qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 05/17] qapi: introduce OptsVisitor


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH v2 05/17] qapi: introduce OptsVisitor
Date: Wed, 13 Jun 2012 16:03:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120422 Thunderbird/10.0.4

On 06/13/12 12:50, Paolo Bonzini wrote:
> Il 13/06/2012 10:22, Laszlo Ersek ha scritto:
>> +static void
>> +opts_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp)
>> +{
>> +    OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v);
>> +    const QemuOpt *opt;
>> +    const char *str;
>> +
>> +    opt = lookup_scalar(ov, name, errp);
>> +    if (!opt) {
>> +        return;
>> +    }
>> +
>> +    str = opt->str;
>> +    if (str != NULL) {
>> +        while (isspace((unsigned char)*str)) {
>> +            ++str;
>> +        }
>> +
>> +        if (*str != '-' && *str != '\0') {
>> +            unsigned long long val;
>> +            char *endptr;
>> +
>> +            /* non-empty, non-negative subject sequence */
>> +            errno = 0;
>> +            val = strtoull(str, &endptr, 0);
>> +            if (*endptr == '\0' && errno == 0 && val <= UINT64_MAX) {
> 
> I would have expected a warning from GCC here, but obviously that's not
> the case?

Right, same surprise here. Maybe gcc has seen the light and it realizes
now "long long" can be wider than 64 bits, theoretically.

Thanks for the review!
Laszlo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]