--- a/source.c
+++ b/source.c
@@ -13,7 +13,7 @@
     s = qemu_mallocz(sizeof(NE2000State));

+
     register_ioport_write(base, 16, 1, ne2000_ioport_write, s);

     register_ioport_read(base, 16, 1, ne2000_ioport_read, s);

void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd)

{

    NE2000State *s;

    qemu_check_nic_model(nd, "ne2k_isa");

    s = qemu_mallocz(sizeof(NE2000State));

    register_ioport_write(base, 16, 1, ne2000_ioport_write, s);

    register_ioport_read(base, 16, 1, ne2000_ioport_read, s);

    register_ioport_write(base + 0x10, 1, 1, ne2000_asic_ioport_write, s);

    register_ioport_read(base + 0x10, 1, 1, ne2000_asic_ioport_read, s);

    register_ioport_write(base + 0x10, 2, 2, ne2000_asic_ioport_write, s);

    register_ioport_read(base + 0x10, 2, 2, ne2000_asic_ioport_read, s);

    register_ioport_write(base + 0x1f, 1, 1, ne2000_reset_ioport_write, s);

    register_ioport_read(base + 0x1f, 1, 1, ne2000_reset_ioport_read, s);

    s->irq = irq;

    memcpy(s->macaddr, nd->macaddr, 6);

    ne2000_reset(s);

    s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,

                                 ne2000_receive, ne2000_can_receive, s);

    qemu_format_nic_info_str(s->vc, s->macaddr);

    register_savevm("ne2000", -1, 2, ne2000_save, ne2000_load, s);

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@
         return -EACCES;
     if (bdrv_check_request(bs, sector_num, nb_sectors)) {
         return -EIO;
+    /* throttling disk write I/O */
+    if (bs->io_limits_enabled) {
+        bdrv_io_limits_intercept(bs, true, nb_sectors);
+    tracked_request_begin(&req, bs, sector_num, nb_sectors, true);
+    ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
     if (bs->dirty_bitmap) {
         set_dirty_bitmap(bs, sector_num, nb_sectors, 1);
     if (bs->wr_highest_sector < sector_num + nb_sectors - 1) {

static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
    int64_t sector_num, int nb_sectors, QEMUIOVector *qiov)
{
    BlockDriver *drv = bs->drv;
    BdrvTrackedRequest req;
    int ret;
    if (!bs->drv) {
        return -ENOMEDIUM;
    if (bs->read_only) {
        return -EACCES;
    if (bdrv_check_request(bs, sector_num, nb_sectors)) {
        return -EIO;
    /* throttling disk write I/O */
    if (bs->io_limits_enabled) {
        bdrv_io_limits_intercept(bs, true, nb_sectors);
    tracked_request_begin(&req, bs, sector_num, nb_sectors, true);
    ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov);
    if (bs->dirty_bitmap) {
        set_dirty_bitmap(bs, sector_num, nb_sectors, 1);
    if (bs->wr_highest_sector < sector_num + nb_sectors - 1) {
        bs->wr_highest_sector = sector_num + nb_sectors - 1;
    tracked_request_end(&req);
    return ret;


--- a/source.c
+++ b/source.c
@@ -3,12 +3,12 @@
                        const char *in, int x1, int y1, int x2, int y2)

 {
+
+    if (x1 >= 0 && y1 >= 0) {

         /* XXX: here we rescale coordinate assuming they are in DVD resolution
+
+         * (720x480) since we don't have anything better */

static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,

                       const char *in, int x1, int y1, int x2, int y2)

{

    if (x1 >= 0 && y1 >= 0) {

        /* XXX: here we rescale coordinate assuming they are in DVD resolution

         * (720x480) since we don't have anything better */

        if (x2 >= 0 && y2 >= 0 && (x2 != x1 || y2 != y1) && x2 >= x1 && y2 >= y1) {

            /* text rectangle defined, write the text at the center of the rectangle */

            const int cx = x1 + (x2 - x1)/2;

            const int cy = y1 + (y2 - y1)/2;

            const int scaled_x = cx * ASS_DEFAULT_PLAYRESX / 720;

            const int scaled_y = cy * ASS_DEFAULT_PLAYRESY / 480;

            av_bprintf(dst, "{\\an5}{\\pos(%d,%d)}", scaled_x, scaled_y);

        } else {

            /* only the top left corner, assume the text starts in that corner */

            const int scaled_x = x1 * ASS_DEFAULT_PLAYRESX / 720;

            const int scaled_y = y1 * ASS_DEFAULT_PLAYRESY / 480;

            av_bprintf(dst, "{\\an1}{\\pos(%d,%d)}", scaled_x, scaled_y);

        }

    }

    ff_htmlmarkup_to_ass(avctx, dst, in);

}


--- a/source.c
+++ b/source.c
@@ -9,12 +9,12 @@
     unsigned short int work[50];

     short *ptr = work;
+

     memcpy(work, statbuf,20);

+    memcpy(work + 10, i2, len * 2);

static void final(const short *i1, const short *i2,

                  void *out, int *statbuf, int len)

{

    int x, i;

    unsigned short int work[50];

    short *ptr = work;

    memcpy(work, statbuf,20);

    memcpy(work + 10, i2, len * 2);

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

        int sum = 0;

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

            sum += i1[9-x] * ptr[x];

        sum >>= 12;

        if (ptr[10] - sum < -32768 || ptr[10] - sum > 32767) {

            memset(out, 0, len * 2);

            memset(statbuf, 0, 20);

            return;

        }

        ptr[10] -= sum;

        ptr++;

    }

    memcpy(out, work+10, len * 2);

    memcpy(statbuf, work + 40, 20);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void gen_loop(DisasContext *ctx, int r1, int32_t offset)

 {
+
+    int l1;
+
+    l1 = gen_new_label();
+

     tcg_gen_subi_tl(cpu_gpr_a[r1], cpu_gpr_a[r1], 1);

static void gen_loop(DisasContext *ctx, int r1, int32_t offset)

{

    int l1;

    l1 = gen_new_label();

    tcg_gen_subi_tl(cpu_gpr_a[r1], cpu_gpr_a[r1], 1);

    tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr_a[r1], -1, l1);

    gen_goto_tb(ctx, 1, ctx->pc + offset);

    gen_set_label(l1);

    gen_goto_tb(ctx, 0, ctx->next_pc);

}


int64_t av_gettime_relative(void)

{

#if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)

    struct timespec ts;

    clock_gettime(CLOCK_MONOTONIC, &ts);

    return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;

#else

    return av_gettime() + 42 * 60 * 60 * INT64_C(1000000);

#endif

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     uint16_t cid = le16_to_cpu(frame->cid);

     uint16_t len = le16_to_cpu(frame->len);
+
+
+
+    if (unlikely(cid >= L2CAP_CID_MAX || !l2cap->cid[cid])) {
+
         fprintf(stderr, "%s: frame addressed to a non-existent L2CAP "

                         "channel %04x received.\n", __FUNCTION__, cid);

static void l2cap_frame_in(struct l2cap_instance_s *l2cap,

                const l2cap_hdr *frame)

{

    uint16_t cid = le16_to_cpu(frame->cid);

    uint16_t len = le16_to_cpu(frame->len);

    if (unlikely(cid >= L2CAP_CID_MAX || !l2cap->cid[cid])) {

        fprintf(stderr, "%s: frame addressed to a non-existent L2CAP "

                        "channel %04x received.\n", __FUNCTION__, cid);

        return;

    }

    l2cap->cid[cid]->frame_in(l2cap->cid[cid], cid, frame, len);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 e1000_mmio_map(PCIDevice *pci_dev, int region_num,
+                uint32_t addr, uint32_t size, int type)
 {
     E1000State *d = (E1000State *)pci_dev;
     DBGOUT(MMIO, "e1000_mmio_map addr=0x%08x 0x%08x\n", addr, size);

e1000_mmio_map(PCIDevice *pci_dev, int region_num,
                uint32_t addr, uint32_t size, int type)
{
    E1000State *d = (E1000State *)pci_dev;
    DBGOUT(MMIO, "e1000_mmio_map addr=0x%08x 0x%08x\n", addr, size);
    cpu_register_physical_memory(addr, PNPMMIO_SIZE, d->mmio_index);
}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     BusState *bus = opaque;

     DeviceState *qdev, *next;
+
     PCIDevice *dev;

     int slot = ffs(val) - 1;

static void pciej_write(void *opaque, uint32_t addr, uint32_t val)

{

    BusState *bus = opaque;

    DeviceState *qdev, *next;

    PCIDevice *dev;

    int slot = ffs(val) - 1;

    QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) {

        dev = DO_UPCAST(PCIDevice, qdev, qdev);

        if (PCI_SLOT(dev->devfn) == slot) {

            qdev_free(qdev);

        }

    }

    PIIX4_DPRINTF("pciej write %x <== %d\n", addr, val);

}


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

 {

+    *resp = qmp("{ 'execute': 'query-cpus' }");

     g_assert(*resp);

static QList *get_cpus(QDict **resp)

{

    *resp = qmp("{ 'execute': 'query-cpus' }");

    g_assert(*resp);

    g_assert(qdict_haskey(*resp, "return"));

    return  qdict_get_qlist(*resp, "return");

}


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

     case 1:
+
+        xfer = buf[3];
+
+        break;
+
     case 2:

         xfer = buf[4];

static int ata_passthrough_12_xfer_size(SCSIDevice *dev, uint8_t *buf)

{

    int length = buf[2] & 0x3;

    int xfer;

    int unit = ata_passthrough_xfer_unit(dev, buf);

    switch (length) {

    case 0:

    case 3: /* USB-specific.  */

        xfer = 0;

        break;

    case 1:

        xfer = buf[3];

        break;

    case 2:

        xfer = buf[4];

        break;

    }

    return xfer * unit;

}


--- a/source.c
+++ b/source.c
@@ -11,8 +11,8 @@
         memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) {

         return -1;
+
+    }

     p += sizeof(ff_asf_guid) + 14;

static int rtp_asf_fix_header(uint8_t *buf, int len)

{

    uint8_t *p = buf, *end = buf + len;

    if (len < sizeof(ff_asf_guid) * 2 + 22 ||

        memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) {

        return -1;

    }

    p += sizeof(ff_asf_guid) + 14;

    do {

        uint64_t chunksize = AV_RL64(p + sizeof(ff_asf_guid));

        if (memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) {

            if (chunksize > end - p)

                return -1;

            p += chunksize;

            continue;

        }

        /* skip most of the file header, to min_pktsize */

        p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2;

        if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) {

            /* and set that to zero */

            AV_WL32(p, 0);

            return 0;

        }

        break;

    } while (end - p >= sizeof(ff_asf_guid) + 8);

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void mixeng_clear (st_sample_t *buf, int len)

+{

     memset (buf, 0, len * sizeof (st_sample_t));

void mixeng_clear (st_sample_t *buf, int len)

{

    memset (buf, 0, len * sizeof (st_sample_t));

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     wp->vaddr = addr;

     wp->len = len;
+
+    wp->flags = flags;
+
+
+
     /* keep all GDB-injected watchpoints in front */

     if (flags & BP_GDB) {

int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,

                          int flags, CPUWatchpoint **watchpoint)

{

    CPUWatchpoint *wp;

    /* forbid ranges which are empty or run off the end of the address space */

    if (len == 0 || (addr + len - 1) <= addr) {

        error_report("tried to set invalid watchpoint at %"

                     VADDR_PRIx ", len=%" VADDR_PRIu, addr, len);

        return -EINVAL;

    }

    wp = g_malloc(sizeof(*wp));

    wp->vaddr = addr;

    wp->len = len;

    wp->flags = flags;

    /* keep all GDB-injected watchpoints in front */

    if (flags & BP_GDB) {

        QTAILQ_INSERT_HEAD(&cpu->watchpoints, wp, entry);

    } else {

        QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry);

    }

    tlb_flush_page(cpu, addr);

    if (watchpoint)

        *watchpoint = wp;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void spatial_compose53i(IDWTELEM *buffer, int width, int height, int stride){

     dwt_compose_t cs;
+
+    spatial_compose53i_init(&cs, buffer, height, stride);

     while(cs.y <= height)

static void spatial_compose53i(IDWTELEM *buffer, int width, int height, int stride){

    dwt_compose_t cs;

    spatial_compose53i_init(&cs, buffer, height, stride);

    while(cs.y <= height)

        spatial_compose53i_dy(&cs, buffer, width, height, stride);

}


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

 {

+    lhs->selector = rhs->selector;

     lhs->base = rhs->base;

static void get_seg(SegmentCache *lhs, const struct kvm_segment *rhs)

{

    lhs->selector = rhs->selector;

    lhs->base = rhs->base;

    lhs->limit = rhs->limit;

    lhs->flags = (rhs->type << DESC_TYPE_SHIFT) |

                 (rhs->present * DESC_P_MASK) |

                 (rhs->dpl << DESC_DPL_SHIFT) |

                 (rhs->db << DESC_B_SHIFT) |

                 (rhs->s * DESC_S_MASK) |

                 (rhs->l << DESC_L_SHIFT) |

                 (rhs->g * DESC_G_MASK) |

                 (rhs->avl * DESC_AVL_MASK);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+static void IMLT(float *pInput, float *pOutput, int odd_band)

 {

     int     i;

+

     if (odd_band) {

static void IMLT(float *pInput, float *pOutput, int odd_band)

{

    int     i;

    if (odd_band) {

        /**

        * Reverse the odd bands before IMDCT, this is an effect of the QMF transform

        * or it gives better compression to do it this way.

        * FIXME: It should be possible to handle this in ff_imdct_calc

        * for that to happen a modification of the prerotation step of

        * all SIMD code and C code is needed.

        * Or fix the functions before so they generate a pre reversed spectrum.

        */

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

            FFSWAP(float, pInput[i], pInput[255-i]);

    }

    ff_imdct_calc(&mdct_ctx,pOutput,pInput);

    /* Perform windowing on the output. */

    dsp.vector_fmul(pOutput,mdct_window,512);

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport,
+
+                            void *data,
+
+                            size_t len) {
+
+    VncState *vs = (VncState *)transport;

+    int ret;

static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport,

                            void *data,

                            size_t len) {

    VncState *vs = (VncState *)transport;

    int ret;

 retry:

    ret = qemu_recv(vs->csock, data, len, 0);

    if (ret < 0) {

        if (errno == EINTR)

            goto retry;

        return -1;

    }

    return ret;

}


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

 #ifndef CONFIG_USER_ONLY

+    cpu_remove_sync(CPU(dev));
+
+    qemu_unregister_reset(x86_cpu_machine_reset_cb, dev);
+
+#endif

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

{

    X86CPU *cpu = X86_CPU(dev);

#ifndef CONFIG_USER_ONLY

    cpu_remove_sync(CPU(dev));

    qemu_unregister_reset(x86_cpu_machine_reset_cb, dev);

#endif

    if (cpu->apic_state) {

        object_unparent(OBJECT(cpu->apic_state));

        cpu->apic_state = NULL;

    }

    xcc->parent_unrealize(dev, &local_err);

    if (local_err != NULL) {

        error_propagate(errp, local_err);

        return;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+void virtio_scsi_dataplane_notify(VirtIODevice *vdev, VirtIOSCSIReq *req)
+
+{

     if (virtio_should_notify(vdev, req->vq)) {

void virtio_scsi_dataplane_notify(VirtIODevice *vdev, VirtIOSCSIReq *req)

{

    if (virtio_should_notify(vdev, req->vq)) {

        event_notifier_set(virtio_queue_get_guest_notifier(req->vq));

    }

}


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

+{

     PXA2xxSSPState *s = (PXA2xxSSPState *) opaque;

@@ -11,7 +11,7 @@
     s->enable = qemu_get_be32(f);

+
     qemu_get_be32s(f, &s->sscr[0]);

     qemu_get_be32s(f, &s->sscr[1]);

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

{

    PXA2xxSSPState *s = (PXA2xxSSPState *) opaque;

    int i;

    s->enable = qemu_get_be32(f);

    qemu_get_be32s(f, &s->sscr[0]);

    qemu_get_be32s(f, &s->sscr[1]);

    qemu_get_be32s(f, &s->sspsp);

    qemu_get_be32s(f, &s->ssto);

    qemu_get_be32s(f, &s->ssitr);

    qemu_get_be32s(f, &s->sssr);

    qemu_get_8s(f, &s->sstsa);

    qemu_get_8s(f, &s->ssrsa);

    qemu_get_8s(f, &s->ssacd);

    s->rx_level = qemu_get_byte(f);

    s->rx_start = 0;

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

        s->rx_fifo[i] = qemu_get_byte(f);

    return 0;

}


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

 {

+    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);

     DeviceClass *dc = DEVICE_CLASS(klass);

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

{

    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);

    DeviceClass *dc = DEVICE_CLASS(klass);

    k->init = pci_grackle_init_device;

    dc->no_user = 1;

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
         case PIX_FMT_RGB565:

         case PIX_FMT_RGB555:
+
+            bits = 16;
+
+                        break;
+
         case PIX_FMT_PAL8:

             bits = 8;

static int avg_bits_per_pixel(int pix_fmt)

{

    int bits;

    const PixFmtInfo *pf;

    pf = &pix_fmt_info[pix_fmt];

    if (pf->is_packed) {

        switch(pix_fmt) {

        case PIX_FMT_RGB24:

        case PIX_FMT_BGR24:

            bits = 24;

            break;

        case PIX_FMT_RGBA32:

            bits = 32;

                        break;

        case PIX_FMT_RGB565:

        case PIX_FMT_RGB555:

            bits = 16;

                        break;

        case PIX_FMT_PAL8:

            bits = 8;

            break;

        default:

            bits = 32;

            break;

        }

    } else {

        bits = pf->depth;

        bits += (2 * pf->depth >>

                 (pf->x_chroma_shift + pf->x_chroma_shift));

    }

    return bits;

}


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

     uc->product_desc   = "QEMU USB Mouse";

+    uc->usb_desc       = &desc_mouse;
+
+    uc->handle_packet  = usb_generic_handle_packet;
+
+    uc->handle_reset   = usb_hid_handle_reset;

     uc->handle_control = usb_hid_handle_control;

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

{

    USBDeviceClass *uc = USB_DEVICE_CLASS(klass);

    uc->init           = usb_mouse_initfn;

    uc->product_desc   = "QEMU USB Mouse";

    uc->usb_desc       = &desc_mouse;

    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
@@ -2,11 +2,11 @@

 {

+    enum AVPixelFormat pix_fmts[] = {
+
+        AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,
+
+    };

static int scale_vaapi_query_formats(AVFilterContext *avctx)

{

    enum AVPixelFormat pix_fmts[] = {

        AV_PIX_FMT_VAAPI, AV_PIX_FMT_NONE,

    };

    ff_formats_ref(ff_make_format_list(pix_fmts),

                   &avctx->inputs[0]->out_formats);

    ff_formats_ref(ff_make_format_list(pix_fmts),

                   &avctx->outputs[0]->in_formats);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     sc->init         = scsi_hd_initfn;

     sc->destroy      = scsi_destroy;
+
+    sc->alloc_req    = scsi_new_request;
+
+    sc->unit_attention_reported = scsi_disk_unit_attention_reported;
+
     dc->fw_name = "disk";

     dc->desc = "virtual SCSI disk";

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    SCSIDeviceClass *sc = SCSI_DEVICE_CLASS(klass);

    sc->init         = scsi_hd_initfn;

    sc->destroy      = scsi_destroy;

    sc->alloc_req    = scsi_new_request;

    sc->unit_attention_reported = scsi_disk_unit_attention_reported;

    dc->fw_name = "disk";

    dc->desc = "virtual SCSI disk";

    dc->reset = scsi_disk_reset;

    dc->props = scsi_hd_properties;

    dc->vmsd  = &vmstate_scsi_disk_state;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static hwaddr ppc_hash64_pteg_search(PowerPCCPU *cpu, hwaddr hash,

                                      bool secondary, target_ulong ptem,

static hwaddr ppc_hash64_pteg_search(PowerPCCPU *cpu, hwaddr hash,

                                     bool secondary, target_ulong ptem,

                                     ppc_hash_pte64_t *pte)

{

    CPUPPCState *env = &cpu->env;

    int i;

    uint64_t token;

    target_ulong pte0, pte1;

    target_ulong pte_index;

    pte_index = (hash & env->htab_mask) * HPTES_PER_GROUP;

    token = ppc_hash64_start_access(cpu, pte_index);

    if (!token) {

        return -1;

    }

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

        pte0 = ppc_hash64_load_hpte0(cpu, token, i);

        pte1 = ppc_hash64_load_hpte1(cpu, token, i);

        if ((pte0 & HPTE64_V_VALID)

            && (secondary == !!(pte0 & HPTE64_V_SECONDARY))

            && HPTE64_V_COMPARE(pte0, ptem)) {

            pte->pte0 = pte0;

            pte->pte1 = pte1;

            ppc_hash64_stop_access(cpu, token);

            return (pte_index + i) * HASH_PTE_SIZE_64;

        }

    }

    ppc_hash64_stop_access(cpu, token);

    /*

     * We didn't find a valid entry.

     */

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                    void *value, size_t size, int flags)

 {
+
     XattrOperations *xops = get_xattr_operations(ctx->xops, name);

     if (xops) {

int v9fs_set_xattr(FsContext *ctx, const char *path, const char *name,

                   void *value, size_t size, int flags)

{

    XattrOperations *xops = get_xattr_operations(ctx->xops, name);

    if (xops) {

        return xops->setxattr(ctx, path, name, value, size, flags);

    }

    errno = -EOPNOTSUPP;

    return -1;

}


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

     AVIOContext *pb = s->pb;
+
     int ret;

static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st)

{

    AVIOContext *pb = s->pb;

    int ret;

    /* parse fmt header */

    *st = av_new_stream(s, 0);

    if (!*st)

        return AVERROR(ENOMEM);

    ff_get_wav_header(pb, (*st)->codec, size);

    if (ret < 0)

        return ret;

    (*st)->need_parsing = AVSTREAM_PARSE_FULL;

    av_set_pts_info(*st, 64, 1, (*st)->codec->sample_rate);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void ff_put_h264_qpel16_mc00_msa(uint8_t *dst, const uint8_t *src,

+                                 ptrdiff_t stride)
+
 {

     copy_width16_msa(src, stride, dst, stride, 16);

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

                                 ptrdiff_t stride)

{

    copy_width16_msa(src, stride, dst, stride, 16);

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
                             int64_t timestamp)

 {
+
+    int frame_delay;
+
+    int64_t pts, dts;
+

     if (st->codec.codec_type == CODEC_TYPE_VIDEO &&

static void compute_pts_dts(AVStream *st, int64_t *ppts, int64_t *pdts,

                            int64_t timestamp)

{

    int frame_delay;

    int64_t pts, dts;

    if (st->codec.codec_type == CODEC_TYPE_VIDEO &&

        st->codec.max_b_frames != 0) {

        frame_delay = (st->codec.frame_rate_base * 90000LL) /

            st->codec.frame_rate;

        if (timestamp == 0) {

            /* specific case for first frame : DTS just before */

            pts = timestamp;

            dts = timestamp - frame_delay;

        } else {

            timestamp -= frame_delay;

            if (st->codec.coded_frame->pict_type == FF_B_TYPE) {

                /* B frames has identical pts/dts */

                pts = timestamp;

                dts = timestamp;

            } else {

                /* a reference frame has a pts equal to the dts of the

                   _next_ one */

                dts = timestamp;

                pts = timestamp + (st->codec.max_b_frames + 1) * frame_delay;

            }

        }

#if 1

        av_log(&st->codec, AV_LOG_DEBUG, "pts=%0.3f dts=%0.3f pict_type=%c\n",

               pts / 90000.0, dts / 90000.0,

               av_get_pict_type_char(st->codec.coded_frame->pict_type));

#endif

    } else {

        pts = timestamp;

        dts = timestamp;

    }

    *ppts = pts & ((1LL << 33) - 1);

    *pdts = dts & ((1LL << 33) - 1);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int print_uint16(DeviceState *dev, Property *prop, char *dest, size_t len)
+
+{

     uint16_t *ptr = qdev_get_prop_ptr(dev, prop);

static int print_uint16(DeviceState *dev, Property *prop, char *dest, size_t len)

{

    uint16_t *ptr = qdev_get_prop_ptr(dev, prop);

    return snprintf(dest, len, "%" PRIu16, *ptr);

}


--- a/source.c
+++ b/source.c
@@ -63,11 +63,11 @@
     env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);

     env->eip = offset;
+
+    env->segs[R_CS].selector = selector;
+
+    env->segs[R_CS].base = (uint8_t *)(selector << 4);
+
     env->eflags &= ~(IF_MASK | TF_MASK | AC_MASK | RF_MASK);

 }

static void do_interrupt_real(int intno, int is_int, int error_code,

                                 unsigned int next_eip)

{

    SegmentCache *dt;

    uint8_t *ptr, *ssp;

    int selector;

    uint32_t offset, esp;

    uint32_t old_cs, old_eip;

    /* real mode (simpler !) */

    dt = &env->idt;

    if (intno * 4 + 3 > dt->limit)

        raise_exception_err(EXCP0D_GPF, intno * 8 + 2);

    ptr = dt->base + intno * 4;

    offset = lduw(ptr);

    selector = lduw(ptr + 2);

    esp = env->regs[R_ESP];

    ssp = env->segs[R_SS].base;

    if (is_int)

        old_eip = next_eip;

    else

        old_eip = env->eip;

    old_cs = env->segs[R_CS].selector;

    esp -= 2;

    stw(ssp + (esp & 0xffff), compute_eflags());

    esp -= 2;

    stw(ssp + (esp & 0xffff), old_cs);

    esp -= 2;

    stw(ssp + (esp & 0xffff), old_eip);

    /* update processor state */

    env->regs[R_ESP] = (env->regs[R_ESP] & ~0xffff) | (esp & 0xffff);

    env->eip = offset;

    env->segs[R_CS].selector = selector;

    env->segs[R_CS].base = (uint8_t *)(selector << 4);

    env->eflags &= ~(IF_MASK | TF_MASK | AC_MASK | RF_MASK);

}


--- a/source.c
+++ b/source.c
@@ -21,9 +21,9 @@
         return AVERROR_IO;

     s->dest_addr.sin_family = AF_INET;
+
+    s->dest_addr.sin_port = htons(port);
+
+    return 0;
+
 }

int udp_set_remote_url(URLContext *h, const char *uri)

{

    UDPContext *s = h->priv_data;

    char hostname[256];

    int port;

    url_split(NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);

    /* set the destination address */

    if (resolve_host(&s->dest_addr.sin_addr, hostname) < 0)

        return AVERROR_IO;

    s->dest_addr.sin_family = AF_INET;

    s->dest_addr.sin_port = htons(port);

    return 0;

}


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

+    vs->vd = vd;
+
     vs->ds = vd->ds;

     vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs);

static void vnc_connect(VncDisplay *vd, int csock)

{

    VncState *vs = qemu_mallocz(sizeof(VncState));

    vs->csock = csock;

    VNC_DEBUG("New client on socket %d\n", csock);

    dcl->idle = 0;

    socket_set_nonblock(vs->csock);

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

    vs->vd = vd;

    vs->ds = vd->ds;

    vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs);

    vs->last_x = -1;

    vs->last_y = -1;

    vs->as.freq = 44100;

    vs->as.nchannels = 2;

    vs->as.fmt = AUD_FMT_S16;

    vs->as.endianness = 0;

    vnc_resize(vs);

    vnc_write(vs, "RFB 003.008\n", 12);

    vnc_flush(vs);

    vnc_read_when(vs, protocol_version, 12);

    memset(vs->old_data, 0, ds_get_linesize(vs->ds) * ds_get_height(vs->ds));

    memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));

    vnc_update_client(vs);

    reset_keys(vs);

    vs->next = vd->clients;

    vd->clients = vs;

}


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

         rc = read(il->fd, &event, sizeof(event));

+        if (rc != sizeof(event)) {
+
+            if (rc < 0 && errno != EAGAIN) {
+
+                fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno));

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

static void input_linux_event_keyboard(void *opaque)

{

    InputLinux *il = opaque;

    struct input_event event;

    int rc;

    for (;;) {

        rc = read(il->fd, &event, sizeof(event));

        if (rc != sizeof(event)) {

            if (rc < 0 && errno != EAGAIN) {

                fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno));

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

                close(il->fd);

            }

            break;

        }

        input_linux_handle_keyboard(il, &event);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static inline void gen_op_mov_reg_v(int ot, int reg, TCGv t0)
+
+{
+
+    switch(ot) {
+
     case OT_BYTE:

         if (reg < 4 X86_64_DEF( || reg >= 8 || x86_64_hregs)) {

static inline void gen_op_mov_reg_v(int ot, int reg, TCGv t0)

{

    switch(ot) {

    case OT_BYTE:

        if (reg < 4 X86_64_DEF( || reg >= 8 || x86_64_hregs)) {

            tcg_gen_deposit_tl(cpu_regs[reg], cpu_regs[reg], t0, 0, 8);

        } else {

            tcg_gen_deposit_tl(cpu_regs[reg - 4], cpu_regs[reg - 4], t0, 8, 8);

        }

        break;

    case OT_WORD:

        tcg_gen_deposit_tl(cpu_regs[reg], cpu_regs[reg], t0, 0, 16);

        break;

    default: /* XXX this shouldn't be reached;  abort? */

    case OT_LONG:

        /* For x86_64, this sets the higher half of register to zero.

           For i386, this is equivalent to a mov. */

        tcg_gen_ext32u_tl(cpu_regs[reg], t0);

        break;

#ifdef TARGET_X86_64

    case OT_QUAD:

        tcg_gen_mov_tl(cpu_regs[reg], t0);

        break;

#endif

    }

}


--- a/source.c
+++ b/source.c
@@ -1,22 +1,22 @@
+static void expand_rle_row(unsigned char *optr, unsigned char *iptr,

         int chan_offset, int pixelstride)

 {

     unsigned char pixel, count;
+

 #ifndef WORDS_BIGENDIAN

     /* rgba -> bgra for rgba32 on little endian cpus */
+
     if (pixelstride == 4 && chan_offset != 3) {
+
        chan_offset = 2 - chan_offset;

+    }

 #endif

static void expand_rle_row(unsigned char *optr, unsigned char *iptr,

        int chan_offset, int pixelstride)

{

    unsigned char pixel, count;

#ifndef WORDS_BIGENDIAN

    /* rgba -> bgra for rgba32 on little endian cpus */

    if (pixelstride == 4 && chan_offset != 3) {

       chan_offset = 2 - chan_offset;

    }

#endif

    optr += chan_offset;

    while (1) {

        pixel = *iptr++;

        if (!(count = (pixel & 0x7f))) {

            return;

        }

        if (pixel & 0x80) {

            while (count--) {

                *optr = *iptr;

                optr += pixelstride;

                iptr++;

            }

        } else {

            pixel = *iptr++;

            while (count--) {

                *optr = pixel;

                optr += pixelstride;

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void pc_compat_1_5(QEMUMachineInitArgs *args)

+{

     pc_compat_1_6(args);

static void pc_compat_1_5(QEMUMachineInitArgs *args)

{

    pc_compat_1_6(args);

    has_pvpanic = true;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static ssize_t mp_user_getxattr(FsContext *ctx, const char *path,
+
+                                const char *name, void *value, size_t size)

 {

     char *buffer;
+
+    ssize_t ret;
+
+

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

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

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

{

    char *buffer;

    ssize_t ret;

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

        /*

         * Don't allow fetch of user.virtfs namesapce

         * in case of mapped security

         */

        errno = ENOATTR;

        return -1;

    }

    buffer = rpath(ctx, path);

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

    g_free(buffer);

    return ret;

}


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

     DriveInfo *dinfo = NULL;
+
     const char *opts = qdict_get_str(qdict, "opts");

+

     dinfo = add_init_drive(opts);
+
     if (!dinfo) {
+
+        goto err;
+
     }

     if (dinfo->devaddr) {
+
         monitor_printf(mon, "Parameter addr not supported\n");

         goto err;

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

{

    DriveInfo *dinfo = NULL;

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

    dinfo = add_init_drive(opts);

    if (!dinfo) {

        goto err;

    }

    if (dinfo->devaddr) {

        monitor_printf(mon, "Parameter addr not supported\n");

        goto err;

    }

    switch (dinfo->type) {

    case IF_NONE:

        monitor_printf(mon, "OK\n");

        break;

    default:

        if (pci_drive_hot_add(mon, qdict, dinfo)) {

            goto err;

        }

    }

    return;

err:

    if (dinfo) {

        blk_unref(blk_by_legacy_dinfo(dinfo));

    }

}


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

     ret = ff_inlink_make_frame_writable(fs->parent->inputs[0], f0);
+
+    if (ret < 0) {
+
+        av_frame_free(f0);
+
         av_frame_free(f1);

         return ret;

int ff_framesync_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)

{

    int ret;

    ret = ff_framesync_dualinput_get(fs, f0, f1);

    if (ret < 0)

        return ret;

    ret = ff_inlink_make_frame_writable(fs->parent->inputs[0], f0);

    if (ret < 0) {

        av_frame_free(f0);

        av_frame_free(f1);

        return ret;

    }

    return 0;

}


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

     int64_t val = *value;

static void visit_type_int32(Visitor *v, int *value, const char *name, Error **errp)

{

    int64_t val = *value;

    visit_type_int(v, &val, name, errp);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void vmsvga_bios_write(void *opaque, uint32_t address, uint32_t data)

+{
+
     printf("%s: what are we supposed to do with (%08x)?\n",

                     __FUNCTION__, data);

static void vmsvga_bios_write(void *opaque, uint32_t address, uint32_t data)

{

    printf("%s: what are we supposed to do with (%08x)?\n",

                    __FUNCTION__, data);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static CharDriverState *qmp_chardev_open_udp(ChardevUdp *udp,

                                              Error **errp)
+
 {

     int fd;

static CharDriverState *qmp_chardev_open_udp(ChardevUdp *udp,

                                             Error **errp)

{

    int fd;

    fd = socket_dgram(udp->remote, udp->local, errp);

    if (error_is_set(errp)) {

        return NULL;

    }

    return qemu_chr_open_udp_fd(fd);

}


--- a/source.c
+++ b/source.c
@@ -1,22 +1,22 @@
 void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe,

                                     VP8Frame *prev_frame, int is_vp7)
+
+{

     VP8Context *s = avctx->priv_data;

     int mb_x, mb_y;
+
+

     s->mv_min.y = -MARGIN;
+
+    s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
+
     for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
+
+        VP8Macroblock *mb = s->macroblocks_base +

                             ((s->mb_width + 1) * (mb_y + 1) + 1);

void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe,

                                    VP8Frame *prev_frame, int is_vp7)

{

    VP8Context *s = avctx->priv_data;

    int mb_x, mb_y;

    s->mv_min.y = -MARGIN;

    s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;

    for (mb_y = 0; mb_y < s->mb_height; mb_y++) {

        VP8Macroblock *mb = s->macroblocks_base +

                            ((s->mb_width + 1) * (mb_y + 1) + 1);

        int mb_xy = mb_y * s->mb_width;

        AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED * 0x01010101);

        s->mv_min.x = -MARGIN;

        s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;

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

            if (mb_y == 0)

                AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top,

                         DC_PRED * 0x01010101);

            decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,

                           prev_frame && prev_frame->seg_map ?

                           prev_frame->seg_map->data + mb_xy : NULL, 1, is_vp7);

            s->mv_min.x -= 64;

            s->mv_max.x -= 64;

        }

        s->mv_min.y -= 64;

        s->mv_max.y -= 64;

    }

}


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

+    return bdrv_check_byte_request(bs, sector_num * BDRV_SECTOR_SIZE,
+
+                                   nb_sectors * BDRV_SECTOR_SIZE);
+
 }

static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num,

                              int nb_sectors)

{

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

        return -EIO;

    }

    return bdrv_check_byte_request(bs, sector_num * BDRV_SECTOR_SIZE,

                                   nb_sectors * BDRV_SECTOR_SIZE);

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
         goto out;

     }
+
+    bdrv_dirty_bitmap_make_anon(bitmap);
+
+    bdrv_release_dirty_bitmap(bs, bitmap);
+

  out:

void qmp_block_dirty_bitmap_remove(const char *node, const char *name,

                                   Error **errp)

{

    AioContext *aio_context;

    BlockDriverState *bs;

    BdrvDirtyBitmap *bitmap;

    bitmap = block_dirty_bitmap_lookup(node, name, &bs, &aio_context, errp);

    if (!bitmap || !bs) {

        return;

    }

    if (bdrv_dirty_bitmap_frozen(bitmap)) {

        error_setg(errp,

                   "Bitmap '%s' is currently frozen and cannot be removed",

                   name);

        goto out;

    }

    bdrv_dirty_bitmap_make_anon(bitmap);

    bdrv_release_dirty_bitmap(bs, bitmap);

 out:

    aio_context_release(aio_context);

}


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

     /* send event */
+
+    s = qemu_input_find_handler(1 << evt->type, src);
+
+    if (!s) {
+
         return;

     }

void qemu_input_event_send(QemuConsole *src, InputEvent *evt)

{

    QemuInputHandlerState *s;

    if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {

        return;

    }

    qemu_input_event_trace(src, evt);

    /* pre processing */

    if (graphic_rotate && (evt->type == INPUT_EVENT_KIND_ABS)) {

            qemu_input_transform_abs_rotate(evt);

    }

    /* send event */

    s = qemu_input_find_handler(1 << evt->type, src);

    if (!s) {

        return;

    }

    s->handler->event(s->dev, src, evt);

    s->events++;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2],

+                     const int16_t *ubuf[2], const int16_t *vbuf[2],
+
                      const int16_t *abuf[2], uint8_t *dest, int dstW,

                      int yalpha, int uvalpha, int y,

yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2],

                     const int16_t *ubuf[2], const int16_t *vbuf[2],

                     const int16_t *abuf[2], uint8_t *dest, int dstW,

                     int yalpha, int uvalpha, int y,

                     enum PixelFormat target)

{

    const int16_t *buf0  = buf[0],  *buf1  = buf[1],

                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],

                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];

    int  yalpha1 = 4095 - yalpha;

    int uvalpha1 = 4095 - uvalpha;

    int i;

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

        int Y1 = (buf0[i * 2]     * yalpha1  + buf1[i * 2]     * yalpha)  >> 19;

        int Y2 = (buf0[i * 2 + 1] * yalpha1  + buf1[i * 2 + 1] * yalpha)  >> 19;

        int U  = (ubuf0[i]        * uvalpha1 + ubuf1[i]        * uvalpha) >> 19;

        int V  = (vbuf0[i]        * uvalpha1 + vbuf1[i]        * uvalpha) >> 19;

        Y1 = av_clip_uint8(Y1);

        Y2 = av_clip_uint8(Y2);

        U  = av_clip_uint8(U);

        V  = av_clip_uint8(V);

        output_pixels(i * 4, Y1, U, Y2, V);

    }

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     relation = float32_compare(t0, t1, &env->fp_status);

     if (unlikely(relation == float_relation_unordered)) {
+
+        update_fpscr(env, GETPC());
+
+    } else {
+
         env->sr_t = (relation == float_relation_greater);

     }

void helper_fcmp_gt_FT(CPUSH4State *env, float32 t0, float32 t1)

{

    int relation;

    set_float_exception_flags(0, &env->fp_status);

    relation = float32_compare(t0, t1, &env->fp_status);

    if (unlikely(relation == float_relation_unordered)) {

        update_fpscr(env, GETPC());

    } else {

        env->sr_t = (relation == float_relation_greater);

    }

}


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

     devfn = pci_dev->devfn;

+    pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,
+
+                                     info->config_read, info->config_write);
+
+    assert(pci_dev);

     rc = info->init(pci_dev);

static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)

{

    PCIDevice *pci_dev = (PCIDevice *)qdev;

    PCIDeviceInfo *info = container_of(base, PCIDeviceInfo, qdev);

    PCIBus *bus;

    int devfn, rc;

    /* initialize cap_present for pci_is_express() and pci_config_size() */

    if (info->is_express) {

        pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;

    }

    bus = FROM_QBUS(PCIBus, qdev_get_parent_bus(qdev));

    devfn = pci_dev->devfn;

    pci_dev = do_pci_register_device(pci_dev, bus, base->name, devfn,

                                     info->config_read, info->config_write);

    assert(pci_dev);

    rc = info->init(pci_dev);

    if (rc != 0)

        return rc;

    if (qdev->hotplugged)

        bus->hotplug(pci_dev, 1);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static target_ulong get_psr(void)

+{
+
+    helper_compute_psr();

static target_ulong get_psr(void)

{

    helper_compute_psr();

#if !defined (TARGET_SPARC64)

    return env->version | (env->psr & PSR_ICC) |

        (env->psref? PSR_EF : 0) |

        (env->psrpil << 8) |

        (env->psrs? PSR_S : 0) |

        (env->psrps? PSR_PS : 0) |

        (env->psret? PSR_ET : 0) | env->cwp;

#else

    return env->version | (env->psr & PSR_ICC) |

        (env->psref? PSR_EF : 0) |

        (env->psrpil << 8) |

        (env->psrs? PSR_S : 0) |

        (env->psrps? PSR_PS : 0) | env->cwp;

#endif

}


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

         migrate_del_blocker(hdev->migration_blocker);

+        error_free(hdev->migration_blocker);
+
+    }
+
+    g_free(hdev->mem);

     g_free(hdev->mem_sections);

void vhost_dev_cleanup(struct vhost_dev *hdev)

{

    int i;

    for (i = 0; i < hdev->nvqs; ++i) {

        vhost_virtqueue_cleanup(hdev->vqs + i);

    }

    memory_listener_unregister(&hdev->memory_listener);

    if (hdev->migration_blocker) {

        migrate_del_blocker(hdev->migration_blocker);

        error_free(hdev->migration_blocker);

    }

    g_free(hdev->mem);

    g_free(hdev->mem_sections);

    hdev->vhost_ops->vhost_backend_cleanup(hdev);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2,

                                     const uint8_t *src, int width)

static inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2,

                                    const uint8_t *src, int width)

{

#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",2), %%mm0           \n\t"

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

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

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

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

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

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

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

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

        "packuswb            %%mm3, %%mm2           \n\t"

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

        "movq                %%mm2, (%3, %%"REG_a") \n\t"

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

        " js                    1b                  \n\t"

        : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst1+width), "r" (dst2+width)

        : "%"REG_a

    );

#else

    int i;

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

        dst1[i] = src[2*i+0];

        dst2[i] = src[2*i+1];

    }

#endif

}


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

                                        int64_t s, int64_t e)

+{

     Range *r = g_malloc0(sizeof(*r));

static void string_output_append_range(StringOutputVisitor *sov,

                                       int64_t s, int64_t e)

{

    Range *r = g_malloc0(sizeof(*r));

    r->begin = s;

    r->end = e + 1;

    sov->ranges = g_list_insert_sorted_merged(sov->ranges, r, range_compare);

}


--- a/source.c
+++ b/source.c
@@ -6,11 +6,11 @@
         return AVERROR_INVALIDDATA;
     s->width  = AV_RL16(&buf[4]);
     s->height = AV_RL16(&buf[6]);
+    ret = ff_set_dimensions(s->avctx, s->width, s->height);
+    if (ret < 0)
+        return ret;
+    fps = AV_RL16(&buf[10]);
+    if (fps > 0)
         s->avctx->time_base = (AVRational){ 1, fps };
     pal_start = AV_RL16(&buf[12]);
     pal_count = AV_RL16(&buf[14]);

static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)
{
    int pal_start, pal_count, i, ret, fps;
    if(buf_end - buf < 16) {
        av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
        return AVERROR_INVALIDDATA;
    s->width  = AV_RL16(&buf[4]);
    s->height = AV_RL16(&buf[6]);
    ret = ff_set_dimensions(s->avctx, s->width, s->height);
    if (ret < 0)
        return ret;
    fps = AV_RL16(&buf[10]);
    if (fps > 0)
        s->avctx->time_base = (AVRational){ 1, fps };
    pal_start = AV_RL16(&buf[12]);
    pal_count = AV_RL16(&buf[14]);
    buf += 16;
    for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) {
        s->palette[i] = AV_RB24(buf);
        buf += 3;
    return 0;


--- a/source.c
+++ b/source.c
@@ -53,11 +53,11 @@
     dc = DEVICE_CLASS(oc);

     if (dc->cannot_instantiate_with_device_add_yet ||
+
+        (qdev_hotplug && !dc->hotpluggable)) {
+
+        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
+
                    "pluggable device type");

         return NULL;

static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)

{

    ObjectClass *oc;

    DeviceClass *dc;

    oc = object_class_by_name(*driver);

    if (!oc) {

        const char *typename = find_typename_by_alias(*driver);

        if (typename) {

            *driver = typename;

            oc = object_class_by_name(*driver);

        }

    }

    if (!object_class_dynamic_cast(oc, TYPE_DEVICE)) {

        error_setg(errp, "'%s' is not a valid device model name", *driver);

        return NULL;

    }

    if (object_class_is_abstract(oc)) {

        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",

                   "non-abstract device type");

        return NULL;

    }

    dc = DEVICE_CLASS(oc);

    if (dc->cannot_instantiate_with_device_add_yet ||

        (qdev_hotplug && !dc->hotpluggable)) {

        error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",

                   "pluggable device type");

        return NULL;

    }

    return dc;

}


--- a/source.c
+++ b/source.c
@@ -1,25 +1,25 @@
+static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
+
+				    int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,

+				    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
+
+{
+
+	//FIXME Optimize (just quickly writen not opti..)

+	int i;

+	for(i=0; i<dstW; i++)
+
+	{
+
 		int val=1<<18;
+
+		int j;

+		for(j=0; j<lumFilterSize; j++)
+
 			val += lumSrc[j][i] * lumFilter[j];

static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,

				    int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,

				    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)

{

	//FIXME Optimize (just quickly writen not opti..)

	int i;

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

	{

		int val=1<<18;

		int j;

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

			val += lumSrc[j][i] * lumFilter[j];

		dest[i]= av_clip_uint8(val>>19);

	}

	if(uDest != NULL)

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

		{

			int u=1<<18;

			int v=1<<18;

			int j;

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

			{

				u += chrSrc[j][i] * chrFilter[j];

				v += chrSrc[j][i + 2048] * chrFilter[j];

			}

			uDest[i]= av_clip_uint8(u>>19);

			vDest[i]= av_clip_uint8(v>>19);

		}

}


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

     struct virtio_gpu_resp_capset *resp;

+    uint32_t max_ver, max_size;

     VIRTIO_GPU_FILL_CMD(gc);

static void virgl_cmd_get_capset(VirtIOGPU *g,

                                 struct virtio_gpu_ctrl_command *cmd)

{

    struct virtio_gpu_get_capset gc;

    struct virtio_gpu_resp_capset *resp;

    uint32_t max_ver, max_size;

    VIRTIO_GPU_FILL_CMD(gc);

    virgl_renderer_get_cap_set(gc.capset_id, &max_ver,

                               &max_size);

    if (!max_size) {

        cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;

        return;

    }

    resp = g_malloc(sizeof(*resp) + max_size);

    resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET;

    virgl_renderer_fill_caps(gc.capset_id,

                             gc.capset_version,

                             (void *)resp->capset_data);

    virtio_gpu_ctrl_response(g, cmd, &resp->hdr, sizeof(*resp) + max_size);

    g_free(resp);

}


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

     /* Workaround to allow loading the binary-only wlandrv.ko crap

+     * from the original Freecom firmware. */
+
+    case MP_WLAN_MAGIC1:
+
+        return ~3;

     case MP_WLAN_MAGIC2:

static uint64_t mv88w8618_wlan_read(void *opaque, target_phys_addr_t offset,

                                    unsigned size)

{

    switch (offset) {

    /* Workaround to allow loading the binary-only wlandrv.ko crap

     * from the original Freecom firmware. */

    case MP_WLAN_MAGIC1:

        return ~3;

    case MP_WLAN_MAGIC2:

        return -1;

    default:

        return 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int x86_cpu_filter_features(X86CPU *cpu)

 {
+
+    CPUX86State *env = &cpu->env;
+
+    FeatureWord w;
+
     int rv = 0;

static int x86_cpu_filter_features(X86CPU *cpu)

{

    CPUX86State *env = &cpu->env;

    FeatureWord w;

    int rv = 0;

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

        uint32_t host_feat =

            x86_cpu_get_supported_feature_word(w, false);

        uint32_t requested_features = env->features[w];

        env->features[w] &= host_feat;

        cpu->filtered_features[w] = requested_features & ~env->features[w];

        if (cpu->filtered_features[w]) {

            rv = 1;

        }

    }

    return rv;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     *status = 0;

     reply->iov_len = 0;
+
+    retval = socket_read(proxy->sockfd, reply->iov_base, PROXY_HDR_SZ);
+
+    if (retval < 0) {
+
         return retval;

     }

static int v9fs_receive_status(V9fsProxy *proxy,

                               struct iovec *reply, int *status)

{

    int retval;

    ProxyHeader header;

    *status = 0;

    reply->iov_len = 0;

    retval = socket_read(proxy->sockfd, reply->iov_base, PROXY_HDR_SZ);

    if (retval < 0) {

        return retval;

    }

    reply->iov_len = PROXY_HDR_SZ;

    proxy_unmarshal(reply, 0, "dd", &header.type, &header.size);

    if (header.size != sizeof(int)) {

        *status = -ENOBUFS;

        return 0;

    }

    retval = socket_read(proxy->sockfd,

                         reply->iov_base + PROXY_HDR_SZ, header.size);

    if (retval < 0) {

        return retval;

    }

    reply->iov_len += header.size;

    proxy_unmarshal(reply, PROXY_HDR_SZ, "d", status);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void print_net_client(Monitor *mon, VLANClientState *vc)
+
 {

     monitor_printf(mon, "%s: type=%s,%s\n", vc->name,

static void print_net_client(Monitor *mon, VLANClientState *vc)

{

    monitor_printf(mon, "%s: type=%s,%s\n", vc->name,

                   net_client_types[vc->info->type].type, vc->info_str);

}


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

         case USB_SPEED_HIGH:

+            port->portsc |= PORTSC_SPEED_HIGH;
+
+            break;
+
+        case USB_SPEED_SUPER:

             port->portsc |= PORTSC_SPEED_SUPER;

static void xhci_port_update(XHCIPort *port, int is_detach)

{

    port->portsc = PORTSC_PP;

    if (port->uport->dev && port->uport->dev->attached && !is_detach &&

        (1 << port->uport->dev->speed) & port->speedmask) {

        port->portsc |= PORTSC_CCS;

        switch (port->uport->dev->speed) {

        case USB_SPEED_LOW:

            port->portsc |= PORTSC_SPEED_LOW;

            break;

        case USB_SPEED_FULL:

            port->portsc |= PORTSC_SPEED_FULL;

            break;

        case USB_SPEED_HIGH:

            port->portsc |= PORTSC_SPEED_HIGH;

            break;

        case USB_SPEED_SUPER:

            port->portsc |= PORTSC_SPEED_SUPER;

            break;

        }

    }

    if (xhci_running(port->xhci)) {

        port->portsc |= PORTSC_CSC;

        XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS,

                         port->portnr << 24};

        xhci_event(port->xhci, &ev, 0);

        DPRINTF("xhci: port change event for port %d\n", port->portnr);

    }

}


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

     loc_push_none(&loc);
+
+    for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
+
+        dinfo = drive_get(IF_SCSI, bus->busnr, unit);
+
         if (dinfo == NULL) {

             continue;

int scsi_bus_legacy_handle_cmdline(SCSIBus *bus)

{

    Location loc;

    DriveInfo *dinfo;

    int res = 0, unit;

    loc_push_none(&loc);

    for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {

        dinfo = drive_get(IF_SCSI, bus->busnr, unit);

        if (dinfo == NULL) {

            continue;

        }

        qemu_opts_loc_restore(dinfo->opts);

        if (!scsi_bus_legacy_add_drive(bus, dinfo->bdrv, unit)) {

            res = -1;

            break;

        }

    }

    loc_pop(&loc);

    return res;

}


--- a/source.c
+++ b/source.c
@@ -24,11 +24,11 @@
         goto out_nofid;
     }
     err = v9fs_co_fstat(pdu, fidp->fs.fd, &stbuf);
+    if (err < 0) {
+        goto out;
+    }
+    status = P9_LOCK_SUCCESS;
+out:
     put_fid(pdu, fidp);
 out_nofid:
     err = offset;

static void v9fs_lock(void *opaque)
{
    int8_t status;
    V9fsFlock *flock;
    size_t offset = 7;
    struct stat stbuf;
    V9fsFidState *fidp;
    int32_t fid, err = 0;
    V9fsPDU *pdu = opaque;
    V9fsState *s = pdu->s;
    flock = g_malloc(sizeof(*flock));
    pdu_unmarshal(pdu, offset, "dbdqqds", &fid, &flock->type,
                  &flock->flags, &flock->start, &flock->length,
                  &flock->proc_id, &flock->client_id);
    status = P9_LOCK_ERROR;
    /* We support only block flag now (that too ignored currently) */
    if (flock->flags & ~P9_LOCK_FLAGS_BLOCK) {
        err = -EINVAL;
        goto out_nofid;
    }
    fidp = get_fid(pdu, fid);
    if (fidp == NULL) {
        err = -ENOENT;
        goto out_nofid;
    }
    err = v9fs_co_fstat(pdu, fidp->fs.fd, &stbuf);
    if (err < 0) {
        goto out;
    }
    status = P9_LOCK_SUCCESS;
out:
    put_fid(pdu, fidp);
out_nofid:
    err = offset;
    err += pdu_marshal(pdu, offset, "b", status);
    trace_v9fs_lock_return(pdu->tag, pdu->id, status);
    complete_pdu(s, pdu, err);
    v9fs_string_free(&flock->client_id);
    g_free(flock);
}


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

 {

+    ProresContext *ctx = avctx->priv_data;

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

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

                               uint16_t *dst, int dst_stride,

                               const uint8_t *buf, unsigned buf_size,

                               const int16_t *qmat, int log2_blocks_per_mb)

{

    ProresContext *ctx = avctx->priv_data;

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

    int16_t *block;

    GetBitContext gb;

    int i, j, blocks_per_slice = slice->mb_count << log2_blocks_per_mb;

    int ret;

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

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

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

    decode_dc_coeffs(&gb, blocks, blocks_per_slice);

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

        return ret;

    block = blocks;

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

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

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

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

            block += 2*64;

            dst += 8;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 static int xen_host_pci_config_open(XenHostPCIDevice *d)

+{
+
+    char path[PATH_MAX];
+
     int rc;

     rc = xen_host_pci_sysfs_path(d, "config", path, sizeof (path));
+
     if (rc) {

         return rc;

static int xen_host_pci_config_open(XenHostPCIDevice *d)

{

    char path[PATH_MAX];

    int rc;

    rc = xen_host_pci_sysfs_path(d, "config", path, sizeof (path));

    if (rc) {

        return rc;

    }

    d->config_fd = open(path, O_RDWR);

    if (d->config_fd < 0) {

        return -errno;

    }

    return 0;

}


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

         put_symbol(&s->c, s->header_state, s->colorspace_type, 0);

+        put_symbol(&s->c, s->header_state, s->b_width, 0);
+
+        put_symbol(&s->c, s->header_state, s->b_height, 0);
+
+        put_symbol(&s->c, s->header_state, s->chroma_h_shift, 0);

         put_symbol(&s->c, s->header_state, s->chroma_v_shift, 0);

static void encode_header(SnowContext *s){

    int plane_index, level, orientation;

    put_cabac(&s->c, s->header_state, s->keyframe); // state clearing stuff?

    if(s->keyframe){

        put_symbol(&s->c, s->header_state, s->version, 0);

        put_symbol(&s->c, s->header_state, s->temporal_decomposition_type, 0);

        put_symbol(&s->c, s->header_state, s->temporal_decomposition_count, 0);

        put_symbol(&s->c, s->header_state, s->spatial_decomposition_count, 0);

        put_symbol(&s->c, s->header_state, s->colorspace_type, 0);

        put_symbol(&s->c, s->header_state, s->b_width, 0);

        put_symbol(&s->c, s->header_state, s->b_height, 0);

        put_symbol(&s->c, s->header_state, s->chroma_h_shift, 0);

        put_symbol(&s->c, s->header_state, s->chroma_v_shift, 0);

        put_cabac(&s->c, s->header_state, s->spatial_scalability);

//        put_cabac(&s->c, s->header_state, s->rate_scalability);

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

            for(level=0; level<s->spatial_decomposition_count; level++){

                for(orientation=level ? 1:0; orientation<4; orientation++){

                    if(orientation==2) continue;

                    put_symbol(&s->c, s->header_state, s->plane[plane_index].band[level][orientation].qlog, 1);

                }

            }

        }

    }

    put_symbol(&s->c, s->header_state, s->spatial_decomposition_type, 0);

    put_symbol(&s->c, s->header_state, s->qlog, 1);

    put_symbol(&s->c, s->header_state, s->mv_scale, 0);

    put_symbol(&s->c, s->header_state, s->qbias, 1);

}


--- a/source.c
+++ b/source.c
@@ -9,10 +9,10 @@
     av_freep(&esc->samples);

     esc->samples_size = 0;
+
+    esc->samples_idx = 0;
+
+

     return 0;

static av_cold int eightsvx_decode_close(AVCodecContext *avctx)

{

    EightSvxContext *esc = avctx->priv_data;

    av_freep(&esc->samples);

    esc->samples_size = 0;

    esc->samples_idx = 0;

    return 0;

}


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

                 target_phys_addr_t addr)

+{
+
     return addr >= OMAP_LOCALBUS_BASE && addr < OMAP_LOCALBUS_BASE + 0x1000000;

 }

int omap_validate_local_addr(struct omap_mpu_state_s *s,

                target_phys_addr_t addr)

{

    return addr >= OMAP_LOCALBUS_BASE && addr < OMAP_LOCALBUS_BASE + 0x1000000;

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static int del_existing_snapshots(Monitor *mon, const char *name)

 {
+
     BlockDriverState *bs;

     QEMUSnapshotInfo sn1, *snapshot = &sn1;
+
+    int ret;
+

     bs = NULL;

static int del_existing_snapshots(Monitor *mon, const char *name)

{

    BlockDriverState *bs;

    QEMUSnapshotInfo sn1, *snapshot = &sn1;

    int ret;

    bs = NULL;

    while ((bs = bdrv_next(bs))) {

        if (bdrv_can_snapshot(bs) &&

            bdrv_snapshot_find(bs, snapshot, name) >= 0)

        {

            ret = bdrv_snapshot_delete(bs, name);

            if (ret < 0) {

                monitor_printf(mon,

                               "Error while deleting snapshot on '%s'\n",

                               bdrv_get_device_name(bs));

                return -1;

            }

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     bool msi = msi_enabled(&d->pci);

     int level;
+
+
+
+    intel_hda_update_int_sts(d);
+
     if (d->int_sts & (1U << 31) && d->int_ctl & (1U << 31)) {

         level = 1;

static void intel_hda_update_irq(IntelHDAState *d)

{

    bool msi = msi_enabled(&d->pci);

    int level;

    intel_hda_update_int_sts(d);

    if (d->int_sts & (1U << 31) && d->int_ctl & (1U << 31)) {

        level = 1;

    } else {

        level = 0;

    }

    dprint(d, 2, "%s: level %d [%s]\n", __FUNCTION__,

           level, msi ? "msi" : "intx");

    if (msi) {

        if (level) {

            msi_notify(&d->pci, 0);

        }

    } else {

        pci_set_irq(&d->pci, level);

    }

}


void do_mulldo (void)

{

    int64_t th;

    uint64_t tl;

    muls64(&tl, &th, T0, T1);

    if (likely(th == 0)) {

        xer_ov = 0;

    } else {

        xer_ov = 1;

        xer_so = 1;

    }

    T0 = (int64_t)tl;

}


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

             buf_off += len;

+            iov_off += len;
+
+            size -= len;
+
+        }

         iovec_off += iov[i].iov_len;

size_t iov_from_buf(struct iovec *iov, unsigned int iov_cnt, size_t iov_off,

                    const void *buf, size_t size)

{

    size_t iovec_off, buf_off;

    unsigned int i;

    iovec_off = 0;

    buf_off = 0;

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

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

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

            memcpy(iov[i].iov_base + (iov_off - iovec_off), buf + buf_off, len);

            buf_off += len;

            iov_off += len;

            size -= len;

        }

        iovec_off += iov[i].iov_len;

    }

    return buf_off;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void store_slice_mmx(uint8_t *dst, const uint16_t *src,

                             int dst_stride, int src_stride,

static void store_slice_mmx(uint8_t *dst, const uint16_t *src,

                            int dst_stride, int src_stride,

                            int width, int height, int log2_scale,

                            const uint8_t dither[8][8])

{

    int y;

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

        uint8_t *dst1 = dst;

        const int16_t *src1 = src;

        __asm__ volatile(

            "movq (%3), %%mm3           \n"

            "movq (%3), %%mm4           \n"

            "movd %4, %%mm2             \n"

            "pxor %%mm0, %%mm0          \n"

            "punpcklbw %%mm0, %%mm3     \n"

            "punpckhbw %%mm0, %%mm4     \n"

            "psraw %%mm2, %%mm3         \n"

            "psraw %%mm2, %%mm4         \n"

            "movd %5, %%mm2             \n"

            "1:                         \n"

            "movq (%0), %%mm0           \n"

            "movq 8(%0), %%mm1          \n"

            "paddw %%mm3, %%mm0         \n"

            "paddw %%mm4, %%mm1         \n"

            "psraw %%mm2, %%mm0         \n"

            "psraw %%mm2, %%mm1         \n"

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

            "movq %%mm0, (%1)           \n"

            "add $16, %0                \n"

            "add $8, %1                 \n"

            "cmp %2, %1                 \n"

            " jb 1b                     \n"

            : "+r" (src1), "+r"(dst1)

            : "r"(dst + width), "r"(dither[y]), "g"(log2_scale), "g"(MAX_LEVEL - log2_scale)

        );

        src += src_stride;

        dst += dst_stride;

    }

}


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

     if(enc->codec_id == CODEC_ID_VORBIS)

+        return -1;

static int get_audio_frame_size(AVCodecContext *enc, int size)

{

    int frame_size;

    if(enc->codec_id == CODEC_ID_VORBIS)

        return -1;

    if (enc->frame_size <= 1) {

        int bits_per_sample = av_get_bits_per_sample(enc->codec_id);

        if (bits_per_sample) {

            if (enc->channels == 0)

                return -1;

            frame_size = (size << 3) / (bits_per_sample * enc->channels);

        } else {

            /* used for example by ADPCM codecs */

            if (enc->bit_rate == 0)

                return -1;

            frame_size = (size * 8 * enc->sample_rate) / enc->bit_rate;

        }

    } else {

        frame_size = enc->frame_size;

    }

    return frame_size;

}


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

     SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);

+    DeviceClass *k = DEVICE_CLASS(klass);

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

{

    SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);

    DeviceClass *k = DEVICE_CLASS(klass);

    sdc->init = pl181_init;

    k->vmsd = &vmstate_pl181;

    k->reset = pl181_reset;

    k->no_user = 1;

}


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

     }

+
+
+    ret = vfio_add_std_cap(vdev, pdev->config[PCI_CAPABILITY_LIST]);
+
+    if (ret) {

         return ret;

static int vfio_add_capabilities(VFIOPCIDevice *vdev)

{

    PCIDevice *pdev = &vdev->pdev;

    int ret;

    if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST) ||

        !pdev->config[PCI_CAPABILITY_LIST]) {

        return 0; /* Nothing to add */

    }

    ret = vfio_add_std_cap(vdev, pdev->config[PCI_CAPABILITY_LIST]);

    if (ret) {

        return ret;

    }

    /* on PCI bus, it doesn't make sense to expose extended capabilities. */

    if (!pci_is_express(pdev) ||

        !pci_bus_is_express(pdev->bus) ||

        !pci_get_long(pdev->config + PCI_CONFIG_SPACE_SIZE)) {

        return 0;

    }

    return vfio_add_ext_cap(vdev);

}


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

+    DPRINTF("set config status %d config %d id %u\n", config_status->status,

             config_status->configuration, id);

static void usbredir_configuration_status(void *priv, uint32_t id,

    struct usb_redir_configuration_status_header *config_status)

{

    USBRedirDevice *dev = priv;

    AsyncURB *aurb;

    int len = 0;

    DPRINTF("set config status %d config %d id %u\n", config_status->status,

            config_status->configuration, id);

    aurb = async_find(dev, id);

    if (!aurb) {

        return;

    }

    if (aurb->packet) {

        if (aurb->get) {

            dev->dev.data_buf[0] = config_status->configuration;

            len = 1;

        }

        aurb->packet->len =

            usbredir_handle_status(dev, config_status->status, len);

        usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);

    }

    async_free(dev, aurb);

}


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

     memset(desc, 0, sizeof(desc));

+    if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {
+
+        return -EIO;
+
+    }

static int vmdk_write_cid(BlockDriverState *bs, uint32_t cid)

{

    char desc[DESC_SIZE], tmp_desc[DESC_SIZE];

    char *p_name, *tmp_str;

    BDRVVmdkState *s = bs->opaque;

    memset(desc, 0, sizeof(desc));

    if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {

        return -EIO;

    }

    tmp_str = strstr(desc,"parentCID");

    pstrcpy(tmp_desc, sizeof(tmp_desc), tmp_str);

    if ((p_name = strstr(desc,"CID")) != NULL) {

        p_name += sizeof("CID");

        snprintf(p_name, sizeof(desc) - (p_name - desc), "%x\n", cid);

        pstrcat(desc, sizeof(desc), tmp_desc);

    }

    if (bdrv_pwrite_sync(bs->file, s->desc_offset, desc, DESC_SIZE) < 0) {

        return -EIO;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;

+
     if (av_new_packet(pkt, size+2) < 0)

         return AVERROR(EIO);

static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)

{

    VqfContext *c = s->priv_data;

    int ret;

    int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;

    if (av_new_packet(pkt, size+2) < 0)

        return AVERROR(EIO);

    pkt->pos          = avio_tell(s->pb);

    pkt->stream_index = 0;

    pkt->duration     = 1;

    pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip

    pkt->data[1] = c->last_frame_bits;

    ret = avio_read(s->pb, pkt->data+2, size);

    if (ret<=0) {

        av_free_packet(pkt);

        return AVERROR(EIO);

    }

    c->last_frame_bits = pkt->data[size+1];

    c->remaining_bits  = (size << 3) - c->frame_bit_len + c->remaining_bits;

    return size+2;

}


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

         env->spr[SPR_SDR1] = value;

+#if defined(TARGET_PPC64)

         if (env->mmu_model & POWERPC_MMU_64) {

void ppc_store_sdr1(CPUPPCState *env, target_ulong value)

{

    LOG_MMU("%s: " TARGET_FMT_lx "\n", __func__, value);

    if (env->spr[SPR_SDR1] != value) {

        env->spr[SPR_SDR1] = value;

#if defined(TARGET_PPC64)

        if (env->mmu_model & POWERPC_MMU_64) {

            target_ulong htabsize = value & SDR_64_HTABSIZE;

            if (htabsize > 28) {

                fprintf(stderr, "Invalid HTABSIZE 0x" TARGET_FMT_lx

                        " stored in SDR1\n", htabsize);

                htabsize = 28;

            }

            env->htab_mask = (1ULL << (htabsize + 18)) - 1;

            env->htab_base = value & SDR_64_HTABORG;

        } else

#endif /* defined(TARGET_PPC64) */

        {

            /* FIXME: Should check for valid HTABMASK values */

            env->htab_mask = ((value & SDR_32_HTABMASK) << 16) | 0xFFFF;

            env->htab_base = value & SDR_32_HTABORG;

        }

        tlb_flush(env, 1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void bonito_pciconf_writel(void *opaque, target_phys_addr_t addr,
+
+                                  uint64_t val, unsigned size)
+
 {

     PCIBonitoState *s = opaque;

static void bonito_pciconf_writel(void *opaque, target_phys_addr_t addr,

                                  uint64_t val, unsigned size)

{

    PCIBonitoState *s = opaque;

    PCIDevice *d = PCI_DEVICE(s);

    DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val);

    d->config_write(d, addr, val, 4);

}


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

 {

+    struct bt_l2cap_sdp_state_s *sdp = opaque;

     int i;

static void bt_l2cap_sdp_close_ch(void *opaque)

{

    struct bt_l2cap_sdp_state_s *sdp = opaque;

    int i;

    for (i = 0; i < sdp->services; i ++) {

        g_free(sdp->service_list[i].attribute_list->pair);

        g_free(sdp->service_list[i].attribute_list);

        g_free(sdp->service_list[i].uuid);

    }

    g_free(sdp->service_list);

    g_free(sdp);

}


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

 {

+    return job->deferred_to_main_loop ?
+
            qemu_get_aio_context() :

            blk_get_aio_context(job->blk);

static AioContext *block_job_get_aio_context(BlockJob *job)

{

    return job->deferred_to_main_loop ?

           qemu_get_aio_context() :

           blk_get_aio_context(job->blk);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void qvirtio_9p_pci_stop(QVirtIO9P *v9p)

 {
+
     qvirtqueue_cleanup(v9p->dev->bus, v9p->vq, v9p->qs->alloc);

     qvirtio_pci_device_disable(container_of(v9p->dev, QVirtioPCIDevice, vdev));

static void qvirtio_9p_pci_stop(QVirtIO9P *v9p)

{

    qvirtqueue_cleanup(v9p->dev->bus, v9p->vq, v9p->qs->alloc);

    qvirtio_pci_device_disable(container_of(v9p->dev, QVirtioPCIDevice, vdev));

    g_free(v9p->dev);

    qvirtio_9p_stop(v9p);

}


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

     return (qemu_chr_fe_get_msgfds(s, &fd, 1) == 1) ? fd : -1;
+
+}

int qemu_chr_fe_get_msgfd(CharDriverState *s)

{

    int fd;

    return (qemu_chr_fe_get_msgfds(s, &fd, 1) == 1) ? fd : -1;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int get_bits(J2kDecoderContext *s, int n)

+{

     int res = 0;
+
+    if (s->buf_end - s->buf < ((n - s->bit_index) >> 8))
+
         return AVERROR(EINVAL);

+    while (--n >= 0){

         res <<= 1;

static int get_bits(J2kDecoderContext *s, int n)

{

    int res = 0;

    if (s->buf_end - s->buf < ((n - s->bit_index) >> 8))

        return AVERROR(EINVAL);

    while (--n >= 0){

        res <<= 1;

        if (s->bit_index == 0){

            s->bit_index = 7 + (*s->buf != 0xff);

            s->buf++;

        }

        s->bit_index--;

        res |= (*s->buf >> s->bit_index) & 1;

    }

    return res;

}


--- a/source.c
+++ b/source.c
@@ -39,11 +39,11 @@
                                  virtio_net_receive, virtio_net_can_receive, n);

+
+    qemu_format_nic_info_str(n->vc, n->mac);
+
+
+
     n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n);

     n->tx_timer_active = 0;

PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)

{

    VirtIONet *n;

    static int virtio_net_id;

    n = (VirtIONet *)virtio_init_pci(bus, "virtio-net", 6900, 0x1000,

                                     0, VIRTIO_ID_NET,

                                     0x02, 0x00, 0x00,

                                     6, sizeof(VirtIONet));

    if (!n)

        return NULL;

    n->vdev.get_config = virtio_net_update_config;

    n->vdev.get_features = virtio_net_get_features;

    n->vdev.set_features = virtio_net_set_features;

    n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);

    n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx);

    memcpy(n->mac, nd->macaddr, 6);

    n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,

                                 virtio_net_receive, virtio_net_can_receive, n);

    qemu_format_nic_info_str(n->vc, n->mac);

    n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n);

    n->tx_timer_active = 0;

    n->mergeable_rx_bufs = 0;

    register_savevm("virtio-net", virtio_net_id++, 2,

                    virtio_net_save, virtio_net_load, n);

    return (PCIDevice *)n;

}


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

     return float64_chs(a);

+}

float64 HELPER(ucf64_negd)(float64 a)

{

    return float64_chs(a);

}


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

     if (block->flags & RAM_PREALLOC) {

+        ;

     } else if (xen_enabled()) {

static void reclaim_ramblock(RAMBlock *block)

{

    if (block->flags & RAM_PREALLOC) {

        ;

    } else if (xen_enabled()) {

        xen_invalidate_map_cache_entry(block->host);

#ifndef _WIN32

    } else if (block->fd >= 0) {

        munmap(block->host, block->max_length);

        close(block->fd);

#endif

    } else {

        qemu_anon_ram_free(block->host, block->max_length);

    }

    g_free(block);

}


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

    stbuf->st_blocks = prstat->st_blocks;

+   stbuf->st_atim.tv_sec = prstat->st_atim_sec;
+
+   stbuf->st_atim.tv_nsec = prstat->st_atim_nsec;
+
+   stbuf->st_mtime = prstat->st_mtim_sec;

    stbuf->st_mtim.tv_nsec = prstat->st_mtim_nsec;

static void prstat_to_stat(struct stat *stbuf, ProxyStat *prstat)

{

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

   stbuf->st_dev = prstat->st_dev;

   stbuf->st_ino = prstat->st_ino;

   stbuf->st_nlink = prstat->st_nlink;

   stbuf->st_mode = prstat->st_mode;

   stbuf->st_uid = prstat->st_uid;

   stbuf->st_gid = prstat->st_gid;

   stbuf->st_rdev = prstat->st_rdev;

   stbuf->st_size = prstat->st_size;

   stbuf->st_blksize = prstat->st_blksize;

   stbuf->st_blocks = prstat->st_blocks;

   stbuf->st_atim.tv_sec = prstat->st_atim_sec;

   stbuf->st_atim.tv_nsec = prstat->st_atim_nsec;

   stbuf->st_mtime = prstat->st_mtim_sec;

   stbuf->st_mtim.tv_nsec = prstat->st_mtim_nsec;

   stbuf->st_ctime = prstat->st_ctim_sec;

   stbuf->st_ctim.tv_nsec = prstat->st_ctim_nsec;

}


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

     NBDExport *exp = client->exp;

+

     if (exp) {

static coroutine_fn void nbd_co_client_start(void *opaque)

{

    NBDClientNewData *data = opaque;

    NBDClient *client = data->client;

    NBDExport *exp = client->exp;

    if (exp) {

        nbd_export_get(exp);

        QTAILQ_INSERT_TAIL(&exp->clients, client, next);

    }

    qemu_co_mutex_init(&client->send_lock);

    if (nbd_negotiate(data)) {

        client_close(client);

        goto out;

    }

    nbd_client_receive_next_request(client);

out:

    g_free(data);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
+
+{
+
+    int count, i;

int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)

{

    int count, i;

    if (avctx->bits_per_coded_sample > 8) {

        av_log(avctx, AV_LOG_ERROR, "bit_per_coded_sample > 8 not supported\n");

        return AVERROR_INVALIDDATA;

    }

    count = 1 << avctx->bits_per_coded_sample;

    if (avctx->extradata_size < count * 3) {

        av_log(avctx, AV_LOG_ERROR, "palette data underflow\n");

        return AVERROR_INVALIDDATA;

    }

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

        pal[i] = 0xFF000000 | AV_RB24( avctx->extradata + i*3 );

    }

    return 0;

}


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

     if (unlikely((float64_is_infinity(farg1.d) && float64_is_zero(farg2.d)) ||

+                 (float64_is_zero(farg1.d) && float64_is_infinity(farg2.d)))) {
+
+        /* Multiplication of zero by infinity */
+
+        farg1.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ);

     } else {

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

{

    CPU_DoubleU farg1, farg2;

    farg1.ll = arg1;

    farg2.ll = arg2;

    if (unlikely((float64_is_infinity(farg1.d) && float64_is_zero(farg2.d)) ||

                 (float64_is_zero(farg1.d) && float64_is_infinity(farg2.d)))) {

        /* Multiplication of zero by infinity */

        farg1.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ);

    } else {

        if (unlikely(float64_is_signaling_nan(farg1.d) ||

                     float64_is_signaling_nan(farg2.d))) {

            /* sNaN multiplication */

            fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN);

        }

        farg1.d = float64_mul(farg1.d, farg2.d, &env->fp_status);

    }

    return farg1.ll;

}


static void h261_h_loop_filter_c(uint8_t *dest,uint8_t *src, int stride){

    int i,j,xy,yz;

    int res;

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

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

            xy = j * stride + i;

            yz = j * 8 + i;

            res = (int)src[yz-1] + ((int)(src[yz]) *2) + (int)src[yz+1];

            res+=2;

            res>>=2;

            dest[xy] = (uint8_t)res;

        }

    }

}


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

                                  Error **errp)

+{
+
+    s->get_error = socket_errno;
+
     s->write = socket_write;

+    s->close = tcp_close;
+
+
+
     s->fd = inet_connect(host_port, false, NULL, errp);
+

+    if (!error_is_set(errp)) {

         migrate_fd_connect(s);

int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,

                                 Error **errp)

{

    s->get_error = socket_errno;

    s->write = socket_write;

    s->close = tcp_close;

    s->fd = inet_connect(host_port, false, NULL, errp);

    if (!error_is_set(errp)) {

        migrate_fd_connect(s);

    } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_IN_PROGRESS)) {

        DPRINTF("connect in progress\n");

        qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s);

    } else if (error_is_type(*errp, QERR_SOCKET_CREATE_FAILED)) {

        DPRINTF("connect failed\n");

        return -1;

    } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_FAILED)) {

        DPRINTF("connect failed\n");

        migrate_fd_error(s);

        return -1;

    } else {

        DPRINTF("unknown error\n");

        return -1;

    }

    return 0;

}


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

         .misc = (MCM_ADDR_PHYS << 6) | 0xc,
+
+    };
+
+    int r;
+

     r = kvm_set_mce(env, &mce);

static void kvm_mce_inj_srar_dataload(CPUState *env, target_phys_addr_t paddr)

{

    struct kvm_x86_mce mce = {

        .bank = 9,

        .status = MCI_STATUS_VAL | MCI_STATUS_UC | MCI_STATUS_EN

                  | MCI_STATUS_MISCV | MCI_STATUS_ADDRV | MCI_STATUS_S

                  | MCI_STATUS_AR | 0x134,

        .mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV,

        .addr = paddr,

        .misc = (MCM_ADDR_PHYS << 6) | 0xc,

    };

    int r;

    r = kvm_set_mce(env, &mce);

    if (r < 0) {

        fprintf(stderr, "kvm_set_mce: %s\n", strerror(errno));

        abort();

    }

    kvm_mce_broadcast_rest(env);

}


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

+    close_input_file(&fmt_ctx);
+
+    return 0;
+
+}

static int probe_file(const char *filename)

{

    AVFormatContext *fmt_ctx;

    int ret, i;

    if ((ret = open_input_file(&fmt_ctx, filename)))

        return ret;

    if (do_show_packets)

        show_packets(fmt_ctx);

    if (do_show_streams)

        for (i = 0; i < fmt_ctx->nb_streams; i++)

            show_stream(fmt_ctx, i);

    if (do_show_format)

        show_format(fmt_ctx);

    close_input_file(&fmt_ctx);

    return 0;

}


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

     char *buf = NULL;

+
+
+    nfs_co_init_task(client, &task);
+
+

     buf = g_try_malloc(nb_sectors * BDRV_SECTOR_SIZE);

static int coroutine_fn nfs_co_writev(BlockDriverState *bs,

                                        int64_t sector_num, int nb_sectors,

                                        QEMUIOVector *iov)

{

    NFSClient *client = bs->opaque;

    NFSRPC task;

    char *buf = NULL;

    nfs_co_init_task(client, &task);

    buf = g_try_malloc(nb_sectors * BDRV_SECTOR_SIZE);

    if (nb_sectors && buf == NULL) {

        return -ENOMEM;

    }

    qemu_iovec_to_buf(iov, 0, buf, nb_sectors * BDRV_SECTOR_SIZE);

    if (nfs_pwrite_async(client->context, client->fh,

                         sector_num * BDRV_SECTOR_SIZE,

                         nb_sectors * BDRV_SECTOR_SIZE,

                         buf, nfs_co_generic_cb, &task) != 0) {

        g_free(buf);

        return -ENOMEM;

    }

    while (!task.complete) {

        nfs_set_events(client);

        qemu_coroutine_yield();

    }

    g_free(buf);

    if (task.ret != nb_sectors * BDRV_SECTOR_SIZE) {

        return task.ret < 0 ? task.ret : -EIO;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -12,11 +12,11 @@
     err = pdu_unmarshal(pdu, offset, "dds", &fid, &newdirfid, &name);
     if (err < 0) {
     fidp = get_fid(pdu, fid);
+    if (fidp == NULL) {
+    BUG_ON(fidp->fid_type != P9_FID_NONE);
+    /* if fs driver is not path based, return EOPNOTSUPP */
+    if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) {
+        err = -EOPNOTSUPP;
         goto out;
     v9fs_path_write_lock(s);
     err = v9fs_complete_rename(pdu, fidp, newdirfid, &name);

static void v9fs_rename(void *opaque)
{
    int32_t fid;
    ssize_t err = 0;
    size_t offset = 7;
    V9fsString name;
    int32_t newdirfid;
    V9fsFidState *fidp;
    V9fsPDU *pdu = opaque;
    V9fsState *s = pdu->s;
    v9fs_string_init(&name);
    err = pdu_unmarshal(pdu, offset, "dds", &fid, &newdirfid, &name);
    if (err < 0) {
    fidp = get_fid(pdu, fid);
    if (fidp == NULL) {
    BUG_ON(fidp->fid_type != P9_FID_NONE);
    /* if fs driver is not path based, return EOPNOTSUPP */
    if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) {
        err = -EOPNOTSUPP;
        goto out;
    v9fs_path_write_lock(s);
    err = v9fs_complete_rename(pdu, fidp, newdirfid, &name);
    v9fs_path_unlock(s);
    if (!err) {
        err = offset;
out:
    put_fid(pdu, fidp);
out_nofid:
    pdu_complete(pdu, err);
    v9fs_string_free(&name);


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void virtio_queue_aio_set_host_notifier_handler(VirtQueue *vq, AioContext *ctx,

+                                                bool assign, bool set_handler)

 {

     if (assign && set_handler) {
+
         aio_set_event_notifier(ctx, &vq->host_notifier, true,

                                virtio_queue_host_notifier_read);

void virtio_queue_aio_set_host_notifier_handler(VirtQueue *vq, AioContext *ctx,

                                                bool assign, bool set_handler)

{

    if (assign && set_handler) {

        aio_set_event_notifier(ctx, &vq->host_notifier, true,

                               virtio_queue_host_notifier_read);

    } else {

        aio_set_event_notifier(ctx, &vq->host_notifier, true, NULL);

    }

    if (!assign) {

        /* Test and clear notifier before after disabling event,

         * in case poll callback didn't have time to run. */

        virtio_queue_host_notifier_read(&vq->host_notifier);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,

                               int (*compare)(AVFormatContext *, AVPacket *, AVPacket *))

void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,

                              int (*compare)(AVFormatContext *, AVPacket *, AVPacket *))

{

    AVPacketList **next_point, *this_pktl;

    this_pktl = av_mallocz(sizeof(AVPacketList));

    this_pktl->pkt= *pkt;

    pkt->destruct= NULL;             // do not free original but only the copy

    av_dup_packet(&this_pktl->pkt);  // duplicate the packet if it uses non-alloced memory

    if(s->streams[pkt->stream_index]->last_in_packet_buffer){

        next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next);

    }else

        next_point = &s->packet_buffer;

    if(*next_point){

        if(compare(s, &s->packet_buffer_end->pkt, pkt)){

            while(!compare(s, &(*next_point)->pkt, pkt)){

                next_point= &(*next_point)->next;

            }

            goto next_non_null;

        }else{

            next_point = &(s->packet_buffer_end->next);

        }

    }

    assert(!*next_point);

    s->packet_buffer_end= this_pktl;

next_non_null:

    this_pktl->next= *next_point;

    s->streams[pkt->stream_index]->last_in_packet_buffer=

    *next_point= this_pktl;

}


static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs,

                                       ptrdiff_t stride)

{

    int x, y;

    pixel *dst = (pixel *)_dst;

    stride /= sizeof(pixel);

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

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

            dst[x] += *coeffs;

            coeffs++;

        }

        dst += stride;

    }

}


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

                                           bool is_write)
+
 {

     Coroutine *co;

static BlockAIOCB *bdrv_co_aio_prw_vector(BdrvChild *child,

                                          int64_t offset,

                                          QEMUIOVector *qiov,

                                          BdrvRequestFlags flags,

                                          BlockCompletionFunc *cb,

                                          void *opaque,

                                          bool is_write)

{

    Coroutine *co;

    BlockAIOCBCoroutine *acb;

    /* Matched by bdrv_co_complete's bdrv_dec_in_flight.  */

    bdrv_inc_in_flight(child->bs);

    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, child->bs, cb, opaque);

    acb->child = child;

    acb->need_bh = true;

    acb->req.error = -EINPROGRESS;

    acb->req.offset = offset;

    acb->req.qiov = qiov;

    acb->req.flags = flags;

    acb->is_write = is_write;

    co = qemu_coroutine_create(bdrv_co_do_rw, acb);

    qemu_coroutine_enter(co);

    bdrv_co_maybe_schedule_bh(acb);

    return &acb->common;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+bool qemu_file_is_writable(QEMUFile *f)

 {

bool qemu_file_is_writable(QEMUFile *f)

{

    return f->ops->writev_buffer || f->ops->put_buffer;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static inline int compare_masked(uint64_t x, uint64_t y, uint64_t mask)
+
 {

     return (x & mask) == (y & mask);

static inline int compare_masked(uint64_t x, uint64_t y, uint64_t mask)

{

    return (x & mask) == (y & mask);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+int index_from_key(const char *key)

 {
+
     int i;

int index_from_key(const char *key)

{

    int i;

    for (i = 0; QKeyCode_lookup[i] != NULL; i++) {

        if (!strcmp(key, QKeyCode_lookup[i])) {

            break;

        }

    }

    /* Return Q_KEY_CODE__MAX if the key is invalid */

    return i;

}


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

                                 ptrdiff_t stride)

+{
+
     avc_luma_mid_4w_msa(src - (2 * stride) - 2, stride, dst, stride, 4);

 }

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

                                ptrdiff_t stride)

{

    avc_luma_mid_4w_msa(src - (2 * stride) - 2, stride, dst, stride, 4);

}


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

     printf("%s: recv not supported!!!\n", __FUNCTION__);
+
+    return -1;

 }

static int tosa_dac_recv(I2CSlave *s)

{

    printf("%s: recv not supported!!!\n", __FUNCTION__);

    return -1;

}


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

     ram_addr_t actual;

+
+
+    actual = qemu_balloon_status();
+
+    if (kvm_enabled() && !kvm_has_sync_mmu())

         qemu_error_new(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon");

static void do_info_balloon(Monitor *mon, QObject **ret_data)

{

    ram_addr_t actual;

    actual = qemu_balloon_status();

    if (kvm_enabled() && !kvm_has_sync_mmu())

        qemu_error_new(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon");

    else if (actual == 0)

        qemu_error_new(QERR_DEVICE_NOT_ACTIVE, "balloon");

    else

        *ret_data = qobject_from_jsonf("{ 'balloon': %" PRId64 "}",

                                       (int64_t) actual);

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     switch (event) {

     case I2C_START_SEND:
+
+        s->i2c_len = 0;
+
+        break;
+
     case I2C_FINISH:

 #ifdef VERBOSE

static int wm8750_event(I2CSlave *i2c, enum i2c_event event)

{

    WM8750State *s = WM8750(i2c);

    switch (event) {

    case I2C_START_SEND:

        s->i2c_len = 0;

        break;

    case I2C_FINISH:

#ifdef VERBOSE

        if (s->i2c_len < 2)

            printf("%s: message too short (%i bytes)\n",

                            __FUNCTION__, s->i2c_len);

#endif

        break;

    default:

        break;

    }

    return 0;

}


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

+    trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque);
+
+
+
+    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);

     acb->need_bh = true;

BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs,

        int64_t sector_num, int nb_sectors,

        BlockCompletionFunc *cb, void *opaque)

{

    Coroutine *co;

    BlockAIOCBCoroutine *acb;

    trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque);

    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);

    acb->need_bh = true;

    acb->req.error = -EINPROGRESS;

    acb->req.sector = sector_num;

    acb->req.nb_sectors = nb_sectors;

    co = qemu_coroutine_create(bdrv_aio_discard_co_entry);

    qemu_coroutine_enter(co, acb);

    bdrv_co_maybe_schedule_bh(acb);

    return &acb->common;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 int qemu_register_machine(QEMUMachine *m)

+{

     TypeInfo ti = {

int qemu_register_machine(QEMUMachine *m)

{

    TypeInfo ti = {

        .name       = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL),

        .parent     = TYPE_MACHINE,

        .class_init = machine_class_init,

        .class_data = (void *)m,

    };

    type_register(&ti);

    return 0;

}


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

     case USB_SPEED_LOW:

+    case USB_SPEED_FULL:
+
+    case USB_SPEED_HIGH:
+
+        set_field(&port->portsc, PLS_U0, PORTSC_PLS);

         trace_usb_xhci_port_link(port->portnr, PLS_U0);

static void xhci_port_reset(XHCIPort *port)

{

    trace_usb_xhci_port_reset(port->portnr);

    if (!xhci_port_have_device(port)) {

        return;

    }

    usb_device_reset(port->uport->dev);

    switch (port->uport->dev->speed) {

    case USB_SPEED_LOW:

    case USB_SPEED_FULL:

    case USB_SPEED_HIGH:

        set_field(&port->portsc, PLS_U0, PORTSC_PLS);

        trace_usb_xhci_port_link(port->portnr, PLS_U0);

        port->portsc |= PORTSC_PED;

        break;

    }

    port->portsc &= ~PORTSC_PR;

    xhci_port_notify(port, PORTSC_PRC);

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
         proxy->class_code = PCI_CLASS_STORAGE_SCSI;

+
+    if (!proxy->block.bs) {
+
+        error_report("virtio-blk-pci: drive property not set");
+

     vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);

static int virtio_blk_init_pci(PCIDevice *pci_dev)

{

    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);

    VirtIODevice *vdev;

    if (proxy->class_code != PCI_CLASS_STORAGE_SCSI &&

        proxy->class_code != PCI_CLASS_STORAGE_OTHER)

        proxy->class_code = PCI_CLASS_STORAGE_SCSI;

    if (!proxy->block.bs) {

        error_report("virtio-blk-pci: drive property not set");

    vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);

    vdev->nvectors = proxy->nvectors;

    virtio_init_pci(proxy, vdev,

                    PCI_VENDOR_ID_REDHAT_QUMRANET,

                    PCI_DEVICE_ID_VIRTIO_BLOCK,

                    proxy->class_code, 0x00);

    /* make the actual value visible */

    proxy->nvectors = vdev->nvectors;

    return 0;


int spapr_allocate_irq_block(int num, bool lsi)

{

    int first = -1;

    int i;

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

        int irq;

        irq = spapr_allocate_irq(0, lsi);

        if (!irq) {

            return -1;

        }

        if (0 == i) {

            first = irq;

        }

        /* If the above doesn't create a consecutive block then that's

         * an internal bug */

        assert(irq == (first + i));

    }

    return first;

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
         tlb_update_dirty(&env->tlb_table[2][i]);

 #endif
+
+#if (NB_MMU_MODES >= 4)
+
+    for(i = 0; i < CPU_TLB_SIZE; i++)
+
         tlb_update_dirty(&env->tlb_table[3][i]);

 #endif

void cpu_tlb_update_dirty(CPUState *env)

{

    int i;

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

        tlb_update_dirty(&env->tlb_table[0][i]);

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

        tlb_update_dirty(&env->tlb_table[1][i]);

#if (NB_MMU_MODES >= 3)

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

        tlb_update_dirty(&env->tlb_table[2][i]);

#endif

#if (NB_MMU_MODES >= 4)

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

        tlb_update_dirty(&env->tlb_table[3][i]);

#endif

#if (NB_MMU_MODES >= 5)

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

        tlb_update_dirty(&env->tlb_table[4][i]);

#endif

}


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

     qdev_prop_set(dev, name, &value, PROP_TYPE_PTR);

+}

void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value)

{

    qdev_prop_set(dev, name, &value, PROP_TYPE_PTR);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void HELPER(entry)(CPUXtensaState *env, uint32_t pc, uint32_t s, uint32_t imm)
 {
     int callinc = (env->sregs[PS] & PS_CALLINC) >> PS_CALLINC_SHIFT;
+    if (s > 3 || ((env->sregs[PS] & (PS_WOE | PS_EXCM)) ^ PS_WOE) != 0) {
+        qemu_log("Illegal entry instruction(pc = %08x), PS = %08x\n",
+                pc, env->sregs[PS]);
         HELPER(exception_cause)(env, pc, ILLEGAL_INSTRUCTION_CAUSE);
     } else {
         env->regs[(callinc << 2) | (s & 3)] = env->regs[s] - (imm << 3);

void HELPER(entry)(CPUXtensaState *env, uint32_t pc, uint32_t s, uint32_t imm)
{
    int callinc = (env->sregs[PS] & PS_CALLINC) >> PS_CALLINC_SHIFT;
    if (s > 3 || ((env->sregs[PS] & (PS_WOE | PS_EXCM)) ^ PS_WOE) != 0) {
        qemu_log("Illegal entry instruction(pc = %08x), PS = %08x\n",
                pc, env->sregs[PS]);
        HELPER(exception_cause)(env, pc, ILLEGAL_INSTRUCTION_CAUSE);
    } else {
        env->regs[(callinc << 2) | (s & 3)] = env->regs[s] - (imm << 3);
        rotate_window(env, callinc);
        env->sregs[WINDOW_START] |=
            windowstart_bit(env->sregs[WINDOW_BASE], env);


--- a/source.c
+++ b/source.c
@@ -53,11 +53,11 @@
         /* Allredy attached ? */

         if (hostdev_find(bus_num, addr))
+
+            return 0;
+
+
+
         dprintf("husb: auto open: bus_num %d addr %d\n", bus_num, addr);

static int usb_host_auto_scan(void *opaque, int bus_num, int addr,

                     int class_id, int vendor_id, int product_id,

                     const char *product_name, int speed)

{

    struct USBAutoFilter *f;

    struct USBDevice *dev;

    /* Ignore hubs */

    if (class_id == 9)

        return 0;

    for (f = usb_auto_filter; f; f = f->next) {

	if (f->bus_num >= 0 && f->bus_num != bus_num)

            continue;

	if (f->addr >= 0 && f->addr != addr)

            continue;

	if (f->vendor_id >= 0 && f->vendor_id != vendor_id)

            continue;

	if (f->product_id >= 0 && f->product_id != product_id)

            continue;

        /* We got a match */

        /* Allredy attached ? */

        if (hostdev_find(bus_num, addr))

            return 0;

        dprintf("husb: auto open: bus_num %d addr %d\n", bus_num, addr);

	dev = usb_host_device_open_addr(bus_num, addr, product_name);

    }

    return 0;

}