]> xenbits.xensource.com Git - libvirt.git/commitdiff
esx: silence spurious compiler warning
authorEric Blake <eblake@redhat.com>
Wed, 28 Jul 2010 23:28:44 +0000 (17:28 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 29 Jul 2010 20:36:43 +0000 (14:36 -0600)
* src/esx/esx_vi_types.c (_DESERIALIZE_NUMBER)
(ESX_VI__TEMPLATE__DESERIALIZE_NUMBER): Add range check to shut up
gcc 4.5.0 regarding long long.

src/esx/esx_vi_types.c

index 6e759950a9fd0d8547c43c3b3a42a8eb2312bb1a..5cf30b1ccfb218085159c104dd5b8a8b9465f13c 100644 (file)
             goto cleanup;                                                     \
         }                                                                     \
                                                                               \
-        if (value < (_min) || value > (_max)) {                               \
+        if (((_min) != INT64_MIN && value < (_min))                           \
+            || ((_max) != INT64_MAX && value > (_max))) {                     \
             ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                              \
                          "Value '%s' is not representable as "_xsdType,       \
                          (const char *)string);                               \
@@ -922,7 +923,8 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
                 goto failure;                                                 \
             }                                                                 \
                                                                               \
-            if (number < (_min) || number > (_max)) {                         \
+            if (((_min) != INT64_MIN && number < (_min))                      \
+                || ((_max) != INT64_MAX && number > (_max))) {                \
                 ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                          \
                              _("Value '%s' is out of %s range"),              \
                              (*anyType)->value, _xsdType);                    \