--- a/source.c
+++ b/source.c
@@ -36,10 +36,10 @@
     visit_type_int64(v, NULL, &tail->value, &error_abort);
     tail = (int64List *)visit_next_list(v, (GenericList *)tail, sizeof(*res));
     g_assert(tail);
+    visit_type_int64(v, NULL, &tail->value, &error_abort);
+    g_assert_cmpint(tail->value, ==, 2);
+    tail = (int64List *)visit_next_list(v, (GenericList *)tail, sizeof(*res));
+    g_assert(tail);
+    visit_check_list(v, &err);
     error_free_or_abort(&err);
 }

static void test_visitor_in_intList(TestInputVisitorData *data,
                                    const void *unused)
{
    /* Note: the visitor *sorts* ranges *unsigned* */
    int64_t expect1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20 };
    int64_t expect2[] = { 32767, -32768, -32767 };
    int64_t expect3[] = { INT64_MAX, INT64_MIN };
    uint64_t expect4[] = { UINT64_MAX };
    Error *err = NULL;
    int64List *res = NULL;
    int64List *tail;
    Visitor *v;
    int64_t val;
    /* Valid lists */
    v = visitor_input_test_init(data, "1,2,0,2-4,20,5-9,1-8");
    check_ilist(v, expect1, ARRAY_SIZE(expect1));
    v = visitor_input_test_init(data, "32767,-32768--32767");
    check_ilist(v, expect2, ARRAY_SIZE(expect2));
    v = visitor_input_test_init(data,
                                "-9223372036854775808,9223372036854775807");
    check_ilist(v, expect3, ARRAY_SIZE(expect3));
    v = visitor_input_test_init(data, "18446744073709551615");
    check_ulist(v, expect4, ARRAY_SIZE(expect4));
    /* Empty list is invalid (weird) */
    v = visitor_input_test_init(data, "");
    visit_type_int64List(v, NULL, &res, &err);
    error_free_or_abort(&err);
    /* Not a list */
    v = visitor_input_test_init(data, "not an int list");
    visit_type_int64List(v, NULL, &res, &err);
    error_free_or_abort(&err);
    g_assert(!res);
    /* Unvisited list tail */
    v = visitor_input_test_init(data, "0,2-3");
    /* Would be simpler if the visitor genuinely supported virtual walks */
    visit_type_int64(v, NULL, &tail->value, &error_abort);
    tail = (int64List *)visit_next_list(v, (GenericList *)tail, sizeof(*res));
    g_assert(tail);
    visit_type_int64(v, NULL, &tail->value, &error_abort);
    g_assert_cmpint(tail->value, ==, 2);
    tail = (int64List *)visit_next_list(v, (GenericList *)tail, sizeof(*res));
    g_assert(tail);
    visit_check_list(v, &err);
    error_free_or_abort(&err);
}


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

+        set_bit(apic_id, cpu->found_cpus);
+
+    }
+
+

     object_child_foreach(o, acpi_add_cpu_info, opaque);

int acpi_add_cpu_info(Object *o, void *opaque)

{

    AcpiCpuInfo *cpu = opaque;

    uint64_t apic_id;

    if (object_dynamic_cast(o, TYPE_CPU)) {

        apic_id = object_property_get_int(o, "apic-id", NULL);

        assert(apic_id <= MAX_CPUMASK_BITS);

        set_bit(apic_id, cpu->found_cpus);

    }

    object_child_foreach(o, acpi_add_cpu_info, opaque);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static inline bool media_is_dvd(SCSIDiskState *s)

 {
+
+    uint64_t nb_sectors;
+
+    if (s->qdev.type != TYPE_ROM) {
+
         return false;

     }

static inline bool media_is_dvd(SCSIDiskState *s)

{

    uint64_t nb_sectors;

    if (s->qdev.type != TYPE_ROM) {

        return false;

    }

    if (!bdrv_is_inserted(s->qdev.conf.bs)) {

        return false;

    }

    bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);

    return nb_sectors > CD_MAX_SECTORS;

}


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

+    if (MPV_common_init(s) < 0)
+
+        return -1;
+
+

     ff_h264_pred_init(&r->h, CODEC_ID_RV40);

av_cold int ff_rv34_decode_init(AVCodecContext *avctx)

{

    RV34DecContext *r = avctx->priv_data;

    MpegEncContext *s = &r->s;

    MPV_decode_defaults(s);

    s->avctx= avctx;

    s->out_format = FMT_H263;

    s->codec_id= avctx->codec_id;

    s->width = avctx->width;

    s->height = avctx->height;

    r->s.avctx = avctx;

    avctx->flags |= CODEC_FLAG_EMU_EDGE;

    r->s.flags |= CODEC_FLAG_EMU_EDGE;

    avctx->pix_fmt = PIX_FMT_YUV420P;

    avctx->has_b_frames = 1;

    s->low_delay = 0;

    if (MPV_common_init(s) < 0)

        return -1;

    ff_h264_pred_init(&r->h, CODEC_ID_RV40);

    r->intra_types_hist = av_malloc(s->b4_stride * 4 * 2 * sizeof(*r->intra_types_hist));

    r->intra_types = r->intra_types_hist + s->b4_stride * 4;

    r->mb_type = av_mallocz(r->s.mb_stride * r->s.mb_height * sizeof(*r->mb_type));

    r->cbp_luma   = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma));

    r->cbp_chroma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma));

    r->deblock_coefs = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->deblock_coefs));

    if(!intra_vlcs[0].cbppattern[0].bits)

        rv34_init_tables();

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -8,11 +8,11 @@
     AVStream *st = s->streams[0];
     if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
         AUD_CHUNK_PREAMBLE_SIZE)
+        return AVERROR(EIO);
+    /* validate the chunk */
+    if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE)
+    chunk_size = AV_RL16(&preamble[0]);
+    if (st->codecpar->codec_id == AV_CODEC_ID_WESTWOOD_SND1) {
         /* For Westwood SND1 audio we need to add the output size and input
            size to the start of the packet to match what is in VQA.
            Specifically, this is needed to signal when a packet should be

static int wsaud_read_packet(AVFormatContext *s,
                             AVPacket *pkt)
{
    AVIOContext *pb = s->pb;
    unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE];
    unsigned int chunk_size;
    int ret = 0;
    AVStream *st = s->streams[0];
    if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
        AUD_CHUNK_PREAMBLE_SIZE)
        return AVERROR(EIO);
    /* validate the chunk */
    if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE)
    chunk_size = AV_RL16(&preamble[0]);
    if (st->codecpar->codec_id == AV_CODEC_ID_WESTWOOD_SND1) {
        /* For Westwood SND1 audio we need to add the output size and input
           size to the start of the packet to match what is in VQA.
           Specifically, this is needed to signal when a packet should be
           decoding as raw 8-bit pcm or variable-size ADPCM. */
        int out_size = AV_RL16(&preamble[2]);
        if ((ret = av_new_packet(pkt, chunk_size + 4)) < 0)
            return ret;
        if ((ret = avio_read(pb, &pkt->data[4], chunk_size)) != chunk_size)
            return ret < 0 ? ret : AVERROR(EIO);
        AV_WL16(&pkt->data[0], out_size);
        AV_WL16(&pkt->data[2], chunk_size);
        pkt->duration = out_size;
    } else {
        ret = av_get_packet(pb, pkt, chunk_size);
        if (ret != chunk_size)
            return AVERROR(EIO);
        /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
        pkt->duration = (chunk_size * 2) / st->codecpar->channels;
    pkt->stream_index = st->index;
    return ret;


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
         if (!vmdk_is_cid_valid(bs))

             return -1;
+
+
+
+        /* floor offset to cluster */
+
         offset -= offset % (extent->cluster_sectors * 512);

         ret = bdrv_read(bs->backing_hd, offset >> 9, whole_grain,

static int get_whole_cluster(BlockDriverState *bs,

                VmdkExtent *extent,

                uint64_t cluster_offset,

                uint64_t offset,

                bool allocate)

{

    /* 128 sectors * 512 bytes each = grain size 64KB */

    uint8_t  whole_grain[extent->cluster_sectors * 512];

    /* we will be here if it's first write on non-exist grain(cluster).

     * try to read from parent image, if exist */

    if (bs->backing_hd) {

        int ret;

        if (!vmdk_is_cid_valid(bs))

            return -1;

        /* floor offset to cluster */

        offset -= offset % (extent->cluster_sectors * 512);

        ret = bdrv_read(bs->backing_hd, offset >> 9, whole_grain,

                extent->cluster_sectors);

        if (ret < 0) {

            return -1;

        }

        /* Write grain only into the active image */

        ret = bdrv_write(extent->file, cluster_offset, whole_grain,

                extent->cluster_sectors);

        if (ret < 0) {

            return -1;

        }

    }

    return 0;

}


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

         }

+        rdma->total_registrations++;
+
+    }
+
+

     if (i >= local->nb_blocks) {

static int qemu_rdma_reg_whole_ram_blocks(RDMAContext *rdma)

{

    int i;

    RDMALocalBlocks *local = &rdma->local_ram_blocks;

    for (i = 0; i < local->nb_blocks; i++) {

        local->block[i].mr =

            ibv_reg_mr(rdma->pd,

                    local->block[i].local_host_addr,

                    local->block[i].length,

                    IBV_ACCESS_LOCAL_WRITE |

                    IBV_ACCESS_REMOTE_WRITE

                    );

        if (!local->block[i].mr) {

            perror("Failed to register local dest ram block!\n");

            break;

        }

        rdma->total_registrations++;

    }

    if (i >= local->nb_blocks) {

        return 0;

    }

    for (i--; i >= 0; i--) {

        ibv_dereg_mr(local->block[i].mr);

        rdma->total_registrations--;

    }

    return -1;

}


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

 {
+
     DeviceClass *dc = DEVICE_CLASS(klass);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    dc->vmsd = &vmstate_pic_common;

    dc->no_user = 1;

    dc->props = pic_properties_common;

    dc->realize = pic_common_realize;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static ssize_t net_socket_receive(NetClientState *nc, const uint8_t *buf, size_t size)
+
+{
+
     NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);

     uint32_t len;

static ssize_t net_socket_receive(NetClientState *nc, const uint8_t *buf, size_t size)

{

    NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);

    uint32_t len;

    len = htonl(size);

    send_all(s->fd, (const uint8_t *)&len, sizeof(len));

    return send_all(s->fd, buf, size);

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@
     int is_mace3 = (avctx->codec_id == AV_CODEC_ID_MACE3);
     /* get output buffer */
     frame->nb_samples = 3 * (buf_size << (1 - is_mace3)) / avctx->channels;
+    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+        return ret;
+    samples = (int16_t **)frame->extended_data;
+    for(i = 0; i < avctx->channels; i++) {
+        int16_t *output = samples[i];
         for (j=0; j < buf_size / (avctx->channels << is_mace3); j++)
             for (k=0; k < (1 << is_mace3); k++) {
                 uint8_t pkt = buf[(i << is_mace3) +

static int mace_decode_frame(AVCodecContext *avctx, void *data,
                             int *got_frame_ptr, AVPacket *avpkt)
{
    AVFrame *frame     = data;
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    int16_t **samples;
    MACEContext *ctx = avctx->priv_data;
    int i, j, k, l, ret;
    int is_mace3 = (avctx->codec_id == AV_CODEC_ID_MACE3);
    /* get output buffer */
    frame->nb_samples = 3 * (buf_size << (1 - is_mace3)) / avctx->channels;
    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
        return ret;
    samples = (int16_t **)frame->extended_data;
    for(i = 0; i < avctx->channels; i++) {
        int16_t *output = samples[i];
        for (j=0; j < buf_size / (avctx->channels << is_mace3); j++)
            for (k=0; k < (1 << is_mace3); k++) {
                uint8_t pkt = buf[(i << is_mace3) +
                                  (j*avctx->channels << is_mace3) + k];
                uint8_t val[2][3] = {{pkt >> 5, (pkt >> 3) & 3, pkt & 7 },
                                     {pkt & 7 , (pkt >> 3) & 3, pkt >> 5}};
                for (l=0; l < 3; l++) {
                    if (is_mace3)
                        chomp3(&ctx->chd[i], output, val[1][l], l);
                    else
                        chomp6(&ctx->chd[i], output, val[0][l], l);
                    output += 1 << (1-is_mace3);
    *got_frame_ptr = 1;
    return buf_size;


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

             fprintf(stderr, "Failed to initialize SPI flash!\n");

+            return 1;
+
+        }
+
+    } else {

         DB_PRINT_L(0, "No BDRV - binding to RAM\n");

static int m25p80_init(SSISlave *ss)

{

    DriveInfo *dinfo;

    Flash *s = M25P80(ss);

    M25P80Class *mc = M25P80_GET_CLASS(s);

    s->pi = mc->pi;

    s->size = s->pi->sector_size * s->pi->n_sectors;

    s->dirty_page = -1;

    s->storage = qemu_blockalign(s->bdrv, s->size);

    dinfo = drive_get_next(IF_MTD);

    if (dinfo) {

        DB_PRINT_L(0, "Binding to IF_MTD drive\n");

        s->bdrv = blk_bs(blk_by_legacy_dinfo(dinfo));

        /* FIXME: Move to late init */

        if (bdrv_read(s->bdrv, 0, s->storage, DIV_ROUND_UP(s->size,

                                                    BDRV_SECTOR_SIZE))) {

            fprintf(stderr, "Failed to initialize SPI flash!\n");

            return 1;

        }

    } else {

        DB_PRINT_L(0, "No BDRV - binding to RAM\n");

        memset(s->storage, 0xFF, s->size);

    }

    return 0;

}


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

     OHCIState *ohci = opaque;

static bool ohci_eof_timer_needed(void *opaque)

{

    OHCIState *ohci = opaque;

    return ohci->eof_timer != NULL;

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
             goto found;

     }
+
+ help:
+
+    help_cmd(argv[0]);
+
     return;

  found:

static void do_info(int argc, const char **argv)

{

    term_cmd_t *cmd;

    const char *item;

    if (argc < 2)

        goto help;

    item = argv[1];

    for(cmd = info_cmds; cmd->name != NULL; cmd++) {

        if (compare_cmd(argv[1], cmd->name))

            goto found;

    }

 help:

    help_cmd(argv[0]);

    return;

 found:

    cmd->handler(argc, argv);

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     uint32_t val;

+
+    val = bswap16(cpu_inw(addr & IOPORTS_MASK));
+
     return val;

 }

static uint32_t pci_apb_ioreadw (void *opaque, target_phys_addr_t addr)

{

    uint32_t val;

    val = bswap16(cpu_inw(addr & IOPORTS_MASK));

    return val;

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
+QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists)

 {

+    QemuOpts *opts = NULL;

     if (id) {

         if (!id_wellformed(id)) {
+
             qerror_report(QERR_INVALID_PARAMETER_VALUE, "id", "an identifier");

             error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n");

QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists)

{

    QemuOpts *opts = NULL;

    if (id) {

        if (!id_wellformed(id)) {

            qerror_report(QERR_INVALID_PARAMETER_VALUE, "id", "an identifier");

            error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n");

            return NULL;

        }

        opts = qemu_opts_find(list, id);

        if (opts != NULL) {

            if (fail_if_exists && !list->merge_lists) {

                qerror_report(QERR_DUPLICATE_ID, id, list->name);

                return NULL;

            } else {

                return opts;

            }

        }

    } else if (list->merge_lists) {

        opts = qemu_opts_find(list, NULL);

        if (opts) {

            return opts;

        }

    }

    opts = g_malloc0(sizeof(*opts));

    if (id) {

        opts->id = g_strdup(id);

    }

    opts->list = list;

    loc_save(&opts->loc);

    QTAILQ_INIT(&opts->head);

    QTAILQ_INSERT_TAIL(&list->head, opts, next);

    return opts;

}


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

     /* XXX implement */
+
+#if 0
+
+    env->storage_keys[r2 / TARGET_PAGE_SIZE] &= ~SK_REFERENCED;
+
 #endif

uint32_t HELPER(rrbe)(uint32_t r1, uint64_t r2)

{

    if (r2 > ram_size) {

        return 0;

    }

    /* XXX implement */

#if 0

    env->storage_keys[r2 / TARGET_PAGE_SIZE] &= ~SK_REFERENCED;

#endif

    /*

     * cc

     *

     * 0  Reference bit zero; change bit zero

     * 1  Reference bit zero; change bit one

     * 2  Reference bit one; change bit zero

     * 3  Reference bit one; change bit one

     */

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     struct AHCIPCIState *d;

     d = DO_UPCAST(struct AHCIPCIState, card, dev);
+
+
+
+    pci_config_set_vendor_id(d->card.config, PCI_VENDOR_ID_INTEL);
+
     pci_config_set_device_id(d->card.config, PCI_DEVICE_ID_INTEL_82801IR);

static int pci_ich9_ahci_init(PCIDevice *dev)

{

    struct AHCIPCIState *d;

    d = DO_UPCAST(struct AHCIPCIState, card, dev);

    pci_config_set_vendor_id(d->card.config, PCI_VENDOR_ID_INTEL);

    pci_config_set_device_id(d->card.config, PCI_DEVICE_ID_INTEL_82801IR);

    pci_config_set_class(d->card.config, PCI_CLASS_STORAGE_SATA);

    pci_config_set_revision(d->card.config, 0x02);

    pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1);

    d->card.config[PCI_CACHE_LINE_SIZE] = 0x08;  /* Cache line size */

    d->card.config[PCI_LATENCY_TIMER]   = 0x00;  /* Latency timer */

    pci_config_set_interrupt_pin(d->card.config, 1);

    /* XXX Software should program this register */

    d->card.config[0x90]   = 1 << 6; /* Address Map Register - AHCI mode */

    qemu_register_reset(ahci_reset, d);

    /* XXX BAR size should be 1k, but that breaks, so bump it to 4k for now */

    pci_register_bar_simple(&d->card, 5, 0x1000, 0, d->ahci.mem);

    msi_init(dev, 0x50, 1, true, false);

    ahci_init(&d->ahci, &dev->qdev, 6);

    d->ahci.irq = d->card.irq[0];

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
             ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma,
                             h->sps.chroma_format_idc);
             ff_h264chroma_init(&h->h264chroma, h->sps.bit_depth_chroma);
+            ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma);
+            ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
+                              h->sps.chroma_format_idc);
+            h->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16;
+            ff_dsputil_init(&h->dsp, h->avctx);
             ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
         } else {
             av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",

static int h264_set_parameter_from_sps(H264Context *h)
{
    if (h->flags & CODEC_FLAG_LOW_DELAY ||
        (h->sps.bitstream_restriction_flag &&
         !h->sps.num_reorder_frames)) {
        if (h->avctx->has_b_frames > 1 || h->delayed_pic[0])
            av_log(h->avctx, AV_LOG_WARNING, "Delayed frames seen. "
                   "Reenabling low delay requires a codec flush.\n");
        else
            h->low_delay = 1;
    if (h->avctx->has_b_frames < 2)
        h->avctx->has_b_frames = !h->low_delay;
    if (h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
        h->cur_chroma_format_idc      != h->sps.chroma_format_idc) {
        if (h->avctx->codec &&
            h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU &&
            (h->sps.bit_depth_luma != 8 || h->sps.chroma_format_idc > 1)) {
            av_log(h->avctx, AV_LOG_ERROR,
                   "VDPAU decoding does not support video colorspace.\n");
            return AVERROR_INVALIDDATA;
        if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) {
            h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
            h->cur_chroma_format_idc      = h->sps.chroma_format_idc;
            h->pixel_shift                = h->sps.bit_depth_luma > 8;
            ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma,
                            h->sps.chroma_format_idc);
            ff_h264chroma_init(&h->h264chroma, h->sps.bit_depth_chroma);
            ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma);
            ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
                              h->sps.chroma_format_idc);
            h->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16;
            ff_dsputil_init(&h->dsp, h->avctx);
            ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
        } else {
            av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",
                   h->sps.bit_depth_luma);
            return AVERROR_INVALIDDATA;
    return 0;


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

+
+    unlock_user_struct(mcp, mcp_addr, 1);
+
+    return 0;
+

 sigsegv:

static int do_setcontext(struct target_ucontext *ucp, CPUPPCState *env, int sig)

{

    struct target_mcontext *mcp;

    target_ulong mcp_addr;

    sigset_t blocked;

    target_sigset_t set;

    if (copy_from_user(&set, h2g(ucp) + offsetof(struct target_ucontext, tuc_sigmask),

                       sizeof (set)))

        return 1;

#if defined(TARGET_PPC64)

    fprintf (stderr, "do_setcontext: not implemented\n");

    return 0;

#else

    if (__get_user(mcp_addr, &ucp->tuc_regs))

        return 1;

    if (!lock_user_struct(VERIFY_READ, mcp, mcp_addr, 1))

        return 1;

    target_to_host_sigset_internal(&blocked, &set);

    do_sigprocmask(SIG_SETMASK, &blocked, NULL);

    if (restore_user_regs(env, mcp, sig))

        goto sigsegv;

    unlock_user_struct(mcp, mcp_addr, 1);

    return 0;

sigsegv:

    unlock_user_struct(mcp, mcp_addr, 1);

    return 1;

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+
 	long width, long height,

 	long lumStride, long chromStride, long dstStride)

static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,

	long width, long height,

	long lumStride, long chromStride, long dstStride)

{

	//FIXME interpolate chroma

	RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){

     int i;
+
+
+
+    s->dts= s->pts= AV_NOPTS_VALUE;
+
     s->offset= 0;

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

void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){

    int i;

    s->dts= s->pts= AV_NOPTS_VALUE;

    s->offset= 0;

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

        if (   s->next_frame_offset + off >= s->cur_frame_offset[i]

            &&(s->     frame_offset       <  s->cur_frame_offset[i] || !s->frame_offset)

            //check is disabled  becausue mpeg-ts doesnt send complete PES packets

            && /*s->next_frame_offset + off <*/  s->cur_frame_end[i]){

            s->dts= s->cur_frame_dts[i];

            s->pts= s->cur_frame_pts[i];

            s->offset = s->next_frame_offset - s->cur_frame_offset[i];

            if(remove)

                s->cur_frame_offset[i]= INT64_MAX;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     Visitor *v;

     Error *err = NULL;
+
+
+
+    v = validate_test_init(data, "3.14");
+

     visit_type_UserDefAlternate(v, NULL, &tmp, &err);

static void test_validate_fail_alternate(TestInputVisitorData *data,

                                         const void *unused)

{

    UserDefAlternate *tmp;

    Visitor *v;

    Error *err = NULL;

    v = validate_test_init(data, "3.14");

    visit_type_UserDefAlternate(v, NULL, &tmp, &err);

    error_free_or_abort(&err);

    g_assert(!tmp);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void bdrv_attach_aio_context(BlockDriverState *bs,
+
                              AioContext *new_context)

 {
@@ -11,8 +11,8 @@

     if (!bs->drv) {
+
+        return;

     }

void bdrv_attach_aio_context(BlockDriverState *bs,

                             AioContext *new_context)

{

    BdrvAioNotifier *ban;

    BdrvChild *child;

    if (!bs->drv) {

        return;

    }

    bs->aio_context = new_context;

    QLIST_FOREACH(child, &bs->children, next) {

        bdrv_attach_aio_context(child->bs, new_context);

    }

    if (bs->drv->bdrv_attach_aio_context) {

        bs->drv->bdrv_attach_aio_context(bs, new_context);

    }

    QLIST_FOREACH(ban, &bs->aio_notifiers, list) {

        ban->attached_aio_context(new_context, ban->opaque);

    }

}


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

         goto sigsegv;

+

 #if defined(TARGET_PPC64)

long do_sigreturn(CPUPPCState *env)

{

    struct target_sigcontext *sc = NULL;

    struct target_mcontext *sr = NULL;

    target_ulong sr_addr = 0, sc_addr;

    sigset_t blocked;

    target_sigset_t set;

    sc_addr = env->gpr[1] + SIGNAL_FRAMESIZE;

    if (!lock_user_struct(VERIFY_READ, sc, sc_addr, 1))

        goto sigsegv;

#if defined(TARGET_PPC64)

    set.sig[0] = sc->oldmask + ((uint64_t)(sc->_unused[3]) << 32);

#else

    __get_user(set.sig[0], &sc->oldmask);

    __get_user(set.sig[1], &sc->_unused[3]);

#endif

    target_to_host_sigset_internal(&blocked, &set);

    set_sigmask(&blocked);

    __get_user(sr_addr, &sc->regs);

    if (!lock_user_struct(VERIFY_READ, sr, sr_addr, 1))

        goto sigsegv;

    restore_user_regs(env, sr, 1);

    unlock_user_struct(sr, sr_addr, 1);

    unlock_user_struct(sc, sc_addr, 1);

    return -TARGET_QEMU_ESIGRETURN;

sigsegv:

    unlock_user_struct(sr, sr_addr, 1);

    unlock_user_struct(sc, sc_addr, 1);

    force_sig(TARGET_SIGSEGV);

    return 0;

}


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

     case 1: /* YIELD */
+
+        if (!parallel_cpus) {
+
+            s->base.is_jmp = DISAS_YIELD;
+
         }

         return;

static void handle_hint(DisasContext *s, uint32_t insn,

                        unsigned int op1, unsigned int op2, unsigned int crm)

{

    unsigned int selector = crm << 3 | op2;

    if (op1 != 3) {

        unallocated_encoding(s);

        return;

    }

    switch (selector) {

    case 0: /* NOP */

        return;

    case 3: /* WFI */

        s->base.is_jmp = DISAS_WFI;

        return;

    case 1: /* YIELD */

        if (!parallel_cpus) {

            s->base.is_jmp = DISAS_YIELD;

        }

        return;

    case 2: /* WFE */

        if (!parallel_cpus) {

            s->base.is_jmp = DISAS_WFE;

        }

        return;

    case 4: /* SEV */

    case 5: /* SEVL */

        /* we treat all as NOP at least for now */

        return;

    default:

        /* default specified as NOP equivalent */

        return;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int default_fdset_get_fd(int64_t fdset_id, int flags)

 {

static int default_fdset_get_fd(int64_t fdset_id, int flags)

{

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -9,8 +9,8 @@
         st->nb_frames = var_read_int(pb, size);

     } else if (!strcmp(name, "AUDIO_FORMAT")) {
+
+        st->codec->codec_id = var_read_int(pb, size);

     } else if (!strcmp(name, "COMPRESSION")) {

static int parse_audio_var(AVFormatContext *avctx, AVStream *st, const char *name, int size)

{

    AVIOContext *pb = avctx->pb;

    if (!strcmp(name, "__DIR_COUNT")) {

        st->nb_frames = var_read_int(pb, size);

    } else if (!strcmp(name, "AUDIO_FORMAT")) {

        st->codec->codec_id = var_read_int(pb, size);

    } else if (!strcmp(name, "COMPRESSION")) {

        st->codec->codec_tag = var_read_int(pb, size);

    } else if (!strcmp(name, "DEFAULT_VOL")) {

        var_read_metadata(avctx, name, size);

    } else if (!strcmp(name, "NUM_CHANNELS")) {

        st->codec->channels = var_read_int(pb, size);

        st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;

    } else if (!strcmp(name, "SAMPLE_RATE")) {

        st->codec->sample_rate = var_read_int(pb, size);

        avpriv_set_pts_info(st, 33, 1, st->codec->sample_rate);

    } else if (!strcmp(name, "SAMPLE_WIDTH")) {

        st->codec->bits_per_coded_sample = var_read_int(pb, size) * 8;

    } else

        return -1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static FlatView generate_memory_topology(MemoryRegion *mr)

 {
+
     FlatView view;

static FlatView generate_memory_topology(MemoryRegion *mr)

{

    FlatView view;

    flatview_init(&view);

    render_memory_region(&view, mr, 0, addrrange_make(0, UINT64_MAX));

    flatview_simplify(&view);

    return view;

}


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

     uc->handle_reset   = usb_hid_handle_reset;

+    uc->handle_control = usb_hid_handle_control;
+
+    uc->handle_data    = usb_hid_handle_data;
+
+    uc->handle_destroy = usb_hid_handle_destroy;

 }

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

{

    USBDeviceClass *uc = USB_DEVICE_CLASS(klass);

    uc->init           = usb_keyboard_initfn;

    uc->product_desc   = "QEMU USB Keyboard";

    uc->usb_desc       = &desc_keyboard;

    uc->handle_packet  = usb_generic_handle_packet;

    uc->handle_reset   = usb_hid_handle_reset;

    uc->handle_control = usb_hid_handle_control;

    uc->handle_data    = usb_hid_handle_data;

    uc->handle_destroy = usb_hid_handle_destroy;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+static QObject *qdict_get_obj(const QDict *qdict, const char *key, QType type)
+
+{
+
+    QObject *obj;
+

     obj = qdict_get(qdict, key);

static QObject *qdict_get_obj(const QDict *qdict, const char *key, QType type)

{

    QObject *obj;

    obj = qdict_get(qdict, key);

    assert(obj != NULL);

    assert(qobject_type(obj) == type);

    return obj;

}


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

     WorkerTestData data = { .n = 0, .ret = -EINPROGRESS };
+
     data.aiocb = thread_pool_submit_aio(pool, worker_cb, &data,

                                         done_cb, &data);

static void test_submit_aio(void)

{

    WorkerTestData data = { .n = 0, .ret = -EINPROGRESS };

    data.aiocb = thread_pool_submit_aio(pool, worker_cb, &data,

                                        done_cb, &data);

    /* The callbacks are not called until after the first wait.  */

    active = 1;

    g_assert_cmpint(data.ret, ==, -EINPROGRESS);

    qemu_aio_wait_all();

    g_assert_cmpint(active, ==, 0);

    g_assert_cmpint(data.n, ==, 1);

    g_assert_cmpint(data.ret, ==, 0);

}


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

     /* Prevent race with block_job_defer_to_main_loop() */

+    aio_context_acquire(data->aio_context);
+
+
+
+    /* Fetch BDS AioContext again, in case it has changed */

     aio_context = blk_get_aio_context(data->job->blk);

static void block_job_defer_to_main_loop_bh(void *opaque)

{

    BlockJobDeferToMainLoopData *data = opaque;

    AioContext *aio_context;

    /* Prevent race with block_job_defer_to_main_loop() */

    aio_context_acquire(data->aio_context);

    /* Fetch BDS AioContext again, in case it has changed */

    aio_context = blk_get_aio_context(data->job->blk);

    if (aio_context != data->aio_context) {

        aio_context_acquire(aio_context);

    }

    data->job->deferred_to_main_loop = false;

    data->fn(data->job, data->opaque);

    if (aio_context != data->aio_context) {

        aio_context_release(aio_context);

    }

    aio_context_release(data->aio_context);

    g_free(data);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int show_hwaccels(void *optctx, const char *opt, const char *arg)

 {
+
+    int i;
+
+
+
     printf("Hardware acceleration methods:\n");

     for (i = 0; hwaccels[i].name; i++) {

static int show_hwaccels(void *optctx, const char *opt, const char *arg)

{

    int i;

    printf("Hardware acceleration methods:\n");

    for (i = 0; hwaccels[i].name; i++) {

        printf("%s\n", hwaccels[i].name);

    }

    printf("\n");

    return 0;

}


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

         if (hwaccels[i].pix_fmt == pix_fmt &&

+            (!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[i].id == selected_hwaccel_id))
+
+            return &hwaccels[i];
+
     return NULL;

 }

static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt, enum HWAccelID selected_hwaccel_id)

{

    int i;

    for (i = 0; hwaccels[i].name; i++)

        if (hwaccels[i].pix_fmt == pix_fmt &&

            (!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[i].id == selected_hwaccel_id))

            return &hwaccels[i];

    return NULL;

}


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

+    qvirtio_9p_pci_free(v9p);
+
+    qvirtio_9p_stop();
+
+}

static void pci_basic_config(void)

{

    QVirtIO9P *v9p;

    void *addr;

    size_t tag_len;

    char *tag;

    int i;

    qvirtio_9p_start();

    v9p = qvirtio_9p_pci_init();

    addr = ((QVirtioPCIDevice *) v9p->dev)->addr + VIRTIO_PCI_CONFIG_OFF(false);

    tag_len = qvirtio_config_readw(v9p->dev,

                                   (uint64_t)(uintptr_t)addr);

    g_assert_cmpint(tag_len, ==, strlen(mount_tag));

    addr += sizeof(uint16_t);

    tag = g_malloc(tag_len);

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

        tag[i] = qvirtio_config_readb(v9p->dev, (uint64_t)(uintptr_t)addr + i);

    }

    g_assert_cmpmem(tag, tag_len, mount_tag, tag_len);

    g_free(tag);

    qvirtio_9p_pci_free(v9p);

    qvirtio_9p_stop();

}


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

     if (s->delta == 0 || s->period == 0) {

+        fprintf(stderr, "Timer with period zero, disabling\n");
+
+        s->enabled = 0;
+
+        return;

     }

static void ptimer_reload(ptimer_state *s)

{

    if (s->delta == 0) {

        ptimer_trigger(s);

        s->delta = s->limit;

    }

    if (s->delta == 0 || s->period == 0) {

        fprintf(stderr, "Timer with period zero, disabling\n");

        s->enabled = 0;

        return;

    }

    s->last_event = s->next_event;

    s->next_event = s->last_event + s->delta * s->period;

    if (s->period_frac) {

        s->next_event += ((int64_t)s->period_frac * s->delta) >> 32;

    }

    timer_mod(s->timer, s->next_event);

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+static void adb_kbd_class_init(ObjectClass *oc, void *data)
+
+{
+
+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    ADBDeviceClass *adc = ADB_DEVICE_CLASS(oc);
+
+    ADBKeyboardClass *akc = ADB_KEYBOARD_CLASS(oc);
+

     akc->parent_realize = dc->realize;

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

{

    DeviceClass *dc = DEVICE_CLASS(oc);

    ADBDeviceClass *adc = ADB_DEVICE_CLASS(oc);

    ADBKeyboardClass *akc = ADB_KEYBOARD_CLASS(oc);

    akc->parent_realize = dc->realize;

    dc->realize = adb_kbd_realizefn;

    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);

    adc->devreq = adb_kbd_request;

    dc->reset = adb_kbd_reset;

    dc->vmsd = &vmstate_adb_kbd;

}


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

+    /* Now fix up the spec with information we can query from the host */
+
+
+
+    alter_insns(&spec->insns_flags, PPC_ALTIVEC, vmx > 0);

     alter_insns(&spec->insns_flags2, PPC2_VSX, vmx > 1);

const ppc_def_t *kvmppc_host_cpu_def(void)

{

    uint32_t host_pvr = mfpvr();

    const ppc_def_t *base_spec;

    ppc_def_t *spec;

    uint32_t vmx = kvmppc_get_vmx();

    uint32_t dfp = kvmppc_get_dfp();

    base_spec = ppc_find_by_pvr(host_pvr);

    spec = g_malloc0(sizeof(*spec));

    memcpy(spec, base_spec, sizeof(*spec));

    /* Now fix up the spec with information we can query from the host */

    alter_insns(&spec->insns_flags, PPC_ALTIVEC, vmx > 0);

    alter_insns(&spec->insns_flags2, PPC2_VSX, vmx > 1);

    alter_insns(&spec->insns_flags2, PPC2_DFP, dfp);

    return spec;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     Visitor *v;

+
+    v = qmp_output_visitor_new(&ret);
+
+    object_property_get(obj, v, name, &local_err);
+
     if (!local_err) {

         visit_complete(v, &ret);

QObject *object_property_get_qobject(Object *obj, const char *name,

                                     Error **errp)

{

    QObject *ret = NULL;

    Error *local_err = NULL;

    Visitor *v;

    v = qmp_output_visitor_new(&ret);

    object_property_get(obj, v, name, &local_err);

    if (!local_err) {

        visit_complete(v, &ret);

    }

    error_propagate(errp, local_err);

    visit_free(v);

    return ret;

}


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

         if (s->bits_per_raw_sample <= 8) {

+            for (x = 0; x < w; x++)
+
+                sample[0][x] = src[x + stride * y];
+
+            encode_line(s, w, sample, plane_index, 8);

         } else {

static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h,

                         int stride, int plane_index)

{

    int x, y, i;

    const int ring_size = s->avctx->context_model ? 3 : 2;

    int16_t *sample[3];

    s->run_index = 0;

    memset(s->sample_buffer, 0, ring_size * (w + 6) * sizeof(*s->sample_buffer));

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

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

            sample[i] = s->sample_buffer + (w + 6) * ((h + i - y) % ring_size) + 3;

        sample[0][-1]= sample[1][0  ];

        sample[1][ w]= sample[1][w-1];

// { START_TIMER

        if (s->bits_per_raw_sample <= 8) {

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

                sample[0][x] = src[x + stride * y];

            encode_line(s, w, sample, plane_index, 8);

        } else {

            if (s->packed_at_lsb) {

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

                    sample[0][x] = ((uint16_t*)(src + stride*y))[x];

                }

            } else {

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

                    sample[0][x] = ((uint16_t*)(src + stride*y))[x] >> (16 - s->bits_per_raw_sample);

                }

            }

            encode_line(s, w, sample, plane_index, s->bits_per_raw_sample);

        }

// STOP_TIMER("encode line") }

    }

}


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

      * with the consequences.

+     */

     enable_mss_facility();

+

     if (dev_info != -1) {

static void virtio_setup(uint64_t dev_info)

{

    struct schib schib;

    int ssid;

    bool found = false;

    uint16_t dev_no;

    /*

     * We unconditionally enable mss support. In every sane configuration,

     * this will succeed; and even if it doesn't, stsch_err() can deal

     * with the consequences.

     */

    enable_mss_facility();

    if (dev_info != -1) {

        dev_no = dev_info & 0xffff;

        debug_print_int("device no. ", dev_no);

        blk_schid.ssid = (dev_info >> 16) & 0x3;

        debug_print_int("ssid ", blk_schid.ssid);

        found = find_dev(&schib, dev_no);

    } else {

        for (ssid = 0; ssid < 0x3; ssid++) {

            blk_schid.ssid = ssid;

            found = find_dev(&schib, -1);

            if (found) {

                break;

            }

        }

    }

    if (!found) {

        virtio_panic("No virtio-blk device found!\n");

    }

    virtio_setup_block(blk_schid);

    if (!virtio_ipl_disk_is_valid()) {

        virtio_panic("No valid hard disk detected.\n");

    }

}


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

 {
+
     stq_raw(t1, t0);

 }

void helper_stq_raw(uint64_t t0, uint64_t t1)

{

    stq_raw(t1, t0);

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     int type = PIXMAN_TYPE_OTHER;

+
+    if (rshift > gshift && gshift > bshift) {
+
+        if (bshift == 0) {
+
             type = PIXMAN_TYPE_ARGB;

         } else {

int qemu_pixman_get_type(int rshift, int gshift, int bshift)

{

    int type = PIXMAN_TYPE_OTHER;

    if (rshift > gshift && gshift > bshift) {

        if (bshift == 0) {

            type = PIXMAN_TYPE_ARGB;

        } else {

#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)

            type = PIXMAN_TYPE_RGBA;

#endif

        }

    } else if (rshift < gshift && gshift < bshift) {

        if (rshift == 0) {

            type = PIXMAN_TYPE_ABGR;

        } else {

#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0, 21, 8)

            type = PIXMAN_TYPE_BGRA;

#endif

        }

    }

    return type;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static FlatRange *address_space_lookup(AddressSpace *as, AddrRange addr)
+
 {

     return bsearch(&addr, as->current_map.ranges, as->current_map.nr,

static FlatRange *address_space_lookup(AddressSpace *as, AddrRange addr)

{

    return bsearch(&addr, as->current_map.ranges, as->current_map.nr,

                   sizeof(FlatRange), cmp_flatrange_addr);

}


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

     }

+
+
+    if ((st_entry & _SEGMENT_ENTRY_FC) && (env->cregs[0] & CR0_EDAT)) {
+
+        /* Decode EDAT1 segment frame absolute address (1MB page) */

         *raddr = (st_entry & 0xfffffffffff00000ULL) | (vaddr & 0xfffff);

static int mmu_translate_segment(CPUS390XState *env, target_ulong vaddr,

                                 uint64_t asc, uint64_t st_entry,

                                 target_ulong *raddr, int *flags, int rw)

{

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

    uint64_t origin, offs, pt_entry;

    if (st_entry & _SEGMENT_ENTRY_RO) {

        *flags &= ~PAGE_WRITE;

    }

    if ((st_entry & _SEGMENT_ENTRY_FC) && (env->cregs[0] & CR0_EDAT)) {

        /* Decode EDAT1 segment frame absolute address (1MB page) */

        *raddr = (st_entry & 0xfffffffffff00000ULL) | (vaddr & 0xfffff);

        PTE_DPRINTF("%s: SEG=0x%" PRIx64 "\n", __func__, st_entry);

        return 0;

    }

    /* Look up 4KB page entry */

    origin = st_entry & _SEGMENT_ENTRY_ORIGIN;

    offs  = (vaddr & VADDR_PX) >> 9;

    pt_entry = ldq_phys(cs->as, origin + offs);

    PTE_DPRINTF("%s: 0x%" PRIx64 " + 0x%" PRIx64 " => 0x%016" PRIx64 "\n",

                __func__, origin, offs, pt_entry);

    return mmu_translate_pte(env, vaddr, asc, pt_entry, raddr, flags, rw);

}


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

     int fd;
+
     void *table;

void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd)

{

    struct kvm_create_spapr_tce args = {

        .liobn = liobn,

        .window_size = window_size,

    };

    long len;

    int fd;

    void *table;

    /* Must set fd to -1 so we don't try to munmap when called for

     * destroying the table, which the upper layers -will- do

     */

    *pfd = -1;

    if (!cap_spapr_tce) {

        return NULL;

    }

    fd = kvm_vm_ioctl(kvm_state, KVM_CREATE_SPAPR_TCE, &args);

    if (fd < 0) {

        fprintf(stderr, "KVM: Failed to create TCE table for liobn 0x%x\n",

                liobn);

        return NULL;

    }

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

    /* FIXME: round this up to page size */

    table = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);

    if (table == MAP_FAILED) {

        fprintf(stderr, "KVM: Failed to map TCE table for liobn 0x%x\n",

                liobn);

        close(fd);

        return NULL;

    }

    *pfd = fd;

    return table;

}


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

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

+    cmd[0] = INQUIRY;
+
+    cmd[4] = sizeof(buf);
+
+

     memset(&io_header, 0, sizeof(io_header));

static int get_device_type(SCSIDiskState *s)

{

    BlockDriverState *bdrv = s->qdev.conf.bs;

    uint8_t cmd[16];

    uint8_t buf[36];

    uint8_t sensebuf[8];

    sg_io_hdr_t io_header;

    int ret;

    memset(cmd, 0, sizeof(cmd));

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

    cmd[0] = INQUIRY;

    cmd[4] = sizeof(buf);

    memset(&io_header, 0, sizeof(io_header));

    io_header.interface_id = 'S';

    io_header.dxfer_direction = SG_DXFER_FROM_DEV;

    io_header.dxfer_len = sizeof(buf);

    io_header.dxferp = buf;

    io_header.cmdp = cmd;

    io_header.cmd_len = sizeof(cmd);

    io_header.mx_sb_len = sizeof(sensebuf);

    io_header.sbp = sensebuf;

    io_header.timeout = 6000; /* XXX */

    ret = bdrv_ioctl(bdrv, SG_IO, &io_header);

    if (ret < 0 || io_header.driver_status || io_header.host_status) {

        return -1;

    }

    s->qdev.type = buf[0];

    if (buf[1] & 0x80) {

        s->features |= 1 << SCSI_DISK_F_REMOVABLE;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,30 +1,30 @@
+static inline int GetCode(GifState * s)
+
+{
+
+    int c, sizbuf;
+
+    uint8_t *ptr;
+
+
+
+    while (s->bbits < s->cursize) {
+
         ptr = s->pbuf;
+
         if (ptr >= s->ebuf) {

+            if (!s->eob_reached) {

+                sizbuf = get_byte(s->f);
+
+                s->ebuf = s->buf + sizbuf;
+
                 s->pbuf = s->buf;
+
+                if (sizbuf > 0) {
+
+                    get_buffer(s->f, s->buf, sizbuf);

                 } else {

static inline int GetCode(GifState * s)

{

    int c, sizbuf;

    uint8_t *ptr;

    while (s->bbits < s->cursize) {

        ptr = s->pbuf;

        if (ptr >= s->ebuf) {

            if (!s->eob_reached) {

                sizbuf = get_byte(s->f);

                s->ebuf = s->buf + sizbuf;

                s->pbuf = s->buf;

                if (sizbuf > 0) {

                    get_buffer(s->f, s->buf, sizbuf);

                } else {

                    s->eob_reached = 1;

                }

            }

            ptr = s->pbuf;

        }

        s->bbuf |= ptr[0] << s->bbits;

        ptr++;

        s->pbuf = ptr;

        s->bbits += 8;

    }

    c = s->bbuf & s->curmask;

    s->bbuf >>= s->cursize;

    s->bbits -= s->cursize;

    return c;

}


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

     gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);
+
 #else

     if (unlikely(ctx->pr)) {

static void gen_slbmte(DisasContext *ctx)

{

#if defined(CONFIG_USER_ONLY)

    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);

#else

    if (unlikely(ctx->pr)) {

        gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG);

        return;

    }

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

                         cpu_gpr[rS(ctx->opcode)]);

#endif

}


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

     test_native_list_integer_helper(data, unused,

+                                    USER_DEF_NATIVE_LIST_UNION_KIND_U16);
+
 }

static void test_visitor_in_native_list_uint16(TestInputVisitorData *data,

                                               const void *unused)

{

    test_native_list_integer_helper(data, unused,

                                    USER_DEF_NATIVE_LIST_UNION_KIND_U16);

}


--- a/source.c
+++ b/source.c
@@ -21,8 +21,8 @@
     DPRINTF("Read TOC (track %d format %d msf %d)\n", start_track, format, msf >> 1);

     nb_sectors /= s->qdev.blocksize / 512;
+
+    switch (format) {

     case 0:

static int scsi_disk_emulate_read_toc(SCSIRequest *req, uint8_t *outbuf)

{

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

    int start_track, format, msf, toclen;

    uint64_t nb_sectors;

    msf = req->cmd.buf[1] & 2;

    format = req->cmd.buf[2] & 0xf;

    start_track = req->cmd.buf[6];

    bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);

    DPRINTF("Read TOC (track %d format %d msf %d)\n", start_track, format, msf >> 1);

    nb_sectors /= s->qdev.blocksize / 512;

    switch (format) {

    case 0:

        toclen = cdrom_read_toc(nb_sectors, outbuf, msf, start_track);

        break;

    case 1:

        /* multi session : only a single session defined */

        toclen = 12;

        memset(outbuf, 0, 12);

        outbuf[1] = 0x0a;

        outbuf[2] = 0x01;

        outbuf[3] = 0x01;

        break;

    case 2:

        toclen = cdrom_read_toc_raw(nb_sectors, outbuf, msf, start_track);

        break;

    default:

        return -1;

    }

    if (toclen > req->cmd.xfer) {

        toclen = req->cmd.xfer;

    }

    return toclen;

}


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

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

static void scsi_dma_complete(void *opaque, int ret)

{

    SCSIDiskReq *r = (SCSIDiskReq *)opaque;

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

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

    if (ret) {

        if (scsi_handle_rw_error(r, -ret)) {

            goto done;

        }

    }

    r->sector += r->sector_count;

    r->sector_count = 0;

    scsi_req_complete(&r->req, GOOD);

done:

    if (!r->req.io_canceled) {

        scsi_req_unref(&r->req);

    }

}


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

     info->qdev.init = spapr_vio_busdev_init;
+
+    info->qdev.bus_info = &spapr_vio_bus_info;
+

     assert(info->qdev.size >= sizeof(VIOsPAPRDevice));

void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info)

{

    info->qdev.init = spapr_vio_busdev_init;

    info->qdev.bus_info = &spapr_vio_bus_info;

    assert(info->qdev.size >= sizeof(VIOsPAPRDevice));

    qdev_register(&info->qdev);

}


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

     size = vde_recv(s->vde, (char *)buf, sizeof(buf), 0);

+    if (size > 0) {
+
+        qemu_send_packet(&s->nc, buf, size);
+
+    }

 }

static void vde_to_qemu(void *opaque)

{

    VDEState *s = opaque;

    uint8_t buf[4096];

    int size;

    size = vde_recv(s->vde, (char *)buf, sizeof(buf), 0);

    if (size > 0) {

        qemu_send_packet(&s->nc, buf, size);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 init_disasm (struct disassemble_info *info)
+
+{

+  const struct s390_opcode *opcode;
+
   const struct s390_opcode *opcode_end;
+
+

   memset (opc_index, 0, sizeof (opc_index));

init_disasm (struct disassemble_info *info)

{

  const struct s390_opcode *opcode;

  const struct s390_opcode *opcode_end;

  memset (opc_index, 0, sizeof (opc_index));

  opcode_end = s390_opcodes + s390_num_opcodes;

  for (opcode = s390_opcodes; opcode < opcode_end; opcode++)

    {

      opc_index[(int) opcode->opcode[0]] = opcode - s390_opcodes;

      while ((opcode < opcode_end) &&

	     (opcode[1].opcode[0] == opcode->opcode[0]))

	opcode++;

    }

#ifdef QEMU_DISABLE

  switch (info->mach)

    {

    case bfd_mach_s390_31:

      current_arch_mask = 1 << S390_OPCODE_ESA;

      break;

    case bfd_mach_s390_64:

      current_arch_mask = 1 << S390_OPCODE_ZARCH;

      break;

    default:

      abort ();

    }

#endif /* QEMU_DISABLE */

  init_flag = 1;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+static __attribute__((unused)) void map_exec(void *addr, long size)
+
+{
+
+    unsigned long start, end, page_size;
+
+
+
+    page_size = getpagesize();

     start = (unsigned long)addr;

static __attribute__((unused)) void map_exec(void *addr, long size)

{

    unsigned long start, end, page_size;

    page_size = getpagesize();

    start = (unsigned long)addr;

    start &= ~(page_size - 1);

    end = (unsigned long)addr + size;

    end += page_size - 1;

    end &= ~(page_size - 1);

    mprotect((void *)start, end - start,

             PROT_READ | PROT_WRITE | PROT_EXEC);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int parse_hex64(DeviceState *dev, Property *prop, const char *str)

+{

     uint64_t *ptr = qdev_get_prop_ptr(dev, prop);

static int parse_hex64(DeviceState *dev, Property *prop, const char *str)

{

    uint64_t *ptr = qdev_get_prop_ptr(dev, prop);

    if (sscanf(str, "%" PRIx64, ptr) != 1)

        return -EINVAL;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void virtio_scsi_common_realize(DeviceState *dev, Error **errp)

 {

@@ -6,10 +6,10 @@

     VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev);

+    int i;
+

+
     virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI,

                 sizeof(VirtIOSCSIConfig));

void virtio_scsi_common_realize(DeviceState *dev, Error **errp)

{

    VirtIODevice *vdev = VIRTIO_DEVICE(dev);

    VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev);

    int i;

    virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI,

                sizeof(VirtIOSCSIConfig));

    s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));

    s->sense_size = VIRTIO_SCSI_SENSE_SIZE;

    s->cdb_size = VIRTIO_SCSI_CDB_SIZE;

    s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,

                                  virtio_scsi_handle_ctrl);

    s->event_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,

                                   virtio_scsi_handle_event);

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

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

                                         virtio_scsi_handle_cmd);

    }

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     CPUWatchpoint *wp_hit = cs->watchpoint_hit;

+
+    if (wp_hit && wp_hit->flags & BP_CPU) {
+
+        /* FIXME: When the storage-alteration-space control bit is set,
+
            the exception should only be triggered if the memory access

            is done using an address space with the storage-alteration-event

void s390x_cpu_debug_excp_handler(CPUState *cs)

{

    S390CPU *cpu = S390_CPU(cs);

    CPUS390XState *env = &cpu->env;

    CPUWatchpoint *wp_hit = cs->watchpoint_hit;

    if (wp_hit && wp_hit->flags & BP_CPU) {

        /* FIXME: When the storage-alteration-space control bit is set,

           the exception should only be triggered if the memory access

           is done using an address space with the storage-alteration-event

           bit set.  We have no way to detect that with the current

           watchpoint code.  */

        cs->watchpoint_hit = NULL;

        env->per_address = env->psw.addr;

        env->per_perc_atmid |= PER_CODE_EVENT_STORE | get_per_atmid(env);

        /* FIXME: We currently no way to detect the address space used

           to trigger the watchpoint.  For now just consider it is the

           current default ASC. This turn to be true except when MVCP

           and MVCS instrutions are not used.  */

        env->per_perc_atmid |= env->psw.mask & (PSW_MASK_ASC) >> 46;

        /* Remove all watchpoints to re-execute the code.  A PER exception

           will be triggered, it will call load_psw which will recompute

           the watchpoints.  */

        cpu_watchpoint_remove_all(cs, BP_CPU);

        cpu_resume_from_signal(cs, NULL);

    }

}


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

+    if (l->has_value) {
+
+        tcg_out_goto(s, cond, l->u.value_ptr);
+
+    } else {

         tcg_out_reloc(s, s->code_ptr, R_ARM_PC24, label_index, 0);

static inline void tcg_out_goto_label(TCGContext *s, int cond, int label_index)

{

    TCGLabel *l = &s->labels[label_index];

    if (l->has_value) {

        tcg_out_goto(s, cond, l->u.value_ptr);

    } else {

        tcg_out_reloc(s, s->code_ptr, R_ARM_PC24, label_index, 0);

        tcg_out_b_noaddr(s, cond);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void * g_malloc0(size_t size)
+
 {

     return g_malloc(size);

void * g_malloc0(size_t size)

{

    return g_malloc(size);

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     f->bytes_xfer++;

     if (f->ops->writev_buffer) {
+
+        add_to_iovec(f, f->buf + f->buf_index, 1);
+
+    }
+
     f->buf_index++;

     if (f->buf_index == IO_BUF_SIZE) {

void qemu_put_byte(QEMUFile *f, int v)

{

    if (f->last_error) {

        return;

    }

    f->buf[f->buf_index] = v;

    f->bytes_xfer++;

    if (f->ops->writev_buffer) {

        add_to_iovec(f, f->buf + f->buf_index, 1);

    }

    f->buf_index++;

    if (f->buf_index == IO_BUF_SIZE) {

        qemu_fflush(f);

    }

}


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

 {

+    int offset = tag == TIFF_YRES ? 2 : 0;

     s->res[offset++] = num;

static void set_sar(TiffContext *s, unsigned tag, unsigned num, unsigned den)

{

    int offset = tag == TIFF_YRES ? 2 : 0;

    s->res[offset++] = num;

    s->res[offset]   = den;

    if (s->res[0] && s->res[1] && s->res[2] && s->res[3])

        av_reduce(&s->avctx->sample_aspect_ratio.num, &s->avctx->sample_aspect_ratio.den,

                  s->res[2] * (uint64_t)s->res[1], s->res[0] * (uint64_t)s->res[3], INT32_MAX);

}


--- a/source.c
+++ b/source.c
@@ -55,9 +55,9 @@
     pkt->flags |= AV_PKT_FLAG_KEY;

     *got_packet = 1;
+
+
+
+    return 0;
+
 }

static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt,

                                const AVFrame *frame, int *got_packet)

{

    DVVideoContext *s = c->priv_data;

    int ret;

    s->sys = avpriv_dv_codec_profile(c);

    if (!s->sys || ff_dv_init_dynamic_tables(s->sys))

        return -1;

    if ((ret = ff_alloc_packet(pkt, s->sys->frame_size)) < 0) {

        av_log(c, AV_LOG_ERROR, "Error getting output packet.\n");

        return ret;

    }

    c->pix_fmt                = s->sys->pix_fmt;

    s->frame                  = frame;

    c->coded_frame->key_frame = 1;

    c->coded_frame->pict_type = AV_PICTURE_TYPE_I;

    s->buf = pkt->data;

    c->execute(c, dv_encode_video_segment, s->sys->work_chunks, NULL,

               dv_work_pool_size(s->sys), sizeof(DVwork_chunk));

    emms_c();

    dv_format_frame(s, pkt->data);

    pkt->flags |= AV_PKT_FLAG_KEY;

    *got_packet = 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+bool memory_region_present(MemoryRegion *container, hwaddr addr)
+
+{
+
     MemoryRegion *mr = memory_region_find(container, addr, 1).mr;
+
+    if (!mr || (mr == container)) {

         return false;

bool memory_region_present(MemoryRegion *container, hwaddr addr)

{

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

    if (!mr || (mr == container)) {

        return false;

    }

    memory_region_unref(mr);

    return true;

}


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

                                 const uint8_t *src, int src_size,

+                                int id, int bpp)

 {

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

                                const uint8_t *src, int src_size,

                                int id, int bpp)

{

    int h;

    uint8_t *dst;

    int ret;

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

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

        return AVERROR_INVALIDDATA;

    }

    avctx->pix_fmt = id;

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

        return ret;

    dst = pic->data[0];

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

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

        src += avctx->width * bpp;

        dst += pic->linesize[0];

    }

    return 0;

}


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

+                  const char *backing_file_str, int64_t speed,

                   BlockdevOnError on_error,

void stream_start(BlockDriverState *bs, BlockDriverState *base,

                  const char *backing_file_str, int64_t speed,

                  BlockdevOnError on_error,

                  BlockCompletionFunc *cb,

                  void *opaque, Error **errp)

{

    StreamBlockJob *s;

    s = block_job_create(&stream_job_driver, bs, speed, cb, opaque, errp);

    if (!s) {

        return;

    }

    s->base = base;

    s->backing_file_str = g_strdup(backing_file_str);

    s->on_error = on_error;

    s->common.co = qemu_coroutine_create(stream_run);

    trace_stream_start(bs, base, s, s->common.co, opaque);

    qemu_coroutine_enter(s->common.co, s);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int v9fs_synth_open2(FsContext *fs_ctx, V9fsPath *dir_path,
+
+                            const char *name, int flags,
+
                             FsCred *credp, V9fsFidOpenState *fs)

 {

static int v9fs_synth_open2(FsContext *fs_ctx, V9fsPath *dir_path,

                            const char *name, int flags,

                            FsCred *credp, V9fsFidOpenState *fs)

{

    errno = ENOSYS;

    return -1;

}


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

         qxl_log_cmd_draw_copy(qxl, &draw->u.copy, group_id);

+        break;
+
+    }
+
+}

static void qxl_log_cmd_draw(PCIQXLDevice *qxl, QXLDrawable *draw, int group_id)

{

    fprintf(stderr, ": surface_id %d type %s effect %s",

            draw->surface_id,

            qxl_name(qxl_draw_type, draw->type),

            qxl_name(qxl_draw_effect, draw->effect));

    switch (draw->type) {

    case QXL_DRAW_COPY:

        qxl_log_cmd_draw_copy(qxl, &draw->u.copy, group_id);

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -49,11 +49,11 @@
         av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);

+
+        /* Store color in palette */
+
+        ctx->clut[color_id] = RGBA(r,g,b,alpha);
+
     }

 }

static void parse_palette_segment(AVCodecContext *avctx,

                                  const uint8_t *buf, int buf_size)

{

    PGSSubContext *ctx = avctx->priv_data;

    const uint8_t *buf_end = buf + buf_size;

    const uint8_t *cm      = ff_crop_tab + MAX_NEG_CROP;

    int color_id;

    int y, cb, cr, alpha;

    int r, g, b, r_add, g_add, b_add;

    /* Skip two null bytes */

    buf += 2;

    while (buf < buf_end) {

        color_id  = bytestream_get_byte(&buf);

        y         = bytestream_get_byte(&buf);

        cr        = bytestream_get_byte(&buf);

        cb        = bytestream_get_byte(&buf);

        alpha     = bytestream_get_byte(&buf);

        YUV_TO_RGB1(cb, cr);

        YUV_TO_RGB2(r, g, b, y);

        av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);

        /* Store color in palette */

        ctx->clut[color_id] = RGBA(r,g,b,alpha);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+void qpci_io_writel(QPCIDevice *dev, void *data, uint32_t value)
+
+{
+
     uintptr_t addr = (uintptr_t)data;

+

     if (addr < QPCI_PIO_LIMIT) {

void qpci_io_writel(QPCIDevice *dev, void *data, uint32_t value)

{

    uintptr_t addr = (uintptr_t)data;

    if (addr < QPCI_PIO_LIMIT) {

        dev->bus->pio_writel(dev->bus, addr, value);

    } else {

        value = cpu_to_le32(value);

        dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));

    }

}


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

         error_report("Failed to write16 data to iSCSI lun. %s",

+                     iscsi_get_error(iscsi));
+
+        acb->status = -EIO;
+
+    }

iscsi_aio_write16_cb(struct iscsi_context *iscsi, int status,

                     void *command_data, void *opaque)

{

    IscsiAIOCB *acb = opaque;

    trace_iscsi_aio_write16_cb(iscsi, status, acb, acb->canceled);

    g_free(acb->buf);

    acb->buf = NULL;

    if (acb->canceled != 0) {

        return;

    }

    acb->status = 0;

    if (status < 0) {

        error_report("Failed to write16 data to iSCSI lun. %s",

                     iscsi_get_error(iscsi));

        acb->status = -EIO;

    }

    iscsi_schedule_bh(acb);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void test_reconnect(void)
+
+{
+
     gchar *path = g_strdup_printf("/%s/vhost-user/reconnect/subprocess",

                                   qtest_get_arch());

static void test_reconnect(void)

{

    gchar *path = g_strdup_printf("/%s/vhost-user/reconnect/subprocess",

                                  qtest_get_arch());

    g_test_trap_subprocess(path, 0, 0);

    g_test_trap_assert_passed();

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     idx = s->nb_globals;

     tcg_temp_alloc(s, s->nb_globals + 1);
+
+    ts = &s->temps[s->nb_globals];
+
+    ts->base_type = type;
+
     ts->type = type;

     ts->fixed_reg = 1;

static inline int tcg_global_reg_new_internal(TCGType type, int reg,

                                              const char *name)

{

    TCGContext *s = &tcg_ctx;

    TCGTemp *ts;

    int idx;

#if TCG_TARGET_REG_BITS == 32

    if (type != TCG_TYPE_I32)

        tcg_abort();

#endif

    if (tcg_regset_test_reg(s->reserved_regs, reg))

        tcg_abort();

    idx = s->nb_globals;

    tcg_temp_alloc(s, s->nb_globals + 1);

    ts = &s->temps[s->nb_globals];

    ts->base_type = type;

    ts->type = type;

    ts->fixed_reg = 1;

    ts->reg = reg;

    ts->name = name;

    s->nb_globals++;

    tcg_regset_set_reg(s->reserved_regs, reg);

    return idx;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void clone_slice(H264Context *dst, H264Context *src)

 {

static void clone_slice(H264Context *dst, H264Context *src)

{

    memcpy(dst->block_offset, src->block_offset, sizeof(dst->block_offset));

    dst->s.current_picture_ptr = src->s.current_picture_ptr;

    dst->s.current_picture     = src->s.current_picture;

    dst->s.linesize            = src->s.linesize;

    dst->s.uvlinesize          = src->s.uvlinesize;

    dst->s.first_field         = src->s.first_field;

    dst->prev_poc_msb          = src->prev_poc_msb;

    dst->prev_poc_lsb          = src->prev_poc_lsb;

    dst->prev_frame_num_offset = src->prev_frame_num_offset;

    dst->prev_frame_num        = src->prev_frame_num;

    dst->short_ref_count       = src->short_ref_count;

    memcpy(dst->short_ref,        src->short_ref,        sizeof(dst->short_ref));

    memcpy(dst->long_ref,         src->long_ref,         sizeof(dst->long_ref));

    memcpy(dst->default_ref_list, src->default_ref_list, sizeof(dst->default_ref_list));

    memcpy(dst->ref_list,         src->ref_list,         sizeof(dst->ref_list));

    memcpy(dst->dequant4_coeff,   src->dequant4_coeff,   sizeof(src->dequant4_coeff));

    memcpy(dst->dequant8_coeff,   src->dequant8_coeff,   sizeof(src->dequant8_coeff));

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
      * driver that it needs to copy the buffer.

      */
+
+    if ((bs->open_flags & BDRV_O_NOCACHE)) {
+
+        if (!qiov_is_aligned(bs, qiov)) {
+
             type |= QEMU_AIO_MISALIGNED;

 #ifdef CONFIG_LINUX_AIO

static BlockDriverAIOCB *raw_aio_submit(BlockDriverState *bs,

        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,

        BlockDriverCompletionFunc *cb, void *opaque, int type)

{

    BDRVRawState *s = bs->opaque;

    if (fd_open(bs) < 0)

        return NULL;

    /*

     * If O_DIRECT is used the buffer needs to be aligned on a sector

     * boundary.  Check if this is the case or tell the low-level

     * driver that it needs to copy the buffer.

     */

    if ((bs->open_flags & BDRV_O_NOCACHE)) {

        if (!qiov_is_aligned(bs, qiov)) {

            type |= QEMU_AIO_MISALIGNED;

#ifdef CONFIG_LINUX_AIO

        } else if (s->use_aio) {

            return laio_submit(bs, s->aio_ctx, s->fd, sector_num, qiov,

                               nb_sectors, cb, opaque, type);

#endif

        }

    }

    return paio_submit(bs, s->fd, sector_num, qiov, nb_sectors,

                       cb, opaque, type);

}


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

     target_phys_addr_t start = s->regs[GT_ISD] << 21;
+
+    target_phys_addr_t length = 0x1000;
+
+
+
     if (s->ISD_length) {

         memory_region_del_subregion(get_system_memory(), &s->ISD_mem);

static void gt64120_isd_mapping(GT64120State *s)

{

    target_phys_addr_t start = s->regs[GT_ISD] << 21;

    target_phys_addr_t length = 0x1000;

    if (s->ISD_length) {

        memory_region_del_subregion(get_system_memory(), &s->ISD_mem);

    }

    check_reserved_space(&start, &length);

    length = 0x1000;

    /* Map new address */

    DPRINTF("ISD: "TARGET_FMT_plx"@"TARGET_FMT_plx

        " -> "TARGET_FMT_plx"@"TARGET_FMT_plx"\n",

        s->ISD_length, s->ISD_start, length, start);

    s->ISD_start = start;

    s->ISD_length = length;

    memory_region_add_subregion(get_system_memory(), s->ISD_start, &s->ISD_mem);

}


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

     } else if (vs->csock != -1) {

+        qemu_set_fd_handler(vs->csock, vnc_client_read, NULL, vs);
+
+    }
+
+    vnc_unlock_output(vs);

 }

void vnc_client_write(void *opaque)

{

    VncState *vs = opaque;

    vnc_lock_output(vs);

    if (vs->output.offset

#ifdef CONFIG_VNC_WS

            || vs->ws_output.offset

#endif

            ) {

        vnc_client_write_locked(opaque);

    } else if (vs->csock != -1) {

        qemu_set_fd_handler(vs->csock, vnc_client_read, NULL, vs);

    }

    vnc_unlock_output(vs);

}


--- a/source.c
+++ b/source.c
@@ -43,11 +43,11 @@
         virtio_blk_init_request(s, virtio_get_queue(vdev, vq_idx), req);

         req->next = s->rq;
+
+        s->rq = req;
+
+    }
+

     return 0;

static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f,

                                  int version_id)

{

    VirtIOBlock *s = VIRTIO_BLK(vdev);

    while (qemu_get_sbyte(f)) {

        unsigned nvqs = s->conf.num_queues;

        unsigned vq_idx = 0;

        VirtIOBlockReq *req;

        if (nvqs > 1) {

            vq_idx = qemu_get_be32(f);

            if (vq_idx >= nvqs) {

                error_report("Invalid virtqueue index in request list: %#x",

                             vq_idx);

                return -EINVAL;

            }

        }

        req = qemu_get_virtqueue_element(f, sizeof(VirtIOBlockReq));

        virtio_blk_init_request(s, virtio_get_queue(vdev, vq_idx), req);

        req->next = s->rq;

        s->rq = req;

    }

    return 0;

}


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

 {

+    int64_t delta;
+
+    int64_t rtdelta;
+
+

     if (use_icount)

static uint64_t qemu_next_deadline_dyntick(void)

{

    int64_t delta;

    int64_t rtdelta;

    if (use_icount)

        delta = INT32_MAX;

    else

        delta = (qemu_next_deadline() + 999) / 1000;

    if (active_timers[QEMU_TIMER_REALTIME]) {

        rtdelta = (active_timers[QEMU_TIMER_REALTIME]->expire_time -

                 qemu_get_clock(rt_clock))*1000;

        if (rtdelta < delta)

            delta = rtdelta;

    }

    if (delta < MIN_TIMER_REARM_US)

        delta = MIN_TIMER_REARM_US;

    return delta;

}


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

     scc->parent_reset(s);

+    cpu->env.sigp_order = 0;
+
+    s390_cpu_set_state(CPU_STATE_STOPPED, cpu);
+
+

     memset(env, 0, offsetof(CPUS390XState, end_reset_fields));

static void s390_cpu_full_reset(CPUState *s)

{

    S390CPU *cpu = S390_CPU(s);

    S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);

    CPUS390XState *env = &cpu->env;

    int i;

    scc->parent_reset(s);

    cpu->env.sigp_order = 0;

    s390_cpu_set_state(CPU_STATE_STOPPED, cpu);

    memset(env, 0, offsetof(CPUS390XState, end_reset_fields));

    /* architectured initial values for CR 0 and 14 */

    env->cregs[0] = CR0_RESET;

    env->cregs[14] = CR14_RESET;

    /* architectured initial value for Breaking-Event-Address register */

    env->gbea = 1;

    env->pfault_token = -1UL;

    env->ext_index = -1;

    for (i = 0; i < ARRAY_SIZE(env->io_index); i++) {

        env->io_index[i] = -1;

    }

    env->mchk_index = -1;

    /* tininess for underflow is detected before rounding */

    set_float_detect_tininess(float_tininess_before_rounding,

                              &env->fpu_status);

    /* Reset state inside the kernel that we cannot access yet from QEMU. */

    if (kvm_enabled()) {

        kvm_s390_reset_vcpu(cpu);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame,
+
                                                             int perms)

 {

AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame,

                                                            int perms)

{

    AVFilterBufferRef *samplesref =

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

                                                  frame->nb_samples, frame->format,

                                                  av_frame_get_channel_layout(frame));

    if (!samplesref)

        return NULL;

    if (avfilter_copy_frame_props(samplesref, frame) < 0) {

        samplesref->buf->data[0] = NULL;

        avfilter_unref_bufferp(&samplesref);

    }

    return samplesref;

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
     tcg_gen_shr_tl(t3, t3, t1);

     tcg_gen_xor_tl(cpu_gpr[rA(ctx->opcode)], t2, t3);
+
+    tcg_gen_brcond_tl(TCG_COND_GE, t0, t1, l1);
+
+    tcg_gen_neg_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
+
     gen_set_label(l1);

     tcg_temp_free(t0);

static void gen_maskg(DisasContext *ctx)

{

    int l1 = gen_new_label();

    TCGv t0 = tcg_temp_new();

    TCGv t1 = tcg_temp_new();

    TCGv t2 = tcg_temp_new();

    TCGv t3 = tcg_temp_new();

    tcg_gen_movi_tl(t3, 0xFFFFFFFF);

    tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x1F);

    tcg_gen_andi_tl(t1, cpu_gpr[rS(ctx->opcode)], 0x1F);

    tcg_gen_addi_tl(t2, t0, 1);

    tcg_gen_shr_tl(t2, t3, t2);

    tcg_gen_shr_tl(t3, t3, t1);

    tcg_gen_xor_tl(cpu_gpr[rA(ctx->opcode)], t2, t3);

    tcg_gen_brcond_tl(TCG_COND_GE, t0, t1, l1);

    tcg_gen_neg_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);

    gen_set_label(l1);

    tcg_temp_free(t0);

    tcg_temp_free(t1);

    tcg_temp_free(t2);

    tcg_temp_free(t3);

    if (unlikely(Rc(ctx->opcode) != 0))

        gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]);

}


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

     fbptr = (uint32_t *)(vd->server->data + y * ds_get_linesize(vs->ds) +

+                         x * ds_get_bytes_per_pixel(vs->ds));
+
+
+
+    while (count--) {

         pix = *fbptr++;

static void jpeg_prepare_row24(VncState *vs, uint8_t *dst, int x, int y,

                                     int count)

{

    VncDisplay *vd = vs->vd;

    uint32_t *fbptr;

    uint32_t pix;

    fbptr = (uint32_t *)(vd->server->data + y * ds_get_linesize(vs->ds) +

                         x * ds_get_bytes_per_pixel(vs->ds));

    while (count--) {

        pix = *fbptr++;

        *dst++ = (uint8_t)(pix >> vs->ds->surface->pf.rshift);

        *dst++ = (uint8_t)(pix >> vs->ds->surface->pf.gshift);

        *dst++ = (uint8_t)(pix >> vs->ds->surface->pf.bshift);

    }

}


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

         return;

+    }
+
+    dev->attached++;
+
+

     port = TAILQ_FIRST(&bus->free);

static void do_attach(USBDevice *dev)

{

    USBBus *bus = usb_bus_from_device(dev);

    USBPort *port;

    if (dev->attached) {

        fprintf(stderr, "Warning: tried to attach usb device %s twice\n",

                dev->devname);

        return;

    }

    dev->attached++;

    port = TAILQ_FIRST(&bus->free);

    TAILQ_REMOVE(&bus->free, port, next);

    bus->nfree--;

    usb_attach(port, dev);

    TAILQ_INSERT_TAIL(&bus->used, port, next);

    bus->nused++;

}


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

+    env = cpu_single_env;
+
+    if (!env)
+
         return 0;

     return env->eflags & (IF_MASK | IOPL_MASK);

static uint32_t qpi_mem_readl(void *opaque, target_phys_addr_t addr)

{

    CPUState *env;

    env = cpu_single_env;

    if (!env)

        return 0;

    return env->eflags & (IF_MASK | IOPL_MASK);

}


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

     if (!s->in_len) {

+        ret = USB_RET_NAK;
+
+        return ret;
+
+    }

     ret = s->in_len - s->in_ptr;

static int usb_net_handle_datain(USBNetState *s, USBPacket *p)

{

    int ret = USB_RET_NAK;

    if (s->in_ptr > s->in_len) {

        s->in_ptr = s->in_len = 0;

        ret = USB_RET_NAK;

        return ret;

    }

    if (!s->in_len) {

        ret = USB_RET_NAK;

        return ret;

    }

    ret = s->in_len - s->in_ptr;

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

        ret = p->iov.size;

    }

    usb_packet_copy(p, &s->in_buf[s->in_ptr], ret);

    s->in_ptr += ret;

    if (s->in_ptr >= s->in_len &&

                    (is_rndis(s) || (s->in_len & (64 - 1)) || !ret)) {

        /* no short packet necessary */

        s->in_ptr = s->in_len = 0;

    }

#ifdef TRAFFIC_DEBUG

    fprintf(stderr, "usbnet: data in len %zu return %d", p->iov.size, ret);

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

#endif

    return ret;

}


static void xenfb_copy_mfns(int mode, int count, unsigned long *dst, void *src)

{

    uint32_t *src32 = src;

    uint64_t *src64 = src;

    int i;

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

	dst[i] = (mode == 32) ? src32[i] : src64[i];

}


--- a/source.c
+++ b/source.c
@@ -1,16 +1,16 @@
 static int check_protocol_support(bool *has_ipv4, bool *has_ipv6)
+
+{
+
+    struct sockaddr_in sin = {
+
+        .sin_family = AF_INET,
+
         .sin_addr = { .s_addr = htonl(INADDR_LOOPBACK) },
+
     };

+    struct sockaddr_in6 sin6 = {

         .sin6_family = AF_INET6,

static int check_protocol_support(bool *has_ipv4, bool *has_ipv6)

{

    struct sockaddr_in sin = {

        .sin_family = AF_INET,

        .sin_addr = { .s_addr = htonl(INADDR_LOOPBACK) },

    };

    struct sockaddr_in6 sin6 = {

        .sin6_family = AF_INET6,

        .sin6_addr = IN6ADDR_LOOPBACK_INIT,

    };

    if (check_bind((struct sockaddr *)&sin, sizeof(sin), has_ipv4) < 0) {

        return -1;

    }

    if (check_bind((struct sockaddr *)&sin6, sizeof(sin6), has_ipv6) < 0) {

        return -1;

    }

    return 0;

}


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

     } else {

+        h->s.dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta);
+
+    }
+
+}

static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) {

    int i, d;

    const int index_a = qp + h->slice_alpha_c0_offset;

    const int alpha = (alpha_table+52)[index_a];

    const int beta  = (beta_table+52)[qp + h->slice_beta_offset];

    const int pix_next  = stride;

    if( bS[0] < 4 ) {

        int8_t tc[4];

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

            tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] : -1;

        h->s.dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc);

    } else {

        h->s.dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta);

    }

}


--- a/source.c
+++ b/source.c
@@ -4,11 +4,11 @@
     uint16_t (*buffer)[4];
     int left[4], top[4], topleft[4];
     const int linesize = s->linesize[0];
+    const int mask     = (1 << s->bits) - 1;
+    int resync_mb_y = 0;
+    int resync_mb_x = 0;
+    s->restart_count = s->restart_interval;
+    av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size,
                    (unsigned)s->mb_width * 4 * sizeof(s->ljpeg_buffer[0][0]));
     buffer = s->ljpeg_buffer;
     for (i = 0; i < 4; i++)

static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int predictor, int point_transform)
{
    int i, mb_x, mb_y;
    uint16_t (*buffer)[4];
    int left[4], top[4], topleft[4];
    const int linesize = s->linesize[0];
    const int mask     = (1 << s->bits) - 1;
    int resync_mb_y = 0;
    int resync_mb_x = 0;
    s->restart_count = s->restart_interval;
    av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size,
                   (unsigned)s->mb_width * 4 * sizeof(s->ljpeg_buffer[0][0]));
    buffer = s->ljpeg_buffer;
    for (i = 0; i < 4; i++)
        buffer[0][i] = 1 << (s->bits - 1);
    for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
        uint8_t *ptr = s->picture.data[0] + (linesize * mb_y);
        if (s->interlaced && s->bottom_field)
            ptr += linesize >> 1;
        for (i = 0; i < 4; i++)
            top[i] = left[i] = topleft[i] = buffer[0][i];
        for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
            int modified_predictor = predictor;
            if (s->restart_interval && !s->restart_count){
                s->restart_count = s->restart_interval;
                resync_mb_x = mb_x;
                resync_mb_y = mb_y;
                for(i=0; i<4; i++)
                    top[i] = left[i]= topleft[i]= 1 << (s->bits - 1);
            }
            if (mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x || !mb_x)
                modified_predictor = 1;
            for (i=0;i<nb_components;i++) {
                int pred, dc;
                topleft[i] = top[i];
                top[i]     = buffer[mb_x][i];
                PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
                dc = mjpeg_decode_dc(s, s->dc_index[i]);
                if(dc == 0xFFFF)
                    return -1;
                left[i] = buffer[mb_x][i] =
                    mask & (pred + (dc << point_transform));
            }
            if (s->restart_interval && !--s->restart_count) {
                align_get_bits(&s->gb);
                skip_bits(&s->gb, 16); /* skip RSTn */
            }
        }
        if (s->nb_components == 4) {
            for(i=0; i<nb_components; i++) {
                int c= s->comp_index[i];
                for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
                    ptr[4*mb_x+3-c] = buffer[mb_x][i];
                }
            }
        } else if (s->rct) {
            for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
                ptr[3*mb_x + 1] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2] - 0x200) >> 2);
                ptr[3*mb_x + 0] = buffer[mb_x][1] + ptr[3*mb_x + 1];
                ptr[3*mb_x + 2] = buffer[mb_x][2] + ptr[3*mb_x + 1];
            }
        } else if (s->pegasus_rct) {
            for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
                ptr[3*mb_x + 1] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2]) >> 2);
                ptr[3*mb_x + 0] = buffer[mb_x][1] + ptr[3*mb_x + 1];
                ptr[3*mb_x + 2] = buffer[mb_x][2] + ptr[3*mb_x + 1];
            }
        } else {
            for(i=0; i<nb_components; i++) {
                int c= s->comp_index[i];
                for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
                    ptr[3*mb_x+2-c] = buffer[mb_x][i];
                }
            }
        }
    }
    return 0;
}


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

     Q35PCIHost *s = Q35_HOST_DEVICE(obj);
+
+    uint32_t value = s->mch.pci_hole.begin;
+
+

     visit_type_uint32(v, name, &value, errp);

static void q35_host_get_pci_hole_start(Object *obj, Visitor *v,

                                        const char *name, void *opaque,

                                        Error **errp)

{

    Q35PCIHost *s = Q35_HOST_DEVICE(obj);

    uint32_t value = s->mch.pci_hole.begin;

    visit_type_uint32(v, name, &value, errp);

}


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

{

#if COMPILE_TEMPLATE_MMX

    __asm__ volatile(

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

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

        "1:                                         \n\t"

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

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

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

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

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

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

        "psrlw                  $8, %%mm0           \n\t"

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

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

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

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

        "movd                %%mm1, (%2, %%"REG_a") \n\t"

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

        " js                    1b                  \n\t"

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

        : "%"REG_a

    );

#else

    int i;

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

        dstU[i]= src1[4*i + 0];

        dstV[i]= src1[4*i + 2];

    }

#endif

    assert(src1 == src2);

}


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

     FrameDecodeData *fdd;
+
+    NVDECFrame *cf;
+
+
+
     if (!frame || !frame->private_ref)

         return -1;

static int get_ref_idx(AVFrame *frame)

{

    FrameDecodeData *fdd;

    NVDECFrame *cf;

    if (!frame || !frame->private_ref)

        return -1;

    fdd = (FrameDecodeData*)frame->private_ref->data;

    cf  = (NVDECFrame*)fdd->hwaccel_priv;

    return cf->idx;

}


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

 {

+    OpenPICState *opp = opaque;

     uint64_t r = 0;

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

{

    OpenPICState *opp = opaque;

    uint64_t r = 0;

    int i, srs;

    DPRINTF("%s: addr " TARGET_FMT_plx "\n", __func__, addr);

    if (addr & 0xF) {

        return -1;

    }

    srs = addr >> 4;

    switch (addr) {

    case 0x00:

    case 0x10:

    case 0x20:

    case 0x30:

    case 0x40:

    case 0x50:

    case 0x60:

    case 0x70: /* MSIRs */

        r = opp->msi[srs].msir;

        /* Clear on read */

        opp->msi[srs].msir = 0;

        break;

    case 0x120: /* MSISR */

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

            r |= (opp->msi[i].msir ? 1 : 0) << i;

        }

        break;

    }

    return r;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     DB_PRINT("realized spips\n");

+
+    s->spi = g_new(SSIBus *, s->num_busses);
+
+    for (i = 0; i < s->num_busses; ++i) {
+
         char bus_name[16];

         snprintf(bus_name, 16, "spi%d", i);

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

{

    XilinxSPIPS *s = XILINX_SPIPS(dev);

    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);

    XilinxSPIPSClass *xsc = XILINX_SPIPS_GET_CLASS(s);

    int i;

    DB_PRINT("realized spips\n");

    s->spi = g_new(SSIBus *, s->num_busses);

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

        char bus_name[16];

        snprintf(bus_name, 16, "spi%d", i);

        s->spi[i] = ssi_create_bus(dev, bus_name);

    }

    s->cs_lines = g_new0(qemu_irq, s->num_cs * s->num_busses);

    ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[0]);

    ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[1]);

    sysbus_init_irq(sbd, &s->irq);

    for (i = 0; i < s->num_cs * s->num_busses; ++i) {

        sysbus_init_irq(sbd, &s->cs_lines[i]);

    }

    memory_region_init_io(&s->iomem, &spips_ops, s, "spi", R_MAX*4);

    sysbus_init_mmio(sbd, &s->iomem);

    s->irqline = -1;

    fifo8_create(&s->rx_fifo, xsc->rx_fifo_size);

    fifo8_create(&s->tx_fifo, xsc->tx_fifo_size);

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     memset(ps->delay+top, 0, (NR_BANDS[is34] - top)*sizeof(ps->delay[0]));

     if (top < NR_ALLPASS_BANDS[is34])
+
+        memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0]));
+
+
+
     hybrid_analysis(Lbuf, ps->in_buf, L, is34, len);

     decorrelation(ps, Rbuf, Lbuf, is34);

int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top)

{

    float Lbuf[91][32][2];

    float Rbuf[91][32][2];

    const int len = 32;

    int is34 = ps->is34bands;

    top += NR_BANDS[is34] - 64;

    memset(ps->delay+top, 0, (NR_BANDS[is34] - top)*sizeof(ps->delay[0]));

    if (top < NR_ALLPASS_BANDS[is34])

        memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0]));

    hybrid_analysis(Lbuf, ps->in_buf, L, is34, len);

    decorrelation(ps, Rbuf, Lbuf, is34);

    stereo_processing(ps, Lbuf, Rbuf, is34);

    hybrid_synthesis(L, Lbuf, is34, len);

    hybrid_synthesis(R, Rbuf, is34, len);

    return 0;

}


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

     return set_boot_dev(opaque, boot_device);
+
 }

static int pc_boot_set(void *opaque, const char *boot_device)

{

    return set_boot_dev(opaque, boot_device);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void spr_read_tbl(DisasContext *ctx, int gprn, int sprn)
+
 {

     if (ctx->tb->cflags & CF_USE_ICOUNT) {

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

{

    if (ctx->tb->cflags & CF_USE_ICOUNT) {

        gen_io_start();

    }

    gen_helper_load_tbl(cpu_gpr[gprn], cpu_env);

    if (ctx->tb->cflags & CF_USE_ICOUNT) {

        gen_io_end();

        gen_stop_exception(ctx);

    }

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);

     qemu_set_fd_handler(s->fd, NULL, NULL, NULL);
+
+    close(s->fd);

 }

static void net_socket_cleanup(NetClientState *nc)

{

    NetSocketState *s = DO_UPCAST(NetSocketState, nc, nc);

    qemu_set_fd_handler(s->fd, NULL, NULL, NULL);

    close(s->fd);

}


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

     return bs->enable_write_cache;

+}

int bdrv_enable_write_cache(BlockDriverState *bs)

{

    return bs->enable_write_cache;

}


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

+    /* Get the next frame pts/duration */
+
+    ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,
+
+                       &avpkt->duration);

static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,

                             const AVFrame *frame, int *got_packet_ptr)

{

    FaacAudioContext *s = avctx->priv_data;

    int bytes_written, ret;

    int num_samples  = frame ? frame->nb_samples : 0;

    void *samples    = frame ? frame->data[0]    : NULL;

    if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels))) {

        av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");

        return ret;

    }

    bytes_written = faacEncEncode(s->faac_handle, samples,

                                  num_samples * avctx->channels,

                                  avpkt->data, avpkt->size);

    if (bytes_written < 0) {

        av_log(avctx, AV_LOG_ERROR, "faacEncEncode() error\n");

        return bytes_written;

    }

    /* add current frame to the queue */

    if (frame) {

        if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)

            return ret;

    }

    if (!bytes_written)

        return 0;

    /* Get the next frame pts/duration */

    ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts,

                       &avpkt->duration);

    avpkt->size = bytes_written;

    *got_packet_ptr = 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static inline void upmix_mono_to_stereo(AC3DecodeContext *ctx)
+
+{

     int i;

static inline void upmix_mono_to_stereo(AC3DecodeContext *ctx)

{

    int i;

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

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

        output[2][i] = output[1][i];

}


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

         .dev = dev,

+        .type = PCI_REQ_ID_BDF,
+
+    };
+
+

     while (!pci_bus_is_root(dev->bus)) {

static PCIReqIDCache pci_req_id_cache_get(PCIDevice *dev)

{

    PCIDevice *parent;

    PCIReqIDCache cache = {

        .dev = dev,

        .type = PCI_REQ_ID_BDF,

    };

    while (!pci_bus_is_root(dev->bus)) {

        /* We are under PCI/PCIe bridges */

        parent = dev->bus->parent_dev;

        if (pci_is_express(parent)) {

            if (pcie_cap_get_type(parent) == PCI_EXP_TYPE_PCI_BRIDGE) {

                /* When we pass through PCIe-to-PCI/PCIX bridges, we

                 * override the requester ID using secondary bus

                 * number of parent bridge with zeroed devfn

                 * (pcie-to-pci bridge spec chap 2.3). */

                cache.type = PCI_REQ_ID_SECONDARY_BUS;

                cache.dev = dev;

            }

        } else {

            /* Legacy PCI, override requester ID with the bridge's

             * BDF upstream.  When the root complex connects to

             * legacy PCI devices (including buses), it can only

             * obtain requester ID info from directly attached

             * devices.  If devices are attached under bridges, only

             * the requester ID of the bridge that is directly

             * attached to the root complex can be recognized. */

            cache.type = PCI_REQ_ID_BDF;

            cache.dev = parent;

        }

        dev = parent;

    }

    return cache;

}


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

     MERGE(i_tex_bits);

+    MERGE(p_tex_bits);
+
+    MERGE(i_count);

     MERGE(f_count);

static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src){

    int i;

    MERGE(dct_count[0]); //note, the other dct vars are not part of the context

    MERGE(dct_count[1]);

    MERGE(mv_bits);

    MERGE(i_tex_bits);

    MERGE(p_tex_bits);

    MERGE(i_count);

    MERGE(f_count);

    MERGE(b_count);

    MERGE(skip_count);

    MERGE(misc_bits);

    MERGE(er.error_count);

    MERGE(padding_bug_score);

    MERGE(current_picture.f->error[0]);

    MERGE(current_picture.f->error[1]);

    MERGE(current_picture.f->error[2]);

    if(dst->avctx->noise_reduction){

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

            MERGE(dct_error_sum[0][i]);

            MERGE(dct_error_sum[1][i]);

        }

    }

    assert(put_bits_count(&src->pb) % 8 ==0);

    assert(put_bits_count(&dst->pb) % 8 ==0);

    avpriv_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb));

    flush_put_bits(&dst->pb);

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     int endian = s->dump_info.d_endian;

+
+    memset(&phdr, 0, sizeof(Elf64_Phdr));
+
+    phdr.p_type = cpu_convert_to_target32(PT_LOAD, endian);
+
     phdr.p_offset = cpu_convert_to_target64(offset, endian);

     phdr.p_paddr = cpu_convert_to_target64(memory_mapping->phys_addr, endian);

static int write_elf64_load(DumpState *s, MemoryMapping *memory_mapping,

                            int phdr_index, hwaddr offset)

{

    Elf64_Phdr phdr;

    int ret;

    int endian = s->dump_info.d_endian;

    memset(&phdr, 0, sizeof(Elf64_Phdr));

    phdr.p_type = cpu_convert_to_target32(PT_LOAD, endian);

    phdr.p_offset = cpu_convert_to_target64(offset, endian);

    phdr.p_paddr = cpu_convert_to_target64(memory_mapping->phys_addr, endian);

    if (offset == -1) {

        /* When the memory is not stored into vmcore, offset will be -1 */

        phdr.p_filesz = 0;

    } else {

        phdr.p_filesz = cpu_convert_to_target64(memory_mapping->length, endian);

    }

    phdr.p_memsz = cpu_convert_to_target64(memory_mapping->length, endian);

    phdr.p_vaddr = cpu_convert_to_target64(memory_mapping->virt_addr, endian);

    ret = fd_write_vmcore(&phdr, sizeof(Elf64_Phdr), s);

    if (ret < 0) {

        dump_error(s, "dump: failed to write program header table.\n");

        return -1;

    }

    return 0;

}


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

+    nc = qemu_find_netdev(id);

     if (!nc) {

void qmp_netdev_del(const char *id, Error **errp)

{

    NetClientState *nc;

    nc = qemu_find_netdev(id);

    if (!nc) {

        error_set(errp, QERR_DEVICE_NOT_FOUND, id);

        return;

    }

    qemu_del_net_client(nc);

    qemu_opts_del(qemu_opts_find(qemu_find_opts_err("netdev", errp), id));

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     qemu_chr_delete(dev->cs);

+    /* Note must be done after qemu_chr_close, as that causes a close event */
+
+    qemu_bh_delete(dev->chardev_close_bh);
+
+

     qemu_del_timer(dev->attach_timer);

static void usbredir_handle_destroy(USBDevice *udev)

{

    USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);

    qemu_chr_delete(dev->cs);

    /* Note must be done after qemu_chr_close, as that causes a close event */

    qemu_bh_delete(dev->chardev_close_bh);

    qemu_del_timer(dev->attach_timer);

    qemu_free_timer(dev->attach_timer);

    usbredir_cleanup_device_queues(dev);

    if (dev->parser) {

        usbredirparser_destroy(dev->parser);

    }

    if (dev->watch) {

        g_source_remove(dev->watch);

    }

    free(dev->filter_rules);

}


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

         if (!logfile) {

+            perror(logfilename);

             _exit(1);

void cpu_set_log(int log_flags)

{

    loglevel = log_flags;

    if (loglevel && !logfile) {

        logfile = fopen(logfilename, log_append ? "a" : "w");

        if (!logfile) {

            perror(logfilename);

            _exit(1);

        }

#if !defined(CONFIG_SOFTMMU)

        /* must avoid mmap() usage of glibc by setting a buffer "by hand" */

        {

            static char logfile_buf[4096];

            setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));

        }

#elif !defined(_WIN32)

        /* Win32 doesn't support line-buffering and requires size >= 2 */

        setvbuf(logfile, NULL, _IOLBF, 0);

#endif

        log_append = 1;

    }

    if (!loglevel && logfile) {

        fclose(logfile);

        logfile = NULL;

    }

}


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

         cpu_fprintf(f, "BROKEN: LO=0x" TARGET_FMT_lx "\n", env->active_tc.LO[0]);

+    if (!SIGN_EXT_P(env->btarget))
+
+        cpu_fprintf(f, "BROKEN: btarget=0x" TARGET_FMT_lx "\n", env->btarget);
+
+

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

cpu_mips_check_sign_extensions (CPUState *env, FILE *f,

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

                                int flags)

{

    int i;

    if (!SIGN_EXT_P(env->active_tc.PC))

        cpu_fprintf(f, "BROKEN: pc=0x" TARGET_FMT_lx "\n", env->active_tc.PC);

    if (!SIGN_EXT_P(env->active_tc.HI[0]))

        cpu_fprintf(f, "BROKEN: HI=0x" TARGET_FMT_lx "\n", env->active_tc.HI[0]);

    if (!SIGN_EXT_P(env->active_tc.LO[0]))

        cpu_fprintf(f, "BROKEN: LO=0x" TARGET_FMT_lx "\n", env->active_tc.LO[0]);

    if (!SIGN_EXT_P(env->btarget))

        cpu_fprintf(f, "BROKEN: btarget=0x" TARGET_FMT_lx "\n", env->btarget);

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

        if (!SIGN_EXT_P(env->active_tc.gpr[i]))

            cpu_fprintf(f, "BROKEN: %s=0x" TARGET_FMT_lx "\n", regnames[i], env->active_tc.gpr[i]);

    }

    if (!SIGN_EXT_P(env->CP0_EPC))

        cpu_fprintf(f, "BROKEN: EPC=0x" TARGET_FMT_lx "\n", env->CP0_EPC);

    if (!SIGN_EXT_P(env->lladdr))

        cpu_fprintf(f, "BROKEN: LLAddr=0x" TARGET_FMT_lx "\n", env->lladdr);

}


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

     scsi_req_ref(req);

+    scsi_req_dequeue(req);
+
+    req->io_canceled = true;
+
+    if (req->aiocb) {

         blk_aio_cancel_async(req->aiocb);

void scsi_req_cancel_async(SCSIRequest *req, Notifier *notifier)

{

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

    if (notifier) {

        notifier_list_add(&req->cancel_notifiers, notifier);

    scsi_req_ref(req);

    scsi_req_dequeue(req);

    req->io_canceled = true;

    if (req->aiocb) {

        blk_aio_cancel_async(req->aiocb);

    } else {

        scsi_req_cancel_complete(req);