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

     r = mr->ops->read_with_attrs(mr->opaque, addr, &tmp, size, attrs);

+    if (mr->subpage) {
+
+        trace_memory_region_subpage_read(get_cpu_index(), mr, addr, tmp, size);
+
+

static MemTxResult memory_region_read_with_attrs_accessor(MemoryRegion *mr,

                                                          hwaddr addr,

                                                          uint64_t *value,

                                                          unsigned size,

                                                          unsigned shift,

                                                          uint64_t mask,

                                                          MemTxAttrs attrs)

{

    uint64_t tmp = 0;

    MemTxResult r;

    r = mr->ops->read_with_attrs(mr->opaque, addr, &tmp, size, attrs);

    if (mr->subpage) {

        trace_memory_region_subpage_read(get_cpu_index(), mr, addr, tmp, size);

    } else if (TRACE_MEMORY_REGION_OPS_READ_ENABLED) {

        hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);

        trace_memory_region_ops_read(get_cpu_index(), mr, abs_addr, tmp, size);

    }

    *value |= (tmp & mask) << shift;

    return r;

}


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

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

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

             entry = &error_entries[i];

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

{

    int ret = 0, i;

    struct error_entry *entry = NULL;

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

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

            entry = &error_entries[i];

            break;

        }

    }

    if (entry) {

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

    } else {

#if HAVE_STRERROR_R

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

#else

        ret = -1;

#endif

        if (ret < 0)

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

    }

    return ret;

}


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

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

     if (parse_str(siv, name, errp) < 0) {

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

{

    StringInputVisitor *siv = to_siv(v);

    if (parse_str(siv, name, errp) < 0) {

        return;

    }

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

    if (siv->cur_range) {

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

        if (r) {

            siv->cur = r->begin;

        }

    }

}


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

     if (vnc_has_feature(vs, VNC_FEATURE_WMVI)) {

+        /* Sending a WMVi message to notify the client*/

         vnc_lock_output(vs);

static void vnc_colordepth(VncState *vs)

{

    if (vnc_has_feature(vs, VNC_FEATURE_WMVI)) {

        /* Sending a WMVi message to notify the client*/

        vnc_lock_output(vs);

        vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);

        vnc_write_u8(vs, 0);

        vnc_write_u16(vs, 1); /* number of rects */

        vnc_framebuffer_update(vs, 0, 0,

                               surface_width(vs->vd->ds),

                               surface_height(vs->vd->ds),

                               VNC_ENCODING_WMVi);

        pixel_format_message(vs);

        vnc_unlock_output(vs);

        vnc_flush(vs);

    } else {

        set_pixel_conversion(vs);

    }

}


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

             tis->loc[locty].sts = TPM_TIS_STS_VALID;

+#ifdef RAISE_STS_IRQ
+
+            tpm_tis_raise_irq(s, locty, TPM_TIS_INT_STS_VALID);
+
+#endif

         }

static uint32_t tpm_tis_data_read(TPMState *s, uint8_t locty)

{

    TPMTISEmuState *tis = &s->s.tis;

    uint32_t ret = TPM_TIS_NO_DATA_BYTE;

    uint16_t len;

    if ((tis->loc[locty].sts & TPM_TIS_STS_DATA_AVAILABLE)) {

        len = tpm_tis_get_size_from_buffer(&tis->loc[locty].r_buffer);

        ret = tis->loc[locty].r_buffer.buffer[tis->loc[locty].r_offset++];

        if (tis->loc[locty].r_offset >= len) {

            /* got last byte */

            tis->loc[locty].sts = TPM_TIS_STS_VALID;

#ifdef RAISE_STS_IRQ

            tpm_tis_raise_irq(s, locty, TPM_TIS_INT_STS_VALID);

#endif

        }

        DPRINTF("tpm_tis: tpm_tis_data_read byte 0x%02x   [%d]\n",

                ret, tis->loc[locty].r_offset-1);

    }

    return ret;

}


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

+                                     unsigned size)
+
 {

     return fw_cfg_read(opaque);

static uint64_t fw_cfg_data_mem_read(void *opaque, hwaddr addr,

                                     unsigned size)

{

    return fw_cfg_read(opaque);

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
                              uint8_t *aDest, int dstW, int chrDstW)

 {
+
+    int p= 4;
+
+    const int16_t *src[4]= { alpSrc + dstW, lumSrc + dstW, chrUSrc + chrDstW, chrVSrc + chrDstW };
+
     uint8_t *dst[4]= { aDest, dest, uDest, vDest };

     x86_reg counter[4]= { dstW, dstW, chrDstW, chrDstW };

static void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc,

                             const int16_t *chrUSrc, const int16_t *chrVSrc,

                             const int16_t *alpSrc,

                             uint8_t *dest, uint8_t *uDest, uint8_t *vDest,

                             uint8_t *aDest, int dstW, int chrDstW)

{

    int p= 4;

    const int16_t *src[4]= { alpSrc + dstW, lumSrc + dstW, chrUSrc + chrDstW, chrVSrc + chrDstW };

    uint8_t *dst[4]= { aDest, dest, uDest, vDest };

    x86_reg counter[4]= { dstW, dstW, chrDstW, chrDstW };

    while (p--) {

        if (dst[p]) {

            __asm__ volatile(

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

                ".p2align               4             \n\t" /* FIXME Unroll? */

                "1:                                   \n\t"

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

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

                "psraw                 $7, %%mm0      \n\t"

                "psraw                 $7, %%mm1      \n\t"

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

                MOVNTQ(%%mm0, (%1, %%REGa))

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

                "jnc                   1b             \n\t"

                :: "r" (src[p]), "r" (dst[p] + counter[p]),

                   "g" (-counter[p])

                : "%"REG_a

            );

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id)

 {
+
+    VirtIORNG *vrng = opaque;
+
+    VirtIODevice *vdev = VIRTIO_DEVICE(vrng);
+

     if (version_id != 1) {

static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id)

{

    VirtIORNG *vrng = opaque;

    VirtIODevice *vdev = VIRTIO_DEVICE(vrng);

    if (version_id != 1) {

        return -EINVAL;

    }

    virtio_load(vdev, f, version_id);

    /* We may have an element ready but couldn't process it due to a quota

     * limit.  Make sure to try again after live migration when the quota may

     * have been reset.

     */

    virtio_rng_process(vrng);

    return 0;

}


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

     n = s->nsector;
+
+    if (n > s->req_nb_sectors) {
+
+        n = s->req_nb_sectors;
+
     }

static void ide_sector_read_cb(void *opaque, int ret)

{

    IDEState *s = opaque;

    int n;

    s->pio_aiocb = NULL;

    s->status &= ~BUSY_STAT;

    if (ret == -ECANCELED) {

        return;

    }

    block_acct_done(bdrv_get_stats(s->bs), &s->acct);

    if (ret != 0) {

        if (ide_handle_rw_error(s, -ret, IDE_RETRY_PIO |

                                IDE_RETRY_READ)) {

            return;

        }

    }

    n = s->nsector;

    if (n > s->req_nb_sectors) {

        n = s->req_nb_sectors;

    }

    /* Allow the guest to read the io_buffer */

    ide_transfer_start(s, s->io_buffer, n * BDRV_SECTOR_SIZE, ide_sector_read);

    ide_set_irq(s->bus);

    ide_set_sector(s, ide_get_sector(s) + n);

    s->nsector -= n;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+BlockDeviceInfoList *bdrv_named_nodes_list(void)

 {

     BlockDeviceInfoList *list, *entry;

+    BlockDriverState *bs;

BlockDeviceInfoList *bdrv_named_nodes_list(void)

{

    BlockDeviceInfoList *list, *entry;

    BlockDriverState *bs;

    list = NULL;

    QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) {

        entry = g_malloc0(sizeof(*entry));

        entry->value = bdrv_block_device_info(bs);

        entry->next = list;

        list = entry;

    }

    return list;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     /* NaN are not treated the same way IEEE 754 does */

     if (unlikely(float32_is_nan(u.f)))
+
+        return 0;
+
+    tmp = uint64_to_float32(1ULL << 32, &env->vec_status);
+
     u.f = float32_mul(u.f, tmp, &env->vec_status);

static inline uint32_t efsctuf(uint32_t val)

{

    CPU_FloatU u;

    float32 tmp;

    u.l = val;

    /* NaN are not treated the same way IEEE 754 does */

    if (unlikely(float32_is_nan(u.f)))

        return 0;

    tmp = uint64_to_float32(1ULL << 32, &env->vec_status);

    u.f = float32_mul(u.f, tmp, &env->vec_status);

    return float32_to_uint32(u.f, &env->vec_status);

}


void ff_h264_h_lpf_luma_inter_msa(uint8_t *data, int img_width,

                                  int alpha, int beta, int8_t *tc)

{

    uint8_t bs0 = 1;

    uint8_t bs1 = 1;

    uint8_t bs2 = 1;

    uint8_t bs3 = 1;

    if (tc[0] < 0)

        bs0 = 0;

    if (tc[1] < 0)

        bs1 = 0;

    if (tc[2] < 0)

        bs2 = 0;

    if (tc[3] < 0)

        bs3 = 0;

    avc_loopfilter_luma_inter_edge_ver_msa(data,

                                           bs0, bs1, bs2, bs3,

                                           tc[0], tc[1], tc[2], tc[3],

                                           alpha, beta, img_width);

}


--- a/source.c
+++ b/source.c
@@ -7,12 +7,12 @@
     BusState *qbus = BUS(qdev_get_parent_bus(qdev));

     VirtioBusState *bus = VIRTIO_BUS(qbus);
+
     VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus);

+    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);

+    bool has_iommu = virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM);

void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp)

{

    DeviceState *qdev = DEVICE(vdev);

    BusState *qbus = BUS(qdev_get_parent_bus(qdev));

    VirtioBusState *bus = VIRTIO_BUS(qbus);

    VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus);

    VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);

    bool has_iommu = virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM);

    DPRINTF("%s: plug device.\n", qbus->name);

    if (klass->pre_plugged != NULL) {

        klass->pre_plugged(qbus->parent, errp);

    }

    /* Get the features of the plugged device. */

    assert(vdc->get_features != NULL);

    vdev->host_features = vdc->get_features(vdev, vdev->host_features,

                                            errp);

    if (klass->device_plugged != NULL) {

        klass->device_plugged(qbus->parent, errp);

    }

    if (klass->get_dma_as != NULL && has_iommu) {

        virtio_add_feature(&vdev->host_features, VIRTIO_F_IOMMU_PLATFORM);

        vdev->dma_as = klass->get_dma_as(qbus->parent);

    } else {

        vdev->dma_as = &address_space_memory;

    }

}


--- a/source.c
+++ b/source.c
@@ -5,8 +5,8 @@
     uint16_t *dstu = (uint16_t *)frame->data[1];

     uint16_t *dstv = (uint16_t *)frame->data[2];
+
+    int16_t *srcu  = (int16_t *)frame->data[1];

     int16_t *srcv  = (int16_t *)frame->data[2];

static void postprocess_chroma(AVFrame *frame, int w, int h, int depth)

{

    uint16_t *dstu = (uint16_t *)frame->data[1];

    uint16_t *dstv = (uint16_t *)frame->data[2];

    int16_t *srcu  = (int16_t *)frame->data[1];

    int16_t *srcv  = (int16_t *)frame->data[2];

    ptrdiff_t strideu = frame->linesize[1] / 2;

    ptrdiff_t stridev = frame->linesize[2] / 2;

    const int add = 1 << (depth - 1);

    const int shift = 16 - depth;

    int i, j;

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

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

            dstu[i] = (add + srcu[i]) << shift;

            dstv[i] = (add + srcv[i]) << shift;

        }

        dstu += strideu;

        dstv += stridev;

        srcu += strideu;

        srcv += stridev;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx)
+
+{
+
+    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail);

     if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)

static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx)

{

    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail);

    if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)

        FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);

    ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4 - ctx->min_padding) * 8;

    ctx->qscale = 1;

    ctx->lambda = 2<<LAMBDA_FRAC_BITS; // qscale 2

    return 0;

 fail:

    return -1;

}


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

                                   BlockDriverState *bs,

+                                  int64_t sector_num,
+
+                                  int nb_sectors, bool is_write)
+
+{

     *req = (BdrvTrackedRequest){

static void tracked_request_begin(BdrvTrackedRequest *req,

                                  BlockDriverState *bs,

                                  int64_t sector_num,

                                  int nb_sectors, bool is_write)

{

    *req = (BdrvTrackedRequest){

        .bs = bs,

        .sector_num = sector_num,

        .nb_sectors = nb_sectors,

        .is_write = is_write,

    };

    qemu_co_queue_init(&req->wait_queue);

    QLIST_INSERT_HEAD(&bs->tracked_requests, req, list);

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int mp_user_removexattr(FsContext *ctx,
+
+                               const char *path, const char *name)

 {

     char *buffer;
+
+    int ret;
+
+

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

static int mp_user_removexattr(FsContext *ctx,

                               const char *path, const char *name)

{

    char *buffer;

    int ret;

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

        /*

         * Don't allow fetch of user.virtfs namesapce

         * in case of mapped security

         */

        errno = EACCES;

        return -1;

    }

    buffer = rpath(ctx, path);

    ret = lremovexattr(buffer, name);

    g_free(buffer);

    return ret;

}


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

                        qemu_irq irq)

+{

     OHCIState *ohci = (OHCIState *)qemu_mallocz(sizeof(OHCIState));

void usb_ohci_init_pxa(target_phys_addr_t base, int num_ports, int devfn,

                       qemu_irq irq)

{

    OHCIState *ohci = (OHCIState *)qemu_mallocz(sizeof(OHCIState));

    usb_ohci_init(ohci, num_ports, devfn, irq,

                  OHCI_TYPE_PXA, "OHCI USB");

    ohci->mem_base = base;

    cpu_register_physical_memory(ohci->mem_base, 0xfff, ohci->mem);

}


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

+                                       target_phys_addr_t addr)

 {

static uint32_t pci_unin_config_readl (void *opaque,

                                       target_phys_addr_t addr)

{

    UNINState *s = opaque;

    return s->config_reg;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
     /* FIXME how to correctly detect RLE ??? */
     if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
         int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
+        uint8_t *ptr = s->frame->data[0];
+        uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
+        int i, j;
+        for (i = 0; i < avctx->height; i++) {
+            if (avctx->bits_per_coded_sample == 4) {
                 for (j = 0; j < avctx->width - 1; j += 2) {
                     ptr[j+0] = buf[j>>1] >> 4;
                     ptr[j+1] = buf[j>>1] & 0xF;

static int msrle_decode_frame(AVCodecContext *avctx,
                              void *data, int *got_frame,
                              AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    MsrleContext *s = avctx->priv_data;
    int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8;
    int ret;
    s->buf = buf;
    s->size = buf_size;
    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
        return ret;
    if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
        const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
        if (pal) {
            s->frame->palette_has_changed = 1;
            memcpy(s->pal, pal, AVPALETTE_SIZE);
        }
        /* make the palette available */
        memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
    }
    /* FIXME how to correctly detect RLE ??? */
    if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
        int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
        uint8_t *ptr = s->frame->data[0];
        uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
        int i, j;
        for (i = 0; i < avctx->height; i++) {
            if (avctx->bits_per_coded_sample == 4) {
                for (j = 0; j < avctx->width - 1; j += 2) {
                    ptr[j+0] = buf[j>>1] >> 4;
                    ptr[j+1] = buf[j>>1] & 0xF;
                }
                if (avctx->width & 1)
                    ptr[j+0] = buf[j>>1] >> 4;
            } else {
                memcpy(ptr, buf, linesize);
            }
            buf -= istride;
            ptr += s->frame->linesize[0];
        }
    } else {
        bytestream2_init(&s->gb, buf, buf_size);
        ff_msrle_decode(avctx, (AVPicture*)s->frame, avctx->bits_per_coded_sample, &s->gb);
    }
    if ((ret = av_frame_ref(data, s->frame)) < 0)
        return ret;
    *got_frame      = 1;
    /* report that the buffer was completely consumed */
    return buf_size;
}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {

         object_unref(OBJECT(listen_ioc));
+
+        qapi_free_SocketAddress(saddr);
+
+        return;
+
     }

static void socket_start_incoming_migration(SocketAddress *saddr,

                                            Error **errp)

{

    QIOChannelSocket *listen_ioc = qio_channel_socket_new();

    qio_channel_set_name(QIO_CHANNEL(listen_ioc),

                         "migration-socket-listener");

    if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {

        object_unref(OBJECT(listen_ioc));

        qapi_free_SocketAddress(saddr);

        return;

    }

    qio_channel_add_watch(QIO_CHANNEL(listen_ioc),

                          G_IO_IN,

                          socket_accept_incoming_migration,

                          listen_ioc,

                          (GDestroyNotify)object_unref);

    qapi_free_SocketAddress(saddr);

}


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

             skip_bits1(gb);

+            syn_ele = TYPE_CCE;
+
+            break;
+
+        case AAC_CHANNEL_LFE:

             syn_ele = TYPE_LFE;

static void decode_channel_map(uint8_t layout_map[][3],

                               enum ChannelPosition type,

                               GetBitContext *gb, int n)

{

    while (n--) {

        enum RawDataBlockType syn_ele;

        switch (type) {

        case AAC_CHANNEL_FRONT:

        case AAC_CHANNEL_BACK:

        case AAC_CHANNEL_SIDE:

            syn_ele = get_bits1(gb);

            break;

        case AAC_CHANNEL_CC:

            skip_bits1(gb);

            syn_ele = TYPE_CCE;

            break;

        case AAC_CHANNEL_LFE:

            syn_ele = TYPE_LFE;

            break;

        }

        layout_map[0][0] = syn_ele;

        layout_map[0][1] = get_bits(gb, 4);

        layout_map[0][2] = type;

        layout_map++;

    }

}


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

     cpu_list_add(cpu);
+
+
+
+    if (tcg_enabled() && !cc->tcg_initialized) {
+
         cc->tcg_initialized = true;

         cc->tcg_initialize();

void cpu_exec_realizefn(CPUState *cpu, Error **errp)

{

    CPUClass *cc = CPU_GET_CLASS(cpu);

    cpu_list_add(cpu);

    if (tcg_enabled() && !cc->tcg_initialized) {

        cc->tcg_initialized = true;

        cc->tcg_initialize();

    }

#ifndef CONFIG_USER_ONLY

    if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {

        vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu);

    }

    if (cc->vmsd != NULL) {

        vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu);

    }

#endif

}


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

       return (openat(dirfd, pathname, flags, mode));
+
+  }
+
+  return (openat(dirfd, pathname, flags));
+
 }

static int sys_openat(int dirfd, const char *pathname, int flags, ...)

{

  /*

   * open(2) has extra parameter 'mode' when called with

   * flag O_CREAT.

   */

  if ((flags & O_CREAT) != 0) {

      va_list ap;

      mode_t mode;

      /*

       * Get the 'mode' parameter and translate it to

       * host bits.

       */

      va_start(ap, flags);

      mode = va_arg(ap, mode_t);

      mode = target_to_host_bitmask(mode, fcntl_flags_tbl);

      va_end(ap);

      return (openat(dirfd, pathname, flags, mode));

  }

  return (openat(dirfd, pathname, flags));

}


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

     balloon_stat_fn(balloon_opaque, info);

+    return 1;
+
+}

static int qemu_balloon_status(BalloonInfo *info)

{

    if (!balloon_stat_fn) {

        return 0;

    }

    balloon_stat_fn(balloon_opaque, info);

    return 1;

}


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

+    /* Special cases not set in the x86_def_t structs: */
+
+    if (kvm_enabled()) {
+
+        env->features[FEAT_KVM] |= kvm_default_features;

     }

static void cpu_x86_register(X86CPU *cpu, const char *name, Error **errp)

{

    CPUX86State *env = &cpu->env;

    x86_def_t def1, *def = &def1;

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

    if (cpu_x86_find_by_name(cpu, def, name) < 0) {

        error_setg(errp, "Unable to find CPU definition: %s", name);

        return;

    }

    object_property_set_str(OBJECT(cpu), def->vendor, "vendor", errp);

    object_property_set_int(OBJECT(cpu), def->level, "level", errp);

    object_property_set_int(OBJECT(cpu), def->family, "family", errp);

    object_property_set_int(OBJECT(cpu), def->model, "model", errp);

    object_property_set_int(OBJECT(cpu), def->stepping, "stepping", errp);

    env->features[FEAT_1_EDX] = def->features[FEAT_1_EDX];

    env->features[FEAT_1_ECX] = def->features[FEAT_1_ECX];

    env->features[FEAT_8000_0001_EDX] = def->features[FEAT_8000_0001_EDX];

    env->features[FEAT_8000_0001_ECX] = def->features[FEAT_8000_0001_ECX];

    object_property_set_int(OBJECT(cpu), def->xlevel, "xlevel", errp);

    env->features[FEAT_KVM] = def->features[FEAT_KVM];

    env->features[FEAT_SVM] = def->features[FEAT_SVM];

    env->features[FEAT_C000_0001_EDX] = def->features[FEAT_C000_0001_EDX];

    env->features[FEAT_7_0_EBX] = def->features[FEAT_7_0_EBX];

    env->cpuid_xlevel2 = def->xlevel2;

    cpu->cache_info_passthrough = def->cache_info_passthrough;

    object_property_set_str(OBJECT(cpu), def->model_id, "model-id", errp);

    /* Special cases not set in the x86_def_t structs: */

    if (kvm_enabled()) {

        env->features[FEAT_KVM] |= kvm_default_features;

    }

    env->features[FEAT_1_ECX] |= CPUID_EXT_HYPERVISOR;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static ssize_t mp_pacl_getxattr(FsContext *ctx, const char *path,
+
+                                const char *name, void *value, size_t size)
+
+{
+
+    char *buffer;

     ssize_t ret;

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

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

{

    char *buffer;

    ssize_t ret;

    buffer = rpath(ctx, path);

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

    g_free(buffer);

    return ret;

}


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

     if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {
+
         int64_t addend;

         int delta_timestamp;

static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp)

{

    if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {

        int64_t addend;

        int delta_timestamp;

        /* compute pts from timestamp with received ntp_time */

        delta_timestamp = timestamp - s->last_rtcp_timestamp;

        /* convert to the PTS timebase */

        addend = av_rescale(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, s->st->time_base.den, (uint64_t)s->st->time_base.num << 32);

        pkt->pts = addend + delta_timestamp;

    }

}


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

 {
+
     UHCIQueue *queue, *nq;

static void uhci_async_cancel_all(UHCIState *s)

{

    UHCIQueue *queue, *nq;

    QTAILQ_FOREACH_SAFE(queue, &s->queues, next, nq) {

        uhci_queue_free(queue);

    }

}


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

 {

+    struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;

+    struct io_event event;
+
     int ret;

+
+
     if (laiocb->ret != -EINPROGRESS)

         return;

static void laio_cancel(BlockDriverAIOCB *blockacb)

{

    struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;

    struct io_event event;

    int ret;

    if (laiocb->ret != -EINPROGRESS)

        return;

    /*

     * Note that as of Linux 2.6.31 neither the block device code nor any

     * filesystem implements cancellation of AIO request.

     * Thus the polling loop below is the normal code path.

     */

    ret = io_cancel(laiocb->ctx->ctx, &laiocb->iocb, &event);

    if (ret == 0) {

        laiocb->ret = -ECANCELED;

        return;

    }

    /*

     * We have to wait for the iocb to finish.

     *

     * The only way to get the iocb status update is by polling the io context.

     * We might be able to do this slightly more optimal by removing the

     * O_NONBLOCK flag.

     */

    while (laiocb->ret == -EINPROGRESS) {

        qemu_laio_completion_cb(&laiocb->ctx->e);

    }

}


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

 {
+
     VTEncContext *vtctx = avctx->priv_data;

static av_cold int vtenc_close(AVCodecContext *avctx)

{

    VTEncContext *vtctx = avctx->priv_data;

    if(!vtctx->session) return 0;

    VTCompressionSessionInvalidate(vtctx->session);

    pthread_cond_destroy(&vtctx->cv_sample_sent);

    pthread_mutex_destroy(&vtctx->lock);

    CFRelease(vtctx->session);

    vtctx->session = NULL;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));

     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+
+    int i;
+
+    int nvectors = k->query_nvectors ? k->query_nvectors(qbus->parent) : 0;
+

     if (nvectors) {

void virtio_init(VirtIODevice *vdev, const char *name,

                 uint16_t device_id, size_t config_size)

{

    BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));

    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);

    int i;

    int nvectors = k->query_nvectors ? k->query_nvectors(qbus->parent) : 0;

    if (nvectors) {

        vdev->vector_queues =

            g_malloc0(sizeof(*vdev->vector_queues) * nvectors);

    }

    vdev->device_id = device_id;

    vdev->status = 0;

    vdev->isr = 0;

    vdev->queue_sel = 0;

    vdev->config_vector = VIRTIO_NO_VECTOR;

    vdev->vq = g_malloc0(sizeof(VirtQueue) * VIRTIO_QUEUE_MAX);

    vdev->vm_running = runstate_is_running();

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

        vdev->vq[i].vector = VIRTIO_NO_VECTOR;

        vdev->vq[i].vdev = vdev;

        vdev->vq[i].queue_index = i;

    }

    vdev->name = name;

    vdev->config_len = config_size;

    if (vdev->config_len) {

        vdev->config = g_malloc0(config_size);

    } else {

        vdev->config = NULL;

    }

    vdev->vmstate = qemu_add_vm_change_state_handler(virtio_vmstate_change,

                                                     vdev);

    vdev->device_endian = virtio_default_endian();

    vdev->use_guest_notifier_mask = true;

}


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

 {

+    PCIBridge *s = DO_UPCAST(PCIBridge, dev, pci_dev);

     assert(QLIST_EMPTY(&s->sec_bus.child));

void pci_bridge_exitfn(PCIDevice *pci_dev)

{

    PCIBridge *s = DO_UPCAST(PCIBridge, dev, pci_dev);

    assert(QLIST_EMPTY(&s->sec_bus.child));

    QLIST_REMOVE(&s->sec_bus, sibling);

    pci_bridge_region_cleanup(s);

    memory_region_destroy(&s->address_space_mem);

    memory_region_destroy(&s->address_space_io);

    /* qbus_free() is called automatically by qdev_free() */

}


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

    else if (value > max)
+
+       return max;
+
+   else

        return value;

static inline int clamp(int value, int min, int max)

{

   if (value < min)

       return min;

   else if (value > max)

       return max;

   else

       return value;

}


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

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

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

{

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

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void puv3_board_init(CPUUniCore32State *env, ram_addr_t ram_size)

+{

     MemoryRegion *ram_memory = g_new(MemoryRegion, 1);

static void puv3_board_init(CPUUniCore32State *env, ram_addr_t ram_size)

{

    MemoryRegion *ram_memory = g_new(MemoryRegion, 1);

    /* SDRAM at address zero.  */

    memory_region_init_ram(ram_memory, NULL, "puv3.ram", ram_size,

                           &error_abort);

    vmstate_register_ram_global(ram_memory);

    memory_region_add_subregion(get_system_memory(), 0, ram_memory);

}


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

     for (count = 0; fmts[count] != -1; count++)

+        ;
+
+
+
+    formats               = av_mallocz(sizeof(*formats));

     if (count)

AVFilterFormats *ff_make_format_list(const int *fmts)

{

    AVFilterFormats *formats;

    int count;

    for (count = 0; fmts[count] != -1; count++)

        ;

    formats               = av_mallocz(sizeof(*formats));

    if (count)

        formats->formats  = av_malloc(sizeof(*formats->formats) * count);

    formats->nb_formats = count;

    memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);

    return formats;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void tci_out_label(TCGContext *s, TCGLabel *label)
+
+{
+
     if (label->has_value) {

         tcg_out_i(s, label->u.value);

static void tci_out_label(TCGContext *s, TCGLabel *label)

{

    if (label->has_value) {

        tcg_out_i(s, label->u.value);

        assert(label->u.value);

    } else {

        tcg_out_reloc(s, s->code_ptr, sizeof(tcg_target_ulong), label, 0);

        s->code_ptr += sizeof(tcg_target_ulong);

    }

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
                     av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction mode\n");

                     return -1;
+
+                }
+
+            }
+
         }

     }

static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t *dst)

{

    int i, j, k;

    for(i = 0; i < 4; i++, dst += r->intra_types_stride - 4){

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

            int code = svq3_get_ue_golomb(gb) << 1;

            if(code >= 81*2){

                av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");

                return -1;

            }

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

                int A = dst[-r->intra_types_stride] + 1;

                int B = dst[-1] + 1;

                *dst++ = rv30_itype_from_context[A * 90 + B * 9 + rv30_itype_code[code + k]];

                if(dst[-1] == 9){

                    av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction mode\n");

                    return -1;

                }

            }

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void omap_badwidth_write32(void *opaque, target_phys_addr_t addr,

                 uint32_t value)
+
+{

     OMAP_32B_REG(addr);

void omap_badwidth_write32(void *opaque, target_phys_addr_t addr,

                uint32_t value)

{

    OMAP_32B_REG(addr);

    cpu_physical_memory_write(addr, (void *) &value, 4);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void aarch64_cpu_register(const ARMCPUInfo *info)
+
+{
+
+    TypeInfo type_info = {

         .parent = TYPE_AARCH64_CPU,

static void aarch64_cpu_register(const ARMCPUInfo *info)

{

    TypeInfo type_info = {

        .parent = TYPE_AARCH64_CPU,

        .instance_size = sizeof(ARMCPU),

        .instance_init = info->initfn,

        .class_size = sizeof(ARMCPUClass),

        .class_init = info->class_init,

    };

    /* TODO: drop when we support more CPUs - all entries will have name set */

    if (!info->name) {

        return;

    }

    type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, info->name);

    type_register(&type_info);

    g_free((void *)type_info.name);

}


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

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

     ohci_set_interrupt(ohci, OHCI_INTR_SF);

static void ohci_sof(OHCIState *ohci)

{

    ohci->sof_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);

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

    ohci_set_interrupt(ohci, OHCI_INTR_SF);

}


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

     QEDWriteZeroesCB *cb = opaque;
+

     cb->done = true;

static void coroutine_fn qed_co_pwrite_zeroes_cb(void *opaque, int ret)

{

    QEDWriteZeroesCB *cb = opaque;

    cb->done = true;

    cb->ret = ret;

    if (cb->co) {

        qemu_coroutine_enter(cb->co, NULL);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void term_init(void)

 {
+
 #if HAVE_TERMIOS_H

     if(!run_as_daemon){

static void term_init(void)

{

#if HAVE_TERMIOS_H

    if(!run_as_daemon){

    struct termios tty;

    tcgetattr (0, &tty);

    oldtty = tty;

    atexit(term_exit);

    tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP

                          |INLCR|IGNCR|ICRNL|IXON);

    tty.c_oflag |= OPOST;

    tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);

    tty.c_cflag &= ~(CSIZE|PARENB);

    tty.c_cflag |= CS8;

    tty.c_cc[VMIN] = 1;

    tty.c_cc[VTIME] = 0;

    tcsetattr (0, TCSANOW, &tty);

    signal(SIGQUIT, sigterm_handler); /* Quit (POSIX).  */

    }

#endif

    avformat_network_deinit();

    signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).    */

    signal(SIGTERM, sigterm_handler); /* Termination (ANSI).  */

#ifdef SIGXCPU

    signal(SIGXCPU, sigterm_handler);

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static void fw_cfg_initfn(Object *obj)
+
+{
+
+    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
+
+    FWCfgState *s = FW_CFG(obj);
+

     memory_region_init_io(&s->ctl_iomem, OBJECT(s), &fw_cfg_ctl_mem_ops, s,

static void fw_cfg_initfn(Object *obj)

{

    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);

    FWCfgState *s = FW_CFG(obj);

    memory_region_init_io(&s->ctl_iomem, OBJECT(s), &fw_cfg_ctl_mem_ops, s,

                          "fwcfg.ctl", FW_CFG_SIZE);

    sysbus_init_mmio(sbd, &s->ctl_iomem);

    memory_region_init_io(&s->data_iomem, OBJECT(s), &fw_cfg_data_mem_ops, s,

                          "fwcfg.data", FW_CFG_DATA_SIZE);

    sysbus_init_mmio(sbd, &s->data_iomem);

    /* In case ctl and data overlap: */

    memory_region_init_io(&s->comb_iomem, OBJECT(s), &fw_cfg_comb_mem_ops, s,

                          "fwcfg", FW_CFG_SIZE);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+int qemu_chr_open_msmouse(QemuOpts *opts, CharDriverState **_chr)

 {

     CharDriverState *chr;

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

     chr->chr_write = msmouse_chr_write;

int qemu_chr_open_msmouse(QemuOpts *opts, CharDriverState **_chr)

{

    CharDriverState *chr;

    chr = g_malloc0(sizeof(CharDriverState));

    chr->chr_write = msmouse_chr_write;

    chr->chr_close = msmouse_chr_close;

    qemu_add_mouse_event_handler(msmouse_event, chr, 0, "QEMU Microsoft Mouse");

    *_chr = chr;

    return 0;

}


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

     return version_id == 5;

+}

static bool version_is_5(void *opaque, int version_id)

{

    return version_id == 5;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline uint64_t vtd_get_slpte_addr(uint64_t slpte)

 {

static inline uint64_t vtd_get_slpte_addr(uint64_t slpte)

{

    return slpte & VTD_SL_PT_BASE_ADDR_MASK(VTD_HOST_ADDRESS_WIDTH);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
+
+{
+
+    char *buffer;
+
+    int ret;

     char *path = fs_path->data;

static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)

{

    char *buffer;

    int ret;

    char *path = fs_path->data;

    buffer = rpath(s, path);

    ret = statfs(buffer, stbuf);

    g_free(buffer);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict)

+{

     pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr"));

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

{

    pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr"));

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     DeviceClass *dc = DEVICE_CLASS(klass);

     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+

     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);

    dc->reset = ich9_lpc_reset;

    k->init = ich9_lpc_initfn;

    dc->vmsd = &vmstate_ich9_lpc;

    dc->no_user = 1;

    k->config_write = ich9_lpc_config_write;

    dc->desc = "ICH9 LPC bridge";

    k->vendor_id = PCI_VENDOR_ID_INTEL;

    k->device_id = PCI_DEVICE_ID_INTEL_ICH9_8;

    k->revision = ICH9_A2_LPC_REVISION;

    k->class_id = PCI_CLASS_BRIDGE_ISA;

}


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

     for (cpu = 0; cpu < NUM_CPU(s); cpu++) {
+
+        cm = 1 << cpu;
+
+        s->current_pending[cpu] = 1023;
+
         if (!s->enabled || !s->cpu_enabled[cpu]) {

 	    qemu_irq_lower(s->parent_irq[cpu]);

static void gic_update(gic_state *s)

{

    int best_irq;

    int best_prio;

    int irq;

    int level;

    int cpu;

    int cm;

    for (cpu = 0; cpu < NUM_CPU(s); cpu++) {

        cm = 1 << cpu;

        s->current_pending[cpu] = 1023;

        if (!s->enabled || !s->cpu_enabled[cpu]) {

	    qemu_irq_lower(s->parent_irq[cpu]);

            return;

        }

        best_prio = 0x100;

        best_irq = 1023;

        for (irq = 0; irq < GIC_NIRQ; irq++) {

            if (GIC_TEST_ENABLED(irq) && GIC_TEST_PENDING(irq, cm)) {

                if (GIC_GET_PRIORITY(irq, cpu) < best_prio) {

                    best_prio = GIC_GET_PRIORITY(irq, cpu);

                    best_irq = irq;

                }

            }

        }

        level = 0;

        if (best_prio <= s->priority_mask[cpu]) {

            s->current_pending[cpu] = best_irq;

            if (best_prio < s->running_priority[cpu]) {

                DPRINTF("Raised pending IRQ %d\n", best_irq);

                level = 1;

            }

        }

        qemu_set_irq(s->parent_irq[cpu], level);

    }

}


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

 {

+    qht_debug_assert(!(to == from && i == j));

+    qht_debug_assert(to->pointers[i]);

     qht_debug_assert(from->pointers[j]);

qht_entry_move(struct qht_bucket *to, int i, struct qht_bucket *from, int j)

{

    qht_debug_assert(!(to == from && i == j));

    qht_debug_assert(to->pointers[i]);

    qht_debug_assert(from->pointers[j]);

    to->hashes[i] = from->hashes[j];

    atomic_set(&to->pointers[i], from->pointers[j]);

    from->hashes[j] = 0;

    atomic_set(&from->pointers[j], NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void pack_yuv(TiffEncoderContext * s, uint8_t * dst, int lnum)
+
+{
+
+    AVFrame *p = &s->picture;

     int i, j, k;

static void pack_yuv(TiffEncoderContext * s, uint8_t * dst, int lnum)

{

    AVFrame *p = &s->picture;

    int i, j, k;

    int w = (s->width - 1) / s->subsampling[0] + 1;

    uint8_t *pu = &p->data[1][lnum / s->subsampling[1] * p->linesize[1]];

    uint8_t *pv = &p->data[2][lnum / s->subsampling[1] * p->linesize[2]];

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

        for (j = 0; j < s->subsampling[1]; j++)

            for (k = 0; k < s->subsampling[0]; k++)

                *dst++ = p->data[0][(lnum + j) * p->linesize[0] +

                                    i * s->subsampling[0] + k];

        *dst++ = *pu++;

        *dst++ = *pv++;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 int bdrv_dirty_bitmap_get_meta(BlockDriverState *bs,
+
+                               BdrvDirtyBitmap *bitmap, int64_t sector,
+
+                               int nb_sectors)
+
 {

     uint64_t i;

int bdrv_dirty_bitmap_get_meta(BlockDriverState *bs,

                               BdrvDirtyBitmap *bitmap, int64_t sector,

                               int nb_sectors)

{

    uint64_t i;

    int sectors_per_bit = 1 << hbitmap_granularity(bitmap->meta);

    /* To optimize: we can make hbitmap to internally check the range in a

     * coarse level, or at least do it word by word. */

    for (i = sector; i < sector + nb_sectors; i += sectors_per_bit) {

        if (hbitmap_get(bitmap->meta, i)) {

            return true;

        }

    }

    return false;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
         return cpu_inb(addr);

     case 2:
+
+        return cpu_inw(addr);
+
+    case 4:
+
         return cpu_inl(addr);

     }

static uint64_t bw_io_read(void *opaque, target_phys_addr_t addr, unsigned size)

{

    switch (size) {

    case 1:

        return cpu_inb(addr);

    case 2:

        return cpu_inw(addr);

    case 4:

        return cpu_inl(addr);

    }

    abort();

}


PPC_OP(mulhwu)

{

    T0 = ((uint64_t)T0 * (uint64_t)T1) >> 32;

    RETURN();

}


--- a/source.c
+++ b/source.c
@@ -39,9 +39,9 @@
     }

     seek_data = g_new0(GuestFileSeek, 1);
+
+    seek_data->position = new_pos.QuadPart;
+
+    return seek_data;
+
 }

GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset,

                                   int64_t whence, Error **errp)

{

    GuestFileHandle *gfh;

    GuestFileSeek *seek_data;

    HANDLE fh;

    LARGE_INTEGER new_pos, off_pos;

    off_pos.QuadPart = offset;

    BOOL res;

    gfh = guest_file_handle_find(handle, errp);

    if (!gfh) {

        return NULL;

    }

    fh = gfh->fh;

    res = SetFilePointerEx(fh, off_pos, &new_pos, whence);

    if (!res) {

        error_setg_win32(errp, GetLastError(), "failed to seek file");

        return NULL;

    }

    seek_data = g_new0(GuestFileSeek, 1);

    seek_data->position = new_pos.QuadPart;

    return seek_data;

}


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

     int iomemtype;
+
     struct pxa2xx_fir_s *s = (struct pxa2xx_fir_s *)

             qemu_mallocz(sizeof(struct pxa2xx_fir_s));

static struct pxa2xx_fir_s *pxa2xx_fir_init(target_phys_addr_t base,

                qemu_irq irq, struct pxa2xx_dma_state_s *dma,

                CharDriverState *chr)

{

    int iomemtype;

    struct pxa2xx_fir_s *s = (struct pxa2xx_fir_s *)

            qemu_mallocz(sizeof(struct pxa2xx_fir_s));

    s->base = base;

    s->irq = irq;

    s->dma = dma;

    s->chr = chr;

    pxa2xx_fir_reset(s);

    iomemtype = cpu_register_io_memory(0, pxa2xx_fir_readfn,

                    pxa2xx_fir_writefn, s);

    cpu_register_physical_memory(s->base, 0xfff, iomemtype);

    if (chr)

        qemu_chr_add_handlers(chr, pxa2xx_fir_is_empty,

                        pxa2xx_fir_rx, pxa2xx_fir_event, s);

    register_savevm("pxa2xx_fir", 0, 0, pxa2xx_fir_save, pxa2xx_fir_load, s);

    return s;

}


static void hash32_bat_size(CPUPPCState *env, target_ulong *blp, int *validp,

                            target_ulong batu, target_ulong batl)

{

    target_ulong bl;

    int valid;

    bl = (batu & BATU32_BL) << 15;

    valid = 0;

    if (((msr_pr == 0) && (batu & BATU32_VS)) ||

        ((msr_pr != 0) && (batu & BATU32_VP))) {

        valid = 1;

    }

    *blp = bl;

    *validp = valid;

}


--- a/source.c
+++ b/source.c
@@ -1,17 +1,17 @@
+int xics_alloc(XICSState *icp, int src, int irq_hint, bool lsi)

 {

     ICSState *ics = &icp->ics[src];

+    int irq;

     if (irq_hint) {

         assert(src == xics_find_source(icp, irq_hint));
+
         if (!ICS_IRQ_FREE(ics, irq_hint - ics->offset)) {

             trace_xics_alloc_failed_hint(src, irq_hint);

int xics_alloc(XICSState *icp, int src, int irq_hint, bool lsi)

{

    ICSState *ics = &icp->ics[src];

    int irq;

    if (irq_hint) {

        assert(src == xics_find_source(icp, irq_hint));

        if (!ICS_IRQ_FREE(ics, irq_hint - ics->offset)) {

            trace_xics_alloc_failed_hint(src, irq_hint);

            return -1;

        }

        irq = irq_hint;

    } else {

        irq = ics_find_free_block(ics, 1, 1);

        if (irq < 0) {

            trace_xics_alloc_failed_no_left(src);

            return -1;

        }

        irq += ics->offset;

    }

    ics_set_irq_type(ics, irq - ics->offset, lsi);

    trace_xics_alloc(src, irq);

    return irq;

}


--- a/source.c
+++ b/source.c
@@ -7,8 +7,8 @@
     AVFrame *frame = ist->sub2video.frame;

     int8_t *dst;
+
+    int     dst_linesize;

     int num_rects, i;

static void sub2video_update(InputStream *ist, AVSubtitle *sub)

{

    int w = ist->sub2video.w, h = ist->sub2video.h;

    AVFrame *frame = ist->sub2video.frame;

    int8_t *dst;

    int     dst_linesize;

    int num_rects, i;

    int64_t pts, end_pts;

    if (!frame)

        return;

    if (sub) {

        pts       = av_rescale_q(sub->pts + sub->start_display_time * 1000,

                                 AV_TIME_BASE_Q, ist->st->time_base);

        end_pts   = av_rescale_q(sub->pts + sub->end_display_time   * 1000,

                                 AV_TIME_BASE_Q, ist->st->time_base);

        num_rects = sub->num_rects;

    } else {

        pts       = ist->sub2video.end_pts;

        end_pts   = INT64_MAX;

        num_rects = 0;

    }

    if (sub2video_get_blank_frame(ist) < 0) {

        av_log(ist->dec_ctx, AV_LOG_ERROR,

               "Impossible to get a blank canvas.\n");

        return;

    }

    dst          = frame->data    [0];

    dst_linesize = frame->linesize[0];

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

        sub2video_copy_rect(dst, dst_linesize, w, h, sub->rects[i]);

    sub2video_push_ref(ist, pts);

    ist->sub2video.end_pts = end_pts;

}


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

     if (pic_irq < 16) {

+        /* The pic level is the logical OR of all the PCI irqs mapped
+
+           to it */
+
+        pic_level = 0;

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

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

{

    int i, pic_irq, pic_level;

    PIIX3State *piix3 = opaque;

    /* now we change the pic irq level according to the piix irq mappings */

    /* XXX: optimize */

    pic_irq = piix3->dev.config[0x60 + irq_num];

    if (pic_irq < 16) {

        /* The pic level is the logical OR of all the PCI irqs mapped

           to it */

        pic_level = 0;

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

            if (pic_irq == piix3->dev.config[0x60 + i]) {

                pic_level |= pci_bus_get_irq_level(piix3->dev.bus, i);

            }

        }

        qemu_set_irq(piix3->pic[pic_irq], pic_level);

    }

}


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

     visit_type_UserDefNestedList(v, (UserDefNestedList **)native, NULL, errp);
+
 }

static void visit_nested_struct_list(Visitor *v, void **native, Error **errp)

{

    visit_type_UserDefNestedList(v, (UserDefNestedList **)native, NULL, errp);

}


static void restore_native_fp_fxrstor(CPUState *env)

{

    struct fpxstate *fp = &fpx1;

    int i, j, fptag;

    fp->fpuc = env->fpuc;

    fp->fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11;

    fptag = 0;

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

        fptag |= (env->fptags[i] << i);

    fp->fptag = fptag ^ 0xff;

    j = env->fpstt;

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

        memcpy(&fp->fpregs1[i * 16], &env->fpregs[j].d, 10);

        j = (j + 1) & 7;

    }

    if (env->cpuid_features & CPUID_SSE) {

        fp->mxcsr = env->mxcsr;

        /* XXX: check if DAZ is not available */

        fp->mxcsr_mask = 0xffff;

        memcpy(fp->xmm_regs, env->xmm_regs, CPU_NB_REGS * 16);

    }

    asm volatile ("fxrstor %0" : "=m" (*fp));

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+int monitor_fdset_dup_fd_remove(int dup_fd)
+
 {

     return monitor_fdset_dup_fd_find_remove(dup_fd, true);

int monitor_fdset_dup_fd_remove(int dup_fd)

{

    return monitor_fdset_dup_fd_find_remove(dup_fd, true);

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+static void convert_matrix(int *qmat, UINT16 *qmat16, const UINT16 *quant_matrix, int qscale)
+
+{
+
+    int i;

+    if (av_fdct == jpeg_fdct_ifast) {
+
         for(i=0;i<64;i++) {

             /* 16 <= qscale * quant_matrix[i] <= 7905 */

static void convert_matrix(int *qmat, UINT16 *qmat16, const UINT16 *quant_matrix, int qscale)

{

    int i;

    if (av_fdct == jpeg_fdct_ifast) {

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

            /* 16 <= qscale * quant_matrix[i] <= 7905 */

            /* 19952         <= aanscales[i] * qscale * quant_matrix[i]           <= 249205026 */

            /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */

            /* 3444240       >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */

            qmat[block_permute_op(i)] = (int)((UINT64_C(1) << (QMAT_SHIFT + 11)) /

                            (aanscales[i] * qscale * quant_matrix[block_permute_op(i)]));

        }

    } else {

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

            /* We can safely suppose that 16 <= quant_matrix[i] <= 255

               So 16           <= qscale * quant_matrix[i]             <= 7905

               so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905

               so 32768        >= (1<<19) / (qscale * quant_matrix[i]) >= 67

            */

            qmat[i]   = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]);

            qmat16[i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[block_permute_op(i)]);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     CPUSPARCState *env;

+
+    cpu = SPARC_CPU(object_new(TYPE_SPARC_CPU));
+
+    env = &cpu->env;
+

     gen_intermediate_code_init(env);

CPUSPARCState *cpu_sparc_init(const char *cpu_model)

{

    SPARCCPU *cpu;

    CPUSPARCState *env;

    cpu = SPARC_CPU(object_new(TYPE_SPARC_CPU));

    env = &cpu->env;

    gen_intermediate_code_init(env);

    if (cpu_sparc_register(env, cpu_model) < 0) {

        object_delete(OBJECT(cpu));

        return NULL;

    }

    qemu_init_vcpu(env);

    return env;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+static int poll_frame(AVFilterLink *link)
+
+{
+
+    AVFilterContext   *s = link->src;
+
     OverlayContext *over = s->priv;

     int ret = avfilter_poll_frame(s->inputs[OVERLAY]);

static int poll_frame(AVFilterLink *link)

{

    AVFilterContext   *s = link->src;

    OverlayContext *over = s->priv;

    int ret = avfilter_poll_frame(s->inputs[OVERLAY]);

    if (ret == AVERROR_EOF)

        ret = !!over->overpicref;

    return ret && avfilter_poll_frame(s->inputs[MAIN]);

}


--- 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 @@
 static void test_visitor_in_uint(TestInputVisitorData *data,
+
                                 const void *unused)

 {
@@ -16,8 +16,8 @@

     Visitor *v;

+
+
     v = visitor_input_test_init(data, "%d", value);

static void test_visitor_in_uint(TestInputVisitorData *data,

                                const void *unused)

{

    Error *err = NULL;

    uint64_t res = 0;

    int64_t i64;

    double dbl;

    int value = 42;

    Visitor *v;

    v = visitor_input_test_init(data, "%d", value);

    visit_type_uint64(v, NULL, &res, &error_abort);

    g_assert_cmpuint(res, ==, (uint64_t)value);

    visit_type_int(v, NULL, &i64, &error_abort);

    g_assert_cmpint(i64, ==, value);

    visit_type_number(v, NULL, &dbl, &error_abort);

    g_assert_cmpfloat(dbl, ==, value);

    /* BUG: value between INT64_MIN and -1 accepted modulo 2^64 */

    v = visitor_input_test_init(data, "%d", -value);

    visit_type_uint64(v, NULL, &res, &error_abort);

    g_assert_cmpuint(res, ==, (uint64_t)-value);

    /* BUG: value between INT64_MAX+1 and UINT64_MAX rejected */

    v = visitor_input_test_init(data, "18446744073709551574");

    visit_type_uint64(v, NULL, &res, &err);

    error_free_or_abort(&err);

    visit_type_number(v, NULL, &dbl, &error_abort);

    g_assert_cmpfloat(dbl, ==, 18446744073709552000.0);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int register_insn (opc_handler_t **ppc_opcodes, opcode_t *insn)

 {
+
     if (insn->opc2 != 0xFF) {

         if (insn->opc3 != 0xFF) {

static int register_insn (opc_handler_t **ppc_opcodes, opcode_t *insn)

{

    if (insn->opc2 != 0xFF) {

        if (insn->opc3 != 0xFF) {

            if (register_dblind_insn(ppc_opcodes, insn->opc1, insn->opc2,

                                     insn->opc3, &insn->handler) < 0)

                return -1;

        } else {

            if (register_ind_insn(ppc_opcodes, insn->opc1,

                                  insn->opc2, &insn->handler) < 0)

                return -1;

        }

    } else {

        if (register_direct_insn(ppc_opcodes, insn->opc1, &insn->handler) < 0)

            return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+void qemu_fclose(QEMUFile *f)
+
+{
+
     if (f->is_writable)

         qemu_fflush(f);

void qemu_fclose(QEMUFile *f)

{

    if (f->is_writable)

        qemu_fflush(f);

    if (f->is_file) {

        fclose(f->outfile);

    }

    qemu_free(f);

}


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

         chr->chr_add_watch = mux_chr_add_watch;

+    }
+
+    /* only default to opened state if we've realized the initial
+
+     * set of muxes

      */

static CharDriverState *qemu_chr_open_mux(const char *id,

                                          ChardevBackend *backend,

                                          ChardevReturn *ret, Error **errp)

{

    ChardevMux *mux = backend->mux;

    CharDriverState *chr, *drv;

    MuxDriver *d;

    drv = qemu_chr_find(mux->chardev);

    if (drv == NULL) {

        error_setg(errp, "mux: base chardev %s not found", mux->chardev);

        return NULL;

    }

    chr = qemu_chr_alloc();

    d = g_new0(MuxDriver, 1);

    chr->opaque = d;

    d->drv = drv;

    d->focus = -1;

    chr->chr_write = mux_chr_write;

    chr->chr_update_read_handler = mux_chr_update_read_handler;

    chr->chr_accept_input = mux_chr_accept_input;

    /* Frontend guest-open / -close notification is not support with muxes */

    chr->chr_set_fe_open = NULL;

    if (drv->chr_add_watch) {

        chr->chr_add_watch = mux_chr_add_watch;

    }

    /* only default to opened state if we've realized the initial

     * set of muxes

     */

    chr->explicit_be_open = muxes_realized ? 0 : 1;

    chr->is_mux = 1;

    return chr;

}


static uint64_t lsi_ram_read(void *opaque, target_phys_addr_t addr,

                             unsigned size)

{

    LSIState *s = opaque;

    uint32_t val;

    uint32_t mask;

    val = s->script_ram[addr >> 2];

    mask = ((uint64_t)1 << (size * 8)) - 1;

    val >>= (addr & 3) * 8;

    return val & mask;

}


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

     unsigned *bsel_alloc = opaque;

+    unsigned *bus_bsel;

static void *acpi_set_bsel(PCIBus *bus, void *opaque)

{

    unsigned *bsel_alloc = opaque;

    unsigned *bus_bsel;

    if (qbus_is_hotpluggable(BUS(bus))) {

        bus_bsel = g_malloc(sizeof *bus_bsel);

        *bus_bsel = (*bsel_alloc)++;

        object_property_add_uint32_ptr(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,

                                       bus_bsel, NULL);

    }

    return bsel_alloc;

}


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

     static const LxBoardDesc lx200_board = {
+
+        .flash_base = 0xf8000000,
+
+        .flash_size = 0x01000000,

         .flash_sector_size = 0x20000,

static void xtensa_lx200_init(MachineState *machine)

{

    static const LxBoardDesc lx200_board = {

        .flash_base = 0xf8000000,

        .flash_size = 0x01000000,

        .flash_sector_size = 0x20000,

        .sram_size = 0x2000000,

    };

    lx_init(&lx200_board, machine);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static float quantize_band_cost(struct AACEncContext *s, const float *in,
+
                                 const float *scaled, int size, int scale_idx,

                                 int cb, const float lambda, const float uplim,

static float quantize_band_cost(struct AACEncContext *s, const float *in,

                                const float *scaled, int size, int scale_idx,

                                int cb, const float lambda, const float uplim,

                                int *bits, int rtz)

{

    return get_band_cost(s, NULL, in, scaled, size, scale_idx, cb, lambda, uplim, bits);

}


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

     PCNetState *d = qemu_get_nic_opaque(nc);

+
+
     pcnet_common_cleanup(d);

 }

static void lance_cleanup(NetClientState *nc)

{

    PCNetState *d = qemu_get_nic_opaque(nc);

    pcnet_common_cleanup(d);

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     cc->chr_sync_read = tcp_chr_sync_read;

     cc->chr_disconnect = tcp_chr_disconnect;
+
+    cc->get_msgfds = tcp_get_msgfds;
+
+    cc->set_msgfds = tcp_set_msgfds;
+
     cc->chr_add_client = tcp_chr_add_client;

     cc->chr_add_watch = tcp_chr_add_watch;

static void char_socket_class_init(ObjectClass *oc, void *data)

{

    ChardevClass *cc = CHARDEV_CLASS(oc);

    cc->parse = qemu_chr_parse_socket;

    cc->open = qmp_chardev_open_socket;

    cc->chr_wait_connected = tcp_chr_wait_connected;

    cc->chr_write = tcp_chr_write;

    cc->chr_sync_read = tcp_chr_sync_read;

    cc->chr_disconnect = tcp_chr_disconnect;

    cc->get_msgfds = tcp_get_msgfds;

    cc->set_msgfds = tcp_set_msgfds;

    cc->chr_add_client = tcp_chr_add_client;

    cc->chr_add_watch = tcp_chr_add_watch;

    cc->chr_update_read_handler = tcp_chr_update_read_handler;

    object_class_property_add(oc, "addr", "SocketAddressLegacy",

                              char_socket_get_addr, NULL,

                              NULL, NULL, &error_abort);

    object_class_property_add_bool(oc, "connected", char_socket_get_connected,

                                   NULL, &error_abort);

}


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

+
+    uint64_t now = qemu_clock_get_ns(rtc_clock);
+
+    if (now < s->next_periodic_time ||
+
         now > (s->next_periodic_time + get_max_clock_jump())) {

         periodic_timer_update(s, qemu_clock_get_ns(rtc_clock));

static int rtc_post_load(void *opaque, int version_id)

{

    RTCState *s = opaque;

    if (version_id <= 2 || rtc_clock == QEMU_CLOCK_REALTIME) {

        rtc_set_time(s);

        s->offset = 0;

        check_update_timer(s);

    }

    uint64_t now = qemu_clock_get_ns(rtc_clock);

    if (now < s->next_periodic_time ||

        now > (s->next_periodic_time + get_max_clock_jump())) {

        periodic_timer_update(s, qemu_clock_get_ns(rtc_clock));

    }

#ifdef TARGET_I386

    if (version_id >= 2) {

        if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) {

            rtc_coalesced_timer_update(s);

        }

    }

#endif

    return 0;

}


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

+    v = opts_visitor_new(opts);

test_opts_range_unvisited(void)

{

    intList *list = NULL;

    intList *tail;

    QemuOpts *opts;

    Visitor *v;

    opts = qemu_opts_parse(qemu_find_opts("userdef"), "ilist=0-2", false,

                           &error_abort);

    v = opts_visitor_new(opts);

    visit_start_struct(v, NULL, NULL, 0, &error_abort);

    /* Would be simpler if the visitor genuinely supported virtual walks */

    visit_start_list(v, "ilist", (GenericList **)&list, sizeof(*list),

                     &error_abort);

    tail = list;

    visit_type_int(v, NULL, &tail->value, &error_abort);

    g_assert_cmpint(tail->value, ==, 0);

    tail = (intList *)visit_next_list(v, (GenericList *)tail, sizeof(*list));

    g_assert(tail);

    visit_type_int(v, NULL, &tail->value, &error_abort);

    g_assert_cmpint(tail->value, ==, 1);

    tail = (intList *)visit_next_list(v, (GenericList *)tail, sizeof(*list));

    g_assert(tail);

    visit_check_list(v, &error_abort); /* BUG: unvisited tail not reported */

    visit_end_list(v, (void **)&list);

    visit_check_struct(v, &error_abort);

    visit_end_struct(v, NULL);

    qapi_free_intList(list);

    visit_free(v);

    qemu_opts_del(opts);

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 static void close_decoder(QSVContext *q)

 {
+
+    QSVFrame *cur;
+
+
+
+    if (q->session)

         MFXVideoDECODE_Close(q->session);

static void close_decoder(QSVContext *q)

{

    QSVFrame *cur;

    if (q->session)

        MFXVideoDECODE_Close(q->session);

    while (q->async_fifo && av_fifo_size(q->async_fifo)) {

        QSVFrame *out_frame;

        mfxSyncPoint *sync;

        av_fifo_generic_read(q->async_fifo, &out_frame, sizeof(out_frame), NULL);

        av_fifo_generic_read(q->async_fifo, &sync,      sizeof(sync),      NULL);

        av_freep(&sync);

    }

    cur = q->work_frames;

    while (cur) {

        q->work_frames = cur->next;

        av_frame_free(&cur->frame);

        av_freep(&cur);

        cur = q->work_frames;

    }

    q->engine_ready   = 0;

    q->reinit_pending = 0;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
                 "results.\nAdd '-strict experimental' if you want to use it.\n",

                 codec_string, c->codec->name);
+
+        codec = encoder ? avcodec_find_encoder(c->codec->id) : avcodec_find_decoder(c->codec->id);
+
+        if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
+
             av_log(NULL, AV_LOG_FATAL, "Or use the non experimental %s '%s'.\n",

                    codec_string, codec->name);

static void assert_codec_experimental(AVCodecContext *c, int encoder)

{

    const char *codec_string = encoder ? "encoder" : "decoder";

    AVCodec *codec;

    if (c->codec->capabilities & CODEC_CAP_EXPERIMENTAL &&

        c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {

        av_log(NULL, AV_LOG_FATAL, "%s '%s' is experimental and might produce bad "

                "results.\nAdd '-strict experimental' if you want to use it.\n",

                codec_string, c->codec->name);

        codec = encoder ? avcodec_find_encoder(c->codec->id) : avcodec_find_decoder(c->codec->id);

        if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))

            av_log(NULL, AV_LOG_FATAL, "Or use the non experimental %s '%s'.\n",

                   codec_string, codec->name);

        exit(1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int32_t read_s32(uint8_t *data, size_t offset)

+{
+
     return (int32_t)((data[offset] << 24) | (data[offset + 1] << 16) |

 		     (data[offset + 2] << 8) | data[offset + 3]);

static int32_t read_s32(uint8_t *data, size_t offset)

{

    return (int32_t)((data[offset] << 24) | (data[offset + 1] << 16) |

		     (data[offset + 2] << 8) | data[offset + 3]);

}


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

     if (vnc_state == NULL)

void do_info_vnc(void)

{

    if (vnc_state == NULL)

	term_printf("VNC server disabled\n");

    else {

	term_printf("VNC server active on: ");

	term_print_filename(vnc_state->display);

	term_printf("\n");

	if (vnc_state->csock == -1)

	    term_printf("No client connected\n");

	else

	    term_printf("Client connected\n");

    }

}


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

     block_acct_start(bdrv_get_stats(s->bs), &s->acct, s->packet_transfer_size,

+                     BLOCK_ACCT_READ);
+
+
+
+    /* XXX: check if BUSY_STAT should be set */

     s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;

static void ide_atapi_cmd_read_dma(IDEState *s, int lba, int nb_sectors,

                                   int sector_size)

{

    s->lba = lba;

    s->packet_transfer_size = nb_sectors * sector_size;

    s->io_buffer_index = 0;

    s->io_buffer_size = 0;

    s->cd_sector_size = sector_size;

    block_acct_start(bdrv_get_stats(s->bs), &s->acct, s->packet_transfer_size,

                     BLOCK_ACCT_READ);

    /* XXX: check if BUSY_STAT should be set */

    s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;

    ide_start_dma(s, ide_atapi_cmd_read_dma_cb);

}


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

     AVDictionaryEntry *t = NULL;

+    uint8_t *data = NULL;
+
     *size = 0;

+

     if (!dict)

uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)

{

    AVDictionaryEntry *t = NULL;

    uint8_t *data = NULL;

    *size = 0;

    if (!dict)

        return NULL;

    while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX))) {

        const int keylen = strlen(t->key);

        const int valuelen = strlen(t->value);

        const size_t new_size = *size + keylen + 1 + valuelen + 1;

        uint8_t *const new_data = av_realloc(data, new_size);

        if (!new_data)

            goto fail;

        data = new_data;

        memcpy(data + *size, t->key, keylen + 1);

        memcpy(data + *size + keylen + 1, t->value, valuelen + 1);

        *size = new_size;

    }

    return data;

fail:

    av_freep(&data);

    *size = 0;

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int mp3_read_probe(AVProbeData *p)
+
 {

     int max_frames, first_frames;

static int mp3_read_probe(AVProbeData *p)

{

    int max_frames, first_frames;

    int fsize, frames, sample_rate;

    uint32_t header;

    uint8_t *buf, *buf2, *end;

    AVCodecContext avctx;

    if(id3v2_match(p->buf))

        return AVPROBE_SCORE_MAX/2+1; // this must be less than mpeg-ps because some retards put id3v2 tags before mpeg-ps files

    max_frames = 0;

    buf = p->buf;

    end = buf + FFMIN(4096, p->buf_size - sizeof(uint32_t));

    for(; buf < end; buf++) {

        buf2 = buf;

        for(frames = 0; buf2 < end; frames++) {

            header = AV_RB32(buf2);

            fsize = ff_mpa_decode_header(&avctx, header, &sample_rate);

            if(fsize < 0)

                break;

            buf2 += fsize;

        }

        max_frames = FFMAX(max_frames, frames);

        if(buf == p->buf)

            first_frames= frames;

    }

    if   (first_frames>=3) return AVPROBE_SCORE_MAX/2+1;

    else if(max_frames>=3) return AVPROBE_SCORE_MAX/4;

    else if(max_frames>=1) return 1;

    else                   return 0;

}


--- a/source.c
+++ b/source.c
@@ -18,11 +18,11 @@
         ch_data->bs_var_bord[1] = get_bits(gb, 2);
         ch_data->bs_num_rel[1]  = get_bits(gb, 2);
         ch_data->bs_num_env[1]  = ch_data->bs_num_rel[1] + 1;
+        for (i = 0; i < ch_data->bs_num_rel[1]; i++)
+            ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2;
+        ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);
+        for (i = 0; i < ch_data->bs_num_env[1]; i++)
+            ch_data->bs_freq_res[ch_data->bs_num_env[1] - i] = get_bits1(gb);
         break;
     case VARFIX:
         ch_data->bs_var_bord[0] = get_bits(gb, 2);

static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
                         GetBitContext *gb, SBRData *ch_data)
{
    int i;
    ch_data->bs_freq_res[0] = ch_data->bs_freq_res[ch_data->bs_num_env[1]];
    ch_data->bs_num_env[0] = ch_data->bs_num_env[1];
    ch_data->bs_amp_res = sbr->bs_amp_res_header;
    switch (ch_data->bs_frame_class = get_bits(gb, 2)) {
    case FIXFIX:
        ch_data->bs_num_env[1] = 1 << get_bits(gb, 2);
        if (ch_data->bs_num_env[1] == 1)
            ch_data->bs_amp_res = 0;
        ch_data->bs_freq_res[1] = get_bits1(gb);
        for (i = 1; i < ch_data->bs_num_env[1]; i++)
            ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1];
        break;
    case FIXVAR:
        ch_data->bs_var_bord[1] = get_bits(gb, 2);
        ch_data->bs_num_rel[1]  = get_bits(gb, 2);
        ch_data->bs_num_env[1]  = ch_data->bs_num_rel[1] + 1;
        for (i = 0; i < ch_data->bs_num_rel[1]; i++)
            ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2;
        ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);
        for (i = 0; i < ch_data->bs_num_env[1]; i++)
            ch_data->bs_freq_res[ch_data->bs_num_env[1] - i] = get_bits1(gb);
        break;
    case VARFIX:
        ch_data->bs_var_bord[0] = get_bits(gb, 2);
        ch_data->bs_num_rel[0]  = get_bits(gb, 2);
        ch_data->bs_num_env[1]  = ch_data->bs_num_rel[0] + 1;
        for (i = 0; i < ch_data->bs_num_rel[0]; i++)
            ch_data->bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2;
        ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);
        get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]);
        break;
    case VARVAR:
        ch_data->bs_var_bord[0] = get_bits(gb, 2);
        ch_data->bs_var_bord[1] = get_bits(gb, 2);
        ch_data->bs_num_rel[0]  = get_bits(gb, 2);
        ch_data->bs_num_rel[1]  = get_bits(gb, 2);
        ch_data->bs_num_env[1]  = ch_data->bs_num_rel[0] + ch_data->bs_num_rel[1] + 1;
        for (i = 0; i < ch_data->bs_num_rel[0]; i++)
            ch_data->bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2;
        for (i = 0; i < ch_data->bs_num_rel[1]; i++)
            ch_data->bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2;
        ch_data->bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);
        get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]);
        break;
    }
    if (ch_data->bs_pointer > ch_data->bs_num_env[1] + 1) {
        av_log(ac->avccontext, AV_LOG_ERROR,
               "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n",
               ch_data->bs_pointer);
        return -1;
    }
    if (ch_data->bs_frame_class == FIXFIX && ch_data->bs_num_env[1] > 4) {
        av_log(ac->avccontext, AV_LOG_ERROR,
               "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
               ch_data->bs_num_env[1]);
        return -1;
    }
    if (ch_data->bs_frame_class == VARVAR && ch_data->bs_num_env[1] > 5) {
        av_log(ac->avccontext, AV_LOG_ERROR,
               "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n",
               ch_data->bs_num_env[1]);
        return -1;
    }
    ch_data->bs_num_noise = (ch_data->bs_num_env[1] > 1) + 1;
    return 0;
}


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

 {
+
+    CharDriverState *chr;
+
+
+
     chr = qemu_chr_alloc();

     chr->chr_write = msmouse_chr_write;

static CharDriverState *qemu_chr_open_msmouse(const char *id,

                                              ChardevBackend *backend,

                                              ChardevReturn *ret,

                                              Error **errp)

{

    CharDriverState *chr;

    chr = qemu_chr_alloc();

    chr->chr_write = msmouse_chr_write;

    chr->chr_close = msmouse_chr_close;

    chr->explicit_be_open = true;

    qemu_add_mouse_event_handler(msmouse_event, chr, 0, "QEMU Microsoft Mouse");

    return chr;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static always_inline void gen_op_subfo_64 (void)
+
 {
+
     gen_op_move_T2_T0();

     gen_op_subf();

static always_inline void gen_op_subfo_64 (void)

{

    gen_op_move_T2_T0();

    gen_op_subf();

    gen_op_check_subfo_64();

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
     int ret = 0;

     switch (frame->format) {
+
         case AV_PIX_FMT_YUV420P:

             ret = SDL_UpdateYUVTexture(tex, NULL, frame->data[0], frame->linesize[0],

static int upload_texture(SDL_Texture *tex, AVFrame *frame, struct SwsContext **img_convert_ctx) {

    int ret = 0;

    switch (frame->format) {

        case AV_PIX_FMT_YUV420P:

            ret = SDL_UpdateYUVTexture(tex, NULL, frame->data[0], frame->linesize[0],

                                                  frame->data[1], frame->linesize[1],

                                                  frame->data[2], frame->linesize[2]);

            break;

        case AV_PIX_FMT_BGRA:

            ret = SDL_UpdateTexture(tex, NULL, frame->data[0], frame->linesize[0]);

            break;

        default:

            /* This should only happen if we are not using avfilter... */

            *img_convert_ctx = sws_getCachedContext(*img_convert_ctx,

                frame->width, frame->height, frame->format, frame->width, frame->height,

                AV_PIX_FMT_BGRA, sws_flags, NULL, NULL, NULL);

            if (*img_convert_ctx != NULL) {

                uint8_t *pixels;

                int pitch;

                if (!SDL_LockTexture(tex, NULL, (void **)&pixels, &pitch)) {

                    sws_scale(*img_convert_ctx, (const uint8_t * const *)frame->data, frame->linesize,

                              0, frame->height, &pixels, &pitch);

                    SDL_UnlockTexture(tex);

                }

            } else {

                av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n");

                ret = -1;

            }

            break;

    }

    return ret;

}


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

 {

+    Coroutine *caller = (Coroutine *)opaque;

static void coroutine_fn verify_entered_step_2(void *opaque)

{

    Coroutine *caller = (Coroutine *)opaque;

    g_assert(qemu_coroutine_entered(caller));

    g_assert(qemu_coroutine_entered(qemu_coroutine_self()));

    qemu_coroutine_yield();

    /* Once more to check it still works after yielding */

    g_assert(qemu_coroutine_entered(caller));

    g_assert(qemu_coroutine_entered(qemu_coroutine_self()));

    qemu_coroutine_yield();

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void omap_mpui_init(MemoryRegion *memory, target_phys_addr_t base,
+
+                struct omap_mpu_state_s *mpu)
+
 {

     memory_region_init_io(&mpu->mpui_iomem, &omap_mpui_ops, mpu,

static void omap_mpui_init(MemoryRegion *memory, target_phys_addr_t base,

                struct omap_mpu_state_s *mpu)

{

    memory_region_init_io(&mpu->mpui_iomem, &omap_mpui_ops, mpu,

                          "omap-mpui", 0x100);

    memory_region_add_subregion(memory, base, &mpu->mpui_iomem);

    omap_mpui_reset(mpu);

}


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

                                               Error **errp)

+{
+
+    return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE));

 }

static CharDriverState *qemu_chr_open_win_con(const char *id,

                                              ChardevBackend *backend,

                                              ChardevReturn *ret,

                                              Error **errp)

{

    return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE));

}


--- a/source.c
+++ b/source.c
@@ -8,7 +8,7 @@
     assert(ts->temp_allocated != 0);
     ts->temp_allocated = 0;
     k = ts->base_type;
+    if (ts->temp_local)
+        k += TCG_TYPE_COUNT;
+    ts->next_free_temp = s->first_free_temp[k];
     s->first_free_temp[k] = idx;

static inline void tcg_temp_free_internal(int idx)
{
    TCGContext *s = &tcg_ctx;
    TCGTemp *ts;
    int k;
    assert(idx >= s->nb_globals && idx < s->nb_temps);
    ts = &s->temps[idx];
    assert(ts->temp_allocated != 0);
    ts->temp_allocated = 0;
    k = ts->base_type;
    if (ts->temp_local)
        k += TCG_TYPE_COUNT;
    ts->next_free_temp = s->first_free_temp[k];
    s->first_free_temp[k] = idx;


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

     if (phb) {

+        pdev = find_dev(spapr, buid, config_addr);
+
+    }
+
+    if (!phb || !pdev) {

         rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);

static void rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu,

                                                   sPAPREnvironment *spapr,

                                                   uint32_t token,

                                                   uint32_t nargs,

                                                   target_ulong args,

                                                   uint32_t nret,

                                                   target_ulong rets)

{

    uint32_t config_addr = rtas_ld(args, 0);

    uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);

    unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3);

    sPAPRPHBState *phb = NULL;

    PCIDevice *pdev = NULL;

    spapr_pci_msi *msi;

    /* Find sPAPRPHBState */

    phb = find_phb(spapr, buid);

    if (phb) {

        pdev = find_dev(spapr, buid, config_addr);

    }

    if (!phb || !pdev) {

        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);

        return;

    }

    /* Find device descriptor and start IRQ */

    msi = (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr);

    if (!msi || !msi->first_irq || !msi->num || (ioa_intr_num >= msi->num)) {

        trace_spapr_pci_msi("Failed to return vector", config_addr);

        rtas_st(rets, 0, RTAS_OUT_HW_ERROR);

        return;

    }

    intr_src_num = msi->first_irq + ioa_intr_num;

    trace_spapr_pci_rtas_ibm_query_interrupt_source_number(ioa_intr_num,

                                                           intr_src_num);

    rtas_st(rets, 0, RTAS_OUT_SUCCESS);

    rtas_st(rets, 1, intr_src_num);

    rtas_st(rets, 2, 1);/* 0 == level; 1 == edge */

}


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

     FlatRange *fr;

+

     if (listener->address_space_filter

static void listener_add_address_space(MemoryListener *listener,

                                       AddressSpace *as)

{

    FlatRange *fr;

    if (listener->address_space_filter

        && listener->address_space_filter != as->root) {

        return;

    }

    if (global_dirty_log) {

        listener->log_global_start(listener);

    }

    FOR_EACH_FLAT_RANGE(fr, &as->current_map) {

        MemoryRegionSection section = {

            .mr = fr->mr,

            .address_space = as->root,

            .offset_within_region = fr->offset_in_region,

            .size = int128_get64(fr->addr.size),

            .offset_within_address_space = int128_get64(fr->addr.start),

            .readonly = fr->readonly,

        };

        listener->region_add(listener, &section);

    }

}


--- a/source.c
+++ b/source.c
@@ -33,9 +33,9 @@
     for (i = 0; i < size; i++)

         snprintf(&os->private_str[2*i], 3, "%02x", ptr[i]);
+
+    if (ptr != codec->extradata)
+
+        av_free(ptr);
+
 }

static void get_private_data(OutputStream *os)

{

    AVCodecContext *codec = os->ctx->streams[0]->codec;

    uint8_t *ptr = codec->extradata;

    int size = codec->extradata_size;

    int i;

    if (codec->codec_id == AV_CODEC_ID_H264) {

        ff_avc_write_annexb_extradata(ptr, &ptr, &size);

        if (!ptr)

            ptr = codec->extradata;

    }

    if (!ptr)

        return;

    os->private_str = av_mallocz(2*size + 1);

    if (!os->private_str)

        return;

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

        snprintf(&os->private_str[2*i], 3, "%02x", ptr[i]);

    if (ptr != codec->extradata)

        av_free(ptr);

}


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

         CLOSE_READER(re, s)

+    }
+
+#ifdef A32_BITSTREAM_READER
+
+    s->cache1 = 0;

 #endif

void init_get_bits(GetBitContext *s,

                   UINT8 *buffer, int buffer_size)

{

    s->buffer= buffer;

    s->size= buffer_size;

    s->buffer_end= buffer + buffer_size;

#ifdef ALT_BITSTREAM_READER

    s->index=0;

#elif defined LIBMPEG2_BITSTREAM_READER

    s->buffer_ptr = buffer;

    s->bit_count = 16;

    s->cache = 0;

#elif defined A32_BITSTREAM_READER

    s->buffer_ptr = (uint32_t*)buffer;

    s->bit_count = 32;

    s->cache0 = 0;

    s->cache1 = 0;

#endif

    {

        OPEN_READER(re, s)

        UPDATE_CACHE(re, s)

//        UPDATE_CACHE(re, s)

        CLOSE_READER(re, s)

    }

#ifdef A32_BITSTREAM_READER

    s->cache1 = 0;

#endif

}


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

     } else {

+        /* jump to another page: currently not optimized */
+
+        gen_jmp_im(eip);
+
+        gen_eob(s);

     }

static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)

{

    target_ulong pc = s->cs_base + eip;

    if (use_goto_tb(s, pc))  {

        /* jump to same page: we can use a direct jump */

        tcg_gen_goto_tb(tb_num);

        gen_jmp_im(eip);

        tcg_gen_exit_tb((uintptr_t)s->tb + tb_num);

    } else {

        /* jump to another page: currently not optimized */

        gen_jmp_im(eip);

        gen_eob(s);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static uint32_t get_level1_table_address(CPUARMState *env, uint32_t address)
+
+{
+
+    uint32_t table;
+

     if (address & env->cp15.c2_mask)

static uint32_t get_level1_table_address(CPUARMState *env, uint32_t address)

{

    uint32_t table;

    if (address & env->cp15.c2_mask)

        table = env->cp15.ttbr1_el1 & 0xffffc000;

    else

        table = env->cp15.ttbr0_el1 & env->cp15.c2_base_mask;

    table |= (address >> 18) & 0x3ffc;

    return table;

}


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

     int cpu_index = qdict_get_int(qdict, "cpu_index");

+    int bank = qdict_get_int(qdict, "bank");

+    uint64_t status = qdict_get_int(qdict, "status");

     uint64_t mcg_status = qdict_get_int(qdict, "mcg_status");

static void do_inject_mce(Monitor *mon, const QDict *qdict)

{

    CPUState *cenv;

    int cpu_index = qdict_get_int(qdict, "cpu_index");

    int bank = qdict_get_int(qdict, "bank");

    uint64_t status = qdict_get_int(qdict, "status");

    uint64_t mcg_status = qdict_get_int(qdict, "mcg_status");

    uint64_t addr = qdict_get_int(qdict, "addr");

    uint64_t misc = qdict_get_int(qdict, "misc");

    for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu)

        if (cenv->cpu_index == cpu_index && cenv->mcg_cap) {

            cpu_inject_x86_mce(cenv, bank, status, mcg_status, addr, misc);

            break;

        }

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     if (!alt_grab) {

         mod_state = (ev->key.keysym.mod & gui_grab_code);
+
+    } else {
+
+        mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT));
+
     }

     if (!mod_state && gui_key_modifier_pressed) {

static void handle_keyup(DisplayState *ds, SDL_Event *ev)

{

    int mod_state;

    if (!alt_grab) {

        mod_state = (ev->key.keysym.mod & gui_grab_code);

    } else {

        mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT));

    }

    if (!mod_state && gui_key_modifier_pressed) {

        gui_key_modifier_pressed = 0;

        if (gui_keysym == 0) {

            /* exit/enter grab if pressing Ctrl-Alt */

            if (!gui_grab) {

                /* If the application is not active, do not try to enter grab

                 * state. It prevents 'SDL_WM_GrabInput(SDL_GRAB_ON)' from

                 * blocking all the application (SDL bug). */

                if (is_graphic_console() &&

                    SDL_GetAppState() & SDL_APPACTIVE) {

                    sdl_grab_start();

                }

            } else if (!gui_fullscreen) {

                sdl_grab_end();

            }

            /* SDL does not send back all the modifiers key, so we must

             * correct it. */

            reset_keys();

            return;

        }

        gui_keysym = 0;

    }

    if (is_graphic_console() && !gui_keysym) {

        sdl_process_key(&ev->key);

    }

}


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

     qs = qstring_from_substr("virtualization", 3, 9);

+    fail_unless(qs != NULL);
+
+    fail_unless(strcmp(qstring_get_str(qs), "tualiza") == 0);
+

     QDECREF(qs);

START_TEST(qstring_from_substr_test)

{

    QString *qs;

    qs = qstring_from_substr("virtualization", 3, 9);

    fail_unless(qs != NULL);

    fail_unless(strcmp(qstring_get_str(qs), "tualiza") == 0);

    QDECREF(qs);

}


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

 {
+
+    Coroutine *co = opaque;

     qemu_coroutine_enter(co, NULL);

static void coroutine_enter_cb(void *opaque, int ret)

{

    Coroutine *co = opaque;

    qemu_coroutine_enter(co, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int pci_apb_map_irq(PCIDevice *pci_dev, int irq_num)

 {
+
     return ((pci_dev->devfn & 0x18) >> 1) + irq_num;

 }

static int pci_apb_map_irq(PCIDevice *pci_dev, int irq_num)

{

    return ((pci_dev->devfn & 0x18) >> 1) + irq_num;

}


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

 {

+#if HAVE_THREADS

     if (*mq) {

void av_thread_message_queue_free(AVThreadMessageQueue **mq)

{

#if HAVE_THREADS

    if (*mq) {

        av_thread_message_flush(*mq);

        av_fifo_freep(&(*mq)->fifo);

        pthread_cond_destroy(&(*mq)->cond);

        pthread_mutex_destroy(&(*mq)->lock);

        av_freep(mq);

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void kvmppc_pivot_hpt_cpu(CPUState *cs, run_on_cpu_data arg)
+
+{
+
+    target_ulong sdr1 = arg.target_ptr;
+
     PowerPCCPU *cpu = POWERPC_CPU(cs);

     CPUPPCState *env = &cpu->env;

static void kvmppc_pivot_hpt_cpu(CPUState *cs, run_on_cpu_data arg)

{

    target_ulong sdr1 = arg.target_ptr;

    PowerPCCPU *cpu = POWERPC_CPU(cs);

    CPUPPCState *env = &cpu->env;

    /* This is just for the benefit of PR KVM */

    cpu_synchronize_state(cs);

    env->spr[SPR_SDR1] = sdr1;

    if (kvmppc_put_books_sregs(cpu) < 0) {

        error_report("Unable to update SDR1 in KVM");

        exit(1);

    }

}


--- a/source.c
+++ b/source.c
@@ -2,11 +2,11 @@
 {
     int mod_state, win;
     struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
+    if (alt_grab) {
+        mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) ==
+            (gui_grab_code | KMOD_LSHIFT);
+    } else if (ctrl_grab) {
+        mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL;
     } else {
         mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
     gui_key_modifier_pressed = mod_state;

static void handle_keydown(SDL_Event *ev)
{
    int mod_state, win;
    struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
    if (alt_grab) {
        mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) ==
            (gui_grab_code | KMOD_LSHIFT);
    } else if (ctrl_grab) {
        mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL;
    } else {
        mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
    gui_key_modifier_pressed = mod_state;
    if (gui_key_modifier_pressed) {
        switch (ev->key.keysym.scancode) {
        case SDL_SCANCODE_2:
        case SDL_SCANCODE_3:
        case SDL_SCANCODE_4:
        case SDL_SCANCODE_5:
        case SDL_SCANCODE_6:
        case SDL_SCANCODE_7:
        case SDL_SCANCODE_8:
        case SDL_SCANCODE_9:
            win = ev->key.keysym.scancode - SDL_SCANCODE_1;
            if (win < sdl2_num_outputs) {
                sdl2_console[win].hidden = !sdl2_console[win].hidden;
                if (sdl2_console[win].real_window) {
                    if (sdl2_console[win].hidden) {
                        SDL_HideWindow(sdl2_console[win].real_window);
                    } else {
                        SDL_ShowWindow(sdl2_console[win].real_window);
                gui_keysym = 1;
            break;
        case SDL_SCANCODE_F:
            toggle_full_screen(scon);
            gui_keysym = 1;
            break;
        case SDL_SCANCODE_U:
            sdl2_window_destroy(scon);
            sdl2_window_create(scon);
            if (!scon->opengl) {
                /* re-create scon->texture */
                sdl2_2d_switch(&scon->dcl, scon->surface);
            gui_keysym = 1;
            break;
#if 0
        case SDL_SCANCODE_KP_PLUS:
        case SDL_SCANCODE_KP_MINUS:
            if (!gui_fullscreen) {
                int scr_w, scr_h;
                int width, height;
                SDL_GetWindowSize(scon->real_window, &scr_w, &scr_h);
                width = MAX(scr_w + (ev->key.keysym.scancode ==
                                     SDL_SCANCODE_KP_PLUS ? 50 : -50),
                            160);
                height = (surface_height(scon->surface) * width) /
                    surface_width(scon->surface);
                fprintf(stderr, "%s: scale to %dx%d\n",
                        __func__, width, height);
                sdl_scale(scon, width, height);
                sdl2_redraw(scon);
                gui_keysym = 1;
#endif
        default:
            break;
    if (!gui_keysym) {
        sdl2_process_key(scon, &ev->key);


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

     av_fifo_generic_read(aic->fifo, pkt->data, size, NULL);

+
+
+    pkt->dts = pkt->pts = aic->dts;
+
+    pkt->duration = av_rescale_q(*aic->samples, st->time_base, aic->time_base);

     pkt->stream_index = stream_index;

static int ff_interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt,

                                   int stream_index, int flush)

{

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

    AudioInterleaveContext *aic = st->priv_data;

    int size = FFMIN(av_fifo_size(aic->fifo), *aic->samples * aic->sample_size);

    if (!size || (!flush && size == av_fifo_size(aic->fifo)))

        return 0;

    av_new_packet(pkt, size);

    av_fifo_generic_read(aic->fifo, pkt->data, size, NULL);

    pkt->dts = pkt->pts = aic->dts;

    pkt->duration = av_rescale_q(*aic->samples, st->time_base, aic->time_base);

    pkt->stream_index = stream_index;

    aic->dts += pkt->duration;

    aic->samples++;

    if (!*aic->samples)

        aic->samples = aic->samples_per_frame;

    return size;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void kvm_cpu_synchronize_state(CPUState *env)

 {
+
+    if (!env->kvm_vcpu_dirty)

         run_on_cpu(env, do_kvm_cpu_synchronize_state, env);

void kvm_cpu_synchronize_state(CPUState *env)

{

    if (!env->kvm_vcpu_dirty)

        run_on_cpu(env, do_kvm_cpu_synchronize_state, env);

}


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

     if (qemu_in_coroutine()) {
+
         return bdrv_co_rw_vmstate(bs, qiov, pos, is_read);

     } else {

bdrv_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos,

                bool is_read)

{

    if (qemu_in_coroutine()) {

        return bdrv_co_rw_vmstate(bs, qiov, pos, is_read);

    } else {

        BdrvVmstateCo data = {

            .bs         = bs,

            .qiov       = qiov,

            .pos        = pos,

            .is_read    = is_read,

            .ret        = -EINPROGRESS,

        };

        Coroutine *co = qemu_coroutine_create(bdrv_co_rw_vmstate_entry, &data);

        qemu_coroutine_enter(co);

        while (data.ret == -EINPROGRESS) {

            aio_poll(bdrv_get_aio_context(bs), true);

        }

        return data.ret;

    }

}


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

     target_phys_addr_t addr;

+    uint16_t section_index = phys_section_add(section);
+
+
+
+    assert(size);

static void register_multipage(MemoryRegionSection *section)

{

    target_phys_addr_t start_addr = section->offset_within_address_space;

    ram_addr_t size = section->size;

    target_phys_addr_t addr;

    uint16_t section_index = phys_section_add(section);

    assert(size);

    addr = start_addr;

    phys_page_set(addr >> TARGET_PAGE_BITS, size >> TARGET_PAGE_BITS,

                  section_index);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int qio_channel_command_close(QIOChannel *ioc,

                                      Error **errp)
+
 {

+    QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc);

     int rv = 0;

static int qio_channel_command_close(QIOChannel *ioc,

                                     Error **errp)

{

    QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc);

    int rv = 0;

    /* We close FDs before killing, because that

     * gives a better chance of clean shutdown

     */

    if (close(cioc->writefd) < 0) {

        rv = -1;

    }

    if (close(cioc->readfd) < 0) {

        rv = -1;

    }

#ifndef WIN32

    if (qio_channel_command_abort(cioc, errp) < 0) {

        return -1;

    }

#endif

    if (rv < 0) {

        error_setg_errno(errp, errno, "%s",

                         "Unable to close command");

    }

    return rv;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void mirror_iteration_done(MirrorOp *op, int ret)

+{
+
+    MirrorBlockJob *s = op->s;
+
+    struct iovec *iov;

     int64_t chunk_num;

static void mirror_iteration_done(MirrorOp *op, int ret)

{

    MirrorBlockJob *s = op->s;

    struct iovec *iov;

    int64_t chunk_num;

    int i, nb_chunks, sectors_per_chunk;

    trace_mirror_iteration_done(s, op->sector_num * BDRV_SECTOR_SIZE,

                                op->nb_sectors * BDRV_SECTOR_SIZE, ret);

    s->in_flight--;

    s->sectors_in_flight -= op->nb_sectors;

    iov = op->qiov.iov;

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

        MirrorBuffer *buf = (MirrorBuffer *) iov[i].iov_base;

        QSIMPLEQ_INSERT_TAIL(&s->buf_free, buf, next);

        s->buf_free_count++;

    }

    sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS;

    chunk_num = op->sector_num / sectors_per_chunk;

    nb_chunks = DIV_ROUND_UP(op->nb_sectors, sectors_per_chunk);

    bitmap_clear(s->in_flight_bitmap, chunk_num, nb_chunks);

    if (ret >= 0) {

        if (s->cow_bitmap) {

            bitmap_set(s->cow_bitmap, chunk_num, nb_chunks);

        }

        if (!s->initial_zeroing_ongoing) {

            s->common.offset += (uint64_t)op->nb_sectors * BDRV_SECTOR_SIZE;

        }

    }

    qemu_iovec_destroy(&op->qiov);

    g_free(op);

    if (s->waiting_for_io) {

        qemu_coroutine_enter(s->common.co);

    }

}


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

                                 ram_addr_t offset)

+{

     RAMState *rs = &ram_state;

static int do_compress_ram_page(QEMUFile *f, RAMBlock *block,

                                ram_addr_t offset)

{

    RAMState *rs = &ram_state;

    int bytes_sent, blen;

    uint8_t *p = block->host + (offset & TARGET_PAGE_MASK);

    bytes_sent = save_page_header(rs, block, offset |

                                  RAM_SAVE_FLAG_COMPRESS_PAGE);

    blen = qemu_put_compression_data(f, p, TARGET_PAGE_SIZE,

                                     migrate_compress_level());

    if (blen < 0) {

        bytes_sent = 0;

        qemu_file_set_error(migrate_get_current()->to_dst_file, blen);

        error_report("compressed data failed!");

    } else {

        bytes_sent += blen;

        ram_release_pages(block->idstr, offset & TARGET_PAGE_MASK, 1);

    }

    return bytes_sent;

}


--- a/source.c
+++ b/source.c
@@ -5,19 +5,19 @@
     int rc;

     uint8_t byte;
+

     if (!dev->crq.qsize) {

         fprintf(stderr, "spapr_vio_send_creq on uninitialized queue\n");

+        return -1;

     }

+
     /* Maybe do a fast path for KVM just writing to the pages */

     rc = spapr_tce_dma_read(dev, dev->crq.qladdr + dev->crq.qnext, &byte, 1);
@@ -25,7 +25,7 @@
     if (rc) {

         return rc;
+
     }

     if (byte != 0) {

int spapr_vio_send_crq(VIOsPAPRDevice *dev, uint8_t *crq)

{

    int rc;

    uint8_t byte;

    if (!dev->crq.qsize) {

        fprintf(stderr, "spapr_vio_send_creq on uninitialized queue\n");

        return -1;

    }

    /* Maybe do a fast path for KVM just writing to the pages */

    rc = spapr_tce_dma_read(dev, dev->crq.qladdr + dev->crq.qnext, &byte, 1);

    if (rc) {

        return rc;

    }

    if (byte != 0) {

        return 1;

    }

    rc = spapr_tce_dma_write(dev, dev->crq.qladdr + dev->crq.qnext + 8,

                             &crq[8], 8);

    if (rc) {

        return rc;

    }

    kvmppc_eieio();

    rc = spapr_tce_dma_write(dev, dev->crq.qladdr + dev->crq.qnext, crq, 8);

    if (rc) {

        return rc;

    }

    dev->crq.qnext = (dev->crq.qnext + 16) % dev->crq.qsize;

    if (dev->signal_state & 1) {

        qemu_irq_pulse(dev->qirq);

    }

    return 0;

}