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

 #endif

+
+
+    case POWERPC_MMU_32B:
+
+    case POWERPC_MMU_601:

         return ppc_hash32_get_phys_page_debug(env, addr);

hwaddr ppc_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)

{

    PowerPCCPU *cpu = POWERPC_CPU(cs);

    CPUPPCState *env = &cpu->env;

    mmu_ctx_t ctx;

    switch (env->mmu_model) {

#if defined(TARGET_PPC64)

    case POWERPC_MMU_64B:

    case POWERPC_MMU_2_03:

    case POWERPC_MMU_2_06:

    case POWERPC_MMU_2_07:

        return ppc_hash64_get_phys_page_debug(env, addr);

#endif

    case POWERPC_MMU_32B:

    case POWERPC_MMU_601:

        return ppc_hash32_get_phys_page_debug(env, addr);

    default:

        ;

    }

    if (unlikely(get_physical_address(env, &ctx, addr, 0, ACCESS_INT) != 0)) {

        /* Some MMUs have separate TLBs for code and data. If we only try an

         * ACCESS_INT, we may not be able to read instructions mapped by code

         * TLBs, so we also try a ACCESS_CODE.

         */

        if (unlikely(get_physical_address(env, &ctx, addr, 0,

                                          ACCESS_CODE) != 0)) {

            return -1;

        }

    }

    return ctx.raddr & TARGET_PAGE_MASK;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static inline void reloc_pc26(tcg_insn_unit *code_ptr, tcg_insn_unit *target)
+
+{

     ptrdiff_t offset = target - code_ptr;

static inline void reloc_pc26(tcg_insn_unit *code_ptr, tcg_insn_unit *target)

{

    ptrdiff_t offset = target - code_ptr;

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

    /* read instruction, mask away previous PC_REL26 parameter contents,

       set the proper offset, then write back the instruction. */

    *code_ptr = deposit32(*code_ptr, 0, 26, offset);

}


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

                            AVFrame *out, AVFrame *in)

+{

     NPPScaleContext *s = ctx->priv;

static int nppscale_resize(AVFilterContext *ctx, NPPScaleStageContext *stage,

                           AVFrame *out, AVFrame *in)

{

    NPPScaleContext *s = ctx->priv;

    NppStatus err;

    int i;

    for (i = 0; i < FF_ARRAY_ELEMS(in->data) && in->data[i]; i++) {

        int iw = stage->planes_in[i].width;

        int ih = stage->planes_in[i].height;

        int ow = stage->planes_out[i].width;

        int oh = stage->planes_out[i].height;

        err = nppiResizeSqrPixel_8u_C1R(in->data[i], (NppiSize){ iw, ih },

                                        in->linesize[i], (NppiRect){ 0, 0, iw, ih },

                                        out->data[i], out->linesize[i],

                                        (NppiRect){ 0, 0, ow, oh },

                                        (double)ow / iw, (double)oh / ih,

                                        0.0, 0.0, s->interp_algo);

        if (err != NPP_SUCCESS) {

            av_log(ctx, AV_LOG_ERROR, "NPP resize error: %d\n", err);

            return AVERROR_UNKNOWN;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor)

+{

     QEMUCursor *c;

@@ -8,15 +8,15 @@

     size_t size;

+

     c = cursor_alloc(cursor->header.width, cursor->header.height);
+
+    c->hot_x = cursor->header.hot_spot_x;
+
+    c->hot_y = cursor->header.hot_spot_y;

+    switch (cursor->header.type) {

     case SPICE_CURSOR_TYPE_ALPHA:

static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor)

{

    QEMUCursor *c;

    uint8_t *image, *mask;

    size_t size;

    c = cursor_alloc(cursor->header.width, cursor->header.height);

    c->hot_x = cursor->header.hot_spot_x;

    c->hot_y = cursor->header.hot_spot_y;

    switch (cursor->header.type) {

    case SPICE_CURSOR_TYPE_ALPHA:

        size = sizeof(uint32_t) * cursor->header.width * cursor->header.height;

        memcpy(c->data, cursor->chunk.data, size);

        if (qxl->debug > 2) {

            cursor_print_ascii_art(c, "qxl/alpha");

        }

        break;

    case SPICE_CURSOR_TYPE_MONO:

        mask  = cursor->chunk.data;

        image = mask + cursor_get_mono_bpl(c) * c->width;

        cursor_set_mono(c, 0xffffff, 0x000000, image, 1, mask);

        if (qxl->debug > 2) {

            cursor_print_ascii_art(c, "qxl/mono");

        }

        break;

    default:

        fprintf(stderr, "%s: not implemented: type %d\n",

                __FUNCTION__, cursor->header.type);

        goto fail;

    }

    return c;

fail:

    cursor_put(c);

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     idx = s->nb_globals;

     tcg_temp_alloc(s, s->nb_globals + 1);
+
+    ts = &s->temps[s->nb_globals];
+
+    ts->base_type = type;
+
     ts->type = type;

     ts->fixed_reg = 1;

static inline int tcg_global_reg_new_internal(TCGType type, int reg,

                                              const char *name)

{

    TCGContext *s = &tcg_ctx;

    TCGTemp *ts;

    int idx;

#if TCG_TARGET_REG_BITS == 32

    if (type != TCG_TYPE_I32)

        tcg_abort();

#endif

    if (tcg_regset_test_reg(s->reserved_regs, reg))

        tcg_abort();

    idx = s->nb_globals;

    tcg_temp_alloc(s, s->nb_globals + 1);

    ts = &s->temps[s->nb_globals];

    ts->base_type = type;

    ts->type = type;

    ts->fixed_reg = 1;

    ts->reg = reg;

    ts->name = name;

    s->nb_globals++;

    tcg_regset_set_reg(s->reserved_regs, reg);

    return idx;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static inline int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes)

+{

     static const uint32_t tab[4] = {

static inline int decode_bytes(const uint8_t *inbuffer, uint8_t *out, int bytes)

{

    static const uint32_t tab[4] = {

        AV_BE2NE32C(0x37c511f2), AV_BE2NE32C(0xf237c511),

        AV_BE2NE32C(0x11f237c5), AV_BE2NE32C(0xc511f237),

    };

    int i, off;

    uint32_t c;

    const uint32_t *buf;

    uint32_t *obuf = (uint32_t *) out;

    /* FIXME: 64 bit platforms would be able to do 64 bits at a time.

     * I'm too lazy though, should be something like

     * for (i = 0; i < bitamount / 64; i++)

     *     (int64_t) out[i] = 0x37c511f237c511f2 ^ av_be2ne64(int64_t) in[i]);

     * Buffer alignment needs to be checked. */

    off = (intptr_t) inbuffer & 3;

    buf = (const uint32_t *) (inbuffer - off);

    c = tab[off];

    bytes += 3 + off;

    for (i = 0; i < bytes / 4; i++)

        obuf[i] = c ^ buf[i];

    return off;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 e1000_link_up(E1000State *s)
 {
     s->mac_reg[STATUS] |= E1000_STATUS_LU;
+    s->phy_reg[PHY_STATUS] |= MII_SR_LINK_STATUS;
 }

e1000_link_up(E1000State *s)
{
    s->mac_reg[STATUS] |= E1000_STATUS_LU;
    s->phy_reg[PHY_STATUS] |= MII_SR_LINK_STATUS;
}


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

     if (size != 4) {

static void omap_id_write(void *opaque, target_phys_addr_t addr,

                          uint64_t value, unsigned size)

{

    if (size != 4) {

        return omap_badwidth_write32(opaque, addr, value);

    }

    OMAP_BAD_REG(addr);

}


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

         return 8;

+    }
+
+    if (n == 32) {
+
+        /* FPSCR not implemented  */

         return 4;

static int gdb_set_float_reg(CPUPPCState *env, uint8_t *mem_buf, int n)

{

    if (n < 32) {

        env->fpr[n] = ldfq_p(mem_buf);

        return 8;

    }

    if (n == 32) {

        /* FPSCR not implemented  */

        return 4;

    }

    return 0;

}


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

         tmp1 = (ctx->samples + 256)[start];

+        ctx->samples[start] = tmp0 + tmp1;
+
+        (ctx->samples + 256)[start] = tmp0 - tmp1;
+
+        start++;

     }

static int _do_rematrixing(AC3DecodeContext *ctx, int start, int end)

{

    float tmp0, tmp1;

    while (start < end) {

        tmp0 = ctx->samples[start];

        tmp1 = (ctx->samples + 256)[start];

        ctx->samples[start] = tmp0 + tmp1;

        (ctx->samples + 256)[start] = tmp0 - tmp1;

        start++;

    }

    return 0;

}


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

                        BdrvCheckMode fix)

+{
+
     return qcow2_check_refcounts(bs, result, fix);

 }

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

                       BdrvCheckMode fix)

{

    return qcow2_check_refcounts(bs, result, fix);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static inline TCGv load_reg(DisasContext *s, int reg)
+
 {

     TCGv tmp = new_tmp();

static inline TCGv load_reg(DisasContext *s, int reg)

{

    TCGv tmp = new_tmp();

    load_reg_var(s, tmp, reg);

    return tmp;

}


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

+{

     pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr"));

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

{

    pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr"));

}


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

+    v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }");
+
+
+
+    visit_type_TestStruct(v, NULL, &p, &err);

     error_free_or_abort(&err);

static void test_validate_fail_struct(TestInputVisitorData *data,

                                       const void *unused)

{

    TestStruct *p = NULL;

    Error *err = NULL;

    Visitor *v;

    v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }");

    visit_type_TestStruct(v, NULL, &p, &err);

    error_free_or_abort(&err);

    g_assert(!p);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense)
+
+{
+
+    SCSIRequest *req;

void scsi_device_purge_requests(SCSIDevice *sdev, SCSISense sense)

{

    SCSIRequest *req;

    while (!QTAILQ_EMPTY(&sdev->requests)) {

        req = QTAILQ_FIRST(&sdev->requests);

        scsi_req_cancel(req);

    }

    sdev->unit_attention = sense;

}


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

     qdev_prop_set(dev, name, &value, PROP_TYPE_DRIVE);
+
 }

void qdev_prop_set_drive(DeviceState *dev, const char *name, DriveInfo *value)

{

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

}


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

+
+    for (i = 0; i < NB_BOOTP_CLIENTS; i++) {
+
+        slirp->bootp_clients[i].allocated = qemu_get_be16(f);

         qemu_get_buffer(f, slirp->bootp_clients[i].macaddr, 6);

static void slirp_bootp_load(QEMUFile *f, Slirp *slirp)

{

    int i;

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

        slirp->bootp_clients[i].allocated = qemu_get_be16(f);

        qemu_get_buffer(f, slirp->bootp_clients[i].macaddr, 6);

    }

}


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

     ISADevice *dev;

+    m48t59_t *s;

m48t59_t *m48t59_init_isa(uint32_t io_base, uint16_t size, int type)

{

    M48t59ISAState *d;

    ISADevice *dev;

    m48t59_t *s;

    dev = isa_create("m48t59_isa");

    qdev_prop_set_uint32(&dev->qdev, "type", type);

    qdev_prop_set_uint32(&dev->qdev, "size", size);

    qdev_prop_set_uint32(&dev->qdev, "io_base", io_base);

    qdev_init(&dev->qdev);

    d = DO_UPCAST(M48t59ISAState, busdev, dev);

    s = &d->state;

    if (io_base != 0) {

        register_ioport_read(io_base, 0x04, 1, NVRAM_readb, s);

        register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, s);

    }

    return s;

}


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

     /* add the timer in the sorted list */
+
+    /* NOTE: this code must be signal safe because
+
+       qemu_timer_expired() can be called from a signal. */
+
     pt = &active_timers[ts->clock->type];

     for(;;) {

void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)

{

    QEMUTimer **pt, *t;

    qemu_del_timer(ts);

    /* add the timer in the sorted list */

    /* NOTE: this code must be signal safe because

       qemu_timer_expired() can be called from a signal. */

    pt = &active_timers[ts->clock->type];

    for(;;) {

        t = *pt;

        if (!t)

            break;

        if (t->expire_time > expire_time)

            break;

        pt = &t->next;

    }

    ts->expire_time = expire_time;

    ts->next = *pt;

    *pt = ts;

    /* Rearm if necessary  */

    if (pt == &active_timers[ts->clock->type]) {

        if ((alarm_timer->flags & ALARM_FLAG_EXPIRED) == 0) {

            qemu_rearm_alarm_timer(alarm_timer);

        }

        /* Interrupt execution to force deadline recalculation.  */

        if (use_icount)

            qemu_notify_event();

    }

}


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

 {

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

     CharDriverState *chr;

static CharDriverState *qemu_chr_open_pp(QemuOpts *opts)

{

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

    CharDriverState *chr;

    int fd;

    fd = open(filename, O_RDWR);

    if (fd < 0)

        return NULL;

    chr = g_malloc0(sizeof(CharDriverState));

    chr->opaque = (void *)(intptr_t)fd;

    chr->chr_write = null_chr_write;

    chr->chr_ioctl = pp_ioctl;

    return chr;

}


--- 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
@@ -1,4 +1,4 @@
+static int decode_hybrid(const uint8_t *sptr, uint8_t *dptr, int dx, int dy,

                          int h, int w, int stride, const uint32_t *pal)

static int decode_hybrid(const uint8_t *sptr, uint8_t *dptr, int dx, int dy,

                         int h, int w, int stride, const uint32_t *pal)

{

    int x, y;

    const uint8_t *orig_src = sptr;

    for (y = dx + h; y > dx; y--) {

        uint8_t *dst = dptr + (y * stride) + dy * 3;

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

            if (*sptr & 0x80) {

                /* 15-bit color */

                unsigned c = AV_RB16(sptr) & ~0x8000;

                unsigned b =  c        & 0x1F;

                unsigned g = (c >>  5) & 0x1F;

                unsigned r =  c >> 10;

                /* 000aaabb -> aaabbaaa  */

                *dst++ = (b << 3) | (b >> 2);

                *dst++ = (g << 3) | (g >> 2);

                *dst++ = (r << 3) | (r >> 2);

                sptr += 2;

            } else {

                /* palette index */

                uint32_t c = pal[*sptr++];

                bytestream_put_le24(&dst, c);

            }

        }

    }

    return sptr - orig_src;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         curval = stack[sp]->val;
     while (curval < threshold && sp >= 0) {
         if (curval < stack[sp]->val)
+            curval = stack[sp]->val;
+        while (curval < threshold) {
+            int ret;
+            if ((ret = get_bits(s, 1)) > 0) {
+                stack[sp]->vis++;
                 break;
             } else if (!ret)
                 curval++;

static int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node,
                           int threshold)
{
    Jpeg2000TgtNode *stack[30];
    int sp = -1, curval = 0;
    while (node && !node->vis) {
        stack[++sp] = node;
        node        = node->parent;
    }
    if (node)
        curval = node->val;
    else
        curval = stack[sp]->val;
    while (curval < threshold && sp >= 0) {
        if (curval < stack[sp]->val)
            curval = stack[sp]->val;
        while (curval < threshold) {
            int ret;
            if ((ret = get_bits(s, 1)) > 0) {
                stack[sp]->vis++;
                break;
            } else if (!ret)
                curval++;
            else
                return ret;
        }
        stack[sp]->val = curval;
        sp--;
    }
    return curval;
}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static sPAPRDREntitySense logical_entity_sense(sPAPRDRConnector *drc)

 {
+
+    if (drc->dev
+
+        && (drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE)) {

         return SPAPR_DR_ENTITY_SENSE_PRESENT;

static sPAPRDREntitySense logical_entity_sense(sPAPRDRConnector *drc)

{

    if (drc->dev

        && (drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE)) {

        return SPAPR_DR_ENTITY_SENSE_PRESENT;

    } else {

        return SPAPR_DR_ENTITY_SENSE_UNUSABLE;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void qemu_set_log(int log_flags, bool use_own_buffers)

 {
+
     qemu_loglevel = log_flags;
+
     if (qemu_loglevel && !qemu_logfile) {

         qemu_logfile = fopen(logfilename, log_append ? "a" : "w");

void qemu_set_log(int log_flags, bool use_own_buffers)

{

    qemu_loglevel = log_flags;

    if (qemu_loglevel && !qemu_logfile) {

        qemu_logfile = fopen(logfilename, log_append ? "a" : "w");

        if (!qemu_logfile) {

            perror(logfilename);

            _exit(1);

        }

        /* must avoid mmap() usage of glibc by setting a buffer "by hand" */

        if (use_own_buffers) {

            static char logfile_buf[4096];

            setvbuf(qemu_logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));

        } else {

#if defined(_WIN32)

            /* Win32 doesn't support line-buffering, so use unbuffered output. */

            setvbuf(qemu_logfile, NULL, _IONBF, 0);

#else

            setvbuf(qemu_logfile, NULL, _IOLBF, 0);

#endif

            log_append = 1;

        }

    }

    if (!qemu_loglevel && qemu_logfile) {

        fclose(qemu_logfile);

        qemu_logfile = NULL;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,17 +1,17 @@
+static inline TCGOp *tcg_emit_op(TCGOpcode opc)
+
+{
+
+    TCGContext *ctx = tcg_ctx;
+
+    int oi = ctx->gen_next_op_idx;
+
+    int ni = oi + 1;
+
+    int pi = oi - 1;
+
+    TCGOp *op = &ctx->gen_op_buf[oi];
+

     tcg_debug_assert(oi < OPC_BUF_SIZE);

static inline TCGOp *tcg_emit_op(TCGOpcode opc)

{

    TCGContext *ctx = tcg_ctx;

    int oi = ctx->gen_next_op_idx;

    int ni = oi + 1;

    int pi = oi - 1;

    TCGOp *op = &ctx->gen_op_buf[oi];

    tcg_debug_assert(oi < OPC_BUF_SIZE);

    ctx->gen_op_buf[0].prev = oi;

    ctx->gen_next_op_idx = ni;

    memset(op, 0, offsetof(TCGOp, args));

    op->opc = opc;

    op->prev = pi;

    op->next = ni;

    return op;

}


--- 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
@@ -1,5 +1,5 @@
+void rng_backend_open(RngBackend *s, Error **errp)
+
 {

     object_property_set_bool(OBJECT(s), true, "opened", errp);

void rng_backend_open(RngBackend *s, Error **errp)

{

    object_property_set_bool(OBJECT(s), true, "opened", errp);

}


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

 {

+    return ldq_phys_internal(addr, DEVICE_BIG_ENDIAN);

 }

uint64_t ldq_be_phys(target_phys_addr_t addr)

{

    return ldq_phys_internal(addr, DEVICE_BIG_ENDIAN);

}


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

     gen_set_label(l1);

+    tcg_gen_andi_i32(cpu_flags, cpu_flags, ~DELAY_SLOT_TRUE);
+
+    gen_jump(ctx);
+
+}

static void gen_delayed_conditional_jump(DisasContext * ctx)

{

    int l1;

    TCGv ds;

    l1 = gen_new_label();

    ds = tcg_temp_new();

    tcg_gen_andi_i32(ds, cpu_flags, DELAY_SLOT_TRUE);

    tcg_gen_brcondi_i32(TCG_COND_NE, ds, 0, l1);

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

    gen_set_label(l1);

    tcg_gen_andi_i32(cpu_flags, cpu_flags, ~DELAY_SLOT_TRUE);

    gen_jump(ctx);

}


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

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

+        base = tswapl(target_vec[i].iov_base);
+
+        unlock_user(vec[i].iov_base, base, copy ? vec[i].iov_len : 0);
+
+    }

     unlock_user (target_vec, target_addr, 0);

static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr,

                             int count, int copy)

{

    struct target_iovec *target_vec;

    abi_ulong base;

    int i;

    target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1);

    if (!target_vec)

        return -TARGET_EFAULT;

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

        base = tswapl(target_vec[i].iov_base);

        unlock_user(vec[i].iov_base, base, copy ? vec[i].iov_len : 0);

    }

    unlock_user (target_vec, target_addr, 0);

    return 0;

}


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

     isabus->assigned |= (1 << isairq);
+
+    dev->isairq[dev->nirqs] = isairq;
+
+    *p = isabus->irqs[isairq];
+
     dev->nirqs++;

 }

void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq)

{

    assert(dev->nirqs < ARRAY_SIZE(dev->isairq));

    if (isabus->assigned & (1 << isairq)) {

        hw_error("isa irq %d already assigned", isairq);

    }

    isabus->assigned |= (1 << isairq);

    dev->isairq[dev->nirqs] = isairq;

    *p = isabus->irqs[isairq];

    dev->nirqs++;

}


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

     BlockStats *s;
+
+
+
+    s = bdrv_query_bds_stats(bs, query_backing);
+

     if (blk) {

static BlockStats *bdrv_query_stats(BlockBackend *blk,

                                    const BlockDriverState *bs,

                                    bool query_backing)

{

    BlockStats *s;

    s = bdrv_query_bds_stats(bs, query_backing);

    if (blk) {

        s->has_device = true;

        s->device = g_strdup(blk_name(blk));

        bdrv_query_blk_stats(s->stats, blk);

    }

    return s;

}


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

+    frame = mxf->last_indexed_edit_unit + mxf->edit_units_count;
+
+
+
+    // write system metadata pack

     avio_write(pb, system_metadata_pack_key, 16);

static void mxf_write_system_item(AVFormatContext *s)

{

    MXFContext *mxf = s->priv_data;

    AVIOContext *pb = s->pb;

    unsigned frame;

    uint32_t time_code;

    frame = mxf->last_indexed_edit_unit + mxf->edit_units_count;

    // write system metadata pack

    avio_write(pb, system_metadata_pack_key, 16);

    klv_encode_ber4_length(pb, 57);

    avio_w8(pb, 0x5c); // UL, user date/time stamp, picture and sound item present

    avio_w8(pb, 0x04); // content package rate

    avio_w8(pb, 0x00); // content package type

    avio_wb16(pb, 0x00); // channel handle

    avio_wb16(pb, mxf->tc.start + frame); // continuity count

    if (mxf->essence_container_count > 1)

        avio_write(pb, multiple_desc_ul, 16);

    else {

        MXFStreamContext *sc = s->streams[0]->priv_data;

        avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16);

    }

    avio_w8(pb, 0);

    avio_wb64(pb, 0);

    avio_wb64(pb, 0); // creation date/time stamp

    avio_w8(pb, 0x81); // SMPTE 12M time code

    time_code = av_timecode_get_smpte_from_framenum(&mxf->tc, frame);

    avio_wb32(pb, time_code);

    avio_wb32(pb, 0); // binary group data

    avio_wb64(pb, 0);

    // write system metadata package set

    avio_write(pb, system_metadata_package_set_key, 16);

    klv_encode_ber4_length(pb, 35);

    avio_w8(pb, 0x83); // UMID

    avio_wb16(pb, 0x20);

    mxf_write_umid(s, 1);

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 static int raw_write(BlockDriverState *bs, int64_t sector_num,
+
+                     const uint8_t *buf, int nb_sectors)
+
+{
+
     if (check_write_unsafe(bs, sector_num, buf, nb_sectors)) {
+
         int ret;

+
         ret = raw_write_scrubbed_bootsect(bs, buf);

         if (ret < 0) {

static int raw_write(BlockDriverState *bs, int64_t sector_num,

                     const uint8_t *buf, int nb_sectors)

{

    if (check_write_unsafe(bs, sector_num, buf, nb_sectors)) {

        int ret;

        ret = raw_write_scrubbed_bootsect(bs, buf);

        if (ret < 0) {

            return ret;

        }

        ret = bdrv_write(bs->file, 1, buf + 512, nb_sectors - 1);

        if (ret < 0) {

            return ret;

        }

        return ret + 512;

    }

    return bdrv_write(bs->file, sector_num, buf, nb_sectors);

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
     st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod];

     if (lfeon)
+
+        st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;
+
+    *ast = bsmod;
+
     if (st->codec->channels > 1 && bsmod == 0x7)

         *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE;

static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)

{

    AVStream *st;

    enum AVAudioServiceType *ast;

    int ac3info, acmod, lfeon, bsmod;

    if (c->fc->nb_streams < 1)

        return 0;

    st = c->fc->streams[c->fc->nb_streams-1];

    ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE,

                                                            sizeof(*ast));

    if (!ast)

        return AVERROR(ENOMEM);

    ac3info = avio_rb24(pb);

    bsmod = (ac3info >> 14) & 0x7;

    acmod = (ac3info >> 11) & 0x7;

    lfeon = (ac3info >> 10) & 0x1;

    st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;

    st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod];

    if (lfeon)

        st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;

    *ast = bsmod;

    if (st->codec->channels > 1 && bsmod == 0x7)

        *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE;

    st->codec->audio_service_type = *ast;

    return 0;

}


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

     int z;

+    const char *effect;
+
+
+
+    effect = fp->amount == 0 ? "none" : fp->amount < 0 ? "blur" : "sharpen";

static void init_filter_param(AVFilterContext *ctx, FilterParam *fp, const char *effect_type, int width)

{

    int z;

    const char *effect;

    effect = fp->amount == 0 ? "none" : fp->amount < 0 ? "blur" : "sharpen";

    av_log(ctx, AV_LOG_VERBOSE, "effect:%s type:%s msize_x:%d msize_y:%d amount:%0.2f\n",

           effect, effect_type, fp->msize_x, fp->msize_y, fp->amount / 65535.0);

    for (z = 0; z < 2 * fp->steps_y; z++)

        fp->sc[z] = av_malloc(sizeof(*(fp->sc[z])) * (width + 2 * fp->steps_x));

}


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

             if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);

+            else                      ff_h264_idct8_add_sse2   (dst + block_offset[i], block + i*16, stride);
+
+        }
+
     }

 }

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

    int i;

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

        int nnz = nnzc[ scan8[i] ];

        if(nnz){

            if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);

            else                      ff_h264_idct8_add_sse2   (dst + block_offset[i], block + i*16, stride);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -10,8 +10,8 @@
         g364fb_draw_blank(s);
     } else if (s->depth == 8) {
         g364fb_draw_graphic8(s);
+    } else {
+        error_report("g364: unknown guest depth %d", s->depth);
+    }
+    qemu_irq_raise(s->irq);
 }

static void g364fb_update_display(void *opaque)
{
    G364State *s = opaque;
    if (s->width == 0 || s->height == 0)
        return;
    if (s->width != ds_get_width(s->ds) || s->height != ds_get_height(s->ds)) {
        qemu_console_resize(s->ds, s->width, s->height);
    }
    if (s->ctla & CTLA_FORCE_BLANK) {
        g364fb_draw_blank(s);
    } else if (s->depth == 8) {
        g364fb_draw_graphic8(s);
    } else {
        error_report("g364: unknown guest depth %d", s->depth);
    }
    qemu_irq_raise(s->irq);
}


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

     }

+
+
+    assert(index != 0 && desc->str[index] != NULL);
+
+    dst = snprintf(serial, sizeof(serial), "%s", desc->str[index]);

     path = qdev_get_dev_path(hcd);

void usb_desc_create_serial(USBDevice *dev)

{

    DeviceState *hcd = dev->qdev.parent_bus->parent;

    const USBDesc *desc = usb_device_get_usb_desc(dev);

    int index = desc->id.iSerialNumber;

    char serial[64];

    char *path;

    int dst;

    if (dev->serial) {

        /* 'serial' usb bus property has priority if present */

        usb_desc_set_string(dev, index, dev->serial);

        return;

    }

    assert(index != 0 && desc->str[index] != NULL);

    dst = snprintf(serial, sizeof(serial), "%s", desc->str[index]);

    path = qdev_get_dev_path(hcd);

    if (path) {

        dst += snprintf(serial+dst, sizeof(serial)-dst, "-%s", path);

    }

    dst += snprintf(serial+dst, sizeof(serial)-dst, "-%s", dev->port->path);

    usb_desc_set_string(dev, index, serial);

}


--- a/source.c
+++ b/source.c
@@ -1,19 +1,19 @@
+static int find_and_check_chardev(CharDriverState **chr,

                                   char *chr_name,

                                   Error **errp)
+
 {
+
+    CompareChardevProps props;

+
+    *chr = qemu_chr_find(chr_name);

     if (*chr == NULL) {
+
         error_setg(errp, "Device '%s' not found",

                    chr_name);

static int find_and_check_chardev(CharDriverState **chr,

                                  char *chr_name,

                                  Error **errp)

{

    CompareChardevProps props;

    *chr = qemu_chr_find(chr_name);

    if (*chr == NULL) {

        error_setg(errp, "Device '%s' not found",

                   chr_name);

        return 1;

    }

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

    if (qemu_opt_foreach((*chr)->opts, compare_chardev_opts, &props, errp)) {

        return 1;

    }

    if (!props.is_socket) {

        error_setg(errp, "chardev \"%s\" is not a tcp socket",

                   chr_name);

        return 1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,9 +11,9 @@
     uint8_t *out_end;

+
+    /* Test buffer size. */
+
     if (offset * s->depth > bytestream2_get_bytes_left(&s->g))

         return AVERROR_INVALIDDATA;

static int read_uncompressed_sgi(unsigned char* out_buf, SgiState *s)

{

    int x, y, z;

    unsigned int offset = s->height * s->width * s->bytes_per_channel;

    GetByteContext gp[4];

    uint8_t *out_end;

    /* Test buffer size. */

    if (offset * s->depth > bytestream2_get_bytes_left(&s->g))

        return AVERROR_INVALIDDATA;

    /* Create a reader for each plane */

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

        gp[z] = s->g;

        bytestream2_skip(&gp[z], z * offset);

    }

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

        out_end = out_buf + (y * s->linesize);

        if (s->bytes_per_channel == 1) {

            for (x = s->width; x > 0; x--) {

                bytestream2_get_bufferu(&gp[z], out_end, s->depth);

                out_end += s->depth;

            }

        } else {

            uint16_t *out16 = (uint16_t *)out_end;

            for (x = s->width; x > 0; x--)

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

                    *out16++ = bytestream2_get_ne16u(&gp[z]);

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void slirp_receive(void *opaque, const uint8_t *buf, size_t size)
+
+{
+
 #ifdef DEBUG_SLIRP

     printf("slirp input:\n");

static void slirp_receive(void *opaque, const uint8_t *buf, size_t size)

{

#ifdef DEBUG_SLIRP

    printf("slirp input:\n");

    hex_dump(stdout, buf, size);

#endif

    slirp_input(buf, size);

}


void input_type_enum(Visitor *v, int *obj, const char *strings[],

                     const char *kind, const char *name,

                     Error **errp)

{

    int64_t value = 0;

    char *enum_str;

    assert(strings);

    visit_type_str(v, &enum_str, name, errp);

    if (error_is_set(errp)) {

        return;

    }

    while (strings[value] != NULL) {

        if (strcmp(strings[value], enum_str) == 0) {

            break;

        }

        value++;

    }

    if (strings[value] == NULL) {

        error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null");

        g_free(enum_str);

        return;

    }

    g_free(enum_str);

    *obj = value;

}


--- a/source.c
+++ b/source.c
@@ -35,11 +35,11 @@
                                    rsdp_table, &rsdp->rsdt_physical_address,

                                    sizeof rsdp->rsdt_physical_address);
+
+    rsdp->checksum = 0;
+
+    /* Checksum to be filled by Guest linker */
+
     bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,

                                     rsdp, rsdp, sizeof *rsdp, &rsdp->checksum);

build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)

{

    AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp);

    bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16,

                             true /* fseg memory */);

    memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));

    memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));

    rsdp->length = cpu_to_le32(sizeof(*rsdp));

    rsdp->revision = 0x02;

    /* Point to RSDT */

    rsdp->rsdt_physical_address = cpu_to_le32(rsdt);

    /* Address to be filled by Guest linker */

    bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE,

                                   ACPI_BUILD_TABLE_FILE,

                                   rsdp_table, &rsdp->rsdt_physical_address,

                                   sizeof rsdp->rsdt_physical_address);

    rsdp->checksum = 0;

    /* Checksum to be filled by Guest linker */

    bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,

                                    rsdp, rsdp, sizeof *rsdp, &rsdp->checksum);

    return rsdp_table;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc,
+
                               target_ulong *r0_p)

 {
@@ -19,7 +19,7 @@
     COPY(gregs[4]); COPY(gregs[5]);

     COPY(gregs[6]); COPY(gregs[7]);
+
     COPY(gregs[8]); COPY(gregs[9]);

     COPY(gregs[10]); COPY(gregs[11]);

static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc,

                              target_ulong *r0_p)

{

    unsigned int err = 0;

    int i;

#define COPY(x)         __get_user(regs->x, &sc->sc_##x)

    COPY(gregs[1]);

    COPY(gregs[2]); COPY(gregs[3]);

    COPY(gregs[4]); COPY(gregs[5]);

    COPY(gregs[6]); COPY(gregs[7]);

    COPY(gregs[8]); COPY(gregs[9]);

    COPY(gregs[10]); COPY(gregs[11]);

    COPY(gregs[12]); COPY(gregs[13]);

    COPY(gregs[14]); COPY(gregs[15]);

    COPY(gbr); COPY(mach);

    COPY(macl); COPY(pr);

    COPY(sr); COPY(pc);

#undef COPY

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

        __get_user(regs->fregs[i], &sc->sc_fpregs[i]);

    }

    __get_user(regs->fpscr, &sc->sc_fpscr);

    __get_user(regs->fpul, &sc->sc_fpul);

    regs->tra = -1;         /* disable syscall checks */

    __get_user(*r0_p, &sc->sc_gregs[0]);

    return err;

}


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

 {

+    BDRVNBDState *s = opaque;

     uint64_t i;

static void nbd_reply_ready(void *opaque)

{

    BDRVNBDState *s = opaque;

    uint64_t i;

    if (s->reply.handle == 0) {

        /* No reply already in flight.  Fetch a header.  */

        if (nbd_receive_reply(s->sock, &s->reply) < 0) {

            s->reply.handle = 0;

            goto fail;

        }

    }

    /* There's no need for a mutex on the receive side, because the

     * handler acts as a synchronization point and ensures that only

     * one coroutine is called until the reply finishes.  */

    i = HANDLE_TO_INDEX(s, s->reply.handle);

    if (i >= MAX_NBD_REQUESTS) {

        goto fail;

    }

    if (s->recv_coroutine[i]) {

        qemu_coroutine_enter(s->recv_coroutine[i], NULL);

        return;

    }

fail:

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

        if (s->recv_coroutine[i]) {

            qemu_coroutine_enter(s->recv_coroutine[i], NULL);

        }

    }

}


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

   fprintf(stderr, "PowerPC performance report\n Values are from the Time Base register, and represent 4 bus cycles.\n");

+#else /* POWERPC_PERF_USE_PMC */
+
+  fprintf(stderr, "PowerPC performance report\n Values are from the PMC registers, and represent whatever the registers are set to record.\n");
+
+#endif /* POWERPC_PERF_USE_PMC */

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

void powerpc_display_perf_report(void)

{

  int i;

#ifndef POWERPC_PERF_USE_PMC

  fprintf(stderr, "PowerPC performance report\n Values are from the Time Base register, and represent 4 bus cycles.\n");

#else /* POWERPC_PERF_USE_PMC */

  fprintf(stderr, "PowerPC performance report\n Values are from the PMC registers, and represent whatever the registers are set to record.\n");

#endif /* POWERPC_PERF_USE_PMC */

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

  {

    if (perfdata[i][powerpc_data_num] != (unsigned long long)0)

      fprintf(stderr, " Function \"%s\" (pmc1):\n\tmin: %llu\n\tmax: %llu\n\tavg: %1.2lf (%llu)\n",

              perfname[i],

              perfdata[i][powerpc_data_min],

              perfdata[i][powerpc_data_max],

              (double)perfdata[i][powerpc_data_sum] /

              (double)perfdata[i][powerpc_data_num],

              perfdata[i][powerpc_data_num]);

#ifdef POWERPC_PERF_USE_PMC

    if (perfdata_pmc2[i][powerpc_data_num] != (unsigned long long)0)

      fprintf(stderr, " Function \"%s\" (pmc2):\n\tmin: %llu\n\tmax: %llu\n\tavg: %1.2lf (%llu)\n",

              perfname[i],

              perfdata_pmc2[i][powerpc_data_min],

              perfdata_pmc2[i][powerpc_data_max],

              (double)perfdata_pmc2[i][powerpc_data_sum] /

              (double)perfdata_pmc2[i][powerpc_data_num],

              perfdata_pmc2[i][powerpc_data_num]);

    if (perfdata_pmc3[i][powerpc_data_num] != (unsigned long long)0)

      fprintf(stderr, " Function \"%s\" (pmc3):\n\tmin: %llu\n\tmax: %llu\n\tavg: %1.2lf (%llu)\n",

              perfname[i],

              perfdata_pmc3[i][powerpc_data_min],

              perfdata_pmc3[i][powerpc_data_max],

              (double)perfdata_pmc3[i][powerpc_data_sum] /

              (double)perfdata_pmc3[i][powerpc_data_num],

              perfdata_pmc3[i][powerpc_data_num]);

#endif

  }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void qemu_sgl_init_external(VirtIOSCSIReq *req, struct iovec *sg,

+                                   hwaddr *addr, int num)
+
+{
+
     QEMUSGList *qsgl = &req->qsgl;

static void qemu_sgl_init_external(VirtIOSCSIReq *req, struct iovec *sg,

                                   hwaddr *addr, int num)

{

    QEMUSGList *qsgl = &req->qsgl;

    qemu_sglist_init(qsgl, DEVICE(req->dev), num, &address_space_memory);

    while (num--) {

        qemu_sglist_add(qsgl, *(addr++), (sg++)->iov_len);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen)

 {
+
     int ret;

+
 #ifdef CONFIG_ACCEPT4

     ret = accept4(s, addr, addrlen, SOCK_CLOEXEC);

int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen)

{

    int ret;

#ifdef CONFIG_ACCEPT4

    ret = accept4(s, addr, addrlen, SOCK_CLOEXEC);

#else

    ret = accept(s, addr, addrlen);

    if (ret >= 0) {

        qemu_set_cloexec(ret);

    }

#endif

    return ret;

}


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

             tcg_gen_op4ii_i64(INDEX_op_brcond_i64, arg1, arg2, cond, label);
+
+        }
+
+    }
+
 }

void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, TCGv_i64 arg2, int label)

{

    if (cond == TCG_COND_ALWAYS) {

        tcg_gen_br(label);

    } else if (cond != TCG_COND_NEVER) {

        if (TCG_TARGET_REG_BITS == 32) {

            tcg_gen_op6ii_i32(INDEX_op_brcond2_i32, TCGV_LOW(arg1),

                              TCGV_HIGH(arg1), TCGV_LOW(arg2),

                              TCGV_HIGH(arg2), cond, label);

        } else {

            tcg_gen_op4ii_i64(INDEX_op_brcond_i64, arg1, arg2, cond, label);

        }

    }

}


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

     target_ulong cs_base, pc;

+    uint32_t flags;
+
+    uint32_t cflags = 1 | CF_IGNORE_ICOUNT;
+
+

     if (sigsetjmp(cpu->jmp_env, 0) == 0) {

static void cpu_exec_step(CPUState *cpu)

{

    CPUClass *cc = CPU_GET_CLASS(cpu);

    TranslationBlock *tb;

    target_ulong cs_base, pc;

    uint32_t flags;

    uint32_t cflags = 1 | CF_IGNORE_ICOUNT;

    if (sigsetjmp(cpu->jmp_env, 0) == 0) {

        tb = tb_lookup__cpu_state(cpu, &pc, &cs_base, &flags,

                                  cflags & CF_HASH_MASK);

        if (tb == NULL) {

            mmap_lock();

            tb_lock();

            tb = tb_gen_code(cpu, pc, cs_base, flags, cflags);

            tb_unlock();

            mmap_unlock();

        }

        cc->cpu_exec_enter(cpu);

        /* execute the generated code */

        trace_exec_tb(tb, pc);

        cpu_tb_exec(cpu, tb);

        cc->cpu_exec_exit(cpu);

    } else {

        /* We may have exited due to another problem here, so we need

         * to reset any tb_locks we may have taken but didn't release.

         * The mmap_lock is dropped by tb_gen_code if it runs out of

         * memory.

         */

#ifndef CONFIG_SOFTMMU

        tcg_debug_assert(!have_mmap_lock());

#endif

        tb_lock_reset();

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int decode_block(ALSDecContext *ctx, ALSBlockData *bd)

 {
+
     unsigned int smp;

+

     // read block type flag and read the samples accordingly

static int decode_block(ALSDecContext *ctx, ALSBlockData *bd)

{

    unsigned int smp;

    // read block type flag and read the samples accordingly

    if (*bd->const_block)

        decode_const_block_data(ctx, bd);

    else if (decode_var_block_data(ctx, bd))

        return -1;

    // TODO: read RLSLMS extension data

    if (*bd->shift_lsbs)

        for (smp = 0; smp < bd->block_length; smp++)

            bd->raw_samples[smp] <<= *bd->shift_lsbs;

    return 0;

}


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

     ctx->poll_max_ns = max_ns;
+
+    ctx->poll_ns = 0;
+
+    ctx->poll_grow = grow;
+
     ctx->poll_shrink = shrink;

void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,

                                 int64_t grow, int64_t shrink, Error **errp)

{

    /* No thread synchronization here, it doesn't matter if an incorrect value

     * is used once.

     */

    ctx->poll_max_ns = max_ns;

    ctx->poll_ns = 0;

    ctx->poll_grow = grow;

    ctx->poll_shrink = shrink;

    aio_notify(ctx);

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
         error_report("warning: ssh server %s does not support fsync",

                      s->inet->host);
+
+        if (what) {
+
+            error_report("to support fsync, you need %s", what);
+
         }

         s->unsafe_flush_warning = true;

static void unsafe_flush_warning(BDRVSSHState *s, const char *what)

{

    if (!s->unsafe_flush_warning) {

        error_report("warning: ssh server %s does not support fsync",

                     s->inet->host);

        if (what) {

            error_report("to support fsync, you need %s", what);

        }

        s->unsafe_flush_warning = true;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void vmsvga_init(struct vmsvga_state_s *s,
+
                         MemoryRegion *address_space, MemoryRegion *io)

 {
+
     DisplaySurface *surface;

@@ -11,8 +11,8 @@
     s->scratch_size = SVGA_SCRATCH_SIZE;

     s->scratch = g_malloc(s->scratch_size * 4);
+
+

     s->vga.con = graphic_console_init(vmsvga_update_display,

static void vmsvga_init(struct vmsvga_state_s *s,

                        MemoryRegion *address_space, MemoryRegion *io)

{

    DisplaySurface *surface;

    s->scratch_size = SVGA_SCRATCH_SIZE;

    s->scratch = g_malloc(s->scratch_size * 4);

    s->vga.con = graphic_console_init(vmsvga_update_display,

                                      vmsvga_invalidate_display,

                                      vmsvga_screen_dump,

                                      vmsvga_text_update, s);

    surface = qemu_console_surface(s->vga.con);

    s->fifo_size = SVGA_FIFO_SIZE;

    memory_region_init_ram(&s->fifo_ram, "vmsvga.fifo", s->fifo_size);

    vmstate_register_ram_global(&s->fifo_ram);

    s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram);

    vga_common_init(&s->vga);

    vga_init(&s->vga, address_space, io, true);

    vmstate_register(NULL, 0, &vmstate_vga_common, &s->vga);

    /* Save some values here in case they are changed later.

     * This is suspicious and needs more though why it is needed. */

    s->depth = surface_bits_per_pixel(surface);

    s->bypp = surface_bytes_per_pixel(surface);

}


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

     fd = qemu_chr_fe_get_msgfd(cur_mon->chr);

+    if (fd == -1) {
+
+        error_set(errp, QERR_FD_NOT_SUPPLIED);
+
+        return;

     }

void qmp_getfd(const char *fdname, Error **errp)

{

    mon_fd_t *monfd;

    int fd;

    fd = qemu_chr_fe_get_msgfd(cur_mon->chr);

    if (fd == -1) {

        error_set(errp, QERR_FD_NOT_SUPPLIED);

        return;

    }

    if (qemu_isdigit(fdname[0])) {

        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname",

                  "a name not starting with a digit");

        return;

    }

    QLIST_FOREACH(monfd, &cur_mon->fds, next) {

        if (strcmp(monfd->name, fdname) != 0) {

            continue;

        }

        close(monfd->fd);

        monfd->fd = fd;

        return;

    }

    monfd = g_malloc0(sizeof(mon_fd_t));

    monfd->name = g_strdup(fdname);

    monfd->fd = fd;

    QLIST_INSERT_HEAD(&cur_mon->fds, monfd, next);

}


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

     char desc[DESC_SIZE];

+    char parent_img_name[1024];

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

+    if ((p_name = strstr(desc,"parentFileNameHint")) != 0) {

         char *end_name;

static int vmdk_parent_open(BlockDriverState *bs, const char * filename)

{

    BDRVVmdkState *s = bs->opaque;

    char *p_name;

    char desc[DESC_SIZE];

    char parent_img_name[1024];

    /* the descriptor offset = 0x200 */

    if (bdrv_pread(s->hd, 0x200, desc, DESC_SIZE) != DESC_SIZE)

        return -1;

    if ((p_name = strstr(desc,"parentFileNameHint")) != 0) {

        char *end_name;

        struct stat file_buf;

        p_name += sizeof("parentFileNameHint") + 1;

        if ((end_name = strchr(p_name,'\"')) == 0)

            return -1;

        strncpy(s->hd->backing_file, p_name, end_name - p_name);

        if (stat(s->hd->backing_file, &file_buf) != 0) {

            path_combine(parent_img_name, sizeof(parent_img_name),

                         filename, s->hd->backing_file);

        } else {

            strcpy(parent_img_name, s->hd->backing_file);

        }

        s->hd->backing_hd = bdrv_new("");

        if (!s->hd->backing_hd) {

            failure:

            bdrv_close(s->hd);

            return -1;

        }

        if (bdrv_open(s->hd->backing_hd, parent_img_name, 0) < 0)

            goto failure;

    }

    return 0;

}


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

+    ret->type = ORG_QEMU_X_UNION1_KIND___ORG_QEMU_X_BRANCH;
+
+    ret->u.__org_qemu_x_branch = strdup("blah1");
+
+

__org_qemu_x_Union1 *qmp___org_qemu_x_command(__org_qemu_x_EnumList *a,

                                              __org_qemu_x_StructList *b,

                                              __org_qemu_x_Union2 *c,

                                              __org_qemu_x_Alt *d,

                                              Error **errp)

{

    __org_qemu_x_Union1 *ret = g_new0(__org_qemu_x_Union1, 1);

    ret->type = ORG_QEMU_X_UNION1_KIND___ORG_QEMU_X_BRANCH;

    ret->u.__org_qemu_x_branch = strdup("blah1");

    return ret;


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
                              NULL, /* memory_region_set_container */

                              NULL, NULL, &error_abort);
+
+    op->resolve = memory_region_resolve_container;
+
+
+
     object_property_add(OBJECT(mr), "addr", "uint64",

                         memory_region_get_addr,

static void memory_region_initfn(Object *obj)

{

    MemoryRegion *mr = MEMORY_REGION(obj);

    ObjectProperty *op;

    mr->ops = &unassigned_mem_ops;

    mr->enabled = true;

    mr->romd_mode = true;

    mr->global_locking = true;

    mr->destructor = memory_region_destructor_none;

    QTAILQ_INIT(&mr->subregions);

    QTAILQ_INIT(&mr->coalesced);

    op = object_property_add(OBJECT(mr), "container",

                             "link<" TYPE_MEMORY_REGION ">",

                             memory_region_get_container,

                             NULL, /* memory_region_set_container */

                             NULL, NULL, &error_abort);

    op->resolve = memory_region_resolve_container;

    object_property_add(OBJECT(mr), "addr", "uint64",

                        memory_region_get_addr,

                        NULL, /* memory_region_set_addr */

                        NULL, NULL, &error_abort);

    object_property_add(OBJECT(mr), "priority", "uint32",

                        memory_region_get_priority,

                        NULL, /* memory_region_set_priority */

                        NULL, NULL, &error_abort);

    object_property_add_bool(OBJECT(mr), "may-overlap",

                             memory_region_get_may_overlap,

                             NULL, /* memory_region_set_may_overlap */

                             &error_abort);

    object_property_add(OBJECT(mr), "size", "uint64",

                        memory_region_get_size,

                        NULL, /* memory_region_set_size, */

                        NULL, NULL, &error_abort);

}


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

     dp8393xState *s = opaque;
+
+
+
+    if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN))

         return 0;

static int nic_can_receive(void *opaque)

{

    dp8393xState *s = opaque;

    if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN))

        return 0;

    if (s->regs[SONIC_ISR] & SONIC_ISR_RBE)

        return 0;

    return 1;

}


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

+    if (dec_alu_op_b_is_small_imm(dc)) {
+
+        int32_t offset = (int32_t)((int16_t)dc->imm); /* sign-extend.  */
+
+

         tcg_gen_movi_tl(env_btarget, dc->pc + offset);

static void dec_bcc(DisasContext *dc)

{

    unsigned int cc;

    unsigned int dslot;

    cc = EXTRACT_FIELD(dc->ir, 21, 23);

    dslot = dc->ir & (1 << 25);

    LOG_DIS("bcc%s r%d %x\n", dslot ? "d" : "", dc->ra, dc->imm);

    dc->delayed_branch = 1;

    if (dslot) {

        dc->delayed_branch = 2;

        dc->tb_flags |= D_FLAG;

        tcg_gen_st_tl(tcg_const_tl(dc->type_b && (dc->tb_flags & IMM_FLAG)),

                      cpu_env, offsetof(CPUState, bimm));

    }

    if (dec_alu_op_b_is_small_imm(dc)) {

        int32_t offset = (int32_t)((int16_t)dc->imm); /* sign-extend.  */

        tcg_gen_movi_tl(env_btarget, dc->pc + offset);

    } else {

        tcg_gen_movi_tl(env_btarget, dc->pc);

        tcg_gen_add_tl(env_btarget, env_btarget, *(dec_alu_op_b(dc)));

    }

    dc->jmp = JMP_INDIRECT;

    eval_cc(dc, cc, env_btaken, cpu_R[dc->ra], tcg_const_tl(0));

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
+
+{
+
 	long i;
+
+	long num_pixels = src_size >> 1;
+
+
+
+	for(i=0; i<num_pixels; i++)
+
 	{

 	    unsigned b,g,r;

void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size)

{

	long i;

	long num_pixels = src_size >> 1;

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

	{

	    unsigned b,g,r;

	    register uint16_t rgb;

	    rgb = src[2*i];

	    r = rgb&0x1F;

	    g = (rgb&0x7E0)>>5;

	    b = (rgb&0xF800)>>11;

	    dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10);

	}

}


--- a/source.c
+++ b/source.c
@@ -1,22 +1,22 @@
 static inline void FUNC(idctSparseColAdd)(pixel *dest, int line_size,

+                                          DCTELEM *col)

+{

+    int a0, a1, a2, a3, b0, b1, b2, b3;

+    INIT_CLIP;

+

+    IDCT_COLS;

+

+    dest[0] = CLIP(dest[0] + ((a0 + b0) >> COL_SHIFT));

+    dest += line_size;

     dest[0] = CLIP(dest[0] + ((a1 + b1) >> COL_SHIFT));

static inline void FUNC(idctSparseColAdd)(pixel *dest, int line_size,

                                          DCTELEM *col)

{

    int a0, a1, a2, a3, b0, b1, b2, b3;

    INIT_CLIP;

    IDCT_COLS;

    dest[0] = CLIP(dest[0] + ((a0 + b0) >> COL_SHIFT));

    dest += line_size;

    dest[0] = CLIP(dest[0] + ((a1 + b1) >> COL_SHIFT));

    dest += line_size;

    dest[0] = CLIP(dest[0] + ((a2 + b2) >> COL_SHIFT));

    dest += line_size;

    dest[0] = CLIP(dest[0] + ((a3 + b3) >> COL_SHIFT));

    dest += line_size;

    dest[0] = CLIP(dest[0] + ((a3 - b3) >> COL_SHIFT));

    dest += line_size;

    dest[0] = CLIP(dest[0] + ((a2 - b2) >> COL_SHIFT));

    dest += line_size;

    dest[0] = CLIP(dest[0] + ((a1 - b1) >> COL_SHIFT));

    dest += line_size;

    dest[0] = CLIP(dest[0] + ((a0 - b0) >> COL_SHIFT));

}


--- a/source.c
+++ b/source.c
@@ -8,9 +8,9 @@
     mr->destructor(mr);

     memory_region_clear_coalescing(mr);
+
+    g_free((char *)mr->name);
+
+    g_free(mr->ioeventfds);

 }

void memory_region_destroy(MemoryRegion *mr)

{

    assert(QTAILQ_EMPTY(&mr->subregions));

    mr->destructor(mr);

    memory_region_clear_coalescing(mr);

    g_free((char *)mr->name);

    g_free(mr->ioeventfds);

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     TAILQ_FOREACH(chr, &chardevs, next) {

         monitor_printf(mon, "%s: filename=%s\n", chr->label, chr->filename);
+
+    }
+
 }

void qemu_chr_info(Monitor *mon)

{

    CharDriverState *chr;

    TAILQ_FOREACH(chr, &chardevs, next) {

        monitor_printf(mon, "%s: filename=%s\n", chr->label, chr->filename);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static inline void gen_addr_imm_index (DisasContext *ctx)

 {
+
     target_long simm = SIMM(ctx->opcode);

static inline void gen_addr_imm_index (DisasContext *ctx)

{

    target_long simm = SIMM(ctx->opcode);

    if (rA(ctx->opcode) == 0) {

        gen_op_set_T0(simm);

    } else {

        gen_op_load_gpr_T0(rA(ctx->opcode));

        if (likely(simm != 0))

            gen_op_addi(simm);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs,
+
+        BdrvTrackedRequest *self, int64_t offset, unsigned int bytes)
+
+{

     BdrvTrackedRequest *req;

static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs,

        BdrvTrackedRequest *self, int64_t offset, unsigned int bytes)

{

    BdrvTrackedRequest *req;

    int64_t cluster_offset;

    unsigned int cluster_bytes;

    bool retry;

    /* If we touch the same cluster it counts as an overlap.  This guarantees

     * that allocating writes will be serialized and not race with each other

     * for the same cluster.  For example, in copy-on-read it ensures that the

     * CoR read and write operations are atomic and guest writes cannot

     * interleave between them.

     */

    round_bytes_to_clusters(bs, offset, bytes, &cluster_offset, &cluster_bytes);

    do {

        retry = false;

        QLIST_FOREACH(req, &bs->tracked_requests, list) {

            if (req == self) {

                continue;

            }

            if (tracked_request_overlaps(req, cluster_offset, cluster_bytes)) {

                /* Hitting this means there was a reentrant request, for

                 * example, a block driver issuing nested requests.  This must

                 * never happen since it means deadlock.

                 */

                assert(qemu_coroutine_self() != req->co);

                qemu_co_queue_wait(&req->wait_queue);

                retry = true;

                break;

            }

        }

    } while (retry);

}


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

     if (mr->subpage) {

+        trace_memory_region_subpage_read(get_cpu_index(), mr, addr, tmp, size);
+
+
+
+

     } else if (TRACE_MEMORY_REGION_OPS_READ_ENABLED) {

static MemTxResult  memory_region_read_accessor(MemoryRegion *mr,

                                                hwaddr addr,

                                                uint64_t *value,

                                                unsigned size,

                                                unsigned shift,

                                                uint64_t mask,

                                                MemTxAttrs attrs)

{

    uint64_t tmp;

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

    if (mr->subpage) {

        trace_memory_region_subpage_read(get_cpu_index(), mr, addr, tmp, size);

    } else if (TRACE_MEMORY_REGION_OPS_READ_ENABLED) {

        hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);

        trace_memory_region_ops_read(get_cpu_index(), mr, abs_addr, tmp, size);

    }

    *value |= (tmp & mask) << shift;

    return MEMTX_OK;

}


struct MUSBState *musb_init(qemu_irq *irqs)

{

    MUSBState *s = g_malloc0(sizeof(*s));

    int i;

    s->irqs = irqs;

    s->faddr = 0x00;

    s->power = MGC_M_POWER_HSENAB;

    s->tx_intr = 0x0000;

    s->rx_intr = 0x0000;

    s->tx_mask = 0xffff;

    s->rx_mask = 0xffff;

    s->intr = 0x00;

    s->mask = 0x06;

    s->idx = 0;

    /* TODO: _DW */

    s->ep[0].config = MGC_M_CONFIGDATA_SOFTCONE | MGC_M_CONFIGDATA_DYNFIFO;

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

        s->ep[i].fifosize = 64;

        s->ep[i].maxp[0] = 0x40;

        s->ep[i].maxp[1] = 0x40;

        s->ep[i].musb = s;

        s->ep[i].epnum = i;

        usb_packet_init(&s->ep[i].packey[0].p);

        usb_packet_init(&s->ep[i].packey[1].p);

    }

    usb_bus_new(&s->bus, &musb_bus_ops, NULL /* FIXME */);

    usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops,

                      USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void common_end(FFV1Context *s){

     int i;

static void common_end(FFV1Context *s){

    int i;

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

        PlaneContext *p= &s->plane[i];

        av_freep(&p->state);

    }

}


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

+    avio_skip(pb, 1); /* one byte has been read ahead */

     avio_skip(pb, 2);

static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)

{

    AVIOContext *pb = ctx->pb;

    uint16_t keyframe;

    uint32_t size, timestamp;

    avio_skip(pb, 1); /* one byte has been read ahead */

    avio_skip(pb, 2);

    avio_skip(pb, 2);

    keyframe = avio_rl16(pb);

    size = avio_rl32(pb);

    avio_skip(pb, 4);

    avio_skip(pb, 4);

    timestamp = avio_rl32(pb);

    if(!size || av_get_packet(pb, pkt, size) != size)

        return -1;

    avio_skip(pb, 1); /* Read ahead one byte of struct size like read_header */

    pkt->pts = timestamp;

    pkt->dts = timestamp;

    pkt->stream_index = 0;

    /* Some aMsn generated videos (or was it Mercury Messenger?) don't set

     * this bit and rely on the codec to get keyframe information */

    if(keyframe&1)

        pkt->flags |= AV_PKT_FLAG_KEY;

    return HEADER_SIZE + size;

}


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

+    s->nbits           = nbits;

     s->inverse         = trans == IRDFT || trans == IRIDFT;

av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)

{

    int n = 1 << nbits;

    int i;

    const double theta = (trans == RDFT || trans == IRIDFT ? -1 : 1)*2*M_PI/n;

    s->nbits           = nbits;

    s->inverse         = trans == IRDFT || trans == IRIDFT;

    s->sign_convention = trans == RIDFT || trans == IRIDFT ? 1 : -1;

    if (nbits < 4 || nbits > 16)

        return -1;

    if (ff_fft_init(&s->fft, nbits-1, trans == IRDFT || trans == RIDFT) < 0)

        return -1;

    s->tcos = ff_cos_tabs[nbits-4];

    s->tsin = ff_sin_tabs[nbits-4]+(trans == RDFT || trans == IRIDFT)*(n>>2);

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

        s->tcos[i] = cos(i*theta);

        s->tsin[i] = sin(i*theta);

    }

    return 0;

}


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

             int n;

+            n = (addr >> 1) & 7;
+
+            if (n >= NB_PORTS)
+
+                goto read_default;

             port = &s->ports[n];

static uint32_t uhci_ioport_readw(void *opaque, uint32_t addr)

{

    UHCIState *s = opaque;

    uint32_t val;

    addr &= 0x1f;

    switch(addr) {

    case 0x00:

        val = s->cmd;

        break;

    case 0x02:

        val = s->status;

        break;

    case 0x04:

        val = s->intr;

        break;

    case 0x06:

        val = s->frnum;

        break;

    case 0x10 ... 0x1f:

        {

            UHCIPort *port;

            int n;

            n = (addr >> 1) & 7;

            if (n >= NB_PORTS)

                goto read_default;

            port = &s->ports[n];

            val = port->ctrl;

        }

        break;

    default:

    read_default:

        val = 0xff7f; /* disabled port */

        break;

    }

#ifdef DEBUG

    printf("uhci readw port=0x%04x val=0x%04x\n", addr, val);

#endif

    return val;

}


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

     s->config[0x05] = 0x00;

+    s->config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error
+
+    s->config[0x07] = 0x03; // status = medium devsel
+
+    s->config[0x08] = 0x01; // revision

     s->config[0x09] = 0x00; // programming i/f

pci_ebus_init1(PCIDevice *s)

{

    isa_bus_new(&s->qdev);

    pci_config_set_vendor_id(s->config, PCI_VENDOR_ID_SUN);

    pci_config_set_device_id(s->config, PCI_DEVICE_ID_SUN_EBUS);

    s->config[0x04] = 0x06; // command = bus master, pci mem

    s->config[0x05] = 0x00;

    s->config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error

    s->config[0x07] = 0x03; // status = medium devsel

    s->config[0x08] = 0x01; // revision

    s->config[0x09] = 0x00; // programming i/f

    pci_config_set_class(s->config, PCI_CLASS_BRIDGE_OTHER);

    s->config[0x0D] = 0x0a; // latency_timer

    pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY,

                           ebus_mmio_mapfunc);

    pci_register_bar(s, 1, 0x800000,  PCI_BASE_ADDRESS_SPACE_MEMORY,

                           ebus_mmio_mapfunc);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int add_tonal_components(float *spectrum, int num_components,

+                                TonalComponent *components)
+
+{
+
+    int i, j, last_pos = -1;

     float *input, *output;

static int add_tonal_components(float *spectrum, int num_components,

                                TonalComponent *components)

{

    int i, j, last_pos = -1;

    float *input, *output;

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

        last_pos = FFMAX(components[i].pos + components[i].num_coefs, last_pos);

        input    = components[i].coef;

        output   = &spectrum[components[i].pos];

        for (j = 0; j < components[i].num_coefs; j++)

            output[i] += input[i];

    }

    return last_pos;

}


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

     qs = qstring_from_substr("virtualization", 3, 9);

+    fail_unless(qs != NULL);
+
+    fail_unless(strcmp(qstring_get_str(qs), "tualiza") == 0);
+

     QDECREF(qs);

START_TEST(qstring_from_substr_test)

{

    QString *qs;

    qs = qstring_from_substr("virtualization", 3, 9);

    fail_unless(qs != NULL);

    fail_unless(strcmp(qstring_get_str(qs), "tualiza") == 0);

    QDECREF(qs);

}


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

 {

+    return !strcmp(name, VIRTFS_META_DIR);

 }

static bool local_is_mapped_file_metadata(FsContext *fs_ctx, const char *name)

{

    return !strcmp(name, VIRTFS_META_DIR);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void diag288_timer_expired(void *dev)

+{

     qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n");

+    watchdog_perform_action();

     /* Reset the watchdog only if the guest was notified about expiry. */

static void diag288_timer_expired(void *dev)

{

    qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n");

    watchdog_perform_action();

    /* Reset the watchdog only if the guest was notified about expiry. */

    switch (get_watchdog_action()) {

    case WDT_DEBUG:

    case WDT_NONE:

    case WDT_PAUSE:

         return;

    }

    wdt_diag288_reset(dev);

}


--- a/source.c
+++ b/source.c
@@ -35,11 +35,11 @@
                 s->input_state[i] = 0;

                 continue;
+
+            }
+
+        } else if (ret < 0)
+
             return ret;

     }

static int request_samples(AVFilterContext *ctx, int min_samples)

{

    MixContext *s = ctx->priv;

    int i, ret;

    av_assert0(s->nb_inputs > 1);

    for (i = 1; i < s->nb_inputs; i++) {

        ret = 0;

        if (!(s->input_state[i] & INPUT_ON))

            continue;

        if (av_audio_fifo_size(s->fifos[i]) >= min_samples)

            continue;

        ret = ff_request_frame(ctx->inputs[i]);

        if (ret == AVERROR_EOF) {

            s->input_state[i] |= INPUT_EOF;

            if (av_audio_fifo_size(s->fifos[i]) == 0) {

                s->input_state[i] = 0;

                continue;

            }

        } else if (ret < 0)

            return ret;

    }

    return output_frame(ctx->outputs[0], 1);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static int virtio_balloon_device_exit(DeviceState *qdev)
+
+{

     VirtIOBalloon *s = VIRTIO_BALLOON(qdev);
+
     VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
+

     balloon_stats_destroy_timer(s);

static int virtio_balloon_device_exit(DeviceState *qdev)

{

    VirtIOBalloon *s = VIRTIO_BALLOON(qdev);

    VirtIODevice *vdev = VIRTIO_DEVICE(qdev);

    balloon_stats_destroy_timer(s);

    qemu_remove_balloon_handler(s);

    unregister_savevm(qdev, "virtio-balloon", s);

    virtio_cleanup(vdev);

    return 0;

}


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

     cpu_abort(dc->env, "unknown opcode 0x%02x\n", dc->opcode);

static void dec_ill(DisasContext *dc)

{

    cpu_abort(dc->env, "unknown opcode 0x%02x\n", dc->opcode);

}


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

                            "'string': 'str', "

+                           "'boolean': true }");
+
+    /* TODO when generator bug is fixed, add 'integer': 41 */
+
+

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

static void test_validate_union_flat(TestInputVisitorData *data,

                                     const void *unused)

{

    UserDefFlatUnion *tmp = NULL;

    Visitor *v;

    Error *err = NULL;

    v = validate_test_init(data,

                           "{ 'enum1': 'value1', "

                           "'string': 'str', "

                           "'boolean': true }");

    /* TODO when generator bug is fixed, add 'integer': 41 */

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

    g_assert(!err);

    qapi_free_UserDefFlatUnion(tmp);

}


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

                               const char *name,

+                              uint64_t size)
+
+{
+
+    memory_region_init(mr, owner, name, size);

     mr->iommu_ops = ops,

void memory_region_init_iommu(MemoryRegion *mr,

                              Object *owner,

                              const MemoryRegionIOMMUOps *ops,

                              const char *name,

                              uint64_t size)

{

    memory_region_init(mr, owner, name, size);

    mr->iommu_ops = ops,

    mr->terminates = true;  /* then re-forwards */

    notifier_list_init(&mr->iommu_notify);

}


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

     Object *obj = object_new(type);
+
+    TestIf *iobj = TEST_IF(obj);
+
+    TestIfClass *ioc = TEST_IF_GET_CLASS(iobj);

static void test_interface_impl(const char *type)

{

    Object *obj = object_new(type);

    TestIf *iobj = TEST_IF(obj);

    TestIfClass *ioc = TEST_IF_GET_CLASS(iobj);

    g_assert(iobj);

    g_assert(ioc->test == PATTERN);

}


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

 		    dc->op1, dc->op2));

+	cris_cc_mask(dc, CC_MASK_NZ);
+
+	t0 = tcg_temp_new(TCG_TYPE_TL);
+
+	dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0, cpu_R[dc->op2], t0);

 	cris_alu(dc, CC_OP_LZ, cpu_R[dc->op2], cpu_R[dc->op2], t0, 4);

static unsigned int dec_lz_r(DisasContext *dc)

{

	TCGv t0;

	DIS(fprintf (logfile, "lz $r%u, $r%u\n",

		    dc->op1, dc->op2));

	cris_cc_mask(dc, CC_MASK_NZ);

	t0 = tcg_temp_new(TCG_TYPE_TL);

	dec_prep_alu_r(dc, dc->op1, dc->op2, 4, 0, cpu_R[dc->op2], t0);

	cris_alu(dc, CC_OP_LZ, cpu_R[dc->op2], cpu_R[dc->op2], t0, 4);

	tcg_temp_free(t0);

	return 2;

}


--- a/source.c
+++ b/source.c
@@ -7,6 +7,6 @@
     blk_drain_all();

+    return 0;
+
+}

static int aio_flush_f(BlockBackend *blk, int argc, char **argv)

{

    blk_drain_all();

    return 0;

}


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

     }

+
+
+    monfd = qemu_mallocz(sizeof(mon_fd_t));
+
+    monfd->name = qemu_strdup(fdname);

     monfd->fd = fd;

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

{

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

    mon_fd_t *monfd;

    int fd;

    fd = qemu_chr_get_msgfd(mon->chr);

    if (fd == -1) {

        monitor_printf(mon, "getfd: no file descriptor supplied via SCM_RIGHTS\n");

        return;

    }

    if (qemu_isdigit(fdname[0])) {

        monitor_printf(mon, "getfd: monitor names may not begin with a number\n");

        return;

    }

    fd = dup(fd);

    if (fd == -1) {

        monitor_printf(mon, "Failed to dup() file descriptor: %s\n",

                       strerror(errno));

        return;

    }

    LIST_FOREACH(monfd, &mon->fds, next) {

        if (strcmp(monfd->name, fdname) != 0) {

            continue;

        }

        close(monfd->fd);

        monfd->fd = fd;

        return;

    }

    monfd = qemu_mallocz(sizeof(mon_fd_t));

    monfd->name = qemu_strdup(fdname);

    monfd->fd = fd;

    LIST_INSERT_HEAD(&mon->fds, monfd, next);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height)

 {

static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height)

{

    /* chroma allocates an edge of 8 when subsampled

       which for 4:2:2 means an h edge of 16 and v edge of 8

       just use 8 for everything for the moment */

    int i, edge = EDGE_WIDTH/2;

    ref->hpel[plane][0] = ref->avframe->data[plane];

    s->mpvencdsp.draw_edges(ref->hpel[plane][0], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); /* EDGE_TOP | EDGE_BOTTOM values just copied to make it build, this needs to be ensured */

    /* no need for hpel if we only have fpel vectors */

    if (!s->mv_precision)

        return;

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

        if (!ref->hpel_base[plane][i])

            ref->hpel_base[plane][i] = av_malloc((height+2*edge) * ref->avframe->linesize[plane] + 32);

        /* we need to be 16-byte aligned even for chroma */

        ref->hpel[plane][i] = ref->hpel_base[plane][i] + edge*ref->avframe->linesize[plane] + 16;

    }

    if (!ref->interpolated[plane]) {

        s->diracdsp.dirac_hpel_filter(ref->hpel[plane][1], ref->hpel[plane][2],

                                      ref->hpel[plane][3], ref->hpel[plane][0],

                                      ref->avframe->linesize[plane], width, height);

        s->mpvencdsp.draw_edges(ref->hpel[plane][1], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM);

        s->mpvencdsp.draw_edges(ref->hpel[plane][2], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM);

        s->mpvencdsp.draw_edges(ref->hpel[plane][3], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM);

    }

    ref->interpolated[plane] = 1;

}


--- a/source.c
+++ b/source.c
@@ -43,11 +43,11 @@
     if (block_mig_state.total_sector_sum != 0) {

         progress = completed_sector_sum * 100 /
+
+                   block_mig_state.total_sector_sum;
+
+    } else {
+
         progress = 100;

     }

static int blk_mig_save_bulked_block(QEMUFile *f)

{

    int64_t completed_sector_sum = 0;

    BlkMigDevState *bmds;

    int progress;

    int ret = 0;

    QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {

        if (bmds->bulk_completed == 0) {

            if (mig_save_device_bulk(f, bmds) == 1) {

                /* completed bulk section for this device */

                bmds->bulk_completed = 1;

            }

            completed_sector_sum += bmds->completed_sectors;

            ret = 1;

            break;

        } else {

            completed_sector_sum += bmds->completed_sectors;

        }

    }

    if (block_mig_state.total_sector_sum != 0) {

        progress = completed_sector_sum * 100 /

                   block_mig_state.total_sector_sum;

    } else {

        progress = 100;

    }

    if (progress != block_mig_state.prev_progress) {

        block_mig_state.prev_progress = progress;

        qemu_put_be64(f, (progress << BDRV_SECTOR_BITS)

                         | BLK_MIG_FLAG_PROGRESS);

        DPRINTF("Completed %d %%\r", progress);

    }

    return ret;

}


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

     vnc_client_io_error(vs, -1, EINVAL);

void vnc_client_error(VncState *vs)

{

    vnc_client_io_error(vs, -1, EINVAL);

}


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

     char f = 'X';
+
+    const char *endptr = &f;
+
     uint64_t res = 999;

     int err;

static void test_qemu_strtoull_whitespace(void)

{

    const char *str = "  \t  ";

    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_cmpint(res, ==, 0);

    g_assert(endptr == str);

}


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

 {

+    RwCo *rwco = opaque;
+

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

static void coroutine_fn bdrv_flush_co_entry(void *opaque)

{

    RwCo *rwco = opaque;

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

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void memory_region_finalize(Object *obj)
+
+{
+
+    MemoryRegion *mr = MEMORY_REGION(obj);
+

     assert(QTAILQ_EMPTY(&mr->subregions));

static void memory_region_finalize(Object *obj)

{

    MemoryRegion *mr = MEMORY_REGION(obj);

    assert(QTAILQ_EMPTY(&mr->subregions));

    assert(memory_region_transaction_depth == 0);

    mr->destructor(mr);

    memory_region_clear_coalescing(mr);

    g_free((char *)mr->name);

    g_free(mr->ioeventfds);

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     s->timer.irq = irq;

     s->timer.clk = clk;
+
+    s->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &s->timer);
+
+    omap_wd_timer_reset(s);
+
     omap_timer_clk_setup(&s->timer);

static struct omap_watchdog_timer_s *omap_wd_timer_init(MemoryRegion *memory,

                target_phys_addr_t base,

                qemu_irq irq, omap_clk clk)

{

    struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *)

            g_malloc0(sizeof(struct omap_watchdog_timer_s));

    s->timer.irq = irq;

    s->timer.clk = clk;

    s->timer.timer = qemu_new_timer_ns(vm_clock, omap_timer_tick, &s->timer);

    omap_wd_timer_reset(s);

    omap_timer_clk_setup(&s->timer);

    memory_region_init_io(&s->iomem, &omap_wd_timer_ops, s,

                          "omap-wd-timer", 0x100);

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

    return s;

}


--- a/source.c
+++ b/source.c
@@ -18,11 +18,11 @@
         PUT_COEFF(ac);
     }
     // 4 bits per coefficient
+    ALIGN(4);
+    if (get_bits_count(gb) + (coeff << 2) >= gb->size_in_bits)
+    while (coeff) {
+        ac = get_sbits(gb, 4);
+        if (ac == -8)
             break; // continue with more bits
         PUT_COEFF(ac);
     }

static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *scan,
                            const uint32_t *quant) {
    int coeff, i, n;
    int8_t ac;
    uint8_t dc = get_bits(gb, 8);
    // block not coded
    if (dc == 255)
    // number of non-zero coefficients
    coeff = get_bits(gb, 6);
    // normally we would only need to clear the (63 - coeff) last values,
    // but since we do not know where they are we just clear the whole block
    memset(block, 0, 64 * sizeof(DCTELEM));
    // 2 bits per coefficient
    while (coeff) {
        ac = get_sbits(gb, 2);
        if (ac == -2)
            break; // continue with more bits
        PUT_COEFF(ac);
    }
    // 4 bits per coefficient
    ALIGN(4);
    if (get_bits_count(gb) + (coeff << 2) >= gb->size_in_bits)
    while (coeff) {
        ac = get_sbits(gb, 4);
        if (ac == -8)
            break; // continue with more bits
        PUT_COEFF(ac);
    }
    // 8 bits per coefficient
    ALIGN(8);
    if (get_bits_count(gb) + (coeff << 3) >= gb->size_in_bits)
    while (coeff) {
        ac = get_sbits(gb, 8);
        PUT_COEFF(ac);
    }
    PUT_COEFF(dc);
    return 1;
}


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

     s->base = base;

+    s->ds = ds;
+
+    iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn,
+
+                                       musicpal_lcd_writefn, s);

     cpu_register_physical_memory(base, MP_LCD_SIZE, iomemtype);

static void musicpal_lcd_init(DisplayState *ds, uint32_t base)

{

    musicpal_lcd_state *s;

    int iomemtype;

    s = qemu_mallocz(sizeof(musicpal_lcd_state));

    if (!s)

        return;

    s->base = base;

    s->ds = ds;

    iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn,

                                       musicpal_lcd_writefn, s);

    cpu_register_physical_memory(base, MP_LCD_SIZE, iomemtype);

    graphic_console_init(ds, lcd_refresh, NULL, NULL, NULL, s);

    dpy_resize(ds, 128*3, 64*3);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static inline int *DEC_UPAIR(int *dst, unsigned idx, unsigned sign)

+{

     dst[0] = (idx & 15) * (1 - (sign & 0xFFFFFFFE));

static inline int *DEC_UPAIR(int *dst, unsigned idx, unsigned sign)

{

    dst[0] = (idx & 15) * (1 - (sign & 0xFFFFFFFE));

    dst[1] = (idx >> 4 & 15) * (1 - ((sign & 1) << 1));

    return dst + 2;

}


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

 {

+    PtyCharDriver *s = chr->opaque;

static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)

{

    PtyCharDriver *s = chr->opaque;

    if (!s->connected) {

        /* guest sends data, check for (re-)connect */

        pty_chr_update_read_handler_locked(chr);

        return 0;

    }

    return io_channel_send(s->fd, buf, len);

}


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

 #if defined(TARGET_PPC64)

+        target_ulong lo = (uint32_t)env->gpr[n];

         target_ulong hi = (target_ulong)ldl_p(mem_buf) << 32;

+        env->gpr[n] = lo | hi;

 #else

static int gdb_set_spe_reg(CPUState *env, uint8_t *mem_buf, int n)

{

    if (n < 32) {

#if defined(TARGET_PPC64)

        target_ulong lo = (uint32_t)env->gpr[n];

        target_ulong hi = (target_ulong)ldl_p(mem_buf) << 32;

        env->gpr[n] = lo | hi;

#else

        env->gprh[n] = ldl_p(mem_buf);

#endif

        return 4;

    }

    if (n == 33) {

        env->spe_acc = ldq_p(mem_buf);

        return 8;

    }

    if (n == 34) {

        /* SPEFSCR not implemented */

        return 4;

    }

    return 0;

}


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

     FrameDecodeData *fdd;
+
+    NVDECFrame *cf;
+
+
+
     if (!frame || !frame->private_ref)

         return -1;

static int get_ref_idx(AVFrame *frame)

{

    FrameDecodeData *fdd;

    NVDECFrame *cf;

    if (!frame || !frame->private_ref)

        return -1;

    fdd = (FrameDecodeData*)frame->private_ref->data;

    cf  = (NVDECFrame*)fdd->hwaccel_priv;

    return cf->idx;

}


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

     if(!array ||
+
 	    index_to<0 || index_to>=array->next ||

 	    index_from<0 || index_from>=array->next)

static inline int array_roll(array_t* array,int index_to,int index_from,int count)

{

    char* buf;

    char* from;

    char* to;

    int is;

    if(!array ||

	    index_to<0 || index_to>=array->next ||

	    index_from<0 || index_from>=array->next)

	return -1;

    if(index_to==index_from)

	return 0;

    is=array->item_size;

    from=array->pointer+index_from*is;

    to=array->pointer+index_to*is;

    buf=g_malloc(is*count);

    memcpy(buf,from,is*count);

    if(index_to<index_from)

	memmove(to+is*count,to,from-to);

    else

	memmove(from,from+is*count,to-from);

    memcpy(to,buf,is*count);

    free(buf);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     if (bs->peer) {

         return -EBUSY;
+
+    }
+
     bs->peer = qdev;

     return 0;

int bdrv_attach(BlockDriverState *bs, DeviceState *qdev)

{

    if (bs->peer) {

        return -EBUSY;

    }

    bs->peer = qdev;

    return 0;

}


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

     QemuOpts *opts;
+
     int sock = -1;

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

{

    QemuOpts *opts;

    int sock = -1;

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

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

        sock = inet_connect_opts(opts, true, NULL, errp);

    } else {

        error_set(errp, QERR_SOCKET_CREATE_FAILED);

    }

    qemu_opts_del(opts);

    return sock;

}


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

         return -1;

+    }
+
+    return lgetxattr(rpath(ctx, path, buffer), name, value, size);
+
+}

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

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

{

    char buffer[PATH_MAX];

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

        /*

         * Don't allow fetch of user.virtfs namesapce

         * in case of mapped security

         */

        errno = ENOATTR;

        return -1;

    }

    return lgetxattr(rpath(ctx, path, buffer), name, value, size);

}


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

             qemu_chr_be_write(chr, buf, size);

+    }
+
+
+
+    return TRUE;

 }

static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)

{

    CharDriverState *chr = opaque;

    TCPCharDriver *s = chr->opaque;

    uint8_t buf[READ_BUF_LEN];

    int len, size;

    if (!s->connected || s->max_size <= 0) {

        return FALSE;

    }

    len = sizeof(buf);

    if (len > s->max_size)

        len = s->max_size;

    size = tcp_chr_recv(chr, (void *)buf, len);

    if (size == 0) {

        /* connection closed */

        s->connected = 0;

        if (s->listen_chan) {

            s->listen_tag = g_io_add_watch(s->listen_chan, G_IO_IN, tcp_chr_accept, chr);

        }

        if (s->tag) {

            g_source_remove(s->tag);

            s->tag = 0;

        }

        g_io_channel_unref(s->chan);

        s->chan = NULL;

        closesocket(s->fd);

        s->fd = -1;

        qemu_chr_be_event(chr, CHR_EVENT_CLOSED);

    } else if (size > 0) {

        if (s->do_telnetopt)

            tcp_chr_process_IAC_bytes(chr, s, buf, &size);

        if (size > 0)

            qemu_chr_be_write(chr, buf, size);

    }

    return TRUE;

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static int qcrypto_cipher_setiv_aes(QCryptoCipher *cipher,

+                                     const uint8_t *iv, size_t niv,
+
                                      Error **errp)

+{
+
+    QCryptoCipherBuiltin *ctxt = cipher->opaque;
+
     if (niv != 16) {

         error_setg(errp, "IV must be 16 bytes not %zu", niv);

static int qcrypto_cipher_setiv_aes(QCryptoCipher *cipher,

                                     const uint8_t *iv, size_t niv,

                                     Error **errp)

{

    QCryptoCipherBuiltin *ctxt = cipher->opaque;

    if (niv != 16) {

        error_setg(errp, "IV must be 16 bytes not %zu", niv);

        return -1;

    }

    g_free(ctxt->state.aes.iv);

    ctxt->state.aes.iv = g_new0(uint8_t, niv);

    memcpy(ctxt->state.aes.iv, iv, niv);

    ctxt->state.aes.niv = niv;

    return 0;

}


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

 {

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

     trace_cpu_in(addr, val);

uint8_t cpu_inb(pio_addr_t addr)

{

    uint8_t val;

    val = ioport_read(0, addr);

    trace_cpu_in(addr, val);

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

    return val;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void bdrv_flush_io_queue(BlockDriverState *bs)

+{
+
+    BlockDriver *drv = bs->drv;
+
     if (drv && drv->bdrv_flush_io_queue) {

         drv->bdrv_flush_io_queue(bs);

void bdrv_flush_io_queue(BlockDriverState *bs)

{

    BlockDriver *drv = bs->drv;

    if (drv && drv->bdrv_flush_io_queue) {

        drv->bdrv_flush_io_queue(bs);

    } else if (bs->file) {

        bdrv_flush_io_queue(bs->file);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void copy_context_reset(AVCodecContext *avctx)
 {
     av_opt_free(avctx);
+    av_freep(&avctx->rc_override);
+    av_freep(&avctx->intra_matrix);
+    av_freep(&avctx->inter_matrix);
     av_freep(&avctx->extradata);
     av_freep(&avctx->subtitle_header);
     av_buffer_unref(&avctx->hw_frames_ctx);

static void copy_context_reset(AVCodecContext *avctx)
{
    av_opt_free(avctx);
    av_freep(&avctx->rc_override);
    av_freep(&avctx->intra_matrix);
    av_freep(&avctx->inter_matrix);
    av_freep(&avctx->extradata);
    av_freep(&avctx->subtitle_header);
    av_buffer_unref(&avctx->hw_frames_ctx);
    avctx->subtitle_header_size = 0;
    avctx->extradata_size = 0;
}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     int16_t *out = data;

     int i;
+
+
+
+    if(!buf)
+
         return 0;

     if(buf_size < s->checksum_size)

static int qdm2_decode_frame(AVCodecContext *avctx,

            void *data, int *data_size,

            AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    QDM2Context *s = avctx->priv_data;

    int16_t *out = data;

    int i;

    if(!buf)

        return 0;

    if(buf_size < s->checksum_size)

        return -1;

    av_log(avctx, AV_LOG_DEBUG, "decode(%d): %p[%d] -> %p[%d]\n",

       buf_size, buf, s->checksum_size, data, *data_size);

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

        if (qdm2_decode(s, buf, out) < 0)

            return -1;

        out += s->channels * s->frame_size;

    }

    *data_size = (uint8_t*)out - (uint8_t*)data;

    return s->checksum_size;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
                          strerror(-ret));

             exit(1);
+
+        } else {
+
+            DPRINTF("Enabled KVM_CAP_SPLIT_IRQCHIP\n");
+
             kvm_split_irqchip = true;

             return 1;

int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)

{

    int ret;

    if (machine_kernel_irqchip_split(ms)) {

        ret = kvm_vm_enable_cap(s, KVM_CAP_SPLIT_IRQCHIP, 0, 24);

        if (ret) {

            error_report("Could not enable split irqchip mode: %s\n",

                         strerror(-ret));

            exit(1);

        } else {

            DPRINTF("Enabled KVM_CAP_SPLIT_IRQCHIP\n");

            kvm_split_irqchip = true;

            return 1;

        }

    } else {

        return 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -3,10 +3,10 @@
                                     int i)

 {
+
+    hwaddr pa;
+
+    virtio_tswap32s(vq->vdev, &uelem->id);

     virtio_tswap32s(vq->vdev, &uelem->len);

static inline void vring_used_write(VirtQueue *vq, VRingUsedElem *uelem,

                                    int i)

{

    hwaddr pa;

    virtio_tswap32s(vq->vdev, &uelem->id);

    virtio_tswap32s(vq->vdev, &uelem->len);

    pa = vq->vring.used + offsetof(VRingUsed, ring[i]);

    address_space_write(&address_space_memory, pa, MEMTXATTRS_UNSPECIFIED,

                       (void *)uelem, sizeof(VRingUsedElem));

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     static char buf[16];

     if (addr < PCI_IO_SIZE) {
+
+        const char *r = reg[addr / 4];
+
+        if (r != 0) {
+
             sprintf(buf, "%s+%u", r, addr % 4);

         } else {

static char *regname(uint32_t addr)

{

    static char buf[16];

    if (addr < PCI_IO_SIZE) {

        const char *r = reg[addr / 4];

        if (r != 0) {

            sprintf(buf, "%s+%u", r, addr % 4);

        } else {

            sprintf(buf, "0x%02x", addr);

        }

    } else {

        sprintf(buf, "??? 0x%08x", addr);

    }

    return buf;

}


--- a/source.c
+++ b/source.c
@@ -7,23 +7,23 @@
     struct virtio_gpu_simple_resource *res, *tmp;

     int i;
+
+
+
+    g->enable = 0;
+

+
+    QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) {

+        virtio_gpu_resource_destroy(g, res);

     }

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

 #if 0
+
         g->req_state[i].x = 0;

         g->req_state[i].y = 0;

static void virtio_gpu_reset(VirtIODevice *vdev)

{

    VirtIOGPU *g = VIRTIO_GPU(vdev);

    struct virtio_gpu_simple_resource *res, *tmp;

    int i;

    g->enable = 0;

    QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) {

        virtio_gpu_resource_destroy(g, res);

    }

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

#if 0

        g->req_state[i].x = 0;

        g->req_state[i].y = 0;

        if (i == 0) {

            g->req_state[0].width = 1024;

            g->req_state[0].height = 768;

        } else {

            g->req_state[i].width = 0;

            g->req_state[i].height = 0;

        }

#endif

        g->scanout[i].resource_id = 0;

        g->scanout[i].width = 0;

        g->scanout[i].height = 0;

        g->scanout[i].x = 0;

        g->scanout[i].y = 0;

        g->scanout[i].ds = NULL;

    }

    g->enabled_output_bitmask = 1;

#ifdef CONFIG_VIRGL

    if (g->use_virgl_renderer) {

        virtio_gpu_virgl_reset(g);

        g->use_virgl_renderer = 0;

    }

#endif

}


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

     size = d->size;
+
+    av_free(d);
+
+    av_free(s);
+
     return size;

 }

int ffio_close_null_buf(AVIOContext *s)

{

    DynBuffer *d = s->opaque;

    int size;

    avio_flush(s);

    size = d->size;

    av_free(d);

    av_free(s);

    return size;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int kvm_put_xsave(CPUState *env)
+
 {

 #ifdef KVM_CAP_XSAVE
@@ -18,7 +18,7 @@

+    xsave = qemu_memalign(4096, sizeof(struct kvm_xsave));

     memset(xsave, 0, sizeof(struct kvm_xsave));

static int kvm_put_xsave(CPUState *env)

{

#ifdef KVM_CAP_XSAVE

    int i;

    struct kvm_xsave* xsave;

    uint16_t cwd, swd, twd, fop;

    if (!kvm_has_xsave())

        return kvm_put_fpu(env);

    xsave = qemu_memalign(4096, sizeof(struct kvm_xsave));

    memset(xsave, 0, sizeof(struct kvm_xsave));

    cwd = swd = twd = fop = 0;

    swd = env->fpus & ~(7 << 11);

    swd |= (env->fpstt & 7) << 11;

    cwd = env->fpuc;

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

        twd |= (!env->fptags[i]) << i;

    xsave->region[0] = (uint32_t)(swd << 16) + cwd;

    xsave->region[1] = (uint32_t)(fop << 16) + twd;

    memcpy(&xsave->region[XSAVE_ST_SPACE], env->fpregs,

            sizeof env->fpregs);

    memcpy(&xsave->region[XSAVE_XMM_SPACE], env->xmm_regs,

            sizeof env->xmm_regs);

    xsave->region[XSAVE_MXCSR] = env->mxcsr;

    *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV] = env->xstate_bv;

    memcpy(&xsave->region[XSAVE_YMMH_SPACE], env->ymmh_regs,

            sizeof env->ymmh_regs);

    return kvm_vcpu_ioctl(env, KVM_SET_XSAVE, xsave);

#else

    return kvm_put_fpu(env);

#endif

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                           int64_t offset, int count)

 {
+
     int ret;

     BDRVQcow2State *s = bs->opaque;

static coroutine_fn int qcow2_co_pdiscard(BlockDriverState *bs,

                                          int64_t offset, int count)

{

    int ret;

    BDRVQcow2State *s = bs->opaque;

    if (!QEMU_IS_ALIGNED(offset | count, s->cluster_size)) {

        assert(count < s->cluster_size);

        return -ENOTSUP;

    }

    qemu_co_mutex_lock(&s->lock);

    ret = qcow2_discard_clusters(bs, offset, count >> BDRV_SECTOR_BITS,

                                 QCOW2_DISCARD_REQUEST, false);

    qemu_co_mutex_unlock(&s->lock);

    return ret;

}


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

     case SOCKET_ADDRESS_FLAT_TYPE_VSOCK:

+        addr->type = SOCKET_ADDRESS_KIND_VSOCK;
+
+        addr->u.vsock.data = QAPI_CLONE(VsockSocketAddress,
+
+                                        &addr_flat->u.vsock);

         break;

SocketAddress *socket_address_crumple(SocketAddressFlat *addr_flat)

{

    SocketAddress *addr = g_new(SocketAddress, 1);

    switch (addr_flat->type) {

    case SOCKET_ADDRESS_FLAT_TYPE_INET:

        addr->type = SOCKET_ADDRESS_KIND_INET;

        addr->u.inet.data = QAPI_CLONE(InetSocketAddress,

                                       &addr_flat->u.inet);

        break;

    case SOCKET_ADDRESS_FLAT_TYPE_UNIX:

        addr->type = SOCKET_ADDRESS_KIND_UNIX;

        addr->u.q_unix.data = QAPI_CLONE(UnixSocketAddress,

                                         &addr_flat->u.q_unix);

        break;

    case SOCKET_ADDRESS_FLAT_TYPE_VSOCK:

        addr->type = SOCKET_ADDRESS_KIND_VSOCK;

        addr->u.vsock.data = QAPI_CLONE(VsockSocketAddress,

                                        &addr_flat->u.vsock);

        break;

    case SOCKET_ADDRESS_FLAT_TYPE_FD:

        addr->type = SOCKET_ADDRESS_KIND_FD;

        addr->u.fd.data = QAPI_CLONE(String, &addr_flat->u.fd);

        break;

    default:

        abort();

    }

    return addr;

}


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

     ff_dct_init(&dct, 5, DCT_II);

+    ff_init_mpadsp_tabs_float();
+
+    ff_init_mpadsp_tabs_fixed();
+
+

     s->apply_window_float = ff_mpadsp_apply_window_float;

av_cold void ff_mpadsp_init(MPADSPContext *s)

{

    DCTContext dct;

    ff_dct_init(&dct, 5, DCT_II);

    ff_init_mpadsp_tabs_float();

    ff_init_mpadsp_tabs_fixed();

    s->apply_window_float = ff_mpadsp_apply_window_float;

    s->apply_window_fixed = ff_mpadsp_apply_window_fixed;

    s->dct32_float = dct.dct32;

    s->dct32_fixed = ff_dct32_fixed;

    s->imdct36_blocks_float = ff_imdct36_blocks_float;

    s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed;

    if (ARCH_AARCH64) ff_mpadsp_init_aarch64(s);

    if (ARCH_ARM)     ff_mpadsp_init_arm(s);

    if (ARCH_PPC)     ff_mpadsp_init_ppc(s);

    if (ARCH_X86)     ff_mpadsp_init_x86(s);

    if (HAVE_MIPSFPU)   ff_mpadsp_init_mipsfpu(s);

    if (HAVE_MIPSDSP) ff_mpadsp_init_mipsdsp(s);

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
             for (i = 0; i < AC3_MAX_COEFS; i++) {

                 int e;
+
+                int v = abs(SCALE_COEF(block->mdct_coef[ch][i]));
+
+                if (v == 0)
+
                     e = 24;

                 else {

static void extract_exponents(AC3EncodeContext *s)

{

    int blk, ch, i;

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

        for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {

            AC3Block *block = &s->blocks[blk];

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

                int e;

                int v = abs(SCALE_COEF(block->mdct_coef[ch][i]));

                if (v == 0)

                    e = 24;

                else {

                    e = 23 - av_log2(v) + block->exp_shift[ch];

                    if (e >= 24) {

                        e = 24;

                        block->mdct_coef[ch][i] = 0;

                    }

                }

                block->exp[ch][i] = e;

            }

        }

    }

}


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

     CPUState *cs = CPU(obj);
+
     OpenRISCCPU *cpu = OPENRISC_CPU(obj);

     static int inited;

static void openrisc_cpu_initfn(Object *obj)

{

    CPUState *cs = CPU(obj);

    OpenRISCCPU *cpu = OPENRISC_CPU(obj);

    static int inited;

    cs->env_ptr = &cpu->env;

    cpu_exec_init(cs, &error_abort);

#ifndef CONFIG_USER_ONLY

    cpu_openrisc_mmu_init(cpu);

#endif

    if (tcg_enabled() && !inited) {

        inited = 1;

        openrisc_translate_init();

    }

}


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

     reg->current_index = ntohl(reg->current_index);

+    reg->chunks = ntohll(reg->chunks);
+
 }

static void network_to_register(RDMARegister *reg)

{

    reg->key.current_addr = ntohll(reg->key.current_addr);

    reg->current_index = ntohl(reg->current_index);

    reg->chunks = ntohll(reg->chunks);

}