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

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

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

 }

static inline void gen_evmergelohi(DisasContext *ctx)

{

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

        gen_exception(ctx, POWERPC_EXCP_APU);

        return;

    }

#if defined(TARGET_PPC64)

    TCGv t0 = tcg_temp_new();

    TCGv t1 = tcg_temp_new();

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

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

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

    tcg_temp_free(t0);

    tcg_temp_free(t1);

#else

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

        TCGv_i32 tmp = tcg_temp_new_i32();

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

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

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

        tcg_temp_free_i32(tmp);

    } else {

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

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

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -5,8 +5,8 @@
     assert(timer != NULL);

+
+

     ptimer_stop(timer->ptimer);

static void grlib_gptimer_enable(GPTimer *timer)

{

    assert(timer != NULL);

    ptimer_stop(timer->ptimer);

    if (!(timer->config & GPTIMER_ENABLE)) {

        /* Timer disabled */

        trace_grlib_gptimer_disabled(timer->id, timer->config);

        return;

    }

    /* ptimer is triggered when the counter reach 0 but GPTimer is triggered at

       underflow. Set count + 1 to simulate the GPTimer behavior. */

    trace_grlib_gptimer_enable(timer->id, timer->counter + 1);

    ptimer_set_count(timer->ptimer, timer->counter + 1);

    ptimer_run(timer->ptimer, 1);

}


--- a/source.c
+++ b/source.c
@@ -14,11 +14,11 @@
                                        &new_extradata_size);
     int jp_dualmono_size;
     const uint8_t *jp_dualmono   = av_packet_get_side_data(avpkt,
+                                       AV_PKT_DATA_JP_DUALMONO,
+                                       &jp_dualmono_size);
+    if (new_extradata && 0) {
+        av_free(avctx->extradata);
+        avctx->extradata = av_mallocz(new_extradata_size +
                                       FF_INPUT_BUFFER_PADDING_SIZE);
         if (!avctx->extradata)
             return AVERROR(ENOMEM);

static int aac_decode_frame(AVCodecContext *avctx, void *data,
                            int *got_frame_ptr, AVPacket *avpkt)
{
    AACContext *ac = avctx->priv_data;
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    GetBitContext gb;
    int buf_consumed;
    int buf_offset;
    int err;
    int new_extradata_size;
    const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
                                       AV_PKT_DATA_NEW_EXTRADATA,
                                       &new_extradata_size);
    int jp_dualmono_size;
    const uint8_t *jp_dualmono   = av_packet_get_side_data(avpkt,
                                       AV_PKT_DATA_JP_DUALMONO,
                                       &jp_dualmono_size);
    if (new_extradata && 0) {
        av_free(avctx->extradata);
        avctx->extradata = av_mallocz(new_extradata_size +
                                      FF_INPUT_BUFFER_PADDING_SIZE);
        if (!avctx->extradata)
            return AVERROR(ENOMEM);
        avctx->extradata_size = new_extradata_size;
        memcpy(avctx->extradata, new_extradata, new_extradata_size);
        push_output_configuration(ac);
        if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac,
                                         avctx->extradata,
                                         avctx->extradata_size*8, 1) < 0) {
            pop_output_configuration(ac);
        }
    }
    ac->dmono_mode = 0;
    if (jp_dualmono && jp_dualmono_size > 0)
        ac->dmono_mode =  1 + *jp_dualmono;
    if (ac->force_dmono_mode >= 0)
        ac->dmono_mode = ac->force_dmono_mode;
    init_get_bits(&gb, buf, buf_size * 8);
    if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt)) < 0)
        return err;
    buf_consumed = (get_bits_count(&gb) + 7) >> 3;
    for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++)
        if (buf[buf_offset])
            break;
    return buf_size > buf_offset ? buf_consumed : buf_size;
}


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

     hdr->video_frame_type = avio_r8(pb);
+
+    hdr->audio_frame_type = avio_r8(pb);
+
+    hdr->pal_colors_count = avio_rl16(pb);
+
     hdr->video_frame_size = avio_rl32(pb);

     hdr->audio_frame_size = avio_rl32(pb);

static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) {

    CinFrameHeader *hdr = &cin->frame_header;

    hdr->video_frame_type = avio_r8(pb);

    hdr->audio_frame_type = avio_r8(pb);

    hdr->pal_colors_count = avio_rl16(pb);

    hdr->video_frame_size = avio_rl32(pb);

    hdr->audio_frame_size = avio_rl32(pb);

    if (pb->eof_reached || pb->error)

        return AVERROR(EIO);

    if (avio_rl32(pb) != 0xAA55AA55)

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)

 {

int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)

{

    BufferSinkContext *buf = ctx->priv;

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

    int ret;

    AVFrame *cur_frame;

    /* no picref available, fetch it from the filterchain */

    if (!av_fifo_size(buf->fifo)) {

        if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST)

            return AVERROR(EAGAIN);

        if ((ret = ff_request_frame(inlink)) < 0)

            return ret;

    }

    if (!av_fifo_size(buf->fifo))

        return AVERROR(EINVAL);

    if (flags & AV_BUFFERSINK_FLAG_PEEK) {

        cur_frame = *((AVFrame **)av_fifo_peek2(buf->fifo, 0));

        av_frame_ref(frame, cur_frame); /* TODO check failure */

    } else {

        av_fifo_generic_read(buf->fifo, &cur_frame, sizeof(cur_frame), NULL);

        av_frame_move_ref(frame, cur_frame);

        av_frame_free(&cur_frame);

    }

    return 0;

}


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

     mxf_write_generic_desc(s, st, key, size+5+12+8+8);
+

     // audio locked

static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)

{

    AVIOContext *pb = s->pb;

    mxf_write_generic_desc(s, st, key, size+5+12+8+8);

    // audio locked

    mxf_write_local_tag(pb, 1, 0x3D02);

    avio_w8(pb, 1);

    // write audio sampling rate

    mxf_write_local_tag(pb, 8, 0x3D03);

    avio_wb32(pb, st->codec->sample_rate);

    avio_wb32(pb, 1);

    mxf_write_local_tag(pb, 4, 0x3D07);

    avio_wb32(pb, st->codec->channels);

    mxf_write_local_tag(pb, 4, 0x3D01);

    avio_wb32(pb, av_get_bits_per_sample(st->codec->codec_id));

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int get_uint64(QEMUFile *f, void *pv, size_t size)
+
+{

     uint64_t *v = pv;

static int get_uint64(QEMUFile *f, void *pv, size_t size)

{

    uint64_t *v = pv;

    qemu_get_be64s(f, v);

    return 0;

}


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

 {

+    PutBitContext p;
+
     uint8_t buf[256];

+
+
     init_put_bits(&p, buf, sizeof(buf));
+
+
+
     put_bits(&p, 1, 1); /* a, d present */

     put_bits(&p, 5, 20); /* nb bits */

static void put_swf_matrix(ByteIOContext *pb,

                           int a, int b, int c, int d, int tx, int ty)

{

    PutBitContext p;

    uint8_t buf[256];

    init_put_bits(&p, buf, sizeof(buf));

    put_bits(&p, 1, 1); /* a, d present */

    put_bits(&p, 5, 20); /* nb bits */

    put_bits(&p, 20, a);

    put_bits(&p, 20, d);

    put_bits(&p, 1, 1); /* b, c present */

    put_bits(&p, 5, 20); /* nb bits */

    put_bits(&p, 20, c);

    put_bits(&p, 20, b);

    put_bits(&p, 5, 20); /* nb bits */

    put_bits(&p, 20, tx);

    put_bits(&p, 20, ty);

    flush_put_bits(&p);

    put_buffer(pb, buf, pbBufPtr(&p) - p.buf);

}


--- a/source.c
+++ b/source.c
@@ -3,9 +3,9 @@
                           AVFormatParameters *ap)

 {
+
+    RawDVContext *c = s->priv_data;
+
     c->dv_demux = dv_init_demux(s);

static int dv_read_header(AVFormatContext *s,

                          AVFormatParameters *ap)

{

    RawDVContext *c = s->priv_data;

    c->dv_demux = dv_init_demux(s);

    return c->dv_demux ? 0 : -1;

}


--- a/source.c
+++ b/source.c
@@ -65,9 +65,9 @@
         return 0;

     }
+
+    return (reventry->paddr_index << MCACHE_BUCKET_SHIFT) +
+
+        ((unsigned long) ptr - (unsigned long) entry->vaddr_base);
+
 }

ram_addr_t xen_ram_addr_from_mapcache(void *ptr)

{

    MapCacheEntry *entry = NULL;

    MapCacheRev *reventry;

    hwaddr paddr_index;

    hwaddr size;

    int found = 0;

    QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {

        if (reventry->vaddr_req == ptr) {

            paddr_index = reventry->paddr_index;

            size = reventry->size;

            found = 1;

            break;

        }

    }

    if (!found) {

        fprintf(stderr, "%s, could not find %p\n", __func__, ptr);

        QTAILQ_FOREACH(reventry, &mapcache->locked_entries, next) {

            DPRINTF("   "TARGET_FMT_plx" -> %p is present\n", reventry->paddr_index,

                    reventry->vaddr_req);

        }

        abort();

        return 0;

    }

    entry = &mapcache->entry[paddr_index % mapcache->nr_buckets];

    while (entry && (entry->paddr_index != paddr_index || entry->size != size)) {

        entry = entry->next;

    }

    if (!entry) {

        DPRINTF("Trying to find address %p that is not in the mapcache!\n", ptr);

        return 0;

    }

    return (reventry->paddr_index << MCACHE_BUCKET_SHIFT) +

        ((unsigned long) ptr - (unsigned long) entry->vaddr_base);

}


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

         if (slirp_smb_export) {

+            slirp_smb(slirp_smb_export);
+
+        }
+
+#endif

     }

static int net_slirp_init(VLANState *vlan, const char *model, const char *name,

                          int restricted, const char *ip)

{

    if (slirp_in_use) {

        /* slirp only supports a single instance so far */

        return -1;

    }

    if (!slirp_inited) {

        slirp_inited = 1;

        slirp_init(restricted, ip);

        while (slirp_redirs) {

            struct slirp_config_str *config = slirp_redirs;

            slirp_redirection(NULL, config->str);

            slirp_redirs = config->next;

            qemu_free(config);

        }

#ifndef _WIN32

        if (slirp_smb_export) {

            slirp_smb(slirp_smb_export);

        }

#endif

    }

    slirp_vc = qemu_new_vlan_client(vlan, model, name, NULL, slirp_receive,

                                    NULL, net_slirp_cleanup, NULL);

    slirp_vc->info_str[0] = '\0';

    slirp_in_use = 1;

    return 0;

}


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

 {

+    int count, i;

+
+    if (avctx->bits_per_coded_sample > 8) {

         av_log(avctx, AV_LOG_ERROR, "bit_per_coded_sample > 8 not supported\n");

int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)

{

    int count, i;

    if (avctx->bits_per_coded_sample > 8) {

        av_log(avctx, AV_LOG_ERROR, "bit_per_coded_sample > 8 not supported\n");

        return AVERROR_INVALIDDATA;

    }

    count = 1 << avctx->bits_per_coded_sample;

    if (avctx->extradata_size < count * 3) {

        av_log(avctx, AV_LOG_ERROR, "palette data underflow\n");

        return AVERROR_INVALIDDATA;

    }

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

        pal[i] = 0xFF000000 | AV_RB24( avctx->extradata + i*3 );

    }

    return 0;

}


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

         .device = (char *) device,

+        .name = (char *) name
+
+    };
+
+    TransactionAction action = {

         .type = TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC,

void qmp_blockdev_snapshot_internal_sync(const char *device,

                                         const char *name,

                                         Error **errp)

{

    BlockdevSnapshotInternal snapshot = {

        .device = (char *) device,

        .name = (char *) name

    };

    TransactionAction action = {

        .type = TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC,

        .u.blockdev_snapshot_internal_sync = &snapshot,

    };

    blockdev_do_action(&action, errp);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum)

 {
+
     int64_t start, size;

 //    start= url_ftell(bc) - 8;

static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum)

{

    int64_t start, size;

//    start= url_ftell(bc) - 8;

    size= get_v(bc);

    init_checksum(bc, calculate_checksum ? av_crc04C11DB7_update : NULL, 1);

//    nut->packet_start[2] = start;

//    nut->written_packet_size= size;

    return size;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+static int spapr_set_associativity(void *fdt, sPAPREnvironment *spapr)

 {

+    int ret = 0, offset;

+    CPUPPCState *env;

     char cpu_model[32];

@@ -15,8 +15,8 @@
     assert(spapr->cpu_model);

+
+    for (env = first_cpu; env != NULL; env = env->next_cpu) {

         uint32_t associativity[] = {cpu_to_be32(0x5),

static int spapr_set_associativity(void *fdt, sPAPREnvironment *spapr)

{

    int ret = 0, offset;

    CPUPPCState *env;

    char cpu_model[32];

    int smt = kvmppc_smt_threads();

    assert(spapr->cpu_model);

    for (env = first_cpu; env != NULL; env = env->next_cpu) {

        uint32_t associativity[] = {cpu_to_be32(0x5),

                                    cpu_to_be32(0x0),

                                    cpu_to_be32(0x0),

                                    cpu_to_be32(0x0),

                                    cpu_to_be32(env->numa_node),

                                    cpu_to_be32(env->cpu_index)};

        if ((env->cpu_index % smt) != 0) {

            continue;

        }

        snprintf(cpu_model, 32, "/cpus/%s@%x", spapr->cpu_model,

                 env->cpu_index);

        offset = fdt_path_offset(fdt, cpu_model);

        if (offset < 0) {

            return offset;

        }

        ret = fdt_setprop(fdt, offset, "ibm,associativity", associativity,

                          sizeof(associativity));

        if (ret < 0) {

            return ret;

        }

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 uint64_t HELPER(neon_abdl_u16)(uint32_t a, uint32_t b)

 {
+
+    uint64_t tmp;

+    uint64_t result;

+    DO_ABD(result, a, b, uint8_t);

     DO_ABD(tmp, a >> 8, b >> 8, uint8_t);

uint64_t HELPER(neon_abdl_u16)(uint32_t a, uint32_t b)

{

    uint64_t tmp;

    uint64_t result;

    DO_ABD(result, a, b, uint8_t);

    DO_ABD(tmp, a >> 8, b >> 8, uint8_t);

    result |= tmp << 16;

    DO_ABD(tmp, a >> 16, b >> 16, uint8_t);

    result |= tmp << 32;

    DO_ABD(tmp, a >> 24, b >> 24, uint8_t);

    result |= tmp << 48;

    return result;

}


--- a/source.c
+++ b/source.c
@@ -40,11 +40,11 @@
          * elsewhere in the function as the state machine dictates.
          */
         hs->kbd.modifiers |= 1 << (hid_code & 0x0f);
+        return;
+    case 0xea ... 0xef:
+        abort();
+    default:
+        break;
     if (keycode & (1 << 7)) {
         for (i = hs->kbd.keys - 1; i >= 0; i--) {
             if (hs->kbd.key[i] == hid_code) {

static void hid_keyboard_process_keycode(HIDState *hs)
{
    uint8_t hid_code, index, key;
    int i, keycode, slot;
    if (hs->n == 0) {
        return;
    slot = hs->head & QUEUE_MASK; QUEUE_INCR(hs->head); hs->n--;
    keycode = hs->kbd.keycodes[slot];
    key = keycode & 0x7f;
    index = key | ((hs->kbd.modifiers & (1 << 8)) >> 1);
    hid_code = hid_usage_keys[index];
    hs->kbd.modifiers &= ~(1 << 8);
    switch (hid_code) {
    case 0x00:
        return;
    case 0xe0:
        assert(key == 0x1d);
        if (hs->kbd.modifiers & (1 << 9)) {
            /* The hid_codes for the 0xe1/0x1d scancode sequence are 0xe9/0xe0.
             * Here we're processing the second hid_code.  By dropping bit 9
             * and setting bit 8, the scancode after 0x1d will access the
             * second half of the table.
             */
            hs->kbd.modifiers ^= (1 << 8) | (1 << 9);
            return;
        /* fall through to process Ctrl_L */
    case 0xe1 ... 0xe7:
        /* Ctrl_L/Ctrl_R, Shift_L/Shift_R, Alt_L/Alt_R, Win_L/Win_R.
         * Handle releases here, or fall through to process presses.
         */
        if (keycode & (1 << 7)) {
            hs->kbd.modifiers &= ~(1 << (hid_code & 0x0f));
            return;
        /* fall through */
    case 0xe8 ... 0xe9:
        /* USB modifiers are just 1 byte long.  Bits 8 and 9 of
         * hs->kbd.modifiers implement a state machine that detects the
         * 0xe0 and 0xe1/0x1d sequences.  These bits do not follow the
         * usual rules where bit 7 marks released keys; they are cleared
         * elsewhere in the function as the state machine dictates.
         */
        hs->kbd.modifiers |= 1 << (hid_code & 0x0f);
        return;
    case 0xea ... 0xef:
        abort();
    default:
        break;
    if (keycode & (1 << 7)) {
        for (i = hs->kbd.keys - 1; i >= 0; i--) {
            if (hs->kbd.key[i] == hid_code) {
                hs->kbd.key[i] = hs->kbd.key[-- hs->kbd.keys];
                hs->kbd.key[hs->kbd.keys] = 0x00;
                break;
        if (i < 0) {
            return;
    } else {
        for (i = hs->kbd.keys - 1; i >= 0; i--) {
            if (hs->kbd.key[i] == hid_code) {
                break;
        if (i < 0) {
            if (hs->kbd.keys < sizeof(hs->kbd.key)) {
                hs->kbd.key[hs->kbd.keys++] = hid_code;
        } else {
            return;


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     /* TODO: Check client args type */

+
+out:
+
+    QDECREF(cmd_args);
+
     return err;

 }

static int qmp_check_client_args(const mon_cmd_t *cmd, QDict *client_args)

{

    int flags, err;

    QDict *cmd_args;

    cmd_args = qdict_from_args_type(cmd->args_type);

    flags = 0;

    err = check_mandatory_args(cmd_args, client_args, &flags);

    if (err) {

        goto out;

    }

    /* TODO: Check client args type */

out:

    QDECREF(cmd_args);

    return err;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int irq_cpu_hotplug_init(SCLPEvent *event)
+
 {

     irq_cpu_hotplug = *qemu_allocate_irqs(trigger_signal, event, 1);

static int irq_cpu_hotplug_init(SCLPEvent *event)

{

    irq_cpu_hotplug = *qemu_allocate_irqs(trigger_signal, event, 1);

    return 0;

}


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

     abi_long ret;

+
+
     if ((int)addrlen < 0) {

         return -TARGET_EINVAL;

static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags,

                          abi_ulong target_addr, socklen_t addrlen)

{

    void *addr;

    void *host_msg;

    abi_long ret;

    if ((int)addrlen < 0) {

        return -TARGET_EINVAL;

    }

    host_msg = lock_user(VERIFY_READ, msg, len, 1);

    if (!host_msg)

        return -TARGET_EFAULT;

    if (fd_trans_target_to_host_data(fd)) {

        ret = fd_trans_target_to_host_data(fd)(host_msg, len);

        if (ret < 0) {

            unlock_user(host_msg, msg, 0);

            return ret;

        }

    }

    if (target_addr) {

        addr = alloca(addrlen+1);

        ret = target_to_host_sockaddr(fd, addr, target_addr, addrlen);

        if (ret) {

            unlock_user(host_msg, msg, 0);

            return ret;

        }

        ret = get_errno(safe_sendto(fd, host_msg, len, flags, addr, addrlen));

    } else {

        ret = get_errno(safe_sendto(fd, host_msg, len, flags, NULL, 0));

    }

    unlock_user(host_msg, msg, 0);

    return ret;

}


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

 {

+    VLANState *vlan;
+
     VLANClientState *vc;

void net_host_device_remove(Monitor *mon, int vlan_id, const char *device)

{

    VLANState *vlan;

    VLANClientState *vc;

    vlan = qemu_find_vlan(vlan_id);

    if (!vlan) {

        monitor_printf(mon, "can't find vlan %d\n", vlan_id);

        return;

    }

   for(vc = vlan->first_client; vc != NULL; vc = vc->next)

        if (!strcmp(vc->name, device))

            break;

    if (!vc) {

        monitor_printf(mon, "can't find device %s\n", device);

        return;

    }

    qemu_del_vlan_client(vc);

}


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

 {

+    BlockBackend *blk;
+
+
+
+    blk = g_new0(BlockBackend, 1);

     blk->refcnt = 1;

BlockBackend *blk_new(uint64_t perm, uint64_t shared_perm)

{

    BlockBackend *blk;

    blk = g_new0(BlockBackend, 1);

    blk->refcnt = 1;

    blk->perm = perm;

    blk->shared_perm = shared_perm;

    blk_set_enable_write_cache(blk, true);

    qemu_co_mutex_init(&blk->public.throttle_group_member.throttled_reqs_lock);

    qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[0]);

    qemu_co_queue_init(&blk->public.throttle_group_member.throttled_reqs[1]);

    block_acct_init(&blk->stats);

    notifier_list_init(&blk->remove_bs_notifiers);

    notifier_list_init(&blk->insert_bs_notifiers);

    QTAILQ_INSERT_TAIL(&block_backends, blk, link);

    return blk;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 qemu_irq get_cps_irq(MIPSCPSState *s, int pin_number)
+
+{
+
+    MIPSCPU *cpu = MIPS_CPU(first_cpu);

     CPUMIPSState *env = &cpu->env;

qemu_irq get_cps_irq(MIPSCPSState *s, int pin_number)

{

    MIPSCPU *cpu = MIPS_CPU(first_cpu);

    CPUMIPSState *env = &cpu->env;

    assert(pin_number < s->num_irq);

    /* TODO: return GIC pins once implemented */

    return env->irq[pin_number];

}


--- a/source.c
+++ b/source.c
@@ -3,8 +3,8 @@
     ResampleContext *c= s->resample;

 //    sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
+
+    c->compensation_distance= compensation_distance;

     c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;

void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_distance){

    ResampleContext *c= s->resample;

//    sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;

    c->compensation_distance= compensation_distance;

    c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;

}


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

                          const uint8_t *buf, int nb_sectors)

+{

+    int async_ret;
+
     BlockDriverAIOCB *acb;

     async_ret = NOT_DONE;
+
     qemu_aio_wait_start();

     acb = bdrv_aio_write(bs, sector_num, buf, nb_sectors,

static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num,

                         const uint8_t *buf, int nb_sectors)

{

    int async_ret;

    BlockDriverAIOCB *acb;

    async_ret = NOT_DONE;

    qemu_aio_wait_start();

    acb = bdrv_aio_write(bs, sector_num, buf, nb_sectors,

                         bdrv_rw_em_cb, &async_ret);

    if (acb == NULL) {

        qemu_aio_wait_end();

        return -1;

    }

    while (async_ret == NOT_DONE) {

        qemu_aio_wait();

    }

    qemu_aio_wait_end();

    return async_ret;

}


--- a/source.c
+++ b/source.c
@@ -38,11 +38,11 @@
     if (nb_channels > INT_MAX / align ||

         (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
+
+
+
+
+    line_size = planar ? FFALIGN(nb_samples * sample_size,               align) :

                          FFALIGN(nb_samples * sample_size * nb_channels, align);

int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,

                               enum AVSampleFormat sample_fmt, int align)

{

    int line_size;

    int sample_size = av_get_bytes_per_sample(sample_fmt);

    int planar      = av_sample_fmt_is_planar(sample_fmt);

    /* validate parameter ranges */

    if (!sample_size || nb_samples <= 0 || nb_channels <= 0)

    /* auto-select alignment if not specified */

    if (!align) {

        align = 1;

        nb_samples = FFALIGN(nb_samples, 32);

    }

    /* check for integer overflow */

    if (nb_channels > INT_MAX / align ||

        (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)

    line_size = planar ? FFALIGN(nb_samples * sample_size,               align) :

                         FFALIGN(nb_samples * sample_size * nb_channels, align);

    if (linesize)

        *linesize = line_size;

    return planar ? line_size * nb_channels : line_size;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void akita_init(int ram_size, int vga_ram_size, int boot_device,
+
+                DisplayState *ds, const char **fd_filename, int snapshot,

                 const char *kernel_filename, const char *kernel_cmdline,

static void akita_init(int ram_size, int vga_ram_size, int boot_device,

                DisplayState *ds, const char **fd_filename, int snapshot,

                const char *kernel_filename, const char *kernel_cmdline,

                const char *initrd_filename, const char *cpu_model)

{

    spitz_common_init(ram_size, vga_ram_size, ds, kernel_filename,

                kernel_cmdline, initrd_filename, akita, 0x2e8);

}


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

     CPUState *env = _env;
+
+
+
+    if (kvm_enabled())

         kvm_init_vcpu(env);

void qemu_init_vcpu(void *_env)

{

    CPUState *env = _env;

    if (kvm_enabled())

        kvm_init_vcpu(env);

    env->nr_cores = smp_cores;

    env->nr_threads = smp_threads;

    return;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     S390CPU *cpu = S390_CPU(cs);

     CPUS390XState *env = &cpu->env;
+
+
+
     return (cs->interrupt_request & CPU_INTERRUPT_HARD) &&

            (env->psw.mask & PSW_MASK_EXT);

static bool s390_cpu_has_work(CPUState *cs)

{

    S390CPU *cpu = S390_CPU(cs);

    CPUS390XState *env = &cpu->env;

    return (cs->interrupt_request & CPU_INTERRUPT_HARD) &&

           (env->psw.mask & PSW_MASK_EXT);

}


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

 {

+    ppc_tb_t *tb_env = cpu->env.tb_env;
+
+
+
     if (tb_env->hdecr_timer != NULL) {

         __cpu_ppc_store_decr(cpu, &tb_env->hdecr_next, tb_env->hdecr_timer,

static inline void _cpu_ppc_store_hdecr(PowerPCCPU *cpu, uint32_t hdecr,

                                        uint32_t value, int is_excp)

{

    ppc_tb_t *tb_env = cpu->env.tb_env;

    if (tb_env->hdecr_timer != NULL) {

        __cpu_ppc_store_decr(cpu, &tb_env->hdecr_next, tb_env->hdecr_timer,

                             &cpu_ppc_hdecr_excp, hdecr, value, is_excp);

    }

}


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

 #ifdef HOST_WORDS_BIGENDIAN

+    surface->flags = QEMU_BIG_ENDIAN_FLAG;
+
+#endif
+
+

     return surface;

DisplaySurface *qemu_create_displaysurface_from(int width, int height, int bpp,

                                                int linesize, uint8_t *data)

{

    DisplaySurface *surface = g_new0(DisplaySurface, 1);

    surface->pf = qemu_default_pixelformat(bpp);

    surface->format = qemu_pixman_get_format(&surface->pf);

    assert(surface->format != 0);

    surface->image = pixman_image_create_bits(surface->format,

                                              width, height,

                                              (void *)data, linesize);

    assert(surface->image != NULL);

#ifdef HOST_WORDS_BIGENDIAN

    surface->flags = QEMU_BIG_ENDIAN_FLAG;

#endif

    return surface;

}


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

     return job ? job->user_paused : 0;

+}

bool block_job_user_paused(BlockJob *job)

{

    return job ? job->user_paused : 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 target_ulong helper_rdhwr_xnp(CPUMIPSState *env)
+
 {

     check_hwrena(env, 5);

target_ulong helper_rdhwr_xnp(CPUMIPSState *env)

{

    check_hwrena(env, 5);

    return (env->CP0_Config5 >> CP0C5_XNP) & 1;

}


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

     while (bsf_ctx) {

+        AVPacket new_pkt = *pkt;
+
+        ret = av_bitstream_filter_filter(bsf_ctx, enc_ctx, NULL,
+
+                                             &new_pkt.data, &new_pkt.size,

                                              pkt->data, pkt->size,

static int filter_packet(void *log_ctx, AVPacket *pkt,

                         AVFormatContext *fmt_ctx, AVBitStreamFilterContext *bsf_ctx)

{

    AVCodecContext *enc_ctx = fmt_ctx->streams[pkt->stream_index]->codec;

    int ret = 0;

    while (bsf_ctx) {

        AVPacket new_pkt = *pkt;

        ret = av_bitstream_filter_filter(bsf_ctx, enc_ctx, NULL,

                                             &new_pkt.data, &new_pkt.size,

                                             pkt->data, pkt->size,

                                             pkt->flags & AV_PKT_FLAG_KEY);

        if (ret == 0 && new_pkt.data != pkt->data && new_pkt.destruct) {

            if ((ret = av_copy_packet(&new_pkt, pkt)) < 0)

                break;

            ret = 1;

        }

        if (ret > 0) {

            av_free_packet(pkt);

            new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size,

                                           av_buffer_default_free, NULL, 0);

            if (!new_pkt.buf)

                break;

        }

        if (ret < 0) {

            av_log(log_ctx, AV_LOG_ERROR,

                "Failed to filter bitstream with filter %s for stream %d in file '%s' with codec %s\n",

                bsf_ctx->filter->name, pkt->stream_index, fmt_ctx->filename,

                avcodec_get_name(enc_ctx->codec_id));

        }

        *pkt = new_pkt;

        bsf_ctx = bsf_ctx->next;

    }

    return ret;

}


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

     vp8_idct_dc_add_c(dst+ 4, block[1], stride);

+    vp8_idct_dc_add_c(dst+ 8, block[2], stride);
+
+    vp8_idct_dc_add_c(dst+12, block[3], stride);

 }

static void vp8_idct_dc_add4y_c(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride)

{

    vp8_idct_dc_add_c(dst+ 0, block[0], stride);

    vp8_idct_dc_add_c(dst+ 4, block[1], stride);

    vp8_idct_dc_add_c(dst+ 8, block[2], stride);

    vp8_idct_dc_add_c(dst+12, block[3], stride);

}


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

     /* This is a best 1st approximation. ns to ms */

+    s->expected_downtime = max_downtime/1000000;
+
+
+
+    s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup, s);

     s->file = qemu_fopen_ops(s, &migration_file_ops);

void migrate_fd_connect(MigrationState *s)

{

    s->state = MIG_STATE_ACTIVE;

    trace_migrate_set_state(MIG_STATE_ACTIVE);

    s->bytes_xfer = 0;

    /* This is a best 1st approximation. ns to ms */

    s->expected_downtime = max_downtime/1000000;

    s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup, s);

    s->file = qemu_fopen_ops(s, &migration_file_ops);

    qemu_file_set_rate_limit(s->file,

                             s->bandwidth_limit / XFER_LIMIT_RATIO);

    qemu_thread_create(&s->thread, migration_thread, s,

                       QEMU_THREAD_JOINABLE);

    notifier_list_notify(&migration_state_notifiers, s);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+void qtest_quit(QTestState *s)
+
+{
+
+    int status;

void qtest_quit(QTestState *s)

{

    int status;

    pid_t pid = qtest_qemu_pid(s);

    if (pid != -1) {

        kill(pid, SIGTERM);

        waitpid(pid, &status, 0);

    }

    unlink(s->pid_file);

    unlink(s->socket_path);

    unlink(s->qmp_socket_path);

    g_free(s->pid_file);

    g_free(s->socket_path);

    g_free(s->qmp_socket_path);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void tcg_prologue_init(TCGContext *s)
 {
     /* init global prologue and epilogue */
+    s->code_buf = s->code_gen_prologue;
+    s->code_ptr = s->code_buf;
     tcg_target_qemu_prologue(s);
     flush_icache_range((tcg_target_ulong)s->code_buf,
                        (tcg_target_ulong)s->code_ptr);

void tcg_prologue_init(TCGContext *s)
{
    /* init global prologue and epilogue */
    s->code_buf = s->code_gen_prologue;
    s->code_ptr = s->code_buf;
    tcg_target_qemu_prologue(s);
    flush_icache_range((tcg_target_ulong)s->code_buf,
                       (tcg_target_ulong)s->code_ptr);


--- a/source.c
+++ b/source.c
@@ -3,5 +3,5 @@
                                  BlockDriverCompletionFunc *cb, void *opaque)
 {
     return bdrv_aio_rw_vector(bs, sector_num, iov, nb_sectors,
+                              cb, opaque, 0);
 }

BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num,
                                 QEMUIOVector *iov, int nb_sectors,
                                 BlockDriverCompletionFunc *cb, void *opaque)
{
    return bdrv_aio_rw_vector(bs, sector_num, iov, nb_sectors,
                              cb, opaque, 0);
}


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

     if (!get_vhost_net(nc->peer)) {
+
+        return features;
+
+    }
+
     return vhost_net_get_features(get_vhost_net(nc->peer), features);

 }

static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)

{

    VirtIONet *n = VIRTIO_NET(vdev);

    NetClientState *nc = qemu_get_queue(n->nic);

    features |= (1 << VIRTIO_NET_F_MAC);

    if (!peer_has_vnet_hdr(n)) {

        features &= ~(0x1 << VIRTIO_NET_F_CSUM);

        features &= ~(0x1 << VIRTIO_NET_F_HOST_TSO4);

        features &= ~(0x1 << VIRTIO_NET_F_HOST_TSO6);

        features &= ~(0x1 << VIRTIO_NET_F_HOST_ECN);

        features &= ~(0x1 << VIRTIO_NET_F_GUEST_CSUM);

        features &= ~(0x1 << VIRTIO_NET_F_GUEST_TSO4);

        features &= ~(0x1 << VIRTIO_NET_F_GUEST_TSO6);

        features &= ~(0x1 << VIRTIO_NET_F_GUEST_ECN);

    }

    if (!peer_has_vnet_hdr(n) || !peer_has_ufo(n)) {

        features &= ~(0x1 << VIRTIO_NET_F_GUEST_UFO);

        features &= ~(0x1 << VIRTIO_NET_F_HOST_UFO);

    }

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

        return features;

    }

    return vhost_net_get_features(get_vhost_net(nc->peer), features);

}


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

     if (!ap)

+        return AVERROR(ENOMEM);
+
+    av_dict_set(&s->picture.metadata, name, ap, AV_DICT_DONT_STRDUP_VAL);
+
+    return 0;

 }

static int add_doubles_metadata(const uint8_t **buf, int count,

                                const char *name, const char *sep,

                                TiffContext *s)

{

    char *ap;

    int i;

    double *dp = av_malloc(count * sizeof(double));

    if (!dp)

        return AVERROR(ENOMEM);

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

        dp[i] = tget_double(buf, s->le);

    ap = doubles2str(dp, count, sep);

    av_freep(&dp);

    if (!ap)

        return AVERROR(ENOMEM);

    av_dict_set(&s->picture.metadata, name, ap, AV_DICT_DONT_STRDUP_VAL);

    return 0;

}


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

     char *testname;

+
+
+    trace_lm32_sys_memory_write(addr, value);
+
+

     addr >>= 2;

static void sys_write(void *opaque, target_phys_addr_t addr,

                      uint64_t value, unsigned size)

{

    LM32SysState *s = opaque;

    char *testname;

    trace_lm32_sys_memory_write(addr, value);

    addr >>= 2;

    switch (addr) {

    case R_CTRL:

        qemu_system_shutdown_request();

        break;

    case R_PASSFAIL:

        s->regs[addr] = value;

        testname = (char *)s->testname;

        qemu_log("TC  %-16s %s\n", testname, (value) ? "FAILED" : "OK");

        break;

    case R_TESTNAME:

        s->regs[addr] = value;

        copy_testname(s);

        break;

    default:

        error_report("lm32_sys: write access to unknown register 0x"

                TARGET_FMT_plx, addr << 2);

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -5,15 +5,15 @@
     struct sigframe *frame;

     abi_ulong frame_addr = env->regs[R_ESP] - 8;
+
+    target_sigset_t target_set;

+    sigset_t set;

     int eax, i;

+
 #if defined(DEBUG_SIGNAL)

     fprintf(stderr, "do_sigreturn\n");

long do_sigreturn(CPUX86State *env)

{

    struct sigframe *frame;

    abi_ulong frame_addr = env->regs[R_ESP] - 8;

    target_sigset_t target_set;

    sigset_t set;

    int eax, i;

#if defined(DEBUG_SIGNAL)

    fprintf(stderr, "do_sigreturn\n");

#endif

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

        goto badframe;

    /* set blocked signals */

    if (__get_user(target_set.sig[0], &frame->sc.oldmask))

        goto badframe;

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

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

            goto badframe;

    }

    target_to_host_sigset_internal(&set, &target_set);

    do_sigprocmask(SIG_SETMASK, &set, NULL);

    /* restore registers */

    if (restore_sigcontext(env, &frame->sc, &eax))

        goto badframe;

    unlock_user_struct(frame, frame_addr, 0);

    return eax;

badframe:

    unlock_user_struct(frame, frame_addr, 0);

    force_sig(TARGET_SIGSEGV);

    return 0;

}


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

     if (lp->ptr == PHYS_MAP_NODE_NIL) {
+
         return;

     }

static void destroy_l2_mapping(PhysPageEntry *lp, unsigned level)

{

    unsigned i;

    PhysPageEntry *p;

    if (lp->ptr == PHYS_MAP_NODE_NIL) {

        return;

    }

    p = phys_map_nodes[lp->ptr];

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

        if (!p[i].is_leaf) {

            destroy_l2_mapping(&p[i], level - 1);

        } else {

            destroy_page_desc(p[i].ptr);

        }

    }

    lp->is_leaf = 0;

    lp->ptr = PHYS_MAP_NODE_NIL;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void pstrcpy_targphys(const char *name, target_phys_addr_t dest, int buf_size,

                       const char *source)
+
+{
+
+    const char *nulp;
+
     char *ptr;

void pstrcpy_targphys(const char *name, target_phys_addr_t dest, int buf_size,

                      const char *source)

{

    const char *nulp;

    char *ptr;

    if (buf_size <= 0) return;

    nulp = memchr(source, 0, buf_size);

    if (nulp) {

        rom_add_blob_fixed(name, source, (nulp - source) + 1, dest);

    } else {

        rom_add_blob_fixed(name, source, buf_size, dest);

        ptr = rom_ptr(dest + buf_size - 1);

        *ptr = 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static FlatRange *address_space_lookup(AddressSpace *as, AddrRange addr)
+
 {

     return bsearch(&addr, as->current_map.ranges, as->current_map.nr,

static FlatRange *address_space_lookup(AddressSpace *as, AddrRange addr)

{

    return bsearch(&addr, as->current_map.ranges, as->current_map.nr,

                   sizeof(FlatRange), cmp_flatrange_addr);

}


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

     const char *name = reg2str(reg);
+
     QTestState *qtest = global_qtest;

     unsigned res;

static inline unsigned in_reg(IVState *s, enum Reg reg)

{

    const char *name = reg2str(reg);

    QTestState *qtest = global_qtest;

    unsigned res;

    global_qtest = s->qtest;

    res = qpci_io_readl(s->dev, s->reg_base + reg);

    g_test_message("*%s -> %x\n", name, res);

    global_qtest = qtest;

    return res;

}


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

+    assert((granularity & (granularity - 1)) == 0);

BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, int granularity,

                                          Error **errp)

{

    int64_t bitmap_size;

    BdrvDirtyBitmap *bitmap;

    assert((granularity & (granularity - 1)) == 0);

    granularity >>= BDRV_SECTOR_BITS;

    assert(granularity);

    bitmap_size = bdrv_nb_sectors(bs);

    if (bitmap_size < 0) {

        error_setg_errno(errp, -bitmap_size, "could not get length of device");

        errno = -bitmap_size;

        return NULL;

    }

    bitmap = g_malloc0(sizeof(BdrvDirtyBitmap));

    bitmap->bitmap = hbitmap_alloc(bitmap_size, ffs(granularity) - 1);

    QLIST_INSERT_HEAD(&bs->dirty_bitmaps, bitmap, list);

    return bitmap;

}


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

 {
+
+    return ~(uint64_t)0;

 }

static uint64_t kvm_apic_mem_read(void *opaque, target_phys_addr_t addr,

                                  unsigned size)

{

    return ~(uint64_t)0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static uint32_t memory_region_read_thunk_n(void *_mr,

+                                           target_phys_addr_t addr,
+
+                                           unsigned size)
+
+{

     MemoryRegion *mr = _mr;

static uint32_t memory_region_read_thunk_n(void *_mr,

                                           target_phys_addr_t addr,

                                           unsigned size)

{

    MemoryRegion *mr = _mr;

    uint64_t data = 0;

    if (!memory_region_access_valid(mr, addr, size)) {

        return -1U; /* FIXME: better signalling */

    }

    if (!mr->ops->read) {

        return mr->ops->old_mmio.read[bitops_ffsl(size)](mr->opaque, addr);

    }

    /* FIXME: support unaligned access */

    access_with_adjusted_size(addr + mr->offset, &data, size,

                              mr->ops->impl.min_access_size,

                              mr->ops->impl.max_access_size,

                              memory_region_read_accessor, mr);

    return data;

}


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

     for (i = 0; i < MAX_DISKS; i++) {
+
+        if (bs_table[i])
+
+            bdrv_commit(bs_table[i]);

     }

static void do_commit(int argc, const char **argv)

{

    int i;

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

        if (bs_table[i])

            bdrv_commit(bs_table[i]);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void put_line(uint8_t *dst, int size, int width, const int *runs)

 {
+
     PutBitContext pb;

     int run, mode = ~0, pix_left = width, run_idx = 0;

static void put_line(uint8_t *dst, int size, int width, const int *runs)

{

    PutBitContext pb;

    int run, mode = ~0, pix_left = width, run_idx = 0;

    init_put_bits(&pb, dst, size * 8);

    while (pix_left > 0) {

        run       = runs[run_idx++];

        mode      = ~mode;

        pix_left -= run;

        for (; run > 16; run -= 16)

            put_sbits(&pb, 16, mode);

        if (run)

            put_sbits(&pb, run, mode);

    }

    flush_put_bits(&pb);

}


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

     fail_unless(count == qdict_size(tests_dict));

+
+
+    /* Do it again to test restarting */
+
+    count = 0;

     for (ent = qdict_first(tests_dict); ent; ent = qdict_next(tests_dict, ent)){

START_TEST(qdict_iterapi_test)

{

    int count;

    const QDictEntry *ent;

    fail_unless(qdict_first(tests_dict) == NULL);

    qdict_put(tests_dict, "key1", qint_from_int(1));

    qdict_put(tests_dict, "key2", qint_from_int(2));

    qdict_put(tests_dict, "key3", qint_from_int(3));

    count = 0;

    for (ent = qdict_first(tests_dict); ent; ent = qdict_next(tests_dict, ent)){

        fail_unless(qdict_haskey(tests_dict, qdict_entry_key(ent)) == 1);

        count++;

    }

    fail_unless(count == qdict_size(tests_dict));

    /* Do it again to test restarting */

    count = 0;

    for (ent = qdict_first(tests_dict); ent; ent = qdict_next(tests_dict, ent)){

        fail_unless(qdict_haskey(tests_dict, qdict_entry_key(ent)) == 1);

        count++;

    }

    fail_unless(count == qdict_size(tests_dict));

}


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

     rdma->wr_data[idx].control_len = head->len;
+
+    rdma->wr_data[idx].control_curr =
+
         rdma->wr_data[idx].control + sizeof(RDMAControlHeader);

 }

static void qemu_rdma_move_header(RDMAContext *rdma, int idx,

                                  RDMAControlHeader *head)

{

    rdma->wr_data[idx].control_len = head->len;

    rdma->wr_data[idx].control_curr =

        rdma->wr_data[idx].control + sizeof(RDMAControlHeader);

}


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

     if (xen_hvm_init() != 0) {
+
+        hw_error("xen hardware virtual machine initialisation failed");
+
     }

     pc_init_pci(args);

static void pc_xen_hvm_init(QEMUMachineInitArgs *args)

{

    if (xen_hvm_init() != 0) {

        hw_error("xen hardware virtual machine initialisation failed");

    }

    pc_init_pci(args);

}


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

     ASS *ass = &ctx->ass;
+
     int i;

ASSStyle *ff_ass_style_get(ASSSplitContext *ctx, const char *style)

{

    ASS *ass = &ctx->ass;

    int i;

    if (!style || !*style)

        style = "Default";

    for (i=0; i<ass->styles_count; i++)

        if (!strcmp(ass->styles[i].name, style))

            return ass->styles + i;

    return NULL;

}


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

         array->pointer = g_realloc(array->pointer, new_size);

+        if (!array->pointer)
+
+            return -1;
+
+
         array->size = new_size;

         array->next = index + 1;

static inline int array_ensure_allocated(array_t* array, int index)

{

    if((index + 1) * array->item_size > array->size) {

        int new_size = (index + 32) * array->item_size;

        array->pointer = g_realloc(array->pointer, new_size);

        if (!array->pointer)

            return -1;

        array->size = new_size;

        array->next = index + 1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,

                                          size_t resid)
+
+{
+
+    VirtIOSCSIReq *req = r->hba_private;
+
     uint8_t sense[SCSI_SENSE_BUF_SIZE];

     uint32_t sense_len;

static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,

                                         size_t resid)

{

    VirtIOSCSIReq *req = r->hba_private;

    uint8_t sense[SCSI_SENSE_BUF_SIZE];

    uint32_t sense_len;

    if (r->io_canceled) {

        return;

    }

    req->resp.cmd->response = VIRTIO_SCSI_S_OK;

    req->resp.cmd->status = status;

    if (req->resp.cmd->status == GOOD) {

        req->resp.cmd->resid = tswap32(resid);

    } else {

        req->resp.cmd->resid = 0;

        sense_len = scsi_req_get_sense(r, sense, sizeof(sense));

        sense_len = MIN(sense_len, req->resp_size - sizeof(req->resp.cmd));

        memcpy(req->resp.cmd->sense, sense, sense_len);

        req->resp.cmd->sense_len = tswap32(sense_len);

    }

    virtio_scsi_complete_cmd_req(req);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void IRQ_check(OpenPICState *opp, IRQ_queue_t *q)

 {

static void IRQ_check(OpenPICState *opp, IRQ_queue_t *q)

{

    int next, i;

    int priority;

    next = -1;

    priority = -1;

    if (!q->pending) {

        /* IRQ bitmap is empty */

        goto out;

    }

    for (i = 0; i < opp->max_irq; i++) {

        if (IRQ_testbit(q, i)) {

            DPRINTF("IRQ_check: irq %d set ipvp_pr=%d pr=%d\n",

                    i, IPVP_PRIORITY(opp->src[i].ipvp), priority);

            if (IPVP_PRIORITY(opp->src[i].ipvp) > priority) {

                next = i;

                priority = IPVP_PRIORITY(opp->src[i].ipvp);

            }

        }

    }

out:

    q->next = next;

    q->priority = priority;

}


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

     PulseData *s = h->priv_data;

+    pa_usec_t latency;
+
+    int neg;
+
+    pa_threaded_mainloop_lock(s->mainloop);

     pa_stream_get_latency(s->stream, &latency, &neg);

static void pulse_get_output_timestamp(AVFormatContext *h, int stream, int64_t *dts, int64_t *wall)

{

    PulseData *s = h->priv_data;

    pa_usec_t latency;

    int neg;

    pa_threaded_mainloop_lock(s->mainloop);

    pa_stream_get_latency(s->stream, &latency, &neg);

    pa_threaded_mainloop_unlock(s->mainloop);

    *wall = av_gettime();

    *dts = s->timestamp - (neg ? -latency : latency);

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@
         ide_transfer_stop(s);
     s->status |= BUSY_STAT;
     if (n > s->req_nb_sectors) {
+        n = s->req_nb_sectors;
+#if defined(DEBUG_IDE)
+    printf("sector=%" PRId64 "\n", sector_num);
+#endif
+    s->iov.iov_base = s->io_buffer;
     s->iov.iov_len  = n * BDRV_SECTOR_SIZE;
     qemu_iovec_init_external(&s->qiov, &s->iov, 1);
     bdrv_acct_start(s->bs, &s->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);

void ide_sector_read(IDEState *s)
{
    int64_t sector_num;
    int n;
    s->status = READY_STAT | SEEK_STAT;
    s->error = 0; /* not needed by IDE spec, but needed by Windows */
    sector_num = ide_get_sector(s);
    n = s->nsector;
    if (n == 0) {
        ide_transfer_stop(s);
    s->status |= BUSY_STAT;
    if (n > s->req_nb_sectors) {
        n = s->req_nb_sectors;
#if defined(DEBUG_IDE)
    printf("sector=%" PRId64 "\n", sector_num);
#endif
    s->iov.iov_base = s->io_buffer;
    s->iov.iov_len  = n * BDRV_SECTOR_SIZE;
    qemu_iovec_init_external(&s->qiov, &s->iov, 1);
    bdrv_acct_start(s->bs, &s->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);
    s->pio_aiocb = bdrv_aio_readv(s->bs, sector_num, &s->qiov, n,
                                  ide_sector_read_cb, s);


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

     /* Enable protocol handling, disable format probing for bs->file */
+
+    flags |= BDRV_O_PROTOCOL;
+
+
+
     /* Our block drivers take care to send flushes and respect unmap policy,

      * so we can enable both unconditionally on lower layers. */

static int bdrv_inherited_flags(int flags)

{

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

    flags |= BDRV_O_PROTOCOL;

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

     * so we can enable both unconditionally on lower layers. */

    flags |= BDRV_O_CACHE_WB | BDRV_O_UNMAP;

    /* The backing file of a temporary snapshot is read-only */

    if (flags & BDRV_O_SNAPSHOT) {

        flags &= ~BDRV_O_RDWR;

    }

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

    flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);

    return flags;

}


--- a/source.c
+++ b/source.c
@@ -1,28 +1,28 @@
 GList *range_list_insert(GList *list, Range *data)
+
+{
+
+    GList *l, *next = NULL;
+
     Range *r, *nextr;
+
+
+
+    if (!list) {
+
+        list = g_list_insert_sorted(list, data, range_compare);
+
+        return list;
+
+    }

+

     nextr = data;
+
     l = list;

+    while (l && l != next && nextr) {

         r = l->data;

GList *range_list_insert(GList *list, Range *data)

{

    GList *l, *next = NULL;

    Range *r, *nextr;

    if (!list) {

        list = g_list_insert_sorted(list, data, range_compare);

        return list;

    }

    nextr = data;

    l = list;

    while (l && l != next && nextr) {

        r = l->data;

        if (ranges_can_merge(r, nextr)) {

            range_merge(r, nextr);

            l = g_list_remove_link(l, next);

            next = g_list_next(l);

            if (next) {

                nextr = next->data;

            } else {

                nextr = NULL;

            }

        } else {

            l = g_list_next(l);

        }

    }

    if (!l) {

        list = g_list_insert_sorted(list, data, range_compare);

    }

    return list;

}


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

     else

+        pix_fmts = mpeg12_pixfmt_list_444;
+
+
+
+    return ff_get_format(avctx, pix_fmts);

 }

static enum AVPixelFormat mpeg_get_pixelformat(AVCodecContext *avctx)

{

    Mpeg1Context *s1  = avctx->priv_data;

    MpegEncContext *s = &s1->mpeg_enc_ctx;

    const enum AVPixelFormat *pix_fmts;

#if FF_API_XVMC

FF_DISABLE_DEPRECATION_WARNINGS

    if (avctx->xvmc_acceleration)

        return ff_get_format(avctx, pixfmt_xvmc_mpg2_420);

FF_ENABLE_DEPRECATION_WARNINGS

#endif /* FF_API_XVMC */

    if (s->chroma_format < 2)

        pix_fmts = mpeg12_hwaccel_pixfmt_list_420;

    else if (s->chroma_format == 2)

        pix_fmts = mpeg12_pixfmt_list_422;

    else

        pix_fmts = mpeg12_pixfmt_list_444;

    return ff_get_format(avctx, pix_fmts);

}


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

     PerThreadContext *p;

+    atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;

void ff_thread_report_progress(ThreadFrame *f, int n, int field)

{

    PerThreadContext *p;

    atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;

    if (!progress ||

        atomic_load_explicit(&progress[field], memory_order_relaxed) >= n)

        return;

    p = f->owner[field]->internal->thread_ctx;

    if (f->owner[field]->debug&FF_DEBUG_THREADS)

        av_log(f->owner[field], AV_LOG_DEBUG,

               "%p finished %d field %d\n", progress, n, field);

    pthread_mutex_lock(&p->progress_mutex);

    atomic_store_explicit(&progress[field], n, memory_order_release);

    pthread_cond_broadcast(&p->progress_cond);

    pthread_mutex_unlock(&p->progress_mutex);

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
            if (!gnutls_record_get_direction(vs->tls_session))

                qemu_set_fd_handler(vs->csock, vnc_handshake_io, NULL, vs);
+
+           else
+
+               qemu_set_fd_handler(vs->csock, NULL, vnc_handshake_io, vs);
+
            return 0;

        }

static int vnc_continue_handshake(struct VncState *vs) {

    int ret;

    if ((ret = gnutls_handshake(vs->tls_session)) < 0) {

       if (!gnutls_error_is_fatal(ret)) {

           VNC_DEBUG("Handshake interrupted (blocking)\n");

           if (!gnutls_record_get_direction(vs->tls_session))

               qemu_set_fd_handler(vs->csock, vnc_handshake_io, NULL, vs);

           else

               qemu_set_fd_handler(vs->csock, NULL, vnc_handshake_io, vs);

           return 0;

       }

       VNC_DEBUG("Handshake failed %s\n", gnutls_strerror(ret));

       vnc_client_error(vs);

       return -1;

    }

    if (vs->vd->x509verify) {

	if (vnc_validate_certificate(vs) < 0) {

	    VNC_DEBUG("Client verification failed\n");

	    vnc_client_error(vs);

	    return -1;

	} else {

	    VNC_DEBUG("Client verification passed\n");

	}

    }

    VNC_DEBUG("Handshake done, switching to TLS data mode\n");

    vs->wiremode = VNC_WIREMODE_TLS;

    qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs);

    return start_auth_vencrypt_subauth(vs);

}


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

                 break;

+        }
+
+    } else {
+
+        switch (vs->ds->surface->pf.bits_per_pixel) {

             case 8:

void vnc_hextile_set_pixel_conversion(VncState *vs, int generic)

{

    if (!generic) {

        switch (vs->ds->surface->pf.bits_per_pixel) {

            case 8:

                vs->send_hextile_tile = send_hextile_tile_8;

                break;

            case 16:

                vs->send_hextile_tile = send_hextile_tile_16;

                break;

            case 32:

                vs->send_hextile_tile = send_hextile_tile_32;

                break;

        }

    } else {

        switch (vs->ds->surface->pf.bits_per_pixel) {

            case 8:

                vs->send_hextile_tile = send_hextile_tile_generic_8;

                break;

            case 16:

                vs->send_hextile_tile = send_hextile_tile_generic_16;

                break;

            case 32:

                vs->send_hextile_tile = send_hextile_tile_generic_32;

                break;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
     put_bits(&pb, 1, w->per_mb_rl_bit=1);

     put_bits(&pb, 3, code=1);
+
+
+
+    flush_put_bits(&pb);
+

     s->slice_height = s->mb_height / code;

static int encode_ext_header(Wmv2Context *w){

    MpegEncContext * const s= &w->s;

    PutBitContext pb;

    int code;

    init_put_bits(&pb, s->avctx->extradata, s->avctx->extradata_size);

    put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29

    put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047));

    put_bits(&pb, 1, w->mspel_bit=1);

    put_bits(&pb, 1, w->flag3=1);

    put_bits(&pb, 1, w->abt_flag=1);

    put_bits(&pb, 1, w->j_type_bit=1);

    put_bits(&pb, 1, w->top_left_mv_flag=0);

    put_bits(&pb, 1, w->per_mb_rl_bit=1);

    put_bits(&pb, 3, code=1);

    flush_put_bits(&pb);

    s->slice_height = s->mb_height / code;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
         .port = NULL, /* Filled in later */

     };
+
+
+
+    test_io_channel(async, listen_addr, connect_addr, false);
+

     qapi_free_SocketAddress(listen_addr);

static void test_io_channel_ipv6(bool async)

{

    SocketAddress *listen_addr = g_new0(SocketAddress, 1);

    SocketAddress *connect_addr = g_new0(SocketAddress, 1);

    listen_addr->type = SOCKET_ADDRESS_KIND_INET;

    listen_addr->u.inet = g_new(InetSocketAddress, 1);

    *listen_addr->u.inet = (InetSocketAddress) {

        .host = g_strdup("::1"),

        .port = NULL, /* Auto-select */

    };

    connect_addr->type = SOCKET_ADDRESS_KIND_INET;

    connect_addr->u.inet = g_new(InetSocketAddress, 1);

    *connect_addr->u.inet = (InetSocketAddress) {

        .host = g_strdup("::1"),

        .port = NULL, /* Filled in later */

    };

    test_io_channel(async, listen_addr, connect_addr, false);

    qapi_free_SocketAddress(listen_addr);

    qapi_free_SocketAddress(connect_addr);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void qemu_mutex_init(QemuMutex *mutex)

+{
+
+    int err;
+
+    pthread_mutexattr_t mutexattr;

void qemu_mutex_init(QemuMutex *mutex)

{

    int err;

    pthread_mutexattr_t mutexattr;

    pthread_mutexattr_init(&mutexattr);

    pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK);

    err = pthread_mutex_init(&mutex->lock, &mutexattr);

    pthread_mutexattr_destroy(&mutexattr);

    if (err)

        error_exit(err, __func__);

}


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

                               uint32_t value)

+{

     m5206_mbar_state *s = (m5206_mbar_state *)opaque;

static void m5206_mbar_writeb(void *opaque, target_phys_addr_t offset,

                              uint32_t value)

{

    m5206_mbar_state *s = (m5206_mbar_state *)opaque;

    int width;

    offset &= 0x3ff;

    if (offset > 0x200) {

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

    }

    width = m5206_mbar_width[offset >> 2];

    if (width > 1) {

        uint32_t tmp;

        tmp = m5206_mbar_readw(opaque, offset & ~1);

        if (offset & 1) {

            tmp = (tmp & 0xff00) | value;

        } else {

            tmp = (tmp & 0x00ff) | (value << 8);

        }

        m5206_mbar_writew(opaque, offset & ~1, tmp);

        return;

    }

    m5206_mbar_write(s, offset, value, 1);

}


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

+
+    switch (offset) {
+
+    case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:
+
         t = &s->timer[offset >> 2];

         t->limit = value;

static void mv88w8618_pit_write(void *opaque, target_phys_addr_t offset,

                                uint32_t value)

{

    mv88w8618_pit_state *s = opaque;

    mv88w8618_timer_state *t;

    int i;

    switch (offset) {

    case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:

        t = &s->timer[offset >> 2];

        t->limit = value;

        ptimer_set_limit(t->ptimer, t->limit, 1);

        break;

    case MP_PIT_CONTROL:

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

            if (value & 0xf) {

                t = &s->timer[i];

                ptimer_set_limit(t->ptimer, t->limit, 0);

                ptimer_set_freq(t->ptimer, t->freq);

                ptimer_run(t->ptimer, 0);

            }

            value >>= 4;

        }

        break;

    case MP_BOARD_RESET:

        if (value == MP_BOARD_RESET_MAGIC) {

            qemu_system_reset_request();

        }

        break;

    }

}


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

     if (qdev_hotplug) {
+
         assert(bus->allow_hotplug);

     }

static void bus_add_child(BusState *bus, DeviceState *child)

{

    char name[32];

    BusChild *kid = g_malloc0(sizeof(*kid));

    if (qdev_hotplug) {

        assert(bus->allow_hotplug);

    }

    kid->index = bus->max_index++;

    kid->child = child;

    object_ref(OBJECT(kid->child));

    QTAILQ_INSERT_HEAD(&bus->children, kid, sibling);

    /* This transfers ownership of kid->child to the property.  */

    snprintf(name, sizeof(name), "child[%d]", kid->index);

    object_property_add_link(OBJECT(bus), name,

                             object_get_typename(OBJECT(child)),

                             (Object **)&kid->child,

                             NULL);

}


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

     if (new_len <= qsb->size) {
+
+        qsb->used = new_len;
+
+    } else {

         qsb->used = qsb->size;

size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t new_len)

{

    if (new_len <= qsb->size) {

        qsb->used = new_len;

    } else {

        qsb->used = qsb->size;

    }

    return qsb->used;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void vnc_display_init(DisplayState *ds)

+{
+
+    VncDisplay *vs = g_malloc0(sizeof(*vs));

@@ -14,8 +14,8 @@

     dcl->idle = 1;

+    vnc_display = vs;
+

     vs->lsock = -1;

void vnc_display_init(DisplayState *ds)

{

    VncDisplay *vs = g_malloc0(sizeof(*vs));

    dcl = g_malloc0(sizeof(DisplayChangeListener));

    ds->opaque = vs;

    dcl->idle = 1;

    vnc_display = vs;

    vs->lsock = -1;

#ifdef CONFIG_VNC_WS

    vs->lwebsock = -1;

#endif

    vs->ds = ds;

    QTAILQ_INIT(&vs->clients);

    vs->expires = TIME_MAX;

    if (keyboard_layout)

        vs->kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);

    else

        vs->kbd_layout = init_keyboard_layout(name2keysym, "en-us");

    if (!vs->kbd_layout)

        exit(1);

    qemu_mutex_init(&vs->mutex);

    vnc_start_worker_thread();

    dcl->ops = &dcl_ops;

    register_displaychangelistener(ds, dcl);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static inline int available_samples(AVFrame *out)

+{

     int bytes_per_sample = av_get_bytes_per_sample(out->format);

static inline int available_samples(AVFrame *out)

{

    int bytes_per_sample = av_get_bytes_per_sample(out->format);

    int samples = out->linesize[0] / bytes_per_sample;

    if (av_sample_fmt_is_planar(out->format)) {

        return samples;

    } else {

        int channels = av_get_channel_layout_nb_channels(out->channel_layout);

        return samples / channels;

    }

}


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

     while (band < num_bands) {
+
+        band_type = get_bits(gb, 4);
+
+        run_len   = 1;
+
         do {

             run = get_bits(gb, bits_per_sect);

static int on2avc_decode_band_types(On2AVCContext *c, GetBitContext *gb)

{

    int bits_per_sect = c->is_long ? 5 : 3;

    int esc_val = (1 << bits_per_sect) - 1;

    int num_bands = c->num_bands * c->num_windows;

    int band = 0, i, band_type, run_len, run;

    while (band < num_bands) {

        band_type = get_bits(gb, 4);

        run_len   = 1;

        do {

            run = get_bits(gb, bits_per_sect);

            run_len += run;

        } while (run == esc_val);

        if (band + run_len > num_bands) {

            av_log(c->avctx, AV_LOG_ERROR, "Invalid band type run\n");

            return AVERROR_INVALIDDATA;

        }

        for (i = band; i < band + run_len; i++) {

            c->band_type[i]    = band_type;

            c->band_run_end[i] = band + run_len;

        }

        band += run_len;

    }

    return 0;

}


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

                                  Error **errp)

+{
+
+    s->get_error = socket_errno;
+
+    s->write = socket_write;

     s->close = tcp_close;

int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,

                                 Error **errp)

{

    s->get_error = socket_errno;

    s->write = socket_write;

    s->close = tcp_close;

    s->fd = inet_connect(host_port, false, errp);

    if (!error_is_set(errp)) {

        migrate_fd_connect(s);

    } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_IN_PROGRESS)) {

        DPRINTF("connect in progress\n");

        qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s);

    } else if (error_is_type(*errp, QERR_SOCKET_CREATE_FAILED)) {

        DPRINTF("connect failed\n");

        return -1;

    } else if (error_is_type(*errp, QERR_SOCKET_CONNECT_FAILED)) {

        DPRINTF("connect failed\n");

        migrate_fd_error(s);

        return -1;

    } else {

        DPRINTF("unknown error\n");

        return -1;

    }

    return 0;

}


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

 {

+    TCGMemOp opc = get_memop(oi);
+
 #ifdef CONFIG_SOFTMMU

     unsigned mem_index = get_mmuidx(oi);

static void tcg_out_qemu_st(TCGContext* s, TCGReg data_reg, TCGReg addr_reg,

                            TCGMemOpIdx oi)

{

    TCGMemOp opc = get_memop(oi);

#ifdef CONFIG_SOFTMMU

    unsigned mem_index = get_mmuidx(oi);

    tcg_insn_unit *label_ptr;

    TCGReg base_reg;

    base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 0);

    label_ptr = s->code_ptr + 1;

    tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);

    tcg_out_qemu_st_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0);

    add_qemu_ldst_label(s, 0, oi, data_reg, addr_reg, s->code_ptr, label_ptr);

#else

    TCGReg index_reg;

    tcg_target_long disp;

    tcg_prepare_user_ldst(s, &addr_reg, &index_reg, &disp);

    tcg_out_qemu_st_direct(s, opc, data_reg, addr_reg, index_reg, disp);

#endif

}


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

     memory_region_init(mr, owner, name, size);

+    mr->ram = true;
+
+    mr->terminates = true;
+
+    mr->destructor = memory_region_destructor_ram;

     mr->ram_addr = qemu_ram_alloc(size, mr);

void memory_region_init_ram(MemoryRegion *mr,

                            Object *owner,

                            const char *name,

                            uint64_t size)

{

    memory_region_init(mr, owner, name, size);

    mr->ram = true;

    mr->terminates = true;

    mr->destructor = memory_region_destructor_ram;

    mr->ram_addr = qemu_ram_alloc(size, mr);

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     if(v){

         const int a= FFABS(v);
+
+        const int e= av_log2(a);
+
+        put_rac(c, state+0, 0);
+

         assert(e<=9);

static inline void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed){

    int i;

    if(v){

        const int a= FFABS(v);

        const int e= av_log2(a);

        put_rac(c, state+0, 0);

        assert(e<=9);

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

            put_rac(c, state+1+i, 1);  //1..10

        }

        put_rac(c, state+1+i, 0);

        for(i=e-1; i>=0; i--){

            put_rac(c, state+22+i, (a>>i)&1); //22..31

        }

        if(is_signed)

            put_rac(c, state+11 + e, v < 0); //11..21

    }else{

        put_rac(c, state+0, 1);

    }

}


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

     dc->realize = spapr_phb_realize;

+    dc->props = spapr_phb_properties;
+
+    dc->reset = spapr_phb_reset;
+
+    dc->vmsd = &vmstate_spapr_pci;

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

{

    PCIHostBridgeClass *hc = PCI_HOST_BRIDGE_CLASS(klass);

    DeviceClass *dc = DEVICE_CLASS(klass);

    HotplugHandlerClass *hp = HOTPLUG_HANDLER_CLASS(klass);

    hc->root_bus_path = spapr_phb_root_bus_path;

    dc->realize = spapr_phb_realize;

    dc->props = spapr_phb_properties;

    dc->reset = spapr_phb_reset;

    dc->vmsd = &vmstate_spapr_pci;

    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);

    hp->plug = spapr_phb_hot_plug_child;

    hp->unplug = spapr_phb_hot_unplug_child;

}


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

         (kbd_mouse_is_absolute() || absolute_enabled)) {
+
+        max_x = real_screen->w - 1;
+
+        max_y = real_screen->h - 1;
+
         if (gui_grab && (ev->motion.x == 0 || ev->motion.y == 0 ||

             ev->motion.x == max_x || ev->motion.y == max_y)) {

static void handle_mousemotion(DisplayState *ds, SDL_Event *ev)

{

    int max_x, max_y;

    if (is_graphic_console() &&

        (kbd_mouse_is_absolute() || absolute_enabled)) {

        max_x = real_screen->w - 1;

        max_y = real_screen->h - 1;

        if (gui_grab && (ev->motion.x == 0 || ev->motion.y == 0 ||

            ev->motion.x == max_x || ev->motion.y == max_y)) {

            sdl_grab_end();

        }

        if (!gui_grab && SDL_GetAppState() & SDL_APPINPUTFOCUS &&

            (ev->motion.x > 0 && ev->motion.x < max_x &&

            ev->motion.y > 0 && ev->motion.y < max_y)) {

            sdl_grab_start();

        }

    }

    if (gui_grab || kbd_mouse_is_absolute() || absolute_enabled) {

        sdl_send_mouse_event(ev->motion.xrel, ev->motion.yrel, 0,

                             ev->motion.x, ev->motion.y, ev->motion.state);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 int avfilter_default_query_formats(AVFilterContext *ctx)
+
 {

     enum AVMediaType type = ctx->inputs [0] ? ctx->inputs [0]->type :

int avfilter_default_query_formats(AVFilterContext *ctx)

{

    enum AVMediaType type = ctx->inputs [0] ? ctx->inputs [0]->type :

                            ctx->outputs[0] ? ctx->outputs[0]->type :

                            AVMEDIA_TYPE_VIDEO;

    avfilter_set_common_formats(ctx, avfilter_all_formats(type));

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -2,10 +2,10 @@
 {
     int64_t sector_num;
     int n;
+    s->status = READY_STAT | SEEK_STAT | BUSY_STAT;
+    sector_num = ide_get_sector(s);
+#if defined(DEBUG_IDE)
+    printf("sector=%" PRId64 "\n", sector_num);
 #endif
     n = s->nsector;
     if (n > s->req_nb_sectors) {

void ide_sector_write(IDEState *s)
{
    int64_t sector_num;
    int n;
    s->status = READY_STAT | SEEK_STAT | BUSY_STAT;
    sector_num = ide_get_sector(s);
#if defined(DEBUG_IDE)
    printf("sector=%" PRId64 "\n", sector_num);
#endif
    n = s->nsector;
    if (n > s->req_nb_sectors) {
        n = s->req_nb_sectors;
    s->iov.iov_base = s->io_buffer;
    s->iov.iov_len  = n * BDRV_SECTOR_SIZE;
    qemu_iovec_init_external(&s->qiov, &s->iov, 1);
    bdrv_acct_start(s->bs, &s->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);
    s->pio_aiocb = bdrv_aio_writev(s->bs, sector_num, &s->qiov, n,
                                   ide_sector_write_cb, s);


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
 {
     int i, b, c_idx = 0;
     int16_t *dst = (int16_t *)_dst;
+    DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
+    INIT_RESIDUE(res);
+    for (b = 1; b <= bytes; b++) {
+        future[0] = &lut_ctx[buf[b]];
+        future[1] = future[0] + 1*LUT_SIZE;
         future[2] = future[0] + 2*LUT_SIZE;
         future[3] = future[0] + 3*LUT_SIZE;
         if ((c_idx + 1) > coeffs)

int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
                               int bytes, uint8_t *_dst, int coeffs)
{
    int i, b, c_idx = 0;
    int16_t *dst = (int16_t *)_dst;
    DiracGolombLUT *future[4], *l = &lut_ctx[2*LUT_SIZE + buf[0]];
    INIT_RESIDUE(res);
    for (b = 1; b <= bytes; b++) {
        future[0] = &lut_ctx[buf[b]];
        future[1] = future[0] + 1*LUT_SIZE;
        future[2] = future[0] + 2*LUT_SIZE;
        future[3] = future[0] + 3*LUT_SIZE;
        if ((c_idx + 1) > coeffs)
            return c_idx;
        if (res_bits && l->sign) {
            int32_t coeff = 1;
            APPEND_RESIDUE(res, l->preamble);
            for (i = 0; i < (res_bits >> 1) - 1; i++) {
                coeff <<= 1;
                coeff |= (res >> (RSIZE_BITS - 2*i - 2)) & 1;
            }
            dst[c_idx++] = l->sign * (coeff - 1);
        }
        for (i = 0; i < LUT_BITS; i++)
            dst[c_idx + i] = l->ready[i];
        c_idx += l->ready_num;
        APPEND_RESIDUE(res, l->leftover);
        l = future[l->need_s ? 3 : !res_bits ? 2 : res_bits & 1];
    }
    return c_idx;
}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static void gen_div(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb)
+
 {
+
+    TCGv sr_ov = tcg_temp_new();

     TCGv t0 = tcg_temp_new();
+
+
+
     tcg_gen_setcondi_tl(TCG_COND_EQ, sr_ov, srcb, 0);

     /* The result of divide-by-zero is undefined.

static void gen_div(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb)

{

    TCGv sr_ov = tcg_temp_new();

    TCGv t0 = tcg_temp_new();

    tcg_gen_setcondi_tl(TCG_COND_EQ, sr_ov, srcb, 0);

    /* The result of divide-by-zero is undefined.

       Supress the host-side exception by dividing by 1.  */

    tcg_gen_or_tl(t0, srcb, sr_ov);

    tcg_gen_div_tl(dest, srca, t0);

    tcg_temp_free(t0);

    tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_ov, ctz32(SR_OV), 1);

    gen_ove_ov(dc, sr_ov);

    tcg_temp_free(sr_ov);

}


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

     QCowAIOCB *next;

+
+
+    /* Take the request off the list of running requests */
+
+    if (m->nb_clusters != 0) {

         LIST_REMOVE(m, next_in_flight);

static void run_dependent_requests(QCowL2Meta *m)

{

    QCowAIOCB *req;

    QCowAIOCB *next;

    /* Take the request off the list of running requests */

    if (m->nb_clusters != 0) {

        LIST_REMOVE(m, next_in_flight);

    }

    /*

     * Restart all dependent requests.

     * Can't use LIST_FOREACH here - the next link might not be the same

     * any more after the callback  (request could depend on a different

     * request now)

     */

    for (req = m->dependent_requests.lh_first; req != NULL; req = next) {

        next = req->next_depend.le_next;

        qcow_aio_write_cb(req, 0);

    }

    /* Empty the list for the next part of the request */

    LIST_INIT(&m->dependent_requests);

}


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

         aio_context_release(aio_context);

+    }
+
+
+
+    return result;

 }

int bdrv_flush_all(void)

{

    BlockDriverState *bs = NULL;

    int result = 0;

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

        AioContext *aio_context = bdrv_get_aio_context(bs);

        int ret;

        aio_context_acquire(aio_context);

        ret = bdrv_flush(bs);

        if (ret < 0 && !result) {

            result = ret;

        }

        aio_context_release(aio_context);

    }

    return result;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void mips_cpu_do_unaligned_access(CPUState *cs, vaddr addr,

+                                  int is_write, int is_user, uintptr_t retaddr)
+
+{
+
     MIPSCPU *cpu = MIPS_CPU(cs);

     CPUMIPSState *env = &cpu->env;

void mips_cpu_do_unaligned_access(CPUState *cs, vaddr addr,

                                  int is_write, int is_user, uintptr_t retaddr)

{

    MIPSCPU *cpu = MIPS_CPU(cs);

    CPUMIPSState *env = &cpu->env;

    env->CP0_BadVAddr = addr;

    do_raise_exception(env, (is_write == 1) ? EXCP_AdES : EXCP_AdEL, retaddr);

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 static inline void RENAME(rgb15ToY)(uint8_t *dst, uint8_t *src, int width)
+
+{

+	int i;
+
+	for(i=0; i<width; i++)
+
+	{

 		int d= ((uint16_t*)src)[i];

static inline void RENAME(rgb15ToY)(uint8_t *dst, uint8_t *src, int width)

{

	int i;

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

	{

		int d= ((uint16_t*)src)[i];

		int r= d&0x1F;

		int g= (d>>5)&0x1F;

		int b= (d>>10)&0x1F;

		dst[i]= ((RY*r + GY*g + BY*b)>>(RGB2YUV_SHIFT-3)) + 16;

	}

}


static void t_gen_mulu(TCGv d, TCGv d2, TCGv a, TCGv b)

{

	TCGv t0, t1;

	t0 = tcg_temp_new(TCG_TYPE_I64);

	t1 = tcg_temp_new(TCG_TYPE_I64);

	tcg_gen_extu_i32_i64(t0, a);

	tcg_gen_extu_i32_i64(t1, b);

	tcg_gen_mul_i64(t0, t0, t1);

	tcg_gen_trunc_i64_i32(d, t0);

	tcg_gen_shri_i64(t0, t0, 32);

	tcg_gen_trunc_i64_i32(d2, t0);

	tcg_temp_free(t0);

	tcg_temp_free(t1);

}


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

     if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {

+        return 0;
+
+    }
+
+

     if (parent) {

static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)

{

    char desc[DESC_SIZE];

    uint32_t cid;

    const char *p_name, *cid_str;

    size_t cid_str_size;

    BDRVVmdkState *s = bs->opaque;

    if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {

        return 0;

    }

    if (parent) {

        cid_str = "parentCID";

        cid_str_size = sizeof("parentCID");

    } else {

        cid_str = "CID";

        cid_str_size = sizeof("CID");

    }

    if ((p_name = strstr(desc,cid_str)) != NULL) {

        p_name += cid_str_size;

        sscanf(p_name,"%x",&cid);

    }

    return cid;

}


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

     if (src->format == AV_PIX_FMT_VIDEOTOOLBOX && src->buf[0]->size == 1)

+        return AVERROR_EXTERNAL;
+
+
+
+    ret = av_frame_ref(dst, src);

     if (ret < 0)

static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)

{

    AVFrame *src = srcp->f;

    int ret;

    if (src->format == AV_PIX_FMT_VIDEOTOOLBOX && src->buf[0]->size == 1)

        return AVERROR_EXTERNAL;

    ret = av_frame_ref(dst, src);

    if (ret < 0)

        return ret;

    av_dict_set(&dst->metadata, "stereo_mode", ff_h264_sei_stereo_mode(&h->sei.frame_packing), 0);

    if (srcp->sei_recovery_frame_cnt == 0)

        dst->key_frame = 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
             yield_until_fd_readable(s->fd);

         } else if (errno != EINTR) {
+
+            break;
+
+        }
+
     }

static int unix_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)

{

    QEMUFileSocket *s = opaque;

    ssize_t len;

    for (;;) {

        len = read(s->fd, buf, size);

        if (len != -1) {

            break;

        }

        if (errno == EAGAIN) {

            yield_until_fd_readable(s->fd);

        } else if (errno != EINTR) {

            break;

        }

    }

    if (len == -1) {

        len = -errno;

    }

    return len;

}


--- a/source.c
+++ b/source.c
@@ -29,9 +29,9 @@
     env->spr[SPR_HIOR] = 0;

+
+    ppc_hash64_set_external_hpt(cpu, spapr->htab, spapr->htab_shift,
+
+                                &error_fatal);
+
 }

static void spapr_cpu_reset(void *opaque)

{

    sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());

    PowerPCCPU *cpu = opaque;

    CPUState *cs = CPU(cpu);

    CPUPPCState *env = &cpu->env;

    cpu_reset(cs);

    /* All CPUs start halted.  CPU0 is unhalted from the machine level

     * reset code and the rest are explicitly started up by the guest

     * using an RTAS call */

    cs->halted = 1;

    env->spr[SPR_HIOR] = 0;

    ppc_hash64_set_external_hpt(cpu, spapr->htab, spapr->htab_shift,

                                &error_fatal);

}


static int ffm_write_write_index(int fd, int64_t pos)

{

    uint8_t buf[8];

    int i;

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

        buf[i] = (pos >> (56 - i * 8)) & 0xff;

    lseek(fd, 8, SEEK_SET);

    if (write(fd, buf, 8) != 8)

        return AVERROR(EIO);

    return 8;

}


--- a/source.c
+++ b/source.c
@@ -5,8 +5,8 @@
     VAAPIEncodeContext *ctx = avctx->priv_data;

     VAAPIEncodePicture *pic, *next;
+
+

     for (pic = ctx->pic_start; pic; pic = next) {

av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)

{

    VAAPIEncodeContext *ctx = avctx->priv_data;

    VAAPIEncodePicture *pic, *next;

    for (pic = ctx->pic_start; pic; pic = next) {

        next = pic->next;

        vaapi_encode_free(avctx, pic);

    }

    if (ctx->va_context != VA_INVALID_ID)

        vaDestroyContext(ctx->hwctx->display, ctx->va_context);

    if (ctx->va_config != VA_INVALID_ID)

        vaDestroyConfig(ctx->hwctx->display, ctx->va_config);

    if (ctx->codec->close)

        ctx->codec->close(avctx);

    av_freep(&ctx->codec_sequence_params);

    av_freep(&ctx->codec_picture_params);

    av_buffer_unref(&ctx->recon_frames_ref);

    av_buffer_unref(&ctx->input_frames_ref);

    av_buffer_unref(&ctx->device_ref);

    av_freep(&ctx->priv_data);

    return 0;

}


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

     }

+    list->head = NULL;
+
+    list->tail = NULL;
+
+    g_free(list);

 }

vreader_list_delete(VReaderList *list)

{

    VReaderListEntry *current_entry;

    VReaderListEntry *next_entry = NULL;

    for (current_entry = vreader_list_get_first(list); current_entry;

         current_entry = next_entry) {

        next_entry = vreader_list_get_next(current_entry);

        vreader_list_entry_delete(current_entry);

    }

    list->head = NULL;

    list->tail = NULL;

    g_free(list);

}


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

     struct sockaddr_in addr;

+    socklen_t addrlen = sizeof(addr);
+
+
+
+    /* Catch-up */

     vga_hw_update();

static void vnc_listen_read(void *opaque)

{

    VncDisplay *vs = opaque;

    struct sockaddr_in addr;

    socklen_t addrlen = sizeof(addr);

    /* Catch-up */

    vga_hw_update();

    int csock = qemu_accept(vs->lsock, (struct sockaddr *)&addr, &addrlen);

    if (csock != -1) {

        vnc_connect(vs, csock);

    }

}


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

         stb_p(qemu_get_ram_ptr(ram_addr), val);

+        break;
+
+    case 2:
+
+        stw_p(qemu_get_ram_ptr(ram_addr), val);

         break;

static void notdirty_mem_write(void *opaque, target_phys_addr_t ram_addr,

                               uint64_t val, unsigned size)

{

    int dirty_flags;

    dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);

    if (!(dirty_flags & CODE_DIRTY_FLAG)) {

#if !defined(CONFIG_USER_ONLY)

        tb_invalidate_phys_page_fast(ram_addr, size);

        dirty_flags = cpu_physical_memory_get_dirty_flags(ram_addr);

#endif

    }

    switch (size) {

    case 1:

        stb_p(qemu_get_ram_ptr(ram_addr), val);

        break;

    case 2:

        stw_p(qemu_get_ram_ptr(ram_addr), val);

        break;

    case 4:

        stl_p(qemu_get_ram_ptr(ram_addr), val);

        break;

    default:

        abort();

    }

    dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);

    cpu_physical_memory_set_dirty_flags(ram_addr, dirty_flags);

    /* we remove the notdirty callback only if the code has been

       flushed */

    if (dirty_flags == 0xff)

        tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     uint32_t pcba = pnv_xscom_pcba(chip, addr);

     uint64_t val = 0;
+
     MemTxResult result;

static uint64_t xscom_read(void *opaque, hwaddr addr, unsigned width)

{

    PnvChip *chip = opaque;

    uint32_t pcba = pnv_xscom_pcba(chip, addr);

    uint64_t val = 0;

    MemTxResult result;

    /* Handle some SCOMs here before dispatch */

    val = xscom_read_default(chip, pcba);

    if (val != -1) {

        goto complete;

    }

    val = address_space_ldq(&chip->xscom_as, pcba << 3, MEMTXATTRS_UNSPECIFIED,

                            &result);

    if (result != MEMTX_OK) {

        qemu_log_mask(LOG_GUEST_ERROR, "XSCOM read failed at @0x%"

                      HWADDR_PRIx " pcba=0x%08x\n", addr, pcba);

        xscom_complete(current_cpu, HMER_XSCOM_FAIL | HMER_XSCOM_DONE);

        return 0;

    }

complete:

    xscom_complete(current_cpu, HMER_XSCOM_DONE);

    return val;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void network_to_remote_block(RDMARemoteBlock *rb)

 {
+
+    rb->remote_host_addr = ntohll(rb->remote_host_addr);
+
     rb->offset = ntohll(rb->offset);

     rb->length = ntohll(rb->length);

static void network_to_remote_block(RDMARemoteBlock *rb)

{

    rb->remote_host_addr = ntohll(rb->remote_host_addr);

    rb->offset = ntohll(rb->offset);

    rb->length = ntohll(rb->length);

    rb->remote_rkey = ntohl(rb->remote_rkey);

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
     Wmv2Context * const w= avctx->priv_data;

+
     if(ff_MPV_encode_init(avctx) < 0)

         return -1;

static av_cold int wmv2_encode_init(AVCodecContext *avctx){

    Wmv2Context * const w= avctx->priv_data;

    if(ff_MPV_encode_init(avctx) < 0)

        return -1;

    ff_wmv2_common_init(w);

    avctx->extradata_size= 4;

    avctx->extradata= av_mallocz(avctx->extradata_size + 10);

    encode_ext_header(w);

    return 0;

}


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

+{

     rc4030State *s = RC4030(dev);

     int i;
+

     s->config = 0x410; /* some boards seem to accept 0x104 too */

static void rc4030_reset(DeviceState *dev)

{

    rc4030State *s = RC4030(dev);

    int i;

    s->config = 0x410; /* some boards seem to accept 0x104 too */

    s->revision = 1;

    s->invalid_address_register = 0;

    memset(s->dma_regs, 0, sizeof(s->dma_regs));

    rc4030_dma_tt_update(s, 0, 0);

    s->remote_failed_address = s->memory_failed_address = 0;

    s->cache_maint = 0;

    s->cache_ptag = s->cache_ltag = 0;

    s->cache_bmask = 0;

    s->memory_refresh_rate = 0x18186;

    s->nvram_protect = 7;

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

        s->rem_speed[i] = 7;

    s->imr_jazz = 0x10; /* XXX: required by firmware, but why? */

    s->isr_jazz = 0;

    s->itr = 0;

    qemu_irq_lower(s->timer_irq);

    qemu_irq_lower(s->jazz_bus_irq);

}


--- a/source.c
+++ b/source.c
@@ -49,11 +49,11 @@
     cpu_register_physical_memory_log(int128_get64(fr->addr.start),

                                      int128_get64(fr->addr.size),
+
+                                     phys_offset,
+
+                                     region_offset,
+
                                      fr->dirty_log_mask);

 }

static void as_memory_range_add(AddressSpace *as, FlatRange *fr)

{

    ram_addr_t phys_offset, region_offset;

    memory_region_prepare_ram_addr(fr->mr);

    phys_offset = fr->mr->ram_addr;

    region_offset = fr->offset_in_region;

    /* cpu_register_physical_memory_log() wants region_offset for

     * mmio, but prefers offseting phys_offset for RAM.  Humour it.

     */

    if ((phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM) {

        phys_offset += region_offset;

        region_offset = 0;

    }

    if (!fr->readable) {

        phys_offset &= ~TARGET_PAGE_MASK & ~IO_MEM_ROMD;

    }

    if (fr->readonly) {

        phys_offset |= IO_MEM_ROM;

    }

    cpu_register_physical_memory_log(int128_get64(fr->addr.start),

                                     int128_get64(fr->addr.size),

                                     phys_offset,

                                     region_offset,

                                     fr->dirty_log_mask);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline int cris_abs(int n)

 {

static inline int cris_abs(int n)

{

	int r;

	asm ("abs\t%1, %0\n" : "=r" (r) : "r" (n));

	return r;

}


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

+    av_dict_copy(&tmp, opts, 0);
+
+
+
+    av_opt_set_dict(var->input, &tmp);

static int url_connect(struct variant *var, AVDictionary *opts)

{

    AVDictionary *tmp = NULL;

    int ret;

    av_dict_copy(&tmp, opts, 0);

    av_opt_set_dict(var->input, &tmp);

    if ((ret = ffurl_connect(var->input, NULL)) < 0) {

        ffurl_close(var->input);

        var->input = NULL;

    }

    av_dict_free(&tmp);

    return ret;

}


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

     for (i = 0; i < ctx->nb_outputs; i++) {
+
+        ret = ff_filter_samples(inlink->dst->outputs[i],
+
+                                avfilter_ref_buffer(samplesref, ~AV_PERM_WRITE));
+
         if (ret < 0)

             break;

static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)

{

    AVFilterContext *ctx = inlink->dst;

    int i, ret = 0;

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

        ret = ff_filter_samples(inlink->dst->outputs[i],

                                avfilter_ref_buffer(samplesref, ~AV_PERM_WRITE));

        if (ret < 0)

            break;

    }

    avfilter_unref_buffer(samplesref);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,24 +1,24 @@
 static void gen_addc(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb)

 {
+
+    TCGv t0 = tcg_const_tl(0);
+
+    TCGv res = tcg_temp_new();
+
+    TCGv sr_cy = tcg_temp_new();
+
     TCGv sr_ov = tcg_temp_new();
+

     tcg_gen_shri_tl(sr_cy, cpu_sr, ctz32(SR_CY));
+
+    tcg_gen_andi_tl(sr_cy, sr_cy, 1);
+
+
+
+    tcg_gen_add2_tl(res, sr_cy, srca, t0, sr_cy, t0);

     tcg_gen_add2_tl(res, sr_cy, res, sr_cy, srcb, t0);

static void gen_addc(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb)

{

    TCGv t0 = tcg_const_tl(0);

    TCGv res = tcg_temp_new();

    TCGv sr_cy = tcg_temp_new();

    TCGv sr_ov = tcg_temp_new();

    tcg_gen_shri_tl(sr_cy, cpu_sr, ctz32(SR_CY));

    tcg_gen_andi_tl(sr_cy, sr_cy, 1);

    tcg_gen_add2_tl(res, sr_cy, srca, t0, sr_cy, t0);

    tcg_gen_add2_tl(res, sr_cy, res, sr_cy, srcb, t0);

    tcg_gen_xor_tl(sr_ov, srca, srcb);

    tcg_gen_xor_tl(t0, res, srcb);

    tcg_gen_andc_tl(sr_ov, t0, sr_ov);

    tcg_temp_free(t0);

    tcg_gen_mov_tl(dest, res);

    tcg_temp_free(res);

    tcg_gen_shri_tl(sr_ov, sr_ov, TARGET_LONG_BITS - 1);

    tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1);

    tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_ov, ctz32(SR_OV), 1);

    gen_ove_cyov(dc, sr_ov, sr_cy);

    tcg_temp_free(sr_ov);

    tcg_temp_free(sr_cy);

}


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

         error_setg(errp, "Memory backend has bad page size. "

+                   "Use 'memory-backend-file' with correct mem-path.");
+
+        return;
+
+    }

 }

static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,

                                  Error **errp)

{

    PCDIMMDevice *dimm = PC_DIMM(dev);

    PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);

    MemoryRegion *mr = ddc->get_memory_region(dimm);

    uint64_t size = memory_region_size(mr);

    char *mem_dev;

    if (size % SPAPR_MEMORY_BLOCK_SIZE) {

        error_setg(errp, "Hotplugged memory size must be a multiple of "

                      "%lld MB", SPAPR_MEMORY_BLOCK_SIZE / M_BYTE);

        return;

    }

    mem_dev = object_property_get_str(OBJECT(dimm), PC_DIMM_MEMDEV_PROP, NULL);

    if (mem_dev && !kvmppc_is_mem_backend_page_size_ok(mem_dev)) {

        error_setg(errp, "Memory backend has bad page size. "

                   "Use 'memory-backend-file' with correct mem-path.");

        return;

    }

}


--- a/source.c
+++ b/source.c
@@ -35,11 +35,11 @@
         sanitize_channel_layouts(ctx, ctx->inputs[i]->out_channel_layouts);

     for (i = 0; i < ctx->nb_outputs; i++)
+
+        sanitize_channel_layouts(ctx, ctx->outputs[i]->in_channel_layouts);
+
+
+
     formats = ff_all_formats(type);

     if (!formats)

static int filter_query_formats(AVFilterContext *ctx)

{

    int ret, i;

    AVFilterFormats *formats;

    AVFilterChannelLayouts *chlayouts;

    AVFilterFormats *samplerates;

    enum AVMediaType type = ctx->inputs  && ctx->inputs [0] ? ctx->inputs [0]->type :

                            ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :

                            AVMEDIA_TYPE_VIDEO;

    if ((ret = ctx->filter->query_formats(ctx)) < 0) {

        av_log(ctx, AV_LOG_ERROR, "Query format failed for '%s': %s\n",

               ctx->name, av_err2str(ret));

        return ret;

    }

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

        sanitize_channel_layouts(ctx, ctx->inputs[i]->out_channel_layouts);

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

        sanitize_channel_layouts(ctx, ctx->outputs[i]->in_channel_layouts);

    formats = ff_all_formats(type);

    if (!formats)

        return AVERROR(ENOMEM);

    ff_set_common_formats(ctx, formats);

    if (type == AVMEDIA_TYPE_AUDIO) {

        samplerates = ff_all_samplerates();

        if (!samplerates)

            return AVERROR(ENOMEM);

        ff_set_common_samplerates(ctx, samplerates);

        chlayouts = ff_all_channel_layouts();

        if (!chlayouts)

            return AVERROR(ENOMEM);

        ff_set_common_channel_layouts(ctx, chlayouts);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);

     VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
+
+
+
+    assert(!s->ctx);
+
     s->ctx = iothread_get_aio_context(vs->conf.iothread);

void virtio_scsi_set_iothread(VirtIOSCSI *s, IOThread *iothread)

{

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

    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);

    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);

    assert(!s->ctx);

    s->ctx = iothread_get_aio_context(vs->conf.iothread);

    /* Don't try if transport does not support notifiers. */

    if (!k->set_guest_notifiers || !k->ioeventfd_assign) {

        fprintf(stderr, "virtio-scsi: Failed to set iothread "

                   "(transport does not support notifiers)");

        exit(1);

    }

}


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

+    if (pal) {
+
+        frame->palette_has_changed = 1;
+
+        memcpy(s->pal, pal, AVPALETTE_SIZE);

     }

static int idcin_decode_frame(AVCodecContext *avctx,

                              void *data, int *got_frame,

                              AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size = avpkt->size;

    IdcinContext *s = avctx->priv_data;

    const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);

    AVFrame *frame = data;

    int ret;

    s->buf = buf;

    s->size = buf_size;

    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)

        return ret;

    if (idcin_decode_vlcs(s, frame))

        return AVERROR_INVALIDDATA;

    if (pal) {

        frame->palette_has_changed = 1;

        memcpy(s->pal, pal, AVPALETTE_SIZE);

    }

    /* make the palette available on the way out */

    memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);

    *got_frame = 1;

    /* report that the buffer was completely consumed */

    return buf_size;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void rv40_h_strong_loop_filter(uint8_t *src, const int stride,

                                       const int alpha, const int lims,

static void rv40_h_strong_loop_filter(uint8_t *src, const int stride,

                                      const int alpha, const int lims,

                                      const int dmode, const int chroma)

{

    rv40_strong_loop_filter(src, stride, 1, alpha, lims, dmode, chroma);

}


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

 {

+    if (guessed_disk_nature) {
+
+        return (blk_cfg.blk_size  == 512);
+
     }

     return (blk_cfg.geometry.heads == 255)

bool virtio_disk_is_scsi(void)

{

    if (guessed_disk_nature) {

        return (blk_cfg.blk_size  == 512);

    }

    return (blk_cfg.geometry.heads == 255)

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

        && (blk_cfg.blk_size  == 512);

}


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

     const char *codec_string = encoder ? "encoder" : "decoder";
+
     AVCodec *codec;

     if (c->codec->capabilities & CODEC_CAP_EXPERIMENTAL &&

static void assert_codec_experimental(AVCodecContext *c, int encoder)

{

    const char *codec_string = encoder ? "encoder" : "decoder";

    AVCodec *codec;

    if (c->codec->capabilities & CODEC_CAP_EXPERIMENTAL &&

        c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {

        av_log(NULL, AV_LOG_ERROR, "%s '%s' is experimental and might produce bad "

                "results.\nAdd '-strict experimental' if you want to use it.\n",

                codec_string, c->codec->name);

        codec = encoder ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);

        if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))

            av_log(NULL, AV_LOG_ERROR, "Or use the non experimental %s '%s'.\n",

                   codec_string, codec->name);

        ffmpeg_exit(1);

    }

}


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

     qdict = qdict_new();

+    qdict_put_obj(qdict, "num", QOBJECT(qint_from_int(0)));
+
+    qdict_put_obj(qdict, "str", QOBJECT(qstring_from_str("foo")));
+

     QDECREF(qdict);

START_TEST(qdict_destroy_simple_test)

{

    QDict *qdict;

    qdict = qdict_new();

    qdict_put_obj(qdict, "num", QOBJECT(qint_from_int(0)));

    qdict_put_obj(qdict, "str", QOBJECT(qstring_from_str("foo")));

    QDECREF(qdict);

}


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

+{
+
+    NFSClient *client = arg;
+

     aio_context_acquire(client->aio_context);

static void nfs_process_write(void *arg)

{

    NFSClient *client = arg;

    aio_context_acquire(client->aio_context);

    nfs_service(client->context, POLLOUT);

    nfs_set_events(client);

    aio_context_release(client->aio_context);

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     ret |= taihu_cpld_readb(opaque, addr + 1) << 16;

     ret |= taihu_cpld_readb(opaque, addr + 2) << 8;
+
+    ret |= taihu_cpld_readb(opaque, addr + 3);
+
+
+
     return ret;

 }

static uint32_t taihu_cpld_readl (void *opaque, hwaddr addr)

{

    uint32_t ret;

    ret = taihu_cpld_readb(opaque, addr) << 24;

    ret |= taihu_cpld_readb(opaque, addr + 1) << 16;

    ret |= taihu_cpld_readb(opaque, addr + 2) << 8;

    ret |= taihu_cpld_readb(opaque, addr + 3);

    return ret;

}


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

     PCIIORegion *r;

+    int i;
+
+    pcibus_t new_addr;
+
+

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

static void pci_update_mappings(PCIDevice *d)

{

    PCIIORegion *r;

    int i;

    pcibus_t new_addr;

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

        r = &d->io_regions[i];

        /* this region isn't registered */

        if (!r->size)

            continue;

        new_addr = pci_bar_address(d, i, r->type, r->size);

        /* This bar isn't changed */

        if (new_addr == r->addr)

            continue;

        /* now do the real mapping */

        if (r->addr != PCI_BAR_UNMAPPED) {

            trace_pci_update_mappings_del(d, pci_bus_num(d->bus),

                                          PCI_SLOT(d->devfn),

                                          PCI_FUNC(d->devfn),

                                          i, r->addr, r->size);

            memory_region_del_subregion(r->address_space, r->memory);

        }

        r->addr = new_addr;

        if (r->addr != PCI_BAR_UNMAPPED) {

            trace_pci_update_mappings_add(d, pci_bus_num(d->bus),

                                          PCI_SLOT(d->devfn),

                                          PCI_FUNC(d->devfn),

                                          i, r->addr, r->size);

            memory_region_add_subregion_overlap(r->address_space,

                                                r->addr, r->memory, 1);

        }

    }

    pci_update_vga(d);

}