--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 static void vnc_resize(VncState *vs)

 {
+
+    DisplayState *ds = vs->ds;
+
+

+    int size_changed;

+
+
     vs->old_data = qemu_realloc(vs->old_data, ds_get_linesize(ds) * ds_get_height(ds));

@@ -19,8 +19,8 @@
         fprintf(stderr, "vnc: memory allocation failed\n");

         exit(1);
+
+    }

static void vnc_resize(VncState *vs)

{

    DisplayState *ds = vs->ds;

    int size_changed;

    vs->old_data = qemu_realloc(vs->old_data, ds_get_linesize(ds) * ds_get_height(ds));

    if (vs->old_data == NULL) {

        fprintf(stderr, "vnc: memory allocation failed\n");

        exit(1);

    }

    if (ds_get_bytes_per_pixel(ds) != vs->serverds.pf.bytes_per_pixel)

        console_color_init(ds);

    vnc_colordepth(vs);

    size_changed = ds_get_width(ds) != vs->serverds.width ||

                   ds_get_height(ds) != vs->serverds.height;

    vs->serverds = *(ds->surface);

    if (size_changed) {

        if (vs->csock != -1 && vnc_has_feature(vs, VNC_FEATURE_RESIZE)) {

            vnc_write_u8(vs, 0);  /* msg id */

            vnc_write_u8(vs, 0);

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

            vnc_framebuffer_update(vs, 0, 0, ds_get_width(ds), ds_get_height(ds),

                                   VNC_ENCODING_DESKTOPRESIZE);

            vnc_flush(vs);

        }

    }

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

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

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 uint32_t virtio_config_readw(VirtIODevice *vdev, uint32_t addr)

 {
+
+    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);

     uint16_t val;

uint32_t virtio_config_readw(VirtIODevice *vdev, uint32_t addr)

{

    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);

    uint16_t val;

    k->get_config(vdev, vdev->config);

    if (addr > (vdev->config_len - sizeof(val)))

        return (uint32_t)-1;

    val = lduw_p(vdev->config + addr);

    return val;

}


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

     /* remove the callback from the queue */
+
+    pacb = &posix_aio_state->first_aio;
+
+    for(;;) {
+
         if (*pacb == NULL) {

             fprintf(stderr, "raw_aio_remove: aio request not found!\n");

static void raw_aio_remove(RawAIOCB *acb)

{

    RawAIOCB **pacb;

    /* remove the callback from the queue */

    pacb = &posix_aio_state->first_aio;

    for(;;) {

        if (*pacb == NULL) {

            fprintf(stderr, "raw_aio_remove: aio request not found!\n");

            break;

        } else if (*pacb == acb) {

            *pacb = acb->next;

            qemu_aio_release(acb);

            break;

        }

        pacb = &(*pacb)->next;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int read_line(AVIOContext * pb, char* line, int bufsize)

+{
+
+    int i;
+
+    for (i = 0; i < bufsize - 1; i++) {

         int b = avio_r8(pb);

static int read_line(AVIOContext * pb, char* line, int bufsize)

{

    int i;

    for (i = 0; i < bufsize - 1; i++) {

        int b = avio_r8(pb);

        if (b == 0)

            break;

        if (b == '\n') {

            line[i] = '\0';

            return 0;

        }

        line[i] = b;

    }

    line[i] = '\0';

    return -1;

}


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

 {
+
     DeviceClass *dc = DEVICE_CLASS(klass);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    dc->realize = vmmouse_realizefn;

    dc->no_user = 1;

    dc->reset = vmmouse_reset;

    dc->vmsd = &vmstate_vmmouse;

    dc->props = vmmouse_properties;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int av_buffersink_poll_frame(AVFilterContext *ctx)

 {
+
     BufferSinkContext *buf = ctx->priv;

     AVFilterLink *inlink = ctx->inputs[0];

int av_buffersink_poll_frame(AVFilterContext *ctx)

{

    BufferSinkContext *buf = ctx->priv;

    AVFilterLink *inlink = ctx->inputs[0];

    av_assert0(!strcmp(ctx->filter->name, "buffersink") || !strcmp(ctx->filter->name, "abuffersink"));

    return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + ff_poll_frame(inlink);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static NvencSurface *get_free_frame(NvencContext *ctx)

+{
+
+    int i;
+
+

     for (i = 0; i < ctx->nb_surfaces; i++) {

static NvencSurface *get_free_frame(NvencContext *ctx)

{

    int i;

    for (i = 0; i < ctx->nb_surfaces; i++) {

        if (!ctx->surfaces[i].lockCount) {

            ctx->surfaces[i].lockCount = 1;

            return &ctx->surfaces[i];

        }

    }

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void rgb15tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size)

 {

void rgb15tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size)

{

	const uint16_t *end;

	uint8_t *d = (uint8_t *)dst;

	const uint16_t *s = (const uint16_t *)src;

	end = s + src_size/2;

	while(s < end)

	{

		register uint16_t bgr;

		bgr = *s++;

		*d++ = (bgr&0x7C00)>>7;

		*d++ = (bgr&0x3E0)>>2;

		*d++ = (bgr&0x1F)<<3;

		*d++ = 0;

	}

}


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

         m->imkh_cctv = 1;

+    } else if (!memcmp("Sofdec", buffer, 6)) {
+
+        m->sofdec = 1;
+
+    } else

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

static int mpegps_read_header(AVFormatContext *s)

{

    MpegDemuxContext *m = s->priv_data;

    char buffer[7];

    int64_t last_pos = avio_tell(s->pb);

    m->header_state = 0xff;

    s->ctx_flags   |= AVFMTCTX_NOHEADER;

    avio_get_str(s->pb, 6, buffer, sizeof(buffer));

    if (!memcmp("IMKH", buffer, 4)) {

        m->imkh_cctv = 1;

    } else if (!memcmp("Sofdec", buffer, 6)) {

        m->sofdec = 1;

    } else

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

    /* no need to do more */

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip)

 {

void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip)

{

    const ARMCPRegInfo *ri = rip;

    switch (ri->accessfn(env, ri)) {

    case CP_ACCESS_OK:

        return;

    case CP_ACCESS_TRAP:

    case CP_ACCESS_TRAP_UNCATEGORIZED:

        /* These cases will eventually need to generate different

         * syndrome information.

         */

        break;

    default:

        g_assert_not_reached();

    }

    raise_exception(env, EXCP_UDEF);

}


static int mpc8_probe(AVProbeData *p)

{

    const uint8_t *bs = p->buf + 4;

    const uint8_t *bs_end = bs + p->buf_size;

    int64_t size;

    if (p->buf_size < 16)

        return 0;

    if (AV_RL32(p->buf) != TAG_MPCK)

        return 0;

    while (bs < bs_end + 3) {

        int header_found = (bs[0] == 'S' && bs[1] == 'H');

        if (bs[0] < 'A' || bs[0] > 'Z' || bs[1] < 'A' || bs[1] > 'Z')

            return 0;

        bs += 2;

        size = bs_get_v(&bs);

        if (size < 2)

            return 0;

        if (bs + size - 2 >= bs_end)

            return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet

        if (header_found) {

            if (size < 11 || size > 28)

                return 0;

            if (!AV_RL32(bs)) //zero CRC is invalid

                return 0;

            return AVPROBE_SCORE_MAX;

        } else {

            bs += size - 2;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     unsigned int rxbase = s->rxbuf * (0x800 / 4);

+
+    /* DA filter.  */
+
+    if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6))
+
         return size;

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

{

    struct xlx_ethlite *s = qemu_get_nic_opaque(nc);

    unsigned int rxbase = s->rxbuf * (0x800 / 4);

    /* DA filter.  */

    if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6))

        return size;

    if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) {

        D(qemu_log("ethlite lost packet %x\n", s->regs[R_RX_CTRL0]));

    D(qemu_log("%s %zd rxbase=%x\n", __func__, size, rxbase));

    memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size);

    s->regs[rxbase + R_RX_CTRL0] |= CTRL_S;

    if (s->regs[R_RX_CTRL0] & CTRL_I) {

        eth_pulse_irq(s);

    /* If c_rx_pingpong was set flip buffers.  */

    s->rxbuf ^= s->c_rx_pingpong;

    return size;


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

             return AVERROR(ENOMEM);

+        s->frames[i]->nb_samples = 512;
+
+        if ((ret = ff_get_buffer(avctx, s->frames[i], 0)) < 0) {
+
+            return AVERROR(ENOMEM);

         }

static av_cold int xma_decode_init(AVCodecContext *avctx)

{

    XMADecodeCtx *s = avctx->priv_data;

    int i, ret;

    for (i = 0; i < avctx->channels / 2; i++) {

        ret = decode_init(&s->xma[i], avctx);

        s->frames[i] = av_frame_alloc();

        if (!s->frames[i])

            return AVERROR(ENOMEM);

        s->frames[i]->nb_samples = 512;

        if ((ret = ff_get_buffer(avctx, s->frames[i], 0)) < 0) {

            return AVERROR(ENOMEM);

        }

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int msix_is_masked(PCIDevice *dev, int vector)
+
+{

     unsigned offset =

static int msix_is_masked(PCIDevice *dev, int vector)

{

    unsigned offset =

        vector * PCI_MSIX_ENTRY_SIZE + PCI_MSIX_ENTRY_VECTOR_CTRL;

    return dev->msix_function_masked ||

	   dev->msix_table_page[offset] & PCI_MSIX_ENTRY_CTRL_MASKBIT;

}


--- a/source.c
+++ b/source.c
@@ -11,9 +11,9 @@
     if (addr & 7)

         ide_ioport_write(&s->bus, addr, val);
+
+    else
+
+        ide_data_writew(&s->bus, 0, val);

 }

static void mmio_ide_write(void *opaque, target_phys_addr_t addr,

                           uint64_t val, unsigned size)

{

    MMIOState *s = opaque;

    addr >>= s->shift;

    if (addr & 7)

        ide_ioport_write(&s->bus, addr, val);

    else

        ide_data_writew(&s->bus, 0, val);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static vscsi_req *vscsi_find_req(VSCSIState *s, uint32_t tag)

+{

     if (tag >= VSCSI_REQ_LIMIT || !s->reqs[tag].active) {

static vscsi_req *vscsi_find_req(VSCSIState *s, uint32_t tag)

{

    if (tag >= VSCSI_REQ_LIMIT || !s->reqs[tag].active) {

        return NULL;

    }

    return &s->reqs[tag];

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     av_freep(&s->me.map);

     av_freep(&s->me.score_map);
+
+    av_freep(&s->blocks);
+
+    av_freep(&s->ac_val_base);
+
     s->block = NULL;

 }

static void free_duplicate_context(MpegEncContext *s)

{

    if (s == NULL)

        return;

    av_freep(&s->edge_emu_buffer);

    av_freep(&s->me.scratchpad);

    s->me.temp =

    s->rd_scratchpad =

    s->b_scratchpad =

    s->obmc_scratchpad = NULL;

    av_freep(&s->dct_error_sum);

    av_freep(&s->me.map);

    av_freep(&s->me.score_map);

    av_freep(&s->blocks);

    av_freep(&s->ac_val_base);

    s->block = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 USBDevice *usb_create_simple(USBBus *bus, const char *name)

+{

     USBDevice *dev = usb_create(bus, name);

USBDevice *usb_create_simple(USBBus *bus, const char *name)

{

    USBDevice *dev = usb_create(bus, name);

    qdev_init(&dev->qdev);

    return dev;

}


--- a/source.c
+++ b/source.c
@@ -5,5 +5,5 @@
     printf("ECC: Unsupported read 0x" TARGET_FMT_plx " 0000\n", addr);

     return 0;
+
+}

static uint32_t ecc_mem_readw(void *opaque, target_phys_addr_t addr)

{

    printf("ECC: Unsupported read 0x" TARGET_FMT_plx " 0000\n", addr);

    return 0;

}


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

+err:
+
+    while (--i >= 0) {
+
+        obj = sc->threads + i * size;

         object_unparent(obj);

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

{

    sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));

    CPUCore *cc = CPU_CORE(OBJECT(dev));

    const char *typename = object_class_get_name(sc->cpu_class);

    size_t size = object_type_get_instance_size(typename);

    Error *local_err = NULL;

    Object *obj;

    int i;

    sc->threads = g_malloc0(size * cc->nr_threads);

    for (i = 0; i < cc->nr_threads; i++) {

        char id[32];

        void *obj = sc->threads + i * size;

        object_initialize(obj, size, typename);

        snprintf(id, sizeof(id), "thread[%d]", i);

        object_property_add_child(OBJECT(sc), id, obj, &local_err);

        if (local_err) {

            goto err;

        }

    }

    object_child_foreach(OBJECT(dev), spapr_cpu_core_realize_child, &local_err);

    if (local_err) {

        goto err;

    } else {

        return;

    }

err:

    while (--i >= 0) {

        obj = sc->threads + i * size;

        object_unparent(obj);

    }

    g_free(sc->threads);

    error_propagate(errp, local_err);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void dump(unsigned char *buf,size_t len)
+
+{
+
+	int i;
+
 	for(i=0;i<len;i++) {
+
 		if ((i&15)==0) printf("%04x  ",i);

 		printf("%02x ",buf[i]);

static void dump(unsigned char *buf,size_t len)

{

	int i;

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

		if ((i&15)==0) printf("%04x  ",i);

		printf("%02x ",buf[i]);

		if ((i&15)==15) printf("\n");

	}

	printf("\n");

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int init(AVCodecParserContext *s)
+
+{
+
     H264Context *h = s->priv_data;

     h->thread_context[0] = h;

static int init(AVCodecParserContext *s)

{

    H264Context *h = s->priv_data;

    h->thread_context[0] = h;

    return 0;

}


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

+{

     Request *req = opaque;

static void blkreplay_bh_cb(void *opaque)

{

    Request *req = opaque;

    qemu_coroutine_enter(req->co, NULL);

    qemu_bh_delete(req->bh);

    g_free(req);

}


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

                                     int *pcwidth, int *pcheight)

+{

     int width, cwidth, height, cheight;
+

     /* total width & height */

static void vga_get_text_resolution(VGACommonState *s, int *pwidth, int *pheight,

                                    int *pcwidth, int *pcheight)

{

    int width, cwidth, height, cheight;

    /* total width & height */

    cheight = (s->cr[VGA_CRTC_MAX_SCAN] & 0x1f) + 1;

    cwidth = 8;

    if (!(s->sr[VGA_SEQ_CLOCK_MODE] & VGA_SR01_CHAR_CLK_8DOTS)) {

        cwidth = 9;

    }

    if (s->sr[VGA_SEQ_CLOCK_MODE] & 0x08) {

        cwidth = 16; /* NOTE: no 18 pixel wide */

    }

    width = (s->cr[VGA_CRTC_H_DISP] + 1);

    if (s->cr[VGA_CRTC_V_TOTAL] == 100) {

        /* ugly hack for CGA 160x100x16 - explain me the logic */

        height = 100;

    } else {

        height = s->cr[VGA_CRTC_V_DISP_END] |

            ((s->cr[VGA_CRTC_OVERFLOW] & 0x02) << 7) |

            ((s->cr[VGA_CRTC_OVERFLOW] & 0x40) << 3);

        height = (height + 1) / cheight;

    }

    *pwidth = width;

    *pheight = height;

    *pcwidth = cwidth;

    *pcheight = cheight;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 static int vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)

 {
+
     int ret;

+    vdev->msix->pending = g_malloc0(BITS_TO_LONGS(vdev->msix->entries) *

                                     sizeof(unsigned long));

static int vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)

{

    int ret;

    vdev->msix->pending = g_malloc0(BITS_TO_LONGS(vdev->msix->entries) *

                                    sizeof(unsigned long));

    ret = msix_init(&vdev->pdev, vdev->msix->entries,

                    vdev->bars[vdev->msix->table_bar].region.mem,

                    vdev->msix->table_bar, vdev->msix->table_offset,

                    vdev->bars[vdev->msix->pba_bar].region.mem,

                    vdev->msix->pba_bar, vdev->msix->pba_offset, pos);

    if (ret < 0) {

        if (ret == -ENOTSUP) {

            return 0;

        }

        error_setg(errp, "msix_init failed");

        return ret;

    }

    /*

     * The PCI spec suggests that devices provide additional alignment for

     * MSI-X structures and avoid overlapping non-MSI-X related registers.

     * For an assigned device, this hopefully means that emulation of MSI-X

     * structures does not affect the performance of the device.  If devices

     * fail to provide that alignment, a significant performance penalty may

     * result, for instance Mellanox MT27500 VFs:

     * http://www.spinics.net/lists/kvm/msg125881.html

     *

     * The PBA is simply not that important for such a serious regression and

     * most drivers do not appear to look at it.  The solution for this is to

     * disable the PBA MemoryRegion unless it's being used.  We disable it

     * here and only enable it if a masked vector fires through QEMU.  As the

     * vector-use notifier is called, which occurs on unmask, we test whether

     * PBA emulation is needed and again disable if not.

     */

    memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, false);

    return 0;

}


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

     if(!graph)

+        return r;

int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags)

{

    int i, r = AVERROR(ENOSYS);

    if(!graph)

        return r;

    if((flags & AVFILTER_CMD_FLAG_ONE) && !(flags & AVFILTER_CMD_FLAG_FAST)) {

        r=avfilter_graph_send_command(graph, target, cmd, arg, res, res_len, flags | AVFILTER_CMD_FLAG_FAST);

        if(r != AVERROR(ENOSYS))

            return r;

    }

    if(res_len && res)

        res[0]= 0;

    for (i = 0; i < graph->filter_count; i++) {

        AVFilterContext *filter = graph->filters[i];

        if(!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name)){

            r = avfilter_process_command(filter, cmd, arg, res, res_len, flags);

            if(r != AVERROR(ENOSYS)) {

                if((flags & AVFILTER_CMD_FLAG_ONE) || r<0)

                    return r;

            }

        }

    }

    return r;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
     avctx->delay      = avctx->frame_size;

     avctx->bit_rate = 8000;
+
+    ractx = avctx->priv_data;
+
+    ractx->lpc_coef[0] = ractx->lpc_tables[0];
+
     ractx->lpc_coef[1] = ractx->lpc_tables[1];

     ractx->avctx = avctx;

static av_cold int ra144_encode_init(AVCodecContext * avctx)

{

    RA144Context *ractx;

    int ret;

    if (avctx->channels != 1) {

        av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n",

               avctx->channels);

        return -1;

    }

    avctx->frame_size = NBLOCKS * BLOCKSIZE;

    avctx->delay      = avctx->frame_size;

    avctx->bit_rate = 8000;

    ractx = avctx->priv_data;

    ractx->lpc_coef[0] = ractx->lpc_tables[0];

    ractx->lpc_coef[1] = ractx->lpc_tables[1];

    ractx->avctx = avctx;

    ret = ff_lpc_init(&ractx->lpc_ctx, avctx->frame_size, LPC_ORDER,

                      FF_LPC_TYPE_LEVINSON);

    if (ret < 0)

        goto error;

    ff_af_queue_init(avctx, &ractx->afq);

    return 0;

error:

    ra144_encode_close(avctx);

    return ret;

}


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

     env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001800;

+    env->excp_prefix   = 0x00000000FFF00000ULL;
+
+    /* Hardware reset vector */
+
+    env->hreset_vector = 0x0000000000000100ULL;

 #endif

static void init_excp_970 (CPUPPCState *env)

{

#if !defined(CONFIG_USER_ONLY)

    env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;

    env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;

    env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;

    env->excp_vectors[POWERPC_EXCP_DSEG]     = 0x00000380;

    env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;

    env->excp_vectors[POWERPC_EXCP_ISEG]     = 0x00000480;

    env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;

    env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;

    env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;

    env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;

    env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;

#if defined(TARGET_PPC64H) /* PowerPC 64 with hypervisor mode support */

    env->excp_vectors[POWERPC_EXCP_HDECR]    = 0x00000980;

#endif

    env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;

    env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;

    env->excp_vectors[POWERPC_EXCP_PERFM]    = 0x00000F00;

    env->excp_vectors[POWERPC_EXCP_VPU]      = 0x00000F20;

    env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;

    env->excp_vectors[POWERPC_EXCP_MAINT]    = 0x00001600;

    env->excp_vectors[POWERPC_EXCP_VPUA]     = 0x00001700;

    env->excp_vectors[POWERPC_EXCP_THERM]    = 0x00001800;

    env->excp_prefix   = 0x00000000FFF00000ULL;

    /* Hardware reset vector */

    env->hreset_vector = 0x0000000000000100ULL;

#endif

}


static int l2_load(BlockDriverState *bs, uint64_t l2_offset,

    uint64_t **l2_table)

{

    BDRVQcowState *s = bs->opaque;

    int min_index;

    int ret;

    /* seek if the table for the given offset is in the cache */

    *l2_table = seek_l2_table(s, l2_offset);

    if (*l2_table != NULL) {

        return 0;

    }

    /* not found: load a new entry in the least used one */

    min_index = l2_cache_new_entry(bs);

    *l2_table = s->l2_cache + (min_index << s->l2_bits);

    BLKDBG_EVENT(bs->file, BLKDBG_L2_LOAD);

    ret = bdrv_pread(bs->file, l2_offset, *l2_table,

        s->l2_size * sizeof(uint64_t));

    if (ret < 0) {

        return ret;

    }

    s->l2_cache_offsets[min_index] = l2_offset;

    s->l2_cache_counts[min_index] = 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     uint64_t i;

     int ret;
+
+
+
+    assert(nb_clusters >= 0);
+
     if (nb_clusters == 0) {

         return 0;

int qcow2_alloc_clusters_at(BlockDriverState *bs, uint64_t offset,

    int nb_clusters)

{

    BDRVQcow2State *s = bs->opaque;

    uint64_t cluster_index, refcount;

    uint64_t i;

    int ret;

    assert(nb_clusters >= 0);

    if (nb_clusters == 0) {

        return 0;

    }

    do {

        /* Check how many clusters there are free */

        cluster_index = offset >> s->cluster_bits;

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

            ret = qcow2_get_refcount(bs, cluster_index++, &refcount);

            if (ret < 0) {

                return ret;

            } else if (refcount != 0) {

                break;

            }

        }

        /* And then allocate them */

        ret = update_refcount(bs, offset, i << s->cluster_bits, 1, false,

                              QCOW2_DISCARD_NEVER);

    } while (ret == -EAGAIN);

    if (ret < 0) {

        return ret;

    }

    return i;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void setup_rt_frame(int sig, struct target_sigaction *ka,
+
                            target_siginfo_t *info,

 			   target_sigset_t *set, CPUState *env)

static void setup_rt_frame(int sig, struct target_sigaction *ka,

                           target_siginfo_t *info,

			   target_sigset_t *set, CPUState *env)

{

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

}


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

 {

+    uint8_t val;
+
+    val = ioport_read(0, addr);

     trace_cpu_in(addr, val);

uint8_t cpu_inb(pio_addr_t addr)

{

    uint8_t val;

    val = ioport_read(0, addr);

    trace_cpu_in(addr, val);

    LOG_IOPORT("inb : %04"FMT_pioaddr" %02"PRIx8"\n", addr, val);

    return val;

}


--- 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
@@ -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
@@ -1,14 +1,14 @@
+int spapr_vio_check_tces(VIOsPAPRDevice *dev, target_ulong ioba,
+
+                         target_ulong len, enum VIOsPAPR_TCEAccess access)
+
+{
+
+    int start, end, i;
+

+    start = ioba >> SPAPR_VIO_TCE_PAGE_SHIFT;

     end = (ioba + len - 1) >> SPAPR_VIO_TCE_PAGE_SHIFT;

int spapr_vio_check_tces(VIOsPAPRDevice *dev, target_ulong ioba,

                         target_ulong len, enum VIOsPAPR_TCEAccess access)

{

    int start, end, i;

    start = ioba >> SPAPR_VIO_TCE_PAGE_SHIFT;

    end = (ioba + len - 1) >> SPAPR_VIO_TCE_PAGE_SHIFT;

    for (i = start; i <= end; i++) {

        if ((dev->rtce_table[i].tce & access) != access) {

#ifdef DEBUG_TCE

            fprintf(stderr, "FAIL on %d\n", i);

#endif

            return -1;

        }

    }

    return 0;

}


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

             linesize = s->width * s->depth * s->bytes_per_channel;

+            dest_row -= s->linesize;
+
+            start_offset = bytestream2_get_be32(&g_table);
+
+            bytestream2_seek(&s->g, start_offset, SEEK_SET);

             if (s->bytes_per_channel == 1)

static int read_rle_sgi(uint8_t *out_buf, SgiState *s)

{

    uint8_t *dest_row;

    unsigned int len = s->height * s->depth * 4;

    GetByteContext g_table = s->g;

    unsigned int y, z;

    unsigned int start_offset;

    int linesize, ret;

    /* size of  RLE offset and length tables */

    if (len * 2 > bytestream2_get_bytes_left(&s->g)) {

        return AVERROR_INVALIDDATA;

    }

    for (z = 0; z < s->depth; z++) {

        dest_row = out_buf;

        for (y = 0; y < s->height; y++) {

            linesize = s->width * s->depth * s->bytes_per_channel;

            dest_row -= s->linesize;

            start_offset = bytestream2_get_be32(&g_table);

            bytestream2_seek(&s->g, start_offset, SEEK_SET);

            if (s->bytes_per_channel == 1)

                ret = expand_rle_row8(s, dest_row + z, linesize, s->depth);

            else

                ret = expand_rle_row16(s, (uint16_t *)dest_row + z, linesize, s->depth);

            if (ret != s->width)

                return AVERROR_INVALIDDATA;

        }

    }

    return 0;

}


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

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

+        idx[i] = ceilf(asin(coef[i])*((coef[i] >= 0) ? iqfac_p : iqfac_m));
+
+        u_coef = (idx[i])&(~(~0<<TNS_Q_BITS));
+
+        lpc[i] = quant_arr[u_coef];

     }

static int quantize_coefs(double *coef, int *idx, float *lpc, int order)

{

    int i;

    uint8_t u_coef;

    const float *quant_arr = tns_tmp2_map[TNS_Q_BITS == 4];

    const double iqfac_p = ((1 << (TNS_Q_BITS-1)) - 0.5)/(M_PI/2.0);

    const double iqfac_m = ((1 << (TNS_Q_BITS-1)) + 0.5)/(M_PI/2.0);

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

        idx[i] = ceilf(asin(coef[i])*((coef[i] >= 0) ? iqfac_p : iqfac_m));

        u_coef = (idx[i])&(~(~0<<TNS_Q_BITS));

        lpc[i] = quant_arr[u_coef];

    }

    return order;

}


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

 {

+    RwCo *rwco = opaque;
+

     rwco->ret = bdrv_co_flush(rwco->bs);

static void coroutine_fn bdrv_flush_co_entry(void *opaque)

{

    RwCo *rwco = opaque;

    rwco->ret = bdrv_co_flush(rwco->bs);

}


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

 {

const uint8_t *get_submv_prob(uint32_t left, uint32_t top)

{

    if (left == top)

        return vp8_submv_prob[4 - !!left];

    if (!top)

        return vp8_submv_prob[2];

    return vp8_submv_prob[1 - !!left];

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
     case TIFF_SSHORT   : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 1, metadata);

     case TIFF_SHORT    : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 0, metadata);
+
+    case TIFF_SBYTE    : return ff_tadd_bytes_metadata(count, name, sep, gb, le, 1, metadata);
+
+    case TIFF_BYTE     :
+
     case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(count, name, sep, gb, le, 0, metadata);

     case TIFF_STRING   : return ff_tadd_string_metadata(count, name, gb, le, metadata);

static int exif_add_metadata(AVCodecContext *avctx, int count, int type,

                             const char *name, const char *sep,

                             GetByteContext *gb, int le,

                             AVDictionary **metadata)

{

    switch(type) {

    case 0:

        av_log(avctx, AV_LOG_WARNING,

               "Invalid TIFF tag type 0 found for %s with size %d\n",

               name, count);

        return 0;

    case TIFF_DOUBLE   : return ff_tadd_doubles_metadata(count, name, sep, gb, le, metadata);

    case TIFF_SSHORT   : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 1, metadata);

    case TIFF_SHORT    : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 0, metadata);

    case TIFF_SBYTE    : return ff_tadd_bytes_metadata(count, name, sep, gb, le, 1, metadata);

    case TIFF_BYTE     :

    case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(count, name, sep, gb, le, 0, metadata);

    case TIFF_STRING   : return ff_tadd_string_metadata(count, name, gb, le, metadata);

    case TIFF_SRATIONAL:

    case TIFF_RATIONAL : return ff_tadd_rational_metadata(count, name, sep, gb, le, metadata);

    case TIFF_SLONG    :

    case TIFF_LONG     : return ff_tadd_long_metadata(count, name, sep, gb, le, metadata);

    default:

        avpriv_request_sample(avctx, "TIFF tag type (%u)", type);

        return 0;

    };

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     pci_conf[PCI_CLASS_PROG] = 0x00;

     pci_config_set_class(pci_conf, PCI_CLASS_SERIAL_USB);
+
+    /* TODO: reset value should be 0. */
+
+    pci_conf[PCI_INTERRUPT_PIN] = 4; // interrupt pin 3
+
     pci_conf[0x60] = 0x10; // release number

static int usb_uhci_common_initfn(UHCIState *s)

{

    uint8_t *pci_conf = s->dev.config;

    int i;

    pci_conf[PCI_REVISION_ID] = 0x01; // revision number

    pci_conf[PCI_CLASS_PROG] = 0x00;

    pci_config_set_class(pci_conf, PCI_CLASS_SERIAL_USB);

    /* TODO: reset value should be 0. */

    pci_conf[PCI_INTERRUPT_PIN] = 4; // interrupt pin 3

    pci_conf[0x60] = 0x10; // release number

    usb_bus_new(&s->bus, &s->dev.qdev);

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

        usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,

                          USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);

        usb_port_location(&s->ports[i].port, NULL, i+1);

    }

    s->frame_timer = qemu_new_timer_ns(vm_clock, uhci_frame_timer, s);

    s->expire_time = qemu_get_clock_ns(vm_clock) +

        (get_ticks_per_sec() / FRAME_TIMER_FREQ);

    s->num_ports_vmstate = NB_PORTS;

    qemu_register_reset(uhci_reset, s);

    /* Use region 4 for consistency with real hardware.  BSD guests seem

       to rely on this.  */

    pci_register_bar(&s->dev, 4, 0x20,

                           PCI_BASE_ADDRESS_SPACE_IO, uhci_map);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                     NotifierWithReturn *notifier)

 {
+
+    notifier_with_return_list_add(&bs->before_write_notifiers, notifier);

 }

void bdrv_add_before_write_notifier(BlockDriverState *bs,

                                    NotifierWithReturn *notifier)

{

    notifier_with_return_list_add(&bs->before_write_notifiers, notifier);

}


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

+
+    if (dev->pdev->msix_enabled) {

         g_assert_cmpint(dev->config_msix_entry, !=, -1);

static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d)

{

    QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;

    uint32_t data;

    if (dev->pdev->msix_enabled) {

        g_assert_cmpint(dev->config_msix_entry, !=, -1);

        if (qpci_msix_masked(dev->pdev, dev->config_msix_entry)) {

            /* No ISR checking should be done if masked, but read anyway */

            return qpci_msix_pending(dev->pdev, dev->config_msix_entry);

        } else {

            data = readl(dev->config_msix_addr);

            writel(dev->config_msix_addr, 0);

            return data == dev->config_msix_data;

        }

    } else {

        return qpci_io_readb(dev->pdev, dev->addr + QVIRTIO_PCI_ISR_STATUS) & 2;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
+
+                                 int size)
+
+{
+
     AVPacketSideData *sd, *tmp;

     int i;

uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,

                                 int size)

{

    AVPacketSideData *sd, *tmp;

    int i;

    uint8_t *data = av_malloc(size);

    if (!data)

        return NULL;

    for (i = 0; i < st->nb_side_data; i++) {

        sd = &st->side_data[i];

        if (sd->type == type) {

            av_freep(&sd->data);

            sd->data = data;

            sd->size = size;

            return sd->data;

        }

    }

    tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));

    if (!tmp) {

        av_freep(&data);

        return NULL;

    }

    st->side_data = tmp;

    st->nb_side_data++;

    sd = &st->side_data[st->nb_side_data - 1];

    sd->type = type;

    sd->data = data;

    sd->size = size;

    return data;

}


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

 {

+    pl061_state *s = (pl061_state *)opaque;
+
+
+
+    qemu_put_be32(f, s->locked);

     qemu_put_be32(f, s->data);

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

{

    pl061_state *s = (pl061_state *)opaque;

    qemu_put_be32(f, s->locked);

    qemu_put_be32(f, s->data);

    qemu_put_be32(f, s->old_data);

    qemu_put_be32(f, s->dir);

    qemu_put_be32(f, s->isense);

    qemu_put_be32(f, s->ibe);

    qemu_put_be32(f, s->iev);

    qemu_put_be32(f, s->im);

    qemu_put_be32(f, s->istate);

    qemu_put_be32(f, s->afsel);

    qemu_put_be32(f, s->dr2r);

    qemu_put_be32(f, s->dr4r);

    qemu_put_be32(f, s->dr8r);

    qemu_put_be32(f, s->odr);

    qemu_put_be32(f, s->pur);

    qemu_put_be32(f, s->pdr);

    qemu_put_be32(f, s->slr);

    qemu_put_be32(f, s->den);

    qemu_put_be32(f, s->cr);

    qemu_put_be32(f, s->float_high);

}


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

     gen_op_store_403_pb(sprn - SPR_403_PBL1);

+    RET_STOP(ctx);
+
+}

static void spr_write_403_pbr (void *opaque, int sprn)

{

    DisasContext *ctx = opaque;

    gen_op_store_403_pb(sprn - SPR_403_PBL1);

    RET_STOP(ctx);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static inline int mov_stsc_index_valid(int index, int count)
+
 {

     return index + 1 < count;

static inline int mov_stsc_index_valid(int index, int count)

{

    return index + 1 < count;

}


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

     int i;

+    AVOptionRanges *ranges = *rangesp;
+

     if (!ranges)

void av_opt_freep_ranges(AVOptionRanges **rangesp)

{

    int i;

    AVOptionRanges *ranges = *rangesp;

    if (!ranges)

        return;

    for (i = 0; i < ranges->nb_ranges * ranges->nb_components; i++) {

        AVOptionRange *range = ranges->range[i];

        av_freep(&range->str);

        av_freep(&ranges->range[i]);

    }

    av_freep(&ranges->range);

    av_freep(rangesp);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int get_qcc(J2kDecoderContext *s, int n, J2kQuantStyle *q, uint8_t *properties)

+{
+
     int compno;

static int get_qcc(J2kDecoderContext *s, int n, J2kQuantStyle *q, uint8_t *properties)

{

    int compno;

    if (s->buf_end - s->buf < 1)

        return AVERROR(EINVAL);

    compno = bytestream_get_byte(&s->buf);

    properties[compno] |= HAD_QCC;

    return get_qcx(s, n-1, q+compno);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void OPPROTO op_subfme (void)

+{
+
     T0 = ~T0 + xer_ca - 1;

     if (likely((uint32_t)T0 != (uint32_t)-1))

void OPPROTO op_subfme (void)

{

    T0 = ~T0 + xer_ca - 1;

    if (likely((uint32_t)T0 != (uint32_t)-1))

        xer_ca = 1;

    RETURN();

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count){
+
     int i, j, pos, ch;

     int taps  = s->dither.ns_taps;

void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count){

    int i, j, pos, ch;

    int taps  = s->dither.ns_taps;

    float S   = s->dither.ns_scale;

    float S_1 = s->dither.ns_scale_1;

    av_assert2((taps&3) != 2);

    av_assert2((taps&3) != 3 || s->dither.ns_coeffs[taps] == 0);

    for (ch=0; ch<srcs->ch_count; ch++) {

        const float *noise = ((const float *)noises->ch[ch]) + s->dither.noise_pos;

        const DELEM *src = (const DELEM*)srcs->ch[ch];

        DELEM *dst = (DELEM*)dsts->ch[ch];

        float *ns_errors = s->dither.ns_errors[ch];

        const float *ns_coeffs = s->dither.ns_coeffs;

        pos  = s->dither.ns_pos;

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

            double d1, d = src[i]*S_1;

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

                d -= ns_coeffs[j    ] * ns_errors[pos + j    ]

                    +ns_coeffs[j + 1] * ns_errors[pos + j + 1]

                    +ns_coeffs[j + 2] * ns_errors[pos + j + 2]

                    +ns_coeffs[j + 3] * ns_errors[pos + j + 3];

            }

            if(j < taps)

                d -= ns_coeffs[j] * ns_errors[pos + j];

            pos = pos ? pos - 1 : taps - 1;

            d1 = rint(d + noise[i]);

            ns_errors[pos + taps] = ns_errors[pos] = d1 - d;

            d1 *= S;

            CLIP(d1);

            dst[i] = d1;

        }

    }

    s->dither.ns_pos = pos;

}


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

 {

+    spapr->epow_irq = spapr_allocate_msi(0);

     spapr->epow_notifier.notify = spapr_powerdown_req;

void spapr_events_init(sPAPREnvironment *spapr)

{

    spapr->epow_irq = spapr_allocate_msi(0);

    spapr->epow_notifier.notify = spapr_powerdown_req;

    qemu_register_powerdown_notifier(&spapr->epow_notifier);

    spapr_rtas_register("check-exception", check_exception);

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     qlist = qlist_new();

     qlist_append(qlist, qi);
+
+
+
+    entry = QTAILQ_FIRST(&qlist->head);
+
     fail_unless(entry != NULL);

     fail_unless(entry->value == QOBJECT(qi));

START_TEST(qlist_append_test)

{

    QInt *qi;

    QList *qlist;

    QListEntry *entry;

    qi = qint_from_int(42);

    qlist = qlist_new();

    qlist_append(qlist, qi);

    entry = QTAILQ_FIRST(&qlist->head);

    fail_unless(entry != NULL);

    fail_unless(entry->value == QOBJECT(qi));

    // destroy doesn't exist yet

    QDECREF(qi);

    g_free(entry);

    g_free(qlist);

}


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

     g_assert(aio_poll(ctx, false));

+    g_assert_cmpint(data.n, ==, 0);

     g_assert_cmpint(data.active, ==, 10);

static void test_flush_event_notifier(void)

{

    EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };

    event_notifier_init(&data.e, false);

    aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);

    g_assert(aio_poll(ctx, false));

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

    g_assert_cmpint(data.active, ==, 10);

    event_notifier_set(&data.e);

    g_assert(aio_poll(ctx, false));

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

    g_assert_cmpint(data.active, ==, 9);

    g_assert(aio_poll(ctx, false));

    wait_for_aio();

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

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

    g_assert(!aio_poll(ctx, false));

    aio_set_event_notifier(ctx, &data.e, NULL, NULL);

    g_assert(!aio_poll(ctx, false));

    event_notifier_cleanup(&data.e);

}


--- a/source.c
+++ b/source.c
@@ -1,33 +1,33 @@
 static SoftFloat sbr_sum_square_c(int (*x)[2], int n)

+{
+
     SoftFloat ret;

+    uint64_t accu = 0, round;
+
+    int i, nz;
+
+    unsigned u;
+
+
+
     for (i = 0; i < n; i += 2) {

+        // Larger values are inavlid and could cause overflows of accu.
+
         av_assert2(FFABS(x[i + 0][0]) >> 29 == 0);
+
         accu += (int64_t)x[i + 0][0] * x[i + 0][0];

+        av_assert2(FFABS(x[i + 0][1]) >> 29 == 0);

+        accu += (int64_t)x[i + 0][1] * x[i + 0][1];

         av_assert2(FFABS(x[i + 1][0]) >> 29 == 0);

         accu += (int64_t)x[i + 1][0] * x[i + 1][0];
+
         av_assert2(FFABS(x[i + 1][1]) >> 29 == 0);

         accu += (int64_t)x[i + 1][1] * x[i + 1][1];

static SoftFloat sbr_sum_square_c(int (*x)[2], int n)

{

    SoftFloat ret;

    uint64_t accu = 0, round;

    int i, nz;

    unsigned u;

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

        // Larger values are inavlid and could cause overflows of accu.

        av_assert2(FFABS(x[i + 0][0]) >> 29 == 0);

        accu += (int64_t)x[i + 0][0] * x[i + 0][0];

        av_assert2(FFABS(x[i + 0][1]) >> 29 == 0);

        accu += (int64_t)x[i + 0][1] * x[i + 0][1];

        av_assert2(FFABS(x[i + 1][0]) >> 29 == 0);

        accu += (int64_t)x[i + 1][0] * x[i + 1][0];

        av_assert2(FFABS(x[i + 1][1]) >> 29 == 0);

        accu += (int64_t)x[i + 1][1] * x[i + 1][1];

    }

    u = accu >> 32;

    if (u == 0) {

        nz = 1;

    } else {

        nz = -1;

        while (u < 0x80000000U) {

            u <<= 1;

            nz++;

        }

        nz = 32 - nz;

    }

    round = 1ULL << (nz-1);

    u = ((accu + round) >> nz);

    u >>= 1;

    ret = av_int2sf(u, 15 - nz);

    return ret;

}


PPC_OP(b_T1)

{

    regs->nip = T1 & ~3;

    RETURN();

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     if (dev->state != DEV_STATE_CREATED) {

         error_set(errp, QERR_PERMISSION_DENIED);
+
+        return;
+
+    }
+

     visit_type_enum(v, ptr, prop->info->enum_table,

static void set_enum(Object *obj, Visitor *v, void *opaque,

                     const char *name, Error **errp)

{

    DeviceState *dev = DEVICE(obj);

    Property *prop = opaque;

    int *ptr = qdev_get_prop_ptr(dev, prop);

    if (dev->state != DEV_STATE_CREATED) {

        error_set(errp, QERR_PERMISSION_DENIED);

        return;

    }

    visit_type_enum(v, ptr, prop->info->enum_table,

                    prop->info->name, prop->name, errp);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static inline void t_gen_swapw(TCGv d, TCGv s)
+
+{
+
+	TCGv t;
+
 	/* d and s refer the same object.  */

 	t = tcg_temp_new(TCG_TYPE_TL);

static inline void t_gen_swapw(TCGv d, TCGv s)

{

	TCGv t;

	/* d and s refer the same object.  */

	t = tcg_temp_new(TCG_TYPE_TL);

	tcg_gen_mov_tl(t, s);

	tcg_gen_shli_tl(d, t, 16);

	tcg_gen_shri_tl(t, t, 16);

	tcg_gen_or_tl(d, d, t);

	tcg_temp_free(t);

}


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

+    bios_linker_loader_alloc(linker, ACPI_BUILD_TPMLOG_FILE, tcpalog, 1,
+
+                             false /* high memory */);
+
+

     /* log area start address to be filled by Guest linker */

build_tpm_tcpa(GArray *table_data, BIOSLinker *linker, GArray *tcpalog)

{

    Acpi20Tcpa *tcpa = acpi_data_push(table_data, sizeof *tcpa);

    tcpa->platform_class = cpu_to_le16(TPM_TCPA_ACPI_CLASS_CLIENT);

    tcpa->log_area_minimum_length = cpu_to_le32(TPM_LOG_AREA_MINIMUM_SIZE);

    acpi_data_push(tcpalog, le32_to_cpu(tcpa->log_area_minimum_length));

    bios_linker_loader_alloc(linker, ACPI_BUILD_TPMLOG_FILE, tcpalog, 1,

                             false /* high memory */);

    /* log area start address to be filled by Guest linker */

    bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE,

                                   ACPI_BUILD_TPMLOG_FILE,

                                   &tcpa->log_area_start_address,

                                   sizeof(tcpa->log_area_start_address));

    build_header(linker, table_data,

                 (void *)tcpa, "TCPA", sizeof(*tcpa), 2, NULL, NULL);

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         .e = e,
     };
     unsigned i;
+    if (size) {
+        adjust_endianness(mr, &mrfd.data, size);
+    memory_region_transaction_begin();
+    for (i = 0; i < mr->ioeventfd_nb; ++i) {
+        if (memory_region_ioeventfd_before(mrfd, mr->ioeventfds[i])) {
             break;
     ++mr->ioeventfd_nb;
     mr->ioeventfds = g_realloc(mr->ioeventfds,

void memory_region_add_eventfd(MemoryRegion *mr,
                               hwaddr addr,
                               unsigned size,
                               bool match_data,
                               uint64_t data,
                               EventNotifier *e)
{
    MemoryRegionIoeventfd mrfd = {
        .addr.start = int128_make64(addr),
        .addr.size = int128_make64(size),
        .match_data = match_data,
        .data = data,
        .e = e,
    };
    unsigned i;
    if (size) {
        adjust_endianness(mr, &mrfd.data, size);
    memory_region_transaction_begin();
    for (i = 0; i < mr->ioeventfd_nb; ++i) {
        if (memory_region_ioeventfd_before(mrfd, mr->ioeventfds[i])) {
            break;
    ++mr->ioeventfd_nb;
    mr->ioeventfds = g_realloc(mr->ioeventfds,
                                  sizeof(*mr->ioeventfds) * mr->ioeventfd_nb);
    memmove(&mr->ioeventfds[i+1], &mr->ioeventfds[i],
            sizeof(*mr->ioeventfds) * (mr->ioeventfd_nb-1 - i));
    mr->ioeventfds[i] = mrfd;
    ioeventfd_update_pending |= mr->enabled;
    memory_region_transaction_commit();


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

         event_notifier_test_and_clear(&ctx->notifier);

+    }
+
 }

void aio_notify_accept(AioContext *ctx)

{

    if (atomic_xchg(&ctx->notified, false)) {

        event_notifier_test_and_clear(&ctx->notifier);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void bt_vhci_add(int vlan_id)
+
+{
+
+    struct bt_scatternet_s *vlan = qemu_find_bt_vlan(vlan_id);

static void bt_vhci_add(int vlan_id)

{

    struct bt_scatternet_s *vlan = qemu_find_bt_vlan(vlan_id);

    if (!vlan->slave)

        fprintf(stderr, "qemu: warning: adding a VHCI to "

                        "an empty scatternet %i\n", vlan_id);

    bt_vhci_init(bt_new_hci(vlan));

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void spapr_tce_reset(DeviceState *dev)

 {
+
     sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev);

     size_t table_size = tcet->nb_table * sizeof(uint64_t);

static void spapr_tce_reset(DeviceState *dev)

{

    sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev);

    size_t table_size = tcet->nb_table * sizeof(uint64_t);

    memset(tcet->table, 0, table_size);

}


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

     const uint8_t *buf_ptr;

+    unsigned int v, v2;

     int val;

static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)

{

    const uint8_t *buf_ptr;

    unsigned int v, v2;

    int val;

    int skipped = 0;

    buf_ptr = *pbuf_ptr;

    while (buf_ptr < buf_end) {

        v  = *buf_ptr++;

        v2 = *buf_ptr;

        if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end) {

            val = *buf_ptr++;

            goto found;

        }

        skipped++;

    }

    val = -1;

found:

    av_dlog(NULL, "find_marker skipped %d bytes\n", skipped);

    *pbuf_ptr = buf_ptr;

    return val;

}


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

     XenPTRegInfo *reg = cfg_entry->reg;

+    uint16_t writable_mask = 0;
+
+    uint16_t throughable_mask = get_throughable_mask(s, reg, valid_mask);
+
+

     /* modify emulate register */

static int xen_pt_word_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry,

                                 uint16_t *val, uint16_t dev_value,

                                 uint16_t valid_mask)

{

    XenPTRegInfo *reg = cfg_entry->reg;

    uint16_t writable_mask = 0;

    uint16_t throughable_mask = get_throughable_mask(s, reg, valid_mask);

    /* modify emulate register */

    writable_mask = reg->emu_mask & ~reg->ro_mask & valid_mask;

    cfg_entry->data = XEN_PT_MERGE_VALUE(*val, cfg_entry->data, writable_mask);

    /* create value for writing to I/O device register */

    *val = XEN_PT_MERGE_VALUE(*val, dev_value, throughable_mask);

    return 0;

}


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

 {
+
     BlockDriverState *bs;

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

     bs = NULL;

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

{

    BlockDriverState *bs;

    QEMUSnapshotInfo sn1, *snapshot = &sn1;

    int ret;

    bs = NULL;

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

        if (bdrv_can_snapshot(bs) &&

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

        {

            ret = bdrv_snapshot_delete(bs, name);

            if (ret < 0) {

                monitor_printf(mon,

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

                               bdrv_get_device_name(bs));

                return -1;

            }

        }

    }

    return 0;

}


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

             len = s->buf_end - s->buf_ptr;

+            if (len == 0)
+
+                break;
+
+        } else {

             memcpy(buf, s->buf_ptr, len);

int get_buffer(ByteIOContext *s, unsigned char *buf, int size)

{

    int len, size1;

    size1 = size;

    while (size > 0) {

        len = s->buf_end - s->buf_ptr;

        if (len > size)

            len = size;

        if (len == 0) {

            fill_buffer(s);

            len = s->buf_end - s->buf_ptr;

            if (len == 0)

                break;

        } else {

            memcpy(buf, s->buf_ptr, len);

            buf += len;

            s->buf_ptr += len;

            size -= len;

        }

    }

    return size1 - size;

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
     avio_wl16(pb, 4);   /* wLongsPerEntry */

     avio_w8(pb, 0);     /* bIndexSubType (0 == frame index) */
+
+    avio_w8(pb, 0);     /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
+
+    avio_wl32(pb, 0);   /* nEntriesInUse (will fill out later on) */
+
     ffio_wfourcc(pb, avi_stream2fourcc(tag, stream_index, enc->codec_type));

                         /* dwChunkId */

static void write_odml_master(AVFormatContext *s, int stream_index)

{

    AVIOContext *pb = s->pb;

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

    AVCodecContext *enc = st->codec;

    AVIStream *avist = st->priv_data;

    unsigned char tag[5];

    int j;

    /* Starting to lay out AVI OpenDML master index.

        * We want to make it JUNK entry for now, since we'd

        * like to get away without making AVI an OpenDML one

        * for compatibility reasons. */

    avist->indexes.entry      = avist->indexes.ents_allocated = 0;

    avist->indexes.indx_start = ff_start_tag(pb, "JUNK");

    avio_wl16(pb, 4);   /* wLongsPerEntry */

    avio_w8(pb, 0);     /* bIndexSubType (0 == frame index) */

    avio_w8(pb, 0);     /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */

    avio_wl32(pb, 0);   /* nEntriesInUse (will fill out later on) */

    ffio_wfourcc(pb, avi_stream2fourcc(tag, stream_index, enc->codec_type));

                        /* dwChunkId */

    avio_wl64(pb, 0);   /* dwReserved[3] */

    avio_wl32(pb, 0);   /* Must be 0.    */

    for (j = 0; j < AVI_MASTER_INDEX_SIZE * 2; j++)

        avio_wl64(pb, 0);

    ff_end_tag(pb, avist->indexes.indx_start);

}


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

     SHPCDevice *shpc = d->shpc;

+    d->cap_present &= ~QEMU_PCI_CAP_SHPC;
+
+    memory_region_del_subregion(bar, &shpc->mmio);
+
+
     /* TODO: cleanup config space changes? */

     g_free(shpc->config);

void shpc_cleanup(PCIDevice *d, MemoryRegion *bar)

{

    SHPCDevice *shpc = d->shpc;

    d->cap_present &= ~QEMU_PCI_CAP_SHPC;

    memory_region_del_subregion(bar, &shpc->mmio);

    /* TODO: cleanup config space changes? */

    g_free(shpc->config);

    g_free(shpc->cmask);

    g_free(shpc->wmask);

    g_free(shpc->w1cmask);

    g_free(shpc);

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     nb_streams = 0;
     if (c->stream)
         nb_streams = c->stream->nb_streams;
+    for(i=0;i<nb_streams;i++) {
+        ctx = c->rtp_ctx[i];
+        if (ctx) {
+            av_free(ctx);
+        h = c->rtp_handles[i];
         if (h) {
             url_close(h);
     if (c->stream)

static void close_connection(HTTPContext *c)
{
    HTTPContext **cp, *c1;
    int i, nb_streams;
    AVFormatContext *ctx;
    URLContext *h;
    AVStream *st;
    /* remove connection from list */
    cp = &first_http_ctx;
    while ((*cp) != NULL) {
        c1 = *cp;
        if (c1 == c) {
            *cp = c->next;
        } else {
            cp = &c1->next;
    /* remove connection associated resources */
    if (c->fd >= 0)
        close(c->fd);
    if (c->fmt_in) {
        /* close each frame parser */
        for(i=0;i<c->fmt_in->nb_streams;i++) {
            st = c->fmt_in->streams[i];
            if (st->codec.codec) {
                avcodec_close(&st->codec);
        av_close_input_file(c->fmt_in);
    /* free RTP output streams if any */
    nb_streams = 0;
    if (c->stream)
        nb_streams = c->stream->nb_streams;
    for(i=0;i<nb_streams;i++) {
        ctx = c->rtp_ctx[i];
        if (ctx) {
            av_free(ctx);
        h = c->rtp_handles[i];
        if (h) {
            url_close(h);
    if (c->stream)
        current_bandwidth -= c->stream->bandwidth;
    av_freep(&c->pb_buffer);
    av_free(c->buffer);
    av_free(c);
    nb_connections--;


static char *qemu_rbd_next_tok(int max_len,

                               char *src, char delim,

                               const char *name,

                               char **p, Error **errp)

{

    int l;

    char *end;

    *p = NULL;

    if (delim != '\0') {

        for (end = src; *end; ++end) {

            if (*end == delim) {

                break;

            }

            if (*end == '\\' && end[1] != '\0') {

                end++;

            }

        }

        if (*end == delim) {

            *p = end + 1;

            *end = '\0';

        }

    }

    l = strlen(src);

    if (l >= max_len) {

        error_setg(errp, "%s too long", name);

        return NULL;

    } else if (l == 0) {

        error_setg(errp, "%s too short", name);

        return NULL;

    }

    return src;

}


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

     av_frame_free(&avctx->coded_frame);

+
+
     return 0;

 }

static av_cold int asv_encode_close(AVCodecContext *avctx)

{

    av_frame_free(&avctx->coded_frame);

    return 0;

}


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

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

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

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

{

    int t, v;

    int last = 0;

    const uint8_t *dec_end;

    CHECK_READ_VAL(gb, b, t);

    dec_end = b->cur_dec + t;

    if (dec_end > b->data_end) {

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

        return -1;

    }

    if (get_bits1(gb)) {

        v = get_bits(gb, 4);

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

        b->cur_dec += t;

    } else {

        do {

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

            if (v < 12) {

                last = v;

                *b->cur_dec++ = v;

            } else {

                int run = bink_rlelens[v - 12];

                memset(b->cur_dec, last, run);

                b->cur_dec += run;

            }

        } while (b->cur_dec < dec_end);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void qobject_output_type_uint64(Visitor *v, const char *name,

+                                       uint64_t *obj, Error **errp)

 {

static void qobject_output_type_uint64(Visitor *v, const char *name,

                                       uint64_t *obj, Error **errp)

{

    /* FIXME values larger than INT64_MAX become negative */

    QObjectOutputVisitor *qov = to_qov(v);

    qobject_output_add(qov, name, qnum_from_int(*obj));

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void vnc_client_error(VncState *vs)

 {
+
     vnc_client_io_error(vs, -1, EINVAL);

 }

static void vnc_client_error(VncState *vs)

{

    vnc_client_io_error(vs, -1, EINVAL);

}


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

     }

+    if (bits_left > 0) {
+
+        put_bits(pb, bits_left, get_bits(gb, bits_left));
+
+    }

 }

static inline void bit_copy(PutBitContext *pb, GetBitContext *gb)

{

    int bits_left = get_bits_left(gb);

    while (bits_left >= 16) {

        put_bits(pb, 16, get_bits(gb, 16));

        bits_left -= 16;

    }

    if (bits_left > 0) {

        put_bits(pb, bits_left, get_bits(gb, bits_left));

    }

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
             pstrcpy(id, sizeof(id), path);

             pstrcat(id, sizeof(id), "/");
+
+            qemu_free(path);
+
+
+
     pstrcat(id, sizeof(id), idstr);

void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque)

{

    SaveStateEntry *se, *new_se;

    char id[256] = "";

    if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) {

        char *path = dev->parent_bus->info->get_dev_path(dev);

        if (path) {

            pstrcpy(id, sizeof(id), path);

            pstrcat(id, sizeof(id), "/");

            qemu_free(path);

    pstrcat(id, sizeof(id), idstr);

    QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) {

        if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) {

            QTAILQ_REMOVE(&savevm_handlers, se, entry);

            qemu_free(se);


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static int s390x_write_all_elf64_notes(const char *note_name,

                                        WriteCoreDumpFunction f,

                                        S390CPU *cpu, int id,
+
                                        void *opaque)
+
 {

     Note note;

static int s390x_write_all_elf64_notes(const char *note_name,

                                       WriteCoreDumpFunction f,

                                       S390CPU *cpu, int id,

                                       void *opaque)

{

    Note note;

    const NoteFuncDesc *nf;

    int note_size;

    int ret = -1;

    for (nf = note_func; nf->note_contents_func; nf++) {

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

        note.hdr.n_namesz = cpu_to_be32(sizeof(note.name));

        note.hdr.n_descsz = cpu_to_be32(nf->contents_size);

        strncpy(note.name, note_name, sizeof(note.name));

        (*nf->note_contents_func)(&note, cpu);

        note_size = sizeof(note) - sizeof(note.contents) + nf->contents_size;

        ret = f(&note, note_size, opaque);

        if (ret < 0) {

            return -1;

        }

    }

    return 0;

}


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

     replay_finish_event();

+
+
+    replay_state.cached_clock[read_kind] = clock;
+
+}

void replay_read_next_clock(ReplayClockKind kind)

{

    unsigned int read_kind = replay_data_kind - EVENT_CLOCK;

    assert(read_kind == kind);

    int64_t clock = replay_get_qword();

    replay_check_error();

    replay_finish_event();

    replay_state.cached_clock[read_kind] = clock;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     Error *err = NULL;

     Visitor *v;
+
+
+
+    /* test situation where discriminator field ('enum1' here) is missing */
+
     v = validate_test_init(data, "{ 'integer': 42, 'string': 'c', 'string1': 'd', 'string2': 'e' }");

static void test_validate_fail_union_flat_no_discrim(TestInputVisitorData *data,

                                                     const void *unused)

{

    UserDefFlatUnion2 *tmp = NULL;

    Error *err = NULL;

    Visitor *v;

    /* test situation where discriminator field ('enum1' here) is missing */

    v = validate_test_init(data, "{ 'integer': 42, 'string': 'c', 'string1': 'd', 'string2': 'e' }");

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

    error_free_or_abort(&err);

    g_assert(!tmp);

}


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

     gen_op_subf();

static always_inline void gen_op_subfo (void)

{

    gen_op_move_T2_T0();

    gen_op_subf();

    gen_op_check_subfo();

}


static inline void transpose4x4(uint8_t *dst, uint8_t *src, x86_reg dst_stride, x86_reg src_stride){

    __asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ...

        "movd  (%1), %%mm0              \n\t"

        "add   %3, %1                   \n\t"

        "movd  (%1), %%mm1              \n\t"

        "movd  (%1,%3,1), %%mm2         \n\t"

        "movd  (%1,%3,2), %%mm3         \n\t"

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

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

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

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

        "punpckhwd %%mm2, %%mm1         \n\t"

        "movd  %%mm0, (%0)              \n\t"

        "add   %2, %0                   \n\t"

        "punpckhdq %%mm0, %%mm0         \n\t"

        "movd  %%mm0, (%0)              \n\t"

        "movd  %%mm1, (%0,%2,1)         \n\t"

        "punpckhdq %%mm1, %%mm1         \n\t"

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

        :  "+&r" (dst),

           "+&r" (src)

        :  "r" (dst_stride),

           "r" (src_stride)

        :  "memory"

    );

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                    size_t size)

 {
+
     int64_t len;

static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset,

                                   size_t size)

{

    int64_t len;

    if (!bdrv_is_inserted(bs))

        return -ENOMEDIUM;

    if (bs->growable)

        return 0;

    len = bdrv_getlength(bs);

    if ((offset + size) > len)

        return -EIO;

    return 0;

}


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

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


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void handle_arg_log_filename(const char *arg)
+
 {

     qemu_set_log_filename(arg);

static void handle_arg_log_filename(const char *arg)

{

    qemu_set_log_filename(arg);

}


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

 {

+    h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0);

 }

static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)

{

    h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static uint64_t get_vb(ByteIOContext *bc){

+    uint64_t val=0;

     int i= get_v(bc);

static uint64_t get_vb(ByteIOContext *bc){

    uint64_t val=0;

    int i= get_v(bc);

    if(i>8)

        return UINT64_MAX;

    while(i--)

        val = (val<<8) + get_byte(bc);

//av_log(NULL, AV_LOG_DEBUG, "get_vb()= %lld\n", val);

    return val;

}


void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id,

                         void (*func)(QPCIDevice *dev, int devfn, void *data),

                         void *data)

{

    int slot;

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

        int fn;

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

            QPCIDevice *dev;

            dev = qpci_device_find(bus, QPCI_DEVFN(slot, fn));

            if (!dev) {

                continue;

            }

            if (vendor_id != -1 &&

                qpci_config_readw(dev, PCI_VENDOR_ID) != vendor_id) {

                continue;

            }

            if (device_id != -1 &&

                qpci_config_readw(dev, PCI_DEVICE_ID) != device_id) {

                continue;

            }

            func(dev, QPCI_DEVFN(slot, fn), data);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 size_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset,
+
+                const void *src, size_t size)

 {

size_t v9fs_pack(struct iovec *in_sg, int in_num, size_t offset,

                const void *src, size_t size)

{

    return v9fs_packunpack((void *)src, in_sg, in_num, offset, size, 1);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int scsi_req_parse(SCSIRequest *req, uint8_t *buf)

 {
+
+    int rc;
+
+
+
     if (req->dev->type == TYPE_TAPE) {

         rc = scsi_req_stream_length(&req->cmd, req->dev, buf);

int scsi_req_parse(SCSIRequest *req, uint8_t *buf)

{

    int rc;

    if (req->dev->type == TYPE_TAPE) {

        rc = scsi_req_stream_length(&req->cmd, req->dev, buf);

    } else {

        rc = scsi_req_length(&req->cmd, req->dev, buf);

    }

    if (rc != 0)

        return rc;

    assert(buf == req->cmd.buf);

    scsi_cmd_xfer_mode(&req->cmd);

    req->cmd.lba = scsi_cmd_lba(&req->cmd);

    trace_scsi_req_parsed(req->dev->id, req->lun, req->tag, buf[0],

                          req->cmd.mode, req->cmd.xfer);

    if (req->cmd.lba != -1) {

        trace_scsi_req_parsed_lba(req->dev->id, req->lun, req->tag, buf[0],

                              req->cmd.lba);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void *get_surface(const AVFrame *frame)
+
 {

     return frame->data[3];

static void *get_surface(const AVFrame *frame)

{

    return frame->data[3];

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int parse_fade(struct sbg_parser *p, struct sbg_fade *fr)
+
 {

     struct sbg_fade f;

static int parse_fade(struct sbg_parser *p, struct sbg_fade *fr)

{

    struct sbg_fade f;

    if (lex_char(p, '<'))

        f.in = SBG_FADE_SILENCE;

    else if (lex_char(p, '-'))

        f.in = SBG_FADE_SAME;

    else if (lex_char(p, '='))

        f.in = SBG_FADE_ADAPT;

    else

        return 0;

    if (lex_char(p, '>'))

        f.out = SBG_FADE_SILENCE;

    else if (lex_char(p, '-'))

        f.out = SBG_FADE_SAME;

    else if (lex_char(p, '='))

        f.out = SBG_FADE_ADAPT;

    else

        return AVERROR_INVALIDDATA;

    *fr = f;

    return 1;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void change_qscale(MpegEncContext * s, int dquant)
+
+{
+
+    s->qscale += dquant;
+

     if (s->qscale < 1)

static void change_qscale(MpegEncContext * s, int dquant)

{

    s->qscale += dquant;

    if (s->qscale < 1)

        s->qscale = 1;

    else if (s->qscale > 31)

        s->qscale = 31;

    s->y_dc_scale= s->y_dc_scale_table[ s->qscale ];

    s->c_dc_scale= s->c_dc_scale_table[ s->qscale ];

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+static int scsi_write_data(SCSIDevice *d, uint32_t tag)
+
+{

+    SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, d);
+
+    SCSIGenericReq *r;
+
+    int ret;
+

     DPRINTF("scsi_write_data 0x%x\n", tag);
@@ -17,7 +17,7 @@
     if (!r) {

         BADF("Bad write tag 0x%x\n", tag);
+
         /* ??? This is the wrong error.  */

         scsi_command_complete(r, -EINVAL);

static int scsi_write_data(SCSIDevice *d, uint32_t tag)

{

    SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, d);

    SCSIGenericReq *r;

    int ret;

    DPRINTF("scsi_write_data 0x%x\n", tag);

    r = scsi_find_request(s, tag);

    if (!r) {

        BADF("Bad write tag 0x%x\n", tag);

        /* ??? This is the wrong error.  */

        scsi_command_complete(r, -EINVAL);

        return 0;

    }

    if (r->len == 0) {

        r->len = r->buflen;

        scsi_req_data(&r->req, r->len);

        return 0;

    }

    ret = execute_command(s->bs, r, SG_DXFER_TO_DEV, scsi_write_complete);

    if (ret == -1) {

        scsi_command_complete(r, -EINVAL);

        return 1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,9 +11,9 @@
                              ErrorClass_lookup[err->err_class],

                              qerror_human(err));
+
+
+
+    return qobject_to_qdict(obj);

 }

static QDict *build_qmp_error_dict(const QError *err)

{

    QObject *obj;

    obj = qobject_from_jsonf("{ 'error': { 'class': %s, 'desc': %p } }",

                             ErrorClass_lookup[err->err_class],

                             qerror_human(err));

    return qobject_to_qdict(obj);

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     inited = 1;

+
+    /* devices */
+
+    REGISTER_MUXDEMUX (AUDIO_BEOS, audio_beos);
+
     REGISTER_DEMUXER  (BKTR, bktr);

     REGISTER_DEMUXER  (DV1394, dv1394);

void avdevice_register_all(void)

{

    static int inited;

    if (inited)

        return;

    inited = 1;

    /* devices */

    REGISTER_MUXDEMUX (AUDIO_BEOS, audio_beos);

    REGISTER_DEMUXER  (BKTR, bktr);

    REGISTER_DEMUXER  (DV1394, dv1394);

    REGISTER_MUXDEMUX (OSS, oss);

    REGISTER_DEMUXER  (V4L2, v4l2);

    REGISTER_DEMUXER  (V4L, v4l);

    REGISTER_DEMUXER  (X11_GRAB_DEVICE, x11_grab_device);

    /* external libraries */

    REGISTER_DEMUXER  (LIBDC1394, libdc1394);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void clr_msg_flags(IPMIBmcSim *ibs,

                           uint8_t *cmd, unsigned int cmd_len,
+
                           uint8_t *rsp, unsigned int *rsp_len,

                           unsigned int max_rsp_len)

static void clr_msg_flags(IPMIBmcSim *ibs,

                          uint8_t *cmd, unsigned int cmd_len,

                          uint8_t *rsp, unsigned int *rsp_len,

                          unsigned int max_rsp_len)

{

    IPMIInterface *s = ibs->parent.intf;

    IPMIInterfaceClass *k = IPMI_INTERFACE_GET_CLASS(s);

    IPMI_CHECK_CMD_LEN(3);

    ibs->msg_flags &= ~cmd[2];

    k->set_atn(s, attn_set(ibs), attn_irq_enabled(ibs));

}


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

     int i;

+    uint32_t fpscr;
+
+
+
     fpscr = (env->ucf64.xregs[UC32_UCF64_FPSCR] & UCF64_FPSCR_MASK);

     i = get_float_exception_flags(&env->ucf64.fp_status);

uint32_t HELPER(ucf64_get_fpscr)(CPUUniCore32State *env)

{

    int i;

    uint32_t fpscr;

    fpscr = (env->ucf64.xregs[UC32_UCF64_FPSCR] & UCF64_FPSCR_MASK);

    i = get_float_exception_flags(&env->ucf64.fp_status);

    fpscr |= ucf64_exceptbits_from_host(i);

    return fpscr;

}


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

 {
+
+    Coroutine *c1;
+
     Coroutine *c2;
+

     c1 = qemu_coroutine_create(c1_fn);

static void test_co_queue(void)

{

    Coroutine *c1;

    Coroutine *c2;

    c1 = qemu_coroutine_create(c1_fn);

    c2 = qemu_coroutine_create(c2_fn);

    qemu_coroutine_enter(c1, c2);

    memset(c1, 0xff, sizeof(Coroutine));

    qemu_coroutine_enter(c2, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,28 +1,28 @@
 static void encode_signal_range(VC2EncContext *s)
+
+{
+
+    int idx;
+
+    AVCodecContext *avctx = s->avctx;
+
+    const AVPixFmtDescriptor *fmt = av_pix_fmt_desc_get(avctx->pix_fmt);
+
+    const int depth = fmt->comp[0].depth;
+
     if (depth == 8 && avctx->color_range == AVCOL_RANGE_JPEG) {

+        idx = 1;
+
+        s->bpp = 1;
+
         s->diff_offset = 128;
+
     } else if (depth == 8 && (avctx->color_range == AVCOL_RANGE_MPEG ||
+
                avctx->color_range == AVCOL_RANGE_UNSPECIFIED)) {

+        idx = 2;

         s->bpp = 1;

static void encode_signal_range(VC2EncContext *s)

{

    int idx;

    AVCodecContext *avctx = s->avctx;

    const AVPixFmtDescriptor *fmt = av_pix_fmt_desc_get(avctx->pix_fmt);

    const int depth = fmt->comp[0].depth;

    if (depth == 8 && avctx->color_range == AVCOL_RANGE_JPEG) {

        idx = 1;

        s->bpp = 1;

        s->diff_offset = 128;

    } else if (depth == 8 && (avctx->color_range == AVCOL_RANGE_MPEG ||

               avctx->color_range == AVCOL_RANGE_UNSPECIFIED)) {

        idx = 2;

        s->bpp = 1;

        s->diff_offset = 128;

    } else if (depth == 10) {

        idx = 3;

        s->bpp = 2;

        s->diff_offset = 512;

    } else {

        idx = 4;

        s->bpp = 2;

        s->diff_offset = 2048;

    }

    put_bits(&s->pb, 1, !s->strict_compliance);

    if (!s->strict_compliance)

        put_vc2_ue_uint(&s->pb, idx);

}


static void tcx_stip_writel(void *opaque, hwaddr addr,

                            uint64_t val, unsigned size)

{

    TCXState *s = opaque;

    int i;

    uint32_t col;

    if (!(addr & 4)) {

        s->tmpblit = val;

    } else {

        addr = (addr >> 3) & 0xfffff;

        col = cpu_to_be32(s->tmpblit);

        if (s->depth == 24) {

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

                if (val & 0x80000000) {

                    s->vram[addr + i] = s->tmpblit;

                    s->vram24[addr + i] = col;

                }

                val <<= 1;

            }

        } else {

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

                if (val & 0x80000000) {

                    s->vram[addr + i] = s->tmpblit;

                }

                val <<= 1;

            }

        }

        memory_region_set_dirty(&s->vram_mem, addr, 32);

    }

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
     serial = dev->serial;

     if (!serial) {
+
+        /* try to fall back to value set with legacy -drive serial=... */
+
+        dinfo = drive_get_by_blockdev(dev->conf.bs);
+
         if (*dinfo->serial) {

             serial = dinfo->serial;

static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)

{

    IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);

    IDEState *s = bus->ifs + dev->unit;

    const char *serial;

    DriveInfo *dinfo;

    if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512) {

        error_report("discard_granularity must be 512 for ide");

        return -1;

    }

    serial = dev->serial;

    if (!serial) {

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

        dinfo = drive_get_by_blockdev(dev->conf.bs);

        if (*dinfo->serial) {

            serial = dinfo->serial;

        }

    }

    if (ide_init_drive(s, dev->conf.bs, kind, dev->version, serial) < 0) {

        return -1;

    }

    if (!dev->version) {

        dev->version = g_strdup(s->version);

    }

    if (!dev->serial) {

        dev->serial = g_strdup(s->drive_serial_str);

    }

    add_boot_device_path(dev->conf.bootindex, &dev->qdev,

                         dev->unit ? "/disk@1" : "/disk@0");

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -32,9 +32,9 @@
     hs->protocol = 1;

     hs->idle = 0;
+
+    hs->idle_pending = false;
+
+    hid_del_idle_timer(hs);
+
 }

void hid_reset(HIDState *hs)

{

    switch (hs->kind) {

    case HID_KEYBOARD:

        memset(hs->kbd.keycodes, 0, sizeof(hs->kbd.keycodes));

        memset(hs->kbd.key, 0, sizeof(hs->kbd.key));

        hs->kbd.keys = 0;

        break;

    case HID_MOUSE:

    case HID_TABLET:

        memset(hs->ptr.queue, 0, sizeof(hs->ptr.queue));

        break;

    }

    hs->head = 0;

    hs->n = 0;

    hs->protocol = 1;

    hs->idle = 0;

    hs->idle_pending = false;

    hid_del_idle_timer(hs);

}


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

     case I2C_START_SEND:
+
+        break;
+
+    case I2C_START_RECV:
+
         printf("%s: recv not supported!!!\n", __FUNCTION__);

         break;

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

{

    TosaDACState *s = TOSA_DAC(i2c);

    s->len = 0;

    switch (event) {

    case I2C_START_SEND:

        break;

    case I2C_START_RECV:

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

        break;

    case I2C_FINISH:

#ifdef VERBOSE

        if (s->len < 2)

            printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len);

        if (s->len > 2)

            printf("%s: message too long\n", __FUNCTION__);

#endif

        break;

    default:

        break;

    }

    return 0;

}


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

 {

+    qiv->stack[qiv->nb_stack].obj = obj;
+
+    if (qobject_type(obj) == QTYPE_QLIST) {
+
+        qiv->stack[qiv->nb_stack].entry = qlist_first(qobject_to_qlist(obj));

     }

static void qmp_input_push(QmpInputVisitor *qiv, const QObject *obj, Error **errp)

{

    qiv->stack[qiv->nb_stack].obj = obj;

    if (qobject_type(obj) == QTYPE_QLIST) {

        qiv->stack[qiv->nb_stack].entry = qlist_first(qobject_to_qlist(obj));

    }

    qiv->nb_stack++;

    if (qiv->nb_stack >= QIV_STACK_SIZE) {

        error_set(errp, QERR_BUFFER_OVERRUN);

        return;

    }

}


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

     }
+
+    assert(dev->info->unplug != NULL);
+
+
+
     if (dev->ref != 0) {

         qerror_report(QERR_DEVICE_IN_USE, dev->id?:"");

int qdev_unplug(DeviceState *dev)

{

    if (!dev->parent_bus->allow_hotplug) {

        qerror_report(QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);

        return -1;

    }

    assert(dev->info->unplug != NULL);

    if (dev->ref != 0) {

        qerror_report(QERR_DEVICE_IN_USE, dev->id?:"");

        return -1;

    }

    qdev_hot_removed = true;

    return dev->info->unplug(dev);

}


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

     if(smk->type_tbl)

+        av_free(smk->type_tbl);
+
+
+
+    if (smk->pic.data[0])

         avctx->release_buffer(avctx, &smk->pic);

static int decode_end(AVCodecContext *avctx)

{

    SmackVContext * const smk = (SmackVContext *)avctx->priv_data;

    if(smk->mmap_tbl)

        av_free(smk->mmap_tbl);

    if(smk->mclr_tbl)

        av_free(smk->mclr_tbl);

    if(smk->full_tbl)

        av_free(smk->full_tbl);

    if(smk->type_tbl)

        av_free(smk->type_tbl);

    if (smk->pic.data[0])

        avctx->release_buffer(avctx, &smk->pic);

    return 0;

}


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

     MigrationState *s = opaque;
+

     if (fd < 0) {

static void tcp_wait_for_connect(int fd, Error *err, void *opaque)

{

    MigrationState *s = opaque;

    if (fd < 0) {

        DPRINTF("migrate connect error: %s\n", error_get_pretty(err));

        s->to_dst_file = NULL;

        migrate_fd_error(s);

    } else {

        DPRINTF("migrate connect success\n");

        s->to_dst_file = qemu_fopen_socket(fd, "wb");

        migrate_fd_connect(s);

    }

}


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

     char buffer[PATH_MAX];

+    if (strncmp(name, "user.virtfs.", 12) == 0) {
+
+        /*
+
+         * Don't allow fetch of user.virtfs namesapce

          * in case of mapped security

static int mp_user_removexattr(FsContext *ctx,

                               const char *path, const char *name)

{

    char buffer[PATH_MAX];

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

        /*

         * Don't allow fetch of user.virtfs namesapce

         * in case of mapped security

         */

        errno = EACCES;

        return -1;

    }

    return lremovexattr(rpath(ctx, path, buffer), name);

}


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

 {

+    return FFMPEG_CONFIGURATION;

 }

const char *avutil_configuration(void)

{

    return FFMPEG_CONFIGURATION;

}


--- a/source.c
+++ b/source.c
@@ -1,17 +1,17 @@
+void qemu_init_vcpu(void *_env)
+
+{
+
+    CPUState *env = _env;
+
+    int r;
+
+
+
     env->nr_cores = smp_cores;
+
     env->nr_threads = smp_threads;
+

     if (kvm_enabled()) {

void qemu_init_vcpu(void *_env)

{

    CPUState *env = _env;

    int r;

    env->nr_cores = smp_cores;

    env->nr_threads = smp_threads;

    if (kvm_enabled()) {

        r = kvm_init_vcpu(env);

        if (r < 0) {

            fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r));

            exit(1);

        }

        qemu_kvm_init_cpu_signals(env);

    } else {

        qemu_tcg_init_cpu_signals();

    }

}


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

     return ram_state->migration_dirty_pages * TARGET_PAGE_SIZE;

uint64_t ram_bytes_remaining(void)

{

    return ram_state->migration_dirty_pages * TARGET_PAGE_SIZE;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     int f = vdev->blk_factor;

     unsigned int data_size;
+
+
+
+    do {
+
         sector_count = MIN_NON_ZERO(sec_num, vdev->config.scsi.max_sectors);

         data_size = sector_count * virtio_get_block_size() * f;

int virtio_scsi_read_many(VDev *vdev,

                          ulong sector, void *load_addr, int sec_num)

{

    int sector_count;

    int f = vdev->blk_factor;

    unsigned int data_size;

    do {

        sector_count = MIN_NON_ZERO(sec_num, vdev->config.scsi.max_sectors);

        data_size = sector_count * virtio_get_block_size() * f;

        if (!scsi_read_10(vdev, sector * f, sector_count * f, load_addr,

                          data_size)) {

            virtio_scsi_verify_response(&resp, "virtio-scsi:read_many");

        }

        load_addr += data_size;

        sector += sector_count;

        sec_num -= sector_count;

    } while (sec_num > 0);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int can_safely_read(GetBitContext* gb, int bits) {

     return get_bits_left(gb) >= bits;

static int can_safely_read(GetBitContext* gb, int bits) {

    return get_bits_left(gb) >= bits;

}


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

+        do {

             run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;

static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)

{

    int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;

    int num_blocks = s->total_num_coded_frags;

    for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {

        i = blocks_decoded = num_blocks_at_qpi = 0;

        bit = get_bits1(gb);

        do {

            run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;

            if (run_length == 34)

                run_length += get_bits(gb, 12);

            blocks_decoded += run_length;

            if (!bit)

                num_blocks_at_qpi += run_length;

            for (j = 0; j < run_length; i++) {

                if (i >= s->total_num_coded_frags)

                    return -1;

                if (s->all_fragments[s->coded_fragment_list[0][i]].qpi == qpi) {

                    s->all_fragments[s->coded_fragment_list[0][i]].qpi += bit;

                    j++;

                }

            }

            if (run_length == MAXIMUM_LONG_BIT_RUN)

                bit = get_bits1(gb);

            else

                bit ^= 1;

        } while (blocks_decoded < num_blocks);

        num_blocks -= num_blocks_at_qpi;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,26 +1,26 @@
+int css_do_rsch(SubchDev *sch)

 {
+
     SCSW *s = &sch->curr_status.scsw;
+
+    PMCW *p = &sch->curr_status.pmcw;

     int ret;
+

     if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {
+
         ret = -ENODEV;

         goto out;

     }

+
+
+    if (s->ctrl & SCSW_STCTL_STATUS_PEND) {

         ret = -EINPROGRESS;

int css_do_rsch(SubchDev *sch)

{

    SCSW *s = &sch->curr_status.scsw;

    PMCW *p = &sch->curr_status.pmcw;

    int ret;

    if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {

        ret = -ENODEV;

        goto out;

    }

    if (s->ctrl & SCSW_STCTL_STATUS_PEND) {

        ret = -EINPROGRESS;

        goto out;

    }

    if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) ||

        (s->ctrl & SCSW_ACTL_RESUME_PEND) ||

        (!(s->ctrl & SCSW_ACTL_SUSP))) {

        ret = -EINVAL;

        goto out;

    }

    /* If monitoring is active, update counter. */

    if (channel_subsys.chnmon_active) {

        css_update_chnmon(sch);

    }

    s->ctrl |= SCSW_ACTL_RESUME_PEND;

    do_subchannel_work(sch);

    ret = 0;

out:

    return ret;

}


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

     TCGReg base = TCG_REG_G0;

+    if (!check_fit_tl(arg, 10)) {
+
+        tcg_out_movi(s, TCG_TYPE_PTR, ret, arg & ~0x3ff);
+
         base = ret;

     }

static inline void tcg_out_ld_ptr(TCGContext *s, TCGReg ret, uintptr_t arg)

{

    TCGReg base = TCG_REG_G0;

    if (!check_fit_tl(arg, 10)) {

        tcg_out_movi(s, TCG_TYPE_PTR, ret, arg & ~0x3ff);

        base = ret;

    }

    tcg_out_ld(s, TCG_TYPE_PTR, ret, base, arg & 0x3ff);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q,

                    uint8_t *properties)
+
 {

     int compno;

static int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q,

                   uint8_t *properties)

{

    int compno;

    if (bytestream2_get_bytes_left(&s->g) < 1)

        return AVERROR_INVALIDDATA;

    compno              = bytestream2_get_byteu(&s->g);

    properties[compno] |= HAD_QCC;

    return get_qcx(s, n - 1, q + compno);

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
     pmv[2] = pmv[0];

   }
+
+
+
+  result = decode_motion_vector (bitbuf, &mv, pmv);
+

   if (result != 0)

static int motion_inter_block (bit_buffer_t *bitbuf,

			       uint8_t *current, uint8_t *previous, int pitch,

			       svq1_pmv_t *motion, int x, int y) {

  uint8_t    *src;

  uint8_t    *dst;

  svq1_pmv_t  mv;

  svq1_pmv_t *pmv[3];

  int	      result;

  /* predict and decode motion vector */

  pmv[0] = &motion[0];

  pmv[1] = &motion[(x / 8) + 2];

  pmv[2] = &motion[(x / 8) + 4];

  if (y == 0) {

    pmv[1] = pmv[0];

    pmv[2] = pmv[0];

  }

  result = decode_motion_vector (bitbuf, &mv, pmv);

  if (result != 0)

    return result;

  motion[0].x		= mv.x;

  motion[0].y		= mv.y;

  motion[(x / 8) + 2].x	= mv.x;

  motion[(x / 8) + 2].y	= mv.y;

  motion[(x / 8) + 3].x	= mv.x;

  motion[(x / 8) + 3].y	= mv.y;

  src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch];

  dst = current;

  put_pixels_tab[((mv.y & 1) << 1) | (mv.x & 1)](dst,src,pitch,16);

  put_pixels_tab[((mv.y & 1) << 1) | (mv.x & 1)](dst+8,src+8,pitch,16);

  return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+static int kvmclock_post_load(void *opaque, int version_id)
+
+{
+
+    KVMClockState *s = opaque;
+
     struct kvm_clock_data data;

static int kvmclock_post_load(void *opaque, int version_id)

{

    KVMClockState *s = opaque;

    struct kvm_clock_data data;

    data.clock = s->clock;

    data.flags = 0;

    return kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void increase_dynamic_storage(IVShmemState *s, int new_min_size) {

+
     int j, old_nb_alloc;

static void increase_dynamic_storage(IVShmemState *s, int new_min_size) {

    int j, old_nb_alloc;

    old_nb_alloc = s->nb_peers;

    while (new_min_size >= s->nb_peers)

        s->nb_peers = s->nb_peers * 2;

    IVSHMEM_DPRINTF("bumping storage to %d guests\n", s->nb_peers);

    s->peers = g_realloc(s->peers, s->nb_peers * sizeof(Peer));

    /* zero out new pointers */

    for (j = old_nb_alloc; j < s->nb_peers; j++) {

        s->peers[j].eventfds = NULL;

        s->peers[j].nb_eventfds = 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
         if (unlikely((ra != 0 && reg < ra && (reg + num_used_regs) > ra) ||

                      (reg < rb && (reg + num_used_regs) > rb))) {
+
+            helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM,
+
+                                       POWERPC_EXCP_INVAL |
+
                                        POWERPC_EXCP_INVAL_LSWX);

         } else {

void helper_lswx(CPUPPCState *env, target_ulong addr, uint32_t reg,

                 uint32_t ra, uint32_t rb)

{

    if (likely(xer_bc != 0)) {

        int num_used_regs = (xer_bc + 3) / 4;

        if (unlikely((ra != 0 && reg < ra && (reg + num_used_regs) > ra) ||

                     (reg < rb && (reg + num_used_regs) > rb))) {

            helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM,

                                       POWERPC_EXCP_INVAL |

                                       POWERPC_EXCP_INVAL_LSWX);

        } else {

            helper_lsw(env, addr, xer_bc, reg);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                           int evpd, int pc, void **inq, Error **errp)

 {
+
     int full_size;

     struct scsi_task *task = NULL;
@@ -19,8 +19,8 @@
     full_size = scsi_datain_getfullsize(task);

     if (full_size > task->datain.size) {
+
+        scsi_free_scsi_task(task);

static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun,

                                          int evpd, int pc, void **inq, Error **errp)

{

    int full_size;

    struct scsi_task *task = NULL;

    task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, 64);

    if (task == NULL || task->status != SCSI_STATUS_GOOD) {

        goto fail;

    }

    full_size = scsi_datain_getfullsize(task);

    if (full_size > task->datain.size) {

        scsi_free_scsi_task(task);

        /* we need more data for the full list */

        task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, full_size);

        if (task == NULL || task->status != SCSI_STATUS_GOOD) {

            goto fail;

        }

    }

    *inq = scsi_datain_unmarshall(task);

    if (*inq == NULL) {

        error_setg(errp, "iSCSI: failed to unmarshall inquiry datain blob");

        goto fail;

    }

    return task;

fail:

    if (!error_is_set(errp)) {

        error_setg(errp, "iSCSI: Inquiry command failed : %s",

                   iscsi_get_error(iscsi));

    }

    if (task != NULL) {

        scsi_free_scsi_task(task);

    }

    return NULL;

}


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

     farg1.ll = arg1;
+
+    farg2.ll = arg2;
+
+#if USE_PRECISE_EMULATION
+
     if (unlikely(float64_is_signaling_nan(farg1.d) ||

                  float64_is_signaling_nan(farg2.d))) {

uint64_t helper_fdiv (uint64_t arg1, uint64_t arg2)

{

    CPU_DoubleU farg1, farg2;

    farg1.ll = arg1;

    farg2.ll = arg2;

#if USE_PRECISE_EMULATION

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

                 float64_is_signaling_nan(farg2.d))) {

        /* sNaN division */

        farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);

    } else if (unlikely(float64_is_infinity(farg1.d) && float64_is_infinity(farg2.d))) {

        /* Division of infinity by infinity */

        farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXIDI);

    } else if (unlikely(!float64_is_nan(farg1.d) && float64_is_zero(farg2.d))) {

        if (float64_is_zero(farg1.d)) {

            /* Division of zero by zero */

            farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXZDZ);

        } else {

            /* Division by zero */

            farg1.ll = float_zero_divide_excp(farg1.d, farg2.d);

        }

    } else {

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

    }

#else

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

#endif

    return farg1.ll;

}


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

     return qemu_can_send_packet(&s->nc);
+
+}

static int netmap_can_send(void *opaque)

{

    NetmapState *s = opaque;

    return qemu_can_send_packet(&s->nc);

}


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

     CPUState *cs = CPU(obj);

+    LM32CPU *cpu = LM32_CPU(obj);

     CPULM32State *env = &cpu->env;

static void lm32_cpu_initfn(Object *obj)

{

    CPUState *cs = CPU(obj);

    LM32CPU *cpu = LM32_CPU(obj);

    CPULM32State *env = &cpu->env;

    static bool tcg_initialized;

    cs->env_ptr = env;

    cpu_exec_init(cs, &error_abort);

    env->flags = 0;

    if (tcg_enabled() && !tcg_initialized) {

        tcg_initialized = true;

        lm32_translate_init();

    }

}


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

 {

static ssize_t v9fs_synth_lgetxattr(FsContext *ctx, V9fsPath *path,

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

{

    errno = ENOTSUP;

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static int v9fs_synth_chown(FsContext *fs_ctx, V9fsPath *path, FsCred *credp)
+
 {

     errno = EPERM;

static int v9fs_synth_chown(FsContext *fs_ctx, V9fsPath *path, FsCred *credp)

{

    errno = EPERM;

    return -1;

}


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

+    /* Check the pages is dirty and if it is send it */

     if (migration_bitmap_clear_dirty(dirty_ram_abs)) {

static int ram_save_target_page(MigrationState *ms, QEMUFile *f,

                                RAMBlock *block, ram_addr_t offset,

                                bool last_stage,

                                uint64_t *bytes_transferred,

                                ram_addr_t dirty_ram_abs)

{

    int res = 0;

    /* Check the pages is dirty and if it is send it */

    if (migration_bitmap_clear_dirty(dirty_ram_abs)) {

        unsigned long *unsentmap;

        if (compression_switch && migrate_use_compression()) {

            res = ram_save_compressed_page(f, block, offset,

                                           last_stage,

                                           bytes_transferred);

        } else {

            res = ram_save_page(f, block, offset, last_stage,

                                bytes_transferred);

        }

        if (res < 0) {

            return res;

        }

        unsentmap = atomic_rcu_read(&migration_bitmap_rcu)->unsentmap;

        if (unsentmap) {

            clear_bit(dirty_ram_abs >> TARGET_PAGE_BITS, unsentmap);

        }

        last_sent_block = block;

    }

    return res;

}


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

     kroute.flags = 0;

+    kroute.u.msi.address_lo = (uint32_t)msg.address;
+
+    kroute.u.msi.address_hi = msg.address >> 32;
+
+    kroute.u.msi.data = le32_to_cpu(msg.data);

     if (kvm_msi_devid_required()) {

int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg,

                                 PCIDevice *dev)

{

    struct kvm_irq_routing_entry kroute = {};

    if (kvm_gsi_direct_mapping()) {

        return 0;

    }

    if (!kvm_irqchip_in_kernel()) {

        return -ENOSYS;

    }

    kroute.gsi = virq;

    kroute.type = KVM_IRQ_ROUTING_MSI;

    kroute.flags = 0;

    kroute.u.msi.address_lo = (uint32_t)msg.address;

    kroute.u.msi.address_hi = msg.address >> 32;

    kroute.u.msi.data = le32_to_cpu(msg.data);

    if (kvm_msi_devid_required()) {

        kroute.flags = KVM_MSI_VALID_DEVID;

        kroute.u.msi.devid = pci_requester_id(dev);

    }

    if (kvm_arch_fixup_msi_route(&kroute, msg.address, msg.data, dev)) {

        return -EINVAL;

    }

    trace_kvm_irqchip_update_msi_route(virq);

    return kvm_update_routing_entry(s, &kroute);

}


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

                                    vaddr addr, unsigned size,

+                                   MMUAccessType access_type,

                                    int mmu_idx, MemTxAttrs attrs,

void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,

                                   vaddr addr, unsigned size,

                                   MMUAccessType access_type,

                                   int mmu_idx, MemTxAttrs attrs,

                                   MemTxResult response, uintptr_t retaddr)

{

    ARMCPU *cpu = ARM_CPU(cs);

    ARMMMUFaultInfo fi = {};

    /* now we have a real cpu fault */

    cpu_restore_state(cs, retaddr);

    /* The EA bit in syndromes and fault status registers is an

     * IMPDEF classification of external aborts. ARM implementations

     * usually use this to indicate AXI bus Decode error (0) or

     * Slave error (1); in QEMU we follow that.

     */

    fi.ea = (response != MEMTX_DECODE_ERROR);

    fi.type = ARMFault_SyncExternal;

    deliver_fault(cpu, addr, access_type, mmu_idx, &fi);

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
+int boot_sector_init(const char *fname)
+
 {
+
     FILE *f = fopen(fname, "w");

     size_t len = sizeof boot_sector;

+    if (!f) {
+
         fprintf(stderr, "Couldn't open \"%s\": %s", fname, strerror(errno));

         return 1;

int boot_sector_init(const char *fname)

{

    FILE *f = fopen(fname, "w");

    size_t len = sizeof boot_sector;

    if (!f) {

        fprintf(stderr, "Couldn't open \"%s\": %s", fname, strerror(errno));

        return 1;

    }

    /* For Open Firmware based system, we can use a Forth script instead */

    if (strcmp(qtest_get_arch(), "ppc64") == 0) {

        len = sprintf((char *)boot_sector, "\\ Bootscript\n%x %x c! %x %x c!\n",

                LOW(SIGNATURE), BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET,

                HIGH(SIGNATURE), BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET + 1);

    }

    fwrite(boot_sector, 1, len, f);

    fclose(f);

    return 0;

}