--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+void HELPER(ove)(CPUOpenRISCState *env, target_ulong test)
+
+{
+
+    if (unlikely(test)) {
+
         OpenRISCCPU *cpu = openrisc_env_get_cpu(env);

         CPUState *cs = CPU(cpu);

void HELPER(ove)(CPUOpenRISCState *env, target_ulong test)

{

    if (unlikely(test)) {

        OpenRISCCPU *cpu = openrisc_env_get_cpu(env);

        CPUState *cs = CPU(cpu);

        cs->exception_index = EXCP_RANGE;

        cpu_loop_exit_restore(cs, GETPC());

    }

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
         cmp = t->cmp;

         diff = cmp - current;
+
+        diff = (int64_t)diff > 0 ? diff : (uint64_t)0;
+
+        return diff;
+
     }

 }

static inline uint64_t hpet_calculate_diff(HPETTimer *t, uint64_t current)

{

    if (t->config & HPET_TN_32BIT) {

        uint32_t diff, cmp;

        cmp = (uint32_t)t->cmp;

        diff = cmp - (uint32_t)current;

        diff = (int32_t)diff > 0 ? diff : (uint32_t)0;

        return (uint64_t)diff;

    } else {

        uint64_t diff, cmp;

        cmp = t->cmp;

        diff = cmp - current;

        diff = (int64_t)diff > 0 ? diff : (uint64_t)0;

        return diff;

    }

}


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

     SDHCI_GET_CLASS(s)->mem_write(s, off, val, sz);
+
+}

sdhci_writefn(void *opaque, hwaddr off, uint64_t val, unsigned sz)

{

    SDHCIState *s = (SDHCIState *)opaque;

    SDHCI_GET_CLASS(s)->mem_write(s, off, val, sz);

}


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

     }

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

         return ret;

static int vfio_add_capabilities(VFIOPCIDevice *vdev)

{

    PCIDevice *pdev = &vdev->pdev;

    int ret;

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

        !pdev->config[PCI_CAPABILITY_LIST]) {

        return 0; /* Nothing to add */

    }

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

    if (ret) {

        return ret;

    }

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

    if (!pci_is_express(pdev) ||

        !pci_bus_is_express(pdev->bus) ||

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

        return 0;

    }

    return vfio_add_ext_cap(vdev);

}


static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s)

{

    unsigned char B;

    int x, y;

    /* copy block from 2 frames ago using a motion vector; need 1 more byte */

    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);

    B = *s->stream_ptr++;

    if (B < 56) {

        x = 8 + (B % 7);

        y = B / 7;

    } else {

        x = -14 + ((B - 56) % 29);

        y =   8 + ((B - 56) / 29);

    }

    debug_interplay ("    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);

    return copy_from(s, &s->second_last_frame, x, y);

}


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

 {

+    return float64_add(a, b, &env->ucf64.fp_status);

 }

float64 HELPER(ucf64_addd)(float64 a, float64 b, CPUUniCore32State *env)

{

    return float64_add(a, b, &env->ucf64.fp_status);

}


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

     const uint8_t *const buf_start = buf;
+
+    unsigned x;

     for (x = 0; x < dst_size && buf < buf_end;) {
+
+        unsigned length;

         const int8_t value = *buf++;

static int decode_byterun(uint8_t *dst, int dst_size,

                          const uint8_t *buf, const uint8_t *const buf_end)

{

    const uint8_t *const buf_start = buf;

    unsigned x;

    for (x = 0; x < dst_size && buf < buf_end;) {

        unsigned length;

        const int8_t value = *buf++;

        if (value >= 0) {

            length = value + 1;

            memcpy(dst + x, buf, FFMIN3(length, dst_size - x, buf_end - buf));

            buf += length;

        } else if (value > -128) {

            length = -value + 1;

            memset(dst + x, *buf++, FFMIN(length, dst_size - x));

        } else { // noop

            continue;

        }

        x += length;

    }

    if (x < dst_size) {

        av_log(NULL, AV_LOG_WARNING, "decode_byterun ended before plane size\n");

        memset(dst+x, 0, dst_size - x);

    }

    return buf - buf_start;

}


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

   DEBUG_CALL("m_free");
+
   DEBUG_ARG("m = %lx", (long )m);

m_free(struct mbuf *m)

{

  DEBUG_CALL("m_free");

  DEBUG_ARG("m = %lx", (long )m);

  if(m) {

	/* Remove from m_usedlist */

	if (m->m_flags & M_USEDLIST)

	   remque(m);

	/* If it's M_EXT, free() it */

	if (m->m_flags & M_EXT)

	   free(m->m_ext);

	/*

	 * Either free() it or put it on the free list

	 */

	if (m->m_flags & M_DOFREE) {

		free(m);

		m->slirp->mbuf_alloced--;

	} else if ((m->m_flags & M_FREELIST) == 0) {

		insque(m,&m->slirp->m_freelist);

		m->m_flags = M_FREELIST; /* Clobber other flags */

	}

  } /* if(m) */

}


--- a/source.c
+++ b/source.c
@@ -1,22 +1,22 @@
 static void vnc_dpy_switch(DisplayChangeListener *dcl,
+
                            DisplaySurface *surface)

 {

+    VncDisplay *vd = container_of(dcl, VncDisplay, dcl);

     VncState *vs;

+
     vnc_abort_display_jobs(vd);

     /* server surface */

+    qemu_pixman_image_unref(vd->server);

     vd->ds = surface;

static void vnc_dpy_switch(DisplayChangeListener *dcl,

                           DisplaySurface *surface)

{

    VncDisplay *vd = container_of(dcl, VncDisplay, dcl);

    VncState *vs;

    vnc_abort_display_jobs(vd);

    /* server surface */

    qemu_pixman_image_unref(vd->server);

    vd->ds = surface;

    vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,

                                          surface_width(vd->ds),

                                          surface_height(vd->ds),

                                          NULL, 0);

    /* guest surface */

#if 0 /* FIXME */

    if (ds_get_bytes_per_pixel(ds) != vd->guest.ds->pf.bytes_per_pixel)

        console_color_init(ds);

#endif

    qemu_pixman_image_unref(vd->guest.fb);

    vd->guest.fb = pixman_image_ref(surface->image);

    vd->guest.format = surface->format;

    VNC_SET_VISIBLE_PIXELS_DIRTY(vd->guest.dirty,

                                 surface_width(vd->ds),

                                 surface_height(vd->ds));

    QTAILQ_FOREACH(vs, &vd->clients, next) {

        vnc_colordepth(vs);

        vnc_desktop_resize(vs);

        if (vs->vd->cursor) {

            vnc_cursor_define(vs);

        }

        VNC_SET_VISIBLE_PIXELS_DIRTY(vs->dirty,

                                     surface_width(vd->ds),

                                     surface_height(vd->ds));

    }

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     item = QTAILQ_FIRST(queue);

     g_assert(item->type == QEMU_INPUT_QUEUE_DELAY);
+
+    QTAILQ_REMOVE(queue, item, node);
+
+
+    g_free(item);

static void qemu_input_queue_process(void *opaque)

{

    struct QemuInputEventQueueHead *queue = opaque;

    QemuInputEventQueue *item;

    g_assert(!QTAILQ_EMPTY(queue));

    item = QTAILQ_FIRST(queue);

    g_assert(item->type == QEMU_INPUT_QUEUE_DELAY);

    QTAILQ_REMOVE(queue, item, node);

    g_free(item);

    while (!QTAILQ_EMPTY(queue)) {

        item = QTAILQ_FIRST(queue);

        switch (item->type) {

        case QEMU_INPUT_QUEUE_DELAY:

            timer_mod(item->timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)

                      + item->delay_ms);

            return;

        case QEMU_INPUT_QUEUE_EVENT:

            qemu_input_event_send(item->src, item->evt);

            qapi_free_InputEvent(item->evt);

            break;

        case QEMU_INPUT_QUEUE_SYNC:

            qemu_input_event_sync();

            break;

        }

        QTAILQ_REMOVE(queue, item, node);

        g_free(item);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void ff_weight_h264_pixels16_8_msa(uint8_t *src, int stride,
+
+                                   int height, int log2_denom,
+
                                    int weight_src, int offset)

 {

void ff_weight_h264_pixels16_8_msa(uint8_t *src, int stride,

                                   int height, int log2_denom,

                                   int weight_src, int offset)

{

    avc_wgt_16width_msa(src, stride,

                        height, log2_denom, weight_src, offset);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static inline TCGv gen_ld16u(TCGv addr, int index)
+
 {

     TCGv tmp = new_tmp();

static inline TCGv gen_ld16u(TCGv addr, int index)

{

    TCGv tmp = new_tmp();

    tcg_gen_qemu_ld16u(tmp, addr, index);

    return tmp;

}


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

         h->sei_anticlockwise_rotation = get_bits(&h->gb, 16);
+
+        get_ue_golomb(&h->gb);  // display_orientation_repetition_period
+
+        skip_bits1(&h->gb);     // display_orientation_extension_flag
+
     }

static int decode_display_orientation(H264Context *h)

{

    h->sei_display_orientation_present = !get_bits1(&h->gb);

    if (h->sei_display_orientation_present) {

        h->sei_hflip = get_bits1(&h->gb);     // hor_flip

        h->sei_vflip = get_bits1(&h->gb);     // ver_flip

        h->sei_anticlockwise_rotation = get_bits(&h->gb, 16);

        get_ue_golomb(&h->gb);  // display_orientation_repetition_period

        skip_bits1(&h->gb);     // display_orientation_extension_flag

    }

    return 0;

}


static int64_t get_pts(const char **buf, int *duration,

                       int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2)

{

    int i;

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

        int hh1, mm1, ss1, ms1;

        int hh2, mm2, ss2, ms2;

        if (sscanf(*buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d"

                   "%*[ ]X1:%u X2:%u Y1:%u Y2:%u",

                   &hh1, &mm1, &ss1, &ms1,

                   &hh2, &mm2, &ss2, &ms2,

                   x1, x2, y1, y2) >= 8) {

            int64_t start = (hh1*3600LL + mm1*60LL + ss1) * 1000LL + ms1;

            int64_t end   = (hh2*3600LL + mm2*60LL + ss2) * 1000LL + ms2;

            *duration = end - start;

            *buf += strcspn(*buf, "\n") + 1;

            return start;

        }

        *buf += strcspn(*buf, "\n") + 1;

    }

    return AV_NOPTS_VALUE;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void qemu_system_reset(bool report)

 {

@@ -7,7 +7,7 @@

     mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;
+

     cpu_synchronize_all_states();

void qemu_system_reset(bool report)

{

    MachineClass *mc;

    mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;

    cpu_synchronize_all_states();

    if (mc && mc->reset) {

        mc->reset();

    } else {

        qemu_devices_reset();

    }

    if (report) {

        qapi_event_send_reset(&error_abort);

    }

    cpu_synchronize_all_post_reset();

}


bool vfio_blacklist_opt_rom(VFIOPCIDevice *vdev)

{

    PCIDevice *pdev = &vdev->pdev;

    uint16_t vendor_id, device_id;

    int count = 0;

    vendor_id = pci_get_word(pdev->config + PCI_VENDOR_ID);

    device_id = pci_get_word(pdev->config + PCI_DEVICE_ID);

    while (count < ARRAY_SIZE(romblacklist)) {

        if (romblacklist[count].vendor_id == vendor_id &&

            romblacklist[count].device_id == device_id) {

                return true;

        }

        count++;

    }

    return false;

}


static av_cold int pcm_encode_close(AVCodecContext *avctx)

{

    av_freep(&avctx->coded_frame);

    return 0;

}


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

     QLIST_REMOVE(tcet, list);
+
+
+
+    if (!kvm_enabled() ||
+
         (kvmppc_remove_spapr_tce(tcet->table, tcet->fd,

                                  tcet->window_size) != 0)) {

void spapr_tce_free(sPAPRTCETable *tcet)

{

    QLIST_REMOVE(tcet, list);

    if (!kvm_enabled() ||

        (kvmppc_remove_spapr_tce(tcet->table, tcet->fd,

                                 tcet->window_size) != 0)) {

        g_free(tcet->table);

    }

    g_free(tcet);

}


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

     for (lp_cnt = 4; lp_cnt--;) {

+        SD(out0, src);
+
+        SD(out1, src + stride * 4);
+
+        src += stride;

     }

static void intra_predict_mad_cow_dc_l00_8x8_msa(uint8_t *src, int32_t stride)

{

    uint8_t lp_cnt;

    uint32_t src0 = 0;

    uint64_t out0, out1;

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

        src0 += src[lp_cnt * stride - 1];

    }

    src0 = (src0 + 2) >> 2;

    out0 = src0 * 0x0101010101010101;

    out1 = 0x8080808080808080;

    for (lp_cnt = 4; lp_cnt--;) {

        SD(out0, src);

        SD(out1, src + stride * 4);

        src += stride;

    }

}


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

     const uint8_t *src = pic->data[0];

+    int x, y;

+

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

static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)

{

    DPXContext *s = avctx->priv_data;

    const uint8_t *src = pic->data[0];

    int x, y;

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

        for (x = 0; x < avctx->width; x++) {

            int value;

            if (s->big_endian) {

                value = ((AV_RB16(src + 6*x + 4) & 0xFFC0) >> 4)

                      | ((AV_RB16(src + 6*x + 2) & 0xFFC0) << 6)

                      | ((AV_RB16(src + 6*x + 0) & 0xFFC0) << 16);

            } else {

                value = ((AV_RL16(src + 6*x + 4) & 0xFFC0) >> 4)

                      | ((AV_RL16(src + 6*x + 2) & 0xFFC0) << 6)

                      | ((AV_RL16(src + 6*x + 0) & 0xFFC0) << 16);

            }

            write32(dst, value);

            dst += 4;

        }

        src += pic->linesize[0];

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+void qemu_cpu_kick_self(void)
+
+{
+
+#ifndef _WIN32

     assert(cpu_single_env);

void qemu_cpu_kick_self(void)

{

#ifndef _WIN32

    assert(cpu_single_env);

    raise(SIG_IPI);

#else

    abort();

#endif

}


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

     avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num);
+
+
+
+    st->codec->width    = s->width;
+
     st->codec->height   = s->height;

     st->codec->pix_fmt  = ctx->iformat->raw_codec_id == AV_CODEC_ID_V210 ?

static int v210_read_header(AVFormatContext *ctx)

{

    V210DemuxerContext *s = ctx->priv_data;

    AVStream *st;

    st = avformat_new_stream(ctx, NULL);

    if (!st)

        return AVERROR(ENOMEM);

    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;

    st->codec->codec_id = ctx->iformat->raw_codec_id;

    avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num);

    st->codec->width    = s->width;

    st->codec->height   = s->height;

    st->codec->pix_fmt  = ctx->iformat->raw_codec_id == AV_CODEC_ID_V210 ?

                          AV_PIX_FMT_YUV422P10 : AV_PIX_FMT_YUV422P16;

    st->codec->bit_rate = av_rescale_q(GET_PACKET_SIZE(s->width, s->height),

                                       (AVRational){8,1}, st->time_base);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
+
 {

     return addr;

target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)

{

    return addr;

}


void aio_bh_call(QEMUBH *bh)

{

    bh->cb(bh->opaque);

}


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

     assert(src < 4 || TCG_TARGET_REG_BITS == 64);
+
+    tcg_out_modrm(s, OPC_MOVZBL + P_REXB_RM, dest, src);

 }

static inline void tcg_out_ext8u(TCGContext *s, int dest, int src)

{

    /* movzbl */

    assert(src < 4 || TCG_TARGET_REG_BITS == 64);

    tcg_out_modrm(s, OPC_MOVZBL + P_REXB_RM, dest, src);

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
                        now.size);

         register_subpage(d, &now);
+
+        remain.size -= now.size;
+
+        remain.offset_within_address_space += now.size;
+
         remain.offset_within_region += now.size;

     }

static void mem_add(MemoryListener *listener, MemoryRegionSection *section)

{

    AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch, listener);

    MemoryRegionSection now = limit(*section), remain = limit(*section);

    if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)

        || (now.size < TARGET_PAGE_SIZE)) {

        now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)

                       - now.offset_within_address_space,

                       now.size);

        register_subpage(d, &now);

        remain.size -= now.size;

        remain.offset_within_address_space += now.size;

        remain.offset_within_region += now.size;

    }

    while (remain.size >= TARGET_PAGE_SIZE) {

        now = remain;

        if (remain.offset_within_region & ~TARGET_PAGE_MASK) {

            now.size = TARGET_PAGE_SIZE;

            register_subpage(d, &now);

        } else {

            now.size &= TARGET_PAGE_MASK;

            register_multipage(d, &now);

        }

        remain.size -= now.size;

        remain.offset_within_address_space += now.size;

        remain.offset_within_region += now.size;

    }

    now = remain;

    if (now.size) {

        register_subpage(d, &now);

    }

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     if (!strcmp(version.data, "9P2000.u")) {
         s->proto_version = V9FS_PROTO_2000U;
     } else if (!strcmp(version.data, "9P2000.L")) {
+        s->proto_version = V9FS_PROTO_2000L;
+    } else {
+        v9fs_string_sprintf(&version, "unknown");
+    }
+    offset += pdu_marshal(pdu, offset, "ds", s->msize, &version);
     complete_pdu(s, pdu, offset);
     v9fs_string_free(&version);
     return;

static void v9fs_version(void *opaque)
{
    V9fsPDU *pdu = opaque;
    V9fsState *s = pdu->s;
    V9fsString version;
    size_t offset = 7;
    pdu_unmarshal(pdu, offset, "ds", &s->msize, &version);
    trace_v9fs_version(pdu->tag, pdu->id, s->msize, version.data);
    if (!strcmp(version.data, "9P2000.u")) {
        s->proto_version = V9FS_PROTO_2000U;
    } else if (!strcmp(version.data, "9P2000.L")) {
        s->proto_version = V9FS_PROTO_2000L;
    } else {
        v9fs_string_sprintf(&version, "unknown");
    }
    offset += pdu_marshal(pdu, offset, "ds", s->msize, &version);
    complete_pdu(s, pdu, offset);
    v9fs_string_free(&version);
    return;
}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 int dma_memory_set(DMAContext *dma, dma_addr_t addr, uint8_t c, dma_addr_t len)
+{
+    if (dma_has_iommu(dma)) {
         return iommu_dma_memory_set(dma, addr, c, len);
     }
     do_dma_memory_set(addr, c, len);

int dma_memory_set(DMAContext *dma, dma_addr_t addr, uint8_t c, dma_addr_t len)
{
    if (dma_has_iommu(dma)) {
        return iommu_dma_memory_set(dma, addr, c, len);
    }
    do_dma_memory_set(addr, c, len);
    return 0;
}


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

     memory_region_init_io(&s->mmio, &omap2_inth_mem_ops, s, "omap2-intc", size);

+    memory_region_add_subregion(get_system_memory(), base, &s->mmio);
+
+
+
+    omap_inth_reset(s);

struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,

                int size, int nbanks, qemu_irq **pins,

                qemu_irq parent_irq, qemu_irq parent_fiq,

                omap_clk fclk, omap_clk iclk)

{

    struct omap_intr_handler_s *s = (struct omap_intr_handler_s *)

            g_malloc0(sizeof(struct omap_intr_handler_s) +

                            sizeof(struct omap_intr_handler_bank_s) * nbanks);

    s->parent_intr[0] = parent_irq;

    s->parent_intr[1] = parent_fiq;

    s->nbanks = nbanks;

    s->level_only = 1;

    s->pins = qemu_allocate_irqs(omap_set_intr_noedge, s, nbanks * 32);

    if (pins)

        *pins = s->pins;

    memory_region_init_io(&s->mmio, &omap2_inth_mem_ops, s, "omap2-intc", size);

    memory_region_add_subregion(get_system_memory(), base, &s->mmio);

    omap_inth_reset(s);

    return s;

}


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

     QmpInputVisitor *qiv = to_qiv(v);
+
+    const QObject *qobj = qmp_input_get_object(qiv, name);

static void qmp_input_start_struct(Visitor *v, void **obj, const char *kind,

                                   const char *name, size_t size, Error **errp)

{

    QmpInputVisitor *qiv = to_qiv(v);

    const QObject *qobj = qmp_input_get_object(qiv, name);

    if (!qobj || qobject_type(qobj) != QTYPE_QDICT) {

        error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",

                  "QDict");

        return;

    }

    qmp_input_push(qiv, qobj, errp);

    if (error_is_set(errp)) {

        return;

    }

    if (obj) {

        *obj = g_malloc0(size);

    }

}


PPC_OP(mulli)

{

    T0 = (Ts0 * SPARAM(1));

    RETURN();

}


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

     acpi_ram_update(build_state->rsdp_mr, tables.rsdp);

+    acpi_ram_update(build_state->linker_mr, tables.linker);
+
+
+
+

     acpi_build_tables_cleanup(&tables, true);

static void virt_acpi_build_update(void *build_opaque)

{

    AcpiBuildState *build_state = build_opaque;

    AcpiBuildTables tables;

    /* No state to update or already patched? Nothing to do. */

    if (!build_state || build_state->patched) {

        return;

    }

    build_state->patched = true;

    acpi_build_tables_init(&tables);

    virt_acpi_build(build_state->guest_info, &tables);

    acpi_ram_update(build_state->table_mr, tables.table_data);

    acpi_ram_update(build_state->rsdp_mr, tables.rsdp);

    acpi_ram_update(build_state->linker_mr, tables.linker);

    acpi_build_tables_cleanup(&tables, true);

}


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

                                 const struct iovec *iov, int iovcnt,

+                                size_t iovoff, bool strip_vlan,

+                                uint16_t vet)

 {

void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt,

                                const struct iovec *iov, int iovcnt,

                                size_t iovoff, bool strip_vlan,

                                uint16_t vet)

{

    uint16_t tci = 0;

    uint16_t ploff = iovoff;

    assert(pkt);

    pkt->vlan_stripped = false;

    if (strip_vlan) {

        pkt->vlan_stripped = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet,

                                               pkt->ehdr_buf,

                                               &ploff, &tci);

    }

    pkt->tci = tci;

    net_rx_pkt_pull_data(pkt, iov, iovcnt, ploff);

}


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

+
+    virtio_net_set_multiqueue(n, !!(features & (1 << VIRTIO_NET_F_MQ)),
+
+                              !!(features & (1 << VIRTIO_NET_F_CTRL_VQ)));
+

     virtio_net_set_mrg_rx_bufs(n, !!(features & (1 << VIRTIO_NET_F_MRG_RXBUF)));

static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)

{

    VirtIONet *n = VIRTIO_NET(vdev);

    int i;

    virtio_net_set_multiqueue(n, !!(features & (1 << VIRTIO_NET_F_MQ)),

                              !!(features & (1 << VIRTIO_NET_F_CTRL_VQ)));

    virtio_net_set_mrg_rx_bufs(n, !!(features & (1 << VIRTIO_NET_F_MRG_RXBUF)));

    if (n->has_vnet_hdr) {

        tap_set_offload(qemu_get_subqueue(n->nic, 0)->peer,

                        (features >> VIRTIO_NET_F_GUEST_CSUM) & 1,

                        (features >> VIRTIO_NET_F_GUEST_TSO4) & 1,

                        (features >> VIRTIO_NET_F_GUEST_TSO6) & 1,

                        (features >> VIRTIO_NET_F_GUEST_ECN)  & 1,

                        (features >> VIRTIO_NET_F_GUEST_UFO)  & 1);

    }

    for (i = 0;  i < n->max_queues; i++) {

        NetClientState *nc = qemu_get_subqueue(n->nic, i);

        if (!nc->peer || nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) {

            continue;

        }

        if (!tap_get_vhost_net(nc->peer)) {

            continue;

        }

        vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);

    }

}


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

 #else

+    tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);
+
+    tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)]);
+
+#endif

 }

static inline void gen_evmergehi(DisasContext *ctx)

{

    if (unlikely(!ctx->spe_enabled)) {

        gen_exception(ctx, POWERPC_EXCP_APU);

        return;

    }

#if defined(TARGET_PPC64)

    TCGv t0 = tcg_temp_new();

    TCGv t1 = tcg_temp_new();

    tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 32);

    tcg_gen_andi_tl(t1, cpu_gpr[rA(ctx->opcode)], 0xFFFFFFFF0000000ULL);

    tcg_gen_or_tl(cpu_gpr[rD(ctx->opcode)], t0, t1);

    tcg_temp_free(t0);

    tcg_temp_free(t1);

#else

    tcg_gen_mov_i32(cpu_gpr[rD(ctx->opcode)], cpu_gprh[rB(ctx->opcode)]);

    tcg_gen_mov_i32(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)]);

#endif

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     int num, den, q, r;

+
     num = (EAX & 0xffff) | ((EDX & 0xffff) << 16);

     den = (int16_t)T0;

void OPPROTO op_idivw_AX_T0(void)

{

    int num, den, q, r;

    num = (EAX & 0xffff) | ((EDX & 0xffff) << 16);

    den = (int16_t)T0;

    if (den == 0) {

        raise_exception(EXCP00_DIVZ);

    }

    q = (num / den) & 0xffff;

    r = (num % den) & 0xffff;

    EAX = (EAX & ~0xffff) | q;

    EDX = (EDX & ~0xffff) | r;

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
+static int check_for_block_signature(BlockDriverState *bs, const uint8_t *buf)
+
 {

     static const uint8_t signatures[][4] = {

+        { 'Q', 'F', 'I', 0xfb }, /* qcow/qcow2 */
+
+        { 'C', 'O', 'W', 'D' }, /* VMDK3 */
+
+        { 'V', 'M', 'D', 'K' }, /* VMDK4 */
+
         { 'O', 'O', 'O', 'M' }, /* UML COW */

+        {}

     };

static int check_for_block_signature(BlockDriverState *bs, const uint8_t *buf)

{

    static const uint8_t signatures[][4] = {

        { 'Q', 'F', 'I', 0xfb }, /* qcow/qcow2 */

        { 'C', 'O', 'W', 'D' }, /* VMDK3 */

        { 'V', 'M', 'D', 'K' }, /* VMDK4 */

        { 'O', 'O', 'O', 'M' }, /* UML COW */

        {}

    };

    int i;

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

        if (memcmp(buf, signatures[i], 4) == 0) {

            return 1;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 char *socket_address_to_string(struct SocketAddress *addr, Error **errp)

 {
+
+    char *buf;
+
+    InetSocketAddress *inet;
+

     switch (addr->type) {

char *socket_address_to_string(struct SocketAddress *addr, Error **errp)

{

    char *buf;

    InetSocketAddress *inet;

    switch (addr->type) {

    case SOCKET_ADDRESS_KIND_INET:

        inet = addr->u.inet.data;

        if (strchr(inet->host, ':') == NULL) {

            buf = g_strdup_printf("%s:%s", inet->host, inet->port);

        } else {

            buf = g_strdup_printf("[%s]:%s", inet->host, inet->port);

        }

        break;

    case SOCKET_ADDRESS_KIND_UNIX:

        buf = g_strdup(addr->u.q_unix.data->path);

        break;

    case SOCKET_ADDRESS_KIND_FD:

        buf = g_strdup(addr->u.fd.data->str);

        break;

    case SOCKET_ADDRESS_KIND_VSOCK:

        buf = g_strdup_printf("%s:%s",

                              addr->u.vsock.data->cid,

                              addr->u.vsock.data->port);

        break;

    default:

        abort();

    }

    return buf;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+void ff_decode_dxt3(const uint8_t *s, uint8_t *dst,

                     const unsigned int w, const unsigned int h,

+                    const unsigned int stride) {
+
     unsigned int bx, by, qstride = stride/4;

     uint32_t *d = (uint32_t *) dst;

void ff_decode_dxt3(const uint8_t *s, uint8_t *dst,

                    const unsigned int w, const unsigned int h,

                    const unsigned int stride) {

    unsigned int bx, by, qstride = stride/4;

    uint32_t *d = (uint32_t *) dst;

    for (by=0; by < h/4; by++, d += stride-w)

        for (bx=0; bx < w/4; bx++, s+=16, d+=4)

            dxt1_decode_pixels(s+8, d, qstride, 1, AV_RL64(s));

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 int64_t qdict_get_try_int(const QDict *qdict, const char *key,
+
+                          int64_t def_value)
+
+{

     QObject *obj;

int64_t qdict_get_try_int(const QDict *qdict, const char *key,

                          int64_t def_value)

{

    QObject *obj;

    obj = qdict_get(qdict, key);

    if (!obj || qobject_type(obj) != QTYPE_QINT)

        return def_value;

    return qint_get_int(qobject_to_qint(obj));

}


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

TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *old_op,

                            TCGOpcode opc, int nargs)

{

    int oi = s->gen_next_op_idx;

    int prev = old_op->prev;

    int next = old_op - s->gen_op_buf;

    TCGOp *new_op;

    tcg_debug_assert(oi < OPC_BUF_SIZE);

    s->gen_next_op_idx = oi + 1;

    new_op = &s->gen_op_buf[oi];

    *new_op = (TCGOp){

        .opc = opc,

        .prev = prev,

        .next = next

    };

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

    old_op->prev = oi;

    return new_op;

}


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

 {

+    int i;

+    HotpluggableCPUList *head = NULL;

     sPAPRMachineState *spapr = SPAPR_MACHINE(machine);

static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *machine)

{

    int i;

    HotpluggableCPUList *head = NULL;

    sPAPRMachineState *spapr = SPAPR_MACHINE(machine);

    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);

    int spapr_max_cores = max_cpus / smp_threads;

    g_assert(smc->dr_cpu_enabled);

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

        HotpluggableCPUList *list_item = g_new0(typeof(*list_item), 1);

        HotpluggableCPU *cpu_item = g_new0(typeof(*cpu_item), 1);

        CpuInstanceProperties *cpu_props = g_new0(typeof(*cpu_props), 1);

        cpu_item->type = spapr_get_cpu_core_type(machine->cpu_model);

        cpu_item->vcpus_count = smp_threads;

        cpu_props->has_core_id = true;

        cpu_props->core_id = i * smp_threads;

        /* TODO: add 'has_node/node' here to describe

           to which node core belongs */

        cpu_item->props = cpu_props;

        if (spapr->cores[i]) {

            cpu_item->has_qom_path = true;

            cpu_item->qom_path = object_get_canonical_path(spapr->cores[i]);

        }

        list_item->value = cpu_item;

        list_item->next = head;

        head = list_item;

    }

    return head;

}


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

     qemu_put_be64(f, cpu_ticks_offset);

+    qemu_put_be64(f, ticks_per_sec);
+
+    qemu_put_be64(f, cpu_clock_offset);
+
 }

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

{

    if (cpu_ticks_enabled) {

        hw_error("cannot save state if virtual timers are running");

    }

    qemu_put_be64(f, cpu_ticks_offset);

    qemu_put_be64(f, ticks_per_sec);

    qemu_put_be64(f, cpu_clock_offset);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
 {
+    AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(dev);
     acc->parent_realize(dev, errp);
 }

static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
{
    AlphaCPUClass *acc = ALPHA_CPU_GET_CLASS(dev);
    acc->parent_realize(dev, errp);
}


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

     cpu_exec_init();

+
+
+    env = qemu_mallocz(sizeof(CPUPPCState));
+
+    if (!env)

         return NULL;

CPUPPCState *cpu_ppc_init(void)

{

    CPUPPCState *env;

    cpu_exec_init();

    env = qemu_mallocz(sizeof(CPUPPCState));

    if (!env)

        return NULL;

#if !defined(CONFIG_USER_ONLY) && defined (USE_OPEN_FIRMWARE)

    setup_machine(env, 0);

#else

//    env->spr[PVR] = 0; /* Basic PPC */

    env->spr[PVR] = 0x00080100; /* G3 CPU */

//    env->spr[PVR] = 0x00083100; /* MPC755 (G3 embedded) */

//    env->spr[PVR] = 0x00070100; /* IBM 750FX */

#endif

    tlb_flush(env, 1);

#if defined (DO_SINGLE_STEP)

    /* Single step trace mode */

    msr_se = 1;

#endif

    msr_fp = 1; /* Allow floating point exceptions */

    msr_me = 1; /* Allow machine check exceptions  */

#if defined(CONFIG_USER_ONLY)

    msr_pr = 1;

    cpu_ppc_register(env, 0x00080000);

#else

    env->nip = 0xFFFFFFFC;

#endif

    env->access_type = ACCESS_INT;

    cpu_single_env = env;

    return env;

}


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

         video_qsquish > 99.0) {

+        fprintf(stderr, "qsquish must be >= 0.0 and <= 99.0\n");
+
+        exit(1);
+
     }

 }

static void opt_qsquish(const char *arg)

{

    video_qsquish = atof(arg);

    if (video_qsquish < 0.0 ||

        video_qsquish > 99.0) {

        fprintf(stderr, "qsquish must be >= 0.0 and <= 99.0\n");

        exit(1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static target_ulong h_register_process_table(PowerPCCPU *cpu,
+
+                                             sPAPRMachineState *spapr,

                                              target_ulong opcode,

static target_ulong h_register_process_table(PowerPCCPU *cpu,

                                             sPAPRMachineState *spapr,

                                             target_ulong opcode,

                                             target_ulong *args)

{

    qemu_log_mask(LOG_UNIMP, "Unimplemented SPAPR hcall 0x"TARGET_FMT_lx"%s\n",

                  opcode, " (H_REGISTER_PROC_TBL)");

    return H_FUNCTION;

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
                  "tcp::%d,nowait,nodelay,server", port_num);

         port = gdbstub_port_name;
+
+    }
+
+
+
     chr = qemu_chr_open("gdb", port);

     if (!chr)

int gdbserver_start(const char *port)

{

    GDBState *s;

    char gdbstub_port_name[128];

    int port_num;

    char *p;

    CharDriverState *chr;

    if (!port || !*port)

      return -1;

    port_num = strtol(port, &p, 10);

    if (*p == 0) {

        /* A numeric value is interpreted as a port number.  */

        snprintf(gdbstub_port_name, sizeof(gdbstub_port_name),

                 "tcp::%d,nowait,nodelay,server", port_num);

        port = gdbstub_port_name;

    }

    chr = qemu_chr_open("gdb", port);

    if (!chr)

        return -1;

    s = qemu_mallocz(sizeof(GDBState));

    if (!s) {

        return -1;

    }

    s->env = first_cpu; /* XXX: allow to change CPU */

    s->chr = chr;

    qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive,

                          gdb_chr_event, s);

    qemu_add_vm_stop_handler(gdb_vm_stopped, s);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -38,11 +38,11 @@
     /* For machine-state changed between user-mode and supervisor mode,

        we need flush TLB when we enter&exit EXCP.  */
+
+    tlb_flush(cs);
+
+
+
     env->esr = env->sr;

     env->sr &= ~SR_DME;

void openrisc_cpu_do_interrupt(CPUState *cs)

{

#ifndef CONFIG_USER_ONLY

    OpenRISCCPU *cpu = OPENRISC_CPU(cs);

    CPUOpenRISCState *env = &cpu->env;

    env->epcr = env->pc;

    if (env->flags & D_FLAG) {

        env->flags &= ~D_FLAG;

        env->sr |= SR_DSX;

        env->epcr -= 4;

    if (cs->exception_index == EXCP_SYSCALL) {

        env->epcr += 4;

    /* For machine-state changed between user-mode and supervisor mode,

       we need flush TLB when we enter&exit EXCP.  */

    tlb_flush(cs);

    env->esr = env->sr;

    env->sr &= ~SR_DME;

    env->sr &= ~SR_IME;

    env->sr |= SR_SM;

    env->sr &= ~SR_IEE;

    env->sr &= ~SR_TEE;

    env->tlb->cpu_openrisc_map_address_data = &cpu_openrisc_get_phys_nommu;

    env->tlb->cpu_openrisc_map_address_code = &cpu_openrisc_get_phys_nommu;

    if (cs->exception_index > 0 && cs->exception_index < EXCP_NR) {

        env->pc = (cs->exception_index << 8);

        cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index);

#endif

    cs->exception_index = -1;


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

 {

+    put_ebml_binary(pb, elementid, str, strlen(str));

 }

static void put_ebml_utf8(ByteIOContext *pb, unsigned int elementid, char *str)

{

    put_ebml_binary(pb, elementid, str, strlen(str));

}


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

     strcpy(*cred, certdir);

+    strcat(*cred, "/");
+
+    strcat(*cred, filename);
+
+

     VNC_DEBUG("Check %s\n", *cred);

static int vnc_set_x509_credential(VncDisplay *vs,

				   const char *certdir,

				   const char *filename,

				   char **cred,

				   int ignoreMissing)

{

    struct stat sb;

    if (*cred) {

	qemu_free(*cred);

	*cred = NULL;

    }

    *cred = qemu_malloc(strlen(certdir) + strlen(filename) + 2);

    strcpy(*cred, certdir);

    strcat(*cred, "/");

    strcat(*cred, filename);

    VNC_DEBUG("Check %s\n", *cred);

    if (stat(*cred, &sb) < 0) {

	qemu_free(*cred);

	*cred = NULL;

	if (ignoreMissing && errno == ENOENT)

	    return 0;

	return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int restore_sigcontext(CPUAlphaState *env,

+                              struct target_sigcontext *sc)

 {

@@ -10,7 +10,7 @@

+    __get_user(env->pc, &sc->sc_pc);

static int restore_sigcontext(CPUAlphaState *env,

                              struct target_sigcontext *sc)

{

    uint64_t fpcr;

    int i, err = 0;

    __get_user(env->pc, &sc->sc_pc);

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

        __get_user(env->ir[i], &sc->sc_regs[i]);

    }

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

        __get_user(env->fir[i], &sc->sc_fpregs[i]);

    }

    __get_user(fpcr, &sc->sc_fpcr);

    cpu_alpha_store_fpcr(env, fpcr);

    return err;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 HBitmap *hbitmap_alloc(uint64_t size, int granularity)
+
 {

     HBitmap *hb = g_malloc0(sizeof (struct HBitmap));
@@ -8,7 +8,7 @@

+    assert(granularity >= 0 && granularity < 64);

     size = (size + (1ULL << granularity) - 1) >> granularity;

HBitmap *hbitmap_alloc(uint64_t size, int granularity)

{

    HBitmap *hb = g_malloc0(sizeof (struct HBitmap));

    unsigned i;

    assert(granularity >= 0 && granularity < 64);

    size = (size + (1ULL << granularity) - 1) >> granularity;

    assert(size <= ((uint64_t)1 << HBITMAP_LOG_MAX_SIZE));

    hb->size = size;

    hb->granularity = granularity;

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

        size = MAX((size + BITS_PER_LONG - 1) >> BITS_PER_LEVEL, 1);

        hb->levels[i] = g_malloc0(size * sizeof(unsigned long));

    }

    /* We necessarily have free bits in level 0 due to the definition

     * of HBITMAP_LEVELS, so use one for a sentinel.  This speeds up

     * hbitmap_iter_skip_words.

     */

    assert(size == 1);

    hb->levels[0][0] |= 1UL << (BITS_PER_LONG - 1);

    return hb;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+virtio_crypto_check_cryptodev_is_used(Object *obj, const char *name,

                                       Object *val, Error **errp)

virtio_crypto_check_cryptodev_is_used(Object *obj, const char *name,

                                      Object *val, Error **errp)

{

    if (cryptodev_backend_is_used(CRYPTODEV_BACKEND(val))) {

        char *path = object_get_canonical_path_component(val);

        error_setg(errp,

            "can't use already used cryptodev backend: %s", path);

        g_free(path);

    } else {

        qdev_prop_allow_set_link_before_realize(obj, name, val, errp);

    }

}


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

+    if (!vring_setup(&r->vring, VIRTIO_DEVICE(s), n)) {
+
+        fprintf(stderr, "virtio-scsi: VRing setup failed\n");
+
+        goto fail_vring;

     }

static VirtIOSCSIVring *virtio_scsi_vring_init(VirtIOSCSI *s,

                                               VirtQueue *vq,

                                               EventNotifierHandler *handler,

                                               int n)

{

    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s)));

    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);

    VirtIOSCSIVring *r;

    int rc;

    /* Set up virtqueue notify */

    rc = k->set_host_notifier(qbus->parent, n, true);

    if (rc != 0) {

        fprintf(stderr, "virtio-scsi: Failed to set host notifier (%d)\n",

                rc);

        s->dataplane_fenced = true;

        return NULL;

    }

    r = g_new(VirtIOSCSIVring, 1);

    r->host_notifier = *virtio_queue_get_host_notifier(vq);

    r->guest_notifier = *virtio_queue_get_guest_notifier(vq);

    aio_set_event_notifier(s->ctx, &r->host_notifier, false,

                           handler);

    r->parent = s;

    if (!vring_setup(&r->vring, VIRTIO_DEVICE(s), n)) {

        fprintf(stderr, "virtio-scsi: VRing setup failed\n");

        goto fail_vring;

    }

    return r;

fail_vring:

    aio_set_event_notifier(s->ctx, &r->host_notifier, false,

                           NULL);

    k->set_host_notifier(qbus->parent, n, false);

    g_free(r);

    return NULL;

}


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

     int target_bits = 0;
+

     if (host_bits & float_flag_invalid)

static inline int vfp_exceptbits_from_host(int host_bits)

{

    int target_bits = 0;

    if (host_bits & float_flag_invalid)

        target_bits |= 1;

    if (host_bits & float_flag_divbyzero)

        target_bits |= 2;

    if (host_bits & float_flag_overflow)

        target_bits |= 4;

    if (host_bits & float_flag_underflow)

        target_bits |= 8;

    if (host_bits & float_flag_inexact)

        target_bits |= 0x10;

    if (host_bits & float_flag_input_denormal)

        target_bits |= 0x80;

    return target_bits;

}


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

+
+    /* Read the message header from the guest first. */
+
+    addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);
+
     pci_dma_read(pci, addr, req, sizeof(hdr));

static void mptsas_fetch_request(MPTSASState *s)

{

    PCIDevice *pci = (PCIDevice *) s;

    char req[MPTSAS_MAX_REQUEST_SIZE];

    MPIRequestHeader *hdr = (MPIRequestHeader *)req;

    hwaddr addr;

    int size;

    if (s->state != MPI_IOC_STATE_OPERATIONAL) {

        mptsas_set_fault(s, MPI_IOCSTATUS_INVALID_STATE);

        return;

    }

    /* Read the message header from the guest first. */

    addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);

    pci_dma_read(pci, addr, req, sizeof(hdr));

    if (hdr->Function < ARRAY_SIZE(mpi_request_sizes) &&

        mpi_request_sizes[hdr->Function]) {

        /* Read the rest of the request based on the type.  Do not

         * reread everything, as that could cause a TOC/TOU mismatch

         * and leak data from the QEMU stack.

         */

        size = mpi_request_sizes[hdr->Function];

        assert(size <= MPTSAS_MAX_REQUEST_SIZE);

        pci_dma_read(pci, addr + sizeof(hdr), &req[sizeof(hdr)],

                     size - sizeof(hdr));

    }

    if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST) {

        /* SCSI I/O requests are separate from mptsas_process_message

         * because they cannot be sent through the doorbell yet.

         */

        mptsas_process_scsi_io_request(s, (MPIMsgSCSIIORequest *)req, addr);

    } else {

        mptsas_process_message(s, (MPIRequestHeader *)req);

    }

}


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

 {

+    PVSCSICmdDescSetupRings *rc =

         (PVSCSICmdDescSetupRings *) s->curr_cmd_data;

pvscsi_on_cmd_setup_rings(PVSCSIState *s)

{

    PVSCSICmdDescSetupRings *rc =

        (PVSCSICmdDescSetupRings *) s->curr_cmd_data;

    trace_pvscsi_on_cmd_arrived("PVSCSI_CMD_SETUP_RINGS");

    pvscsi_dbg_dump_tx_rings_config(rc);

    pvscsi_ring_init_data(&s->rings, rc);

    s->rings_info_valid = TRUE;

    return PVSCSI_COMMAND_PROCESSING_SUCCEEDED;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static inline void downmix_3f_1r_to_stereo(float *samples)
+
+{
+
     int i;

static inline void downmix_3f_1r_to_stereo(float *samples)

{

    int i;

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

        samples[i] += (samples[i + 256] + samples[i + 768]);

        samples[i + 256] += (samples[i + 512] + samples[i + 768]);

        samples[i + 512] = samples[i + 768] = 0;

    }

}


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

     int off = sce->sf_idx[0], diff;
+
     int i, w;

static void encode_scale_factors(AVCodecContext *avctx, AACEncContext *s,

                                 SingleChannelElement *sce)

{

    int off = sce->sf_idx[0], diff;

    int i, w;

    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {

        for (i = 0; i < sce->ics.max_sfb; i++) {

            if (!sce->zeroes[w*16 + i]) {

                diff = sce->sf_idx[w*16 + i] - off + SCALE_DIFF_ZERO;

                if (diff < 0 || diff > 120)

                    av_log(avctx, AV_LOG_ERROR, "Scalefactor difference is too big to be coded\n");

                off = sce->sf_idx[w*16 + i];

                put_bits(&s->pb, ff_aac_scalefactor_bits[diff], ff_aac_scalefactor_code[diff]);

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
 {
     int idx;
     CPUState *cs;
+    CPUArchId *cpu_slot;
+    X86CPUTopoInfo topo;
+    X86CPU *cpu = X86_CPU(dev);
+    PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+    /* if APIC ID is not set, set it based on socket/core/thread properties */
     if (cpu->apic_id == UNASSIGNED_APIC_ID) {
         int max_socket = (max_cpus - 1) / smp_threads / smp_cores;
         if (cpu->socket_id < 0) {

static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
                            DeviceState *dev, Error **errp)
{
    int idx;
    CPUState *cs;
    CPUArchId *cpu_slot;
    X86CPUTopoInfo topo;
    X86CPU *cpu = X86_CPU(dev);
    PCMachineState *pcms = PC_MACHINE(hotplug_dev);
    /* if APIC ID is not set, set it based on socket/core/thread properties */
    if (cpu->apic_id == UNASSIGNED_APIC_ID) {
        int max_socket = (max_cpus - 1) / smp_threads / smp_cores;
        if (cpu->socket_id < 0) {
            error_setg(errp, "CPU socket-id is not set");
        } else if (cpu->socket_id > max_socket) {
            error_setg(errp, "Invalid CPU socket-id: %u must be in range 0:%u",
                       cpu->socket_id, max_socket);
        if (cpu->core_id < 0) {
            error_setg(errp, "CPU core-id is not set");
        } else if (cpu->core_id > (smp_cores - 1)) {
            error_setg(errp, "Invalid CPU core-id: %u must be in range 0:%u",
                       cpu->core_id, smp_cores - 1);
        if (cpu->thread_id < 0) {
            error_setg(errp, "CPU thread-id is not set");
        } else if (cpu->thread_id > (smp_threads - 1)) {
            error_setg(errp, "Invalid CPU thread-id: %u must be in range 0:%u",
                       cpu->thread_id, smp_threads - 1);
        topo.pkg_id = cpu->socket_id;
        topo.core_id = cpu->core_id;
        topo.smt_id = cpu->thread_id;
        cpu->apic_id = apicid_from_topo_ids(smp_cores, smp_threads, &topo);
    cpu_slot = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx);
    if (!cpu_slot) {
        MachineState *ms = MACHINE(pcms);
        x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo);
        error_setg(errp, "Invalid CPU [socket: %u, core: %u, thread: %u] with"
                  " APIC ID %" PRIu32 ", valid index range 0:%d",
                   topo.pkg_id, topo.core_id, topo.smt_id, cpu->apic_id,
                   ms->possible_cpus->len - 1);
    if (cpu_slot->cpu) {
        error_setg(errp, "CPU[%d] with APIC ID %" PRIu32 " exists",
                   idx, cpu->apic_id);
    /* if 'address' properties socket-id/core-id/thread-id are not set, set them
     * so that machine_query_hotpluggable_cpus would show correct values
     */
    /* TODO: move socket_id/core_id/thread_id checks into x86_cpu_realizefn()
     * once -smp refactoring is complete and there will be CPU private
     * CPUState::nr_cores and CPUState::nr_threads fields instead of globals */
    x86_topo_ids_from_apicid(cpu->apic_id, smp_cores, smp_threads, &topo);
    if (cpu->socket_id != -1 && cpu->socket_id != topo.pkg_id) {
        error_setg(errp, "property socket-id: %u doesn't match set apic-id:"
            " 0x%x (socket-id: %u)", cpu->socket_id, cpu->apic_id, topo.pkg_id);
    cpu->socket_id = topo.pkg_id;
    if (cpu->core_id != -1 && cpu->core_id != topo.core_id) {
        error_setg(errp, "property core-id: %u doesn't match set apic-id:"
            " 0x%x (core-id: %u)", cpu->core_id, cpu->apic_id, topo.core_id);
    cpu->core_id = topo.core_id;
    if (cpu->thread_id != -1 && cpu->thread_id != topo.smt_id) {
        error_setg(errp, "property thread-id: %u doesn't match set apic-id:"
            " 0x%x (thread-id: %u)", cpu->thread_id, cpu->apic_id, topo.smt_id);
    cpu->thread_id = topo.smt_id;
    cs = CPU(cpu);
    cs->cpu_index = idx;
    numa_cpu_pre_plug(cpu_slot, dev, errp);


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

         LOG("invalid magic (got 0x%x)", magic);

+        errno = EINVAL;
+
+        return -1;
+
+    }

     return 0;

static ssize_t nbd_receive_request(int csock, struct nbd_request *request)

{

    uint8_t buf[4 + 4 + 8 + 8 + 4];

    uint32_t magic;

    if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) {

        LOG("read failed");

        errno = EINVAL;

        return -1;

    }

    /* Request

       [ 0 ..  3]   magic   (NBD_REQUEST_MAGIC)

       [ 4 ..  7]   type    (0 == READ, 1 == WRITE)

       [ 8 .. 15]   handle

       [16 .. 23]   from

       [24 .. 27]   len

     */

    magic = be32_to_cpup((uint32_t*)buf);

    request->type  = be32_to_cpup((uint32_t*)(buf + 4));

    request->handle = be64_to_cpup((uint64_t*)(buf + 8));

    request->from  = be64_to_cpup((uint64_t*)(buf + 16));

    request->len   = be32_to_cpup((uint32_t*)(buf + 24));

    TRACE("Got request: "

          "{ magic = 0x%x, .type = %d, from = %" PRIu64" , len = %u }",

          magic, request->type, request->from, request->len);

    if (magic != NBD_REQUEST_MAGIC) {

        LOG("invalid magic (got 0x%x)", magic);

        errno = EINVAL;

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int sdp_probe(AVProbeData *p1)

 {
+
     const char *p = p1->buf, *p_end = p1->buf + p1->buf_size;

static int sdp_probe(AVProbeData *p1)

{

    const char *p = p1->buf, *p_end = p1->buf + p1->buf_size;

    /* we look for a line beginning "c=IN IP" */

    while (p < p_end && *p != '\0') {

        if (p + sizeof("c=IN IP") - 1 < p_end &&

            av_strstart(p, "c=IN IP", NULL))

            return AVPROBE_SCORE_EXTENSION;

        while (p < p_end - 1 && *p != '\n') p++;

        if (++p >= p_end)

            break;

        if (*p == '\r')

            p++;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -13,9 +13,9 @@
     if (s->conn_data)

         return ffurl_shutdown(s->conn_data, flags);
+
+
+
+    return AVERROR(EIO);
+
 }

static int ftp_shutdown(URLContext *h, int flags)

{

    FTPContext *s = h->priv_data;

    av_dlog(h, "ftp protocol shutdown\n");

    if (s->conn_data)

        return ffurl_shutdown(s->conn_data, flags);

    return AVERROR(EIO);

}


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

+    av_assert0(context_count && h->slice_ctx[context_count - 1].mb_y < h->mb_height);

int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count)

{

    AVCodecContext *const avctx = h->avctx;

    H264SliceContext *sl;

    int i;

    av_assert0(context_count && h->slice_ctx[context_count - 1].mb_y < h->mb_height);

    if (h->avctx->hwaccel ||

        h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)

        return 0;

    if (context_count == 1) {

        int ret = decode_slice(avctx, &h->slice_ctx[0]);

        h->mb_y = h->slice_ctx[0].mb_y;

        return ret;

    } else {

        av_assert0(context_count > 0);

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

            sl                 = &h->slice_ctx[i];

            if (CONFIG_ERROR_RESILIENCE) {

                sl->er.error_count = 0;

            }

        }

        avctx->execute(avctx, decode_slice, h->slice_ctx,

                       NULL, context_count, sizeof(h->slice_ctx[0]));

        /* pull back stuff from slices to master context */

        sl                   = &h->slice_ctx[context_count - 1];

        h->mb_y              = sl->mb_y;

        if (CONFIG_ERROR_RESILIENCE) {

            for (i = 1; i < context_count; i++)

                h->slice_ctx[0].er.error_count += h->slice_ctx[i].er.error_count;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,10 +5,10 @@
     if (guessed_disk_nature) {

         return (blk_cfg.blk_size  == 4096);
+
+    }
+
+    return (blk_cfg.geometry.heads == 15)

         && (blk_cfg.geometry.sectors == 12)

bool virtio_disk_is_eckd(void)

{

    if (guessed_disk_nature) {

        return (blk_cfg.blk_size  == 4096);

    }

    return (blk_cfg.geometry.heads == 15)

        && (blk_cfg.geometry.sectors == 12)

        && (blk_cfg.blk_size  == 4096);

}


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

 #ifdef CONFIG_PPOLL
+
     if (timeout < 0) {

         return ppoll((struct pollfd *)fds, nfds, NULL, NULL);

int qemu_poll_ns(GPollFD *fds, guint nfds, int64_t timeout)

{

#ifdef CONFIG_PPOLL

    if (timeout < 0) {

        return ppoll((struct pollfd *)fds, nfds, NULL, NULL);

    } else {

        struct timespec ts;

        ts.tv_sec = timeout / 1000000000LL;

        ts.tv_nsec = timeout % 1000000000LL;

        return ppoll((struct pollfd *)fds, nfds, &ts, NULL);

    }

#else

    return g_poll(fds, nfds, qemu_timeout_ns_to_ms(timeout));

#endif

}


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

         gpu_env.context = NULL;

+    }
+
+    av_freep(&(gpu_env.device_ids));
+
+end:

     UNLOCK_OPENCL

void av_opencl_uninit(void)

{

    cl_int status;

    int i;

    LOCK_OPENCL

    gpu_env.init_count--;

    if (gpu_env.is_user_created)

        goto end;

    if ((gpu_env.init_count > 0) || (gpu_env.kernel_count > 0))

        goto end;

    for (i = 0; i < gpu_env.program_count; i++) {

        if (gpu_env.programs[i]) {

            status = clReleaseProgram(gpu_env.programs[i]);

            if (status != CL_SUCCESS) {

                av_log(&openclutils, AV_LOG_ERROR, "Could not release OpenCL program: %s\n", opencl_errstr(status));

            }

            gpu_env.programs[i] = NULL;

        }

    }

    if (gpu_env.command_queue) {

        status = clReleaseCommandQueue(gpu_env.command_queue);

        if (status != CL_SUCCESS) {

            av_log(&openclutils, AV_LOG_ERROR, "Could not release OpenCL command queue: %s\n", opencl_errstr(status));

        }

        gpu_env.command_queue = NULL;

    }

    if (gpu_env.context) {

        status = clReleaseContext(gpu_env.context);

        if (status != CL_SUCCESS) {

            av_log(&openclutils, AV_LOG_ERROR, "Could not release OpenCL context: %s\n", opencl_errstr(status));

        }

        gpu_env.context = NULL;

    }

    av_freep(&(gpu_env.device_ids));

end:

    UNLOCK_OPENCL

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static int qcow_check(BlockDriverState *bs)
+
 {

     return qcow2_check_refcounts(bs);

static int qcow_check(BlockDriverState *bs)

{

    return qcow2_check_refcounts(bs);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline int draw_glyph_yuv(AVFilterBufferRef *picref, FT_Bitmap *bitmap, unsigned int x,

                                  unsigned int y, unsigned int width, unsigned int height,

static inline int draw_glyph_yuv(AVFilterBufferRef *picref, FT_Bitmap *bitmap, unsigned int x,

                                 unsigned int y, unsigned int width, unsigned int height,

                                 const uint8_t yuva_color[4], int hsub, int vsub)

{

    int r, c, alpha;

    unsigned int luma_pos, chroma_pos1, chroma_pos2;

    uint8_t src_val;

    for (r = 0; r < bitmap->rows && r+y < height; r++) {

        for (c = 0; c < bitmap->width && c+x < width; c++) {

            /* get intensity value in the glyph bitmap (source) */

            src_val = GET_BITMAP_VAL(r, c);

            if (!src_val)

                continue;

            SET_PIXEL_YUV(picref, yuva_color, src_val, c+x, y+r, hsub, vsub);

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static int set_palette(AVFrame * frame, const uint8_t * palette_buffer, int buf_size)
+
 {
+
     uint32_t * palette = (uint32_t *)frame->data[1];
+
     int a;
+

     if (buf_size < 256*3)

static int set_palette(AVFrame * frame, const uint8_t * palette_buffer, int buf_size)

{

    uint32_t * palette = (uint32_t *)frame->data[1];

    int a;

    if (buf_size < 256*3)

        return AVERROR_INVALIDDATA;

    for(a = 0; a < 256; a++){

        palette[a] = AV_RB24(&palette_buffer[a * 3]) * 4;

    }

    frame->palette_has_changed = 1;

    return 256*3;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 TraceEvent *trace_event_iter_next(TraceEventIter *iter)

+{

     while (iter->event < TRACE_EVENT_COUNT) {

TraceEvent *trace_event_iter_next(TraceEventIter *iter)

{

    while (iter->event < TRACE_EVENT_COUNT) {

        TraceEvent *ev = &(trace_events[iter->event]);

        iter->event++;

        if (!iter->pattern ||

            pattern_glob(iter->pattern,

                         trace_event_get_name(ev))) {

            return ev;

        }

    }

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -15,14 +15,14 @@
     dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;

+
+    dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;
+
+    dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;
+
+    dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;

+    dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;

av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)

{

    dsp->vp8_luma_dc_wht    = vp8_luma_dc_wht_c;

    dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;

    dsp->vp8_idct_add       = vp8_idct_add_c;

    dsp->vp8_idct_dc_add    = vp8_idct_dc_add_c;

    dsp->vp8_idct_dc_add4y  = vp8_idct_dc_add4y_c;

    dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;

    dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;

    dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;

    dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;

    dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;

    dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;

    dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;

    dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;

    dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;

    dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;

    dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;

    VP8_MC_FUNC(0, 16);

    VP8_MC_FUNC(1, 8);

    VP8_MC_FUNC(2, 4);

    VP8_BILINEAR_MC_FUNC(0, 16);

    VP8_BILINEAR_MC_FUNC(1, 8);

    VP8_BILINEAR_MC_FUNC(2, 4);

    if (ARCH_ARM)

        ff_vp8dsp_init_arm(dsp);

    if (ARCH_PPC)

        ff_vp8dsp_init_ppc(dsp);

    if (ARCH_X86)

        ff_vp8dsp_init_x86(dsp);

}


av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx)

{

    const unsigned high_bit_depth = avctx->bits_per_raw_sample > 8;

    c->diff_pixels = diff_pixels_c;

    switch (avctx->bits_per_raw_sample) {

    case 9:

    case 10:

    case 12:

    case 14:

        c->get_pixels = get_pixels_16_c;

        break;

    default:

        if (avctx->bits_per_raw_sample<=8 || avctx->codec_type != AVMEDIA_TYPE_VIDEO) {

            c->get_pixels = get_pixels_8_c;

        }

        break;

    }

    if (ARCH_ALPHA)

        ff_pixblockdsp_init_alpha(c, avctx, high_bit_depth);

    if (ARCH_ARM)

        ff_pixblockdsp_init_arm(c, avctx, high_bit_depth);

    if (ARCH_PPC)

        ff_pixblockdsp_init_ppc(c, avctx, high_bit_depth);

    if (ARCH_X86)

        ff_pixblockdsp_init_x86(c, avctx, high_bit_depth);

    if (ARCH_MIPS)

        ff_pixblockdsp_init_mips(c, avctx, high_bit_depth);

}


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

     memory_region_init(&s->container_mem, obj, "container", 0x10000000);
+
     sysbus_init_mmio(sbd, &s->container_mem);

static void pxa2xx_pcmcia_initfn(Object *obj)

{

    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);

    PXA2xxPCMCIAState *s = PXA2XX_PCMCIA(obj);

    memory_region_init(&s->container_mem, obj, "container", 0x10000000);

    sysbus_init_mmio(sbd, &s->container_mem);

    /* Socket I/O Memory Space */

    memory_region_init_io(&s->iomem, NULL, &pxa2xx_pcmcia_io_ops, s,

                          "pxa2xx-pcmcia-io", 0x04000000);

    memory_region_add_subregion(&s->container_mem, 0x00000000,

                                &s->iomem);

    /* Then next 64 MB is reserved */

    /* Socket Attribute Memory Space */

    memory_region_init_io(&s->attr_iomem, NULL, &pxa2xx_pcmcia_attr_ops, s,

                          "pxa2xx-pcmcia-attribute", 0x04000000);

    memory_region_add_subregion(&s->container_mem, 0x08000000,

                                &s->attr_iomem);

    /* Socket Common Memory Space */

    memory_region_init_io(&s->common_iomem, NULL, &pxa2xx_pcmcia_common_ops, s,

                          "pxa2xx-pcmcia-common", 0x04000000);

    memory_region_add_subregion(&s->container_mem, 0x0c000000,

                                &s->common_iomem);

    s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0];

    object_property_add_link(obj, "card", TYPE_PCMCIA_CARD,

                             (Object **)&s->card,

                             NULL, /* read-only property */

                             0, NULL);

}


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

     CPUState *cs = CPU(obj);
+
     MIPSCPU *cpu = MIPS_CPU(obj);

     CPUMIPSState *env = &cpu->env;

static void mips_cpu_initfn(Object *obj)

{

    CPUState *cs = CPU(obj);

    MIPSCPU *cpu = MIPS_CPU(obj);

    CPUMIPSState *env = &cpu->env;

    cs->env_ptr = env;

    cpu_exec_init(cs, &error_abort);

    if (tcg_enabled()) {

        mips_tcg_init();

    }

}


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

         trace_qio_channel_socket_listen_fail(ioc);

+        return -1;
+
+    }
+
+

     trace_qio_channel_socket_listen_complete(ioc, fd);

int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,

                                   SocketAddress *addr,

                                   Error **errp)

{

    int fd;

    trace_qio_channel_socket_listen_sync(ioc, addr);

    fd = socket_listen(addr, errp);

    if (fd < 0) {

        trace_qio_channel_socket_listen_fail(ioc);

        return -1;

    }

    trace_qio_channel_socket_listen_complete(ioc, fd);

    if (qio_channel_socket_set_fd(ioc, fd, errp) < 0) {

        close(fd);

        return -1;

    }

    qio_channel_set_feature(QIO_CHANNEL(ioc), QIO_CHANNEL_FEATURE_LISTEN);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp)

+{

     unix_nonblocking_connect(path, unix_wait_for_connect, s, errp);

void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp)

{

    unix_nonblocking_connect(path, unix_wait_for_connect, s, errp);

}


--- a/source.c
+++ b/source.c
@@ -7,10 +7,10 @@
     port->opaque = opaque;

     port->index = index;
+
+    port->attach = attach;
+
+    TAILQ_INSERT_TAIL(&bus->free, port, next);

     bus->nfree++;

void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,

                       usb_attachfn attach)

{

    port->opaque = opaque;

    port->index = index;

    port->attach = attach;

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

    bus->nfree++;

}


--- a/source.c
+++ b/source.c
@@ -23,9 +23,9 @@
         } else if (!acb->error) {

             acb->ret = rcb->size;
+
+        }
+
     } else {

         if (r < 0) {

static void qemu_rbd_complete_aio(RADOSCB *rcb)

{

    RBDAIOCB *acb = rcb->acb;

    int64_t r;

    r = rcb->ret;

    if (acb->cmd != RBD_AIO_READ) {

        if (r < 0) {

            acb->ret = r;

            acb->error = 1;

        } else if (!acb->error) {

            acb->ret = rcb->size;

        }

    } else {

        if (r < 0) {

            memset(rcb->buf, 0, rcb->size);

            acb->ret = r;

            acb->error = 1;

        } else if (r < rcb->size) {

            memset(rcb->buf + r, 0, rcb->size - r);

            if (!acb->error) {

                acb->ret = rcb->size;

            }

        } else if (!acb->error) {

            acb->ret = r;

        }

    }

    /* Note that acb->bh can be NULL in case where the aio was cancelled */

    acb->bh = qemu_bh_new(rbd_aio_bh_cb, acb);

    qemu_bh_schedule(acb->bh);

    g_free(rcb);

}


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

     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

+
+
+    k->init = virtio_net_init_pci;
+
+    k->exit = virtio_net_exit_pci;

     k->romfile = "pxe-virtio.rom";

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

    k->init = virtio_net_init_pci;

    k->exit = virtio_net_exit_pci;

    k->romfile = "pxe-virtio.rom";

    k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;

    k->device_id = PCI_DEVICE_ID_VIRTIO_NET;

    k->revision = VIRTIO_PCI_ABI_VERSION;

    k->class_id = PCI_CLASS_NETWORK_ETHERNET;

    dc->alias = "virtio-net";

    dc->reset = virtio_pci_reset;

    dc->props = virtio_net_properties;

}


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

+        if(length){
+
+            hc->bits[hc->current] = prefix;
+
+            hc->lengths[hc->current] = length;

         } else {

static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t prefix, int length)

{

    if(!get_bits1(gb)){ //Leaf

        if(hc->current >= 256){

            av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");

        if(length){

            hc->bits[hc->current] = prefix;

            hc->lengths[hc->current] = length;

        } else {

            hc->bits[hc->current] = 0;

            hc->lengths[hc->current] = 0;

        hc->values[hc->current] = get_bits(gb, 8);

        hc->current++;

        if(hc->maxlength < length)

            hc->maxlength = length;

        return 0;

    } else { //Node

        int r;

        length++;

        r = smacker_decode_tree(gb, hc, prefix, length);

        if(r)

            return r;

        return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), length);


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

     uint64_t words[MAX_STFL_WORDS];

+    unsigned count_m1 = env->regs[0] & 0xff;
+
+    unsigned max_m1 = do_stfle(env, words);
+
+    unsigned i;

uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t addr)

{

    uint64_t words[MAX_STFL_WORDS];

    unsigned count_m1 = env->regs[0] & 0xff;

    unsigned max_m1 = do_stfle(env, words);

    unsigned i;

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

        cpu_stq_data(env, addr + 8 * i, words[i]);

    }

    env->regs[0] = deposit64(env->regs[0], 0, 8, max_m1);

    return (count_m1 >= max_m1 ? 0 : 3);

}


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

+{

     PXA2xxSSPState *s = (PXA2xxSSPState *) opaque;

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

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

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

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

{

    PXA2xxSSPState *s = (PXA2xxSSPState *) opaque;

    int i;

    s->enable = qemu_get_be32(f);

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

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

    qemu_get_be32s(f, &s->sspsp);

    qemu_get_be32s(f, &s->ssto);

    qemu_get_be32s(f, &s->ssitr);

    qemu_get_be32s(f, &s->sssr);

    qemu_get_8s(f, &s->sstsa);

    qemu_get_8s(f, &s->ssrsa);

    qemu_get_8s(f, &s->ssacd);

    s->rx_level = qemu_get_byte(f);

    s->rx_start = 0;

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

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

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void json_print_int(WriterContext *wctx, const char *key, int value)
+
 {
+
+    char *key_esc = json_escape_str(key);

static void json_print_int(WriterContext *wctx, const char *key, int value)

{

    char *key_esc = json_escape_str(key);

    if (wctx->nb_item) printf(",\n");

    printf(INDENT "\"%s\": %d", key_esc ? key_esc : "", value);

    av_free(key_esc);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void pty_chr_update_read_handler(CharDriverState *chr)
+
+{
+
+    PtyCharDriver *s = chr->opaque;

     GPollFD pfd;

static void pty_chr_update_read_handler(CharDriverState *chr)

{

    PtyCharDriver *s = chr->opaque;

    GPollFD pfd;

    pfd.fd = g_io_channel_unix_get_fd(s->fd);

    pfd.events = G_IO_OUT;

    pfd.revents = 0;

    g_poll(&pfd, 1, 0);

    if (pfd.revents & G_IO_HUP) {

        pty_chr_state(chr, 0);

    } else {

        pty_chr_state(chr, 1);

    }

}


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

     qemu_mutex_destroy(&s->mutex);

+
+
+    g_free(s->cookie);
+
+    g_free(s->url);

static void curl_close(BlockDriverState *bs)

{

    BDRVCURLState *s = bs->opaque;

    DPRINTF("CURL: Close\n");

    curl_detach_aio_context(bs);

    qemu_mutex_destroy(&s->mutex);

    g_free(s->cookie);

    g_free(s->url);

}


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

+    /* Tell KVM that we're in PAPR mode */
+
+    if (kvm_enabled()) {
+
+        kvmppc_set_papr(cpu);

     }

void cpu_ppc_set_papr(PowerPCCPU *cpu)

{

    CPUPPCState *env = &cpu->env;

    /* PAPR always has exception vectors in RAM not ROM. To ensure this,

     * MSR[IP] should never be set.

     *

     * We also disallow setting of MSR_HV

     */

    env->msr_mask &= ~((1ull << MSR_EP) | MSR_HVB);

    /* Set a full AMOR so guest can use the AMR as it sees fit */

    env->spr[SPR_AMOR] = amor->default_value = 0xffffffffffffffffull;

    /* Tell KVM that we're in PAPR mode */

    if (kvm_enabled()) {

        kvmppc_set_papr(cpu);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+int qemu_timedate_diff(struct tm *tm)
+
+{
+
+    time_t seconds;

int qemu_timedate_diff(struct tm *tm)

{

    time_t seconds;

    if (rtc_date_offset == -1)

        if (rtc_utc)

            seconds = mktimegm(tm);

        else {

            struct tm tmp = *tm;

            tmp.tm_isdst = -1; /* use timezone to figure it out */

            seconds = mktime(&tmp);

	}

    else

        seconds = mktimegm(tm) + rtc_date_offset;

    return seconds - time(NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void opt_pass(const char *pass_str)

+{
+
+    int pass;
+
     pass = atoi(pass_str);

     if (pass != 1 && pass != 2) {

static void opt_pass(const char *pass_str)

{

    int pass;

    pass = atoi(pass_str);

    if (pass != 1 && pass != 2) {

        fprintf(stderr, "pass number can be only 1 or 2\n");

        ffmpeg_exit(1);

    }

    do_pass = pass;

}


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

         return NULL;
+
+    }
+
+
+
     bs = bdrv_new_root();

     blk->root = bdrv_root_attach_child(bs, "root", &child_root);

BlockBackend *blk_new_with_bs(Error **errp)

{

    BlockBackend *blk;

    BlockDriverState *bs;

    blk = blk_new(errp);

    if (!blk) {

        return NULL;

    }

    bs = bdrv_new_root();

    blk->root = bdrv_root_attach_child(bs, "root", &child_root);

    blk->root->opaque = blk;

    bs->blk = blk;

    return blk;

}


void vnc_init_state(VncState *vs)

{

    vs->initialized = true;

    VncDisplay *vd = vs->vd;

    vs->last_x = -1;

    vs->last_y = -1;

    vs->as.freq = 44100;

    vs->as.nchannels = 2;

    vs->as.fmt = AUD_FMT_S16;

    vs->as.endianness = 0;

    qemu_mutex_init(&vs->output_mutex);

    vs->bh = qemu_bh_new(vnc_jobs_bh, vs);

    QTAILQ_INSERT_HEAD(&vd->clients, vs, next);

    graphic_hw_update(vd->dcl.con);

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

    vnc_flush(vs);

    vnc_read_when(vs, protocol_version, 12);

    reset_keys(vs);

    if (vs->vd->lock_key_sync)

        vs->led = qemu_add_led_event_handler(kbd_leds, vs);

    vs->mouse_mode_notifier.notify = check_pointer_type_change;

    qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier);

    /* vs might be free()ed here */

}


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

     qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));

+    /* force virtio-1.0 */
+
+    vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN;
+
+    vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY;

     object_property_set_bool(OBJECT(vdev), true, "realized", errp);

static void virtio_gpu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)

{

    VirtIOGPUPCI *vgpu = VIRTIO_GPU_PCI(vpci_dev);

    VirtIOGPU *g = &vgpu->vdev;

    DeviceState *vdev = DEVICE(&vgpu->vdev);

    int i;

    qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));

    /* force virtio-1.0 */

    vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN;

    vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY;

    object_property_set_bool(OBJECT(vdev), true, "realized", errp);

    for (i = 0; i < g->conf.max_outputs; i++) {

        object_property_set_link(OBJECT(g->scanout[i].con),

                                 OBJECT(vpci_dev),

                                 "device", errp);

    }

}


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

     if (f->ops->get_rate_limit)
+
+        return f->ops->get_rate_limit(f->opaque);
+

     return 0;

int64_t qemu_file_get_rate_limit(QEMUFile *f)

{

    if (f->ops->get_rate_limit)

        return f->ops->get_rate_limit(f->opaque);

    return 0;

}


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

         break;

+    case I2CLC_ADDR:
+
+        value = s->i2clc;
+
+        break;

     default:

static uint64_t exynos4210_i2c_read(void *opaque, target_phys_addr_t offset,

                                 unsigned size)

{

    Exynos4210I2CState *s = (Exynos4210I2CState *)opaque;

    uint8_t value;

    switch (offset) {

    case I2CCON_ADDR:

        value = s->i2ccon;

        break;

    case I2CSTAT_ADDR:

        value = s->i2cstat;

        break;

    case I2CADD_ADDR:

        value = s->i2cadd;

        break;

    case I2CDS_ADDR:

        value = s->i2cds;

        s->scl_free = true;

        if (EXYNOS4_I2C_MODE(s->i2cstat) == I2CMODE_MASTER_Rx &&

               (s->i2cstat & I2CSTAT_START_BUSY) &&

               !(s->i2ccon & I2CCON_INT_PEND)) {

            exynos4210_i2c_data_receive(s);

        }

        break;

    case I2CLC_ADDR:

        value = s->i2clc;

        break;

    default:

        value = 0;

        DPRINT("ERROR: Bad read offset 0x%x\n", (unsigned int)offset);

        break;

    }

    DPRINT("read %s [0x%02x] -> 0x%02x\n", exynos4_i2c_get_regname(offset),

            (unsigned int)offset, value);

    return value;

}


yuv2rgb_2_c_template(SwsContext *c, const uint16_t *buf0,

                     const uint16_t *buf1, const uint16_t *ubuf0,

                     const uint16_t *ubuf1, const uint16_t *vbuf0,

                     const uint16_t *vbuf1, const uint16_t *abuf0,

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

                     int yalpha, int uvalpha, int y,

                     enum PixelFormat target, int hasAlpha)

{

    int  yalpha1 = 4095 - yalpha;

    int uvalpha1 = 4095 - uvalpha;

    int i;

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

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

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

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

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

        int A1, A2;

        const void *r =  c->table_rV[V],

                   *g = (c->table_gU[U] + c->table_gV[V]),

                   *b =  c->table_bU[U];

        if (hasAlpha) {

            A1 = (abuf0[i * 2    ] * yalpha1 + abuf1[i * 2    ] * yalpha) >> 19;

            A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19;

        }

        yuv2rgb_write(dest, i, Y1, Y2, U, V, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,

                      r, g, b, y, target, hasAlpha);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static NetSocketState *net_socket_fd_init(NetClientState *peer,

                                           const char *model, const char *name,

@@ -6,7 +6,7 @@

 {

+    int so_type = -1, optlen=sizeof(so_type);

static NetSocketState *net_socket_fd_init(NetClientState *peer,

                                          const char *model, const char *name,

                                          int fd, int is_connected)

{

    int so_type = -1, optlen=sizeof(so_type);

    if(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&so_type,

        (socklen_t *)&optlen)< 0) {

        fprintf(stderr, "qemu: error: getsockopt(SO_TYPE) for fd=%d failed\n",

                fd);

        closesocket(fd);

        return NULL;

    }

    switch(so_type) {

    case SOCK_DGRAM:

        return net_socket_fd_init_dgram(peer, model, name, fd, is_connected);

    case SOCK_STREAM:

        return net_socket_fd_init_stream(peer, model, name, fd, is_connected);

    default:

        /* who knows ... this could be a eg. a pty, do warn and continue as stream */

        fprintf(stderr, "qemu: warning: socket type=%d for fd=%d is not SOCK_DGRAM or SOCK_STREAM\n", so_type, fd);

        return net_socket_fd_init_stream(peer, model, name, fd, is_connected);

    }

    return NULL;

}


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

 	D(dump_d(c, &ctrl->channels[c].current_d));

+	cpu_physical_memory_write (addr,
+
+				  (void *) &ctrl->channels[c].current_c,
+
+				  sizeof ctrl->channels[c].current_c);

 }

static void channel_store_c(struct fs_dma_ctrl *ctrl, int c)

{

	target_phys_addr_t addr = channel_reg(ctrl, c, RW_GROUP_DOWN);

	/* Encode and store. FIXME: handle endianness.  */

	D(printf("%s ch=%d addr=" TARGET_FMT_plx "\n", __func__, c, addr));

	D(dump_d(c, &ctrl->channels[c].current_d));

	cpu_physical_memory_write (addr,

				  (void *) &ctrl->channels[c].current_c,

				  sizeof ctrl->channels[c].current_c);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void xenstore_update_be(char *watch, char *type, int dom,

+                               struct XenDevOps *ops)

+{
+
+    struct XenDevice *xendev;

     char path[XEN_BUFSIZE], *dom0, *bepath;

static void xenstore_update_be(char *watch, char *type, int dom,

                               struct XenDevOps *ops)

{

    struct XenDevice *xendev;

    char path[XEN_BUFSIZE], *dom0, *bepath;

    unsigned int len, dev;

    dom0 = xs_get_domain_path(xenstore, 0);

    len = snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);

    free(dom0);

    if (strncmp(path, watch, len) != 0) {

        return;

    }

    if (sscanf(watch+len, "/%u/%255s", &dev, path) != 2) {

        strcpy(path, "");

        if (sscanf(watch+len, "/%u", &dev) != 1) {

            dev = -1;

        }

    }

    if (dev == -1) {

        return;

    }

    xendev = xen_be_get_xendev(type, dom, dev, ops);

    if (xendev != NULL) {

        bepath = xs_read(xenstore, 0, xendev->be, &len);

        if (bepath == NULL) {

            xen_be_del_xendev(dom, dev);

        } else {

            free(bepath);

            xen_be_backend_changed(xendev, path);

            xen_be_check_state(xendev);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -3,8 +3,8 @@
         VSCMsgType type, uint32_t reader_id,

         const uint8_t *payload, uint32_t length)
+
+{

     VSCMsgHeader scr_msg_header;

static void ccid_card_vscard_send_msg(PassthruState *s,

        VSCMsgType type, uint32_t reader_id,

        const uint8_t *payload, uint32_t length)

{

    VSCMsgHeader scr_msg_header;

    scr_msg_header.type = htonl(type);

    scr_msg_header.reader_id = htonl(reader_id);

    scr_msg_header.length = htonl(length);

    qemu_chr_fe_write(s->cs, (uint8_t *)&scr_msg_header, sizeof(VSCMsgHeader));

    qemu_chr_fe_write(s->cs, payload, length);

}


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

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

+        tc[2] = tc0_table[index_a][bS[2]];
+
+        tc[3] = tc0_table[index_a][bS[3]];
+
+        h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc);

     } else {

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

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

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

    const int alpha = alpha_table[index_a];

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

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

    if( bS[0] < 4 || !intra ) {

        int8_t tc[4];

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

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

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

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

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

    } else {

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

    }

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
+static bool invalid_qmp_mode(const Monitor *mon, const char *cmd,
+
+                             Error **errp)
+
+{

+    bool is_cap = g_str_equal(cmd, "qmp_capabilities");
+

+    if (is_cap && mon->qmp.in_command_mode) {

         error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,

static bool invalid_qmp_mode(const Monitor *mon, const char *cmd,

                             Error **errp)

{

    bool is_cap = g_str_equal(cmd, "qmp_capabilities");

    if (is_cap && mon->qmp.in_command_mode) {

        error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,

                  "Capabilities negotiation is already complete, command "

                  "'%s' ignored", cmd);

        return true;

    }

    if (!is_cap && !mon->qmp.in_command_mode) {

        error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,

                  "Expecting capabilities negotiation with "

                  "'qmp_capabilities' before command '%s'", cmd);

        return true;

    }

    return false;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static block_number_t eckd_block_num(BootMapPointer *p)
+
+{
+
+    const uint64_t sectors = virtio_get_sectors();
+
     const uint64_t heads = virtio_get_heads();

     const uint64_t cylinder = p->eckd.cylinder

static block_number_t eckd_block_num(BootMapPointer *p)

{

    const uint64_t sectors = virtio_get_sectors();

    const uint64_t heads = virtio_get_heads();

    const uint64_t cylinder = p->eckd.cylinder

                            + ((p->eckd.head & 0xfff0) << 12);

    const uint64_t head = p->eckd.head & 0x000f;

    const block_number_t block = sectors * heads * cylinder

                               + sectors * head

                               + p->eckd.sector

                               - 1; /* block nr starts with zero */

    return block;

}


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

     if (arm_feature(env, ARM_FEATURE_M)) {
+
+        return env->v7m.mpu_ctrl & R_V7M_MPU_CTRL_PRIVDEFENA_MASK;
+
+    } else {
+
         return regime_sctlr(env, mmu_idx) & SCTLR_BR;

     }

static bool pmsav7_use_background_region(ARMCPU *cpu,

                                         ARMMMUIdx mmu_idx, bool is_user)

{

    /* Return true if we should use the default memory map as a

     * "background" region if there are no hits against any MPU regions.

     */

    CPUARMState *env = &cpu->env;

    if (is_user) {

        return false;

    }

    if (arm_feature(env, ARM_FEATURE_M)) {

        return env->v7m.mpu_ctrl & R_V7M_MPU_CTRL_PRIVDEFENA_MASK;

    } else {

        return regime_sctlr(env, mmu_idx) & SCTLR_BR;

    }

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
         case FLV_CODECID_REALH263: vcodec->codec_id = CODEC_ID_H263 ; break; // Really mean it this time

         case FLV_CODECID_SCREEN: vcodec->codec_id = CODEC_ID_FLASHSV; break;
+
         case FLV_CODECID_SCREEN2: vcodec->codec_id = CODEC_ID_FLASHSV2; break;

         case FLV_CODECID_VP6   : vcodec->codec_id = CODEC_ID_VP6F   ;

static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) {

    AVCodecContext *vcodec = vstream->codec;

    switch(flv_codecid) {

        case FLV_CODECID_H263  : vcodec->codec_id = CODEC_ID_FLV1   ; break;

        case FLV_CODECID_REALH263: vcodec->codec_id = CODEC_ID_H263 ; break; // Really mean it this time

        case FLV_CODECID_SCREEN: vcodec->codec_id = CODEC_ID_FLASHSV; break;

        case FLV_CODECID_SCREEN2: vcodec->codec_id = CODEC_ID_FLASHSV2; break;

        case FLV_CODECID_VP6   : vcodec->codec_id = CODEC_ID_VP6F   ;

        case FLV_CODECID_VP6A  :

            if(flv_codecid == FLV_CODECID_VP6A)

                vcodec->codec_id = CODEC_ID_VP6A;

            if(vcodec->extradata_size != 1) {

                vcodec->extradata_size = 1;

                vcodec->extradata = av_malloc(1);

            }

            vcodec->extradata[0] = avio_r8(s->pb);

            return 1; // 1 byte body size adjustment for flv_read_packet()

        case FLV_CODECID_H264:

            vcodec->codec_id = CODEC_ID_H264;

            return 3; // not 4, reading packet type will consume one byte

        case FLV_CODECID_MPEG4:

            vcodec->codec_id = CODEC_ID_MPEG4;

            return 3;

        default:

            av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flv_codecid);

            vcodec->codec_tag = flv_codecid;

    }

    return 0;

}


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

         int len = strlen(p) * 6 / 8;

+        char *buf = av_mallocz(len);
+
+        av_base64_decode(buf, p, len);
+
+

         if (rtp_asf_fix_header(buf, len) < 0)

int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)

{

    int ret = 0;

    if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {

        AVIOContext pb;

        RTSPState *rt = s->priv_data;

        AVDictionary *opts = NULL;

        int len = strlen(p) * 6 / 8;

        char *buf = av_mallocz(len);

        av_base64_decode(buf, p, len);

        if (rtp_asf_fix_header(buf, len) < 0)

            av_log(s, AV_LOG_ERROR,

                   "Failed to fix invalid RTSP-MS/ASF min_pktsize\n");

        init_packetizer(&pb, buf, len);

        if (rt->asf_ctx) {

            avformat_close_input(&rt->asf_ctx);

        }

        if (!(rt->asf_ctx = avformat_alloc_context()))

            return AVERROR(ENOMEM);

        rt->asf_ctx->pb      = &pb;

        av_dict_set(&opts, "no_resync_search", "1", 0);

        ret = avformat_open_input(&rt->asf_ctx, "", &ff_asf_demuxer, &opts);

        av_dict_free(&opts);

        if (ret < 0)

            return ret;

        av_dict_copy(&s->metadata, rt->asf_ctx->metadata, 0);

        rt->asf_pb_pos = avio_tell(&pb);

        av_free(buf);

        rt->asf_ctx->pb = NULL;

    }

    return ret;

}


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

                               uint32_t value)

+{

     m5206_mbar_state *s = (m5206_mbar_state *)opaque;

static void m5206_mbar_writel(void *opaque, target_phys_addr_t offset,

                              uint32_t value)

{

    m5206_mbar_state *s = (m5206_mbar_state *)opaque;

    int width;

    offset &= 0x3ff;

    if (offset > 0x200) {

        hw_error("Bad MBAR write offset 0x%x", (int)offset);

    }

    width = m5206_mbar_width[offset >> 2];

    if (width < 4) {

        m5206_mbar_writew(opaque, offset, value >> 16);

        m5206_mbar_writew(opaque, offset + 2, value & 0xffff);

        return;

    }

    m5206_mbar_write(s, offset, value, 4);

}


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

     /* remove from list, if necessary */

+    bdrv_make_anon(bs);
+
+
+
+    bdrv_close(bs);

     if (bs->file != NULL) {

void bdrv_delete(BlockDriverState *bs)

{

    assert(!bs->peer);

    /* remove from list, if necessary */

    bdrv_make_anon(bs);

    bdrv_close(bs);

    if (bs->file != NULL) {

        bdrv_delete(bs->file);

    }

    assert(bs != bs_snapshots);

    g_free(bs);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static MegasasCmd *megasas_lookup_frame(MegasasState *s,

+    target_phys_addr_t frame)
+
+{
+
+    MegasasCmd *cmd = NULL;

     int num = 0, index;

static MegasasCmd *megasas_lookup_frame(MegasasState *s,

    target_phys_addr_t frame)

{

    MegasasCmd *cmd = NULL;

    int num = 0, index;

    index = s->reply_queue_head;

    while (num < s->fw_cmds) {

        if (s->frames[index].pa && s->frames[index].pa == frame) {

            cmd = &s->frames[index];

            break;

        }

        index = megasas_next_index(s, index, s->fw_cmds);

        num++;

    }

    return cmd;

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
         do_multiwrite(req->dev->bs, blkreq, *num_writes);

     }
+
+    *num_writes = 0;
+
+
+
     acb = bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req);

     if (!acb) {

static void virtio_blk_handle_flush(BlockRequest *blkreq, int *num_writes,

    VirtIOBlockReq *req)

{

    BlockDriverAIOCB *acb;

    /*

     * Make sure all outstanding writes are posted to the backing device.

     */

    if (*num_writes > 0) {

        do_multiwrite(req->dev->bs, blkreq, *num_writes);

    }

    *num_writes = 0;

    acb = bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req);

    if (!acb) {

        virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);

    }

}


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

     }
+
+    if (dimm->node >= nb_numa_nodes) {
+
+        error_setg(errp, "'DIMM property " PC_DIMM_NODE_PROP " has value %"
+
                    PRIu32 "' which exceeds the number of numa nodes: %d",

                    dimm->node, nb_numa_nodes);

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

{

    PCDIMMDevice *dimm = PC_DIMM(dev);

    if (!dimm->hostmem) {

        error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set");

        return;

    }

    if (dimm->node >= nb_numa_nodes) {

        error_setg(errp, "'DIMM property " PC_DIMM_NODE_PROP " has value %"

                   PRIu32 "' which exceeds the number of numa nodes: %d",

                   dimm->node, nb_numa_nodes);

        return;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int local_set_xattr(const char *path, FsCred *credp)
+
+{
+
+    int err;
+

     if (credp->fc_uid != -1) {

static int local_set_xattr(const char *path, FsCred *credp)

{

    int err;

    if (credp->fc_uid != -1) {

        err = setxattr(path, "user.virtfs.uid", &credp->fc_uid, sizeof(uid_t),

                0);

        if (err) {

            return err;

        }

    }

    if (credp->fc_gid != -1) {

        err = setxattr(path, "user.virtfs.gid", &credp->fc_gid, sizeof(gid_t),

                0);

        if (err) {

            return err;

        }

    }

    if (credp->fc_mode != -1) {

        err = setxattr(path, "user.virtfs.mode", &credp->fc_mode,

                sizeof(mode_t), 0);

        if (err) {

            return err;

        }

    }

    if (credp->fc_rdev != -1) {

        err = setxattr(path, "user.virtfs.rdev", &credp->fc_rdev,

                sizeof(dev_t), 0);

        if (err) {

            return err;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+int qemu_signalfd(const sigset_t *mask)
+
+{
+
+#if defined(CONFIG_signalfd)

     int ret;

int qemu_signalfd(const sigset_t *mask)

{

#if defined(CONFIG_signalfd)

    int ret;

    ret = syscall(SYS_signalfd, -1, mask, _NSIG / 8);

    if (ret != -1)

        return ret;

#endif

    return qemu_signalfd_compat(mask);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void cpu_exit(CPUArchState *env)

 {
+
     CPUState *cpu = ENV_GET_CPU(env);

void cpu_exit(CPUArchState *env)

{

    CPUState *cpu = ENV_GET_CPU(env);

    cpu->exit_request = 1;

    cpu_unlink_tb(cpu);

}


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

     if (addr < QPCI_PIO_LIMIT) {

void qpci_io_writeb(QPCIDevice *dev, void *data, uint8_t value)

{

    uintptr_t addr = (uintptr_t)data;

    if (addr < QPCI_PIO_LIMIT) {

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

    } else {

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

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){

     const int stride= 16*2;
+
     const int xStride= 16;

     int a,b,c,d,e;
@@ -11,10 +11,10 @@

     a= block[stride*0 + xStride*0];
+
+    b= block[stride*0 + xStride*1];
+
+    c= block[stride*1 + xStride*0];

     d= block[stride*1 + xStride*1];

void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){

    const int stride= 16*2;

    const int xStride= 16;

    int a,b,c,d,e;

    dctcoef *block = (dctcoef*)_block;

    a= block[stride*0 + xStride*0];

    b= block[stride*0 + xStride*1];

    c= block[stride*1 + xStride*0];

    d= block[stride*1 + xStride*1];

    e= a-b;

    a= a+b;

    b= c-d;

    c= c+d;

    block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7;

    block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;

    block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;

    block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;

}


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

     register_ioport_read(addr, size, 2, ioport_read2, s);

+    register_ioport_write(addr, size, 4, ioport_write4, s);
+
+    register_ioport_read(addr, size, 4, ioport_read4, s);
+
+

     s->region[region_num] = addr;

static void pci_map(PCIDevice * pci_dev, int region_num,

                    uint32_t addr, uint32_t size, int type)

{

    PCIEEPRO100State *d = DO_UPCAST(PCIEEPRO100State, dev, pci_dev);

    EEPRO100State *s = &d->eepro100;

    logout("region %d, addr=0x%08x, size=0x%08x, type=%d\n",

           region_num, addr, size, type);

    assert(region_num == 1);

    register_ioport_write(addr, size, 1, ioport_write1, s);

    register_ioport_read(addr, size, 1, ioport_read1, s);

    register_ioport_write(addr, size, 2, ioport_write2, s);

    register_ioport_read(addr, size, 2, ioport_read2, s);

    register_ioport_write(addr, size, 4, ioport_write4, s);

    register_ioport_read(addr, size, 4, ioport_read4, s);

    s->region[region_num] = addr;

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     const testdef_t *test = data;

     char *args;
+
     char tmpname[] = "/tmp/qtest-boot-serial-XXXXXX";

     int fd;

static void test_machine(const void *data)

{

    const testdef_t *test = data;

    char *args;

    char tmpname[] = "/tmp/qtest-boot-serial-XXXXXX";

    int fd;

    fd = mkstemp(tmpname);

    g_assert(fd != -1);

    args = g_strdup_printf("-M %s,accel=tcg -chardev file,id=serial0,path=%s"

                           " -serial chardev:serial0 %s", test->machine,

                           tmpname, test->extra);

    qtest_start(args);

    unlink(tmpname);

    check_guest_output(test, fd);

    qtest_quit(global_qtest);

    g_free(args);

    close(fd);

}


--- a/source.c
+++ b/source.c
@@ -5,5 +5,5 @@
     QObject *obj = qobject_from_json("[32,}");

     fail_unless(obj == NULL);
+
+}

START_TEST(invalid_array_comma)

{

    QObject *obj = qobject_from_json("[32,}");

    fail_unless(obj == NULL);

}


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

   s = gdbserver_state;

+  if (!s) {
+
       return;

   }

void gdb_exit(CPUArchState *env, int code)

{

  GDBState *s;

  char buf[4];

  s = gdbserver_state;

  if (!s) {

      return;

  }

#ifdef CONFIG_USER_ONLY

  if (gdbserver_fd < 0 || s->fd < 0) {

      return;

  }

#endif

  snprintf(buf, sizeof(buf), "W%02x", (uint8_t)code);

  put_packet(s, buf);

#ifndef CONFIG_USER_ONLY

  if (s->chr) {

      qemu_chr_delete(s->chr);

  }

#endif

}


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

+
     for (;; ) {

         AVPacket pkt;

int av_write_trailer(AVFormatContext *s)

{

    int ret, i;

    for (;; ) {

        AVPacket pkt;

        ret = interleave_packet(s, &pkt, NULL, 1);

        if (ret < 0) //FIXME cleanup needed for ret<0 ?

            goto fail;

        if (!ret)

            break;

        ret = s->oformat->write_packet(s, &pkt);

        if (ret >= 0)

            s->streams[pkt.stream_index]->nb_frames++;

        av_free_packet(&pkt);

        if (ret < 0)

            goto fail;

    }

    if (s->oformat->write_trailer)

        ret = s->oformat->write_trailer(s);

    if (!(s->oformat->flags & AVFMT_NOFILE))

        avio_flush(s->pb);

fail:

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

        av_freep(&s->streams[i]->priv_data);

        av_freep(&s->streams[i]->index_entries);

    }

    if (s->oformat->priv_class)

        av_opt_free(s->priv_data);

    av_freep(&s->priv_data);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void gen_ldda_asi(DisasContext *dc, TCGv hi, TCGv addr,

+                         int insn, int rd)
+
+{
+
+    TCGv_i32 r_asi, r_rd;

static void gen_ldda_asi(DisasContext *dc, TCGv hi, TCGv addr,

                         int insn, int rd)

{

    TCGv_i32 r_asi, r_rd;

    r_asi = gen_get_asi(dc, insn);

    r_rd = tcg_const_i32(rd);

    gen_helper_ldda_asi(cpu_env, addr, r_asi, r_rd);

    tcg_temp_free_i32(r_rd);

    tcg_temp_free_i32(r_asi);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int dpx_probe(AVProbeData *p)

+{

     const uint8_t *b = p->buf;

static int dpx_probe(AVProbeData *p)

{

    const uint8_t *b = p->buf;

    if (AV_RN32(b) == AV_RN32("SDPX") || AV_RN32(b) == AV_RN32("XPDS"))

        return AVPROBE_SCORE_EXTENSION + 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void visit_end_list(Visitor *v, Error **errp)
+
 {

     assert(!error_is_set(errp));

void visit_end_list(Visitor *v, Error **errp)

{

    assert(!error_is_set(errp));

    v->end_list(v, errp);

}


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

         new_rate = SIZE_MAX;

+    }
+
+
+
+    s->xfer_limit = new_rate / 10;

static int64_t buffered_set_rate_limit(void *opaque, int64_t new_rate)

{

    QEMUFileBuffered *s = opaque;

    if (qemu_file_get_error(s->file)) {

        goto out;

    }

    if (new_rate > SIZE_MAX) {

        new_rate = SIZE_MAX;

    }

    s->xfer_limit = new_rate / 10;

out:

    return s->xfer_limit;

}