@@ -1833,7 +1833,7 @@ typedef struct {
1833
1833
#define FOUND_WINXP (1<<SECTION_WINXP)
1834
1834
#define FOUND_MAKERNOTE (1<<SECTION_MAKERNOTE)
1835
1835
1836
- static char * exif_get_sectionname (int section )
1836
+ static const char * exif_get_sectionname (int section )
1837
1837
{
1838
1838
switch (section ) {
1839
1839
case SECTION_FILE : return "FILE" ;
@@ -2047,7 +2047,7 @@ typedef struct {
2047
2047
char * valid_end ; /* exclusive */
2048
2048
} exif_offset_info ;
2049
2049
2050
- static zend_always_inline bool ptr_offset_overflows (char * ptr , size_t offset ) {
2050
+ static zend_always_inline bool ptr_offset_overflows (const char * ptr , size_t offset ) {
2051
2051
return UINTPTR_MAX - (uintptr_t ) ptr < offset ;
2052
2052
}
2053
2053
@@ -2084,15 +2084,14 @@ static inline char *exif_offset_info_try_get(
2084
2084
}
2085
2085
2086
2086
static inline bool exif_offset_info_contains (
2087
- const exif_offset_info * info , char * start , size_t length ) {
2088
- char * end ;
2087
+ const exif_offset_info * info , const char * start , size_t length ) {
2089
2088
if (ptr_offset_overflows (start , length )) {
2090
2089
return 0 ;
2091
2090
}
2092
2091
2093
2092
/* start and valid_start are both inclusive, end and valid_end are both exclusive,
2094
2093
* so we use >= and <= to do the checks, respectively. */
2095
- end = start + length ;
2094
+ const char * end = start + length ;
2096
2095
return start >= info -> valid_start && end <= info -> valid_end ;
2097
2096
}
2098
2097
@@ -2184,7 +2183,7 @@ static image_info_data *exif_alloc_image_info_data(image_info_list *info_list) {
2184
2183
/* {{{ exif_iif_add_value
2185
2184
Add a value to image_info
2186
2185
*/
2187
- static void exif_iif_add_value (image_info_type * image_info , int section_index , char * name , int tag , int format , size_t length , void * value , size_t value_len , int motorola_intel )
2186
+ static void exif_iif_add_value (image_info_type * image_info , int section_index , const char * name , int tag , int format , size_t length , void * value , size_t value_len , int motorola_intel )
2188
2187
{
2189
2188
size_t idex ;
2190
2189
void * vptr , * vptr_end ;
@@ -2323,7 +2322,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
2323
2322
/* {{{ exif_iif_add_tag
2324
2323
Add a tag from IFD to image_info
2325
2324
*/
2326
- static void exif_iif_add_tag (image_info_type * image_info , int section_index , char * name , int tag , int format , size_t length , void * value , size_t value_len )
2325
+ static void exif_iif_add_tag (image_info_type * image_info , int section_index , const char * name , int tag , int format , size_t length , void * value , size_t value_len )
2327
2326
{
2328
2327
exif_iif_add_value (image_info , section_index , name , tag , format , length , value , value_len , image_info -> motorola_intel );
2329
2328
}
@@ -2332,7 +2331,7 @@ static void exif_iif_add_tag(image_info_type *image_info, int section_index, cha
2332
2331
/* {{{ exif_iif_add_int
2333
2332
Add an int value to image_info
2334
2333
*/
2335
- static void exif_iif_add_int (image_info_type * image_info , int section_index , char * name , int value )
2334
+ static void exif_iif_add_int (image_info_type * image_info , int section_index , const char * name , int value )
2336
2335
{
2337
2336
image_info_data * info_data = exif_alloc_image_info_data (& image_info -> info_list [section_index ]);
2338
2337
info_data -> tag = TAG_NONE ;
@@ -2347,7 +2346,7 @@ static void exif_iif_add_int(image_info_type *image_info, int section_index, cha
2347
2346
/* {{{ exif_iif_add_str
2348
2347
Add a string value to image_info MUST BE NUL TERMINATED
2349
2348
*/
2350
- static void exif_iif_add_str (image_info_type * image_info , int section_index , char * name , char * value )
2349
+ static void exif_iif_add_str (image_info_type * image_info , int section_index , const char * name , const char * value )
2351
2350
{
2352
2351
if (value ) {
2353
2352
image_info_data * info_data =
@@ -2365,7 +2364,7 @@ static void exif_iif_add_str(image_info_type *image_info, int section_index, cha
2365
2364
/* {{{ exif_iif_add_fmt
2366
2365
Add a format string value to image_info MUST BE NUL TERMINATED
2367
2366
*/
2368
- static void exif_iif_add_fmt (image_info_type * image_info , int section_index , char * name , char * value , ...)
2367
+ static void exif_iif_add_fmt (image_info_type * image_info , int section_index , const char * name , char * value , ...)
2369
2368
{
2370
2369
char * tmp ;
2371
2370
va_list arglist ;
@@ -2383,7 +2382,7 @@ static void exif_iif_add_fmt(image_info_type *image_info, int section_index, cha
2383
2382
/* {{{ exif_iif_add_str
2384
2383
Add a string value to image_info MUST BE NUL TERMINATED
2385
2384
*/
2386
- static void exif_iif_add_buffer (image_info_type * image_info , int section_index , char * name , int length , char * value )
2385
+ static void exif_iif_add_buffer (image_info_type * image_info , int section_index , const char * name , int length , const char * value )
2387
2386
{
2388
2387
if (value ) {
2389
2388
image_info_data * info_data =
@@ -2979,7 +2978,7 @@ static void exif_thumbnail_extract(image_info_type *ImageInfo, const exif_offset
2979
2978
2980
2979
/* {{{ exif_process_undefined
2981
2980
* Copy a string/buffer in Exif header to a character string and return length of allocated buffer if any. */
2982
- static int exif_process_undefined (char * * result , char * value , size_t byte_count ) {
2981
+ static int exif_process_undefined (char * * result , const char * value , size_t byte_count ) {
2983
2982
/* we cannot use strlcpy - here the problem is that we have to copy NUL
2984
2983
* chars up to byte_count, we also have to add a single NUL character to
2985
2984
* force end of string.
@@ -2995,7 +2994,7 @@ static int exif_process_undefined(char **result, char *value, size_t byte_count)
2995
2994
2996
2995
/* {{{ exif_process_string_raw
2997
2996
* Copy a string in Exif header to a character string returns length of allocated buffer if any. */
2998
- static int exif_process_string_raw (char * * result , char * value , size_t byte_count ) {
2997
+ static int exif_process_string_raw (char * * result , const char * value , size_t byte_count ) {
2999
2998
/* we cannot use strlcpy - here the problem is that we have to copy NUL
3000
2999
* chars up to byte_count, we also have to add a single NUL character to
3001
3000
* force end of string.
@@ -3013,7 +3012,7 @@ static int exif_process_string_raw(char **result, char *value, size_t byte_count
3013
3012
/* {{{ exif_process_string
3014
3013
* Copy a string in Exif header to a character string and return length of allocated buffer if any.
3015
3014
* In contrast to exif_process_string this function does always return a string buffer */
3016
- static int exif_process_string (char * * result , char * value , size_t byte_count ) {
3015
+ static int exif_process_string (char * * result , const char * value , size_t byte_count ) {
3017
3016
/* we cannot use strlcpy - here the problem is that we cannot use strlen to
3018
3017
* determine length of string and we cannot use strlcpy with len=byte_count+1
3019
3018
* because then we might get into an EXCEPTION if we exceed an allocated
@@ -3031,7 +3030,7 @@ static int exif_process_string(char **result, char *value, size_t byte_count) {
3031
3030
3032
3031
/* {{{ exif_process_user_comment
3033
3032
* Process UserComment in IFD. */
3034
- static int exif_process_user_comment (image_info_type * ImageInfo , char * * pszInfoPtr , char * * pszEncoding , char * szValuePtr , int ByteCount )
3033
+ static int exif_process_user_comment (const image_info_type * ImageInfo , char * * pszInfoPtr , char * * pszEncoding , char * szValuePtr , int ByteCount )
3035
3034
{
3036
3035
int a ;
3037
3036
char * decode ;
@@ -3119,15 +3118,15 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
3119
3118
3120
3119
/* {{{ exif_process_unicode
3121
3120
* Process unicode field in IFD. */
3122
- static int exif_process_unicode (image_info_type * ImageInfo , xp_field_type * xp_field , int tag , char * szValuePtr , int ByteCount )
3121
+ static int exif_process_unicode (const image_info_type * ImageInfo , xp_field_type * xp_field , int tag , const char * szValuePtr , int ByteCount )
3123
3122
{
3124
3123
xp_field -> tag = tag ;
3125
3124
xp_field -> value = NULL ;
3126
3125
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
3127
3126
if (zend_multibyte_encoding_converter (
3128
3127
(unsigned char * * )& xp_field -> value ,
3129
3128
& xp_field -> size ,
3130
- (unsigned char * )szValuePtr ,
3129
+ (const unsigned char * )szValuePtr ,
3131
3130
ByteCount ,
3132
3131
zend_multibyte_fetch_encoding (ImageInfo -> encode_unicode ),
3133
3132
zend_multibyte_fetch_encoding (ImageInfo -> motorola_intel ? ImageInfo -> decode_unicode_be : ImageInfo -> decode_unicode_le )
@@ -4463,7 +4462,7 @@ static bool exif_read_from_stream(image_info_type *ImageInfo, php_stream *stream
4463
4462
/* }}} */
4464
4463
4465
4464
/* {{{ exif_read_from_file */
4466
- static bool exif_read_from_file (image_info_type * ImageInfo , char * FileName , int read_thumbnail , int read_all )
4465
+ static bool exif_read_from_file (image_info_type * ImageInfo , const char * FileName , int read_thumbnail , int read_all )
4467
4466
{
4468
4467
bool ret ;
4469
4468
php_stream * stream ;
0 commit comments