Do more casting to avoid build errors
authorAndreas Rönnquist <gusnan@librem.one>
Sun, 7 May 2023 19:55:55 +0000 (21:55 +0200)
committerColin Clark <colin.clark@cclark.uk>
Tue, 9 May 2023 08:14:38 +0000 (09:14 +0100)
src/exif.cc
src/format-canon.cc
src/format-nikon.cc
src/format-olympus.cc
src/format-raw.cc

index 8d2b834..044d4bc 100644 (file)
@@ -91,7 +91,7 @@ ExifFormatAttrib ExifFormatList[] = {
        { EXIF_FORMAT_RATIONAL,         8, "srational", "signed rational" },
        { EXIF_FORMAT_FLOAT,            4, "float",     "float" },
        { EXIF_FORMAT_DOUBLE,           8, "double",    "double" },
-       { -1, 0, NULL, NULL }
+       { (ExifFormatType)-1, 0, NULL, NULL }
 };
 
 /* tags that are special, or need special treatment */
@@ -584,7 +584,7 @@ gchar *exif_item_get_data(ExifItem *item, guint *data_len)
 {
        if (data_len)
                *data_len = item->data_len;
-       return g_memdup(item->data, item->data_len);
+       return (gchar*)g_memdup2((gpointer)(item->data), item->data_len);
 }
 
 guint exif_item_get_format_id(ExifItem *item)
@@ -746,7 +746,7 @@ static const ExifMarker *exif_marker_from_tag(guint16 tag, const ExifMarker *lis
 
 static void rational_from_data(ExifRational *r, gpointer src, ExifByteOrder bo)
 {
-       r->num = exif_byte_get_int32(src, bo);
+       r->num = exif_byte_get_int32((guchar *)src, bo);
        r->den = exif_byte_get_int32((guchar *)src + sizeof(guint32), bo);
 }
 
@@ -932,7 +932,7 @@ static gint exif_parse_IFD_entry(ExifData *exif, guchar *tiff, guint offset,
                }
 
        item = exif_item_new(marker->format, tag, count, marker);
-       exif_item_copy_data(item, tiff + data_offset, data_length, format, bo);
+       exif_item_copy_data(item, tiff + data_offset, data_length, (ExifFormatType)format, bo);
        exif->items = g_list_prepend(exif->items, item);
 
        if (list == ExifKnownMarkersList)
@@ -1245,7 +1245,7 @@ ExifData *exif_read(gchar *path, gchar *UNUSED(sidecar_path), GHashTable *UNUSED
                FormatRawExifParseFunc exif_parse_func;
                guint32 offset = 0;
 
-               exif_type = format_raw_exif_offset(f, size, &offset, &exif_parse_func);
+               exif_type = format_raw_exif_offset((guchar*)f, size, &offset, &exif_parse_func);
                switch (exif_type)
                        {
                        case FORMAT_RAW_EXIF_NONE:
@@ -1299,7 +1299,7 @@ ExifItem *exif_get_item(ExifData *exif, const gchar *key)
                {
                ExifItem *item;
 
-               item = work->data;
+               item = (ExifItem*)(work->data);
                work = work->next;
                if (item->marker->key && strcmp(key, item->marker->key) == 0) return item;
                }
@@ -1571,7 +1571,7 @@ void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list)
                        {
                        ExifItem *item;
 
-                       item = work->data;
+                       item = (ExifItem*)(work->data);
                        work = work->next;
 
                        exif_write_item(f, item);
index 1ad0cdc..57b7173 100644 (file)
@@ -516,13 +516,13 @@ gboolean format_canon_makernote(ExifData *exif, guchar *tiff, guint offset,
        item = exif_get_item(exif, "MkN.Canon.Settings1");
        if (item)
                {
-               canon_mknote_parse_settings(exif, item->data, item->data_len, bo, CanonSet1);
+               canon_mknote_parse_settings(exif, (guint16*)item->data, item->data_len, bo, CanonSet1);
                }
 
        item = exif_get_item(exif, "MkN.Canon.Settings2");
        if (item)
                {
-               canon_mknote_parse_settings(exif, item->data, item->data_len, bo, CanonSet2);
+               canon_mknote_parse_settings(exif, (guint16*)item->data, item->data_len, bo, CanonSet2);
                }
 
        return TRUE;
index aaf8e4a..a39b08e 100644 (file)
@@ -387,7 +387,7 @@ gboolean format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset,
                {
                static ExifMarker marker = { 0x0088, EXIF_FORMAT_STRING, -1,
                                             "Nikon.AutoFocusPoint", "Auto focus point", NULL };
-               guchar *array = item->data;
+               guchar *array = (guchar*)item->data;
                gchar *text;
                gint l;
 
index 69b9c3c..d9b0139 100644 (file)
@@ -321,7 +321,7 @@ gboolean format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset,
                {
                static ExifMarker marker = { 0x0200, EXIF_FORMAT_STRING, -1,
                                             "Olympus.ShootingMode", "Shooting mode", NULL };
-               guint32 *array = item->data;
+               guint32 *array = (guint32 *)item->data;
                gchar *mode;
                gchar *pdir = NULL;
                gchar *text;
@@ -352,7 +352,7 @@ gboolean format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset,
                {
                static ExifMarker marker = { 0x1015, EXIF_FORMAT_STRING, -1,
                                             "Olympus.WhiteBalance", "White balance", NULL };
-               guint16 *array = item->data;
+               guint16 *array = (guint16 *)item->data;
                gchar *mode;
                gchar *color = NULL;
                gchar *text;
index 3249020..a902432 100644 (file)
@@ -66,7 +66,7 @@ static FormatRawEntry format_raw_list[] = {
        FORMAT_RAW_OLYMPUS,
        FORMAT_RAW_PENTAX,
        FORMAT_RAW_SAMSUNG,
-       { NULL, 0, 0, NULL, 0, 0, NULL, NULL, NULL }
+       { NULL, (FormatRawMatchType)0, 0, NULL, 0, (FormatRawExifType)0, NULL, NULL, NULL }
 };
 
 
@@ -84,7 +84,7 @@ static FormatExifEntry format_exif_list[] = {
        FORMAT_EXIF_FUJI,
        FORMAT_EXIF_NIKON,
        FORMAT_EXIF_OLYMPUS,
-       { 0, NULL, 0, NULL, NULL }
+       { (FormatExifMatchType)0, NULL, 0, NULL, NULL }
 };
 
 
@@ -283,11 +283,11 @@ FormatRawExifType format_raw_exif_offset(guchar *data, const guint len, guint *e
 {
        FormatRawEntry *entry;
 
-       if (!data || len < 1) return FALSE;
+       if (!data || len < 1) return (FormatRawExifType)FALSE;
 
        entry = format_raw_find(data, len);
 
-       if (!entry || !entry->func_parse) return FALSE;
+       if (!entry || !entry->func_parse) return (FormatRawExifType)FALSE;
 
        if (!format_raw_parse(entry, data, len, NULL, exif_offset)) return FORMAT_RAW_EXIF_NONE;
 
@@ -360,7 +360,7 @@ gboolean format_raw_img_exif_offsets_fd(gint fd, const gchar *path,
                return FALSE;
                }
 
-       success = format_raw_parse(entry, map_data, map_len, image_offset, exif_offset);
+       success = format_raw_parse(entry, (guchar*)map_data, map_len, image_offset, exif_offset);
 
        if (munmap(map_data, map_len) == -1)
                {