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

Re: [libvirt] [PATCH 2/2] esx: silence spurious compiler warning



On Wed, Jul 28, 2010 at 05:34:15PM -0600, Eric Blake wrote:
> * 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 |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
> index 6e75995..5cf30b1 100644
> --- a/src/esx/esx_vi_types.c
> +++ b/src/esx/esx_vi_types.c
> @@ -333,7 +333,8 @@
>              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);                    \
> -- 
> 1.7.2

  Way harder to understand than the original, IMHO
I defer to Matthias for this :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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