Skip to content

Commit 3744ff7

Browse files
committed
Merge pull request #1 from weltling/string_size_refactor_take_2
windows fixes
2 parents f4c4fe4 + 8db3e37 commit 3744ff7

File tree

11 files changed

+21
-15
lines changed

11 files changed

+21
-15
lines changed

ext/spl/php_spl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ PHP_FUNCTION(spl_autoload_call)
415415
zval *class_name, *retval = NULL;
416416
int class_name_len;
417417
char *func_name, *lc_name;
418-
uint func_name_len;
418+
zend_str_size_uint func_name_len;
419419
ulong dummy;
420420
HashPosition function_pos;
421421
autoload_func_info *alfi;
@@ -466,7 +466,7 @@ PHP_FUNCTION(spl_autoload_call)
466466
PHP_FUNCTION(spl_autoload_register)
467467
{
468468
char *func_name, *error = NULL;
469-
int func_name_len;
469+
zend_str_size_int func_name_len;
470470
char *lc_name = NULL;
471471
zval *zcallable = NULL;
472472
zend_bool do_throw = 1;
@@ -627,7 +627,7 @@ PHP_FUNCTION(spl_autoload_register)
627627
PHP_FUNCTION(spl_autoload_unregister)
628628
{
629629
char *func_name, *error = NULL;
630-
int func_name_len;
630+
zend_str_size_int func_name_len;
631631
char *lc_name = NULL;
632632
zval *zcallable;
633633
int success = FAILURE;

ext/spl/spl_directory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static zend_object_value spl_filesystem_object_new_check(zend_class_entry *class
183183
/* }}} */
184184

185185

186-
PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, int *len TSRMLS_DC) /* {{{ */
186+
PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, zend_str_size_int *len TSRMLS_DC) /* {{{ */
187187
{
188188
#ifdef HAVE_GLOB
189189
if (intern->type == SPL_FS_DIR) {
@@ -589,7 +589,7 @@ static HashTable* spl_filesystem_object_get_debug_info(zval *obj, int *is_temp T
589589
HashTable *rv;
590590
zval *tmp, zrv;
591591
char *pnstr, *path;
592-
int pnlen, path_len;
592+
zend_str_size_int pnlen, path_len;
593593
char stmp[2];
594594

595595
*is_temp = 1;

ext/spl/spl_dllist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp TSRML
511511
spl_ptr_llist_element *current = intern->llist->head, *next;
512512
zval *tmp, zrv, *dllist_array;
513513
char *pnstr;
514-
int pnlen;
514+
zend_str_size_int pnlen;
515515
int i = 0;
516516

517517
*is_temp = 0;

ext/spl/spl_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ int spl_add_classes(zend_class_entry *pce, zval *list, int sub, int allow, int c
133133
}
134134
/* }}} */
135135

136-
char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, int prop_len, int *name_len TSRMLS_DC) /* {{{ */
136+
char * spl_gen_private_prop_name(zend_class_entry *ce, char *prop_name, zend_str_size_int prop_len, zend_str_size_int *name_len TSRMLS_DC) /* {{{ */
137137
{
138138
char *rv;
139139

ext/spl/spl_heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv
523523
spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(obj TSRMLS_CC);
524524
zval *tmp, zrv, *heap_array;
525525
char *pnstr;
526-
int pnlen;
526+
zend_str_size_int pnlen;
527527
int i;
528528

529529
*is_temp = 0;

ext/spl/spl_observer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp TSRMLS_D
318318
HashPosition pos;
319319
zval *tmp, *storage;
320320
char md5str[33];
321-
int name_len;
321+
zend_str_size_int name_len;
322322
char *zname;
323323

324324
*is_temp = 0;

ext/standard/http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
3434
char *key = NULL;
3535
char *ekey, *newprefix, *p;
3636
int arg_sep_len, ekey_len, key_type, newprefix_len;
37-
uint key_len;
37+
zend_str_size_uint key_len;
3838
ulong idx;
3939
zval **zdata = NULL, *copyzval;
4040

ext/standard/info.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static int php_info_print(const char *str) /* {{{ */
102102
static void php_info_print_stream_hash(const char *name, HashTable *ht TSRMLS_DC) /* {{{ */
103103
{
104104
char *key;
105-
uint len;
105+
zend_str_size_uint len;
106106

107107
if (ht) {
108108
if (zend_hash_num_elements(ht)) {
@@ -196,7 +196,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
196196
{
197197
zval **data, **tmp, tmp2;
198198
char *string_key;
199-
uint string_len;
199+
zend_str_size_uint string_len;
200200
ulong num_key;
201201

202202
zend_is_auto_global(name, name_length TSRMLS_CC);

ext/standard/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ PHP_FUNCTION(strtolower)
14131413
PHPAPI void php_basename(const char *s, zend_str_size_size_t len, char *suffix, zend_str_size_size_t sufflen, char **p_ret, zend_str_size_size_t *p_len TSRMLS_DC)
14141414
{
14151415
char *ret = NULL, *c, *comp, *cend;
1416-
zend_str_size inc_len, cnt;
1416+
zend_str_size_size_t inc_len, cnt;
14171417
int state;
14181418

14191419
c = comp = cend = (char*)s;

win32/build/config.w32

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,3 +449,9 @@ if (PHP_STATIC_ANALYZE == "yes") {
449449
ADD_FLAG("CFLAGS", " /analyze ");
450450
ADD_FLAG("CFLAGS", " /wd6308 ");
451451
}
452+
453+
ARG_ENABLE("zstrlen", "Include Z_STRLEN macros enabling size_t for string length", "no");
454+
if (PHP_ZSTRLEN == "yes") {
455+
AC_DEFINE('ZEND_USE_LEGACY_STRING_TYPES', 1, "");
456+
}
457+

win32/registry.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_
9090
}
9191
INIT_PZVAL(data);
9292
Z_STRVAL_P(data) = zend_strndup(value, value_len-1);
93-
Z_STRLEN_P(data) = value_len-1;
93+
Z_STRSIZE_P(data) = value_len-1;
9494
Z_TYPE_P(data) = IS_STRING;
9595
zend_hash_update(ht, name, name_len+1, &data, sizeof(zval*), NULL);
9696
}
@@ -261,7 +261,7 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC)
261261
zend_hash_get_current_data_ex(ht, (void**)&data, &pos) == SUCCESS &&
262262
zend_hash_get_current_key_ex(ht, &index, &index_len, &num, 0, &pos) == HASH_KEY_IS_STRING;
263263
zend_hash_move_forward_ex(ht, &pos)) {
264-
zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRLEN_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
264+
zend_alter_ini_entry(index, index_len, Z_STRVAL_PP(data), Z_STRSIZE_PP(data), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
265265
}
266266
break;
267267
}

0 commit comments

Comments
 (0)