@@ -234,18 +234,6 @@ static ssize_t exif_read_from_stream_file_looped(php_stream *stream, char *buf,
234
234
return total_read ;
235
235
}
236
236
237
- /* {{{ php_strnlen
238
- * get length of string if buffer if less than buffer size or buffer size */
239
- static size_t php_strnlen (char * str , size_t maxlen ) {
240
- size_t len = 0 ;
241
-
242
- if (str && maxlen && * str ) {
243
- do {
244
- len ++ ;
245
- } while (-- maxlen && * (++ str ));
246
- }
247
- return len ;
248
- }
249
237
/* }}} */
250
238
251
239
/* {{{ error messages */
@@ -2223,7 +2211,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
2223
2211
value = NULL ;
2224
2212
}
2225
2213
if (value ) {
2226
- length = (int )php_strnlen (value , length );
2214
+ length = (int )zend_strnlen (value , length );
2227
2215
info_value -> s = estrndup (value , length );
2228
2216
info_data -> length = length ;
2229
2217
} else {
@@ -2254,7 +2242,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
2254
2242
}
2255
2243
if (value ) {
2256
2244
if (tag == TAG_MAKER_NOTE ) {
2257
- length = (int ) php_strnlen (value , length );
2245
+ length = (int ) zend_strnlen (value , length );
2258
2246
}
2259
2247
2260
2248
/* do not recompute length here */
@@ -3034,11 +3022,11 @@ static int exif_process_string(char **result, char *value, size_t byte_count) {
3034
3022
/* we cannot use strlcpy - here the problem is that we cannot use strlen to
3035
3023
* determine length of string and we cannot use strlcpy with len=byte_count+1
3036
3024
* because then we might get into an EXCEPTION if we exceed an allocated
3037
- * memory page...so we use php_strnlen in conjunction with memcpy and add the NUL
3025
+ * memory page...so we use zend_strnlen in conjunction with memcpy and add the NUL
3038
3026
* char.
3039
3027
* estrdup would sometimes allocate more memory and does not return length
3040
3028
*/
3041
- if ((byte_count = php_strnlen (value , byte_count )) > 0 ) {
3029
+ if ((byte_count = zend_strnlen (value , byte_count )) > 0 ) {
3042
3030
return exif_process_undefined (result , value , byte_count );
3043
3031
}
3044
3032
(* result ) = estrndup ("" , 1 ); /* force empty string */
@@ -3412,7 +3400,7 @@ static bool exif_process_IFD_TAG_impl(image_info_type *ImageInfo, char *dir_entr
3412
3400
switch (tag ) {
3413
3401
case TAG_COPYRIGHT :
3414
3402
/* check for "<photographer> NUL <editor> NUL" */
3415
- if (byte_count > 1 && (length = php_strnlen (value_ptr , byte_count )) > 0 ) {
3403
+ if (byte_count > 1 && (length = zend_strnlen (value_ptr , byte_count )) > 0 ) {
3416
3404
if (length < byte_count - 1 ) {
3417
3405
/* When there are any characters after the first NUL */
3418
3406
EFREE_IF (ImageInfo -> CopyrightPhotographer );
@@ -3776,10 +3764,10 @@ static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t
3776
3764
{
3777
3765
size_t l1 , l2 = 0 ;
3778
3766
3779
- if ((l1 = php_strnlen (buffer + 2 , length - 2 )) > 0 ) {
3767
+ if ((l1 = zend_strnlen (buffer + 2 , length - 2 )) > 0 ) {
3780
3768
exif_iif_add_tag (ImageInfo , SECTION_APP12 , "Company" , TAG_NONE , TAG_FMT_STRING , l1 , buffer + 2 , l1 );
3781
3769
if (length > 2 + l1 + 1 ) {
3782
- l2 = php_strnlen (buffer + 2 + l1 + 1 , length - 2 - l1 - 1 );
3770
+ l2 = zend_strnlen (buffer + 2 + l1 + 1 , length - 2 - l1 - 1 );
3783
3771
exif_iif_add_tag (ImageInfo , SECTION_APP12 , "Info" , TAG_NONE , TAG_FMT_STRING , l2 , buffer + 2 + l1 + 1 , l2 );
3784
3772
}
3785
3773
}
0 commit comments