[PATCH] tests: avoid too-large constants

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Compiling with gcc 4.1.2 (RHEL 5) complains:

virdbustest.c: In function 'testMessageSimple':
virdbustest.c:61: warning: integer constant is too large for 'long' type
virdbustest.c:62: warning: integer constant is too large for 'long' type
virdbustest.c: In function 'testMessageArray':
virdbustest.c:183: warning: this decimal constant is unsigned only in ISO C90
virdbustest.c: In function 'testMessageStruct':
virdbustest.c:239: warning: integer constant is too large for 'long' type
virdbustest.c:240: warning: integer constant is too large for 'long' type

* tests/virdbustest.c (testMessageSiple, testMessageArray)
(testMessageStruct): Don't violate C89 constant constraints.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---

Pushing under the build-breaker rule.

 tests/virdbustest.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/virdbustest.c b/tests/virdbustest.c
index 61de937..528342b 100644
--- a/tests/virdbustest.c
+++ b/tests/virdbustest.c
@@ -58,8 +58,8 @@ static int testMessageSimple(const void *args ATTRIBUTE_UNUSED)
     unsigned short in_uint16 = 32000, out_uint16 = 0;
     int in_int32 = 100000000, out_int32 = 0;
     unsigned int in_uint32 = 200000000, out_uint32 = 0;
-    long long in_int64 = 1000000000000, out_int64 = 0;
-    unsigned long long in_uint64 = 2000000000000, out_uint64 = 0;
+    long long in_int64 = 1000000000000LL, out_int64 = 0;
+    unsigned long long in_uint64 = 2000000000000LL, out_uint64 = 0;
     double in_double = 3.14159265359, out_double = 0;;
     const char *in_string = "Hello World";
     char *out_string = NULL;
@@ -178,9 +178,9 @@ static int testMessageArray(const void *args ATTRIBUTE_UNUSED)
     DBusMessage *msg = NULL;
     int ret = -1;
     const char *in_str1 = "Hello";
-    int in_int32a = 1000000000, out_int32a = 0;
-    int in_int32b = 2000000000, out_int32b = 0;
-    int in_int32c = 3000000000, out_int32c = 0;
+    int in_int32a = 100000000, out_int32a = 0;
+    int in_int32b = 200000000, out_int32b = 0;
+    int in_int32c = 300000000, out_int32c = 0;
     const char *in_str2 = "World";
     char *out_str1 = NULL, *out_str2 = NULL;

@@ -236,8 +236,8 @@ static int testMessageStruct(const void *args ATTRIBUTE_UNUSED)
     unsigned short in_uint16 = 32000, out_uint16 = 0;
     int in_int32 = 100000000, out_int32 = 0;
     unsigned int in_uint32 = 200000000, out_uint32 = 0;
-    long long in_int64 = 1000000000000, out_int64 = 0;
-    unsigned long long in_uint64 = 2000000000000, out_uint64 = 0;
+    long long in_int64 = 1000000000000LL, out_int64 = 0;
+    unsigned long long in_uint64 = 2000000000000LL, out_uint64 = 0;
     double in_double = 3.14159265359, out_double = 0;;
     const char *in_string = "Hello World";
     char *out_string = NULL;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]