diff --git a/src/exif-common.cc b/src/exif-common.cc index d56ac1b6..4e4dfcaa 100644 --- a/src/exif-common.cc +++ b/src/exif-common.cc @@ -977,10 +977,10 @@ gboolean exif_jpeg_parse_color(ExifData *exif, guchar *data, guint size) */ while (jpeg_segment_find(data + seg_offset + seg_length, - size - seg_offset - seg_length, - JPEG_MARKER_APP2, - "ICC_PROFILE\x00", 12, - &seg_offset, &seg_length)) + size - seg_offset - seg_length, + JPEG_MARKER_APP2, + "ICC_PROFILE\x00", 12, + seg_offset, seg_length)) { guchar chunk_num; guchar chunk_tot; diff --git a/src/exif.cc b/src/exif.cc index 84933aad..a08d04a5 100644 --- a/src/exif.cc +++ b/src/exif.cc @@ -1069,8 +1069,6 @@ static gint exif_jpeg_parse(ExifData *exif, guchar *data, guint size, ExifMarker *list) { - guint seg_offset = 0; - guint seg_length = 0; gint res = -1; if (size < 4 || @@ -1079,9 +1077,11 @@ static gint exif_jpeg_parse(ExifData *exif, return -2; } + guint seg_offset = 0; + guint seg_length = 0; if (jpeg_segment_find(data, size, JPEG_MARKER_APP1, - "Exif\x00\x00", 6, - &seg_offset, &seg_length)) + "Exif\x00\x00", 6, + seg_offset, seg_length)) { res = exif_tiff_parse(exif, data + seg_offset + 6, seg_length - 6, list); } diff --git a/src/jpeg-parser.cc b/src/jpeg-parser.cc index b9aa7d51..924f3a4b 100644 --- a/src/jpeg-parser.cc +++ b/src/jpeg-parser.cc @@ -240,8 +240,8 @@ gboolean is_jpeg_container(const guchar *data, guint size) } gboolean jpeg_segment_find(const guchar *data, guint size, - guchar app_marker, const gchar *magic, guint magic_len, - guint *seg_offset, guint *seg_length) + guchar app_marker, const gchar *magic, guint magic_len, + guint &seg_offset, guint &seg_length) { guchar marker = 0; guint offset = 0; @@ -267,8 +267,8 @@ gboolean jpeg_segment_find(const guchar *data, guint size, length >= 4 + magic_len && memcmp(data + offset + 4, magic, magic_len) == 0) { - *seg_offset = offset + 4; - *seg_length = length - 4; + seg_offset = offset + 4; + seg_length = length - 4; return TRUE; } } @@ -280,7 +280,7 @@ MPOData jpeg_get_mpo_data(const guchar *data, guint size) { guint seg_offset; guint seg_size; - if (!jpeg_segment_find(data, size, JPEG_MARKER_APP2, "MPF\x00", 4, &seg_offset, &seg_size) || seg_size <= 16) return {}; + if (!jpeg_segment_find(data, size, JPEG_MARKER_APP2, "MPF\x00", 4, seg_offset, seg_size) || seg_size <= 16) return {}; DEBUG_1("mpo signature found at %x", seg_offset); seg_offset += 4; @@ -319,7 +319,7 @@ MPOData jpeg_get_mpo_data(const guchar *data, guint size) } else { - if (!jpeg_segment_find(data + mpo.images[i].offset, mpo.images[i].length, JPEG_MARKER_APP2, "MPF\x00", 4, &seg_offset, &seg_size) || seg_size <=16) + if (!jpeg_segment_find(data + mpo.images[i].offset, mpo.images[i].length, JPEG_MARKER_APP2, "MPF\x00", 4, seg_offset, seg_size) || seg_size <= 16) { DEBUG_1("MPO image %u: MPO signature not found", i); continue; diff --git a/src/jpeg-parser.h b/src/jpeg-parser.h index 5ce9997f..79e7b64d 100644 --- a/src/jpeg-parser.h +++ b/src/jpeg-parser.h @@ -47,8 +47,8 @@ gboolean is_jpeg_container(const guchar *data, guint size); gboolean jpeg_segment_find(const guchar *data, guint size, - guchar app_marker, const gchar *magic, guint magic_len, - guint *seg_offset, guint *seg_length); + guchar app_marker, const gchar *magic, guint magic_len, + guint &seg_offset, guint &seg_length); struct MPOEntry {