Skip to content

Commit b1ee324

Browse files
committed
ext/exif: make php_tiff_bytes_per_format and other globals const
1 parent 2226f86 commit b1ee324

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

ext/exif/exif.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ static size_t php_strnlen(char* str, size_t maxlen) {
230230
/* }}} */
231231

232232
/* {{{ error messages */
233-
static const char * EXIF_ERROR_FILEEOF = "Unexpected end of file reached";
234-
static const char * EXIF_ERROR_CORRUPT = "File structure corrupted";
235-
static const char * EXIF_ERROR_THUMBEOF = "Thumbnail goes IFD boundary or end of file reached";
236-
static const char * EXIF_ERROR_FSREALLOC = "Illegal reallocating of undefined file section";
233+
static const char *const EXIF_ERROR_FILEEOF = "Unexpected end of file reached";
234+
static const char *const EXIF_ERROR_CORRUPT = "File structure corrupted";
235+
static const char *const EXIF_ERROR_THUMBEOF = "Thumbnail goes IFD boundary or end of file reached";
236+
static const char *const EXIF_ERROR_FSREALLOC = "Illegal reallocating of undefined file section";
237237

238238
#define EXIF_ERRLOG_FILEEOF(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "%s", EXIF_ERROR_FILEEOF);
239239
#define EXIF_ERRLOG_CORRUPT(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "%s", EXIF_ERROR_CORRUPT);
@@ -244,7 +244,7 @@ static const char * EXIF_ERROR_FSREALLOC = "Illegal reallocating of undefined fi
244244
/* {{{ format description defines
245245
Describes format descriptor
246246
*/
247-
static int php_tiff_bytes_per_format[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
247+
static const int php_tiff_bytes_per_format[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
248248
#define NUM_FORMATS 13
249249

250250
#define TAG_FMT_BYTE 1
@@ -504,15 +504,15 @@ typedef const struct {
504504
char *Desc;
505505
} tag_info_type;
506506

507-
typedef tag_info_type tag_info_array[];
508-
typedef tag_info_type *tag_table_type;
507+
typedef const tag_info_type tag_info_array[];
508+
typedef const tag_info_type *tag_table_type;
509509

510510
#define TAG_TABLE_END \
511511
{TAG_NONE, "No tag value"},\
512512
{TAG_COMPUTED_VALUE, "Computed value"},\
513513
{TAG_END_OF_LIST, ""} /* Important for exif_get_tagname() IF value != "" function result is != false */
514514

515-
static tag_info_array tag_table_IFD = {
515+
static const tag_info_array tag_table_IFD = {
516516
{ 0x000B, "ACDComment"},
517517
{ 0x00FE, "NewSubFile"}, /* better name it 'ImageType' ? */
518518
{ 0x00FF, "SubFile"},
@@ -760,7 +760,7 @@ static tag_info_array tag_table_IFD = {
760760
TAG_TABLE_END
761761
} ;
762762

763-
static tag_info_array tag_table_GPS = {
763+
static const tag_info_array tag_table_GPS = {
764764
{ 0x0000, "GPSVersion"},
765765
{ 0x0001, "GPSLatitudeRef"},
766766
{ 0x0002, "GPSLatitude"},
@@ -795,7 +795,7 @@ static tag_info_array tag_table_GPS = {
795795
TAG_TABLE_END
796796
};
797797

798-
static tag_info_array tag_table_IOP = {
798+
static const tag_info_array tag_table_IOP = {
799799
{ 0x0001, "InterOperabilityIndex"}, /* should be 'R98' or 'THM' */
800800
{ 0x0002, "InterOperabilityVersion"},
801801
{ 0x1000, "RelatedFileFormat"},
@@ -804,7 +804,7 @@ static tag_info_array tag_table_IOP = {
804804
TAG_TABLE_END
805805
};
806806

807-
static tag_info_array tag_table_VND_CANON = {
807+
static const tag_info_array tag_table_VND_CANON = {
808808
{ 0x0001, "ModeArray"}, /* guess */
809809
{ 0x0004, "ImageInfo"}, /* guess */
810810
{ 0x0006, "ImageType"},
@@ -816,7 +816,7 @@ static tag_info_array tag_table_VND_CANON = {
816816
TAG_TABLE_END
817817
};
818818

819-
static tag_info_array tag_table_VND_CASIO = {
819+
static const tag_info_array tag_table_VND_CASIO = {
820820
{ 0x0001, "RecordingMode"},
821821
{ 0x0002, "Quality"},
822822
{ 0x0003, "FocusingMode"},
@@ -832,7 +832,7 @@ static tag_info_array tag_table_VND_CASIO = {
832832
TAG_TABLE_END
833833
};
834834

835-
static tag_info_array tag_table_VND_FUJI = {
835+
static const tag_info_array tag_table_VND_FUJI = {
836836
{ 0x0000, "Version"},
837837
{ 0x1000, "Quality"},
838838
{ 0x1001, "Sharpness"},
@@ -852,7 +852,7 @@ static tag_info_array tag_table_VND_FUJI = {
852852
TAG_TABLE_END
853853
};
854854

855-
static tag_info_array tag_table_VND_NIKON = {
855+
static const tag_info_array tag_table_VND_NIKON = {
856856
{ 0x0003, "Quality"},
857857
{ 0x0004, "ColorMode"},
858858
{ 0x0005, "ImageAdjustment"},
@@ -864,7 +864,7 @@ static tag_info_array tag_table_VND_NIKON = {
864864
TAG_TABLE_END
865865
};
866866

867-
static tag_info_array tag_table_VND_NIKON_990 = {
867+
static const tag_info_array tag_table_VND_NIKON_990 = {
868868
{ 0x0001, "Version"},
869869
{ 0x0002, "ISOSetting"},
870870
{ 0x0003, "ColorMode"},
@@ -883,7 +883,7 @@ static tag_info_array tag_table_VND_NIKON_990 = {
883883
TAG_TABLE_END
884884
};
885885

886-
static tag_info_array tag_table_VND_OLYMPUS = {
886+
static const tag_info_array tag_table_VND_OLYMPUS = {
887887
{ 0x0200, "SpecialMode"},
888888
{ 0x0201, "JPEGQuality"},
889889
{ 0x0202, "Macro"},
@@ -895,7 +895,7 @@ static tag_info_array tag_table_VND_OLYMPUS = {
895895
TAG_TABLE_END
896896
};
897897

898-
static tag_info_array tag_table_VND_SAMSUNG = {
898+
static const tag_info_array tag_table_VND_SAMSUNG = {
899899
{ 0x0001, "Version"},
900900
{ 0x0021, "PictureWizard"},
901901
{ 0x0030, "LocalLocationName"},
@@ -929,7 +929,7 @@ static tag_info_array tag_table_VND_SAMSUNG = {
929929
TAG_TABLE_END
930930
};
931931

932-
static tag_info_array tag_table_VND_PANASONIC = {
932+
static const tag_info_array tag_table_VND_PANASONIC = {
933933
{ 0x0001, "Quality"},
934934
{ 0x0002, "FirmwareVersion"},
935935
{ 0x0003, "WhiteBalance"},
@@ -1030,7 +1030,7 @@ static tag_info_array tag_table_VND_PANASONIC = {
10301030
TAG_TABLE_END
10311031
};
10321032

1033-
static tag_info_array tag_table_VND_DJI = {
1033+
static const tag_info_array tag_table_VND_DJI = {
10341034
{ 0x0001, "Make"},
10351035
{ 0x0003, "SpeedX"},
10361036
{ 0x0004, "SpeedY"},
@@ -1044,7 +1044,7 @@ static tag_info_array tag_table_VND_DJI = {
10441044
TAG_TABLE_END
10451045
};
10461046

1047-
static tag_info_array tag_table_VND_SONY = {
1047+
static const tag_info_array tag_table_VND_SONY = {
10481048
{ 0x0102, "Quality"},
10491049
{ 0x0104, "FlashExposureComp"},
10501050
{ 0x0105, "Teleconverter"},
@@ -1099,7 +1099,7 @@ static tag_info_array tag_table_VND_SONY = {
10991099
TAG_TABLE_END
11001100
};
11011101

1102-
static tag_info_array tag_table_VND_PENTAX = {
1102+
static const tag_info_array tag_table_VND_PENTAX = {
11031103
{ 0x0000, "Version"},
11041104
{ 0x0001, "Mode"},
11051105
{ 0x0002, "PreviewResolution"},
@@ -1184,7 +1184,7 @@ static tag_info_array tag_table_VND_PENTAX = {
11841184
TAG_TABLE_END
11851185
};
11861186

1187-
static tag_info_array tag_table_VND_MINOLTA = {
1187+
static const tag_info_array tag_table_VND_MINOLTA = {
11881188
{ 0x0000, "Version"},
11891189
{ 0x0001, "CameraSettingsStdOld"},
11901190
{ 0x0003, "CameraSettingsStdNew"},
@@ -1215,7 +1215,7 @@ static tag_info_array tag_table_VND_MINOLTA = {
12151215
TAG_TABLE_END
12161216
};
12171217

1218-
static tag_info_array tag_table_VND_SIGMA = {
1218+
static const tag_info_array tag_table_VND_SIGMA = {
12191219
{ 0x0002, "SerialNumber"},
12201220
{ 0x0003, "DriveMode"},
12211221
{ 0x0004, "ResolutionMode"},
@@ -1242,13 +1242,13 @@ static tag_info_array tag_table_VND_SIGMA = {
12421242
TAG_TABLE_END
12431243
};
12441244

1245-
static tag_info_array tag_table_VND_KYOCERA = {
1245+
static const tag_info_array tag_table_VND_KYOCERA = {
12461246
{ 0x0001, "FormatThumbnail"},
12471247
{ 0x0E00, "PrintImageMatchingInfo"},
12481248
TAG_TABLE_END
12491249
};
12501250

1251-
static tag_info_array tag_table_VND_RICOH = {
1251+
static const tag_info_array tag_table_VND_RICOH = {
12521252
{ 0x0001, "MakerNoteDataType"},
12531253
{ 0x0002, "Version"},
12541254
{ 0x0E00, "PrintImageMatchingInfo"},

0 commit comments

Comments
 (0)