diff --git a/php/ChangeLog b/php/ChangeLog index d36193b4..83db4914 100644 --- a/php/ChangeLog +++ b/php/ChangeLog @@ -1,5 +1,10 @@ msgpack extension changelog +Version 0.3.4 +------------- + * Support PHP 5.3.x version on Windows. + (note: NAN and Resource is failed) + Version 0.3.3 ------------- * Update msgpack header files. diff --git a/php/config.w32 b/php/config.w32 index 726b75f2..59f51409 100644 --- a/php/config.w32 +++ b/php/config.w32 @@ -1,9 +1,9 @@ // $Id$ // vim:ft=javascript -// If your extension references something external, use ARG_WITH -// ARG_WITH("msgpack", "for msgpack support", "no"); +ARG_ENABLE("msgpack", "for msgpack support", "yes"); if (PHP_MSGPACK != "no") { - EXTENSION("msgpack", "msgpack.c msgpack_pack.c msgpack_unpack.c msgpack_class.c"); + EXTENSION("msgpack", "msgpack.c", PHP_MSGPACK_SHARED, ""); + ADD_SOURCES(configure_module_dirname, "msgpack_pack.c msgpack_unpack.c msgpack_class.c", "msgpack"); } diff --git a/php/msgpack/pack_template.h b/php/msgpack/pack_template.h index da54c364..887a61bf 100644 --- a/php/msgpack/pack_template.h +++ b/php/msgpack/pack_template.h @@ -635,8 +635,8 @@ if(sizeof(unsigned long long) == 2) { msgpack_pack_inline_func(_float)(msgpack_pack_user x, float d) { union { float f; uint32_t i; } mem; - mem.f = d; unsigned char buf[5]; + mem.f = d; buf[0] = 0xca; _msgpack_store32(&buf[1], mem.i); msgpack_pack_append_buffer(x, buf, 5); } @@ -644,8 +644,8 @@ msgpack_pack_inline_func(_float)(msgpack_pack_user x, float d) msgpack_pack_inline_func(_double)(msgpack_pack_user x, double d) { union { double f; uint64_t i; } mem; - mem.f = d; unsigned char buf[9]; + mem.f = d; buf[0] = 0xcb; _msgpack_store64(&buf[1], mem.i); msgpack_pack_append_buffer(x, buf, 9); } diff --git a/php/msgpack/unpack_template.h b/php/msgpack/unpack_template.h index 0fbfbb78..beed4c4c 100644 --- a/php/msgpack/unpack_template.h +++ b/php/msgpack/unpack_template.h @@ -96,7 +96,9 @@ msgpack_unpack_func(msgpack_unpack_object, _data)(msgpack_unpack_struct(_context msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const char* data, size_t len, size_t* off) { +#ifndef _MSC_VER assert(len >= *off); +#endif const unsigned char* p = (unsigned char*)data + *off; const unsigned char* const pe = (unsigned char*)data + len; @@ -105,6 +107,9 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c unsigned int trail = ctx->trail; unsigned int cs = ctx->cs; unsigned int top = ctx->top; + + int ret; + msgpack_unpack_struct(_stack)* stack = ctx->stack; /* unsigned int stack_size = ctx->stack_size; @@ -114,8 +119,6 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c msgpack_unpack_object obj; msgpack_unpack_struct(_stack)* c = NULL; - int ret; - #define push_simple_value(func) \ if(msgpack_unpack_callback(func)(user, &obj) < 0) { goto _failed; } \ goto _push diff --git a/php/msgpack_class.c b/php/msgpack_class.c index dd40333e..903712df 100644 --- a/php/msgpack_class.c +++ b/php/msgpack_class.c @@ -258,7 +258,7 @@ static zend_object_value php_msgpack_unpacker_new( /* MessagePack */ static ZEND_METHOD(msgpack, __construct) { - bool php_only = MSGPACK_G(php_only); + zend_bool php_only = MSGPACK_G(php_only); MSGPACK_BASE_OBJECT; if (zend_parse_parameters( @@ -369,7 +369,7 @@ static ZEND_METHOD(msgpack, unpacker) /* MessagePackUnpacker */ static ZEND_METHOD(msgpack_unpacker, __construct) { - bool php_only = MSGPACK_G(php_only); + zend_bool php_only = MSGPACK_G(php_only); MSGPACK_UNPACKER_OBJECT; if (zend_parse_parameters( diff --git a/php/msgpack_pack.c b/php/msgpack_pack.c index 97ce19ce..36a1ade2 100644 --- a/php/msgpack_pack.c +++ b/php/msgpack_pack.c @@ -231,12 +231,12 @@ inline static void msgpack_serialize_class( } inline static void msgpack_serialize_array( - smart_str *buf, zval *val, HashTable *var_hash, bool object, + smart_str *buf, zval *val, HashTable *var_hash, zend_bool object, char* class_name, zend_uint name_len, zend_bool incomplete_class TSRMLS_DC) { HashTable *ht; size_t n; - bool hash = true; + zend_bool hash = 1; if (object) { @@ -283,12 +283,12 @@ inline static void msgpack_serialize_array( else { msgpack_pack_array(buf, n); - hash = false; + hash = 0; } } else if (n == 0) { - hash = false; + hash = 0; msgpack_pack_array(buf, n); } else @@ -367,8 +367,6 @@ inline static void msgpack_serialize_array( Z_ARRVAL_PP(data)->nApplyCount++; } - //php_var_dump(data, 1 TSRMLS_CC); //hoge - msgpack_serialize_zval(buf, *data, var_hash TSRMLS_CC); if (Z_TYPE_PP(data) == IS_ARRAY) @@ -471,7 +469,7 @@ inline static void msgpack_serialize_object( } msgpack_serialize_array( - buf, val, var_hash, true, + buf, val, var_hash, 1, class_name, name_len, incomplete_class TSRMLS_CC); } @@ -541,7 +539,7 @@ void msgpack_serialize_zval( break; case IS_ARRAY: msgpack_serialize_array( - buf, val, var_hash, false, NULL, 0, 0 TSRMLS_CC); + buf, val, var_hash, 0, NULL, 0, 0 TSRMLS_CC); break; case IS_OBJECT: { diff --git a/php/msgpack_unpack.c b/php/msgpack_unpack.c index 05b2328d..3c8e6ee2 100644 --- a/php/msgpack_unpack.c +++ b/php/msgpack_unpack.c @@ -22,13 +22,13 @@ typedef struct void *next; } var_entries; -#define MSGPACK_UNSERIALIZE_ALLOC_STACK(_unpack) \ - if (_unpack->deps <= 0) { \ - *obj = _unpack->retval; \ - msgpack_stack_push(_unpack->var_hash, obj, false); \ - } else { \ - ALLOC_INIT_ZVAL(*obj); \ - msgpack_stack_push(_unpack->var_hash, obj, true); \ +#define MSGPACK_UNSERIALIZE_ALLOC_STACK(_unpack) \ + if (_unpack->deps <= 0) { \ + *obj = _unpack->retval; \ + msgpack_stack_push(_unpack->var_hash, obj, 0); \ + } else { \ + ALLOC_INIT_ZVAL(*obj); \ + msgpack_stack_push(_unpack->var_hash, obj, 1); \ } #define MSGPACK_UNSERIALIZE_ALLOC_VALUE(_unpack) \ @@ -42,9 +42,8 @@ typedef struct #define MSGPACK_UNSERIALIZE_FINISH_ITEM(_unpack, _count) \ msgpack_stack_pop(_unpack->var_hash, _count); \ - long deps = _unpack->deps - 1; \ - _unpack->stack[deps]--; \ - if (_unpack->stack[deps] == 0) { \ + _unpack->stack[_unpack->deps-1]--; \ + if (_unpack->stack[_unpack->deps-1] == 0) { \ _unpack->deps--; \ } @@ -118,7 +117,7 @@ inline static int msgpack_var_access( } inline static void msgpack_stack_push( - php_unserialize_data_t *var_hashx, zval **rval, bool save) + php_unserialize_data_t *var_hashx, zval **rval, zend_bool save) { var_entries *var_hash, *prev = NULL; @@ -197,7 +196,7 @@ inline static zend_class_entry* msgpack_unserialize_class( zval **container, char *class_name, size_t name_len) { zend_class_entry *ce, **pce; - bool incomplete_class = false; + zend_bool incomplete_class = 0; zval *user_func, *retval_ptr, **args[1], *arg_func_name; TSRMLS_FETCH(); @@ -262,7 +261,7 @@ inline static zend_class_entry* msgpack_unserialize_class( "it was called for", __FUNCTION__, class_name); } - incomplete_class = true; + incomplete_class = 1; ce = PHP_IC_ENTRY; } @@ -299,7 +298,8 @@ void msgpack_unserialize_var_init(php_unserialize_data_t *var_hashx) var_hashx->first_dtor = 0; } -void msgpack_unserialize_var_destroy(php_unserialize_data_t *var_hashx, bool err) +void msgpack_unserialize_var_destroy( + php_unserialize_data_t *var_hashx, zend_bool err) { void *next; long i; @@ -529,10 +529,12 @@ int msgpack_unserialize_map( int msgpack_unserialize_map_item( msgpack_unserialize_data *unpack, zval **container, zval *key, zval *val) { + long deps; TSRMLS_FETCH(); if (MSGPACK_G(php_only)) { + zend_class_entry *ce; if (Z_TYPE_P(key) == IS_NULL) { unpack->type = MSGPACK_SERIALIZE_TYPE_NONE; @@ -556,7 +558,7 @@ int msgpack_unserialize_map_item( } else if (Z_TYPE_P(val) == IS_STRING) { - zend_class_entry *ce = msgpack_unserialize_class( + ce = msgpack_unserialize_class( container, Z_STRVAL_P(val), Z_STRLEN_P(val)); if (ce == NULL) @@ -575,7 +577,7 @@ int msgpack_unserialize_map_item( { unpack->type = MSGPACK_SERIALIZE_TYPE_NONE; - zend_class_entry *ce = msgpack_unserialize_class( + ce = msgpack_unserialize_class( container, Z_STRVAL_P(key), Z_STRLEN_P(key)); if (ce == NULL) @@ -698,7 +700,7 @@ int msgpack_unserialize_map_item( zval_ptr_dtor(&key); msgpack_stack_pop(unpack->var_hash, 2); - long deps = unpack->deps - 1; + deps = unpack->deps - 1; unpack->stack[deps]--; if (unpack->stack[deps] == 0) { diff --git a/php/msgpack_unpack.h b/php/msgpack_unpack.h index 5cc4a5b6..1f7b05e8 100644 --- a/php/msgpack_unpack.h +++ b/php/msgpack_unpack.h @@ -26,7 +26,7 @@ typedef struct { void msgpack_unserialize_var_init(php_unserialize_data_t *var_hashx); void msgpack_unserialize_var_destroy( - php_unserialize_data_t *var_hashx, bool err); + php_unserialize_data_t *var_hashx, zend_bool err); void msgpack_unserialize_init(msgpack_unserialize_data *unpack); diff --git a/php/package.xml b/php/package.xml index 8ad5c533..31a480b6 100644 --- a/php/package.xml +++ b/php/package.xml @@ -10,11 +10,11 @@ advect@gmail.com yes - 2010-12-27 - + 2010-12-28 + - 0.3.3 - 0.3.3 + 0.3.4 + 0.3.4 beta @@ -32,17 +32,17 @@ - + - + - - - + + + - + - + diff --git a/php/php-msgpack.spec b/php/php-msgpack.spec index b3cdd05a..86125cb0 100644 --- a/php/php-msgpack.spec +++ b/php/php-msgpack.spec @@ -3,7 +3,7 @@ Summary: PHP extension for interfacing with MessagePack Name: php-msgpack -Version: 0.3.3 +Version: 0.3.4 Release: 1%{?dist} Source: php-msgpack-%{version}.tar.gz License: New BSD License diff --git a/php/php_msgpack.h b/php/php_msgpack.h index 5010a397..80dce02e 100644 --- a/php/php_msgpack.h +++ b/php/php_msgpack.h @@ -2,7 +2,7 @@ #ifndef PHP_MSGPACK_H #define PHP_MSGPACK_H -#define MSGPACK_EXTENSION_VERSION "0.3.3" +#define MSGPACK_EXTENSION_VERSION "0.3.4" #include "ext/standard/php_smart_str.h"