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

     }
+
+    pkt->stream_index = 0;
+
+    wc->block_parsed = 1;
+
     pkt->size = ret + WV_EXTRA_SIZE;

static int wv_read_packet(AVFormatContext *s,

                          AVPacket *pkt)

{

    WVContext *wc = s->priv_data;

    int ret, samples;

    if (url_feof(&s->pb))

        return -EIO;

    if(wc->block_parsed){

        if(wv_read_block_header(s, &s->pb) < 0)

            return -1;

    }

    samples = LE_32(wc->extra);

    /* should not happen but who knows */

    if(samples * 2 * wc->chan > AVCODEC_MAX_AUDIO_FRAME_SIZE){

        av_log(s, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n");

        return -EIO;

    }

    if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0)

        return AVERROR_NOMEM;

    memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE);

    ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize);

    if(ret != wc->blksize){

        av_free_packet(pkt);

        return AVERROR_IO;

    }

    pkt->stream_index = 0;

    wc->block_parsed = 1;

    pkt->size = ret + WV_EXTRA_SIZE;

    return 0;

}


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

     int i;

+    pixel *dst = (pixel *) _dst;
+
+    dctcoef *src = (dctcoef *) _src;
+
     stride /= sizeof(pixel);

static void FUNCC(ff_h264_add_pixels4)(uint8_t *_dst, int16_t *_src, int stride)

{

    int i;

    pixel *dst = (pixel *) _dst;

    dctcoef *src = (dctcoef *) _src;

    stride /= sizeof(pixel);

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

        dst[0] += src[0];

        dst[1] += src[1];

        dst[2] += src[2];

        dst[3] += src[3];

        dst += stride;

        src += 4;

    }

    memset(_src, 0, sizeof(dctcoef) * 16);

}


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

     int ret;

+
+
+    if (dev == NULL) {
+
+        return USB_RET_NODEV;

     }

int usb_handle_packet(USBDevice *dev, USBPacket *p)

{

    int ret;

    if (dev == NULL) {

        return USB_RET_NODEV;

    }

    assert(dev->addr == p->devaddr);

    assert(dev->state == USB_STATE_DEFAULT);

    assert(p->state == USB_PACKET_SETUP);

    if (p->devep == 0) {

        /* control pipe */

        switch (p->pid) {

        case USB_TOKEN_SETUP:

            ret = do_token_setup(dev, p);

            break;

        case USB_TOKEN_IN:

            ret = do_token_in(dev, p);

            break;

        case USB_TOKEN_OUT:

            ret = do_token_out(dev, p);

            break;

        default:

            ret = USB_RET_STALL;

            break;

        }

    } else {

        /* data pipe */

        ret = usb_device_handle_data(dev, p);

    }

    if (ret == USB_RET_ASYNC) {

        p->ep = usb_ep_get(dev, p->pid, p->devep);

        p->state = USB_PACKET_ASYNC;

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -6,11 +6,11 @@
     minor = get_bits(&gb, 8); /* version minor */
     micro = get_bits(&gb, 8); /* version micro */
     av_log(avctx, AV_LOG_INFO, "Theora bitstream version %d.%d.%d\n",
+	major, minor, micro);
+    /* FIXME: endianess? */
+    s->theora = (major << 16) | (minor << 8) | micro;
+    /* 3.3.0 aka alpha3 has the same frame orientation as original vp3 */
+    /* but previous versions have the image flipped relative to vp3 */
     if (s->theora < 0x030300)
     {
 	s->flipped_image = 1;

static int theora_decode_header(AVCodecContext *avctx, GetBitContext gb)
{
    Vp3DecodeContext *s = avctx->priv_data;
    int major, minor, micro;
    major = get_bits(&gb, 8); /* version major */
    minor = get_bits(&gb, 8); /* version minor */
    micro = get_bits(&gb, 8); /* version micro */
    av_log(avctx, AV_LOG_INFO, "Theora bitstream version %d.%d.%d\n",
	major, minor, micro);
    /* FIXME: endianess? */
    s->theora = (major << 16) | (minor << 8) | micro;
    /* 3.3.0 aka alpha3 has the same frame orientation as original vp3 */
    /* but previous versions have the image flipped relative to vp3 */
    if (s->theora < 0x030300)
    {
	s->flipped_image = 1;
        av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n");
    s->width = get_bits(&gb, 16) << 4;
    s->height = get_bits(&gb, 16) << 4;
    skip_bits(&gb, 24); /* frame width */
    skip_bits(&gb, 24); /* frame height */
    skip_bits(&gb, 8); /* offset x */
    skip_bits(&gb, 8); /* offset y */
    skip_bits(&gb, 32); /* fps numerator */
    skip_bits(&gb, 32); /* fps denumerator */
    skip_bits(&gb, 24); /* aspect numerator */
    skip_bits(&gb, 24); /* aspect denumerator */
    if (s->theora < 0x030300)
	skip_bits(&gb, 5); /* keyframe frequency force */
    skip_bits(&gb, 8); /* colorspace */
    skip_bits(&gb, 24); /* bitrate */
    skip_bits(&gb, 6); /* last(?) quality index */
    if (s->theora >= 0x030300)
    {
	skip_bits(&gb, 5); /* keyframe frequency force */
	skip_bits(&gb, 5); /* spare bits */
//    align_get_bits(&gb);
    avctx->width = s->width;
    avctx->height = s->height;
    vp3_decode_init(avctx);
    return 0;


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

     ret = opt->value.uint;

+    if (del) {
+
+        qemu_opt_del_all(opts, name);
+
+    }

     return ret;

static uint64_t qemu_opt_get_number_helper(QemuOpts *opts, const char *name,

                                           uint64_t defval, bool del)

{

    QemuOpt *opt = qemu_opt_find(opts, name);

    uint64_t ret = defval;

    if (opt == NULL) {

        const QemuOptDesc *desc = find_desc_by_name(opts->list->desc, name);

        if (desc && desc->def_value_str) {

            parse_option_number(name, desc->def_value_str, &ret, &error_abort);

        }

        return ret;

    }

    assert(opt->desc && opt->desc->type == QEMU_OPT_NUMBER);

    ret = opt->value.uint;

    if (del) {

        qemu_opt_del_all(opts, name);

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     if (!ogg->page_list)

         return;
+
+
+
+    for (p = ogg->page_list; p; ) {
+
         OGGStreamContext *oggstream =

             s->streams[p->page.stream_index]->priv_data;

static void ogg_write_pages(AVFormatContext *s, int flush)

{

    OGGContext *ogg = s->priv_data;

    OGGPageList *next, *p;

    if (!ogg->page_list)

        return;

    for (p = ogg->page_list; p; ) {

        OGGStreamContext *oggstream =

            s->streams[p->page.stream_index]->priv_data;

        if (oggstream->page_count < 2 && !flush)

            break;

        ogg_write_page(s, &p->page,

                       flush && oggstream->page_count == 1 ? 4 : 0); // eos

        next = p->next;

        av_freep(&p);

        p = next;

    }

    ogg->page_list = p;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void ohci_bus_stop(OHCIState *ohci)

+{
+
+    trace_usb_ohci_stop(ohci->name);

+    if (ohci->eof_timer) {

         timer_del(ohci->eof_timer);

static void ohci_bus_stop(OHCIState *ohci)

{

    trace_usb_ohci_stop(ohci->name);

    if (ohci->eof_timer) {

        timer_del(ohci->eof_timer);

        timer_free(ohci->eof_timer);

    }

    ohci->eof_timer = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void xilinx_axidma_init(Object *obj)

 {
+
+    XilinxAXIDMA *s = XILINX_AXI_DMA(obj);

     SysBusDevice *sbd = SYS_BUS_DEVICE(obj);

static void xilinx_axidma_init(Object *obj)

{

    XilinxAXIDMA *s = XILINX_AXI_DMA(obj);

    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);

    object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE,

                             (Object **)&s->tx_data_dev, &error_abort);

    object_property_add_link(obj, "axistream-control-connected",

                             TYPE_STREAM_SLAVE,

                             (Object **)&s->tx_control_dev, &error_abort);

    object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev),

                      TYPE_XILINX_AXI_DMA_DATA_STREAM);

    object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev),

                      TYPE_XILINX_AXI_DMA_CONTROL_STREAM);

    object_property_add_child(OBJECT(s), "axistream-connected-target",

                              (Object *)&s->rx_data_dev, &error_abort);

    object_property_add_child(OBJECT(s), "axistream-control-connected-target",

                              (Object *)&s->rx_control_dev, &error_abort);

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

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

    memory_region_init_io(&s->iomem, obj, &axidma_ops, s,

                          "xlnx.axi-dma", R_MAX * 4 * 2);

    sysbus_init_mmio(sbd, &s->iomem);

}


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

 {

+    char path[PATH_MAX];
+
+    char buf[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE];

     int fd, rc;

static int xen_host_pci_get_value(XenHostPCIDevice *d, const char *name,

                                  unsigned int *pvalue, int base)

{

    char path[PATH_MAX];

    char buf[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE];

    int fd, rc;

    unsigned long value;

    char *endptr;

    rc = xen_host_pci_sysfs_path(d, name, path, sizeof (path));

    if (rc) {

        return rc;

    }

    fd = open(path, O_RDONLY);

    if (fd == -1) {

        XEN_HOST_PCI_LOG("Error: Can't open %s: %s\n", path, strerror(errno));

        return -errno;

    }

    do {

        rc = read(fd, &buf, sizeof (buf) - 1);

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

            rc = -errno;

            goto out;

        }

    } while (rc < 0);

    buf[rc] = 0;

    value = strtol(buf, &endptr, base);

    if (endptr == buf || *endptr != '\n') {

        rc = -1;

    } else if ((value == LONG_MIN || value == LONG_MAX) && errno == ERANGE) {

        rc = -errno;

    } else {

        rc = 0;

        *pvalue = value;

    }

out:

    close(fd);

    return rc;

}


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

 	struct envlist_entry *entry;

+
+
 	assert(envlist != NULL);
+

 	while (envlist->el_entries.lh_first != NULL) {

envlist_free(envlist_t *envlist)

{

	struct envlist_entry *entry;

	assert(envlist != NULL);

	while (envlist->el_entries.lh_first != NULL) {

		entry = envlist->el_entries.lh_first;

		QLIST_REMOVE(entry, ev_link);

		free((char *)entry->ev_var);

		free(entry);

	}

	free(envlist);

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
     kd = g_new0(KVMDevice, 1);

     kd->mr = mr;
+
+    kd->kda.id = devid;
+
+    kd->kda.addr = -1;
+
     QSLIST_INSERT_HEAD(&kvm_devices_head, kd, entries);

     memory_region_ref(kd->mr);

void kvm_arm_register_device(MemoryRegion *mr, uint64_t devid)

{

    KVMDevice *kd;

    if (!kvm_irqchip_in_kernel()) {

        return;

    }

    if (QSLIST_EMPTY(&kvm_devices_head)) {

        memory_listener_register(&devlistener, NULL);

        qemu_add_machine_init_done_notifier(&notify);

    }

    kd = g_new0(KVMDevice, 1);

    kd->mr = mr;

    kd->kda.id = devid;

    kd->kda.addr = -1;

    QSLIST_INSERT_HEAD(&kvm_devices_head, kd, entries);

    memory_region_ref(kd->mr);

}


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

 {

+    NFSRPC *task = opaque;

     task->complete = 1;

static void nfs_co_generic_bh_cb(void *opaque)

{

    NFSRPC *task = opaque;

    task->complete = 1;

    qemu_bh_delete(task->bh);

    qemu_coroutine_enter(task->co, NULL);

}


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

     DEBUG("slow_bar_writeb addr=0x" TARGET_FMT_plx " val=0x%02x\n", addr, val);

+    *out = val;
+
+}

static void slow_bar_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)

{

    AssignedDevRegion *d = opaque;

    uint8_t *out = d->u.r_virtbase + addr;

    DEBUG("slow_bar_writeb addr=0x" TARGET_FMT_plx " val=0x%02x\n", addr, val);

    *out = val;

}


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

 {

+    uint32_t val, size, addr;

     PCIDevice *dev = find_dev(spapr, 0, rtas_ld(args, 0));

static void rtas_write_pci_config(sPAPREnvironment *spapr,

                                  uint32_t token, uint32_t nargs,

                                  target_ulong args,

                                  uint32_t nret, target_ulong rets)

{

    uint32_t val, size, addr;

    PCIDevice *dev = find_dev(spapr, 0, rtas_ld(args, 0));

    if (!dev) {

        rtas_st(rets, 0, -1);

        return;

    }

    val = rtas_ld(args, 2);

    size = rtas_ld(args, 1);

    addr = rtas_pci_cfgaddr(rtas_ld(args, 0));

    pci_default_write_config(dev, addr, val, size);

    rtas_st(rets, 0, 0);

}


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

+    if (drv && drv->bdrv_eject) {
+
+        drv->bdrv_eject(bs, eject_flag);
+
+    }

     bs->tray_open = eject_flag;

int bdrv_eject(BlockDriverState *bs, int eject_flag)

{

    BlockDriver *drv = bs->drv;

    if (bs->locked) {

        return -EBUSY;

    }

    if (drv && drv->bdrv_eject) {

        drv->bdrv_eject(bs, eject_flag);

    }

    bs->tray_open = eject_flag;

    return 0;

}


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

                                              gpointer opaque)
+
 {

     QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(qio_task_get_source(task));

static int qio_channel_socket_connect_worker(QIOTask *task,

                                             Error **errp,

                                             gpointer opaque)

{

    QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(qio_task_get_source(task));

    SocketAddress *addr = opaque;

    int ret;

    ret = qio_channel_socket_connect_sync(ioc,

                                          addr,

                                          errp);

    object_unref(OBJECT(ioc));

    return ret;

}


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

 		tcg_gen_shri_tl(x, x, 4);

+
+
+		tcg_gen_and_tl(x, x, c);
+
+		tcg_gen_sub_tl(d, d, x);

 		tcg_temp_free(x);

static inline void t_gen_subx_carry(DisasContext *dc, TCGv d)

{

	if (dc->flagx_known) {

		if (dc->flags_x) {

			TCGv c;

			c = tcg_temp_new(TCG_TYPE_TL);

			t_gen_mov_TN_preg(c, PR_CCS);

			/* C flag is already at bit 0.  */

			tcg_gen_andi_tl(c, c, C_FLAG);

			tcg_gen_sub_tl(d, d, c);

			tcg_temp_free(c);

		}

	} else {

		TCGv x, c;

		x = tcg_temp_new(TCG_TYPE_TL);

		c = tcg_temp_new(TCG_TYPE_TL);

		t_gen_mov_TN_preg(x, PR_CCS);

		tcg_gen_mov_tl(c, x);

		/* Propagate carry into d if X is set. Branch free.  */

		tcg_gen_andi_tl(c, c, C_FLAG);

		tcg_gen_andi_tl(x, x, X_FLAG);

		tcg_gen_shri_tl(x, x, 4);

		tcg_gen_and_tl(x, x, c);

		tcg_gen_sub_tl(d, d, x);

		tcg_temp_free(x);

		tcg_temp_free(c);

	}

}


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

     const char * pch = str;
+
     unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;

@@ -11,7 +11,7 @@
     add1 = atoi(pch);

     pch = strpbrk(pch,".");
+
     if (pch == 0 || ++pch == 0) goto done;

     add2 = atoi(pch);

int inet_aton (const char * str, struct in_addr * add)

{

    const char * pch = str;

    unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;

    add1 = atoi(pch);

    pch = strpbrk(pch,".");

    if (pch == 0 || ++pch == 0) goto done;

    add2 = atoi(pch);

    pch = strpbrk(pch,".");

    if (pch == 0 || ++pch == 0) goto done;

    add3 = atoi(pch);

    pch = strpbrk(pch,".");

    if (pch == 0 || ++pch == 0) goto done;

    add4 = atoi(pch);

done:

    add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;

    return 1;

}


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

                                         gpointer user_data)

+{
+
+    VTDIOTLBEntry *entry = (VTDIOTLBEntry *)value;
+
     VTDIOTLBPageInvInfo *info = (VTDIOTLBPageInvInfo *)user_data;

     uint64_t gfn = info->gfn & info->mask;

static gboolean vtd_hash_remove_by_page(gpointer key, gpointer value,

                                        gpointer user_data)

{

    VTDIOTLBEntry *entry = (VTDIOTLBEntry *)value;

    VTDIOTLBPageInvInfo *info = (VTDIOTLBPageInvInfo *)user_data;

    uint64_t gfn = info->gfn & info->mask;

    return (entry->domain_id == info->domain_id) &&

            ((entry->gfn & info->mask) == gfn);

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     ebml_master targets;

     int ret;
+
+
+
+    if (!tags->pos) {
+
         ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb));

         if (ret < 0) return ret;

static int mkv_write_tag_targets(AVFormatContext *s,

                                 unsigned int elementid, unsigned int uid,

                                 ebml_master *tags, ebml_master* tag)

{

    AVIOContext *pb;

    MatroskaMuxContext *mkv = s->priv_data;

    ebml_master targets;

    int ret;

    if (!tags->pos) {

        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb));

        if (ret < 0) return ret;

        start_ebml_master_crc32(s->pb, &mkv->tags_bc, tags, MATROSKA_ID_TAGS, 0);

    }

    pb = mkv->tags_bc;

    *tag     = start_ebml_master(pb, MATROSKA_ID_TAG,       0);

    targets = start_ebml_master(pb, MATROSKA_ID_TAGTARGETS, 0);

    if (elementid)

        put_ebml_uint(pb, elementid, uid);

    end_ebml_master(pb, targets);

    return 0;

}


static void read_partition(uint8_t *p, struct partition_record *r)

{

    r->bootable = p[0];

    r->start_head = p[1];

    r->start_cylinder = p[3] | ((p[2] << 2) & 0x0300);

    r->start_sector = p[2] & 0x3f;

    r->system = p[4];

    r->end_head = p[5];

    r->end_cylinder = p[7] | ((p[6] << 2) & 0x300);

    r->end_sector = p[6] & 0x3f;

    r->start_sector_abs = p[8] | p[9] << 8 | p[10] << 16 | p[11] << 24;

    r->nb_sectors_abs = p[12] | p[13] << 8 | p[14] << 16 | p[15] << 24;

}


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

                          uint64_t value)

+{

     ARMCPU *cpu = arm_env_get_cpu(env);
+
+    int timeridx = ri->crm & 1;

     uint32_t oldval = env->cp15.c14_timer[timeridx].ctl;

static void gt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri,

                         uint64_t value)

{

    ARMCPU *cpu = arm_env_get_cpu(env);

    int timeridx = ri->crm & 1;

    uint32_t oldval = env->cp15.c14_timer[timeridx].ctl;

    env->cp15.c14_timer[timeridx].ctl = value & 3;

    if ((oldval ^ value) & 1) {

        /* Enable toggled */

        gt_recalc_timer(cpu, timeridx);

    } else if ((oldval & value) & 2) {

        /* IMASK toggled: don't need to recalculate,

         * just set the interrupt line based on ISTATUS

         */

        qemu_set_irq(cpu->gt_timer_outputs[timeridx],

                     (oldval & 4) && (value & 2));

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void shifter_out_im(TCGv var, int shift)
+
 {

     TCGv tmp = new_tmp();
@@ -7,7 +7,7 @@
     if (shift == 0) {

         tcg_gen_andi_i32(tmp, var, 1);
+
     } else {

         tcg_gen_shri_i32(tmp, var, shift);

static void shifter_out_im(TCGv var, int shift)

{

    TCGv tmp = new_tmp();

    if (shift == 0) {

        tcg_gen_andi_i32(tmp, var, 1);

    } else {

        tcg_gen_shri_i32(tmp, var, shift);

        if (shift != 31)

            tcg_gen_andi_i32(tmp, tmp, 1);

    }

    gen_set_CF(tmp);

    dead_tmp(tmp);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static uint32_t add_weights(uint32_t w1, uint32_t w2)
+
+{

     uint32_t max = (w1 & 0xFF) > (w2 & 0xFF) ? (w1 & 0xFF) : (w2 & 0xFF);

static uint32_t add_weights(uint32_t w1, uint32_t w2)

{

    uint32_t max = (w1 & 0xFF) > (w2 & 0xFF) ? (w1 & 0xFF) : (w2 & 0xFF);

    return ((w1 & 0xFFFFFF00) + (w2 & 0xFFFFFF00)) | (1 + max);

}


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

 {

+    int ret = qcow2_check_refcounts(bs, result, fix);

     if (ret < 0) {

static int qcow2_check(BlockDriverState *bs, BdrvCheckResult *result,

                       BdrvCheckMode fix)

{

    int ret = qcow2_check_refcounts(bs, result, fix);

    if (ret < 0) {

        return ret;

    }

    if (fix && result->check_errors == 0 && result->corruptions == 0) {

        return qcow2_mark_clean(bs);

    }

    return ret;

}


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

 {

+    double res = 0, value = 3.14;
+
+    Visitor *v;
+
+

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

static void test_visitor_in_number(TestInputVisitorData *data,

                                   const void *unused)

{

    double res = 0, value = 3.14;

    Visitor *v;

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

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

    g_assert_cmpfloat(res, ==, value);

}


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

+    if (ch == STI_TRACE_CONTROL_CHANNEL) {
+
+        /* Flush channel <i>value</i>.  */
+
+        qemu_chr_fe_write(s->chr, (const uint8_t *) "\r", 1);

     } else if (ch == STI_TRACE_CONSOLE_CHANNEL || 1) {

static void omap_sti_fifo_write(void *opaque, target_phys_addr_t addr,

                                uint64_t value, unsigned size)

{

    struct omap_sti_s *s = (struct omap_sti_s *) opaque;

    int ch = addr >> 6;

    uint8_t byte = value;

    if (size != 1) {

        return omap_badwidth_write8(opaque, addr, size);

    }

    if (ch == STI_TRACE_CONTROL_CHANNEL) {

        /* Flush channel value.  */

        qemu_chr_fe_write(s->chr, (const uint8_t *) "\r", 1);

    } else if (ch == STI_TRACE_CONSOLE_CHANNEL || 1) {

        if (value == 0xc0 || value == 0xc3) {

            /* Open channel ch.  */

        } else if (value == 0x00)

            qemu_chr_fe_write(s->chr, (const uint8_t *) "\n", 1);

        else

            qemu_chr_fe_write(s->chr, &byte, 1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op,
+
+                           TCGOpcode opc, int nargs)
+
+{
+
+    int oi = s->gen_next_op_idx;
+
+    int prev = old_op - s->gen_op_buf;
+
+    int next = old_op->next;
+
     TCGOp *new_op;

TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op,

                           TCGOpcode opc, int nargs)

{

    int oi = s->gen_next_op_idx;

    int prev = old_op - s->gen_op_buf;

    int next = old_op->next;

    TCGOp *new_op;

    tcg_debug_assert(oi < OPC_BUF_SIZE);

    s->gen_next_op_idx = oi + 1;

    new_op = &s->gen_op_buf[oi];

    *new_op = (TCGOp){

        .opc = opc,

        .prev = prev,

        .next = next

    };

    s->gen_op_buf[next].prev = oi;

    old_op->next = oi;

    return new_op;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         machine->cpu_model = "host";

     }
+
+
+
+    cpu_states = g_malloc0(sizeof(S390CPU *) * max_cpus);
+

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

void s390_init_cpus(MachineState *machine)

{

    int i;

    gchar *name;

    if (machine->cpu_model == NULL) {

        machine->cpu_model = "host";

    }

    cpu_states = g_malloc0(sizeof(S390CPU *) * max_cpus);

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

        name = g_strdup_printf("cpu[%i]", i);

        object_property_add_link(OBJECT(machine), name, TYPE_S390_CPU,

                                 (Object **) &cpu_states[i],

                                 object_property_allow_set_link,

                                 OBJ_PROP_LINK_UNREF_ON_RELEASE,

                                 &error_abort);

        g_free(name);

    }

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

        cpu_s390x_init(machine->cpu_model);

    }

}


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

     const char *val;
+
+
+
+    if (token_get_type(obj) != JSON_OPERATOR) {
+
         return 0;

     }

static int token_is_operator(QObject *obj, char op)

{

    const char *val;

    if (token_get_type(obj) != JSON_OPERATOR) {

        return 0;

    }

    val = token_get_value(obj);

    return (val[0] == op) && (val[1] == 0);

}


--- a/source.c
+++ b/source.c
@@ -20,11 +20,11 @@
         CoroutineIOCompletion co = {
             .coroutine = qemu_coroutine_self(),
         };
+        acb = bs->drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors,
+                                      bdrv_co_io_em_complete, &co);
+        if (acb == NULL) {
+            return -EIO;
+        } else {
             qemu_coroutine_yield();
             return co.ret;
         }

static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs,
                                           uint64_t offset, uint64_t bytes,
                                           QEMUIOVector *qiov, int flags)
{
    BlockDriver *drv = bs->drv;
    int64_t sector_num;
    unsigned int nb_sectors;
    if (drv->bdrv_co_preadv) {
        return drv->bdrv_co_preadv(bs, offset, bytes, qiov, flags);
    }
    sector_num = offset >> BDRV_SECTOR_BITS;
    nb_sectors = bytes >> BDRV_SECTOR_BITS;
    assert((offset & (BDRV_SECTOR_SIZE - 1)) == 0);
    assert((bytes & (BDRV_SECTOR_SIZE - 1)) == 0);
    assert((bytes >> BDRV_SECTOR_BITS) <= BDRV_REQUEST_MAX_SECTORS);
    if (drv->bdrv_co_readv) {
        return drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov);
    } else {
        BlockAIOCB *acb;
        CoroutineIOCompletion co = {
            .coroutine = qemu_coroutine_self(),
        };
        acb = bs->drv->bdrv_aio_readv(bs, sector_num, qiov, nb_sectors,
                                      bdrv_co_io_em_complete, &co);
        if (acb == NULL) {
            return -EIO;
        } else {
            qemu_coroutine_yield();
            return co.ret;
        }
    }
}


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

 #endif

+#if CONFIG_HEVC_VAAPI_HWACCEL
+
+        *fmt++ = AV_PIX_FMT_VAAPI;
+
+#endif

         break;

static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps)

{

    #define HWACCEL_MAX (CONFIG_HEVC_DXVA2_HWACCEL + CONFIG_HEVC_D3D11VA_HWACCEL + CONFIG_HEVC_VAAPI_HWACCEL + CONFIG_HEVC_VDPAU_HWACCEL)

    enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;

    switch (sps->pix_fmt) {

    case AV_PIX_FMT_YUV420P:

    case AV_PIX_FMT_YUVJ420P:

#if CONFIG_HEVC_DXVA2_HWACCEL

        *fmt++ = AV_PIX_FMT_DXVA2_VLD;

#endif

#if CONFIG_HEVC_D3D11VA_HWACCEL

        *fmt++ = AV_PIX_FMT_D3D11VA_VLD;

#endif

#if CONFIG_HEVC_VAAPI_HWACCEL

        *fmt++ = AV_PIX_FMT_VAAPI;

#endif

#if CONFIG_HEVC_VDPAU_HWACCEL

        *fmt++ = AV_PIX_FMT_VDPAU;

#endif

        break;

    case AV_PIX_FMT_YUV420P10:

#if CONFIG_HEVC_DXVA2_HWACCEL

        *fmt++ = AV_PIX_FMT_DXVA2_VLD;

#endif

#if CONFIG_HEVC_D3D11VA_HWACCEL

        *fmt++ = AV_PIX_FMT_D3D11VA_VLD;

#endif

#if CONFIG_HEVC_VAAPI_HWACCEL

        *fmt++ = AV_PIX_FMT_VAAPI;

#endif

        break;

    }

    *fmt++ = sps->pix_fmt;

    *fmt = AV_PIX_FMT_NONE;

    return ff_thread_get_format(s->avctx, pix_fmts);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static VirtIOBlockReq *virtio_blk_get_request(VirtIOBlock *s)

+{

     VirtIOBlockReq *req = virtio_blk_alloc_request(s);

static VirtIOBlockReq *virtio_blk_get_request(VirtIOBlock *s)

{

    VirtIOBlockReq *req = virtio_blk_alloc_request(s);

    if (!virtqueue_pop(s->vq, req->elem)) {

        virtio_blk_free_request(req);

        return NULL;

    }

    return req;

}


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

 {

+    qemu_irq *s = g_malloc0(2 * sizeof(qemu_irq));

     s[0] = irq1;

qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)

{

    qemu_irq *s = g_malloc0(2 * sizeof(qemu_irq));

    s[0] = irq1;

    s[1] = irq2;

    return qemu_allocate_irqs(qemu_splitirq, s, 1)[0];

}


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

 {

+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    X86CPUClass *xcc = X86_CPU_CLASS(oc);
+
+    uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;

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

{

    DeviceClass *dc = DEVICE_CLASS(oc);

    X86CPUClass *xcc = X86_CPU_CLASS(oc);

    uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;

    xcc->kvm_required = true;

    host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx);

    x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx);

    host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx);

    host_cpudef.family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF);

    host_cpudef.model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12);

    host_cpudef.stepping = eax & 0x0F;

    cpu_x86_fill_model_id(host_cpudef.model_id);

    xcc->cpu_def = &host_cpudef;

    host_cpudef.cache_info_passthrough = true;

    /* level, xlevel, xlevel2, and the feature words are initialized on

     * instance_init, because they require KVM to be initialized.

     */

    dc->props = host_x86_cpu_properties;

}


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

     gen_set_label(l1);

+    tcg_gen_sari_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], sh);
+
+    tcg_temp_free(t0);
+
+    tcg_temp_free(t1);

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

static void gen_sraiq(DisasContext *ctx)

{

    int sh = SH(ctx->opcode);

    int l1 = gen_new_label();

    TCGv t0 = tcg_temp_new();

    TCGv t1 = tcg_temp_new();

    tcg_gen_shri_tl(t0, cpu_gpr[rS(ctx->opcode)], sh);

    tcg_gen_shli_tl(t1, cpu_gpr[rS(ctx->opcode)], 32 - sh);

    tcg_gen_or_tl(t0, t0, t1);

    gen_store_spr(SPR_MQ, t0);

    tcg_gen_movi_tl(cpu_ca, 0);

    tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1);

    tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rS(ctx->opcode)], 0, l1);

    tcg_gen_movi_tl(cpu_ca, 1);

    gen_set_label(l1);

    tcg_gen_sari_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], sh);

    tcg_temp_free(t0);

    tcg_temp_free(t1);

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

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

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void pci_bridge_cleanup_alias(MemoryRegion *alias,
+
+                                     MemoryRegion *parent_space)

 {

static void pci_bridge_cleanup_alias(MemoryRegion *alias,

                                     MemoryRegion *parent_space)

{

    memory_region_del_subregion(parent_space, alias);

    memory_region_destroy(alias);

}


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

+
+    }
+
+    if (dir_path) {
+
         dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH);

     } else {

static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,

                              const char *name, V9fsPath *target)

{

    char buffer[PATH_MAX];

    struct file_handle *fh;

    int dirfd, ret, mnt_id;

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

    /* "." and ".." are not allowed */

    if (!strcmp(name, ".") || !strcmp(name, "..")) {

        errno = EINVAL;

        return -1;

    }

    if (dir_path) {

        dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH);

    } else {

        /* relative to export root */

        dirfd = open(rpath(ctx, ".", buffer), O_DIRECTORY);

    }

    if (dirfd < 0) {

        return dirfd;

    }

    fh = g_malloc(sizeof(struct file_handle) + data->handle_bytes);

    fh->handle_bytes = data->handle_bytes;

    /* add a "./" at the beginning of the path */

    snprintf(buffer, PATH_MAX, "./%s", name);

    /* flag = 0 imply don't follow symlink */

    ret = name_to_handle(dirfd, buffer, fh, &mnt_id, 0);

    if (!ret) {

        target->data = (char *)fh;

        target->size = sizeof(struct file_handle) + data->handle_bytes;

    } else {

        g_free(fh);

    }

    close(dirfd);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     case 0: /* CP_IDFIELD */

         return 0x41034003;
+
+    case 1: /* CP_FLASHPROG */
+
+        return 0;
+
     case 2: /* CP_INTREG */

         return 0;

static uint64_t icp_control_read(void *opaque, target_phys_addr_t offset,

                                 unsigned size)

{

    switch (offset >> 2) {

    case 0: /* CP_IDFIELD */

        return 0x41034003;

    case 1: /* CP_FLASHPROG */

        return 0;

    case 2: /* CP_INTREG */

        return 0;

    case 3: /* CP_DECODE */

        return 0x11;

    default:

        hw_error("icp_control_read: Bad offset %x\n", (int)offset);

        return 0;

    }

}


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

     MonFdsetFd *mon_fdset_fd;
+
+    MonFdsetFd *mon_fdset_fd_next;
+
+
+
     QLIST_FOREACH_SAFE(mon_fdset_fd, &mon_fdset->fds, next, mon_fdset_fd_next) {

         if (mon_fdset_fd->removed ||

static void monitor_fdset_cleanup(MonFdset *mon_fdset)

{

    MonFdsetFd *mon_fdset_fd;

    MonFdsetFd *mon_fdset_fd_next;

    QLIST_FOREACH_SAFE(mon_fdset_fd, &mon_fdset->fds, next, mon_fdset_fd_next) {

        if (mon_fdset_fd->removed ||

                (QLIST_EMPTY(&mon_fdset->dup_fds) && mon_refcount == 0)) {

            close(mon_fdset_fd->fd);

            g_free(mon_fdset_fd->opaque);

            QLIST_REMOVE(mon_fdset_fd, next);

            g_free(mon_fdset_fd);

        }

    }

    if (QLIST_EMPTY(&mon_fdset->fds) && QLIST_EMPTY(&mon_fdset->dup_fds)) {

        QLIST_REMOVE(mon_fdset, next);

        g_free(mon_fdset);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int inet_connect(const char *str, bool block, Error **errp)

 {
+
     QemuOpts *opts;

     int sock = -1;

int inet_connect(const char *str, bool block, Error **errp)

{

    QemuOpts *opts;

    int sock = -1;

    opts = qemu_opts_create(&dummy_opts, NULL, 0);

    if (inet_parse(opts, str) == 0) {

        if (block) {

            qemu_opt_set(opts, "block", "on");

        }

        sock = inet_connect_opts(opts, errp);

    } else {

        error_set(errp, QERR_SOCKET_CREATE_FAILED);

    }

    qemu_opts_del(opts);

    return sock;

}


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
     v->visitor.end_struct = qapi_dealloc_end_struct;

     v->visitor.start_implicit_struct = qapi_dealloc_start_implicit_struct;
+
     v->visitor.end_implicit_struct = qapi_dealloc_end_implicit_struct;

     v->visitor.start_list = qapi_dealloc_start_list;

QapiDeallocVisitor *qapi_dealloc_visitor_new(void)

{

    QapiDeallocVisitor *v;

    v = g_malloc0(sizeof(*v));

    v->visitor.start_struct = qapi_dealloc_start_struct;

    v->visitor.end_struct = qapi_dealloc_end_struct;

    v->visitor.start_implicit_struct = qapi_dealloc_start_implicit_struct;

    v->visitor.end_implicit_struct = qapi_dealloc_end_implicit_struct;

    v->visitor.start_list = qapi_dealloc_start_list;

    v->visitor.next_list = qapi_dealloc_next_list;

    v->visitor.end_list = qapi_dealloc_end_list;

    v->visitor.type_enum = qapi_dealloc_type_enum;

    v->visitor.type_int64 = qapi_dealloc_type_int64;

    v->visitor.type_uint64 = qapi_dealloc_type_uint64;

    v->visitor.type_bool = qapi_dealloc_type_bool;

    v->visitor.type_str = qapi_dealloc_type_str;

    v->visitor.type_number = qapi_dealloc_type_number;

    v->visitor.type_any = qapi_dealloc_type_anything;

    v->visitor.start_union = qapi_dealloc_start_union;

    QTAILQ_INIT(&v->stack);

    return v;

}


--- a/source.c
+++ b/source.c
@@ -12,9 +12,9 @@
                    num_irq, GIC_MAXIRQ);
     /* ITLinesNumber is represented as (N / 32) - 1 (see
      * gic_dist_readb) so this is an implementation imposed
+     * restriction, not an architectural one:
+     */
+    if (s->num_irq < 32 || (s->num_irq % 32)) {
+        error_setg(errp,
+                   "%d interrupt lines unsupported: not divisible by 32",
                    num_irq);

static void arm_gic_common_realize(DeviceState *dev, Error **errp)
{
    GICState *s = ARM_GIC_COMMON(dev);
    int num_irq = s->num_irq;
    if (s->num_cpu > GIC_NCPU) {
        error_setg(errp, "requested %u CPUs exceeds GIC maximum %d",
                   s->num_cpu, GIC_NCPU);
    s->num_irq += GIC_BASE_IRQ;
    if (s->num_irq > GIC_MAXIRQ) {
        error_setg(errp,
                   "requested %u interrupt lines exceeds GIC maximum %d",
                   num_irq, GIC_MAXIRQ);
    /* ITLinesNumber is represented as (N / 32) - 1 (see
     * gic_dist_readb) so this is an implementation imposed
     * restriction, not an architectural one:
     */
    if (s->num_irq < 32 || (s->num_irq % 32)) {
        error_setg(errp,
                   "%d interrupt lines unsupported: not divisible by 32",
                   num_irq);


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

+{
+
     QPCIDevice *dev;

     QPCIBus *pcibus;

static QPCIDevice *get_device(void)

{

    QPCIDevice *dev;

    QPCIBus *pcibus;

    pcibus = qpci_init_pc();

    dev = NULL;

    qpci_device_foreach(pcibus, 0x1af4, 0x1110, save_fn, &dev);

    g_assert(dev != NULL);

    return dev;

}


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

 {

+    sc->base = get_seg_base(e1, e2);
+
     sc->limit = get_seg_limit(e1, e2);

     sc->flags = e2;

static inline void load_seg_cache_raw_dt(SegmentCache *sc, uint32_t e1, uint32_t e2)

{

    sc->base = get_seg_base(e1, e2);

    sc->limit = get_seg_limit(e1, e2);

    sc->flags = e2;

}


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

     assert(wanted_type == QCOW2_CLUSTER_ZERO ||
+
+           wanted_type == QCOW2_CLUSTER_UNALLOCATED);
+
+    for (i = 0; i < nb_clusters; i++) {
+
         uint64_t entry = be64_to_cpu(l2_table[i]);

         QCow2ClusterType type = qcow2_get_cluster_type(entry);

static int count_contiguous_clusters_unallocated(int nb_clusters,

                                                 uint64_t *l2_table,

                                                 QCow2ClusterType wanted_type)

{

    int i;

    assert(wanted_type == QCOW2_CLUSTER_ZERO ||

           wanted_type == QCOW2_CLUSTER_UNALLOCATED);

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

        uint64_t entry = be64_to_cpu(l2_table[i]);

        QCow2ClusterType type = qcow2_get_cluster_type(entry);

        if (type != wanted_type || entry & L2E_OFFSET_MASK) {

            break;

        }

    }

    return i;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
                             bool rhs_is_const)

 {
+
+    /* Emit either the reg,imm or reg,reg form of a data-processing insn.
+
+     * rhs must satisfy the "rIN" constraint.
+
      */

     if (rhs_is_const) {

static void tcg_out_dat_rIN(TCGContext *s, int cond, int opc, int opneg,

                            TCGArg dst, TCGArg lhs, TCGArg rhs,

                            bool rhs_is_const)

{

    /* Emit either the reg,imm or reg,reg form of a data-processing insn.

     * rhs must satisfy the "rIN" constraint.

     */

    if (rhs_is_const) {

        int rot = encode_imm(rhs);

        if (rot < 0) {

            rhs = -rhs;

            rot = encode_imm(rhs);

            assert(rot >= 0);

            opc = opneg;

        }

        tcg_out_dat_imm(s, cond, opc, dst, lhs, rotl(rhs, rot) | (rot << 7));

    } else {

        tcg_out_dat_reg(s, cond, opc, dst, lhs, rhs, SHIFT_IMM_LSL(0));

    }

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     k->init = lsi_scsi_init;

     k->exit = lsi_scsi_uninit;
+
+    k->vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
+
+    k->device_id = PCI_DEVICE_ID_LSI_53C895A;
+
     k->class_id = PCI_CLASS_STORAGE_SCSI;

     k->subsystem_id = 0x1000;

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

    k->init = lsi_scsi_init;

    k->exit = lsi_scsi_uninit;

    k->vendor_id = PCI_VENDOR_ID_LSI_LOGIC;

    k->device_id = PCI_DEVICE_ID_LSI_53C895A;

    k->class_id = PCI_CLASS_STORAGE_SCSI;

    k->subsystem_id = 0x1000;

    dc->alias = "lsi";

    dc->reset = lsi_scsi_reset;

    dc->vmsd = &vmstate_lsi_scsi;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int nbd_co_discard(BlockDriverState *bs, int64_t sector_num,

+                          int nb_sectors)
+
+{
+
+    BDRVNBDState *s = bs->opaque;

     struct nbd_request request;

static int nbd_co_discard(BlockDriverState *bs, int64_t sector_num,

                          int nb_sectors)

{

    BDRVNBDState *s = bs->opaque;

    struct nbd_request request;

    struct nbd_reply reply;

    if (!(s->nbdflags & NBD_FLAG_SEND_TRIM)) {

        return 0;

    }

    request.type = NBD_CMD_TRIM;

    request.from = sector_num * 512;;

    request.len = nb_sectors * 512;

    nbd_coroutine_start(s, &request);

    if (nbd_co_send_request(s, &request, NULL, 0) == -1) {

        reply.error = errno;

    } else {

        nbd_co_receive_reply(s, &request, &reply, NULL, 0);

    }

    nbd_coroutine_end(s, &request);

    return -reply.error;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,

+                          int line_size)

+{
+
     int i;

     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;

static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,

                          int line_size)

{

    int i;

    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;

    /* read the pixels */

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

        pixels[0] = cm[pixels[0] + block[0]];

        pixels[1] = cm[pixels[1] + block[1]];

        pixels += line_size;

        block += 8;

    }

}


--- a/source.c
+++ b/source.c
@@ -4,11 +4,11 @@
     int flags = s->flags;
     AES_KEY aes_encrypt_key;
     AES_KEY aes_decrypt_key;
+    uint32_t crypt_method = 0;
+    QDict *options;
+    /*
+     * Backing files are read-only which makes all of their metadata immutable,
+     * that means we don't have to worry about reopening them here.
      */
     if (s->crypt_method) {
         crypt_method = s->crypt_method;

static void qcow2_invalidate_cache(BlockDriverState *bs)
{
    BDRVQcowState *s = bs->opaque;
    int flags = s->flags;
    AES_KEY aes_encrypt_key;
    AES_KEY aes_decrypt_key;
    uint32_t crypt_method = 0;
    QDict *options;
    /*
     * Backing files are read-only which makes all of their metadata immutable,
     * that means we don't have to worry about reopening them here.
     */
    if (s->crypt_method) {
        crypt_method = s->crypt_method;
        memcpy(&aes_encrypt_key, &s->aes_encrypt_key, sizeof(aes_encrypt_key));
        memcpy(&aes_decrypt_key, &s->aes_decrypt_key, sizeof(aes_decrypt_key));
    }
    qcow2_close(bs);
    options = qdict_new();
    qdict_put(options, QCOW2_OPT_LAZY_REFCOUNTS,
              qbool_from_int(s->use_lazy_refcounts));
    memset(s, 0, sizeof(BDRVQcowState));
    qcow2_open(bs, options, flags, NULL);
    QDECREF(options);
    if (crypt_method) {
        s->crypt_method = crypt_method;
        memcpy(&s->aes_encrypt_key, &aes_encrypt_key, sizeof(aes_encrypt_key));
        memcpy(&s->aes_decrypt_key, &aes_decrypt_key, sizeof(aes_decrypt_key));
    }
}


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

     QmpInputVisitor *v;
+

+    v = g_malloc0(sizeof(*v));

QmpInputVisitor *qmp_input_visitor_new(QObject *obj, bool strict)

{

    QmpInputVisitor *v;

    v = g_malloc0(sizeof(*v));

    v->visitor.type = VISITOR_INPUT;

    v->visitor.start_struct = qmp_input_start_struct;

    v->visitor.end_struct = qmp_input_end_struct;

    v->visitor.start_list = qmp_input_start_list;

    v->visitor.next_list = qmp_input_next_list;

    v->visitor.end_list = qmp_input_end_list;

    v->visitor.start_alternate = qmp_input_start_alternate;

    v->visitor.type_int64 = qmp_input_type_int64;

    v->visitor.type_uint64 = qmp_input_type_uint64;

    v->visitor.type_bool = qmp_input_type_bool;

    v->visitor.type_str = qmp_input_type_str;

    v->visitor.type_number = qmp_input_type_number;

    v->visitor.type_any = qmp_input_type_any;

    v->visitor.type_null = qmp_input_type_null;

    v->visitor.optional = qmp_input_optional;

    v->strict = strict;

    v->root = obj;

    qobject_incref(obj);

    return v;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+int kvm_log_stop(target_phys_addr_t phys_addr, target_phys_addr_t end_addr)
+
 {

         return kvm_dirty_pages_log_change(phys_addr, end_addr,

int kvm_log_stop(target_phys_addr_t phys_addr, target_phys_addr_t end_addr)

{

        return kvm_dirty_pages_log_change(phys_addr, end_addr,

                                          0,

                                          KVM_MEM_LOG_DIRTY_PAGES);

}


--- a/source.c
+++ b/source.c
@@ -1,16 +1,16 @@
 int ff_v4l2_m2m_codec_end(AVCodecContext *avctx)
+
 {

     V4L2m2mContext* s = avctx->priv_data;

     int ret;

+
+
+    ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF);
+
+    if (ret)

             av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name);

int ff_v4l2_m2m_codec_end(AVCodecContext *avctx)

{

    V4L2m2mContext* s = avctx->priv_data;

    int ret;

    ret = ff_v4l2_context_set_status(&s->output, VIDIOC_STREAMOFF);

    if (ret)

            av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->output.name);

    ret = ff_v4l2_context_set_status(&s->capture, VIDIOC_STREAMOFF);

    if (ret)

        av_log(avctx, AV_LOG_ERROR, "VIDIOC_STREAMOFF %s\n", s->capture.name);

    ff_v4l2_context_release(&s->output);

    if (atomic_load(&s->refcount))

        av_log(avctx, AV_LOG_ERROR, "ff_v4l2m2m_codec_end leaving pending buffers\n");

    ff_v4l2_context_release(&s->capture);

    sem_destroy(&s->refsync);

    /* release the hardware */

    if (close(s->fd) < 0 )

        av_log(avctx, AV_LOG_ERROR, "failure closing %s (%s)\n", s->devname, av_err2str(AVERROR(errno)));

    s->fd = -1;

    return 0;

}


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

 {
+
     CharDriverState *chr = opaque;
+
     TCPCharDriver *s = chr->opaque;

     QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(s->ioc);

static void tcp_chr_connect(void *opaque)

{

    CharDriverState *chr = opaque;

    TCPCharDriver *s = chr->opaque;

    QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(s->ioc);

    g_free(chr->filename);

    chr->filename = sockaddr_to_str(&sioc->localAddr, sioc->localAddrLen,

                                    &sioc->remoteAddr, sioc->remoteAddrLen,

                                    s->is_listen, s->is_telnet);

    s->connected = 1;

    if (s->ioc) {

        chr->fd_in_tag = io_add_watch_poll(s->ioc,

                                           tcp_chr_read_poll,

                                           tcp_chr_read, chr);

    }

    qemu_chr_be_generic_open(chr);

}


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

+{

     struct wm8750_s *s = (struct wm8750_s *) opaque;

static void wm8750_audio_out_cb(void *opaque, int free_b)

{

    struct wm8750_s *s = (struct wm8750_s *) opaque;

    wm8750_out_flush(s);

    s->req_out = free_b;

    s->data_req(s->opaque, free_b >> 2, s->req_in >> 2);

}


--- a/source.c
+++ b/source.c
@@ -20,11 +20,11 @@
     /* XXX: beware: this is false if VLE is supported */
     env->nip = nip & ~((target_ulong)0x00000003);
     hreg_store_msr(env, msr, 1);
+#if defined(DEBUG_OP)
+    cpu_dump_rfi(env->nip, env->msr);
+#endif
+    /* No need to raise an exception here,
+     * as rfi is always the last insn of a TB
      */
     cs->interrupt_request |= CPU_INTERRUPT_EXITTB;
 }

static inline void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong msr,
                          target_ulong msrm, int keep_msrh)
{
    CPUState *cs = CPU(ppc_env_get_cpu(env));
#if defined(TARGET_PPC64)
    if (msr_is_64bit(env, msr)) {
        nip = (uint64_t)nip;
        msr &= (uint64_t)msrm;
    } else {
        nip = (uint32_t)nip;
        msr = (uint32_t)(msr & msrm);
        if (keep_msrh) {
            msr |= env->msr & ~((uint64_t)0xFFFFFFFF);
        }
    }
#else
    nip = (uint32_t)nip;
    msr &= (uint32_t)msrm;
#endif
    /* XXX: beware: this is false if VLE is supported */
    env->nip = nip & ~((target_ulong)0x00000003);
    hreg_store_msr(env, msr, 1);
#if defined(DEBUG_OP)
    cpu_dump_rfi(env->nip, env->msr);
#endif
    /* No need to raise an exception here,
     * as rfi is always the last insn of a TB
     */
    cs->interrupt_request |= CPU_INTERRUPT_EXITTB;
}


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

 sigsegv:

+    unlock_user_struct(sr, sr_addr, 1);
+
+    unlock_user_struct(sc, sc_addr, 1);
+
+    qemu_log("segfaulting from do_sigreturn\n");

     force_sig(TARGET_SIGSEGV);

long do_sigreturn(CPUPPCState *env)

{

    struct target_sigcontext *sc = NULL;

    struct target_mcontext *sr = NULL;

    target_ulong sr_addr = 0, sc_addr;

    sigset_t blocked;

    target_sigset_t set;

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

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

        goto sigsegv;

#if defined(TARGET_PPC64)

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

#else

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

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

       goto sigsegv;

#endif

    target_to_host_sigset_internal(&blocked, &set);

    sigprocmask(SIG_SETMASK, &blocked, NULL);

    if (__get_user(sr_addr, &sc->regs))

        goto sigsegv;

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

        goto sigsegv;

    if (restore_user_regs(env, sr, 1))

        goto sigsegv;

    unlock_user_struct(sr, sr_addr, 1);

    unlock_user_struct(sc, sc_addr, 1);

    return -TARGET_QEMU_ESIGRETURN;

sigsegv:

    unlock_user_struct(sr, sr_addr, 1);

    unlock_user_struct(sc, sc_addr, 1);

    qemu_log("segfaulting from do_sigreturn\n");

    force_sig(TARGET_SIGSEGV);

    return 0;

}


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

     int idx = ogg->nstreams++;

+    AVStream *st;

     struct ogg_stream *os;

static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)

{

    struct ogg *ogg = s->priv_data;

    int idx = ogg->nstreams++;

    AVStream *st;

    struct ogg_stream *os;

    ogg->streams = av_realloc (ogg->streams,

                               ogg->nstreams * sizeof (*ogg->streams));

    memset (ogg->streams + idx, 0, sizeof (*ogg->streams));

    os = ogg->streams + idx;

    os->serial = serial;

    os->bufsize = DECODER_BUFFER_SIZE;

    os->buf = av_malloc(os->bufsize);

    os->header = -1;

    if (new_avstream) {

        st = avformat_new_stream(s, NULL);

        if (!st)

            return AVERROR(ENOMEM);

        st->id = idx;

        avpriv_set_pts_info(st, 64, 1, 1000000);

    }

    return idx;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void imdct12(INTFLOAT *out, INTFLOAT *in)
+
 {

     INTFLOAT in0, in1, in2, in3, in4, in5, t1, t2;


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+av_cold void ff_vp8dsp_init_ppc(VP8DSPContext *c)

 {

av_cold void ff_vp8dsp_init_ppc(VP8DSPContext *c)

{

#if HAVE_ALTIVEC

    if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC))

        return;

    c->put_vp8_epel_pixels_tab[0][0][0] = put_vp8_pixels16_altivec;

    c->put_vp8_epel_pixels_tab[0][0][2] = put_vp8_epel16_h6_altivec;

    c->put_vp8_epel_pixels_tab[0][2][0] = put_vp8_epel16_v6_altivec;

    c->put_vp8_epel_pixels_tab[0][2][2] = put_vp8_epel16_h6v6_altivec;

    c->put_vp8_epel_pixels_tab[1][0][2] = put_vp8_epel8_h6_altivec;

    c->put_vp8_epel_pixels_tab[1][2][0] = put_vp8_epel8_v6_altivec;

    c->put_vp8_epel_pixels_tab[1][0][1] = put_vp8_epel8_h4_altivec;

    c->put_vp8_epel_pixels_tab[1][1][0] = put_vp8_epel8_v4_altivec;

    c->put_vp8_epel_pixels_tab[1][2][2] = put_vp8_epel8_h6v6_altivec;

    c->put_vp8_epel_pixels_tab[1][1][1] = put_vp8_epel8_h4v4_altivec;

    c->put_vp8_epel_pixels_tab[1][1][2] = put_vp8_epel8_h6v4_altivec;

    c->put_vp8_epel_pixels_tab[1][2][1] = put_vp8_epel8_h4v6_altivec;

    c->put_vp8_epel_pixels_tab[2][0][2] = put_vp8_epel4_h6_altivec;

    c->put_vp8_epel_pixels_tab[2][2][0] = put_vp8_epel4_v6_altivec;

    c->put_vp8_epel_pixels_tab[2][0][1] = put_vp8_epel4_h4_altivec;

    c->put_vp8_epel_pixels_tab[2][1][0] = put_vp8_epel4_v4_altivec;

    c->put_vp8_epel_pixels_tab[2][2][2] = put_vp8_epel4_h6v6_altivec;

    c->put_vp8_epel_pixels_tab[2][1][1] = put_vp8_epel4_h4v4_altivec;

    c->put_vp8_epel_pixels_tab[2][1][2] = put_vp8_epel4_h6v4_altivec;

    c->put_vp8_epel_pixels_tab[2][2][1] = put_vp8_epel4_h4v6_altivec;

#endif /* HAVE_ALTIVEC */

}


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

     int is_read)

+{

     BlockInterfaceErrorAction action =

         drive_get_on_error(req->dev->bs, is_read);

+    VirtIOBlock *s = req->dev;

+    if (action == BLOCK_ERR_IGNORE) {

         bdrv_mon_event(req->dev->bs, BDRV_ACTION_IGNORE, is_read);

static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,

    int is_read)

{

    BlockInterfaceErrorAction action =

        drive_get_on_error(req->dev->bs, is_read);

    VirtIOBlock *s = req->dev;

    if (action == BLOCK_ERR_IGNORE) {

        bdrv_mon_event(req->dev->bs, BDRV_ACTION_IGNORE, is_read);

        return 0;

    }

    if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC)

            || action == BLOCK_ERR_STOP_ANY) {

        req->next = s->rq;

        s->rq = req;

        bdrv_mon_event(req->dev->bs, BDRV_ACTION_STOP, is_read);

        vm_stop(0);

    } else {

        virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);

        bdrv_mon_event(req->dev->bs, BDRV_ACTION_REPORT, is_read);

    }

    return 1;

}


static void do_exit(void)

{

    if (cur_stream) {

        stream_close(cur_stream);

        cur_stream = NULL;

    }

    uninit_opts();

#if CONFIG_AVFILTER

    avfilter_uninit();

#endif

    avformat_network_deinit();

    if (show_status)

        printf("\n");

    SDL_Quit();

    av_log(NULL, AV_LOG_QUIET, "");

    exit(0);

}


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

     struct nbd_request request = {

+        .type = NBD_CMD_DISC,
+
+        .from = 0,
+
+        .len = 0

     };

void nbd_client_close(BlockDriverState *bs)

{

    NbdClientSession *client = nbd_get_client_session(bs);

    struct nbd_request request = {

        .type = NBD_CMD_DISC,

        .from = 0,

        .len = 0

    };

    if (client->ioc == NULL) {

        return;

    }

    nbd_send_request(client->ioc, &request);

    nbd_teardown_connection(bs);

}


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

     const char *str = g_strdup_printf("%lu", ULONG_MAX);

static void test_qemu_strtoul_max(void)

{

    const char *str = g_strdup_printf("%lu", ULONG_MAX);

    char f = 'X';

    const char *endptr = &f;

    unsigned long res = 999;

    int err;

    err = qemu_strtoul(str, &endptr, 0, &res);

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, ULONG_MAX);

    g_assert(endptr == str + strlen(str));

}


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

 {

+    CPUS390XState *env = &cpu->env;
+
+    uint64_t sccb;

     uint32_t code;

+    int r = 0;

static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,

                                 uint16_t ipbh0)

{

    CPUS390XState *env = &cpu->env;

    uint64_t sccb;

    uint32_t code;

    int r = 0;

    cpu_synchronize_state(CPU(cpu));

    if (env->psw.mask & PSW_MASK_PSTATE) {

        enter_pgmcheck(cpu, PGM_PRIVILEGED);

        return 0;

    }

    sccb = env->regs[ipbh0 & 0xf];

    code = env->regs[(ipbh0 & 0xf0) >> 4];

    r = sclp_service_call(sccb, code);

    if (r < 0) {

        enter_pgmcheck(cpu, -r);

    }

    setcc(cpu, r);

    return 0;

}


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

     addr &= s->cirrus_addr_mask;
+
+
+
+    if (((s->vga.sr[0x17] & 0x44) == 0x44) &&
+
         ((addr & s->linear_mmio_mask) ==  s->linear_mmio_mask)) {

 	/* memory-mapped I/O */

static void cirrus_linear_write(void *opaque, target_phys_addr_t addr,

                                uint64_t val, unsigned size)

{

    CirrusVGAState *s = opaque;

    unsigned mode;

    addr &= s->cirrus_addr_mask;

    if (((s->vga.sr[0x17] & 0x44) == 0x44) &&

        ((addr & s->linear_mmio_mask) ==  s->linear_mmio_mask)) {

	/* memory-mapped I/O */

	cirrus_mmio_blt_write(s, addr & 0xff, val);

    } else if (s->cirrus_srcptr != s->cirrus_srcptr_end) {

	/* bitblt */

	*s->cirrus_srcptr++ = (uint8_t) val;

	if (s->cirrus_srcptr >= s->cirrus_srcptr_end) {

	    cirrus_bitblt_cputovideo_next(s);

	}

    } else {

	/* video memory */

	if ((s->vga.gr[0x0B] & 0x14) == 0x14) {

	    addr <<= 4;

	} else if (s->vga.gr[0x0B] & 0x02) {

	    addr <<= 3;

	}

	addr &= s->cirrus_addr_mask;

	mode = s->vga.gr[0x05] & 0x7;

	if (mode < 4 || mode > 5 || ((s->vga.gr[0x0B] & 0x4) == 0)) {

	    *(s->vga.vram_ptr + addr) = (uint8_t) val;

            memory_region_set_dirty(&s->vga.vram, addr, 1);

	} else {

	    if ((s->vga.gr[0x0B] & 0x14) != 0x14) {

		cirrus_mem_writeb_mode4and5_8bpp(s, mode, addr, val);

	    } else {

		cirrus_mem_writeb_mode4and5_16bpp(s, mode, addr, val);

	    }

	}

    }

}


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

+{
+
     has_pci_info = false;

static void pc_init_pci_1_6(QEMUMachineInitArgs *args)

{

    has_pci_info = false;

    pc_init_pci(args);

}


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

 {

+    uint32_t old_pending;

     uint32_t le_events = cpu_to_le32(events);

static void qxl_send_events(PCIQXLDevice *d, uint32_t events)

{

    uint32_t old_pending;

    uint32_t le_events = cpu_to_le32(events);

    trace_qxl_send_events(d->id, events);

    assert(qemu_spice_display_is_running(&d->ssd));

    old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events);

    if ((old_pending & le_events) == le_events) {

        return;

    }

    if (qemu_thread_is_self(&d->main)) {

        qxl_update_irq(d);

    } else {

        if (write(d->pipe[1], d, 1) != 1) {

            dprint(d, 1, "%s: write to pipe failed\n", __func__);

        }

    }

}


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

+
+
+
+
+
     av_free(filter);

     ts->pids[pid] = NULL;

static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)

{

    int pid;

    pid = filter->pid;

    if (filter->type == MPEGTS_SECTION)

        av_freep(&filter->u.section_filter.section_buf);

    av_free(filter);

    ts->pids[pid] = NULL;


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

+    if (!ret) {

         return false;

bool object_property_get_bool(Object *obj, const char *name,

                              Error **errp)

{

    QObject *ret = object_property_get_qobject(obj, name, errp);

    QBool *qbool;

    bool retval;

    if (!ret) {

        return false;

    }

    qbool = qobject_to_qbool(ret);

    if (!qbool) {

        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "boolean");

        retval = false;

    } else {

        retval = qbool_get_bool(qbool);

    }

    QDECREF(qbool);

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static inline void gen_sync_flags(DisasContext *dc)
+
+{

     /* Sync the tb dependent flag between translate and runtime.  */

static inline void gen_sync_flags(DisasContext *dc)

{

    /* Sync the tb dependent flag between translate and runtime.  */

    if (dc->tb_flags != dc->synced_flags) {

        tcg_gen_movi_tl(env_flags, dc->tb_flags);

        dc->synced_flags = dc->tb_flags;

    }

}


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

     qemu_irq *irqs;
+
     int i;

void ahci_init(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)

{

    qemu_irq *irqs;

    int i;

    s->as = as;

    s->ports = ports;

    s->dev = g_malloc0(sizeof(AHCIDevice) * ports);

    ahci_reg_init(s);

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

    memory_region_init_io(&s->mem, OBJECT(qdev), &ahci_mem_ops, s,

                          "ahci", AHCI_MEM_BAR_SIZE);

    memory_region_init_io(&s->idp, OBJECT(qdev), &ahci_idp_ops, s,

                          "ahci-idp", 32);

    irqs = qemu_allocate_irqs(ahci_irq_set, s, s->ports);

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

        AHCIDevice *ad = &s->dev[i];

        ide_bus_new(&ad->port, sizeof(ad->port), qdev, i, 1);

        ide_init2(&ad->port, irqs[i]);

        ad->hba = s;

        ad->port_no = i;

        ad->port.dma = &ad->dma;

        ad->port.dma->ops = &ahci_dma_ops;

    }

}


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

     OptsVisitor *ov = to_ov(v);
+
+
+
+    assert(ov->list_mode == LM_STARTED ||
+
            ov->list_mode == LM_IN_PROGRESS ||

            ov->list_mode == LM_SIGNED_INTERVAL ||

opts_end_list(Visitor *v)

{

    OptsVisitor *ov = to_ov(v);

    assert(ov->list_mode == LM_STARTED ||

           ov->list_mode == LM_IN_PROGRESS ||

           ov->list_mode == LM_SIGNED_INTERVAL ||

           ov->list_mode == LM_UNSIGNED_INTERVAL);

    ov->repeated_opts = NULL;

    ov->list_mode = LM_NONE;

}


--- a/source.c
+++ b/source.c
@@ -1,23 +1,23 @@
+static int adb_mouse_poll(ADBDevice *d, uint8_t *obuf)
+
+{
+
+    MouseState *s = ADB_MOUSE(d);
+
+    int dx, dy;
+
+
+
+    if (s->last_buttons_state == s->buttons_state &&
+
+        s->dx == 0 && s->dy == 0)
+
+        return 0;
+
+
+
+    dx = s->dx;
+
     if (dx < -63)

         dx = -63;

static int adb_mouse_poll(ADBDevice *d, uint8_t *obuf)

{

    MouseState *s = ADB_MOUSE(d);

    int dx, dy;

    if (s->last_buttons_state == s->buttons_state &&

        s->dx == 0 && s->dy == 0)

        return 0;

    dx = s->dx;

    if (dx < -63)

        dx = -63;

    else if (dx > 63)

        dx = 63;

    dy = s->dy;

    if (dy < -63)

        dy = -63;

    else if (dy > 63)

        dy = 63;

    s->dx -= dx;

    s->dy -= dy;

    s->last_buttons_state = s->buttons_state;

    dx &= 0x7f;

    dy &= 0x7f;

    if (!(s->buttons_state & MOUSE_EVENT_LBUTTON))

        dy |= 0x80;

    if (!(s->buttons_state & MOUSE_EVENT_RBUTTON))

        dx |= 0x80;

    obuf[0] = dy;

    obuf[1] = dx;

    return 2;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);

+
+    pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
+
     pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371AB);

     return pci_piix_ide_initfn(d);

static int pci_piix4_ide_initfn(PCIDevice *dev)

{

    PCIIDEState *d = DO_UPCAST(PCIIDEState, dev, dev);

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

    pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82371AB);

    return pci_piix_ide_initfn(d);

}


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

     WebPContext *s = avctx->priv_data;

+    if (s->has_alpha)
+
+        return AV_PIX_FMT_YUVA420P;
+
     else

         return AV_PIX_FMT_YUV420P;

static enum AVPixelFormat webp_get_format(AVCodecContext *avctx,

                                          const enum AVPixelFormat *formats)

{

    WebPContext *s = avctx->priv_data;

    if (s->has_alpha)

        return AV_PIX_FMT_YUVA420P;

    else

        return AV_PIX_FMT_YUV420P;

}


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

         avio_write(out, buf, n);
+
+        size -= n;
+
+    }
+
     avio_flush(out);

     avio_close(out);

static int copy_moof(AVFormatContext *s, const char* infile, const char *outfile, int64_t size)

{

    AVIOContext *in, *out;

    int ret = 0;

    if ((ret = avio_open2(&in, infile, AVIO_FLAG_READ, &s->interrupt_callback, NULL)) < 0)

        return ret;

    if ((ret = avio_open2(&out, outfile, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) {

        avio_close(in);

        return ret;

    }

    while (size > 0) {

        uint8_t buf[8192];

        int n = FFMIN(size, sizeof(buf));

        n = avio_read(in, buf, n);

        if (n <= 0) {

            ret = AVERROR(EIO);

            break;

        }

        avio_write(out, buf, n);

        size -= n;

    }

    avio_flush(out);

    avio_close(out);

    avio_close(in);

    return ret;

}


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

      /* memory #0 LFB */

+     /* memory #1 memory-mapped I/O */
+
+     /* XXX: s->vga.vram_size must be a power of two */
+
+     pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar);

      if (device_id == CIRRUS_ID_CLGD5446) {

static int pci_cirrus_vga_initfn(PCIDevice *dev)

{

     PCICirrusVGAState *d = DO_UPCAST(PCICirrusVGAState, dev, dev);

     CirrusVGAState *s = &d->cirrus_vga;

     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);

     int16_t device_id = pc->device_id;

     /* setup VGA */

     vga_common_init(&s->vga, OBJECT(dev), true);

     cirrus_init_common(s, OBJECT(dev), device_id, 1, pci_address_space(dev),

                        pci_address_space_io(dev));

     s->vga.con = graphic_console_init(DEVICE(dev), 0, s->vga.hw_ops, &s->vga);

     /* setup PCI */

    memory_region_init(&s->pci_bar, OBJECT(dev), "cirrus-pci-bar0", 0x2000000);

    /* XXX: add byte swapping apertures */

    memory_region_add_subregion(&s->pci_bar, 0, &s->cirrus_linear_io);

    memory_region_add_subregion(&s->pci_bar, 0x1000000,

                                &s->cirrus_linear_bitblt_io);

     /* setup memory space */

     /* memory #0 LFB */

     /* memory #1 memory-mapped I/O */

     /* XXX: s->vga.vram_size must be a power of two */

     pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->pci_bar);

     if (device_id == CIRRUS_ID_CLGD5446) {

         pci_register_bar(&d->dev, 1, 0, &s->cirrus_mmio_io);

     return 0;


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

         default:

+            IVSHMEM_DPRINTF("why are we reading " TARGET_FMT_plx "\n", addr);
+
+            ret = 0;
+
+    }

static uint64_t ivshmem_io_read(void *opaque, target_phys_addr_t addr,

                                unsigned size)

{

    IVShmemState *s = opaque;

    uint32_t ret;

    switch (addr)

    {

        case INTRMASK:

            ret = ivshmem_IntrMask_read(s);

            break;

        case INTRSTATUS:

            ret = ivshmem_IntrStatus_read(s);

            break;

        case IVPOSITION:

            /* return my VM ID if the memory is mapped */

            if (s->shm_fd > 0) {

                ret = s->vm_id;

            } else {

                ret = -1;

            }

            break;

        default:

            IVSHMEM_DPRINTF("why are we reading " TARGET_FMT_plx "\n", addr);

            ret = 0;

    }

    return ret;

}


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

     DeviceClass *k = DEVICE_CLASS(klass);

+    k->init = ide_qdev_init;
+
+    set_bit(DEVICE_CATEGORY_STORAGE, k->categories);
+
     k->bus_type = TYPE_IDE_BUS;

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

{

    DeviceClass *k = DEVICE_CLASS(klass);

    k->init = ide_qdev_init;

    set_bit(DEVICE_CATEGORY_STORAGE, k->categories);

    k->bus_type = TYPE_IDE_BUS;

    k->props = ide_props;

}


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

                     fprintf(stderr, "Not overwriting - exiting\n");
+
+                    exit_program(1);
+
+                }
+
             }

             else {

static void assert_file_overwrite(const char *filename)

{

    if (file_overwrite && file_skip) {

        fprintf(stderr, "Error, both -y and -n supplied. Exiting.\n");

        exit_program(1);

    }

    if (!file_overwrite &&

        (strchr(filename, ':') == NULL || filename[1] == ':' ||

         av_strstart(filename, "file:", NULL))) {

        if (avio_check(filename, 0) == 0) {

            if (!using_stdin && !file_skip) {

                fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);

                fflush(stderr);

                if (!read_yesno()) {

                    fprintf(stderr, "Not overwriting - exiting\n");

                    exit_program(1);

                }

            }

            else {

                fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);

                exit_program(1);

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx)

+{
+
     int ret;
+
+

     if (*pexpr)

static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx)

{

    int ret;

    if (*pexpr)

        av_expr_free(*pexpr);

    *pexpr = NULL;

    ret = av_expr_parse(pexpr, expr, var_names,

                        NULL, NULL, NULL, NULL, 0, log_ctx);

    if (ret < 0)

        av_log(log_ctx, AV_LOG_ERROR,

               "Error when evaluating the expression '%s'\n", expr);

    return ret;

}


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

                         enum PixelFormat target)

+{
+
+    int  yalpha1 = 4095 - yalpha; \
+
+    int i;

yuv2gray16_2_c_template(SwsContext *c, const uint16_t *buf0,

                        const uint16_t *buf1, const uint16_t *ubuf0,

                        const uint16_t *ubuf1, const uint16_t *vbuf0,

                        const uint16_t *vbuf1, const uint16_t *abuf0,

                        const uint16_t *abuf1, uint8_t *dest, int dstW,

                        int yalpha, int uvalpha, int y,

                        enum PixelFormat target)

{

    int  yalpha1 = 4095 - yalpha; \

    int i;

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

        const int i2 = 2 * i;

        int Y1 = (buf0[i2  ] * yalpha1 + buf1[i2  ] * yalpha) >> 11;

        int Y2 = (buf0[i2+1] * yalpha1 + buf1[i2+1] * yalpha) >> 11;

        output_pixel(&dest[2 * i2 + 0], Y1);

        output_pixel(&dest[2 * i2 + 2], Y2);

    }

}


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

     TCGv_i32 v = tcg_temp_new_i32();
+
+
+
     tcg_gen_ld_i32(v, cpu_env, fp_reg_offset(reg, MO_32));

     return v;

static TCGv_i32 read_fp_sreg(DisasContext *s, int reg)

{

    TCGv_i32 v = tcg_temp_new_i32();

    tcg_gen_ld_i32(v, cpu_env, fp_reg_offset(reg, MO_32));

    return v;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void checkasm_check_blockdsp(void)

 {
+
+    LOCAL_ALIGNED_16(uint16_t, buf0, [6 * 8 * 8]);
+
+    LOCAL_ALIGNED_16(uint16_t, buf1, [6 * 8 * 8]);
+

     AVCodecContext avctx = { 0 };

void checkasm_check_blockdsp(void)

{

    LOCAL_ALIGNED_16(uint16_t, buf0, [6 * 8 * 8]);

    LOCAL_ALIGNED_16(uint16_t, buf1, [6 * 8 * 8]);

    AVCodecContext avctx = { 0 };

    BlockDSPContext h;

    ff_blockdsp_init(&h, &avctx);

    check_clear(clear_block,  8 * 8);

    check_clear(clear_blocks, 8 * 8 * 6);

    report("blockdsp");

}


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

        MIPS_TLB_NB not being a power of two.  But so does real silicon.  */

+    invalidate_tlb(env->CP0_index & (MIPS_TLB_NB - 1), 0);
+
+    fill_tlb(env->CP0_index & (MIPS_TLB_NB - 1));
+
+}

void do_tlbwi (void)

{

    /* Discard cached TLB entries.  We could avoid doing this if the

       tlbwi is just upgrading access permissions on the current entry;

       that might be a further win.  */

    mips_tlb_flush_extra (env, MIPS_TLB_NB);

    /* Wildly undefined effects for CP0_index containing a too high value and

       MIPS_TLB_NB not being a power of two.  But so does real silicon.  */

    invalidate_tlb(env->CP0_index & (MIPS_TLB_NB - 1), 0);

    fill_tlb(env->CP0_index & (MIPS_TLB_NB - 1));

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     uint8_t *in = d->u.r_virtbase + addr;

     uint32_t r;
+
+
+
+    r = *in;
+
     DEBUG("slow_bar_readl addr=0x" TARGET_FMT_plx " val=0x%08x\n", addr, r);

static uint32_t slow_bar_readb(void *opaque, target_phys_addr_t addr)

{

    AssignedDevRegion *d = opaque;

    uint8_t *in = d->u.r_virtbase + addr;

    uint32_t r;

    r = *in;

    DEBUG("slow_bar_readl addr=0x" TARGET_FMT_plx " val=0x%08x\n", addr, r);

    return r;

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,
+
+                               SchroFrameFormat  *schro_frame_fmt)
+
+{
+
+    unsigned int num_formats = sizeof(schro_pixel_format_map) /

                                sizeof(schro_pixel_format_map[0]);
+

     int idx;

int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,

                               SchroFrameFormat  *schro_frame_fmt)

{

    unsigned int num_formats = sizeof(schro_pixel_format_map) /

                               sizeof(schro_pixel_format_map[0]);

    int idx;

    for (idx = 0; idx < num_formats; ++idx) {

        if (schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) {

            *schro_frame_fmt = schro_pixel_format_map[idx].schro_frame_fmt;

            return 0;

        }

    }

    return -1;

}


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

     CirrusVGAState *s;

+
+
+    s = qemu_mallocz(sizeof(CirrusVGAState));
+
+

     vga_common_init((VGAState *)s,

void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,

                         unsigned long vga_ram_offset, int vga_ram_size)

{

    CirrusVGAState *s;

    s = qemu_mallocz(sizeof(CirrusVGAState));

    vga_common_init((VGAState *)s,

                    ds, vga_ram_base, vga_ram_offset, vga_ram_size);

    cirrus_init_common(s, CIRRUS_ID_CLGD5430, 0);

    s->console = graphic_console_init(s->ds, s->update, s->invalidate,

                                      s->screen_dump, s->text_update, s);

    /* XXX ISA-LFB support */

}


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

     pixel *dest = (pixel *)dest_;
+
     int i;

void FUNC(ff_simple_idct_add)(uint8_t *dest_, int line_size, DCTELEM *block)

{

    pixel *dest = (pixel *)dest_;

    int i;

    line_size /= sizeof(pixel);

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

        FUNC(idctRowCondDC)(block + i*8);

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

        FUNC(idctSparseColAdd)(dest + i, line_size, block + i);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void clear_sel(IPMIBmcSim *ibs,
+
                       uint8_t *cmd, unsigned int cmd_len,

                       uint8_t *rsp, unsigned int *rsp_len,

static void clear_sel(IPMIBmcSim *ibs,

                      uint8_t *cmd, unsigned int cmd_len,

                      uint8_t *rsp, unsigned int *rsp_len,

                      unsigned int max_rsp_len)

{

    IPMI_CHECK_CMD_LEN(8);

    IPMI_CHECK_RESERVATION(2, ibs->sel.reservation);

    if (cmd[4] != 'C' || cmd[5] != 'L' || cmd[6] != 'R') {

        rsp[2] = IPMI_CC_INVALID_DATA_FIELD;

        return;

    }

    if (cmd[7] == 0xaa) {

        ibs->sel.next_free = 0;

        ibs->sel.overflow = 0;

        set_timestamp(ibs, ibs->sdr.last_clear);

        IPMI_ADD_RSP_DATA(1); /* Erasure complete */

        sel_inc_reservation(&ibs->sel);

    } else if (cmd[7] == 0) {

        IPMI_ADD_RSP_DATA(1); /* Erasure complete */

    } else {

        rsp[2] = IPMI_CC_INVALID_DATA_FIELD;

        return;

    }

}


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

     const int beta  = beta_table[qp - qp_bd_offset + h->slice_beta_offset];

+    if (alpha ==0 || beta == 0) return;
+
+
+
+    if( bS[0] < 4 ) {

         int8_t tc[4];

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

    const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);

    const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;

    const int alpha = alpha_table[index_a];

    const int beta  = beta_table[qp - qp_bd_offset + h->slice_beta_offset];

    if (alpha ==0 || beta == 0) return;

    if( bS[0] < 4 ) {

        int8_t tc[4];

        tc[0] = tc0_table[index_a][bS[0]];

        tc[1] = tc0_table[index_a][bS[1]];

        tc[2] = tc0_table[index_a][bS[2]];

        tc[3] = tc0_table[index_a][bS[3]];

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

    } else {

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

    }

}


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

+
     for (chan = 0; chan < s->channels; chan++) {

         if (FFMAX(1, s->nmean) >= UINT_MAX / sizeof(int32_t)) {

static int allocate_buffers(ShortenContext *s)

{

    int i, chan, err;

    for (chan = 0; chan < s->channels; chan++) {

        if (FFMAX(1, s->nmean) >= UINT_MAX / sizeof(int32_t)) {

            av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n");

            return AVERROR_INVALIDDATA;

        }

        if (s->blocksize + s->nwrap >= UINT_MAX / sizeof(int32_t) ||

            s->blocksize + s->nwrap <= (unsigned)s->nwrap) {

            av_log(s->avctx, AV_LOG_ERROR,

                   "s->blocksize + s->nwrap too large\n");

            return AVERROR_INVALIDDATA;

        }

        if ((err = av_reallocp_array(&s->offset[chan],

                               sizeof(int32_t),

                               FFMAX(1, s->nmean))) < 0)

            return err;

        if ((err = av_reallocp_array(&s->decoded_base[chan], (s->blocksize + s->nwrap),

                               sizeof(s->decoded_base[0][0]))) < 0)

            return err;

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

            s->decoded_base[chan][i] = 0;

        s->decoded[chan] = s->decoded_base[chan] + s->nwrap;

    }

    if ((err = av_reallocp_array(&s->coeffs, s->nwrap, sizeof(*s->coeffs))) < 0)

        return err;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 bool qemu_clock_expired(QEMUClockType type)
+
+{

     return timerlist_expired(

bool qemu_clock_expired(QEMUClockType type)

{

    return timerlist_expired(

        main_loop_tlg.tl[type]);

}


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

+                                         FsCred *credp)
+
 {

     char buffer[PATH_MAX];

static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,

                                         FsCred *credp)

{

    char buffer[PATH_MAX];

    if (chmod(rpath(fs_ctx, path, buffer), credp->fc_mode & 07777) < 0) {

        return -1;

    }

    if (lchown(rpath(fs_ctx, path, buffer), credp->fc_uid,

                credp->fc_gid) < 0) {

        /*

         * If we fail to change ownership and if we are

         * using security model none. Ignore the error

         */

        if ((fs_ctx->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) {

            return -1;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void qerror_report(const char *fmt, ...)

+{
+
+    va_list va;
+
+    QError *qerror;

void qerror_report(const char *fmt, ...)

{

    va_list va;

    QError *qerror;

    va_start(va, fmt);

    qerror = qerror_from_info(fmt, &va);

    va_end(va);

    if (monitor_cur_is_qmp()) {

        monitor_set_error(cur_mon, qerror);

    } else {

        qerror_print(qerror);

        QDECREF(qerror);

    }

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     virtio_save(&n->vdev, f);

+
+    qemu_put_buffer(f, n->mac, ETH_ALEN);
+
+    qemu_put_be32(f, n->tx_timer_active);
+
     qemu_put_be32(f, n->mergeable_rx_bufs);

     qemu_put_be16(f, n->status);

static void virtio_net_save(QEMUFile *f, void *opaque)

{

    VirtIONet *n = opaque;

    virtio_save(&n->vdev, f);

    qemu_put_buffer(f, n->mac, ETH_ALEN);

    qemu_put_be32(f, n->tx_timer_active);

    qemu_put_be32(f, n->mergeable_rx_bufs);

    qemu_put_be16(f, n->status);

    qemu_put_byte(f, n->promisc);

    qemu_put_byte(f, n->allmulti);

    qemu_put_be32(f, n->mac_table.in_use);

    qemu_put_buffer(f, n->mac_table.macs, n->mac_table.in_use * ETH_ALEN);

    qemu_put_buffer(f, (uint8_t *)n->vlans, MAX_VLAN >> 3);

    qemu_put_be32(f, 0); /* vnet-hdr placeholder */

    qemu_put_byte(f, n->mac_table.multi_overflow);

    qemu_put_byte(f, n->mac_table.uni_overflow);

    qemu_put_byte(f, n->alluni);

    qemu_put_byte(f, n->nomulti);

    qemu_put_byte(f, n->nouni);

    qemu_put_byte(f, n->nobcast);

}


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

         new = qht_map_create(n_buckets);

+        resize = true;
+
+    }
+
+

     qht_map_lock_buckets(map);

bool qht_reset_size(struct qht *ht, size_t n_elems)

{

    struct qht_map *new;

    struct qht_map *map;

    size_t n_buckets;

    bool resize = false;

    n_buckets = qht_elems_to_buckets(n_elems);

    qemu_mutex_lock(&ht->lock);

    map = ht->map;

    if (n_buckets != map->n_buckets) {

        new = qht_map_create(n_buckets);

        resize = true;

    }

    qht_map_lock_buckets(map);

    qht_map_reset__all_locked(map);

    if (resize) {

        qht_do_resize(ht, new);

    }

    qht_map_unlock_buckets(map);

    qemu_mutex_unlock(&ht->lock);

    return resize;

}


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

+    snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id);

     if (snapshot_index < 0)

int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)

{

    BDRVQcowState *s = bs->opaque;

    QCowSnapshot *sn;

    int i, snapshot_index, l1_size2;

    snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id);

    if (snapshot_index < 0)

        return -ENOENT;

    sn = &s->snapshots[snapshot_index];

    if (qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, -1) < 0)

        goto fail;

    if (qcow2_grow_l1_table(bs, sn->l1_size) < 0)

        goto fail;

    s->l1_size = sn->l1_size;

    l1_size2 = s->l1_size * sizeof(uint64_t);

    /* copy the snapshot l1 table to the current l1 table */

    if (bdrv_pread(bs->file, sn->l1_table_offset,

                   s->l1_table, l1_size2) != l1_size2)

        goto fail;

    if (bdrv_pwrite(bs->file, s->l1_table_offset,

                    s->l1_table, l1_size2) != l1_size2)

        goto fail;

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

        be64_to_cpus(&s->l1_table[i]);

    }

    if (qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, 1) < 0)

        goto fail;

#ifdef DEBUG_ALLOC

    qcow2_check_refcounts(bs);

#endif

    return 0;

 fail:

    return -EIO;

}


--- a/source.c
+++ b/source.c
@@ -1,17 +1,17 @@
+static int qemu_chr_open_tty(QemuOpts *opts, CharDriverState **_chr)

 {

+    const char *filename = qemu_opt_get(opts, "path");
+
+    CharDriverState *chr;

     int fd;

+    TFR(fd = qemu_open(filename, O_RDWR | O_NONBLOCK));
+
     if (fd < 0) {

         return -errno;

static int qemu_chr_open_tty(QemuOpts *opts, CharDriverState **_chr)

{

    const char *filename = qemu_opt_get(opts, "path");

    CharDriverState *chr;

    int fd;

    TFR(fd = qemu_open(filename, O_RDWR | O_NONBLOCK));

    if (fd < 0) {

        return -errno;

    }

    tty_serial_init(fd, 115200, 'N', 8, 1);

    chr = qemu_chr_open_fd(fd, fd);

    chr->chr_ioctl = tty_serial_ioctl;

    chr->chr_close = qemu_chr_close_tty;

    *_chr = chr;

    return 0;

}


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

 {
+
+    GenericList *retval = *list;
+
     g_free(retval->value);

     *list = retval->next;

static GenericList *qapi_dealloc_next_list(Visitor *v, GenericList **list,

                                           Error **errp)

{

    GenericList *retval = *list;

    g_free(retval->value);

    *list = retval->next;

    return retval;

}


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

         for (i = 0; i < nevents; i++) {
+
+            struct iocb *iocb = events[i].obj;
+
+            struct qemu_laiocb *laiocb =
+
                     container_of(iocb, struct qemu_laiocb, iocb);

static void qemu_laio_completion_cb(void *opaque)

{

    struct qemu_laio_state *s = opaque;

    while (1) {

        struct io_event events[MAX_EVENTS];

        uint64_t val;

        ssize_t ret;

        struct timespec ts = { 0 };

        int nevents, i;

        do {

            ret = read(s->efd, &val, sizeof(val));

        } while (ret == 1 && errno == EINTR);

        if (ret == -1 && errno == EAGAIN)

            break;

        if (ret != 8)

            break;

        do {

            nevents = io_getevents(s->ctx, val, MAX_EVENTS, events, &ts);

        } while (nevents == -EINTR);

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

            struct iocb *iocb = events[i].obj;

            struct qemu_laiocb *laiocb =

                    container_of(iocb, struct qemu_laiocb, iocb);

            laiocb->ret = io_event_ret(&events[i]);

            qemu_laio_enqueue_completed(s, laiocb);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void gdb_chr_event(void *opaque, int event)

 {
+
+    switch (event) {
+
+    case CHR_EVENT_RESET:
+
         vm_stop(EXCP_INTERRUPT);

         gdb_syscall_state = opaque;

static void gdb_chr_event(void *opaque, int event)

{

    switch (event) {

    case CHR_EVENT_RESET:

        vm_stop(EXCP_INTERRUPT);

        gdb_syscall_state = opaque;

        gdb_has_xml = 0;

        break;

    default:

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 uint32_t pci_default_read_config(PCIDevice *d,

+                                 uint32_t address, int len)
+
 {

     uint32_t val = 0;

uint32_t pci_default_read_config(PCIDevice *d,

                                 uint32_t address, int len)

{

    uint32_t val = 0;

    assert(len == 1 || len == 2 || len == 4);

    len = MIN(len, pci_config_size(d) - address);

    memcpy(&val, d->config + address, len);

    return le32_to_cpu(val);

}


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

         return k->keysym2keycode[keysym];

+    } else {
+
+        int i;
+
+#ifdef XK_ISO_Left_Tab

         if (keysym == XK_ISO_Left_Tab) {

int keysym2scancode(void *kbd_layout, int keysym)

{

    kbd_layout_t *k = kbd_layout;

    if (keysym < MAX_NORMAL_KEYCODE) {

        if (k->keysym2keycode[keysym] == 0) {

            trace_keymap_unmapped(keysym);

            fprintf(stderr, "Warning: no scancode found for keysym %d\n",

                    keysym);

        }

        return k->keysym2keycode[keysym];

    } else {

        int i;

#ifdef XK_ISO_Left_Tab

        if (keysym == XK_ISO_Left_Tab) {

            keysym = XK_Tab;

        }

#endif

        for (i = 0; i < k->extra_count; i++) {

            if (k->keysym2keycode_extra[i].keysym == keysym) {

                return k->keysym2keycode_extra[i].keycode;

            }

        }

    }

    return 0;

}


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

     scsi_req_ref(req);

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

         blk_aio_cancel_async(req->aiocb);

void scsi_req_cancel_async(SCSIRequest *req, Notifier *notifier)

{

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

    if (notifier) {

        notifier_list_add(&req->cancel_notifiers, notifier);

    scsi_req_ref(req);

    scsi_req_dequeue(req);

    req->io_canceled = true;

    if (req->aiocb) {

        blk_aio_cancel_async(req->aiocb);

    } else {

        scsi_req_cancel_complete(req);


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

 {

+    avc_luma_midh_qrt_and_aver_dst_8w_msa(src - (2 * stride) - 2,
+
                                           stride, dst, stride, 8, 0);

 }

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

                                ptrdiff_t stride)

{

    avc_luma_midh_qrt_and_aver_dst_8w_msa(src - (2 * stride) - 2,

                                          stride, dst, stride, 8, 0);

}


static int make_cdt15_entry(int p1, int p2, int16_t *cdt)

{

    int r, b, lo;

    b = cdt[p2];

    r = cdt[p1] * 1024;

    lo = b + r;

    return (lo + (lo * (1 << 16))) * 2;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static inline void read_mem(IVState *s, uint64_t off, void *buf, size_t len)

 {
+
     QTestState *qtest = global_qtest;

static inline void read_mem(IVState *s, uint64_t off, void *buf, size_t len)

{

    QTestState *qtest = global_qtest;

    global_qtest = s->qtest;

    qpci_memread(s->dev, s->mem_base + off, buf, len);

    global_qtest = qtest;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static ssize_t block_crypto_write_func(QCryptoBlock *block,

                                        void *opaque,
+
+                                       size_t offset,
+
+                                       const uint8_t *buf,
+
                                        size_t buflen,

                                        Error **errp)

static ssize_t block_crypto_write_func(QCryptoBlock *block,

                                       void *opaque,

                                       size_t offset,

                                       const uint8_t *buf,

                                       size_t buflen,

                                       Error **errp)

{

    struct BlockCryptoCreateData *data = opaque;

    ssize_t ret;

    ret = blk_pwrite(data->blk, offset, buf, buflen, 0);

    if (ret < 0) {

        error_setg_errno(errp, -ret, "Could not write encryption header");

        return ret;

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -11,9 +11,9 @@
     for (i = 0; i < s->num_mmio; i++) {

         monitor_printf(mon, "%*smmio " TARGET_FMT_plx "/" TARGET_FMT_plx "\n",
+
+                       indent, "", s->mmio[i].addr, s->mmio[i].size);
+
+    }

 }

void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent)

{

    SysBusDevice *s = sysbus_from_qdev(dev);

    int i;

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

        monitor_printf(mon, "%*smmio " TARGET_FMT_plx "/" TARGET_FMT_plx "\n",

                       indent, "", s->mmio[i].addr, s->mmio[i].size);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn)
+
+{
+
+    spapr_hcall_fn old_fn;
+
+

     assert(opcode <= MAX_HCALL_OPCODE);

void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn)

{

    spapr_hcall_fn old_fn;

    assert(opcode <= MAX_HCALL_OPCODE);

    assert((opcode & 0x3) == 0);

    old_fn = hypercall_table[opcode / 4];

    assert(!old_fn || (fn == old_fn));

    hypercall_table[opcode / 4] = fn;

}


static inline int get_egolomb(GetBitContext *gb)

{

    int v = 4;

    while (get_bits1(gb)) v++;

    return (1 << v) + get_bits(gb, v);

}


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

         if (conf->heads < 1 || conf->heads > heads_max) {

+            error_setg(errp, "heads must be between 1 and %u", heads_max);
+
+            return;
+
+        }

         if (conf->secs < 1 || conf->secs > secs_max) {

void blkconf_geometry(BlockConf *conf, int *ptrans,

                      unsigned cyls_max, unsigned heads_max, unsigned secs_max,

                      Error **errp)

{

    DriveInfo *dinfo;

    if (!conf->cyls && !conf->heads && !conf->secs) {

        /* try to fall back to value set with legacy -drive cyls=... */

        dinfo = drive_get_by_blockdev(conf->bs);

        conf->cyls  = dinfo->cyls;

        conf->heads = dinfo->heads;

        conf->secs  = dinfo->secs;

        if (ptrans) {

            *ptrans = dinfo->trans;

        }

    }

    if (!conf->cyls && !conf->heads && !conf->secs) {

        hd_geometry_guess(conf->bs,

                          &conf->cyls, &conf->heads, &conf->secs,

                          ptrans);

    } else if (ptrans && *ptrans == BIOS_ATA_TRANSLATION_AUTO) {

        *ptrans = hd_bios_chs_auto_trans(conf->cyls, conf->heads, conf->secs);

    }

    if (conf->cyls || conf->heads || conf->secs) {

        if (conf->cyls < 1 || conf->cyls > cyls_max) {

            error_setg(errp, "cyls must be between 1 and %u", cyls_max);

            return;

        }

        if (conf->heads < 1 || conf->heads > heads_max) {

            error_setg(errp, "heads must be between 1 and %u", heads_max);

            return;

        }

        if (conf->secs < 1 || conf->secs > secs_max) {

            error_setg(errp, "secs must be between 1 and %u", secs_max);

            return;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp)

 {

@@ -7,7 +7,7 @@
         ff_vp9dsp_init_8(dsp);

     } else if (bpp == 10) {
+
         ff_vp9dsp_init_10(dsp);

     } else {

av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp)

{

    if (bpp == 8) {

        ff_vp9dsp_init_8(dsp);

    } else if (bpp == 10) {

        ff_vp9dsp_init_10(dsp);

    } else {

        av_assert0(bpp == 12);

        ff_vp9dsp_init_12(dsp);

    }

    if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp);

    if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)

+{

     c->frames= frame_offset;

void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)

{

    c->frames= frame_offset;

    if (c->ach)

        c->abytes= av_rescale_q(c->frames, c->sys->time_base,

                                (AVRational){8, c->ast[0]->codec->bit_rate});

    c->audio_pkt[0].size = c->audio_pkt[1].size = 0;

    c->audio_pkt[2].size = c->audio_pkt[3].size = 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static ExitStatus trans_fop_wew_0e(DisasContext *ctx, uint32_t insn,

                                    const DisasInsn *di)
+
 {

     unsigned rt = assemble_rt64(insn);

static ExitStatus trans_fop_wew_0e(DisasContext *ctx, uint32_t insn,

                                   const DisasInsn *di)

{

    unsigned rt = assemble_rt64(insn);

    unsigned ra = assemble_ra64(insn);

    return do_fop_wew(ctx, rt, ra, di->f_wew);

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 void migration_bitmap_extend(ram_addr_t old, ram_addr_t new)
+
+{
+
     /* called in qemu main thread, so there is
+
+     * no writing race against this migration_bitmap
+
      */

+    if (migration_bitmap) {
+
         unsigned long *old_bitmap = migration_bitmap, *bitmap;

         bitmap = bitmap_new(new);

void migration_bitmap_extend(ram_addr_t old, ram_addr_t new)

{

    /* called in qemu main thread, so there is

     * no writing race against this migration_bitmap

     */

    if (migration_bitmap) {

        unsigned long *old_bitmap = migration_bitmap, *bitmap;

        bitmap = bitmap_new(new);

        /* prevent migration_bitmap content from being set bit

         * by migration_bitmap_sync_range() at the same time.

         * it is safe to migration if migration_bitmap is cleared bit

         * at the same time.

         */

        qemu_mutex_lock(&migration_bitmap_mutex);

        bitmap_copy(bitmap, old_bitmap, old);

        bitmap_set(bitmap, old, new - old);

        atomic_rcu_set(&migration_bitmap, bitmap);

        qemu_mutex_unlock(&migration_bitmap_mutex);

        migration_dirty_pages += new - old;

        synchronize_rcu();

        g_free(old_bitmap);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static inline void menelaus_rtc_start(struct menelaus_s *s)

+{

     s->rtc.next =+ qemu_get_clock(rt_clock);

static inline void menelaus_rtc_start(struct menelaus_s *s)

{

    s->rtc.next =+ qemu_get_clock(rt_clock);

    qemu_mod_timer(s->rtc.hz, s->rtc.next);

}


static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs)

{

    int i;

    BDRVVmdkState *s = bs->opaque;

    ImageInfoSpecific *spec_info = g_new0(ImageInfoSpecific, 1);

    ImageInfoList **next;

    *spec_info = (ImageInfoSpecific){

        .type = IMAGE_INFO_SPECIFIC_KIND_VMDK,

        {

            .vmdk = g_new0(ImageInfoSpecificVmdk, 1),

        },

    };

    *spec_info->u.vmdk = (ImageInfoSpecificVmdk) {

        .create_type = g_strdup(s->create_type),

        .cid = s->cid,

        .parent_cid = s->parent_cid,

    };

    next = &spec_info->u.vmdk->extents;

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

        *next = g_new0(ImageInfoList, 1);

        (*next)->value = vmdk_get_extent_info(&s->extents[i]);

        (*next)->next = NULL;

        next = &(*next)->next;

    }

    return spec_info;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
         decoded1++;

+
+        /* Combined */
+
+        p->buf++;
+

         /* Have we filled the history buffer? */

static void predictor_decode_stereo(APEContext *ctx, int count)

{

    APEPredictor *p = &ctx->predictor;

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

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

    while (count--) {

        /* Predictor Y */

        *decoded0 = predictor_update_filter(p, *decoded0, 0, YDELAYA, YDELAYB,

                                            YADAPTCOEFFSA, YADAPTCOEFFSB);

        decoded0++;

        *decoded1 = predictor_update_filter(p, *decoded1, 1, XDELAYA, XDELAYB,

                                            XADAPTCOEFFSA, XADAPTCOEFFSB);

        decoded1++;

        /* Combined */

        p->buf++;

        /* Have we filled the history buffer? */

        if (p->buf == p->historybuffer + HISTORY_SIZE) {

            memmove(p->historybuffer, p->buf,

                    PREDICTOR_SIZE * sizeof(*p->historybuffer));

            p->buf = p->historybuffer;

        }

    }

}


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

     /* Ignore regions with dirty logging, we cannot mark them dirty */

+    if (memory_region_is_logging(section.mr)) {
+
+        goto out;
+
+    }

static void *vring_map(MemoryRegion **mr, hwaddr phys, hwaddr len,

                       bool is_write)

{

    MemoryRegionSection section = memory_region_find(get_system_memory(), phys, len);

    if (!section.mr || int128_get64(section.size) < len) {

        goto out;

    }

    if (is_write && section.readonly) {

        goto out;

    }

    if (!memory_region_is_ram(section.mr)) {

        goto out;

    }

    /* Ignore regions with dirty logging, we cannot mark them dirty */

    if (memory_region_is_logging(section.mr)) {

        goto out;

    }

    *mr = section.mr;

    return memory_region_get_ram_ptr(section.mr) + section.offset_within_region;

out:

    memory_region_unref(section.mr);

    *mr = NULL;

    return NULL;

}


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

     int pw = w, ph = h;
+
     Jpeg2000TgtNode *res, *t, *t2;

     int32_t tt_size;

Jpeg2000TgtNode *ff_j2k_tag_tree_init(int w, int h)

{

    int pw = w, ph = h;

    Jpeg2000TgtNode *res, *t, *t2;

    int32_t tt_size;

    tt_size = tag_tree_size(w, h);

    t = res = av_mallocz(tt_size, sizeof(*t));

    if (!res)

        return NULL;

    while (w > 1 || h > 1) {

        int i, j;

        pw = w;

        ph = h;

        w  = (w + 1) >> 1;

        h  = (h + 1) >> 1;

        t2 = t + pw * ph;

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

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

                t[i * pw + j].parent = &t2[(i >> 1) * w + (j >> 1)];

        t = t2;

    }

    t[0].parent = NULL;

    return res;

}