--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     QIOTask *task;

     struct QIODNSResolverLookupData *data =
+
+        g_new0(struct QIODNSResolverLookupData, 1);
+
+
+
     data->addr = QAPI_CLONE(SocketAddressLegacy, addr);

void qio_dns_resolver_lookup_async(QIODNSResolver *resolver,

                                   SocketAddressLegacy *addr,

                                   QIOTaskFunc func,

                                   gpointer opaque,

                                   GDestroyNotify notify)

{

    QIOTask *task;

    struct QIODNSResolverLookupData *data =

        g_new0(struct QIODNSResolverLookupData, 1);

    data->addr = QAPI_CLONE(SocketAddressLegacy, addr);

    task = qio_task_new(OBJECT(resolver), func, opaque, notify);

    qio_task_run_in_thread(task,

                           qio_dns_resolver_lookup_worker,

                           data,

                           qio_dns_resolver_lookup_data_free);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int v9fs_do_open2(V9fsState *s, V9fsCreateState *vs)
+
+{
+
+    FsCred cred;

     int flags;

static int v9fs_do_open2(V9fsState *s, V9fsCreateState *vs)

{

    FsCred cred;

    int flags;

    cred_init(&cred);

    cred.fc_uid = vs->fidp->uid;

    cred.fc_mode = vs->perm & 0777;

    flags = omode_to_uflags(vs->mode) | O_CREAT;

    return s->ops->open2(&s->ctx, vs->fullname.data, flags, &cred);

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
 {
     QPCIDevice *dev;
     uint16_t bmdma_base;
+    uintptr_t guest_prdt;
+    size_t len;
+    bool from_dev;
+    uint8_t status;
+    int flags;
     dev = get_pci_device(&bmdma_base);
     flags = cmd & ~0xff;
     cmd &= 0xff;

static int send_dma_request(int cmd, uint64_t sector, int nb_sectors,
                            PrdtEntry *prdt, int prdt_entries)
{
    QPCIDevice *dev;
    uint16_t bmdma_base;
    uintptr_t guest_prdt;
    size_t len;
    bool from_dev;
    uint8_t status;
    int flags;
    dev = get_pci_device(&bmdma_base);
    flags = cmd & ~0xff;
    cmd &= 0xff;
    switch (cmd) {
    case CMD_READ_DMA:
        from_dev = true;
        break;
    case CMD_WRITE_DMA:
        from_dev = false;
        break;
    default:
        g_assert_not_reached();
    /* Select device 0 */
    outb(IDE_BASE + reg_device, 0 | LBA);
    /* Stop any running transfer, clear any pending interrupt */
    outb(bmdma_base + bmreg_cmd, 0);
    outb(bmdma_base + bmreg_status, BM_STS_INTR);
    /* Setup PRDT */
    len = sizeof(*prdt) * prdt_entries;
    guest_prdt = guest_alloc(guest_malloc, len);
    memwrite(guest_prdt, prdt, len);
    outl(bmdma_base + bmreg_prdt, guest_prdt);
    /* ATA DMA command */
    outb(IDE_BASE + reg_nsectors, nb_sectors);
    outb(IDE_BASE + reg_lba_low,    sector & 0xff);
    outb(IDE_BASE + reg_lba_middle, (sector >> 8) & 0xff);
    outb(IDE_BASE + reg_lba_high,   (sector >> 16) & 0xff);
    outb(IDE_BASE + reg_command, cmd);
    /* Start DMA transfer */
    outb(bmdma_base + bmreg_cmd, BM_CMD_START | (from_dev ? BM_CMD_WRITE : 0));
    if (flags & CMDF_ABORT) {
        outb(bmdma_base + bmreg_cmd, 0);
    /* Wait for the DMA transfer to complete */
    do {
        status = inb(bmdma_base + bmreg_status);
    } while ((status & (BM_STS_ACTIVE | BM_STS_INTR)) == BM_STS_ACTIVE);
    g_assert_cmpint(get_irq(IDE_PRIMARY_IRQ), ==, !!(status & BM_STS_INTR));
    /* Check IDE status code */
    assert_bit_set(inb(IDE_BASE + reg_status), DRDY);
    assert_bit_clear(inb(IDE_BASE + reg_status), BSY | DRQ);
    /* Reading the status register clears the IRQ */
    g_assert(!get_irq(IDE_PRIMARY_IRQ));
    /* Stop DMA transfer if still active */
    if (status & BM_STS_ACTIVE) {
        outb(bmdma_base + bmreg_cmd, 0);
    free_pci_device(dev);
    return status;


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
         s->max_gsi = gsi_bits;

+
+        /* Mark any over-allocated bits as already in use */
+
+        for (i = gsi_count; i < gsi_bits; i++) {
+
             set_gsi(s, i);

         }

static void kvm_init_irq_routing(KVMState *s)

{

    int gsi_count;

    gsi_count = kvm_check_extension(s, KVM_CAP_IRQ_ROUTING);

    if (gsi_count > 0) {

        unsigned int gsi_bits, i;

        /* Round up so we can search ints using ffs */

        gsi_bits = ALIGN(gsi_count, 32);

        s->used_gsi_bitmap = g_malloc0(gsi_bits / 8);

        s->max_gsi = gsi_bits;

        /* Mark any over-allocated bits as already in use */

        for (i = gsi_count; i < gsi_bits; i++) {

            set_gsi(s, i);

        }

    }

    s->irq_routes = g_malloc0(sizeof(*s->irq_routes));

    s->nr_allocated_irq_routes = 0;

    kvm_arch_init_irq_routing(s);

}


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

+    default:
+
+        error_report("milkymist_softusb: read access to unknown register 0x"
+
+                TARGET_FMT_plx, addr << 2);

         break;

static uint64_t softusb_read(void *opaque, target_phys_addr_t addr,

                             unsigned size)

{

    MilkymistSoftUsbState *s = opaque;

    uint32_t r = 0;

    addr >>= 2;

    switch (addr) {

    case R_CTRL:

        r = s->regs[addr];

        break;

    default:

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

                TARGET_FMT_plx, addr << 2);

        break;

    }

    trace_milkymist_softusb_memory_read(addr << 2, r);

    return r;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
+
 {

     if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;

int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)

{

    if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;

    *inv_table = c->srcColorspaceTable;

    *table     = c->dstColorspaceTable;

    *srcRange  = c->srcRange;

    *dstRange  = c->dstRange;

    *brightness= c->brightness;

    *contrast  = c->contrast;

    *saturation= c->saturation;

    return 0;

}


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

+    /* reset dma provider too */
+
+    if (bus->dma->ops->reset) {
+
+        bus->dma->ops->reset(bus->dma);

     }

void ide_bus_reset(IDEBus *bus)

{

    bus->unit = 0;

    bus->cmd = 0;

    ide_reset(&bus->ifs[0]);

    ide_reset(&bus->ifs[1]);

    ide_clear_hob(bus);

    /* pending async DMA */

    if (bus->dma->aiocb) {

#ifdef DEBUG_AIO

        printf("aio_cancel\n");

#endif

        bdrv_aio_cancel(bus->dma->aiocb);

        bus->dma->aiocb = NULL;

    }

    /* reset dma provider too */

    if (bus->dma->ops->reset) {

        bus->dma->ops->reset(bus->dma);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+target_ulong helper_dmt(target_ulong arg1)
+
+{

     // TODO

target_ulong helper_dmt(target_ulong arg1)

{

    // TODO

    arg1 = 0;

    // rt = arg1

    return arg1;

}


--- a/source.c
+++ b/source.c
@@ -8,7 +8,7 @@
         cpu_restore_state_from_tb(cpu, tb, retaddr);
         if (tb->cflags & CF_NOCACHE) {
             /* one-shot translation, invalidate it immediately */
+            tb_phys_invalidate(tb, -1);
+            tb_free(tb);
+        r = true;
     tb_unlock();

bool cpu_restore_state(CPUState *cpu, uintptr_t retaddr)
{
    TranslationBlock *tb;
    bool r = false;
    tb_lock();
    tb = tb_find_pc(retaddr);
    if (tb) {
        cpu_restore_state_from_tb(cpu, tb, retaddr);
        if (tb->cflags & CF_NOCACHE) {
            /* one-shot translation, invalidate it immediately */
            tb_phys_invalidate(tb, -1);
            tb_free(tb);
        r = true;
    tb_unlock();


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

 {

+    SubchSet *set;

     uint8_t real_cssid;

bool css_schid_final(int m, uint8_t cssid, uint8_t ssid, uint16_t schid)

{

    SubchSet *set;

    uint8_t real_cssid;

    real_cssid = (!m && (cssid == 0)) ? channel_subsys.default_cssid : cssid;

    if (real_cssid > MAX_CSSID || ssid > MAX_SSID ||

        !channel_subsys.css[real_cssid] ||

        !channel_subsys.css[real_cssid]->sch_set[ssid]) {

        return true;

    }

    set = channel_subsys.css[real_cssid]->sch_set[ssid];

    return schid > find_last_bit(set->schids_used,

                                 (MAX_SCHID + 1) / sizeof(unsigned long));

}


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

     if (ret != 0) {

+        return ret;
+
+    }
+
+    ret = qemu_file_get_error(f);

     if (ret != 0) {

int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)

{

    SaveStateEntry *se;

    int ret = 1;

    QTAILQ_FOREACH(se, &savevm_handlers, entry) {

        if (se->save_live_state == NULL)

            continue;

        /* Section type */

        qemu_put_byte(f, QEMU_VM_SECTION_PART);

        qemu_put_be32(f, se->section_id);

        ret = se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque);

        if (!ret) {

            /* Do not proceed to the next vmstate before this one reported

               completion of the current stage. This serializes the migration

               and reduces the probability that a faster changing state is

               synchronized over and over again. */

            break;

        }

    }

    if (ret != 0) {

        return ret;

    }

    ret = qemu_file_get_error(f);

    if (ret != 0) {

        qemu_savevm_state_cancel(mon, f);

    }

    return ret;

}


void helper_cpuid(void)

{

    if (EAX == 0) {

        EAX = 1; /* max EAX index supported */

        EBX = 0x756e6547;

        ECX = 0x6c65746e;

        EDX = 0x49656e69;

    } else {

        /* EAX = 1 info */

        EAX = 0x52b;

        EBX = 0;

        ECX = 0;

        EDX = CPUID_FP87 | CPUID_VME | CPUID_DE | CPUID_PSE |

            CPUID_TSC | CPUID_MSR | CPUID_MCE |

            CPUID_CX8;

    }

}


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

     av_frame_free(&avctx->coded_frame);

+    av_freep(&s->scratch);
+
+
+
     return 0;

 }

static av_cold int ljpeg_encode_close(AVCodecContext *avctx)

{

    LJpegEncContext *s = avctx->priv_data;

    av_frame_free(&avctx->coded_frame);

    av_freep(&s->scratch);

    return 0;

}


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

 {
+
+    PowerPCCPU *cpu = POWERPC_CPU(dev);

     CPUPPCState *env = &cpu->env;

@@ -11,8 +11,8 @@
     int i, j;

+
+    cpu_exec_exit(CPU(dev));

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

{

    PowerPCCPU *cpu = POWERPC_CPU(dev);

    CPUPPCState *env = &cpu->env;

    opc_handler_t **table;

    int i, j;

    cpu_exec_exit(CPU(dev));

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

        if (env->opcodes[i] == &invalid_handler) {

            continue;

        }

        if (is_indirect_opcode(env->opcodes[i])) {

            table = ind_table(env->opcodes[i]);

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

                if (table[j] != &invalid_handler &&

                        is_indirect_opcode(table[j])) {

                    g_free((opc_handler_t *)((uintptr_t)table[j] &

                        ~PPC_INDIRECT));

                }

            }

            g_free((opc_handler_t *)((uintptr_t)env->opcodes[i] &

                ~PPC_INDIRECT));

        }

    }

}


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

     }

+
+
+    QLIST_INSERT_HEAD(&s->inflight_aiocb_head, aiocb, aiocb_siblings);
+
+    return false;

 }

static bool check_overwrapping_aiocb(BDRVSheepdogState *s, SheepdogAIOCB *aiocb)

{

    SheepdogAIOCB *cb;

    QLIST_FOREACH(cb, &s->inflight_aiocb_head, aiocb_siblings) {

        if (AIOCBOverwrapping(aiocb, cb)) {

            return true;

        }

    }

    QLIST_INSERT_HEAD(&s->inflight_aiocb_head, aiocb, aiocb_siblings);

    return false;

}


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

+{
+
+    BlockAIOCBSync *acb = opaque;
+
+

     if (!acb->is_write && acb->ret >= 0) {

static void bdrv_aio_bh_cb(void *opaque)

{

    BlockAIOCBSync *acb = opaque;

    if (!acb->is_write && acb->ret >= 0) {

        qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);

    }

    qemu_vfree(acb->bounce);

    acb->common.cb(acb->common.opaque, acb->ret);

    qemu_bh_delete(acb->bh);

    acb->bh = NULL;

    qemu_aio_unref(acb);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static float voice_factor(float *p_vector, float p_gain,

                           float *f_vector, float f_gain,
+
                           CELPMContext *ctx)

 {

static float voice_factor(float *p_vector, float p_gain,

                          float *f_vector, float f_gain,

                          CELPMContext *ctx)

{

    double p_ener = (double) ctx->dot_productf(p_vector, p_vector,

                                                          AMRWB_SFR_SIZE) *

                    p_gain * p_gain;

    double f_ener = (double) ctx->dot_productf(f_vector, f_vector,

                                                          AMRWB_SFR_SIZE) *

                    f_gain * f_gain;

    return (p_ener - f_ener) / (p_ener + f_ener);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void migrate_check_parameter(QTestState *who, const char *parameter,

+                                    const char *value)

 {

static void migrate_check_parameter(QTestState *who, const char *parameter,

                                    const char *value)

{

    QDict *rsp, *rsp_return;

    const char *result;

    rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }");

    rsp_return = qdict_get_qdict(rsp, "return");

    result = g_strdup_printf("%" PRId64,

                             qdict_get_try_int(rsp_return,  parameter, -1));

    g_assert_cmpstr(result, ==, value);

    QDECREF(rsp);

}


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

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

     while (*p != NULL)

void av_register_input_format(AVInputFormat *format)

{

    AVInputFormat **p = &first_iformat;

    while (*p != NULL)

        p = &(*p)->next;

    *p = format;

    format->next = NULL;

}


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

     qemu_put_be64(f, dev->routes.adapter.ind_offset);

+    qemu_put_byte(f, dev->thinint_isc);
+
+    qemu_put_be32(f, dev->revision);
+
+}

static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)

{

    VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);

    CcwDevice *ccw_dev = CCW_DEVICE(d);

    SubchDev *s = ccw_dev->sch;

    VirtIODevice *vdev = virtio_ccw_get_vdev(s);

    subch_device_save(s, f);

    if (dev->indicators != NULL) {

        qemu_put_be32(f, dev->indicators->len);

        qemu_put_be64(f, dev->indicators->addr);

    } else {

        qemu_put_be32(f, 0);

        qemu_put_be64(f, 0UL);

    }

    if (dev->indicators2 != NULL) {

        qemu_put_be32(f, dev->indicators2->len);

        qemu_put_be64(f, dev->indicators2->addr);

    } else {

        qemu_put_be32(f, 0);

        qemu_put_be64(f, 0UL);

    }

    if (dev->summary_indicator != NULL) {

        qemu_put_be32(f, dev->summary_indicator->len);

        qemu_put_be64(f, dev->summary_indicator->addr);

    } else {

        qemu_put_be32(f, 0);

        qemu_put_be64(f, 0UL);

    }

    qemu_put_be16(f, vdev->config_vector);

    qemu_put_be64(f, dev->routes.adapter.ind_offset);

    qemu_put_byte(f, dev->thinint_isc);

    qemu_put_be32(f, dev->revision);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void qemu_mutex_lock(QemuMutex *mutex)
+
+{
+
     EnterCriticalSection(&mutex->lock);

void qemu_mutex_lock(QemuMutex *mutex)

{

    EnterCriticalSection(&mutex->lock);

    /* Win32 CRITICAL_SECTIONs are recursive.  Assert that we're not

     * using them as such.

     */

    assert(mutex->owner == 0);

    mutex->owner = GetCurrentThreadId();

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,

                                    MMUAccessType access_type,
+
+                                   int mmu_idx, uintptr_t retaddr)
+
+{
+
     S390CPU *cpu = S390_CPU(cs);

     CPUS390XState *env = &cpu->env;

void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,

                                   MMUAccessType access_type,

                                   int mmu_idx, uintptr_t retaddr)

{

    S390CPU *cpu = S390_CPU(cs);

    CPUS390XState *env = &cpu->env;

    if (retaddr) {

        cpu_restore_state(cs, retaddr);

    }

    program_interrupt(env, PGM_SPECIFICATION, ILEN_LATER);

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
         url_fseek(bc, nut->packet_size_pos, SEEK_SET);

         for(i=get_length(size); i < get_length(nut->written_packet_size); i+=7)
+
+            put_byte(bc, 0x80);
+
+        put_v(bc, size);
+

         url_fseek(bc, cur, SEEK_SET);

static int update_packetheader(NUTContext *nut, ByteIOContext *bc, int additional_size){

    int64_t start= nut->packet_start;

    int64_t cur= url_ftell(bc);

    int size= cur - start + additional_size;

    if(size != nut->written_packet_size){

        int i;

        assert( size <= nut->written_packet_size );

        url_fseek(bc, nut->packet_size_pos, SEEK_SET);

        for(i=get_length(size); i < get_length(nut->written_packet_size); i+=7)

            put_byte(bc, 0x80);

        put_v(bc, size);

        url_fseek(bc, cur, SEEK_SET);

        nut->written_packet_size= size; //FIXME may fail if multiple updates with differing sizes, as get_length may differ

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void trigger_page_fault(CPUS390XState *env, target_ulong vaddr,
+
+                               uint32_t type, uint64_t asc, int rw)
+
+{

     CPUState *cs = CPU(s390_env_get_cpu(env));

static void trigger_page_fault(CPUS390XState *env, target_ulong vaddr,

                               uint32_t type, uint64_t asc, int rw)

{

    CPUState *cs = CPU(s390_env_get_cpu(env));

    int ilen = ILEN_LATER;

    int bits = trans_bits(env, asc);

    /* Code accesses have an undefined ilc.  */

    if (rw == 2) {

        ilen = 2;

    }

    DPRINTF("%s: vaddr=%016" PRIx64 " bits=%d\n", __func__, vaddr, bits);

    stq_phys(cs->as,

             env->psa + offsetof(LowCore, trans_exc_code), vaddr | bits);

    trigger_pgm_exception(env, type, ilen);

}


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

                               int sample)

+{

     /* No need to keep track of smaller samples, since describing them

static void sample_queue_push(HintSampleQueue *queue, uint8_t *data, int size,

                              int sample)

{

    /* No need to keep track of smaller samples, since describing them

     * with immediates is more efficient. */

    if (size <= 14)

        return;

    if (!queue->samples || queue->len >= queue->size) {

        HintSample *samples;

        samples = av_realloc(queue->samples, sizeof(HintSample) * (queue->size + 10));

        if (!samples)

            return;

        queue->size += 10;

        queue->samples = samples;

    }

    queue->samples[queue->len].data = data;

    queue->samples[queue->len].size = size;

    queue->samples[queue->len].sample_number = sample;

    queue->samples[queue->len].offset   = 0;

    queue->samples[queue->len].own_data = 0;

    queue->len++;

}


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

 {

+    if (ram_bulk_stage || !migrate_use_xbzrle()) {

         return;

static void xbzrle_cache_zero_page(ram_addr_t current_addr)

{

    if (ram_bulk_stage || !migrate_use_xbzrle()) {

        return;

    }

    /* We don't care if this fails to allocate a new cache page

     * as long as it updated an old one */

    cache_insert(XBZRLE.cache, current_addr, ZERO_TARGET_PAGE);

}


--- a/source.c
+++ b/source.c
@@ -49,11 +49,11 @@
     tcg_gen_brcondi_i32(cond, r_tmp2, 0, l1);

     tcg_gen_mov_i32(fp1, fp0);
+
+    tcg_temp_free(fp0);
+
+    gen_set_label(l1);
+
     tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x2);

     tcg_gen_brcondi_i32(cond, r_tmp2, 0, l2);

static inline void gen_movcf_ps (int fs, int fd, int cc, int tf)

{

    int cond;

    TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv r_tmp2 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv fph0 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv fp1 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv fph1 = tcg_temp_local_new(TCG_TYPE_I32);

    int l1 = gen_new_label();

    int l2 = gen_new_label();

    if (tf)

        cond = TCG_COND_EQ;

    else

        cond = TCG_COND_NE;

    gen_load_fpr32(fp0, fs);

    gen_load_fpr32h(fph0, fs);

    gen_load_fpr32(fp1, fd);

    gen_load_fpr32h(fph1, fd);

    get_fp_cond(r_tmp1);

    tcg_gen_shri_i32(r_tmp1, r_tmp1, cc);

    tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x1);

    tcg_gen_brcondi_i32(cond, r_tmp2, 0, l1);

    tcg_gen_mov_i32(fp1, fp0);

    tcg_temp_free(fp0);

    gen_set_label(l1);

    tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x2);

    tcg_gen_brcondi_i32(cond, r_tmp2, 0, l2);

    tcg_gen_mov_i32(fph1, fph0);

    tcg_temp_free(fph0);

    gen_set_label(l2);

    tcg_temp_free(r_tmp1);

    tcg_temp_free(r_tmp2);

    gen_store_fpr32(fp1, fd);

    gen_store_fpr32h(fph1, fd);

    tcg_temp_free(fp1);

    tcg_temp_free(fph1);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 CharDriverState *qemu_chr_alloc(ChardevCommon *backend, Error **errp)

 {
+
     CharDriverState *chr = g_malloc0(sizeof(CharDriverState));

     qemu_mutex_init(&chr->chr_write_lock);

CharDriverState *qemu_chr_alloc(ChardevCommon *backend, Error **errp)

{

    CharDriverState *chr = g_malloc0(sizeof(CharDriverState));

    qemu_mutex_init(&chr->chr_write_lock);

    chr->mux_idx = -1;

    if (backend->has_logfile) {

        int flags = O_WRONLY | O_CREAT;

        if (backend->has_logappend &&

            backend->logappend) {

            flags |= O_APPEND;

        } else {

            flags |= O_TRUNC;

        }

        chr->logfd = qemu_open(backend->logfile, flags, 0666);

        if (chr->logfd < 0) {

            error_setg_errno(errp, errno,

                             "Unable to open logfile %s",

                             backend->logfile);

            g_free(chr);

            return NULL;

        }

    } else {

        chr->logfd = -1;

    }

    return chr;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
  again:
         /* check if we can really output */
         if (!slirp_can_output())
+            return;
+	/*
+	 * See which queue to get next packet from
+	 * If there's something in the fastq, select it immediately
+	 */
 	if (if_fastq.ifq_next != &if_fastq) {
 		ifm = if_fastq.ifq_next;
 	} else {

if_start(void)
{
	struct mbuf *ifm, *ifqt;
	DEBUG_CALL("if_start");
	if (if_queued == 0)
	   return; /* Nothing to do */
 again:
        /* check if we can really output */
        if (!slirp_can_output())
            return;
	/*
	 * See which queue to get next packet from
	 * If there's something in the fastq, select it immediately
	 */
	if (if_fastq.ifq_next != &if_fastq) {
		ifm = if_fastq.ifq_next;
	} else {
		/* Nothing on fastq, see if next_m is valid */
		if (next_m != &if_batchq)
		   ifm = next_m;
		else
		   ifm = if_batchq.ifq_next;
		/* Set which packet to send on next iteration */
		next_m = ifm->ifq_next;
	}
	/* Remove it from the queue */
	ifqt = ifm->ifq_prev;
	remque(ifm);
	--if_queued;
	/* If there are more packets for this session, re-queue them */
	if (ifm->ifs_next != /* ifm->ifs_prev != */ ifm) {
		insque(ifm->ifs_next, ifqt);
		ifs_remque(ifm);
	}
	/* Update so_queued */
	if (ifm->ifq_so) {
		if (--ifm->ifq_so->so_queued == 0)
		   /* If there's no more queued, reset nqueued */
		   ifm->ifq_so->so_nqueued = 0;
	}
	/* Encapsulate the packet for sending */
        if_encap(ifm->m_data, ifm->m_len);
	if (if_queued)
	   goto again;
}


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

     /* share a single thread for all cpus with TCG */

+    if (!tcg_cpu_thread) {
+
+        cpu->thread = g_malloc0(sizeof(QemuThread));
+
+        cpu->halt_cond = g_malloc0(sizeof(QemuCond));

         qemu_cond_init(cpu->halt_cond);

static void qemu_tcg_init_vcpu(CPUState *cpu)

{

    char thread_name[VCPU_THREAD_NAME_SIZE];

    static QemuCond *tcg_halt_cond;

    static QemuThread *tcg_cpu_thread;

    tcg_cpu_address_space_init(cpu, cpu->as);

    /* share a single thread for all cpus with TCG */

    if (!tcg_cpu_thread) {

        cpu->thread = g_malloc0(sizeof(QemuThread));

        cpu->halt_cond = g_malloc0(sizeof(QemuCond));

        qemu_cond_init(cpu->halt_cond);

        tcg_halt_cond = cpu->halt_cond;

        snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG",

                 cpu->cpu_index);

        qemu_thread_create(cpu->thread, thread_name, qemu_tcg_cpu_thread_fn,

                           cpu, QEMU_THREAD_JOINABLE);

#ifdef _WIN32

        cpu->hThread = qemu_thread_get_handle(cpu->thread);

#endif

        while (!cpu->created) {

            qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);

        }

        tcg_cpu_thread = cpu->thread;

    } else {

        cpu->thread = tcg_cpu_thread;

        cpu->halt_cond = tcg_halt_cond;

    }

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     RomResetData *rrd = _rrd;

+
+    cpu_physical_memory_write_rom(rrd->addr, rrd->data, rrd->size);

 }

static void option_rom_reset(void *_rrd)

{

    RomResetData *rrd = _rrd;

    cpu_physical_memory_write_rom(rrd->addr, rrd->data, rrd->size);

}


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

     case 0x150: return s->rfsr;

+    case 0x180: return s->erdsr;
+
+    case 0x184: return s->etdsr;
+
+    case 0x188: return s->emrbr;

     default:

static uint64_t mcf_fec_read(void *opaque, target_phys_addr_t addr,

                             unsigned size)

{

    mcf_fec_state *s = (mcf_fec_state *)opaque;

    switch (addr & 0x3ff) {

    case 0x004: return s->eir;

    case 0x008: return s->eimr;

    case 0x010: return s->rx_enabled ? (1 << 24) : 0; /* RDAR */

    case 0x014: return 0; /* TDAR */

    case 0x024: return s->ecr;

    case 0x040: return s->mmfr;

    case 0x044: return s->mscr;

    case 0x064: return 0; /* MIBC */

    case 0x084: return s->rcr;

    case 0x0c4: return s->tcr;

    case 0x0e4: /* PALR */

        return (s->conf.macaddr.a[0] << 24) | (s->conf.macaddr.a[1] << 16)

              | (s->conf.macaddr.a[2] << 8) | s->conf.macaddr.a[3];

        break;

    case 0x0e8: /* PAUR */

        return (s->conf.macaddr.a[4] << 24) | (s->conf.macaddr.a[5] << 16) | 0x8808;

    case 0x0ec: return 0x10000; /* OPD */

    case 0x118: return 0;

    case 0x11c: return 0;

    case 0x120: return 0;

    case 0x124: return 0;

    case 0x144: return s->tfwr;

    case 0x14c: return 0x600;

    case 0x150: return s->rfsr;

    case 0x180: return s->erdsr;

    case 0x184: return s->etdsr;

    case 0x188: return s->emrbr;

    default:

        hw_error("mcf_fec_read: Bad address 0x%x\n", (int)addr);

        return 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int local_chmod(FsContext *fs_ctx, const char *path, FsCred *credp)

 {
+
     if (fs_ctx->fs_sm == SM_MAPPED) {

         return local_set_xattr(rpath(fs_ctx, path), credp);

static int local_chmod(FsContext *fs_ctx, const char *path, FsCred *credp)

{

    if (fs_ctx->fs_sm == SM_MAPPED) {

        return local_set_xattr(rpath(fs_ctx, path), credp);

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

        return chmod(rpath(fs_ctx, path), credp->fc_mode);

    }

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
     cc->handle_mmu_fault = arm_cpu_handle_mmu_fault;
 #else
     cc->do_interrupt = arm_cpu_do_interrupt;
+    cc->get_phys_page_debug = arm_cpu_get_phys_page_debug;
+    cc->vmsd = &vmstate_arm_cpu;
+    cc->virtio_is_big_endian = arm_cpu_is_big_endian;
+#endif
+    cc->gdb_num_core_regs = 26;
     cc->gdb_core_xml_file = "arm-core.xml";
     cc->gdb_stop_before_watchpoint = true;
     cc->debug_excp_handler = arm_debug_excp_handler;

static void arm_cpu_class_init(ObjectClass *oc, void *data)
{
    ARMCPUClass *acc = ARM_CPU_CLASS(oc);
    CPUClass *cc = CPU_CLASS(acc);
    DeviceClass *dc = DEVICE_CLASS(oc);
    acc->parent_realize = dc->realize;
    dc->realize = arm_cpu_realizefn;
    dc->props = arm_cpu_properties;
    acc->parent_reset = cc->reset;
    cc->reset = arm_cpu_reset;
    cc->class_by_name = arm_cpu_class_by_name;
    cc->has_work = arm_cpu_has_work;
    cc->cpu_exec_interrupt = arm_cpu_exec_interrupt;
    cc->dump_state = arm_cpu_dump_state;
    cc->set_pc = arm_cpu_set_pc;
    cc->gdb_read_register = arm_cpu_gdb_read_register;
    cc->gdb_write_register = arm_cpu_gdb_write_register;
#ifdef CONFIG_USER_ONLY
    cc->handle_mmu_fault = arm_cpu_handle_mmu_fault;
#else
    cc->do_interrupt = arm_cpu_do_interrupt;
    cc->get_phys_page_debug = arm_cpu_get_phys_page_debug;
    cc->vmsd = &vmstate_arm_cpu;
    cc->virtio_is_big_endian = arm_cpu_is_big_endian;
#endif
    cc->gdb_num_core_regs = 26;
    cc->gdb_core_xml_file = "arm-core.xml";
    cc->gdb_stop_before_watchpoint = true;
    cc->debug_excp_handler = arm_debug_excp_handler;
    cc->disas_set_info = arm_disas_set_info;
}


static int delta_decode(int8_t *dst, const uint8_t *src, int src_size,

                        int8_t val, const int8_t *table)

{

    int n = src_size;

    int8_t *dst0 = dst;

    while (n--) {

        uint8_t d = *src++;

        val = av_clip(val + table[d & 0x0f], -127, 128);

        *dst++ = val;

        val = av_clip(val + table[d >> 4]  , -127, 128);

        *dst++ = val;

    }

    return dst-dst0;

}


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

     struct kvm_fpu fpu;
+
+    int i, ret;
+
+
+
     ret = kvm_vcpu_ioctl(env, KVM_GET_FPU, &fpu);

     if (ret < 0)

static int kvm_get_fpu(CPUState *env)

{

    struct kvm_fpu fpu;

    int i, ret;

    ret = kvm_vcpu_ioctl(env, KVM_GET_FPU, &fpu);

    if (ret < 0)

        return ret;

    env->fpstt = (fpu.fsw >> 11) & 7;

    env->fpus = fpu.fsw;

    env->fpuc = fpu.fcw;

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

	env->fptags[i] = !((fpu.ftwx >> i) & 1);

    memcpy(env->fpregs, fpu.fpr, sizeof env->fpregs);

    memcpy(env->xmm_regs, fpu.xmm, sizeof env->xmm_regs);

    env->mxcsr = fpu.mxcsr;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+int qcow2_pre_write_overlap_check(BlockDriverState *bs, int chk, int64_t offset,
+
                                   int64_t size)

 {

int qcow2_pre_write_overlap_check(BlockDriverState *bs, int chk, int64_t offset,

                                  int64_t size)

{

    int ret = qcow2_check_metadata_overlap(bs, chk, offset, size);

    if (ret < 0) {

        return ret;

    } else if (ret > 0) {

        int metadata_ol_bitnr = ffs(ret) - 1;

        char *message;

        QObject *data;

        assert(metadata_ol_bitnr < QCOW2_OL_MAX_BITNR);

        fprintf(stderr, "qcow2: Preventing invalid write on metadata (overlaps "

                "with %s); image marked as corrupt.\n",

                metadata_ol_names[metadata_ol_bitnr]);

        message = g_strdup_printf("Prevented %s overwrite",

                metadata_ol_names[metadata_ol_bitnr]);

        data = qobject_from_jsonf("{ 'device': %s, 'msg': %s, 'offset': %"

                PRId64 ", 'size': %" PRId64 " }", bs->device_name, message,

                offset, size);

        monitor_protocol_event(QEVENT_BLOCK_IMAGE_CORRUPTED, data);

        g_free(message);

        qobject_decref(data);

        qcow2_mark_corrupt(bs);

        bs->drv = NULL; /* make BDS unusable */

        return -EIO;

    }

    return 0;

}


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

 {

+    CharDriverState *chr;

     FDCharDriver *s;

static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out)

{

    CharDriverState *chr;

    FDCharDriver *s;

    chr = qemu_chr_alloc();

    s = g_malloc0(sizeof(FDCharDriver));

    s->fd_in = io_channel_from_fd(fd_in);

    s->fd_out = io_channel_from_fd(fd_out);

    qemu_set_nonblock(fd_out);

    s->chr = chr;

    chr->opaque = s;

    chr->chr_add_watch = fd_chr_add_watch;

    chr->chr_write = fd_chr_write;

    chr->chr_update_read_handler = fd_chr_update_read_handler;

    chr->chr_close = fd_chr_close;

    return chr;

}


--- a/source.c
+++ b/source.c
@@ -1,20 +1,20 @@
+FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
+
+                        hwaddr ctl_addr, hwaddr data_addr)
+
+{
+
+    DeviceState *dev;
+
+    SysBusDevice *d;

     FWCfgState *s;

+
+
     dev = qdev_create(NULL, TYPE_FW_CFG);
+
+    qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port);

     qdev_prop_set_uint32(dev, "data_iobase", data_port);

@@ -25,7 +25,7 @@
     s = FW_CFG(dev);

+
     assert(!object_resolve_path(FW_CFG_PATH, NULL));

FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,

                        hwaddr ctl_addr, hwaddr data_addr)

{

    DeviceState *dev;

    SysBusDevice *d;

    FWCfgState *s;

    dev = qdev_create(NULL, TYPE_FW_CFG);

    qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port);

    qdev_prop_set_uint32(dev, "data_iobase", data_port);

    d = SYS_BUS_DEVICE(dev);

    s = FW_CFG(dev);

    assert(!object_resolve_path(FW_CFG_PATH, NULL));

    object_property_add_child(qdev_get_machine(), FW_CFG_NAME, OBJECT(s), NULL);

    qdev_init_nofail(dev);

    if (ctl_addr) {

        sysbus_mmio_map(d, 0, ctl_addr);

    }

    if (data_addr) {

        sysbus_mmio_map(d, 1, data_addr);

    }

    fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);

    fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);

    fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));

    fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);

    fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);

    fw_cfg_bootsplash(s);

    fw_cfg_reboot(s);

    s->machine_ready.notify = fw_cfg_machine_ready;

    qemu_add_machine_init_done_notifier(&s->machine_ready);

    return s;

}


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

+
+    if (nb_sectors > INT_MAX) {
+
+        return false;
+
     }

     if (sector & dev->sector_mask) {

static bool virtio_blk_sect_range_ok(VirtIOBlock *dev,

                                     uint64_t sector, size_t size)

{

    uint64_t nb_sectors = size >> BDRV_SECTOR_BITS;

    uint64_t total_sectors;

    if (nb_sectors > INT_MAX) {

        return false;

    }

    if (sector & dev->sector_mask) {

        return false;

    }

    if (size % dev->conf.conf.logical_block_size) {

        return false;

    }

    blk_get_geometry(dev->blk, &total_sectors);

    if (sector > total_sectors || nb_sectors > total_sectors - sector) {

        return false;

    }

    return true;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void qxl_check_state(PCIQXLDevice *d)
+
+{
+
     QXLRam *ram = d->ram;

static void qxl_check_state(PCIQXLDevice *d)

{

    QXLRam *ram = d->ram;

    assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring));

    assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring));

}


void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id,

                         void (*func)(QPCIDevice *dev, int devfn, void *data),

                         void *data)

{

    int slot;

    for (slot = 0; slot < 32; slot++) {

        int fn;

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

            QPCIDevice *dev;

            dev = qpci_device_find(bus, QPCI_DEVFN(slot, fn));

            if (!dev) {

                continue;

            }

            if (vendor_id != -1 &&

                qpci_config_readw(dev, PCI_VENDOR_ID) != vendor_id) {

                continue;

            }

            if (device_id != -1 &&

                qpci_config_readw(dev, PCI_DEVICE_ID) != device_id) {

                continue;

            }

            func(dev, QPCI_DEVFN(slot, fn), data);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,20 +1,20 @@
+static int nprobe(AVFormatContext *s, uint8_t *enc_header, int size,

+                  const uint8_t *n_val)

+{

     OMAContext *oc = s->priv_data;

     uint32_t pos, taglen, datalen;

+    struct AVDES av_des;

     if (!enc_header || !n_val)

+        return -1;

static int nprobe(AVFormatContext *s, uint8_t *enc_header, int size,

                  const uint8_t *n_val)

{

    OMAContext *oc = s->priv_data;

    uint32_t pos, taglen, datalen;

    struct AVDES av_des;

    if (!enc_header || !n_val)

        return -1;

    pos = OMA_ENC_HEADER_SIZE + oc->k_size;

    if (!memcmp(&enc_header[pos], "EKB ", 4))

        pos += 32;

    if (AV_RB32(&enc_header[pos]) != oc->rid)

        av_log(s, AV_LOG_DEBUG, "Mismatching RID\n");

    taglen  = AV_RB32(&enc_header[pos + 32]);

    datalen = AV_RB32(&enc_header[pos + 36]) >> 4;

    if (taglen + (((uint64_t)datalen) << 4) + 44 > size)

        return -1;

    pos += 44 + taglen;

    av_des_init(&av_des, n_val, 192, 1);

    while (datalen-- > 0) {

        av_des_crypt(&av_des, oc->r_val, &enc_header[pos], 2, NULL, 1);

        kset(s, oc->r_val, NULL, 16);

        if (!rprobe(s, enc_header, oc->r_val))

            return 0;

        pos += 16;

    }

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int context_init(H264Context *h){

+    MpegEncContext * const s = &h->s;
+

     CHECKED_ALLOCZ(h->top_borders[0], h->s.mb_width * (16+8+8) * sizeof(uint8_t))

static int context_init(H264Context *h){

    MpegEncContext * const s = &h->s;

    CHECKED_ALLOCZ(h->top_borders[0], h->s.mb_width * (16+8+8) * sizeof(uint8_t))

    CHECKED_ALLOCZ(h->top_borders[1], h->s.mb_width * (16+8+8) * sizeof(uint8_t))

    // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264)

    CHECKED_ALLOCZ(s->allocated_edge_emu_buffer,

                   (s->width+64)*2*21*2); //(width + edge + align)*interlaced*MBsize*tolerance

    s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21;

    return 0;

fail:

    return -1; // free_tables will clean up for us

}


--- a/source.c
+++ b/source.c
@@ -19,8 +19,8 @@
             for (j = 0; j < sizeof(command_to_handler); j++) {

                 if ((j & handlers[i].mask) == handlers[i].value) {
+
+                    command_to_handler[j] = i;

                 }

static int fdctrl_init_common(FDCtrl *fdctrl)

{

    int i, j;

    static int command_tables_inited = 0;

    /* Fill 'command_to_handler' lookup table */

    if (!command_tables_inited) {

        command_tables_inited = 1;

        for (i = ARRAY_SIZE(handlers) - 1; i >= 0; i--) {

            for (j = 0; j < sizeof(command_to_handler); j++) {

                if ((j & handlers[i].mask) == handlers[i].value) {

                    command_to_handler[j] = i;

                }

            }

        }

    }

    FLOPPY_DPRINTF("init controller\n");

    fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN);

    fdctrl->fifo_size = 512;

    fdctrl->result_timer = qemu_new_timer(vm_clock,

                                          fdctrl_result_timer, fdctrl);

    fdctrl->version = 0x90; /* Intel 82078 controller */

    fdctrl->config = FD_CONFIG_EIS | FD_CONFIG_EFIFO; /* Implicit seek, polling & FIFO enabled */

    fdctrl->num_floppies = MAX_FD;

    if (fdctrl->dma_chann != -1)

        DMA_register_channel(fdctrl->dma_chann, &fdctrl_transfer_handler, fdctrl);

    fdctrl_connect_drives(fdctrl);

    return 0;

}


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

     av_freep(&ctx->frm0);

+    av_freep(&ctx->frm1);
+
+    av_freep(&ctx->frm2);
+
+    av_freep(&ctx->stored_frame);

     av_freep(&ctx->rle_buf);

static void destroy_buffers(SANMVideoContext *ctx)

{

    av_freep(&ctx->frm0);

    av_freep(&ctx->frm1);

    av_freep(&ctx->frm2);

    av_freep(&ctx->stored_frame);

    av_freep(&ctx->rle_buf);

    ctx->frm0_size =

    ctx->frm1_size =

    ctx->frm2_size = 0;

}


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

     return malloc(size);
+
 }

void *qemu_malloc(size_t size)

{

    return malloc(size);

}


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

     switch(ext_type) {

+    case 0x1:
+
+        /* sequence ext */
+
+        mpeg_decode_sequence_extension(s);

         break;

static void mpeg_decode_extension(AVCodecContext *avctx,

                                  UINT8 *buf, int buf_size)

{

    Mpeg1Context *s1 = avctx->priv_data;

    MpegEncContext *s = &s1->mpeg_enc_ctx;

    int ext_type;

    init_get_bits(&s->gb, buf, buf_size);

    ext_type = get_bits(&s->gb, 4);

    switch(ext_type) {

    case 0x1:

        /* sequence ext */

        mpeg_decode_sequence_extension(s);

        break;

    case 0x3:

        /* quant matrix extension */

        mpeg_decode_quant_matrix_extension(s);

        break;

    case 0x8:

        /* picture extension */

        mpeg_decode_picture_coding_extension(s);

        break;

    }

}


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

 #if HAVE_BIGENDIAN
+
+    int i;
+
+    for (i = 0; i < s->frame.blocksize * s->channels; i++) {
+
         int16_t smp = av_le2ne16(samples[i]);

         av_md5_update(s->md5ctx, (uint8_t *)&smp, 2);

static void update_md5_sum(FlacEncodeContext *s, const int16_t *samples)

{

#if HAVE_BIGENDIAN

    int i;

    for (i = 0; i < s->frame.blocksize * s->channels; i++) {

        int16_t smp = av_le2ne16(samples[i]);

        av_md5_update(s->md5ctx, (uint8_t *)&smp, 2);

    }

#else

    av_md5_update(s->md5ctx, (const uint8_t *)samples, s->frame.blocksize*s->channels*2);

#endif

}


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

+    s->ioc = QIO_CHANNEL(sioc);
+
     object_ref(OBJECT(sioc));
+

     if (s->do_nodelay) {

static int tcp_chr_new_client(CharDriverState *chr, QIOChannelSocket *sioc)

{

    TCPCharDriver *s = chr->opaque;

    if (s->ioc != NULL) {

	return -1;

    }

    s->ioc = QIO_CHANNEL(sioc);

    object_ref(OBJECT(sioc));

    if (s->do_nodelay) {

        qio_channel_set_delay(s->ioc, false);

    }

    if (s->listen_tag) {

        g_source_remove(s->listen_tag);

        s->listen_tag = 0;

    }

    if (s->do_telnetopt) {

        tcp_chr_telnet_init(chr);

    } else {

        tcp_chr_connect(chr);

    }

    return 0;

}


static int get_uint32_equal(QEMUFile *f, void *pv, size_t size,

                            VMStateField *field)

{

    uint32_t *v = pv;

    uint32_t v2;

    qemu_get_be32s(f, &v2);

    if (*v == v2) {

        return 0;

    error_report("%" PRIx32 " != %" PRIx32, *v, v2);

    return -EINVAL;


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
     MpegEncContext *s = &h->s;

     int frame_rate_code;
+
+    int width, height;
+
+
+
     h->profile =         get_bits(&s->gb,8);

     h->level =           get_bits(&s->gb,8);

static int decode_seq_header(AVSContext *h) {

    MpegEncContext *s = &h->s;

    int frame_rate_code;

    int width, height;

    h->profile =         get_bits(&s->gb,8);

    h->level =           get_bits(&s->gb,8);

    skip_bits1(&s->gb); //progressive sequence

       width =           get_bits(&s->gb,14);

       height =          get_bits(&s->gb,14);

    if ((s->width || s->height) && (s->width != width || s->height != height)) {

        av_log_missing_feature(s, "Width/height changing in CAVS is", 0);

        return -1;

    s->width  = width;

    s->height = height;

    skip_bits(&s->gb,2); //chroma format

    skip_bits(&s->gb,3); //sample_precision

    h->aspect_ratio =    get_bits(&s->gb,4);

    frame_rate_code =    get_bits(&s->gb,4);

    skip_bits(&s->gb,18);//bit_rate_lower

    skip_bits1(&s->gb);  //marker_bit

    skip_bits(&s->gb,12);//bit_rate_upper

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

    h->mb_width  = (s->width  + 15) >> 4;

    h->mb_height = (s->height + 15) >> 4;

    h->s.avctx->time_base.den = avpriv_frame_rate_tab[frame_rate_code].num;

    h->s.avctx->time_base.num = avpriv_frame_rate_tab[frame_rate_code].den;

    h->s.avctx->width  = s->width;

    h->s.avctx->height = s->height;

    if(!h->top_qp)

        ff_cavs_init_top_lines(h);

    return 0;


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void serial_reset(void *opaque)
+
+{

     SerialState *s = opaque;

+
     s->divider = 0;

     s->rbr = 0;

static void serial_reset(void *opaque)

{

    SerialState *s = opaque;

    s->divider = 0;

    s->rbr = 0;

    s->ier = 0;

    s->iir = UART_IIR_NO_INT;

    s->lcr = 0;

    s->mcr = 0;

    s->lsr = UART_LSR_TEMT | UART_LSR_THRE;

    s->msr = UART_MSR_DCD | UART_MSR_DSR | UART_MSR_CTS;

    s->scr = 0;

    s->thr_ipending = 0;

    s->last_break_enable = 0;

    qemu_irq_lower(s->irq);

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 static Visitor *visitor_input_test_init_raw(TestInputVisitorData *data,
+
+                                            const char *json_string)
+
+{
+
+    Visitor *v;
+
+

     data->obj = qobject_from_json(json_string);

static Visitor *visitor_input_test_init_raw(TestInputVisitorData *data,

                                            const char *json_string)

{

    Visitor *v;

    data->obj = qobject_from_json(json_string);

    g_assert(data->obj != NULL);

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

    g_assert(data->qiv != NULL);

    v = qmp_input_get_visitor(data->qiv);

    g_assert(v != NULL);

    return v;

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
+static bool memory_region_dispatch_write(MemoryRegion *mr,

                                          hwaddr addr,
+
                                          uint64_t data,

                                          unsigned size)
+
 {
+
     if (!memory_region_access_valid(mr, addr, size, true)) {
+
         unassigned_mem_write(mr, addr, data, size);

         return true;

static bool memory_region_dispatch_write(MemoryRegion *mr,

                                         hwaddr addr,

                                         uint64_t data,

                                         unsigned size)

{

    if (!memory_region_access_valid(mr, addr, size, true)) {

        unassigned_mem_write(mr, addr, data, size);

        return true;

    }

    adjust_endianness(mr, &data, size);

    if (mr->ops->write) {

        access_with_adjusted_size(addr, &data, size,

                                  mr->ops->impl.min_access_size,

                                  mr->ops->impl.max_access_size,

                                  memory_region_write_accessor, mr);

    } else {

        access_with_adjusted_size(addr, &data, size, 1, 4,

                                  memory_region_oldmmio_write_accessor, mr);

    }

    return false;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+bool qvirtio_wait_config_isr(const QVirtioBus *bus, QVirtioDevice *d,

                                                             uint64_t timeout)

 {

+    do {
+
         clock_step(100);

         if (bus->get_config_isr_status(d)) {

bool qvirtio_wait_config_isr(const QVirtioBus *bus, QVirtioDevice *d,

                                                            uint64_t timeout)

{

    do {

        clock_step(100);

        if (bus->get_config_isr_status(d)) {

            break; /* It has ended */

        }

    } while (--timeout);

    return timeout != 0;

}


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

      * because we are sure we have enough space for the status

+     */
+
+    msg_size = proxy_marshal(iovec, 0, "ddd", header.type,
+
+                             header.size, status);

static int send_status(int sockfd, struct iovec *iovec, int status)

{

    ProxyHeader header;

    int retval, msg_size;

    if (status < 0) {

        header.type = T_ERROR;

    } else {

        header.type = T_SUCCESS;

    header.size = sizeof(status);

    /*

     * marshal the return status. We don't check error.

     * because we are sure we have enough space for the status

     */

    msg_size = proxy_marshal(iovec, 0, "ddd", header.type,

                             header.size, status);

    retval = socket_write(sockfd, iovec->iov_base, msg_size);

    if (retval < 0) {

        return retval;

    return 0;


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void loadvm_postcopy_handle_run_bh(void *opaque)

+{

     Error *local_err = NULL;

@@ -15,7 +15,7 @@
      */

     cpu_synchronize_all_post_init();
+

     qemu_announce_self();

static void loadvm_postcopy_handle_run_bh(void *opaque)

{

    Error *local_err = NULL;

    MigrationIncomingState *mis = opaque;

    /* TODO we should move all of this lot into postcopy_ram.c or a shared code

     * in migration.c

     */

    cpu_synchronize_all_post_init();

    qemu_announce_self();

    /* Make sure all file formats flush their mutable metadata */

    bdrv_invalidate_cache_all(&local_err);

    if (local_err) {

        error_report_err(local_err);

    }

    trace_loadvm_postcopy_handle_run_cpu_sync();

    cpu_synchronize_all_post_init();

    trace_loadvm_postcopy_handle_run_vmstart();

    if (autostart) {

        /* Hold onto your hats, starting the CPU */

        vm_start();

    } else {

        /* leave it paused and let management decide when to start the CPU */

        runstate_set(RUN_STATE_PAUSED);

    }

    qemu_bh_delete(mis->bh);

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
     if (ret < 0) {

         error_setg(errp,
+
                    "Unable to initialize GNUTLS library: %s",

                    gnutls_strerror(ret));

int qcrypto_init(Error **errp)

{

#ifdef CONFIG_GNUTLS

    int ret;

    ret = gnutls_global_init();

    if (ret < 0) {

        error_setg(errp,

                   "Unable to initialize GNUTLS library: %s",

                   gnutls_strerror(ret));

        return -1;

    }

#ifdef DEBUG_GNUTLS

    gnutls_global_set_log_level(10);

    gnutls_global_set_log_function(qcrypto_gnutls_log);

#endif

#endif

#ifdef CONFIG_GCRYPT

    if (!gcry_check_version(GCRYPT_VERSION)) {

        error_setg(errp, "Unable to initialize gcrypt");

        return -1;

    }

#ifdef QCRYPTO_INIT_GCRYPT_THREADS

    gcry_control(GCRYCTL_SET_THREAD_CBS, &qcrypto_gcrypt_thread_impl);

#endif /* QCRYPTO_INIT_GCRYPT_THREADS */

    gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);

#endif

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun)
+
 {
+
     SCSIRequest *req;

     req = qemu_mallocz(size);
+
     /* Two references: one is passed back to the HBA, one is in d->requests.  */
+
     req->refcount = 2;

     req->bus = scsi_bus_from_device(d);

SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun)

{

    SCSIRequest *req;

    req = qemu_mallocz(size);

    /* Two references: one is passed back to the HBA, one is in d->requests.  */

    req->refcount = 2;

    req->bus = scsi_bus_from_device(d);

    req->dev = d;

    req->tag = tag;

    req->lun = lun;

    req->status = -1;

    req->enqueued = true;

    trace_scsi_req_alloc(req->dev->id, req->lun, req->tag);

    QTAILQ_INSERT_TAIL(&d->requests, req, next);

    return req;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int pci_unin_agp_init_device(SysBusDevice *dev)

+{
+
+    UNINState *s;
+
+    int pci_mem_config, pci_mem_data;

static int pci_unin_agp_init_device(SysBusDevice *dev)

{

    UNINState *s;

    int pci_mem_config, pci_mem_data;

    /* Uninorth AGP bus */

    s = FROM_SYSBUS(UNINState, dev);

    pci_mem_config = cpu_register_io_memory(pci_unin_config_read,

                                            pci_unin_config_write, s);

    pci_mem_data = cpu_register_io_memory(pci_unin_main_read,

                                          pci_unin_main_write, &s->host_state);

    sysbus_init_mmio(dev, 0x1000, pci_mem_config);

    sysbus_init_mmio(dev, 0x1000, pci_mem_data);

    return 0;

}


static inline float32 ucf64_itos(uint32_t i)

{

    union {

        uint32_t i;

        float32 s;

    } v;

    v.i = i;

    return v.s;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void qio_channel_socket_connect_async(QIOChannelSocket *ioc,

                                       SocketAddressLegacy *addr,
+
+                                      QIOTaskFunc callback,
+
+                                      gpointer opaque,
+
                                       GDestroyNotify destroy)

 {

void qio_channel_socket_connect_async(QIOChannelSocket *ioc,

                                      SocketAddressLegacy *addr,

                                      QIOTaskFunc callback,

                                      gpointer opaque,

                                      GDestroyNotify destroy)

{

    QIOTask *task = qio_task_new(

        OBJECT(ioc), callback, opaque, destroy);

    SocketAddressLegacy *addrCopy;

    addrCopy = QAPI_CLONE(SocketAddressLegacy, addr);

    /* socket_connect() does a non-blocking connect(), but it

     * still blocks in DNS lookups, so we must use a thread */

    trace_qio_channel_socket_connect_async(ioc, addr);

    qio_task_run_in_thread(task,

                           qio_channel_socket_connect_worker,

                           addrCopy,

                           (GDestroyNotify)qapi_free_SocketAddressLegacy);

}


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

     tcsetattr (0, TCSANOW, &oldtty);

+}

static void term_exit(void)

{

    tcsetattr (0, TCSANOW, &oldtty);

}


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

 {

+    av_freep(dst);
+
     *dst = av_strdup(val);

     return 0;

static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)

{

    av_freep(dst);

    *dst = av_strdup(val);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta,
+
                 MemoryRegion *sysmem,

                 hwaddr channel_base, qemu_irq irq, omap_clk clk,

static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta,

                MemoryRegion *sysmem,

                hwaddr channel_base, qemu_irq irq, omap_clk clk,

                CharDriverState *chr)

{

    struct omap_sti_s *s = (struct omap_sti_s *)

            g_malloc0(sizeof(struct omap_sti_s));

    s->irq = irq;

    omap_sti_reset(s);

    s->chr = chr ?: qemu_chr_new("null", "null", NULL);

    memory_region_init_io(&s->iomem, NULL, &omap_sti_ops, s, "omap.sti",

                          omap_l4_region_size(ta, 0));

    omap_l4_attach(ta, 0, &s->iomem);

    memory_region_init_io(&s->iomem_fifo, NULL, &omap_sti_fifo_ops, s,

                          "omap.sti.fifo", 0x10000);

    memory_region_add_subregion(sysmem, channel_base, &s->iomem_fifo);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
         if (unlikely((ra != 0 && reg < ra && (reg + num_used_regs) > ra) ||

                      (reg < rb && (reg + num_used_regs) > rb))) {
+
+            helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM,
+
+                                       POWERPC_EXCP_INVAL |
+
                                        POWERPC_EXCP_INVAL_LSWX);

         } else {

void helper_lswx(CPUPPCState *env, target_ulong addr, uint32_t reg,

                 uint32_t ra, uint32_t rb)

{

    if (likely(xer_bc != 0)) {

        int num_used_regs = (xer_bc + 3) / 4;

        if (unlikely((ra != 0 && reg < ra && (reg + num_used_regs) > ra) ||

                     (reg < rb && (reg + num_used_regs) > rb))) {

            helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM,

                                       POWERPC_EXCP_INVAL |

                                       POWERPC_EXCP_INVAL_LSWX);

        } else {

            helper_lsw(env, addr, xer_bc, reg);

        }

    }

}


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

                                 const uint8_t *src, int src_size,

+                                int id, int bpp)

 {

static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic,

                                const uint8_t *src, int src_size,

                                int id, int bpp)

{

    int h;

    uint8_t *dst;

    int ret;

    if (src_size < avctx->width * avctx->height * bpp) {

        av_log(avctx, AV_LOG_ERROR, "packet too small\n");

        return AVERROR_INVALIDDATA;

    }

    avctx->pix_fmt = id;

    if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)

        return ret;

    dst = pic->data[0];

    for (h = 0; h < avctx->height; h++) {

        memcpy(dst, src, avctx->width * bpp);

        src += avctx->width * bpp;

        dst += pic->linesize[0];

    }

    return 0;

}


static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){

    GetBitContext gb;

    int i;

    init_get_bits(&gb, src, length);

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

        read_len_table(s->len[i], &gb);

        if(generate_bits_table(s->bits[i], s->len[i])<0){

            return -1;

        }

#if 0

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

printf("%6X, %2d,  %3d\n", s->bits[i][j], s->len[i][j], j);

}

#endif

        init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
                               const char *name, int n)
+{
+    NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
     assert(gpio_list->num_in == 0 || !name);
     assert(gpio_list->num_out == 0);
     gpio_list->num_out = n;

void qdev_init_gpio_out_named(DeviceState *dev, qemu_irq *pins,
                              const char *name, int n)
{
    NamedGPIOList *gpio_list = qdev_get_named_gpio_list(dev, name);
    assert(gpio_list->num_in == 0 || !name);
    assert(gpio_list->num_out == 0);
    gpio_list->num_out = n;
    gpio_list->out = pins;


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg)
+
 {

     struct kvm_irq_routing_entry kroute;

int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg)

{

    struct kvm_irq_routing_entry kroute;

    if (!kvm_irqchip_in_kernel()) {

        return -ENOSYS;

    }

    kroute.gsi = virq;

    kroute.type = KVM_IRQ_ROUTING_MSI;

    kroute.flags = 0;

    kroute.u.msi.address_lo = (uint32_t)msg.address;

    kroute.u.msi.address_hi = msg.address >> 32;

    kroute.u.msi.data = le32_to_cpu(msg.data);

    return kvm_update_routing_entry(s, &kroute);

}


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

     sysbus_init_mmio(sbd, &s->iomem);

+    sysbus_init_irq(sbd, &s->irq[0]);
+
+    sysbus_init_irq(sbd, &s->irq[1]);
+
+    qdev_init_gpio_out(dev, s->cardstatus, 2);

     dinfo = drive_get_next(IF_SD);

static int pl181_init(SysBusDevice *sbd)

{

    DeviceState *dev = DEVICE(sbd);

    PL181State *s = PL181(dev);

    DriveInfo *dinfo;

    memory_region_init_io(&s->iomem, OBJECT(s), &pl181_ops, s, "pl181", 0x1000);

    sysbus_init_mmio(sbd, &s->iomem);

    sysbus_init_irq(sbd, &s->irq[0]);

    sysbus_init_irq(sbd, &s->irq[1]);

    qdev_init_gpio_out(dev, s->cardstatus, 2);

    dinfo = drive_get_next(IF_SD);

    s->card = sd_init(dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, false);

    if (s->card == NULL) {

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
         av_freep(&avcodec_opts[i]);

     av_freep(&avformat_opts->key);
+
+    av_freep(&avformat_opts);
+
+#if CONFIG_SWSCALE
+
     av_freep(&sws_opts);

 #endif

void uninit_opts(void)

{

    int i;

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

        av_freep(&avcodec_opts[i]);

    av_freep(&avformat_opts->key);

    av_freep(&avformat_opts);

#if CONFIG_SWSCALE

    av_freep(&sws_opts);

#endif

}


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

     as->current_map = new_view;
+
+    flatview_destroy(old_view);
+
+    address_space_update_ioeventfds(as);
+
 }

static void address_space_update_topology(AddressSpace *as)

{

    FlatView *old_view = as->current_map;

    FlatView *new_view = generate_memory_topology(as->root);

    address_space_update_topology_pass(as, old_view, new_view, false);

    address_space_update_topology_pass(as, old_view, new_view, true);

    as->current_map = new_view;

    flatview_destroy(old_view);

    address_space_update_ioeventfds(as);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src)

+{

     int ret;

+
     dst->owner = src->owner;

int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src)

{

    int ret;

    dst->owner = src->owner;

    ret = av_frame_ref(dst->f, src->f);

    if (ret < 0)

        return ret;

    av_assert0(!dst->progress);

    if (src->progress &&

        !(dst->progress = av_buffer_ref(src->progress))) {

        ff_thread_release_buffer(dst->owner, dst);

        return AVERROR(ENOMEM);

    }

    return 0;

}


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

 {

+    V4L2m2mContext *s = buf_to_m2mctx(avbuf);

     AVRational v4l2_timebase = { 1, USEC_PER_SEC };

static inline uint64_t v4l2_get_pts(V4L2Buffer *avbuf)

{

    V4L2m2mContext *s = buf_to_m2mctx(avbuf);

    AVRational v4l2_timebase = { 1, USEC_PER_SEC };

    int64_t v4l2_pts;

    /* convert pts back to encoder timebase */

    v4l2_pts = avbuf->buf.timestamp.tv_sec * USEC_PER_SEC + avbuf->buf.timestamp.tv_usec;

    return av_rescale_q(v4l2_pts, v4l2_timebase, s->avctx->time_base);

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     long len;

+
     if (fd < 0) {

         return -1;

int kvmppc_remove_spapr_tce(void *table, int fd, uint32_t window_size)

{

    long len;

    if (fd < 0) {

        return -1;

    }

    len = (window_size / SPAPR_VIO_TCE_PAGE_SIZE)*sizeof(VIOsPAPR_RTCE);

    if ((munmap(table, len) < 0) ||

        (close(fd) < 0)) {

        fprintf(stderr, "KVM: Unexpected error removing KVM SPAPR TCE "

                "table: %s", strerror(errno));

        /* Leak the table */

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,

                        unsigned int len)
+
+{
+
     vq->last_avail_idx--;

void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,

                       unsigned int len)

{

    vq->last_avail_idx--;

    virtqueue_unmap_sg(vq, elem, len);

}


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

         size -= ret;

+    }
+
+
+
+    g_free(buffer);

     return dropped;

static ssize_t drop_sync(int fd, size_t size)

{

    ssize_t ret, dropped = size;

    uint8_t *buffer = g_malloc(MIN(65536, size));

    while (size > 0) {

        ret = read_sync(fd, buffer, MIN(65536, size));

        if (ret < 0) {

            g_free(buffer);

            return ret;

        }

        assert(ret <= size);

        size -= ret;

    }

    g_free(buffer);

    return dropped;

}


static int save_zero_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,

                          uint8_t *p)

{

    int pages = -1;

    if (is_zero_range(p, TARGET_PAGE_SIZE)) {

        rs->zero_pages++;

        rs->bytes_transferred +=

            save_page_header(rs, block, offset | RAM_SAVE_FLAG_COMPRESS);

        qemu_put_byte(rs->f, 0);

        rs->bytes_transferred += 1;

        pages = 1;

    }

    return pages;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static av_always_inline int rv40_loop_filter_strength(uint8_t *src,

                                                       int step, int stride,

static av_always_inline int rv40_loop_filter_strength(uint8_t *src,

                                                      int step, int stride,

                                                      int beta, int beta2,

                                                      int edge,

                                                      int *p1, int *q1)

{

    int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0;

    int strong0 = 0, strong1 = 0;

    uint8_t *ptr;

    int i;

    for (i = 0, ptr = src; i < 4; i++, ptr += stride) {

        sum_p1p0 += ptr[-2*step] - ptr[-1*step];

        sum_q1q0 += ptr[ 1*step] - ptr[ 0*step];

    }

    *p1 = FFABS(sum_p1p0) < (beta << 2);

    *q1 = FFABS(sum_q1q0) < (beta << 2);

    if(!*p1 && !*q1)

        return 0;

    if (!edge)

        return 0;

    for (i = 0, ptr = src; i < 4; i++, ptr += stride) {

        sum_p1p2 += ptr[-2*step] - ptr[-3*step];

        sum_q1q2 += ptr[ 1*step] - ptr[ 2*step];

    }

    strong0 = *p1 && (FFABS(sum_p1p2) < beta2);

    strong1 = *q1 && (FFABS(sum_q1q2) < beta2);

    return strong0 && strong1;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     if (state == SPAPR_DR_ALLOCATION_STATE_USABLE) {

         /* if there's no resource/device associated with the DRC, there's
+
+         * no way for us to put it in an allocation state consistent with
+
+         * being 'USABLE'. PAPR 2.7, 13.5.3.4 documents that this should
+
          * result in an RTAS return code of -3 / "no such indicator"

          */

static uint32_t set_allocation_state(sPAPRDRConnector *drc,

                                     sPAPRDRAllocationState state)

{

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);

    DPRINTFN("drc: %x, set_allocation_state: %x", get_index(drc), state);

    if (state == SPAPR_DR_ALLOCATION_STATE_USABLE) {

        /* if there's no resource/device associated with the DRC, there's

         * no way for us to put it in an allocation state consistent with

         * being 'USABLE'. PAPR 2.7, 13.5.3.4 documents that this should

         * result in an RTAS return code of -3 / "no such indicator"

         */

        if (!drc->dev) {

            return RTAS_OUT_NO_SUCH_INDICATOR;

        }

    }

    if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI) {

        drc->allocation_state = state;

        if (drc->awaiting_release &&

            drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {

            DPRINTFN("finalizing device removal");

            drck->detach(drc, DEVICE(drc->dev), drc->detach_cb,

                         drc->detach_cb_opaque, NULL);

        }

    }

    return RTAS_OUT_SUCCESS;

}


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

             fn(node->opaque);

+        }
+
+    }
+
+    qemu_lockcnt_dec(&ctx->list_lock);

 }

static void poll_set_started(AioContext *ctx, bool started)

{

    AioHandler *node;

    if (started == ctx->poll_started) {

        return;

    }

    ctx->poll_started = started;

    qemu_lockcnt_inc(&ctx->list_lock);

    QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {

        IOHandler *fn;

        if (node->deleted) {

            continue;

        }

        if (started) {

            fn = node->io_poll_begin;

        } else {

            fn = node->io_poll_end;

        }

        if (fn) {

            fn(node->opaque);

        }

    }

    qemu_lockcnt_dec(&ctx->list_lock);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int pxa2xx_i2c_slave_init(I2CSlave *i2c)

+{
+
     /* Nothing to do.  */

     return 0;

static int pxa2xx_i2c_slave_init(I2CSlave *i2c)

{

    /* Nothing to do.  */

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 int parse_host_src_port(struct sockaddr_in *haddr,
+
                         struct sockaddr_in *saddr,

                         const char *input_str)

int parse_host_src_port(struct sockaddr_in *haddr,

                        struct sockaddr_in *saddr,

                        const char *input_str)

{

    char *str = strdup(input_str);

    char *host_str = str;

    char *src_str;

    const char *src_str2;

    char *ptr;

    /*

     * Chop off any extra arguments at the end of the string which

     * would start with a comma, then fill in the src port information

     * if it was provided else use the "any address" and "any port".

     */

    if ((ptr = strchr(str,',')))

        *ptr = '\0';

    if ((src_str = strchr(input_str,'@'))) {

        *src_str = '\0';

        src_str++;

    }

    if (parse_host_port(haddr, host_str) < 0)

        goto fail;

    src_str2 = src_str;

    if (!src_str || *src_str == '\0')

        src_str2 = ":0";

    if (parse_host_port(saddr, src_str2) < 0)

        goto fail;

    free(str);

    return(0);

fail:

    free(str);

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -2,11 +2,11 @@
 {
     YuvPixel p;
     int y, y0;
+    for (y = 0; y < mp->avctx->height; ++y) {
+        if (mp->changes_map[y * mp->avctx->width] != 0) {
+            memset(mp->gradient_scale, 1, sizeof(mp->gradient_scale));
+            p = mp_get_yuv_from_rgb(mp, 0, y);
+        } else {
             p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
             p.y = av_clip(p.y, 0, 31);
             if ((y & 3) == 0) {

static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb)
{
    YuvPixel p;
    int y, y0;
    for (y = 0; y < mp->avctx->height; ++y) {
        if (mp->changes_map[y * mp->avctx->width] != 0) {
            memset(mp->gradient_scale, 1, sizeof(mp->gradient_scale));
            p = mp_get_yuv_from_rgb(mp, 0, y);
        } else {
            p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
            p.y = av_clip(p.y, 0, 31);
            if ((y & 3) == 0) {
                p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
                p.v = av_clip(p.v, -32, 31);
                p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
                p.u = av_clip(p.u, -32, 31);
            }
            mp->vpt[y] = p;
            mp_set_rgb_from_yuv(mp, 0, y, &p);
        }
    }
    for (y0 = 0; y0 < 2; ++y0)
        for (y = y0; y < mp->avctx->height; y += 2)
            mp_decode_line(mp, gb, y);
}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
+{
+    if(!strcmp(cmd, "ping")){
         av_strlcatf(res, res_len, "pong from:%s %s\n", filter->filter->name, filter->name);
         return 0;
     }else if(!strcmp(cmd, "enable")) {

int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
{
    if(!strcmp(cmd, "ping")){
        av_strlcatf(res, res_len, "pong from:%s %s\n", filter->filter->name, filter->name);
        return 0;
    }else if(!strcmp(cmd, "enable")) {
        return set_enable_expr(filter, arg);
    }else if(filter->filter->process_command) {
        return filter->filter->process_command(filter, cmd, arg, res, res_len, flags);
    return AVERROR(ENOSYS);


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void dma_aio_cancel(BlockDriverAIOCB *acb)

 {
+
     DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);

static void dma_aio_cancel(BlockDriverAIOCB *acb)

{

    DMAAIOCB *dbs = container_of(acb, DMAAIOCB, common);

    if (dbs->acb) {

        bdrv_aio_cancel(dbs->acb);

    }

}


--- a/source.c
+++ b/source.c
@@ -7,5 +7,5 @@
     errno = ENOTSUP;

     return -1;
+
+}

static ssize_t v9fs_synth_llistxattr(FsContext *ctx, V9fsPath *path,

                                     void *value, size_t size)

{

    errno = ENOTSUP;

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 void helper_retry(void)
+
+{
+
+    env->pc = env->tsptr->tpc;
+
+    env->npc = env->tsptr->tnpc;

+    PUT_CCR(env, env->tsptr->tstate >> 32);

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

void helper_retry(void)

{

    env->pc = env->tsptr->tpc;

    env->npc = env->tsptr->tnpc;

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

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

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

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

    env->tl--;

    env->tsptr = &env->ts[env->tl & MAXTL_MASK];

}


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

 {

+    has_pci_info = false;
+
+    has_acpi_build = false;
+
+    smbios_defaults = false;

static void pc_init_pci_no_kvmclock(MachineState *machine)

{

    has_pci_info = false;

    has_acpi_build = false;

    smbios_defaults = false;

    x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);

    enable_compat_apic_id_mode();

    pc_init1(machine, 1, 0);

}


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

     guest_fsfreeze_state.status = GUEST_FSFREEZE_STATUS_THAWED;

+}

static void guest_fsfreeze_init(void)

{

    guest_fsfreeze_state.status = GUEST_FSFREEZE_STATUS_THAWED;

}


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

     tcg_gen_andi_i32(rm, t1, 0xff000000);

+    tcg_gen_shri_i32(tmp, t0, 8);
+
+    tcg_gen_andi_i32(tmp, tmp, 0xff0000);
+
+    tcg_gen_or_i32(rm, rm, tmp);

     tcg_gen_shri_i32(tmp, t1, 8);

static void gen_neon_zip_u8(TCGv t0, TCGv t1)

{

    TCGv rd, rm, tmp;

    rd = new_tmp();

    rm = new_tmp();

    tmp = new_tmp();

    tcg_gen_andi_i32(rd, t0, 0xff);

    tcg_gen_shli_i32(tmp, t1, 8);

    tcg_gen_andi_i32(tmp, tmp, 0xff00);

    tcg_gen_or_i32(rd, rd, tmp);

    tcg_gen_shli_i32(tmp, t0, 16);

    tcg_gen_andi_i32(tmp, tmp, 0xff0000);

    tcg_gen_or_i32(rd, rd, tmp);

    tcg_gen_shli_i32(tmp, t1, 24);

    tcg_gen_andi_i32(tmp, tmp, 0xff000000);

    tcg_gen_or_i32(rd, rd, tmp);

    tcg_gen_andi_i32(rm, t1, 0xff000000);

    tcg_gen_shri_i32(tmp, t0, 8);

    tcg_gen_andi_i32(tmp, tmp, 0xff0000);

    tcg_gen_or_i32(rm, rm, tmp);

    tcg_gen_shri_i32(tmp, t1, 8);

    tcg_gen_andi_i32(tmp, tmp, 0xff00);

    tcg_gen_or_i32(rm, rm, tmp);

    tcg_gen_shri_i32(tmp, t0, 16);

    tcg_gen_andi_i32(tmp, tmp, 0xff);

    tcg_gen_or_i32(t1, rm, tmp);

    tcg_gen_mov_i32(t0, rd);

    dead_tmp(tmp);

    dead_tmp(rm);

    dead_tmp(rd);

}


--- a/source.c
+++ b/source.c
@@ -19,7 +19,7 @@
         error_printf_unless_qmp(

             "firstport value of %u makes companion take ports %u - %u, which "
+
             "is outside of the valid range of 0 - %u\n", firstport, firstport,

             firstport + portcount - 1, NB_PORTS - 1);

static int ehci_register_companion(USBBus *bus, USBPort *ports[],

                                   uint32_t portcount, uint32_t firstport)

{

    EHCIState *s = container_of(bus, EHCIState, bus);

    uint32_t i;

    if (firstport + portcount > NB_PORTS) {

        qerror_report(QERR_INVALID_PARAMETER_VALUE, "firstport",

                      "firstport on masterbus");

        error_printf_unless_qmp(

            "firstport value of %u makes companion take ports %u - %u, which "

            "is outside of the valid range of 0 - %u\n", firstport, firstport,

            firstport + portcount - 1, NB_PORTS - 1);

        return -1;

    }

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

        if (s->companion_ports[firstport + i]) {

            qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus",

                          "an USB masterbus");

            error_printf_unless_qmp(

                "port %u on masterbus %s already has a companion assigned\n",

                firstport + i, bus->qbus.name);

            return -1;

        }

    }

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

        s->companion_ports[firstport + i] = ports[i];

        s->ports[firstport + i].speedmask |=

            USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL;

        /* Ensure devs attached before the initial reset go to the companion */

        s->portsc[firstport + i] = PORTSC_POWNER;

    }

    s->companion_count++;

    s->mmio[0x05] = (s->companion_count << 4) | portcount;

    return 0;

}


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

     return ff_h264_decoder.flush(avctx);

+}

static void vdadec_flush(AVCodecContext *avctx)

{

    return ff_h264_decoder.flush(avctx);

}


static uint64_t hb_regs_read(void *opaque, target_phys_addr_t offset,

                             unsigned size)

{

    uint32_t *regs = opaque;

    uint32_t value = regs[offset/4];

    if ((offset == 0x100) || (offset == 0x108) || (offset == 0x10C)) {

        value |= 0x30000000;

    }

    return value;

}


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

+err:
+
+    while (--i >= 0) {
+
+        obj = sc->threads + i * size;

         object_unparent(obj);

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

{

    sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));

    CPUCore *cc = CPU_CORE(OBJECT(dev));

    const char *typename = object_class_get_name(sc->cpu_class);

    size_t size = object_type_get_instance_size(typename);

    Error *local_err = NULL;

    Object *obj;

    int i;

    sc->threads = g_malloc0(size * cc->nr_threads);

    for (i = 0; i < cc->nr_threads; i++) {

        char id[32];

        void *obj = sc->threads + i * size;

        object_initialize(obj, size, typename);

        snprintf(id, sizeof(id), "thread[%d]", i);

        object_property_add_child(OBJECT(sc), id, obj, &local_err);

        if (local_err) {

            goto err;

        }

    }

    object_child_foreach(OBJECT(dev), spapr_cpu_core_realize_child, &local_err);

    if (local_err) {

        goto err;

    } else {

        return;

    }

err:

    while (--i >= 0) {

        obj = sc->threads + i * size;

        object_unparent(obj);

    }

    g_free(sc->threads);

    error_propagate(errp, local_err);

}


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

 #ifdef WORDS_BIGENDIAN

+        stq_p(mem_buf, env->avr[n].u64[0]);

         stq_p(mem_buf+8, env->avr[n].u64[1]);

+#else

         stq_p(mem_buf, env->avr[n].u64[1]);

static int gdb_get_avr_reg(CPUState *env, uint8_t *mem_buf, int n)

{

    if (n < 32) {

#ifdef WORDS_BIGENDIAN

        stq_p(mem_buf, env->avr[n].u64[0]);

        stq_p(mem_buf+8, env->avr[n].u64[1]);

#else

        stq_p(mem_buf, env->avr[n].u64[1]);

        stq_p(mem_buf+8, env->avr[n].u64[0]);

#endif

        return 16;

    }

    if (n == 33) {

        stl_p(mem_buf, env->vscr);

        return 4;

    }

    if (n == 34) {

        stl_p(mem_buf, (uint32_t)env->spr[SPR_VRSAVE]);

        return 4;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 BlockDriverAIOCB *bdrv_aio_write(BlockDriverState *bs, int64_t sector_num,

                                  const uint8_t *buf, int nb_sectors,
+
                                  BlockDriverCompletionFunc *cb, void *opaque)
+
 {

     BlockDriver *drv = bs->drv;

BlockDriverAIOCB *bdrv_aio_write(BlockDriverState *bs, int64_t sector_num,

                                 const uint8_t *buf, int nb_sectors,

                                 BlockDriverCompletionFunc *cb, void *opaque)

{

    BlockDriver *drv = bs->drv;

    BlockDriverAIOCB *ret;

    if (!drv)

        return NULL;

    if (bs->read_only)

        return NULL;

    if (bdrv_wr_badreq_sectors(bs, sector_num, nb_sectors))

        return NULL;

    if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {

        memcpy(bs->boot_sector_data, buf, 512);

    }

    ret = drv->bdrv_aio_write(bs, sector_num, buf, nb_sectors, cb, opaque);

    if (ret) {

	/* Update stats even though technically transfer has not happened. */

	bs->wr_bytes += (unsigned) nb_sectors * SECTOR_SIZE;

	bs->wr_ops ++;

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     ram_addr_t addr;

     if ((last_ram_offset + size) > kqemu_phys_ram_size) {
+
+        fprintf(stderr, "Not enough memory (requested_size = %" PRIu64 ", max memory = %" PRIu64 ")\n",
+
+                (uint64_t)size, (uint64_t)kqemu_phys_ram_size);
+
         abort();

     }

static ram_addr_t kqemu_ram_alloc(ram_addr_t size)

{

    ram_addr_t addr;

    if ((last_ram_offset + size) > kqemu_phys_ram_size) {

        fprintf(stderr, "Not enough memory (requested_size = %" PRIu64 ", max memory = %" PRIu64 ")\n",

                (uint64_t)size, (uint64_t)kqemu_phys_ram_size);

        abort();

    }

    addr = last_ram_offset;

    last_ram_offset = TARGET_PAGE_ALIGN(last_ram_offset + size);

    return addr;

}


static inline void downmix_2f_2r_to_dolby(float *samples)

{

    int i;

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

        samples[i] -= samples[i + 512];

        samples[i + 256] += samples[i + 768];

        samples[i + 512] = samples[i + 768] = 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 RockerSwitch *qmp_query_rocker(const char *name, Error **errp)
+
 {

     RockerSwitch *rocker = g_malloc0(sizeof(*rocker));

RockerSwitch *qmp_query_rocker(const char *name, Error **errp)

{

    RockerSwitch *rocker = g_malloc0(sizeof(*rocker));

    Rocker *r;

    r = rocker_find(name);

    if (!r) {

        error_set(errp, ERROR_CLASS_GENERIC_ERROR,

                  "rocker %s not found", name);

        return NULL;

    }

    rocker->name = g_strdup(r->name);

    rocker->id = r->switch_id;

    rocker->ports = r->fp_ports;

    return rocker;

}


--- a/source.c
+++ b/source.c
@@ -1,17 +1,17 @@
+void qemu_init_vcpu(void *_env)
+
+{
+
+    CPUState *env = _env;
+
+    int r;
+
+
+
     env->nr_cores = smp_cores;
+
     env->nr_threads = smp_threads;
+

     if (kvm_enabled()) {

void qemu_init_vcpu(void *_env)

{

    CPUState *env = _env;

    int r;

    env->nr_cores = smp_cores;

    env->nr_threads = smp_threads;

    if (kvm_enabled()) {

        r = kvm_init_vcpu(env);

        if (r < 0) {

            fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r));

            exit(1);

        }

        qemu_kvm_init_cpu_signals(env);

    } else {

        qemu_tcg_init_cpu_signals();

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 char *socket_address_to_string(struct SocketAddress *addr, Error **errp)

 {
+
+    char *buf;
+
+    InetSocketAddress *inet;
+

     switch (addr->type) {

char *socket_address_to_string(struct SocketAddress *addr, Error **errp)

{

    char *buf;

    InetSocketAddress *inet;

    switch (addr->type) {

    case SOCKET_ADDRESS_KIND_INET:

        inet = addr->u.inet.data;

        if (strchr(inet->host, ':') == NULL) {

            buf = g_strdup_printf("%s:%s", inet->host, inet->port);

        } else {

            buf = g_strdup_printf("[%s]:%s", inet->host, inet->port);

        }

        break;

    case SOCKET_ADDRESS_KIND_UNIX:

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

        break;

    case SOCKET_ADDRESS_KIND_FD:

        buf = g_strdup(addr->u.fd.data->str);

        break;

    case SOCKET_ADDRESS_KIND_VSOCK:

        buf = g_strdup_printf("%s:%s",

                              addr->u.vsock.data->cid,

                              addr->u.vsock.data->port);

        break;

    default:

        abort();

    }

    return buf;

}


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

                    "-device ide-cd,drive=sr0,bus=ide.0", tmp_path);

+    qtest_irq_intercept_in(global_qtest, "ioapic");
+
+
+
+    guest_buf = guest_alloc(guest_malloc, len);

     prdt[0].addr = cpu_to_le32(guest_buf);

static void test_cdrom_dma(void)

{

    static const size_t len = ATAPI_BLOCK_SIZE;

    char *pattern = g_malloc(ATAPI_BLOCK_SIZE * 16);

    char *rx = g_malloc0(len);

    uintptr_t guest_buf;

    PrdtEntry prdt[1];

    FILE *fh;

    ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 "

                   "-device ide-cd,drive=sr0,bus=ide.0", tmp_path);

    qtest_irq_intercept_in(global_qtest, "ioapic");

    guest_buf = guest_alloc(guest_malloc, len);

    prdt[0].addr = cpu_to_le32(guest_buf);

    prdt[0].size = cpu_to_le32(len | PRDT_EOT);

    generate_pattern(pattern, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE);

    fh = fopen(tmp_path, "w+");

    fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh);

    fclose(fh);

    send_dma_request(CMD_PACKET, 0, 1, prdt, 1, send_scsi_cdb_read10);

    /* Read back data from guest memory into local qtest memory */

    memread(guest_buf, rx, len);

    g_assert_cmpint(memcmp(pattern, rx, len), ==, 0);

    g_free(pattern);

    g_free(rx);

    test_bmdma_teardown();

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,

+                             uint64_t address, uint32_t data, PCIDevice *dev)

+{

     S390PCIBusDevice *pbdev;

int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,

                             uint64_t address, uint32_t data, PCIDevice *dev)

{

    S390PCIBusDevice *pbdev;

    uint32_t fid = data >> ZPCI_MSI_VEC_BITS;

    uint32_t vec = data & ZPCI_MSI_VEC_MASK;

    pbdev = s390_pci_find_dev_by_fid(fid);

    if (!pbdev) {

        DPRINTF("add_msi_route no dev\n");

        return -ENODEV;

    }

    pbdev->routes.adapter.ind_offset = vec;

    route->type = KVM_IRQ_ROUTING_S390_ADAPTER;

    route->flags = 0;

    route->u.adapter.summary_addr = pbdev->routes.adapter.summary_addr;

    route->u.adapter.ind_addr = pbdev->routes.adapter.ind_addr;

    route->u.adapter.summary_offset = pbdev->routes.adapter.summary_offset;

    route->u.adapter.ind_offset = pbdev->routes.adapter.ind_offset;

    route->u.adapter.adapter_id = pbdev->routes.adapter.adapter_id;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void read_len_table(uint8_t *dst, GetBitContext *gb){

     int i, val, repeat;

static void read_len_table(uint8_t *dst, GetBitContext *gb){

    int i, val, repeat;

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

        repeat= get_bits(gb, 3);

        val   = get_bits(gb, 5);

        if(repeat==0)

            repeat= get_bits(gb, 8);

//printf("%d %d\n", val, repeat);

        while (repeat--)

            dst[i++] = val;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void ahci_reg_init(AHCIState *s)

+{

     int i;

static void ahci_reg_init(AHCIState *s)

{

    int i;

    s->control_regs.cap = (s->ports - 1) |

                          (AHCI_NUM_COMMAND_SLOTS << 8) |

                          (AHCI_SUPPORTED_SPEED_GEN1 << AHCI_SUPPORTED_SPEED) |

                          HOST_CAP_NCQ | HOST_CAP_AHCI;

    s->control_regs.impl = (1 << s->ports) - 1;

    s->control_regs.version = AHCI_VERSION_1_0;

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

        s->dev[i].port_state = STATE_RUN;

    }

}


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

+
     for(mb_y=s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {

         for(mb_x=0; mb_x < s->mb_width; mb_x++) {

static int mb_var_thread(AVCodecContext *c, void *arg){

    MpegEncContext *s= *(void**)arg;

    int mb_x, mb_y;

    for(mb_y=s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {

        for(mb_x=0; mb_x < s->mb_width; mb_x++) {

            int xx = mb_x * 16;

            int yy = mb_y * 16;

            uint8_t *pix = s->new_picture.f.data[0] + (yy * s->linesize) + xx;

            int varc;

            int sum = s->dsp.pix_sum(pix, s->linesize);

            varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)sum*sum)>>8) + 500 + 128)>>8;

            s->current_picture.mb_var [s->mb_stride * mb_y + mb_x] = varc;

            s->current_picture.mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8;

            s->me.mb_var_sum_temp    += varc;

        }

    }

    return 0;

}


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

     int ret;
+
+    uint8_t buf[ID3v1_TAG_SIZE];
+
+    int64_t filesize, position = avio_tell(s->pb);
+

     if (s->pb->seekable) {

void ff_id3v1_read(AVFormatContext *s)

{

    int ret;

    uint8_t buf[ID3v1_TAG_SIZE];

    int64_t filesize, position = avio_tell(s->pb);

    if (s->pb->seekable) {

        /* XXX: change that */

        filesize = avio_size(s->pb);

        if (filesize > 128) {

            avio_seek(s->pb, filesize - 128, SEEK_SET);

            ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE);

            if (ret == ID3v1_TAG_SIZE) {

                parse_tag(s, buf);

            }

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

        }

    }

}


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

     hwaddr physical;

+    int prot;

     int access_type;

hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address, int rw)

{

    hwaddr physical;

    int prot;

    int access_type;

    int ret = 0;

    /* data access */

    access_type = ACCESS_INT;

    ret = get_physical_address(env, &physical, &prot,

                               address, rw, access_type);

    if (ret != TLBRET_MATCH) {

        raise_mmu_exception(env, address, rw, ret);

        return -1LL;

    } else {

        return physical;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,

                       uint32_t sums[][MAX_PARTITIONS])

@@ -6,7 +6,7 @@

     int i, j;

+    int parts;

     uint32_t *res, *res_end;

static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,

                      uint32_t sums[][MAX_PARTITIONS])

{

    int i, j;

    int parts;

    uint32_t *res, *res_end;

    /* sums for highest level */

    parts   = (1 << pmax);

    res     = &data[pred_order];

    res_end = &data[n >> pmax];

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

        uint32_t sum = 0;

        while (res < res_end)

            sum += *(res++);

        sums[pmax][i] = sum;

        res_end += n >> pmax;

    }

    /* sums for lower levels */

    for (i = pmax - 1; i >= pmin; i--) {

        parts = (1 << i);

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

            sums[i][j] = sums[i+1][2*j] + sums[i+1][2*j+1];

    }

}


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

     if (h&3) {

+        ff_avg_dirac_pixels32_c(dst, src, stride, h);
+
+    } else {
+
     ff_avg_pixels16_sse2(dst   , src[0]   , stride, h);

     ff_avg_pixels16_sse2(dst+16, src[0]+16, stride, h);

void ff_avg_dirac_pixels32_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h)

{

    if (h&3) {

        ff_avg_dirac_pixels32_c(dst, src, stride, h);

    } else {

    ff_avg_pixels16_sse2(dst   , src[0]   , stride, h);

    ff_avg_pixels16_sse2(dst+16, src[0]+16, stride, h);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void x8_init_block_index(MpegEncContext *s){ //FIXME maybe merge with ff_*
+
+//not s->linesize as this would be wrong for field pics
+
+//not that IntraX8 has interlacing support ;)
+
     const int linesize   = s->current_picture.f.linesize[0];

     const int uvlinesize = s->current_picture.f.linesize[1];

static void x8_init_block_index(MpegEncContext *s){ //FIXME maybe merge with ff_*

//not s->linesize as this would be wrong for field pics

//not that IntraX8 has interlacing support ;)

    const int linesize   = s->current_picture.f.linesize[0];

    const int uvlinesize = s->current_picture.f.linesize[1];

    s->dest[0] = s->current_picture.f.data[0];

    s->dest[1] = s->current_picture.f.data[1];

    s->dest[2] = s->current_picture.f.data[2];

    s->dest[0] +=   s->mb_y        *   linesize << 3;

    s->dest[1] += ( s->mb_y&(~1) ) * uvlinesize << 2;//chroma blocks are on add rows

    s->dest[2] += ( s->mb_y&(~1) ) * uvlinesize << 2;

}


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

+    /* Decorrelate and scale to output depth */
+
+    while (count--) {
+
+        left = *decoded1 - (*decoded0 / 2);

         right = left + *decoded0;

static void ape_unpack_stereo(APEContext *ctx, int count)

{

    int32_t left, right;

    int32_t *decoded0 = ctx->decoded[0];

    int32_t *decoded1 = ctx->decoded[1];

    if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {

        /* We are pure silence, so we're done. */

        av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence stereo\n");

        return;

    }

    entropy_decode(ctx, count, 1);

    ape_apply_filters(ctx, decoded0, decoded1, count);

    /* Now apply the predictor decoding */

    predictor_decode_stereo(ctx, count);

    /* Decorrelate and scale to output depth */

    while (count--) {

        left = *decoded1 - (*decoded0 / 2);

        right = left + *decoded0;

        *(decoded0++) = left;

        *(decoded1++) = right;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void set_dirty_bitmap(BlockDriverState *bs, int64_t sector_num,

                              int nb_sectors, int dirty)
+
 {
+
     int64_t start, end;

static void set_dirty_bitmap(BlockDriverState *bs, int64_t sector_num,

                             int nb_sectors, int dirty)

{

    int64_t start, end;

    start = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK;

    end = (sector_num + nb_sectors) / BDRV_SECTORS_PER_DIRTY_CHUNK;

    for (; start <= end; start++) {

        bs->dirty_bitmap[start] = dirty;

    }

}


--- a/source.c
+++ b/source.c
@@ -5,5 +5,5 @@
         update_external_clock_pts(is, pts);

     }
+
+}

static void check_external_clock_sync(VideoState *is, double pts) {

    if (fabs(get_external_clock(is) - pts) > AV_NOSYNC_THRESHOLD) {

        update_external_clock_pts(is, pts);

    }

}


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

+    av_assert0(context_count && h->slice_ctx[context_count - 1].mb_y < h->mb_height);

int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count)

{

    AVCodecContext *const avctx = h->avctx;

    H264SliceContext *sl;

    int i;

    av_assert0(context_count && h->slice_ctx[context_count - 1].mb_y < h->mb_height);

    if (h->avctx->hwaccel ||

        h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)

        return 0;

    if (context_count == 1) {

        int ret = decode_slice(avctx, &h->slice_ctx[0]);

        h->mb_y = h->slice_ctx[0].mb_y;

        return ret;

    } else {

        av_assert0(context_count > 0);

        for (i = 1; i < context_count; i++) {

            sl                 = &h->slice_ctx[i];

            if (CONFIG_ERROR_RESILIENCE) {

                sl->er.error_count = 0;

            }

        }

        avctx->execute(avctx, decode_slice, h->slice_ctx,

                       NULL, context_count, sizeof(h->slice_ctx[0]));

        /* pull back stuff from slices to master context */

        sl                   = &h->slice_ctx[context_count - 1];

        h->mb_y              = sl->mb_y;

        if (CONFIG_ERROR_RESILIENCE) {

            for (i = 1; i < context_count; i++)

                h->slice_ctx[0].er.error_count += h->slice_ctx[i].er.error_count;

        }

    }

    return 0;

}


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

     RV34DecContext *r = avctx->priv_data;
+

     r->s.avctx = avctx;

int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx)

{

    int err;

    RV34DecContext *r = avctx->priv_data;

    r->s.avctx = avctx;

    if (avctx->internal->is_copy) {

        r->tmp_b_block_base = NULL;

        if ((err = ff_MPV_common_init(&r->s)) < 0)

            return err;

        if ((err = rv34_decoder_alloc(r)) < 0)

            return err;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {

         avctx->active_thread_type = FF_THREAD_FRAME;
+
+    } else {
+
+        avctx->active_thread_type = FF_THREAD_SLICE;
+
     }

 }

static void validate_thread_parameters(AVCodecContext *avctx)

{

    int frame_threading_supported = (avctx->codec->capabilities & CODEC_CAP_FRAME_THREADS)

                                && !(avctx->flags & CODEC_FLAG_TRUNCATED)

                                && !(avctx->flags & CODEC_FLAG_LOW_DELAY)

                                && !(avctx->flags2 & CODEC_FLAG2_CHUNKS);

    if (avctx->thread_count == 1) {

        avctx->active_thread_type = 0;

    } else if (frame_threading_supported && (avctx->thread_type & FF_THREAD_FRAME)) {

        avctx->active_thread_type = FF_THREAD_FRAME;

    } else {

        avctx->active_thread_type = FF_THREAD_SLICE;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void bdrv_io_limits_enable(BlockDriverState *bs)

+{

     assert(!bs->io_limits_enabled);

void bdrv_io_limits_enable(BlockDriverState *bs)

{

    assert(!bs->io_limits_enabled);

    throttle_init(&bs->throttle_state,

                  bdrv_get_aio_context(bs),

                  QEMU_CLOCK_VIRTUAL,

                  bdrv_throttle_read_timer_cb,

                  bdrv_throttle_write_timer_cb,

                  bs);

    bs->io_limits_enabled = true;

}


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

             if (kvm_vm_ioctl(kvm_state, KVM_ARM_SET_DEVICE_ADDR,

+                             &kd->kda) < 0) {
+
+                fprintf(stderr, "KVM_ARM_SET_DEVICE_ADDRESS failed: %s\n",
+
+                        strerror(errno));

                 abort();

static void kvm_arm_machine_init_done(Notifier *notifier, void *data)

{

    KVMDevice *kd, *tkd;

    memory_listener_unregister(&devlistener);

    QSLIST_FOREACH_SAFE(kd, &kvm_devices_head, entries, tkd) {

        if (kd->kda.addr != -1) {

            if (kvm_vm_ioctl(kvm_state, KVM_ARM_SET_DEVICE_ADDR,

                             &kd->kda) < 0) {

                fprintf(stderr, "KVM_ARM_SET_DEVICE_ADDRESS failed: %s\n",

                        strerror(errno));

                abort();

            }

        }

        memory_region_unref(kd->mr);

        g_free(kd);

    }

}


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

     data->qov = qmp_output_visitor_new();

+    g_assert(data->qov != NULL);
+
+
+
     data->ov = qmp_output_get_visitor(data->qov);

     g_assert(data->ov != NULL);

static void visitor_output_setup(TestOutputVisitorData *data,

                                 const void *unused)

{

    data->qov = qmp_output_visitor_new();

    g_assert(data->qov != NULL);

    data->ov = qmp_output_get_visitor(data->qov);

    g_assert(data->ov != NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,

+                              const char *filename, const char *mime_type,

                               enum AVMediaType type)

enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,

                              const char *filename, const char *mime_type,

                              enum AVMediaType type)

{

    if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) {

        fmt = av_guess_format(NULL, filename, NULL);

    }

    if (type == AVMEDIA_TYPE_VIDEO) {

        enum AVCodecID codec_id = AV_CODEC_ID_NONE;

#if CONFIG_IMAGE2_MUXER

        if (!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")) {

            codec_id = ff_guess_image2_codec(filename);

        }

#endif

        if (codec_id == AV_CODEC_ID_NONE)

            codec_id = fmt->video_codec;

        return codec_id;

    } else if (type == AVMEDIA_TYPE_AUDIO)

        return fmt->audio_codec;

    else if (type == AVMEDIA_TYPE_SUBTITLE)

        return fmt->subtitle_codec;

    else

        return AV_CODEC_ID_NONE;

}