Fix Linux/GCC compiler warning in recent fixes.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 17 Jan 2018 20:11:59 +0000 (21:11 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Wed, 17 Jan 2018 23:54:07 +0000 (00:54 +0100)
source/blender/imbuf/intern/cineon/logImageCore.c
source/blender/imbuf/intern/iris.c
source/blender/imbuf/intern/radiance_hdr.c

index 376d40a5f6beccdd54d06212a22b33e52ad730f0..bb72f675cb803755dc27c1bf40fa2d48b89fe8cb 100644 (file)
@@ -701,7 +701,7 @@ static int logImageElementGetData10Packed(LogImageFile *logImage, LogImageElemen
        for (size_t y = 0; y < logImage->height; y++) {
                /* seek to data */
                if (logimage_fseek(logImage, y * rowLength + logElement.dataOffset, SEEK_SET) != 0) {
-                       if (verbose) printf("DPX/Cineon: Couldn't seek at %u\n", (int)(y * rowLength + logElement.dataOffset));
+                       if (verbose) printf("DPX/Cineon: Couldn't seek at %u\n", (unsigned int)(y * rowLength + logElement.dataOffset));
                        return 1;
                }
 
@@ -779,7 +779,7 @@ static int logImageElementGetData12Packed(LogImageFile *logImage, LogImageElemen
        for (size_t y = 0; y < logImage->height; y++) {
                /* seek to data */
                if (logimage_fseek(logImage, y * rowLength + logElement.dataOffset, SEEK_SET) != 0) {
-                       if (verbose) printf("DPX/Cineon: Couldn't seek at %u\n", (int)(y * rowLength + logElement.dataOffset));
+                       if (verbose) printf("DPX/Cineon: Couldn't seek at %u\n", (unsigned int)(y * rowLength + logElement.dataOffset));
                        return 1;
                }
 
index c62829cb8faaec449928371c53d65645d259aafa..55727ed669734513d5c25aa89d8338828a673b0a 100644 (file)
@@ -261,7 +261,7 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors
        MFileOffset _inf_data = {mem, 0}, *inf = &_inf_data;
        IMAGE image;
        int bpp, rle, cur, badorder;
-       ImBuf *ibuf;
+       ImBuf *ibuf = NULL;
        uchar dirty_flag = 0;
 
        if (size < HEADER_SIZE) {
index cecebf7bfa39a4ee2dbb89903f702d3414b8f7cd..8d822a314f54deaefc0dc31e7a0dc5dbb7483442 100644 (file)
@@ -138,7 +138,7 @@ static const unsigned char *freadcolrs(RGBE *scan, const unsigned char *mem, int
                                if (UNLIKELY(code + j > xmax)) {
                                        return NULL;
                                }
-                               int val = *mem++;
+                               val = *mem++;
                                while (code--) {
                                        scan[j++][i] = (unsigned char)val;
                                }
@@ -263,7 +263,7 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem, size_t size, int flags, char
                                        printf("WARNING! HDR decode error, image may be just truncated, or completely wrong...\n");
                                        break;
                                }
-                               for (size_t x = 0; x < width; x++) {
+                               for (x = 0; x < width; x++) {
                                        /* convert to ldr */
                                        RGBE2FLOAT(sline[x], fcol);
                                        *rect_float++ = fcol[RED];
@@ -302,8 +302,7 @@ static int fwritecolrs(FILE *file, int width, int channels, unsigned char *ibufs
        rgbe_scan = (RGBE *)MEM_mallocN(sizeof(RGBE) * width, "radhdr_write_tmpscan");
 
        /* convert scanline */
-       size_t j = 0;
-       for (size_t i = 0; i < width; i++) {
+       for (size_t i = 0, j = 0; i < width; i++) {
                if (fpscan) {
                        fcol[RED] = fpscan[j];
                        fcol[GRN] = (channels >= 2) ? fpscan[j + 1] : fpscan[j];
@@ -400,7 +399,7 @@ int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags)
        if (ibuf->rect_float)
                fp = ibuf->rect_float + ibuf->channels * (height - 1) * width;
        
-       for (size_t y = height - 1; y >= 0; y--) {
+       for (size_t y = 0; y < height; y++) {
                if (fwritecolrs(file, width, ibuf->channels, cp, fp) < 0) {
                        fclose(file);
                        printf("HDR write error\n");