]> git.pld-linux.org Git - packages/xmlrpc-c.git/blame - xmlrpc-c-longlong.patch
- updated to 1.39.12 (from super stable branch)
[packages/xmlrpc-c.git] / xmlrpc-c-longlong.patch
CommitLineData
3671422b 1From 4d3bbc5d59418666a5fc91c8fe3e301ee9c89b32 Mon Sep 17 00:00:00 2001
65007067
ER
2From: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
3Date: Sat, 5 Apr 2008 11:41:34 +0200
3671422b 4Subject: [PATCH 3/8] Use proper datatypes for 'long long'
65007067
ER
5
6xmlrpc-c uses 'long long' at some places (e.g. in printf
7statements with PRId64) under the assumption that it has a
8width of exactly 64 bits.
9
10On 64 bit machines 'long long' has a width of 128 bit and
11will cause overhead both in memory and cpu usage there. As
12'long long' is used only to handle <i8> datatypes, the patch
13uses a plain 64 integer type there.
14
15It is arguable whether 'int_least64_t' (and 'int_least32_t')
16would be a better choice for 'int64_t' (and 'int32_t'), but
17for now, the patch uses datatypes with exact widths.
18---
3671422b
JB
19 include/xmlrpc-c/base.h | 7 ++++---
20 lib/libutil/string_number.c | 1 +
21 src/cpp/param_list.cpp | 8 ++++----
22 3 files changed, 9 insertions(+), 7 deletions(-)
65007067
ER
23
24diff --git a/include/xmlrpc-c/base.h b/include/xmlrpc-c/base.h
3671422b 25index cdc9161..cbdf3d0 100644
65007067
ER
26--- a/include/xmlrpc-c/base.h
27+++ b/include/xmlrpc-c/base.h
3671422b 28@@ -5,6 +5,7 @@
65007067
ER
29
30 #include <stddef.h>
31 #include <stdarg.h>
32+#include <stdint.h>
33 #include <time.h>
3671422b 34 #include <xmlrpc-c/c_util.h>
65007067 35 #include <xmlrpc-c/util.h>
3671422b 36@@ -50,9 +51,9 @@ xmlrpc_version(unsigned int * const majorP,
65007067
ER
37
38 typedef signed int xmlrpc_int;
39 /* An integer of the type defined by XML-RPC <int>; i.e. 32 bit */
40-typedef XMLRPC_INT32 xmlrpc_int32;
41+typedef int32_t xmlrpc_int32;
42 /* An integer of the type defined by XML-RPC <i4>; i.e. 32 bit */
43-typedef XMLRPC_INT64 xmlrpc_int64;
44+typedef int64_t xmlrpc_int64;
45 /* An integer of the type defined by "XML-RPC" <i8>; i.e. 64 bit */
46 typedef int xmlrpc_bool;
47 /* A boolean (of the type defined by XML-RPC <boolean>, but there's
3671422b
JB
48@@ -89,7 +90,7 @@ typedef int xmlrpc_socket;
49 #define XMLRPC_INT32_MAX 0x7fffffff
50 #define XMLRPC_INT32_MIN (-XMLRPC_INT32_MAX - 1)
51
52-#define XMLRPC_INT64_MAX 0x7fffffffffffffffll
53+#define XMLRPC_INT64_MAX ((xmlrpc_int64)0x7fffffffffffffffll)
54 #define XMLRPC_INT64_MIN (-XMLRPC_INT64_MAX - 1)
65007067 55
65007067 56
3671422b
JB
57diff --git a/lib/libutil/string_number.c b/lib/libutil/string_number.c
58index 1c284af..a7e78ad 100644
59--- a/lib/libutil/string_number.c
60+++ b/lib/libutil/string_number.c
61@@ -6,6 +6,7 @@
62 ============================================================================*/
63 #include <stdlib.h>
64 #include <string.h>
65+#include <inttypes.h>
66 #include <errno.h>
65007067 67
3671422b 68 #include <xmlrpc-c/base.h>
65007067
ER
69diff --git a/src/cpp/param_list.cpp b/src/cpp/param_list.cpp
70index 67c636b..60f7df9 100644
71--- a/src/cpp/param_list.cpp
72+++ b/src/cpp/param_list.cpp
65007067
ER
73@@ -277,7 +277,7 @@ paramList::getI8(unsigned int const paramNumber,
74 throw(fault("Parameter that is supposed to be 64-bit integer is not",
75 fault::CODE_TYPE));
76
77- long long const longlongvalue(static_cast<long long>(
78+ xmlrpc_int64 const longlongvalue(static_cast<xmlrpc_int64>(
79 value_i8(this->paramVector[paramNumber])));
80
81 if (longlongvalue < minimum)
65007067 82--
3671422b 831.7.4
65007067 84
This page took 0.138562 seconds and 4 git commands to generate.