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