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

                             uint64_t *bytes)

+{

+    bool need_cow;

     int ret = 0;

static int mirror_cow_align(MirrorBlockJob *s, int64_t *offset,

                            uint64_t *bytes)

{

    bool need_cow;

    int ret = 0;

    int64_t align_offset = *offset;

    unsigned int align_bytes = *bytes;

    int max_bytes = s->granularity * s->max_iov;

    assert(*bytes < INT_MAX);

    need_cow = !test_bit(*offset / s->granularity, s->cow_bitmap);

    need_cow |= !test_bit((*offset + *bytes - 1) / s->granularity,

                          s->cow_bitmap);

    if (need_cow) {

        bdrv_round_to_clusters(blk_bs(s->target), *offset, *bytes,

                               &align_offset, &align_bytes);

    }

    if (align_bytes > max_bytes) {

        align_bytes = max_bytes;

        if (need_cow) {

            align_bytes = QEMU_ALIGN_DOWN(align_bytes, s->target_cluster_size);

        }

    }

    /* Clipping may result in align_bytes unaligned to chunk boundary, but

     * that doesn't matter because it's already the end of source image. */

    align_bytes = mirror_clip_bytes(s, align_offset, align_bytes);

    ret = align_offset + align_bytes - (*offset + *bytes);

    *offset = align_offset;

    *bytes = align_bytes;

    assert(ret >= 0);

    return ret;

}


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

     wfx->nSamplesPerSec = as->freq;

+    wfx->nAvgBytesPerSec = as->freq << (as->nchannels == 2);
+
+    wfx->nBlockAlign = 1 << (as->nchannels == 2);
+
+    wfx->cbSize = 0;

static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as)

{

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

    wfx->wFormatTag = WAVE_FORMAT_PCM;

    wfx->nChannels = as->nchannels;

    wfx->nSamplesPerSec = as->freq;

    wfx->nAvgBytesPerSec = as->freq << (as->nchannels == 2);

    wfx->nBlockAlign = 1 << (as->nchannels == 2);

    wfx->cbSize = 0;

    switch (as->fmt) {

    case AUD_FMT_S8:

    case AUD_FMT_U8:

        wfx->wBitsPerSample = 8;

        break;

    case AUD_FMT_S16:

    case AUD_FMT_U16:

        wfx->wBitsPerSample = 16;

        wfx->nAvgBytesPerSec <<= 1;

        wfx->nBlockAlign <<= 1;

        break;

    case AUD_FMT_S32:

    case AUD_FMT_U32:

        wfx->wBitsPerSample = 32;

        wfx->nAvgBytesPerSec <<= 2;

        wfx->nBlockAlign <<= 2;

        break;

    default:

        dolog ("Internal logic error: Bad audio format %d\n", as->freq);

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     uint32_t *pal, *dst2;

     uint8_t *src, *src2;
+
     int x, y;

static void sub2video_copy_rect(uint8_t *dst, int dst_linesize, int w, int h,

                                AVSubtitleRect *r)

{

    uint32_t *pal, *dst2;

    uint8_t *src, *src2;

    int x, y;

    if (r->type != SUBTITLE_BITMAP) {

        av_log(NULL, AV_LOG_WARNING, "sub2video: non-bitmap subtitle\n");

        return;

    }

    if (r->x < 0 || r->x + r->w > w || r->y < 0 || r->y + r->h > h) {

        av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle overflowing\n");

        return;

    }

    dst += r->y * dst_linesize + r->x * 4;

    src = r->pict.data[0];

    pal = (uint32_t *)r->pict.data[1];

    for (y = 0; y < r->h; y++) {

        dst2 = (uint32_t *)dst;

        src2 = src;

        for (x = 0; x < r->w; x++)

            *(dst2++) = pal[*(src2++)];

        dst += dst_linesize;

        src += r->pict.linesize[0];

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 bool qdict_get_bool(const QDict *qdict, const char *key)
+
+{

     QObject *obj = qdict_get_obj(qdict, key, QTYPE_QBOOL);

bool qdict_get_bool(const QDict *qdict, const char *key)

{

    QObject *obj = qdict_get_obj(qdict, key, QTYPE_QBOOL);

    return qbool_get_bool(qobject_to_qbool(obj));

}


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

+    cc->has_work = mips_cpu_has_work;

     cc->do_interrupt = mips_cpu_do_interrupt;

static void mips_cpu_class_init(ObjectClass *c, void *data)

{

    MIPSCPUClass *mcc = MIPS_CPU_CLASS(c);

    CPUClass *cc = CPU_CLASS(c);

    DeviceClass *dc = DEVICE_CLASS(c);

    mcc->parent_realize = dc->realize;

    dc->realize = mips_cpu_realizefn;

    mcc->parent_reset = cc->reset;

    cc->reset = mips_cpu_reset;

    cc->has_work = mips_cpu_has_work;

    cc->do_interrupt = mips_cpu_do_interrupt;

    cc->cpu_exec_interrupt = mips_cpu_exec_interrupt;

    cc->dump_state = mips_cpu_dump_state;

    cc->set_pc = mips_cpu_set_pc;

    cc->synchronize_from_tb = mips_cpu_synchronize_from_tb;

    cc->gdb_read_register = mips_cpu_gdb_read_register;

    cc->gdb_write_register = mips_cpu_gdb_write_register;

#ifdef CONFIG_USER_ONLY

    cc->handle_mmu_fault = mips_cpu_handle_mmu_fault;

#else

    cc->do_unassigned_access = mips_cpu_unassigned_access;

    cc->do_unaligned_access = mips_cpu_do_unaligned_access;

    cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;

    cc->vmsd = &vmstate_mips_cpu;

#endif

    cc->disas_set_info = mips_cpu_disas_set_info;

    cc->gdb_num_core_regs = 73;

    cc->gdb_stop_before_watchpoint = true;

    /*

     * Reason: mips_cpu_initfn() calls cpu_exec_init(), which saves

     * the object in cpus -> dangling pointer after final

     * object_unref().

     */

    dc->cannot_destroy_with_object_finalize_yet = true;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 int64_t HELPER(nabs_i64)(int64_t val)

 {
+
+    if (val < 0) {
+
         return val;

     } else {

int64_t HELPER(nabs_i64)(int64_t val)

{

    if (val < 0) {

        return val;

    } else {

        return -val;

    }

}


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

     case 2:

+        return check_solid_tile16(vs, x, y, w, h, color, samecolor);
+
+    default:
+
+        return check_solid_tile8(vs, x, y, w, h, color, samecolor);

     }

static bool check_solid_tile(VncState *vs, int x, int y, int w, int h,

                             uint32_t* color, bool samecolor)

{

    VncDisplay *vd = vs->vd;

    switch(vd->server->pf.bytes_per_pixel) {

    case 4:

        return check_solid_tile32(vs, x, y, w, h, color, samecolor);

    case 2:

        return check_solid_tile16(vs, x, y, w, h, color, samecolor);

    default:

        return check_solid_tile8(vs, x, y, w, h, color, samecolor);

    }

}


--- a/source.c
+++ b/source.c
@@ -26,11 +26,11 @@
         return -1;
     if (w != avctx->width || h != avctx->height)
         avcodec_set_dimensions(avctx, w, h);
+    if (avctx->get_buffer(avctx, p) < 0) {
+        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+        return -1;
+    }
+    p->pict_type = AV_PICTURE_TYPE_I;
     ptr    = p->data[0];
     stride = p->linesize[0];
     for (y=0; y<h; y++) {

static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
                            AVPacket *avpkt) {
    const uint8_t *buf = avpkt->data;
    const uint8_t *buf_end = avpkt->data + avpkt->size;
    PTXContext * const s = avctx->priv_data;
    AVFrame *picture = data;
    AVFrame * const p = &s->picture;
    unsigned int offset, w, h, y, stride, bytes_per_pixel;
    uint8_t *ptr;
    if (buf_end - buf < 14)
    offset          = AV_RL16(buf);
    w               = AV_RL16(buf+8);
    h               = AV_RL16(buf+10);
    bytes_per_pixel = AV_RL16(buf+12) >> 3;
    if (bytes_per_pixel != 2) {
        av_log_ask_for_sample(avctx, "Image format is not RGB15.\n");
        return -1;
    }
    avctx->pix_fmt = PIX_FMT_RGB555;
    if (offset != 0x2c)
        av_log_ask_for_sample(avctx, "offset != 0x2c\n");
    buf += offset;
    if (p->data[0])
        avctx->release_buffer(avctx, p);
    if (av_image_check_size(w, h, 0, avctx))
        return -1;
    if (w != avctx->width || h != avctx->height)
        avcodec_set_dimensions(avctx, w, h);
    if (avctx->get_buffer(avctx, p) < 0) {
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
        return -1;
    }
    p->pict_type = AV_PICTURE_TYPE_I;
    ptr    = p->data[0];
    stride = p->linesize[0];
    for (y=0; y<h; y++) {
        if (buf_end - buf < w * bytes_per_pixel)
            break;
#if HAVE_BIGENDIAN
        unsigned int x;
        for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel)
            AV_WN16(ptr+x, AV_RL16(buf+x));
#else
        memcpy(ptr, buf, w*bytes_per_pixel);
#endif
        ptr += stride;
        buf += w*bytes_per_pixel;
    }
    *picture = s->picture;
    *data_size = sizeof(AVPicture);
    return offset + w*h*bytes_per_pixel;
}


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

 {

+    bool progress;
+
+
+
+    progress = aio_bh_poll(ctx);

     if (dispatch_fds) {

bool aio_dispatch(AioContext *ctx, bool dispatch_fds)

{

    bool progress;

    progress = aio_bh_poll(ctx);

    if (dispatch_fds) {

        progress |= aio_dispatch_handlers(ctx, INVALID_HANDLE_VALUE);

    }

    progress |= timerlistgroup_run_timers(&ctx->tlg);

    return progress;

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     const uint32_t broadcast_addr =

         ~slirp->vnetwork_mask.s_addr | slirp->vnetwork_addr.s_addr;
+
     ArpTable *arptbl = &slirp->arp_table;

     int i;

void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN])

{

    const uint32_t broadcast_addr =

        ~slirp->vnetwork_mask.s_addr | slirp->vnetwork_addr.s_addr;

    ArpTable *arptbl = &slirp->arp_table;

    int i;

    DEBUG_CALL("arp_table_add");

    DEBUG_ARG("ip = 0x%x", ip_addr);

    DEBUG_ARGS((dfd, " hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n",

                ethaddr[0], ethaddr[1], ethaddr[2],

                ethaddr[3], ethaddr[4], ethaddr[5]));

    /* Check 0.0.0.0/8 invalid source-only addresses */

    assert((ip_addr & htonl(~(0xf << 28))) != 0);

    if (ip_addr == 0xffffffff || ip_addr == broadcast_addr) {

        /* Do not register broadcast addresses */

        return;

    }

    /* Search for an entry */

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

        if (arptbl->table[i].ar_sip == ip_addr) {

            /* Update the entry */

            memcpy(arptbl->table[i].ar_sha, ethaddr, ETH_ALEN);

            return;

        }

    }

    /* No entry found, create a new one */

    arptbl->table[arptbl->next_victim].ar_sip = ip_addr;

    memcpy(arptbl->table[arptbl->next_victim].ar_sha,  ethaddr, ETH_ALEN);

    arptbl->next_victim = (arptbl->next_victim + 1) % ARP_TABLE_SIZE;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void gic_cpu_write(gic_state *s, int cpu, int offset, uint32_t value)

 {
+
     switch (offset) {

     case 0x00: /* Control */

static void gic_cpu_write(gic_state *s, int cpu, int offset, uint32_t value)

{

    switch (offset) {

    case 0x00: /* Control */

        s->cpu_enabled[cpu] = (value & 1);

        DPRINTF("CPU %d %sabled\n", cpu, s->cpu_enabled ? "En" : "Dis");

        break;

    case 0x04: /* Priority mask */

        s->priority_mask[cpu] = (value & 0xff);

        break;

    case 0x08: /* Binary Point */

        /* ??? Not implemented.  */

        break;

    case 0x10: /* End Of Interrupt */

        return gic_complete_irq(s, cpu, value & 0x3ff);

    default:

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

        return;

    }

    gic_update(s);

}


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

+    skip_bits(&s->gb, 8); /* profil and level */
+
+    skip_bits(&s->gb, 1); /* progressive_sequence */
+
+    skip_bits(&s->gb, 2); /* chroma_format */

     horiz_size_ext = get_bits(&s->gb, 2);

static void mpeg_decode_sequence_extension(MpegEncContext *s)

{

    int horiz_size_ext, vert_size_ext;

    int bit_rate_ext, vbv_buf_ext, low_delay;

    int frame_rate_ext_n, frame_rate_ext_d;

    skip_bits(&s->gb, 8); /* profil and level */

    skip_bits(&s->gb, 1); /* progressive_sequence */

    skip_bits(&s->gb, 2); /* chroma_format */

    horiz_size_ext = get_bits(&s->gb, 2);

    vert_size_ext = get_bits(&s->gb, 2);

    s->width |= (horiz_size_ext << 12);

    s->height |= (vert_size_ext << 12);

    bit_rate_ext = get_bits(&s->gb, 12);  /* XXX: handle it */

    s->bit_rate = ((s->bit_rate / 400) | (bit_rate_ext << 12)) * 400;

    skip_bits1(&s->gb); /* marker */

    vbv_buf_ext = get_bits(&s->gb, 8);

    low_delay = get_bits1(&s->gb);

    frame_rate_ext_n = get_bits(&s->gb, 2);

    frame_rate_ext_d = get_bits(&s->gb, 5);

    if (frame_rate_ext_d >= 1)

        s->frame_rate = (s->frame_rate * frame_rate_ext_n) / frame_rate_ext_d;

    dprintf("sequence extension\n");

    s->mpeg2 = 1;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static void memory_region_write_accessor(MemoryRegion *mr,
+
                                          hwaddr addr,

                                          uint64_t *value,

static void memory_region_write_accessor(MemoryRegion *mr,

                                         hwaddr addr,

                                         uint64_t *value,

                                         unsigned size,

                                         unsigned shift,

                                         uint64_t mask)

{

    uint64_t tmp;

    if (mr->flush_coalesced_mmio) {

        qemu_flush_coalesced_mmio_buffer();

    }

    tmp = (*value >> shift) & mask;

    trace_memory_region_ops_write(mr, addr, tmp, size);

    mr->ops->write(mr->opaque, addr, tmp, size);

}


--- a/source.c
+++ b/source.c
@@ -1,1 +1,1 @@
+static inline void gen_check_tlb_flush(DisasContext *ctx) { }


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

+
+    memset(&category,       0, sizeof(category));
+
+    memset(&category_index, 0, sizeof(category_index));
+

     if ((ret = decode_envelope(q, p, quant_index_table)) < 0)

static int mono_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer)

{

    int category_index[128];

    int quant_index_table[102];

    int category[128];

    int ret;

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

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

    if ((ret = decode_envelope(q, p, quant_index_table)) < 0)

        return ret;

    q->num_vectors = get_bits(&q->gb, p->log2_numvector_size);

    categorize(q, p, quant_index_table, category, category_index);

    expand_category(q, category, category_index);

    decode_vectors(q, p, category, quant_index_table, mlt_buffer);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int get_cod(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties)

 {
+
     J2kCodingStyle tmp;
+
     int compno;

+    if (s->buf_end - s->buf < 5)

         return AVERROR(EINVAL);

static int get_cod(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties)

{

    J2kCodingStyle tmp;

    int compno;

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

        return AVERROR(EINVAL);

    tmp.log2_prec_width  =

    tmp.log2_prec_height = 15;

    tmp.csty = bytestream_get_byte(&s->buf);

    if (bytestream_get_byte(&s->buf)){ // progression level

        av_log(s->avctx, AV_LOG_ERROR, "only LRCP progression supported\n");

        return -1;

    }

    tmp.nlayers = bytestream_get_be16(&s->buf);

        tmp.mct = bytestream_get_byte(&s->buf); // multiple component transformation

    get_cox(s, &tmp);

    for (compno = 0; compno < s->ncomponents; compno++){

        if (!(properties[compno] & HAD_COC))

            memcpy(c + compno, &tmp, sizeof(J2kCodingStyle));

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     /* XXX: we assume that nb_sectors == 0 is suppored by the async read */

     if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
+
+        memcpy(buf, bs->boot_sector_data, 512);
+
+        sector_num++;
+
         nb_sectors--;

         buf += 512;

BlockDriverAIOCB *bdrv_aio_read(BlockDriverState *bs, int64_t sector_num,

                                uint8_t *buf, int nb_sectors,

                                BlockDriverCompletionFunc *cb, void *opaque)

{

    BlockDriver *drv = bs->drv;

    BlockDriverAIOCB *ret;

    if (!drv)

        return NULL;

    /* XXX: we assume that nb_sectors == 0 is suppored by the async read */

    if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {

        memcpy(buf, bs->boot_sector_data, 512);

        sector_num++;

        nb_sectors--;

        buf += 512;

    }

    ret = drv->bdrv_aio_read(bs, sector_num, buf, nb_sectors, cb, opaque);

    if (ret) {

	/* Update stats even though technically transfer has not happened. */

	bs->rd_bytes += (unsigned) nb_sectors * SECTOR_SIZE;

	bs->rd_ops ++;

    }

    return ret;

}


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

     int ret = 0;
+
     BDRVGlusterReopenState *reop_s;

+    GlusterConf *gconf = NULL;

     int open_flags = 0;

static int qemu_gluster_reopen_prepare(BDRVReopenState *state,

                                       BlockReopenQueue *queue, Error **errp)

{

    int ret = 0;

    BDRVGlusterReopenState *reop_s;

    GlusterConf *gconf = NULL;

    int open_flags = 0;

    assert(state != NULL);

    assert(state->bs != NULL);

    state->opaque = g_malloc0(sizeof(BDRVGlusterReopenState));

    reop_s = state->opaque;

    qemu_gluster_parse_flags(state->flags, &open_flags);

    gconf = g_malloc0(sizeof(GlusterConf));

    reop_s->glfs = qemu_gluster_init(gconf, state->bs->filename, errp);

    if (reop_s->glfs == NULL) {

        ret = -errno;

        goto exit;

    }

    reop_s->fd = glfs_open(reop_s->glfs, gconf->image, open_flags);

    if (reop_s->fd == NULL) {

        /* reops->glfs will be cleaned up in _abort */

        ret = -errno;

        goto exit;

    }

exit:

    /* state->opaque will be freed in either the _abort or _commit */

    qemu_gluster_gconf_free(gconf);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void handle_msr(DisasContext *s, uint32_t insn, unsigned int op0,

                        unsigned int op1, unsigned int op2,
+
+                       unsigned int crn, unsigned int crm, unsigned int rt)

 {

static void handle_msr(DisasContext *s, uint32_t insn, unsigned int op0,

                       unsigned int op1, unsigned int op2,

                       unsigned int crn, unsigned int crm, unsigned int rt)

{

    unsupported_encoding(s, insn);

}


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

     PowerPCCPU *cpu = opaque;

static void cpu_ppc_decr_cb(void *opaque)

{

    PowerPCCPU *cpu = opaque;

    _cpu_ppc_store_decr(cpu, 0x00000000, 0xFFFFFFFF, 1);

}


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

 {

+    CPUState *cs = arg;
+
+    S390CPU *cpu = S390_CPU(cs);

static void sigp_cpu_start(void *arg)

{

    CPUState *cs = arg;

    S390CPU *cpu = S390_CPU(cs);

    s390_cpu_set_state(CPU_STATE_OPERATING, cpu);

    DPRINTF("DONE: KVM cpu start: %p\n", &cpu->env);

}


--- a/source.c
+++ b/source.c
@@ -49,11 +49,11 @@
     tcg_gen_brcondi_i32(cond, r_tmp2, 0, l1);

     tcg_gen_mov_i32(fp1, fp0);
+
+    tcg_temp_free(fp0);
+
+    gen_set_label(l1);
+
     tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x2);

     tcg_gen_brcondi_i32(cond, r_tmp2, 0, l2);

static inline void gen_movcf_ps (int fs, int fd, int cc, int tf)

{

    int cond;

    TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv r_tmp2 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv fph0 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv fp1 = tcg_temp_local_new(TCG_TYPE_I32);

    TCGv fph1 = tcg_temp_local_new(TCG_TYPE_I32);

    int l1 = gen_new_label();

    int l2 = gen_new_label();

    if (tf)

        cond = TCG_COND_EQ;

    else

        cond = TCG_COND_NE;

    gen_load_fpr32(fp0, fs);

    gen_load_fpr32h(fph0, fs);

    gen_load_fpr32(fp1, fd);

    gen_load_fpr32h(fph1, fd);

    get_fp_cond(r_tmp1);

    tcg_gen_shri_i32(r_tmp1, r_tmp1, cc);

    tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x1);

    tcg_gen_brcondi_i32(cond, r_tmp2, 0, l1);

    tcg_gen_mov_i32(fp1, fp0);

    tcg_temp_free(fp0);

    gen_set_label(l1);

    tcg_gen_andi_i32(r_tmp2, r_tmp1, 0x2);

    tcg_gen_brcondi_i32(cond, r_tmp2, 0, l2);

    tcg_gen_mov_i32(fph1, fph0);

    tcg_temp_free(fph0);

    gen_set_label(l2);

    tcg_temp_free(r_tmp1);

    tcg_temp_free(r_tmp2);

    gen_store_fpr32(fp1, fd);

    gen_store_fpr32h(fph1, fd);

    tcg_temp_free(fp1);

    tcg_temp_free(fph1);

}


static void vscsi_send_request_sense(VSCSIState *s, vscsi_req *req)

{

    SCSIDevice *sdev = req->sdev;

    uint8_t *cdb = req->iu.srp.cmd.cdb;

    int n;

    cdb[0] = 3;

    cdb[1] = 0;

    cdb[2] = 0;

    cdb[3] = 0;

    cdb[4] = 96;

    cdb[5] = 0;

    req->sensing = 1;

    n = sdev->info->send_command(sdev, req->qtag, cdb, req->lun);

    dprintf("VSCSI: Queued request sense tag 0x%x\n", req->qtag);

    if (n < 0) {

        fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\n");

        sdev->info->cancel_io(sdev, req->qtag);

        vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);

        vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0);

        vscsi_put_req(s, req);

        return;

    } else if (n == 0) {

        return;

    }

    sdev->info->read_data(sdev, req->qtag);

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
         QINCREF(bs->file->bs->full_open_options);

         qdict_put_obj(opts, "raw", QOBJECT(bs->file->bs->full_open_options));
+
+        QINCREF(s->test_file->bs->full_open_options);
+
+        qdict_put_obj(opts, "test",
+
                       QOBJECT(s->test_file->bs->full_open_options));

static void blkverify_refresh_filename(BlockDriverState *bs)

{

    BDRVBlkverifyState *s = bs->opaque;

    /* bs->file->bs has already been refreshed */

    bdrv_refresh_filename(s->test_file->bs);

    if (bs->file->bs->full_open_options

        && s->test_file->bs->full_open_options)

    {

        QDict *opts = qdict_new();

        qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkverify")));

        QINCREF(bs->file->bs->full_open_options);

        qdict_put_obj(opts, "raw", QOBJECT(bs->file->bs->full_open_options));

        QINCREF(s->test_file->bs->full_open_options);

        qdict_put_obj(opts, "test",

                      QOBJECT(s->test_file->bs->full_open_options));

        bs->full_open_options = opts;

    }

    if (bs->file->bs->exact_filename[0]

        && s->test_file->bs->exact_filename[0])

    {

        snprintf(bs->exact_filename, sizeof(bs->exact_filename),

                 "blkverify:%s:%s",

                 bs->file->bs->exact_filename,

                 s->test_file->bs->exact_filename);

    }

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
                                      struct virtio_gpu_ctrl_command *cmd)

 {
+
+    struct virtio_gpu_resource_unref unref;
+
+
+

     VIRTIO_GPU_FILL_CMD(unref);

static void virgl_cmd_resource_unref(VirtIOGPU *g,

                                     struct virtio_gpu_ctrl_command *cmd)

{

    struct virtio_gpu_resource_unref unref;

    VIRTIO_GPU_FILL_CMD(unref);

    trace_virtio_gpu_cmd_res_unref(unref.resource_id);

    virgl_renderer_resource_unref(unref.resource_id);


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

     iohandler_init();
+
+    aio_set_fd_handler(iohandler_ctx, fd, false,
+
+                       fd_read, fd_write, NULL, opaque);

 }

void qemu_set_fd_handler(int fd,

                         IOHandler *fd_read,

                         IOHandler *fd_write,

                         void *opaque)

{

    iohandler_init();

    aio_set_fd_handler(iohandler_ctx, fd, false,

                       fd_read, fd_write, NULL, opaque);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void helper_rfmci(CPUPPCState *env)
+
 {

     do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1,

void helper_rfmci(CPUPPCState *env)

{

    do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], SPR_BOOKE_MCSRR1,

           ~((target_ulong)0x3FFF0000), 0);

}


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

     MigrationState *ms = MIGRATION_OBJ(obj);

+
+
+    ms->state = MIGRATION_STATUS_NONE;
+
     ms->xbzrle_cache_size = DEFAULT_MIGRATE_CACHE_SIZE;

     ms->mbps = -1;

static void migration_instance_init(Object *obj)

{

    MigrationState *ms = MIGRATION_OBJ(obj);

    ms->state = MIGRATION_STATUS_NONE;

    ms->xbzrle_cache_size = DEFAULT_MIGRATE_CACHE_SIZE;

    ms->mbps = -1;

    ms->parameters.tls_creds = g_strdup("");

    ms->parameters.tls_hostname = g_strdup("");

}


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

     GSource *src;

+    guint tag;
+
+
+
+    if (s->chr_add_watch == NULL) {

         return -ENOSYS;

guint qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,

                            GIOFunc func, void *user_data)

{

    GSource *src;

    guint tag;

    if (s->chr_add_watch == NULL) {

        return -ENOSYS;

    }

    src = s->chr_add_watch(s, cond);

    g_source_set_callback(src, (GSourceFunc)func, user_data, NULL);

    tag = g_source_attach(src, NULL);

    g_source_unref(src);

    return tag;

}


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

     __put_user(exception_resume_pc(regs), &sc->sc_pc);
+
+    regs->hflags &= ~MIPS_HFLAG_BMASK;
+
+
+
     __put_user(0, &sc->sc_regs[0]);

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

setup_sigcontext(CPUMIPSState *regs, struct target_sigcontext *sc)

{

    int err = 0;

    int i;

    __put_user(exception_resume_pc(regs), &sc->sc_pc);

    regs->hflags &= ~MIPS_HFLAG_BMASK;

    __put_user(0, &sc->sc_regs[0]);

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

        __put_user(regs->active_tc.gpr[i], &sc->sc_regs[i]);

    }

    __put_user(regs->active_tc.HI[0], &sc->sc_mdhi);

    __put_user(regs->active_tc.LO[0], &sc->sc_mdlo);

    /* Rather than checking for dsp existence, always copy.  The storage

       would just be garbage otherwise.  */

    __put_user(regs->active_tc.HI[1], &sc->sc_hi1);

    __put_user(regs->active_tc.HI[2], &sc->sc_hi2);

    __put_user(regs->active_tc.HI[3], &sc->sc_hi3);

    __put_user(regs->active_tc.LO[1], &sc->sc_lo1);

    __put_user(regs->active_tc.LO[2], &sc->sc_lo2);

    __put_user(regs->active_tc.LO[3], &sc->sc_lo3);

    {

        uint32_t dsp = cpu_rddsp(0x3ff, regs);

        __put_user(dsp, &sc->sc_dsp);

    }

    __put_user(1, &sc->sc_used_math);

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

        __put_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]);

    }

    return err;

}


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

 	/* Every channel has a 0x2000 ctrl register map.  */
+
+	return addr >> 13;

 }

static inline int fs_channel(target_phys_addr_t addr)

{

	/* Every channel has a 0x2000 ctrl register map.  */

	return addr >> 13;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+static hwaddr ppc_hash64_pte_raddr(ppc_slb_t *slb, ppc_hash_pte64_t pte,
+
+                                   target_ulong eaddr)
+
+{
+
+    hwaddr mask;

     int target_page_bits;

static hwaddr ppc_hash64_pte_raddr(ppc_slb_t *slb, ppc_hash_pte64_t pte,

                                   target_ulong eaddr)

{

    hwaddr mask;

    int target_page_bits;

    hwaddr rpn = pte.pte1 & HPTE64_R_RPN;

    /*

     * We support 4K, 64K and 16M now

     */

    target_page_bits = ppc_hash64_page_shift(slb);

    mask = (1ULL << target_page_bits) - 1;

    return (rpn & ~mask) | (eaddr & mask);

}


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

 {

+    MpegTSService *service;

static MpegTSService *mpegts_add_service(MpegTSWrite *ts, int sid,

                                         const char *provider_name,

                                         const char *name)

{

    MpegTSService *service;

    service = av_mallocz(sizeof(MpegTSService));

    if (!service)

        return NULL;

    service->pmt.pid       = ts->pmt_start_pid + ts->nb_services;

    service->sid           = sid;

    service->provider_name = av_strdup(provider_name);

    service->name          = av_strdup(name);

    service->pcr_pid       = 0x1fff;

    dynarray_add(&ts->services, &ts->nb_services, service);

    return service;

}


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

     ff_h264dsp_init(&h->h264dsp, 8, 1);
+
+    ff_h264_pred_init(&h->hpc, s->codec_id, 8, 1);
+
+
+
     h->dequant_coeff_pps= -1;

     s->unrestricted_mv=1;

static av_cold void common_init(H264Context *h){

    MpegEncContext * const s = &h->s;

    s->width = s->avctx->width;

    s->height = s->avctx->height;

    s->codec_id= s->avctx->codec->id;

    ff_h264dsp_init(&h->h264dsp, 8, 1);

    ff_h264_pred_init(&h->hpc, s->codec_id, 8, 1);

    h->dequant_coeff_pps= -1;

    s->unrestricted_mv=1;

    s->decode=1; //FIXME

    dsputil_init(&s->dsp, s->avctx); // needed so that idct permutation is known early

    memset(h->pps.scaling_matrix4, 16, 6*16*sizeof(uint8_t));

    memset(h->pps.scaling_matrix8, 16, 2*64*sizeof(uint8_t));

}


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

     QObject *obj = qobject_from_json("{'abc':32,}", NULL);

static void invalid_dict_comma(void)

{

    QObject *obj = qobject_from_json("{'abc':32,}", NULL);

    g_assert(obj == NULL);

}


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

     } else {

+        need_cmp = true;
+
+        tcg_out_cmp(s, ext, a, b, b_const);
+
+    }

static void tcg_out_brcond(TCGContext *s, TCGMemOp ext, TCGCond c, TCGArg a,

                           TCGArg b, bool b_const, int label)

{

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

    intptr_t offset;

    bool need_cmp;

    if (b_const && b == 0 && (c == TCG_COND_EQ || c == TCG_COND_NE)) {

        need_cmp = false;

    } else {

        need_cmp = true;

        tcg_out_cmp(s, ext, a, b, b_const);

    }

    if (!l->has_value) {

        tcg_out_reloc(s, s->code_ptr, R_AARCH64_CONDBR19, label, 0);

        offset = tcg_in32(s) >> 5;

    } else {

        offset = l->u.value_ptr - s->code_ptr;

        assert(offset == sextract64(offset, 0, 19));

    }

    if (need_cmp) {

        tcg_out_insn(s, 3202, B_C, c, offset);

    } else if (c == TCG_COND_EQ) {

        tcg_out_insn(s, 3201, CBZ, ext, a, offset);

    } else {

        tcg_out_insn(s, 3201, CBNZ, ext, a, offset);

    }

}


static int sse_mb(MpegEncContext *s){

    int w= 16;

    int h= 16;

    if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;

    if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;

    if(w==16 && h==16)

      if(s->avctx->mb_cmp == FF_CMP_NSSE){

        return  s->dsp.nsse[0](s, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16)

               +s->dsp.nsse[1](s, s->new_picture.f.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8)

               +s->dsp.nsse[1](s, s->new_picture.f.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8);

      }else{

        return  s->dsp.sse[0](NULL, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16)

               +s->dsp.sse[1](NULL, s->new_picture.f.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8)

               +s->dsp.sse[1](NULL, s->new_picture.f.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8);

      }

    else

        return  sse(s, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize)

               +sse(s, s->new_picture.f.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], w>>1, h>>1, s->uvlinesize)

               +sse(s, s->new_picture.f.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], w>>1, h>>1, s->uvlinesize);

}


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

 {

+    int saved_vm_running  = vm_running;

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

static void do_loadvm(Monitor *mon, const QDict *qdict)

{

    int saved_vm_running  = vm_running;

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

    vm_stop(0);

    if (load_vmstate(name) >= 0 && saved_vm_running)

        vm_start();

}


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

     offset = q->qh.bufptr[0] & ~QTD_BUFPTR_MASK;

+    qemu_sglist_init(&q->sgl, 5);
+
+
+
+    while (bytes > 0) {

         if (cpage > 4) {

static int ehci_init_transfer(EHCIQueue *q)

{

    uint32_t cpage, offset, bytes, plen;

    target_phys_addr_t page;

    cpage  = get_field(q->qh.token, QTD_TOKEN_CPAGE);

    bytes  = get_field(q->qh.token, QTD_TOKEN_TBYTES);

    offset = q->qh.bufptr[0] & ~QTD_BUFPTR_MASK;

    qemu_sglist_init(&q->sgl, 5);

    while (bytes > 0) {

        if (cpage > 4) {

            fprintf(stderr, "cpage out of range (%d)\n", cpage);

            return USB_RET_PROCERR;

        }

        page  = q->qh.bufptr[cpage] & QTD_BUFPTR_MASK;

        page += offset;

        plen  = bytes;

        if (plen > 4096 - offset) {

            plen = 4096 - offset;

            offset = 0;

            cpage++;

        }

        qemu_sglist_add(&q->sgl, page, plen);

        bytes -= plen;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                       const char *path, const char *name)

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

     if (xops) {

int v9fs_remove_xattr(FsContext *ctx,

                      const char *path, const char *name)

{

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

    if (xops) {

        return xops->removexattr(ctx, path, name);

    }

    errno = -EOPNOTSUPP;

    return -1;

}


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

+    for (i = 1; i < 3; i++) {
+
+        EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
+
+        event_notifier_init(&data.e, false);

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

static void test_aio_external_client(void)

{

    int i, j;

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

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

        event_notifier_init(&data.e, false);

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

        event_notifier_set(&data.e);

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

            aio_disable_external(ctx);

        }

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

            assert(!aio_poll(ctx, false));

            assert(event_notifier_test_and_clear(&data.e));

            event_notifier_set(&data.e);

            aio_enable_external(ctx);

        }

        assert(aio_poll(ctx, false));

        event_notifier_cleanup(&data.e);

    }

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
     int is_alpha = (inlink == ctx->inputs[1]);

     struct FFBufQueue *queue =
+
         (is_alpha ? &merge->queue_alpha : &merge->queue_main);

     ff_bufqueue_add(ctx, queue, buf);

static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)

{

    AVFilterContext *ctx = inlink->dst;

    AlphaMergeContext *merge = ctx->priv;

    int is_alpha = (inlink == ctx->inputs[1]);

    struct FFBufQueue *queue =

        (is_alpha ? &merge->queue_alpha : &merge->queue_main);

    ff_bufqueue_add(ctx, queue, buf);

    while (1) {

        AVFilterBufferRef *main_buf, *alpha_buf;

        if (!ff_bufqueue_peek(&merge->queue_main, 0) ||

            !ff_bufqueue_peek(&merge->queue_alpha, 0)) break;

        main_buf = ff_bufqueue_get(&merge->queue_main);

        alpha_buf = ff_bufqueue_get(&merge->queue_alpha);

        merge->frame_requested = 0;

        draw_frame(ctx, main_buf, alpha_buf);

        ff_filter_frame(ctx->outputs[0], avfilter_ref_buffer(main_buf, ~0));

        avfilter_unref_buffer(alpha_buf);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static inline TCGv load_cpu_offset(int offset)
+
 {

     TCGv tmp = new_tmp();

static inline TCGv load_cpu_offset(int offset)

{

    TCGv tmp = new_tmp();

    tcg_gen_ld_i32(tmp, cpu_env, offset);

    return tmp;

}


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

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

                                unsigned int max_rsp_len)

static void set_sensor_type(IPMIBmcSim *ibs,

                               uint8_t *cmd, unsigned int cmd_len,

                               uint8_t *rsp, unsigned int *rsp_len,

                               unsigned int max_rsp_len)

{

    IPMISensor *sens;

    IPMI_CHECK_CMD_LEN(5);

    if ((cmd[2] > MAX_SENSORS) ||

            !IPMI_SENSOR_GET_PRESENT(ibs->sensors + cmd[2])) {

        rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT;

        return;

    }

    sens = ibs->sensors + cmd[2];

    sens->sensor_type = cmd[3];

    sens->evt_reading_type_code = cmd[4] & 0x7f;

}


static void ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){

    int i;

    for(i=16; i<16+8; i++){

        if(nnzc[ scan8[i] ] || block[i*16])

            ff_h264_idct_add_mmx    (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);

    }

}


static int32_t tag_tree_size(uint16_t w, uint16_t h)

{

    uint32_t res = 0;

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

        res += w * h;

        if (res + 1 >= INT32_MAX)

            return -1;

        w = (w + 1) >> 1;

        h = (h + 1) >> 1;

    }

    return (int32_t)(res + 1);

}


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

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

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

{

    pixel *dest = (pixel *)dest_;

    int i;

    line_size /= sizeof(pixel);

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

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

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

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

}


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

         offset = offset >> 9;

+        offset_end = (offset_end + 511) >> 9;
+
+        bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
+
+                   offset_end - offset);

     }

static void pflash_update(pflash_t *pfl, int offset,

                          int size)

{

    int offset_end;

    if (pfl->bs) {

        offset_end = offset + size;

        /* round to sectors */

        offset = offset >> 9;

        offset_end = (offset_end + 511) >> 9;

        bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),

                   offset_end - offset);

    }

}


--- a/source.c
+++ b/source.c
@@ -7,13 +7,13 @@
     int r, e;

     siginfo_t siginfo;
+
+    sigset_t waitset;
+
+
+
+    ts.tv_sec = timeout / 1000;
+
     ts.tv_nsec = (timeout % 1000) * 1000000;

static void qemu_kvm_eat_signal(CPUState *env, int timeout)

{

    struct timespec ts;

    int r, e;

    siginfo_t siginfo;

    sigset_t waitset;

    ts.tv_sec = timeout / 1000;

    ts.tv_nsec = (timeout % 1000) * 1000000;

    sigemptyset(&waitset);

    sigaddset(&waitset, SIG_IPI);

    qemu_mutex_unlock(&qemu_global_mutex);

    r = sigtimedwait(&waitset, &siginfo, &ts);

    e = errno;

    qemu_mutex_lock(&qemu_global_mutex);

    if (r == -1 && !(e == EAGAIN || e == EINTR)) {

        fprintf(stderr, "sigtimedwait: %s\n", strerror(e));

        exit(1);

    }

}


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

+    if (is_first_init) {
+
+        key_timer = qemu_new_timer(vm_clock, release_keys, NULL);
+
+        if (!key_timer)

             return;

void monitor_init(CharDriverState *hd, int show_banner)

{

    int i;

    if (is_first_init) {

        key_timer = qemu_new_timer(vm_clock, release_keys, NULL);

        if (!key_timer)

            return;

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

            monitor_hd[i] = NULL;

        }

        is_first_init = 0;

    }

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

        if (monitor_hd[i] == NULL) {

            monitor_hd[i] = hd;

            break;

        }

    }

    hide_banner = !show_banner;

    qemu_chr_add_handlers(hd, term_can_read, term_read, term_event, NULL);

    readline_start("", 0, monitor_handle_command1, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,16 +1,16 @@
+static struct iovec *adjust_sg(struct iovec *sg, int len, int *iovcnt)
+
+{
+
+    while (len && *iovcnt) {
+
         if (len < sg->iov_len) {
+
+            sg->iov_len -= len;
+
             sg->iov_base += len;

+            len = 0;

         } else {

static struct iovec *adjust_sg(struct iovec *sg, int len, int *iovcnt)

{

    while (len && *iovcnt) {

        if (len < sg->iov_len) {

            sg->iov_len -= len;

            sg->iov_base += len;

            len = 0;

        } else {

            len -= sg->iov_len;

            sg++;

            *iovcnt -= 1;

        }

    }

    return sg;

}


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

     int cb_width  = s->codeblock[b->level + (b->orientation != subband_ll)].width;

+    int cb_height = s->codeblock[b->level + (b->orientation != subband_ll)].height;

     int blockcnt_one = (cb_width + cb_height) == 2;
+

     if (!b->length)

static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b, int is_arith)

{

    int cb_x, cb_y, left, right, top, bottom;

    DiracArith c;

    GetBitContext gb;

    int cb_width  = s->codeblock[b->level + (b->orientation != subband_ll)].width;

    int cb_height = s->codeblock[b->level + (b->orientation != subband_ll)].height;

    int blockcnt_one = (cb_width + cb_height) == 2;

    if (!b->length)

        return;

    init_get_bits8(&gb, b->coeff_data, b->length);

    if (is_arith)

        ff_dirac_init_arith_decoder(&c, &gb, b->length);

    top = 0;

    for (cb_y = 0; cb_y < cb_height; cb_y++) {

        bottom = (b->height * (cb_y+1)) / cb_height;

        left = 0;

        for (cb_x = 0; cb_x < cb_width; cb_x++) {

            right = (b->width * (cb_x+1)) / cb_width;

            codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith);

            left = right;

        }

        top = bottom;

    }

    if (b->orientation == subband_ll && s->num_refs == 0)

        intra_dc_prediction(b);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
+
                 hwaddr base,

                 qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,

static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,

                hwaddr base,

                qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,

                omap_clk clk)

{

    struct omap_mpuio_s *s = (struct omap_mpuio_s *)

            g_malloc0(sizeof(struct omap_mpuio_s));

    s->irq = gpio_int;

    s->kbd_irq = kbd_int;

    s->wakeup = wakeup;

    s->in = qemu_allocate_irqs(omap_mpuio_set, s, 16);

    omap_mpuio_reset(s);

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

                          "omap-mpuio", 0x800);

    memory_region_add_subregion(memory, base, &s->iomem);

    omap_clk_adduser(clk, qemu_allocate_irq(omap_mpuio_onoff, s, 0));

    return s;

}


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

         int val=1<<18;

+        int j;

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

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

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

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

{

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

    int i;

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

    {

        int val=1<<18;

        int j;

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

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

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

    }

    if (uDest)

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

        {

            int u=1<<18;

            int v=1<<18;

            int j;

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

            {

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

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

            }

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

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

        }

}


--- a/source.c
+++ b/source.c
@@ -1,22 +1,22 @@
+static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
+
+{
+
+    AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
+
+    AVFilterContext *ctx = inlink->dst;
+
+    OverlayContext *over = ctx->priv;
+
+    av_unused AVFilterLink *outlink = ctx->outputs[0];
+
+

     inlink->dst->outputs[0]->out_buf = outpicref;
+
+    outpicref->pts = av_rescale_q(outpicref->pts, ctx->inputs[MAIN]->time_base,
+
+                                  ctx->outputs[0]->time_base);

static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)

{

    AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);

    AVFilterContext *ctx = inlink->dst;

    OverlayContext *over = ctx->priv;

    av_unused AVFilterLink *outlink = ctx->outputs[0];

    inlink->dst->outputs[0]->out_buf = outpicref;

    outpicref->pts = av_rescale_q(outpicref->pts, ctx->inputs[MAIN]->time_base,

                                  ctx->outputs[0]->time_base);

    if (!over->overpicref || over->overpicref->pts < outpicref->pts) {

        if (!over->overpicref_next)

            avfilter_request_frame(ctx->inputs[OVERLAY]);

        if (over->overpicref && over->overpicref_next &&

            over->overpicref_next->pts <= outpicref->pts) {

            avfilter_unref_buffer(over->overpicref);

            over->overpicref = over->overpicref_next;

            over->overpicref_next = NULL;

        }

    }

    av_dlog(ctx, "main_pts:%s main_pts_time:%s",

            av_ts2str(outpicref->pts), av_ts2timestr(outpicref->pts, &outlink->time_base));

    if (over->overpicref)

        av_dlog(ctx, " over_pts:%s over_pts_time:%s",

                av_ts2str(over->overpicref->pts), av_ts2timestr(over->overpicref->pts, &outlink->time_base));

    av_dlog(ctx, "\n");

    avfilter_start_frame(inlink->dst->outputs[0], outpicref);

}


--- a/source.c
+++ b/source.c
@@ -26,11 +26,11 @@
                 err = s->ctx.exops.get_st_gen(&s->ctx, path, st_mode,

                                               &v9stat->st_gen);
+
+                if (err < 0) {
+
+                    err = -errno;
+

             });

int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,

                   V9fsStatDotl *v9stat)

{

    int err = 0;

    V9fsState *s = pdu->s;

    if (v9fs_request_cancelled(pdu)) {

        return -EINTR;

    if (s->ctx.exops.get_st_gen) {

        v9fs_path_read_lock(s);

        v9fs_co_run_in_worker(

            {

                err = s->ctx.exops.get_st_gen(&s->ctx, path, st_mode,

                                              &v9stat->st_gen);

                if (err < 0) {

                    err = -errno;

            });

        v9fs_path_unlock(s);

    return err;


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

+{

     DeviceClass *dc = DEVICE_CLASS(klass);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    dc->no_user = 1;

    dc->reset   = vapic_reset;

    dc->vmsd    = &vmstate_vapic;

    dc->realize = vapic_realize;

}


--- a/source.c
+++ b/source.c
@@ -5,8 +5,8 @@
     const char *str = "   xxxx  \t abc";

     char f = 'X';
+
+    const char *endptr = &f;

     uint64_t res = 999;

static void test_qemu_strtoull_invalid(void)

{

    const char *str = "   xxxx  \t abc";

    char f = 'X';

    const char *endptr = &f;

    uint64_t res = 999;

    int err;

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

    g_assert_cmpint(err, ==, 0);

    g_assert(endptr == str);

}


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

     R3DContext *r3d = s->priv_data;

+    int frame_num;

static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)

{

    AVStream *st = s->streams[0]; // video stream

    R3DContext *r3d = s->priv_data;

    int frame_num;

    if (!st->codec->time_base.num || !st->time_base.den)

        return -1;

    frame_num = sample_time*st->codec->time_base.den/

        ((int64_t)st->codec->time_base.num*st->time_base.den);

    av_dlog(s, "seek frame num %d timestamp %"PRId64"\n",

            frame_num, sample_time);

    if (frame_num < r3d->video_offsets_count) {

        avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET);

    } else {

        av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num);

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     QIOChannelSocket *sioc = qio_channel_socket_new();

     struct SocketConnectData *data = g_new0(struct SocketConnectData, 1);
+
+
+
+    data->s = s;
+
     if (saddr->type == SOCKET_ADDRESS_KIND_INET) {

         data->hostname = g_strdup(saddr->u.inet.data->host);

static void socket_start_outgoing_migration(MigrationState *s,

                                            SocketAddress *saddr,

                                            Error **errp)

{

    QIOChannelSocket *sioc = qio_channel_socket_new();

    struct SocketConnectData *data = g_new0(struct SocketConnectData, 1);

    data->s = s;

    if (saddr->type == SOCKET_ADDRESS_KIND_INET) {

        data->hostname = g_strdup(saddr->u.inet.data->host);

    }

    qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-outgoing");

    qio_channel_socket_connect_async(sioc,

                                     saddr,

                                     socket_outgoing_migration,

                                     data,

                                     socket_connect_data_free);

    qapi_free_SocketAddress(saddr);

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     NBDRequest request = {

         .type = NBD_CMD_TRIM,
+
         .from = offset,

         .len = count,

int nbd_client_co_pdiscard(BlockDriverState *bs, int64_t offset, int count)

{

    NBDClientSession *client = nbd_get_client_session(bs);

    NBDRequest request = {

        .type = NBD_CMD_TRIM,

        .from = offset,

        .len = count,

    };

    NBDReply reply;

    ssize_t ret;

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

        return 0;

    }

    nbd_coroutine_start(client, &request);

    ret = nbd_co_send_request(bs, &request, NULL);

    if (ret < 0) {

        reply.error = -ret;

    } else {

        nbd_co_receive_reply(client, &request, &reply, NULL);

    }

    nbd_coroutine_end(bs, &request);

    return -reply.error;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     tm->tm_min = qemu_get_be16(f);

     tm->tm_hour = qemu_get_be16(f);
+
+    tm->tm_mday = qemu_get_be16(f);
+
     tm->tm_min = qemu_get_be16(f);

     tm->tm_year = qemu_get_be16(f);

static void tm_get(QEMUFile *f, struct tm *tm) {

    tm->tm_sec = qemu_get_be16(f);

    tm->tm_min = qemu_get_be16(f);

    tm->tm_hour = qemu_get_be16(f);

    tm->tm_mday = qemu_get_be16(f);

    tm->tm_min = qemu_get_be16(f);

    tm->tm_year = qemu_get_be16(f);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void gen_check_cpenable(DisasContext *dc, unsigned cp)

 {

static void gen_check_cpenable(DisasContext *dc, unsigned cp)

{

    if (option_enabled(dc, XTENSA_OPTION_COPROCESSOR) &&

            !(dc->cpenable & (1 << cp))) {

        gen_exception_cause(dc, COPROCESSOR0_DISABLED + cp);

        dc->is_jmp = DISAS_UPDATE;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void decode_rowskip(uint8_t* plane, int width, int height, int stride, VC9Context *v){

+    int x, y;

     GetBitContext *gb = &v->s.gb;

static void decode_rowskip(uint8_t* plane, int width, int height, int stride, VC9Context *v){

    int x, y;

    GetBitContext *gb = &v->s.gb;

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

        if (!get_bits(gb, 1)) //rowskip

            memset(plane, 0, width);

        else

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

                plane[x] = get_bits(gb, 1);

        plane += stride;

    }

}


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

+    av_freep(&ist->hwaccel_ctx);
+
+    av_freep(&s->hwaccel_context);
+
+}

static void dxva2_uninit(AVCodecContext *s)

{

    InputStream  *ist = s->opaque;

    DXVA2Context *ctx = ist->hwaccel_ctx;

    ist->hwaccel_uninit        = NULL;

    ist->hwaccel_get_buffer    = NULL;

    ist->hwaccel_retrieve_data = NULL;

    if (ctx->decoder_service)

        IDirectXVideoDecoderService_Release(ctx->decoder_service);

    av_buffer_unref(&ctx->hw_frames_ctx);

    av_buffer_unref(&ctx->hw_device_ctx);

    av_frame_free(&ctx->tmp_frame);

    av_freep(&ist->hwaccel_ctx);

    av_freep(&s->hwaccel_context);

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     if (n < VIRTIO_PCI_QUEUE_MAX && vdev->vq[n].vring.desc) {

         trace_virtio_queue_notify(vdev, n, &vdev->vq[n]);
+
+        vdev->vq[n].handle_output(vdev, &vdev->vq[n]);
+
     }

 }

void virtio_queue_notify(VirtIODevice *vdev, int n)

{

    if (n < VIRTIO_PCI_QUEUE_MAX && vdev->vq[n].vring.desc) {

        trace_virtio_queue_notify(vdev, n, &vdev->vq[n]);

        vdev->vq[n].handle_output(vdev, &vdev->vq[n]);

    }

}


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

         return -1;
+
+    }

     p += sizeof(ff_asf_guid) + 14;

static int rtp_asf_fix_header(uint8_t *buf, int len)

{

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

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

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

        return -1;

    }

    p += sizeof(ff_asf_guid) + 14;

    do {

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

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

            if (chunksize > end - p)

                return -1;

            p += chunksize;

            continue;

        }

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

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

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

            /* and set that to zero */

            AV_WL32(p, 0);

            return 0;

        }

        break;

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

    return -1;

}


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

     /* return the priority of the current pending interrupt,

+     * or NVIC_NOEXC_PRIO if no interrupt is pending
+
+     */

     return s->vectpending ? s->vectors[s->vectpending].prio : NVIC_NOEXC_PRIO;

static int nvic_pending_prio(NVICState *s)

{

    /* return the priority of the current pending interrupt,

     * or NVIC_NOEXC_PRIO if no interrupt is pending

     */

    return s->vectpending ? s->vectors[s->vectpending].prio : NVIC_NOEXC_PRIO;

}


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

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


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int nbd_receive_request(int csock, struct nbd_request *request)

 {

static int 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
@@ -7,5 +7,5 @@
     GICState *s = (GICState *)opaque;

     return gic_cpu_read(s, gic_get_current_cpu(s), addr);
+
+}

static uint64_t gic_thiscpu_read(void *opaque, target_phys_addr_t addr,

                                 unsigned size)

{

    GICState *s = (GICState *)opaque;

    return gic_cpu_read(s, gic_get_current_cpu(s), addr);

}


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

 {

+    StringOutputVisitor *sov;

     StringInputVisitor *siv;

int object_property_get_enum(Object *obj, const char *name,

                             const char *strings[], Error **errp)

{

    StringOutputVisitor *sov;

    StringInputVisitor *siv;

    int ret;

    sov = string_output_visitor_new(false);

    object_property_get(obj, string_output_get_visitor(sov), name, errp);

    siv = string_input_visitor_new(string_output_get_string(sov));

    string_output_visitor_cleanup(sov);

    visit_type_enum(string_input_get_visitor(siv),

                    &ret, strings, NULL, name, errp);

    string_input_visitor_cleanup(siv);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void gen_ove_ov(DisasContext *dc, TCGv ov)
+
 {

     gen_helper_ove(cpu_env, ov);

static void gen_ove_ov(DisasContext *dc, TCGv ov)

{

    gen_helper_ove(cpu_env, ov);

}


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

     if (cc.mask != -1) {
+
+        tcg_gen_andi_tl(cpu_T[0], cc.reg, cc.mask);
+
+        cc.reg = cpu_T[0];
+
     }

     if (cc.use_reg2) {

static inline void gen_jcc1_noeob(DisasContext *s, int b, int l1)

{

    CCPrepare cc = gen_prepare_cc(s, b, cpu_T[0]);

    if (cc.mask != -1) {

        tcg_gen_andi_tl(cpu_T[0], cc.reg, cc.mask);

        cc.reg = cpu_T[0];

    }

    if (cc.use_reg2) {

        tcg_gen_brcond_tl(cc.cond, cc.reg, cc.reg2, l1);

    } else {

        tcg_gen_brcondi_tl(cc.cond, cc.reg, cc.imm, l1);

    }

}


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

     mbr_t* real_mbr=(mbr_t*)s->first_sectors;

+    partition_t* partition = &(real_mbr->partition[0]);
+
+    int lba;

static void init_mbr(BDRVVVFATState* s)

{

    /* TODO: if the files mbr.img and bootsect.img exist, use them */

    mbr_t* real_mbr=(mbr_t*)s->first_sectors;

    partition_t* partition = &(real_mbr->partition[0]);

    int lba;

    memset(s->first_sectors,0,512);

    /* Win NT Disk Signature */

    real_mbr->nt_id= cpu_to_le32(0xbe1afdfa);

    partition->attributes=0x80; /* bootable */

    /* LBA is used when partition is outside the CHS geometry */

    lba = sector2CHS(s->bs, &partition->start_CHS, s->first_sectors_number-1);

    lba|= sector2CHS(s->bs, &partition->end_CHS,   s->sector_count);

    /*LBA partitions are identified only by start/length_sector_long not by CHS*/

    partition->start_sector_long =cpu_to_le32(s->first_sectors_number-1);

    partition->length_sector_long=cpu_to_le32(s->sector_count - s->first_sectors_number+1);

    /* FAT12/FAT16/FAT32 */

    /* DOS uses different types when partition is LBA,

       probably to prevent older versions from using CHS on them */

    partition->fs_type= s->fat_type==12 ? 0x1:

                        s->fat_type==16 ? (lba?0xe:0x06):

                         /*fat_tyoe==32*/ (lba?0xc:0x0b);

    real_mbr->magic[0]=0x55; real_mbr->magic[1]=0xaa;

}


static void uhci_reset(void *opaque)

{

    UHCIState *s = opaque;

    uint8_t *pci_conf;

    int i;

    UHCIPort *port;

    DPRINTF("uhci: full reset\n");

    pci_conf = s->dev.config;

    pci_conf[0x6a] = 0x01; /* usb clock */

    pci_conf[0x6b] = 0x00;

    s->cmd = 0;

    s->status = 0;

    s->status2 = 0;

    s->intr = 0;

    s->fl_base_addr = 0;

    s->sof_timing = 64;

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

        port = &s->ports[i];

        port->ctrl = 0x0080;

        if (port->port.dev) {

            usb_attach(&port->port, port->port.dev);

        }

    }

    uhci_async_cancel_all(s);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static void pci_pcnet_cleanup(NetClientState *nc)
+
 {

     PCNetState *d = qemu_get_nic_opaque(nc);

static void pci_pcnet_cleanup(NetClientState *nc)

{

    PCNetState *d = qemu_get_nic_opaque(nc);

    pcnet_common_cleanup(d);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size)

+{
+
+    uint16_t crc;
+
+

     if (!crc_init) {

static uint16_t mlp_checksum16(const uint8_t *buf, unsigned int buf_size)

{

    uint16_t crc;

    if (!crc_init) {

        av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));

        crc_init = 1;

    }

    crc = av_crc(crc_2D, 0, buf, buf_size - 2);

    crc ^= AV_RL16(buf + buf_size - 2);

    return crc;

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
                 if (i > s->coded_fragment_list_index)

                     return -1;
+
+
+
+                if (s->all_fragments[s->coded_fragment_list[i]].qpi == qpi) {
+
                     s->all_fragments[s->coded_fragment_list[i]].qpi += bit;

                     j++;

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

{

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

    int num_blocks = s->coded_fragment_list_index;

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

        i = blocks_decoded = num_blocks_at_qpi = 0;

        bit = get_bits1(gb);

        do {

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

            if (run_length == 34)

                run_length += get_bits(gb, 12);

            blocks_decoded += run_length;

            if (!bit)

                num_blocks_at_qpi += run_length;

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

                if (i > s->coded_fragment_list_index)

                    return -1;

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

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

                    j++;

                }

            }

            if (run_length == 4129)

                bit = get_bits1(gb);

            else

                bit ^= 1;

        } while (blocks_decoded < num_blocks);

        num_blocks -= num_blocks_at_qpi;

    }

    return 0;

}


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

     return virtio_is_big_endian(vdev);

+#endif
+
+#else
+
+    return false;

 #endif

static inline bool vhost_needs_vring_endian(VirtIODevice *vdev)

{

    if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {

        return false;

    }

#ifdef TARGET_IS_BIENDIAN

#ifdef HOST_WORDS_BIGENDIAN

    return !virtio_is_big_endian(vdev);

#else

    return virtio_is_big_endian(vdev);

#endif

#else

    return false;

#endif

}


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

 {

+    uint32_t config_addr = rtas_ld(args, 0);
+
+    uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);
+
+    unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3);

     int ndev;

static void rtas_ibm_query_interrupt_source_number(sPAPREnvironment *spapr,

                                                   uint32_t token,

                                                   uint32_t nargs,

                                                   target_ulong args,

                                                   uint32_t nret,

                                                   target_ulong rets)

{

    uint32_t config_addr = rtas_ld(args, 0);

    uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);

    unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3);

    int ndev;

    sPAPRPHBState *phb = NULL;

    /* Fins sPAPRPHBState */

    phb = find_phb(spapr, buid);

    if (!phb) {

        rtas_st(rets, 0, -3); /* Parameter error */

        return;

    }

    /* Find device descriptor and start IRQ */

    ndev = spapr_msicfg_find(phb, config_addr, false);

    if (ndev < 0) {

        trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr);

        rtas_st(rets, 0, -1); /* Hardware error */

        return;

    }

    intr_src_num = phb->msi_table[ndev].irq + ioa_intr_num;

    trace_spapr_pci_rtas_ibm_query_interrupt_source_number(ioa_intr_num,

                                                           intr_src_num);

    rtas_st(rets, 0, 0);

    rtas_st(rets, 1, intr_src_num);

    rtas_st(rets, 2, 1);/* 0 == level; 1 == edge */

}


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

         }

+        v9fs_memrewind(req, 7);
+
+    }
+
+

     g_assert_cmpint(hdr.size, >=, 7);

static void v9fs_req_recv(P9Req *req, uint8_t id)

{

    QVirtIO9P *v9p = req->v9p;

    P9Hdr hdr;

    int i;

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

        qvirtio_wait_queue_isr(v9p->dev, v9p->vq, 1000 * 1000);

        v9fs_memread(req, &hdr, 7);

        le32_to_cpus(&hdr.size);

        le16_to_cpus(&hdr.tag);

        if (hdr.size >= 7) {

            break;

        }

        v9fs_memrewind(req, 7);

    }

    g_assert_cmpint(hdr.size, >=, 7);

    g_assert_cmpint(hdr.size, <=, P9_MAX_SIZE);

    g_assert_cmpint(hdr.tag, ==, req->tag);

    if (hdr.id != id) {

        g_printerr("Received response %d (%s) instead of %d (%s)\n",

                   hdr.id, rmessage_name(hdr.id), id, rmessage_name(id));

        if (hdr.id == P9_RLERROR) {

            uint32_t err;

            v9fs_uint32_read(req, &err);

            g_printerr("Rlerror has errno %d (%s)\n", err, strerror(err));

        }

    }

    g_assert_cmpint(hdr.id, ==, id);

}


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

         return 0;

+
+
+    return float64_to_int32_round_to_zero(u.d, &env->vec_status);
+
+}

uint32_t helper_efdctsiz (uint64_t val)

{

    CPU_DoubleU u;

    u.ll = val;

    /* NaN are not treated the same way IEEE 754 does */

    if (unlikely(float64_is_nan(u.d)))

        return 0;

    return float64_to_int32_round_to_zero(u.d, &env->vec_status);

}


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

         u.q = QT0;

+        cpu_stq_user(env, addr, u.ll.upper);
+
         cpu_stq_user(env, addr + 8, u.ll.lower);

         break;

void helper_stqf(CPUSPARCState *env, target_ulong addr, int mem_idx)

{

    /* XXX add 128 bit store */

    CPU_QuadU u;

    helper_check_align(env, addr, 7);

#if !defined(CONFIG_USER_ONLY)

    switch (mem_idx) {

    case MMU_USER_IDX:

        u.q = QT0;

        cpu_stq_user(env, addr, u.ll.upper);

        cpu_stq_user(env, addr + 8, u.ll.lower);

        break;

    case MMU_KERNEL_IDX:

        u.q = QT0;

        cpu_stq_kernel(env, addr, u.ll.upper);

        cpu_stq_kernel(env, addr + 8, u.ll.lower);

        break;

#ifdef TARGET_SPARC64

    case MMU_HYPV_IDX:

        u.q = QT0;

        cpu_stq_hypv(env, addr, u.ll.upper);

        cpu_stq_hypv(env, addr + 8, u.ll.lower);

        break;

#endif

    default:

        DPRINTF_MMU("helper_stqf: need to check MMU idx %d\n", mem_idx);

        break;

    }

#else

    u.q = QT0;

    stq_raw(address_mask(env, addr), u.ll.upper);

    stq_raw(address_mask(env, addr + 8), u.ll.lower);

#endif

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                            const void *in,

                            void *out,
+
                            size_t len,

                            Error **errp)

int qcrypto_cipher_decrypt(QCryptoCipher *cipher,

                           const void *in,

                           void *out,

                           size_t len,

                           Error **errp)

{

    QCryptoCipherNettle *ctx = cipher->opaque;

    switch (cipher->mode) {

    case QCRYPTO_CIPHER_MODE_ECB:

        ctx->alg_decrypt(ctx->ctx_decrypt ? ctx->ctx_decrypt : ctx->ctx_encrypt,

                         len, out, in);

        break;

    case QCRYPTO_CIPHER_MODE_CBC:

        cbc_decrypt(ctx->ctx_decrypt ? ctx->ctx_decrypt : ctx->ctx_encrypt,

                    ctx->alg_decrypt, ctx->niv, ctx->iv,

                    len, out, in);

        break;

    default:

        error_setg(errp, "Unsupported cipher algorithm %d",

                   cipher->alg);

        return -1;

    }

    return 0;

}


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

     return mknod(rpath(ctx, path), mode, dev);
+
 }

static int local_mknod(FsContext *ctx, const char *path, mode_t mode, dev_t dev)

{

    return mknod(rpath(ctx, path), mode, dev);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static inline int32_t mipsdsp_sat_add_i32(int32_t a, int32_t b,

                                           CPUMIPSState *env)
+
+{

     int32_t tempI;

static inline int32_t mipsdsp_sat_add_i32(int32_t a, int32_t b,

                                          CPUMIPSState *env)

{

    int32_t tempI;

    tempI = a + b;

    if (MIPSDSP_OVERFLOW(a, b, tempI, 0x80000000)) {

        if (a > 0) {

            tempI = 0x7FFFFFFF;

        } else {

            tempI = 0x80000000;

        }

        set_DSPControl_overflow_flag(1, 20, env);

    }

    return tempI;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void fw_cfg_mem_realize(DeviceState *dev, Error **errp)

 {
+
+    FWCfgMemState *s = FW_CFG_MEM(dev);
+
+    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+

     memory_region_init_io(&s->ctl_iomem, OBJECT(s), &fw_cfg_ctl_mem_ops,

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

{

    FWCfgMemState *s = FW_CFG_MEM(dev);

    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);

    memory_region_init_io(&s->ctl_iomem, OBJECT(s), &fw_cfg_ctl_mem_ops,

                          FW_CFG(s), "fwcfg.ctl", FW_CFG_SIZE);

    sysbus_init_mmio(sbd, &s->ctl_iomem);

    memory_region_init_io(&s->data_iomem, OBJECT(s), &fw_cfg_data_mem_ops,

                          FW_CFG(s), "fwcfg.data",

                          fw_cfg_data_mem_ops.valid.max_access_size);

    sysbus_init_mmio(sbd, &s->data_iomem);

}


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

 {

+#if defined(CONFIG_USER_ONLY)
+
+    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
+
+#else

     TCGv t0;

static void gen_tlbsx_40x(DisasContext *ctx)

{

#if defined(CONFIG_USER_ONLY)

    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

#else

    TCGv t0;

    if (unlikely(ctx->pr)) {

        gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

        return;

    }

    t0 = tcg_temp_new();

    gen_addr_reg_index(ctx, t0);

    gen_helper_4xx_tlbsx(cpu_gpr[rD(ctx->opcode)], cpu_env, t0);

    tcg_temp_free(t0);

    if (Rc(ctx->opcode)) {

        int l1 = gen_new_label();

        tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so);

        tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rD(ctx->opcode)], -1, l1);

        tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 0x02);

        gen_set_label(l1);

    }

#endif

}


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

     /* emulate byte register */
+
+    valid_emu_mask = reg->emu_mask & valid_mask;
+
+    *value = XEN_PT_MERGE_VALUE(*value, cfg_entry->data, ~valid_emu_mask);
+

     return 0;

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

                                uint8_t *value, uint8_t valid_mask)

{

    XenPTRegInfo *reg = cfg_entry->reg;

    uint8_t valid_emu_mask = 0;

    /* emulate byte register */

    valid_emu_mask = reg->emu_mask & valid_mask;

    *value = XEN_PT_MERGE_VALUE(*value, cfg_entry->data, ~valid_emu_mask);

    return 0;

}


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

 {

+    DeviceState *dev;

     SysBusDevice *s;

void esp_init(target_phys_addr_t espaddr, int it_shift,

              espdma_memory_read_write dma_memory_read,

              espdma_memory_read_write dma_memory_write,

              void *dma_opaque, qemu_irq irq, qemu_irq *reset)

{

    DeviceState *dev;

    SysBusDevice *s;

    ESPState *esp;

    dev = qdev_create(NULL, "esp");

    esp = DO_UPCAST(ESPState, busdev.qdev, dev);

    esp->dma_memory_read = dma_memory_read;

    esp->dma_memory_write = dma_memory_write;

    esp->dma_opaque = dma_opaque;

    esp->it_shift = it_shift;

    qdev_init(dev);

    s = sysbus_from_qdev(dev);

    sysbus_connect_irq(s, 0, irq);

    sysbus_mmio_map(s, 0, espaddr);

    *reset = qdev_get_gpio_in(dev, 0);

}


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

     v = string_input_visitor_new(str);

+    visit_type_uint16List(v, NULL, list, errp);
+
+
+
+    g_free(str);

     visit_free(v);

void object_property_get_uint16List(Object *obj, const char *name,

                                    uint16List **list, Error **errp)

{

    Error *err = NULL;

    StringOutputVisitor *ov;

    Visitor *v;

    char *str;

    ov = string_output_visitor_new(false);

    object_property_get(obj, string_output_get_visitor(ov),

                        name, &err);

    if (err) {

        error_propagate(errp, err);

        goto out;

    }

    str = string_output_get_string(ov);

    v = string_input_visitor_new(str);

    visit_type_uint16List(v, NULL, list, errp);

    g_free(str);

    visit_free(v);

out:

    string_output_visitor_cleanup(ov);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 long do_rt_sigreturn(CPUARMState *env)
+
 {

     struct target_rt_sigframe *frame;

long do_rt_sigreturn(CPUARMState *env)

{

    struct target_rt_sigframe *frame;

    abi_ulong frame_addr = env->xregs[31];

    if (frame_addr & 15) {

        goto badframe;

    }

    if  (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {

        goto badframe;

    }

    if (target_restore_sigframe(env, frame)) {

        goto badframe;

    }

    if (do_sigaltstack(frame_addr +

            offsetof(struct target_rt_sigframe, uc.tuc_stack),

            0, get_sp_from_cpustate(env)) == -EFAULT) {

        goto badframe;

    }

    unlock_user_struct(frame, frame_addr, 0);

    return env->xregs[0];

 badframe:

    unlock_user_struct(frame, frame_addr, 0);

    force_sig(TARGET_SIGSEGV);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
     avctx->internal->allocate_progress = 1;

+
     ret = hevc_init_context(avctx);

     if (ret < 0)

static av_cold int hevc_decode_init(AVCodecContext *avctx)

{

    HEVCContext *s = avctx->priv_data;

    int ret;

    avctx->internal->allocate_progress = 1;

    ret = hevc_init_context(avctx);

    if (ret < 0)

        return ret;

    s->enable_parallel_tiles = 0;

    s->sei.picture_timing.picture_struct = 0;

    s->eos = 1;

    atomic_init(&s->wpp_err, 0);

    if(avctx->active_thread_type & FF_THREAD_SLICE)

        s->threads_number = avctx->thread_count;

    else

        s->threads_number = 1;

    if (avctx->extradata_size > 0 && avctx->extradata) {

        ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size);

        if (ret < 0) {

            hevc_decode_free(avctx);

            return ret;

        }

    }

    if((avctx->active_thread_type & FF_THREAD_FRAME) && avctx->thread_count > 1)

            s->threads_type = FF_THREAD_FRAME;

        else

            s->threads_type = FF_THREAD_SLICE;

    return 0;

}


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

     QObject *obj = qobject_from_json("\"abc\\\"", NULL);

static void unterminated_escape(void)

{

    QObject *obj = qobject_from_json("\"abc\\\"", NULL);

    g_assert(obj == NULL);

}


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

         io_size = ACPI_PCIHP_LEGACY_SIZE;

+
+
+        *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;
+
+        object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,

                                        bus_bsel, NULL);

void acpi_pcihp_init(AcpiPciHpState *s, PCIBus *root_bus,

                     MemoryRegion *address_space_io, bool bridges_enabled)

{

    uint16_t io_size = ACPI_PCIHP_SIZE;

    s->root= root_bus;

    s->legacy_piix = !bridges_enabled;

    if (s->legacy_piix) {

        unsigned *bus_bsel = g_malloc(sizeof *bus_bsel);

        io_size = ACPI_PCIHP_LEGACY_SIZE;

        *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;

        object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,

                                       bus_bsel, NULL);

    }

    memory_region_init_io(&s->io, NULL, &acpi_pcihp_io_ops, s,

                          "acpi-pci-hotplug", io_size);

    memory_region_add_subregion(address_space_io, ACPI_PCIHP_ADDR, &s->io);

}


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

     spin_unlock(&global_cpu_lock);
+
 }

void helper_unlock(void)

{

    spin_unlock(&global_cpu_lock);

}


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

         return ret;

+    }
+
+
+
+    /*

      * SEND was received with new bytes, now try again.

static int qemu_rdma_get_buffer(void *opaque, uint8_t *buf,

                                int64_t pos, int size)

{

    QEMUFileRDMA *r = opaque;

    RDMAContext *rdma = r->rdma;

    RDMAControlHeader head;

    int ret = 0;

    CHECK_ERROR_STATE();

    /*

     * First, we hold on to the last SEND message we

     * were given and dish out the bytes until we run

     * out of bytes.

     */

    r->len = qemu_rdma_fill(r->rdma, buf, size, 0);

    if (r->len) {

        return r->len;

    }

    /*

     * Once we run out, we block and wait for another

     * SEND message to arrive.

     */

    ret = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_QEMU_FILE);

    if (ret < 0) {

        rdma->error_state = ret;

        return ret;

    }

    /*

     * SEND was received with new bytes, now try again.

     */

    return qemu_rdma_fill(r->rdma, buf, size, 0);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int ff_rtsp_send_cmd_with_content(AVFormatContext *s,

                                   const char *method, const char *url,
+
                                   const char *header,

                                   RTSPMessageHeader *reply,
+
                                   unsigned char **content_ptr,

                                   const unsigned char *send_content,

int ff_rtsp_send_cmd_with_content(AVFormatContext *s,

                                  const char *method, const char *url,

                                  const char *header,

                                  RTSPMessageHeader *reply,

                                  unsigned char **content_ptr,

                                  const unsigned char *send_content,

                                  int send_content_length)

{

    RTSPState *rt = s->priv_data;

    HTTPAuthType cur_auth_type;

    int ret;

retry:

    cur_auth_type = rt->auth_state.auth_type;

    if ((ret = ff_rtsp_send_cmd_with_content_async(s, method, url, header,

                                                   send_content,

                                                   send_content_length)))

        return ret;

    if ((ret = ff_rtsp_read_reply(s, reply, content_ptr, 0, method) ) < 0)

        return ret;

    if (reply->status_code == 401 && cur_auth_type == HTTP_AUTH_NONE &&

        rt->auth_state.auth_type != HTTP_AUTH_NONE)

        goto retry;

    if (reply->status_code > 400){

        av_log(s, AV_LOG_ERROR, "method %s failed: %d%s\n",

               method,

               reply->status_code,

               reply->reason);

        av_log(s, AV_LOG_DEBUG, "%s\n", rt->last_reply);

    }

    return 0;

}


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

     static const int shifts[4] = { 0, 2, 8, 10 };

+    const int *curshift = shifts;
+
+    int i, t, mask;
+
+

     code = get_vlc2(gb, vlc->cbppattern[table].table, 9, 2);

static int rv34_decode_cbp(GetBitContext *gb, RV34VLC *vlc, int table)

{

    int pattern, code, cbp=0;

    int ones;

    static const int cbp_masks[3] = {0x100000, 0x010000, 0x110000};

    static const int shifts[4] = { 0, 2, 8, 10 };

    const int *curshift = shifts;

    int i, t, mask;

    code = get_vlc2(gb, vlc->cbppattern[table].table, 9, 2);

    pattern = code & 0xF;

    code >>= 4;

    ones = rv34_count_ones[pattern];

    for(mask = 8; mask; mask >>= 1, curshift++){

        if(pattern & mask)

            cbp |= get_vlc2(gb, vlc->cbp[table][ones].table, vlc->cbp[table][ones].bits, 1) << curshift[0];

    }

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

        t = modulo_three_table[code][i];

        if(t == 1)

            cbp |= cbp_masks[get_bits1(gb)] << i;

        if(t == 2)

            cbp |= cbp_masks[2] << i;

    }

    return cbp;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static int analyze(const uint8_t *buf, int size, int packet_size, int *index)

 {

     int stat[TS_MAX_PACKET_SIZE];

     int i;
+
     int x = 0;

     int best_score = 0;

static int analyze(const uint8_t *buf, int size, int packet_size, int *index)

{

    int stat[TS_MAX_PACKET_SIZE];

    int i;

    int x = 0;

    int best_score = 0;

    memset(stat, 0, packet_size * sizeof(int));

    for (x = i = 0; i < size - 3; i++) {

        if (buf[i] == 0x47 && !(buf[i + 1] & 0x80) && (buf[i + 3] & 0x30)) {

            stat[x]++;

            if (stat[x] > best_score) {

                best_score = stat[x];

                if (index)

                    *index = x;

            }

        }

        x++;

        if (x == packet_size)

            x = 0;

    }

    return best_score;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void bdrv_inherited_options(int *child_flags, QDict *child_options,

+                                   int parent_flags, QDict *parent_options)
+
+{
+
+    int flags = parent_flags;

static void bdrv_inherited_options(int *child_flags, QDict *child_options,

                                   int parent_flags, QDict *parent_options)

{

    int flags = parent_flags;

    /* Enable protocol handling, disable format probing for bs->file */

    flags |= BDRV_O_PROTOCOL;

    /* If the cache mode isn't explicitly set, inherit direct and no-flush from

     * the parent. */

    qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_DIRECT);

    qdict_copy_default(child_options, parent_options, BDRV_OPT_CACHE_NO_FLUSH);

    /* Inherit the read-only option from the parent if it's not set */

    qdict_copy_default(child_options, parent_options, BDRV_OPT_READ_ONLY);

    /* Our block drivers take care to send flushes and respect unmap policy,

     * so we can default to enable both on lower layers regardless of the

     * corresponding parent options. */

    flags |= BDRV_O_UNMAP;

    /* Clear flags that only apply to the top layer */

    flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | BDRV_O_COPY_ON_READ |

               BDRV_O_NO_IO);

    *child_flags = flags;

}


--- a/source.c
+++ b/source.c
@@ -35,11 +35,11 @@
                 memcpy(addr, sg[i].iov_base + offset, len);

             }
+
+            size -= len;
+
+            copied += len;
+
             addr += len;

             if (size) {

static size_t v9fs_packunpack(void *addr, struct iovec *sg, int sg_count,

                              size_t offset, size_t size, int pack)

{

    int i = 0;

    size_t copied = 0;

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

        size_t len;

        if (offset >= sg[i].iov_len) {

            /* skip this sg */

            offset -= sg[i].iov_len;

            continue;

        } else {

            len = MIN(sg[i].iov_len - offset, size);

            if (pack) {

                memcpy(sg[i].iov_base + offset, addr, len);

            } else {

                memcpy(addr, sg[i].iov_base + offset, len);

            }

            size -= len;

            copied += len;

            addr += len;

            if (size) {

                offset = 0;

                continue;

            }

        }

    }

    return copied;

}


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

         p = g_array_index(mc->compat_props, GlobalProperty *, i);

+        /* Machine compat_props must never cause errors: */
+
+        p->errp = &error_abort;
+
+        qdev_prop_register_global(p);

     }

void machine_register_compat_props(MachineState *machine)

{

    MachineClass *mc = MACHINE_GET_CLASS(machine);

    int i;

    GlobalProperty *p;

    if (!mc->compat_props) {

        return;

    }

    for (i = 0; i < mc->compat_props->len; i++) {

        p = g_array_index(mc->compat_props, GlobalProperty *, i);

        /* Machine compat_props must never cause errors: */

        p->errp = &error_abort;

        qdev_prop_register_global(p);

    }

}


--- a/source.c
+++ b/source.c
@@ -38,11 +38,11 @@
         const char *basename;
         char fw_file_name[FW_CFG_MAX_FILE_PATH];
         void *data;
+        basename = strrchr(rom->fw_file, '/');
+        if (basename) {
+            basename++;
+        } else {
+            basename = rom->fw_file;
         snprintf(fw_file_name, sizeof(fw_file_name), "%s/%s", rom->fw_dir,
                  basename);
         snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);

int rom_add_file(const char *file, const char *fw_dir,
                 hwaddr addr, int32_t bootindex,
                 bool option_rom, MemoryRegion *mr)
{
    MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
    Rom *rom;
    int rc, fd = -1;
    char devpath[100];
    rom = g_malloc0(sizeof(*rom));
    rom->name = g_strdup(file);
    rom->path = qemu_find_file(QEMU_FILE_TYPE_BIOS, rom->name);
    if (rom->path == NULL) {
        rom->path = g_strdup(file);
    fd = open(rom->path, O_RDONLY | O_BINARY);
    if (fd == -1) {
        fprintf(stderr, "Could not open option rom '%s': %s\n",
                rom->path, strerror(errno));
        goto err;
        rom->fw_dir  = g_strdup(fw_dir);
        rom->fw_file = g_strdup(file);
    rom->addr     = addr;
    rom->romsize  = lseek(fd, 0, SEEK_END);
    if (rom->romsize == -1) {
        fprintf(stderr, "rom: file %-20s: get size error: %s\n",
                rom->name, strerror(errno));
        goto err;
    rom->datasize = rom->romsize;
    rom->data     = g_malloc0(rom->datasize);
    lseek(fd, 0, SEEK_SET);
    rc = read(fd, rom->data, rom->datasize);
    if (rc != rom->datasize) {
        fprintf(stderr, "rom: file %-20s: read error: rc=%d (expected %zd)\n",
                rom->name, rc, rom->datasize);
        goto err;
    close(fd);
    rom_insert(rom);
    if (rom->fw_file && fw_cfg) {
        const char *basename;
        char fw_file_name[FW_CFG_MAX_FILE_PATH];
        void *data;
        basename = strrchr(rom->fw_file, '/');
        if (basename) {
            basename++;
        } else {
            basename = rom->fw_file;
        snprintf(fw_file_name, sizeof(fw_file_name), "%s/%s", rom->fw_dir,
                 basename);
        snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);
        if ((!option_rom || mc->option_rom_has_mr) && mc->rom_file_has_mr) {
            data = rom_set_mr(rom, OBJECT(fw_cfg), devpath);
        } else {
            data = rom->data;
        fw_cfg_add_file(fw_cfg, fw_file_name, data, rom->romsize);
    } else {
        if (mr) {
            rom->mr = mr;
            snprintf(devpath, sizeof(devpath), "/rom@%s", file);
        } else {
            snprintf(devpath, sizeof(devpath), "/rom@" TARGET_FMT_plx, addr);
    add_boot_device_path(bootindex, NULL, devpath);
    return 0;
err:
    if (fd != -1)
        close(fd);
    g_free(rom->data);
    g_free(rom->path);
    g_free(rom->name);
    g_free(rom);
    return -1;


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

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

     }

static int token_is_operator(QObject *obj, char op)

{

    const char *val;

    if (token_get_type(obj) != JSON_OPERATOR) {

        return 0;

    }

    val = token_get_value(obj);

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

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void qmp_guest_suspend_disk(Error **errp)

+{

     Error *local_err = NULL;

void qmp_guest_suspend_disk(Error **errp)

{

    Error *local_err = NULL;

    GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode));

    *mode = GUEST_SUSPEND_MODE_DISK;

    check_suspend_mode(*mode, &local_err);

    acquire_privilege(SE_SHUTDOWN_NAME, &local_err);

    execute_async(do_suspend, mode, &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        g_free(mode);

    }

}


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

     do_store_msr(env, T0);

void OPPROTO op_store_msr (void)

{

    do_store_msr(env, T0);

    RETURN();

}


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

     if (c->csty & JPEG2000_CSTY_PREC) {

+        int i;
+
+        for (i = 0; i < c->nreslevels; i++) {
+
+            byte = bytestream_get_byte(&s->buf);

             c->log2_prec_widths[i]  =  byte       & 0x0F;    // precinct PPx

static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c)

{

    uint8_t byte;

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

        return AVERROR(EINVAL);

    c->nreslevels = bytestream_get_byte(&s->buf) + 1; // num of resolution levels - 1

    /* compute number of resolution levels to decode */

    if (c->nreslevels < s->reduction_factor)

        c->nreslevels2decode = 1;

    else

        c->nreslevels2decode = c->nreslevels - s->reduction_factor;

    c->log2_cblk_width  = bytestream_get_byte(&s->buf) + 2; // cblk width

    c->log2_cblk_height = bytestream_get_byte(&s->buf) + 2; // cblk height

    c->cblk_style = bytestream_get_byte(&s->buf);

    if (c->cblk_style != 0) { // cblk style

        av_log(s->avctx, AV_LOG_ERROR, "no extra cblk styles supported\n");

        return -1;

    }

    c->transform = bytestream_get_byte(&s->buf); // DWT transformation type

    /* set integer 9/7 DWT in case of BITEXACT flag */

    if ((s->avctx->flags & CODEC_FLAG_BITEXACT) && (c->transform == FF_DWT97))

        c->transform = FF_DWT97_INT;

    if (c->csty & JPEG2000_CSTY_PREC) {

        int i;

        for (i = 0; i < c->nreslevels; i++) {

            byte = bytestream_get_byte(&s->buf);

            c->log2_prec_widths[i]  =  byte       & 0x0F;    // precinct PPx

            c->log2_prec_heights[i] = (byte >> 4) & 0x0F;    // precinct PPy

        }

    }

    return 0;

}


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

     frame_addr = env->regs[R_SP];

+    trace_user_do_sigreturn(env, frame_addr);

     /* Make sure the guest isn't playing games.  */

long do_sigreturn(CPUMBState *env)

{

    struct target_signal_frame *frame;

    abi_ulong frame_addr;

    target_sigset_t target_set;

    sigset_t set;

    int i;

    frame_addr = env->regs[R_SP];

    trace_user_do_sigreturn(env, frame_addr);

    /* Make sure the guest isn't playing games.  */

    if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 1))

        goto badframe;

    /* Restore blocked signals */

    __get_user(target_set.sig[0], &frame->uc.tuc_mcontext.oldmask);

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

        __get_user(target_set.sig[i], &frame->extramask[i - 1]);

    }

    target_to_host_sigset_internal(&set, &target_set);

    do_sigprocmask(SIG_SETMASK, &set, NULL);

    restore_sigcontext(&frame->uc.tuc_mcontext, env);

    /* We got here through a sigreturn syscall, our path back is via an

       rtb insn so setup r14 for that.  */

    env->regs[14] = env->sregs[SR_PC];

    unlock_user_struct(frame, frame_addr, 0);

    return env->regs[10];

badframe:

    force_sig(TARGET_SIGSEGV);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 Visitor *qmp_output_get_visitor(QmpOutputVisitor *v)

+{

     return &v->visitor;

Visitor *qmp_output_get_visitor(QmpOutputVisitor *v)

{

    return &v->visitor;

}


static int send_rect_simple(VncState *vs, int x, int y, int w, int h)

{

    int max_size, max_width;

    int max_sub_width, max_sub_height;

    int dx, dy;

    int rw, rh;

    int n = 0;

    max_size = tight_conf[vs->tight_compression].max_rect_size;

    max_width = tight_conf[vs->tight_compression].max_rect_width;

    if (w > max_width || w * h > max_size) {

        max_sub_width = (w > max_width) ? max_width : w;

        max_sub_height = max_size / max_sub_width;

        for (dy = 0; dy < h; dy += max_sub_height) {

            for (dx = 0; dx < w; dx += max_width) {

                rw = MIN(max_sub_width, w - dx);

                rh = MIN(max_sub_height, h - dy);

                n += send_sub_rect(vs, x+dx, y+dy, rw, rh);

            }

        }

    } else {

        n += send_sub_rect(vs, x, y, w, h);

    }

    return n;

}


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

     idsel = (cfgaddr & BONITO_PCICONF_IDSEL_MASK) >> BONITO_PCICONF_IDSEL_OFFSET;

+    devno = ffs(idsel) - 1;
+
+    funno = (cfgaddr & BONITO_PCICONF_FUN_MASK) >> BONITO_PCICONF_FUN_OFFSET;
+
+    regno = (cfgaddr & BONITO_PCICONF_REG_MASK) >> BONITO_PCICONF_REG_OFFSET;

static uint32_t bonito_sbridge_pciaddr(void *opaque, target_phys_addr_t addr)

{

    PCIBonitoState *s = opaque;

    PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost);

    uint32_t cfgaddr;

    uint32_t idsel;

    uint32_t devno;

    uint32_t funno;

    uint32_t regno;

    uint32_t pciaddr;

    /* support type0 pci config */

    if ((s->regs[BONITO_PCIMAP_CFG] & 0x10000) != 0x0) {

        return 0xffffffff;

    }

    cfgaddr = addr & 0xffff;

    cfgaddr |= (s->regs[BONITO_PCIMAP_CFG] & 0xffff) << 16;

    idsel = (cfgaddr & BONITO_PCICONF_IDSEL_MASK) >> BONITO_PCICONF_IDSEL_OFFSET;

    devno = ffs(idsel) - 1;

    funno = (cfgaddr & BONITO_PCICONF_FUN_MASK) >> BONITO_PCICONF_FUN_OFFSET;

    regno = (cfgaddr & BONITO_PCICONF_REG_MASK) >> BONITO_PCICONF_REG_OFFSET;

    if (idsel == 0) {

        fprintf(stderr, "error in bonito pci config address " TARGET_FMT_plx

            ",pcimap_cfg=%x\n", addr, s->regs[BONITO_PCIMAP_CFG]);

        exit(1);

    }

    pciaddr = PCI_ADDR(pci_bus_num(phb->bus), devno, funno, regno);

    DPRINTF("cfgaddr %x pciaddr %x busno %x devno %d funno %d regno %d\n",

        cfgaddr, pciaddr, pci_bus_num(phb->bus), devno, funno, regno);

    return pciaddr;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename

+    const int linesize   = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics

     const int uvlinesize = s->current_picture.f.linesize[1];

@@ -8,9 +8,9 @@

+    s->block_index[0]= s->b8_stride*(s->mb_y*2    ) - 2 + s->mb_x*2;
+
+    s->block_index[1]= s->b8_stride*(s->mb_y*2    ) - 1 + s->mb_x*2;

     s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2;

void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename

    const int linesize   = s->current_picture.f.linesize[0]; //not s->linesize as this would be wrong for field pics

    const int uvlinesize = s->current_picture.f.linesize[1];

    const int mb_size= 4;

    s->block_index[0]= s->b8_stride*(s->mb_y*2    ) - 2 + s->mb_x*2;

    s->block_index[1]= s->b8_stride*(s->mb_y*2    ) - 1 + s->mb_x*2;

    s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2;

    s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2;

    s->block_index[4]= s->mb_stride*(s->mb_y + 1)                + s->b8_stride*s->mb_height*2 + s->mb_x - 1;

    s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;

    //block_index is not used by mpeg2, so it is not affected by chroma_format

    s->dest[0] = s->current_picture.f.data[0] + ((s->mb_x - 1) <<  mb_size);

    s->dest[1] = s->current_picture.f.data[1] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));

    s->dest[2] = s->current_picture.f.data[2] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));

    if(!(s->pict_type==AV_PICTURE_TYPE_B && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME))

    {

        if(s->picture_structure==PICT_FRAME){

        s->dest[0] += s->mb_y *   linesize << mb_size;

        s->dest[1] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);

        s->dest[2] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);

        }else{

            s->dest[0] += (s->mb_y>>1) *   linesize << mb_size;

            s->dest[1] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift);

            s->dest[2] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift);

            assert((s->mb_y&1) == (s->picture_structure == PICT_BOTTOM_FIELD));

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,23 +1,23 @@
+static int vfio_ccw_handle_request(ORB *orb, SCSW *scsw, void *data)
+
 {

+    S390CCWDevice *cdev = data;

     VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);

     struct ccw_io_region *region = vcdev->io_region;
+
+    int ret;

     QEMU_BUILD_BUG_ON(sizeof(region->orb_area) != sizeof(ORB));

     QEMU_BUILD_BUG_ON(sizeof(region->scsw_area) != sizeof(SCSW));
+
     QEMU_BUILD_BUG_ON(sizeof(region->irb_area) != sizeof(IRB));
+

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

static int vfio_ccw_handle_request(ORB *orb, SCSW *scsw, void *data)

{

    S390CCWDevice *cdev = data;

    VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);

    struct ccw_io_region *region = vcdev->io_region;

    int ret;

    QEMU_BUILD_BUG_ON(sizeof(region->orb_area) != sizeof(ORB));

    QEMU_BUILD_BUG_ON(sizeof(region->scsw_area) != sizeof(SCSW));

    QEMU_BUILD_BUG_ON(sizeof(region->irb_area) != sizeof(IRB));

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

    memcpy(region->orb_area, orb, sizeof(ORB));

    memcpy(region->scsw_area, scsw, sizeof(SCSW));

again:

    ret = pwrite(vcdev->vdev.fd, region,

                 vcdev->io_region_size, vcdev->io_region_offset);

    if (ret != vcdev->io_region_size) {

        if (errno == EAGAIN) {

            goto again;

        }

        error_report("vfio-ccw: wirte I/O region failed with errno=%d", errno);

        return -errno;

    }

    return region->ret_code;

}