[Bf-blender-cvs] [d3c895fc41d] master: Cleanup: shadow and format warnings

Campbell Barton noreply at git.blender.org
Thu May 5 02:58:22 CEST 2022


Commit: d3c895fc41d7a2d4ec677c4cd70f656a28f8edb1
Author: Campbell Barton
Date:   Thu May 5 10:38:19 2022 +1000
Branches: master
https://developer.blender.org/rBd3c895fc41d7a2d4ec677c4cd70f656a28f8edb1

Cleanup: shadow and format warnings

===================================================================

M	source/blender/imbuf/intern/jpeg.c
M	source/blender/imbuf/intern/readimage.c

===================================================================

diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 0ec4e5a3ba8..d76bd00df57 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -290,7 +290,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo,
        * while libjpeg-turbo can also do 3/8, 5/8, etc. But max is 1/8. */
       float scale = (float)max_size / MAX2(cinfo->image_width, cinfo->image_height);
       cinfo->scale_denom = 8;
-      cinfo->scale_num = MAX2(1, MIN2(8, ceill(scale * (float)cinfo->scale_denom)));
+      cinfo->scale_num = max_uu(1, min_uu(8, ceill(scale * (float)cinfo->scale_denom)));
       cinfo->dct_method = JDCT_FASTEST;
       cinfo->dither_mode = JDITHER_ORDERED;
     }
@@ -529,7 +529,7 @@ struct ImBuf *imb_thumbnail_jpeg(const char *filepath,
     if (i > 0 && !feof(infile)) {
       /* We found a JPEG thumbnail inside this image. */
       ImBuf *ibuf = NULL;
-      unsigned char *buffer = (char *)MEM_callocN(JPEG_APP1_MAX, "thumbbuffer");
+      uchar *buffer = MEM_callocN(JPEG_APP1_MAX, "thumbbuffer");
       /* Just put SOI directly in buffer rather than seeking back 2 bytes. */
       buffer[0] = JPEG_MARKER_MSB;
       buffer[1] = JPEG_MARKER_SOI;
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index 424ab8e085a..81347bce588 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -278,10 +278,10 @@ struct ImBuf *IMB_thumb_load_image(const char *filepath,
 
     if (width > 0 && height > 0) {
       /* Save dimensions of original image into the thumbnail metadata. */
-      char cwidth[40] = "0";
-      char cheight[40] = "0";
-      BLI_snprintf(cwidth, sizeof(cwidth), "%d", width);
-      BLI_snprintf(cheight, sizeof(cheight), "%d", height);
+      char cwidth[40];
+      char cheight[40];
+      SNPRINTF(cwidth, "%zu", width);
+      SNPRINTF(cheight, "%zu", height);
       IMB_metadata_ensure(&ibuf->metadata);
       IMB_metadata_set_field(ibuf->metadata, "Thumb::Image::Width", cwidth);
       IMB_metadata_set_field(ibuf->metadata, "Thumb::Image::Height", cheight);



More information about the Bf-blender-cvs mailing list