@@ -1796,30 +1796,30 @@ static void curl_free_post(void **post)
1796
1796
}
1797
1797
/* }}} */
1798
1798
1799
- struct mime_file {
1799
+ struct mime_data_cb_arg {
1800
1800
php_curl * ch ;
1801
1801
union {
1802
1802
zval postfields ;
1803
1803
struct {
1804
- zend_string * name ;
1804
+ zend_string * filename ;
1805
1805
php_stream * stream ;
1806
1806
};
1807
1807
};
1808
1808
};
1809
1809
1810
- /* {{{ curl_free_stream
1810
+ /* {{{ curl_free_cb_arg
1811
1811
*/
1812
- static void curl_free_stream (void * * post )
1812
+ static void curl_free_cb_arg (void * * cb_arg_p )
1813
1813
{
1814
- struct mime_file * mime_file = (struct mime_file * ) * post ;
1814
+ struct mime_data_cb_arg * cb_arg = (struct mime_data_cb_arg * ) * cb_arg_p ;
1815
1815
1816
- if (mime_file -> ch ) {
1817
- Z_DELREF (mime_file -> postfields );
1816
+ if (cb_arg -> ch ) {
1817
+ Z_DELREF (cb_arg -> postfields );
1818
1818
} else {
1819
- ZEND_ASSERT (mime_file -> stream == NULL );
1820
- zend_string_release (mime_file -> name );
1819
+ ZEND_ASSERT (cb_arg -> stream == NULL );
1820
+ zend_string_release (cb_arg -> filename );
1821
1821
}
1822
- efree (mime_file );
1822
+ efree (cb_arg );
1823
1823
}
1824
1824
/* }}} */
1825
1825
@@ -1920,7 +1920,7 @@ php_curl *alloc_curl_handle()
1920
1920
1921
1921
zend_llist_init (& ch -> to_free -> str , sizeof (char * ), (llist_dtor_func_t )curl_free_string , 0 );
1922
1922
zend_llist_init (& ch -> to_free -> post , sizeof (struct HttpPost * ), (llist_dtor_func_t )curl_free_post , 0 );
1923
- zend_llist_init (& ch -> to_free -> stream , sizeof (struct mime_file * ), (llist_dtor_func_t )curl_free_stream , 0 );
1923
+ zend_llist_init (& ch -> to_free -> stream , sizeof (struct mime_data_cb_arg * ), (llist_dtor_func_t )curl_free_cb_arg , 0 );
1924
1924
1925
1925
ch -> to_free -> slist = emalloc (sizeof (HashTable ));
1926
1926
zend_hash_init (ch -> to_free -> slist , 4 , NULL , curl_free_slist , 0 );
@@ -2153,7 +2153,7 @@ static int rebuild_mime_structure(php_curl *ch, zval *zpostfields)
2153
2153
zval * prop , rv ;
2154
2154
char * type = NULL , * filename = NULL ;
2155
2155
2156
- struct mime_file * mime_file ;
2156
+ struct mime_data_cb_arg * cb_arg ;
2157
2157
2158
2158
2159
2159
prop = zend_read_property (curl_CURLFile_class , current , "name" , sizeof ("name" )- 1 , 0 , & rv );
@@ -2175,27 +2175,27 @@ static int rebuild_mime_structure(php_curl *ch, zval *zpostfields)
2175
2175
filename = Z_STRVAL_P (prop );
2176
2176
}
2177
2177
2178
- mime_file = emalloc (sizeof * mime_file );
2179
- mime_file -> ch = ch ;
2180
- ZVAL_COPY (& mime_file -> postfields , zpostfields );
2181
- zend_llist_add_element (& ch -> to_free -> stream , & mime_file );
2178
+ cb_arg = emalloc (sizeof * cb_arg );
2179
+ cb_arg -> ch = ch ;
2180
+ ZVAL_COPY (& cb_arg -> postfields , zpostfields );
2181
+ zend_llist_add_element (& ch -> to_free -> stream , & cb_arg );
2182
2182
2183
- mime_file = emalloc (sizeof * mime_file );
2184
- mime_file -> ch = NULL ;
2185
- mime_file -> name = zend_string_copy (postval );
2186
- mime_file -> stream = NULL ;
2183
+ cb_arg = emalloc (sizeof * cb_arg );
2184
+ cb_arg -> ch = NULL ;
2185
+ cb_arg -> filename = zend_string_copy (postval );
2186
+ cb_arg -> stream = NULL ;
2187
2187
part = curl_mime_addpart (mime );
2188
2188
if (part == NULL ) {
2189
2189
zend_string_release_ex (string_key , 0 );
2190
2190
return FAILURE ;
2191
2191
}
2192
2192
if ((form_error = curl_mime_name (part , ZSTR_VAL (string_key ))) != CURLE_OK
2193
- || (form_error = curl_mime_data_cb (part , -1 , read_cb , seek_cb , free_cb , mime_file )) != CURLE_OK
2193
+ || (form_error = curl_mime_data_cb (part , -1 , read_cb , seek_cb , free_cb , cb_arg )) != CURLE_OK
2194
2194
|| (form_error = curl_mime_filename (part , filename ? filename : ZSTR_VAL (postval ))) != CURLE_OK
2195
2195
|| (form_error = curl_mime_type (part , type ? type : "application/octet-stream" )) != CURLE_OK ) {
2196
2196
error = form_error ;
2197
2197
}
2198
- zend_llist_add_element (& ch -> to_free -> stream , & mime_file );
2198
+ zend_llist_add_element (& ch -> to_free -> stream , & cb_arg );
2199
2199
}
2200
2200
2201
2201
zend_string_release_ex (string_key , 0 );
@@ -2234,15 +2234,15 @@ static int rebuild_mime_structure(php_curl *ch, zval *zpostfields)
2234
2234
2235
2235
static HashTable * get_postfields_of_handle (php_curl * ch )
2236
2236
{
2237
- struct mime_file * mime_file , * * mfp ;
2237
+ struct mime_data_cb_arg * cb_arg , * * cb_arg_p ;
2238
2238
2239
- mfp = zend_llist_get_last (& ch -> to_free -> stream );
2240
- while (mfp ) {
2241
- mime_file = * mfp ;
2242
- if (mime_file -> ch == ch ) {
2243
- return & mime_file -> postfields ;
2239
+ cb_arg_p = zend_llist_get_last (& ch -> to_free -> stream );
2240
+ while (cb_arg_p ) {
2241
+ cb_arg = * cb_arg_p ;
2242
+ if (cb_arg -> ch == ch ) {
2243
+ return & cb_arg -> postfields ;
2244
2244
}
2245
- mfp = zend_llist_get_prev (& ch -> to_free -> stream );
2245
+ cb_arg_p = zend_llist_get_prev (& ch -> to_free -> stream );
2246
2246
}
2247
2247
return NULL ;
2248
2248
}
@@ -2297,51 +2297,51 @@ PHP_FUNCTION(curl_copy_handle)
2297
2297
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
2298
2298
static size_t read_cb (char * buffer , size_t size , size_t nitems , void * arg ) /* {{{ */
2299
2299
{
2300
- struct mime_file * mime_file = (struct mime_file * ) arg ;
2300
+ struct mime_data_cb_arg * cb_arg = (struct mime_data_cb_arg * ) arg ;
2301
2301
ssize_t numread ;
2302
2302
2303
- ZEND_ASSERT (!mime_file -> ch );
2303
+ ZEND_ASSERT (!cb_arg -> ch );
2304
2304
2305
- if (mime_file -> stream == NULL ) {
2306
- if (!(mime_file -> stream = php_stream_open_wrapper (ZSTR_VAL (mime_file -> name ), "rb" , IGNORE_PATH , NULL ))) {
2305
+ if (cb_arg -> stream == NULL ) {
2306
+ if (!(cb_arg -> stream = php_stream_open_wrapper (ZSTR_VAL (cb_arg -> filename ), "rb" , IGNORE_PATH , NULL ))) {
2307
2307
return CURL_READFUNC_ABORT ;
2308
2308
}
2309
2309
}
2310
- numread = php_stream_read (mime_file -> stream , buffer , nitems * size );
2310
+ numread = php_stream_read (cb_arg -> stream , buffer , nitems * size );
2311
2311
if (numread < 0 ) {
2312
- php_stream_close (mime_file -> stream );
2313
- mime_file -> stream = NULL ;
2312
+ php_stream_close (cb_arg -> stream );
2313
+ cb_arg -> stream = NULL ;
2314
2314
}
2315
2315
return (numread >= 0 ) ? numread : CURL_READFUNC_ABORT ;
2316
2316
}
2317
2317
/* }}} */
2318
2318
2319
2319
static int seek_cb (void * arg , curl_off_t offset , int origin ) /* {{{ */
2320
2320
{
2321
- struct mime_file * mime_file = (struct mime_file * ) arg ;
2321
+ struct mime_data_cb_arg * cb_arg = (struct mime_data_cb_arg * ) arg ;
2322
2322
int res ;
2323
2323
2324
- ZEND_ASSERT (!mime_file -> ch );
2324
+ ZEND_ASSERT (!cb_arg -> ch );
2325
2325
2326
- if (mime_file -> stream == NULL ) {
2327
- if (!(mime_file -> stream = php_stream_open_wrapper (ZSTR_VAL (mime_file -> name ), "rb" , IGNORE_PATH , NULL ))) {
2326
+ if (cb_arg -> stream == NULL ) {
2327
+ if (!(cb_arg -> stream = php_stream_open_wrapper (ZSTR_VAL (cb_arg -> filename ), "rb" , IGNORE_PATH , NULL ))) {
2328
2328
return CURL_SEEKFUNC_CANTSEEK ;
2329
2329
}
2330
2330
}
2331
- res = php_stream_seek (mime_file -> stream , offset , origin );
2331
+ res = php_stream_seek (cb_arg -> stream , offset , origin );
2332
2332
return !res ? CURL_SEEKFUNC_OK : CURL_SEEKFUNC_CANTSEEK ;
2333
2333
}
2334
2334
/* }}} */
2335
2335
2336
2336
static void free_cb (void * arg ) /* {{{ */
2337
2337
{
2338
- struct mime_file * mime_file = (struct mime_file * ) arg ;
2338
+ struct mime_data_cb_arg * cb_arg = (struct mime_data_cb_arg * ) arg ;
2339
2339
2340
- ZEND_ASSERT (!mime_file -> ch );
2340
+ ZEND_ASSERT (!cb_arg -> ch );
2341
2341
2342
- if (mime_file -> stream != NULL ) {
2343
- php_stream_close (mime_file -> stream );
2344
- mime_file -> stream = NULL ;
2342
+ if (cb_arg -> stream != NULL ) {
2343
+ php_stream_close (cb_arg -> stream );
2344
+ cb_arg -> stream = NULL ;
2345
2345
}
2346
2346
}
2347
2347
/* }}} */
@@ -2985,7 +2985,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2985
2985
zval * prop , rv ;
2986
2986
char * type = NULL , * filename = NULL ;
2987
2987
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
2988
- struct mime_file * mime_file ;
2988
+ struct mime_data_cb_arg * cb_arg ;
2989
2989
#endif
2990
2990
2991
2991
prop = zend_read_property (curl_CURLFile_class , current , "name" , sizeof ("name" )- 1 , 0 , & rv );
@@ -3008,28 +3008,28 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
3008
3008
}
3009
3009
3010
3010
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
3011
- mime_file = emalloc (sizeof * mime_file );
3012
- mime_file -> ch = ch ;
3013
- ZVAL_COPY (& mime_file -> postfields , zvalue );
3014
- zend_llist_add_element (& ch -> to_free -> stream , & mime_file );
3011
+ cb_arg = emalloc (sizeof * cb_arg );
3012
+ cb_arg -> ch = ch ;
3013
+ ZVAL_COPY (& cb_arg -> postfields , zvalue );
3014
+ zend_llist_add_element (& ch -> to_free -> stream , & cb_arg );
3015
3015
3016
- mime_file = emalloc (sizeof * mime_file );
3017
- mime_file -> ch = NULL ;
3018
- mime_file -> name = zend_string_copy (postval );
3019
- mime_file -> stream = NULL ;
3016
+ cb_arg = emalloc (sizeof * cb_arg );
3017
+ cb_arg -> ch = NULL ;
3018
+ cb_arg -> filename = zend_string_copy (postval );
3019
+ cb_arg -> stream = NULL ;
3020
3020
3021
3021
part = curl_mime_addpart (mime );
3022
3022
if (part == NULL ) {
3023
3023
zend_string_release_ex (string_key , 0 );
3024
3024
return FAILURE ;
3025
3025
}
3026
3026
if ((form_error = curl_mime_name (part , ZSTR_VAL (string_key ))) != CURLE_OK
3027
- || (form_error = curl_mime_data_cb (part , -1 , read_cb , seek_cb , free_cb , mime_file )) != CURLE_OK
3027
+ || (form_error = curl_mime_data_cb (part , -1 , read_cb , seek_cb , free_cb , cb_arg )) != CURLE_OK
3028
3028
|| (form_error = curl_mime_filename (part , filename ? filename : ZSTR_VAL (postval ))) != CURLE_OK
3029
3029
|| (form_error = curl_mime_type (part , type ? type : "application/octet-stream" )) != CURLE_OK ) {
3030
3030
error = form_error ;
3031
3031
}
3032
- zend_llist_add_element (& ch -> to_free -> stream , & mime_file );
3032
+ zend_llist_add_element (& ch -> to_free -> stream , & cb_arg );
3033
3033
#else
3034
3034
form_error = curl_formadd (& first , & last ,
3035
3035
CURLFORM_COPYNAME , ZSTR_VAL (string_key ),
0 commit comments