From b4c2bd227743e4ab9d47bf624911b230b3237b51 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 15 Jul 2014 15:50:42 +0400 Subject: [PATCH] Fixed compilation on Windows --- ext/opcache/ZendAccelerator.c | 6 ++++-- ext/standard/crypt.c | 3 ++- ext/standard/http_fopen_wrapper.c | 4 ++-- win32/registry.c | 3 ++- win32/sendmail.c | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index c1775b8538..df36b55b62 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -400,10 +400,12 @@ static void accel_use_shm_interned_strings(TSRMLS_D) } /* class table hash keys, class names, properties, methods, constants, etc */ - for (idx = 0; idx < CG(class_table)->nNumUsed; idx++) { + for (idx = 0; idx < CG(class_table)->nNumUsed; idx++) { + zend_class_entry *ce; + p = CG(class_table)->arData + idx; if (Z_TYPE(p->val) == IS_UNDEF) continue; - zend_class_entry *ce = (zend_class_entry*)Z_PTR(p->val); + ce = (zend_class_entry*)Z_PTR(p->val); if (p->key) { p->key = accel_new_interned_string(p->key TSRMLS_CC); diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index f7696cf551..2a2304be20 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -260,9 +260,10 @@ PHP_FUNCTION(crypt) char salt[PHP_MAX_SALT_LEN + 1]; char *str, *salt_in = NULL; int str_len, salt_in_len = 0; - salt[0] = salt[PHP_MAX_SALT_LEN] = '\0'; zend_string *result; + salt[0] = salt[PHP_MAX_SALT_LEN] = '\0'; + /* This will produce suitable results if people depend on DES-encryption * available (passing always 2-character salt). At least for glibc6.1 */ memset(&salt[1], '$', PHP_MAX_SALT_LEN - 1); diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index eb6cebf534..d8f31960cc 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -224,14 +224,14 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, efree(transport_string); if (stream && use_proxy && use_ssl) { + smart_str header = {0}; + /* Set peer_name or name verification will try to use the proxy server name */ if (!context || (tmpzval = php_stream_context_get_option(context, "ssl", "peer_name")) == NULL) { ZVAL_STRING(&ssl_proxy_peer_name, resource->host); php_stream_context_set_option(stream->context, "ssl", "peer_name", &ssl_proxy_peer_name); } - smart_str header = {0}; - smart_str_appendl(&header, "CONNECT ", sizeof("CONNECT ")-1); smart_str_appends(&header, resource->host); smart_str_appendc(&header, ':'); diff --git a/win32/registry.c b/win32/registry.c index e7d1b2b2a9..ade09aa486 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -146,8 +146,9 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_ return ret; } -static void delete_internal_hashtable(void *data) +static void delete_internal_hashtable(zval *zv) { + void *data = Z_PTR_P(zv); zend_hash_destroy(*(HashTable**)data); free(*(HashTable**)data); } diff --git a/win32/sendmail.c b/win32/sendmail.c index dd653879c2..ed9736c1dd 100644 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@ -616,8 +616,8 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char return (res); } -PHPAPI zend_string *php_str_to_str(char *haystack, int length, char *needle, - int needle_len, char *str, int str_len); +//???PHPAPI zend_string *php_str_to_str(char *haystack, int length, char *needle, +//??? int needle_len, char *str, int str_len); /* Escape \n. sequences * We use php_str_to_str() and not php_str_replace_in_subject(), since the latter -- 2.40.0