Skip to content

Commit 761e8c7

Browse files
committed
Remove dead commented code and dead code in-between KALLE_0 ifdefs.
Closes GH-4986
1 parent eaaf14e commit 761e8c7

File tree

1 file changed

+2
-55
lines changed

1 file changed

+2
-55
lines changed

ext/exif/exif.c

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,9 +1286,6 @@ typedef enum mn_byte_order_t {
12861286
typedef enum mn_offset_mode_t {
12871287
MN_OFFSET_NORMAL,
12881288
MN_OFFSET_MAKER
1289-
#ifdef KALLE_0
1290-
, MN_OFFSET_GUESS
1291-
#endif
12921289
} mn_offset_mode_t;
12931290

12941291
typedef struct {
@@ -2357,9 +2354,6 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
23572354
image_info_data *info_data;
23582355
zval tmpi, array;
23592356

2360-
#ifdef EXIF_DEBUG
2361-
/* php_error_docref(NULL, E_NOTICE, "Adding %d infos from section %s", image_info->info_list[section_index].count, exif_get_sectionname(section_index));*/
2362-
#endif
23632357
if (image_info->info_list[section_index].count) {
23642358
if (sub_array) {
23652359
array_init(&tmpi);
@@ -2377,9 +2371,7 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
23772371
snprintf(uname, sizeof(uname), "%d", unknown++);
23782372
name = uname;
23792373
}
2380-
#ifdef EXIF_DEBUG
2381-
/* php_error_docref(NULL, E_NOTICE, "Adding infos: tag(0x%04X,%12s,L=0x%04X): %s", info_tag, exif_get_tagname_debug(info_tag, exif_get_tag_table(section_index)), info_data->length, info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:"<no data>"):exif_get_tagformat(info_data->format));*/
2382-
#endif
2374+
23832375
if (info_data->length==0) {
23842376
add_assoc_null(&tmpi, name);
23852377
} else {
@@ -2413,8 +2405,6 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
24132405

24142406
case TAG_FMT_URATIONAL:
24152407
case TAG_FMT_SRATIONAL:
2416-
/*case TAG_FMT_BYTE:
2417-
case TAG_FMT_SBYTE:*/
24182408
case TAG_FMT_USHORT:
24192409
case TAG_FMT_SSHORT:
24202410
case TAG_FMT_SINGLE:
@@ -2604,28 +2594,11 @@ static void exif_process_COM (image_info_type *image_info, char *value, size_t l
26042594
* Process a SOFn marker. This is useful for the image dimensions */
26052595
static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result)
26062596
{
2607-
/* 0xFF SOSn SectLen(2) Bits(1) Height(2) Width(2) Channels(1) 3*Channels (1) */
2597+
/* 0xFF SOSn SectLen(2) Bits(1) Height(2) Width(2) Channels(1) 3*Channels (1) */
26082598
result->bits_per_sample = Data[2];
26092599
result->height = php_jpg_get16(Data+3);
26102600
result->width = php_jpg_get16(Data+5);
26112601
result->num_components = Data[7];
2612-
2613-
/* switch (marker) {
2614-
case M_SOF0: process = "Baseline"; break;
2615-
case M_SOF1: process = "Extended sequential"; break;
2616-
case M_SOF2: process = "Progressive"; break;
2617-
case M_SOF3: process = "Lossless"; break;
2618-
case M_SOF5: process = "Differential sequential"; break;
2619-
case M_SOF6: process = "Differential progressive"; break;
2620-
case M_SOF7: process = "Differential lossless"; break;
2621-
case M_SOF9: process = "Extended sequential, arithmetic coding"; break;
2622-
case M_SOF10: process = "Progressive, arithmetic coding"; break;
2623-
case M_SOF11: process = "Lossless, arithmetic coding"; break;
2624-
case M_SOF13: process = "Differential sequential, arithmetic coding"; break;
2625-
case M_SOF14: process = "Differential progressive, arithmetic coding"; break;
2626-
case M_SOF15: process = "Differential lossless, arithmetic coding"; break;
2627-
default: process = "Unknown"; break;
2628-
}*/
26292602
}
26302603
/* }}} */
26312604

@@ -3074,9 +3047,6 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
30743047
size_t i;
30753048
int de, section_index = SECTION_MAKERNOTE;
30763049
int NumDirEntries, old_motorola_intel;
3077-
#ifdef KALLE_0
3078-
int offset_diff;
3079-
#endif
30803050
const maker_note_type *maker_note;
30813051
char *dir_start;
30823052
int data_len;
@@ -3092,7 +3062,6 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
30923062

30933063
maker_note = maker_note_array+i;
30943064

3095-
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s)", maker_note->make?maker_note->make:"");*/
30963065
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
30973066
continue;
30983067
if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len))
@@ -3134,25 +3103,6 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
31343103
offset_base = value_ptr;
31353104
data_len = value_len;
31363105
break;
3137-
#ifdef KALLE_0
3138-
case MN_OFFSET_GUESS:
3139-
if (maker_note->offset + 10 + 4 >= value_len) {
3140-
/* Can not read dir_start+10 since it's beyond value end */
3141-
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X", value_len);
3142-
return FALSE;
3143-
}
3144-
offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel);
3145-
#ifdef EXIF_DEBUG
3146-
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Using automatic offset correction: 0x%04X", ((int)dir_start-(int)offset_base+maker_note->offset+displacement) + offset_diff);
3147-
#endif
3148-
if (offset_diff < 0 || offset_diff >= value_len ) {
3149-
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data bad offset: 0x%04X length 0x%04X", offset_diff, value_len);
3150-
return FALSE;
3151-
}
3152-
offset_base = value_ptr + offset_diff;
3153-
data_len = value_len - offset_diff;
3154-
break;
3155-
#endif
31563106
default:
31573107
case MN_OFFSET_NORMAL:
31583108
data_len = value_len;
@@ -3221,7 +3171,6 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
32213171
/* (-1) catches illegal zero case as unsigned underflows to positive large. */
32223172
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal format code 0x%04X, suppose BYTE", tag, exif_get_tagname_debug(tag, tag_table), format);
32233173
format = TAG_FMT_BYTE;
3224-
/*return TRUE;*/
32253174
}
32263175

32273176
byte_count_signed = (int64_t)components * php_tiff_bytes_per_format[format];
@@ -3989,7 +3938,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
39893938
return FALSE;
39903939
}
39913940
php_stream_read(ImageInfo->infile, (char*)(ImageInfo->file.list[sn].data+2), dir_size-2);
3992-
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Dump: %s", exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 0));*/
39933941
next_offset = php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, ImageInfo->motorola_intel);
39943942
#ifdef EXIF_DEBUG
39953943
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF done, next offset x%04X", next_offset);
@@ -4328,7 +4276,6 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
43284276
/* Store file date/time. */
43294277
ImageInfo->FileDateTime = st.st_mtime;
43304278
ImageInfo->FileSize = st.st_size;
4331-
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Opened stream is file: %d", ImageInfo->FileSize);*/
43324279
}
43334280
} else {
43344281
if (!ImageInfo->FileSize) {

0 commit comments

Comments
 (0)