More use of const, fix up a warning.
authorLaurent Monin <zas@norz.org>
Mon, 14 May 2012 21:01:01 +0000 (23:01 +0200)
committerLaurent Monin <zas@norz.org>
Thu, 16 Aug 2012 21:27:08 +0000 (23:27 +0200)
src/jpeg_parser.c
src/jpeg_parser.h

index 990ec4b..4fc8332 100644 (file)
@@ -13,7 +13,7 @@
 #include "main.h" 
 #include "jpeg_parser.h"
 
-gboolean jpeg_segment_find(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)
 {
@@ -64,7 +64,7 @@ typedef enum {
 
 
 
-guint16 tiff_byte_get_int16(guchar *f, TiffByteOrder bo)
+guint16 tiff_byte_get_int16(const guchar *f, TiffByteOrder bo)
 {
        guint16 align_buf;
 
@@ -76,7 +76,7 @@ guint16 tiff_byte_get_int16(guchar *f, TiffByteOrder bo)
                return GUINT16_FROM_BE(align_buf);
 }
 
-guint32 tiff_byte_get_int32(guchar *f, TiffByteOrder bo)
+guint32 tiff_byte_get_int32(const guchar *f, TiffByteOrder bo)
 {
        guint32 align_buf;
 
@@ -120,7 +120,7 @@ void tiff_byte_put_int32(guchar *f, guint32 n, TiffByteOrder bo)
        memcpy(f, &align_buf, sizeof(guint32));
 }
 
-gint tiff_directory_offset(guchar *data, const guint len,
+gint tiff_directory_offset(const guchar *data, const guint len,
                                guint *offset, TiffByteOrder *bo)
 {
        if (len < 8) return FALSE;
@@ -148,12 +148,12 @@ gint tiff_directory_offset(guchar *data, const guint len,
        return (*offset < len);
 }
 
-typedef gint (* FuncParseIFDEntry)(guchar *tiff, guint offset,
+typedef gint (* FuncParseIFDEntry)(const guchar *tiff, guint offset,
                                 guint size, TiffByteOrder bo,
                                 gpointer data);
 
 
-gint tiff_parse_IFD_table(guchar *tiff, guint offset,
+gint tiff_parse_IFD_table(const guchar *tiff, guint offset,
                          guint size, TiffByteOrder bo,
                          guint *next_offset,
                          FuncParseIFDEntry parse_entry, gpointer data)
@@ -182,7 +182,7 @@ gint tiff_parse_IFD_table(guchar *tiff, guint offset,
        return 0;
 }
 
-static gint mpo_parse_Index_IFD_entry(guchar *tiff, guint offset,
+static gint mpo_parse_Index_IFD_entry(const guchar *tiff, guint offset,
                                 guint size, TiffByteOrder bo,
                                 gpointer data)
 {
@@ -254,7 +254,7 @@ static gint mpo_parse_Index_IFD_entry(guchar *tiff, guint offset,
        return 0;
 }
 
-static gint mpo_parse_Attributes_IFD_entry(guchar *tiff, guint offset,
+static gint mpo_parse_Attributes_IFD_entry(const guchar *tiff, guint offset,
                                 guint size, TiffByteOrder bo,
                                 gpointer data)
 {
@@ -310,7 +310,7 @@ Roll Angle RollAngle 45581 B20D
        return 0;
 }
 
-MPOData *jpeg_get_mpo_data(guchar *data, guint size)
+MPOData *jpeg_get_mpo_data(const guchar *data, guint size)
 {
        guint seg_offset;
        guint seg_size;
@@ -383,4 +383,4 @@ void jpeg_mpo_data_free(MPOData *mpo)
                if (mpo->images) g_free(mpo->images);
                g_free(mpo);
                }
-}
\ No newline at end of file
+}
index d3f4b1a..0d65343 100644 (file)
@@ -31,7 +31,7 @@
        NNN.: the data in this segment
  */
 
-gboolean jpeg_segment_find(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);
 
@@ -76,7 +76,7 @@ struct _MPOData {
        MPOEntry *images;
 };
 
-MPOData* jpeg_get_mpo_data(guchar *data, guint size);
+MPOData* jpeg_get_mpo_data(const guchar *data, guint size);
 void jpeg_mpo_data_free(MPOData *mpo);
 
-#endif
\ No newline at end of file
+#endif