--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     /* First word */
     if (nr - bits_to_clear > 0) {
         old_bits = atomic_fetch_and(p, ~mask_to_clear);
+        dirty |= old_bits & mask_to_clear;
+        nr -= bits_to_clear;
+        bits_to_clear = BITS_PER_LONG;
+        mask_to_clear = ~0UL;
+        p++;
     }
     /* Full words */
     if (bits_to_clear == BITS_PER_LONG) {

bool bitmap_test_and_clear_atomic(unsigned long *map, long start, long nr)
{
    unsigned long *p = map + BIT_WORD(start);
    const long size = start + nr;
    int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG);
    unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start);
    unsigned long dirty = 0;
    unsigned long old_bits;
    /* First word */
    if (nr - bits_to_clear > 0) {
        old_bits = atomic_fetch_and(p, ~mask_to_clear);
        dirty |= old_bits & mask_to_clear;
        nr -= bits_to_clear;
        bits_to_clear = BITS_PER_LONG;
        mask_to_clear = ~0UL;
        p++;
    }
    /* Full words */
    if (bits_to_clear == BITS_PER_LONG) {
        while (nr >= BITS_PER_LONG) {
            if (*p) {
                old_bits = atomic_xchg(p, 0);
                dirty |= old_bits;
            }
            nr -= BITS_PER_LONG;
            p++;
        }
    }
    /* Last word */
    if (nr) {
        mask_to_clear &= BITMAP_LAST_WORD_MASK(size);
        old_bits = atomic_fetch_and(p, ~mask_to_clear);
        dirty |= old_bits & mask_to_clear;
    } else {
        if (!dirty) {
            smp_mb();
        }
    }
    return dirty != 0;
}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     CPUBreakpoint *bp;

+
+    QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
+
+        if (bp->pc == pc && bp->flags == flags) {
+
             cpu_breakpoint_remove_by_ref(cpu, bp);

             return 0;

int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)

{

#if defined(TARGET_HAS_ICE)

    CPUBreakpoint *bp;

    QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {

        if (bp->pc == pc && bp->flags == flags) {

            cpu_breakpoint_remove_by_ref(cpu, bp);

            return 0;

        }

    }

    return -ENOENT;

#else

    return -ENOSYS;

#endif

}


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

     if (err) {

+        fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
+
+        exit(1);
+
+    }

 #else /* _WIN32 */

static void qemu_cpu_kick_thread(CPUState *cpu)

{

#ifndef _WIN32

    int err;

    err = pthread_kill(cpu->thread->thread, SIG_IPI);

    if (err) {

        fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));

        exit(1);

    }

#else /* _WIN32 */

    if (!qemu_cpu_is_self(cpu)) {

        SuspendThread(cpu->hThread);

        cpu_signal(0);

        ResumeThread(cpu->hThread);

    }

#endif

}


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

             avpriv_mpegaudio_decode_header(&mh, header))

+            break;
+
+        out_pos[i] = off;
+
+    }

static int check(AVIOContext *pb, int64_t pos, int64_t *out_pos)

{

    MPADecodeHeader mh = { 0 };

    int i;

    uint32_t header;

    int64_t off = 0;

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

        off = avio_seek(pb, pos + mh.frame_size, SEEK_SET);

        if (off < 0)

            break;

        header = avio_rb32(pb);

        if (ff_mpa_check_header(header) < 0 ||

            avpriv_mpegaudio_decode_header(&mh, header))

            break;

        out_pos[i] = off;

    }

    return i;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static int tcp_wait_fd(int fd, int write)
+
+{
+
     int ev = write ? POLLOUT : POLLIN;

     struct pollfd p = { .fd = fd, .events = ev, .revents = 0 };

static int tcp_wait_fd(int fd, int write)

{

    int ev = write ? POLLOUT : POLLIN;

    struct pollfd p = { .fd = fd, .events = ev, .revents = 0 };

    int ret;

    ret = poll(&p, 1, 100);

    return ret < 0 ? ff_neterrno() : p.revents & ev ? 0 : AVERROR(EAGAIN);

}


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

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


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

         if (size <= 2) {

+            return ne2000_asic_ioport_read(s, addr);
+
+        } else {
+
+            return ne2000_asic_ioport_readl(s, addr);

         }

static uint64_t ne2000_read(void *opaque, target_phys_addr_t addr,

                            unsigned size)

{

    NE2000State *s = opaque;

    if (addr < 0x10 && size == 1) {

        return ne2000_ioport_read(s, addr);

    } else if (addr == 0x10) {

        if (size <= 2) {

            return ne2000_asic_ioport_read(s, addr);

        } else {

            return ne2000_asic_ioport_readl(s, addr);

        }

    } else if (addr == 0x1f && size == 1) {

        return ne2000_reset_ioport_read(s, addr);

    }

    return ((uint64_t)1 << (size * 8)) - 1;

}


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

     VirtIOPCIProxy *proxy = opaque;
+
+    VirtQueue *vq = virtio_get_queue(proxy->vdev, n);
+
+    EventNotifier *notifier = virtio_queue_get_host_notifier(vq);
+
     int r;

     if (assign) {

static int virtio_pci_set_host_notifier(void *opaque, int n, bool assign)

{

    VirtIOPCIProxy *proxy = opaque;

    VirtQueue *vq = virtio_get_queue(proxy->vdev, n);

    EventNotifier *notifier = virtio_queue_get_host_notifier(vq);

    int r;

    if (assign) {

        r = event_notifier_init(notifier, 1);

        if (r < 0) {

            return r;

        }

        r = kvm_set_ioeventfd_pio_word(event_notifier_get_fd(notifier),

                                       proxy->addr + VIRTIO_PCI_QUEUE_NOTIFY,

                                       n, assign);

        if (r < 0) {

            event_notifier_cleanup(notifier);

        }

    } else {

        r = kvm_set_ioeventfd_pio_word(event_notifier_get_fd(notifier),

                                       proxy->addr + VIRTIO_PCI_QUEUE_NOTIFY,

                                       n, assign);

        if (r < 0) {

            return r;

        }

        event_notifier_cleanup(notifier);

    }

    return r;

}


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

             /* Short reads mean EOF, pad with zeros. */

+            if (waiocb->is_read) {

                 qemu_iovec_memset(waiocb->qiov, count, 0,

static void win32_aio_process_completion(QEMUWin32AIOState *s,

    QEMUWin32AIOCB *waiocb, DWORD count)

{

    int ret;

    s->count--;

    if (waiocb->ov.Internal != 0) {

        ret = -EIO;

    } else {

        ret = 0;

        if (count < waiocb->nbytes) {

            /* Short reads mean EOF, pad with zeros. */

            if (waiocb->is_read) {

                qemu_iovec_memset(waiocb->qiov, count, 0,

                    waiocb->qiov->size - count);

            } else {

                ret = -EINVAL;

            }

       }

    }

    if (!waiocb->is_linear) {

        if (ret == 0 && waiocb->is_read) {

            QEMUIOVector *qiov = waiocb->qiov;

            char *p = waiocb->buf;

            int i;

            for (i = 0; i < qiov->niov; ++i) {

                memcpy(qiov->iov[i].iov_base, p, qiov->iov[i].iov_len);

                p += qiov->iov[i].iov_len;

            }

            qemu_vfree(waiocb->buf);

        }

    }

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

    qemu_aio_release(waiocb);

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     BufferSinkContext *buf = ctx->priv;

     AVFilterFormats *formats = NULL;
+
     unsigned i;

     int ret;

static int vsink_query_formats(AVFilterContext *ctx)

{

    BufferSinkContext *buf = ctx->priv;

    AVFilterFormats *formats = NULL;

    unsigned i;

    int ret;

    CHECK_LIST_SIZE(pixel_fmts)

    if (buf->pixel_fmts_size) {

        for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++)

            if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0)

                return ret;

        ff_set_common_formats(ctx, formats);

    } else {

        ff_default_query_formats(ctx);

    }

    return 0;

}


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

     ARMCPU *cpu = ARM_CPU(thread_cpu);

+    uint32_t hwcaps = 0;
+
+
+
+    hwcaps |= ARM_HWCAP_ARM_SWP;

     hwcaps |= ARM_HWCAP_ARM_HALF;

static uint32_t get_elf_hwcap(void)

{

    ARMCPU *cpu = ARM_CPU(thread_cpu);

    uint32_t hwcaps = 0;

    hwcaps |= ARM_HWCAP_ARM_SWP;

    hwcaps |= ARM_HWCAP_ARM_HALF;

    hwcaps |= ARM_HWCAP_ARM_THUMB;

    hwcaps |= ARM_HWCAP_ARM_FAST_MULT;

    /* probe for the extra features */

#define GET_FEATURE(feat, hwcap) \

    do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0)

    /* EDSP is in v5TE and above, but all our v5 CPUs are v5TE */

    GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP);

    GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP);

    GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT);

    GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE);

    GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON);

    GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3);

    GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS);

    GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4);

    GET_FEATURE(ARM_FEATURE_ARM_DIV, ARM_HWCAP_ARM_IDIVA);

    GET_FEATURE(ARM_FEATURE_THUMB_DIV, ARM_HWCAP_ARM_IDIVT);

    /* All QEMU's VFPv3 CPUs have 32 registers, see VFP_DREG in translate.c.

     * Note that the ARM_HWCAP_ARM_VFPv3D16 bit is always the inverse of

     * ARM_HWCAP_ARM_VFPD32 (and so always clear for QEMU); it is unrelated

     * to our VFP_FP16 feature bit.

     */

    GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32);

    GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE);

#undef GET_FEATURE

    return hwcaps;

}


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

         case e_floor:

+        case e_ceil:
+
+        case e_trunc:
+
+        case e_sqrt:

         case e_not:

static int verify_expr(AVExpr *e)

{

    if (!e) return 0;

    switch (e->type) {

        case e_value:

        case e_const: return 1;

        case e_func0:

        case e_func1:

        case e_squish:

        case e_ld:

        case e_gauss:

        case e_isnan:

        case e_floor:

        case e_ceil:

        case e_trunc:

        case e_sqrt:

        case e_not:

        case e_random:

            return verify_expr(e->param[0]) && !e->param[2];

        case e_taylor:

            return verify_expr(e->param[0]) && verify_expr(e->param[1])

                   && (!e->param[2] || verify_expr(e->param[2]));

        default: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && !e->param[2];

    }

}


--- a/source.c
+++ b/source.c
@@ -13,7 +13,7 @@
     for (mat = 0; mat < s->num_primitive_matrices; mat++)

         if (s->lsb_bypass[mat])
+
             m->bypassed_lsbs[pos + s->blockpos][mat] = get_bits1(gbp);

static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp,

                                     unsigned int substr, unsigned int pos)

{

    SubStream *s = &m->substream[substr];

    unsigned int mat, channel;

    for (mat = 0; mat < s->num_primitive_matrices; mat++)

        if (s->lsb_bypass[mat])

            m->bypassed_lsbs[pos + s->blockpos][mat] = get_bits1(gbp);

    for (channel = s->min_channel; channel <= s->max_channel; channel++) {

        ChannelParams *cp = &s->channel_params[channel];

        int codebook = cp->codebook;

        int quant_step_size = s->quant_step_size[channel];

        int lsb_bits = cp->huff_lsbs - quant_step_size;

        int result = 0;

        if (codebook > 0)

            result = get_vlc2(gbp, huff_vlc[codebook-1].table,

                            VLC_BITS, (9 + VLC_BITS - 1) / VLC_BITS);

        if (result < 0)

            return AVERROR_INVALIDDATA;

        if (lsb_bits > 0)

            result = (result << lsb_bits) + get_bits(gbp, lsb_bits);

        result  += cp->sign_huff_offset;

        result <<= quant_step_size;

        m->sample_buffer[pos + s->blockpos][channel] = result;

    }

    return 0;

}


PPC_OP(subfic)

{

    T0 = PARAM(1) + ~T0 + 1;

    if (T0 <= PARAM(1)) {

        xer_ca = 1;

    } else {

        xer_ca = 0;

    }

    RETURN();

}


--- a/source.c
+++ b/source.c
@@ -10,8 +10,8 @@
         if (best_dist > dist) {
             best_dist = dist;
             best_band = i;
+        }
+    }
+    f->intensity_stereo = best_band;
+    s->avg_is_band = (s->avg_is_band + f->intensity_stereo)/2.0f;
 }

static void celt_search_for_intensity(OpusPsyContext *s, CeltFrame *f)
{
    int i, best_band = CELT_MAX_BANDS - 1;
    float dist, best_dist = FLT_MAX;
    /* TODO: fix, make some heuristic up here using the lambda value */
    float end_band = 0;
    for (i = f->end_band; i >= end_band; i--) {
        f->intensity_stereo = i;
        bands_dist(s, f, &dist);
        if (best_dist > dist) {
            best_dist = dist;
            best_band = i;
        }
    }
    f->intensity_stereo = best_band;
    s->avg_is_band = (s->avg_is_band + f->intensity_stereo)/2.0f;
}


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

+    fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK);
+
+    if (fd < 0) {
+
+        return fd;

     }

static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path,

                            const struct timespec *buf)

{

    int fd, ret;

    struct handle_data *data = (struct handle_data *)ctx->private;

    fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK);

    if (fd < 0) {

        return fd;

    }

    ret = futimens(fd, buf);

    close(fd);

    return ret;

}


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

         dsp->idct_put = ff_prores_idct_put_10_avx;

+    }
+
+#endif /* HAVE_AVX */
+
+#endif /* ARCH_X86_64 && HAVE_YASM */

 }

void ff_proresdsp_x86_init(ProresDSPContext *dsp)

{

#if ARCH_X86_64 && HAVE_YASM

    int flags = av_get_cpu_flags();

    if (flags & AV_CPU_FLAG_SSE2) {

        dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;

        dsp->idct_put = ff_prores_idct_put_10_sse2;

    }

    if (flags & AV_CPU_FLAG_SSE4) {

        dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;

        dsp->idct_put = ff_prores_idct_put_10_sse4;

    }

#if HAVE_AVX

    if (flags & AV_CPU_FLAG_AVX) {

        dsp->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;

        dsp->idct_put = ff_prores_idct_put_10_avx;

    }

#endif /* HAVE_AVX */

#endif /* ARCH_X86_64 && HAVE_YASM */

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
     retval = offset;

     retval += v9fs_fill_statfs(s, pdu, &stbuf);
+
+out:
+
+    put_fid(pdu, fidp);
+
 out_nofid:

     complete_pdu(s, pdu, retval);

static void v9fs_statfs(void *opaque)

{

    int32_t fid;

    ssize_t retval = 0;

    size_t offset = 7;

    V9fsFidState *fidp;

    struct statfs stbuf;

    V9fsPDU *pdu = opaque;

    V9fsState *s = pdu->s;

    pdu_unmarshal(pdu, offset, "d", &fid);

    fidp = get_fid(pdu, fid);

    if (fidp == NULL) {

        retval = -ENOENT;

        goto out_nofid;

    }

    retval = v9fs_co_statfs(pdu, &fidp->path, &stbuf);

    if (retval < 0) {

        goto out;

    }

    retval = offset;

    retval += v9fs_fill_statfs(s, pdu, &stbuf);

out:

    put_fid(pdu, fidp);

out_nofid:

    complete_pdu(s, pdu, retval);

    return;

}


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

                                            uint64_t ram_size)

+{

     if (mem_path) {

 #ifdef __linux__
+
         Error *err = NULL;

         memory_region_init_ram_from_file(mr, owner, name, ram_size, false,

static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner,

                                           const char *name,

                                           uint64_t ram_size)

{

    if (mem_path) {

#ifdef __linux__

        Error *err = NULL;

        memory_region_init_ram_from_file(mr, owner, name, ram_size, false,

                                         mem_path, &err);

        /* Legacy behavior: if allocation failed, fall back to

         * regular RAM allocation.

         */

        if (err) {

            error_report_err(err);

            memory_region_init_ram(mr, owner, name, ram_size, &error_abort);

        }

#else

        fprintf(stderr, "-mem-path not supported on this host\n");

        exit(1);

#endif

    } else {

        memory_region_init_ram(mr, owner, name, ram_size, &error_abort);

    }

    vmstate_register_ram_global(mr);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int local_opendir(FsContext *ctx,

                          V9fsPath *fs_path, V9fsFidOpenState *fs)
+
+{
+
+    char buffer[PATH_MAX];
+
     char *path = fs_path->data;

static int local_opendir(FsContext *ctx,

                         V9fsPath *fs_path, V9fsFidOpenState *fs)

{

    char buffer[PATH_MAX];

    char *path = fs_path->data;

    fs->dir = opendir(rpath(ctx, path, buffer));

    if (!fs->dir) {

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static av_cold int xvid_encode_close(AVCodecContext *avctx) {

     struct xvid_context *x = avctx->priv_data;
+

     xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);

static av_cold int xvid_encode_close(AVCodecContext *avctx) {

    struct xvid_context *x = avctx->priv_data;

    xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);

    if( avctx->extradata != NULL )

        av_free(avctx->extradata);

    if( x->twopassbuffer != NULL ) {

        av_free(x->twopassbuffer);

        av_free(x->old_twopassbuffer);

    }

    if( x->twopassfile != NULL )

        av_free(x->twopassfile);

    if( x->intra_matrix != NULL )

        av_free(x->intra_matrix);

    if( x->inter_matrix != NULL )

        av_free(x->inter_matrix);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void stq_le_phys(target_phys_addr_t addr, uint64_t val)
+
 {

     val = cpu_to_le64(val);

void stq_le_phys(target_phys_addr_t addr, uint64_t val)

{

    val = cpu_to_le64(val);

    cpu_physical_memory_write(addr, &val, 8);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void pci_mmio_map(PCIDevice * pci_dev, int region_num,

+                         uint32_t addr, uint32_t size, int type)
+
+{
+
+    PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, pci_dev);

static void pci_mmio_map(PCIDevice * pci_dev, int region_num,

                         uint32_t addr, uint32_t size, int type)

{

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

    logout("region %d, addr=0x%08x, size=0x%08x, type=%d\n",

           region_num, addr, size, type);

    if (region_num == 0) {

        /* Map control / status registers. */

        cpu_register_physical_memory(addr, size, d->eepro100.mmio_index);

        d->eepro100.region[region_num] = addr;

    }

}


void apic_sipi(CPUState *env)

{

    APICState *s = env->apic_state;

    cpu_reset_interrupt(env, CPU_INTERRUPT_SIPI);

    if (!s->wait_for_sipi)

        return;

    env->eip = 0;

    cpu_x86_load_seg_cache(env, R_CS, s->sipi_vector << 8, s->sipi_vector << 12,

                           0xffff, 0);

    env->halted = 0;

    s->wait_for_sipi = 0;

}


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

+{
+
+    NetQueue *queue;
+
+

     queue = g_malloc0(sizeof(NetQueue));

NetQueue *qemu_new_net_queue(void *opaque)

{

    NetQueue *queue;

    queue = g_malloc0(sizeof(NetQueue));

    queue->opaque = opaque;

    QTAILQ_INIT(&queue->packets);

    queue->delivering = 0;

    return queue;

}


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

     pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);
+
+    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_I_PCI);
+
+    d->config[0x08] = 0x00; // revision
+
     pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);

     d->config[0x0C] = 0x08; // cache_line_size

static int unin_internal_pci_host_init(PCIDevice *d)

{

    pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_APPLE);

    pci_config_set_device_id(d->config, PCI_DEVICE_ID_APPLE_UNI_N_I_PCI);

    d->config[0x08] = 0x00; // revision

    pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);

    d->config[0x0C] = 0x08; // cache_line_size

    d->config[0x0D] = 0x10; // latency_timer

    d->config[0x34] = 0x00; // capabilities_pointer

    return 0;

}


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

         exit(1);

+    }
+
+    /* Round up optiom rom size to the next 2k boundary */
+
+    size = (size + 2047) & ~2047;

     option_rom_setup_reset(start, size);

static int load_option_rom(const char *oprom, target_phys_addr_t start,

                           target_phys_addr_t end)

{

    int size;

    char *filename;

    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, oprom);

    if (filename) {

        size = get_image_size(filename);

        if (size > 0 && start + size > end) {

            fprintf(stderr, "Not enough space to load option rom '%s'\n",

                    oprom);

            exit(1);

        }

        size = load_image_targphys(filename, start, end - start);

        qemu_free(filename);

    } else {

        size = -1;

    }

    if (size < 0) {

        fprintf(stderr, "Could not load option rom '%s'\n", oprom);

        exit(1);

    }

    /* Round up optiom rom size to the next 2k boundary */

    size = (size + 2047) & ~2047;

    option_rom_setup_reset(start, size);

    return size;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void helper_stq_raw(uint64_t t0, uint64_t t1)

 {
+
     stq_raw(t1, t0);

 }

void helper_stq_raw(uint64_t t0, uint64_t t1)

{

    stq_raw(t1, t0);

}


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

     va_list vl;
+
+    va_start(vl, fmt);
+
+    av_log(NULL, log_level, "%s:%d: ", filename, line_num);

     av_vlog(NULL, log_level, fmt, vl);

static void report_config_error(const char *filename, int line_num, int log_level, int *errors, const char *fmt, ...)

{

    va_list vl;

    va_start(vl, fmt);

    av_log(NULL, log_level, "%s:%d: ", filename, line_num);

    av_vlog(NULL, log_level, fmt, vl);

    va_end(vl);

    (*errors)++;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 int64_t ff_lsb2full(StreamContext *stream, int64_t lsb){
+
     int64_t mask = (1<<stream->msb_pts_shift)-1;

     int64_t delta= stream->last_pts - mask/2;

int64_t ff_lsb2full(StreamContext *stream, int64_t lsb){

    int64_t mask = (1<<stream->msb_pts_shift)-1;

    int64_t delta= stream->last_pts - mask/2;

    return  ((lsb - delta)&mask) + delta;

}


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

             if (ff_neterrno() != AVERROR(EINTR) &&
+
+                ff_neterrno() != AVERROR(EAGAIN))
+
+                return ff_neterrno();
+
         } else {

             break;

static int udp_write(URLContext *h, const uint8_t *buf, int size)

{

    UDPContext *s = h->priv_data;

    int ret;

    for(;;) {

        if (!s->is_connected) {

            ret = sendto (s->udp_fd, buf, size, 0,

                          (struct sockaddr *) &s->dest_addr,

                          s->dest_addr_len);

        } else

            ret = send(s->udp_fd, buf, size, 0);

        if (ret < 0) {

            if (ff_neterrno() != AVERROR(EINTR) &&

                ff_neterrno() != AVERROR(EAGAIN))

                return ff_neterrno();

        } else {

            break;

        }

    }

    return size;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+const uint8_t *get_submv_prob(uint32_t left, uint32_t top)

 {

const uint8_t *get_submv_prob(uint32_t left, uint32_t top)

{

    if (left == top)

        return vp8_submv_prob[4 - !!left];

    if (!top)

        return vp8_submv_prob[2];

    return vp8_submv_prob[1 - !!left];

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int segment_end(AVFormatContext *oc, int write_trailer)

+{
+
+    int ret = 0;
+
+

     av_write_frame(oc, NULL); /* Flush any buffered data (fragmented mp4) */

static int segment_end(AVFormatContext *oc, int write_trailer)

{

    int ret = 0;

    av_write_frame(oc, NULL); /* Flush any buffered data (fragmented mp4) */

    if (write_trailer)

        av_write_trailer(oc);

    avio_close(oc->pb);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void s390x_cpu_timer(void *opaque)
+
+{
+
     S390CPU *cpu = opaque;

     CPUS390XState *env = &cpu->env;

void s390x_cpu_timer(void *opaque)

{

    S390CPU *cpu = opaque;

    CPUS390XState *env = &cpu->env;

    env->pending_int |= INTERRUPT_CPUTIMER;

    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);

}


--- a/source.c
+++ b/source.c
@@ -1,1 +1,1 @@
+static void null_end_frame(AVFilterLink *inlink) { }


static void dequantization_int_97(int x, int y, Jpeg2000Cblk *cblk,

                               Jpeg2000Component *comp,

                               Jpeg2000T1Context *t1, Jpeg2000Band *band)

{

    int i, j;

    int w = cblk->coord[0][1] - cblk->coord[0][0];

    for (j = 0; j < (cblk->coord[1][1] - cblk->coord[1][0]); ++j) {

        int32_t *datap = &comp->i_data[(comp->coord[0][1] - comp->coord[0][0]) * (y + j) + x];

        int *src = t1->data[j];

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

            datap[i] = (src[i] * (int64_t)band->i_stepsize + (1<<14)) >> 15;

    }

}


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

     got = fread_targphys(addr, max_sz, f);
+
+    if (ferror(f)) { fclose(f); return -1; }
+
+    fclose(f);
+

     return got;

int load_image_targphys(const char *filename,

			target_phys_addr_t addr, int max_sz)

{

    FILE *f;

    size_t got;

    f = fopen(filename, "rb");

    if (!f) return -1;

    got = fread_targphys(addr, max_sz, f);

    if (ferror(f)) { fclose(f); return -1; }

    fclose(f);

    return got;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void qemuio_add_command(const cmdinfo_t *ci)
+
 {

     cmdtab = g_realloc(cmdtab, ++ncmds * sizeof(*cmdtab));

void qemuio_add_command(const cmdinfo_t *ci)

{

    cmdtab = g_realloc(cmdtab, ++ncmds * sizeof(*cmdtab));

    cmdtab[ncmds - 1] = *ci;

    qsort(cmdtab, ncmds, sizeof(*cmdtab), compare_cmdname);

}


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

     AIOReq *aio_req;

+

+    if (s->cache_flags != SD_FLAG_CMD_CACHE) {

         return 0;

static int coroutine_fn sd_co_flush_to_disk(BlockDriverState *bs)

{

    BDRVSheepdogState *s = bs->opaque;

    SheepdogAIOCB *acb;

    AIOReq *aio_req;

    if (s->cache_flags != SD_FLAG_CMD_CACHE) {

        return 0;

    }

    acb = sd_aio_setup(bs, NULL, 0, 0);

    acb->aiocb_type = AIOCB_FLUSH_CACHE;

    acb->aio_done_func = sd_finish_aiocb;

    aio_req = alloc_aio_req(s, acb, vid_to_vdi_oid(s->inode.vdi_id),

                            0, 0, 0, 0, 0);

    QLIST_INSERT_HEAD(&s->inflight_aio_head, aio_req, aio_siblings);

    add_aio_request(s, aio_req, NULL, 0, false, acb->aiocb_type);

    qemu_coroutine_yield();

    return acb->ret;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int common_init(AVCodecContext *avctx){

+    HYuvContext *s = avctx->priv_data;

     int i;

     s->avctx= avctx;
+
+    s->flags= avctx->flags;

static int common_init(AVCodecContext *avctx){

    HYuvContext *s = avctx->priv_data;

    int i;

    s->avctx= avctx;

    s->flags= avctx->flags;

    dsputil_init(&s->dsp, avctx);

    s->width= avctx->width;

    s->height= avctx->height;

    assert(s->width>0 && s->height>0);

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

        s->temp[i]= av_malloc(avctx->width + 16);

    }

    return 0;

}


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

     acb->req.error = bdrv_co_discard(bs, acb->req.sector, acb->req.nb_sectors);

+    acb->bh = qemu_bh_new(bdrv_co_em_bh, acb);
+
+    qemu_bh_schedule(acb->bh);
+
 }

static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque)

{

    BlockDriverAIOCBCoroutine *acb = opaque;

    BlockDriverState *bs = acb->common.bs;

    acb->req.error = bdrv_co_discard(bs, acb->req.sector, acb->req.nb_sectors);

    acb->bh = qemu_bh_new(bdrv_co_em_bh, acb);

    qemu_bh_schedule(acb->bh);

}


uint64_t helper_mulldo(CPUPPCState *env, uint64_t arg1, uint64_t arg2)

{

    int64_t th;

    uint64_t tl;

    muls64(&tl, (uint64_t *)&th, arg1, arg2);

    /* If th != 0 && th != -1, then we had an overflow */

    if (likely((uint64_t)(th + 1) <= 1)) {

        env->ov = 0;

    } else {

        env->so = env->ov = 1;

    }

    return (int64_t)tl;

}


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

     MMIOState *s = opaque;
+
+    addr >>= s->shift;
+
+    if (addr & 7)

         return ide_ioport_read(&s->bus, addr);

static uint64_t mmio_ide_read(void *opaque, target_phys_addr_t addr,

                              unsigned size)

{

    MMIOState *s = opaque;

    addr >>= s->shift;

    if (addr & 7)

        return ide_ioport_read(&s->bus, addr);

    else

        return ide_data_readw(&s->bus, 0);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void xhci_check_iso_kick(XHCIState *xhci, XHCITransfer *xfer,

                                 XHCIEPContext *epctx, uint64_t mfindex)

static void xhci_check_iso_kick(XHCIState *xhci, XHCITransfer *xfer,

                                XHCIEPContext *epctx, uint64_t mfindex)

{

    if (xfer->mfindex_kick > mfindex) {

        timer_mod(epctx->kick_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +

                       (xfer->mfindex_kick - mfindex) * 125000);

        xfer->running_retry = 1;

    } else {

        epctx->mfindex_last = xfer->mfindex_kick;

        timer_del(epctx->kick_timer);

        xfer->running_retry = 0;

    }

}


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

     c->sample1 = av_clip_int16(predictor);

+    c->idelta = (ff_adpcm_AdaptationTable[(int)nibble] * c->idelta) >> 8;
+
+    if (c->idelta < 16) c->idelta = 16;
+
+

static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble)

{

    int predictor;

    predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 64;

    predictor += ((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta;

    c->sample2 = c->sample1;

    c->sample1 = av_clip_int16(predictor);

    c->idelta = (ff_adpcm_AdaptationTable[(int)nibble] * c->idelta) >> 8;

    if (c->idelta < 16) c->idelta = 16;

    return c->sample1;


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

     int i;


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

         }

+    }else{

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

int ff_find_unused_picture(MpegEncContext *s, int shared){

    int i;

    if(shared){

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

            if(s->picture[i].data[0]==NULL && s->picture[i].type==0) return i;

        }

    }else{

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

            if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) return i; //FIXME

        }

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

            if(s->picture[i].data[0]==NULL) return i;

        }

    }

    assert(0);

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static void vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
+
                                         int jobnr, int threadnr)

 {

static void vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,

                                        int jobnr, int threadnr)

{

    decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 1);

}


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

     /* The command line flac encoder defaults to placing a seekpoint

+     * every 10s.  So one might add padding to allow that later
+
+     * but there seems to be no simple way to get the duration here.
+
+     * So let's try the flac default of 8192 bytes */

     flac_write_block_padding(s->pb, 8192, 1);

static int flac_write_header(struct AVFormatContext *s)

{

    int ret;

    AVCodecContext *codec = s->streams[0]->codec;

    FlacMuxerContext *c   = s->priv_data;

    if (!c->write_header)

        return 0;

    ret = ff_flac_write_header(s->pb, codec, 0);

    if (ret)

        return ret;

    ret = flac_write_block_comment(s->pb, &s->metadata, 0,

                                   codec->flags & CODEC_FLAG_BITEXACT);

    if (ret)

        return ret;

    /* The command line flac encoder defaults to placing a seekpoint

     * every 10s.  So one might add padding to allow that later

     * but there seems to be no simple way to get the duration here.

     * So let's try the flac default of 8192 bytes */

    flac_write_block_padding(s->pb, 8192, 1);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
     trace_v9fs_flush(pdu->tag, pdu->id, tag);

+
+    if (pdu->tag == tag) {
+
+        error_report("Warning: the guest sent a self-referencing 9P flush request");
+
     } else {

         QLIST_FOREACH(cancel_pdu, &s->active_list, next) {

static void coroutine_fn v9fs_flush(void *opaque)

{

    ssize_t err;

    int16_t tag;

    size_t offset = 7;

    V9fsPDU *cancel_pdu = NULL;

    V9fsPDU *pdu = opaque;

    V9fsState *s = pdu->s;

    err = pdu_unmarshal(pdu, offset, "w", &tag);

    if (err < 0) {

        pdu_complete(pdu, err);

        return;

    }

    trace_v9fs_flush(pdu->tag, pdu->id, tag);

    if (pdu->tag == tag) {

        error_report("Warning: the guest sent a self-referencing 9P flush request");

    } else {

        QLIST_FOREACH(cancel_pdu, &s->active_list, next) {

            if (cancel_pdu->tag == tag) {

                break;

            }

        }

    }

    if (cancel_pdu) {

        cancel_pdu->cancelled = 1;

        /*

         * Wait for pdu to complete.

         */

        qemu_co_queue_wait(&cancel_pdu->complete, NULL);

        if (!qemu_co_queue_next(&cancel_pdu->complete)) {

            cancel_pdu->cancelled = 0;

            pdu_free(cancel_pdu);

        }

    }

    pdu_complete(pdu, 7);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static uint64_t kvmppc_read_int_cpu_dt(const char *propname)
+
 {

     char buf[PATH_MAX];
@@ -9,9 +9,9 @@
         uint32_t v32;

         uint64_t v64;
+
+    } u;
+
     FILE *f;

     int len;

static uint64_t kvmppc_read_int_cpu_dt(const char *propname)

{

    char buf[PATH_MAX];

    union {

        uint32_t v32;

        uint64_t v64;

    } u;

    FILE *f;

    int len;

    if (kvmppc_find_cpu_dt(buf, sizeof(buf))) {

        return -1;

    }

    strncat(buf, "/", sizeof(buf) - strlen(buf));

    strncat(buf, propname, sizeof(buf) - strlen(buf));

    f = fopen(buf, "rb");

    if (!f) {

        return -1;

    }

    len = fread(&u, 1, sizeof(u), f);

    fclose(f);

    switch (len) {

    case 4:

        /* property is a 32-bit quantity */

        return be32_to_cpu(u.v32);

    case 8:

        return be64_to_cpu(u.v64);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         if (value == 1 || value == 2) {

             qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+
+        } else if (value == 3) {
+
+            qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
+
         }

     }

static void hb_regs_write(void *opaque, hwaddr offset,

                          uint64_t value, unsigned size)

{

    uint32_t *regs = opaque;

    if (offset == 0xf00) {

        if (value == 1 || value == 2) {

            qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);

        } else if (value == 3) {

            qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);

        }

    }

    regs[offset/4] = value;

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     } else {

         return -EINVAL;
+
+    }
+
 }

static int do_subchannel_work(SubchDev *sch)

{

    if (sch->do_subchannel_work) {

        return sch->do_subchannel_work(sch);

    } else {

        return -EINVAL;

    }

}


void omap_inth_reset(struct omap_intr_handler_s *s)

{

    int i;

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

        s->bank[i].irqs = 0x00000000;

        s->bank[i].mask = 0xffffffff;

        s->bank[i].sens_edge = 0x00000000;

        s->bank[i].fiq = 0x00000000;

        s->bank[i].inputs = 0x00000000;

        s->bank[i].swi = 0x00000000;

        memset(s->bank[i].priority, 0, sizeof(s->bank[i].priority));

        if (s->level_only)

            s->bank[i].sens_edge = 0xffffffff;

    }

    s->new_agr[0] = ~0;

    s->new_agr[1] = ~0;

    s->sir_intr[0] = 0;

    s->sir_intr[1] = 0;

    s->autoidle = 0;

    s->mask = ~0;

    qemu_set_irq(s->parent_intr[0], 0);

    qemu_set_irq(s->parent_intr[1], 0);

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
+int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size)

 {

+    int64_t buffer_start;

+    int buffer_size;

     int overlap, new_size, alloc_size;

+

     if (s->write_flag)

int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size)

{

    int64_t buffer_start;

    int buffer_size;

    int overlap, new_size, alloc_size;

    if (s->write_flag)

        return AVERROR(EINVAL);

    buffer_size = s->buf_end - s->buffer;

    /* the buffers must touch or overlap */

    if ((buffer_start = s->pos - buffer_size) > buf_size)

        return AVERROR(EINVAL);

    overlap = buf_size - buffer_start;

    new_size = buf_size + buffer_size - overlap;

    alloc_size = FFMAX(s->buffer_size, new_size);

    if (alloc_size > buf_size)

        if (!(buf = av_realloc_f(buf, 1, alloc_size)))

            return AVERROR(ENOMEM);

    if (new_size > buf_size) {

        memcpy(buf + buf_size, s->buffer + overlap, buffer_size - overlap);

        buf_size = new_size;

    }

    av_free(s->buffer);

    s->buf_ptr = s->buffer = buf;

    s->buffer_size = alloc_size;

    s->pos = buf_size;

    s->buf_end = s->buf_ptr + buf_size;

    s->eof_reached = 0;

    s->must_flush = 0;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, d);

     DriveInfo *dinfo;
+
+
+
+    s->mode = SSI_SD_CMD;
+
     dinfo = drive_get_next(IF_SD);

     s->sd = sd_init(dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, true);

static int ssi_sd_init(SSISlave *d)

{

    DeviceState *dev = DEVICE(d);

    ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, d);

    DriveInfo *dinfo;

    s->mode = SSI_SD_CMD;

    dinfo = drive_get_next(IF_SD);

    s->sd = sd_init(dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, true);

    if (s->sd == NULL) {

        return -1;

    }

    register_savevm(dev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);

    return 0;

}


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

                                                  outlink->w, outlink->h);

+    avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
+
+    outlink->out_buf->video->w = outlink->w;
+
+    outlink->out_buf->video->h = outlink->h;

static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)

{

    AVFilterContext *ctx  = inlink->dst;

    TileContext *tile    = ctx->priv;

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

    if (tile->current)

        return 0;

    outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE,

                                                 outlink->w, outlink->h);

    avfilter_copy_buffer_ref_props(outlink->out_buf, picref);

    outlink->out_buf->video->w = outlink->w;

    outlink->out_buf->video->h = outlink->h;

    /* fill surface once for margin/padding */

    if (tile->margin || tile->padding)

        ff_fill_rectangle(&tile->draw, &tile->blank,

                          outlink->out_buf->data, outlink->out_buf->linesize,

                          0, 0, outlink->w, outlink->h);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int check_strtox_error(const char **next, char *endptr,

                               int err)

static int check_strtox_error(const char **next, char *endptr,

                              int err)

{

    if (!next && *endptr) {

        return -EINVAL;

    }

    if (next) {

        *next = endptr;

    }

    return -err;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 uint64_t HELPER(neon_abdl_s64)(uint32_t a, uint32_t b)

+{

     uint64_t result;

uint64_t HELPER(neon_abdl_s64)(uint32_t a, uint32_t b)

{

    uint64_t result;

    DO_ABD(result, a, b, int32_t);

    return result;

}


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

     QObject *obj = qobject_from_json("'abc", NULL);

static void unterminated_sq_string(void)

{

    QObject *obj = qobject_from_json("'abc", NULL);

    g_assert(obj == NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int spapr_vga_init(PCIBus *pci_bus)
+
+{
+
+    switch (vga_interface_type) {

     case VGA_STD:

static int spapr_vga_init(PCIBus *pci_bus)

{

    switch (vga_interface_type) {

    case VGA_STD:

        pci_std_vga_init(pci_bus);

        return 1;

    case VGA_NONE:

        return 0;

    default:

        fprintf(stderr, "This vga model is not supported,"

                "currently it only supports -vga std\n");

        exit(0);

        break;

    }

}


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

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

+

     bs = get_bs_snapshots();

void do_delvm(Monitor *mon, const QDict *qdict)

{

    DriveInfo *dinfo;

    BlockDriverState *bs, *bs1;

    int ret;

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

    bs = get_bs_snapshots();

    if (!bs) {

        monitor_printf(mon, "No block device supports snapshots\n");

        return;

    }

    QTAILQ_FOREACH(dinfo, &drives, next) {

        bs1 = dinfo->bdrv;

        if (bdrv_has_snapshot(bs1)) {

            ret = bdrv_snapshot_delete(bs1, name);

            if (ret < 0) {

                if (ret == -ENOTSUP)

                    monitor_printf(mon,

                                   "Snapshots not supported on device '%s'\n",

                                   bdrv_get_device_name(bs1));

                else

                    monitor_printf(mon, "Error %d while deleting snapshot on "

                                   "'%s'\n", ret, bdrv_get_device_name(bs1));

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
 void rdma_start_outgoing_migration(void *opaque,

+                            const char *host_port, Error **errp)
+
 {

+    MigrationState *s = opaque;

     Error *local_err = NULL, **temp = &local_err;
+
     RDMAContext *rdma = qemu_rdma_data_init(host_port, &local_err);

     int ret = 0;

+

     if (rdma == NULL) {

@@ -20,9 +20,9 @@

         goto err;

+    }

+

     ret = qemu_rdma_source_init(rdma, &local_err,

void rdma_start_outgoing_migration(void *opaque,

                            const char *host_port, Error **errp)

{

    MigrationState *s = opaque;

    Error *local_err = NULL, **temp = &local_err;

    RDMAContext *rdma = qemu_rdma_data_init(host_port, &local_err);

    int ret = 0;

    if (rdma == NULL) {

        ERROR(temp, "Failed to initialize RDMA data structures! %d", ret);

        goto err;

    }

    ret = qemu_rdma_source_init(rdma, &local_err,

        s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL]);

    if (ret) {

        goto err;

    }

    trace_rdma_start_outgoing_migration_after_rdma_source_init();

    ret = qemu_rdma_connect(rdma, &local_err);

    if (ret) {

        goto err;

    }

    trace_rdma_start_outgoing_migration_after_rdma_connect();

    s->to_dst_file = qemu_fopen_rdma(rdma, "wb");

    migrate_fd_connect(s);

    return;

err:

    error_propagate(errp, local_err);

    g_free(rdma);

    migrate_fd_error(s);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static inline int ohci_put_ed(OHCIState *ohci,
+
                               uint32_t addr, struct ohci_ed *ed)

 {

static inline int ohci_put_ed(OHCIState *ohci,

                              uint32_t addr, struct ohci_ed *ed)

{

    return put_dwords(ohci, addr, (uint32_t *)ed, sizeof(*ed) >> 2);

}


--- a/source.c
+++ b/source.c
@@ -15,14 +15,14 @@
     bd.ra_block         = ra_frame;

     bd.const_block      = ctx->const_block;
+
     bd.shift_lsbs       = ctx->shift_lsbs;
+
     bd.opt_order        = ctx->opt_order;

     bd.store_prev_samples = ctx->store_prev_samples;

+    bd.use_ltp          = ctx->use_ltp;

     bd.ltp_lag          = ctx->ltp_lag;

static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,

                             unsigned int c, const unsigned int *div_blocks,

                             unsigned int *js_blocks)

{

    unsigned int b;

    ALSBlockData bd = { 0 };

    bd.ra_block         = ra_frame;

    bd.const_block      = ctx->const_block;

    bd.shift_lsbs       = ctx->shift_lsbs;

    bd.opt_order        = ctx->opt_order;

    bd.store_prev_samples = ctx->store_prev_samples;

    bd.use_ltp          = ctx->use_ltp;

    bd.ltp_lag          = ctx->ltp_lag;

    bd.ltp_gain         = ctx->ltp_gain[0];

    bd.quant_cof        = ctx->quant_cof[0];

    bd.lpc_cof          = ctx->lpc_cof[0];

    bd.prev_raw_samples = ctx->prev_raw_samples;

    bd.raw_samples      = ctx->raw_samples[c];

    for (b = 0; b < ctx->num_blocks; b++) {

        bd.block_length     = div_blocks[b];

        if (read_decode_block(ctx, &bd)) {

            // damaged block, write zero for the rest of the frame

            zero_remaining(b, ctx->num_blocks, div_blocks, bd.raw_samples);

            return -1;

        }

        bd.raw_samples += div_blocks[b];

        bd.ra_block     = 0;

    }

    return 0;

}


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

     if (unlikely(ctx->mem_idx)) {
+
+        TCGv_i32 t0;
+
+        tcg_gen_qemu_ld32u(arg1, arg2, ctx->mem_idx);
+
         t0 = tcg_temp_new_i32();

         tcg_gen_trunc_tl_i32(t0, arg1);

static always_inline void gen_qemu_ld32s(DisasContext *ctx, TCGv arg1, TCGv arg2)

{

    if (unlikely(ctx->mem_idx)) {

        TCGv_i32 t0;

        tcg_gen_qemu_ld32u(arg1, arg2, ctx->mem_idx);

        t0 = tcg_temp_new_i32();

        tcg_gen_trunc_tl_i32(t0, arg1);

        tcg_gen_bswap_i32(t0, t0);

        tcg_gen_ext_i32_tl(arg1, t0);

        tcg_temp_free_i32(t0);

    } else

        tcg_gen_qemu_ld32s(arg1, arg2, ctx->mem_idx);

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
     unsigned long *p = map + BIT_WORD(start);
     const long size = start + nr;
     int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
+    unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
+    /* First word */
+    if (nr - bits_to_set > 0) {
+        atomic_or(p, mask_to_set);
+        nr -= bits_to_set;
         bits_to_set = BITS_PER_LONG;
         mask_to_set = ~0UL;
         p++;

void bitmap_set_atomic(unsigned long *map, long start, long nr)
{
    unsigned long *p = map + BIT_WORD(start);
    const long size = start + nr;
    int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
    unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
    /* First word */
    if (nr - bits_to_set > 0) {
        atomic_or(p, mask_to_set);
        nr -= bits_to_set;
        bits_to_set = BITS_PER_LONG;
        mask_to_set = ~0UL;
        p++;
    }
    /* Full words */
    if (bits_to_set == BITS_PER_LONG) {
        while (nr >= BITS_PER_LONG) {
            *p = ~0UL;
            nr -= BITS_PER_LONG;
            p++;
        }
    }
    /* Last word */
    if (nr) {
        mask_to_set &= BITMAP_LAST_WORD_MASK(size);
        atomic_or(p, mask_to_set);
    } else {
        /* If we avoided the full barrier in atomic_or(), issue a
         * barrier to account for the assignments in the while loop.
         */
        smp_mb();
    }
}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int remove_mapping(BDRVVVFATState* s, int mapping_index)

 {
+
     mapping_t* mapping = array_get(&(s->mapping), mapping_index);

     mapping_t* first_mapping = array_get(&(s->mapping), 0);

static int remove_mapping(BDRVVVFATState* s, int mapping_index)

{

    mapping_t* mapping = array_get(&(s->mapping), mapping_index);

    mapping_t* first_mapping = array_get(&(s->mapping), 0);

    /* free mapping */

    if (mapping->first_mapping_index < 0)

	free(mapping->path);

    /* remove from s->mapping */

    array_remove(&(s->mapping), mapping_index);

    /* adjust all references to mappings */

    adjust_mapping_indices(s, mapping_index, -1);

    if (s->current_mapping && first_mapping != (mapping_t*)s->mapping.pointer)

	s->current_mapping = array_get(&(s->mapping),

		s->current_mapping - first_mapping);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -14,11 +14,11 @@
         len = read(s->qmp_fd, &c, 1);
         if (len == -1 && errno == EINTR) {
             continue;
+        switch (c) {
+        case '{':
+            nesting++;
+            has_reply = true;
+            break;
         case '}':
             nesting--;
             break;

void qtest_qmp(QTestState *s, const char *fmt, ...)
{
    va_list ap;
    bool has_reply = false;
    int nesting = 0;
    /* Send QMP request */
    va_start(ap, fmt);
    socket_sendf(s->qmp_fd, fmt, ap);
    va_end(ap);
    /* Receive reply */
    while (!has_reply || nesting > 0) {
        ssize_t len;
        char c;
        len = read(s->qmp_fd, &c, 1);
        if (len == -1 && errno == EINTR) {
            continue;
        switch (c) {
        case '{':
            nesting++;
            has_reply = true;
            break;
        case '}':
            nesting--;
            break;


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

     v9fs_string_free(&name);

+    if (retval < 0) {
+
+        errno = -retval;
+
+    }

     return retval;

static int proxy_remove(FsContext *ctx, const char *path)

{

    int retval;

    V9fsString name;

    v9fs_string_init(&name);

    v9fs_string_sprintf(&name, "%s", path);

    retval = v9fs_request(ctx->private, T_REMOVE, NULL, "s", &name);

    v9fs_string_free(&name);

    if (retval < 0) {

        errno = -retval;

    }

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static inline struct rgbvec interp_trilinear(const LUT3DContext *lut3d,
+
+                                             const struct rgbvec *s)
+
+{
+
+    const struct rgbvec d = {s->r - PREV(s->r), s->g - PREV(s->g), s->b - PREV(s->b)};
+
+    const struct rgbvec c000 = lut3d->lut[PREV(s->r)][PREV(s->g)][PREV(s->b)];
+
     const struct rgbvec c001 = lut3d->lut[PREV(s->r)][PREV(s->g)][NEXT(s->b)];

     const struct rgbvec c010 = lut3d->lut[PREV(s->r)][NEXT(s->g)][PREV(s->b)];

static inline struct rgbvec interp_trilinear(const LUT3DContext *lut3d,

                                             const struct rgbvec *s)

{

    const struct rgbvec d = {s->r - PREV(s->r), s->g - PREV(s->g), s->b - PREV(s->b)};

    const struct rgbvec c000 = lut3d->lut[PREV(s->r)][PREV(s->g)][PREV(s->b)];

    const struct rgbvec c001 = lut3d->lut[PREV(s->r)][PREV(s->g)][NEXT(s->b)];

    const struct rgbvec c010 = lut3d->lut[PREV(s->r)][NEXT(s->g)][PREV(s->b)];

    const struct rgbvec c011 = lut3d->lut[PREV(s->r)][NEXT(s->g)][NEXT(s->b)];

    const struct rgbvec c100 = lut3d->lut[NEXT(s->r)][PREV(s->g)][PREV(s->b)];

    const struct rgbvec c101 = lut3d->lut[NEXT(s->r)][PREV(s->g)][NEXT(s->b)];

    const struct rgbvec c110 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][PREV(s->b)];

    const struct rgbvec c111 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][NEXT(s->b)];

    const struct rgbvec c00  = lerp(&c000, &c100, d.r);

    const struct rgbvec c10  = lerp(&c010, &c110, d.r);

    const struct rgbvec c01  = lerp(&c001, &c101, d.r);

    const struct rgbvec c11  = lerp(&c011, &c111, d.r);

    const struct rgbvec c0   = lerp(&c00,  &c10,  d.g);

    const struct rgbvec c1   = lerp(&c01,  &c11,  d.g);

    const struct rgbvec c    = lerp(&c0,   &c1,   d.b);

    return c;

}


static void simple_number(void)

{

    int i;

    struct {

        const char *encoded;

        int64_t decoded;

        int skip;

    } test_cases[] = {

        { "0", 0 },

        { "1234", 1234 },

        { "1", 1 },

        { "-32", -32 },

        { "-0", 0, .skip = 1 },

        { },

    };

    for (i = 0; test_cases[i].encoded; i++) {

        QObject *obj;

        QInt *qint;

        obj = qobject_from_json(test_cases[i].encoded);

        g_assert(obj != NULL);

        g_assert(qobject_type(obj) == QTYPE_QINT);

        qint = qobject_to_qint(obj);

        g_assert(qint_get_int(qint) == test_cases[i].decoded);

        if (test_cases[i].skip == 0) {

            QString *str;

            str = qobject_to_json(obj);

            g_assert(strcmp(qstring_get_str(str), test_cases[i].encoded) == 0);

            QDECREF(str);

        }

        QDECREF(qint);

    }

}


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

                            struct NetRxPkt *pkt,

+                           const E1000E_RSSInfo *rss_info,

                            uint16_t length)

e1000e_write_lgcy_rx_descr(E1000ECore *core, uint8_t *desc,

                           struct NetRxPkt *pkt,

                           const E1000E_RSSInfo *rss_info,

                           uint16_t length)

{

    uint32_t status_flags, rss, mrq;

    uint16_t ip_id;

    struct e1000_rx_desc *d = (struct e1000_rx_desc *) desc;

    memset(d, 0, sizeof(*d));

    assert(!rss_info->enabled);

    d->length = cpu_to_le16(length);

    e1000e_build_rx_metadata(core, pkt, pkt != NULL,

                             rss_info,

                             &rss, &mrq,

                             &status_flags, &ip_id,

                             &d->special);

    d->errors = (uint8_t) (le32_to_cpu(status_flags) >> 24);

    d->status = (uint8_t) le32_to_cpu(status_flags);

}


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

         qemu_chr_fe_release(con->chr);

+    }
+
+    xen_be_unbind_evtchn(&con->xendev);
+
+

     if (con->sring) {

static void con_disconnect(struct XenDevice *xendev)

{

    struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);

    if (!xendev->dev) {

        return;

    }

    if (con->chr) {

        qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL);

        qemu_chr_fe_release(con->chr);

    }

    xen_be_unbind_evtchn(&con->xendev);

    if (con->sring) {

        if (!xendev->gnttabdev) {

            munmap(con->sring, XC_PAGE_SIZE);

        } else {

            xc_gnttab_munmap(xendev->gnttabdev, con->sring, 1);

        }

	con->sring = NULL;

    }

}


--- a/source.c
+++ b/source.c
@@ -35,9 +35,9 @@
             pos += ts->raw_packet_size;

         }
+
+
+
+    return AV_NOPTS_VALUE;
+
 }

static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,

                              int64_t *ppos, int64_t pos_limit)

{

    MpegTSContext *ts = s->priv_data;

    int64_t pos, timestamp;

    uint8_t buf[TS_PACKET_SIZE];

    int pcr_l, pcr_pid = ((PESContext*)s->streams[stream_index]->priv_data)->pcr_pid;

    pos = ((*ppos  + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47;

        while(pos < pos_limit) {

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

            if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)

                return AV_NOPTS_VALUE;

            if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&

                parse_pcr(&timestamp, &pcr_l, buf) == 0) {

                *ppos = pos;

                return timestamp;

            }

            pos += ts->raw_packet_size;

        }

    return AV_NOPTS_VALUE;

}


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

     MemTxAttrs attrs = {};

+    AddressSpace *as;

+

     attrs.secure = is_secure;

static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure,

                            ARMMMUIdx mmu_idx, ARMMMUFaultInfo *fi)

{

    ARMCPU *cpu = ARM_CPU(cs);

    CPUARMState *env = &cpu->env;

    MemTxAttrs attrs = {};

    AddressSpace *as;

    attrs.secure = is_secure;

    as = arm_addressspace(cs, attrs);

    addr = S1_ptw_translate(env, mmu_idx, addr, attrs, fi);

    if (fi->s1ptw) {

        return 0;

    }

    if (regime_translation_big_endian(env, mmu_idx)) {

        return address_space_ldq_be(as, addr, attrs, NULL);

    } else {

        return address_space_ldq_le(as, addr, attrs, NULL);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,23 +1,23 @@
+static int gif_parse_next_image(GifState *s)
+
+{
+
+    ByteIOContext *f = s->f;
+
+    int ret, code;
+
+
+
+    for (;;) {
+
         code = url_fgetc(f);
+
+#ifdef DEBUG
+
         printf("gif: code=%02x '%c'\n", code, code);

 #endif
+
         switch (code) {

         case ',':

static int gif_parse_next_image(GifState *s)

{

    ByteIOContext *f = s->f;

    int ret, code;

    for (;;) {

        code = url_fgetc(f);

#ifdef DEBUG

        printf("gif: code=%02x '%c'\n", code, code);

#endif

        switch (code) {

        case ',':

            if (gif_read_image(s) < 0)

                return AVERROR(EIO);

            ret = 0;

            goto the_end;

        case ';':

            /* end of image */

            ret = AVERROR(EIO);

            goto the_end;

        case '!':

            if (gif_read_extension(s) < 0)

                return AVERROR(EIO);

            break;

        case EOF:

        default:

            /* error or errneous EOF */

            ret = AVERROR(EIO);

            goto the_end;

        }

    }

  the_end:

    return ret;

}


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

     if (iocb->aiocb) {
+
+        bdrv_aio_cancel_async(iocb->aiocb);
+
+        iocb->aiocb = NULL;
+
     }

 }

static void trim_aio_cancel(BlockAIOCB *acb)

{

    TrimAIOCB *iocb = container_of(acb, TrimAIOCB, common);

    /* Exit the loop so ide_issue_trim_cb will not continue  */

    iocb->j = iocb->qiov->niov - 1;

    iocb->i = (iocb->qiov->iov[iocb->j].iov_len / 8) - 1;

    iocb->ret = -ECANCELED;

    if (iocb->aiocb) {

        bdrv_aio_cancel_async(iocb->aiocb);

        iocb->aiocb = NULL;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
+static int build_def_list(Picture *def, Picture **in, int len, int is_long, int sel)

 {
+
     int  i[2] = { 0 };

+    int index = 0;

+    while (i[0] < len || i[1] < len) {

         while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference & sel)))

static int build_def_list(Picture *def, Picture **in, int len, int is_long, int sel)

{

    int  i[2] = { 0 };

    int index = 0;

    while (i[0] < len || i[1] < len) {

        while (i[0] < len && !(in[i[0]] && (in[i[0]]->reference & sel)))

            i[0]++;

        while (i[1] < len && !(in[i[1]] && (in[i[1]]->reference & (sel ^ 3))))

            i[1]++;

        if (i[0] < len) {

            in[i[0]]->pic_id = is_long ? i[0] : in[i[0]]->frame_num;

            split_field_copy(&def[index++], in[i[0]++], sel, 1);

        }

        if (i[1] < len) {

            in[i[1]]->pic_id = is_long ? i[1] : in[i[1]]->frame_num;

            split_field_copy(&def[index++], in[i[1]++], sel ^ 3, 0);

        }

    }

    return index;

}


static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector,

                                    MSIMessage msg)

{

    VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev);

    VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);

    VirtQueue *vq = virtio_vector_first_queue(vdev, vector);

    int ret, index, unmasked = 0;

    while (vq) {

        index = virtio_get_queue_index(vq);

        if (!virtio_queue_get_num(vdev, index)) {

            break;

        }

        ret = virtio_pci_vq_vector_unmask(proxy, index, vector, msg);

        if (ret < 0) {

            goto undo;

        }

        vq = virtio_vector_next_queue(vq);

        ++unmasked;

    }

    return 0;

undo:

    vq = virtio_vector_first_queue(vdev, vector);

    while (vq && --unmasked >= 0) {

        index = virtio_get_queue_index(vq);

        virtio_pci_vq_vector_mask(proxy, index, vector);

        vq = virtio_vector_next_queue(vq);

    }

    return ret;

}


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

     ssize_t i;

+    off_t curr = 0;
+
+
+
+    if (pos > qsb->used) {

         return -1;

static ssize_t qsb_get_iovec(const QEMUSizedBuffer *qsb,

                             off_t pos, off_t *d_off)

{

    ssize_t i;

    off_t curr = 0;

    if (pos > qsb->used) {

        return -1;

    }

    for (i = 0; i < qsb->n_iov; i++) {

        if (curr + qsb->iov[i].iov_len > pos) {

            *d_off = pos - curr;

            return i;

        }

        curr += qsb->iov[i].iov_len;

    }

    return -1;

}


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

         logout("Failed to negotiate with the NBD server\n");
+
+        closesocket(sock);
+
+        return ret;
+
     }

int nbd_client_session_init(NbdClientSession *client, BlockDriverState *bs,

                            int sock, const char *export, Error **errp)

{

    int ret;

    /* NBD handshake */

    logout("session init %s\n", export);

    qemu_set_block(sock);

    ret = nbd_receive_negotiate(sock, export,

                                &client->nbdflags, &client->size,

                                &client->blocksize, errp);

    if (ret < 0) {

        logout("Failed to negotiate with the NBD server\n");

        closesocket(sock);

        return ret;

    }

    qemu_co_mutex_init(&client->send_mutex);

    qemu_co_mutex_init(&client->free_sema);

    client->bs = bs;

    client->sock = sock;

    /* Now that we're connected, set the socket to be non-blocking and

     * kick the reply mechanism.  */

    qemu_set_nonblock(sock);

    nbd_client_session_attach_aio_context(client, bdrv_get_aio_context(bs));

    logout("Established connection with NBD server\n");

    return 0;

}


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

 {

+    uint32_t tmp;
+
+    bool old_spsel = env->v7m.control & R_V7M_CONTROL_SPSEL_MASK;
+
+

     if (old_spsel != new_spsel) {

static void switch_v7m_sp(CPUARMState *env, bool new_spsel)

{

    uint32_t tmp;

    bool old_spsel = env->v7m.control & R_V7M_CONTROL_SPSEL_MASK;

    if (old_spsel != new_spsel) {

        tmp = env->v7m.other_sp;

        env->v7m.other_sp = env->regs[13];

        env->regs[13] = tmp;

        env->v7m.control = deposit32(env->v7m.control,

                                     R_V7M_CONTROL_SPSEL_SHIFT,

                                     R_V7M_CONTROL_SPSEL_LENGTH, new_spsel);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
+
+{
+
+    DeviceState *dev;

IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)

{

    DeviceState *dev;

    dev = qdev_create(&bus->qbus, drive->media_cd ? "ide-cd" : "ide-hd");

    qdev_prop_set_uint32(dev, "unit", unit);

    qdev_prop_set_drive_nofail(dev, "drive",

                               blk_bs(blk_by_legacy_dinfo(drive)));

    qdev_init_nofail(dev);

    return DO_UPCAST(IDEDevice, qdev, dev);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 target_read_memory (bfd_vma memaddr,
+
+                    bfd_byte *myaddr,
+
                     int length,

                     struct disassemble_info *info)

target_read_memory (bfd_vma memaddr,

                    bfd_byte *myaddr,

                    int length,

                    struct disassemble_info *info)

{

    int i;

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

        myaddr[i] = ldub_code(memaddr + i);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -9,10 +9,10 @@
     dst->cbp_table                = src->cbp_table;

     dst->mb2b_xy                  = src->mb2b_xy;
+
     dst->mb2b8_xy                 = src->mb2b8_xy;

+    dst->chroma_pred_mode_table   = src->chroma_pred_mode_table;

     dst->mvd_table[0]             = src->mvd_table[0];

static void clone_tables(H264Context *dst, H264Context *src){

    dst->intra4x4_pred_mode       = src->intra4x4_pred_mode;

    dst->non_zero_count           = src->non_zero_count;

    dst->slice_table              = src->slice_table;

    dst->cbp_table                = src->cbp_table;

    dst->mb2b_xy                  = src->mb2b_xy;

    dst->mb2b8_xy                 = src->mb2b8_xy;

    dst->chroma_pred_mode_table   = src->chroma_pred_mode_table;

    dst->mvd_table[0]             = src->mvd_table[0];

    dst->mvd_table[1]             = src->mvd_table[1];

    dst->direct_table             = src->direct_table;

    if(!dst->dequant4_coeff[0])

        init_dequant_tables(dst);

    dst->s.obmc_scratchpad = NULL;

    ff_h264_pred_init(&dst->hpc, src->s.codec_id);

    dst->dequant_coeff_pps= -1;

}


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

 {

+    GetBitContext *gb        = &ctx->gb;

+    *bd->shift_lsbs = 0;

     // read block type flag and read the samples accordingly

static int read_block(ALSDecContext *ctx, ALSBlockData *bd)

{

    GetBitContext *gb        = &ctx->gb;

    *bd->shift_lsbs = 0;

    // read block type flag and read the samples accordingly

    if (get_bits1(gb)) {

        if (read_var_block_data(ctx, bd))

            return -1;

    } else {

        read_const_block_data(ctx, bd);

    }

    return 0;

}


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

     CharDriverState *chr;

+
+
+    chr = g_malloc0(sizeof(CharDriverState));
+
     chr->chr_write = null_chr_write;

     chr->explicit_be_open = true;

static CharDriverState *qemu_chr_open_null(void)

{

    CharDriverState *chr;

    chr = g_malloc0(sizeof(CharDriverState));

    chr->chr_write = null_chr_write;

    chr->explicit_be_open = true;

    return chr;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static ssize_t nbd_send_reply(QIOChannel *ioc, NBDReply *reply)

+{
+
+    uint8_t buf[NBD_REPLY_SIZE];
+
+

     reply->error = system_errno_to_nbd_errno(reply->error);

static ssize_t nbd_send_reply(QIOChannel *ioc, NBDReply *reply)

{

    uint8_t buf[NBD_REPLY_SIZE];

    reply->error = system_errno_to_nbd_errno(reply->error);

    TRACE("Sending response to client: { .error = %" PRId32

          ", handle = %" PRIu64 " }",

          reply->error, reply->handle);

    /* Reply

       [ 0 ..  3]    magic   (NBD_REPLY_MAGIC)

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

       [ 7 .. 15]    handle

     */

    stl_be_p(buf, NBD_REPLY_MAGIC);

    stl_be_p(buf + 4, reply->error);

    stq_be_p(buf + 8, reply->handle);

    return write_sync(ioc, buf, sizeof(buf), NULL);

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
                               OBJECT(cpu->apic_state), &error_abort);

+
+
+    qdev_prop_set_uint8(cpu->apic_state, "id", cpu->apic_id);
+
+    /* TODO: convert to link<> */

     apic = APIC_COMMON(cpu->apic_state);

static void x86_cpu_apic_create(X86CPU *cpu, Error **errp)

{

    APICCommonState *apic;

    const char *apic_type = "apic";

    if (kvm_apic_in_kernel()) {

        apic_type = "kvm-apic";

    } else if (xen_enabled()) {

        apic_type = "xen-apic";

    }

    cpu->apic_state = DEVICE(object_new(apic_type));

    object_property_add_child(OBJECT(cpu), "lapic",

                              OBJECT(cpu->apic_state), &error_abort);

    qdev_prop_set_uint8(cpu->apic_state, "id", cpu->apic_id);

    /* TODO: convert to link<> */

    apic = APIC_COMMON(cpu->apic_state);

    apic->cpu = cpu;

    apic->apicbase = APIC_DEFAULT_ADDRESS | MSR_IA32_APICBASE_ENABLE;

}


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

+
     res = src1 + src2;

     if (res < src1) {

uint64_t HELPER(neon_add_saturate_u64)(uint64_t src1, uint64_t src2)

{

    uint64_t res;

    res = src1 + src2;

    if (res < src1) {

        env->QF = 1;

        res = ~(uint64_t)0;

    }

    return res;

}


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

     qdict_extract_subqdict(options, &server, "server.");

+
+
+    crumpled_server = qdict_crumple(server, errp);
+
+    if (!crumpled_server) {

         goto done;

static SocketAddress *sd_server_config(QDict *options, Error **errp)

{

    QDict *server = NULL;

    QObject *crumpled_server = NULL;

    Visitor *iv = NULL;

    SocketAddressFlat *saddr_flat = NULL;

    SocketAddress *saddr = NULL;

    Error *local_err = NULL;

    qdict_extract_subqdict(options, &server, "server.");

    crumpled_server = qdict_crumple(server, errp);

    if (!crumpled_server) {

        goto done;

    }

    /*

     * FIXME .numeric, .to, .ipv4 or .ipv6 don't work with -drive

     * server.type=inet.  .to doesn't matter, it's ignored anyway.

     * That's because when @options come from -blockdev or

     * blockdev_add, members are typed according to the QAPI schema,

     * but when they come from -drive, they're all QString.  The

     * visitor expects the former.

     */

    iv = qobject_input_visitor_new(crumpled_server);

    visit_type_SocketAddressFlat(iv, NULL, &saddr_flat, &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        goto done;

    }

    saddr = socket_address_crumple(saddr_flat);

done:

    qapi_free_SocketAddressFlat(saddr_flat);

    visit_free(iv);

    qobject_decref(crumpled_server);

    QDECREF(server);

    return saddr;

}


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

     if (sz > p->iov.size) {
+
         sz = p->iov.size;

     }

static void usb_net_handle_dataout(USBNetState *s, USBPacket *p)

{

    int sz = sizeof(s->out_buf) - s->out_ptr;

    struct rndis_packet_msg_type *msg =

            (struct rndis_packet_msg_type *) s->out_buf;

    uint32_t len;

#ifdef TRAFFIC_DEBUG

    fprintf(stderr, "usbnet: data out len %zu\n", p->iov.size);

    iov_hexdump(p->iov.iov, p->iov.niov, stderr, "usbnet", p->iov.size);

#endif

    if (sz > p->iov.size) {

        sz = p->iov.size;

    }

    usb_packet_copy(p, &s->out_buf[s->out_ptr], sz);

    s->out_ptr += sz;

    if (!is_rndis(s)) {

        if (p->iov.size < 64) {

            qemu_send_packet(qemu_get_queue(s->nic), s->out_buf, s->out_ptr);

            s->out_ptr = 0;

        }

        return;

    }

    len = le32_to_cpu(msg->MessageLength);

    if (s->out_ptr < 8 || s->out_ptr < len) {

        return;

    }

    if (le32_to_cpu(msg->MessageType) == RNDIS_PACKET_MSG) {

        uint32_t offs = 8 + le32_to_cpu(msg->DataOffset);

        uint32_t size = le32_to_cpu(msg->DataLength);

        if (offs + size <= len)

            qemu_send_packet(qemu_get_queue(s->nic), s->out_buf + offs, size);

    }

    s->out_ptr -= len;

    memmove(s->out_buf, &s->out_buf[len], s->out_ptr);

}


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

     int num;
+

+    if (!s->config || !s->enable) {

         return 0;
+
     }

+

     /* Check range and alignment.  */
+
     if ((CMD(min) | CMD(max) | CMD(next_cmd) | CMD(stop)) & 3) {
+
         return 0;

     }

static inline int vmsvga_fifo_length(struct vmsvga_state_s *s)

{

    int num;

    if (!s->config || !s->enable) {

        return 0;

    }

    /* Check range and alignment.  */

    if ((CMD(min) | CMD(max) | CMD(next_cmd) | CMD(stop)) & 3) {

        return 0;

    }

    if (CMD(min) < (uint8_t *) s->cmd->fifo - (uint8_t *) s->fifo) {

        return 0;

    }

    if (CMD(max) > SVGA_FIFO_SIZE ||

        CMD(min) >= SVGA_FIFO_SIZE ||

        CMD(stop) >= SVGA_FIFO_SIZE ||

        CMD(next_cmd) >= SVGA_FIFO_SIZE) {

        return 0;

    }

    if (CMD(max) < CMD(min) + 10 * 1024) {

        return 0;

    }

    num = CMD(next_cmd) - CMD(stop);

    if (num < 0) {

        num += CMD(max) - CMD(min);

    }

    return num >> 2;

}


--- a/source.c
+++ b/source.c
@@ -4,5 +4,5 @@
                            size_t len,
                            Error **errp)
 {
+    QCryptoCipherBuiltin *ctxt = cipher->opaque;
+    return ctxt->decrypt(cipher, in, out, len, errp);

int qcrypto_cipher_decrypt(QCryptoCipher *cipher,
                           const void *in,
                           void *out,
                           size_t len,
                           Error **errp)
{
    QCryptoCipherBuiltin *ctxt = cipher->opaque;
    return ctxt->decrypt(cipher, in, out, len, errp);


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

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

static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,

    int64_t sector_num, int nb_sectors, QEMUIOVector *qiov,

    BdrvRequestFlags flags)

{

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

        return -EINVAL;

    }

    return bdrv_co_do_pwritev(bs, sector_num << BDRV_SECTOR_BITS,

                              nb_sectors << BDRV_SECTOR_BITS, qiov, flags);

}


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

         qdev_unplug(&(d->qdev), NULL);
+
+    }
+
 }

static void unplug_nic(PCIBus *b, PCIDevice *d)

{

    if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==

            PCI_CLASS_NETWORK_ETHERNET) {

        qdev_unplug(&(d->qdev), NULL);

    }

}


static void encode_refpass(Jpeg2000T1Context *t1, int width, int height, int *nmsedec, int bpno)

{

    int y0, x, y, mask = 1 << (bpno + NMSEDEC_FRACBITS);

    for (y0 = 0; y0 < height; y0 += 4)

        for (x = 0; x < width; x++)

            for (y = y0; y < height && y < y0+4; y++)

                if ((t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS)) == JPEG2000_T1_SIG){

                    int ctxno = ff_jpeg2000_getrefctxno(t1->flags[y+1][x+1]);

                    *nmsedec += getnmsedec_ref(t1->data[y][x], bpno + NMSEDEC_FRACBITS);

                    ff_mqc_encode(&t1->mqc, t1->mqc.cx_states + ctxno, t1->data[y][x] & mask ? 1:0);

                    t1->flags[y+1][x+1] |= JPEG2000_T1_REF;

                }

}


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

     } else if (level < 8)

+        value = get_bits(gb, level + 1);
+
+    return value;
+
 }

static inline int get_scale(GetBitContext *gb, int level, int value)

{

    if (level < 5) {

        /* huffman encoded */

        value += get_bitalloc(gb, &dca_scalefactor, level);

    } else if (level < 8)

        value = get_bits(gb, level + 1);

    return value;

}


--- a/source.c
+++ b/source.c
@@ -23,7 +23,7 @@
     if (get_bits1(gb)) {

         v = get_bits(gb, 4);
+
         if (v) {

             sign = -get_bits1(gb);

static int read_motion_values(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)

{

    int t, sign, v;

    const uint8_t *dec_end;

    CHECK_READ_VAL(gb, b, t);

    dec_end = b->cur_dec + t;

    if (dec_end > b->data_end) {

        av_log(avctx, AV_LOG_ERROR, "Too many motion values\n");

        return -1;

    }

    if (get_bits1(gb)) {

        v = get_bits(gb, 4);

        if (v) {

            sign = -get_bits1(gb);

            v = (v ^ sign) - sign;

        }

        memset(b->cur_dec, v, t);

        b->cur_dec += t;

    } else {

        do {

            v = GET_HUFF(gb, b->tree);

            if (v) {

                sign = -get_bits1(gb);

                v = (v ^ sign) - sign;

            }

            *b->cur_dec++ = v;

        } while (b->cur_dec < dec_end);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -18,11 +18,11 @@
     env->CP0_EBase = 0x80000000;
     env->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL);
     /* vectored interrupts not implemented, timer on int 7,
+       no performance counters. */
+    env->CP0_IntCtl = 0xe0000000;
+    {
+        int i;
+        for (i = 0; i < 7; i++) {
             env->CP0_WatchLo[i] = 0;
             env->CP0_WatchHi[i] = 0x80000000;
         env->CP0_WatchLo[7] = 0;

void cpu_reset (CPUMIPSState *env)
{
    memset(env, 0, offsetof(CPUMIPSState, breakpoints));
    tlb_flush(env, 1);
    /* Minimal init */
#if defined(CONFIG_USER_ONLY)
    env->hflags = MIPS_HFLAG_UM;
#else
    if (env->hflags & MIPS_HFLAG_BMASK) {
        /* If the exception was raised from a delay slot,
           come back to the jump.  */
        env->CP0_ErrorEPC = env->active_tc.PC - 4;
    } else {
        env->CP0_ErrorEPC = env->active_tc.PC;
    env->active_tc.PC = (int32_t)0xBFC00000;
    env->CP0_Wired = 0;
    /* SMP not implemented */
    env->CP0_EBase = 0x80000000;
    env->CP0_Status = (1 << CP0St_BEV) | (1 << CP0St_ERL);
    /* vectored interrupts not implemented, timer on int 7,
       no performance counters. */
    env->CP0_IntCtl = 0xe0000000;
    {
        int i;
        for (i = 0; i < 7; i++) {
            env->CP0_WatchLo[i] = 0;
            env->CP0_WatchHi[i] = 0x80000000;
        env->CP0_WatchLo[7] = 0;
        env->CP0_WatchHi[7] = 0;
    /* Count register increments in debug mode, EJTAG version 1 */
    env->CP0_Debug = (1 << CP0DB_CNT) | (0x1 << CP0DB_VER);
    env->hflags = MIPS_HFLAG_CP0;
#endif
    env->exception_index = EXCP_NONE;
    cpu_mips_register(env, env->cpu_model);


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void check_decode_result(int *got_output, int ret)

 {

static void check_decode_result(int *got_output, int ret)

{

    if (*got_output || ret<0)

        decode_error_stat[ret<0] ++;

    if (ret < 0 && exit_on_error)

        exit_program(1);

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
         gen_op_addq_ESI_T0();

     } else
+
+#endif
+
+    if (s->aflag) {
+
         gen_op_addl_ESI_T0();

     } else {

static inline void gen_lods(DisasContext *s, int ot)

{

    gen_string_movl_A0_ESI(s);

    gen_op_ld_T0_A0(ot + s->mem_index);

    gen_op_mov_reg_T0(ot, R_EAX);

    gen_op_movl_T0_Dshift[ot]();

#ifdef TARGET_X86_64

    if (s->aflag == 2) {

        gen_op_addq_ESI_T0();

    } else

#endif

    if (s->aflag) {

        gen_op_addl_ESI_T0();

    } else {

        gen_op_addw_ESI_T0();

    }

}


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

+    sz = sizeof(VirtIOSCSI) + proxyconf->num_queues * sizeof(VirtQueue *);

     s = (VirtIOSCSI *)virtio_common_init("virtio-scsi", VIRTIO_ID_SCSI,

VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf)

{

    VirtIOSCSI *s;

    static int virtio_scsi_id;

    size_t sz;

    int i;

    sz = sizeof(VirtIOSCSI) + proxyconf->num_queues * sizeof(VirtQueue *);

    s = (VirtIOSCSI *)virtio_common_init("virtio-scsi", VIRTIO_ID_SCSI,

                                         sizeof(VirtIOSCSIConfig), sz);

    s->qdev = dev;

    s->conf = proxyconf;

    /* TODO set up vdev function pointers */

    s->vdev.get_config = virtio_scsi_get_config;

    s->vdev.set_config = virtio_scsi_set_config;

    s->vdev.get_features = virtio_scsi_get_features;

    s->vdev.reset = virtio_scsi_reset;

    s->ctrl_vq = virtio_add_queue(&s->vdev, VIRTIO_SCSI_VQ_SIZE,

                                   virtio_scsi_handle_ctrl);

    s->event_vq = virtio_add_queue(&s->vdev, VIRTIO_SCSI_VQ_SIZE,

                                   NULL);

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

        s->cmd_vqs[i] = virtio_add_queue(&s->vdev, VIRTIO_SCSI_VQ_SIZE,

                                         virtio_scsi_handle_cmd);

    }

    scsi_bus_new(&s->bus, dev, &virtio_scsi_scsi_info);

    if (!dev->hotplugged) {

        scsi_bus_legacy_handle_cmdline(&s->bus);

    }

    register_savevm(dev, "virtio-scsi", virtio_scsi_id++, 1,

                    virtio_scsi_save, virtio_scsi_load, s);

    return &s->vdev;

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
      /* Why 16?

         because some cpus need alignment, for example SSE2 on P4, & most RISC cpus
+
+        it will just trigger an exception and the unaligned load will be done in the
+
+        exception handler or it will just segfault (SSE2 on P4)
+
         Why not larger? because i didnt see a difference in benchmarks ...

      */

void *av_malloc(unsigned int size)

{

    void *ptr;

#if defined (HAVE_MEMALIGN)

    ptr = memalign(16,size);

    /* Why 64?

       Indeed, we should align it:

         on 4 for 386

         on 16 for 486

	 on 32 for 586, PPro - k6-III

	 on 64 for K7 (maybe for P3 too).

       Because L1 and L2 caches are aligned on those values.

       But I don't want to code such logic here!

     */

     /* Why 16?

        because some cpus need alignment, for example SSE2 on P4, & most RISC cpus

        it will just trigger an exception and the unaligned load will be done in the

        exception handler or it will just segfault (SSE2 on P4)

        Why not larger? because i didnt see a difference in benchmarks ...

     */

     /* benchmarks with p3

        memalign(64)+1		3071,3051,3032

        memalign(64)+2		3051,3032,3041

        memalign(64)+4		2911,2896,2915

        memalign(64)+8		2545,2554,2550

        memalign(64)+16		2543,2572,2563

        memalign(64)+32		2546,2545,2571

        memalign(64)+64		2570,2533,2558

        btw, malloc seems to do 8 byte alignment by default here

     */

#else

    ptr = malloc(size);

#endif

    return ptr;

}


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

     MemoryRegion *mr = memory_region_find(parent, addr, 1).mr;
+
+    if (!mr) {
+
+        return false;

     }

bool memory_region_present(MemoryRegion *parent, hwaddr addr)

{

    MemoryRegion *mr = memory_region_find(parent, addr, 1).mr;

    if (!mr) {

        return false;

    }

    memory_region_unref(mr);

    return true;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp)
+
 {

     do_blockdev_backup(arg, NULL, errp);

void qmp_blockdev_backup(BlockdevBackup *arg, Error **errp)

{

    do_blockdev_backup(arg, NULL, errp);

}


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

                                       uint8_t ep)

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

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

                                      uint8_t ep)

{

    AsyncURB *aurb = async_alloc(dev, p);

    struct usb_redir_bulk_packet_header bulk_packet;

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

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

    bulk_packet.endpoint  = ep;

    bulk_packet.length    = p->iov.size;

    bulk_packet.stream_id = 0;

    aurb->bulk_packet = bulk_packet;

    if (ep & USB_DIR_IN) {

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

                                        &bulk_packet, NULL, 0);

    } else {

        uint8_t buf[p->iov.size];

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

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

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

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

    }

    usbredirparser_do_write(dev->parser);

    return USB_RET_ASYNC;

}


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

         gen_op_addl_ESP_im(addend);

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

 }

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

{

#ifdef TARGET_X86_64

    if (CODE64(s)) {

        gen_op_addq_ESP_im(addend);

    } else

#endif

    if (s->ss32) {

        gen_op_addl_ESP_im(addend);

    } else {

        gen_op_addw_ESP_im(addend);

    }

}


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

+{

     return NULL;

static QList *channel_list_get(void)

{

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
+
+{
+
+#if HAVE_YASM
+
     int cpuflags = av_get_cpu_flags();

av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)

{

#if HAVE_YASM

    int cpuflags = av_get_cpu_flags();

#if ARCH_X86_32

    if (HAVE_MMX && cpuflags & AV_CPU_FLAG_MMX) {

        c->idct_put  = ff_vp3_idct_put_mmx;

        c->idct_add  = ff_vp3_idct_add_mmx;

        c->idct_perm = FF_PARTTRANS_IDCT_PERM;

    }

#endif

    if (HAVE_MMXEXT && cpuflags & AV_CPU_FLAG_MMXEXT) {

        c->idct_dc_add = ff_vp3_idct_dc_add_mmx2;

        if (!(flags & CODEC_FLAG_BITEXACT)) {

            c->v_loop_filter = ff_vp3_v_loop_filter_mmx2;

            c->h_loop_filter = ff_vp3_h_loop_filter_mmx2;

        }

    }

    if (cpuflags & AV_CPU_FLAG_SSE2) {

        c->idct_put  = ff_vp3_idct_put_sse2;

        c->idct_add  = ff_vp3_idct_add_sse2;

        c->idct_perm = FF_TRANSPOSE_IDCT_PERM;

    }

#endif

}


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

 {

+    FilmstripDemuxContext *film = s->priv_data;

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

static int read_packet(AVFormatContext *s,

                       AVPacket *pkt)

{

    FilmstripDemuxContext *film = s->priv_data;

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

    if (s->pb->eof_reached)

        return AVERROR(EIO);

    pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);

    pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);

    avio_skip(s->pb, st->codec->width * film->leading * 4);

    if (pkt->size < 0)

        return pkt->size;

    pkt->flags |= AV_PKT_FLAG_KEY;

    return 0;

}


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

     if (!error_is_set(errp)) {

void visit_start_list(Visitor *v, const char *name, Error **errp)

{

    if (!error_is_set(errp)) {

        v->start_list(v, name, errp);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void parse_waveformatex(AVIOContext *pb, AVCodecParameters *par)

+{

     ff_asf_guid subformat;

static void parse_waveformatex(AVIOContext *pb, AVCodecParameters *par)

{

    ff_asf_guid subformat;

    par->bits_per_coded_sample = avio_rl16(pb);

    par->channel_layout        = avio_rl32(pb); /* dwChannelMask */

    ff_get_guid(pb, &subformat);

    if (!memcmp(subformat + 4,

                (const uint8_t[]){ FF_MEDIASUBTYPE_BASE_GUID }, 12)) {

        par->codec_tag = AV_RL32(subformat);

        par->codec_id  = ff_wav_codec_get_id(par->codec_tag,

                                             par->bits_per_coded_sample);

    } else {

        par->codec_id = ff_codec_guid_get_id(ff_codec_wav_guids, subformat);

        if (!par->codec_id)

            av_log(pb, AV_LOG_WARNING,

                   "unknown subformat:"FF_PRI_GUID"\n",

                   FF_ARG_GUID(subformat));

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)
+
 {

     s->chr_read(s->handler_opaque, buf, len);

void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)

{

    s->chr_read(s->handler_opaque, buf, len);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int read_dialogue(ASSContext *ass, AVBPrint *dst, const uint8_t *p,
+
                          int64_t *start, int *duration)

 {
+
     int pos;

     int64_t end;

static int read_dialogue(ASSContext *ass, AVBPrint *dst, const uint8_t *p,

                         int64_t *start, int *duration)

{

    int pos;

    int64_t end;

    int hh1, mm1, ss1, ms1;

    int hh2, mm2, ss2, ms2;

    if (sscanf(p, "Dialogue: %*[^,],%d:%d:%d%*c%d,%d:%d:%d%*c%d,%n",

               &hh1, &mm1, &ss1, &ms1,

               &hh2, &mm2, &ss2, &ms2, &pos) >= 8) {

        /* This is not part of the sscanf itself in order to handle an actual

         * number (which would be the Layer) or the form "Marked=N" (which is

         * the old SSA field, now replaced by Layer, and will be lead to Layer

         * being 0 here). */

        const int layer = atoi(p + 10);

        end    = (hh2*3600LL + mm2*60LL + ss2) * 100LL + ms2;

        *start = (hh1*3600LL + mm1*60LL + ss1) * 100LL + ms1;

        *duration = end - *start;

        av_bprint_clear(dst);

        av_bprintf(dst, "%u,%d,%s", ass->readorder++, layer, p + pos);

        /* right strip the buffer */

        while (dst->len > 0 &&

               dst->str[dst->len - 1] == '\r' ||

               dst->str[dst->len - 1] == '\n')

            dst->str[--dst->len] = 0;

        return 0;

    }

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path,

+                            const struct timespec *buf)

 {

@@ -8,9 +8,9 @@

 #ifdef CONFIG_UTIMENSAT

+    int fd;
+
+    struct handle_data *data = (struct handle_data *)ctx->private;

static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path,

                            const struct timespec *buf)

{

    int ret;

#ifdef CONFIG_UTIMENSAT

    int fd;

    struct handle_data *data = (struct handle_data *)ctx->private;

    fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK);

    if (fd < 0) {

        return fd;

    }

    ret = futimens(fd, buf);

    close(fd);

#else

    ret = -1;

    errno = ENOSYS;

#endif

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -36,11 +36,11 @@
             dst += i;
             l->zeros_rem = lag_calc_zero_run(src[i]);
             src += i + 1;
+            goto output_zeros;
+        } else {
+            memcpy(dst, src, i);
+            src += i;
+            dst += i;
         }
     }
     return  src - src_start;

static int lag_decode_zero_run_line(LagarithContext *l, uint8_t *dst,
                                    const uint8_t *src, const uint8_t *src_end,
                                    int width, int esc_count)
{
    int i = 0;
    int count;
    uint8_t zero_run = 0;
    const uint8_t *src_start = src;
    uint8_t mask1 = -(esc_count < 2);
    uint8_t mask2 = -(esc_count < 3);
    uint8_t *end = dst + (width - 2);
output_zeros:
    if (l->zeros_rem) {
        count = FFMIN(l->zeros_rem, width - i);
        if (end - dst < count) {
            av_log(l->avctx, AV_LOG_ERROR, "Too many zeros remaining.\n");
            return AVERROR_INVALIDDATA;
        }
        memset(dst, 0, count);
        l->zeros_rem -= count;
        dst += count;
    }
    while (dst < end) {
        i = 0;
        while (!zero_run && dst + i < end) {
            i++;
            if (i+2 >= src_end - src)
                return AVERROR_INVALIDDATA;
            zero_run =
                !(src[i] | (src[i + 1] & mask1) | (src[i + 2] & mask2));
        }
        if (zero_run) {
            zero_run = 0;
            i += esc_count;
            memcpy(dst, src, i);
            dst += i;
            l->zeros_rem = lag_calc_zero_run(src[i]);
            src += i + 1;
            goto output_zeros;
        } else {
            memcpy(dst, src, i);
            src += i;
            dst += i;
        }
    }
    return  src - src_start;
}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void gen_pusha(DisasContext *s)

 {
+
     int i;

     gen_op_movl_A0_reg(R_ESP);

static void gen_pusha(DisasContext *s)

{

    int i;

    gen_op_movl_A0_reg(R_ESP);

    gen_op_addl_A0_im(-8 << s->dflag);

    if (!s->ss32)

        tcg_gen_ext16u_tl(cpu_A0, cpu_A0);

    tcg_gen_mov_tl(cpu_T[1], cpu_A0);

    if (s->addseg)

        gen_op_addl_A0_seg(s, R_SS);

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

        gen_op_mov_v_reg(MO_32, cpu_T[0], 7 - i);

        gen_op_st_v(s, s->dflag, cpu_T[0], cpu_A0);

        gen_op_addl_A0_im(1 << s->dflag);

    }

    gen_op_mov_reg_v(MO_16 + s->ss32, R_ESP, cpu_T[1]);

}


static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)

{

    long i;

    for (i = 0; i <= w - sizeof(long); i += sizeof(long)) {

        long a = *(long *)(src1 + i);

        long b = *(long *)(src2 + i);

        *(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80);

    }

    for (; i < w; i++)

        dst[i] = src1[i] + src2[i];

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int acpi_checksum(const uint8_t *data, int len)

 {
+
+    int sum, i;
+
     sum = 0;

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

static int acpi_checksum(const uint8_t *data, int len)

{

    int sum, i;

    sum = 0;

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

        sum += data[i];

    return (-sum) & 0xff;

}


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

 {

+    qemu_set_fd_handler2(s->fd,
+
+                         s->read_poll  ? net_socket_can_send : NULL,

                          s->read_poll  ? s->send_fn : NULL,

static void net_socket_update_fd_handler(NetSocketState *s)

{

    qemu_set_fd_handler2(s->fd,

                         s->read_poll  ? net_socket_can_send : NULL,

                         s->read_poll  ? s->send_fn : NULL,

                         s->write_poll ? net_socket_writable : NULL,

                         s);

}


static void test_visitor_in_native_list_string(TestInputVisitorData *data,

                                               const void *unused)

{

    UserDefNativeListUnion *cvalue = NULL;

    strList *elem = NULL;

    Visitor *v;

    GString *gstr_list = g_string_new("");

    GString *gstr_union = g_string_new("");

    int i;

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

        g_string_append_printf(gstr_list, "'%d'", i);

        if (i != 31) {

            g_string_append(gstr_list, ", ");

        }

    }

    g_string_append_printf(gstr_union,  "{ 'type': 'string', 'data': [ %s ] }",

                           gstr_list->str);

    v = visitor_input_test_init_raw(data,  gstr_union->str);

    visit_type_UserDefNativeListUnion(v, NULL, &cvalue, &error_abort);

    g_assert(cvalue != NULL);

    g_assert_cmpint(cvalue->type, ==, USER_DEF_NATIVE_LIST_UNION_KIND_STRING);

    for (i = 0, elem = cvalue->u.string.data; elem; elem = elem->next, i++) {

        gchar str[8];

        sprintf(str, "%d", i);

        g_assert_cmpstr(elem->value, ==, str);

    }

    g_string_free(gstr_union, true);

    g_string_free(gstr_list, true);

    qapi_free_UserDefNativeListUnion(cvalue);

}


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

     if (x->twopassbuffer) {

+        av_free(x->twopassbuffer);
+
+        av_free(x->old_twopassbuffer);
+
+    }

     av_free(x->twopassfile);

static av_cold int xvid_encode_close(AVCodecContext *avctx)

{

    struct xvid_context *x = avctx->priv_data;

    if (x->encoder_handle) {

        xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);

        x->encoder_handle = NULL;

    }

    av_frame_free(&avctx->coded_frame);

    av_freep(&avctx->extradata);

    if (x->twopassbuffer) {

        av_free(x->twopassbuffer);

        av_free(x->old_twopassbuffer);

    }

    av_free(x->twopassfile);

    av_free(x->intra_matrix);

    av_free(x->inter_matrix);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
         int k = 0;

         while (k < ics->max_sfb) {
+
             uint8_t sect_end = k;

             int sect_len_incr;

static int decode_band_types(AACContext *ac, enum BandType band_type[120],

                             int band_type_run_end[120], GetBitContext *gb,

                             IndividualChannelStream *ics)

{

    int g, idx = 0;

    const int bits = (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) ? 3 : 5;

    for (g = 0; g < ics->num_window_groups; g++) {

        int k = 0;

        while (k < ics->max_sfb) {

            uint8_t sect_end = k;

            int sect_len_incr;

            int sect_band_type = get_bits(gb, 4);

            if (sect_band_type == 12) {

                av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n");

                return -1;

            }

            do {

                sect_len_incr = get_bits(gb, bits);

                sect_end += sect_len_incr;

                if (get_bits_left(gb) < 0) {

                    av_log(ac->avctx, AV_LOG_ERROR, overread_err);

                    return -1;

                }

                if (sect_end > ics->max_sfb) {

                    av_log(ac->avctx, AV_LOG_ERROR,

                           "Number of bands (%d) exceeds limit (%d).\n",

                           sect_end, ics->max_sfb);

                    return -1;

                }

            } while (sect_len_incr == (1 << bits) - 1);

            for (; k < sect_end; k++) {

                band_type        [idx]   = sect_band_type;

                band_type_run_end[idx++] = sect_end;

            }

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static uint64_t bonito_readl(void *opaque, hwaddr addr,

                              unsigned size)
+
 {

     PCIBonitoState *s = opaque;

static uint64_t bonito_readl(void *opaque, hwaddr addr,

                             unsigned size)

{

    PCIBonitoState *s = opaque;

    uint32_t saddr;

    saddr = (addr - BONITO_REGBASE) >> 2;

    DPRINTF("bonito_readl "TARGET_FMT_plx"\n", addr);

    switch (saddr) {

    case BONITO_INTISR:

        return s->regs[saddr];

    default:

        return s->regs[saddr];

    }

}


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

         gen_io_end();

+        gen_stop_exception(ctx);
+
+    }
+
+}

static void spr_read_tbl (DisasContext *ctx, int gprn, int sprn)

{

    if (use_icount) {

        gen_io_start();

    }

    gen_helper_load_tbl(cpu_gpr[gprn], cpu_env);

    if (use_icount) {

        gen_io_end();

        gen_stop_exception(ctx);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static target_long monitor_get_xer (const struct MonitorDef *md, int val)

+{

     CPUState *env = mon_get_cpu();

static target_long monitor_get_xer (const struct MonitorDef *md, int val)

{

    CPUState *env = mon_get_cpu();

    if (!env)

        return 0;

    return env->xer;

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
                               Error **errp)

 {
+
+    StringInputVisitor *siv = to_siv(v);

+    char *endp = (char *) siv->string;
+
     double val;

static void parse_type_number(Visitor *v, const char *name, double *obj,

                              Error **errp)

{

    StringInputVisitor *siv = to_siv(v);

    char *endp = (char *) siv->string;

    double val;

    errno = 0;

    if (siv->string) {

        val = strtod(siv->string, &endp);

    }

    if (!siv->string || errno || endp == siv->string || *endp) {

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

                   "number");

        return;

    }

    *obj = val;

}