qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs clang.c stb_image.h


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs clang.c stb_image.h
Date: Tue, 20 Oct 2020 05:38:21 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        20/10/20 05:38:21

Modified files:
        .              : clang.c stb_image.h 

Log message:
        fix gcc compile warnings

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.141&r2=1.142
http://cvs.savannah.gnu.org/viewcvs/qemacs/stb_image.h?cvsroot=qemacs&r1=1.4&r2=1.5

Patches:
Index: clang.c
===================================================================
RCS file: /sources/qemacs/qemacs/clang.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -b -r1.141 -r1.142
--- clang.c     17 Oct 2020 21:09:49 -0000      1.141
+++ clang.c     20 Oct 2020 09:38:20 -0000      1.142
@@ -807,7 +807,7 @@
 {
     int offset, offset1, offsetl, c, pos, line_num, col_num;
     int i, eoi_found, len, pos1, lpos, style, line_num1, state;
-    int off, found_semi, found_comma, has_else;
+    int off, qe__unused__ found_semi, found_comma, has_else;
     unsigned int buf[COLORED_MAX_LINE_SIZE];
     QETermStyle sbuf[COLORED_MAX_LINE_SIZE];
     unsigned char stack[MAX_STACK_SIZE];

Index: stb_image.h
===================================================================
RCS file: /sources/qemacs/qemacs/stb_image.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- stb_image.h 4 Oct 2020 23:50:30 -0000       1.4
+++ stb_image.h 20 Oct 2020 09:38:21 -0000      1.5
@@ -4159,8 +4159,8 @@
       if(limit > UINT_MAX / 2) return stbi__err("outofmem", "Out of memory");
       limit *= 2;
    }
-   q = (char *) STBI_REALLOC_SIZED(z->zout_start, old_limit, limit);
    STBI_NOTUSED(old_limit);
+   q = (char *) STBI_REALLOC_SIZED(z->zout_start, old_limit, limit);
    if (q == NULL) return stbi__err("outofmem", "Out of memory");
    z->zout_start = q;
    z->zout       = q + cur;
@@ -5041,7 +5041,8 @@
                while (ioff + c.length > idata_limit)
                   idata_limit *= 2;
                STBI_NOTUSED(idata_limit_old);
-               p = (stbi_uc *) STBI_REALLOC_SIZED(z->idata, idata_limit_old, 
idata_limit); if (p == NULL) return stbi__err("outofmem", "Out of memory");
+               p = (stbi_uc *) STBI_REALLOC_SIZED(z->idata, idata_limit_old, 
idata_limit);
+               if (p == NULL) return stbi__err("outofmem", "Out of memory");
                z->idata = p;
             }
             if (!stbi__getn(s, z->idata+ioff,c.length)) return 
stbi__err("outofdata","Corrupt PNG");
@@ -6806,15 +6807,16 @@
                }
 
                if (delays) {
+                  // XXX: potential memory leak
                   *delays = (int*) STBI_REALLOC_SIZED( *delays, delays_size, 
sizeof(int) * layers );
                   delays_size = layers * sizeof(int);
                }
             } else {
-               out = (stbi_uc*)stbi__malloc( layers * stride );
                out_size = layers * stride;
+               out = (stbi_uc*)stbi__malloc( out_size );
                if (delays) {
-                  *delays = (int*) stbi__malloc( layers * sizeof(int) );
                   delays_size = layers * sizeof(int);
+                  *delays = (int*) stbi__malloc( delays_size );
                }
             }
             memcpy( out + ((layers - 1) * stride), u, stride );



reply via email to

[Prev in Thread] Current Thread [Next in Thread]