[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-395-g28b9c8e65

miras at claws-mail.org miras at claws-mail.org
Sun Jan 2 15:01:09 UTC 2022


The branch, gtk3 has been updated
       via  28b9c8e65997b22d0d0c89ea5af000ad5edc5468 (commit)
      from  7464133afbb78b20333a3067ed45ad7676406e96 (commit)

Summary of changes:
 src/common/utils.h | 49 ++++++++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 23 deletions(-)


- Log -----------------------------------------------------------------
commit 28b9c8e65997b22d0d0c89ea5af000ad5edc5468
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Wed Dec 29 04:43:19 2021 -0700

    Fix -Wformat warnings

diff --git a/src/common/utils.h b/src/common/utils.h
index 8d7ed89fc..5ce8d9580 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
@@ -103,11 +103,13 @@ 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); \
-                iffail; \
-        } \
-	if ((ptr = alloca(size)) == NULL) { \
+	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) { \
 		g_warning("can't allocate memory"); \
 		iffail; \
 	} \
@@ -116,13 +118,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); \
-                iffail; \
-        } \
-	if ((__tmp = alloca(size + 1)) == NULL) { \
+	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) { \
 		g_warning("can't allocate memory"); \
 		iffail; \
 	} else \
@@ -134,17 +136,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); \
-                iffail; \
-        } \
-	if ((__tmp = alloca(len + 1)) == NULL) { \
+	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) { \
 		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,14 +156,14 @@ 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); \
-                iffail; \
-        } \
+	if (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) { \
 		g_warning("can't allocate memory"); \
 		iffail; \

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list