From 0b365b7fb7a8623dd6d46ac25fc432f1d0cffc89 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Thu, 14 Feb 2019 19:01:47 +1100 Subject: [PATCH] correct the type of the im_decode_exif() data parameter const foo * and foo* have the same representation so this doesn't break the ABI. const unsigned char * will accept all parameter types it did previously. The only issue is if someone makes a copy of the pointer, but I don't support that. --- imexif.c | 8 ++++---- imexif.h | 2 +- imexttypes.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/imexif.c b/imexif.c index 4bdf386a..30a89896 100644 --- a/imexif.c +++ b/imexif.c @@ -213,7 +213,7 @@ typedef struct { /* in memory tiff structure */ typedef struct { /* the data we use as a tiff */ - unsigned char *base; + const unsigned char *base; size_t size; /* intel or motorola byte order */ @@ -228,7 +228,7 @@ typedef struct { unsigned long next_ifd; } imtiff; -static int tiff_init(imtiff *tiff, unsigned char *base, size_t length); +static int tiff_init(imtiff *tiff, const unsigned char *base, size_t length); static int tiff_load_ifd(imtiff *tiff, unsigned long offset); static void tiff_final(imtiff *tiff); static void tiff_clear_ifd(imtiff *tiff); @@ -286,7 +286,7 @@ Returns true if an EXIF header was seen. */ int -im_decode_exif(i_img *im, unsigned char *data, size_t length) { +im_decode_exif(i_img *im, const unsigned char *data, size_t length) { imtiff tiff; unsigned long exif_ifd_offset = 0; unsigned long gps_ifd_offset = 0; @@ -840,7 +840,7 @@ the first IFD (IFD0 in EXIF) in first_ifd_offset. */ static int -tiff_init(imtiff *tiff, unsigned char *data, size_t length) { +tiff_init(imtiff *tiff, const unsigned char *data, size_t length) { int version; tiff->base = data; diff --git a/imexif.h b/imexif.h index 2e02d1d2..67b674c6 100644 --- a/imexif.h +++ b/imexif.h @@ -5,6 +5,6 @@ #include #include "imdatatypes.h" -extern int im_decode_exif(i_img *im, unsigned char *data, size_t length); +extern int im_decode_exif(i_img *im, const unsigned char *data, size_t length); #endif /* ifndef IMAGER_IMEXIF_H */ diff --git a/imexttypes.h b/imexttypes.h index 62e325ba..0d25c5ef 100644 --- a/imexttypes.h +++ b/imexttypes.h @@ -271,7 +271,7 @@ typedef struct { int (*f_i_img_color_channels)(i_img *im); /* IMAGER_API_LEVEL 10 functions will be added here */ - int (*f_im_decode_exif)(i_img *im, unsigned char *data, size_t length); + int (*f_im_decode_exif)(i_img *im, const unsigned char *data, size_t length); /* IMAGER_API_LEVEL 11 functions will be added here */ } im_ext_funcs; -- 2.39.5