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

         break;

+    case POWERPC_MMU_SOFT_4xx:

+    case POWERPC_MMU_SOFT_4xx_Z:

         ppc4xx_tlb_invalidate_all(env);

void ppc_tlb_invalidate_all (CPUPPCState *env)

{

    switch (env->mmu_model) {

    case POWERPC_MMU_SOFT_6xx:

    case POWERPC_MMU_SOFT_74xx:

        ppc6xx_tlb_invalidate_all(env);

        break;

    case POWERPC_MMU_SOFT_4xx:

    case POWERPC_MMU_SOFT_4xx_Z:

        ppc4xx_tlb_invalidate_all(env);

        break;

    case POWERPC_MMU_REAL_4xx:

        cpu_abort(env, "No TLB for PowerPC 4xx in real mode\n");

        break;

    case POWERPC_MMU_BOOKE:

        /* XXX: TODO */

        cpu_abort(env, "MMU model not implemented\n");

        break;

    case POWERPC_MMU_BOOKE_FSL:

        /* XXX: TODO */

        cpu_abort(env, "MMU model not implemented\n");

        break;

    case POWERPC_MMU_601:

        /* XXX: TODO */

        cpu_abort(env, "MMU model not implemented\n");

        break;

    case POWERPC_MMU_32B:

#if defined(TARGET_PPC64)

    case POWERPC_MMU_64B:

    case POWERPC_MMU_64BRIDGE:

#endif /* defined(TARGET_PPC64) */

        tlb_flush(env, 1);

        break;

    default:

        /* XXX: TODO */

        cpu_abort(env, "Unknown MMU model %d\n", env->mmu_model);

        break;

    }

}


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

+    etsec->rx_first_in_frame = 1;
+
+    etsec->rx_remaining_data = etsec->rx_buffer_len;
+
+    RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__,

                etsec->rx_buffer_len, etsec->rx_padding);

static void rx_init_frame(eTSEC *etsec, const uint8_t *buf, size_t size)

{

    uint32_t fcb_size = 0;

    uint8_t  prsdep   = (etsec->regs[RCTRL].value >> RCTRL_PRSDEP_OFFSET)

        & RCTRL_PRSDEP_MASK;

    if (prsdep != 0) {

        /* Prepend FCB (FCB size + RCTRL[PAL]) */

        fcb_size = 8 + ((etsec->regs[RCTRL].value >> 16) & 0x1F);

        etsec->rx_fcb_size = fcb_size;

        /* TODO: fill_FCB(etsec); */

        memset(etsec->rx_fcb, 0x0, sizeof(etsec->rx_fcb));

    } else {

        etsec->rx_fcb_size = 0;

    }

    if (etsec->rx_buffer != NULL) {

        g_free(etsec->rx_buffer);

    }

    /* Do not copy the frame for now */

    etsec->rx_buffer     = (uint8_t *)buf;

    etsec->rx_buffer_len = size;

    /* CRC padding (We don't have to compute the CRC) */

    etsec->rx_padding = 4;

    etsec->rx_first_in_frame = 1;

    etsec->rx_remaining_data = etsec->rx_buffer_len;

    RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__,

               etsec->rx_buffer_len, etsec->rx_padding);

}


--- a/source.c
+++ b/source.c
@@ -13,9 +13,9 @@
     avctx->width               = 0;

     avctx->height              = 0;
+
+
+
+    return ff_cfhd_init_vlcs(s);
+
 }

static av_cold int cfhd_decode_init(AVCodecContext *avctx)

{

    CFHDContext *s = avctx->priv_data;

    avctx->bits_per_raw_sample = 10;

    s->avctx                   = avctx;

    avctx->width               = 0;

    avctx->height              = 0;

    return ff_cfhd_init_vlcs(s);

}


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

     Coroutine *co = arg;

+    qemu_coroutine_enter(co, NULL);
+
     return 0;

 }

static int coroutine_enter_func(void *arg)

{

    Coroutine *co = arg;

    qemu_coroutine_enter(co, NULL);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static inline int16_t mipsdsp_add_i16(int16_t a, int16_t b, CPUMIPSState *env)

 {
+
     int16_t tempI;

static inline int16_t mipsdsp_add_i16(int16_t a, int16_t b, CPUMIPSState *env)

{

    int16_t tempI;

    tempI = a + b;

    if (MIPSDSP_OVERFLOW(a, b, tempI, 0x8000)) {

        set_DSPControl_overflow_flag(1, 20, env);

    }

    return tempI;

}


--- a/source.c
+++ b/source.c
@@ -18,11 +18,11 @@
         { 0xD4000, 0xD7FFF }, /* Option ROM */
         { 0xD8000, 0xDBFFF }, /* Option ROM */
         { 0xDC000, 0xDFFFF }, /* Option ROM */
+        { 0xE0000, 0xE3FFF }, /* BIOS Extension */
+        { 0xE4000, 0xE7FFF }, /* BIOS Extension */
+        { 0xE8000, 0xEBFFF }, /* BIOS Extension */
+        { 0xEC000, 0xEFFFF }, /* BIOS Extension */
+    };
     bus = test_start_get_bus(s);
     dev = qpci_device_find(bus, QPCI_DEVFN(0, 0));
     g_assert(dev != NULL);

static void test_i440fx_pam(gconstpointer opaque)
{
    const TestData *s = opaque;
    QPCIBus *bus;
    QPCIDevice *dev;
    int i;
    static struct {
        uint32_t start;
        uint32_t end;
    } pam_area[] = {
        { 0, 0 },             /* Reserved */
        { 0xF0000, 0xFFFFF }, /* BIOS Area */
        { 0xC0000, 0xC3FFF }, /* Option ROM */
        { 0xC4000, 0xC7FFF }, /* Option ROM */
        { 0xC8000, 0xCBFFF }, /* Option ROM */
        { 0xCC000, 0xCFFFF }, /* Option ROM */
        { 0xD0000, 0xD3FFF }, /* Option ROM */
        { 0xD4000, 0xD7FFF }, /* Option ROM */
        { 0xD8000, 0xDBFFF }, /* Option ROM */
        { 0xDC000, 0xDFFFF }, /* Option ROM */
        { 0xE0000, 0xE3FFF }, /* BIOS Extension */
        { 0xE4000, 0xE7FFF }, /* BIOS Extension */
        { 0xE8000, 0xEBFFF }, /* BIOS Extension */
        { 0xEC000, 0xEFFFF }, /* BIOS Extension */
    };
    bus = test_start_get_bus(s);
    dev = qpci_device_find(bus, QPCI_DEVFN(0, 0));
    g_assert(dev != NULL);
    for (i = 0; i < ARRAY_SIZE(pam_area); i++) {
        if (pam_area[i].start == pam_area[i].end) {
            continue;
        }
        g_test_message("Checking area 0x%05x..0x%05x",
                       pam_area[i].start, pam_area[i].end);
        /* Switch to RE for the area */
        pam_set(dev, i, PAM_RE);
        /* Verify the RAM is all zeros */
        g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0));
        /* Switch to WE for the area */
        pam_set(dev, i, PAM_RE | PAM_WE);
        /* Write out a non-zero mask to the full area */
        write_area(pam_area[i].start, pam_area[i].end, 0x42);
#ifndef BROKEN
        /* QEMU only supports a limited form of PAM */
        /* Switch to !RE for the area */
        pam_set(dev, i, PAM_WE);
        /* Verify the area is not our mask */
        g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x42));
#endif
        /* Verify the area is our new mask */
        g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x42));
        /* Write out a new mask */
        write_area(pam_area[i].start, pam_area[i].end, 0x82);
#ifndef BROKEN
        /* QEMU only supports a limited form of PAM */
        /* Verify the area is not our mask */
        g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x82));
        /* Switch to RE for the area */
        pam_set(dev, i, PAM_RE | PAM_WE);
#endif
        /* Verify the area is our new mask */
        g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x82));
        /* Reset area */
        pam_set(dev, i, 0);
        /* Verify the area is not our new mask */
        g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x82));
    }
    qtest_end();
}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     switch (page) {

     case MODE_PAGE_CACHING:
+
+        bdrv_set_enable_write_cache(s->qdev.conf.bs, (p[0] & 4) != 0);
+
+        break;
+

     default:

static void scsi_disk_apply_mode_select(SCSIDiskState *s, int page, uint8_t *p)

{

    switch (page) {

    case MODE_PAGE_CACHING:

        bdrv_set_enable_write_cache(s->qdev.conf.bs, (p[0] & 4) != 0);

        break;

    default:

        break;

    }

}


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

                             int stream_index,

+                            const uint8_t *buf, int size, int64_t pts)
+
+{

     CRCState *crc = s->priv_data;

static int crc_write_packet(struct AVFormatContext *s,

                            int stream_index,

                            const uint8_t *buf, int size, int64_t pts)

{

    CRCState *crc = s->priv_data;

    crc->crcval = adler32(crc->crcval, buf, size);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -22,11 +22,11 @@
     set_bit(DEVICE_CATEGORY_SOUND, dc->categories);

     dc->desc = "Intel 82801AA AC97 Audio";
+
+    dc->vmsd = &vmstate_ac97;
+
+    dc->props = ac97_properties;
+
     dc->reset = ac97_on_reset;

 }

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

{

    DeviceClass *dc = DEVICE_CLASS (klass);

    PCIDeviceClass *k = PCI_DEVICE_CLASS (klass);

    k->realize = ac97_realize;

    k->vendor_id = PCI_VENDOR_ID_INTEL;

    k->device_id = PCI_DEVICE_ID_INTEL_82801AA_5;

    k->revision = 0x01;

    k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;

    set_bit(DEVICE_CATEGORY_SOUND, dc->categories);

    dc->desc = "Intel 82801AA AC97 Audio";

    dc->vmsd = &vmstate_ac97;

    dc->props = ac97_properties;

    dc->reset = ac97_on_reset;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void xenstore_update_be(char *watch, char *type, int dom,

+                               struct XenDevOps *ops)

+{
+
+    struct XenDevice *xendev;

     char path[XEN_BUFSIZE], *dom0, *bepath;

static void xenstore_update_be(char *watch, char *type, int dom,

                               struct XenDevOps *ops)

{

    struct XenDevice *xendev;

    char path[XEN_BUFSIZE], *dom0, *bepath;

    unsigned int len, dev;

    dom0 = xs_get_domain_path(xenstore, 0);

    len = snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);

    free(dom0);

    if (strncmp(path, watch, len) != 0) {

        return;

    }

    if (sscanf(watch+len, "/%u/%255s", &dev, path) != 2) {

        strcpy(path, "");

        if (sscanf(watch+len, "/%u", &dev) != 1) {

            dev = -1;

        }

    }

    if (dev == -1) {

        return;

    }

    xendev = xen_be_get_xendev(type, dom, dev, ops);

    if (xendev != NULL) {

        bepath = xs_read(xenstore, 0, xendev->be, &len);

        if (bepath == NULL) {

            xen_be_del_xendev(dom, dev);

        } else {

            free(bepath);

            xen_be_backend_changed(xendev, path);

            xen_be_check_state(xendev);

        }

    }

}


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

         return ri->raw_readfn(env, ri);

+    } else if (ri->readfn) {
+
+        return ri->readfn(env, ri);
+
+    } else {

         return raw_read(env, ri);

static uint64_t read_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri)

{

    /* Raw read of a coprocessor register (as needed for migration, etc). */

    if (ri->type & ARM_CP_CONST) {

        return ri->resetvalue;

    } else if (ri->raw_readfn) {

        return ri->raw_readfn(env, ri);

    } else if (ri->readfn) {

        return ri->readfn(env, ri);

    } else {

        return raw_read(env, ri);

    }

}


--- a/source.c
+++ b/source.c
@@ -23,9 +23,9 @@
     conditional_branch(ch);

+
+wait:
+
+    qemu_bh_schedule(dbdma_bh);
+
 }

static void nop(DBDMA_channel *ch)

{

    dbdma_cmd *current = &ch->current;

    if (conditional_wait(ch))

        goto wait;

    current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));

    dbdma_cmdptr_save(ch);

    conditional_interrupt(ch);

    conditional_branch(ch);

wait:

    qemu_bh_schedule(dbdma_bh);

}


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

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

+        if (errnum == error_entries[i].num) {

             entry = &error_entries[i];

int av_strerror(int errnum, char *errbuf, size_t errbuf_size)

{

    int ret = 0, i;

    struct error_entry *entry = NULL;

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

        if (errnum == error_entries[i].num) {

            entry = &error_entries[i];

            break;

        }

    }

    if (entry) {

        av_strlcpy(errbuf, entry->str, errbuf_size);

    } else {

#if HAVE_STRERROR_R

        ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);

#else

        ret = -1;

#endif

        if (ret < 0)

            snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);

    }

    return ret;

}


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

         return MEMTX_ERROR;

+    }
+
+
+
+    VTD_DPRINTF(IR, "delivering MSI 0x%"PRIx64":0x%"PRIx32

                 " for device sid 0x%04x",

static MemTxResult vtd_mem_ir_write(void *opaque, hwaddr addr,

                                    uint64_t value, unsigned size,

                                    MemTxAttrs attrs)

{

    int ret = 0;

    MSIMessage from = {}, to = {};

    from.address = (uint64_t) addr + VTD_INTERRUPT_ADDR_FIRST;

    from.data = (uint32_t) value;

    ret = vtd_interrupt_remap_msi(opaque, &from, &to);

    if (ret) {

        /* TODO: report error */

        VTD_DPRINTF(GENERAL, "int remap fail for addr 0x%"PRIx64

                    " data 0x%"PRIx32, from.address, from.data);

        /* Drop this interrupt */

        return MEMTX_ERROR;

    }

    VTD_DPRINTF(IR, "delivering MSI 0x%"PRIx64":0x%"PRIx32

                " for device sid 0x%04x",

                to.address, to.data, sid);

    if (dma_memory_write(&address_space_memory, to.address,

                         &to.data, size)) {

        VTD_DPRINTF(GENERAL, "error: fail to write 0x%"PRIx64

                    " value 0x%"PRIx32, to.address, to.data);

    }

    return MEMTX_OK;

}


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

     const char *argv[] = { "/bin/sh", "-c", command, NULL };

+

     trace_migration_exec_outgoing(command);

void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp)

{

    QIOChannel *ioc;

    const char *argv[] = { "/bin/sh", "-c", command, NULL };

    trace_migration_exec_outgoing(command);

    ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv,

                                                    O_WRONLY,

                                                    errp));

    if (!ioc) {

        return;

    }

    migration_set_outgoing_channel(s, ioc);

    object_unref(OBJECT(ioc));

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int rtc_start_timer(struct qemu_alarm_timer *t)

 {
+
     int rtc_fd;

     unsigned long current_rtc_freq = 0;

static int rtc_start_timer(struct qemu_alarm_timer *t)

{

    int rtc_fd;

    unsigned long current_rtc_freq = 0;

    TFR(rtc_fd = open("/dev/rtc", O_RDONLY));

    if (rtc_fd < 0)

        return -1;

    ioctl(rtc_fd, RTC_IRQP_READ, &current_rtc_freq);

    if (current_rtc_freq != RTC_FREQ &&

        ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) {

        fprintf(stderr, "Could not configure '/dev/rtc' to have a 1024 Hz timer. This is not a fatal\n"

                "error, but for better emulation accuracy either use a 2.6 host Linux kernel or\n"

                "type 'echo 1024 > /proc/sys/dev/rtc/max-user-freq' as root.\n");

        goto fail;

    }

    if (ioctl(rtc_fd, RTC_PIE_ON, 0) < 0) {

    fail:

        close(rtc_fd);

        return -1;

    }

    enable_sigio_timer(rtc_fd);

    t->priv = (void *)(long)rtc_fd;

    return 0;

}


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

         register_ioport_write(addr + 4, 4, 2, bmdma_addr_writew, bm);

+        register_ioport_read(addr + 4, 4, 2, bmdma_addr_readw, bm);
+
+        register_ioport_write(addr + 4, 4, 4, bmdma_addr_writel, bm);
+
+        register_ioport_read(addr + 4, 4, 4, bmdma_addr_readl, bm);

         addr += 8;

static void bmdma_map(PCIDevice *pci_dev, int region_num,

                    pcibus_t addr, pcibus_t size, int type)

{

    PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, pci_dev);

    int i;

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

        BMDMAState *bm = &d->bmdma[i];

        d->bus[i].bmdma = bm;

        bm->bus = d->bus+i;

        bm->pci_dev = d;

        qemu_add_vm_change_state_handler(ide_dma_restart_cb, bm);

        register_ioport_write(addr, 1, 1, bmdma_cmd_writeb, bm);

        register_ioport_write(addr + 1, 3, 1, bmdma_writeb, bm);

        register_ioport_read(addr, 4, 1, bmdma_readb, bm);

        register_ioport_write(addr + 4, 4, 1, bmdma_addr_writeb, bm);

        register_ioport_read(addr + 4, 4, 1, bmdma_addr_readb, bm);

        register_ioport_write(addr + 4, 4, 2, bmdma_addr_writew, bm);

        register_ioport_read(addr + 4, 4, 2, bmdma_addr_readw, bm);

        register_ioport_write(addr + 4, 4, 4, bmdma_addr_writel, bm);

        register_ioport_read(addr + 4, 4, 4, bmdma_addr_readl, bm);

        addr += 8;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int blkdebug_debug_resume(BlockDriverState *bs, const char *tag)

+{
+
     BDRVBlkdebugState *s = bs->opaque;

     BlkdebugSuspendedReq *r;

static int blkdebug_debug_resume(BlockDriverState *bs, const char *tag)

{

    BDRVBlkdebugState *s = bs->opaque;

    BlkdebugSuspendedReq *r;

    QLIST_FOREACH(r, &s->suspended_reqs, next) {

        if (!strcmp(r->tag, tag)) {

            qemu_coroutine_enter(r->co, NULL);

            return 0;

        }

    }

    return -ENOENT;

}


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

     c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;

+

     c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;

static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth,

                                      const int chroma_format_idc)

{

    if (bit_depth == 8) {

    c->h264_v_loop_filter_luma   = ff_h264_v_loop_filter_luma_neon;

    c->h264_h_loop_filter_luma   = ff_h264_h_loop_filter_luma_neon;

    c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;

    c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;

    c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;

    c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon;

    c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon;

    c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon;

    c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon;

    c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon;

    c->h264_idct_add        = ff_h264_idct_add_neon;

    c->h264_idct_dc_add     = ff_h264_idct_dc_add_neon;

    c->h264_idct_add16      = ff_h264_idct_add16_neon;

    c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;

    if (chroma_format_idc == 1)

        c->h264_idct_add8   = ff_h264_idct_add8_neon;

    c->h264_idct8_add       = ff_h264_idct8_add_neon;

    c->h264_idct8_dc_add    = ff_h264_idct8_dc_add_neon;

    c->h264_idct8_add4      = ff_h264_idct8_add4_neon;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,

                    AVFilterPad **pads, AVFilterLink ***links,
+
+                   AVFilterPad *newpad)

 {

void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,

                   AVFilterPad **pads, AVFilterLink ***links,

                   AVFilterPad *newpad)

{

    unsigned i;

    idx = FFMIN(idx, *count);

    *pads  = av_realloc(*pads,  sizeof(AVFilterPad)   * (*count + 1));

    *links = av_realloc(*links, sizeof(AVFilterLink*) * (*count + 1));

    memmove(*pads  + idx + 1, *pads  + idx, sizeof(AVFilterPad)   * (*count - idx));

    memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx));

    memcpy(*pads + idx, newpad, sizeof(AVFilterPad));

    (*links)[idx] = NULL;

    (*count)++;

    for (i = idx + 1; i < *count; i++)

        if (*links[i])

            (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;

}


--- a/source.c
+++ b/source.c
@@ -5,8 +5,8 @@
     switch (opsize) {

     case OS_BYTE: return 1;
+
+    case OS_WORD: return 2;

     case OS_LONG: return 4;

static inline int opsize_bytes(int opsize)

{

    switch (opsize) {

    case OS_BYTE: return 1;

    case OS_WORD: return 2;

    case OS_LONG: return 4;

    case OS_SINGLE: return 4;

    case OS_DOUBLE: return 8;

    default:

        qemu_assert(0, "bad operand size");

        return 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+av_cold void ff_h264_free_context(H264Context *h)
+
+{
+
+    int i;

av_cold void ff_h264_free_context(H264Context *h)

{

    int i;

    free_tables(h); //FIXME cleanup init stuff perhaps

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

        av_freep(h->sps_buffers + i);

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

        av_freep(h->pps_buffers + i);

}


--- a/source.c
+++ b/source.c
@@ -3,10 +3,10 @@
     SaveStateEntry *se;
     qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
     qemu_put_be32(f, QEMU_VM_FILE_VERSION);
+    cpu_synchronize_all_states();
+    QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
+        if (se->is_ram) {
+            continue;
         }
         if ((!se->ops || !se->ops->save_state) && !se->vmsd) {
             continue;

static int qemu_save_device_state(QEMUFile *f)
{
    SaveStateEntry *se;
    qemu_put_be32(f, QEMU_VM_FILE_MAGIC);
    qemu_put_be32(f, QEMU_VM_FILE_VERSION);
    cpu_synchronize_all_states();
    QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
        if (se->is_ram) {
            continue;
        }
        if ((!se->ops || !se->ops->save_state) && !se->vmsd) {
            continue;
        }
        save_section_header(f, se, QEMU_VM_SECTION_FULL);
        vmstate_save(f, se, NULL);
    }
    qemu_put_byte(f, QEMU_VM_EOF);
    return qemu_file_get_error(f);
}


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

     for (x = 0;  x < w; x++) {

+        int c = cur[-refs];
+
+        int d = (prev2[0] + next2[0])>>1;
+
+        int e = cur[+refs];

         int temporal_diff0 = FFABS(prev2[0] - next2[0]);

static void filter_line_c(uint8_t *dst,

                          uint8_t *prev, uint8_t *cur, uint8_t *next,

                          int w, int refs, int parity, int mode)

{

    int x;

    uint8_t *prev2 = parity ? prev : cur ;

    uint8_t *next2 = parity ? cur  : next;

    for (x = 0;  x < w; x++) {

        int c = cur[-refs];

        int d = (prev2[0] + next2[0])>>1;

        int e = cur[+refs];

        int temporal_diff0 = FFABS(prev2[0] - next2[0]);

        int temporal_diff1 =(FFABS(prev[-refs] - c) + FFABS(prev[+refs] - e) )>>1;

        int temporal_diff2 =(FFABS(next[-refs] - c) + FFABS(next[+refs] - e) )>>1;

        int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);

        int spatial_pred = (c+e)>>1;

        int spatial_score = FFABS(cur[-refs-1] - cur[+refs-1]) + FFABS(c-e)

                          + FFABS(cur[-refs+1] - cur[+refs+1]) - 1;

#define CHECK(j)\

    {   int score = FFABS(cur[-refs-1+j] - cur[+refs-1-j])\

                  + FFABS(cur[-refs  +j] - cur[+refs  -j])\

                  + FFABS(cur[-refs+1+j] - cur[+refs+1-j]);\

        if (score < spatial_score) {\

            spatial_score= score;\

            spatial_pred= (cur[-refs  +j] + cur[+refs  -j])>>1;\

        CHECK(-1) CHECK(-2) }} }}


static void dp8393x_writew(void *opaque, target_phys_addr_t addr, uint32_t val)

{

    dp8393xState *s = opaque;

    int reg;

    if ((addr & ((1 << s->it_shift) - 1)) != 0) {

        return;

    }

    reg = addr >> s->it_shift;

    write_register(s, reg, (uint16_t)val);

}


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

         char buf[QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT];
+
         QIOChannelWebsockHeader ws;

     } header;

static void qio_channel_websock_encode(QIOChannelWebsock *ioc)

{

    size_t header_size;

    union {

        char buf[QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT];

        QIOChannelWebsockHeader ws;

    } header;

    if (!ioc->rawoutput.offset) {

        return;

    }

    header.ws.b0 = (1 << QIO_CHANNEL_WEBSOCK_HEADER_SHIFT_FIN) |

        (QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME &

         QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE);

    if (ioc->rawoutput.offset <

        QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_7_BIT) {

        header.ws.b1 = (uint8_t)ioc->rawoutput.offset;

        header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_7_BIT;

    } else if (ioc->rawoutput.offset <

               QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_16_BIT) {

        header.ws.b1 = QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_16_BIT;

        header.ws.u.s16.l16 = cpu_to_be16((uint16_t)ioc->rawoutput.offset);

        header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_16_BIT;

    } else {

        header.ws.b1 = QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_64_BIT;

        header.ws.u.s64.l64 = cpu_to_be64(ioc->rawoutput.offset);

        header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT;

    }

    header_size -= QIO_CHANNEL_WEBSOCK_HEADER_LEN_MASK;

    buffer_reserve(&ioc->encoutput, header_size + ioc->rawoutput.offset);

    buffer_append(&ioc->encoutput, header.buf, header_size);

    buffer_append(&ioc->encoutput, ioc->rawoutput.buffer,

                  ioc->rawoutput.offset);

    buffer_reset(&ioc->rawoutput);

}


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

 {

+    int offset = 0;
+
+    int ret;
+
+    while (nb_sectors > NBD_MAX_SECTORS) {

         ret = nbd_co_writev_1(client, sector_num,

int nbd_client_session_co_writev(NbdClientSession *client, int64_t sector_num,

                                 int nb_sectors, QEMUIOVector *qiov)

{

    int offset = 0;

    int ret;

    while (nb_sectors > NBD_MAX_SECTORS) {

        ret = nbd_co_writev_1(client, sector_num,

                              NBD_MAX_SECTORS, qiov, offset);

        if (ret < 0) {

            return ret;

        }

        offset += NBD_MAX_SECTORS * 512;

        sector_num += NBD_MAX_SECTORS;

        nb_sectors -= NBD_MAX_SECTORS;

    }

    return nbd_co_writev_1(client, sector_num, nb_sectors, qiov, offset);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void scsi_dma_complete(void *opaque, int ret)

+{
+
+    SCSIDiskReq *r = (SCSIDiskReq *)opaque;
+
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);

static void scsi_dma_complete(void *opaque, int ret)

{

    SCSIDiskReq *r = (SCSIDiskReq *)opaque;

    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);

    bdrv_acct_done(s->qdev.conf.bs, &r->acct);

    if (ret) {

        if (scsi_handle_rw_error(r, -ret)) {

            goto done;

        }

    }

    r->sector += r->sector_count;

    r->sector_count = 0;

    scsi_req_complete(&r->req, GOOD);

done:

    if (!r->req.io_canceled) {

        scsi_req_unref(&r->req);

    }

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
             tag = mov_get_rawvideo_codec_tag(s, track);

         else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
+
+            tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
+
+            if (!tag) { // if no mac fcc found, try with Microsoft tags
+
                 tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id);

                 if (tag)

static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)

{

    int tag = track->enc->codec_tag;

    if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL &&

                 (tag == MKTAG('d','v','c','p') ||

                  track->enc->codec_id == CODEC_ID_RAWVIDEO ||

                  track->enc->codec_id == CODEC_ID_H263 ||

                  av_get_bits_per_sample(track->enc->codec_id)))) { // pcm audio

        if (track->enc->codec_id == CODEC_ID_DVVIDEO)

            tag = mov_get_dv_codec_tag(s, track);

        else if (track->enc->codec_id == CODEC_ID_RAWVIDEO)

            tag = mov_get_rawvideo_codec_tag(s, track);

        else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {

            tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id);

            if (!tag) { // if no mac fcc found, try with Microsoft tags

                tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id);

                if (tag)

                    av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, "

                           "the file may be unplayable!\n");

            }

        } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {

            tag = ff_codec_get_tag(codec_movaudio_tags, track->enc->codec_id);

            if (!tag) { // if no mac fcc found, try with Microsoft tags

                int ms_tag = ff_codec_get_tag(ff_codec_wav_tags, track->enc->codec_id);

                if (ms_tag) {

                    tag = MKTAG('m', 's', ((ms_tag >> 8) & 0xff), (ms_tag & 0xff));

                    av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, "

                           "the file may be unplayable!\n");

                }

            }

        } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)

            tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, track->enc->codec_id);

    }

    return tag;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static uint32_t parse_enumeration(char *str,
     EnumTable *table, uint32_t not_found_value)
 {
+    uint32_t ret = not_found_value;
+    while (table->name != NULL) {
+        if (strcmp(table->name, str) == 0) {
             ret = table->value;
             break;
         }

static uint32_t parse_enumeration(char *str,
    EnumTable *table, uint32_t not_found_value)
{
    uint32_t ret = not_found_value;
    while (table->name != NULL) {
        if (strcmp(table->name, str) == 0) {
            ret = table->value;
            break;
        }
        table++;
    }
    return ret;
}


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

         vdev->msix = NULL;

+    }
+
+    vfio_put_base_device(&vdev->vbasedev);
+
 }

static void vfio_put_device(VFIOPCIDevice *vdev)

{

    g_free(vdev->vbasedev.name);

    if (vdev->msix) {

        g_free(vdev->msix);

        vdev->msix = NULL;

    }

    vfio_put_base_device(&vdev->vbasedev);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void virtio_scsi_class_init(ObjectClass *klass, void *data)

 {
+
     DeviceClass *dc = DEVICE_CLASS(klass);

     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);

    dc->exit = virtio_scsi_device_exit;

    dc->props = virtio_scsi_properties;

    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);

    vdc->init = virtio_scsi_device_init;

    vdc->set_config = virtio_scsi_set_config;

    vdc->get_features = virtio_scsi_get_features;

    vdc->reset = virtio_scsi_reset;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 bool gs_allowed(void)

 {
+
+    if (kvm_enabled()) {
+
+        MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
+
         if (object_class_dynamic_cast(OBJECT_CLASS(mc),

                                       TYPE_S390_CCW_MACHINE)) {

bool gs_allowed(void)

{

    if (kvm_enabled()) {

        MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());

        if (object_class_dynamic_cast(OBJECT_CLASS(mc),

                                      TYPE_S390_CCW_MACHINE)) {

            S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);

            return s390mc->gs_allowed;

        }

        /* Make sure the "none" machine can have gs */

        return true;

    }

    return false;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     AVFilterBufferRef *samplesref =

         avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms,
+
+                                                  frame->nb_samples, frame->format,
+
+                                                  av_frame_get_channel_layout(frame));
+
     if (!samplesref)

         return NULL;

AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame,

                                                            int perms)

{

    AVFilterBufferRef *samplesref =

        avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms,

                                                  frame->nb_samples, frame->format,

                                                  av_frame_get_channel_layout(frame));

    if (!samplesref)

        return NULL;

    avfilter_copy_frame_props(samplesref, frame);

    return samplesref;

}


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

     OHCIPCIState *ohci = DO_UPCAST(OHCIPCIState, pci_dev, dev);

+    int num_ports = 3;
+
+
+
+    pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE);

     pci_config_set_device_id(ohci->pci_dev.config,

static int usb_ohci_initfn_pci(struct PCIDevice *dev)

{

    OHCIPCIState *ohci = DO_UPCAST(OHCIPCIState, pci_dev, dev);

    int num_ports = 3;

    pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE);

    pci_config_set_device_id(ohci->pci_dev.config,

                             PCI_DEVICE_ID_APPLE_IPID_USB);

    ohci->pci_dev.config[PCI_CLASS_PROG] = 0x10; /* OHCI */

    pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB);

    /* TODO: RST# value should be 0. */

    ohci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */

    usb_ohci_init(&ohci->state, &dev->qdev, num_ports, 0);

    ohci->state.irq = ohci->pci_dev.irq[0];

    /* TODO: avoid cast below by using dev */

    pci_register_bar_simple(&ohci->pci_dev, 0, 256, 0, ohci->state.mem);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,

                                     uint64_t id)
+
 {

     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);

USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,

                                    uint64_t id)

{

    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);

    USBPacket *p;

    while ((p = QTAILQ_FIRST(&uep->queue)) != NULL) {

        if (p->id == id) {

            return p;

        }

    }

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -47,11 +47,11 @@
         phys_val = le32_to_cpu(phys_val);

     }
+
+
+
+    val = (emu_val & emu_bits) | (phys_val & ~emu_bits);
+

     trace_vfio_pci_read_config(vdev->vbasedev.name, addr, len, val);

uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len)

{

    VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev);

    uint32_t emu_bits = 0, emu_val = 0, phys_val = 0, val;

    memcpy(&emu_bits, vdev->emulated_config_bits + addr, len);

    emu_bits = le32_to_cpu(emu_bits);

    if (emu_bits) {

        emu_val = pci_default_read_config(pdev, addr, len);

    }

    if (~emu_bits & (0xffffffffU >> (32 - len * 8))) {

        ssize_t ret;

        ret = pread(vdev->vbasedev.fd, &phys_val, len,

                    vdev->config_offset + addr);

        if (ret != len) {

            error_report("%s(%04x:%02x:%02x.%x, 0x%x, 0x%x) failed: %m",

                         __func__, vdev->host.domain, vdev->host.bus,

                         vdev->host.slot, vdev->host.function, addr, len);

            return -errno;

        }

        phys_val = le32_to_cpu(phys_val);

    }

    val = (emu_val & emu_bits) | (phys_val & ~emu_bits);

    trace_vfio_pci_read_config(vdev->vbasedev.name, addr, len, val);

    return val;

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 static void gen_tlbiva(DisasContext *ctx)
+
+{
+
+#if defined(CONFIG_USER_ONLY)

     gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

 #else

     TCGv t0;
+
     if (unlikely(ctx->pr)) {

         gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

static void gen_tlbiva(DisasContext *ctx)

{

#if defined(CONFIG_USER_ONLY)

    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

#else

    TCGv t0;

    if (unlikely(ctx->pr)) {

        gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

        return;

    }

    t0 = tcg_temp_new();

    gen_addr_reg_index(ctx, t0);

    gen_helper_tlbiva(cpu_env, cpu_gpr[rB(ctx->opcode)]);

    tcg_temp_free(t0);

#endif

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     uint32_t *pal = ctx->pal + 256 - ctx->free_colours;

+
     if (!ctx->free_colours)

         return 0;

static int decode_pal(MSS12Context *ctx, ArithCoder *acoder)

{

    int i, ncol, r, g, b;

    uint32_t *pal = ctx->pal + 256 - ctx->free_colours;

    if (!ctx->free_colours)

        return 0;

    ncol = arith_get_number(acoder, ctx->free_colours + 1);

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

        r = arith_get_bits(acoder, 8);

        g = arith_get_bits(acoder, 8);

        b = arith_get_bits(acoder, 8);

        *pal++ = (0xFF << 24) | (r << 16) | (g << 8) | b;

    }

    return !!ncol;

}


static int decode_cabac_mb_ref( H264Context *h, int list, int n ) {

    int refa = h->ref_cache[list][scan8[n] - 1];

    int refb = h->ref_cache[list][scan8[n] - 8];

    int ref  = 0;

    int ctx  = 0;

    if( h->slice_type_nos == FF_B_TYPE) {

        if( refa > 0 && !h->direct_cache[scan8[n] - 1] )

            ctx++;

        if( refb > 0 && !h->direct_cache[scan8[n] - 8] )

            ctx += 2;

    } else {

        if( refa > 0 )

            ctx++;

        if( refb > 0 )

            ctx += 2;

    }

    while( get_cabac( &h->cabac, &h->cabac_state[54+ctx] ) ) {

        ref++;

        if( ctx < 4 )

            ctx = 4;

        else

            ctx = 5;

        if(ref >= 32 /*h->ref_list[list]*/){

            av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_ref\n");

            return 0; //FIXME we should return -1 and check the return everywhere

        }

    }

    return ref;

}


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

     AC3EncodeContext *s = avctx->priv_data;
+
     const SampleType *samples = data;

     int ret;

static int ac3_encode_frame(AVCodecContext *avctx, unsigned char *frame,

                            int buf_size, void *data)

{

    AC3EncodeContext *s = avctx->priv_data;

    const SampleType *samples = data;

    int ret;

    if (s->bit_alloc.sr_code == 1)

        adjust_frame_size(s);

    deinterleave_input_samples(s, samples);

    apply_mdct(s);

    compute_rematrixing_strategy(s);

    scale_coefficients(s);

    apply_rematrixing(s);

    process_exponents(s);

    ret = compute_bit_allocation(s);

    if (ret) {

        av_log(avctx, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n");

        return ret;

    }

    quantize_mantissas(s);

    output_frame(s, frame);

    return s->frame_size;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
+
+{
+
+    ds1225y_t *NVRAM = opaque;
+
+    int64_t pos;

static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)

{

    ds1225y_t *NVRAM = opaque;

    int64_t pos;

    pos = addr - NVRAM->mem_base;

    if (ds1225y_set_to_mode(NVRAM, writemode, "wb"))

    {

        qemu_fseek(NVRAM->file, pos, SEEK_SET);

        qemu_put_byte(NVRAM->file, (int)value);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,

                               const char *fmt, va_list ap)
+
+{
+
+    V9fsState *s = pdu->s;

     V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);

ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size_t offset,

                              const char *fmt, va_list ap)

{

    V9fsState *s = pdu->s;

    V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);

    VirtQueueElement *elem = &v->elems[pdu->idx];

    return v9fs_iov_vunmarshal(elem->out_sg, elem->out_num, offset, 1, fmt, ap);

}


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

     int i;
+
+
+
+    for (i = 0; i < ARRAY_SIZE(s->slots); i++) {
+
         /* KVM private memory slots */

         if (i >= 8 && i < 12)

static KVMSlot *kvm_alloc_slot(KVMState *s)

{

    int i;

    for (i = 0; i < ARRAY_SIZE(s->slots); i++) {

        /* KVM private memory slots */

        if (i >= 8 && i < 12)

            continue;

        if (s->slots[i].memory_size == 0)

            return &s->slots[i];

    }

    fprintf(stderr, "%s: no free slot available\n", __func__);

    abort();

}


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

     struct sockaddr_in addr;

+    socklen_t addr_len = sizeof(addr);
+
+
+
+    int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len);

     nbd_started = true;

static void nbd_accept(void *opaque)

{

    int server_fd = (uintptr_t) opaque;

    struct sockaddr_in addr;

    socklen_t addr_len = sizeof(addr);

    int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len);

    nbd_started = true;

    if (fd >= 0 && nbd_client_new(exp, fd, nbd_client_closed)) {

        nb_fds++;

    }

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     VncServerInfo2 *info;

     Error *err = NULL;
+
+    SocketAddress *addr;
+
+
+
     addr = qio_channel_socket_get_local_address(ioc, &err);

     if (!addr) {

static VncServerInfo2List *qmp_query_server_entry(QIOChannelSocket *ioc,

                                                  bool websocket,

                                                  int auth,

                                                  int subauth,

                                                  VncServerInfo2List *prev)

{

    VncServerInfo2List *list;

    VncServerInfo2 *info;

    Error *err = NULL;

    SocketAddress *addr;

    addr = qio_channel_socket_get_local_address(ioc, &err);

    if (!addr) {

        error_free(err);

        return prev;

    }

    info = g_new0(VncServerInfo2, 1);

    vnc_init_basic_info(addr, qapi_VncServerInfo2_base(info), &err);

    qapi_free_SocketAddress(addr);

    if (err) {

        qapi_free_VncServerInfo2(info);

        error_free(err);

        return prev;

    }

    info->websocket = websocket;

    qmp_query_auth(auth, subauth, &info->auth,

                   &info->vencrypt, &info->has_vencrypt);

    list = g_new0(VncServerInfo2List, 1);

    list->value = info;

    list->next = prev;

    return list;

}


--- a/source.c
+++ b/source.c
@@ -21,7 +21,7 @@
     }

     slog("guest-file-open called, filepath: %s, mode: %s", path, mode);
+
     fh = safe_open_or_create(path, mode, &local_err);

     if (local_err != NULL) {

int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode,

                            Error **errp)

{

    FILE *fh;

    Error *local_err = NULL;

    int fd;

    int64_t ret = -1, handle;

    if (!has_mode) {

        mode = "r";

    }

    slog("guest-file-open called, filepath: %s, mode: %s", path, mode);

    fh = safe_open_or_create(path, mode, &local_err);

    if (local_err != NULL) {

        error_propagate(errp, local_err);

        return -1;

    }

    /* set fd non-blocking to avoid common use cases (like reading from a

     * named pipe) from hanging the agent

     */

    fd = fileno(fh);

    ret = fcntl(fd, F_GETFL);

    ret = fcntl(fd, F_SETFL, ret | O_NONBLOCK);

    if (ret == -1) {

        error_setg_errno(errp, errno, "failed to make file '%s' non-blocking",

                         path);

        fclose(fh);

        return -1;

    }

    handle = guest_file_handle_add(fh, errp);

    if (error_is_set(errp)) {

        fclose(fh);

        return -1;

    }

    slog("guest-file-open, handle: %" PRId64, handle);

    return handle;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,

                                   GetBitContext *gb, int id_aac)
+
 {
+
     unsigned int cnt = get_bits_count(gb);

static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,

                                  GetBitContext *gb, int id_aac)

{

    unsigned int cnt = get_bits_count(gb);

    if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {

        read_sbr_single_channel_element(ac, sbr, gb);

    } else if (id_aac == TYPE_CPE) {

        read_sbr_channel_pair_element(ac, sbr, gb);

    } else {

        av_log(ac->avccontext, AV_LOG_ERROR,

            "Invalid bitstream - cannot apply SBR to element type %d\n", id_aac);

        sbr->start = 0;

        return get_bits_count(gb) - cnt;

    }

    if (get_bits1(gb)) { // bs_extended_data

        int num_bits_left = get_bits(gb, 4); // bs_extension_size

        if (num_bits_left == 15)

            num_bits_left += get_bits(gb, 8); // bs_esc_count

        num_bits_left <<= 3;

        while (num_bits_left > 7) {

            num_bits_left -= 2;

            read_sbr_extension(ac, sbr, gb, get_bits(gb, 2), &num_bits_left); // bs_extension_id

        }

    }

    return get_bits_count(gb) - cnt;

}


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

     if (dc->rd) {

+        gen_load(dc, cpu_R[dc->rd], *addr, size);
+
+    } else {
+
+        gen_load(dc, env_imm, *addr, size);

static void dec_load(DisasContext *dc)

{

    TCGv t, *addr;

    unsigned int size;

    size = 1 << (dc->opcode & 3);

    LOG_DIS("l %x %d\n", dc->opcode, size);

    t_sync_flags(dc);

    addr = compute_ldst_addr(dc, &t);

    /* If we get a fault on a dslot, the jmpstate better be in sync.  */

    sync_jmpstate(dc);

    /* Verify alignment if needed.  */

    if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) {

        gen_helper_memalign(*addr, tcg_const_tl(dc->rd),

                            tcg_const_tl(0), tcg_const_tl(size - 1));

    if (dc->rd) {

        gen_load(dc, cpu_R[dc->rd], *addr, size);

    } else {

        gen_load(dc, env_imm, *addr, size);

    if (addr == &t)

        tcg_temp_free(t);


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

     async->uhci  = s;

+    async->valid = 0;
+
+    async->td    = 0;
+
+    async->token = 0;

     async->done  = 0;

static UHCIAsync *uhci_async_alloc(UHCIState *s)

{

    UHCIAsync *async = g_malloc(sizeof(UHCIAsync));

    memset(&async->packet, 0, sizeof(async->packet));

    async->uhci  = s;

    async->valid = 0;

    async->td    = 0;

    async->token = 0;

    async->done  = 0;

    async->isoc  = 0;

    usb_packet_init(&async->packet);

    qemu_sglist_init(&async->sgl, 1);

    return async;

}


--- a/source.c
+++ b/source.c
@@ -65,11 +65,11 @@
             res_out = req->data_len;

         } else {
+
+            res_in = req->data_len;
+
+        }
+
     }

     vscsi_send_rsp(s, req, status, res_in, res_out);

static void vscsi_command_complete(SCSIRequest *sreq, uint32_t status)

{

    VSCSIState *s = DO_UPCAST(VSCSIState, vdev.qdev, sreq->bus->qbus.parent);

    vscsi_req *req = sreq->hba_private;

    int32_t res_in = 0, res_out = 0;

    dprintf("VSCSI: SCSI cmd complete, r=0x%x tag=0x%x status=0x%x, req=%p\n",

            reason, sreq->tag, status, req);

    if (req == NULL) {

        fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", sreq->tag);

        return;

    }

    if (status == CHECK_CONDITION) {

        req->senselen = scsi_req_get_sense(req->sreq, req->sense,

                                           sizeof(req->sense));

        status = 0;

        dprintf("VSCSI: Sense data, %d bytes:\n", len);

        dprintf("       %02x  %02x  %02x  %02x  %02x  %02x  %02x  %02x\n",

                req->sense[0], req->sense[1], req->sense[2], req->sense[3],

                req->sense[4], req->sense[5], req->sense[6], req->sense[7]);

        dprintf("       %02x  %02x  %02x  %02x  %02x  %02x  %02x  %02x\n",

                req->sense[8], req->sense[9], req->sense[10], req->sense[11],

                req->sense[12], req->sense[13], req->sense[14], req->sense[15]);

    }

    dprintf("VSCSI: Command complete err=%d\n", status);

    if (status == 0) {

        /* We handle overflows, not underflows for normal commands,

         * but hopefully nobody cares

         */

        if (req->writing) {

            res_out = req->data_len;

        } else {

            res_in = req->data_len;

        }

    }

    vscsi_send_rsp(s, req, status, res_in, res_out);

    vscsi_put_req(req);

}


--- a/source.c
+++ b/source.c
@@ -49,11 +49,11 @@
     put_bits(&pb, 2, 0);        /* number_of_raw_data_blocks_in_frame */

+
+    flush_put_bits(&pb);
+
+
+
     return 0;

 }

int ff_adts_write_frame_header(ADTSContext *ctx,

                               uint8_t *buf, int size, int pce_size)

{

    PutBitContext pb;

    init_put_bits(&pb, buf, ADTS_HEADER_SIZE);

    /* adts_fixed_header */

    put_bits(&pb, 12, 0xfff);   /* syncword */

    put_bits(&pb, 1, 0);        /* ID */

    put_bits(&pb, 2, 0);        /* layer */

    put_bits(&pb, 1, 1);        /* protection_absent */

    put_bits(&pb, 2, ctx->objecttype); /* profile_objecttype */

    put_bits(&pb, 4, ctx->sample_rate_index);

    put_bits(&pb, 1, 0);        /* private_bit */

    put_bits(&pb, 3, ctx->channel_conf); /* channel_configuration */

    put_bits(&pb, 1, 0);        /* original_copy */

    put_bits(&pb, 1, 0);        /* home */

    /* adts_variable_header */

    put_bits(&pb, 1, 0);        /* copyright_identification_bit */

    put_bits(&pb, 1, 0);        /* copyright_identification_start */

    put_bits(&pb, 13, ADTS_HEADER_SIZE + size + pce_size); /* aac_frame_length */

    put_bits(&pb, 11, 0x7ff);   /* adts_buffer_fullness */

    put_bits(&pb, 2, 0);        /* number_of_raw_data_blocks_in_frame */

    flush_put_bits(&pb);

    return 0;

}


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

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

+        if (iov_off < (iovec_off + iov[i].iov_len)) {
+
+            size_t len = MIN((iovec_off + iov[i].iov_len) - iov_off , size);
+
+

             memset(iov[i].iov_base + (iov_off - iovec_off), fillc, len);

size_t iov_memset(const struct iovec *iov, const unsigned int iov_cnt,

                 size_t iov_off, int fillc, size_t size)

{

    size_t iovec_off, buf_off;

    unsigned int i;

    iovec_off = 0;

    buf_off = 0;

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

        if (iov_off < (iovec_off + iov[i].iov_len)) {

            size_t len = MIN((iovec_off + iov[i].iov_len) - iov_off , size);

            memset(iov[i].iov_base + (iov_off - iovec_off), fillc, len);

            buf_off += len;

            iov_off += len;

            size -= len;

        }

        iovec_off += iov[i].iov_len;

    }

    return buf_off;

}


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

     return mknod(rpath(ctx, path), mode, dev);
+
 }

static int local_mknod(FsContext *ctx, const char *path, mode_t mode, dev_t dev)

{

    return mknod(rpath(ctx, path), mode, dev);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void DBDMA_run (DBDMA_channel *ch)

 {
+
+    int channel;
+
+

     for (channel = 0; channel < DBDMA_CHANNELS; channel++, ch++) {

static void DBDMA_run (DBDMA_channel *ch)

{

    int channel;

    for (channel = 0; channel < DBDMA_CHANNELS; channel++, ch++) {

            uint32_t status = be32_to_cpu(ch->regs[DBDMA_STATUS]);

            if (!ch->processing && (status & RUN) && (status & ACTIVE))

                channel_run(ch);

    }

}


static int parse_tag(AVFormatContext *s, const uint8_t *buf)

{

    int genre;

    if (!(buf[0] == 'T' &&

          buf[1] == 'A' &&

          buf[2] == 'G'))

        return -1;

    get_string(s, "title",   buf +  3, 30);

    get_string(s, "artist",  buf + 33, 30);

    get_string(s, "album",   buf + 63, 30);

    get_string(s, "date",    buf + 93,  4);

    get_string(s, "comment", buf + 97, 30);

    if (buf[125] == 0 && buf[126] != 0)

        av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL);

    genre = buf[127];

    if (genre <= ID3v1_GENRE_MAX)

        av_metadata_set2(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void cpu_single_step(CPUState *cpu, int enabled)

+{
+
+#if defined(TARGET_HAS_ICE)
+
+    if (cpu->singlestep_enabled != enabled) {

         cpu->singlestep_enabled = enabled;

void cpu_single_step(CPUState *cpu, int enabled)

{

#if defined(TARGET_HAS_ICE)

    if (cpu->singlestep_enabled != enabled) {

        cpu->singlestep_enabled = enabled;

        if (kvm_enabled()) {

            kvm_update_guest_debug(cpu, 0);

        } else {

            /* must flush all the translated code to avoid inconsistencies */

            /* XXX: only flush what is necessary */

            CPUArchState *env = cpu->env_ptr;

            tb_flush(env);

        }

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)

+{
+
     if (max_packet_size <= 0)

         return -1;

int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)

{

    if (max_packet_size <= 0)

        return -1;

    return url_open_dyn_buf_internal(s, max_packet_size);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)
+
+{
+
+    w->s = s;

     x8_vlc_init();

av_cold void ff_intrax8_common_init(IntraX8Context *w, MpegEncContext *const s)

{

    w->s = s;

    x8_vlc_init();

    assert(s->mb_width > 0);

    // two rows, 2 blocks per cannon mb

    w->prediction_table = av_mallocz(s->mb_width * 2 * 2);

    ff_init_scantable(s->idsp.idct_permutation, &w->scantable[0],

                      ff_wmv1_scantable[0]);

    ff_init_scantable(s->idsp.idct_permutation, &w->scantable[1],

                      ff_wmv1_scantable[2]);

    ff_init_scantable(s->idsp.idct_permutation, &w->scantable[2],

                      ff_wmv1_scantable[3]);

    ff_intrax8dsp_init(&w->dsp);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int qemu_socket(int domain, int type, int protocol)

 {
+
     int ret;

+
 #ifdef SOCK_CLOEXEC

     ret = socket(domain, type | SOCK_CLOEXEC, protocol);

int qemu_socket(int domain, int type, int protocol)

{

    int ret;

#ifdef SOCK_CLOEXEC

    ret = socket(domain, type | SOCK_CLOEXEC, protocol);

#else

    ret = socket(domain, type, protocol);

    if (ret >= 0) {

        qemu_set_cloexec(ret);

    }

#endif

    return ret;

}


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

 {

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

                                 ptrdiff_t stride)

{

    avc_luma_hz_qrt_16w_msa(src - 2, stride, dst, stride, 16, 0);

}


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

         value = *obj;

+        v->type_int64(v, &value, name, errp);
+
+        if (value < 0 || value > UINT32_MAX) {
+
+            /* FIXME questionable reuse of errp if callback changed

                value on error */

void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp)

{

    int64_t value;

    if (v->type_uint32) {

        v->type_uint32(v, obj, name, errp);

    } else {

        value = *obj;

        v->type_int64(v, &value, name, errp);

        if (value < 0 || value > UINT32_MAX) {

            /* FIXME questionable reuse of errp if callback changed

               value on error */

            error_setg(errp, QERR_INVALID_PARAMETER_VALUE,

                       name ? name : "null", "uint32_t");

            return;

        }

        *obj = value;

    }

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
         port->dev = dev;

         port->ops->attach(port);
+
+        usb_send_msg(dev, USB_MSG_ATTACH);
+
+    } else {
+
         /* detach */

         dev = port->dev;

void usb_attach(USBPort *port, USBDevice *dev)

{

    if (dev != NULL) {

        /* attach */

        if (port->dev) {

            usb_attach(port, NULL);

        }

        dev->port = port;

        port->dev = dev;

        port->ops->attach(port);

        usb_send_msg(dev, USB_MSG_ATTACH);

    } else {

        /* detach */

        dev = port->dev;

        port->ops->detach(port);

        if (dev) {

            usb_send_msg(dev, USB_MSG_DETACH);

            dev->port = NULL;

            port->dev = NULL;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
+
+{

+    int i;

void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))

{

    int i;

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

        (*cpu_fprintf)(f, "PowerPC %-16s PVR %08x\n",

                       ppc_defs[i].name, ppc_defs[i].pvr);

        if (strcmp(ppc_defs[i].name, "default") == 0)

            break;

    }

}


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

     }

+
+
+    vnc_init_basic_info(addr, info, errp);
+
+    qapi_free_SocketAddress(addr);

 }

static void vnc_init_basic_info_from_remote_addr(QIOChannelSocket *ioc,

                                                 VncBasicInfo *info,

                                                 Error **errp)

{

    SocketAddress *addr = NULL;

    addr = qio_channel_socket_get_remote_address(ioc, errp);

    if (!addr) {

        return;

    }

    vnc_init_basic_info(addr, info, errp);

    qapi_free_SocketAddress(addr);

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     VAAPIEncodeH265Options  *opt = ctx->codec_options;

+
+    priv->fixed_qp_p = opt->qp;
+
+    if (avctx->i_quant_factor > 0.0)
+
         priv->fixed_qp_idr = (int)((priv->fixed_qp_p * avctx->i_quant_factor +

                                     avctx->i_quant_offset) + 0.5);

static av_cold int vaapi_encode_h265_init_fixed_qp(AVCodecContext *avctx)

{

    VAAPIEncodeContext      *ctx = avctx->priv_data;

    VAAPIEncodeH265Context *priv = ctx->priv_data;

    VAAPIEncodeH265Options  *opt = ctx->codec_options;

    priv->fixed_qp_p = opt->qp;

    if (avctx->i_quant_factor > 0.0)

        priv->fixed_qp_idr = (int)((priv->fixed_qp_p * avctx->i_quant_factor +

                                    avctx->i_quant_offset) + 0.5);

    else

        priv->fixed_qp_idr = priv->fixed_qp_p;

    if (avctx->b_quant_factor > 0.0)

        priv->fixed_qp_b = (int)((priv->fixed_qp_p * avctx->b_quant_factor +

                                  avctx->b_quant_offset) + 0.5);

    else

        priv->fixed_qp_b = priv->fixed_qp_p;

    av_log(avctx, AV_LOG_DEBUG, "Using fixed QP = "

           "%d / %d / %d for IDR- / P- / B-frames.\n",

           priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+static int alloc_table(VLC *vlc, int size)

 {

     int index;

+    index = vlc->table_size;

     vlc->table_size += size;

static int alloc_table(VLC *vlc, int size)

{

    int index;

    index = vlc->table_size;

    vlc->table_size += size;

    if (vlc->table_size > vlc->table_allocated) {

        vlc->table_allocated += (1 << vlc->bits);

        vlc->table = av_realloc(vlc->table,

                                sizeof(VLC_TYPE) * 2 * vlc->table_allocated);

        if (!vlc->table)

            return -1;

    }

    return index;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void vnc_tight_start(VncState *vs)
+
+{

     buffer_reset(&vs->tight);

static void vnc_tight_start(VncState *vs)

{

    buffer_reset(&vs->tight);

    // make the output buffer be the zlib buffer, so we can compress it later

    vs->tight_tmp = vs->output;

    vs->output = vs->tight;

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     default:

         break;
+
+    }
+
+
+
     avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);

     avctx->block_align           = avctx->channels * avctx->bits_per_coded_sample / 8;

static av_cold int pcm_encode_init(AVCodecContext *avctx)

{

    avctx->frame_size = 0;

    switch (avctx->codec->id) {

    case AV_CODEC_ID_PCM_ALAW:

        pcm_alaw_tableinit();

        break;

    case AV_CODEC_ID_PCM_MULAW:

        pcm_ulaw_tableinit();

        break;

    default:

        break;

    }

    avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);

    avctx->block_align           = avctx->channels * avctx->bits_per_coded_sample / 8;

    avctx->bit_rate              = avctx->block_align * avctx->sample_rate * 8;

    avctx->coded_frame           = av_frame_alloc();

    if (!avctx->coded_frame)

        return AVERROR(ENOMEM);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void ehci_queues_rip_device(EHCIState *ehci, USBDevice *dev)

 {
+
     EHCIQueue *q, *tmp;

static void ehci_queues_rip_device(EHCIState *ehci, USBDevice *dev)

{

    EHCIQueue *q, *tmp;

    QTAILQ_FOREACH_SAFE(q, &ehci->queues, next, tmp) {

        if (q->packet.owner == NULL ||

            q->packet.owner->dev != dev) {

            continue;

        }

        ehci_free_queue(q);

    }

}


static void spice_register_types(void)

{

    qemu_spice_init();

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int xen_init(MachineState *ms)

+{

     xen_xc = xen_xc_interface_open(0, 0, 0);

static int xen_init(MachineState *ms)

{

    xen_xc = xen_xc_interface_open(0, 0, 0);

    if (xen_xc == XC_HANDLER_INITIAL_VALUE) {

        xen_be_printf(NULL, 0, "can't open xen interface\n");

    qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);

    global_state_set_optional();

    savevm_skip_configuration();

    savevm_skip_section_footers();

    return 0;


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

 {

+    ProresContext *ctx = avctx->priv_data;

     LOCAL_ALIGNED_16(int16_t, blocks, [8*4*64]);

static int decode_slice_luma(AVCodecContext *avctx, SliceContext *slice,

                             uint16_t *dst, int dst_stride,

                             const uint8_t *buf, unsigned buf_size,

                             const int16_t *qmat)

{

    ProresContext *ctx = avctx->priv_data;

    LOCAL_ALIGNED_16(int16_t, blocks, [8*4*64]);

    int16_t *block;

    GetBitContext gb;

    int i, blocks_per_slice = slice->mb_count<<2;

    int ret;

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

        ctx->bdsp.clear_block(blocks+(i<<6));

    init_get_bits(&gb, buf, buf_size << 3);

    decode_dc_coeffs(&gb, blocks, blocks_per_slice);

    if ((ret = decode_ac_coeffs(avctx, &gb, blocks, blocks_per_slice)) < 0)

        return ret;

    block = blocks;

    for (i = 0; i < slice->mb_count; i++) {

        ctx->prodsp.idct_put(dst, dst_stride, block+(0<<6), qmat);

        ctx->prodsp.idct_put(dst             +8, dst_stride, block+(1<<6), qmat);

        ctx->prodsp.idct_put(dst+4*dst_stride  , dst_stride, block+(2<<6), qmat);

        ctx->prodsp.idct_put(dst+4*dst_stride+8, dst_stride, block+(3<<6), qmat);

        block += 4*64;

        dst += 16;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void op_flush_icache_all(void) {

     CALL_FROM_TB1(tb_flush, env);

void op_flush_icache_all(void) {

    CALL_FROM_TB1(tb_flush, env);

    RETURN();

}


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

     pthread_mutex_lock(&lock);

+    ret = aiocb->ret;
+
+    pthread_mutex_unlock(&lock);
+

     return ret;

ssize_t qemu_paio_return(struct qemu_paiocb *aiocb)

{

    ssize_t ret;

    pthread_mutex_lock(&lock);

    ret = aiocb->ret;

    pthread_mutex_unlock(&lock);

    return ret;

}


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

     ohci->sof_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+
+    timer_mod(ohci->eof_timer, ohci->sof_time + usb_frame_time);

     ohci_set_interrupt(ohci, OHCI_INTR_SF);

static void ohci_sof(OHCIState *ohci)

{

    ohci->sof_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);

    timer_mod(ohci->eof_timer, ohci->sof_time + usb_frame_time);

    ohci_set_interrupt(ohci, OHCI_INTR_SF);

}


static int handle_ping(URLContext *s, RTMPPacket *pkt)

{

    RTMPContext *rt = s->priv_data;

    int t, ret;

    if (pkt->data_size < 2) {

        av_log(s, AV_LOG_ERROR, "Too short ping packet (%d)\n",

               pkt->data_size);

        return AVERROR_INVALIDDATA;

    t = AV_RB16(pkt->data);

    if (t == 6) {

        if ((ret = gen_pong(s, rt, pkt)) < 0)

    return 0;


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode)

+{

     int fd, ret;

static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode)

{

    int fd, ret;

    /* FIXME: this should be handled with fchmodat(AT_SYMLINK_NOFOLLOW).

     * Unfortunately, the linux kernel doesn't implement it yet. As an

     * alternative, let's open the file and use fchmod() instead. This

     * may fail depending on the permissions of the file, but it is the

     * best we can do to avoid TOCTTOU. We first try to open read-only

     * in case name points to a directory. If that fails, we try write-only

     * in case name doesn't point to a directory.

     */

    fd = openat_file(dirfd, name, O_RDONLY, 0);

    if (fd == -1) {

        /* In case the file is writable-only and isn't a directory. */

        if (errno == EACCES) {

            fd = openat_file(dirfd, name, O_WRONLY, 0);

        }

        if (fd == -1 && errno == EISDIR) {

            errno = EACCES;

        }

    }

    if (fd == -1) {

        return -1;

    }

    ret = fchmod(fd, mode);

    close_preserve_errno(fd);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int match_group_separator(const OptionGroupDef *groups, const char *opt)

+{
+
+    const OptionGroupDef *p = groups;
+
+

     while (p->name) {

static int match_group_separator(const OptionGroupDef *groups, const char *opt)

{

    const OptionGroupDef *p = groups;

    while (p->name) {

        if (p->sep && !strcmp(p->sep, opt))

            return p - groups;

        p++;

    }

    return -1;

}


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

     }

+    memset(output[3], 0, sizeof(output[3]));
+
+    memset(output[4], 0, sizeof(output[4]));
+
+}

static inline void mix_2f_2r_to_dolby(AC3DecodeContext *ctx)

{

    int i;

    float (*output)[256] = ctx->audio_block.block_output;

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

        output[1][i] -= output[3][i];

        output[2][i] += output[4][i];

    }

    memset(output[3], 0, sizeof(output[3]));

    memset(output[4], 0, sizeof(output[4]));

}


--- 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
@@ -4,8 +4,8 @@

     PXBDev *pxb = PXB_DEV(pci_dev);

+
+
     pxb_dev_list = g_list_remove(pxb_dev_list, pxb);

 }

static void pxb_dev_exitfn(PCIDevice *pci_dev)

{

    PXBDev *pxb = PXB_DEV(pci_dev);

    pxb_dev_list = g_list_remove(pxb_dev_list, pxb);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static bool xen_host_pci_dev_is_virtfn(XenHostPCIDevice *d)

 {
+
+    char path[PATH_MAX];

     struct stat buf;

static bool xen_host_pci_dev_is_virtfn(XenHostPCIDevice *d)

{

    char path[PATH_MAX];

    struct stat buf;

    if (xen_host_pci_sysfs_path(d, "physfn", path, sizeof (path))) {

        return false;

    }

    return !stat(path, &buf);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void qemu_mutex_unlock(QemuMutex *mutex)
+
+{
+
     assert(mutex->owner == GetCurrentThreadId());

     mutex->owner = 0;

void qemu_mutex_unlock(QemuMutex *mutex)

{

    assert(mutex->owner == GetCurrentThreadId());

    mutex->owner = 0;

    LeaveCriticalSection(&mutex->lock);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int test_vector_fmac_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,

                                    const float *v1, const float *src0, float scale)
+
+{
+
+    LOCAL_ALIGNED(32, float, cdst, [LEN]);
+
     LOCAL_ALIGNED(32, float, odst, [LEN]);

     int ret;

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

                                   const float *v1, const float *src0, float scale)

{

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

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

    int ret;

    memcpy(cdst, v1, LEN * sizeof(*v1));

    memcpy(odst, v1, LEN * sizeof(*v1));

    cdsp->vector_fmac_scalar(cdst, src0, scale, LEN);

    fdsp->vector_fmac_scalar(odst, src0, scale, LEN);

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

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

    return ret;

}


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

 {

+    object_unparent(obj);

     g_assert(obj->ref == 1);

void object_delete(Object *obj)

{

    object_unparent(obj);

    g_assert(obj->ref == 1);

    object_unref(obj);

    g_free(obj);

}


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

     pixel *dest = (pixel *)dest_;
+
     int i;

void FUNC(ff_simple_idct_put)(uint8_t *dest_, int line_size, DCTELEM *block)

{

    pixel *dest = (pixel *)dest_;

    int i;

    line_size /= sizeof(pixel);

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

        FUNC(idctRowCondDC)(block + i*8);

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

        FUNC(idctSparseColPut)(dest + i, line_size, block + i);

}


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

     size_t pagesize_bits =

+        qemu_ram_pagesize(pss->block) >> TARGET_PAGE_BITS;

static int ram_save_host_page(RAMState *rs, PageSearchStatus *pss,

                              bool last_stage)

{

    int tmppages, pages = 0;

    size_t pagesize_bits =

        qemu_ram_pagesize(pss->block) >> TARGET_PAGE_BITS;

    do {

        tmppages = ram_save_target_page(rs, pss, last_stage);

        if (tmppages < 0) {

            return tmppages;

        }

        pages += tmppages;

        pss->page++;

    } while (pss->page & (pagesize_bits - 1));

    /* The offset we leave with is the last one we looked at */

    pss->page--;

    return pages;

}


--- a/source.c
+++ b/source.c
@@ -5,5 +5,5 @@
     bdrv_register(&bdrv_raw);

     bdrv_register(&bdrv_host_device);
+
+}

static void bdrv_raw_init(void)

{

    bdrv_register(&bdrv_raw);

    bdrv_register(&bdrv_host_device);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static void test_parse_invalid_path_subprocess(void)
+
 {

     qemu_set_log_filename("/tmp/qemu-%d%d.log");

static void test_parse_invalid_path_subprocess(void)

{

    qemu_set_log_filename("/tmp/qemu-%d%d.log");

}


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

     result->rkey = ntohl(result->rkey);
+
+    result->host_addr = ntohll(result->host_addr);

 };

static void network_to_result(RDMARegisterResult *result)

{

    result->rkey = ntohl(result->rkey);

    result->host_addr = ntohll(result->host_addr);

};


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

+    ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
+
+    if (ret < 0 && !(flags & AVSEEK_FLAG_BACKWARD) &&
+
+        left < cat->nb_files - 1 &&

         cat->files[left + 1].start_time < max_ts) {

static int real_seek(AVFormatContext *avf, int stream,

                     int64_t min_ts, int64_t ts, int64_t max_ts, int flags)

{

    ConcatContext *cat = avf->priv_data;

    int ret, left, right;

    if (stream >= 0) {

        if (stream >= avf->nb_streams)

            return AVERROR(EINVAL);

        rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q,

                         &min_ts, &ts, &max_ts);

    }

    left  = 0;

    right = cat->nb_files;

    while (right - left > 1) {

        int mid = (left + right) / 2;

        if (ts < cat->files[mid].start_time)

            right = mid;

        else

            left  = mid;

    }

    if ((ret = open_file(avf, left)) < 0)

        return ret;

    ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);

    if (ret < 0 && !(flags & AVSEEK_FLAG_BACKWARD) &&

        left < cat->nb_files - 1 &&

        cat->files[left + 1].start_time < max_ts) {

        if ((ret = open_file(avf, left + 1)) < 0)

            return ret;

        ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static uint64_t itc_tag_read(void *opaque, hwaddr addr, unsigned size)

 {
+
+    MIPSITUState *tag = (MIPSITUState *)opaque;
+
+    uint64_t index = addr >> 3;
+
     uint64_t ret = 0;

+

     switch (index) {

static uint64_t itc_tag_read(void *opaque, hwaddr addr, unsigned size)

{

    MIPSITUState *tag = (MIPSITUState *)opaque;

    uint64_t index = addr >> 3;

    uint64_t ret = 0;

    switch (index) {

    case 0 ... ITC_ADDRESSMAP_NUM:

        ret = tag->ITCAddressMap[index];

        break;

    default:

        qemu_log_mask(LOG_GUEST_ERROR, "Read 0x%" PRIx64 "\n", addr);

        break;

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
+static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs,
+
+                                         int64_t sector_num,
+
+                                         QEMUIOVector *qiov,

+                                         int nb_sectors,
+
+                                         BlockDriverCompletionFunc *cb,

                                          void *opaque)
+
 {

     BDRVQuorumState *s = bs->opaque;

static BlockDriverAIOCB *quorum_aio_readv(BlockDriverState *bs,

                                         int64_t sector_num,

                                         QEMUIOVector *qiov,

                                         int nb_sectors,

                                         BlockDriverCompletionFunc *cb,

                                         void *opaque)

{

    BDRVQuorumState *s = bs->opaque;

    QuorumAIOCB *acb = quorum_aio_get(s, bs, qiov, sector_num,

                                      nb_sectors, cb, opaque);

    int i;

    acb->is_read = true;

    for (i = 0; i < s->num_children; i++) {

        acb->qcrs[i].buf = qemu_blockalign(s->bs[i], qiov->size);

        qemu_iovec_init(&acb->qcrs[i].qiov, qiov->niov);

        qemu_iovec_clone(&acb->qcrs[i].qiov, qiov, acb->qcrs[i].buf);

    }

    for (i = 0; i < s->num_children; i++) {

        bdrv_aio_readv(s->bs[i], sector_num, &acb->qcrs[i].qiov, nb_sectors,

                       quorum_aio_cb, &acb->qcrs[i]);

    }

    return &acb->common;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int64_t coroutine_fn vvfat_co_get_block_status(BlockDriverState *bs,
+
+	int64_t sector_num, int nb_sectors, int *n, BlockDriverState **file)

 {

static int64_t coroutine_fn vvfat_co_get_block_status(BlockDriverState *bs,

	int64_t sector_num, int nb_sectors, int *n, BlockDriverState **file)

{

    BDRVVVFATState* s = bs->opaque;

    *n = s->sector_count - sector_num;

    if (*n > nb_sectors) {

        *n = nb_sectors;

    } else if (*n < 0) {

        return 0;

    }

    return BDRV_BLOCK_DATA;

}


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

     IDCT_START

+
+
+    // pixels are signed; so add 128*16 in addition to the normal 8
+
+    vec_s16 v2048 = vec_sl(vec_splat_s16(1), vec_splat_u16(11));

     eight = vec_add(eight, v2048);

void ff_vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64])

{

    vec_u8 t;

    IDCT_START

    // pixels are signed; so add 128*16 in addition to the normal 8

    vec_s16 v2048 = vec_sl(vec_splat_s16(1), vec_splat_u16(11));

    eight = vec_add(eight, v2048);

    IDCT_1D(NOP, NOP)

    TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);

    IDCT_1D(ADD8, SHIFT4)

#define PUT(a)\

    t = vec_packsu(a, a);\

    vec_ste((vec_u32)t, 0, (unsigned int *)dst);\

    vec_ste((vec_u32)t, 4, (unsigned int *)dst);

    PUT(b0)     dst += stride;

    PUT(b1)     dst += stride;

    PUT(b2)     dst += stride;

    PUT(b3)     dst += stride;

    PUT(b4)     dst += stride;

    PUT(b5)     dst += stride;

    PUT(b6)     dst += stride;

    PUT(b7)

}


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

     int i;
+
+    PCIBus *bus = find_i440fx();
+
+
+
     if (!bus) {

         /* Only PIIX supports ACPI hotplug */

static void acpi_get_hotplug_info(AcpiMiscInfo *misc)

{

    int i;

    PCIBus *bus = find_i440fx();

    if (!bus) {

        /* Only PIIX supports ACPI hotplug */

        memset(misc->slot_hotplug_enable, 0, sizeof misc->slot_hotplug_enable);

        return;

    }

    memset(misc->slot_hotplug_enable, 0xff,

           DIV_ROUND_UP(PCI_SLOT_MAX, BITS_PER_BYTE));

    for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) {

        PCIDeviceClass *pc;

        PCIDevice *pdev = bus->devices[i];

        if (!pdev) {

            continue;

        }

        pc = PCI_DEVICE_GET_CLASS(pdev);

        if (pc->no_hotplug) {

            int slot = PCI_SLOT(i);

            clear_bit(slot, misc->slot_hotplug_enable);

        }

    }

}


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

     return ff_vaapi_encode_init(avctx, &vaapi_encode_type_mjpeg);

+}

static av_cold int vaapi_encode_mjpeg_init(AVCodecContext *avctx)

{

    return ff_vaapi_encode_init(avctx, &vaapi_encode_type_mjpeg);

}


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

     }

+    if (bits_left > 0) {
+
+        put_bits(pb, bits_left, get_bits(gb, bits_left));
+
+    }

 }

static inline void bit_copy(PutBitContext *pb, GetBitContext *gb)

{

    int bits_left = get_bits_left(gb);

    while (bits_left >= 16) {

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

        bits_left -= 16;

    }

    if (bits_left > 0) {

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

    }

}


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

 ) {
+
     struct addrinfo hints;

     struct addrinfo *server;

connect_to_qemu(

    const char *host,

    const char *port

) {

    struct addrinfo hints;

    struct addrinfo *server;

    int ret, sock;

    sock = qemu_socket(AF_INET, SOCK_STREAM, 0);

    if (sock < 0) {

        /* Error */

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

        return -1;

    }

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

    hints.ai_family = AF_UNSPEC;

    hints.ai_socktype = SOCK_STREAM;

    hints.ai_flags = 0;

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

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

    if (ret != 0) {

        /* Error */

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

        return -1;

    }

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

        /* Error */

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

        return -1;

    }

    if (verbose) {

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

    }

    return sock;

}


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

+    if (action == BLOCK_ERR_IGNORE) {
+
+        bdrv_mon_event(s->bs, BDRV_ACTION_IGNORE, is_read);
+
+        return 0;

     }

static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type)

{

    int is_read = (type == SCSI_REQ_STATUS_RETRY_READ);

    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);

    BlockErrorAction action = bdrv_get_on_error(s->bs, is_read);

    if (action == BLOCK_ERR_IGNORE) {

        bdrv_mon_event(s->bs, BDRV_ACTION_IGNORE, is_read);

        return 0;

    }

    if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC)

            || action == BLOCK_ERR_STOP_ANY) {

        type &= SCSI_REQ_STATUS_RETRY_TYPE_MASK;

        r->status |= SCSI_REQ_STATUS_RETRY | type;

        bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);

        vm_stop(VMSTOP_DISKFULL);

    } else {

        if (type == SCSI_REQ_STATUS_RETRY_READ) {

            scsi_req_data(&r->req, 0);

        }

        if (error == ENOMEM) {

            scsi_command_complete(r, CHECK_CONDITION,

                                  SENSE_CODE(TARGET_FAILURE));

        } else {

            scsi_command_complete(r, CHECK_CONDITION,

                                  SENSE_CODE(IO_ERROR));

        }

        bdrv_mon_event(s->bs, BDRV_ACTION_REPORT, is_read);

    }

    return 1;

}


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

+    build_header(linker, table_data,
+
+                 (void *)fadt, "FACP", sizeof(*fadt), 1, NULL);
+
+}

build_fadt(GArray *table_data, GArray *linker, AcpiPmInfo *pm,

           unsigned facs, unsigned dsdt)

{

    AcpiFadtDescriptorRev1 *fadt = acpi_data_push(table_data, sizeof(*fadt));

    fadt->firmware_ctrl = cpu_to_le32(facs);

    /* FACS address to be filled by Guest linker */

    bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE,

                                   ACPI_BUILD_TABLE_FILE,

                                   table_data, &fadt->firmware_ctrl,

                                   sizeof fadt->firmware_ctrl);

    fadt->dsdt = cpu_to_le32(dsdt);

    /* DSDT address to be filled by Guest linker */

    bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE,

                                   ACPI_BUILD_TABLE_FILE,

                                   table_data, &fadt->dsdt,

                                   sizeof fadt->dsdt);

    fadt_setup(fadt, pm);

    build_header(linker, table_data,

                 (void *)fadt, "FACP", sizeof(*fadt), 1, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+uint32_t ldl_phys(target_phys_addr_t addr)

 {

uint32_t ldl_phys(target_phys_addr_t addr)

{

    return ldl_phys_internal(addr, DEVICE_NATIVE_ENDIAN);

}


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

                 int socktype, int port_offset, Error **errp)

+{

     QemuOpts *opts;

int inet_listen(const char *str, char *ostr, int olen,

                int socktype, int port_offset, Error **errp)

{

    QemuOpts *opts;

    char *optstr;

    int sock = -1;

    opts = qemu_opts_create(&dummy_opts, NULL, 0);

    if (inet_parse(opts, str) == 0) {

        sock = inet_listen_opts(opts, port_offset, errp);

        if (sock != -1 && ostr) {

            optstr = strchr(str, ',');

            if (qemu_opt_get_bool(opts, "ipv6", 0)) {

                snprintf(ostr, olen, "[%s]:%s%s",

                         qemu_opt_get(opts, "host"),

                         qemu_opt_get(opts, "port"),

                         optstr ? optstr : "");

            } else {

                snprintf(ostr, olen, "%s:%s%s",

                         qemu_opt_get(opts, "host"),

                         qemu_opt_get(opts, "port"),

                         optstr ? optstr : "");

            }

        }

    } else {

        error_set(errp, QERR_SOCKET_CREATE_FAILED);

    }

    qemu_opts_del(opts);

    return sock;

}


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

+    g_assert_cmpint(err, ==, 0);
+
+    g_assert_cmpint(res, ==, 0x123);
+
+    g_assert(endptr == str + strlen(str));

 }

static void test_qemu_strtoull_hex(void)

{

    const char *str = "0123";

    char f = 'X';

    const char *endptr = &f;

    uint64_t res = 999;

    int err;

    err = qemu_strtoull(str, &endptr, 16, &res);

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 0x123);

    g_assert(endptr == str + strlen(str));

    str = "0x123";

    endptr = &f;

    res = 999;

    err = qemu_strtoull(str, &endptr, 0, &res);

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 0x123);

    g_assert(endptr == str + strlen(str));

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
         fprintf(stderr, "Wrong smbios provided\n");

         exit(1);
+
+    }
+
 }

static void do_smbios_option(const char *optarg)

{

    if (smbios_entry_add(optarg) < 0) {

        fprintf(stderr, "Wrong smbios provided\n");

        exit(1);

    }

}


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

 #endif

+

     pci_conf = pci_dev->config;

static int pci_pcnet_init(PCIDevice *pci_dev)

{

    PCIPCNetState *d = PCI_PCNET(pci_dev);

    PCNetState *s = &d->state;

    uint8_t *pci_conf;

#if 0

    printf("sizeof(RMD)=%d, sizeof(TMD)=%d\n",

        sizeof(struct pcnet_RMD), sizeof(struct pcnet_TMD));

#endif

    pci_conf = pci_dev->config;

    pci_set_word(pci_conf + PCI_STATUS,

                 PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM);

    pci_set_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID, 0x0);

    pci_set_word(pci_conf + PCI_SUBSYSTEM_ID, 0x0);

    pci_conf[PCI_INTERRUPT_PIN] = 1; /* interrupt pin A */

    pci_conf[PCI_MIN_GNT] = 0x06;

    pci_conf[PCI_MAX_LAT] = 0xff;

    /* Handler for memory-mapped I/O */

    memory_region_init_io(&d->state.mmio, OBJECT(d), &pcnet_mmio_ops, s,

                          "pcnet-mmio", PCNET_PNPMMIO_SIZE);

    memory_region_init_io(&d->io_bar, OBJECT(d), &pcnet_io_ops, s, "pcnet-io",

                          PCNET_IOPORT_SIZE);

    pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->io_bar);

    pci_register_bar(pci_dev, 1, 0, &s->mmio);

    s->irq = pci_allocate_irq(pci_dev);

    s->phys_mem_read = pci_physical_memory_read;

    s->phys_mem_write = pci_physical_memory_write;

    s->dma_opaque = pci_dev;

    return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static double get_audio_clock(VideoState *is)

+{
+
+    double pts;
+
+    int hw_buf_size, bytes_per_sec;

     pts = is->audio_clock;

static double get_audio_clock(VideoState *is)

{

    double pts;

    int hw_buf_size, bytes_per_sec;

    pts = is->audio_clock;

    hw_buf_size = audio_write_get_buf_size(is);

    bytes_per_sec = 0;

    if (is->audio_st) {

        bytes_per_sec = is->audio_st->codec->sample_rate *

                        2 * is->audio_st->codec->channels;

    }

    if (bytes_per_sec)

        pts -= (double)hw_buf_size / bytes_per_sec;

    return pts;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int64_t find_best_filter(const DCAADPCMEncContext *s, const int32_t *in, int len)

 {
+
     const premultiplied_coeffs *precalc_data = s->private_data;

     int i, j, k = 0;

static int64_t find_best_filter(const DCAADPCMEncContext *s, const int32_t *in, int len)

{

    const premultiplied_coeffs *precalc_data = s->private_data;

    int i, j, k = 0;

    int vq;

    int64_t err;

    int64_t min_err = 1ll << 62;

    int64_t corr[15];

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

        for (j = i; j <= DCA_ADPCM_COEFFS; j++)

            corr[k++] = calc_corr(in+4, len, i, j);

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

        err = apply_filter(ff_dca_adpcm_vb[i], corr, *precalc_data);

        if (err < min_err) {

            min_err = err;

            vq = i;

        }

        precalc_data++;

    }

    return vq;

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
         proto_drv = bdrv_find_protocol(filename, true);

         if (!proto_drv) {
+
+            error_report("Unknown protocol '%s'", filename);
+
+
+            return 1;

         }

static int print_block_option_help(const char *filename, const char *fmt)

{

    BlockDriver *drv, *proto_drv;

    QEMUOptionParameter *create_options = NULL;

    /* Find driver and parse its options */

    drv = bdrv_find_format(fmt);

    if (!drv) {

        error_report("Unknown file format '%s'", fmt);

        return 1;

    }

    create_options = append_option_parameters(create_options,

                                              drv->create_options);

    if (filename) {

        proto_drv = bdrv_find_protocol(filename, true);

        if (!proto_drv) {

            error_report("Unknown protocol '%s'", filename);

            return 1;

        }

        create_options = append_option_parameters(create_options,

                                                  proto_drv->create_options);

    }

    print_option_help(create_options);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -59,11 +59,11 @@
     alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift);

     if (!alsa->pcm_buf) {
+
+        dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n",
+
+               hw->samples, 1 << hw->info.shift);
+
         alsa_anal_close (&handle);

         return -1;

static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as)

{

    ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw;

    struct alsa_params_req req;

    struct alsa_params_obt obt;

    snd_pcm_t *handle;

    audsettings_t obt_as;

    req.fmt = aud_to_alsafmt (as->fmt);

    req.freq = as->freq;

    req.nchannels = as->nchannels;

    req.period_size = conf.period_size_out;

    req.buffer_size = conf.buffer_size_out;

    req.size_in_usec = conf.size_in_usec_out;

    req.override_mask = !!conf.period_size_out_overridden

        | (!!conf.buffer_size_out_overridden << 1);

    if (alsa_open (0, &req, &obt, &handle)) {

        return -1;

    }

    obt_as.freq = obt.freq;

    obt_as.nchannels = obt.nchannels;

    obt_as.fmt = obt.fmt;

    obt_as.endianness = obt.endianness;

    audio_pcm_init_info (&hw->info, &obt_as);

    hw->samples = obt.samples;

    alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift);

    if (!alsa->pcm_buf) {

        dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n",

               hw->samples, 1 << hw->info.shift);

        alsa_anal_close (&handle);

        return -1;

    }

    alsa->handle = handle;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     pid1 = chk_error(clone(thread1_func, stack1 + STACK_SIZE,

                            CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello1"));
+
+
+
+    stack2 = malloc(STACK_SIZE);
+
     pid2 = chk_error(clone(thread2_func, stack2 + STACK_SIZE,

                            CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2"));

void test_clone(void)

{

    uint8_t *stack1, *stack2;

    int pid1, pid2, status1, status2;

    stack1 = malloc(STACK_SIZE);

    pid1 = chk_error(clone(thread1_func, stack1 + STACK_SIZE,

                           CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello1"));

    stack2 = malloc(STACK_SIZE);

    pid2 = chk_error(clone(thread2_func, stack2 + STACK_SIZE,

                           CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2"));

    while (waitpid(pid1, &status1, 0) != pid1);

    while (waitpid(pid2, &status2, 0) != pid2);

    if (thread1_res != 5 ||

        thread2_res != 6)

        error("clone");

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static BlockAIOCB *blkverify_aio_flush(BlockDriverState *bs,
+
+                                       BlockCompletionFunc *cb,

                                        void *opaque)

static BlockAIOCB *blkverify_aio_flush(BlockDriverState *bs,

                                       BlockCompletionFunc *cb,

                                       void *opaque)

{

    BDRVBlkverifyState *s = bs->opaque;

    /* Only flush test file, the raw file is not important */

    return bdrv_aio_flush(s->test_file->bs, cb, opaque);

}


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

+
     if (s->motion_val)

         free(s->motion_val);

void MPV_common_end(MpegEncContext *s)

{

    int i;

    if (s->motion_val)

        free(s->motion_val);

    if (s->h263_pred) {

        free(s->dc_val[0]);

        free(s->ac_val[0]);

        free(s->coded_block);

        free(s->mbintra_table);

    }

    if (s->mbskip_table)

        free(s->mbskip_table);

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

        free(s->last_picture_base[i]);

        free(s->next_picture_base[i]);

        if (s->has_b_frames)

            free(s->aux_picture_base[i]);

    }

    s->context_initialized = 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void qdev_prop_allow_set_link_before_realize(Object *obj, const char *name,

                                              Object *val, Error **errp)

void qdev_prop_allow_set_link_before_realize(Object *obj, const char *name,

                                             Object *val, Error **errp)

{

    DeviceState *dev = DEVICE(obj);

    if (dev->realized) {

        error_setg(errp, "Attempt to set link property '%s' on device '%s' "

                   "(type '%s') after it was realized",

                   name, dev->id, object_get_typename(obj));

    }

}


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

     uint32_t * palette = (uint32_t *)frame->data[1];
+
+    int a;
+
+    for(a = 0; a < 256; a++){

         palette[a] = AV_RB24(&palette_buffer[a * 3]) * 4;

static void set_palette(AVFrame * frame, const uint8_t * palette_buffer)

{

    uint32_t * palette = (uint32_t *)frame->data[1];

    int a;

    for(a = 0; a < 256; a++){

        palette[a] = AV_RB24(&palette_buffer[a * 3]) * 4;

    }

    frame->palette_has_changed = 1;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 start_list(Visitor *v, const char *name, Error **errp)

+{

     StringInputVisitor *siv = to_siv(v);

start_list(Visitor *v, const char *name, Error **errp)

{

    StringInputVisitor *siv = to_siv(v);

    parse_str(siv, errp);

    siv->cur_range = g_list_first(siv->ranges);

    if (siv->cur_range) {

        Range *r = siv->cur_range->data;

        if (r) {

            siv->cur = r->begin;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
                     get_scale_factor(h, poc, poc1, i + 16);

         }
+
+
+
+    for (i = 0; i < h->ref_count[0]; i++)
+
         h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i);

 }

void ff_h264_direct_dist_scale_factor(H264Context *const h)

{

    const int poc  = h->cur_pic_ptr->field_poc[h->picture_structure == PICT_BOTTOM_FIELD];

    const int poc1 = h->ref_list[1][0].poc;

    int i, field;

    if (FRAME_MBAFF(h))

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

            const int poc  = h->cur_pic_ptr->field_poc[field];

            const int poc1 = h->ref_list[1][0].field_poc[field];

            for (i = 0; i < 2 * h->ref_count[0]; i++)

                h->dist_scale_factor_field[field][i ^ field] =

                    get_scale_factor(h, poc, poc1, i + 16);

        }

    for (i = 0; i < h->ref_count[0]; i++)

        h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs,
+        int64_t sector_num, int nb_sectors)
+{
+    BdrvTrackedRequest *req;
+    int64_t cluster_sector_num;
     int cluster_nb_sectors;
     bool retry;
     /* If we touch the same cluster it counts as an overlap.  This guarantees

static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs,
        int64_t sector_num, int nb_sectors)
{
    BdrvTrackedRequest *req;
    int64_t cluster_sector_num;
    int cluster_nb_sectors;
    bool retry;
    /* If we touch the same cluster it counts as an overlap.  This guarantees
     * that allocating writes will be serialized and not race with each other
     * for the same cluster.  For example, in copy-on-read it ensures that the
     * CoR read and write operations are atomic and guest writes cannot
     * interleave between them.
    round_to_clusters(bs, sector_num, nb_sectors,
                      &cluster_sector_num, &cluster_nb_sectors);
    do {
        retry = false;
        QLIST_FOREACH(req, &bs->tracked_requests, list) {
            if (tracked_request_overlaps(req, cluster_sector_num,
                                         cluster_nb_sectors)) {
                qemu_co_queue_wait(&req->wait_queue);
                retry = true;
                break;
            }
        }
    } while (retry);
}


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

     if (local_err != NULL) {

+        qerror_report_err(local_err);
+
+        error_free(local_err);
+
+    }

int tcp_socket_outgoing_opts(QemuOpts *opts)

{

    Error *local_err = NULL;

    int fd = inet_connect_opts(opts, &local_err, NULL, NULL);

    if (local_err != NULL) {

        qerror_report_err(local_err);

        error_free(local_err);

    }

    return fd;

}


--- a/source.c
+++ b/source.c
@@ -8,7 +8,7 @@
     ram_size = qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE);
     /* Start at 1MB */
     s->start = 1 << 20;
+    /* Respect PCI hole */
+    s->end = MIN(ram_size, 0xE0000000);
+    return &s->alloc;
 }

QGuestAllocator *pc_alloc_init(void)
{
    PCAlloc *s = g_malloc0(sizeof(*s));
    uint64_t ram_size;
    QFWCFG *fw_cfg = pc_fw_cfg_init();
    s->alloc.alloc = pc_alloc;
    s->alloc.free = pc_free;
    ram_size = qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE);
    /* Start at 1MB */
    s->start = 1 << 20;
    /* Respect PCI hole */
    s->end = MIN(ram_size, 0xE0000000);
    return &s->alloc;
}


static int qcow2_set_key(BlockDriverState *bs, const char *key)

{

    BDRVQcow2State *s = bs->opaque;

    uint8_t keybuf[16];

    int len, i;

    Error *err = NULL;

    memset(keybuf, 0, 16);

    len = strlen(key);

    if (len > 16)

        len = 16;

    /* XXX: we could compress the chars to 7 bits to increase

       entropy */

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

        keybuf[i] = key[i];

    }

    assert(bs->encrypted);

    qcrypto_cipher_free(s->cipher);

    s->cipher = qcrypto_cipher_new(

        QCRYPTO_CIPHER_ALG_AES_128,

        QCRYPTO_CIPHER_MODE_CBC,

        keybuf, G_N_ELEMENTS(keybuf),

        &err);

    if (!s->cipher) {

        /* XXX would be nice if errors in this method could

         * be properly propagate to the caller. Would need

         * the bdrv_set_key() API signature to be fixed. */

        error_free(err);

        return -1;

    }

    return 0;

}


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

+        l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];
+
+    }
+
+

     return c_idx;

int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,

                               int bytes, uint8_t *_dst, int coeffs)

{

    int i, b, c_idx = 0;

    int16_t *dst = (int16_t *)_dst;

    DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];

    INIT_RESIDUE(res);

    for (b = 1; b <= bytes; b++) {

        future[0] = &lut_ctx[buf[b]];

        future[1] = future[0] + 1*LUT_SIZE;

        future[2] = future[0] + 2*LUT_SIZE;

        future[3] = future[0] + 3*LUT_SIZE;

        if ((c_idx + 1) > coeffs)

            return c_idx;

        if (res_bits && l->sign) {

            int32_t coeff = 1;

            APPEND_RESIDUE(res, l->preamble);

            for (i = 0; i < (res_bits >> 1) - 1; i++) {

                coeff <<= 1;

                coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1;

            }

            dst[c_idx++] = l->sign * (coeff - 1);

            SET_RESIDUE(res, 0, 0);

        }

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

            dst[c_idx + i] = l->ready[i];

        c_idx += l->ready_num;

        APPEND_RESIDUE(res, l->leftover);

        l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];

    }

    return c_idx;

}