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

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