"Dr. David Alan Gilbert" <dgilb...@redhat.com> wrote:
> * Juan Quintela (quint...@redhat.com) wrote:
>> "Dr. David Alan Gilbert" <dgilb...@redhat.com> wrote:
>> >> > +    while (index >= f->buf_size) {
>> >> > +        int received = qemu_fill_buffer(f);
>> >> > +
>> >> > +        if (received <= 0) {
>> >> 
>> >> here, I don't know really what to do.  We just need one character, so
>> >> the 1st call to qemu_fill_buffer() gives it to us, or we are already on
>> >> problems.  i.e. no need of the while() loop.
>> >
>> > The problem is that peek_byte takes an offset, so while qemu_fill_buffer
>> > will get us a byte, we actually need it to get us all the bytes upto the
>> > offset, and that's not guaranteed from one call.
>> 
>> that is not a problem.
>> 
>> We never got a "hole" on the things that we ask for.  We ask for the
>> "next byte", or the "next bytes", so in qemu_peek_byte() we are
>> guaranteed (with current users) that we would only have to read a single
>> byte.
>> 
>> I.e. qemu_peek_{buffer,byte}(....,offset, size) means that we have
>> "already" peek until offset, and now we want size more bytes.
>
> Hmm ok, that is convenient but is neither documented or enforced;
> I'll rework my patch and at least document it, and possibly enforce it.

thanks very much to take the time to understand it and document it O;-)

Later, Juan.

Reply via email to