1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-29 05:38:00 +00:00

- Update to 2012.05.05

- Official version of the code has been integrated into the MessagePack project

PR:		ports/169261
Submitted by:	Valery Komarov <komarov@valerka.net> (maintainer)
Obtained from:	https://github.com/msgpack/msgpack/tree/master/php/
This commit is contained in:
Michael Scheidell 2012-06-25 11:08:24 +00:00
parent 69f2c4c57e
commit 7635814ed6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=299940
12 changed files with 11 additions and 479 deletions

View File

@ -6,16 +6,21 @@
#
PORTNAME= msgpack
PORTVERSION= 0.5.4
PORTVERSION= 2012.05.05
CATEGORIES= devel
MASTER_SITES= http://php-msgpack.googlecode.com/files/
MASTER_SITES= http://github.com/${GITHUB_USER}/${GITHUB_REPO}/tarball/${GITVERSION}/
PKGNAMEPREFIX= php5-
DISTNAME= php-msgpack-0.5.3
DISTNAME= msgpack-msgpack-${GITVERSION}
MAINTAINER= komarov@valerka.net
COMMENT= PHP extension for interfacing with MessagePack
WRKSRC= ${WRKDIR}/php-msgpack
WRKSRC= ${WRKDIR}/msgpack-msgpack-${GITVERSION}/php
GITHUB_USER= msgpack
GITHUB_REPO= msgpack
GITVERSION= 980a652
FETCH_ARGS= -pRr
USE_PHP= session
USE_PHP_BUILD= yes

View File

@ -1,2 +1,2 @@
SHA256 (php-msgpack-0.5.3.tar.gz) = 9eb0fb03b66bab5994607c7bc1f7aef9a738af173e6e4f65965a2c2ad8e6336c
SIZE (php-msgpack-0.5.3.tar.gz) = 86591
SHA256 (msgpack-msgpack-980a652.tar.gz) = 0a293eeb110fd24bd42bae5d35bab82a6bfc796ac62f793f47c14a2ce1da5b4d
SIZE (msgpack-msgpack-980a652.tar.gz) = 224300

View File

@ -1,72 +0,0 @@
--- ./msgpack.c.orig 2011-10-31 10:15:40.000000000 +0400
+++ ./msgpack.c 2012-05-28 15:06:00.763502625 +0400
@@ -141,11 +141,15 @@
PS_SERIALIZER_ENCODE_FUNC(msgpack)
{
smart_str buf = {0};
- php_serialize_data_t var_hash;
+ msgpack_serialize_data_t var_hash;
PHP_VAR_SERIALIZE_INIT(var_hash);
+#if PHP_API_VERSION < 20100412
msgpack_serialize_zval(&buf, PS(http_session_vars), &var_hash TSRMLS_CC);
+#else
+ msgpack_serialize_zval(&buf, PS(http_session_vars), var_hash TSRMLS_CC);
+#endif
if (newlen)
{
@@ -172,7 +176,7 @@
zval **value;
size_t off = 0;
msgpack_unpack_t mp;
- php_unserialize_data_t var_hash;
+ msgpack_unserialize_data_t var_hash;
ALLOC_INIT_ZVAL(tmp);
@@ -181,7 +185,7 @@
msgpack_unserialize_var_init(&var_hash);
mp.user.retval = (zval *)tmp;
- mp.user.var_hash = (php_unserialize_data_t *)&var_hash;
+ mp.user.var_hash = (msgpack_unserialize_data_t *)&var_hash;
ret = template_execute(&mp, (char *)val, (size_t)vallen, &off);
@@ -224,11 +228,15 @@
PHP_MSGPACK_API void php_msgpack_serialize(smart_str *buf, zval *val TSRMLS_DC)
{
- php_serialize_data_t var_hash;
+ msgpack_serialize_data_t var_hash;
PHP_VAR_SERIALIZE_INIT(var_hash);
+#if PHP_API_VERSION < 20100412
msgpack_serialize_zval(buf, val, &var_hash TSRMLS_CC);
+#else
+ msgpack_serialize_zval(buf, val, var_hash TSRMLS_CC);
+#endif
PHP_VAR_SERIALIZE_DESTROY(var_hash);
}
@@ -239,7 +247,7 @@
int ret;
size_t off = 0;
msgpack_unpack_t mp;
- php_unserialize_data_t var_hash;
+ msgpack_unserialize_data_t var_hash;
if (str_len <= 0)
{
@@ -251,7 +259,7 @@
msgpack_unserialize_var_init(&var_hash);
mp.user.retval = (zval *)return_value;
- mp.user.var_hash = (php_unserialize_data_t *)&var_hash;
+ mp.user.var_hash = (msgpack_unserialize_data_t *)&var_hash;
ret = template_execute(&mp, str, (size_t)str_len, &off);

View File

@ -1,11 +0,0 @@
--- ./msgpack/pack_template.h.orig 2011-10-06 05:03:16.000000000 +0400
+++ ./msgpack/pack_template.h 2012-05-28 15:06:00.762504244 +0400
@@ -728,7 +728,7 @@
msgpack_pack_inline_func(_raw)(msgpack_pack_user x, size_t l)
{
if(l < 32) {
- unsigned char d = 0xa0 | (uint8_t)l;
+ unsigned char d = 0xa0 | l;
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1);
} else if(l < 65536) {
unsigned char buf[3];

View File

@ -1,170 +0,0 @@
--- ./msgpack/sysdep.h.orig 2011-10-06 05:01:16.000000000 +0400
+++ ./msgpack/sysdep.h 2012-05-28 15:06:00.762504244 +0400
@@ -36,20 +36,20 @@
#include <stdbool.h>
#endif
+
#ifdef _WIN32
-#define _msgpack_atomic_counter_header <windows.h>
typedef long _msgpack_atomic_counter_t;
#define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr)
#define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr)
-#elif defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41)
-#define _msgpack_atomic_counter_header "gcc_atomic.h"
#else
typedef unsigned int _msgpack_atomic_counter_t;
#define _msgpack_sync_decr_and_fetch(ptr) __sync_sub_and_fetch(ptr, 1)
#define _msgpack_sync_incr_and_fetch(ptr) __sync_add_and_fetch(ptr, 1)
#endif
+
#ifdef _WIN32
+#include <winsock2.h>
#ifdef __cplusplus
/* numeric_limits<T>::min,max */
@@ -70,45 +70,15 @@
#define __LITTLE_ENDIAN__
#elif __BYTE_ORDER == __BIG_ENDIAN
#define __BIG_ENDIAN__
-#elif _WIN32
-#define __LITTLE_ENDIAN__
#endif
#endif
-
#ifdef __LITTLE_ENDIAN__
-#ifdef _WIN32
-# if defined(ntohs)
-# define _msgpack_be16(x) ntohs(x)
-# elif defined(_byteswap_ushort) || (defined(_MSC_VER) && _MSC_VER >= 1400)
-# define _msgpack_be16(x) ((uint16_t)_byteswap_ushort((unsigned short)x))
-# else
-# define _msgpack_be16(x) ( \
- ((((uint16_t)x) << 8) ) | \
- ((((uint16_t)x) >> 8) ) )
-# endif
-#else
-# define _msgpack_be16(x) ntohs(x)
-#endif
-
-#ifdef _WIN32
-# if defined(ntohl)
-# define _msgpack_be32(x) ntohl(x)
-# elif defined(_byteswap_ulong) || (defined(_MSC_VER) && _MSC_VER >= 1400)
-# define _msgpack_be32(x) ((uint32_t)_byteswap_ulong((unsigned long)x))
-# else
-# define _msgpack_be32(x) \
- ( ((((uint32_t)x) << 24) ) | \
- ((((uint32_t)x) << 8) & 0x00ff0000U ) | \
- ((((uint32_t)x) >> 8) & 0x0000ff00U ) | \
- ((((uint32_t)x) >> 24) ) )
-# endif
-#else
-# define _msgpack_be32(x) ntohl(x)
-#endif
+#define _msgpack_be16(x) ntohs(x)
+#define _msgpack_be32(x) ntohl(x)
-#if defined(_byteswap_uint64) || (defined(_MSC_VER) && _MSC_VER >= 1400)
+#if defined(_byteswap_uint64) || _MSC_VER >= 1400
# define _msgpack_be64(x) (_byteswap_uint64(x))
#elif defined(bswap_64)
# define _msgpack_be64(x) bswap_64(x)
@@ -116,79 +86,34 @@
# define _msgpack_be64(x) __DARWIN_OSSwapInt64(x)
#else
#define _msgpack_be64(x) \
- ( ((((uint64_t)x) << 56) ) | \
- ((((uint64_t)x) << 40) & 0x00ff000000000000ULL ) | \
- ((((uint64_t)x) << 24) & 0x0000ff0000000000ULL ) | \
- ((((uint64_t)x) << 8) & 0x000000ff00000000ULL ) | \
- ((((uint64_t)x) >> 8) & 0x00000000ff000000ULL ) | \
- ((((uint64_t)x) >> 24) & 0x0000000000ff0000ULL ) | \
- ((((uint64_t)x) >> 40) & 0x000000000000ff00ULL ) | \
- ((((uint64_t)x) >> 56) ) )
+ ( ((((uint64_t)x) << 56) & 0xff00000000000000ULL ) | \
+ ((((uint64_t)x) << 40) & 0x00ff000000000000ULL ) | \
+ ((((uint64_t)x) << 24) & 0x0000ff0000000000ULL ) | \
+ ((((uint64_t)x) << 8) & 0x000000ff00000000ULL ) | \
+ ((((uint64_t)x) >> 8) & 0x00000000ff000000ULL ) | \
+ ((((uint64_t)x) >> 24) & 0x0000000000ff0000ULL ) | \
+ ((((uint64_t)x) >> 40) & 0x000000000000ff00ULL ) | \
+ ((((uint64_t)x) >> 56) & 0x00000000000000ffULL ) )
#endif
-#define _msgpack_load16(cast, from) ((cast)( \
- (((uint16_t)((uint8_t*)(from))[0]) << 8) | \
- (((uint16_t)((uint8_t*)(from))[1]) ) ))
-
-#define _msgpack_load32(cast, from) ((cast)( \
- (((uint32_t)((uint8_t*)(from))[0]) << 24) | \
- (((uint32_t)((uint8_t*)(from))[1]) << 16) | \
- (((uint32_t)((uint8_t*)(from))[2]) << 8) | \
- (((uint32_t)((uint8_t*)(from))[3]) ) ))
-
-#define _msgpack_load64(cast, from) ((cast)( \
- (((uint64_t)((uint8_t*)(from))[0]) << 56) | \
- (((uint64_t)((uint8_t*)(from))[1]) << 48) | \
- (((uint64_t)((uint8_t*)(from))[2]) << 40) | \
- (((uint64_t)((uint8_t*)(from))[3]) << 32) | \
- (((uint64_t)((uint8_t*)(from))[4]) << 24) | \
- (((uint64_t)((uint8_t*)(from))[5]) << 16) | \
- (((uint64_t)((uint8_t*)(from))[6]) << 8) | \
- (((uint64_t)((uint8_t*)(from))[7]) ) ))
-
#else
-
#define _msgpack_be16(x) (x)
#define _msgpack_be32(x) (x)
#define _msgpack_be64(x) (x)
-
-#define _msgpack_load16(cast, from) ((cast)( \
- (((uint16_t)((uint8_t*)from)[1]) << 8) | \
- (((uint16_t)((uint8_t*)from)[0]) ) ))
-
-#define _msgpack_load32(cast, from) ((cast)( \
- (((uint32_t)((uint8_t*)from)[3]) << 24) | \
- (((uint32_t)((uint8_t*)from)[2]) << 16) | \
- (((uint32_t)((uint8_t*)from)[1]) << 8) | \
- (((uint32_t)((uint8_t*)from)[0]) ) ))
-
-#define _msgpack_load64(cast, from) ((cast)( \
- (((uint64_t)((uint8_t*)from)[7]) << 56) | \
- (((uint64_t)((uint8_t*)from)[6]) << 48) | \
- (((uint64_t)((uint8_t*)from)[5]) << 40) | \
- (((uint64_t)((uint8_t*)from)[4]) << 32) | \
- (((uint64_t)((uint8_t*)from)[3]) << 24) | \
- (((uint64_t)((uint8_t*)from)[2]) << 16) | \
- (((uint64_t)((uint8_t*)from)[1]) << 8) | \
- (((uint64_t)((uint8_t*)from)[0]) ) ))
#endif
#define _msgpack_store16(to, num) \
- do { uint16_t val = _msgpack_be16(num); memcpy(to, &val, 2); } while(0)
+ do { uint16_t val = _msgpack_be16(num); memcpy(to, &val, 2); } while(0);
#define _msgpack_store32(to, num) \
- do { uint32_t val = _msgpack_be32(num); memcpy(to, &val, 4); } while(0)
+ do { uint32_t val = _msgpack_be32(num); memcpy(to, &val, 4); } while(0);
#define _msgpack_store64(to, num) \
- do { uint64_t val = _msgpack_be64(num); memcpy(to, &val, 8); } while(0)
+ do { uint64_t val = _msgpack_be64(num); memcpy(to, &val, 8); } while(0);
-/*
-#define _msgpack_load16(cast, from) \
- ({ cast val; memcpy(&val, (char*)from, 2); _msgpack_be16(val); })
-#define _msgpack_load32(cast, from) \
- ({ cast val; memcpy(&val, (char*)from, 4); _msgpack_be32(val); })
-#define _msgpack_load64(cast, from) \
- ({ cast val; memcpy(&val, (char*)from, 8); _msgpack_be64(val); })
-*/
+
+#define _msgpack_load16(cast, from) ((cast)_msgpack_be16(*(uint16_t*)from))
+#define _msgpack_load32(cast, from) ((cast)_msgpack_be32(*(uint32_t*)from))
+#define _msgpack_load64(cast, from) ((cast)_msgpack_be64(*(uint64_t*)from))
#endif /* msgpack/sysdep.h */

View File

@ -1,11 +0,0 @@
--- ./msgpack/version.h.orig 2011-10-06 05:01:43.000000000 +0400
+++ ./msgpack/version.h 2012-05-28 15:06:00.763502625 +0400
@@ -27,7 +27,7 @@
int msgpack_version_major(void);
int msgpack_version_minor(void);
-#define MSGPACK_VERSION "0.5.7"
+#define MSGPACK_VERSION "0.5.4"
#define MSGPACK_VERSION_MAJOR 0
#define MSGPACK_VERSION_MINOR 5

View File

@ -1,90 +0,0 @@
--- ./msgpack_class.c.orig 2011-11-01 05:15:37.000000000 +0400
+++ ./msgpack_class.c 2012-05-28 15:06:00.763502625 +0400
@@ -19,7 +19,7 @@
zval *retval;
long offset;
msgpack_unpack_t mp;
- php_unserialize_data_t var_hash;
+ msgpack_unserialize_data_t var_hash;
long php_only;
zend_bool finished;
int error;
@@ -188,8 +188,10 @@
static zend_object_value php_msgpack_base_new(zend_class_entry *ce TSRMLS_DC)
{
zend_object_value retval;
- zval *tmp;
php_msgpack_base_t *base;
+#if PHP_API_VERSION < 20100412
+ zval *tmp;
+#endif
base = emalloc(sizeof(php_msgpack_base_t));
@@ -201,9 +203,13 @@
base->object.ce = ce;
#endif
+#if PHP_API_VERSION < 20100412
zend_hash_copy(
base->object.properties, &ce->default_properties,
(copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *));
+#else
+ object_properties_init(&base->object, ce);
+#endif
retval.handle = zend_objects_store_put(
base, (zend_objects_store_dtor_t)zend_objects_destroy_object,
@@ -233,8 +239,10 @@
zend_class_entry *ce TSRMLS_DC)
{
zend_object_value retval;
- zval *tmp;
php_msgpack_unpacker_t *unpacker;
+#if PHP_API_VERSION < 20100412
+ zval *tmp;
+#endif
unpacker = emalloc(sizeof(php_msgpack_unpacker_t));
@@ -246,9 +254,13 @@
unpacker->object.ce = ce;
#endif
+#if PHP_API_VERSION < 20100412
zend_hash_copy(
unpacker->object.properties, &ce->default_properties,
(copy_ctor_func_t)zval_add_ref, (void *)&tmp, sizeof(zval *));
+#else
+ object_properties_init(&unpacker->object, ce);
+#endif
retval.handle = zend_objects_store_put(
unpacker, (zend_objects_store_dtor_t)zend_objects_destroy_object,
@@ -410,7 +422,7 @@
msgpack_unserialize_var_init(&unpacker->var_hash);
(&unpacker->mp)->user.var_hash =
- (php_unserialize_data_t *)&unpacker->var_hash;
+ (msgpack_unserialize_data_t *)&unpacker->var_hash;
}
static ZEND_METHOD(msgpack_unpacker, __destruct)
@@ -533,7 +545,7 @@
msgpack_unserialize_var_init(&unpacker->var_hash);
(&unpacker->mp)->user.var_hash =
- (php_unserialize_data_t *)&unpacker->var_hash;
+ (msgpack_unserialize_data_t *)&unpacker->var_hash;
}
(&unpacker->mp)->user.retval = (zval *)unpacker->retval;
@@ -649,7 +661,7 @@
msgpack_unserialize_var_init(&unpacker->var_hash);
(&unpacker->mp)->user.var_hash =
- (php_unserialize_data_t *)&unpacker->var_hash;
+ (msgpack_unserialize_data_t *)&unpacker->var_hash;
}
void msgpack_init_class()

View File

@ -1,11 +0,0 @@
--- ./msgpack_pack.c.orig 2011-10-31 10:07:38.000000000 +0400
+++ ./msgpack_pack.c 2012-05-28 15:06:00.764503031 +0400
@@ -439,7 +439,7 @@
msgpack_pack_nil(buf);
msgpack_pack_long(buf, MSGPACK_SERIALIZE_TYPE_CUSTOM_OBJECT);
- msgpack_serialize_string(buf, ce->name, ce->name_length);
+ msgpack_serialize_string(buf, (char *)ce->name, ce->name_length);
msgpack_pack_raw(buf, serialized_length);
msgpack_pack_raw_body(buf, serialized_data, serialized_length);
}

View File

@ -1,17 +0,0 @@
--- ./msgpack_pack.h.orig 2011-07-27 09:50:36.000000000 +0400
+++ ./msgpack_pack.h 2012-05-28 15:06:00.764503031 +0400
@@ -2,7 +2,13 @@
#ifndef MSGPACK_PACK_H
#define MSGPACK_PACK_H
-#include "ext/standard/php_smart_str.h"
+#include "ext/standard/php_var.h"
+
+#if PHP_API_VERSION < 20100412
+#define msgpack_serialize_data_t HashTable
+#else
+typedef HashTable* msgpack_serialize_data_t;
+#endif
enum msgpack_serialize_type
{

View File

@ -1,55 +0,0 @@
--- ./msgpack_unpack.c.orig 2011-11-02 14:17:41.000000000 +0400
+++ ./msgpack_unpack.c 2012-05-28 15:06:00.765503368 +0400
@@ -54,7 +54,7 @@
MSGPACK_UNSERIALIZE_FINISH_ITEM(_unpack, 2);
inline static void msgpack_var_push(
- php_unserialize_data_t *var_hashx, zval **rval)
+ msgpack_unserialize_data_t *var_hashx, zval **rval)
{
var_entries *var_hash, *prev = NULL;
@@ -91,7 +91,7 @@
}
inline static int msgpack_var_access(
- php_unserialize_data_t *var_hashx, long id, zval ***store)
+ msgpack_unserialize_data_t *var_hashx, long id, zval ***store)
{
var_entries *var_hash = var_hashx->first;
@@ -118,7 +118,7 @@
}
inline static void msgpack_stack_push(
- php_unserialize_data_t *var_hashx, zval **rval, zend_bool save)
+ msgpack_unserialize_data_t *var_hashx, zval **rval, zend_bool save)
{
var_entries *var_hash, *prev = NULL;
@@ -162,7 +162,7 @@
}
inline static void msgpack_stack_pop(
- php_unserialize_data_t *var_hashx, long count)
+ msgpack_unserialize_data_t *var_hashx, long count)
{
long i;
var_entries *var_hash = var_hashx->first_dtor;
@@ -280,14 +280,14 @@
return ce;
}
-void msgpack_unserialize_var_init(php_unserialize_data_t *var_hashx)
+void msgpack_unserialize_var_init(msgpack_unserialize_data_t *var_hashx)
{
var_hashx->first = 0;
var_hashx->first_dtor = 0;
}
void msgpack_unserialize_var_destroy(
- php_unserialize_data_t *var_hashx, zend_bool err)
+ msgpack_unserialize_data_t *var_hashx, zend_bool err)
{
void *next;
long i;

View File

@ -1,25 +0,0 @@
--- ./msgpack_unpack.h.orig 2011-07-27 09:50:36.000000000 +0400
+++ ./msgpack_unpack.h 2012-05-28 15:06:00.765503368 +0400
@@ -16,17 +16,19 @@
MSGPACK_UNPACK_PARSE_ERROR = -1,
} msgpack_unpack_return;
+typedef struct php_unserialize_data msgpack_unserialize_data_t;
+
typedef struct {
zval *retval;
long deps;
- php_unserialize_data_t *var_hash;
+ msgpack_unserialize_data_t *var_hash;
long stack[MSGPACK_EMBED_STACK_SIZE];
int type;
} msgpack_unserialize_data;
-void msgpack_unserialize_var_init(php_unserialize_data_t *var_hashx);
+void msgpack_unserialize_var_init(msgpack_unserialize_data_t *var_hashx);
void msgpack_unserialize_var_destroy(
- php_unserialize_data_t *var_hashx, zend_bool err);
+ msgpack_unserialize_data_t *var_hashx, zend_bool err);
void msgpack_unserialize_init(msgpack_unserialize_data *unpack);

View File

@ -1,11 +0,0 @@
--- ./php_msgpack.h.orig 2011-10-31 05:25:28.000000000 +0400
+++ ./php_msgpack.h 2012-05-28 15:06:00.766503914 +0400
@@ -2,7 +2,7 @@
#ifndef PHP_MSGPACK_H
#define PHP_MSGPACK_H
-#define MSGPACK_EXTENSION_VERSION "0.5.3"
+#define MSGPACK_EXTENSION_VERSION "0.5.4"
#include "ext/standard/php_smart_str.h"