]> granicus.if.org Git - php/commitdiff
Fixed compilation problems
authorDmitry Stogov <dmitry@zend.com>
Mon, 30 Jun 2014 14:08:16 +0000 (18:08 +0400)
committerDmitry Stogov <dmitry@zend.com>
Mon, 30 Jun 2014 14:08:16 +0000 (18:08 +0400)
ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
ext/intl/idn/idn.c
ext/intl/msgformat/msgformat_helpers.cpp
ext/intl/timezone/timezone_methods.cpp

index 36a3a8d20d3485e3176819dd4f0f57f8337ab108..c13a43260515df141b5c7f4f39586e89c2e4b955 100644 (file)
@@ -217,10 +217,10 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules)
                RETURN_FALSE;
        }
 
-       char *ret_rules = static_cast<char*>(emalloc(rules_len + 1));
-       memcpy(ret_rules, rules, rules_len);
-       ret_rules[rules_len] = '\0';
+       zend_string *ret_rules = STR_ALLOC(rules_len, 0);
+       memcpy(ret_rules->val, rules, rules_len);
+       ret_rules->val[rules_len] = '\0';
 
-       RETURN_STRINGL(ret_rules, rules_len, 0);
+       RETURN_STR(ret_rules);
 }
 #endif
index f59fea494ba41e4e085f52ec4ec39ef23e523f73..5b463ea58ab2f1846eae9b8e8248c59fb5935ccb 100644 (file)
@@ -140,38 +140,39 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
        UIDNA             *uts46;
        int32_t           len;
        int32_t           buffer_capac = 255; /* no domain name may exceed this */
-       char              *buffer = emalloc(buffer_capac);
+       zend_string       *buffer = STR_ALLOC(buffer_capac, 0);
        UIDNAInfo         info = UIDNA_INFO_INITIALIZER;
        int                       buffer_used = 0;
        
        uts46 = uidna_openUTS46(option, &status);
        if (php_intl_idn_check_status(status, "failed to open UIDNA instance",
                        mode TSRMLS_CC) == FAILURE) {
-               efree(buffer);
+               STR_FREE(buffer);
                RETURN_FALSE;
        }
 
        if (mode == INTL_IDN_TO_ASCII) {
                len = uidna_nameToASCII_UTF8(uts46, domain, (int32_t)domain_len,
-                               buffer, buffer_capac, &info, &status);
+                               buffer->val, buffer_capac, &info, &status);
        } else {
                len = uidna_nameToUnicodeUTF8(uts46, domain, (int32_t)domain_len,
-                               buffer, buffer_capac, &info, &status);
+                               buffer->val, buffer_capac, &info, &status);
        }
        if (php_intl_idn_check_status(status, "failed to convert name",
                        mode TSRMLS_CC) == FAILURE) {
                uidna_close(uts46);
-               efree(buffer);
+               STR_FREE(buffer);
                RETURN_FALSE;
        }
        if (len >= 255) {
                php_error_docref(NULL TSRMLS_CC, E_ERROR, "ICU returned an unexpected length");
        }
 
-       buffer[len] = '\0';
+       buffer->val[len] = '\0';
+       buffer->len = len;
 
        if (info.errors == 0) {
-               RETVAL_STRINGL(buffer, len, 0);
+               RETVAL_STR(buffer);
                buffer_used = 1;
        } else {
                RETVAL_FALSE;
@@ -180,21 +181,20 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
        if (idna_info) {
                if (buffer_used) { /* used in return_value then */
                        zval_addref_p(return_value);
-                       add_assoc_zval_ex(idna_info, "result", sizeof("result"), return_value);
+                       add_assoc_zval_ex(idna_info, "result", sizeof("result")-1, return_value);
                } else {
-                       zval *zv;
-                       ALLOC_INIT_ZVAL(zv);
-                       ZVAL_STRINGL(zv, buffer, len, 0);
+                       zval zv;
+                       ZVAL_STR(&zv, buffer);
                        buffer_used = 1;
-                       add_assoc_zval_ex(idna_info, "result", sizeof("result")zv);
+                       add_assoc_zval_ex(idna_info, "result", sizeof("result")-1, &zv);
                }
                add_assoc_bool_ex(idna_info, "isTransitionalDifferent",
-                               sizeof("isTransitionalDifferent"), info.isTransitionalDifferent);
-               add_assoc_long_ex(idna_info, "errors", sizeof("errors"), (long)info.errors);
+                               sizeof("isTransitionalDifferent")-1, info.isTransitionalDifferent);
+               add_assoc_long_ex(idna_info, "errors", sizeof("errors")-1, (long)info.errors);
        }
 
        if (!buffer_used) {
-               efree(buffer);
+               STR_FREE(buffer);
        }
 
        uidna_close(uts46);
index fc7315aefc97259041d27badb4ed5bd754828e6d..1c18c6c969574699a8f32fc918032c45a5b33e73 100644 (file)
@@ -183,10 +183,10 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
 
                if (name_part.getType() == UMSGPAT_PART_TYPE_ARG_NAME) {
                        UnicodeString argName = mp.getSubstring(name_part);
-                       if ((storedType = zend_hash_str_find_ptr(ret, (char*)argName.getBuffer(), argName.length())) == NULL) {
+                       if ((storedType = (Formattable::Type*)zend_hash_str_find_ptr(ret, (char*)argName.getBuffer(), argName.length())) == NULL) {
                                /* not found already; create new entry in HT */
                                Formattable::Type bogusType = Formattable::kObject;
-                               if ((storedType = zend_hash_str_update_mem(ret, (char*)argName.getBuffer(), argName.length(),
+                               if ((storedType = (Formattable::Type*)zend_hash_str_update_mem(ret, (char*)argName.getBuffer(), argName.length(),
                                                (void*)&bogusType, sizeof(bogusType))) == NULL) {
                                        intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
                                                "Write to argument types hash table failed", 0 TSRMLS_CC);
@@ -200,10 +200,10 @@ static HashTable *umsg_parse_format(MessageFormatter_object *mfo,
                                        "Found part with negative number", 0 TSRMLS_CC);
                                continue;
                        }
-                       if ((storedType = zend_hash_index_find_ptr(ret, (ulong)argNumber)) == NULL) {
+                       if ((storedType = (Formattable::Type*)zend_hash_index_find_ptr(ret, (ulong)argNumber)) == NULL) {
                                /* not found already; create new entry in HT */
                                Formattable::Type bogusType = Formattable::kObject;
-                               if ((storedType = zend_hash_index_update_mem(ret, (ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) {
+                               if ((storedType = (Formattable::Type*)zend_hash_index_update_mem(ret, (ulong)argNumber, (void*)&bogusType, sizeof(bogusType))) == NULL) {
                                        intl_errors_set(&err, U_MEMORY_ALLOCATION_ERROR,
                                                "Write to argument types hash table failed", 0 TSRMLS_CC);
                                        continue;
index cde090c2439abaad04a1be33f13f25878c520d3b..2b1bcfab922ccb489b97fd99e88df49fa94218e4 100644 (file)
@@ -245,9 +245,9 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
 
        /* must come before zpp because zpp would convert the arg in the stack to 0 */
        if (ZEND_NUM_ARGS() == 3) {
-               zval **dummy, **zvoffset;
+               zval *dummy, *zvoffset;
                arg3isnull = zend_get_parameters_ex(3, &dummy, &dummy, &zvoffset)
-                               != FAILURE && Z_TYPE_PP(zvoffset) == IS_NULL;
+                               != FAILURE && Z_TYPE_P(zvoffset) == IS_NULL;
        }
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s!l",