{
int size, l;
- if (f->is_write)
+ if (f->is_write) {
abort();
+ }
size = size1;
while (size > 0) {
if (l == 0) {
qemu_fill_buffer(f);
l = f->buf_size - f->buf_index;
- if (l == 0)
+ if (l == 0) {
break;
+ }
}
- if (l > size)
+ if (l > size) {
l = size;
+ }
memcpy(buf, f->buf + f->buf_index, l);
f->buf_index += l;
buf += l;
static int qemu_peek_byte(QEMUFile *f)
{
- if (f->is_write)
+ if (f->is_write) {
abort();
+ }
if (f->buf_index >= f->buf_size) {
qemu_fill_buffer(f);
- if (f->buf_index >= f->buf_size)
+ if (f->buf_index >= f->buf_size) {
return 0;
+ }
}
return f->buf[f->buf_index];
}
int qemu_get_byte(QEMUFile *f)
{
- if (f->is_write)
+ if (f->is_write) {
abort();
+ }
if (f->buf_index >= f->buf_size) {
qemu_fill_buffer(f);
- if (f->buf_index >= f->buf_size)
+ if (f->buf_index >= f->buf_size) {
return 0;
+ }
}
return f->buf[f->buf_index++];
}