--- a/source.c
+++ b/source.c
@@ -2,11 +2,11 @@

                                       uint8_t ep)

+{
+
+    AsyncURB *aurb = async_alloc(dev, p);
+
+    struct usb_redir_bulk_packet_header bulk_packet;

static int usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p,

                                      uint8_t ep)

{

    AsyncURB *aurb = async_alloc(dev, p);

    struct usb_redir_bulk_packet_header bulk_packet;

    DPRINTF("bulk-out ep %02X len %zd id %u\n", ep,

            p->iov.size, aurb->packet_id);

    bulk_packet.endpoint  = ep;

    bulk_packet.length    = p->iov.size;

    bulk_packet.stream_id = 0;

    aurb->bulk_packet = bulk_packet;

    if (ep & USB_DIR_IN) {

        usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id,

                                        &bulk_packet, NULL, 0);

    } else {

        uint8_t buf[p->iov.size];

        usb_packet_copy(p, buf, p->iov.size);

        usbredir_log_data(dev, "bulk data out:", buf, p->iov.size);

        usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id,

                                        &bulk_packet, buf, p->iov.size);

    }

    usbredirparser_do_write(dev->parser);

    return USB_RET_ASYNC;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 char *object_property_print(Object *obj, const char *name, bool human,

+                            Error **errp)

+{

     StringOutputVisitor *mo;

char *object_property_print(Object *obj, const char *name, bool human,

                            Error **errp)

{

    StringOutputVisitor *mo;

    char *string;

    mo = string_output_visitor_new(human);

    object_property_get(obj, string_output_get_visitor(mo), name, errp);

    string = string_output_get_string(mo);

    string_output_visitor_cleanup(mo);

    return string;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void dump_ops(const uint16_t *opc_buf)
+
+{
+
+    const uint16_t *opc_ptr;
+
     int c;

     opc_ptr = opc_buf;

static void dump_ops(const uint16_t *opc_buf)

{

    const uint16_t *opc_ptr;

    int c;

    opc_ptr = opc_buf;

    for(;;) {

        c = *opc_ptr++;

        fprintf(logfile, "0x%04x: %s\n", opc_ptr - opc_buf - 1, op_str[c]);

        if (c == INDEX_op_end)

            break;

    }

}


--- a/source.c
+++ b/source.c
@@ -3,5 +3,5 @@
 {

     module_call_init(MODULE_INIT_BLOCK);
+
 }

void bdrv_init(void)

{

    module_call_init(MODULE_INIT_BLOCK);

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     PCIBus *bus;

     int devfn, rc;
+

     /* initialize cap_present for pci_is_express() and pci_config_size() */

static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)

{

    PCIDevice *pci_dev = (PCIDevice *)qdev;

    PCIDeviceInfo *info = container_of(base, PCIDeviceInfo, qdev);

    PCIBus *bus;

    int devfn, rc;

    /* initialize cap_present for pci_is_express() and pci_config_size() */

    if (info->is_express) {

        pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;

    }

    bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(qdev));

    devfn = pci_dev->devfn;

    pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,

                                     info->config_read, info->config_write,

                                     info->header_type);

    assert(pci_dev);

    rc = info->init(pci_dev);

    if (rc != 0)

        return rc;

    if (qdev->hotplugged)

        bus->hotplug(pci_dev, 1);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -17,7 +17,7 @@
     if (kernel_filename && !qtest_enabled()) {

         kernel_size = load_elf(kernel_filename, NULL, NULL,
+
                                &elf_entry, NULL, NULL, 1, ELF_MACHINE, 1);

         entry = elf_entry;

static void cpu_openrisc_load_kernel(ram_addr_t ram_size,

                                     const char *kernel_filename,

                                     OpenRISCCPU *cpu)

{

    long kernel_size;

    uint64_t elf_entry;

    hwaddr entry;

    if (kernel_filename && !qtest_enabled()) {

        kernel_size = load_elf(kernel_filename, NULL, NULL,

                               &elf_entry, NULL, NULL, 1, ELF_MACHINE, 1);

        entry = elf_entry;

        if (kernel_size < 0) {

            kernel_size = load_uimage(kernel_filename,

                                      &entry, NULL, NULL);

        }

        if (kernel_size < 0) {

            kernel_size = load_image_targphys(kernel_filename,

                                              KERNEL_LOAD_ADDR,

                                              ram_size - KERNEL_LOAD_ADDR);

            entry = KERNEL_LOAD_ADDR;

        }

        if (kernel_size < 0) {

            fprintf(stderr, "QEMU: couldn't load the kernel '%s'\n",

                    kernel_filename);

            exit(1);

        }

    }

    cpu->env.pc = entry;

}


--- a/source.c
+++ b/source.c
@@ -5,5 +5,5 @@
 {

     test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_INTEGER);
+
+}

static void test_visitor_out_native_list_int(TestOutputVisitorData *data,

                                             const void *unused)

{

    test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_INTEGER);

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
 {

     MovieContext *movie = outlink->src->priv;
+
+    int ret;
+
+
+
     if (movie->is_done)

         return AVERROR_EOF;

static int amovie_request_frame(AVFilterLink *outlink)

{

    MovieContext *movie = outlink->src->priv;

    int ret;

    if (movie->is_done)

        return AVERROR_EOF;

    do {

        if ((ret = amovie_get_samples(outlink)) < 0)

            return ret;

    } while (!movie->samplesref);

    ff_filter_samples(outlink, avfilter_ref_buffer(movie->samplesref, ~0));

    avfilter_unref_buffer(movie->samplesref);

    movie->samplesref = NULL;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void qemu_unregister_clock_reset_notifier(QEMUClock *clock,
+
                                           Notifier *notifier)

 {

void qemu_unregister_clock_reset_notifier(QEMUClock *clock,

                                          Notifier *notifier)

{

    qemu_clock_unregister_reset_notifier(clock->type, notifier);

}


--- a/source.c
+++ b/source.c
@@ -7,10 +7,10 @@

     virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+
+                                TYPE_VIRTIO_CRYPTO);
+
+    object_property_add_alias(obj, "cryptodev", OBJECT(&dev->vdev),

                               "cryptodev", &error_abort);

static void virtio_crypto_initfn(Object *obj)

{

    VirtIOCryptoPCI *dev = VIRTIO_CRYPTO_PCI(obj);

    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),

                                TYPE_VIRTIO_CRYPTO);

    object_property_add_alias(obj, "cryptodev", OBJECT(&dev->vdev),

                              "cryptodev", &error_abort);

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
             continue;

         }
+
+        /* Write value and confirm it reads back as written
+
+         * (to catch read-only registers and partially read-only
+
          * registers where the incoming migration value doesn't match)

          */

bool write_list_to_cpustate(ARMCPU *cpu)

{

    int i;

    bool ok = true;

    for (i = 0; i < cpu->cpreg_array_len; i++) {

        uint32_t regidx = kvm_to_cpreg_id(cpu->cpreg_indexes[i]);

        uint64_t v = cpu->cpreg_values[i];

        const ARMCPRegInfo *ri;

        ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);

        if (!ri) {

            ok = false;

            continue;

        }

        if (ri->type & ARM_CP_NO_MIGRATE) {

            continue;

        }

        /* Write value and confirm it reads back as written

         * (to catch read-only registers and partially read-only

         * registers where the incoming migration value doesn't match)

         */

        write_raw_cp_reg(&cpu->env, ri, v);

        if (read_raw_cp_reg(&cpu->env, ri) != v) {

            ok = false;

        }

    }

    return ok;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void string_deserialize(void **native_out, void *datap,

+                               VisitorFunc visit, Error **errp)

 {

static void string_deserialize(void **native_out, void *datap,

                               VisitorFunc visit, Error **errp)

{

    StringSerializeData *d = datap;

    d->siv = string_input_visitor_new(string_output_get_string(d->sov));

    visit(string_input_get_visitor(d->siv), native_out, errp);

}


--- a/source.c
+++ b/source.c
@@ -55,11 +55,11 @@
     VNC_DEBUG("Handshake done, switching to TLS data mode\n");

     qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs);
+
+
+
+    start_auth_vencrypt_subauth(vs);
+

     return 0;

static int vnc_start_vencrypt_handshake(struct VncState *vs) {

    int ret;

    if ((ret = gnutls_handshake(vs->tls.session)) < 0) {

       if (!gnutls_error_is_fatal(ret)) {

           VNC_DEBUG("Handshake interrupted (blocking)\n");

           if (!gnutls_record_get_direction(vs->tls.session))

               qemu_set_fd_handler(vs->csock, vnc_tls_handshake_io, NULL, vs);

           else

               qemu_set_fd_handler(vs->csock, NULL, vnc_tls_handshake_io, vs);

           return 0;

       }

       VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(ret));

       vnc_client_error(vs);

       return -1;

    }

    if (vs->vd->tls.x509verify) {

        if (vnc_tls_validate_certificate(vs) < 0) {

            VNC_DEBUG("Client verification failed\n");

            vnc_client_error(vs);

            return -1;

        } else {

            VNC_DEBUG("Client verification passed\n");

        }

    }

    VNC_DEBUG("Handshake done, switching to TLS data mode\n");

    qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs);

    start_auth_vencrypt_subauth(vs);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int get_riff(AVFormatContext *s, AVIOContext *pb)

+{

     AVIContext *avi = s->priv_data;

static int get_riff(AVFormatContext *s, AVIOContext *pb)

{

    AVIContext *avi = s->priv_data;

    char header[8];

    int i;

    /* check RIFF header */

    avio_read(pb, header, 4);

    avi->riff_end  = avio_rl32(pb); /* RIFF chunk size */

    avi->riff_end += avio_tell(pb); /* RIFF chunk end */

    avio_read(pb, header + 4, 4);

    for (i = 0; avi_headers[i][0]; i++)

        if (!memcmp(header, avi_headers[i], 8))

            break;

    if (!avi_headers[i][0])

        return AVERROR_INVALIDDATA;

    if (header[7] == 0x19)

        av_log(s, AV_LOG_INFO,

               "This file has been generated by a totally broken muxer.\n");

    return 0;

}


static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)

{

    TPMInfo *res = g_new0(TPMInfo, 1);

    TPMPassthroughOptions *tpo;

    res->id = g_strdup(drv->id);

    res->model = drv->fe_model;

    res->options = g_new0(TpmTypeOptions, 1);

    switch (drv->ops->type) {

    case TPM_TYPE_PASSTHROUGH:

        res->options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH;

        tpo = g_new0(TPMPassthroughOptions, 1);

        res->options->u.passthrough = tpo;

        if (drv->path) {

            tpo->path = g_strdup(drv->path);

            tpo->has_path = true;

        }

        if (drv->cancel_path) {

            tpo->cancel_path = g_strdup(drv->cancel_path);

            tpo->has_cancel_path = true;

        }

        break;

    case TPM_TYPE__MAX:

        break;

    }

    return res;

}


--- a/source.c
+++ b/source.c
@@ -54,11 +54,11 @@

     request->from   = ldq_be_p(buf + 16);

+    request->len    = ldl_be_p(buf + 24);
+
+
+
+    TRACE("Got request: { magic = 0x%" PRIx32 ", .type = %" PRIx32

           ", from = %" PRIu64 " , len = %" PRIu32 " }",

static ssize_t nbd_receive_request(QIOChannel *ioc, struct nbd_request *request)

{

    uint8_t buf[NBD_REQUEST_SIZE];

    uint32_t magic;

    ssize_t ret;

    ret = read_sync(ioc, buf, sizeof(buf));

    if (ret < 0) {

        return ret;

    }

    if (ret != sizeof(buf)) {

        LOG("read failed");

        return -EINVAL;

    }

    /* Request

       [ 0 ..  3]   magic   (NBD_REQUEST_MAGIC)

       [ 4 ..  7]   type    (0 == READ, 1 == WRITE)

       [ 8 .. 15]   handle

       [16 .. 23]   from

       [24 .. 27]   len

     */

    magic = ldl_be_p(buf);

    request->type   = ldl_be_p(buf + 4);

    request->handle = ldq_be_p(buf + 8);

    request->from   = ldq_be_p(buf + 16);

    request->len    = ldl_be_p(buf + 24);

    TRACE("Got request: { magic = 0x%" PRIx32 ", .type = %" PRIx32

          ", from = %" PRIu64 " , len = %" PRIu32 " }",

          magic, request->type, request->from, request->len);

    if (magic != NBD_REQUEST_MAGIC) {

        LOG("invalid magic (got 0x%" PRIx32 ")", magic);

        return -EINVAL;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -41,9 +41,9 @@
     close(s->efd);

 out_free_state:
+
+    qemu_free(s);
+
+    return NULL;
+
 }

void *laio_init(void)

{

    struct qemu_laio_state *s;

    s = qemu_mallocz(sizeof(*s));

    QLIST_INIT(&s->completed_reqs);

    s->efd = eventfd(0, 0);

    if (s->efd == -1)

        goto out_free_state;

    fcntl(s->efd, F_SETFL, O_NONBLOCK);

    if (io_setup(MAX_EVENTS, &s->ctx) != 0)

        goto out_close_efd;

    qemu_aio_set_fd_handler(s->efd, qemu_laio_completion_cb, NULL,

        qemu_laio_flush_cb, qemu_laio_process_requests, s);

    return s;

out_close_efd:

    close(s->efd);

out_free_state:

    qemu_free(s);

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
+static uint64_t boston_lcd_read(void *opaque, hwaddr addr,
+
+                                unsigned size)
+
+{
+
+    BostonState *s = opaque;
+
+    uint64_t val = 0;
+
+
+
+    switch (size) {

+    case 8:

         val |= (uint64_t)s->lcd_content[(addr + 7) & 0x7] << 56;

static uint64_t boston_lcd_read(void *opaque, hwaddr addr,

                                unsigned size)

{

    BostonState *s = opaque;

    uint64_t val = 0;

    switch (size) {

    case 8:

        val |= (uint64_t)s->lcd_content[(addr + 7) & 0x7] << 56;

        val |= (uint64_t)s->lcd_content[(addr + 6) & 0x7] << 48;

        val |= (uint64_t)s->lcd_content[(addr + 5) & 0x7] << 40;

        val |= (uint64_t)s->lcd_content[(addr + 4) & 0x7] << 32;

        /* fall through */

    case 4:

        val |= (uint64_t)s->lcd_content[(addr + 3) & 0x7] << 24;

        val |= (uint64_t)s->lcd_content[(addr + 2) & 0x7] << 16;

        /* fall through */

    case 2:

        val |= (uint64_t)s->lcd_content[(addr + 1) & 0x7] << 8;

        /* fall through */

    case 1:

        val |= (uint64_t)s->lcd_content[(addr + 0) & 0x7];

        break;

    }

    return val;

}


--- a/source.c
+++ b/source.c
@@ -2,11 +2,11 @@

 {

+    QDict *qdict;
+
+
+
+    qdict = qdict_new();

     fail_unless(qdict != NULL);

START_TEST(qdict_new_test)

{

    QDict *qdict;

    qdict = qdict_new();

    fail_unless(qdict != NULL);

    fail_unless(qdict_size(qdict) == 0);

    fail_unless(qdict->base.refcnt == 1);

    fail_unless(qobject_type(QOBJECT(qdict)) == QTYPE_QDICT);

    // destroy doesn't exit yet

    free(qdict);

}


--- a/source.c
+++ b/source.c
@@ -24,11 +24,11 @@

         if (mask) {

+            TCGv tmp = tcg_temp_new(TCG_TYPE_I64);
+
+            tcg_gen_andi_i64(tmp, cpu_ir[ra], 1);
+
+            tcg_gen_brcondi_i64(inv_cond, tmp, 0, l1);

             tcg_temp_free(tmp);

static always_inline void gen_cmov (TCGCond inv_cond,

                                    int ra, int rb, int rc,

                                    int islit, uint8_t lit, int mask)

{

    int l1;

    if (unlikely(rc == 31))

        return;

    l1 = gen_new_label();

    if (ra != 31) {

        if (mask) {

            TCGv tmp = tcg_temp_new(TCG_TYPE_I64);

            tcg_gen_andi_i64(tmp, cpu_ir[ra], 1);

            tcg_gen_brcondi_i64(inv_cond, tmp, 0, l1);

            tcg_temp_free(tmp);

        } else

            tcg_gen_brcondi_i64(inv_cond, cpu_ir[ra], 0, l1);

    } else {

        /* Very uncommon case - Do not bother to optimize.  */

        TCGv tmp = tcg_const_i64(0);

        tcg_gen_brcondi_i64(inv_cond, tmp, 0, l1);

        tcg_temp_free(tmp);

    }

    if (islit)

        tcg_gen_movi_i64(cpu_ir[rc], lit);

    else

        tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[rb]);

    gen_set_label(l1);

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
         tramp->fd_read(tramp->opaque);

     }
+
+
+
+    if ((cond & G_IO_OUT) && tramp->fd_write) {
+
         tramp->fd_write(tramp->opaque);

     }

static gboolean fd_trampoline(GIOChannel *chan, GIOCondition cond, gpointer opaque)

{

    IOTrampoline *tramp = opaque;

    if ((cond & G_IO_IN) && tramp->fd_read) {

        tramp->fd_read(tramp->opaque);

    }

    if ((cond & G_IO_OUT) && tramp->fd_write) {

        tramp->fd_write(tramp->opaque);

    }

    return TRUE;

}


--- a/source.c
+++ b/source.c
@@ -16,8 +16,8 @@

     gen_jmp_tb(s, next_eip, 1);

+    gen_set_label(l1);
+
+    return l2;
+
+}

static int gen_jz_ecx_string(DisasContext *s, target_ulong next_eip)

{

    int l1, l2;

    l1 = gen_new_label();

    l2 = gen_new_label();

    gen_op_jnz_ecx[s->aflag](l1);

    gen_set_label(l2);

    gen_jmp_tb(s, next_eip, 1);

    gen_set_label(l1);

    return l2;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
         f->iov[f->iovcnt++].iov_len = size;

     }
+
+
+
+    if (f->buf_index >= IO_BUF_SIZE || f->iovcnt >= MAX_IOV_SIZE) {
+
         qemu_fflush(f);

     }

static void add_to_iovec(QEMUFile *f, const uint8_t *buf, int size)

{

    /* check for adjacent buffer and coalesce them */

    if (f->iovcnt > 0 && buf == f->iov[f->iovcnt - 1].iov_base +

        f->iov[f->iovcnt - 1].iov_len) {

        f->iov[f->iovcnt - 1].iov_len += size;

    } else {

        f->iov[f->iovcnt].iov_base = (uint8_t *)buf;

        f->iov[f->iovcnt++].iov_len = size;

    }

    if (f->buf_index >= IO_BUF_SIZE || f->iovcnt >= MAX_IOV_SIZE) {

        qemu_fflush(f);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,22 +1,22 @@
+static void display_picref(AVFilterBufferRef *picref, AVRational time_base)

 {

+    int x, y;

+    uint8_t *p0, *p;

     int64_t delay;
+

+
     if (picref->pts != AV_NOPTS_VALUE) {
+
         if (last_pts != AV_NOPTS_VALUE) {
+
             /* sleep roughly the right amount of time;

+             * usleep is in microseconds, just like AV_TIME_BASE. */

             delay = av_rescale_q(picref->pts - last_pts,

static void display_picref(AVFilterBufferRef *picref, AVRational time_base)

{

    int x, y;

    uint8_t *p0, *p;

    int64_t delay;

    if (picref->pts != AV_NOPTS_VALUE) {

        if (last_pts != AV_NOPTS_VALUE) {

            /* sleep roughly the right amount of time;

             * usleep is in microseconds, just like AV_TIME_BASE. */

            delay = av_rescale_q(picref->pts - last_pts,

                                 time_base, AV_TIME_BASE_Q);

            if (delay > 0 && delay < 1000000)

                usleep(delay);

        }

        last_pts = picref->pts;

    }

    /* Trivial ASCII grayscale display. */

    p0 = picref->data[0];

    puts("\033c");

    for (y = 0; y < picref->video->h; y++) {

        p = p0;

        for (x = 0; x < picref->video->w; x++)

            putchar(" .-+#"[*(p++) / 52]);

        putchar('\n');

        p0 += picref->linesize[0];

    }

    fflush(stdout);

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     addr = (addr & 0xFFF) >> 4;

     if (addr == 0) {
+
+        retval = ide_data_readl(&d->bus, 0);
+
+    } else {
+
         retval = 0xFFFFFFFF;

     }

static uint32_t pmac_ide_readl (void *opaque,target_phys_addr_t addr)

{

    uint32_t retval;

    MACIOIDEState *d = opaque;

    addr = (addr & 0xFFF) >> 4;

    if (addr == 0) {

        retval = ide_data_readl(&d->bus, 0);

    } else {

        retval = 0xFFFFFFFF;

    }

    retval = bswap32(retval);

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     MigrationState *s = opaque;

     int ret;
+

     ret = qemu_file_get_error(s->file);

static int buffered_rate_limit(void *opaque)

{

    MigrationState *s = opaque;

    int ret;

    ret = qemu_file_get_error(s->file);

    if (ret) {

        return ret;

    }

    if (s->bytes_xfer > s->xfer_limit) {

        return 1;

    }

    return 0;

}


void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data)

{

    PCIDevice *dev = NULL;

    const char *pci_addr = qdict_get_str(qdict, "pci_addr");

    const char *type = qdict_get_str(qdict, "type");

    const char *opts = qdict_get_try_str(qdict, "opts");

    /* strip legacy tag */

    if (!strncmp(pci_addr, "pci_addr=", 9)) {

        pci_addr += 9;

    }

    if (!opts) {

        opts = "";

    }

    if (!strcmp(pci_addr, "auto"))

        pci_addr = NULL;

    if (strcmp(type, "nic") == 0)

        dev = qemu_pci_hot_add_nic(mon, pci_addr, opts);

    else if (strcmp(type, "storage") == 0)

        dev = qemu_pci_hot_add_storage(mon, pci_addr, opts);

    else

        monitor_printf(mon, "invalid type: %s\n", type);

    if (dev) {

        *ret_data =

        qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, "

                           "'function': %d }", pci_bus_num(dev->bus),

                           PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));

        assert(*ret_data != NULL);

    } else

        monitor_printf(mon, "failed to add %s\n", opts);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun,

                                           int evpd, int pc)

@@ -14,7 +14,7 @@

         goto fail;

+    }

     full_size = scsi_datain_getfullsize(task);

static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun,

                                          int evpd, int pc)

{

    int full_size;

    struct scsi_task *task = NULL;

    task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, 64);

    if (task == NULL || task->status != SCSI_STATUS_GOOD) {

        goto fail;

    }

    full_size = scsi_datain_getfullsize(task);

    if (full_size > task->datain.size) {

        scsi_free_scsi_task(task);

        /* we need more data for the full list */

        task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, full_size);

        if (task == NULL || task->status != SCSI_STATUS_GOOD) {

            goto fail;

        }

    }

    return task;

fail:

    error_report("iSCSI: Inquiry command failed : %s",

                 iscsi_get_error(iscsi));

    if (task) {

        scsi_free_scsi_task(task);

        return NULL;

    }

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     qed_write_l2_table(s, request, index, n, flush, qed_sync_cb, &ret);

     while (ret == -EINPROGRESS) {
+
+        aio_poll(bdrv_get_aio_context(s->bs), true);
+
+    }
+

     return ret;

int qed_write_l2_table_sync(BDRVQEDState *s, QEDRequest *request,

                            unsigned int index, unsigned int n, bool flush)

{

    int ret = -EINPROGRESS;

    qed_write_l2_table(s, request, index, n, flush, qed_sync_cb, &ret);

    while (ret == -EINPROGRESS) {

        aio_poll(bdrv_get_aio_context(s->bs), true);

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int decode_dc_progressive(MJpegDecodeContext *s, int16_t *block,
+
                                  int component, int dc_index,

                                  uint16_t *quant_matrix, int Al)

static int decode_dc_progressive(MJpegDecodeContext *s, int16_t *block,

                                 int component, int dc_index,

                                 uint16_t *quant_matrix, int Al)

{

    int val;

    s->bdsp.clear_block(block);

    val = mjpeg_decode_dc(s, dc_index);

    if (val == 0xfffff) {

        av_log(s->avctx, AV_LOG_ERROR, "error dc\n");

        return AVERROR_INVALIDDATA;

    }

    val = (val * (quant_matrix[0] << Al)) + s->last_dc[component];

    s->last_dc[component] = val;

    block[0] = val;

    return 0;

}


static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,

                                void *opaque)

{

    GtkDisplayState *s = opaque;

    int dx, dy;

    int x, y;

    x = motion->x / s->scale_x;

    y = motion->y / s->scale_y;

    if (kbd_mouse_is_absolute()) {

        dx = x * 0x7FFF / (ds_get_width(s->ds) - 1);

        dy = y * 0x7FFF / (ds_get_height(s->ds) - 1);

    } else if (s->last_x == -1 || s->last_y == -1) {

        dx = 0;

        dy = 0;

    } else {

        dx = x - s->last_x;

        dy = y - s->last_y;

    }

    s->last_x = x;

    s->last_y = y;

    if (kbd_mouse_is_absolute()) {

        kbd_mouse_event(dx, dy, 0, s->button_mask);

    }

    return TRUE;

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                             DBDMA_rw rw, DBDMA_flush flush,

                             void *opaque)
+
 {

     DBDMAState *s = dbdma;

void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,

                            DBDMA_rw rw, DBDMA_flush flush,

                            void *opaque)

{

    DBDMAState *s = dbdma;

    DBDMA_channel *ch = &s->channels[nchan];

    DBDMA_DPRINTF("DBDMA_register_channel 0x%x\n", nchan);

    ch->irq = irq;

    ch->channel = nchan;

    ch->rw = rw;

    ch->flush = flush;

    ch->io.opaque = opaque;

    ch->io.channel = ch;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int kvmppc_get_pvinfo(CPUPPCState *env, struct kvm_ppc_pvinfo *pvinfo)
+
+ {
+
+     PowerPCCPU *cpu = ppc_env_get_cpu(env);

      CPUState *cs = CPU(cpu);

static int kvmppc_get_pvinfo(CPUPPCState *env, struct kvm_ppc_pvinfo *pvinfo)

 {

     PowerPCCPU *cpu = ppc_env_get_cpu(env);

     CPUState *cs = CPU(cpu);

    if (kvm_check_extension(cs->kvm_state, KVM_CAP_PPC_GET_PVINFO) &&

        !kvm_vm_ioctl(cs->kvm_state, KVM_PPC_GET_PVINFO, pvinfo)) {

        return 0;

    }

    return 1;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static SocketAddressLegacy *sd_socket_address(const char *path,
+
+                                        const char *host, const char *port)
+
+{

     SocketAddressLegacy *addr = g_new0(SocketAddressLegacy, 1);

static SocketAddressLegacy *sd_socket_address(const char *path,

                                        const char *host, const char *port)

{

    SocketAddressLegacy *addr = g_new0(SocketAddressLegacy, 1);

    if (path) {

        addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX;

        addr->u.q_unix.data = g_new0(UnixSocketAddress, 1);

        addr->u.q_unix.data->path = g_strdup(path);

    } else {

        addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET;

        addr->u.inet.data = g_new0(InetSocketAddress, 1);

        addr->u.inet.data->host = g_strdup(host ?: SD_DEFAULT_ADDR);

        addr->u.inet.data->port = g_strdup(port ?: stringify(SD_DEFAULT_PORT));

    }

    return addr;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+int index_from_key(const char *key)

 {
+
     int i;

int index_from_key(const char *key)

{

    int i;

    for (i = 0; QKeyCode_lookup[i] != NULL; i++) {

        if (!strcmp(key, QKeyCode_lookup[i])) {

            break;

        }

    }

    /* Return Q_KEY_CODE__MAX if the key is invalid */

    return i;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void gen_op_update_neg_cc(void)

 {
+
+    tcg_gen_neg_tl(cpu_cc_src, cpu_T[0]);

     tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]);

static void gen_op_update_neg_cc(void)

{

    tcg_gen_neg_tl(cpu_cc_src, cpu_T[0]);

    tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]);

}


--- a/source.c
+++ b/source.c
@@ -2,9 +2,9 @@

 {

+    if (vs->zlib_stream.opaque) {
+
+        deflateEnd(&vs->zlib_stream);

     }

void vnc_zlib_clear(VncState *vs)

{

    if (vs->zlib_stream.opaque) {

        deflateEnd(&vs->zlib_stream);

    }

    buffer_free(&vs->zlib);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s)

+{
+
+    int ret = 0;
+
+    int tileno;

static int jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s)

{

    int ret = 0;

    int tileno;

    for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) {

        Jpeg2000Tile *tile = s->tile + tileno;

        if (ret = init_tile(s, tileno))

            return ret;

        s->g = tile->tile_part[0].tpg;

        if (ret = jpeg2000_decode_packets(s, tile))

            return ret;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -39,11 +39,11 @@

+
+        left = buffer_size - rcc->buffer_index - 1;
+
+        rcc->buffer_index += av_clip(left, min_rate, max_rate);
+

         if (rcc->buffer_index > buffer_size) {

int ff_vbv_update(MpegEncContext *s, int frame_size)

{

    RateControlContext *rcc = &s->rc_context;

    const double fps        = get_fps(s->avctx);

    const int buffer_size   = s->avctx->rc_buffer_size;

    const double min_rate   = s->avctx->rc_min_rate / fps;

    const double max_rate   = s->avctx->rc_max_rate / fps;

    av_dlog(s, "%d %f %d %f %f\n",

            buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate);

    if (buffer_size) {

        int left;

        rcc->buffer_index -= frame_size;

        if (rcc->buffer_index < 0) {

            av_log(s->avctx, AV_LOG_ERROR, "rc buffer underflow\n");

            rcc->buffer_index = 0;

        left = buffer_size - rcc->buffer_index - 1;

        rcc->buffer_index += av_clip(left, min_rate, max_rate);

        if (rcc->buffer_index > buffer_size) {

            int stuffing = ceil((rcc->buffer_index - buffer_size) / 8);

            if (stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4)

                stuffing = 4;

            rcc->buffer_index -= 8 * stuffing;

            if (s->avctx->debug & FF_DEBUG_RC)

                av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n", stuffing);

            return stuffing;

    return 0;


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
 {

     AVStream *st = s->streams[stream_index];
+
     MPCContext *c = s->priv_data;

     int index = av_index_search_timestamp(st, timestamp, flags);

static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)

{

    AVStream *st = s->streams[stream_index];

    MPCContext *c = s->priv_data;

    int index = av_index_search_timestamp(st, timestamp, flags);

    if(index < 0) return -1;

    avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);

    c->frame = st->index_entries[index].timestamp;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels,

+                               ptrdiff_t line_size)

 {

static void get_pixels_altivec(int16_t *restrict block, const uint8_t *pixels,

                               ptrdiff_t line_size)

{

    int i;

    vec_u8 perm = vec_lvsl(0, pixels);

    const vec_u8 zero = (const vec_u8)vec_splat_u8(0);

    for (i = 0; i < 8; i++) {

        /* Read potentially unaligned pixels.

         * We're reading 16 pixels, and actually only want 8,

         * but we simply ignore the extras. */

        vec_u8 pixl = vec_ld(0, pixels);

        vec_u8 pixr = vec_ld(7, pixels);

        vec_u8 bytes = vec_perm(pixl, pixr, perm);

        // Convert the bytes into shorts.

        vec_s16 shorts = (vec_s16)vec_mergeh(zero, bytes);

        // Save the data to the block, we assume the block is 16-byte aligned.

        vec_st(shorts, i * 16, (vec_s16 *)block);

        pixels += line_size;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
 static void init_vlcs(void)
+
+{
+
+    static int done = 0;
+
+
+
+    if (!done) {
+
+        done = 1;
+
+
+
+        init_vlc(&dc_lum_vlc, DC_VLC_BITS, 12,

                  vlc_dc_lum_bits, 1, 1,

static void init_vlcs(void)

{

    static int done = 0;

    if (!done) {

        done = 1;

        init_vlc(&dc_lum_vlc, DC_VLC_BITS, 12,

                 vlc_dc_lum_bits, 1, 1,

                 vlc_dc_lum_code, 2, 2);

        init_vlc(&dc_chroma_vlc,  DC_VLC_BITS, 12,

                 vlc_dc_chroma_bits, 1, 1,

                 vlc_dc_chroma_code, 2, 2);

        init_vlc(&mv_vlc, MV_VLC_BITS, 17,

                 &mbMotionVectorTable[0][1], 2, 1,

                 &mbMotionVectorTable[0][0], 2, 1);

        init_vlc(&mbincr_vlc, MBINCR_VLC_BITS, 36,

                 &mbAddrIncrTable[0][1], 2, 1,

                 &mbAddrIncrTable[0][0], 2, 1);

        init_vlc(&mb_pat_vlc, MB_PAT_VLC_BITS, 64,

                 &mbPatTable[0][1], 2, 1,

                 &mbPatTable[0][0], 2, 1);

        init_vlc(&mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7,

                 &table_mb_ptype[0][1], 2, 1,

                 &table_mb_ptype[0][0], 2, 1);

        init_vlc(&mb_btype_vlc, MB_BTYPE_VLC_BITS, 11,

                 &table_mb_btype[0][1], 2, 1,

                 &table_mb_btype[0][0], 2, 1);

        init_rl(&rl_mpeg1);

        init_rl(&rl_mpeg2);

        init_2d_vlc_rl(&rl_mpeg1);

        init_2d_vlc_rl(&rl_mpeg2);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static av_always_inline void avcodec_thread_park_workers(ThreadContext *c, int thread_count)
+
 {

     pthread_cond_wait(&c->last_job_cond, &c->current_job_lock);

static av_always_inline void avcodec_thread_park_workers(ThreadContext *c, int thread_count)

{

    pthread_cond_wait(&c->last_job_cond, &c->current_job_lock);

    pthread_mutex_unlock(&c->current_job_lock);

}


--- a/source.c
+++ b/source.c
@@ -8,9 +8,9 @@

+    uc->realize = usb_msd_realize_storage;
+
+
+    dc->props = msd_properties;

 }

static void usb_msd_class_initfn_storage(ObjectClass *klass, void *data)

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    USBDeviceClass *uc = USB_DEVICE_CLASS(klass);

    uc->realize = usb_msd_realize_storage;

    dc->props = msd_properties;

}


--- a/source.c
+++ b/source.c
@@ -39,11 +39,11 @@
                                  virtio_net_receive, virtio_net_can_receive, n);

+
+    qemu_format_nic_info_str(n->vc, n->mac);
+
+
+
     n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n);

     n->tx_timer_active = 0;

PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)

{

    VirtIONet *n;

    static int virtio_net_id;

    n = (VirtIONet *)virtio_init_pci(bus, "virtio-net", 6900, 0x1000,

                                     0, VIRTIO_ID_NET,

                                     0x02, 0x00, 0x00,

                                     6, sizeof(VirtIONet));

    if (!n)

        return NULL;

    n->vdev.get_config = virtio_net_update_config;

    n->vdev.get_features = virtio_net_get_features;

    n->vdev.set_features = virtio_net_set_features;

    n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);

    n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx);

    memcpy(n->mac, nd->macaddr, 6);

    n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,

                                 virtio_net_receive, virtio_net_can_receive, n);

    qemu_format_nic_info_str(n->vc, n->mac);

    n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n);

    n->tx_timer_active = 0;

    n->mergeable_rx_bufs = 0;

    register_savevm("virtio-net", virtio_net_id++, 2,

                    virtio_net_save, virtio_net_load, n);

    return (PCIDevice *)n;

}


--- a/source.c
+++ b/source.c
@@ -10,8 +10,8 @@
         & ~(REFCOUNTS_PER_SECTOR - 1);
     size = (last_index - first_index) << REFCOUNT_SHIFT;
     BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART);
+    ret = bdrv_pwrite(bs->file,
+        refcount_block_offset + (first_index << REFCOUNT_SHIFT),
+        &s->refcount_block_cache[first_index], size);
+    if (ret < 0) {
         return ret;

static int write_refcount_block_entries(BlockDriverState *bs,
    int64_t refcount_block_offset, int first_index, int last_index)
{
    BDRVQcowState *s = bs->opaque;
    size_t size;
    int ret;
    if (cache_refcount_updates) {
    first_index &= ~(REFCOUNTS_PER_SECTOR - 1);
    last_index = (last_index + REFCOUNTS_PER_SECTOR)
        & ~(REFCOUNTS_PER_SECTOR - 1);
    size = (last_index - first_index) << REFCOUNT_SHIFT;
    BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART);
    ret = bdrv_pwrite(bs->file,
        refcount_block_offset + (first_index << REFCOUNT_SHIFT),
        &s->refcount_block_cache[first_index], size);
    if (ret < 0) {
        return ret;


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@

     tcg_gen_ext_i32_i64(tmp1, a);
+
+    dead_tmp(a);
+
+    tcg_gen_ext_i32_i64(tmp2, b);
+
     dead_tmp(b);

     tcg_gen_mul_i64(tmp1, tmp1, tmp2);

static TCGv gen_muls_i64_i32(TCGv a, TCGv b)

{

    TCGv tmp1 = tcg_temp_new(TCG_TYPE_I64);

    TCGv tmp2 = tcg_temp_new(TCG_TYPE_I64);

    tcg_gen_ext_i32_i64(tmp1, a);

    dead_tmp(a);

    tcg_gen_ext_i32_i64(tmp2, b);

    dead_tmp(b);

    tcg_gen_mul_i64(tmp1, tmp1, tmp2);

    return tmp1;

}


--- a/source.c
+++ b/source.c
@@ -4,4 +4,4 @@

     qdev_prop_set(dev, name, &value, PROP_TYPE_PTR);

+}

void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value)

{

    qdev_prop_set(dev, name, &value, PROP_TYPE_PTR);

}


--- a/source.c
+++ b/source.c
@@ -34,11 +34,11 @@

      * even on failure here */

+    if (s->base_flags != bdrv_get_flags(base)) {
+
+        bdrv_reopen(base, s->base_flags, NULL);
+
+    }

     if (overlay_bs && s->orig_overlay_flags != bdrv_get_flags(overlay_bs)) {

static void commit_complete(BlockJob *job, void *opaque)

{

    CommitBlockJob *s = container_of(job, CommitBlockJob, common);

    CommitCompleteData *data = opaque;

    BlockDriverState *active = s->active;

    BlockDriverState *top = blk_bs(s->top);

    BlockDriverState *base = blk_bs(s->base);

    BlockDriverState *overlay_bs = bdrv_find_overlay(active, top);

    int ret = data->ret;

    if (!block_job_is_cancelled(&s->common) && ret == 0) {

        /* success */

        ret = bdrv_drop_intermediate(active, top, base, s->backing_file_str);

    }

    /* restore base open flags here if appropriate (e.g., change the base back

     * to r/o). These reopens do not need to be atomic, since we won't abort

     * even on failure here */

    if (s->base_flags != bdrv_get_flags(base)) {

        bdrv_reopen(base, s->base_flags, NULL);

    }

    if (overlay_bs && s->orig_overlay_flags != bdrv_get_flags(overlay_bs)) {

        bdrv_reopen(overlay_bs, s->orig_overlay_flags, NULL);

    }

    g_free(s->backing_file_str);

    blk_unref(s->top);

    blk_unref(s->base);

    block_job_completed(&s->common, ret);

    g_free(data);

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     V9fsString newpath;

+
+    v9fs_string_init(&newpath);
+
+    v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name);
+

     retval = v9fs_request(ctx->private, T_LINK, NULL, "ss", oldpath, &newpath);

static int proxy_link(FsContext *ctx, V9fsPath *oldpath,

                      V9fsPath *dirpath, const char *name)

{

    int retval;

    V9fsString newpath;

    v9fs_string_init(&newpath);

    v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name);

    retval = v9fs_request(ctx->private, T_LINK, NULL, "ss", oldpath, &newpath);

    v9fs_string_free(&newpath);

    if (retval < 0) {

        errno = -retval;

        retval = -1;

    }

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -16,11 +16,11 @@

     st->codec->channels = avio_r8(s->pb);

+    avio_skip(s->pb, 1783);
+
+
+
+

     st->codec->codec_type     = AVMEDIA_TYPE_AUDIO;

static int aea_read_header(AVFormatContext *s)

{

    AVStream *st = avformat_new_stream(s, NULL);

    if (!st)

        return AVERROR(ENOMEM);

    /* Parse the amount of channels and skip to pos 2048(0x800) */

    avio_skip(s->pb, 264);

    st->codec->channels = avio_r8(s->pb);

    avio_skip(s->pb, 1783);

    st->codec->codec_type     = AVMEDIA_TYPE_AUDIO;

    st->codec->codec_id       = AV_CODEC_ID_ATRAC1;

    st->codec->sample_rate    = 44100;

    st->codec->bit_rate       = 292000;

    if (st->codec->channels != 1 && st->codec->channels != 2) {

        av_log(s,AV_LOG_ERROR,"Channels %d not supported!\n",st->codec->channels);

        return -1;

    }

    st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;

    st->codec->block_align = AT1_SU_SIZE * st->codec->channels;

    return 0;

}


static void set_lcd_pixel(musicpal_lcd_state *s, int x, int y, int col)

{

    int dx, dy;

    for (dy = 0; dy < 3; dy++)

        for (dx = 0; dx < 3; dx++) {

            s->ds->data[(x*3 + dx + (y*3 + dy) * 128*3) * 4 + 0] =

                scale_lcd_color(col);

            s->ds->data[(x*3 + dx + (y*3 + dy) * 128*3) * 4 + 1] =

                scale_lcd_color(col >> 8);

            s->ds->data[(x*3 + dx + (y*3 + dy) * 128*3) * 4 + 2] =

                scale_lcd_color(col >> 16);

        }

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     const char *port

 ) {
+
     struct addrinfo hints;

     struct addrinfo *server;

connect_to_qemu(

    const char *host,

    const char *port

) {

    struct addrinfo hints;

    struct addrinfo *server;

    int ret, sock;

    sock = qemu_socket(AF_INET, SOCK_STREAM, 0);

    if (sock < 0) {

        /* Error */

        fprintf(stderr, "Error opening socket!\n");

        return -1;

    }

    memset(&hints, 0, sizeof(struct addrinfo));

    hints.ai_family = AF_UNSPEC;

    hints.ai_socktype = SOCK_STREAM;

    hints.ai_flags = 0;

    hints.ai_protocol = 0;          /* Any protocol */

    ret = getaddrinfo(host, port, &hints, &server);

    if (ret != 0) {

        /* Error */

        fprintf(stderr, "getaddrinfo failed\n");

        return -1;

    }

    if (connect(sock, server->ai_addr, server->ai_addrlen) < 0) {

        /* Error */

        fprintf(stderr, "Could not connect\n");

        return -1;

    }

    if (verbose) {

        printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader));

    }

    return sock;

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     int i, err;

+
     av_dlog(s, "%s()\n", __FUNCTION__);

     av_dlog(s, "filename '%s'\n", s->filename);

static int nsv_read_header(AVFormatContext *s)

{

    NSVContext *nsv = s->priv_data;

    int i, err;

    av_dlog(s, "%s()\n", __FUNCTION__);

    av_dlog(s, "filename '%s'\n", s->filename);

    nsv->state = NSV_UNSYNC;

    nsv->ahead[0].data = nsv->ahead[1].data = NULL;

    for (i = 0; i < NSV_MAX_RESYNC_TRIES; i++) {

        if (nsv_resync(s) < 0)

            return -1;

        if (nsv->state == NSV_FOUND_NSVF)

            err = nsv_parse_NSVf_header(s);

            /* we need the first NSVs also... */

        if (nsv->state == NSV_FOUND_NSVS) {

            err = nsv_parse_NSVs_header(s);

            break; /* we just want the first one */

        }

    }

    if (s->nb_streams < 1) /* no luck so far */

        return -1;

    /* now read the first chunk, so we can attempt to decode more info */

    err = nsv_read_chunk(s, 1);

    av_dlog(s, "parsed header\n");

    return err;

}


--- a/source.c
+++ b/source.c
@@ -20,11 +20,11 @@

     if (dflag == 2) {

+        cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 32) & 0xfffc) |
+
+                               3, 0, 0xffffffff,
+
+                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |

                                DESC_S_MASK | (3 << DESC_DPL_SHIFT) |

void helper_sysexit(CPUX86State *env, int dflag)

{

    int cpl;

    cpl = env->hflags & HF_CPL_MASK;

    if (env->sysenter_cs == 0 || cpl != 0) {

        raise_exception_err(env, EXCP0D_GPF, 0);

    }

    cpu_x86_set_cpl(env, 3);

#ifdef TARGET_X86_64

    if (dflag == 2) {

        cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 32) & 0xfffc) |

                               3, 0, 0xffffffff,

                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |

                               DESC_S_MASK | (3 << DESC_DPL_SHIFT) |

                               DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK |

                               DESC_L_MASK);

        cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 40) & 0xfffc) |

                               3, 0, 0xffffffff,

                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |

                               DESC_S_MASK | (3 << DESC_DPL_SHIFT) |

                               DESC_W_MASK | DESC_A_MASK);

    } else

#endif

    {

        cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 16) & 0xfffc) |

                               3, 0, 0xffffffff,

                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |

                               DESC_S_MASK | (3 << DESC_DPL_SHIFT) |

                               DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK);

        cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 24) & 0xfffc) |

                               3, 0, 0xffffffff,

                               DESC_G_MASK | DESC_B_MASK | DESC_P_MASK |

                               DESC_S_MASK | (3 << DESC_DPL_SHIFT) |

                               DESC_W_MASK | DESC_A_MASK);

    }

    env->regs[R_ESP] = env->regs[R_ECX];

    env->eip = env->regs[R_EDX];

}


--- a/source.c
+++ b/source.c
@@ -34,11 +34,11 @@

         /* A device present at reset is ready to go, same as coldplugged */

+        drc->state = drck->ready_state;
+
+    } else {
+
+        drc->state = drck->empty_state;

     }

void spapr_drc_reset(sPAPRDRConnector *drc)

{

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);

    trace_spapr_drc_reset(spapr_drc_index(drc));

    g_free(drc->ccs);

    drc->ccs = NULL;

    /* immediately upon reset we can safely assume DRCs whose devices

     * are pending removal can be safely removed.

     */

    if (drc->unplug_requested) {

        spapr_drc_release(drc);

    }

    if (drc->dev) {

        /* A device present at reset is ready to go, same as coldplugged */

        drc->state = drck->ready_state;

    } else {

        drc->state = drck->empty_state;

    }

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     QOSState *qs;

     struct tm tm;
+
     uint32_t ns;

     uint64_t ret;

static void test_rtas_get_time_of_day(void)

{

    QOSState *qs;

    struct tm tm;

    uint32_t ns;

    uint64_t ret;

    time_t t1, t2;

    qs = qtest_spapr_boot("-machine pseries");

    g_assert(qs != NULL);

    t1 = time(NULL);

    ret = qrtas_get_time_of_day(qs->alloc, &tm, &ns);

    g_assert_cmpint(ret, ==, 0);

    t2 = mktimegm(&tm);

    g_assert(t2 - t1 < 5); /* 5 sec max to run the test */

    qtest_shutdown(qs);

}


--- a/source.c
+++ b/source.c
@@ -44,11 +44,11 @@

     /* export the stream parameters */

+    s->coded_width  = sps->width;
+
+    s->coded_height = sps->height;
+
+    s->width        = sps->output_width;

     s->height       = sps->output_height;

static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal,

                                   AVCodecContext *avctx)

{

    HEVCParserContext *ctx = s->priv_data;

    GetBitContext *gb = &nal->gb;

    HEVCPPS *pps;

    HEVCSPS *sps;

    unsigned int pps_id;

    get_bits1(gb);          // first slice in pic

    if (IS_IRAP_NAL(nal))

        get_bits1(gb);      // no output of prior pics

    pps_id = get_ue_golomb_long(gb);

    if (pps_id >= HEVC_MAX_PPS_COUNT || !ctx->ps.pps_list[pps_id]) {

        av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id);

        return AVERROR_INVALIDDATA;

    }

    pps = (HEVCPPS*)ctx->ps.pps_list[pps_id]->data;

    sps = (HEVCSPS*)ctx->ps.sps_list[pps->sps_id]->data;

    /* export the stream parameters */

    s->coded_width  = sps->width;

    s->coded_height = sps->height;

    s->width        = sps->output_width;

    s->height       = sps->output_height;

    s->format       = sps->pix_fmt;

    avctx->profile  = sps->ptl.general_ptl.profile_idc;

    avctx->level    = sps->ptl.general_ptl.level_idc;

    /* ignore the rest for now*/

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,9 +7,9 @@
     SCSIRequest *req;

     req = d->info->alloc_req(d, tag, lun, hba_private);
+
+    memcpy(req->cmd.buf, buf, 16);
+
     return req;

 }

SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun,

                          uint8_t *buf, void *hba_private)

{

    SCSIRequest *req;

    req = d->info->alloc_req(d, tag, lun, hba_private);

    memcpy(req->cmd.buf, buf, 16);

    return req;

}


--- a/source.c
+++ b/source.c
@@ -2,6 +2,6 @@

 {

+    return strstart(prop->type, "link<", NULL);

 }

static inline bool object_property_is_link(ObjectProperty *prop)

{

    return strstart(prop->type, "link<", NULL);

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     H264Context * const h = avctx->priv_data;

     MpegEncContext * const s = &h->s;
+
+    VASliceParameterBufferH264 *slice_param;
+
+
+
     dprintf(avctx, "decode_slice(): buffer %p, size %d\n", buffer, size);

static int decode_slice(AVCodecContext *avctx,

                        const uint8_t  *buffer,

                        uint32_t        size)

{

    H264Context * const h = avctx->priv_data;

    MpegEncContext * const s = &h->s;

    VASliceParameterBufferH264 *slice_param;

    dprintf(avctx, "decode_slice(): buffer %p, size %d\n", buffer, size);

    /* Fill in VASliceParameterBufferH264. */

    slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);

    if (!slice_param)

        return -1;

    slice_param->slice_data_bit_offset          = get_bits_count(&h->s.gb) + 8; /* bit buffer started beyond nal_unit_type */

    slice_param->first_mb_in_slice              = (s->mb_y >> FIELD_OR_MBAFF_PICTURE) * s->mb_width + s->mb_x;

    slice_param->slice_type                     = ff_h264_get_slice_type(h);

    slice_param->direct_spatial_mv_pred_flag    = h->slice_type == FF_B_TYPE ? h->direct_spatial_mv_pred : 0;

    slice_param->num_ref_idx_l0_active_minus1   = h->list_count > 0 ? h->ref_count[0] - 1 : 0;

    slice_param->num_ref_idx_l1_active_minus1   = h->list_count > 1 ? h->ref_count[1] - 1 : 0;

    slice_param->cabac_init_idc                 = h->cabac_init_idc;

    slice_param->slice_qp_delta                 = s->qscale - h->pps.init_qp;

    slice_param->disable_deblocking_filter_idc  = h->deblocking_filter < 2 ? !h->deblocking_filter : h->deblocking_filter;

    slice_param->slice_alpha_c0_offset_div2     = h->slice_alpha_c0_offset / 2;

    slice_param->slice_beta_offset_div2         = h->slice_beta_offset / 2;

    slice_param->luma_log2_weight_denom         = h->luma_log2_weight_denom;

    slice_param->chroma_log2_weight_denom       = h->chroma_log2_weight_denom;

    fill_vaapi_RefPicList(slice_param->RefPicList0, h->ref_list[0], h->list_count > 0 ? h->ref_count[0] : 0);

    fill_vaapi_RefPicList(slice_param->RefPicList1, h->ref_list[1], h->list_count > 1 ? h->ref_count[1] : 0);

    fill_vaapi_plain_pred_weight_table(h, 0,

                                       &slice_param->luma_weight_l0_flag,   slice_param->luma_weight_l0,   slice_param->luma_offset_l0,

                                       &slice_param->chroma_weight_l0_flag, slice_param->chroma_weight_l0, slice_param->chroma_offset_l0);

    fill_vaapi_plain_pred_weight_table(h, 1,

                                       &slice_param->luma_weight_l1_flag,   slice_param->luma_weight_l1,   slice_param->luma_offset_l1,

                                       &slice_param->chroma_weight_l1_flag, slice_param->chroma_weight_l1, slice_param->chroma_offset_l1);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -12,11 +12,11 @@

     if (vs->tls_session) {

+	ret = gnutls_write(vs->tls_session, vs->output.buffer, vs->output.offset);
+
+	if (ret < 0) {
+
+	    if (ret == GNUTLS_E_AGAIN)

 		errno = EAGAIN;

static void vnc_client_write(void *opaque)

{

    long ret;

    VncState *vs = opaque;

#ifdef CONFIG_VNC_TLS

    if (vs->tls_session) {

	ret = gnutls_write(vs->tls_session, vs->output.buffer, vs->output.offset);

	if (ret < 0) {

	    if (ret == GNUTLS_E_AGAIN)

		errno = EAGAIN;

	    else

		errno = EIO;

	    ret = -1;

	}

    } else

#endif /* CONFIG_VNC_TLS */

	ret = send(vs->csock, vs->output.buffer, vs->output.offset, 0);

    ret = vnc_client_io_error(vs, ret, socket_error());

    if (!ret)

	return;

    memmove(vs->output.buffer, vs->output.buffer + ret, (vs->output.offset - ret));

    vs->output.offset -= ret;

    if (vs->output.offset == 0) {

	qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+uint64_t HELPER(neon_sub_saturate_u64)(uint64_t src1, uint64_t src2)
+
+{
+
+    uint64_t res;

+

+    if (src1 < src2) {

         env->QF = 1;

uint64_t HELPER(neon_sub_saturate_u64)(uint64_t src1, uint64_t src2)

{

    uint64_t res;

    if (src1 < src2) {

        env->QF = 1;

        res = 0;

    } else {

        res = src1 - src2;

    }

    return res;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 DisplayState *init_displaystate(void)

 {
+
+    gchar *name;

     int i;

DisplayState *init_displaystate(void)

{

    gchar *name;

    int i;

    if (!display_state) {

        display_state = g_new0(DisplayState, 1);

    }

    for (i = 0; i < nb_consoles; i++) {

        if (consoles[i]->console_type != GRAPHIC_CONSOLE &&

            consoles[i]->ds == NULL) {

            text_console_do_init(consoles[i]->chr, display_state);

        }

        /* Hook up into the qom tree here (not in new_console()), once

         * all QemuConsoles are created and the order / numbering

         * doesn't change any more */

        name = g_strdup_printf("console[%d]", i);

        object_property_add_child(container_get(object_get_root(), "/backend"),

                                  name, OBJECT(consoles[i]), &error_abort);

        g_free(name);

    }

    return display_state;

}


--- a/source.c
+++ b/source.c
@@ -4,9 +4,9 @@

     unsigned ret = 0;

+    ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);
+
+    ret |= (1 << VIRTIO_RING_F_INDIRECT_DESC);

     ret |= (1 << VIRTIO_F_BAD_FEATURE);

static unsigned virtio_pci_get_features(void *opaque)

{

    unsigned ret = 0;

    ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);

    ret |= (1 << VIRTIO_RING_F_INDIRECT_DESC);

    ret |= (1 << VIRTIO_F_BAD_FEATURE);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 Visitor *visitor_input_test_init(TestInputVisitorData *data,
+
                                  const char *json_string, ...)

+{

+    Visitor *v;
+
+    va_list ap;
+
+
+
     va_start(ap, json_string);

     data->obj = qobject_from_jsonv(json_string, &ap);

Visitor *visitor_input_test_init(TestInputVisitorData *data,

                                 const char *json_string, ...)

{

    Visitor *v;

    va_list ap;

    va_start(ap, json_string);

    data->obj = qobject_from_jsonv(json_string, &ap);

    va_end(ap);

    g_assert(data->obj != NULL);

    data->qiv = qmp_input_visitor_new(data->obj);

    g_assert(data->qiv != NULL);

    v = qmp_input_get_visitor(data->qiv);

    g_assert(v != NULL);

    return v;

}


--- a/source.c
+++ b/source.c
@@ -8,10 +8,10 @@

     AioContext *ctx = (AioContext *) source;

+
+
+    assert(callback == NULL);
+
     aio_dispatch(ctx, true);

     return true;

aio_ctx_dispatch(GSource     *source,

                 GSourceFunc  callback,

                 gpointer     user_data)

{

    AioContext *ctx = (AioContext *) source;

    assert(callback == NULL);

    aio_dispatch(ctx, true);

    return true;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static inline void memcpy_tofs(void * to, const void * from, unsigned long n)

+{

 	memcpy(to, from, n);

static inline void memcpy_tofs(void * to, const void * from, unsigned long n)

{

	memcpy(to, from, n);

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     while (replay_data_kind == EVENT_ASYNC) {

         Event *event = replay_read_event(checkpoint);
+
+        if (!event) {
+
+            break;
+
         }

         replay_mutex_unlock();

void replay_read_events(int checkpoint)

{

    while (replay_data_kind == EVENT_ASYNC) {

        Event *event = replay_read_event(checkpoint);

        if (!event) {

            break;

        }

        replay_mutex_unlock();

        replay_run_event(event);

        replay_mutex_lock();

        g_free(event);

        replay_finish_event();

        read_event_kind = -1;

    }

}


--- a/source.c
+++ b/source.c
@@ -4,11 +4,11 @@

     pool->cur_threads++;

+    pool->new_threads++;
+
+    /* If there are threads being created, they will spawn new workers, so
+
+     * we don't spend time creating many threads in a loop holding a mutex or

      * starving the current vcpu.

static void spawn_thread(ThreadPool *pool)

{

    pool->cur_threads++;

    pool->new_threads++;

    /* If there are threads being created, they will spawn new workers, so

     * we don't spend time creating many threads in a loop holding a mutex or

     * starving the current vcpu.

     *

     * If there are no idle threads, ask the main thread to create one, so we

     * inherit the correct affinity instead of the vcpu affinity.

     */

    if (!pool->pending_threads) {

        qemu_bh_schedule(pool->new_thread_bh);

    }

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                   uint32_t val)

 {
+
+    cpu_outw(addr & IOPORTS_MASK, bswap16(val));

 }

static void pci_apb_iowritew (void *opaque, target_phys_addr_t addr,

                                  uint32_t val)

{

    cpu_outw(addr & IOPORTS_MASK, bswap16(val));

}


--- a/source.c
+++ b/source.c
@@ -9,10 +9,10 @@
     dc->realize = fw_cfg_io_realize;

     dc->props = fw_cfg_io_properties;
+
+
+
+

 }

static void fw_cfg_io_class_init(ObjectClass *klass, void *data)

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    dc->realize = fw_cfg_io_realize;

    dc->props = fw_cfg_io_properties;

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
 {

     ppc4xx_pob_t *pob;
+

     pob = opaque;

static void dcr_write_pob (void *opaque, int dcrn, uint32_t val)

{

    ppc4xx_pob_t *pob;

    pob = opaque;

    switch (dcrn) {

    case POB0_BEAR:

        /* Read only */

        break;

    case POB0_BESR0:

    case POB0_BESR1:

        /* Write-clear */

        pob->besr[dcrn - POB0_BESR0] &= ~val;

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
+
+{
+
     QEMUBH *bh;

QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)

{

    QEMUBH *bh;

    bh = qemu_malloc(sizeof(*bh));

    bh->cb = cb;

    bh->opaque = opaque;

    return bh;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void qmp_xen_save_devices_state(const char *filename, Error **errp)

 {

void qmp_xen_save_devices_state(const char *filename, Error **errp)

{

    QEMUFile *f;

    QIOChannelFile *ioc;

    int saved_vm_running;

    int ret;

    saved_vm_running = runstate_is_running();

    vm_stop(RUN_STATE_SAVE_VM);

    global_state_store_running();

    ioc = qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, errp);

    if (!ioc) {

        goto the_end;

    }

    qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-save-state");

    f = qemu_fopen_channel_output(QIO_CHANNEL(ioc));

    ret = qemu_save_device_state(f);

    qemu_fclose(f);

    if (ret < 0) {

        error_setg(errp, QERR_IO_ERROR);

    }

 the_end:

    if (saved_vm_running) {

        vm_start();

    }

}


--- a/source.c
+++ b/source.c
@@ -12,11 +12,11 @@

         for (; layouts[nb_layouts] != -1; nb_layouts++);

+    if (counts)
+
+        for (; counts[nb_counts] != -1; nb_counts++);
+
+    if (nb_counts > INT_MAX - 1 - nb_layouts)

         return NULL;

static int64_t *concat_channels_lists(const int64_t *layouts, const int *counts)

{

    int nb_layouts = 0, nb_counts = 0, i;

    int64_t *list;

    if (layouts)

        for (; layouts[nb_layouts] != -1; nb_layouts++);

    if (counts)

        for (; counts[nb_counts] != -1; nb_counts++);

    if (nb_counts > INT_MAX - 1 - nb_layouts)

        return NULL;

    if (!(list = av_calloc(nb_layouts + nb_counts + 1, sizeof(*list))))

        return NULL;

    for (i = 0; i < nb_layouts; i++)

        list[i] = layouts[i];

    for (i = 0; i < nb_counts; i++)

        list[nb_layouts + i] = FF_COUNT2LAYOUT(counts[i]);

    list[nb_layouts + nb_counts] = -1;

    return list;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@

     *raddr = pt_entry & _ASCE_ORIGIN;
+
+
+
+    PTE_DPRINTF("%s: PTE=0x%" PRIx64 "\n", __func__, pt_entry);
+

     return 0;

static int mmu_translate_pte(CPUS390XState *env, target_ulong vaddr,

                             uint64_t asc, uint64_t pt_entry,

                             target_ulong *raddr, int *flags, int rw, bool exc)

{

    if (pt_entry & _PAGE_INVALID) {

        DPRINTF("%s: PTE=0x%" PRIx64 " invalid\n", __func__, pt_entry);

        trigger_page_fault(env, vaddr, PGM_PAGE_TRANS, asc, rw, exc);

        return -1;

    }

    if (pt_entry & _PAGE_RO) {

        *flags &= ~PAGE_WRITE;

    }

    *raddr = pt_entry & _ASCE_ORIGIN;

    PTE_DPRINTF("%s: PTE=0x%" PRIx64 "\n", __func__, pt_entry);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
     s->intra_dc_precision = get_bits(&s->gb, 2);

     s->picture_structure = get_bits(&s->gb, 2);
+
     s->top_field_first = get_bits1(&s->gb);

     s->frame_pred_frame_dct = get_bits1(&s->gb);

static void mpeg_decode_picture_coding_extension(MpegEncContext *s)

{

    s->full_pel[0] = s->full_pel[1] = 0;

    s->mpeg_f_code[0][0] = get_bits(&s->gb, 4);

    s->mpeg_f_code[0][1] = get_bits(&s->gb, 4);

    s->mpeg_f_code[1][0] = get_bits(&s->gb, 4);

    s->mpeg_f_code[1][1] = get_bits(&s->gb, 4);

    s->intra_dc_precision = get_bits(&s->gb, 2);

    s->picture_structure = get_bits(&s->gb, 2);

    s->top_field_first = get_bits1(&s->gb);

    s->frame_pred_frame_dct = get_bits1(&s->gb);

    s->concealment_motion_vectors = get_bits1(&s->gb);

    s->q_scale_type = get_bits1(&s->gb);

    s->intra_vlc_format = get_bits1(&s->gb);

    s->alternate_scan = get_bits1(&s->gb);

    s->repeat_first_field = get_bits1(&s->gb);

    s->chroma_420_type = get_bits1(&s->gb);

    s->progressive_frame = get_bits1(&s->gb);

    /* composite display not parsed */

    dprintf("intra_dc_precion=%d\n", s->intra_dc_precision);

    dprintf("picture_structure=%d\n", s->picture_structure);

    dprintf("conceal=%d\n", s->concealment_motion_vectors);

    dprintf("intra_vlc_format=%d\n", s->intra_vlc_format);

    dprintf("alternate_scan=%d\n", s->alternate_scan);

    dprintf("frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct);

}


--- a/source.c
+++ b/source.c
@@ -4,7 +4,7 @@

 {

+    int i;

     uint64_t mask = stop_flags | L2E_OFFSET_MASK | QCOW_OFLAG_COMPRESSED;

static int count_contiguous_clusters(int nb_clusters, int cluster_size,

        uint64_t *l2_table, uint64_t stop_flags)

{

    int i;

    uint64_t mask = stop_flags | L2E_OFFSET_MASK | QCOW_OFLAG_COMPRESSED;

    uint64_t first_entry = be64_to_cpu(l2_table[0]);

    uint64_t offset = first_entry & mask;

    if (!offset)

        return 0;

    assert(qcow2_get_cluster_type(first_entry) != QCOW2_CLUSTER_COMPRESSED);

    for (i = 0; i < nb_clusters; i++) {

        uint64_t l2_entry = be64_to_cpu(l2_table[i]) & mask;

        if (offset + (uint64_t) i * cluster_size != l2_entry) {

            break;

        }

    }

	return i;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static ssize_t mp_user_getxattr(FsContext *ctx, const char *path,
+
+                                const char *name, void *value, size_t size)

 {

     char *buffer;
+
+    ssize_t ret;
+
+

     if (strncmp(name, "user.virtfs.", 12) == 0) {

static ssize_t mp_user_getxattr(FsContext *ctx, const char *path,

                                const char *name, void *value, size_t size)

{

    char *buffer;

    ssize_t ret;

    if (strncmp(name, "user.virtfs.", 12) == 0) {

        /*

         * Don't allow fetch of user.virtfs namesapce

         * in case of mapped security

         */

        errno = ENOATTR;

        return -1;

    }

    buffer = rpath(ctx, path);

    ret = lgetxattr(buffer, name, value, size);

    g_free(buffer);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -4,10 +4,10 @@

     QEMUBuffer *p;

+
+
+    qemu_fflush(f);
+

     p = f->opaque;

const QEMUSizedBuffer *qemu_buf_get(QEMUFile *f)

{

    QEMUBuffer *p;

    qemu_fflush(f);

    p = f->opaque;

    return p->qsb;

}


--- a/source.c
+++ b/source.c
@@ -4,6 +4,6 @@

     return (val << ((sizeof(tcg_target_long) * 8 - bits))

+            >> (sizeof(tcg_target_long) * 8 - bits)) == val;
+
 }

static inline int check_fit_tl(tcg_target_long val, unsigned int bits)

{

    return (val << ((sizeof(tcg_target_long) * 8 - bits))

            >> (sizeof(tcg_target_long) * 8 - bits)) == val;

}


--- a/source.c
+++ b/source.c
@@ -14,11 +14,11 @@

+    x = *s->stream_ptr++;
+
+    y = *s->stream_ptr++;
+
+

     debug_interplay ("    motion bytes = %d, %d\n", x, y);

static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)

{

    signed char x, y;

    /* copy a block from the previous frame using an expanded range;

     * need 2 more bytes */

    CHECK_STREAM_PTR(2);

    x = *s->stream_ptr++;

    y = *s->stream_ptr++;

    debug_interplay ("    motion bytes = %d, %d\n", x, y);

    return copy_from(s, &s->last_frame, x, y);

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@

+    rmn_bits &= 7; rmn_bytes >>= 3;
+
+    if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0)
+
+        put_bits(pb, rmn_bits, get_bits(gb, rmn_bits));

     ff_copy_bits(pb, data + size - rmn_bytes,

static void copy_bits(PutBitContext *pb,

                      const uint8_t *data, int size,

                      GetBitContext *gb, int nbits)

{

    int rmn_bytes, rmn_bits;

    rmn_bits = rmn_bytes = get_bits_left(gb);

    if (rmn_bits < nbits)

    rmn_bits &= 7; rmn_bytes >>= 3;

    if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0)

        put_bits(pb, rmn_bits, get_bits(gb, rmn_bits));

    ff_copy_bits(pb, data + size - rmn_bytes,

                 FFMIN(nbits - rmn_bits, rmn_bytes << 3));

}


--- a/source.c
+++ b/source.c
@@ -30,11 +30,11 @@

     if (!kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) {

+        /* nothing to do */
+
+        return 0;
+
+    }

static int kvm_s390_io_adapter_map(S390FLICState *fs, uint32_t id,

                                   uint64_t map_addr, bool do_map)

{

    struct kvm_s390_io_adapter_req req = {

        .id = id,

        .type = do_map ? KVM_S390_IO_ADAPTER_MAP : KVM_S390_IO_ADAPTER_UNMAP,

        .addr = map_addr,

    };

    struct kvm_device_attr attr = {

        .group = KVM_DEV_FLIC_ADAPTER_MODIFY,

        .addr = (uint64_t)&req,

    };

    KVMS390FLICState *flic = KVM_S390_FLIC(fs);

    int r;

    if (!kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) {

        /* nothing to do */

        return 0;

    }

    r = ioctl(flic->fd, KVM_SET_DEVICE_ATTR, &attr);

    return r ? -errno : 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 const char *avfilter_configuration(void)
+
 {

     return FFMPEG_CONFIGURATION;

const char *avfilter_configuration(void)

{

    return FFMPEG_CONFIGURATION;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static MemoryRegion *acpi_add_rom_blob(AcpiBuildState *build_state,
+
+                                       GArray *blob, const char *name,
+
                                        uint64_t max_size)

 {

static MemoryRegion *acpi_add_rom_blob(AcpiBuildState *build_state,

                                       GArray *blob, const char *name,

                                       uint64_t max_size)

{

    return rom_add_blob(name, blob->data, acpi_data_len(blob), max_size, -1,

                        name, virt_acpi_build_update, build_state);

}


--- a/source.c
+++ b/source.c
@@ -39,11 +39,11 @@

 #if !defined(CONFIG_USER_ONLY)
+
+    if (cpu_interrupts_enabled(env)) {
+
+
+        cpu_check_irqs(env);

     }

void helper_retry(CPUSPARCState *env)

{

    trap_state *tsptr = cpu_tsptr(env);

    env->pc = tsptr->tpc;

    env->npc = tsptr->tnpc;

    cpu_put_ccr(env, tsptr->tstate >> 32);

    env->asi = (tsptr->tstate >> 24) & 0xff;

    cpu_change_pstate(env, (tsptr->tstate >> 8) & 0xf3f);

    cpu_put_cwp64(env, tsptr->tstate & 0xff);

    if (cpu_has_hypervisor(env)) {

        uint32_t new_gl = (tsptr->tstate >> 40) & 7;

        env->hpstate = env->htstate[env->tl];

        cpu_gl_switch_gregs(env, new_gl);

        env->gl = new_gl;

    }

    env->tl--;

    trace_win_helper_retry(env->tl);

#if !defined(CONFIG_USER_ONLY)

    if (cpu_interrupts_enabled(env)) {

        cpu_check_irqs(env);

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static bool msix_vector_masked(PCIDevice *dev, int vector, bool fmask)
+
 {

     unsigned offset = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;

static bool msix_vector_masked(PCIDevice *dev, int vector, bool fmask)

{

    unsigned offset = vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;

    return fmask || dev->msix_table[offset] & PCI_MSIX_ENTRY_CTRL_MASKBIT;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block)

+{

     int i;

void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block)

{

    int i;

    DCTELEM temp[64];

    for (i = 0; i < 8; i++)

        bink_idct_col(&temp[i], &block[i]);

    for (i = 0; i < 8; i++) {

        IDCT_ROW( (&dest[i*linesize]), (&temp[8*i]) );

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void helper_rfdi(CPUPPCState *env)
+
 {

     do_rfi(env, env->spr[SPR_BOOKE_DSRR0], SPR_BOOKE_DSRR1,

void helper_rfdi(CPUPPCState *env)

{

    do_rfi(env, env->spr[SPR_BOOKE_DSRR0], SPR_BOOKE_DSRR1,

           ~((target_ulong)0x3FFF0000), 0);

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     /* FIXME - figure out which other formats work */

     switch (fmt) {
+
+    case IMGFMT_YV12:
+
+    case IMGFMT_IYUV:
+
     case IMGFMT_I420:

         return ff_vf_next_query_format(vf, fmt);

static int query_format(struct vf_instance *vf, unsigned int fmt)

{

    /* FIXME - figure out which other formats work */

    switch (fmt) {

    case IMGFMT_YV12:

    case IMGFMT_IYUV:

    case IMGFMT_I420:

        return ff_vf_next_query_format(vf, fmt);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@

     s->time_base.num = pts_num/gcd;

+    s->time_base.den = pts_den/gcd;
+
+
+
+    if(gcd>1)

         av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd);

void av_set_pts_info(AVStream *s, int pts_wrap_bits,

                     unsigned int pts_num, unsigned int pts_den)

{

    unsigned int gcd= av_gcd(pts_num, pts_den);

    s->pts_wrap_bits = pts_wrap_bits;

    s->time_base.num = pts_num/gcd;

    s->time_base.den = pts_den/gcd;

    if(gcd>1)

        av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd);

}


--- a/source.c
+++ b/source.c
@@ -1,24 +1,24 @@
+int monitor_read_block_device_key(Monitor *mon, const char *device,
+
+                                  BlockCompletionFunc *completion_cb,
+
+                                  void *opaque)
+
+{

+    Error *err = NULL;
+
     BlockBackend *blk;

+
+
+    blk = blk_by_name(device);
+
     if (!blk) {
+
+        monitor_printf(mon, "Device not found %s\n", device);

+        return -1;

     }

int monitor_read_block_device_key(Monitor *mon, const char *device,

                                  BlockCompletionFunc *completion_cb,

                                  void *opaque)

{

    Error *err = NULL;

    BlockBackend *blk;

    blk = blk_by_name(device);

    if (!blk) {

        monitor_printf(mon, "Device not found %s\n", device);

        return -1;

    }

    if (!blk_bs(blk)) {

        monitor_printf(mon, "Device '%s' has no medium\n", device);

        return -1;

    }

    bdrv_add_key(blk_bs(blk), NULL, &err);

    if (err) {

        error_free(err);

        return monitor_read_bdrv_key_start(mon, blk_bs(blk), completion_cb, opaque);

    }

    if (completion_cb) {

        completion_cb(opaque, 0);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
         error_report("warning: ssh server %s does not support fsync",

                      s->inet->host);
+
+        if (what) {
+
+            error_report("to support fsync, you need %s", what);
+
         }

         s->unsafe_flush_warning = true;

static void unsafe_flush_warning(BDRVSSHState *s, const char *what)

{

    if (!s->unsafe_flush_warning) {

        error_report("warning: ssh server %s does not support fsync",

                     s->inet->host);

        if (what) {

            error_report("to support fsync, you need %s", what);

        }

        s->unsafe_flush_warning = true;

    }

}


--- a/source.c
+++ b/source.c
@@ -22,10 +22,10 @@

         p = nodes[lp.ptr];

+        lp = p[(index >> (i * P_L2_BITS)) & (P_L2_SIZE - 1)];
+
+    }
+
+    return &sections[lp.ptr];

 }

static MemoryRegionSection *phys_page_find(PhysPageEntry lp, hwaddr addr,

                                           Node *nodes, MemoryRegionSection *sections)

{

    PhysPageEntry *p;

    hwaddr index = addr >> TARGET_PAGE_BITS;

    int i;

    for (i = P_L2_LEVELS; lp.skip && (i -= lp.skip) >= 0;) {

        if (lp.ptr == PHYS_MAP_NODE_NIL) {

            return &sections[PHYS_SECTION_UNASSIGNED];

        }

        p = nodes[lp.ptr];

        lp = p[(index >> (i * P_L2_BITS)) & (P_L2_SIZE - 1)];

    }

    return &sections[lp.ptr];

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
             s->bd_addr.b[3] = data[offset + 0];

             s->bd_addr.b[4] = data[offset + 3];
+
+            s->bd_addr.b[5] = data[offset + 2];
+
+
+
             s->hci->bdaddr_set(s->hci, s->bd_addr.b);

             fprintf(stderr, "%s: bd_address loaded from firmware: "

static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf,

                uint8_t *data, int len)

{

    int offset;

    uint8_t *rpkt;

    switch (ocf) {

    case OCF_CSR_SEND_FIRMWARE:

        /* Check if this is the bd_address packet */

        if (len >= 18 + 8 && data[12] == 0x01 && data[13] == 0x00) {

            offset = 18;

            s->bd_addr.b[0] = data[offset + 7];	/* Beyond cmd packet end(!?) */

            s->bd_addr.b[1] = data[offset + 6];

            s->bd_addr.b[2] = data[offset + 4];

            s->bd_addr.b[3] = data[offset + 0];

            s->bd_addr.b[4] = data[offset + 3];

            s->bd_addr.b[5] = data[offset + 2];

            s->hci->bdaddr_set(s->hci, s->bd_addr.b);

            fprintf(stderr, "%s: bd_address loaded from firmware: "

                            "%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,

                            s->bd_addr.b[0], s->bd_addr.b[1], s->bd_addr.b[2],

                            s->bd_addr.b[3], s->bd_addr.b[4], s->bd_addr.b[5]);

        }

        rpkt = csrhci_out_packet_event(s, EVT_VENDOR, 11);

        /* Status bytes: no error */

        rpkt[9] = 0x00;

        rpkt[10] = 0x00;

        break;

    default:

        fprintf(stderr, "%s: got a bad CMD packet\n", __FUNCTION__);

        return;

    }

    csrhci_fifo_wake(s);

}


--- a/source.c
+++ b/source.c
@@ -35,11 +35,11 @@
         /* It's hugepage, return the huge page size */

         return fs.f_bsize;
+
+    }
+
+
+

size_t qemu_mempath_getpagesize(const char *mem_path)

{

#ifdef CONFIG_LINUX

    struct statfs fs;

    int ret;

    do {

        ret = statfs(mem_path, &fs);

    } while (ret != 0 && errno == EINTR);

    if (ret != 0) {

        fprintf(stderr, "Couldn't statfs() memory path: %s\n",

                strerror(errno));

        exit(1);

    }

    if (fs.f_type == HUGETLBFS_MAGIC) {

        /* It's hugepage, return the huge page size */

        return fs.f_bsize;

    }

    return getpagesize();

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
         g_str_equal(type, "filter-rewriter")) {

         return false;
+
+    }
+
+
+
     /* Memory allocation by backends needs to be done

      * after configure_accelerator() (due to the tcg_enabled()

static bool object_create_initial(const char *type)

{

    if (g_str_equal(type, "rng-egd")) {

        return false;

    }

    /*

     * return false for concrete netfilters since

     * they depend on netdevs already existing

     */

    if (g_str_equal(type, "filter-buffer") ||

        g_str_equal(type, "filter-dump") ||

        g_str_equal(type, "filter-mirror") ||

        g_str_equal(type, "filter-redirector") ||

        g_str_equal(type, "colo-compare") ||

        g_str_equal(type, "filter-rewriter")) {

        return false;

    }

    /* Memory allocation by backends needs to be done

     * after configure_accelerator() (due to the tcg_enabled()

     * checks at memory_region_init_*()).

     *

     * Also, allocation of large amounts of memory may delay

     * chardev initialization for too long, and trigger timeouts

     * on software that waits for a monitor socket to be created

     * (e.g. libvirt).

     */

    if (g_str_has_prefix(type, "memory-backend-")) {

        return false;

    }

    return true;

}


--- a/source.c
+++ b/source.c
@@ -4,7 +4,7 @@

     WorkerTestData data;

+    Coroutine *co = qemu_coroutine_create(co_test_cb);

static void test_submit_co(void)

{

    WorkerTestData data;

    Coroutine *co = qemu_coroutine_create(co_test_cb);

    qemu_coroutine_enter(co, &data);

    /* Back here once the worker has started.  */

    g_assert_cmpint(active, ==, 1);

    g_assert_cmpint(data.ret, ==, -EINPROGRESS);

    /* qemu_aio_wait_all will execute the rest of the coroutine.  */

    qemu_aio_wait_all();

    /* Back here after the coroutine has finished.  */

    g_assert_cmpint(active, ==, 0);

    g_assert_cmpint(data.ret, ==, 0);

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@

         return buffer_zero_avx2(buf, len);

+    }
+
+    if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE4)) {
+
+        return buffer_zero_sse4(buf, len);

     }

static bool select_accel_fn(const void *buf, size_t len)

{

    uintptr_t ibuf = (uintptr_t)buf;

#ifdef CONFIG_AVX2_OPT

    if (len % 128 == 0 && ibuf % 32 == 0 && (cpuid_cache & CACHE_AVX2)) {

        return buffer_zero_avx2(buf, len);

    }

    if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE4)) {

        return buffer_zero_sse4(buf, len);

    }

#endif

    if (len % 64 == 0 && ibuf % 16 == 0 && (cpuid_cache & CACHE_SSE2)) {

        return buffer_zero_sse2(buf, len);

    }

    return buffer_zero_int(buf, len);

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
     c->icc_pmr_el1 = 0;

     c->icc_bpr[GICV3_G0] = GIC_MIN_BPR;
+
+    c->icc_bpr[GICV3_G1] = GIC_MIN_BPR;
+
+    c->icc_bpr[GICV3_G1NS] = GIC_MIN_BPR;
+

     c->icc_sre_el1 = 0x7;

static void arm_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri)

{

    ARMCPU *cpu;

    GICv3State *s;

    GICv3CPUState *c;

    c = (GICv3CPUState *)env->gicv3state;

    s = c->gic;

    cpu = ARM_CPU(c->cpu);

    /* Initialize to actual HW supported configuration */

    kvm_device_access(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS,

                      KVM_VGIC_ATTR(ICC_CTLR_EL1, cpu->mp_affinity),

                      &c->icc_ctlr_el1[GICV3_NS], false);

    c->icc_ctlr_el1[GICV3_S] = c->icc_ctlr_el1[GICV3_NS];

    c->icc_pmr_el1 = 0;

    c->icc_bpr[GICV3_G0] = GIC_MIN_BPR;

    c->icc_bpr[GICV3_G1] = GIC_MIN_BPR;

    c->icc_bpr[GICV3_G1NS] = GIC_MIN_BPR;

    c->icc_sre_el1 = 0x7;

    memset(c->icc_apr, 0, sizeof(c->icc_apr));

    memset(c->icc_igrpen, 0, sizeof(c->icc_igrpen));

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void decode_422_bitstream(HYuvContext *s, int count)

 {
+
+    int i;
+
+
+
     count /= 2;

static void decode_422_bitstream(HYuvContext *s, int count)

{

    int i;

    count /= 2;

    if (count >= (get_bits_left(&s->gb)) / (31 * 4)) {

        for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) {

            READ_2PIX(s->temp[0][2 * i    ], s->temp[1][i], 1);

            READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2);

        }

    } else {

        for (i = 0; i < count; i++) {

            READ_2PIX(s->temp[0][2 * i    ], s->temp[1][i], 1);

            READ_2PIX(s->temp[0][2 * i + 1], s->temp[2][i], 2);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -66,8 +66,8 @@

     vaapi_encode_mjpeg_init_tables(avctx);

+
+
+    return 0;
+
+}

static av_cold int vaapi_encode_mjpeg_init_internal(AVCodecContext *avctx)

{

    static const VAConfigAttrib default_config_attributes[] = {

        { .type  = VAConfigAttribRTFormat,

          .value = VA_RT_FORMAT_YUV420 },

        { .type  = VAConfigAttribEncPackedHeaders,

          .value = VA_ENC_PACKED_HEADER_SEQUENCE },

    };

    VAAPIEncodeContext       *ctx = avctx->priv_data;

    VAAPIEncodeMJPEGContext *priv = ctx->priv_data;

    int i;

    ctx->va_profile    = VAProfileJPEGBaseline;

    ctx->va_entrypoint = VAEntrypointEncPicture;

    ctx->input_width    = avctx->width;

    ctx->input_height   = avctx->height;

    ctx->aligned_width  = FFALIGN(ctx->input_width,  8);

    ctx->aligned_height = FFALIGN(ctx->input_height, 8);

    for (i = 0; i < FF_ARRAY_ELEMS(default_config_attributes); i++) {

        ctx->config_attributes[ctx->nb_config_attributes++] =

            default_config_attributes[i];

    }

    priv->quality = avctx->global_quality;

    if (priv->quality < 1 || priv->quality > 100) {

        av_log(avctx, AV_LOG_ERROR, "Invalid quality value %d "

               "(must be 1-100).\n", priv->quality);

        return AVERROR(EINVAL);

    }

    vaapi_encode_mjpeg_init_tables(avctx);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int load_refcount_block(BlockDriverState *bs,
+
+                               int64_t refcount_block_offset,
+
+                               void **refcount_block)
+
 {

     BDRVQcow2State *s = bs->opaque;

static int load_refcount_block(BlockDriverState *bs,

                               int64_t refcount_block_offset,

                               void **refcount_block)

{

    BDRVQcow2State *s = bs->opaque;

    int ret;

    BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_LOAD);

    ret = qcow2_cache_get(bs, s->refcount_block_cache, refcount_block_offset,

        refcount_block);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     VGACommonState *s = opaque;

     int full_update, graphic_mode;
+

     qemu_flush_coalesced_mmio_buffer();

static void vga_update_display(void *opaque)

{

    VGACommonState *s = opaque;

    int full_update, graphic_mode;

    qemu_flush_coalesced_mmio_buffer();

    if (ds_get_bits_per_pixel(s->ds) == 0) {

        /* nothing to do */

    } else {

        full_update = 0;

        if (!(s->ar_index & 0x20)) {

            graphic_mode = GMODE_BLANK;

        } else {

            graphic_mode = s->gr[VGA_GFX_MISC] & VGA_GR06_GRAPHICS_MODE;

        }

        if (graphic_mode != s->graphic_mode) {

            s->graphic_mode = graphic_mode;

            s->cursor_blink_time = qemu_get_clock_ms(vm_clock);

            full_update = 1;

        }

        switch(graphic_mode) {

        case GMODE_TEXT:

            vga_draw_text(s, full_update);

            break;

        case GMODE_GRAPH:

            vga_draw_graphic(s, full_update);

            break;

        case GMODE_BLANK:

        default:

            vga_draw_blank(s, full_update);

            break;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth,

                                  unsigned size)
+
 {

     unsigned i, j;

static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth,

                                 unsigned size)

{

    unsigned i, j;

    CodeBook cb = { 0 };

    if (!can_safely_read(gb, size * 34))

        return cb;

    if (size >= INT_MAX / sizeof(MacroBlock))

        return cb;

    cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1);

    if (!cb.blocks)

        return cb;

    cb.depth = depth;

    cb.size = size;

    for (i = 0; i < size; i++) {

        unsigned mask_bits = get_bits(gb, 4);

        unsigned color0 = get_bits(gb, 15);

        unsigned color1 = get_bits(gb, 15);

        for (j = 0; j < 4; j++) {

            if (mask_bits & (1 << j))

                cb.blocks[i].pixels[j] = color1;

            else

                cb.blocks[i].pixels[j] = color0;

        }

    }

    return cb;

}


--- a/source.c
+++ b/source.c
@@ -4,16 +4,16 @@

 {

+    PutBitContext p;
+
     uint8_t buf[256];

+
+
     init_put_bits(&p, buf, sizeof(buf));
+
+
+
     put_bits(&p, 1, 1); /* a, d present */

     put_bits(&p, 5, 20); /* nb bits */

static void put_swf_matrix(ByteIOContext *pb,

                           int a, int b, int c, int d, int tx, int ty)

{

    PutBitContext p;

    uint8_t buf[256];

    init_put_bits(&p, buf, sizeof(buf));

    put_bits(&p, 1, 1); /* a, d present */

    put_bits(&p, 5, 20); /* nb bits */

    put_bits(&p, 20, a);

    put_bits(&p, 20, d);

    put_bits(&p, 1, 1); /* b, c present */

    put_bits(&p, 5, 20); /* nb bits */

    put_bits(&p, 20, c);

    put_bits(&p, 20, b);

    put_bits(&p, 5, 20); /* nb bits */

    put_bits(&p, 20, tx);

    put_bits(&p, 20, ty);

    flush_put_bits(&p);

    put_buffer(pb, buf, pbBufPtr(&p) - p.buf);

}


--- a/source.c
+++ b/source.c
@@ -2,7 +2,7 @@

                              int16_t quant_table[MAX_CONTEXT_INPUTS][256])

+{

     int i;

static int read_quant_tables(RangeCoder *c,

                             int16_t quant_table[MAX_CONTEXT_INPUTS][256])

{

    int i;

    int context_count = 1;

    for (i = 0; i < 5; i++) {

        context_count *= read_quant_table(c, quant_table[i], context_count);

        if (context_count > 32768U) {

            return AVERROR_INVALIDDATA;

        }

    }

    return (context_count + 1) / 2;

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
     if (type != E820_RAM) {

         /* old FW_CFG_E820_TABLE entry -- reservations only */
+
         if (index >= E820_NR_ENTRIES) {

             return -EBUSY;

int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)

{

    int index = le32_to_cpu(e820_reserve.count);

    struct e820_entry *entry;

    if (type != E820_RAM) {

        /* old FW_CFG_E820_TABLE entry -- reservations only */

        if (index >= E820_NR_ENTRIES) {

            return -EBUSY;

        }

        entry = &e820_reserve.entry[index++];

        entry->address = cpu_to_le64(address);

        entry->length = cpu_to_le64(length);

        entry->type = cpu_to_le32(type);

        e820_reserve.count = cpu_to_le32(index);

    }

    /* new "etc/e820" file -- include ram too */

    e820_table = g_realloc(e820_table,

                           sizeof(struct e820_entry) * (e820_entries+1));

    e820_table[e820_entries].address = cpu_to_le64(address);

    e820_table[e820_entries].length = cpu_to_le64(length);

    e820_table[e820_entries].type = cpu_to_le32(type);

    e820_entries++;

    return e820_entries;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     EHCIitd itd;

+
+    assert(!async);
+
+    entry = ehci_get_fetch_addr(ehci, async);
+

     get_dwords(NLPTR_GET(entry),(uint32_t *) &itd,

static int ehci_state_fetchitd(EHCIState *ehci, int async)

{

    uint32_t entry;

    EHCIitd itd;

    assert(!async);

    entry = ehci_get_fetch_addr(ehci, async);

    get_dwords(NLPTR_GET(entry),(uint32_t *) &itd,

               sizeof(EHCIitd) >> 2);

    ehci_trace_itd(ehci, entry, &itd);

    if (ehci_process_itd(ehci, &itd) != 0) {

        return -1;

    }

    put_dwords(NLPTR_GET(entry), (uint32_t *) &itd,

                sizeof(EHCIitd) >> 2);

    ehci_set_fetch_addr(ehci, async, itd.next);

    ehci_set_state(ehci, async, EST_FETCHENTRY);

    return 1;

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                         unsigned char status)

 {
+
     VirtIOBlock *s = req->dev;

     VirtIODevice *vdev = VIRTIO_DEVICE(s);

static void virtio_blk_complete_request(VirtIOBlockReq *req,

                                        unsigned char status)

{

    VirtIOBlock *s = req->dev;

    VirtIODevice *vdev = VIRTIO_DEVICE(s);

    trace_virtio_blk_req_complete(req, status);

    stb_p(&req->in->status, status);

    virtqueue_push(s->vq, req->elem, req->qiov.size + sizeof(*req->in));

    virtio_notify(vdev, s->vq);

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     int ret;

+
     static const enum AVPixelFormat input_pix_fmts[] = {

         AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P,

static int cudaupload_query_formats(AVFilterContext *ctx)

{

    int ret;

    static const enum AVPixelFormat input_pix_fmts[] = {

        AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P,

        AV_PIX_FMT_NONE,

    };

    static const enum AVPixelFormat output_pix_fmts[] = {

        AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE,

    };

    AVFilterFormats *in_fmts  = ff_make_format_list(input_pix_fmts);

    AVFilterFormats *out_fmts = ff_make_format_list(output_pix_fmts);

    ret = ff_formats_ref(in_fmts, &ctx->inputs[0]->out_formats);

    if (ret < 0)

        return ret;

    ret = ff_formats_ref(out_fmts, &ctx->outputs[0]->in_formats);

    if (ret < 0)

        return ret;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -36,11 +36,11 @@

     end = src + (len & ~63);

+    if (HAVE_BIGENDIAN || (!HAVE_FAST_UNALIGNED && ((intptr_t)src & 3))) {
+
+       while (src < end) {
+
+           memcpy(ctx->block, src, 64);

            body(ctx->ABCD, (uint32_t *) ctx->block);

void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len)

{

    const uint8_t *end;

    int j;

    j = ctx->len & 63;

    ctx->len += len;

    if (j) {

        int cnt = FFMIN(len, 64 - j);

        memcpy(ctx->block + j, src, cnt);

        src += cnt;

        len -= cnt;

        if (j + cnt < 64)

            return;

        body(ctx->ABCD, (uint32_t *)ctx->block);

    }

    end = src + (len & ~63);

    if (HAVE_BIGENDIAN || (!HAVE_FAST_UNALIGNED && ((intptr_t)src & 3))) {

       while (src < end) {

           memcpy(ctx->block, src, 64);

           body(ctx->ABCD, (uint32_t *) ctx->block);

           src += 64;

        }

    } else {

        while (src < end) {

            body(ctx->ABCD, (uint32_t *)src);

            src += 64;

        }

    }

    len &= 63;

    if (len > 0)

        memcpy(ctx->block, src, len);

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     LoopContext *s = ctx->priv;

     AVFrame *out;
+
     int ret, i = 0;

static int push_samples(AVFilterContext *ctx, int nb_samples)

{

    AVFilterLink *outlink = ctx->outputs[0];

    LoopContext *s = ctx->priv;

    AVFrame *out;

    int ret, i = 0;

    while (s->loop != 0 && i < nb_samples) {

        out = ff_get_audio_buffer(outlink, FFMIN(nb_samples, s->nb_samples - s->current_sample));

        if (!out)

            return AVERROR(ENOMEM);

        ret = av_audio_fifo_peek_at(s->fifo, (void **)out->extended_data, out->nb_samples, s->current_sample);

        if (ret < 0)

            return ret;

        out->pts = s->pts;

        out->nb_samples = ret;

        s->pts += out->nb_samples;

        i += out->nb_samples;

        s->current_sample += out->nb_samples;

        ret = ff_filter_frame(outlink, out);

        if (ret < 0)

            return ret;

        if (s->current_sample >= s->nb_samples) {

            s->current_sample = 0;

            if (s->loop > 0)

                s->loop--;

        }

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int kvm_recommended_vcpus(KVMState *s)
+
 {

     int ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);

static int kvm_recommended_vcpus(KVMState *s)

{

    int ret = kvm_check_extension(s, KVM_CAP_NR_VCPUS);

    return (ret) ? ret : 4;

}


--- a/source.c
+++ b/source.c
@@ -4,8 +4,8 @@

     qtest_end();

+    rmdir(test_share);
+
     g_free(test_share);

 }

static void qvirtio_9p_stop(void)

{

    qtest_end();

    rmdir(test_share);

    g_free(test_share);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void rng_egd_opened(RngBackend *b, Error **errp)
+{
+    RngEgd *s = RNG_EGD(b);
     if (s->chr_name == NULL) {
         error_set(errp, QERR_INVALID_PARAMETER_VALUE,
                   "chardev", "a valid character device");

static void rng_egd_opened(RngBackend *b, Error **errp)
{
    RngEgd *s = RNG_EGD(b);
    if (s->chr_name == NULL) {
        error_set(errp, QERR_INVALID_PARAMETER_VALUE,
                  "chardev", "a valid character device");
    s->chr = qemu_chr_find(s->chr_name);
    if (s->chr == NULL) {
        error_set(errp, QERR_DEVICE_NOT_FOUND, s->chr_name);
    /* FIXME we should resubmit pending requests when the CDS reconnects. */
    qemu_chr_add_handlers(s->chr, rng_egd_chr_can_read, rng_egd_chr_read,
                          NULL, s);


--- a/source.c
+++ b/source.c
@@ -6,11 +6,11 @@

     /* host_key_check=no */

+    if (strcmp(host_key_check, "no") == 0) {
+
+        return 0;
+
+    }

static int check_host_key(BDRVSSHState *s, const char *host, int port,

                          const char *host_key_check)

{

    /* host_key_check=no */

    if (strcmp(host_key_check, "no") == 0) {

        return 0;

    }

    /* host_key_check=md5:xx:yy:zz:... */

    if (strncmp(host_key_check, "md5:", 4) == 0) {

        return check_host_key_hash(s, &host_key_check[4],

                                   LIBSSH2_HOSTKEY_HASH_MD5, 16);

    }

    /* host_key_check=sha1:xx:yy:zz:... */

    if (strncmp(host_key_check, "sha1:", 5) == 0) {

        return check_host_key_hash(s, &host_key_check[5],

                                   LIBSSH2_HOSTKEY_HASH_SHA1, 20);

    }

    /* host_key_check=yes */

    if (strcmp(host_key_check, "yes") == 0) {

        return check_host_key_knownhosts(s, host, port);

    }

    error_report("unknown host_key_check setting (%s)", host_key_check);

    return -EINVAL;

}


static int mm_decode_pal(MmContext *s)

{

    int i;

    bytestream2_skip(&s->gb, 4);

    for (i = 0; i < 128; i++) {

        s->palette[i] = 0xFF << 24 | bytestream2_get_be24(&s->gb);

        s->palette[i+128] = s->palette[i]<<2;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
         s->out_state = (s->out_state & 0xFFFF) | (value << 16);

         s->lcd_brightness = (s->lcd_brightness & 0xFFFF) |
+
+                            (s->out_state & MP_GPIO_LCD_BRIGHTNESS);
+
+        musicpal_gpio_brightness_update(s);
+
         qemu_set_irq(s->out[3], (s->out_state >> MP_GPIO_I2C_DATA_BIT) & 1);

         qemu_set_irq(s->out[4], (s->out_state >> MP_GPIO_I2C_CLOCK_BIT) & 1);

static void musicpal_gpio_write(void *opaque, target_phys_addr_t offset,

                                uint64_t value, unsigned size)

{

    musicpal_gpio_state *s = opaque;

    switch (offset) {

    case MP_GPIO_OE_HI: /* used for LCD brightness control */

        s->lcd_brightness = (s->lcd_brightness & MP_GPIO_LCD_BRIGHTNESS) |

                         (value & MP_OE_LCD_BRIGHTNESS);

        musicpal_gpio_brightness_update(s);

        break;

    case MP_GPIO_OUT_LO:

        s->out_state = (s->out_state & 0xFFFF0000) | (value & 0xFFFF);

        break;

    case MP_GPIO_OUT_HI:

        s->out_state = (s->out_state & 0xFFFF) | (value << 16);

        s->lcd_brightness = (s->lcd_brightness & 0xFFFF) |

                            (s->out_state & MP_GPIO_LCD_BRIGHTNESS);

        musicpal_gpio_brightness_update(s);

        qemu_set_irq(s->out[3], (s->out_state >> MP_GPIO_I2C_DATA_BIT) & 1);

        qemu_set_irq(s->out[4], (s->out_state >> MP_GPIO_I2C_CLOCK_BIT) & 1);

        break;

    case MP_GPIO_IER_LO:

        s->ier = (s->ier & 0xFFFF0000) | (value & 0xFFFF);

        break;

    case MP_GPIO_IER_HI:

        s->ier = (s->ier & 0xFFFF) | (value << 16);

        break;

    case MP_GPIO_IMR_LO:

        s->imr = (s->imr & 0xFFFF0000) | (value & 0xFFFF);

        break;

    case MP_GPIO_IMR_HI:

        s->imr = (s->imr & 0xFFFF) | (value << 16);

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -10,7 +10,7 @@

     for (x = 0; x < image->numcomps; x++)

+        adjust[x] = FFMAX(FFMIN(av_pix_fmt_desc_get(picture->format)->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0);

static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) {

    int *comp_data;

    uint16_t *img_ptr;

    int index, x, y;

    int adjust[4];

    for (x = 0; x < image->numcomps; x++)

        adjust[x] = FFMAX(FFMIN(av_pix_fmt_desc_get(picture->format)->comp[x].depth_minus1 + 1 - image->comps[x].prec, 8), 0);

    for (index = 0; index < image->numcomps; index++) {

        comp_data = image->comps[index].data;

        for (y = 0; y < image->comps[index].h; y++) {

            img_ptr = (uint16_t*) (picture->data[index] + y * picture->linesize[index]);

            for (x = 0; x < image->comps[index].w; x++) {

                *img_ptr = 0x8000 * image->comps[index].sgnd + (*comp_data << adjust[index]);

                img_ptr++;

                comp_data++;

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -3,10 +3,10 @@
                                     int i)

 {
+
+    hwaddr pa;
+
+    virtio_tswap32s(vq->vdev, &uelem->id);

     virtio_tswap32s(vq->vdev, &uelem->len);

static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem,

                                    int i)

{

    hwaddr pa;

    virtio_tswap32s(vq->vdev, &uelem->id);

    virtio_tswap32s(vq->vdev, &uelem->len);

    pa = vq->vring.used + offsetof(VRingUsed, ring[i]);

    address_space_write(&address_space_memory, pa, MEMTXATTRS_UNSPECIFIED,

                       (void *)uelem, sizeof(VRingUsedElem));

}


--- a/source.c
+++ b/source.c
@@ -2,11 +2,11 @@

 {

+    BlockDirtyBitmapAdd *action;
+
+    BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
+
+                                             common, common);

static void block_dirty_bitmap_add_abort(BlkActionState *common)

{

    BlockDirtyBitmapAdd *action;

    BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,

                                             common, common);

    action = common->action->u.block_dirty_bitmap_add;

    /* Should not be able to fail: IF the bitmap was added via .prepare(),

     * then the node reference and bitmap name must have been valid.

     */

    if (state->prepared) {

        qmp_block_dirty_bitmap_remove(action->node, action->name, &error_abort);

    }

}