[Commits] [SCM] claws branch, master, updated. 3.18.0-324-gb7792aad0

miras at claws-mail.org miras at claws-mail.org
Sun Jan 2 15:13:12 UTC 2022


The branch, master has been updated
       via  b7792aad0de10bd477e3b3ff936a3a915cdd2067 (commit)
      from  67f11d6278e90c587aca21aa056a8f96a6ecd807 (commit)

Summary of changes:
 src/common/utils.h | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit b7792aad0de10bd477e3b3ff936a3a915cdd2067
Author: Michael Rasmussen <mir at datanom.net>
Date:   Sun Jan 2 16:12:56 2022 +0100

    Fix -Wformat warnings. Adapted patch for gtk3 branch by Jonathan Boeing
    
    Signed-off-by: Michael Rasmussen <mir at datanom.net>

diff --git a/src/common/utils.h b/src/common/utils.h
index 3e378e5ea..2e58f15a6 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -103,8 +103,9 @@ typedef gint64 goffset;
 
 #define Xalloca(ptr, size, iffail) \
 { \
-        if (size > MAX_ALLOCA_MEM_SIZE) { \
-                g_warning("%ld: Exceeds max allowed memory '%d'", size, MAX_ALLOCA_MEM_SIZE); \
+        size_t __size = size; \
+        if (__size > MAX_ALLOCA_MEM_SIZE) { \
+                g_warning("%" G_GSIZE_FORMAT " bytes exceeds max alloca size '%d'", __size, MAX_ALLOCA_MEM_SIZE); \
                 iffail; \
         } \
         if ((ptr = alloca(size)) == NULL) { \
@@ -116,13 +117,13 @@ typedef gint64 goffset;
 #define Xstrdup_a(ptr, str, iffail) \
 { \
         gchar *__tmp; \
-        ssize_t size = strlen(str); \
+        size_t __size = strlen(str); \
  \
-        if (size > MAX_ALLOCA_MEM_SIZE) { \
-                g_warning("%ld: Exceeds max allowed memory '%d'", size, MAX_ALLOCA_MEM_SIZE); \
+        if (__size > MAX_ALLOCA_MEM_SIZE) { \
+                g_warning("%" G_GSIZE_FORMAT " bytes exceeds max alloca size '%d'", __size, MAX_ALLOCA_MEM_SIZE); \
                 iffail; \
         } \
-        if ((__tmp = alloca(size + 1)) == NULL) { \
+        if ((__tmp = alloca(__size + 1)) == NULL) { \
                 g_warning("can't allocate memory"); \
                 iffail; \
         } else \
@@ -134,17 +135,18 @@ typedef gint64 goffset;
 #define Xstrndup_a(ptr, str, len, iffail) \
 { \
         gchar *__tmp; \
+        size_t __size = len; \
  \
-        if (len > MAX_ALLOCA_MEM_SIZE) { \
-                g_warning("%ld: Exceeds max allowed memory '%d'", len, MAX_ALLOCA_MEM_SIZE); \
+        if (__size > MAX_ALLOCA_MEM_SIZE) { \
+                g_warning("%" G_GSIZE_FORMAT "bytes exceeds max alloca size '%d'", __size, MAX_ALLOCA_MEM_SIZE); \
                 iffail; \
         } \
-        if ((__tmp = alloca(len + 1)) == NULL) { \
+        if ((__tmp = alloca(__size + 1)) == NULL) { \
                 g_warning("can't allocate memory"); \
                 iffail; \
         } else { \
-                memcpy(__tmp, str, len); \
-                __tmp[len] = '\0'; \
+                memcpy(__tmp, str, __size); \
+                __tmp[__size] = '\0'; \
         } \
  \
         ptr = __tmp; \
@@ -153,12 +155,12 @@ typedef gint64 goffset;
 #define Xstrcat_a(ptr, str1, str2, iffail) \
 { \
         gchar *__tmp; \
-        gint len1, len2; \
+        size_t len1, len2; \
  \
         len1 = strlen(str1); \
         len2 = strlen(str2); \
         if (len1 + len2 > MAX_ALLOCA_MEM_SIZE) { \
-                g_warning("%ld: Exceeds max allowed memory '%d'", len1 + len2, MAX_ALLOCA_MEM_SIZE); \
+                g_warning("%" G_GSIZE_FORMAT " bytes exceeds max alloca size '%d'", len1 + len2, MAX_ALLOCA_MEM_SIZE); \
                 iffail; \
         } \
         if ((__tmp = alloca(len1 + len2 + 1)) == NULL) { \

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list