Paolo Bonzini <pbonz...@redhat.com> wrote:
> On 10/06/2011 06:21 PM, Juan Quintela wrote:
>> +
>> +int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size)
>> +{
>> +    int pending = size;
>> +    int done = 0;
>> +
>> +    while (pending>  0) {
>> +        int res;
>> +
>> +        res = qemu_peek_buffer(f, buf, pending, 0);
>> +        if (res == 0) {
>> +            return 0;

should this line return "done" insntead?

>>           }
>> -        memcpy(buf, f->buf + f->buf_index, l);
>> -        f->buf_index += l;
>> -        buf += l;
>> -        size -= l;
>> +        qemu_file_skip(f, res);
>> +        buf += res;
>> +        pending -= res;
>> +        done += res;
>>       }
>> -    return size1 - size;
>> +    return done;
>>   }
>
> This changes semantics for reads above 32KB.  It should be in the
> commit message, or preferably v1 could be committed instead. :)

how it changes?  My understanding is that we read the same, only change
that I can think of is the one that I have jsut shown (and that is on
the error case).

Later, Juan.

Reply via email to