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

     TAILQ_FOREACH(bp, &env->breakpoints, entry) {

+        if (bp->pc == pc && bp->flags == flags) {
+
+            cpu_breakpoint_remove_by_ref(env, bp);
+
+            return 0;

         }

int cpu_breakpoint_remove(CPUState *env, target_ulong pc, int flags)

{

#if defined(TARGET_HAS_ICE)

    CPUBreakpoint *bp;

    TAILQ_FOREACH(bp, &env->breakpoints, entry) {

        if (bp->pc == pc && bp->flags == flags) {

            cpu_breakpoint_remove_by_ref(env, bp);

            return 0;

        }

    }

    return -ENOENT;

#else

    return -ENOSYS;

#endif

}


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

     avc_biwgt_8width_msa(src, stride,
+
+                         dst, stride,
+
+                         height, log2_denom,

                          weight_src, weight_dst, offset);

void ff_biweight_h264_pixels8_8_msa(uint8_t *dst, uint8_t *src,

                                    int stride, int height,

                                    int log2_denom, int weight_dst,

                                    int weight_src, int offset)

{

    avc_biwgt_8width_msa(src, stride,

                         dst, stride,

                         height, log2_denom,

                         weight_src, weight_dst, offset);

}


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

     visit_start_struct(data->ov, NULL, NULL, 0, &error_abort);

+    visit_type_null(data->ov, "a", &error_abort);
+
+    visit_check_struct(data->ov, &error_abort);
+
+    visit_end_struct(data->ov, NULL);

     arg = visitor_get(data);

static void test_visitor_out_null(TestOutputVisitorData *data,

                                  const void *unused)

{

    QObject *arg;

    QDict *qdict;

    QObject *nil;

    visit_start_struct(data->ov, NULL, NULL, 0, &error_abort);

    visit_type_null(data->ov, "a", &error_abort);

    visit_check_struct(data->ov, &error_abort);

    visit_end_struct(data->ov, NULL);

    arg = visitor_get(data);

    g_assert(qobject_type(arg) == QTYPE_QDICT);

    qdict = qobject_to_qdict(arg);

    g_assert_cmpint(qdict_size(qdict), ==, 1);

    nil = qdict_get(qdict, "a");

    g_assert(nil);

    g_assert(qobject_type(nil) == QTYPE_QNULL);

}


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

     pstrcpy(bs->backing_format, sizeof(bs->backing_format),

+            backing_hd->drv ? backing_hd->drv->format_name : "");
+
+
+
+    bdrv_op_block_all(backing_hd, bs->backing_blocker);

     /* Otherwise we won't be able to commit due to check in bdrv_commit */

void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd)

{

    if (backing_hd) {

        bdrv_ref(backing_hd);

    }

    if (bs->backing) {

        assert(bs->backing_blocker);

        bdrv_op_unblock_all(bs->backing->bs, bs->backing_blocker);

        bdrv_unref_child(bs, bs->backing);

    } else if (backing_hd) {

        error_setg(&bs->backing_blocker,

                   "node is used as backing hd of '%s'",

                   bdrv_get_device_or_node_name(bs));

    }

    if (!backing_hd) {

        error_free(bs->backing_blocker);

        bs->backing_blocker = NULL;

        bs->backing = NULL;

        goto out;

    }

    bs->backing = bdrv_attach_child(bs, backing_hd, &child_backing);

    bs->open_flags &= ~BDRV_O_NO_BACKING;

    pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_hd->filename);

    pstrcpy(bs->backing_format, sizeof(bs->backing_format),

            backing_hd->drv ? backing_hd->drv->format_name : "");

    bdrv_op_block_all(backing_hd, bs->backing_blocker);

    /* Otherwise we won't be able to commit due to check in bdrv_commit */

    bdrv_op_unblock(backing_hd, BLOCK_OP_TYPE_COMMIT_TARGET,

                    bs->backing_blocker);

out:

    bdrv_refresh_limits(bs, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,25 +1,25 @@
+static int inc_refcounts(BlockDriverState *bs,

                           uint16_t *refcount_table,

+                          int refcount_table_size,
+
                           int64_t offset, int64_t size)

 {

     BDRVQcowState *s = bs->opaque;
+
     int64_t start, last, cluster_offset;
+
     int k;

     int errors = 0;
+

     if (size <= 0)
+
         return 0;

static int inc_refcounts(BlockDriverState *bs,

                          uint16_t *refcount_table,

                          int refcount_table_size,

                          int64_t offset, int64_t size)

{

    BDRVQcowState *s = bs->opaque;

    int64_t start, last, cluster_offset;

    int k;

    int errors = 0;

    if (size <= 0)

        return 0;

    start = offset & ~(s->cluster_size - 1);

    last = (offset + size - 1) & ~(s->cluster_size - 1);

    for(cluster_offset = start; cluster_offset <= last;

        cluster_offset += s->cluster_size) {

        k = cluster_offset >> s->cluster_bits;

        if (k < 0 || k >= refcount_table_size) {

            fprintf(stderr, "ERROR: invalid cluster offset=0x%" PRIx64 "\n",

                cluster_offset);

            errors++;

        } else {

            if (++refcount_table[k] == 0) {

                fprintf(stderr, "ERROR: overflow cluster offset=0x%" PRIx64

                    "\n", cluster_offset);

                errors++;

            }

        }

    }

    return errors;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static uint64_t iack_read(void *opaque, target_phys_addr_t addr, unsigned size)

+{

     return pic_read_irq(isa_pic);

static uint64_t iack_read(void *opaque, target_phys_addr_t addr, unsigned size)

{

    return pic_read_irq(isa_pic);

}


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

     handle_user_command(mon, cmdline);

+    monitor_resume(mon);
+
 }

static void monitor_command_cb(Monitor *mon, const char *cmdline, void *opaque)

{

    monitor_suspend(mon);

    handle_user_command(mon, cmdline);

    monitor_resume(mon);

}


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

+    for (i = s->parent.requests; i; i = i->next) {
+
+        rng_egd_free_request(i->data);
+
+    }

static void rng_egd_free_requests(RngEgd *s)

{

    GSList *i;

    for (i = s->parent.requests; i; i = i->next) {

        rng_egd_free_request(i->data);

    }

    g_slist_free(s->parent.requests);

    s->parent.requests = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void process_incoming_migration_bh(void *opaque)
+{
+    Error *local_err = NULL;
+    MigrationIncomingState *mis = opaque;
+    /* Make sure all file formats flush their mutable metadata */
+    bdrv_invalidate_cache_all(&local_err);
         migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
                           MIGRATION_STATUS_FAILED);
         error_report_err(local_err);

static void process_incoming_migration_bh(void *opaque)
{
    Error *local_err = NULL;
    MigrationIncomingState *mis = opaque;
    /* Make sure all file formats flush their mutable metadata */
    bdrv_invalidate_cache_all(&local_err);
        migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
                          MIGRATION_STATUS_FAILED);
        error_report_err(local_err);
        migrate_decompress_threads_join();
        exit(EXIT_FAILURE);
    /*
     * This must happen after all error conditions are dealt with and
     * we're sure the VM is going to be running on this host.
     */
    qemu_announce_self();
    /* If global state section was not received or we are in running
       state, we need to obey autostart. Any other state is set with
       runstate_set. */
    if (!global_state_received() ||
        global_state_get_runstate() == RUN_STATE_RUNNING) {
        if (autostart) {
            vm_start();
        } else {
            runstate_set(RUN_STATE_PAUSED);
    } else {
        runstate_set(global_state_get_runstate());
    migrate_decompress_threads_join();
    /*
     * This must happen after any state changes since as soon as an external
     * observer sees this event they might start to prod at the VM assuming
     * it's ready to use.
     */
    migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
                      MIGRATION_STATUS_COMPLETED);
    qemu_bh_delete(mis->bh);
    migration_incoming_state_destroy();


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

 {

+    float32 f0 = make_float32(a);
+
+    float32 f1 = make_float32(b);

     return float32_val((float32_compare_quiet(f0, f1, NFS) == 1)

uint32_t HELPER(neon_abd_f32)(uint32_t a, uint32_t b)

{

    float32 f0 = make_float32(a);

    float32 f1 = make_float32(b);

    return float32_val((float32_compare_quiet(f0, f1, NFS) == 1)

                    ? float32_sub(f0, f1, NFS)

                    : float32_sub(f1, f0, NFS));

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void tcg_exec_init(unsigned long tb_size)

+{

     cpu_gen_init();
+
     code_gen_alloc(tb_size);

     page_init();

void tcg_exec_init(unsigned long tb_size)

{

    cpu_gen_init();

    code_gen_alloc(tb_size);

    page_init();

#if defined(CONFIG_SOFTMMU)

    /* There's no guest base to take into account, so go ahead and

       initialize the prologue now.  */

    tcg_prologue_init(&tcg_ctx);

#endif

}


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

     nvic_state *s = (nvic_state *)opaque;
+
+    uint32_t irq;
+
+
+
     irq = gic_acknowledge_irq(&s->gic, 0);

     if (irq == 1023)

int armv7m_nvic_acknowledge_irq(void *opaque)

{

    nvic_state *s = (nvic_state *)opaque;

    uint32_t irq;

    irq = gic_acknowledge_irq(&s->gic, 0);

    if (irq == 1023)

        hw_error("Interrupt but no vector\n");

    if (irq >= 32)

        irq -= 16;

    return irq;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){

     const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
+
     void *dst;

     if(!o || o->offset<=0)
@@ -17,7 +17,7 @@
         return NULL;

     }
+

     dst= ((uint8_t*)obj) + o->offset;

static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){

    const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);

    void *dst;

    if(!o || o->offset<=0)

        return NULL;

    if(o->max*den < num*intnum || o->min*den > num*intnum) {

        av_log(NULL, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);

        return NULL;

    }

    dst= ((uint8_t*)obj) + o->offset;

    switch(o->type){

    case FF_OPT_TYPE_FLAGS:

    case FF_OPT_TYPE_INT:   *(int       *)dst= llrint(num/den)*intnum; break;

    case FF_OPT_TYPE_INT64: *(int64_t   *)dst= llrint(num/den)*intnum; break;

    case FF_OPT_TYPE_FLOAT: *(float     *)dst= num*intnum/den;         break;

    case FF_OPT_TYPE_DOUBLE:*(double    *)dst= num*intnum/den;         break;

    case FF_OPT_TYPE_RATIONAL:

        if((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den};

        else                *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24);

        break;

    default:

        return NULL;

    }

    return o;

}


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

                                  int32_t dst_stride,

+                                 int32_t height,
+
+                                 int32_t log2_denom,
+
+                                 int32_t src_weight,

                                  int32_t dst_weight,

static void avc_biwgt_4width_msa(uint8_t *src,

                                 int32_t src_stride,

                                 uint8_t *dst,

                                 int32_t dst_stride,

                                 int32_t height,

                                 int32_t log2_denom,

                                 int32_t src_weight,

                                 int32_t dst_weight,

                                 int32_t offset_in)

{

    if (2 == height) {

        avc_biwgt_4x2_msa(src, src_stride, dst, dst_stride,

                          log2_denom, src_weight, dst_weight,

                          offset_in);

    } else {

        avc_biwgt_4x4multiple_msa(src, src_stride, dst, dst_stride,

                                  height, log2_denom, src_weight,

                                  dst_weight, offset_in);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void uhci_port_test(struct qhc *hc, int port, uint16_t expect)
+
+{

     void *addr = hc->base + 0x10 + 2 * port;

void uhci_port_test(struct qhc *hc, int port, uint16_t expect)

{

    void *addr = hc->base + 0x10 + 2 * port;

    uint16_t value = qpci_io_readw(hc->dev, addr);

    uint16_t mask = ~(UHCI_PORT_WRITE_CLEAR | UHCI_PORT_RSVD1);

    g_assert((value & mask) == (expect & mask));

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static uint16_t phys_section_add(MemoryRegionSection *section)
+{
     if (phys_sections_nb == phys_sections_nb_alloc) {
         phys_sections_nb_alloc = MAX(phys_sections_nb_alloc * 2, 16);
         phys_sections = g_renew(MemoryRegionSection, phys_sections,

static uint16_t phys_section_add(MemoryRegionSection *section)
{
    if (phys_sections_nb == phys_sections_nb_alloc) {
        phys_sections_nb_alloc = MAX(phys_sections_nb_alloc * 2, 16);
        phys_sections = g_renew(MemoryRegionSection, phys_sections,
                                phys_sections_nb_alloc);
    }
    phys_sections[phys_sections_nb] = *section;
    return phys_sections_nb++;
}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                         MemoryRegion *address_space, MemoryRegion *io)

 {
+
     s->scratch_size = SVGA_SCRATCH_SIZE;

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

static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s,

                        MemoryRegion *address_space, MemoryRegion *io)

{

    s->scratch_size = SVGA_SCRATCH_SIZE;

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

    s->vga.con = graphic_console_init(dev, 0, &vmsvga_ops, s);

    s->fifo_size = SVGA_FIFO_SIZE;

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

                           &error_abort);

    vmstate_register_ram_global(&s->fifo_ram);

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

    vga_common_init(&s->vga, OBJECT(dev), true);

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

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

    s->new_depth = 32;

}


--- a/source.c
+++ b/source.c
@@ -61,11 +61,11 @@
         if (vs->vd->cursor) {

             vnc_cursor_define(vs);
+
+        }
+
+        memset(vs->dirty, 0xFF, sizeof(vs->dirty));
+
     }

 }

static void vnc_dpy_resize(DisplayState *ds)

{

    int size_changed;

    VncDisplay *vd = ds->opaque;

    VncState *vs;

    /* server surface */

    if (!vd->server)

        vd->server = qemu_mallocz(sizeof(*vd->server));

    if (vd->server->data)

        qemu_free(vd->server->data);

    *(vd->server) = *(ds->surface);

    vd->server->data = qemu_mallocz(vd->server->linesize *

                                    vd->server->height);

    /* guest surface */

    if (!vd->guest.ds)

        vd->guest.ds = qemu_mallocz(sizeof(*vd->guest.ds));

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

        console_color_init(ds);

    size_changed = ds_get_width(ds) != vd->guest.ds->width ||

                   ds_get_height(ds) != vd->guest.ds->height;

    *(vd->guest.ds) = *(ds->surface);

    memset(vd->guest.dirty, 0xFF, sizeof(vd->guest.dirty));

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

        vnc_colordepth(vs);

        if (size_changed) {

            vnc_desktop_resize(vs);

        }

        if (vs->vd->cursor) {

            vnc_cursor_define(vs);

        }

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

    }

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
         render->info.mpeg.intra_quantizer_matrix[i]     = s->intra_matrix[i];
         render->info.mpeg.non_intra_quantizer_matrix[i] = s->inter_matrix[i];
     }
+    render->info.mpeg.forward_reference          = VDP_INVALID_HANDLE;
+    render->info.mpeg.backward_reference         = VDP_INVALID_HANDLE;
+    switch(s->pict_type){
+    case  FF_B_TYPE:
+        next = (struct vdpau_render_state *)s->next_picture.data[0];
         assert(next);
         render->info.mpeg.backward_reference     = next->surface;
         // no return here, going to set forward prediction

void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
                                    int buf_size, int slice_count)
{
    struct vdpau_render_state *render, *last, *next;
    int i;
    render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
    assert(render);
    /* fill VdpPictureInfoMPEG1Or2 struct */
    render->info.mpeg.picture_structure          = s->picture_structure;
    render->info.mpeg.picture_coding_type        = s->pict_type;
    render->info.mpeg.intra_dc_precision         = s->intra_dc_precision;
    render->info.mpeg.frame_pred_frame_dct       = s->frame_pred_frame_dct;
    render->info.mpeg.concealment_motion_vectors = s->concealment_motion_vectors;
    render->info.mpeg.intra_vlc_format           = s->intra_vlc_format;
    render->info.mpeg.alternate_scan             = s->alternate_scan;
    render->info.mpeg.q_scale_type               = s->q_scale_type;
    render->info.mpeg.top_field_first            = s->top_field_first;
    render->info.mpeg.full_pel_forward_vector    = s->full_pel[0]; // MPEG-1 only.  Set 0 for MPEG-2
    render->info.mpeg.full_pel_backward_vector   = s->full_pel[1]; // MPEG-1 only.  Set 0 for MPEG-2
    render->info.mpeg.f_code[0][0]               = s->mpeg_f_code[0][0]; // For MPEG-1 fill both horiz. & vert.
    render->info.mpeg.f_code[0][1]               = s->mpeg_f_code[0][1];
    render->info.mpeg.f_code[1][0]               = s->mpeg_f_code[1][0];
    render->info.mpeg.f_code[1][1]               = s->mpeg_f_code[1][1];
    for (i = 0; i < 64; ++i) {
        render->info.mpeg.intra_quantizer_matrix[i]     = s->intra_matrix[i];
        render->info.mpeg.non_intra_quantizer_matrix[i] = s->inter_matrix[i];
    }
    render->info.mpeg.forward_reference          = VDP_INVALID_HANDLE;
    render->info.mpeg.backward_reference         = VDP_INVALID_HANDLE;
    switch(s->pict_type){
    case  FF_B_TYPE:
        next = (struct vdpau_render_state *)s->next_picture.data[0];
        assert(next);
        render->info.mpeg.backward_reference     = next->surface;
        // no return here, going to set forward prediction
    case  FF_P_TYPE:
        last = (struct vdpau_render_state *)s->last_picture.data[0];
        if (!last) // FIXME: Does this test make sense?
            last = render; // predict second field from the first
        render->info.mpeg.forward_reference      = last->surface;
    }
    ff_vdpau_add_data_chunk(s, buf, buf_size);
    render->info.mpeg.slice_count                = slice_count;
    if (slice_count)
        ff_draw_horiz_band(s, 0, s->avctx->height);
    render->bitstream_buffers_used               = 0;
}


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

     s->con = graphic_console_init(ssd0303_update_display,

+                                  ssd0303_invalidate_display,
+
+                                  NULL, NULL, s);
+
     qemu_console_resize(s->con, 96 * MAGNIFY, 16 * MAGNIFY);

     return 0;

static int ssd0303_init(I2CSlave *i2c)

{

    ssd0303_state *s = FROM_I2C_SLAVE(ssd0303_state, i2c);

    s->con = graphic_console_init(ssd0303_update_display,

                                  ssd0303_invalidate_display,

                                  NULL, NULL, s);

    qemu_console_resize(s->con, 96 * MAGNIFY, 16 * MAGNIFY);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,19 +1,19 @@
 int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,

+                          int first_header_size, uint8_t *header_start[3],

                           int header_len[3])

 {

     int i, j;
+

+    if (AV_RB16(extradata) == first_header_size) {

         for (i=0; i<3; i++) {
+
             header_len[i] = AV_RB16(extradata);

             extradata += 2;

int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,

                          int first_header_size, uint8_t *header_start[3],

                          int header_len[3])

{

    int i, j;

    if (AV_RB16(extradata) == first_header_size) {

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

            header_len[i] = AV_RB16(extradata);

            extradata += 2;

            header_start[i] = extradata;

            extradata += header_len[i];

        }

    } else if (extradata[0] == 2) {

        for (i=0,j=1; i<2; i++,j++) {

            header_len[i] = 0;

            for (; j<extradata_size && extradata[j]==0xff; j++) {

                header_len[i] += 0xff;

            }

            if (j >= extradata_size)

                return -1;

            header_len[i] += extradata[j];

        }

        header_len[2] = extradata_size - header_len[0] - header_len[1] - j;

        extradata += j;

        header_start[0] = extradata;

        header_start[1] = header_start[0] + header_len[0];

        header_start[2] = header_start[1] + header_len[1];

    } else {

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static double tget_double(const uint8_t **p, int le)
+
+{

     av_alias64 i = { .u64 = le ? AV_RL64(*p) : AV_RB64(*p)};

static double tget_double(const uint8_t **p, int le)

{

    av_alias64 i = { .u64 = le ? AV_RL64(*p) : AV_RB64(*p)};

    *p += 8;

    return i.f64;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void qemu_peer_using_vnet_hdr(NetClientState *nc, bool enable)

 {
+
+    if (!nc->peer || !nc->peer->info->using_vnet_hdr) {
+
         return;

     }

void qemu_peer_using_vnet_hdr(NetClientState *nc, bool enable)

{

    if (!nc->peer || !nc->peer->info->using_vnet_hdr) {

        return;

    }

    nc->peer->info->using_vnet_hdr(nc->peer, enable);

}


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

     val = qemu_opt_get_size(opts, "size", 0);

+    if (val != 0) {
+
+        ringbuf->has_size = true;
+
+        ringbuf->size = val;

     }

static void qemu_chr_parse_ringbuf(QemuOpts *opts, ChardevBackend *backend,

                                   Error **errp)

{

    int val;

    ChardevRingbuf *ringbuf;

    ringbuf = backend->u.ringbuf = g_new0(ChardevRingbuf, 1);

    qemu_chr_parse_common(opts, qapi_ChardevRingbuf_base(ringbuf));

    val = qemu_opt_get_size(opts, "size", 0);

    if (val != 0) {

        ringbuf->has_size = true;

        ringbuf->size = val;

    }

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
         g_source_remove(s->listen_tag);

         s->listen_tag = 0;
+
+    }
+
+    tcp_chr_connect(chr);
+

     return 0;

static int tcp_chr_new_client(CharDriverState *chr, QIOChannelSocket *sioc)

{

    TCPCharDriver *s = chr->opaque;

    if (s->ioc != NULL) {

	return -1;

    }

    s->ioc = QIO_CHANNEL(sioc);

    object_ref(OBJECT(sioc));

    if (s->do_nodelay) {

        qio_channel_set_delay(s->ioc, false);

    }

    if (s->listen_tag) {

        g_source_remove(s->listen_tag);

        s->listen_tag = 0;

    }

    tcp_chr_connect(chr);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void kqemu_flush(CPUState *env, int global)
+
+{

     LOG_INT("kqemu_flush:\n");

void kqemu_flush(CPUState *env, int global)

{

    LOG_INT("kqemu_flush:\n");

    nb_pages_to_flush = KQEMU_FLUSH_ALL;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void kqemu_record_pc(unsigned long pc)
+
+{
+
+    unsigned long h;
+
     PCRecord **pr, *r;

static void kqemu_record_pc(unsigned long pc)

{

    unsigned long h;

    PCRecord **pr, *r;

    h = pc / PC_REC_SIZE;

    h = h ^ (h >> PC_REC_HASH_BITS);

    h &= (PC_REC_HASH_SIZE - 1);

    pr = &pc_rec_hash[h];

    for(;;) {

        r = *pr;

        if (r == NULL)

            break;

        if (r->pc == pc) {

            r->count++;

            return;

        }

        pr = &r->next;

    }

    r = malloc(sizeof(PCRecord));

    r->count = 1;

    r->pc = pc;

    r->next = NULL;

    *pr = r;

    nb_pc_records++;

}


--- a/source.c
+++ b/source.c
@@ -3,20 +3,20 @@
     static int done = 0;

+
     if (!done) {
+
         int i;

+        done = 1;

+
         init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5,

+                 &chroma_dc_coeff_token_len [0], 1, 1,

+                 &chroma_dc_coeff_token_bits[0], 1, 1, 1);

static av_cold void decode_init_vlc(void){

    static int done = 0;

    if (!done) {

        int i;

        done = 1;

        init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5,

                 &chroma_dc_coeff_token_len [0], 1, 1,

                 &chroma_dc_coeff_token_bits[0], 1, 1, 1);

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

            init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17,

                     &coeff_token_len [i][0], 1, 1,

                     &coeff_token_bits[i][0], 1, 1, 1);

        }

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

            init_vlc(&chroma_dc_total_zeros_vlc[i], CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 4,

                     &chroma_dc_total_zeros_len [i][0], 1, 1,

                     &chroma_dc_total_zeros_bits[i][0], 1, 1, 1);

        }

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

            init_vlc(&total_zeros_vlc[i], TOTAL_ZEROS_VLC_BITS, 16,

                     &total_zeros_len [i][0], 1, 1,

                     &total_zeros_bits[i][0], 1, 1, 1);

        }

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

            init_vlc(&run_vlc[i], RUN_VLC_BITS, 7,

                     &run_len [i][0], 1, 1,

                     &run_bits[i][0], 1, 1, 1);

        }

        init_vlc(&run7_vlc, RUN7_VLC_BITS, 16,

                 &run_len [6][0], 1, 1,

                 &run_bits[6][0], 1, 1, 1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void test_parse_path_subprocess(void)
+
+{
+
     /* All these should work without issue */

     qemu_set_log_filename("/tmp/qemu.log");

static void test_parse_path_subprocess(void)

{

    /* All these should work without issue */

    qemu_set_log_filename("/tmp/qemu.log");

    qemu_set_log_filename("/tmp/qemu-%d.log");

    qemu_set_log_filename("/tmp/qemu.log.%d");

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     assert(cpu->as == as);

+
+    if (cpu->cpu_ases) {
+
+        /* We've already registered the listener for our only AS */
+
         return;

     }

void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as)

{

    /* We only support one address space per cpu at the moment.  */

    assert(cpu->as == as);

    if (cpu->cpu_ases) {

        /* We've already registered the listener for our only AS */

        return;

    }

    cpu->cpu_ases = g_new0(CPUAddressSpace, 1);

    cpu->cpu_ases[0].cpu = cpu;

    cpu->cpu_ases[0].as = as;

    cpu->cpu_ases[0].tcg_as_listener.commit = tcg_commit;

    memory_listener_register(&cpu->cpu_ases[0].tcg_as_listener, as);

}


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

     thread_count = migrate_compress_threads();
+
+    quit_comp_thread = true;
+
+    for (idx = 0; idx < thread_count; idx++) {
+
         qemu_mutex_lock(&comp_param[idx].mutex);

         qemu_cond_signal(&comp_param[idx].cond);

static inline void terminate_compression_threads(void)

{

    int idx, thread_count;

    thread_count = migrate_compress_threads();

    quit_comp_thread = true;

    for (idx = 0; idx < thread_count; idx++) {

        qemu_mutex_lock(&comp_param[idx].mutex);

        qemu_cond_signal(&comp_param[idx].cond);

        qemu_mutex_unlock(&comp_param[idx].mutex);

    }

}


--- a/source.c
+++ b/source.c
@@ -14,11 +14,11 @@
     freq = req->freq;
     nchannels = req->nchannels;
     fmt = req->fmt;
+    if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &fmt)) {
+        oss_logerr2 (errno, typ, "Failed to set sample size %d\n", req->fmt);
+    if (ioctl (fd, SNDCTL_DSP_CHANNELS, &nchannels)) {
+        oss_logerr2 (errno, typ, "Failed to set number of channels %d\n",
+                     req->nchannels);
     if (ioctl (fd, SNDCTL_DSP_SPEED, &freq)) {
         oss_logerr2 (errno, typ, "Failed to set frequency %d\n", req->freq);
     if (ioctl (fd, SNDCTL_DSP_NONBLOCK)) {

static int oss_open (int in, struct oss_params *req,
                     struct oss_params *obt, int *pfd)
{
    int fd;
    int mmmmssss;
    audio_buf_info abinfo;
    int fmt, freq, nchannels;
    const char *dspname = in ? conf.devpath_in : conf.devpath_out;
    const char *typ = in ? "ADC" : "DAC";
    fd = open (dspname, (in ? O_RDONLY : O_WRONLY) | O_NONBLOCK);
    if (-1 == fd) {
        oss_logerr2 (errno, typ, "Failed to open `%s'\n", dspname);
        return -1;
    freq = req->freq;
    nchannels = req->nchannels;
    fmt = req->fmt;
    if (ioctl (fd, SNDCTL_DSP_SAMPLESIZE, &fmt)) {
        oss_logerr2 (errno, typ, "Failed to set sample size %d\n", req->fmt);
    if (ioctl (fd, SNDCTL_DSP_CHANNELS, &nchannels)) {
        oss_logerr2 (errno, typ, "Failed to set number of channels %d\n",
                     req->nchannels);
    if (ioctl (fd, SNDCTL_DSP_SPEED, &freq)) {
        oss_logerr2 (errno, typ, "Failed to set frequency %d\n", req->freq);
    if (ioctl (fd, SNDCTL_DSP_NONBLOCK)) {
        oss_logerr2 (errno, typ, "Failed to set non-blocking mode\n");
    mmmmssss = (req->nfrags << 16) | lsbindex (req->fragsize);
    if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
        oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",
                     req->nfrags, req->fragsize);
    if (ioctl (fd, in ? SNDCTL_DSP_GETISPACE : SNDCTL_DSP_GETOSPACE, &abinfo)) {
        oss_logerr2 (errno, typ, "Failed to get buffer length\n");
    obt->fmt = fmt;
    obt->nchannels = nchannels;
    obt->freq = freq;
    obt->nfrags = abinfo.fragstotal;
    obt->fragsize = abinfo.fragsize;
    *pfd = fd;
#ifdef DEBUG_MISMATCHES
    if ((req->fmt != obt->fmt) ||
        (req->nchannels != obt->nchannels) ||
        (req->freq != obt->freq) ||
        (req->fragsize != obt->fragsize) ||
        (req->nfrags != obt->nfrags)) {
        dolog ("Audio parameters mismatch\n");
        oss_dump_info (req, obt);
#endif
#ifdef DEBUG
    oss_dump_info (req, obt);
#endif
    return 0;
 err:
    oss_anal_close (&fd);
    return -1;


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void object_property_set_qobject(Object *obj, QObject *value,

+                                 const char *name, Error **errp)

 {

void object_property_set_qobject(Object *obj, QObject *value,

                                 const char *name, Error **errp)

{

    Visitor *v;

    /* TODO: Should we reject, rather than ignore, excess input? */

    v = qobject_input_visitor_new(value, false);

    object_property_set(obj, v, name, errp);

    visit_free(v);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void spapr_vio_quiesce_one(VIOsPAPRDevice *dev)
+
+{
+
+    dev->flags &= ~VIO_PAPR_FLAG_DMA_BYPASS;

static void spapr_vio_quiesce_one(VIOsPAPRDevice *dev)

{

    dev->flags &= ~VIO_PAPR_FLAG_DMA_BYPASS;

    if (dev->rtce_table) {

        size_t size = (dev->rtce_window_size >> SPAPR_VIO_TCE_PAGE_SHIFT)

            * sizeof(VIOsPAPR_RTCE);

        memset(dev->rtce_table, 0, size);

    }

    dev->crq.qladdr = 0;

    dev->crq.qsize = 0;

    dev->crq.qnext = 0;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     opts_do_parse(opts, params, firstname, false, &err);

     if (err) {
+
+        qerror_report_err(err);
+
+        error_free(err);
+
         return -1;

     }

int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname)

{

    Error *err = NULL;

    opts_do_parse(opts, params, firstname, false, &err);

    if (err) {

        qerror_report_err(err);

        error_free(err);

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 static void gen_rac(DisasContext *ctx)
+
+{
+
+#if defined(CONFIG_USER_ONLY)

     gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

 #else

     TCGv t0;
+
     if (unlikely(ctx->pr)) {

         gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

static void gen_rac(DisasContext *ctx)

{

#if defined(CONFIG_USER_ONLY)

    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

#else

    TCGv t0;

    if (unlikely(ctx->pr)) {

        gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

        return;

    }

    t0 = tcg_temp_new();

    gen_addr_reg_index(ctx, t0);

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

    tcg_temp_free(t0);

#endif

}


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

+    phys_ram_dirty = qemu_realloc(phys_ram_dirty,
+
+        (last_ram_offset + size) >> TARGET_PAGE_BITS);
+
+    memset(phys_ram_dirty + (last_ram_offset >> TARGET_PAGE_BITS),

            0xff, size >> TARGET_PAGE_BITS);

ram_addr_t qemu_ram_alloc(ram_addr_t size)

{

    RAMBlock *new_block;

#ifdef CONFIG_KQEMU

    if (kqemu_phys_ram_base) {

        return kqemu_ram_alloc(size);

    }

#endif

    size = TARGET_PAGE_ALIGN(size);

    new_block = qemu_malloc(sizeof(*new_block));

    new_block->host = qemu_vmalloc(size);

    new_block->offset = last_ram_offset;

    new_block->length = size;

    new_block->next = ram_blocks;

    ram_blocks = new_block;

    phys_ram_dirty = qemu_realloc(phys_ram_dirty,

        (last_ram_offset + size) >> TARGET_PAGE_BITS);

    memset(phys_ram_dirty + (last_ram_offset >> TARGET_PAGE_BITS),

           0xff, size >> TARGET_PAGE_BITS);

    last_ram_offset += size;

    if (kvm_enabled())

        kvm_setup_guest_memory(new_block->host, size);

    return new_block->offset;

}


static inline void patch_reloc(tcg_insn_unit *code_ptr, int type,

                               intptr_t value, intptr_t addend)

{

    assert(addend == 0);

    switch (type) {

    case R_AARCH64_JUMP26:

    case R_AARCH64_CALL26:

        reloc_pc26(code_ptr, (tcg_insn_unit *)value);

        break;

    case R_AARCH64_CONDBR19:

        reloc_pc19(code_ptr, (tcg_insn_unit *)value);

        break;

    default:

        tcg_abort();

    }

}


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

 {

+    struct bt_l2cap_sdp_state_s *sdp = opaque;

     int i;

static void bt_l2cap_sdp_close_ch(void *opaque)

{

    struct bt_l2cap_sdp_state_s *sdp = opaque;

    int i;

    for (i = 0; i < sdp->services; i ++) {

        g_free(sdp->service_list[i].attribute_list->pair);

        g_free(sdp->service_list[i].attribute_list);

        g_free(sdp->service_list[i].uuid);

    }

    g_free(sdp->service_list);

    g_free(sdp);

}


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

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

+    int ret;

static int config_output(AVFilterLink *outlink)

{

    AVFilterContext *ctx = outlink->src;

    LIBVMAFContext *s = ctx->priv;

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

    int ret;

    outlink->w = mainlink->w;

    outlink->h = mainlink->h;

    outlink->time_base = mainlink->time_base;

    outlink->sample_aspect_ratio = mainlink->sample_aspect_ratio;

    outlink->frame_rate = mainlink->frame_rate;

    if ((ret = ff_dualinput_init(ctx, &s->dinput)) < 0)

        return ret;

    return 0;

}


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

     put_v(bc, nut->written_packet_size); /* forward ptr */

+
+
+    return 0;
+
+}

static int put_packetheader(NUTContext *nut, ByteIOContext *bc, int max_size, int calculate_checksum)

{

    put_flush_packet(bc);

    nut->packet_start[2]= url_ftell(bc) - 8;

    nut->written_packet_size = max_size;

    if(calculate_checksum)

        init_checksum(bc, update_adler32, 0);

    /* packet header */

    put_v(bc, nut->written_packet_size); /* forward ptr */

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void qvirtio_9p_pci_stop(QVirtIO9P *v9p)

 {
+
     qvirtqueue_cleanup(v9p->dev->bus, v9p->vq, v9p->qs->alloc);

     qvirtio_pci_device_disable(container_of(v9p->dev, QVirtioPCIDevice, vdev));

static void qvirtio_9p_pci_stop(QVirtIO9P *v9p)

{

    qvirtqueue_cleanup(v9p->dev->bus, v9p->vq, v9p->qs->alloc);

    qvirtio_pci_device_disable(container_of(v9p->dev, QVirtioPCIDevice, vdev));

    g_free(v9p->dev);

    qvirtio_9p_stop(v9p);

}


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

                                          buffer_release, &qsv->surface_used[i], 0);

+        if (!frame->buf[0])
+
+            return AVERROR(ENOMEM);
+
+        frame->data[3]       = (uint8_t*)qsv->surface_ptrs[i];

         qsv->surface_used[i] = 1;

static int qsv_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)

{

    InputStream *ist = s->opaque;

    QSVContext  *qsv = ist->hwaccel_ctx;

    int i;

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

        if (qsv->surface_used[i])

            continue;

        frame->buf[0] = av_buffer_create((uint8_t*)qsv->surface_ptrs[i], sizeof(*qsv->surface_ptrs[i]),

                                         buffer_release, &qsv->surface_used[i], 0);

        if (!frame->buf[0])

            return AVERROR(ENOMEM);

        frame->data[3]       = (uint8_t*)qsv->surface_ptrs[i];

        qsv->surface_used[i] = 1;

        return 0;

    }

    return AVERROR(ENOMEM);

}


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

     LIST_INIT(&blkdev->finished);

+    LIST_INIT(&blkdev->freelist);
+
+    blkdev->bh = qemu_bh_new(blk_bh, blkdev);
+
+    if (xen_mode != XEN_EMULATE)

         batch_maps = 1;

static void blk_alloc(struct XenDevice *xendev)

{

    struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);

    LIST_INIT(&blkdev->inflight);

    LIST_INIT(&blkdev->finished);

    LIST_INIT(&blkdev->freelist);

    blkdev->bh = qemu_bh_new(blk_bh, blkdev);

    if (xen_mode != XEN_EMULATE)

        batch_maps = 1;

}


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

     bool *v = pv;

+    qemu_put_byte(f, *v);
+
 }

static void put_bool(QEMUFile *f, void *pv, size_t size)

{

    bool *v = pv;

    qemu_put_byte(f, *v);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static struct omap_uwire_s *omap_uwire_init(MemoryRegion *system_memory,
+
                                             hwaddr base,

                                             qemu_irq txirq, qemu_irq rxirq,

static struct omap_uwire_s *omap_uwire_init(MemoryRegion *system_memory,

                                            hwaddr base,

                                            qemu_irq txirq, qemu_irq rxirq,

                                            qemu_irq dma,

                                            omap_clk clk)

{

    struct omap_uwire_s *s = (struct omap_uwire_s *)

            g_malloc0(sizeof(struct omap_uwire_s));

    s->txirq = txirq;

    s->rxirq = rxirq;

    s->txdrq = dma;

    omap_uwire_reset(s);

    memory_region_init_io(&s->iomem, NULL, &omap_uwire_ops, s, "omap-uwire", 0x800);

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

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void kvm_reset_vcpu(void *opaque)
+
 {
+
+    CPUState *env = opaque;
+

     kvm_arch_reset_vcpu(env);

static void kvm_reset_vcpu(void *opaque)

{

    CPUState *env = opaque;

    kvm_arch_reset_vcpu(env);

    if (kvm_arch_put_registers(env)) {

        fprintf(stderr, "Fatal: kvm vcpu reset failed\n");

        abort();

    }

}


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

         return drv->bdrv_get_specific_info(bs);

+    }
+
+    return NULL;

 }

ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs)

{

    BlockDriver *drv = bs->drv;

    if (drv && drv->bdrv_get_specific_info) {

        return drv->bdrv_get_specific_info(bs);

    }

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static int local_create_mapped_attr_dir(FsContext *ctx, const char *path)

 {
+
     int err;

     char attr_dir[PATH_MAX];

     char *tmp_path = strdup(path);
+

     snprintf(attr_dir, PATH_MAX, "%s/%s/%s",

static int local_create_mapped_attr_dir(FsContext *ctx, const char *path)

{

    int err;

    char attr_dir[PATH_MAX];

    char *tmp_path = strdup(path);

    snprintf(attr_dir, PATH_MAX, "%s/%s/%s",

             ctx->fs_root, dirname(tmp_path), VIRTFS_META_DIR);

    err = mkdir(attr_dir, 0700);

    if (err < 0 && errno == EEXIST) {

        err = 0;

    }

    free(tmp_path);

    return err;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int buffered_rate_limit(void *opaque)

 {
+
+    QEMUFileBuffered *s = opaque;
+
+    int ret;
+

     ret = qemu_file_get_error(s->file);

static int buffered_rate_limit(void *opaque)

{

    QEMUFileBuffered *s = opaque;

    int ret;

    ret = qemu_file_get_error(s->file);

    if (ret) {

        return ret;

    }

    if (s->bytes_xfer > s->xfer_limit)

        return 1;

    return 0;

}


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

 {

+    unsigned v = le ? bytestream2_get_le16u(gb) : bytestream2_get_be16u(gb);
+
     return v;

 }

static unsigned tget_short(GetByteContext *gb, int le)

{

    unsigned v = le ? bytestream2_get_le16u(gb) : bytestream2_get_be16u(gb);

    return v;

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
         replay_put_byte(checkpoint);

         replay_put_byte(event->event_kind);
+

         /* save event-specific data */

static void replay_save_event(Event *event, int checkpoint)

{

    if (replay_mode != REPLAY_MODE_PLAY) {

        /* put the event into the file */

        replay_put_event(EVENT_ASYNC);

        replay_put_byte(checkpoint);

        replay_put_byte(event->event_kind);

        /* save event-specific data */

        switch (event->event_kind) {

        case REPLAY_ASYNC_EVENT_BH:

            replay_put_qword(event->id);

            break;

        case REPLAY_ASYNC_EVENT_INPUT:

            replay_save_input_event(event->opaque);

            break;

        case REPLAY_ASYNC_EVENT_INPUT_SYNC:

            break;

        case REPLAY_ASYNC_EVENT_CHAR_READ:

            replay_event_char_read_save(event->opaque);

            break;

        default:

            error_report("Unknown ID %d of replay event", read_event_kind);

            exit(1);

        }

    }

}


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

     } else if (desc->full && (dev->port->speedmask & USB_SPEED_MASK_FULL)) {

+        dev->speed = USB_SPEED_FULL;
+
+    } else {
+
+        return;

     }

void usb_desc_attach(USBDevice *dev)

{

    const USBDesc *desc = usb_device_get_usb_desc(dev);

    assert(desc != NULL);

    if (desc->super && (dev->port->speedmask & USB_SPEED_MASK_SUPER)) {

        dev->speed = USB_SPEED_SUPER;

    } else if (desc->high && (dev->port->speedmask & USB_SPEED_MASK_HIGH)) {

        dev->speed = USB_SPEED_HIGH;

    } else if (desc->full && (dev->port->speedmask & USB_SPEED_MASK_FULL)) {

        dev->speed = USB_SPEED_FULL;

    } else {

        return;

    }

    usb_desc_setdefaults(dev);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int find_pte64 (mmu_ctx_t *ctx, int h, int rw)

 {
+
     return _find_pte(ctx, 1, h, rw);

 }

static int find_pte64 (mmu_ctx_t *ctx, int h, int rw)

{

    return _find_pte(ctx, 1, h, rw);

}


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

+    SMBIOS_TABLE_SET_STR(1, manufacturer_str, type1.manufacturer);
+
+    SMBIOS_TABLE_SET_STR(1, product_name_str, type1.product);
+
+    SMBIOS_TABLE_SET_STR(1, version_str, type1.version);

     SMBIOS_TABLE_SET_STR(1, serial_number_str, type1.serial);

static void smbios_build_type_1_table(void)

{

    SMBIOS_BUILD_TABLE_PRE(1, 0x100, true); /* required */

    SMBIOS_TABLE_SET_STR(1, manufacturer_str, type1.manufacturer);

    SMBIOS_TABLE_SET_STR(1, product_name_str, type1.product);

    SMBIOS_TABLE_SET_STR(1, version_str, type1.version);

    SMBIOS_TABLE_SET_STR(1, serial_number_str, type1.serial);

    if (qemu_uuid_set) {

        smbios_encode_uuid(&t->uuid, qemu_uuid);

    } else {

        memset(&t->uuid, 0, 16);

    }

    t->wake_up_type = 0x06; /* power switch */

    SMBIOS_TABLE_SET_STR(1, sku_number_str, type1.sku);

    SMBIOS_TABLE_SET_STR(1, family_str, type1.family);

    SMBIOS_BUILD_TABLE_POST;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int print_uint8(DeviceState *dev, Property *prop, char *dest, size_t len)
+
+{

     uint8_t *ptr = qdev_get_prop_ptr(dev, prop);

static int print_uint8(DeviceState *dev, Property *prop, char *dest, size_t len)

{

    uint8_t *ptr = qdev_get_prop_ptr(dev, prop);

    return snprintf(dest, len, "%" PRIu8, *ptr);

}


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

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

     int err;

static void test_qemu_strtoull_whitespace(void)

{

    const char *str = "  \t  ";

    char f = 'X';

    const char *endptr = &f;

    uint64_t res = 999;

    int err;

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

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 0);

    g_assert(endptr == str);

}


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

     if (dev->parent_bus != NULL) {
+
+        bus_remove_child(dev->parent_bus, dev);
+
     }

 }

static void device_unparent(Object *obj)

{

    DeviceState *dev = DEVICE(obj);

    if (dev->parent_bus != NULL) {

        bus_remove_child(dev->parent_bus, dev);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,30 +1,30 @@
+static void test_qga_set_time(gconstpointer fix)
+
+{
+
+    const TestFixture *fixture = fix;
+
+    QDict *ret;
+
+    int64_t current, time;
+
+    gchar *cmd;
+
+

     /* get current time */

     ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-time'}");

     g_assert_nonnull(ret);
+
+    qmp_assert_no_error(ret);

+    current = qdict_get_int(ret, "return");
+
+    g_assert_cmpint(current, >, 0);
+
+    QDECREF(ret);

static void test_qga_set_time(gconstpointer fix)

{

    const TestFixture *fixture = fix;

    QDict *ret;

    int64_t current, time;

    gchar *cmd;

    /* get current time */

    ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-time'}");

    g_assert_nonnull(ret);

    qmp_assert_no_error(ret);

    current = qdict_get_int(ret, "return");

    g_assert_cmpint(current, >, 0);

    QDECREF(ret);

    /* set some old time */

    ret = qmp_fd(fixture->fd, "{'execute': 'guest-set-time',"

                 " 'arguments': { 'time': 1000 } }");

    g_assert_nonnull(ret);

    qmp_assert_no_error(ret);

    QDECREF(ret);

    /* check old time */

    ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-time'}");

    g_assert_nonnull(ret);

    qmp_assert_no_error(ret);

    time = qdict_get_int(ret, "return");

    g_assert_cmpint(time / 1000, <, G_USEC_PER_SEC * 10);

    QDECREF(ret);

    /* set back current time */

    cmd = g_strdup_printf("{'execute': 'guest-set-time',"

                          " 'arguments': { 'time': %" PRId64 " } }",

                          current + time * 1000);

    ret = qmp_fd(fixture->fd, cmd);

    g_free(cmd);

    g_assert_nonnull(ret);

    qmp_assert_no_error(ret);

    QDECREF(ret);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static unsigned tget_long(const uint8_t **p, int le)

 {
+
+    unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);

     *p += 4;

static unsigned tget_long(const uint8_t **p, int le)

{

    unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);

    *p += 4;

    return v;

}


bool address_space_access_valid(AddressSpace *as, hwaddr addr, int len, bool is_write)

{

    MemoryRegion *mr;

    hwaddr l, xlat;

    rcu_read_lock();

    while (len > 0) {

        l = len;

        mr = address_space_translate(as, addr, &xlat, &l, is_write);

        if (!memory_access_is_direct(mr, is_write)) {

            l = memory_access_size(mr, l, addr);

            if (!memory_region_access_valid(mr, xlat, l, is_write)) {

                return false;

            }

        }

        len -= l;

        addr += l;

    }

    return true;

}


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

     object_property_set_link(OBJECT(hotplug_dev), OBJECT(cs), name,

+                             errp);
+
+    g_free(name);
+
+}

static void s390_cpu_plug(HotplugHandler *hotplug_dev,

                        DeviceState *dev, Error **errp)

{

    gchar *name;

    S390CPU *cpu = S390_CPU(dev);

    CPUState *cs = CPU(dev);

    name = g_strdup_printf("cpu[%i]", cpu->env.cpu_num);

    object_property_set_link(OBJECT(hotplug_dev), OBJECT(cs), name,

                             errp);

    g_free(name);

}


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

                                 ptrdiff_t stride)

+{
+
     avc_luma_midh_qrt_8w_msa(src - (2 * stride) - 2, stride, dst, stride, 8, 0);

 }

void ff_put_h264_qpel8_mc12_msa(uint8_t *dst, const uint8_t *src,

                                ptrdiff_t stride)

{

    avc_luma_midh_qrt_8w_msa(src - (2 * stride) - 2, stride, dst, stride, 8, 0);

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
         av_buffer_unref(&pic->motion_val_buf[i]);

         av_buffer_unref(&pic->ref_index_buf[i]);
+
+    }
+
+
+
     memset((uint8_t*)pic + off, 0, sizeof(*pic) - off);

 }

static void unref_picture(H264Context *h, Picture *pic)

{

    int off = offsetof(Picture, tf) + sizeof(pic->tf);

    int i;

    if (!pic->f.data[0])

        return;

    ff_thread_release_buffer(h->avctx, &pic->tf);

    av_buffer_unref(&pic->hwaccel_priv_buf);

    av_buffer_unref(&pic->qscale_table_buf);

    av_buffer_unref(&pic->mb_type_buf);

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

        av_buffer_unref(&pic->motion_val_buf[i]);

        av_buffer_unref(&pic->ref_index_buf[i]);

    }

    memset((uint8_t*)pic + off, 0, sizeof(*pic) - off);

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     int32_t fid, err = 0;
     V9fsPDU *pdu = opaque;
     V9fsState *s = pdu->s;
+    glock = g_malloc(sizeof(*glock));
+    pdu_unmarshal(pdu, offset, "dbqqds", &fid, &glock->type,
+                  &glock->start, &glock->length, &glock->proc_id,
+                  &glock->client_id);
+    trace_v9fs_getlock(pdu->tag, pdu->id, fid,
                        glock->type, glock->start, glock->length);
     fidp = get_fid(pdu, fid);
     if (fidp == NULL) {

static void v9fs_getlock(void *opaque)
{
    size_t offset = 7;
    struct stat stbuf;
    V9fsFidState *fidp;
    V9fsGetlock *glock;
    int32_t fid, err = 0;
    V9fsPDU *pdu = opaque;
    V9fsState *s = pdu->s;
    glock = g_malloc(sizeof(*glock));
    pdu_unmarshal(pdu, offset, "dbqqds", &fid, &glock->type,
                  &glock->start, &glock->length, &glock->proc_id,
                  &glock->client_id);
    trace_v9fs_getlock(pdu->tag, pdu->id, fid,
                       glock->type, glock->start, glock->length);
    fidp = get_fid(pdu, fid);
    if (fidp == NULL) {
        err = -ENOENT;
        goto out_nofid;
    }
    err = v9fs_co_fstat(pdu, fidp->fs.fd, &stbuf);
    if (err < 0) {
        goto out;
    }
    glock->type = P9_LOCK_TYPE_UNLCK;
    offset += pdu_marshal(pdu, offset, "bqqds", glock->type,
                          glock->start, glock->length, glock->proc_id,
                          &glock->client_id);
    err = offset;
out:
    put_fid(pdu, fidp);
out_nofid:
    complete_pdu(s, pdu, err);
    v9fs_string_free(&glock->client_id);
    g_free(glock);
}


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

     pixel        *src       = (pixel*)_src;
+
     ptrdiff_t     srcstride = _srcstride / sizeof(pixel);

     pixel *dst          = (pixel *)_dst;

static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint8_t *_src, ptrdiff_t _srcstride,

                                       int16_t *src2,

                                       int height, int denom, int wx0, int wx1,

                                       int ox0, int ox1, intptr_t mx, intptr_t my, int width)

{

    int x, y;

    pixel        *src       = (pixel*)_src;

    ptrdiff_t     srcstride = _srcstride / sizeof(pixel);

    pixel *dst          = (pixel *)_dst;

    ptrdiff_t dststride = _dststride / sizeof(pixel);

    const int8_t *filter    = ff_hevc_qpel_filters[my - 1];

    int shift = 14 + 1 - BIT_DEPTH;

    int log2Wd = denom + shift - 1;

    ox0     = ox0 * (1 << (BIT_DEPTH - 8));

    ox1     = ox1 * (1 << (BIT_DEPTH - 8));

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

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

            dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +

                                    ((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1));

        src  += srcstride;

        dst  += dststride;

        src2 += MAX_PB_SIZE;

    }

}


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

                                        ACPI_BUILD_TABLE_FILE,
+
+                                       table_data, &rsdt->table_offset_entry[i],
+
+                                       sizeof(uint32_t));
+
     }

     build_header(linker, table_data,

build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets,

           const char *oem_id, const char *oem_table_id)

{

    AcpiRsdtDescriptorRev1 *rsdt;

    size_t rsdt_len;

    int i;

    const int table_data_len = (sizeof(uint32_t) * table_offsets->len);

    rsdt_len = sizeof(*rsdt) + table_data_len;

    rsdt = acpi_data_push(table_data, rsdt_len);

    memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len);

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

        /* rsdt->table_offset_entry to be filled by Guest linker */

        bios_linker_loader_add_pointer(linker,

                                       ACPI_BUILD_TABLE_FILE,

                                       ACPI_BUILD_TABLE_FILE,

                                       table_data, &rsdt->table_offset_entry[i],

                                       sizeof(uint32_t));

    }

    build_header(linker, table_data,

                 (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);

}


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

 {
+
     int ret;

     BDRVQcow2State *s = bs->opaque;

static coroutine_fn int qcow2_co_pdiscard(BlockDriverState *bs,

                                          int64_t offset, int count)

{

    int ret;

    BDRVQcow2State *s = bs->opaque;

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

        assert(count < s->cluster_size);

        return -ENOTSUP;

    }

    qemu_co_mutex_lock(&s->lock);

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

                                 QCOW2_DISCARD_REQUEST, false);

    qemu_co_mutex_unlock(&s->lock);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static CharDriverState *qmp_chardev_open_udp(ChardevUdp *udp,

                                              Error **errp)
+
 {

     int fd;

static CharDriverState *qmp_chardev_open_udp(ChardevUdp *udp,

                                             Error **errp)

{

    int fd;

    fd = socket_dgram(udp->remote, udp->local, errp);

    if (error_is_set(errp)) {

        return NULL;

    }

    return qemu_chr_open_udp_fd(fd);

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
     while (link->frame_requested) {

         if (link->srcpad->request_frame)
+
+            ret = link->srcpad->request_frame(link);
+
+        else if (link->src->inputs[0])
+
             ret = ff_request_frame(link->src->inputs[0]);

         if (ret == AVERROR_EOF && link->partial_buf) {

int ff_request_frame(AVFilterLink *link)

{

    int ret = -1;

    FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1);

    if (link->closed)

        return AVERROR_EOF;

    av_assert0(!link->frame_requested);

    link->frame_requested = 1;

    while (link->frame_requested) {

        if (link->srcpad->request_frame)

            ret = link->srcpad->request_frame(link);

        else if (link->src->inputs[0])

            ret = ff_request_frame(link->src->inputs[0]);

        if (ret == AVERROR_EOF && link->partial_buf) {

            AVFrame *pbuf = link->partial_buf;

            link->partial_buf = NULL;

            ret = ff_filter_frame_framed(link, pbuf);

        }

        if (ret < 0) {

            link->frame_requested = 0;

            if (ret == AVERROR_EOF)

                link->closed = 1;

        } else {

            av_assert0(!link->frame_requested ||

                       link->flags & FF_LINK_FLAG_REQUEST_LOOP);

        }

    }

    return ret;

}


static void print_tag(const char *str, unsigned int tag, int size)

{

    dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n",

           str, tag & 0xff,

           (tag >> 8) & 0xff,

           (tag >> 16) & 0xff,

           (tag >> 24) & 0xff,

           size);

}


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

     uint32_t data;

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

         g_assert_cmpint(vqpci->msix_entry, !=, -1);

static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)

{

    QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;

    QVirtQueuePCI *vqpci = (QVirtQueuePCI *)vq;

    uint32_t data;

    if (dev->pdev->msix_enabled) {

        g_assert_cmpint(vqpci->msix_entry, !=, -1);

        if (qpci_msix_masked(dev->pdev, vqpci->msix_entry)) {

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

            return qpci_msix_pending(dev->pdev, vqpci->msix_entry);

        } else {

            data = readl(vqpci->msix_addr);

            writel(vqpci->msix_addr, 0);

            return data == vqpci->msix_data;

        }

    } else {

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

    }

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     if (acb->canceled != 0) {

         return;
+
+    }
+
+
+
     acb->status = 0;

     if (status != 0) {

iscsi_aio_read16_cb(struct iscsi_context *iscsi, int status,

                    void *command_data, void *opaque)

{

    IscsiAIOCB *acb = opaque;

    trace_iscsi_aio_read16_cb(iscsi, status, acb, acb->canceled);

    if (acb->canceled != 0) {

        return;

    }

    acb->status = 0;

    if (status != 0) {

        if (status == SCSI_STATUS_CHECK_CONDITION

            && acb->task->sense.key == SCSI_SENSE_UNIT_ATTENTION

            && acb->retries-- > 0) {

            if (acb->task != NULL) {

                scsi_free_scsi_task(acb->task);

                acb->task = NULL;

            }

            if (iscsi_aio_readv_acb(acb) == 0) {

                iscsi_set_events(acb->iscsilun);

                return;

            }

        }

        error_report("Failed to read16 data from iSCSI lun. %s",

                     iscsi_get_error(iscsi));

        acb->status = -EIO;

    }

    iscsi_schedule_bh(acb);

}


static int decode_2(SANMVideoContext *ctx)

{

    int cx, cy, ret;

    for (cy = 0; cy != ctx->aligned_height; cy += 8) {

        for (cx = 0; cx != ctx->aligned_width; cx += 8) {

            if (ret = codec2subblock(ctx, cx, cy, 8))

                return ret;

        }

    }

    return 0;

}


static int cpu_x86_fill_model_id(char *str)

{

    uint32_t eax, ebx, ecx, edx;

    int i;

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

        host_cpuid(0x80000002 + i, 0, &eax, &ebx, &ecx, &edx);

        memcpy(str + i * 16 +  0, &eax, 4);

        memcpy(str + i * 16 +  4, &ebx, 4);

        memcpy(str + i * 16 +  8, &ecx, 4);

        memcpy(str + i * 16 + 12, &edx, 4);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
+
+{

+	long i;
+
+/*
+
 	writes 1 byte o much and might cause alignment issues on some architectures?

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

void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)

{

	long i;

/*

	writes 1 byte o much and might cause alignment issues on some architectures?

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

		((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ];

*/

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

	{

		//FIXME slow?

		dst[0]= palette[ src[i]*4+2 ];

		dst[1]= palette[ src[i]*4+1 ];

		dst[2]= palette[ src[i]*4+0 ];

		dst+= 3;

	}

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void error_setg_file_open(Error **errp, int os_errno, const char *filename)
+
 {

     error_setg_errno(errp, os_errno, "Could not open '%s'", filename);

void error_setg_file_open(Error **errp, int os_errno, const char *filename)

{

    error_setg_errno(errp, os_errno, "Could not open '%s'", filename);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+void *g_try_realloc(void *mem, size_t n_bytes)
+
+{

     __coverity_negative_sink__(n_bytes);

void *g_try_realloc(void *mem, size_t n_bytes)

{

    __coverity_negative_sink__(n_bytes);

    return realloc(mem, n_bytes == 0 ? 1 : n_bytes);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void crs_replace_with_free_ranges(GPtrArray *ranges,
+
                                          uint64_t start, uint64_t end)

 {
@@ -17,7 +17,7 @@
     for (i = 0; i < ranges->len; i++) {

         CrsRangeEntry *used = g_ptr_array_index(ranges, i);
+

         if (free_base < used->base) {

static void crs_replace_with_free_ranges(GPtrArray *ranges,

                                         uint64_t start, uint64_t end)

{

    GPtrArray *free_ranges = g_ptr_array_new_with_free_func(crs_range_free);

    uint64_t free_base = start;

    int i;

    g_ptr_array_sort(ranges, crs_range_compare);

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

        CrsRangeEntry *used = g_ptr_array_index(ranges, i);

        if (free_base < used->base) {

            crs_range_insert(free_ranges, free_base, used->base - 1);

        }

        free_base = used->limit + 1;

    }

    if (free_base < end) {

        crs_range_insert(free_ranges, free_base, end);

    }

    g_ptr_array_set_size(ranges, 0);

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

        g_ptr_array_add(ranges, g_ptr_array_index(free_ranges, i));

    }

    g_ptr_array_free(free_ranges, false);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void qed_check_for_leaks(QEDCheck *check)

+{

     BDRVQEDState *s = check->s;

static void qed_check_for_leaks(QEDCheck *check)

{

    BDRVQEDState *s = check->s;

    size_t i;

    for (i = s->header.header_size; i < check->nclusters; i++) {

        if (!qed_test_bit(check->used_clusters, i)) {

            check->result->leaks++;

        }

    }

}


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

     Rom *rom;

+
+
+    QTAILQ_FOREACH(rom, &roms, next) {
+
+        if (rom->fw_file) {

             continue;

int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size)

{

    target_phys_addr_t end = addr + size;

    uint8_t *s, *d = dest;

    size_t l = 0;

    Rom *rom;

    QTAILQ_FOREACH(rom, &roms, next) {

        if (rom->fw_file) {

            continue;

        }

        if (rom->addr + rom->romsize < addr)

            continue;

        if (rom->addr > end)

            break;

        if (!rom->data)

            continue;

        d = dest + (rom->addr - addr);

        s = rom->data;

        l = rom->romsize;

        if (rom->addr < addr) {

            d = dest;

            s += (addr - rom->addr);

            l -= (addr - rom->addr);

        }

        if ((d + l) > (dest + size)) {

            l = dest - d;

        }

        memcpy(d, s, l);

    }

    return (d + l) - dest;

}


--- a/source.c
+++ b/source.c
@@ -1,16 +1,16 @@
 static int qxl_init_primary(PCIDevice *dev)

 {
+
     PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);

     VGACommonState *vga = &qxl->vga;

     PortioList *qxl_vga_port_list = g_new(PortioList, 1);

+    int rc;
+
+

     qxl->id = 0;

static int qxl_init_primary(PCIDevice *dev)

{

    PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);

    VGACommonState *vga = &qxl->vga;

    PortioList *qxl_vga_port_list = g_new(PortioList, 1);

    int rc;

    qxl->id = 0;

    qxl_init_ramsize(qxl);

    vga->vram_size_mb = qxl->vga.vram_size >> 20;

    vga_common_init(vga, OBJECT(dev), true);

    vga_init(vga, OBJECT(dev),

             pci_address_space(dev), pci_address_space_io(dev), false);

    portio_list_init(qxl_vga_port_list, OBJECT(dev), qxl_vga_portio_list,

                     vga, "vga");

    portio_list_set_flush_coalesced(qxl_vga_port_list);

    portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0);

    vga->con = graphic_console_init(DEVICE(dev), 0, &qxl_ops, qxl);

    qemu_spice_display_init_common(&qxl->ssd);

    rc = qxl_init_common(qxl);

    if (rc != 0) {

        return rc;

    }

    qxl->ssd.dcl.ops = &display_listener_ops;

    qxl->ssd.dcl.con = vga->con;

    register_displaychangelistener(&qxl->ssd.dcl);

    return rc;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val)

+{

     int i, bytes = 1;

static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val)

{

    int i, bytes = 1;

    while (val >> bytes*8 && bytes < 8) bytes++;

    put_ebml_id(pb, elementid);

    put_ebml_num(pb, bytes, 0);

    for (i = bytes - 1; i >= 0; i--)

        put_byte(pb, val >> i*8);

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     BusClass *bc = BUS_GET_CLASS(bus);

     Error *local_err = NULL;
+

     if (value && !bus->realized) {

static void bus_set_realized(Object *obj, bool value, Error **errp)

{

    BusState *bus = BUS(obj);

    BusClass *bc = BUS_GET_CLASS(bus);

    Error *local_err = NULL;

    if (value && !bus->realized) {

        if (bc->realize) {

            bc->realize(bus, &local_err);

        }

    } else if (!value && bus->realized) {

        if (bc->unrealize) {

            bc->unrealize(bus, &local_err);

        }

    }

    if (local_err != NULL) {

        error_propagate(errp, local_err);

        return;

    }

    bus->realized = value;

}


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

     TCGv tmp = tcg_temp_new(TCG_TYPE_I32);
+
+    tcg_gen_qemu_ld32u(tmp, t1, flags);
+
     tcg_gen_helper_1_1(helper_memory_to_f, t0, tmp);

     tcg_temp_free(tmp);

static always_inline void gen_qemu_ldf (TCGv t0, TCGv t1, int flags)

{

    TCGv tmp = tcg_temp_new(TCG_TYPE_I32);

    tcg_gen_qemu_ld32u(tmp, t1, flags);

    tcg_gen_helper_1_1(helper_memory_to_f, t0, tmp);

    tcg_temp_free(tmp);

}


--- a/source.c
+++ b/source.c
@@ -1,20 +1,20 @@
 static void do_interrupt_user(CPUX86State *env, int intno, int is_int,
+
+                              int error_code, target_ulong next_eip)
+
+{
+
+    SegmentCache *dt;
+
     target_ulong ptr;
+
     int dpl, cpl, shift;
+
+    uint32_t e2;
+
+
+
+    dt = &env->idt;

     if (env->hflags & HF_LMA_MASK) {

static void do_interrupt_user(CPUX86State *env, int intno, int is_int,

                              int error_code, target_ulong next_eip)

{

    SegmentCache *dt;

    target_ulong ptr;

    int dpl, cpl, shift;

    uint32_t e2;

    dt = &env->idt;

    if (env->hflags & HF_LMA_MASK) {

        shift = 4;

    } else {

        shift = 3;

    }

    ptr = dt->base + (intno << shift);

    e2 = cpu_ldl_kernel(env, ptr + 4);

    dpl = (e2 >> DESC_DPL_SHIFT) & 3;

    cpl = env->hflags & HF_CPL_MASK;

    /* check privilege if software int */

    if (is_int && dpl < cpl) {

        raise_exception_err(env, EXCP0D_GPF, (intno << shift) + 2);

    }

    /* Since we emulate only user space, we cannot do more than

       exiting the emulation with the suitable exception and error

       code. So update EIP for INT 0x80 and EXCP_SYSCALL. */

    if (is_int || intno == EXCP_SYSCALL) {

        env->eip = next_eip;

    }

}


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

             tlb_entry->addr_write = (tlb_entry->addr_write & TARGET_PAGE_MASK) | TLB_NOTDIRTY;

+        }
+
+    }
+
+}

static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry,

                                         unsigned long start, unsigned long length)

{

    unsigned long addr;

    if ((tlb_entry->addr_write & ~TARGET_PAGE_MASK) == io_mem_ram.ram_addr) {

        addr = (tlb_entry->addr_write & TARGET_PAGE_MASK) + tlb_entry->addend;

        if ((addr - start) < length) {

            tlb_entry->addr_write = (tlb_entry->addr_write & TARGET_PAGE_MASK) | TLB_NOTDIRTY;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static inline void json_print_item_str(WriterContext *wctx,
+
+                                       const char *key, const char *value,
+
+                                       const char *indent)
+
 {

     char *key_esc = json_escape_str(key);

static inline void json_print_item_str(WriterContext *wctx,

                                       const char *key, const char *value,

                                       const char *indent)

{

    char *key_esc = json_escape_str(key);

    char *value_esc = json_escape_str(value);

    printf("%s\"%s\": \"%s\"", indent,

           key_esc   ? key_esc   : "",

           value_esc ? value_esc : "");

    av_free(key_esc);

    av_free(value_esc);

}


static void filter_frame(H264Context *h) {

    int mb_x = 0;

    int mb_y = 0;

    for( mb_y = 0; mb_y < h->s.mb_height; mb_y++ ) {

        for( mb_x = 0; mb_x < h->s.mb_width; mb_x++ ) {

            filter_mb( h, mb_x, mb_y );

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,20 +1,20 @@
 uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
+
 {
+
+    ARMCPU *cpu = arm_env_get_cpu(env);
+
+
+
+    switch (reg) {
+
     case 0: /* APSR */

         return xpsr_read(env) & 0xf8000000;

     case 1: /* IAPSR */
+
+        return xpsr_read(env) & 0xf80001ff;

     case 2: /* EAPSR */

uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)

{

    ARMCPU *cpu = arm_env_get_cpu(env);

    switch (reg) {

    case 0: /* APSR */

        return xpsr_read(env) & 0xf8000000;

    case 1: /* IAPSR */

        return xpsr_read(env) & 0xf80001ff;

    case 2: /* EAPSR */

        return xpsr_read(env) & 0xff00fc00;

    case 3: /* xPSR */

        return xpsr_read(env) & 0xff00fdff;

    case 5: /* IPSR */

        return xpsr_read(env) & 0x000001ff;

    case 6: /* EPSR */

        return xpsr_read(env) & 0x0700fc00;

    case 7: /* IEPSR */

        return xpsr_read(env) & 0x0700edff;

    case 8: /* MSP */

        return env->v7m.current_sp ? env->v7m.other_sp : env->regs[13];

    case 9: /* PSP */

        return env->v7m.current_sp ? env->regs[13] : env->v7m.other_sp;

    case 16: /* PRIMASK */

        return (env->daif & PSTATE_I) != 0;

    case 17: /* BASEPRI */

    case 18: /* BASEPRI_MAX */

        return env->v7m.basepri;

    case 19: /* FAULTMASK */

        return (env->daif & PSTATE_F) != 0;

    case 20: /* CONTROL */

        return env->v7m.control;

    default:

        /* ??? For debugging only.  */

        cpu_abort(CPU(cpu), "Unimplemented system register read (%d)\n", reg);

        return 0;

    }

}


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

     case I2C_START_SEND:
+
+        s->i2c_len = 0;
+
+        break;
+
     case I2C_FINISH:

 #ifdef VERBOSE

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

{

    WM8750State *s = WM8750(i2c);

    switch (event) {

    case I2C_START_SEND:

        s->i2c_len = 0;

        break;

    case I2C_FINISH:

#ifdef VERBOSE

        if (s->i2c_len < 2)

            printf("%s: message too short (%i bytes)\n",

                            __FUNCTION__, s->i2c_len);

#endif

        break;

    default:

        break;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void ff_xvmc_init_block(MpegEncContext *s)

+{

     struct xvmc_render_state *render = (struct xvmc_render_state*)s->current_picture.data[2];

void ff_xvmc_init_block(MpegEncContext *s)

{

    struct xvmc_render_state *render = (struct xvmc_render_state*)s->current_picture.data[2];

    assert(render);

    if (!render || render->magic != AV_XVMC_RENDER_MAGIC) {

        assert(0);

        return; // make sure that this is a render packet

    }

    s->block = (DCTELEM *)(render->data_blocks + render->next_free_data_block_num * 64);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size)

+{
+
+    int i;
+
     PCIDevice *s = container_of(pv, PCIDevice, config);

static void put_pci_irq_state(QEMUFile *f, void *pv, size_t size)

{

    int i;

    PCIDevice *s = container_of(pv, PCIDevice, config);

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

        qemu_put_be32(f, pci_irq_state(s, i));

    }

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
             s->count_latched = RW_STATE_MSB;
             break;
     } else {
+        switch(s->read_state) {
+        default:
+        case RW_STATE_LSB:
+            count = pit_get_count(s);
+            ret = count & 0xff;
             break;
         case RW_STATE_MSB:
             count = pit_get_count(s);

static uint64_t pit_ioport_read(void *opaque, hwaddr addr,
                                unsigned size)
{
    PITCommonState *pit = opaque;
    int ret, count;
    PITChannelState *s;
    addr &= 3;
    s = &pit->channels[addr];
    if (s->status_latched) {
        s->status_latched = 0;
        ret = s->status;
    } else if (s->count_latched) {
        switch(s->count_latched) {
        default:
        case RW_STATE_LSB:
            ret = s->latched_count & 0xff;
            s->count_latched = 0;
            break;
        case RW_STATE_MSB:
            ret = s->latched_count >> 8;
            s->count_latched = 0;
            break;
        case RW_STATE_WORD0:
            ret = s->latched_count & 0xff;
            s->count_latched = RW_STATE_MSB;
            break;
    } else {
        switch(s->read_state) {
        default:
        case RW_STATE_LSB:
            count = pit_get_count(s);
            ret = count & 0xff;
            break;
        case RW_STATE_MSB:
            count = pit_get_count(s);
            ret = (count >> 8) & 0xff;
            break;
        case RW_STATE_WORD0:
            count = pit_get_count(s);
            ret = count & 0xff;
            s->read_state = RW_STATE_WORD1;
            break;
        case RW_STATE_WORD1:
            count = pit_get_count(s);
            ret = (count >> 8) & 0xff;
            s->read_state = RW_STATE_WORD0;
            break;
    return ret;


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void pxa27x_register_keypad(struct pxa2xx_keypad_s *kp, struct keymap *map,
+
         int size)

 {

void pxa27x_register_keypad(struct pxa2xx_keypad_s *kp, struct keymap *map,

        int size)

{

    kp->map = (struct keymap *) qemu_mallocz(sizeof(struct keymap) * size);

    if(!map || size < 0x80) {

        fprintf(stderr, "%s - No PXA keypad map defined\n", __FUNCTION__);

        exit(-1);

    }

    kp->map = map;

    qemu_add_kbd_event_handler((QEMUPutKBDEvent *) pxa27x_keyboard_event, kp);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void qpci_pc_config_writeb(QPCIBus *bus, int devfn, uint8_t offset, uint8_t value)
+
 {

     outl(0xcf8, (1 << 31) | (devfn << 8) | offset);

static void qpci_pc_config_writeb(QPCIBus *bus, int devfn, uint8_t offset, uint8_t value)

{

    outl(0xcf8, (1 << 31) | (devfn << 8) | offset);

    outb(0xcfc, value);

}


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

     max = ARRAY_SIZE(ppc_defs);

+    for (i = 0; i < max; i++) {
+
+        (*cpu_fprintf)(f, "PowerPC %-16s PVR %08x\n",
+
                        ppc_defs[i].name, ppc_defs[i].pvr);

     }

void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))

{

    int i, max;

    max = ARRAY_SIZE(ppc_defs);

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

        (*cpu_fprintf)(f, "PowerPC %-16s PVR %08x\n",

                       ppc_defs[i].name, ppc_defs[i].pvr);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void pmsav5_data_ap_write(CPUARMState *env, const ARMCPRegInfo *ri,
+
                                  uint64_t value)

 {

static void pmsav5_data_ap_write(CPUARMState *env, const ARMCPRegInfo *ri,

                                 uint64_t value)

{

    env->cp15.c5_data = extended_mpu_ap_bits(value);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+int net_init_vde(QemuOpts *opts, const char *name, VLANState *vlan)

 {

@@ -7,7 +7,7 @@
     const char *group;

     int port, mode;
+

     sock  = qemu_opt_get(opts, "sock");

int net_init_vde(QemuOpts *opts, const char *name, VLANState *vlan)

{

    const char *sock;

    const char *group;

    int port, mode;

    sock  = qemu_opt_get(opts, "sock");

    group = qemu_opt_get(opts, "group");

    port = qemu_opt_get_number(opts, "port", 0);

    mode = qemu_opt_get_number(opts, "mode", 0700);

    if (net_vde_init(vlan, "vde", name, sock, port, group, mode) == -1) {

        return -1;

    }

    return 0;

}


static bool migration_object_check(MigrationState *ms, Error **errp)

{

    if (!migrate_params_check(&ms->parameters, errp)) {

        return false;

    }

    return true;

}


--- a/source.c
+++ b/source.c
@@ -1,20 +1,20 @@
+static int expand_rle_row(const uint8_t *in_buf, const uint8_t* in_end,

             unsigned char *out_buf, uint8_t* out_end, int pixelstride)

+{
+
     unsigned char pixel, count;

     unsigned char *orig = out_buf;

+    while (1) {

         if(in_buf + 1 > in_end) return -1;

+        pixel = bytestream_get_byte(&in_buf);

         if (!(count = (pixel & 0x7f))) {

static int expand_rle_row(const uint8_t *in_buf, const uint8_t* in_end,

            unsigned char *out_buf, uint8_t* out_end, int pixelstride)

{

    unsigned char pixel, count;

    unsigned char *orig = out_buf;

    while (1) {

        if(in_buf + 1 > in_end) return -1;

        pixel = bytestream_get_byte(&in_buf);

        if (!(count = (pixel & 0x7f))) {

            return (out_buf - orig) / pixelstride;

        }

        /* Check for buffer overflow. */

        if(out_buf + pixelstride * count >= out_end) return -1;

        if (pixel & 0x80) {

            while (count--) {

                *out_buf = bytestream_get_byte(&in_buf);

                out_buf += pixelstride;

            }

        } else {

            pixel = bytestream_get_byte(&in_buf);

            while (count--) {

                *out_buf = pixel;

                out_buf += pixelstride;

            }

        }

    }

}


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

                         const int32_t **lumSrc, int lumFilterSize,

+                        const int16_t *chrFilter, const int32_t **chrUSrc,
+
                         const int32_t **chrVSrc, int chrFilterSize,

                         const int32_t **alpSrc, uint16_t *dest, int dstW,

                         int y, enum PixelFormat target)

+{
+
+    int i;

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

         int j;

yuv2gray16_X_c_template(SwsContext *c, const int16_t *lumFilter,

                        const int32_t **lumSrc, int lumFilterSize,

                        const int16_t *chrFilter, const int32_t **chrUSrc,

                        const int32_t **chrVSrc, int chrFilterSize,

                        const int32_t **alpSrc, uint16_t *dest, int dstW,

                        int y, enum PixelFormat target)

{

    int i;

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

        int j;

        int Y1 = 1 << 14;

        int Y2 = 1 << 14;

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

            Y1 += lumSrc[j][i * 2]     * lumFilter[j];

            Y2 += lumSrc[j][i * 2 + 1] * lumFilter[j];

        }

        Y1 >>= 15;

        Y2 >>= 15;

        if ((Y1 | Y2) & 0x10000) {

            Y1 = av_clip_uint16(Y1);

            Y2 = av_clip_uint16(Y2);

        }

        output_pixel(&dest[i * 2 + 0], Y1);

        output_pixel(&dest[i * 2 + 1], Y2);

    }

}


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

         return 0;

+    ret = qcow_read(bs, start_sect + n_start, s->cluster_data, n);
+
+    if (ret < 0)
+
+        return ret;

     if (s->crypt_method) {

static int copy_sectors(BlockDriverState *bs, uint64_t start_sect,

                        uint64_t cluster_offset, int n_start, int n_end)

{

    BDRVQcowState *s = bs->opaque;

    int n, ret;

    n = n_end - n_start;

    if (n <= 0)

        return 0;

    ret = qcow_read(bs, start_sect + n_start, s->cluster_data, n);

    if (ret < 0)

        return ret;

    if (s->crypt_method) {

        qcow2_encrypt_sectors(s, start_sect + n_start,

                        s->cluster_data,

                        s->cluster_data, n, 1,

                        &s->aes_encrypt_key);

    }

    ret = bdrv_write(s->hd, (cluster_offset >> 9) + n_start,

                     s->cluster_data, n);

    if (ret < 0)

        return ret;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     iocb->ret = 0;

     iocb->qiov = qiov;
+
+    iocb->i = -1;
+
+    iocb->j = 0;
+
     ide_issue_trim_cb(iocb, 0);

     return &iocb->common;

BlockAIOCB *ide_issue_trim(

        int64_t offset, QEMUIOVector *qiov,

        BlockCompletionFunc *cb, void *cb_opaque, void *opaque)

{

    BlockBackend *blk = opaque;

    TrimAIOCB *iocb;

    iocb = blk_aio_get(&trim_aiocb_info, blk, cb, cb_opaque);

    iocb->blk = blk;

    iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);

    iocb->ret = 0;

    iocb->qiov = qiov;

    iocb->i = -1;

    iocb->j = 0;

    ide_issue_trim_cb(iocb, 0);

    return &iocb->common;

}


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

     qmp_output_add(qov, name, dict);
+
+    qmp_output_push(qov, dict, obj);
+
+}

static void qmp_output_start_struct(Visitor *v, const char *name, void **obj,

                                    size_t unused, Error **errp)

{

    QmpOutputVisitor *qov = to_qov(v);

    QDict *dict = qdict_new();

    qmp_output_add(qov, name, dict);

    qmp_output_push(qov, dict, obj);

}


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

     RV34DecContext *r = avctx->priv_data;
+

     r->s.avctx = avctx;

int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx)

{

    int err;

    RV34DecContext *r = avctx->priv_data;

    r->s.avctx = avctx;

    if (avctx->internal->is_copy) {

        r->tmp_b_block_base = NULL;

        if ((err = ff_MPV_common_init(&r->s)) < 0)

            return err;

        if ((err = rv34_decoder_alloc(r)) < 0)

            return err;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     if (isabus->assigned & (1 << isairq)) {

         hw_error("isa irq %d already assigned", isairq);
+
+    }
+
+    isabus->assigned |= (1 << isairq);
+
     return isabus->irqs[isairq];

 }

qemu_irq isa_reserve_irq(int isairq)

{

    if (isairq < 0 || isairq > 15) {

        hw_error("isa irq %d invalid", isairq);

    }

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

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

    }

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

    return isabus->irqs[isairq];

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static av_always_inline int rv40_loop_filter_strength(uint8_t *src,

                                                       int step, int stride,

static av_always_inline int rv40_loop_filter_strength(uint8_t *src,

                                                      int step, int stride,

                                                      int beta, int beta2,

                                                      int edge,

                                                      int *p1, int *q1)

{

    int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0;

    int strong0 = 0, strong1 = 0;

    uint8_t *ptr;

    int i;

    for (i = 0, ptr = src; i < 4; i++, ptr += stride) {

        sum_p1p0 += ptr[-2*step] - ptr[-1*step];

        sum_q1q0 += ptr[ 1*step] - ptr[ 0*step];

    }

    *p1 = FFABS(sum_p1p0) < (beta << 2);

    *q1 = FFABS(sum_q1q0) < (beta << 2);

    if(!*p1 && !*q1)

        return 0;

    if (!edge)

        return 0;

    for (i = 0, ptr = src; i < 4; i++, ptr += stride) {

        sum_p1p2 += ptr[-2*step] - ptr[-3*step];

        sum_q1q2 += ptr[ 1*step] - ptr[ 2*step];

    }

    strong0 = *p1 && (FFABS(sum_p1p2) < beta2);

    strong1 = *q1 && (FFABS(sum_q1q2) < beta2);

    return strong0 && strong1;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     Coroutine *coroutine;

+
+    coroutine = qemu_coroutine_create(verify_self);
+
     qemu_coroutine_enter(coroutine, coroutine);

 }

static void test_self(void)

{

    Coroutine *coroutine;

    coroutine = qemu_coroutine_create(verify_self);

    qemu_coroutine_enter(coroutine, coroutine);

}


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

     IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev);
+
     IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, qdev, base);

     IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus);
@@ -11,13 +11,13 @@

     if (!dev->conf.bs) {
+
         fprintf(stderr, "%s: no drive specified\n", qdev->info->name);

         goto err;

     }
+
     if (dev->unit == -1) {

         dev->unit = bus->master ? 1 : 0;

static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base)

{

    IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev);

    IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, qdev, base);

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

    if (!dev->conf.bs) {

        fprintf(stderr, "%s: no drive specified\n", qdev->info->name);

        goto err;

    }

    if (dev->unit == -1) {

        dev->unit = bus->master ? 1 : 0;

    }

    switch (dev->unit) {

    case 0:

        if (bus->master) {

            fprintf(stderr, "ide: tried to assign master twice\n");

            goto err;

        }

        bus->master = dev;

        break;

    case 1:

        if (bus->slave) {

            fprintf(stderr, "ide: tried to assign slave twice\n");

            goto err;

        }

        bus->slave = dev;

        break;

    default:

        goto err;

    }

    return info->init(dev);

err:

    return -1;

}


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

     size_t sz;

+
+
+    __coverity_negative_sink__(nmemb);
+
+    __coverity_negative_sink__(size);

     sz = nmemb * size;

void *g_realloc_n(void *ptr, size_t nmemb, size_t size)

{

    size_t sz;

    __coverity_negative_sink__(nmemb);

    __coverity_negative_sink__(size);

    sz = nmemb * size;

    __coverity_escape__(ptr);

    ptr = __coverity_alloc__(size);

    /*

     * Memory beyond the old size isn't actually initialized.  Can't

     * model that.  See Coverity's realloc() model

     */

    __coverity_writeall__(ptr);

    __coverity_mark_as_afm_allocated__(ptr, AFM_free);

    return ptr;

}


static void tcx_rstip_writel(void *opaque, hwaddr addr,

                             uint64_t val, unsigned size)

{

    TCXState *s = opaque;

    int i;

    uint32_t col;

    if (!(addr & 4)) {

        s->tmpblit = val;

    } else {

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

        col = cpu_to_be32(s->tmpblit);

        if (s->depth == 24) {

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

                if (val & 0x80000000) {

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

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

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

                }

                val <<= 1;

            }

        } else {

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

                if (val & 0x80000000) {

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

                }

                val <<= 1;

            }

        }

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

    }

}


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

     thread_pool_submit_aio(aio_get_thread_pool(qemu_get_aio_context()),

+                           coroutine_enter_func, co, coroutine_enter_cb, co);
+
 }

void co_run_in_worker_bh(void *opaque)

{

    Coroutine *co = opaque;

    thread_pool_submit_aio(aio_get_thread_pool(qemu_get_aio_context()),

                           coroutine_enter_func, co, coroutine_enter_cb, co);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)

 {

static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)

{

#if COMPILE_TEMPLATE_MMX

    assert(src1==src2);

    RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);

#else

    int i;

    assert(src1==src2);

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

        int r= src1[3*i + 0];

        int g= src1[3*i + 1];

        int b= src1[3*i + 2];

        dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;

        dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;

    }

#endif

}


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

+{

     CompareState *s = opaque;

static void colo_old_packet_check(void *opaque)

{

    CompareState *s = opaque;

    g_queue_foreach(&s->conn_list, colo_old_packet_check_one_conn, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void msix_mmio_writel(void *opaque, target_phys_addr_t addr,

+                             uint32_t val)

+{

     PCIDevice *dev = opaque;

static void msix_mmio_writel(void *opaque, target_phys_addr_t addr,

                             uint32_t val)

{

    PCIDevice *dev = opaque;

    unsigned int offset = addr & (MSIX_PAGE_SIZE - 1);

    int vector = offset / MSIX_ENTRY_SIZE;

    memcpy(dev->msix_table_page + offset, &val, 4);

    if (!msix_is_masked(dev, vector) && msix_is_pending(dev, vector)) {

        msix_clr_pending(dev, vector);

        msix_notify(dev, vector);

    }

}


--- a/source.c
+++ b/source.c
@@ -36,11 +36,11 @@
         default:
             av_log(avctx, AV_LOG_ERROR, "Invalid/unsupported sample format.\n");
         // prevent overflow
+        if (avctx->sample_rate > 0x7FFFFF) {
+            av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
+            return AVERROR(EINVAL);
+        s->frame_length = 256 * avctx->sample_rate / 245;
+        s->last_frame_length = s->data_length % s->frame_length;
         s->total_frames = s->data_length / s->frame_length +
                         (s->last_frame_length ? 1 : 0);
         av_log(s->avctx, AV_LOG_DEBUG, "format: %d chans: %d bps: %d rate: %d block: %d\n",

static av_cold int tta_decode_init(AVCodecContext * avctx)
{
    TTAContext *s = avctx->priv_data;
    int i;
    s->avctx = avctx;
    // 30bytes includes a seektable with one frame
    if (avctx->extradata_size < 30)
        return -1;
    init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size * 8);
    if (show_bits_long(&s->gb, 32) == AV_RL32("TTA1"))
    {
        /* signature */
        skip_bits(&s->gb, 32);
        s->format = get_bits(&s->gb, 16);
        if (s->format > 2) {
            av_log(s->avctx, AV_LOG_ERROR, "Invalid format\n");
            return -1;
        if (s->format == FORMAT_ENCRYPTED) {
            av_log_missing_feature(s->avctx, "Encrypted TTA", 0);
            return AVERROR(EINVAL);
        avctx->channels = s->channels = get_bits(&s->gb, 16);
        avctx->bits_per_coded_sample = get_bits(&s->gb, 16);
        s->bps = (avctx->bits_per_coded_sample + 7) / 8;
        avctx->sample_rate = get_bits_long(&s->gb, 32);
        s->data_length = get_bits_long(&s->gb, 32);
        skip_bits(&s->gb, 32); // CRC32 of header
        switch(s->bps) {
        case 2:
            avctx->sample_fmt = AV_SAMPLE_FMT_S16;
            avctx->bits_per_raw_sample = 16;
            break;
        case 3:
            avctx->sample_fmt = AV_SAMPLE_FMT_S32;
            avctx->bits_per_raw_sample = 24;
            break;
        default:
            av_log(avctx, AV_LOG_ERROR, "Invalid/unsupported sample format.\n");
        // prevent overflow
        if (avctx->sample_rate > 0x7FFFFF) {
            av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
            return AVERROR(EINVAL);
        s->frame_length = 256 * avctx->sample_rate / 245;
        s->last_frame_length = s->data_length % s->frame_length;
        s->total_frames = s->data_length / s->frame_length +
                        (s->last_frame_length ? 1 : 0);
        av_log(s->avctx, AV_LOG_DEBUG, "format: %d chans: %d bps: %d rate: %d block: %d\n",
            s->format, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate,
            avctx->block_align);
        av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
            s->data_length, s->frame_length, s->last_frame_length, s->total_frames);
        // FIXME: seek table
        for (i = 0; i < s->total_frames; i++)
            skip_bits(&s->gb, 32);
        skip_bits(&s->gb, 32); // CRC32 of seektable
        if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){
            av_log(avctx, AV_LOG_ERROR, "frame_length too large\n");
            return -1;
        if (s->bps == 2) {
            s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels);
            if (!s->decode_buffer)
                return AVERROR(ENOMEM);
        s->ch_ctx = av_malloc(avctx->channels * sizeof(*s->ch_ctx));
        if (!s->ch_ctx) {
            av_freep(&s->decode_buffer);
            return AVERROR(ENOMEM);
    } else {
        av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n");
        return -1;
    avcodec_get_frame_defaults(&s->frame);
    avctx->coded_frame = &s->frame;
    return 0;


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

     int ret;
+
     AVIOContext *moov_buf;

     MOVMuxContext *mov = s->priv_data;

static int get_moov_size(AVFormatContext *s)

{

    int ret;

    AVIOContext *moov_buf;

    MOVMuxContext *mov = s->priv_data;

    if ((ret = ffio_open_null_buf(&moov_buf)) < 0)

        return ret;

    mov_write_moov_tag(moov_buf, mov, s);

    return ffio_close_null_buf(moov_buf);

}


--- a/source.c
+++ b/source.c
@@ -13,7 +13,7 @@
     mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set;

     mxf->metadata_sets_count++;
+
+    return 0;
+
+}

static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)

{

    mxf->metadata_sets = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets));

    if (!mxf->metadata_sets)

        return -1;

    mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set;

    mxf->metadata_sets_count++;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -16,8 +16,8 @@
     buf[0x5f] = 0x01; // UDL
     buf[0x167] = 0x02; // reserved
     AV_WB16(buf + 0x16a, ctx->m.mb_height * 4 + 4); // MSIPS
+    buf[0x16d] = ctx->m.mb_height; // Ns
+    buf[0x16f] = 0x10; // reserved
+    ctx->msip = buf + 0x170;
+    return 0;
+}

static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf)
{
    DNXHDEncContext *ctx = avctx->priv_data;
    const uint8_t header_prefix[5] = { 0x00,0x00,0x02,0x80,0x01 };
    memcpy(buf, header_prefix, 5);
    buf[5] = ctx->interlaced ? ctx->cur_field+2 : 0x01;
    buf[6] = 0x80; // crc flag off
    buf[7] = 0xa0; // reserved
    AV_WB16(buf + 0x18, avctx->height); // ALPF
    AV_WB16(buf + 0x1a, avctx->width);  // SPL
    AV_WB16(buf + 0x1d, avctx->height); // NAL
    buf[0x21] = 0x38; // FIXME 8 bit per comp
    buf[0x22] = 0x88 + (ctx->frame.interlaced_frame<<2);
    AV_WB32(buf + 0x28, ctx->cid); // CID
    buf[0x2c] = ctx->interlaced ? 0 : 0x80;
    buf[0x5f] = 0x01; // UDL
    buf[0x167] = 0x02; // reserved
    AV_WB16(buf + 0x16a, ctx->m.mb_height * 4 + 4); // MSIPS
    buf[0x16d] = ctx->m.mb_height; // Ns
    buf[0x16f] = 0x10; // reserved
    ctx->msip = buf + 0x170;
    return 0;
}


--- a/source.c
+++ b/source.c
@@ -16,11 +16,11 @@
     gen_spr_power8_tce_address_control(env);
     gen_spr_power8_ids(env);
     gen_spr_power8_ebb(env);
+    gen_spr_power8_fscr(env);
+    gen_spr_power8_pmu_sup(env);
+    gen_spr_power8_pmu_user(env);
+    gen_spr_power8_tm(env);
+    gen_spr_power8_pspb(env);
     gen_spr_vtb(env);
     gen_spr_power8_ic(env);
     gen_spr_power8_book4(env);

static void init_proc_POWER9(CPUPPCState *env)
{
    /* Common Registers */
    init_proc_book3s_common(env);
    gen_spr_book3s_207_dbg(env);
    /* POWER8 Specific Registers */
    gen_spr_book3s_ids(env);
    gen_spr_amr(env);
    gen_spr_iamr(env);
    gen_spr_book3s_purr(env);
    gen_spr_power5p_common(env);
    gen_spr_power5p_lpar(env);
    gen_spr_power5p_ear(env);
    gen_spr_power6_common(env);
    gen_spr_power6_dbg(env);
    gen_spr_power8_tce_address_control(env);
    gen_spr_power8_ids(env);
    gen_spr_power8_ebb(env);
    gen_spr_power8_fscr(env);
    gen_spr_power8_pmu_sup(env);
    gen_spr_power8_pmu_user(env);
    gen_spr_power8_tm(env);
    gen_spr_power8_pspb(env);
    gen_spr_vtb(env);
    gen_spr_power8_ic(env);
    gen_spr_power8_book4(env);
    gen_spr_power8_rpr(env);
    /* POWER9 Specific registers */
    spr_register_kvm(env, SPR_TIDR, "TIDR", NULL, NULL,
                     KVM_REG_PPC_TIDR, 0);
    /* env variables */
#if !defined(CONFIG_USER_ONLY)
    env->slb_nr = 32;
#endif
    env->ci_large_pages = true;
    env->dcache_line_size = 128;
    env->icache_line_size = 128;
    /* Allocate hardware IRQ controller */
    init_excp_POWER8(env);
    ppcPOWER7_irq_init(ppc_env_get_cpu(env));
}


--- a/source.c
+++ b/source.c
@@ -15,9 +15,9 @@
 	tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize));

 	tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], t0);
+
+
+
+	return 2;
+
 }

static unsigned int dec_addi_acr(DisasContext *dc)

{

	TCGv t0;

	DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n",

		  memsize_char(memsize_zz(dc)), dc->op2, dc->op1));

	cris_cc_mask(dc, 0);

	t0 = tcg_temp_new(TCG_TYPE_TL);

	tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize));

	tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], t0);

	return 2;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);

     AVPicture dummy_pict;
+
+    int ret;
+
+
+

     if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)

int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)

{

    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);

    AVPicture dummy_pict;

    int ret;

    if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)

        return ret;

    if (desc->flags & PIX_FMT_PSEUDOPAL)

        // do not include palette for these pseudo-paletted formats

        return width * height;

    return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);

}