Skip to content

Commit 1d6d393

Browse files
committed
php: version 0.3.4: supported Windows building
1 parent 293ff79 commit 1d6d393

11 files changed

Lines changed: 56 additions & 48 deletions

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
msgpack extension changelog
22

3+
Version 0.3.4
4+
-------------
5+
* Support PHP 5.3.x version on Windows.
6+
(note: NAN and Resource is failed)
7+
38
Version 0.3.3
49
-------------
510
* Update msgpack header files.

config.w32

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// $Id$
22
// vim:ft=javascript
33

4-
// If your extension references something external, use ARG_WITH
5-
// ARG_WITH("msgpack", "for msgpack support", "no");
4+
ARG_ENABLE("msgpack", "for msgpack support", "yes");
65

76
if (PHP_MSGPACK != "no") {
8-
EXTENSION("msgpack", "msgpack.c msgpack_pack.c msgpack_unpack.c msgpack_class.c");
7+
EXTENSION("msgpack", "msgpack.c", PHP_MSGPACK_SHARED, "");
8+
ADD_SOURCES(configure_module_dirname, "msgpack_pack.c msgpack_unpack.c msgpack_class.c", "msgpack");
99
}

msgpack/pack_template.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,17 +635,17 @@ if(sizeof(unsigned long long) == 2) {
635635
msgpack_pack_inline_func(_float)(msgpack_pack_user x, float d)
636636
{
637637
union { float f; uint32_t i; } mem;
638-
mem.f = d;
639638
unsigned char buf[5];
639+
mem.f = d;
640640
buf[0] = 0xca; _msgpack_store32(&buf[1], mem.i);
641641
msgpack_pack_append_buffer(x, buf, 5);
642642
}
643643

644644
msgpack_pack_inline_func(_double)(msgpack_pack_user x, double d)
645645
{
646646
union { double f; uint64_t i; } mem;
647-
mem.f = d;
648647
unsigned char buf[9];
648+
mem.f = d;
649649
buf[0] = 0xcb; _msgpack_store64(&buf[1], mem.i);
650650
msgpack_pack_append_buffer(x, buf, 9);
651651
}

msgpack/unpack_template.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ msgpack_unpack_func(msgpack_unpack_object, _data)(msgpack_unpack_struct(_context
9696

9797
msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const char* data, size_t len, size_t* off)
9898
{
99+
#ifndef _MSC_VER
99100
assert(len >= *off);
101+
#endif
100102

101103
const unsigned char* p = (unsigned char*)data + *off;
102104
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
105107
unsigned int trail = ctx->trail;
106108
unsigned int cs = ctx->cs;
107109
unsigned int top = ctx->top;
110+
111+
int ret;
112+
108113
msgpack_unpack_struct(_stack)* stack = ctx->stack;
109114
/*
110115
unsigned int stack_size = ctx->stack_size;
@@ -114,8 +119,6 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
114119
msgpack_unpack_object obj;
115120
msgpack_unpack_struct(_stack)* c = NULL;
116121

117-
int ret;
118-
119122
#define push_simple_value(func) \
120123
if(msgpack_unpack_callback(func)(user, &obj) < 0) { goto _failed; } \
121124
goto _push

msgpack_class.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static zend_object_value php_msgpack_unpacker_new(
258258
/* MessagePack */
259259
static ZEND_METHOD(msgpack, __construct)
260260
{
261-
bool php_only = MSGPACK_G(php_only);
261+
zend_bool php_only = MSGPACK_G(php_only);
262262
MSGPACK_BASE_OBJECT;
263263

264264
if (zend_parse_parameters(
@@ -369,7 +369,7 @@ static ZEND_METHOD(msgpack, unpacker)
369369
/* MessagePackUnpacker */
370370
static ZEND_METHOD(msgpack_unpacker, __construct)
371371
{
372-
bool php_only = MSGPACK_G(php_only);
372+
zend_bool php_only = MSGPACK_G(php_only);
373373
MSGPACK_UNPACKER_OBJECT;
374374

375375
if (zend_parse_parameters(

msgpack_pack.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ inline static void msgpack_serialize_class(
231231
}
232232

233233
inline static void msgpack_serialize_array(
234-
smart_str *buf, zval *val, HashTable *var_hash, bool object,
234+
smart_str *buf, zval *val, HashTable *var_hash, zend_bool object,
235235
char* class_name, zend_uint name_len, zend_bool incomplete_class TSRMLS_DC)
236236
{
237237
HashTable *ht;
238238
size_t n;
239-
bool hash = true;
239+
zend_bool hash = 1;
240240

241241
if (object)
242242
{
@@ -283,12 +283,12 @@ inline static void msgpack_serialize_array(
283283
else
284284
{
285285
msgpack_pack_array(buf, n);
286-
hash = false;
286+
hash = 0;
287287
}
288288
}
289289
else if (n == 0)
290290
{
291-
hash = false;
291+
hash = 0;
292292
msgpack_pack_array(buf, n);
293293
}
294294
else
@@ -367,8 +367,6 @@ inline static void msgpack_serialize_array(
367367
Z_ARRVAL_PP(data)->nApplyCount++;
368368
}
369369

370-
//php_var_dump(data, 1 TSRMLS_CC); //hoge
371-
372370
msgpack_serialize_zval(buf, *data, var_hash TSRMLS_CC);
373371

374372
if (Z_TYPE_PP(data) == IS_ARRAY)
@@ -471,7 +469,7 @@ inline static void msgpack_serialize_object(
471469
}
472470

473471
msgpack_serialize_array(
474-
buf, val, var_hash, true,
472+
buf, val, var_hash, 1,
475473
class_name, name_len, incomplete_class TSRMLS_CC);
476474
}
477475

@@ -541,7 +539,7 @@ void msgpack_serialize_zval(
541539
break;
542540
case IS_ARRAY:
543541
msgpack_serialize_array(
544-
buf, val, var_hash, false, NULL, 0, 0 TSRMLS_CC);
542+
buf, val, var_hash, 0, NULL, 0, 0 TSRMLS_CC);
545543
break;
546544
case IS_OBJECT:
547545
{

msgpack_unpack.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ typedef struct
2222
void *next;
2323
} var_entries;
2424

25-
#define MSGPACK_UNSERIALIZE_ALLOC_STACK(_unpack) \
26-
if (_unpack->deps <= 0) { \
27-
*obj = _unpack->retval; \
28-
msgpack_stack_push(_unpack->var_hash, obj, false); \
29-
} else { \
30-
ALLOC_INIT_ZVAL(*obj); \
31-
msgpack_stack_push(_unpack->var_hash, obj, true); \
25+
#define MSGPACK_UNSERIALIZE_ALLOC_STACK(_unpack) \
26+
if (_unpack->deps <= 0) { \
27+
*obj = _unpack->retval; \
28+
msgpack_stack_push(_unpack->var_hash, obj, 0); \
29+
} else { \
30+
ALLOC_INIT_ZVAL(*obj); \
31+
msgpack_stack_push(_unpack->var_hash, obj, 1); \
3232
}
3333

3434
#define MSGPACK_UNSERIALIZE_ALLOC_VALUE(_unpack) \
@@ -42,9 +42,8 @@ typedef struct
4242

4343
#define MSGPACK_UNSERIALIZE_FINISH_ITEM(_unpack, _count) \
4444
msgpack_stack_pop(_unpack->var_hash, _count); \
45-
long deps = _unpack->deps - 1; \
46-
_unpack->stack[deps]--; \
47-
if (_unpack->stack[deps] == 0) { \
45+
_unpack->stack[_unpack->deps-1]--; \
46+
if (_unpack->stack[_unpack->deps-1] == 0) { \
4847
_unpack->deps--; \
4948
}
5049

@@ -118,7 +117,7 @@ inline static int msgpack_var_access(
118117
}
119118

120119
inline static void msgpack_stack_push(
121-
php_unserialize_data_t *var_hashx, zval **rval, bool save)
120+
php_unserialize_data_t *var_hashx, zval **rval, zend_bool save)
122121
{
123122
var_entries *var_hash, *prev = NULL;
124123

@@ -197,7 +196,7 @@ inline static zend_class_entry* msgpack_unserialize_class(
197196
zval **container, char *class_name, size_t name_len)
198197
{
199198
zend_class_entry *ce, **pce;
200-
bool incomplete_class = false;
199+
zend_bool incomplete_class = 0;
201200
zval *user_func, *retval_ptr, **args[1], *arg_func_name;
202201
TSRMLS_FETCH();
203202

@@ -262,7 +261,7 @@ inline static zend_class_entry* msgpack_unserialize_class(
262261
"it was called for", __FUNCTION__, class_name);
263262
}
264263

265-
incomplete_class = true;
264+
incomplete_class = 1;
266265
ce = PHP_IC_ENTRY;
267266
}
268267

@@ -299,7 +298,8 @@ void msgpack_unserialize_var_init(php_unserialize_data_t *var_hashx)
299298
var_hashx->first_dtor = 0;
300299
}
301300

302-
void msgpack_unserialize_var_destroy(php_unserialize_data_t *var_hashx, bool err)
301+
void msgpack_unserialize_var_destroy(
302+
php_unserialize_data_t *var_hashx, zend_bool err)
303303
{
304304
void *next;
305305
long i;
@@ -529,10 +529,12 @@ int msgpack_unserialize_map(
529529
int msgpack_unserialize_map_item(
530530
msgpack_unserialize_data *unpack, zval **container, zval *key, zval *val)
531531
{
532+
long deps;
532533
TSRMLS_FETCH();
533534

534535
if (MSGPACK_G(php_only))
535536
{
537+
zend_class_entry *ce;
536538
if (Z_TYPE_P(key) == IS_NULL)
537539
{
538540
unpack->type = MSGPACK_SERIALIZE_TYPE_NONE;
@@ -556,7 +558,7 @@ int msgpack_unserialize_map_item(
556558
}
557559
else if (Z_TYPE_P(val) == IS_STRING)
558560
{
559-
zend_class_entry *ce = msgpack_unserialize_class(
561+
ce = msgpack_unserialize_class(
560562
container, Z_STRVAL_P(val), Z_STRLEN_P(val));
561563

562564
if (ce == NULL)
@@ -575,7 +577,7 @@ int msgpack_unserialize_map_item(
575577
{
576578
unpack->type = MSGPACK_SERIALIZE_TYPE_NONE;
577579

578-
zend_class_entry *ce = msgpack_unserialize_class(
580+
ce = msgpack_unserialize_class(
579581
container, Z_STRVAL_P(key), Z_STRLEN_P(key));
580582

581583
if (ce == NULL)
@@ -698,7 +700,7 @@ int msgpack_unserialize_map_item(
698700
zval_ptr_dtor(&key);
699701
msgpack_stack_pop(unpack->var_hash, 2);
700702

701-
long deps = unpack->deps - 1;
703+
deps = unpack->deps - 1;
702704
unpack->stack[deps]--;
703705
if (unpack->stack[deps] == 0)
704706
{

msgpack_unpack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ typedef struct {
2626

2727
void msgpack_unserialize_var_init(php_unserialize_data_t *var_hashx);
2828
void msgpack_unserialize_var_destroy(
29-
php_unserialize_data_t *var_hashx, bool err);
29+
php_unserialize_data_t *var_hashx, zend_bool err);
3030

3131
void msgpack_unserialize_init(msgpack_unserialize_data *unpack);
3232

package.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<email>advect@gmail.com</email>
1111
<active>yes</active>
1212
</lead>
13-
<date>2010-12-27</date>
14-
<time>10:30:54</time>
13+
<date>2010-12-28</date>
14+
<time>15:40:02</time>
1515
<version>
16-
<release>0.3.3</release>
17-
<api>0.3.3</api>
16+
<release>0.3.4</release>
17+
<api>0.3.4</api>
1818
</version>
1919
<stability>
2020
<release>beta</release>
@@ -32,17 +32,17 @@
3232
<file md5sum="8cc392f13f5a89d033cf73e612377b95" name="config.m4" role="src" />
3333
<file md5sum="712ddaf861db6e52a7cf4885c6eced70" name="config.w32" role="src" />
3434
<file md5sum="c9216741b72004ddf1a1347398220433" name="msgpack.c" role="src" />
35-
<file md5sum="55455423c25b0a13946809aa5345a160" name="msgpack_class.c" role="src" />
35+
<file md5sum="1b97cb7ae1cb157115ba8df0b3331229" name="msgpack_class.c" role="src" />
3636
<file md5sum="b8eadd32c3eafb67645bb4ffe16f687c" name="msgpack_class.h" role="src" />
37-
<file md5sum="20c46a37124113e6f6a45df46e5496ba" name="msgpack_pack.c" role="src" />
37+
<file md5sum="d08dda734f564bda69136293aac67c9f" name="msgpack_pack.c" role="src" />
3838
<file md5sum="eae6797621ca53f8a7b0c2d9cb8a4d21" name="msgpack_pack.h" role="src" />
39-
<file md5sum="b965b77a1732e78361a9037ad46ac976" name="msgpack_unpack.c" role="src" />
40-
<file md5sum="57657b955720eedcad10c2e510f2c825" name="msgpack_unpack.h" role="src" />
41-
<file md5sum="714bca7f7e5e1ef9e6d190e72ca04cad" name="php_msgpack.h" role="src" />
39+
<file md5sum="163d17e17abc50915668c64145283049" name="msgpack_unpack.c" role="src" />
40+
<file md5sum="1a31c49f353c8deec86affd1564909d1" name="msgpack_unpack.h" role="src" />
41+
<file md5sum="9c3b5db959fbd5df57f2c2af8e69eaef" name="php_msgpack.h" role="src" />
4242
<file md5sum="82079e9a298ecdda2122757ddfbf576e" name="msgpack/pack_define.h" role="src" />
43-
<file md5sum="634c90d15cba0aa0cb0bd7f4fbef114d" name="msgpack/pack_template.h" role="src" />
43+
<file md5sum="af3f5ca341be55d866fe151c45186d22" name="msgpack/pack_template.h" role="src" />
4444
<file md5sum="09510085da29090ea0f3919c2e708f46" name="msgpack/unpack_define.h" role="src" />
45-
<file md5sum="cf387b1971d55b529593fcbc7972ced4" name="msgpack/unpack_template.h" role="src" />
45+
<file md5sum="61cd2025a8357329430154bd3e568be9" name="msgpack/unpack_template.h" role="src" />
4646
<file md5sum="5eea4af1097495efab534b174c16d939" name="msgpack/sysdep.h" role="src" />
4747
<file md5sum="2e346ebe243e8b770ed01f56d9f886ba" name="msgpack/version.h" role="src" />
4848
<file md5sum="237eda031928a5546bdb92a34815830f" name="tests/001.phpt" role="test" />

php-msgpack.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Summary: PHP extension for interfacing with MessagePack
55
Name: php-msgpack
6-
Version: 0.3.3
6+
Version: 0.3.4
77
Release: 1%{?dist}
88
Source: php-msgpack-%{version}.tar.gz
99
License: New BSD License

0 commit comments

Comments
 (0)