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

     }

+
+
+    trace_milkymist_hpdmc_memory_read(addr << 2, r);
+
+

     return r;

static uint64_t hpdmc_read(void *opaque, target_phys_addr_t addr,

                           unsigned size)

{

    MilkymistHpdmcState *s = opaque;

    uint32_t r = 0;

    addr >>= 2;

    switch (addr) {

    case R_SYSTEM:

    case R_BYPASS:

    case R_TIMING:

    case R_IODELAY:

        r = s->regs[addr];

        break;

    default:

        error_report("milkymist_hpdmc: read access to unknown register 0x"

                TARGET_FMT_plx, addr << 2);

        break;

    }

    trace_milkymist_hpdmc_memory_read(addr << 2, r);

    return r;

}


static void imx_fec_reset(DeviceState *d)

{

    IMXFECState *s = IMX_FEC(d);

    /* Reset the FEC */

    s->eir = 0;

    s->eimr = 0;

    s->rx_enabled = 0;

    s->ecr = 0;

    s->mscr = 0;

    s->mibc = 0xc0000000;

    s->rcr = 0x05ee0001;

    s->tcr = 0;

    s->tfwr = 0;

    s->frsr = 0x500;

    s->miigsk_cfgr = 0;

    s->miigsk_enr = 0x6;

    /* We also reset the PHY */

    phy_reset(s);

}


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

     int64_t cpu_id;

+
+
+    cpu_id = k->get_arch_id(cpu);
+
+    if ((cpu_id / 8) >= ACPI_GPE_PROC_LEN) {

         error_setg(errp, "acpi: invalid cpu id: %" PRIi64, cpu_id);

static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu,

                                     Error **errp)

{

    CPUClass *k = CPU_GET_CLASS(cpu);

    int64_t cpu_id;

    cpu_id = k->get_arch_id(cpu);

    if ((cpu_id / 8) >= ACPI_GPE_PROC_LEN) {

        error_setg(errp, "acpi: invalid cpu id: %" PRIi64, cpu_id);

        return;

    }

    g->sts[cpu_id / 8] |= (1 << (cpu_id % 8));

}


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

     if (!qstr) {
+
+
+        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+
+                   "string");

         return;

static void qmp_input_type_str(Visitor *v, const char *name, char **obj,

                               Error **errp)

{

    QmpInputVisitor *qiv = to_qiv(v);

    QString *qstr = qobject_to_qstring(qmp_input_get_object(qiv, name, true));

    if (!qstr) {

        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",

                   "string");

        return;

    }

    *obj = g_strdup(qstring_get_str(qstr));

}


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

     int iomemtype;
+
     icp_control_state *s;

static void icp_control_init(uint32_t base)

{

    int iomemtype;

    icp_control_state *s;

    s = (icp_control_state *)qemu_mallocz(sizeof(icp_control_state));

    iomemtype = cpu_register_io_memory(0, icp_control_readfn,

                                       icp_control_writefn, s);

    cpu_register_physical_memory(base, 0x007fffff, iomemtype);

    s->base = base;

    /* ??? Save/restore.  */

}


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

     VLANClientState *vc;
+
+
+
+    if (vlan) {
+
         vc = qemu_find_vlan_client_by_name(mon, strtol(vlan, NULL, 0), stack);

         if (!vc) {

static SlirpState *slirp_lookup(Monitor *mon, const char *vlan,

                                const char *stack)

{

    VLANClientState *vc;

    if (vlan) {

        vc = qemu_find_vlan_client_by_name(mon, strtol(vlan, NULL, 0), stack);

        if (!vc) {

            return NULL;

        }

        if (strcmp(vc->model, "user")) {

            monitor_printf(mon, "invalid device specified\n");

            return NULL;

        }

        return vc->opaque;

    } else {

        if (TAILQ_EMPTY(&slirp_stacks)) {

            monitor_printf(mon, "user mode network stack not in use\n");

            return NULL;

        }

        return TAILQ_FIRST(&slirp_stacks);

    }

}


--- a/source.c
+++ b/source.c
@@ -14,11 +14,11 @@
      * the fifo-reading code, and the next byte of data
      * to read is always fifo[63 - fifopointer].
      */
+    int fptr;
+    int cs = prefetch_cs(s->prefetch.config1);
+    int is16bit = (((s->cs_file[cs].config[0] >> 12) & 3) != 0);
+    int bytes;
+    /* Don't believe the bit of the OMAP TRM that says that COUNTVALUE
      * and TRANSFERCOUNT are in units of 16 bit words for 16 bit NAND.
      * Instead believe the bit that says it is always a byte count.
      */

static void fill_prefetch_fifo(struct omap_gpmc_s *s)
{
    /* Fill the prefetch FIFO by reading data from NAND.
     * We do this synchronously, unlike the hardware which
     * will do this asynchronously. We refill when the
     * FIFO has THRESHOLD bytes free, and we always refill
     * as much data as possible starting at the top end
     * of the FIFO.
     * (We have to refill at THRESHOLD rather than waiting
     * for the FIFO to empty to allow for the case where
     * the FIFO size isn't an exact multiple of THRESHOLD
     * and we're doing DMA transfers.)
     * This means we never need to handle wrap-around in
     * the fifo-reading code, and the next byte of data
     * to read is always fifo[63 - fifopointer].
     */
    int fptr;
    int cs = prefetch_cs(s->prefetch.config1);
    int is16bit = (((s->cs_file[cs].config[0] >> 12) & 3) != 0);
    int bytes;
    /* Don't believe the bit of the OMAP TRM that says that COUNTVALUE
     * and TRANSFERCOUNT are in units of 16 bit words for 16 bit NAND.
     * Instead believe the bit that says it is always a byte count.
     */
    bytes = 64 - s->prefetch.fifopointer;
    if (bytes > s->prefetch.count) {
        bytes = s->prefetch.count;
    s->prefetch.count -= bytes;
    s->prefetch.fifopointer += bytes;
    fptr = 64 - s->prefetch.fifopointer;
    /* Move the existing data in the FIFO so it sits just
     * before what we're about to read in
     */
    while (fptr < (64 - bytes)) {
        s->prefetch.fifo[fptr] = s->prefetch.fifo[fptr + bytes];
        fptr++;
    while (fptr < 64) {
            uint32_t v = omap_nand_read(&s->cs_file[cs], 0, 2);
            s->prefetch.fifo[fptr++] = v & 0xff;
            s->prefetch.fifo[fptr++] = (v >> 8) & 0xff;
        } else {
            s->prefetch.fifo[fptr++] = omap_nand_read(&s->cs_file[cs], 0, 1);
    if (s->prefetch.startengine && (s->prefetch.count == 0)) {
        /* This was the final transfer: raise TERMINALCOUNTSTATUS */
        s->irqst |= 2;
        s->prefetch.startengine = 0;
    /* If there are any bytes in the FIFO at this point then
     * we must raise a DMA request (either this is a final part
     * transfer, or we filled the FIFO in which case we certainly
     * have THRESHOLD bytes available)
     */
    if (s->prefetch.fifopointer != 0) {
        omap_gpmc_dma_update(s, 1);
    omap_gpmc_int_update(s);


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

     acpi_build(&tables, MACHINE(qdev_get_machine()));

+
+
+    acpi_ram_update(build_state->table_mr, tables.table_data);
+
+

     if (build_state->rsdp) {

static void acpi_build_update(void *build_opaque)

{

    AcpiBuildState *build_state = build_opaque;

    AcpiBuildTables tables;

    /* No state to update or already patched? Nothing to do. */

    if (!build_state || build_state->patched) {

        return;

    }

    build_state->patched = 1;

    acpi_build_tables_init(&tables);

    acpi_build(&tables, MACHINE(qdev_get_machine()));

    acpi_ram_update(build_state->table_mr, tables.table_data);

    if (build_state->rsdp) {

        memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp));

    } else {

        acpi_ram_update(build_state->rsdp_mr, tables.rsdp);

    }

    acpi_ram_update(build_state->linker_mr, tables.linker);

    acpi_build_tables_cleanup(&tables, true);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int flashsv2_prime(FlashSVContext *s, uint8_t *src,
+
+                          int size, int unp_size)
+
+{
+
     z_stream zs;

     int zret; // Zlib return code

static int flashsv2_prime(FlashSVContext *s, uint8_t *src,

                          int size, int unp_size)

{

    z_stream zs;

    int zret; // Zlib return code

    zs.zalloc = NULL;

    zs.zfree  = NULL;

    zs.opaque = NULL;

    s->zstream.next_in   = src;

    s->zstream.avail_in  = size;

    s->zstream.next_out  = s->tmpblock;

    s->zstream.avail_out = s->block_size * 3;

    inflate(&s->zstream, Z_SYNC_FLUSH);

    deflateInit(&zs, 0);

    zs.next_in   = s->tmpblock;

    zs.avail_in  = s->block_size * 3 - s->zstream.avail_out;

    zs.next_out  = s->deflate_block;

    zs.avail_out = s->deflate_block_size;

    deflate(&zs, Z_SYNC_FLUSH);

    deflateEnd(&zs);

    if ((zret = inflateReset(&s->zstream)) != Z_OK) {

        av_log(s->avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);

        return AVERROR_UNKNOWN;

    }

    s->zstream.next_in   = s->deflate_block;

    s->zstream.avail_in  = s->deflate_block_size - zs.avail_out;

    s->zstream.next_out  = s->tmpblock;

    s->zstream.avail_out = s->block_size * 3;

    inflate(&s->zstream, Z_SYNC_FLUSH);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void jpeg_init_destination(j_compress_ptr cinfo)
+
+{

     VncState *vs = cinfo->client_data;

static void jpeg_init_destination(j_compress_ptr cinfo)

{

    VncState *vs = cinfo->client_data;

    Buffer *buffer = &vs->tight_jpeg;

    cinfo->dest->next_output_byte = (JOCTET *)buffer->buffer + buffer->offset;

    cinfo->dest->free_in_buffer = (size_t)(buffer->capacity - buffer->offset);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void vapic_map_rom_writable(VAPICROMState *s)

 {

static void vapic_map_rom_writable(VAPICROMState *s)

{

    hwaddr rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK;

    MemoryRegionSection section;

    MemoryRegion *as;

    size_t rom_size;

    uint8_t *ram;

    as = sysbus_address_space(&s->busdev);

    if (s->rom_mapped_writable) {

        memory_region_del_subregion(as, &s->rom);

        memory_region_destroy(&s->rom);

    }

    /* grab RAM memory region (region @rom_paddr may still be pc.rom) */

    section = memory_region_find(as, 0, 1);

    /* read ROM size from RAM region */

    ram = memory_region_get_ram_ptr(section.mr);

    rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;

    s->rom_size = rom_size;

    /* We need to round to avoid creating subpages

     * from which we cannot run code. */

    rom_size += rom_paddr & ~TARGET_PAGE_MASK;

    rom_paddr &= TARGET_PAGE_MASK;

    rom_size = TARGET_PAGE_ALIGN(rom_size);

    memory_region_init_alias(&s->rom, OBJECT(s), "kvmvapic-rom", section.mr,

                             rom_paddr, rom_size);

    memory_region_add_subregion_overlap(as, rom_paddr, &s->rom, 1000);

    s->rom_mapped_writable = true;

    memory_region_unref(section.mr);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int is_cpuid_supported(void)

+{

     return 1;

static int is_cpuid_supported(void)

{

    return 1;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd,

                                 uint64_t offset, QEMUIOVector *qiov, int type)
+
+{
+
+    int ret;
+
     struct qemu_laiocb laiocb = {

         .co         = qemu_coroutine_self(),

int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd,

                                uint64_t offset, QEMUIOVector *qiov, int type)

{

    int ret;

    struct qemu_laiocb laiocb = {

        .co         = qemu_coroutine_self(),

        .nbytes     = qiov->size,

        .ctx        = s,

        .is_read    = (type == QEMU_AIO_READ),

        .qiov       = qiov,

    };

    ret = laio_do_submit(fd, &laiocb, offset, type);

    if (ret < 0) {

        return ret;

    }

    qemu_coroutine_yield();

    return laiocb.ret;

}


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

         error_setg_errno(errp, -ret,

+                         "Cannot allocate cluster for LUKS header size %zu",
+
+                         headerlen);
+
+        return -1;

     }

static ssize_t qcow2_crypto_hdr_init_func(QCryptoBlock *block, size_t headerlen,

                                          void *opaque, Error **errp)

{

    BlockDriverState *bs = opaque;

    BDRVQcow2State *s = bs->opaque;

    int64_t ret;

    int64_t clusterlen;

    ret = qcow2_alloc_clusters(bs, headerlen);

    if (ret < 0) {

        error_setg_errno(errp, -ret,

                         "Cannot allocate cluster for LUKS header size %zu",

                         headerlen);

        return -1;

    }

    s->crypto_header.length = headerlen;

    s->crypto_header.offset = ret;

    /* Zero fill remaining space in cluster so it has predictable

     * content in case of future spec changes */

    clusterlen = size_to_clusters(s, headerlen) * s->cluster_size;

    ret = bdrv_pwrite_zeroes(bs->file,

                             ret + headerlen,

                             clusterlen - headerlen, 0);

    if (ret < 0) {

        error_setg_errno(errp, -ret, "Could not zero fill encryption header");

        return -1;

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void qemu_sem_wait(QemuSemaphore *sem)

+{
+
+#if defined(__APPLE__) || defined(__NetBSD__)

     pthread_mutex_lock(&sem->lock);
+
     --sem->count;

     while (sem->count < 0) {

void qemu_sem_wait(QemuSemaphore *sem)

{

#if defined(__APPLE__) || defined(__NetBSD__)

    pthread_mutex_lock(&sem->lock);

    --sem->count;

    while (sem->count < 0) {

        pthread_cond_wait(&sem->cond, &sem->lock);

    }

    pthread_mutex_unlock(&sem->lock);

#else

    int rc;

    do {

        rc = sem_wait(&sem->sem);

    } while (rc == -1 && errno == EINTR);

    if (rc < 0) {

        error_exit(errno, __func__);

    }

#endif

}


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

+
     s->dev.speed = USB_SPEED_FULL;

     scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete);

static int usb_msd_initfn(USBDevice *dev)

{

    MSDState *s = DO_UPCAST(MSDState, dev, dev);

    if (!s->conf.dinfo || !s->conf.dinfo->bdrv) {

        error_report("usb-msd: drive property not set");

    s->dev.speed = USB_SPEED_FULL;

    scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete);

    s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, s->conf.dinfo, 0);

    s->bus.qbus.allow_hotplug = 0;

    usb_msd_handle_reset(dev);

    if (bdrv_key_required(s->conf.dinfo->bdrv)) {

        if (cur_mon) {

            monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv,

                                        usb_msd_password_cb, s);

            s->dev.auto_attach = 0;

        } else {

            autostart = 0;

    return 0;


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                              socklen_t *addr_len, const char *localaddr)

 {
+
     int udp_fd = -1;

     struct addrinfo *res0 = NULL, *res = NULL;

static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,

                             socklen_t *addr_len, const char *localaddr)

{

    int udp_fd = -1;

    struct addrinfo *res0 = NULL, *res = NULL;

    int family = AF_UNSPEC;

    if (((struct sockaddr *) &s->dest_addr)->sa_family)

        family = ((struct sockaddr *) &s->dest_addr)->sa_family;

    res0 = udp_resolve_host(localaddr[0] ? localaddr : NULL, s->local_port,

                            SOCK_DGRAM, family, AI_PASSIVE);

    if (res0 == 0)

        goto fail;

    for (res = res0; res; res=res->ai_next) {

        udp_fd = ff_socket(res->ai_family, SOCK_DGRAM, 0);

        if (udp_fd != -1) break;

        log_net_error(NULL, AV_LOG_ERROR, "socket");

    }

    if (udp_fd < 0)

        goto fail;

    memcpy(addr, res->ai_addr, res->ai_addrlen);

    *addr_len = res->ai_addrlen;

    freeaddrinfo(res0);

    return udp_fd;

 fail:

    if (udp_fd >= 0)

        closesocket(udp_fd);

    if(res0)

        freeaddrinfo(res0);

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -5,10 +5,10 @@
     int i;

+
+    for (i = 0; i < NB_BOOTP_CLIENTS; i++) {
+
+        slirp->bootp_clients[i].allocated = qemu_get_be16(f);

         qemu_get_buffer(f, slirp->bootp_clients[i].macaddr, 6);

static void slirp_bootp_load(QEMUFile *f, Slirp *slirp)

{

    int i;

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

        slirp->bootp_clients[i].allocated = qemu_get_be16(f);

        qemu_get_buffer(f, slirp->bootp_clients[i].macaddr, 6);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb)

 {
+
+    int ret;
+
+    int64_t wait_start = 0;
+

     while (1) {

int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb)

{

    int ret;

    int64_t wait_start = 0;

    while (1) {

        ret = ff_network_wait_fd(fd, write);

        if (ret != AVERROR(EAGAIN))

            return ret;

        if (ff_check_interrupt(int_cb))

            return AVERROR_EXIT;

        if (timeout > 0) {

            if (!wait_start)

                wait_start = av_gettime();

            else if (av_gettime() - wait_start > timeout)

                return AVERROR(ETIMEDOUT);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 int kvm_has_sync_mmu(void)
+
+{
+
+#ifdef KVM_CAP_SYNC_MMU

     KVMState *s = kvm_state;

int kvm_has_sync_mmu(void)

{

#ifdef KVM_CAP_SYNC_MMU

    KVMState *s = kvm_state;

    return kvm_check_extension(s, KVM_CAP_SYNC_MMU);

#else

    return 0;

#endif

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
         term_printf("device not found\n");

         return;
+
+    }
+
+    if (fmt) {
+
         drv = bdrv_find_format(fmt);

         if (!drv) {

static void do_change_block(const char *device, const char *filename, const char *fmt)

{

    BlockDriverState *bs;

    BlockDriver *drv = NULL;

    bs = bdrv_find(device);

    if (!bs) {

        term_printf("device not found\n");

        return;

    }

    if (fmt) {

        drv = bdrv_find_format(fmt);

        if (!drv) {

            term_printf("invalid format %s\n", fmt);

            return;

        }

    }

    if (eject_device(bs, 0) < 0)

        return;

    bdrv_open2(bs, filename, 0, drv);

    qemu_key_check(bs, filename);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void update_cursor_data_virgl(VirtIOGPU *g,

                                      struct virtio_gpu_scanout *s,
+
+                                     uint32_t resource_id)
+
+{
+
     uint32_t width, height;

     uint32_t pixels, *data;

static void update_cursor_data_virgl(VirtIOGPU *g,

                                     struct virtio_gpu_scanout *s,

                                     uint32_t resource_id)

{

    uint32_t width, height;

    uint32_t pixels, *data;

    data = virgl_renderer_get_cursor_data(resource_id, &width, &height);

    if (!data) {

        return;

    }

    if (width != s->current_cursor->width ||

        height != s->current_cursor->height) {

        return;

    }

    pixels = s->current_cursor->width * s->current_cursor->height;

    memcpy(s->current_cursor->data, data, pixels * sizeof(uint32_t));

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void http_log(char *fmt, ...)

 {
+
     va_list ap;

     va_start(ap, fmt);

static void http_log(char *fmt, ...)

{

    va_list ap;

    va_start(ap, fmt);

    if (logfile)

        vfprintf(logfile, fmt, ap);

    va_end(ap);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int opus_decode_packet(AVCodecContext *avctx, void *data,
                               int *got_frame_ptr, AVPacket *avpkt)
 {
+    OpusContext *c      = avctx->priv_data;
+    AVFrame *frame      = data;
+    const uint8_t *buf  = avpkt->data;
+    int buf_size        = avpkt->size;
+    int coded_samples   = 0;
     int decoded_samples = 0;
     int i, ret;
     /* decode the header of the first sub-packet to find out the sample count */

static int opus_decode_packet(AVCodecContext *avctx, void *data,
                              int *got_frame_ptr, AVPacket *avpkt)
{
    OpusContext *c      = avctx->priv_data;
    AVFrame *frame      = data;
    const uint8_t *buf  = avpkt->data;
    int buf_size        = avpkt->size;
    int coded_samples   = 0;
    int decoded_samples = 0;
    int i, ret;
    /* decode the header of the first sub-packet to find out the sample count */
    if (buf) {
        OpusPacket *pkt = &c->streams[0].packet;
        ret = ff_opus_parse_packet(pkt, buf, buf_size, c->nb_streams > 1);
        if (ret < 0) {
            av_log(avctx, AV_LOG_ERROR, "Error parsing the packet header.\n");
            return ret;
        coded_samples += pkt->frame_count * pkt->frame_duration;
        c->streams[0].silk_samplerate = get_silk_samplerate(pkt->config);
    frame->nb_samples = coded_samples + c->streams[0].delayed_samples;
    /* no input or buffered data => nothing to do */
    if (!frame->nb_samples) {
        *got_frame_ptr = 0;
        return 0;
    /* setup the data buffers */
    ret = ff_get_buffer(avctx, frame, 0);
    if (ret < 0) {
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
        return ret;
    frame->nb_samples = 0;
    for (i = 0; i < avctx->channels; i++) {
        ChannelMap *map = &c->channel_maps[i];
        if (!map->copy)
            c->streams[map->stream_idx].out[map->channel_idx] = (float*)frame->extended_data[i];
    for (i = 0; i < c->nb_streams; i++)
        c->streams[i].out_size = frame->linesize[0];
    /* decode each sub-packet */
    for (i = 0; i < c->nb_streams; i++) {
        OpusStreamContext *s = &c->streams[i];
        if (i && buf) {
            ret = ff_opus_parse_packet(&s->packet, buf, buf_size, i != c->nb_streams - 1);
            if (ret < 0) {
                av_log(avctx, AV_LOG_ERROR, "Error parsing the packet header.\n");
                return ret;
            s->silk_samplerate = get_silk_samplerate(s->packet.config);
        ret = opus_decode_subpacket(&c->streams[i], buf,
                                    s->packet.data_size, coded_samples);
        if (ret < 0)
            return ret;
        if (decoded_samples && ret != decoded_samples) {
            av_log(avctx, AV_LOG_ERROR, "Different numbers of decoded samples "
                   "in a multi-channel stream\n");
        decoded_samples = ret;
        buf      += s->packet.packet_size;
        buf_size -= s->packet.packet_size;
    for (i = 0; i < avctx->channels; i++) {
        ChannelMap *map = &c->channel_maps[i];
        /* handle copied channels */
        if (map->copy) {
            memcpy(frame->extended_data[i],
                   frame->extended_data[map->copy_idx],
                   frame->linesize[0]);
        } else if (map->silence) {
            memset(frame->extended_data[i], 0, frame->linesize[0]);
        if (c->gain_i) {
            c->fdsp.vector_fmul_scalar((float*)frame->extended_data[i],
                                       (float*)frame->extended_data[i],
                                       c->gain, FFALIGN(decoded_samples, 8));
    frame->nb_samples = decoded_samples;
    *got_frame_ptr    = !!decoded_samples;
    return avpkt->size;


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

     bool iops_flag;

+
+
+    assert(io_limits);
+
+

     bps_flag  = (io_limits->bps[BLOCK_IO_LIMIT_TOTAL] != 0)

static bool do_check_io_limits(BlockIOLimit *io_limits)

{

    bool bps_flag;

    bool iops_flag;

    assert(io_limits);

    bps_flag  = (io_limits->bps[BLOCK_IO_LIMIT_TOTAL] != 0)

                 && ((io_limits->bps[BLOCK_IO_LIMIT_READ] != 0)

                 || (io_limits->bps[BLOCK_IO_LIMIT_WRITE] != 0));

    iops_flag = (io_limits->iops[BLOCK_IO_LIMIT_TOTAL] != 0)

                 && ((io_limits->iops[BLOCK_IO_LIMIT_READ] != 0)

                 || (io_limits->iops[BLOCK_IO_LIMIT_WRITE] != 0));

    if (bps_flag || iops_flag) {

        return false;

    }

    return true;

}


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

 {

+    int64_t pos = avio_tell(pb);

     avio_wb32(pb, 0); /* size */

static int mov_write_mdia_tag(AVIOContext *pb, MOVMuxContext *mov,

                              MOVTrack *track)

{

    int64_t pos = avio_tell(pb);

    avio_wb32(pb, 0); /* size */

    ffio_wfourcc(pb, "mdia");

    mov_write_mdhd_tag(pb, mov, track);

    mov_write_hdlr_tag(pb, track);

    mov_write_minf_tag(pb, track);

    return update_size(pb, pos);

}


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

 {

+    SaveState *state = opaque;

     const char *current_name = MACHINE_GET_CLASS(current_machine)->name;

static int configuration_post_load(void *opaque, int version_id)

{

    SaveState *state = opaque;

    const char *current_name = MACHINE_GET_CLASS(current_machine)->name;

    if (strncmp(state->name, current_name, state->len) != 0) {

        error_report("Machine type received is '%s' and local is '%s'",

                     state->name, current_name);

        return -EINVAL;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void mkv_write_simpletag(AVIOContext *pb, AVDictionaryEntry *t)

 {
+
+    uint8_t *key = av_strdup(t->key);
+
+    uint8_t *p   = key;
+
     const uint8_t *lang = NULL;

     ebml_master tag;

static void mkv_write_simpletag(AVIOContext *pb, AVDictionaryEntry *t)

{

    uint8_t *key = av_strdup(t->key);

    uint8_t *p   = key;

    const uint8_t *lang = NULL;

    ebml_master tag;

    if ((p = strrchr(p, '-')) &&

        (lang = av_convert_lang_to(p + 1, AV_LANG_ISO639_2_BIBL)))

        *p = 0;

    p = key;

    while (*p) {

        if (*p == ' ')

            *p = '_';

        else if (*p >= 'a' && *p <= 'z')

            *p -= 'a' - 'A';

        p++;

    }

    tag = start_ebml_master(pb, MATROSKA_ID_SIMPLETAG, 0);

    put_ebml_string(pb, MATROSKA_ID_TAGNAME, key);

    if (lang)

        put_ebml_string(pb, MATROSKA_ID_TAGLANG, lang);

    put_ebml_string(pb, MATROSKA_ID_TAGSTRING, t->value);

    end_ebml_master(pb, tag);

    av_freep(&key);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void qmp_output_type_bool(Visitor *v, const char *name, bool *obj,

+                                 Error **errp)
+
 {

     QmpOutputVisitor *qov = to_qov(v);

static void qmp_output_type_bool(Visitor *v, const char *name, bool *obj,

                                 Error **errp)

{

    QmpOutputVisitor *qov = to_qov(v);

    qmp_output_add(qov, name, qbool_from_bool(*obj));

}


PPC_OP(cmpi)

{

    if (Ts0 < SPARAM(1)) {

        T0 = 0x08;

    } else if (Ts0 > SPARAM(1)) {

        T0 = 0x04;

    } else {

        T0 = 0x02;

    }

    RETURN();

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 int ff_j2k_dwt_init(DWTContext *s, uint16_t border[2][2], int decomp_levels, int type)

+{

     int i, j, lev = decomp_levels, maxlen,

int ff_j2k_dwt_init(DWTContext *s, uint16_t border[2][2], int decomp_levels, int type)

{

    int i, j, lev = decomp_levels, maxlen,

        b[2][2];

    if (decomp_levels >= FF_DWT_MAX_DECLVLS)

        return AVERROR_INVALIDDATA;

    s->ndeclevels = decomp_levels;

    s->type = type;

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

        for(j = 0; j < 2; j++)

            b[i][j] = border[i][j];

    maxlen = FFMAX(b[0][1] - b[0][0],

                   b[1][1] - b[1][0]);

    while(--lev >= 0){

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

            s->linelen[lev][i] = b[i][1] - b[i][0];

            s->mod[lev][i] = b[i][0] & 1;

            for (j = 0; j < 2; j++)

                b[i][j] = (b[i][j] + 1) >> 1;

        }

    }

    if (type == FF_DWT97)

        s->linebuf = av_malloc((maxlen + 12) * sizeof(float));

    else if (type == FF_DWT53)

        s->linebuf = av_malloc((maxlen + 6) * sizeof(int));

    else

        return -1;

    if (!s->linebuf)

        return AVERROR(ENOMEM);

    return 0;

}


static int bochs_read(BlockDriverState *bs, int64_t sector_num,

                    uint8_t *buf, int nb_sectors)

{

    int ret;

    while (nb_sectors > 0) {

        int64_t block_offset = seek_to_sector(bs, sector_num);

        if (block_offset >= 0) {

            ret = bdrv_pread(bs->file, block_offset, buf, 512);

            if (ret != 512) {

                return -1;

            }

        } else

            memset(buf, 0, 512);

        nb_sectors--;

        sector_num++;

        buf += 512;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void dump_syscall(CPUState *env)
+
 {

     fprintf(logfile, "syscall r0=0x%08x r3=0x%08x r4=0x%08x "

static void dump_syscall(CPUState *env)

{

    fprintf(logfile, "syscall r0=0x%08x r3=0x%08x r4=0x%08x "

            "r5=0x%08x r6=0x%08x nip=0x%08x\n",

            env->gpr[0], env->gpr[3], env->gpr[4],

            env->gpr[5], env->gpr[6], env->nip);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 int v9fs_co_mkdir(V9fsState *s, char *name, mode_t mode, uid_t uid, gid_t gid)

+{
+
+    int err;
+
+    FsCred cred;

int v9fs_co_mkdir(V9fsState *s, char *name, mode_t mode, uid_t uid, gid_t gid)

{

    int err;

    FsCred cred;

    cred_init(&cred);

    cred.fc_mode = mode;

    cred.fc_uid = uid;

    cred.fc_gid = gid;

    v9fs_co_run_in_worker(

        {

            err = s->ops->mkdir(&s->ctx, name, &cred);

            if (err < 0) {

                err = -errno;

            }

        });

    return err;

}


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

     }
+
     if (data_dir_idx == ARRAY_SIZE(data_dir)) {

         return;

static void qemu_add_data_dir(const char *path)

{

    int i;

    if (path == NULL) {

        return;

    }

    if (data_dir_idx == ARRAY_SIZE(data_dir)) {

        return;

    }

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

        if (strcmp(data_dir[i], path) == 0) {

            return; /* duplicate */

        }

    }

    data_dir[data_dir_idx++] = path;

}


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

         trace_cs4231_mem_readl_reg(saddr, ret);

+        break;
+
+    }
+
+    return ret;

 }

static uint64_t cs_mem_read(void *opaque, target_phys_addr_t addr,

                            unsigned size)

{

    CSState *s = opaque;

    uint32_t saddr, ret;

    saddr = addr >> 2;

    switch (saddr) {

    case 1:

        switch (CS_RAP(s)) {

        case 3: // Write only

            ret = 0;

            break;

        default:

            ret = s->dregs[CS_RAP(s)];

            break;

        }

        trace_cs4231_mem_readl_dreg(CS_RAP(s), ret);

        break;

    default:

        ret = s->regs[saddr];

        trace_cs4231_mem_readl_reg(saddr, ret);

        break;

    }

    return ret;

}


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

+    if (s->identify_set) {
+
+        blk_set_enable_write_cache(s->blk, !!(s->identify_data[85] & (1 << 5)));
+
     }

     return 0;

static int ide_drive_post_load(void *opaque, int version_id)

{

    IDEState *s = opaque;

    if (s->identify_set) {

        blk_set_enable_write_cache(s->blk, !!(s->identify_data[85] & (1 << 5)));

    }

    return 0;

}


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

     if (IS_USER(s)) {
+
         gen_exception(s, s->pc - 2, EXCP_PRIVILEGE);

         return;

DISAS_INSN(wdebug)

{

    if (IS_USER(s)) {

        gen_exception(s, s->pc - 2, EXCP_PRIVILEGE);

        return;

    }

    /* TODO: Implement wdebug.  */

    qemu_assert(0, "WDEBUG not implemented");

}


--- a/source.c
+++ b/source.c
@@ -1,17 +1,17 @@
+static int virtio_pci_stop_ioeventfd(VirtIOPCIProxy *proxy)

 {
+
     int n;

     if (!proxy->ioeventfd_started) {

+        return 0;

     }
+

     for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) {

static int virtio_pci_stop_ioeventfd(VirtIOPCIProxy *proxy)

{

    int n;

    if (!proxy->ioeventfd_started) {

        return 0;

    }

    for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) {

        if (!virtio_queue_get_num(proxy->vdev, n)) {

            continue;

        }

        virtio_pci_set_host_notifier_fd_handler(proxy, n, false);

        virtio_pci_set_host_notifier_internal(proxy, n, false);

    }

    proxy->ioeventfd_started = false;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
                          strerror(-ret));

             exit(1);
+
+        } else {
+
+            DPRINTF("Enabled KVM_CAP_SPLIT_IRQCHIP\n");
+
             kvm_split_irqchip = true;

             return 1;

int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)

{

    int ret;

    if (machine_kernel_irqchip_split(ms)) {

        ret = kvm_vm_enable_cap(s, KVM_CAP_SPLIT_IRQCHIP, 0, 24);

        if (ret) {

            error_report("Could not enable split irqchip mode: %s\n",

                         strerror(-ret));

            exit(1);

        } else {

            DPRINTF("Enabled KVM_CAP_SPLIT_IRQCHIP\n");

            kvm_split_irqchip = true;

            return 1;

        }

    } else {

        return 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -9,10 +9,10 @@
     if (inited != 0)

         return;
+
+    inited = 1;
+
+

     dsputil_static_init();

void avcodec_init(void)

{

    static int inited = 0;

    if (inited != 0)

        return;

    inited = 1;

    dsputil_static_init();

}


--- a/source.c
+++ b/source.c
@@ -51,11 +51,11 @@
             monitor_printf(mon, "Start migration for %s with shared base "

                                 "image\n",
+
+                           bs->device_name);
+
+        } else {
+
             monitor_printf(mon, "Start full migration for %s\n",

                            bs->device_name);

static void init_blk_migration_it(void *opaque, BlockDriverState *bs)

{

    Monitor *mon = opaque;

    BlkMigDevState *bmds;

    int64_t sectors;

    if (!bdrv_is_read_only(bs)) {

        sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;

        if (sectors <= 0) {

            return;

        }

        bmds = g_malloc0(sizeof(BlkMigDevState));

        bmds->bs = bs;

        bmds->bulk_completed = 0;

        bmds->total_sectors = sectors;

        bmds->completed_sectors = 0;

        bmds->shared_base = block_mig_state.shared_base;

        alloc_aio_bitmap(bmds);

        drive_get_ref(drive_get_by_blockdev(bs));

        bdrv_set_in_use(bs, 1);

        block_mig_state.total_sector_sum += sectors;

        if (bmds->shared_base) {

            monitor_printf(mon, "Start migration for %s with shared base "

                                "image\n",

                           bs->device_name);

        } else {

            monitor_printf(mon, "Start full migration for %s\n",

                           bs->device_name);

        }

        QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
+
 {

 	unsigned i;

void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)

{

	unsigned i;

/*

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

		((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ];

*/

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

	{

		#ifdef WORDS_BIGENDIAN

		dst[3]= palette[ src[i]*4+2 ];

		dst[2]= palette[ src[i]*4+1 ];

		dst[1]= palette[ src[i]*4+0 ];

		#else

		//FIXME slow?

		dst[0]= palette[ src[i]*4+2 ];

		dst[1]= palette[ src[i]*4+1 ];

		dst[2]= palette[ src[i]*4+0 ];

//		dst[3]= 0; /* do we need this cleansing? */

		#endif

		dst+= 4;

	}

}


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

     UINT8 header[FRAME_HEADER_SIZE];

+    int duration;

static int ffm_write_packet(AVFormatContext *s, int stream_index,

                            UINT8 *buf, int size, int force_pts)

{

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

    FFMStream *fst = st->priv_data;

    INT64 pts;

    UINT8 header[FRAME_HEADER_SIZE];

    int duration;

    if (st->codec.codec_type == CODEC_TYPE_AUDIO) {

        duration = ((float)st->codec.frame_size / st->codec.sample_rate * 1000000.0);

    } else {

        duration = (1000000.0 * FRAME_RATE_BASE / (float)st->codec.frame_rate);

    }

    pts = fst->pts;

    /* packet size & key_frame */

    header[0] = stream_index;

    header[1] = 0;

    if (st->codec.coded_picture->key_frame)

        header[1] |= FLAG_KEY_FRAME;

    header[2] = (size >> 16) & 0xff;

    header[3] = (size >> 8) & 0xff;

    header[4] = size & 0xff;

    header[5] = (duration >> 16) & 0xff;

    header[6] = (duration >> 8) & 0xff;

    header[7] = duration & 0xff;

    ffm_write_data(s, header, FRAME_HEADER_SIZE, pts, 1);

    ffm_write_data(s, buf, size, pts, 0);

    fst->pts += duration;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     struct SheepdogInode *inode = &s->inode;

     uint64_t object_size;
+
+    int obj_order;
+
+
+
     object_size = qemu_opt_get_size_del(opt, BLOCK_OPT_OBJECT_SIZE, 0);

     if (object_size) {

static int parse_block_size_shift(BDRVSheepdogState *s, QemuOpts *opt)

{

    struct SheepdogInode *inode = &s->inode;

    uint64_t object_size;

    int obj_order;

    object_size = qemu_opt_get_size_del(opt, BLOCK_OPT_OBJECT_SIZE, 0);

    if (object_size) {

        if ((object_size - 1) & object_size) {    /* not a power of 2? */

            return -EINVAL;

        }

        obj_order = ffs(object_size) - 1;

        if (obj_order < 20 || obj_order > 31) {

            return -EINVAL;

        }

        inode->block_size_shift = (uint8_t)obj_order;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void av_register_input_format(AVInputFormat *format)

 {
+
+    AVInputFormat **p = &first_iformat;
+
+

     while (*p != NULL)

void av_register_input_format(AVInputFormat *format)

{

    AVInputFormat **p = &first_iformat;

    while (*p != NULL)

        p = &(*p)->next;

    *p = format;

    format->next = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void g_free(void *mem)
+
 {

     free(mem);

void g_free(void *mem)

{

    free(mem);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void bonito_ldma_writel(void *opaque, target_phys_addr_t addr,
+
+                               uint64_t val, unsigned size)
+
 {

     PCIBonitoState *s = opaque;

static void bonito_ldma_writel(void *opaque, target_phys_addr_t addr,

                               uint64_t val, unsigned size)

{

    PCIBonitoState *s = opaque;

    ((uint32_t *)(&s->bonldma))[addr/sizeof(uint32_t)] = val & 0xffffffff;

}


--- a/source.c
+++ b/source.c
@@ -43,11 +43,11 @@
                     (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);

     acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE),
+
+                      guest_info->use_highmem);
+
+    acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO],
+
                        (irqmap[VIRT_GPIO] + ARM_SPI_BASE));

     acpi_dsdt_add_power_button(scope);

build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)

{

    Aml *scope, *dsdt;

    const MemMapEntry *memmap = guest_info->memmap;

    const int *irqmap = guest_info->irqmap;

    dsdt = init_aml_allocator();

    /* Reserve space for header */

    acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader));

    /* When booting the VM with UEFI, UEFI takes ownership of the RTC hardware.

     * While UEFI can use libfdt to disable the RTC device node in the DTB that

     * it passes to the OS, it cannot modify AML. Therefore, we won't generate

     * the RTC ACPI device at all when using UEFI.

     */

    scope = aml_scope("\\_SB");

    acpi_dsdt_add_cpus(scope, guest_info->smp_cpus);

    acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],

                       (irqmap[VIRT_UART] + ARM_SPI_BASE));

    acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);

    acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO],

                    (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);

    acpi_dsdt_add_pci(scope, memmap, (irqmap[VIRT_PCIE] + ARM_SPI_BASE),

                      guest_info->use_highmem);

    acpi_dsdt_add_gpio(scope, &memmap[VIRT_GPIO],

                       (irqmap[VIRT_GPIO] + ARM_SPI_BASE));

    acpi_dsdt_add_power_button(scope);

    aml_append(dsdt, scope);

    /* copy AML table into ACPI tables blob and patch header there */

    g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);

    build_header(linker, table_data,

        (void *)(table_data->data + table_data->len - dsdt->buf->len),

        "DSDT", dsdt->buf->len, 2, NULL);

    free_aml_allocator();

}


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

 {

+    /* Allocate buffer for zero writes */

     if (acb->flags & QED_AIOCB_ZERO) {

static void qed_aio_write_inplace(QEDAIOCB *acb, uint64_t offset, size_t len)

{

    /* Allocate buffer for zero writes */

    if (acb->flags & QED_AIOCB_ZERO) {

        struct iovec *iov = acb->qiov->iov;

        if (!iov->iov_base) {

            iov->iov_base = qemu_blockalign(acb->common.bs, iov->iov_len);

            memset(iov->iov_base, 0, iov->iov_len);

        }

    }

    /* Calculate the I/O vector */

    acb->cur_cluster = offset;

    qemu_iovec_concat(&acb->cur_qiov, acb->qiov, acb->qiov_offset, len);

    /* Do the actual write */

    qed_aio_write_main(acb, 0);

}


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

         .misc = (MCM_ADDR_PHYS << 6) | 0xc,
+
+    };
+
+    int r;
+

     r = kvm_set_mce(env, &mce);

static void kvm_mce_inj_srar_dataload(CPUState *env, target_phys_addr_t paddr)

{

    struct kvm_x86_mce mce = {

        .bank = 9,

        .status = MCI_STATUS_VAL | MCI_STATUS_UC | MCI_STATUS_EN

                  | MCI_STATUS_MISCV | MCI_STATUS_ADDRV | MCI_STATUS_S

                  | MCI_STATUS_AR | 0x134,

        .mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV,

        .addr = paddr,

        .misc = (MCM_ADDR_PHYS << 6) | 0xc,

    };

    int r;

    r = kvm_set_mce(env, &mce);

    if (r < 0) {

        fprintf(stderr, "kvm_set_mce: %s\n", strerror(errno));

        abort();

    }

    kvm_mce_broadcast_rest(env);

}


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

         delay_ns = limit->next_slice_time - now;

+    } else {
+
+        limit->dispatched += n;
+
+    }

     return delay_ns;

static int64_t ratelimit_calculate_delay(RateLimit *limit, uint64_t n)

{

    int64_t delay_ns = 0;

    int64_t now = qemu_get_clock_ns(rt_clock);

    if (limit->next_slice_time < now) {

        limit->next_slice_time = now + SLICE_TIME;

        limit->dispatched = 0;

    }

    if (limit->dispatched + n > limit->slice_quota) {

        delay_ns = limit->next_slice_time - now;

    } else {

        limit->dispatched += n;

    }

    return delay_ns;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void virtio_pci_device_unplugged(DeviceState *d)
+
 {

+    PCIDevice *pci_dev = PCI_DEVICE(d);

     VirtIOPCIProxy *proxy = VIRTIO_PCI(d);

static void virtio_pci_device_unplugged(DeviceState *d)

{

    PCIDevice *pci_dev = PCI_DEVICE(d);

    VirtIOPCIProxy *proxy = VIRTIO_PCI(d);

    virtio_pci_stop_ioeventfd(proxy);

    msix_uninit_exclusive_bar(pci_dev);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static long do_sigreturn_v2(CPUARMState *env)

+{
+
         abi_ulong frame_addr;

 	struct sigframe_v2 *frame;

static long do_sigreturn_v2(CPUARMState *env)

{

        abi_ulong frame_addr;

	struct sigframe_v2 *frame;

	/*

	 * Since we stacked the signal on a 64-bit boundary,

	 * then 'sp' should be word aligned here.  If it's

	 * not, then the user is trying to mess with us.

	 */

	if (env->regs[13] & 7)

		goto badframe;

        frame_addr = env->regs[13];

	if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1))

                goto badframe;

        if (do_sigframe_return_v2(env, frame_addr, &frame->uc))

                goto badframe;

	unlock_user_struct(frame, frame_addr, 0);

	return env->regs[0];

badframe:

	unlock_user_struct(frame, frame_addr, 0);

        force_sig(TARGET_SIGSEGV /* , current */);

	return 0;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     if (xenstore_read_fe_int(&c->xendev, "page-ref", &mfn) == -1)

 	return -1;
+
+    if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)
+
+	return -1;
+

     c->page = xc_map_foreign_range(xen_xc, c->xendev.dom,

static int common_bind(struct common *c)

{

    int mfn;

    if (xenstore_read_fe_int(&c->xendev, "page-ref", &mfn) == -1)

	return -1;

    if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)

	return -1;

    c->page = xc_map_foreign_range(xen_xc, c->xendev.dom,

				   XC_PAGE_SIZE,

				   PROT_READ | PROT_WRITE, mfn);

    if (c->page == NULL)

	return -1;

    xen_be_bind_evtchn(&c->xendev);

    xen_be_printf(&c->xendev, 1, "ring mfn %d, remote-port %d, local-port %d\n",

		  mfn, c->xendev.remote_port, c->xendev.local_port);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
     }

     if (s->match.addr > 127) {
+
+        error_setg(errp, "hostaddr out of range");
+
+        return;
+
     }

static void usb_host_realize(USBDevice *udev, Error **errp)

{

    USBHostDevice *s = USB_HOST_DEVICE(udev);

    if (s->match.vendor_id > 0xffff) {

        error_setg(errp, "vendorid out of range");

        return;

    }

    if (s->match.product_id > 0xffff) {

        error_setg(errp, "productid out of range");

        return;

    }

    if (s->match.addr > 127) {

        error_setg(errp, "hostaddr out of range");

        return;

    }

    loglevel = s->loglevel;

    udev->flags |= (1 << USB_DEV_FLAG_IS_HOST);

    udev->auto_attach = 0;

    QTAILQ_INIT(&s->requests);

    QTAILQ_INIT(&s->isorings);

    s->exit.notify = usb_host_exit_notifier;

    qemu_add_exit_notifier(&s->exit);

    QTAILQ_INSERT_TAIL(&hostdevs, s, next);

    usb_host_auto_check(NULL);

}


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

     job->paused = false;
+
+    block_job_iostatus_reset(job);
+
     if (job->co && !job->busy) {

         qemu_coroutine_enter(job->co, NULL);

void block_job_resume(BlockJob *job)

{

    job->paused = false;

    block_job_iostatus_reset(job);

    if (job->co && !job->busy) {

        qemu_coroutine_enter(job->co, NULL);

    }

}


static void raw_decode(uint8_t *dst, const int8_t *src, int src_size)

{

    while (src_size--)

        *dst++ = *src++ + 128;

}


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

     ISADevice *dev;

+    m48t59_t *s;

m48t59_t *m48t59_init_isa(uint32_t io_base, uint16_t size, int type)

{

    M48t59ISAState *d;

    ISADevice *dev;

    m48t59_t *s;

    dev = isa_create("m48t59_isa");

    qdev_prop_set_uint32(&dev->qdev, "type", type);

    qdev_prop_set_uint32(&dev->qdev, "size", size);

    qdev_prop_set_uint32(&dev->qdev, "io_base", io_base);

    qdev_init(&dev->qdev);

    d = DO_UPCAST(M48t59ISAState, busdev, dev);

    s = &d->state;

    if (io_base != 0) {

        register_ioport_read(io_base, 0x04, 1, NVRAM_readb, s);

        register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, s);

    }

    return s;

}


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

     if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON))

+        av_log(NULL, AV_LOG_ERROR, "vector_fmul_scalar failed\n");
+
+
+
+    return ret;

 }

static int test_vector_fmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,

                                   const float *v1, float scale)

{

    LOCAL_ALIGNED(32, float, cdst, [LEN]);

    LOCAL_ALIGNED(32, float, odst, [LEN]);

    int ret;

    cdsp->vector_fmul_scalar(cdst, v1, scale, LEN);

    fdsp->vector_fmul_scalar(odst, v1, scale, LEN);

    if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON))

        av_log(NULL, AV_LOG_ERROR, "vector_fmul_scalar failed\n");

    return ret;

}


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

     reset_temp(dst);
+
+    temps[dst].state = TCG_TEMP_CONST;
+
+    temps[dst].val = val;
+
     mask = val;

     if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_mov_i32) {

static void tcg_opt_gen_movi(TCGContext *s, TCGOp *op, TCGArg *args,

                             TCGArg dst, TCGArg val)

{

    TCGOpcode new_op = op_to_movi(op->opc);

    tcg_target_ulong mask;

    op->opc = new_op;

    reset_temp(dst);

    temps[dst].state = TCG_TEMP_CONST;

    temps[dst].val = val;

    mask = val;

    if (TCG_TARGET_REG_BITS > 32 && new_op == INDEX_op_mov_i32) {

        /* High bits of the destination are now garbage.  */

        mask |= ~0xffffffffull;

    }

    temps[dst].mask = mask;

    args[0] = dst;

    args[1] = val;

}


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

 {

+    char buf[4096];
+
+    va_list ap;
+
     va_start(ap, fmt);

     vsnprintf(buf, sizeof(buf), fmt, ap);

void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)

{

    char buf[4096];

    va_list ap;

    va_start(ap, fmt);

    vsnprintf(buf, sizeof(buf), fmt, ap);

    qemu_chr_write(s, (uint8_t *)buf, strlen(buf));

    va_end(ap);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void kvmclock_realize(DeviceState *dev, Error **errp)
 {
+    KVMClockState *s = KVM_CLOCK(dev);
     kvm_update_clock(s);
     qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);

static void kvmclock_realize(DeviceState *dev, Error **errp)
{
    KVMClockState *s = KVM_CLOCK(dev);
    kvm_update_clock(s);
    qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s);


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     PVSCSICmdDescSetupMsgRing *rc =

         (PVSCSICmdDescSetupMsgRing *) s->curr_cmd_data;
+

     trace_pvscsi_on_cmd_arrived("PVSCSI_CMD_SETUP_MSG_RING");

pvscsi_on_cmd_setup_msg_ring(PVSCSIState *s)

{

    PVSCSICmdDescSetupMsgRing *rc =

        (PVSCSICmdDescSetupMsgRing *) s->curr_cmd_data;

    trace_pvscsi_on_cmd_arrived("PVSCSI_CMD_SETUP_MSG_RING");

    if (!s->use_msg) {

        return PVSCSI_COMMAND_PROCESSING_FAILED;

    }

    if (s->rings_info_valid) {

        pvscsi_ring_init_msg(&s->rings, rc);

        s->msg_ring_info_valid = TRUE;

    }

    return sizeof(PVSCSICmdDescSetupMsgRing) / sizeof(uint32_t);

}


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

         env->CP0_VPEControl &= ~(0x7 << CP0VPECo_EXCPT);

+        env->CP0_VPEControl |= 2 << CP0VPECo_EXCPT;
+
+        helper_raise_exception(EXCP_THREAD);
+
+    }

     return env->CP0_YQMask;

target_ulong helper_yield(target_ulong arg1)

{

    if (arg1 < 0) {

        /* No scheduling policy implemented. */

        if (arg1 != -2) {

            if (env->CP0_VPEControl & (1 << CP0VPECo_YSI) &&

                env->active_tc.CP0_TCStatus & (1 << CP0TCSt_DT)) {

                env->CP0_VPEControl &= ~(0x7 << CP0VPECo_EXCPT);

                env->CP0_VPEControl |= 4 << CP0VPECo_EXCPT;

                helper_raise_exception(EXCP_THREAD);

            }

        }

    } else if (arg1 == 0) {

        if (0 /* TODO: TC underflow */) {

            env->CP0_VPEControl &= ~(0x7 << CP0VPECo_EXCPT);

            helper_raise_exception(EXCP_THREAD);

        } else {

            // TODO: Deallocate TC

        }

    } else if (arg1 > 0) {

        /* Yield qualifier inputs not implemented. */

        env->CP0_VPEControl &= ~(0x7 << CP0VPECo_EXCPT);

        env->CP0_VPEControl |= 2 << CP0VPECo_EXCPT;

        helper_raise_exception(EXCP_THREAD);

    }

    return env->CP0_YQMask;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void complete_request_vring(VirtIOBlockReq *req, unsigned char status)

+{

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

static void complete_request_vring(VirtIOBlockReq *req, unsigned char status)

{

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

    vring_push(&req->dev->dataplane->vring, req->elem,

               req->qiov.size + sizeof(*req->in));

    notify_guest(req->dev->dataplane);

}


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

     DeviceClass *dc = DEVICE_CLASS(klass);
+
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

    dc->desc        = "ISA bridge";

    dc->vmsd        = &vmstate_piix3;

    dc->no_user     = 1;

    k->no_hotplug   = 1;

    k->init         = piix3_initfn;

    k->config_write = piix3_write_config_xen;

    k->vendor_id    = PCI_VENDOR_ID_INTEL;

    /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */

    k->device_id    = PCI_DEVICE_ID_INTEL_82371SB_0;

    k->class_id     = PCI_CLASS_BRIDGE_ISA;

};


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void vtd_realize(DeviceState *dev, Error **errp)
+
+{

     PCMachineState *pcms = PC_MACHINE(qdev_get_machine());

static void vtd_realize(DeviceState *dev, Error **errp)

{

    PCMachineState *pcms = PC_MACHINE(qdev_get_machine());

    PCIBus *bus = pcms->bus;

    IntelIOMMUState *s = INTEL_IOMMU_DEVICE(dev);

    X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(dev);

    VTD_DPRINTF(GENERAL, "");

    x86_iommu->type = TYPE_INTEL;

    if (!vtd_decide_config(s, errp)) {

        return;

    }

    QLIST_INIT(&s->notifiers_list);

    memset(s->vtd_as_by_bus_num, 0, sizeof(s->vtd_as_by_bus_num));

    memory_region_init_io(&s->csrmem, OBJECT(s), &vtd_mem_ops, s,

                          "intel_iommu", DMAR_REG_SIZE);

    sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->csrmem);

    /* No corresponding destroy */

    s->iotlb = g_hash_table_new_full(vtd_uint64_hash, vtd_uint64_equal,

                                     g_free, g_free);

    s->vtd_as_by_busptr = g_hash_table_new_full(vtd_uint64_hash, vtd_uint64_equal,

                                              g_free, g_free);

    vtd_init(s);

    sysbus_mmio_map(SYS_BUS_DEVICE(s), 0, Q35_HOST_BRIDGE_IOMMU_ADDR);

    pci_setup_iommu(bus, vtd_host_dma_iommu, dev);

    /* Pseudo address space under root PCI bus. */

    pcms->ioapic_as = vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPIC);

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
                                        &rsdt->table_offset_entry[i],

                                        sizeof(uint32_t));
+
+    }
+
+    build_header(linker, table_data,
+
                  (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);

 }

build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,

           const char *oem_id, const char *oem_table_id)

{

    AcpiRsdtDescriptorRev1 *rsdt;

    size_t rsdt_len;

    int i;

    const int table_data_len = (sizeof(uint32_t) * table_offsets->len);

    rsdt_len = sizeof(*rsdt) + table_data_len;

    rsdt = acpi_data_push(table_data, rsdt_len);

    memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len);

    for (i = 0; i < table_offsets->len; ++i) {

        /* rsdt->table_offset_entry to be filled by Guest linker */

        bios_linker_loader_add_pointer(linker,

                                       ACPI_BUILD_TABLE_FILE,

                                       ACPI_BUILD_TABLE_FILE,

                                       &rsdt->table_offset_entry[i],

                                       sizeof(uint32_t));

    }

    build_header(linker, table_data,

                 (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);

}


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

     const struct ip *iph = (const struct ip *)ifm->m_data;

+    int ret;
+
+
+
+    if (ifm->m_len + ETH_HLEN > sizeof(buf)) {

         return 1;

int if_encap(Slirp *slirp, struct mbuf *ifm)

{

    uint8_t buf[1600];

    struct ethhdr *eh = (struct ethhdr *)buf;

    uint8_t ethaddr[ETH_ALEN];

    const struct ip *iph = (const struct ip *)ifm->m_data;

    int ret;

    if (ifm->m_len + ETH_HLEN > sizeof(buf)) {

        return 1;

    }

    switch (iph->ip_v) {

    case IPVERSION:

        ret = if_encap4(slirp, ifm, eh, ethaddr);

        if (ret < 2) {

            return ret;

        }

        break;

    default:

        /* Do not assert while we don't manage IP6VERSION */

        /* assert(0); */

        break;

    }

    memcpy(eh->h_dest, ethaddr, ETH_ALEN);

    DEBUG_ARGS((dfd, " src = %02x:%02x:%02x:%02x:%02x:%02x\n",

                eh->h_source[0], eh->h_source[1], eh->h_source[2],

                eh->h_source[3], eh->h_source[4], eh->h_source[5]));

    DEBUG_ARGS((dfd, " dst = %02x:%02x:%02x:%02x:%02x:%02x\n",

                eh->h_dest[0], eh->h_dest[1], eh->h_dest[2],

                eh->h_dest[3], eh->h_dest[4], eh->h_dest[5]));

    memcpy(buf + sizeof(struct ethhdr), ifm->m_data, ifm->m_len);

    slirp_output(slirp->opaque, buf, ifm->m_len + ETH_HLEN);

    return 1;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 DISAS_INSN(fsave)
+
 {

     /* TODO: Implement fsave.  */

DISAS_INSN(fsave)

{

    /* TODO: Implement fsave.  */

    qemu_assert(0, "FSAVE not implemented");

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len,

     uint8_t status, uint8_t ep, void *free_on_destroy)

static void bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len,

    uint8_t status, uint8_t ep, void *free_on_destroy)

{

    struct buf_packet *bufp;

    if (!dev->endpoint[EP2I(ep)].bufpq_dropping_packets &&

        dev->endpoint[EP2I(ep)].bufpq_size >

            2 * dev->endpoint[EP2I(ep)].bufpq_target_size) {

        DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep);

        dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1;

    }

    /* Since we're interupting the stream anyways, drop enough packets to get

       back to our target buffer size */

    if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) {

        if (dev->endpoint[EP2I(ep)].bufpq_size >

                dev->endpoint[EP2I(ep)].bufpq_target_size) {

            free(data);

            return;

        }

        dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0;

    }

    bufp = g_new(struct buf_packet, 1);

    bufp->data   = data;

    bufp->len    = len;

    bufp->offset = 0;

    bufp->status = status;

    bufp->free_on_destroy = free_on_destroy;

    QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next);

    dev->endpoint[EP2I(ep)].bufpq_size++;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void ff_put_h264_qpel16_mc20_msa(uint8_t *dst, const uint8_t *src,
+
+                                 ptrdiff_t stride)

 {

void ff_put_h264_qpel16_mc20_msa(uint8_t *dst, const uint8_t *src,

                                 ptrdiff_t stride)

{

    avc_luma_hz_16w_msa(src - 2, stride, dst, stride, 16);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void bit_prop_set(DeviceState *dev, Property *props, bool val)

 {
+
     uint32_t *p = qdev_get_prop_ptr(dev, props);

     uint32_t mask = qdev_get_prop_mask(props);

static void bit_prop_set(DeviceState *dev, Property *props, bool val)

{

    uint32_t *p = qdev_get_prop_ptr(dev, props);

    uint32_t mask = qdev_get_prop_mask(props);

    if (val)

        *p |= ~mask;

    else

        *p &= ~mask;

}


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

             if (os->segments[seg] < 255)

+                duration ++;
+
+        }
+
+

         os->lastpts = os->lastdts   = theora_gptopts(s, idx, os->granule, NULL) - duration;

static int theora_packet(AVFormatContext *s, int idx)

{

    struct ogg *ogg = s->priv_data;

    struct ogg_stream *os = ogg->streams + idx;

    int duration;

    /* first packet handling

       here we parse the duration of each packet in the first page and compare

       the total duration to the page granule to find the encoder delay and

       set the first timestamp */

    if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) {

        int seg;

        duration = 1;

        for (seg = os->segp; seg < os->nsegs; seg++) {

            if (os->segments[seg] < 255)

                duration ++;

        }

        os->lastpts = os->lastdts   = theora_gptopts(s, idx, os->granule, NULL) - duration;

        if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {

            s->streams[idx]->start_time = os->lastpts;

            if (s->streams[idx]->duration)

                s->streams[idx]->duration -= s->streams[idx]->start_time;

        }

    }

    /* parse packet duration */

    if (os->psize > 0) {

        os->pduration = 1;

    }

    return 0;

}


e1000e_init_msi(E1000EState *s)

{

    int res;

    res = msi_init(PCI_DEVICE(s),

                   0xD0,   /* MSI capability offset              */

                   1,      /* MAC MSI interrupts                 */

                   true,   /* 64-bit message addresses supported */

                   false); /* Per vector mask supported          */

    if (res > 0) {

        s->intr_state |= E1000E_USE_MSI;

    } else {

        trace_e1000e_msi_init_fail(res);

    }

}


--- a/source.c
+++ b/source.c
@@ -7,9 +7,9 @@
     QEDRequest *request = read_l2_table_cb->request;

     BDRVQEDState *s = read_l2_table_cb->s;
+
     CachedL2Table *l2_table = request->l2_table;
+

     if (ret) {

static void qed_read_l2_table_cb(void *opaque, int ret)

{

    QEDReadL2TableCB *read_l2_table_cb = opaque;

    QEDRequest *request = read_l2_table_cb->request;

    BDRVQEDState *s = read_l2_table_cb->s;

    CachedL2Table *l2_table = request->l2_table;

    if (ret) {

        /* can't trust loaded L2 table anymore */

        qed_unref_l2_cache_entry(l2_table);

        request->l2_table = NULL;

    } else {

        l2_table->offset = read_l2_table_cb->l2_offset;

        qed_commit_l2_cache_entry(&s->l2_cache, l2_table);

        /* This is guaranteed to succeed because we just committed the entry

         * to the cache.

         */

        request->l2_table = qed_find_l2_cache_entry(&s->l2_cache,

                                                    l2_table->offset);

        assert(request->l2_table != NULL);

    }

    gencb_complete(&read_l2_table_cb->gencb, ret);

}


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

 {
+
+#define TEST_FIFO "tests/test-io-channel-command.fifo"

     QIOChannel *src, *dst;

@@ -21,8 +21,8 @@
     const char *dstargv[] = {

         "/bin/socat", dstfifo, "-", NULL,
+
+    };

static void test_io_channel_command_fifo(bool async)

{

#define TEST_FIFO "tests/test-io-channel-command.fifo"

    QIOChannel *src, *dst;

    QIOChannelTest *test;

    char *srcfifo = g_strdup_printf("PIPE:%s,wronly", TEST_FIFO);

    char *dstfifo = g_strdup_printf("PIPE:%s,rdonly", TEST_FIFO);

    const char *srcargv[] = {

        "/bin/socat", "-", srcfifo, NULL,

    };

    const char *dstargv[] = {

        "/bin/socat", dstfifo, "-", NULL,

    };

    unlink(TEST_FIFO);

    if (access("/bin/socat", X_OK) < 0) {

        return; /* Pretend success if socat is not present */

    }

    if (mkfifo(TEST_FIFO, 0600) < 0) {

        abort();

    }

    src = QIO_CHANNEL(qio_channel_command_new_spawn(srcargv,

                                                    O_WRONLY,

                                                    &error_abort));

    dst = QIO_CHANNEL(qio_channel_command_new_spawn(dstargv,

                                                    O_RDONLY,

                                                    &error_abort));

    test = qio_channel_test_new();

    qio_channel_test_run_threads(test, async, src, dst);

    qio_channel_test_validate(test);

    object_unref(OBJECT(src));

    object_unref(OBJECT(dst));

    g_free(srcfifo);

    g_free(dstfifo);

    unlink(TEST_FIFO);

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     /* FIXME: qobject_to_qint mishandles values over INT64_MAX */

     QObjectInputVisitor *qiv = to_qiv(v);
+
     QObject *qobj = qobject_input_get_object(qiv, name, true, errp);

     QInt *qint;

static void qobject_input_type_uint64(Visitor *v, const char *name,

                                      uint64_t *obj, Error **errp)

{

    /* FIXME: qobject_to_qint mishandles values over INT64_MAX */

    QObjectInputVisitor *qiv = to_qiv(v);

    QObject *qobj = qobject_input_get_object(qiv, name, true, errp);

    QInt *qint;

    if (!qobj) {

        return;

    }

    qint = qobject_to_qint(qobj);

    if (!qint) {

        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",

                   "integer");

        return;

    }

    *obj = qint_get_int(qint);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
+
 {

     const int qmul = svq3_dequant_coeff[qp];
@@ -19,10 +19,10 @@
         const int z0 = 13 * (input[4 * i + 0] +      input[4 * i + 2]);

         const int z1 = 13 * (input[4 * i + 0] -      input[4 * i + 2]);
+
+        const int z2 =  7 *  input[4 * i + 1] - 17 * input[4 * i + 3];
+
+        const int z3 = 17 *  input[4 * i + 1] +  7 * input[4 * i + 3];

static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)

{

    const int qmul = svq3_dequant_coeff[qp];

#define stride 16

    int i;

    int temp[16];

    static const uint8_t x_offset[4] = { 0, 1 * stride, 4 * stride, 5 * stride };

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

        const int z0 = 13 * (input[4 * i + 0] +      input[4 * i + 2]);

        const int z1 = 13 * (input[4 * i + 0] -      input[4 * i + 2]);

        const int z2 =  7 *  input[4 * i + 1] - 17 * input[4 * i + 3];

        const int z3 = 17 *  input[4 * i + 1] +  7 * input[4 * i + 3];

        temp[4 * i + 0] = z0 + z3;

        temp[4 * i + 1] = z1 + z2;

        temp[4 * i + 2] = z1 - z2;

        temp[4 * i + 3] = z0 - z3;

    }

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

        const int offset = x_offset[i];

        const int z0     = 13 * (temp[4 * 0 + i] +      temp[4 * 2 + i]);

        const int z1     = 13 * (temp[4 * 0 + i] -      temp[4 * 2 + i]);

        const int z2     =  7 *  temp[4 * 1 + i] - 17 * temp[4 * 3 + i];

        const int z3     = 17 *  temp[4 * 1 + i] +  7 * temp[4 * 3 + i];

        output[stride *  0 + offset] = (z0 + z3) * qmul + 0x80000 >> 20;

        output[stride *  2 + offset] = (z1 + z2) * qmul + 0x80000 >> 20;

        output[stride *  8 + offset] = (z1 - z2) * qmul + 0x80000 >> 20;

        output[stride * 10 + offset] = (z0 - z3) * qmul + 0x80000 >> 20;

    }

}


--- a/source.c
+++ b/source.c
@@ -3,5 +3,5 @@
     char *prop = g_strdup_printf("%s[%d]", SYSBUS_DEVICE_GPIO_IRQ, n);
     ObjectProperty *r;
     r = object_property_find(OBJECT(dev), prop, NULL);
+    return (r != NULL);
 }

bool sysbus_has_irq(SysBusDevice *dev, int n)
{
    char *prop = g_strdup_printf("%s[%d]", SYSBUS_DEVICE_GPIO_IRQ, n);
    ObjectProperty *r;
    r = object_property_find(OBJECT(dev), prop, NULL);
    return (r != NULL);
}


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

     case 0: /* KMICR */

+        s->cr = value;
+
+        pl050_update(s, s->pending);
+
+        /* ??? Need to implement the enable/disable bit.  */

         break;

static void pl050_write(void *opaque, hwaddr offset,

                        uint64_t value, unsigned size)

{

    pl050_state *s = (pl050_state *)opaque;

    switch (offset >> 2) {

    case 0: /* KMICR */

        s->cr = value;

        pl050_update(s, s->pending);

        /* ??? Need to implement the enable/disable bit.  */

        break;

    case 2: /* KMIDATA */

        /* ??? This should toggle the TX interrupt line.  */

        /* ??? This means kbd/mouse can block each other.  */

        if (s->is_mouse) {

            ps2_write_mouse(s->dev, value);

        } else {

            ps2_write_keyboard(s->dev, value);

        }

        break;

    case 3: /* KMICLKDIV */

        s->clk = value;

        return;

    default:

        hw_error("pl050_write: Bad offset %x\n", (int)offset);

    }

}


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

         asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);

+    avio_flush(s->pb);
+
+
+
+    if (asf->is_streamed || !s->pb->seekable) {

         put_chunk(s, 0x4524, 0, 0); /* end of stream */

static int asf_write_trailer(AVFormatContext *s)

{

    ASFContext *asf = s->priv_data;

    int64_t file_size, data_size;

    /* flush the current packet */

    if (asf->pb.buf_ptr > asf->pb.buffer)

        flush_packet(s);

    /* write index */

    data_size = avio_tell(s->pb);

    if ((!asf->is_streamed) && (asf->nb_index_count != 0))

        asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);

    avio_flush(s->pb);

    if (asf->is_streamed || !s->pb->seekable) {

        put_chunk(s, 0x4524, 0, 0); /* end of stream */

    } else {

        /* rewrite an updated header */

        file_size = avio_tell(s->pb);

        avio_seek(s->pb, 0, SEEK_SET);

        asf_write_header1(s, file_size, data_size - asf->data_offset);

    }

    av_free(asf->index_ptr);

    return 0;

}


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

     const char *name = reg2str(reg);
+
     QTestState *qtest = global_qtest;

     unsigned res;

static inline unsigned in_reg(IVState *s, enum Reg reg)

{

    const char *name = reg2str(reg);

    QTestState *qtest = global_qtest;

    unsigned res;

    global_qtest = s->qtest;

    res = qpci_io_readl(s->dev, s->reg_base + reg);

    g_test_message("*%s -> %x\n", name, res);

    global_qtest = qtest;

    return res;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift,

+                  qemu_irq irq, void* mem_opaque,

                   void (*memory_rw)(void *opaque, target_phys_addr_t addr, uint8_t *buf, int len, int is_write))

@@ -9,12 +9,12 @@
     dp8393xState *s;

     int io;
+

     qemu_check_nic_model(nd, "dp83932");
+
+

     s = qemu_mallocz(sizeof(dp8393xState));

void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift,

                  qemu_irq irq, void* mem_opaque,

                  void (*memory_rw)(void *opaque, target_phys_addr_t addr, uint8_t *buf, int len, int is_write))

{

    dp8393xState *s;

    int io;

    qemu_check_nic_model(nd, "dp83932");

    s = qemu_mallocz(sizeof(dp8393xState));

    s->mem_opaque = mem_opaque;

    s->memory_rw = memory_rw;

    s->it_shift = it_shift;

    s->irq = irq;

    s->watchdog = qemu_new_timer(vm_clock, dp8393x_watchdog, s);

    s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */

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

                                 nic_receive, nic_can_receive, s);

    qemu_format_nic_info_str(s->vc, nd->macaddr);

    qemu_register_reset(nic_reset, s);

    nic_reset(s);

    io = cpu_register_io_memory(0, dp8393x_read, dp8393x_write, s);

    cpu_register_physical_memory(base, 0x40 << it_shift, io);

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     if (mr->iommu_ops->notify_started &&

         QLIST_EMPTY(&mr->iommu_notify.notifiers)) {
+
+        mr->iommu_ops->notify_started(mr);
+
     }

     notifier_list_add(&mr->iommu_notify, n);

void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n)

{

    if (mr->iommu_ops->notify_started &&

        QLIST_EMPTY(&mr->iommu_notify.notifiers)) {

        mr->iommu_ops->notify_started(mr);

    }

    notifier_list_add(&mr->iommu_notify, n);

}


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

         gen_op_addl_ESP_im(addend);

+    } else {
+
+        gen_op_addw_ESP_im(addend);
+
+    }

 }

static inline void gen_stack_update(DisasContext *s, int addend)

{

#ifdef TARGET_X86_64

    if (CODE64(s)) {

        gen_op_addq_ESP_im(addend);

    } else

#endif

    if (s->ss32) {

        gen_op_addl_ESP_im(addend);

    } else {

        gen_op_addw_ESP_im(addend);

    }

}


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

     gen_mov_reg_FCC1(cpu_tmp0, src, fcc_offset);

+    tcg_gen_or_tl(dst, dst, cpu_tmp0);
+
+}

static inline void gen_op_eval_fbne(TCGv dst, TCGv src,

                                    unsigned int fcc_offset)

{

    gen_mov_reg_FCC0(dst, src, fcc_offset);

    gen_mov_reg_FCC1(cpu_tmp0, src, fcc_offset);

    tcg_gen_or_tl(dst, dst, cpu_tmp0);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int hls_start(AVFormatContext *s)
+
+{
+
+    HLSContext *c = s->priv_data;

     AVFormatContext *oc = c->avf;

static int hls_start(AVFormatContext *s)

{

    HLSContext *c = s->priv_data;

    AVFormatContext *oc = c->avf;

    int err = 0;

    if (c->wrap)

        c->number %= c->wrap;

    if (av_get_frame_filename(oc->filename, sizeof(oc->filename),

                              c->basename, c->number++) < 0)

        return AVERROR(EINVAL);

    if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,

                          &s->interrupt_callback, NULL)) < 0)

        return err;

    if (oc->oformat->priv_class && oc->priv_data)

        av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);

    return 0;

}


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

     /*
+
+     * Here we use the number returned by pci_spapr_map_irq to find a
+
+     * corresponding qemu_irq.

      */

static void pci_spapr_set_irq(void *opaque, int irq_num, int level)

{

    /*

     * Here we use the number returned by pci_spapr_map_irq to find a

     * corresponding qemu_irq.

     */

    sPAPRPHBState *phb = opaque;

    qemu_set_irq(phb->lsi_table[irq_num].qirq, level);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void pci_host_config_write(void *opaque, target_phys_addr_t addr,

                                   uint64_t val, unsigned len)
+
+{
+
+    PCIHostState *s = opaque;

static void pci_host_config_write(void *opaque, target_phys_addr_t addr,

                                  uint64_t val, unsigned len)

{

    PCIHostState *s = opaque;

    PCI_DPRINTF("%s addr " TARGET_FMT_plx " len %d val %"PRIx64"\n",

                __func__, addr, len, val);

    s->config_reg = val;


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

                        s->streams[0]->codec->channels *

+                       av_get_bits_per_sample(s->streams[0]->codec->codec_id) >> 3);
+
+    if (ret < 0)
+
+        return ret;

     pkt->stream_index = 0;

static int au_read_packet(AVFormatContext *s,

                          AVPacket *pkt)

{

    int ret;

    ret= av_get_packet(s->pb, pkt, BLOCK_SIZE *

                       s->streams[0]->codec->channels *

                       av_get_bits_per_sample(s->streams[0]->codec->codec_id) >> 3);

    if (ret < 0)

        return ret;

    pkt->stream_index = 0;

    /* note: we need to modify the packet size here to handle the last

       packet */

    pkt->size = ret;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int dfa_probe(AVProbeData *p)
 {
+    if (p->buf_size < 4 || AV_RL32(p->buf) != MKTAG('D', 'F', 'I', 'A'))
         return 0;
     return AVPROBE_SCORE_MAX;
 }

static int dfa_probe(AVProbeData *p)
{
    if (p->buf_size < 4 || AV_RL32(p->buf) != MKTAG('D', 'F', 'I', 'A'))
        return 0;
    return AVPROBE_SCORE_MAX;
}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     __get_user(env->dregs[1], &sc->sc_d1);

     __get_user(env->aregs[0], &sc->sc_a0);
+
+    __get_user(env->aregs[1], &sc->sc_a1);
+
+    __get_user(env->pc, &sc->sc_pc);
+
     __get_user(temp, &sc->sc_sr);

     env->sr = (env->sr & 0xff00) | (temp & 0xff);

restore_sigcontext(CPUM68KState *env, struct target_sigcontext *sc, int *pd0)

{

    int temp;

    __get_user(env->aregs[7], &sc->sc_usp);

    __get_user(env->dregs[1], &sc->sc_d1);

    __get_user(env->aregs[0], &sc->sc_a0);

    __get_user(env->aregs[1], &sc->sc_a1);

    __get_user(env->pc, &sc->sc_pc);

    __get_user(temp, &sc->sc_sr);

    env->sr = (env->sr & 0xff00) | (temp & 0xff);

    *pd0 = tswapl(sc->sc_d0);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static int pci_nic_uninit(PCIDevice *dev)
+
+{
+
+    PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, dev);

     EEPRO100State *s = &d->eepro100;

static int pci_nic_uninit(PCIDevice *dev)

{

    PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, dev);

    EEPRO100State *s = &d->eepro100;

    cpu_unregister_io_memory(s->mmio_index);

    return 0;

}


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

 {

+    enum { max_nesting = 1024 }; /* see qobject/json-streamer.c */

     char buf[2 * (max_nesting + 1) + 1];
+
     QObject *obj;

static void limits_nesting(void)

{

    enum { max_nesting = 1024 }; /* see qobject/json-streamer.c */

    char buf[2 * (max_nesting + 1) + 1];

    QObject *obj;

    obj = qobject_from_json(make_nest(buf, max_nesting), NULL);

    g_assert(obj != NULL);

    qobject_decref(obj);

    obj = qobject_from_json(make_nest(buf, max_nesting + 1), NULL);

    g_assert(obj == NULL);

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     const int channels = inlink->channels;

     const int nb_samples = frame->nb_samples;
+
     AVFrame *out_frame;

     int chan, i;

static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame)

{

    CompandContext *s = ctx->priv;

    AVFilterLink *inlink = ctx->inputs[0];

    const int channels = inlink->channels;

    const int nb_samples = frame->nb_samples;

    AVFrame *out_frame;

    int chan, i;

    if (av_frame_is_writable(frame)) {

        out_frame = frame;

    } else {

        out_frame = ff_get_audio_buffer(inlink, nb_samples);

        if (!out_frame)

            return AVERROR(ENOMEM);

        av_frame_copy_props(out_frame, frame);

    }

    for (chan = 0; chan < channels; chan++) {

        const double *src = (double *)frame->extended_data[chan];

        double *dst = (double *)out_frame->extended_data[chan];

        ChanParam *cp = &s->channels[chan];

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

            update_volume(cp, fabs(src[i]));

            dst[i] = av_clipd(src[i] * get_volume(s, cp->volume), -1, 1);

        }

    }

    if (frame != out_frame)

        av_frame_free(&frame);

    return ff_filter_frame(ctx->outputs[0], out_frame);

}


int float32_lt( float32 a, float32 b STATUS_PARAM )

{

    flag aSign, bSign;

    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )

         || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )

       ) {

        float_raise( float_flag_invalid STATUS_VAR);

        return 0;

    }

    aSign = extractFloat32Sign( a );

    bSign = extractFloat32Sign( b );

    if ( aSign != bSign ) return aSign && ( (bits32) ( ( a | b )<<1 ) != 0 );

    return ( a != b ) && ( aSign ^ ( a < b ) );

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     BdrvRequestFlags flags)

 {
+
+    if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) {
+
+        return -EINVAL;
+
     }

static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,

    int64_t sector_num, int nb_sectors, QEMUIOVector *qiov,

    BdrvRequestFlags flags)

{

    if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) {

        return -EINVAL;

    }

    return bdrv_co_do_pwritev(bs, sector_num << BDRV_SECTOR_BITS,

                              nb_sectors << BDRV_SECTOR_BITS, qiov, flags);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+int nbd_receive_reply(int csock, struct nbd_reply *reply)

 {
+
     uint8_t buf[NBD_REPLY_SIZE];

     uint32_t magic;

int nbd_receive_reply(int csock, struct nbd_reply *reply)

{

    uint8_t buf[NBD_REPLY_SIZE];

    uint32_t magic;

    memset(buf, 0xAA, sizeof(buf));

    if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) {

        LOG("read failed");

        errno = EINVAL;

        return -1;

    }

    /* Reply

       [ 0 ..  3]    magic   (NBD_REPLY_MAGIC)

       [ 4 ..  7]    error   (0 == no error)

       [ 7 .. 15]    handle

     */

    magic = be32_to_cpup((uint32_t*)buf);

    reply->error  = be32_to_cpup((uint32_t*)(buf + 4));

    reply->handle = be64_to_cpup((uint64_t*)(buf + 8));

    TRACE("Got reply: "

          "{ magic = 0x%x, .error = %d, handle = %" PRIu64" }",

          magic, reply->error, reply->handle);

    if (magic != NBD_REPLY_MAGIC) {

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

        errno = EINVAL;

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
             if (block->flags & RAM_PREALLOC_MASK) {

                 ;
+
+            } else if (mem_path) {
+
+#if defined (__linux__) && !defined(TARGET_S390X)
+
                 if (block->fd) {

                     munmap(block->host, block->length);

void qemu_ram_free(ram_addr_t addr)

{

    RAMBlock *block;

    QLIST_FOREACH(block, &ram_list.blocks, next) {

        if (addr == block->offset) {

            QLIST_REMOVE(block, next);

            if (block->flags & RAM_PREALLOC_MASK) {

                ;

            } else if (mem_path) {

#if defined (__linux__) && !defined(TARGET_S390X)

                if (block->fd) {

                    munmap(block->host, block->length);

                    close(block->fd);

                } else {

                    qemu_vfree(block->host);

                }

#endif

            } else {

#if defined(TARGET_S390X) && defined(CONFIG_KVM)

                munmap(block->host, block->length);

                qemu_vfree(block->host);

#endif

            }

            qemu_free(block);

            return;

        }

    }

}


static Jpeg2000TgtNode *ff_jpeg2000_tag_tree_init(int w, int h)

{

    int pw = w, ph = h;

    Jpeg2000TgtNode *res, *t, *t2;

    int32_t tt_size;

    tt_size = tag_tree_size(w, h);

    if (tt_size == -1)

        return NULL;

    t = res = av_mallocz_array(tt_size, sizeof(*t));

    if (!res)

        return NULL;

    while (w > 1 || h > 1) {

        int i, j;

        pw = w;

        ph = h;

        w  = (w + 1) >> 1;

        h  = (h + 1) >> 1;

        t2 = t + pw * ph;

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

            for (j = 0; j < pw; j++)

                t[i * pw + j].parent = &t2[(i >> 1) * w + (j >> 1)];

        t = t2;

    }

    t[0].parent = NULL;

    return res;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 int qemu_devtree_nop_node(void *fdt, const char *node_path)
+
+{
+
+    int offset;

int qemu_devtree_nop_node(void *fdt, const char *node_path)

{

    int offset;

    offset = fdt_path_offset(fdt, node_path);

    if (offset < 0)

        return offset;

    return fdt_nop_node(fdt, offset);

}


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

     qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,

+                               &break_enabled);
+
+}

static void uart_send_breaks(UartState *s)

{

    int break_enabled = 1;

    qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,

                               &break_enabled);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int dvvideo_close(AVCodecContext *c)
+
+{

     DVVideoContext *s = c->priv_data;

static int dvvideo_close(AVCodecContext *c)

{

    DVVideoContext *s = c->priv_data;

    av_free(s->dv_anchor);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int bdrv_rd_badreq_bytes(BlockDriverState *bs,
+
+                                int64_t offset, int count)

 {

static int bdrv_rd_badreq_bytes(BlockDriverState *bs,

                                int64_t offset, int count)

{

    int64_t size = bs->total_sectors << SECTOR_BITS;

    return

        count < 0 ||

        size < 0 ||

        count > size ||

        offset > size - count;

}


--- a/source.c
+++ b/source.c
@@ -1,35 +1,35 @@
+int qemu_read_password(char *buf, int buf_size)
+
+{
+
+    uint8_t ch;
+
+    int i, ret;
+
+
+
+    printf("password: ");
+
     fflush(stdout);
+
     term_init();
+
+    i = 0;
+
     for (;;) {
+
+        ret = read(0, &ch, 1);

         if (ret == -1) {
+
+            if (errno == EAGAIN || errno == EINTR) {

                 continue;

+            } else {
+
+                break;
+
             }

         } else if (ret == 0) {

int qemu_read_password(char *buf, int buf_size)

{

    uint8_t ch;

    int i, ret;

    printf("password: ");

    fflush(stdout);

    term_init();

    i = 0;

    for (;;) {

        ret = read(0, &ch, 1);

        if (ret == -1) {

            if (errno == EAGAIN || errno == EINTR) {

                continue;

            } else {

                break;

            }

        } else if (ret == 0) {

            ret = -1;

            break;

        } else {

            if (ch == '\r' ||

                ch == '\n') {

                ret = 0;

                break;

            }

            if (i < (buf_size - 1)) {

                buf[i++] = ch;

            }

        }

    }

    term_exit();

    buf[i] = '\0';

    printf("\n");

    return ret;

}


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

+    av_dict_copy(&tmp, opts, 0);
+
+
+
+    av_opt_set_dict(var->input, &tmp);

static int url_connect(struct variant *var, AVDictionary *opts)

{

    AVDictionary *tmp = NULL;

    int ret;

    av_dict_copy(&tmp, opts, 0);

    av_opt_set_dict(var->input, &tmp);

    if ((ret = ffurl_connect(var->input, NULL)) < 0) {

        ffurl_close(var->input);

        var->input = NULL;

    }

    av_dict_free(&tmp);

    return ret;

}


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

                            "   'id': 'usbdev%d'"

+                           "}}", port);
+
+    response = qmp(cmd);
+
+    g_free(cmd);

     g_assert(response);

void usb_test_hotplug(const char *hcd_id, const int port,

                      void (*port_check)(void))

{

    QDict *response;

    char  *cmd;

    cmd = g_strdup_printf("{'execute': 'device_add',"

                          " 'arguments': {"

                          "   'driver': 'usb-tablet',"

                          "   'port': '%d',"

                          "   'bus': '%s.0',"

                          "   'id': 'usbdev%d'"

                          "}}", port, hcd_id, port);

    response = qmp(cmd);

    g_free(cmd);

    g_assert(response);

    g_assert(!qdict_haskey(response, "error"));

    if (port_check) {

        port_check();

    }

    cmd = g_strdup_printf("{'execute': 'device_del',"

                           " 'arguments': {"

                           "   'id': 'usbdev%d'"

                           "}}", port);

    response = qmp(cmd);

    g_free(cmd);

    g_assert(response);

    g_assert(qdict_haskey(response, "event"));

    g_assert(!strcmp(qdict_get_str(response, "event"), "DEVICE_DELETED"));

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
+void *cpu_register_map_client(void *opaque, void (*callback)(void *opaque))

 {
+
+    MapClient *client = g_malloc(sizeof(*client));

     qemu_mutex_lock(&map_client_list_lock);

+    client->opaque = opaque;

     client->callback = callback;

void *cpu_register_map_client(void *opaque, void (*callback)(void *opaque))

{

    MapClient *client = g_malloc(sizeof(*client));

    qemu_mutex_lock(&map_client_list_lock);

    client->opaque = opaque;

    client->callback = callback;

    QLIST_INSERT_HEAD(&map_client_list, client, link);

    if (!atomic_read(&bounce.in_use)) {

        cpu_notify_map_clients_locked();

    }

    qemu_mutex_unlock(&map_client_list_lock);

    return client;

}


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

+    src_y  -=   linesize + 1;
+
     src_cb -= uvlinesize + 1;
+
+    src_cr -= uvlinesize + 1;

+
+
+#define XCHG(a,b,t,xchg)\

+t= a;\
+
 if(xchg)\

     a= b;\

static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg){

    MpegEncContext * const s = &h->s;

    int temp8, i;

    uint64_t temp64;

    src_y  -=   linesize + 1;

    src_cb -= uvlinesize + 1;

    src_cr -= uvlinesize + 1;

#define XCHG(a,b,t,xchg)\

t= a;\

if(xchg)\

    a= b;\

b= t;

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

        XCHG(h->left_border[i     ], src_y [i*  linesize], temp8, xchg);

    }

    XCHG(*(uint64_t*)(h->top_border[s->mb_x]+0), *(uint64_t*)(src_y +1), temp64, xchg);

    XCHG(*(uint64_t*)(h->top_border[s->mb_x]+8), *(uint64_t*)(src_y +9), temp64, 1);

    if(!(s->flags&CODEC_FLAG_GRAY)){

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

            XCHG(h->left_border[i+17  ], src_cb[i*uvlinesize], temp8, xchg);

            XCHG(h->left_border[i+17+9], src_cr[i*uvlinesize], temp8, xchg);

        }

        XCHG(*(uint64_t*)(h->top_border[s->mb_x]+16), *(uint64_t*)(src_cb+1), temp64, 1);

        XCHG(*(uint64_t*)(h->top_border[s->mb_x]+24), *(uint64_t*)(src_cr+1), temp64, 1);

    }

}


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

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

static void test_visitor_out_native_list_int32(TestOutputVisitorData *data,

                                               const void *unused)

{

    test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_S32);

}


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

     qstring_append(json->str, str);

+    qstring_append_chr(json->str, '"');
+
+}

void json_prop_str(QJSON *json, const char *name, const char *str)

{

    json_emit_element(json, name);

    qstring_append_chr(json->str, '"');

    qstring_append(json->str, str);

    qstring_append_chr(json->str, '"');

}


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

 {

+    assert(con != NULL);
+
+    con->ui_info = *info;
+
+    if (!con->hw_ops->ui_info) {

         return -1;

int dpy_set_ui_info(QemuConsole *con, QemuUIInfo *info)

{

    assert(con != NULL);

    con->ui_info = *info;

    if (!con->hw_ops->ui_info) {

        return -1;

    }

    /*

     * Typically we get a flood of these as the user resizes the window.

     * Wait until the dust has settled (one second without updates), then

     * go notify the guest.

     */

    timer_mod(con->ui_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 1000);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
         int fd;

         fd = open(rpath(fs_ctx, path), O_RDONLY);
+
         if (fd == -1) {

             return -1;

static ssize_t local_readlink(FsContext *fs_ctx, const char *path,

        char *buf, size_t bufsz)

{

    ssize_t tsize = -1;

    if (fs_ctx->fs_sm == SM_MAPPED) {

        int fd;

        fd = open(rpath(fs_ctx, path), O_RDONLY);

        if (fd == -1) {

            return -1;

        }

        do {

            tsize = read(fd, (void *)buf, bufsz);

        } while (tsize == -1 && errno == EINTR);

        close(fd);

        return tsize;

    } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {

        tsize = readlink(rpath(fs_ctx, path), buf, bufsz);

    }

    return tsize;

}


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

     // TODO: fold this into the protocol specific data fields.

+
+
+    if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) {
+
         ff_mpegts_parse_close(s->ts);

     }

void rtp_parse_close(RTPDemuxContext *s)

{

    // TODO: fold this into the protocol specific data fields.

    if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) {

        ff_mpegts_parse_close(s->ts);

    }

    av_free(s);

}


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

+
+    /* We'll eventually drop fd_set completely.  But for now we still have
+
+     * *_fill() and *_poll() functions that use rfds/wfds/xfds.
+
      */

     gpollfds_from_select();

static int os_host_main_loop_wait(uint32_t timeout)

{

    int ret;

    glib_select_fill(&nfds, &rfds, &wfds, &xfds, &timeout);

    if (timeout > 0) {

        qemu_mutex_unlock_iothread();

    }

    /* We'll eventually drop fd_set completely.  But for now we still have

     * *_fill() and *_poll() functions that use rfds/wfds/xfds.

     */

    gpollfds_from_select();

    ret = g_poll((GPollFD *)gpollfds->data, gpollfds->len, timeout);

    gpollfds_to_select(ret);

    if (timeout > 0) {

        qemu_mutex_lock_iothread();

    }

    glib_select_poll(&rfds, &wfds, &xfds, (ret < 0));

    return ret;

}


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

         put_symbol(&s->c, s->header_state, s->colorspace_type, 0);

+        put_symbol(&s->c, s->header_state, s->b_width, 0);
+
+        put_symbol(&s->c, s->header_state, s->b_height, 0);
+
+        put_symbol(&s->c, s->header_state, s->chroma_h_shift, 0);

         put_symbol(&s->c, s->header_state, s->chroma_v_shift, 0);

static void encode_header(SnowContext *s){

    int plane_index, level, orientation;

    put_cabac(&s->c, s->header_state, s->keyframe); // state clearing stuff?

    if(s->keyframe){

        put_symbol(&s->c, s->header_state, s->version, 0);

        put_symbol(&s->c, s->header_state, s->temporal_decomposition_type, 0);

        put_symbol(&s->c, s->header_state, s->temporal_decomposition_count, 0);

        put_symbol(&s->c, s->header_state, s->spatial_decomposition_count, 0);

        put_symbol(&s->c, s->header_state, s->colorspace_type, 0);

        put_symbol(&s->c, s->header_state, s->b_width, 0);

        put_symbol(&s->c, s->header_state, s->b_height, 0);

        put_symbol(&s->c, s->header_state, s->chroma_h_shift, 0);

        put_symbol(&s->c, s->header_state, s->chroma_v_shift, 0);

        put_cabac(&s->c, s->header_state, s->spatial_scalability);

//        put_cabac(&s->c, s->header_state, s->rate_scalability);

        for(plane_index=0; plane_index<2; plane_index++){

            for(level=0; level<s->spatial_decomposition_count; level++){

                for(orientation=level ? 1:0; orientation<4; orientation++){

                    if(orientation==2) continue;

                    put_symbol(&s->c, s->header_state, s->plane[plane_index].band[level][orientation].qlog, 1);

                }

            }

        }

    }

    put_symbol(&s->c, s->header_state, s->spatial_decomposition_type, 0);

    put_symbol(&s->c, s->header_state, s->qlog, 1);

    put_symbol(&s->c, s->header_state, s->mv_scale, 0);

    put_symbol(&s->c, s->header_state, s->qbias, 1);

}


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

         param[i].upper = i == NBANDS - 1 ? fs : bands[i];

+        param[i].gain  = bc[i];
+
+    }
+
 }

static void process_param(float *bc, EqParameter *param, float fs)

{

    int i;

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

        param[i].lower = i == 0 ? 0 : bands[i - 1];

        param[i].upper = i == NBANDS - 1 ? fs : bands[i];

        param[i].gain  = bc[i];

    }

}


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

     __cpu_ppc_store_decr(cpu, &tb_env->decr_next, tb_env->decr_timer,

+                         &cpu_ppc_decr_excp, decr, value, is_excp);
+
+}

static inline void _cpu_ppc_store_decr(PowerPCCPU *cpu, uint32_t decr,

                                       uint32_t value, int is_excp)

{

    ppc_tb_t *tb_env = cpu->env.tb_env;

    __cpu_ppc_store_decr(cpu, &tb_env->decr_next, tb_env->decr_timer,

                         &cpu_ppc_decr_excp, decr, value, is_excp);

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
         src_pr = src_px + w;

+
+        for (; src_px < src_pr; src_px++, dst_px++)
+
+            *dst_px = *src_px;
+
     }

 }

static void gif_copy_img_rect(const uint32_t *src, uint32_t *dst,

                              int linesize, int l, int t, int w, int h)

{

    const int y_start = t * linesize;

    const uint32_t *src_px, *src_pr,

                   *src_py = src + y_start,

                   *dst_py = dst + y_start;

    const uint32_t *src_pb = src_py + t * linesize;

    uint32_t *dst_px;

    for (; src_py < src_pb; src_py += linesize, dst_py += linesize) {

        src_px = src_py + l;

        dst_px = (uint32_t *)dst_py + l;

        src_pr = src_px + w;

        for (; src_px < src_pr; src_px++, dst_px++)

            *dst_px = *src_px;

    }

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     if (mon->mc && !mon->mc->print_enabled) {

         qemu_error_new(QERR_UNDEFINED_ERROR);
+
+    } else {
+
+        char buf[4096];
+
         vsnprintf(buf, sizeof(buf), fmt, ap);

         monitor_puts(mon, buf);

void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)

{

    if (!mon)

        return;

    if (mon->mc && !mon->mc->print_enabled) {

        qemu_error_new(QERR_UNDEFINED_ERROR);

    } else {

        char buf[4096];

        vsnprintf(buf, sizeof(buf), fmt, ap);

        monitor_puts(mon, buf);

    }

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     BlockDriverCompletionFunc *cb, void *opaque)

 {
+
+    return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque);

 }

static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs,

    int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,

    BlockDriverCompletionFunc *cb, void *opaque)

{

    return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)

 {

static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)

{

#if COMPILE_TEMPLATE_MMX

    __asm__ volatile(

        "movq "MANGLE(bm01010101)", %%mm4           \n\t"

        "mov                    %0, %%"REG_a"       \n\t"

        "1:                                         \n\t"

        "movq    (%1, %%"REG_a",2), %%mm0           \n\t"

        "movq   8(%1, %%"REG_a",2), %%mm1           \n\t"

        "movq    (%2, %%"REG_a",2), %%mm2           \n\t"

        "movq   8(%2, %%"REG_a",2), %%mm3           \n\t"

        "pand                %%mm4, %%mm0           \n\t"

        "pand                %%mm4, %%mm1           \n\t"

        "pand                %%mm4, %%mm2           \n\t"

        "pand                %%mm4, %%mm3           \n\t"

        "packuswb            %%mm1, %%mm0           \n\t"

        "packuswb            %%mm3, %%mm2           \n\t"

        "movq                %%mm0, (%3, %%"REG_a") \n\t"

        "movq                %%mm2, (%4, %%"REG_a") \n\t"

        "add                    $8, %%"REG_a"       \n\t"

        " js                    1b                  \n\t"

        : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width)

        : "%"REG_a

    );

#else

    int i;

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

        dstU[i]= src1[2*i];

        dstV[i]= src2[2*i];

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 START_TEST(qdict_haskey_not_test)
+
 {

     fail_unless(qdict_haskey(tests_dict, "test") == 0);

START_TEST(qdict_haskey_not_test)

{

    fail_unless(qdict_haskey(tests_dict, "test") == 0);

}