Blame SOURCES/0002-Use-proper-datatypes-for-long-long.patch

85b0d2
From aca713786debd68c81a823c5989afb3de82da45b Mon Sep 17 00:00:00 2001
85b0d2
From: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
85b0d2
Date: Sat, 5 Apr 2008 11:41:34 +0200
85b0d2
Subject: [PATCH 2/3] Use proper datatypes for 'long long'
85b0d2
85b0d2
xmlrpc-c uses 'long long' at some places (e.g. in printf
85b0d2
statements with PRId64) under the assumption that it has a
85b0d2
width of exactly 64 bits.
85b0d2
85b0d2
On 64 bit machines 'long long' has a width of 128 bit and
85b0d2
will cause overhead both in memory and cpu usage there. As
85b0d2
'long long' is used only to handle <i8> datatypes, the patch
85b0d2
uses a plain 64 integer type there.
85b0d2
85b0d2
It is arguable whether 'int_least64_t' (and 'int_least32_t')
85b0d2
would be a better choice for 'int64_t' (and 'int32_t'), but
85b0d2
for now, the patch uses datatypes with exact widths.
85b0d2
---
85b0d2
 include/xmlrpc-c/base.h     | 7 ++++---
85b0d2
 lib/libutil/string_number.c | 1 +
85b0d2
 src/cpp/param_list.cpp      | 2 +-
85b0d2
 3 files changed, 6 insertions(+), 4 deletions(-)
85b0d2
85b0d2
diff --git a/include/xmlrpc-c/base.h b/include/xmlrpc-c/base.h
85b0d2
index e74e2c5..90f2c91 100644
85b0d2
--- a/include/xmlrpc-c/base.h
85b0d2
+++ b/include/xmlrpc-c/base.h
85b0d2
@@ -5,6 +5,7 @@
85b0d2
 
85b0d2
 #include <stddef.h>
85b0d2
 #include <stdarg.h>
85b0d2
+#include <stdint.h>
85b0d2
 #include <time.h>
85b0d2
 #include <xmlrpc-c/c_util.h>  /* For XMLRPC_DLLEXPORT */
85b0d2
 #include <xmlrpc-c/util.h>
85b0d2
@@ -73,9 +74,9 @@ xmlrpc_version(unsigned int * const majorP,
85b0d2
 
85b0d2
 typedef signed int xmlrpc_int;  
85b0d2
     /* An integer of the type defined by XML-RPC <int>; i.e. 32 bit */
85b0d2
-typedef XMLRPC_INT32 xmlrpc_int32;
85b0d2
+typedef int32_t xmlrpc_int32;
85b0d2
     /* An integer of the type defined by XML-RPC <i4>; i.e. 32 bit */
85b0d2
-typedef XMLRPC_INT64 xmlrpc_int64;
85b0d2
+typedef int64_t xmlrpc_int64;
85b0d2
     /* An integer of the type defined by "XML-RPC" <i8>; i.e. 64 bit */
85b0d2
 typedef int xmlrpc_bool;
85b0d2
     /* A boolean (of the type defined by XML-RPC <boolean>, but there's
85b0d2
@@ -112,7 +113,7 @@ typedef int xmlrpc_socket;
85b0d2
 #define XMLRPC_INT32_MAX 0x7fffffff
85b0d2
 #define XMLRPC_INT32_MIN (-XMLRPC_INT32_MAX - 1)
85b0d2
 
85b0d2
-#define XMLRPC_INT64_MAX 0x7fffffffffffffffll
85b0d2
+#define XMLRPC_INT64_MAX ((xmlrpc_int64)0x7fffffffffffffffll)
85b0d2
 #define XMLRPC_INT64_MIN (-XMLRPC_INT64_MAX - 1)
85b0d2
 
85b0d2
 
85b0d2
diff --git a/lib/libutil/string_number.c b/lib/libutil/string_number.c
85b0d2
index 1c284af..a7e78ad 100644
85b0d2
--- a/lib/libutil/string_number.c
85b0d2
+++ b/lib/libutil/string_number.c
85b0d2
@@ -6,6 +6,7 @@
85b0d2
 ============================================================================*/
85b0d2
 #include <stdlib.h>
85b0d2
 #include <string.h>
85b0d2
+#include <inttypes.h>
85b0d2
 #include <errno.h>
85b0d2
 
85b0d2
 #include <xmlrpc-c/base.h>
85b0d2
diff --git a/src/cpp/param_list.cpp b/src/cpp/param_list.cpp
85b0d2
index 1f7ae41..60f7df9 100644
85b0d2
--- a/src/cpp/param_list.cpp
85b0d2
+++ b/src/cpp/param_list.cpp
85b0d2
@@ -277,7 +277,7 @@ paramList::getI8(unsigned int const paramNumber,
85b0d2
         throw(fault("Parameter that is supposed to be 64-bit integer is not", 
85b0d2
                     fault::CODE_TYPE));
85b0d2
 
85b0d2
-    long long const longlongvalue(static_cast<long long>(
85b0d2
+    xmlrpc_int64 const longlongvalue(static_cast<xmlrpc_int64>(
85b0d2
         value_i8(this->paramVector[paramNumber])));
85b0d2
 
85b0d2
     if (longlongvalue < minimum)
85b0d2
-- 
85b0d2
2.13.1
85b0d2