Fix compile errors
authorColin Clark <colin.clark@cclark.uk>
Wed, 22 Sep 2021 10:39:39 +0000 (11:39 +0100)
committerColin Clark <colin.clark@cclark.uk>
Wed, 22 Sep 2021 10:39:39 +0000 (11:39 +0100)
Fix compile errors in code copied from other image loaders

src/image_load_cr3.c
src/image_load_j2k.c
src/image_load_jpeg.c
src/image_load_psd.c

index 1c3c549..d40a75c 100644 (file)
@@ -93,7 +93,8 @@ static void
 convert_cmyk_to_rgb (struct jpeg_decompress_struct *cinfo,
                     guchar **lines)
 {
-       gint i, j;
+       gint i;
+       guint j;
 
        g_return_if_fail (cinfo != NULL);
        g_return_if_fail (cinfo->output_components == 4);
@@ -217,7 +218,7 @@ static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
 {
        struct jpeg_source_mgr* src = (struct jpeg_source_mgr*) cinfo->src;
 
-       if (num_bytes > src->bytes_in_buffer)
+       if ((gulong)num_bytes > src->bytes_in_buffer)
                {
                ERREXIT(cinfo, JERR_INPUT_EOF);
                }
@@ -267,7 +268,7 @@ static gboolean image_loader_cr3_load (gpointer loader, const guchar *buf, gsize
  */
        gboolean found = FALSE;
        gint i;
-       gint n;
+       guint n;
 
        n = 0;
        while (n < count - 4 && !found)
index a531291..37c1b11 100644 (file)
@@ -130,7 +130,7 @@ static OPJ_BOOL opj_seek_from_buffer (OPJ_OFF_T len, opj_buffer_info_t* psrc)
 {
     OPJ_SIZE_T n = psrc->len;
 
-    if (n > len)
+    if (n > (gulong)len)
         n = len;
 
     psrc->cur = psrc->buf + n;
index 69f31f5..2bb27a8 100644 (file)
@@ -96,7 +96,8 @@ static void
 convert_cmyk_to_rgb (struct jpeg_decompress_struct *cinfo,
                     guchar **lines)
 {
-       gint i, j;
+       gint i;
+       guint j;
 
        g_return_if_fail (cinfo != NULL);
        g_return_if_fail (cinfo->output_components == 4);
@@ -220,7 +221,7 @@ static void skip_input_data (j_decompress_ptr cinfo, long num_bytes)
 {
        struct jpeg_source_mgr* src = (struct jpeg_source_mgr*) cinfo->src;
 
-       if (num_bytes > src->bytes_in_buffer)
+       if ((gulong)num_bytes > src->bytes_in_buffer)
                {
                ERREXIT(cinfo, JERR_INPUT_EOF);
                }
index a915a01..d37b6e4 100644 (file)
@@ -185,7 +185,7 @@ feed_buffer (guchar*        buffer,
              guint*         size,
              guint          bytes_needed)
 {
-       gint how_many = bytes_needed - *bytes_read;
+       guint how_many = bytes_needed - *bytes_read;
        if (how_many > *size) {
                how_many = *size;
        }
@@ -293,7 +293,8 @@ static gboolean image_loader_psd_load(gpointer loader, const guchar *buf, gsize
 {
        ImageLoaderPSD *ld = (ImageLoaderPSD *) loader;
        PsdContext* ctx = g_new0(PsdContext, 1);
-       int i, j;
+       guint i;
+       guint32 j;
        guint size = count;
 
        ctx->state = PSD_STATE_HEADER;