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

     smp_wmb();

+
+
+    ret = qemu_coroutine_switch(self, co, COROUTINE_ENTER);
+
+

     qemu_co_queue_run_restart(co);

void qemu_coroutine_enter(Coroutine *co)

{

    Coroutine *self = qemu_coroutine_self();

    CoroutineAction ret;

    trace_qemu_coroutine_enter(self, co, co->entry_arg);

    if (co->caller) {

        fprintf(stderr, "Co-routine re-entered recursively\n");

        abort();

    }

    co->caller = self;

    co->ctx = qemu_get_current_aio_context();

    /* Store co->ctx before anything that stores co.  Matches

     * barrier in aio_co_wake.

     */

    smp_wmb();

    ret = qemu_coroutine_switch(self, co, COROUTINE_ENTER);

    qemu_co_queue_run_restart(co);

    switch (ret) {

    case COROUTINE_YIELD:

        return;

    case COROUTINE_TERMINATE:

        assert(!co->locks_held);

        trace_qemu_coroutine_terminate(co);

        coroutine_delete(co);

        return;

    default:

        abort();

    }

}


--- a/source.c
+++ b/source.c
@@ -12,11 +12,11 @@
         vaUnmapBuffer(vactx->display, vactx->bitplane_buf_id);
         va_buffers[n_va_buffers++] = vactx->bitplane_buf_id;
     }
+    if (vaBeginPicture(vactx->display, vactx->context_id,
+                       surface) != VA_STATUS_SUCCESS)
+        return -1;
+    if (vaRenderPicture(vactx->display, vactx->context_id,
+                        va_buffers, n_va_buffers) != VA_STATUS_SUCCESS)
         return -1;
     if (vaRenderPicture(vactx->display, vactx->context_id,
                         vactx->slice_buf_ids,

int ff_vaapi_render_picture(struct vaapi_context *vactx, VASurfaceID surface)
{
    VABufferID va_buffers[3];
    unsigned int n_va_buffers = 0;
    vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id);
    va_buffers[n_va_buffers++] = vactx->pic_param_buf_id;
    if (vactx->iq_matrix_buf_id) {
        vaUnmapBuffer(vactx->display, vactx->iq_matrix_buf_id);
        va_buffers[n_va_buffers++] = vactx->iq_matrix_buf_id;
    }
    if (vactx->bitplane_buf_id) {
        vaUnmapBuffer(vactx->display, vactx->bitplane_buf_id);
        va_buffers[n_va_buffers++] = vactx->bitplane_buf_id;
    }
    if (vaBeginPicture(vactx->display, vactx->context_id,
                       surface) != VA_STATUS_SUCCESS)
        return -1;
    if (vaRenderPicture(vactx->display, vactx->context_id,
                        va_buffers, n_va_buffers) != VA_STATUS_SUCCESS)
        return -1;
    if (vaRenderPicture(vactx->display, vactx->context_id,
                        vactx->slice_buf_ids,
                        vactx->n_slice_buf_ids) != VA_STATUS_SUCCESS)
        return -1;
    if (vaEndPicture(vactx->display, vactx->context_id) != VA_STATUS_SUCCESS)
        return -1;
}


--- a/source.c
+++ b/source.c
@@ -23,9 +23,9 @@
         os->extra_packets[i][7] = (start_ts >> 24) & 0x7f;

         avio_write(os->out, os->extra_packets[i], os->extra_packet_sizes[i]);
+
+    }
+
+    return 0;
+
 }

static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts)

{

    int ret, i;

    ret = avio_open2(&os->out, os->temp_filename, AVIO_FLAG_WRITE,

                     &s->interrupt_callback, NULL);

    if (ret < 0)

        return ret;

    avio_wb32(os->out, 0);

    avio_wl32(os->out, MKTAG('m','d','a','t'));

    for (i = 0; i < os->nb_extra_packets; i++) {

        AV_WB24(os->extra_packets[i] + 4, start_ts);

        os->extra_packets[i][7] = (start_ts >> 24) & 0x7f;

        avio_write(os->out, os->extra_packets[i], os->extra_packet_sizes[i]);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)
+
 {

     int opcode, len;

+    int retval = 0;
+
     const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl;

static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)

{

    int opcode, len;

    int retval = 0;

    const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl;

    opcode = le32_to_cpu(cmd->frame->dcmd.opcode);

    trace_megasas_handle_dcmd(cmd->index, opcode);

    len = megasas_map_dcmd(s, cmd);

    if (len < 0) {

        return MFI_STAT_MEMORY_NOT_AVAILABLE;

    }

    while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) {

        cmdptr++;

    }

    if (cmdptr->opcode == -1) {

        trace_megasas_dcmd_unhandled(cmd->index, opcode, len);

        retval = megasas_dcmd_dummy(s, cmd);

    } else {

        trace_megasas_dcmd_enter(cmd->index, cmdptr->desc, len);

        retval = cmdptr->func(s, cmd);

    }

    if (retval != MFI_STAT_INVALID_STATUS) {

        megasas_finish_dcmd(cmd, len);

    }

    return retval;

}


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

+#ifdef DEBUG_IDE
+
+    printf("bmdma: writeb 0x%02x : 0x%02x\n", addr, val);
+
+#endif

     switch (addr & 3) {

static void bmdma_write(void *opaque, target_phys_addr_t addr,

                        uint64_t val, unsigned size)

{

    BMDMAState *bm = opaque;

    if (size != 1) {

        return;

    }

#ifdef DEBUG_IDE

    printf("bmdma: writeb 0x%02x : 0x%02x\n", addr, val);

#endif

    switch (addr & 3) {

    case 0:

        bmdma_cmd_writeb(bm, val);

        break;

    case 2:

        bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);

        break;

    default:;

    }

}


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

+
     if (s->motion_val)

         free(s->motion_val);

void MPV_common_end(MpegEncContext *s)

{

    int i;

    if (s->motion_val)

        free(s->motion_val);

    if (s->h263_pred) {

        free(s->dc_val[0]);

        free(s->ac_val[0]);

        free(s->coded_block);

        free(s->mbintra_table);

    }

    if (s->mbskip_table)

        free(s->mbskip_table);

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

        free(s->last_picture_base[i]);

        free(s->next_picture_base[i]);

        if (s->has_b_frames)

            free(s->aux_picture_base[i]);

    }

    s->context_initialized = 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void cuda_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
+
 {

 }

static void cuda_writel (void *opaque, target_phys_addr_t addr, uint32_t value)

{

}


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

     st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);

+    if (!st->codec->extradata)
+
+        return AVERROR(ENOMEM);
+
+    st->codec->extradata_size = atom.size;

     get_buffer(pb, st->codec->extradata, atom.size);

static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)

{

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

    if((uint64_t)atom.size > (1<<30))

        return -1;

    av_free(st->codec->extradata);

    st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);

    if (!st->codec->extradata)

        return AVERROR(ENOMEM);

    st->codec->extradata_size = atom.size;

    get_buffer(pb, st->codec->extradata, atom.size);

    return 0;

}


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

     MSS12Context *c = &ctx->c;

+    int ret;
+
     c->avctx = avctx;

     avctx->coded_frame = &ctx->pic;

static av_cold int mss2_decode_init(AVCodecContext *avctx)

{

    MSS2Context * const ctx = avctx->priv_data;

    MSS12Context *c = &ctx->c;

    int ret;

    c->avctx = avctx;

    avctx->coded_frame = &ctx->pic;

    if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1]))

        return ret;

    c->pal_stride   = c->mask_stride;

    c->pal_pic      = av_malloc(c->pal_stride * avctx->height);

    c->last_pal_pic = av_malloc(c->pal_stride * avctx->height);

    if (!c->pal_pic || !c->last_pal_pic) {

        mss2_decode_end(avctx);

        return AVERROR(ENOMEM);

    }

    if (ret = wmv9_init(avctx)) {

        mss2_decode_end(avctx);

        return ret;

    }

    ff_mss2dsp_init(&ctx->dsp);

    avctx->pix_fmt = c->free_colours == 127 ? AV_PIX_FMT_RGB555

                                            : AV_PIX_FMT_RGB24;

    return 0;

}


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

     av_free(rt->rtsp_streams);

+    if (rt->asf_ctx) {
+
+        av_close_input_stream (rt->asf_ctx);
+
+        rt->asf_ctx = NULL;

     }

static void rtsp_close_streams(RTSPState *rt)

{

    int i;

    RTSPStream *rtsp_st;

    for(i=0;i<rt->nb_rtsp_streams;i++) {

        rtsp_st = rt->rtsp_streams[i];

        if (rtsp_st) {

            if (rtsp_st->transport_priv) {

                if (rt->transport == RTSP_TRANSPORT_RDT)

                    ff_rdt_parse_close(rtsp_st->transport_priv);

                else

                    rtp_parse_close(rtsp_st->transport_priv);

            }

            if (rtsp_st->rtp_handle)

                url_close(rtsp_st->rtp_handle);

            if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)

                rtsp_st->dynamic_handler->close(rtsp_st->dynamic_protocol_context);

        }

    }

    av_free(rt->rtsp_streams);

    if (rt->asf_ctx) {

        av_close_input_stream (rt->asf_ctx);

        rt->asf_ctx = NULL;

    }

    av_freep(&rt->auth_b64);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
 {
+    HEVCLocalContext *lc = s->HEVClc;
+    int *ret = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
+    int *arg = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
+    int offset;
+    int startheader, cmpt = 0;
     int i, j, res = 0;
     if (!s->sList[1]) {
         ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);

static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
{
    HEVCLocalContext *lc = s->HEVClc;
    int *ret = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
    int *arg = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
    int offset;
    int startheader, cmpt = 0;
    int i, j, res = 0;
    if (!s->sList[1]) {
        ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
        for (i = 1; i < s->threads_number; i++) {
            s->sList[i] = av_malloc(sizeof(HEVCContext));
            memcpy(s->sList[i], s, sizeof(HEVCContext));
            s->HEVClcList[i] = av_mallocz(sizeof(HEVCLocalContext));
            s->sList[i]->HEVClc = s->HEVClcList[i];
    offset = (lc->gb.index >> 3);
    for (j = 0, cmpt = 0, startheader = offset + s->sh.entry_point_offset[0]; j < s->skipped_bytes; j++) {
        if (s->skipped_bytes_pos[j] >= offset && s->skipped_bytes_pos[j] < startheader) {
            startheader--;
            cmpt++;
    for (i = 1; i < s->sh.num_entry_point_offsets; i++) {
        offset += (s->sh.entry_point_offset[i - 1] - cmpt);
        for (j = 0, cmpt = 0, startheader = offset
             + s->sh.entry_point_offset[i]; j < s->skipped_bytes; j++) {
            if (s->skipped_bytes_pos[j] >= offset && s->skipped_bytes_pos[j] < startheader) {
                startheader--;
                cmpt++;
        s->sh.size[i - 1] = s->sh.entry_point_offset[i] - cmpt;
        s->sh.offset[i - 1] = offset;
    if (s->sh.num_entry_point_offsets != 0) {
        offset += s->sh.entry_point_offset[s->sh.num_entry_point_offsets - 1] - cmpt;
        s->sh.size[s->sh.num_entry_point_offsets - 1] = length - offset;
        s->sh.offset[s->sh.num_entry_point_offsets - 1] = offset;
    s->data = nal;
    for (i = 1; i < s->threads_number; i++) {
        s->sList[i]->HEVClc->first_qp_group = 1;
        s->sList[i]->HEVClc->qp_y = s->sList[0]->HEVClc->qp_y;
        memcpy(s->sList[i], s, sizeof(HEVCContext));
        s->sList[i]->HEVClc = s->HEVClcList[i];
    avpriv_atomic_int_set(&s->wpp_err, 0);
    ff_reset_entries(s->avctx);
    for (i = 0; i <= s->sh.num_entry_point_offsets; i++) {
        arg[i] = i;
        ret[i] = 0;
    if (s->pps->entropy_coding_sync_enabled_flag)
        s->avctx->execute2(s->avctx, (void *) hls_decode_entry_wpp, arg, ret, s->sh.num_entry_point_offsets + 1);
    for (i = 0; i <= s->sh.num_entry_point_offsets; i++)
        res += ret[i];
    return res;


static void vc1_h_overlap_c(uint8_t* src, int stride)

{

    int i;

    int a, b, c, d;

    int d1, d2;

    int rnd = 1;

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

        a = src[-2];

        b = src[-1];

        c = src[0];

        d = src[1];

        d1 = (a - d + 3 + rnd) >> 3;

        d2 = (a - d + b - c + 4 - rnd) >> 3;

        src[-2] = a - d1;

        src[-1] = b - d2;

        src[0] = c + d2;

        src[1] = d + d1;

        src += stride;

        rnd = !rnd;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void gdb_breakpoint_remove_all(CPUState *env)
+
+{
+
     cpu_breakpoint_remove_all(env, BP_GDB);

 #ifndef CONFIG_USER_ONLY

static void gdb_breakpoint_remove_all(CPUState *env)

{

    cpu_breakpoint_remove_all(env, BP_GDB);

#ifndef CONFIG_USER_ONLY

    cpu_watchpoint_remove_all(env, BP_GDB);

#endif

}


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

         ics->irqs[i].priority = 0xff;

+        ics->irqs[i].saved_priority = 0xff;
+
+    }
+
+}

static void xics_reset(void *opaque)

{

    struct icp_state *icp = (struct icp_state *)opaque;

    struct ics_state *ics = icp->ics;

    int i;

    for (i = 0; i < icp->nr_servers; i++) {

        icp->ss[i].xirr = 0;

        icp->ss[i].pending_priority = 0;

        icp->ss[i].mfrr = 0xff;

        /* Make all outputs are deasserted */

        qemu_set_irq(icp->ss[i].output, 0);

    }

    for (i = 0; i < ics->nr_irqs; i++) {

        /* Reset everything *except* the type */

        ics->irqs[i].server = 0;

        ics->irqs[i].status = 0;

        ics->irqs[i].priority = 0xff;

        ics->irqs[i].saved_priority = 0xff;

    }

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
                      MemoryRegion *address_space_io, bool bridges_enabled)

 {
+
+    s->io_len = ACPI_PCIHP_SIZE;
+
+    s->io_base = ACPI_PCIHP_ADDR;
+

     s->root= root_bus;

void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus,

                     MemoryRegion *address_space_io, bool bridges_enabled)

{

    s->io_len = ACPI_PCIHP_SIZE;

    s->io_base = ACPI_PCIHP_ADDR;

    s->root= root_bus;

    s->legacy_piix = !bridges_enabled;

    if (s->legacy_piix) {

        unsigned *bus_bsel = g_malloc(sizeof *bus_bsel);

        s->io_len = ACPI_PCIHP_LEGACY_SIZE;

        *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT;

        object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL,

                                       bus_bsel, NULL);

    }

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

                          "acpi-pci-hotplug", s->io_len);

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

    object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base,

                                   &error_abort);

    object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len,

                                   &error_abort);

}


--- a/source.c
+++ b/source.c
@@ -14,11 +14,11 @@
                             NULL, NULL, NULL, NULL, 0, ctx);
         if (ret < 0)
         i++;
+        if (bufptr && *bufptr == ':') { /* found last expression */
+            bufptr++;
+            break;
+        buf = NULL;
+    eval->nb_channels = i;
     if (bufptr && (ret = av_set_options_string(eval, bufptr, "=", ":")) < 0)
     if (eval->chlayout_str) {
         int n;

static int init(AVFilterContext *ctx, const char *args)
{
    EvalContext *eval = ctx->priv;
    char *args1 = av_strdup(args);
    char *expr, *buf, *bufptr;
    int ret, i;
    eval->class = &aevalsrc_class;
    av_opt_set_defaults(eval);
    /* parse expressions */
    buf = args1;
    i = 0;
    while (expr = av_strtok(buf, ":", &bufptr)) {
        ret = av_expr_parse(&eval->expr[i], expr, var_names,
                            NULL, NULL, NULL, NULL, 0, ctx);
        if (ret < 0)
        i++;
        if (bufptr && *bufptr == ':') { /* found last expression */
            bufptr++;
            break;
        buf = NULL;
    eval->nb_channels = i;
    if (bufptr && (ret = av_set_options_string(eval, bufptr, "=", ":")) < 0)
    if (eval->chlayout_str) {
        int n;
        ret = ff_parse_channel_layout(&eval->chlayout, eval->chlayout_str, ctx);
        if (ret < 0)
        n = av_get_channel_layout_nb_channels(eval->chlayout);
        if (n != eval->nb_channels) {
            av_log(ctx, AV_LOG_ERROR,
                   "Mismatch between the specified number of channels '%d' "
                   "and the number of channels '%d' in the specified channel layout '%s'\n",
                   eval->nb_channels, n, eval->chlayout_str);
            ret = AVERROR(EINVAL);
    } else {
        /* guess channel layout from nb expressions/channels */
        eval->chlayout = av_get_default_channel_layout(eval->nb_channels);
        if (!eval->chlayout) {
            av_log(ctx, AV_LOG_ERROR, "Invalid number of channels '%d' provided\n",
                   eval->nb_channels);
            ret = AVERROR(EINVAL);
    if ((ret = ff_parse_sample_rate(&eval->sample_rate, eval->sample_rate_str, ctx)))
    eval->duration = -1;
    if (eval->duration_str) {
        int64_t us = -1;
        if ((ret = av_parse_time(&us, eval->duration_str, 1)) < 0) {
            av_log(ctx, AV_LOG_ERROR, "Invalid duration: '%s'\n", eval->duration_str);
        eval->duration = (double)us / 1000000;
    eval->n = 0;
end:
    av_free(args1);
    return ret;


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

+    return s->enabled_capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE];
+
+}

bool migrate_auto_converge(void)

{

    MigrationState *s;

    s = migrate_get_current();

    return s->enabled_capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE];

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 void visit_start_alternate(Visitor *v, const char *name,

                            GenericAlternate **obj, size_t size,
+
                            bool promote_int, Error **errp)

 {
+
     Error *err = NULL;

void visit_start_alternate(Visitor *v, const char *name,

                           GenericAlternate **obj, size_t size,

                           bool promote_int, Error **errp)

{

    Error *err = NULL;

    assert(obj && size >= sizeof(GenericAlternate));

    assert(v->type != VISITOR_OUTPUT || *obj);

    if (v->start_alternate) {

        v->start_alternate(v, name, obj, size, promote_int, &err);

    }

    if (v->type == VISITOR_INPUT) {

        assert(v->start_alternate && !err != !*obj);

    }

    error_propagate(errp, err);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void virtio_scsi_exit(VirtIODevice *vdev)

 {
+
+

     virtio_cleanup(vdev);

void virtio_scsi_exit(VirtIODevice *vdev)

{

    virtio_cleanup(vdev);

}


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

+	if (bind(so->s,(struct sockaddr *)&addr, addrlen) < 0) {
+
+		udp_detach(so);
+
+

 	socket_set_fast_reuse(so->s);

udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr,

           u_int lport, int flags)

{

	struct sockaddr_in addr;

	struct socket *so;

	socklen_t addrlen = sizeof(struct sockaddr_in);

	so = socreate(slirp);

	if (!so) {

	so->s = qemu_socket(AF_INET,SOCK_DGRAM,0);

	so->so_expire = curtime + SO_EXPIRE;

	insque(so, &slirp->udb);

	addr.sin_family = AF_INET;

	addr.sin_addr.s_addr = haddr;

	addr.sin_port = hport;

	if (bind(so->s,(struct sockaddr *)&addr, addrlen) < 0) {

		udp_detach(so);

	socket_set_fast_reuse(so->s);

	getsockname(so->s,(struct sockaddr *)&addr,&addrlen);

	so->fhost.sin = addr;

	sotranslate_accept(so);

	so->so_lfamily = AF_INET;

	so->so_lport = lport;

	so->so_laddr.s_addr = laddr;

	if (flags != SS_FACCEPTONCE)

	   so->so_expire = 0;

	so->so_state &= SS_PERSISTENT_MASK;

	so->so_state |= SS_ISFCONNECTED | flags;

	return so;


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int mkv_field_order(MatroskaDemuxContext *matroska, int64_t field_order)

+{

     int major, minor, micro, bttb = 0;

static int mkv_field_order(MatroskaDemuxContext *matroska, int64_t field_order)

{

    int major, minor, micro, bttb = 0;

    /* workaround a bug in our Matroska muxer, introduced in version 57.36 alongside

     * this function, and fixed in 57.52 */

    if (sscanf(matroska->muxingapp, "Lavf%d.%d.%d", &major, &minor, &micro) == 3)

        bttb = (major == 57 && minor >= 36 && minor <= 51 && micro >= 100);

    switch (field_order) {

    case MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE:

        return AV_FIELD_PROGRESSIVE;

    case MATROSKA_VIDEO_FIELDORDER_UNDETERMINED:

        return AV_FIELD_UNKNOWN;

    case MATROSKA_VIDEO_FIELDORDER_TT:

        return AV_FIELD_TT;

    case MATROSKA_VIDEO_FIELDORDER_BB:

        return AV_FIELD_BB;

    case MATROSKA_VIDEO_FIELDORDER_BT:

        return bttb ? AV_FIELD_TB : AV_FIELD_BT;

    case MATROSKA_VIDEO_FIELDORDER_TB:

        return bttb ? AV_FIELD_BT : AV_FIELD_TB;

    default:

        return AV_FIELD_UNKNOWN;

    }

}


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

     if (!bus) {
+
+        return;
+
+    }
+
     QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {

         DeviceState *qdev = kid->child;

static void acpi_pcihp_update_hotplug_bus(AcpiPciHpState *s, int bsel)

{

    BusChild *kid, *next;

    PCIBus *bus = acpi_pcihp_find_hotplug_bus(s, bsel);

    /* Execute any pending removes during reset */

    while (s->acpi_pcihp_pci_status[bsel].down) {

        acpi_pcihp_eject_slot(s, bsel, s->acpi_pcihp_pci_status[bsel].down);

    }

    s->acpi_pcihp_pci_status[bsel].hotplug_enable = ~0;

    s->acpi_pcihp_pci_status[bsel].device_present = 0;

    if (!bus) {

        return;

    }

    QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {

        DeviceState *qdev = kid->child;

        PCIDevice *pdev = PCI_DEVICE(qdev);

        int slot = PCI_SLOT(pdev->devfn);

        if (acpi_pcihp_pc_no_hotplug(s, pdev)) {

            s->acpi_pcihp_pci_status[bsel].hotplug_enable &= ~(1U << slot);

        }

        s->acpi_pcihp_pci_status[bsel].device_present |= (1U << slot);

    }

}


--- a/source.c
+++ b/source.c
@@ -7,9 +7,9 @@
         gen_exception(ctx, POWERPC_EXCP_APU);

         return;
+
+    }
+
     tcg_gen_andi_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], (target_long)~0x80000000LL);

 }

static inline void gen_efsabs(DisasContext *ctx)

{

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

        gen_exception(ctx, POWERPC_EXCP_APU);

        return;

    }

    tcg_gen_andi_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], (target_long)~0x80000000LL);

}


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

             g_string_append_printf(sov->string, "%" PRId64 "-%" PRId64,

+                                   r->begin, r->end - 1);
+
+        }
+
+    } else {

         if (human) {

static void format_string(StringOutputVisitor *sov, Range *r, bool next,

                          bool human)

{

    if (r->end - r->begin > 1) {

        if (human) {

            g_string_append_printf(sov->string, "0x%" PRIx64 "-0x%" PRIx64,

                                   r->begin, r->end - 1);

        } else {

            g_string_append_printf(sov->string, "%" PRId64 "-%" PRId64,

                                   r->begin, r->end - 1);

        }

    } else {

        if (human) {

            g_string_append_printf(sov->string, "0x%" PRIx64, r->begin);

        } else {

            g_string_append_printf(sov->string, "%" PRId64, r->begin);

        }

    }

    if (next) {

        g_string_append(sov->string, ",");

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void spr_write_40x_dbcr0 (void *opaque, int sprn)

 {
+
+    DisasContext *ctx = opaque;
+

     gen_op_store_40x_dbcr0();

static void spr_write_40x_dbcr0 (void *opaque, int sprn)

{

    DisasContext *ctx = opaque;

    gen_op_store_40x_dbcr0();

    /* We must stop translation as we may have rebooted */

    RET_STOP(ctx);

}


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

     int i;
+
+
+
+    if (s->iformat->read_close)
+
         s->iformat->read_close(s);

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

void av_close_input_file(AVFormatContext *s)

{

    int i;

    if (s->iformat->read_close)

        s->iformat->read_close(s);

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

        av_free(s->streams[i]);

    }

    if (s->packet_buffer) {

        AVPacketList *p, *p1;

        p = s->packet_buffer;

        while (p != NULL) {

            p1 = p->next;

            av_free_packet(&p->pkt);

            av_free(p);

            p = p1;

        }

        s->packet_buffer = NULL;

    }

    if (!(s->iformat->flags & AVFMT_NOFILE)) {

        url_fclose(&s->pb);

    }

    av_free(s->priv_data);

    av_free(s);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW,

+                         int big_endian, int output_bits)

 {

yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW,

                         int big_endian, int output_bits)

{

    int i;

    int shift = 19 - output_bits;

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

        int val = src[i] + (1 << (shift - 1));

        output_pixel(&dest[i], val, 0, uint);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 int bdrv_pwritev(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov)

+{
+
+    int ret;
+
+

     ret = bdrv_prwv_co(bs, offset, qiov, true, 0);

int bdrv_pwritev(BlockDriverState *bs, int64_t offset, QEMUIOVector *qiov)

{

    int ret;

    ret = bdrv_prwv_co(bs, offset, qiov, true, 0);

    if (ret < 0) {

        return ret;

    }

    return qiov->size;

}


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

     dcl->ds = get_alloc_displaystate();

+    QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next);
+
     gui_setup_refresh(dcl->ds);

     if (dcl->con) {

void register_displaychangelistener(DisplayChangeListener *dcl)

{

    QemuConsole *con;

    trace_displaychangelistener_register(dcl, dcl->ops->dpy_name);

    dcl->ds = get_alloc_displaystate();

    QLIST_INSERT_HEAD(&dcl->ds->listeners, dcl, next);

    gui_setup_refresh(dcl->ds);

    if (dcl->con) {

        dcl->con->dcls++;

        con = dcl->con;

    } else {

        con = active_console;

    }

    if (dcl->ops->dpy_gfx_switch && con) {

        dcl->ops->dpy_gfx_switch(dcl, con->surface);

    }

}


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

     fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
+
+    return 0;

 }

static int fw_cfg_boot_set(void *opaque, const char *boot_device)

{

    fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);

    return 0;

}


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

 {

     const char *ifname;
+

     ifname = qemu_opt_get(opts, "ifname");

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

{

    const char *ifname;

    ifname = qemu_opt_get(opts, "ifname");

    if (!ifname) {

        error_report("tap: no interface name");

        return -1;

    }

    if (tap_win32_init(vlan, "tap", name, ifname) == -1) {

        return -1;

    }

    return 0;

}


static int vmsa_ttbcr_raw_write(CPUARMState *env, const ARMCPRegInfo *ri,

                                uint64_t value)

{

    if (arm_feature(env, ARM_FEATURE_LPAE)) {

        value &= ~((7 << 19) | (3 << 14) | (0xf << 3));

    } else {

        value &= 7;

    }

    /* Note that we always calculate c2_mask and c2_base_mask, but

     * they are only used for short-descriptor tables (ie if EAE is 0);

     * for long-descriptor tables the TTBCR fields are used differently

     * and the c2_mask and c2_base_mask values are meaningless.

     */

    env->cp15.c2_control = value;

    env->cp15.c2_mask = ~(((uint32_t)0xffffffffu) >> value);

    env->cp15.c2_base_mask = ~((uint32_t)0x3fffu >> value);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
     blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EJECT, s->blocker);

     blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,
+
+                   s->blocker);
+
+    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT,
+
                    s->blocker);

     blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,

static void data_plane_set_up_op_blockers(VirtIOBlockDataPlane *s)

{

    assert(!s->blocker);

    error_setg(&s->blocker, "block device is in use by data plane");

    blk_op_block_all(s->conf->conf.blk, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_RESIZE, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_DRIVE_DEL, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_BACKUP_SOURCE, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_CHANGE, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_SOURCE, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_COMMIT_TARGET, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EJECT, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT,

                   s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT,

                   s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT_DELETE,

                   s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_MIRROR_SOURCE, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_STREAM, s->blocker);

    blk_op_unblock(s->conf->conf.blk, BLOCK_OP_TYPE_REPLACE, s->blocker);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+uint32_t ldl_be_phys(target_phys_addr_t addr)

 {

uint32_t ldl_be_phys(target_phys_addr_t addr)

{

    return ldl_phys_internal(addr, DEVICE_BIG_ENDIAN);

}


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

 {

+    GenericList *list = *listp;
+
+    QmpOutputVisitor *qov = to_qov(v);
+
+    QStackEntry *e = QTAILQ_FIRST(&qov->stack);

static GenericList *qmp_output_next_list(Visitor *v, GenericList **listp,

                                         size_t size)

{

    GenericList *list = *listp;

    QmpOutputVisitor *qov = to_qov(v);

    QStackEntry *e = QTAILQ_FIRST(&qov->stack);

    assert(e);

    if (e->is_list_head) {

        e->is_list_head = false;

        return list;

    }

    return list ? list->next : NULL;

}


--- a/source.c
+++ b/source.c
@@ -39,11 +39,11 @@
         if ((ret = alloc_buffer(s, ist, &buf)) < 0)

             return ret;
+
+    }
+
+    buf->refcount++;
+

     frame->opaque        = buf;

static int codec_get_buffer(AVCodecContext *s, AVFrame *frame)

{

    InputStream *ist = s->opaque;

    FrameBuffer *buf;

    int ret, i;

    if(av_image_check_size(s->width, s->height, 0, s))

        return -1;

    if (!ist->buffer_pool && (ret = alloc_buffer(s, ist, &ist->buffer_pool)) < 0)

        return ret;

    buf              = ist->buffer_pool;

    ist->buffer_pool = buf->next;

    buf->next        = NULL;

    if (buf->w != s->width || buf->h != s->height || buf->pix_fmt != s->pix_fmt) {

        av_freep(&buf->base[0]);

        av_free(buf);

        ist->dr1 = 0;

        if ((ret = alloc_buffer(s, ist, &buf)) < 0)

            return ret;

    }

    buf->refcount++;

    frame->opaque        = buf;

    frame->type          = FF_BUFFER_TYPE_USER;

    frame->extended_data = frame->data;

    frame->pkt_pts       = s->pkt ? s->pkt->pts : AV_NOPTS_VALUE;

    for (i = 0; i < FF_ARRAY_ELEMS(buf->data); i++) {

        frame->base[i]     = buf->base[i];  // XXX h264.c uses base though it shouldn't

        frame->data[i]     = buf->data[i];

        frame->linesize[i] = buf->linesize[i];

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int clv_decode_frame(AVCodecContext *avctx, void *data,
                             int *got_frame, AVPacket *avpkt)
+{
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
+    CLVContext *c = avctx->priv_data;
+    GetByteContext gb;
     uint32_t frame_type;
     int i, j;
     int ret;

static int clv_decode_frame(AVCodecContext *avctx, void *data,
                            int *got_frame, AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    CLVContext *c = avctx->priv_data;
    GetByteContext gb;
    uint32_t frame_type;
    int i, j;
    int ret;
    int mb_ret = 0;
    bytestream2_init(&gb, buf, buf_size);
    if (avctx->codec_tag == MKTAG('C','L','V','1')) {
        int skip = bytestream2_get_byte(&gb);
        bytestream2_skip(&gb, (skip + 1) * 8);
    frame_type = bytestream2_get_byte(&gb);
    if ((ret = ff_reget_buffer(avctx, c->pic)) < 0)
        return ret;
    c->pic->key_frame = frame_type & 0x20 ? 1 : 0;
    c->pic->pict_type = frame_type & 0x20 ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
    if (frame_type & 0x2) {
        bytestream2_get_be32(&gb); // frame size;
        c->ac_quant        = bytestream2_get_byte(&gb);
        c->luma_dc_quant   = 32;
        c->chroma_dc_quant = 32;
        if ((ret = init_get_bits8(&c->gb, buf + bytestream2_tell(&gb),
                                  (buf_size - bytestream2_tell(&gb)))) < 0)
            return ret;
        for (i = 0; i < 3; i++)
            c->top_dc[i] = 32;
        for (i = 0; i < 4; i++)
            c->left_dc[i] = 32;
        for (j = 0; j < c->mb_height; j++) {
            for (i = 0; i < c->mb_width; i++) {
                ret = decode_mb(c, i, j);
                if (ret < 0)
                    mb_ret = ret;
    } else {
    if ((ret = av_frame_ref(data, c->pic)) < 0)
        return ret;
    *got_frame = 1;
    return mb_ret < 0 ? mb_ret : buf_size;


--- a/source.c
+++ b/source.c
@@ -8,7 +8,7 @@
 #ifdef CONFIG_TRACE_FTRACE
     if (!ftrace_init()) {
         fprintf(stderr, "failed to initialize ftrace backend.\n");
+        return false;
+    }
+    return true;
 }

bool trace_init_backends(void)
{
#ifdef CONFIG_TRACE_SIMPLE
    if (!st_init()) {
        fprintf(stderr, "failed to initialize simple tracing backend.\n");
        return false;
    }
#ifdef CONFIG_TRACE_FTRACE
    if (!ftrace_init()) {
        fprintf(stderr, "failed to initialize ftrace backend.\n");
        return false;
    }
    return true;
}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
 static int usb_net_handle_statusin(USBNetState *s, USBPacket *p)

+{
+
+    int ret = 8;

+

+    if (p->len < 8)
+
+        return USB_RET_STALL;
+
+

+    ((le32 *) p->data)[0] = cpu_to_le32(1);

     ((le32 *) p->data)[1] = cpu_to_le32(0);

static int usb_net_handle_statusin(USBNetState *s, USBPacket *p)

{

    int ret = 8;

    if (p->len < 8)

        return USB_RET_STALL;

    ((le32 *) p->data)[0] = cpu_to_le32(1);

    ((le32 *) p->data)[1] = cpu_to_le32(0);

    if (!s->rndis_resp.tqh_first)

        ret = USB_RET_NAK;

#ifdef TRAFFIC_DEBUG

    fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret);

    {

        int i;

        fprintf(stderr, ":");

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

            if (!(i & 15))

                fprintf(stderr, "\n%04x:", i);

            fprintf(stderr, " %02x", p->data[i]);

        }

        fprintf(stderr, "\n\n");

    }

#endif

    return ret;

}


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

             ret = send_full_color_rect(vs, x, y, w, h);
+
+        }
+
+    } else if (colors == 1) {
+
         ret = send_solid_rect(vs);

     } else if (colors == 2) {

static int send_sub_rect_nojpeg(VncState *vs, int x, int y, int w, int h,

                                int bg, int fg, int colors, VncPalette *palette)

{

    int ret;

    if (colors == 0) {

        if (tight_detect_smooth_image(vs, w, h)) {

            ret = send_gradient_rect(vs, x, y, w, h);

            ret = send_full_color_rect(vs, x, y, w, h);

        }

    } else if (colors == 1) {

        ret = send_solid_rect(vs);

    } else if (colors == 2) {

        ret = send_mono_rect(vs, x, y, w, h, bg, fg);

    } else if (colors <= 256) {

        ret = send_palette_rect(vs, x, y, w, h, palette);

    }

    return ret;

}


void op_ddiv (void)

{

    if (T1 != 0) {

        env->LO = (int64_t)T0 / (int64_t)T1;

        env->HI = (int64_t)T0 % (int64_t)T1;

    }

    RETURN();

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
+static uint32_t suov32(CPUTriCoreState *env, int64_t arg)

+{

     uint32_t ret;

     int64_t max_pos = UINT32_MAX;

+    if (arg > max_pos) {
+
+        env->PSW_USB_V = (1 << 31);
+
         env->PSW_USB_SV = (1 << 31);
+
+        ret = (target_ulong)max_pos;

     } else {

static uint32_t suov32(CPUTriCoreState *env, int64_t arg)

{

    uint32_t ret;

    int64_t max_pos = UINT32_MAX;

    if (arg > max_pos) {

        env->PSW_USB_V = (1 << 31);

        env->PSW_USB_SV = (1 << 31);

        ret = (target_ulong)max_pos;

    } else {

        if (arg < 0) {

            env->PSW_USB_V = (1 << 31);

            env->PSW_USB_SV = (1 << 31);

            ret = 0;

        } else {

            env->PSW_USB_V = 0;

            ret = (target_ulong)arg;

        }

     }

    env->PSW_USB_AV = arg ^ arg * 2u;

    env->PSW_USB_SAV |= env->PSW_USB_AV;

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -2,5 +2,5 @@
 {
     BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+    if (k->notify) {
         k->notify(qbus->parent, vector);

static void virtio_notify_vector(VirtIODevice *vdev, uint16_t vector)
{
    BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
    if (k->notify) {
        k->notify(qbus->parent, vector);


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

 {

+    uint32_t ret = cadence_ttc_read_imp(opaque, offset);
+
+

     DB_PRINT("addr: %08x data: %08x\n", offset, ret);

static uint64_t cadence_ttc_read(void *opaque, target_phys_addr_t offset,

    unsigned size)

{

    uint32_t ret = cadence_ttc_read_imp(opaque, offset);

    DB_PRINT("addr: %08x data: %08x\n", offset, ret);

    return ret;

}


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

 {

+    UserDefFlatUnion2 *tmp = NULL;
+
     Error *err = NULL;

     Visitor *v;

static void test_validate_fail_union_flat_no_discrim(TestInputVisitorData *data,

                                                     const void *unused)

{

    UserDefFlatUnion2 *tmp = NULL;

    Error *err = NULL;

    Visitor *v;

    /* test situation where discriminator field ('enum1' here) is missing */

    v = validate_test_init(data, "{ 'integer': 42, 'string': 'c', 'string1': 'd', 'string2': 'e' }");

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

    g_assert(err);

    error_free(err);

    qapi_free_UserDefFlatUnion2(tmp);

}


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

     return chmod(rpath(ctx, path), mode);
+
 }

static int local_chmod(FsContext *ctx, const char *path, mode_t mode)

{

    return chmod(rpath(ctx, path), mode);

}


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

     s->rx_wpos = 0;

+    s->rx_count = 0;
+
+    qemu_chr_accept_input(s->chr);
+

     s->r[R_SR] |= UART_SR_INTR_REMPTY;

static void uart_rx_reset(UartState *s)

{

    s->rx_wpos = 0;

    s->rx_count = 0;

    qemu_chr_accept_input(s->chr);

    s->r[R_SR] |= UART_SR_INTR_REMPTY;

    s->r[R_SR] &= ~UART_SR_INTR_RFUL;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
                 /* non-idle bottom halves will be executed

                  * immediately */
+
+                *timeout = 0;
+
+                break;
+
             }

         }

void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout)

{

    QEMUBH *bh;

    for (bh = ctx->first_bh; bh; bh = bh->next) {

        if (!bh->deleted && bh->scheduled) {

            if (bh->idle) {

                /* idle bottom halves will be polled at least

                 * every 10ms */

                *timeout = MIN(10, *timeout);

            } else {

                /* non-idle bottom halves will be executed

                 * immediately */

                *timeout = 0;

                break;

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -35,9 +35,9 @@
                       "size %u\n", __func__, offset, size);
         trace_gicv3_redist_badwrite(gicv3_redist_affid(cs), offset, data,
                                     size, attrs.secure);
+    } else {
+        trace_gicv3_redist_write(gicv3_redist_affid(cs), offset, data,
+                                 size, attrs.secure);
+    }
+    return r;
 }

MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data,
                               unsigned size, MemTxAttrs attrs)
{
    GICv3State *s = opaque;
    GICv3CPUState *cs;
    MemTxResult r;
    int cpuidx;
    /* This region covers all the redistributor pages; there are
     * (for GICv3) two 64K pages per CPU. At the moment they are
     * all contiguous (ie in this one region), though we might later
     * want to allow splitting of redistributor pages into several
     * blocks so we can support more CPUs.
     */
    cpuidx = offset / 0x20000;
    offset %= 0x20000;
    assert(cpuidx < s->num_cpu);
    cs = &s->cpu[cpuidx];
    switch (size) {
    case 1:
        r = gicr_writeb(cs, offset, data, attrs);
        break;
    case 4:
        r = gicr_writel(cs, offset, data, attrs);
        break;
    case 8:
        r = gicr_writell(cs, offset, data, attrs);
        break;
    default:
        r = MEMTX_ERROR;
        break;
    }
    if (r == MEMTX_ERROR) {
        qemu_log_mask(LOG_GUEST_ERROR,
                      "%s: invalid guest write at offset " TARGET_FMT_plx
                      "size %u\n", __func__, offset, size);
        trace_gicv3_redist_badwrite(gicv3_redist_affid(cs), offset, data,
                                    size, attrs.secure);
    } else {
        trace_gicv3_redist_write(gicv3_redist_affid(cs), offset, data,
                                 size, attrs.secure);
    }
    return r;
}


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

         (void)local_set_xattr(NULL, NULL);

+    return fsync(fd);
+
 }

static int local_fsync(FsContext *ctx, int fd)

{

    if (0) /* Just to supress the warning. Will be removed in next patch. */

        (void)local_set_xattr(NULL, NULL);

    return fsync(fd);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2],

+                     const int16_t *ubuf[2], const int16_t *vbuf[2],
+
                      const int16_t *abuf[2], uint8_t *dest, int dstW,

                      int yalpha, int uvalpha, int y,

yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2],

                     const int16_t *ubuf[2], const int16_t *vbuf[2],

                     const int16_t *abuf[2], uint8_t *dest, int dstW,

                     int yalpha, int uvalpha, int y,

                     enum PixelFormat target)

{

    const int16_t *buf0  = buf[0],  *buf1  = buf[1],

                  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],

                  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1];

    int  yalpha1 = 4095 - yalpha;

    int uvalpha1 = 4095 - uvalpha;

    int i;

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

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

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

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

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

        Y1 = av_clip_uint8(Y1);

        Y2 = av_clip_uint8(Y2);

        U  = av_clip_uint8(U);

        V  = av_clip_uint8(V);

        output_pixels(i * 4, Y1, U, Y2, V);

    }

}


--- a/source.c
+++ b/source.c
@@ -15,10 +15,10 @@
         return;
     if (has_format && (format == DATA_FORMAT_BASE64)) {
         write_data = g_base64_decode(data, &write_count);
+    } else {
+        write_data = (uint8_t *)data;
+        write_count = strlen(data);
+    ret = cirmem_chr_write(chr, write_data, write_count);
+    if (ret < 0) {
         error_setg(errp, "Failed to write to device %s", device);
         return;

void qmp_memchar_write(const char *device, const char *data,
                       bool has_format, enum DataFormat format,
                       Error **errp)
{
    CharDriverState *chr;
    const uint8_t *write_data;
    int ret;
    size_t write_count;
    chr = qemu_chr_find(device);
    if (!chr) {
        error_setg(errp, "Device '%s' not found", device);
        return;
    if (qemu_is_chr(chr, "memory")) {
        error_setg(errp,"%s is not memory char device", device);
        return;
    if (has_format && (format == DATA_FORMAT_BASE64)) {
        write_data = g_base64_decode(data, &write_count);
    } else {
        write_data = (uint8_t *)data;
        write_count = strlen(data);
    ret = cirmem_chr_write(chr, write_data, write_count);
    if (ret < 0) {
        error_setg(errp, "Failed to write to device %s", device);
        return;


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+START_TEST(qdict_get_try_int_test)
+
+{
+
+    int ret;

     const int value = 100;

START_TEST(qdict_get_try_int_test)

{

    int ret;

    const int value = 100;

    const char *key = "int";

    qdict_put(tests_dict, key, qint_from_int(value));

    ret = qdict_get_try_int(tests_dict, key, 0);

    fail_unless(ret == value);

}


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

     return kvmppc_read_int_cpu_dt("ibm,dfp");

+}

uint32_t kvmppc_get_dfp(void)

{

    return kvmppc_read_int_cpu_dt("ibm,dfp");

}


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

             if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)

+                video_streams_nb++;
+
+            else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
+
+                audio_streams_nb++;

             else

static int mov_write_identification(AVIOContext *pb, AVFormatContext *s)

{

    MOVMuxContext *mov = s->priv_data;

    int i;

    mov_write_ftyp_tag(pb,s);

    if (mov->mode == MODE_PSP) {

        int video_streams_nb = 0, audio_streams_nb = 0, other_streams_nb = 0;

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

            AVStream *st = s->streams[i];

            if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)

                video_streams_nb++;

            else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)

                audio_streams_nb++;

            else

                other_streams_nb++;

            }

        if (video_streams_nb != 1 || audio_streams_nb != 1 || other_streams_nb) {

            av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n");

            return AVERROR(EINVAL);

        }

        mov_write_uuidprof_tag(pb, s);

    }

    return 0;

}


void OPPROTO op_check_subfo_64 (void)

{

    if (likely(!(((uint64_t)(~T2) ^ (uint64_t)T1 ^ UINT64_MAX) &

                 ((uint64_t)(~T2) ^ (uint64_t)T0) & (1ULL << 63)))) {

        xer_ov = 0;

    } else {

        xer_ov = 1;

        xer_so = 1;

    }

    RETURN();

}


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

+    fsle = qemu_malloc(sizeof(*fsle));
+
+
+
+    fsle->fse.fsdev_id = qemu_strdup(qemu_opts_id(opts));

     fsle->fse.path = qemu_strdup(qemu_opt_get(opts, "path"));

int qemu_fsdev_add(QemuOpts *opts)

{

    struct FsTypeListEntry *fsle;

    int i;

    if (qemu_opts_id(opts) == NULL) {

        fprintf(stderr, "fsdev: No id specified\n");

        return -1;

    }

     for (i = 0; i < ARRAY_SIZE(FsTypes); i++) {

        if (strcmp(FsTypes[i].name, qemu_opt_get(opts, "fstype")) == 0) {

            break;

        }

    }

    if (i == ARRAY_SIZE(FsTypes)) {

        fprintf(stderr, "fsdev: fstype %s not found\n",

                    qemu_opt_get(opts, "fstype"));

        return -1;

    }

    fsle = qemu_malloc(sizeof(*fsle));

    fsle->fse.fsdev_id = qemu_strdup(qemu_opts_id(opts));

    fsle->fse.path = qemu_strdup(qemu_opt_get(opts, "path"));

    fsle->fse.ops = FsTypes[i].ops;

    QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next);

    return 0;

}


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

+
+    bs->io_limits_enabled = false;
+
+
+
     for (i = 0; i < 2; i++) {

         while (qemu_co_enter_next(&bs->throttled_reqs[i])) {

static bool bdrv_start_throttled_reqs(BlockDriverState *bs)

{

    bool drained = false;

    bool enabled = bs->io_limits_enabled;

    int i;

    bs->io_limits_enabled = false;

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

        while (qemu_co_enter_next(&bs->throttled_reqs[i])) {

            drained = true;

        }

    }

    bs->io_limits_enabled = enabled;

    return drained;

}


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

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

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

+        virtio_gpu_resource_destroy(g, res);

     }

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

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

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

static void virtio_gpu_reset(VirtIODevice *vdev)

{

    VirtIOGPU *g = VIRTIO_GPU(vdev);

    struct virtio_gpu_simple_resource *res, *tmp;

    int i;

    g->enable = 0;

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

        virtio_gpu_resource_destroy(g, res);

    }

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

#if 0

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

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

        if (i == 0) {

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

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

        } else {

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

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

        }

#endif

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

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

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

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

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

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

    }

    g->enabled_output_bitmask = 1;

#ifdef CONFIG_VIRGL

    if (g->use_virgl_renderer) {

        virtio_gpu_virgl_reset(g);

        g->use_virgl_renderer = 0;

    }

#endif

}


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

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

         *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE;

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

{

    AVStream *st;

    enum AVAudioServiceType *ast;

    int ac3info, acmod, lfeon, bsmod;

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

        return 0;

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

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

                                                            sizeof(*ast));

    if (!ast)

        return AVERROR(ENOMEM);

    ac3info = avio_rb24(pb);

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

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

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

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

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

    if (lfeon)

        st->codec->channel_layout |= AV_CH_LOW_FREQUENCY;

    *ast = bsmod;

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

        *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE;

    st->codec->audio_service_type = *ast;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void report_unavailable_features(FeatureWord w, uint32_t mask)
+
+{
+
+    FeatureWordInfo *f = &feature_word_info[w];
+
     int i;

static void report_unavailable_features(FeatureWord w, uint32_t mask)

{

    FeatureWordInfo *f = &feature_word_info[w];

    int i;

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

        if ((1UL << i) & mask) {

            const char *reg = get_register_name_32(f->cpuid_reg);

            assert(reg);

            fprintf(stderr, "warning: %s doesn't support requested feature: "

                "CPUID.%02XH:%s%s%s [bit %d]\n",

                kvm_enabled() ? "host" : "TCG",

                f->cpuid_eax, reg,

                f->feat_names[i] ? "." : "",

                f->feat_names[i] ? f->feat_names[i] : "", i);

        }

    }

}


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

     if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS))

+        return;
+
+
+
+    if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) {

         wctx->writer->print_string(wctx, key, val);

static inline void writer_print_string(WriterContext *wctx,

                                       const char *key, const char *val, int opt)

{

    const struct section *section = wctx->section[wctx->level];

    if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS))

        return;

    if (section->show_all_entries || av_dict_get(section->entries_to_show, key, NULL, 0)) {

        wctx->writer->print_string(wctx, key, val);

        wctx->nb_item[wctx->level]++;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+build_qp_table(PPS *pps, int index)

 {
+
+    int i;

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

build_qp_table(PPS *pps, int index)

{

    int i;

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

        pps->chroma_qp_table[i & 0xff] = chroma_qp[av_clip(i + index, 0, 51)];

    pps->chroma_qp_index_offset = index;

}


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

 #if !defined(CONFIG_USER_ONLY)
@@ -18,9 +18,9 @@

     env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;

+    env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;

+    env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;

     env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;

static void init_excp_602 (CPUPPCState *env)

{

#if !defined(CONFIG_USER_ONLY)

    env->excp_vectors[POWERPC_EXCP_RESET]    = 0x00000100;

    env->excp_vectors[POWERPC_EXCP_MCHECK]   = 0x00000200;

    env->excp_vectors[POWERPC_EXCP_DSI]      = 0x00000300;

    env->excp_vectors[POWERPC_EXCP_ISI]      = 0x00000400;

    env->excp_vectors[POWERPC_EXCP_EXTERNAL] = 0x00000500;

    env->excp_vectors[POWERPC_EXCP_ALIGN]    = 0x00000600;

    env->excp_vectors[POWERPC_EXCP_PROGRAM]  = 0x00000700;

    env->excp_vectors[POWERPC_EXCP_FPU]      = 0x00000800;

    env->excp_vectors[POWERPC_EXCP_DECR]     = 0x00000900;

    env->excp_vectors[POWERPC_EXCP_SYSCALL]  = 0x00000C00;

    env->excp_vectors[POWERPC_EXCP_TRACE]    = 0x00000D00;

    env->excp_vectors[POWERPC_EXCP_FPA]      = 0x00000E00;

    env->excp_vectors[POWERPC_EXCP_IFTLB]    = 0x00001000;

    env->excp_vectors[POWERPC_EXCP_DLTLB]    = 0x00001100;

    env->excp_vectors[POWERPC_EXCP_DSTLB]    = 0x00001200;

    env->excp_vectors[POWERPC_EXCP_IABR]     = 0x00001300;

    env->excp_vectors[POWERPC_EXCP_SMI]      = 0x00001400;

    env->excp_vectors[POWERPC_EXCP_WDT]      = 0x00001500;

    env->excp_vectors[POWERPC_EXCP_EMUL]     = 0x00001600;

    env->excp_prefix = 0xFFF00000;

    /* Hardware reset vector */

    env->hreset_vector = 0xFFFFFFFCUL;

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void glib_pollfds_poll(void)
+
+{
+
+    GMainContext *context = g_main_context_default();

     GPollFD *pfds = &g_array_index(gpollfds, GPollFD, glib_pollfds_idx);

static void glib_pollfds_poll(void)

{

    GMainContext *context = g_main_context_default();

    GPollFD *pfds = &g_array_index(gpollfds, GPollFD, glib_pollfds_idx);

    if (g_main_context_check(context, max_priority, pfds, glib_n_poll_fds)) {

        g_main_context_dispatch(context);

    }

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     int sock = -1;

+
+    opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
+
+    if (inet_parse(opts, str) == 0) {
+
         if (block) {

             qemu_opt_set(opts, "block", "on");

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

{

    QemuOpts *opts;

    int sock = -1;

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

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

        if (block) {

            qemu_opt_set(opts, "block", "on");

        }

        sock = inet_connect_opts(opts, errp);

    } else {

        error_set(errp, QERR_SOCKET_CREATE_FAILED);

    }

    qemu_opts_del(opts);

    return sock;

}


--- a/source.c
+++ b/source.c
@@ -6,5 +6,5 @@
         return -ENOMEDIUM;
     if (!drv->bdrv_pwrite)
         return bdrv_pwrite_em(bs, offset, buf1, count1);
+    return drv->bdrv_pwrite(bs, offset, buf1, count1);
+}

int bdrv_pwrite(BlockDriverState *bs, int64_t offset,
                const void *buf1, int count1)
{
    BlockDriver *drv = bs->drv;
    if (!drv)
        return -ENOMEDIUM;
    if (!drv->bdrv_pwrite)
        return bdrv_pwrite_em(bs, offset, buf1, count1);
    return drv->bdrv_pwrite(bs, offset, buf1, count1);
}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+void net_slirp_smb(const char *exported_dir)

 {

+    struct in_addr vserver_addr = { .s_addr = 0 };

+    if (legacy_smb_export) {

         fprintf(stderr, "-smb given twice\n");

void net_slirp_smb(const char *exported_dir)

{

    struct in_addr vserver_addr = { .s_addr = 0 };

    if (legacy_smb_export) {

        fprintf(stderr, "-smb given twice\n");

        exit(1);

    }

    legacy_smb_export = exported_dir;

    if (!QTAILQ_EMPTY(&slirp_stacks)) {

        slirp_smb(QTAILQ_FIRST(&slirp_stacks), NULL, exported_dir,

                  vserver_addr);

    }

}


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

+{

     IB700State *s = IB700(dev);
+
+    PortioList *port_list = g_new(PortioList, 1);

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

{

    IB700State *s = IB700(dev);

    PortioList *port_list = g_new(PortioList, 1);

    ib700_debug("watchdog init\n");

    s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ib700_timer_expired, s);

    portio_list_init(port_list, OBJECT(s), wdt_portio_list, s, "ib700");

    portio_list_add(port_list, isa_address_space_io(&s->parent_obj), 0);

}


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

     PCIDevice *pci_dev = &proxy->pci_dev;

+
+
+    if (!(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_PCIE) &&
+
+        !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN)) {

         pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;

static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)

{

    VirtioPCIClass *vpciklass = VIRTIO_PCI_GET_CLASS(qdev);

    VirtIOPCIProxy *proxy = VIRTIO_PCI(qdev);

    PCIDevice *pci_dev = &proxy->pci_dev;

    if (!(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_PCIE) &&

        !(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN)) {

        pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;

    }

    vpciklass->parent_dc_realize(qdev, errp);

}


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

+    if(s->qlog == LOSSLESS_QLOG) return;

static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){

    const int w= b->width;

    const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);

    const int qmul= ff_qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);

    const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;

    int x,y;

    if(s->qlog == LOSSLESS_QLOG) return;

    for(y=start_y; y<end_y; y++){

//        DWTELEM * line = slice_buffer_get_line_from_address(sb, src + (y * stride));

        IDWTELEM * line = slice_buffer_get_line(sb, (y * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;

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

            int i= line[x];

            if(i<0){

                line[x]= -((-i*qmul + qadd)>>(QEXPSHIFT)); //FIXME try different bias

            }else if(i>0){

                line[x]=  (( i*qmul + qadd)>>(QEXPSHIFT));

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
+
+{
+
+    SCSIDevice *dev = SCSI_DEVICE(qdev);

static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)

{

    SCSIDevice *dev = SCSI_DEVICE(qdev);

    if (dev->vmsentry) {

        qemu_del_vm_change_state_handler(dev->vmsentry);

    }

    scsi_device_unrealize(dev, errp);

}


void helper_ldl_kernel(uint64_t t0, uint64_t t1)

{

    ldl_kernel(t1, t0);

}


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

     int err;
+
+    int fds[2];
+
+
+
     err = qemu_eventfd(fds);

     if (err == -1) {

static int qemu_event_init(void)

{

    int err;

    int fds[2];

    err = qemu_eventfd(fds);

    if (err == -1) {

        return -errno;

    }

    err = fcntl_setfl(fds[0], O_NONBLOCK);

    if (err < 0) {

        goto fail;

    }

    err = fcntl_setfl(fds[1], O_NONBLOCK);

    if (err < 0) {

        goto fail;

    }

    qemu_set_fd_handler2(fds[0], NULL, qemu_event_read, NULL,

                         (void *)(intptr_t)fds[0]);

    io_thread_fd = fds[1];

    return 0;

fail:

    close(fds[0]);

    close(fds[1]);

    return err;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 int qemu_pipe(int pipefd[2])

 {
+
     int ret;

+#ifdef CONFIG_PIPE2

     ret = pipe2(pipefd, O_CLOEXEC);

int qemu_pipe(int pipefd[2])

{

    int ret;

#ifdef CONFIG_PIPE2

    ret = pipe2(pipefd, O_CLOEXEC);

#else

    ret = pipe(pipefd);

    if (ret == 0) {

        qemu_set_cloexec(pipefd[0]);

        qemu_set_cloexec(pipefd[1]);

    }

#endif

    return ret;

}


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

     if (r < 0) {

+        virtio_scsi_free_req(req);
+
+        req = NULL;
+
+    }

     return req;

VirtIOSCSIReq *virtio_scsi_pop_req_vring(VirtIOSCSI *s,

                                         VirtIOSCSIVring *vring)

{

    VirtIOSCSIReq *req = virtio_scsi_init_req(s, NULL);

    int r;

    req->vring = vring;

    r = vring_pop((VirtIODevice *)s, &vring->vring, &req->elem);

    if (r < 0) {

        virtio_scsi_free_req(req);

        req = NULL;

    }

    return req;

}


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

     if (addr->type != SOCKET_ADDRESS_KIND_INET) {
+
+        error_setg(errp, "Not an inet socket type");
+
+        return NULL;
+
     }

     ret = g_strdup_printf("%s;%s", addr->u.inet->host, addr->u.inet->port);

vnc_socket_ip_addr_string(QIOChannelSocket *ioc,

                          bool local,

                          Error **errp)

{

    SocketAddress *addr;

    char *ret;

    if (local) {

        addr = qio_channel_socket_get_local_address(ioc, errp);

    } else {

        addr = qio_channel_socket_get_remote_address(ioc, errp);

    }

    if (!addr) {

        return NULL;

    }

    if (addr->type != SOCKET_ADDRESS_KIND_INET) {

        error_setg(errp, "Not an inet socket type");

        return NULL;

    }

    ret = g_strdup_printf("%s;%s", addr->u.inet->host, addr->u.inet->port);

    qapi_free_SocketAddress(addr);

    return ret;

}


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

 {

+    int ret = 2;

     int k = 1;
+

     while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) {

static av_always_inline int mvd_decode(HEVCContext *s)

{

    int ret = 2;

    int k = 1;

    while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) {

        ret += 1 << k;

        k++;

    }

    if (k == CABAC_MAX_BIN)

        av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k);

    while (k--)

        ret += get_cabac_bypass(&s->HEVClc->cc) << k;

    return get_cabac_bypass_sign(&s->HEVClc->cc, -ret);

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                               void *iommu, qemu_irq *dev_irq)

 {
+
     DeviceState *dev;

     SysBusDevice *s;

static void *sparc32_dma_init(target_phys_addr_t daddr, qemu_irq parent_irq,

                              void *iommu, qemu_irq *dev_irq)

{

    DeviceState *dev;

    SysBusDevice *s;

    dev = qdev_create(NULL, "sparc32_dma");

    qdev_prop_set_ptr(dev, "iommu_opaque", iommu);

    qdev_init(dev);

    s = sysbus_from_qdev(dev);

    sysbus_connect_irq(s, 0, parent_irq);

    *dev_irq = qdev_get_gpio_in(dev, 0);

    sysbus_mmio_map(s, 0, daddr);

    return s;

}


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

 {

+    return avfilter_init_filter(filter, args, NULL);

 }

int avfilter_init_str(AVFilterContext *filter, const char *args)

{

    return avfilter_init_filter(filter, args, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void ff_put_h264_qpel8_mc03_msa(uint8_t *dst, const uint8_t *src,

+                                ptrdiff_t stride)
+
 {

     avc_luma_vt_qrt_8w_msa(src - (stride * 2), stride, dst, stride, 8, 1);

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

                                ptrdiff_t stride)

{

    avc_luma_vt_qrt_8w_msa(src - (stride * 2), stride, dst, stride, 8, 1);

}


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

         return 1;

+
+
+    s->pfa_postreindex = av_malloc(15 * l_ptwo * sizeof(*s->pfa_postreindex));
+
+    if (!s->pfa_postreindex)

         return 1;

static inline int init_pfa_reindex_tabs(MDCT15Context *s)

{

    int i, j;

    const int b_ptwo = s->ptwo_fft.nbits; /* Bits for the power of two FFTs */

    const int l_ptwo = 1 << b_ptwo; /* Total length for the power of two FFTs */

    const int inv_1 = l_ptwo << ((4 - b_ptwo) & 3); /* (2^b_ptwo)^-1 mod 15 */

    const int inv_2 = 0xeeeeeeef & ((1U << b_ptwo) - 1); /* 15^-1 mod 2^b_ptwo */

    s->pfa_prereindex = av_malloc(15 * l_ptwo * sizeof(*s->pfa_prereindex));

    if (!s->pfa_prereindex)

        return 1;

    s->pfa_postreindex = av_malloc(15 * l_ptwo * sizeof(*s->pfa_postreindex));

    if (!s->pfa_postreindex)

        return 1;

    /* Pre/Post-reindex */

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

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

            const int q_pre = ((l_ptwo * j)/15 + i) >> b_ptwo;

            const int q_post = (((j*inv_1)/15) + (i*inv_2)) >> b_ptwo;

            const int k_pre = 15*i + ((j - q_pre*15) << b_ptwo);

            const int k_post = i*inv_2*15 + j*inv_1 - 15*q_post*l_ptwo;

            s->pfa_prereindex[i*15 + j] = k_pre;

            s->pfa_postreindex[k_post] = l_ptwo*j + i;

        }

    }

    return 0;

}


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

     init_get_clock();

static void init_timers(void)

{

    init_get_clock();

    rt_clock = qemu_new_clock(QEMU_TIMER_REALTIME);

    vm_clock = qemu_new_clock(QEMU_TIMER_VIRTUAL);

}


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

     int cpu_flags = av_get_cpu_flags();
+
+
+
+    if (EXTERNAL_SSE4(cpu_flags)) {
+
         if (bps > 16 && CONFIG_FLAC_DECODER)

             c->lpc = ff_flac_lpc_32_sse4;

av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt,

                                 int bps)

{

#if HAVE_YASM

    int cpu_flags = av_get_cpu_flags();

    if (EXTERNAL_SSE4(cpu_flags)) {

        if (bps > 16 && CONFIG_FLAC_DECODER)

            c->lpc = ff_flac_lpc_32_sse4;

    }

    if (EXTERNAL_XOP(cpu_flags)) {

        if (bps > 16)

            c->lpc = ff_flac_lpc_32_xop;

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     char *type, *dom;

+
     /* setup */

     dom = xs_get_domain_path(xenstore, con->xendev.dom);
+
     snprintf(con->console, sizeof(con->console), "%s/console", dom);

     free(dom);

static int con_init(struct XenDevice *xendev)

{

    struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);

    char *type, *dom;

    /* setup */

    dom = xs_get_domain_path(xenstore, con->xendev.dom);

    snprintf(con->console, sizeof(con->console), "%s/console", dom);

    free(dom);

    type = xenstore_read_str(con->console, "type");

    if (!type || strcmp(type, "ioemu") != 0) {

	xen_be_printf(xendev, 1, "not for me (type=%s)\n", type);

	return -1;

    }

    if (!serial_hds[con->xendev.dev])

	xen_be_printf(xendev, 1, "WARNING: serial line %d not configured\n",

                      con->xendev.dev);

    else

        con->chr = serial_hds[con->xendev.dev];

    return 0;

}


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

                                      XenPTReg *cfg_entry, uint16_t *val,

+                                     uint16_t dev_value, uint16_t valid_mask)
+
+{
+
+    XenPTRegInfo *reg = cfg_entry->reg;

     uint16_t writable_mask = 0;

static int xen_pt_msixctrl_reg_write(XenPCIPassthroughState *s,

                                     XenPTReg *cfg_entry, uint16_t *val,

                                     uint16_t dev_value, uint16_t valid_mask)

{

    XenPTRegInfo *reg = cfg_entry->reg;

    uint16_t writable_mask = 0;

    uint16_t throughable_mask = get_throughable_mask(s, reg, valid_mask);

    int debug_msix_enabled_old;

    /* modify emulate register */

    writable_mask = reg->emu_mask & ~reg->ro_mask & valid_mask;

    cfg_entry->data = XEN_PT_MERGE_VALUE(*val, cfg_entry->data, writable_mask);

    /* create value for writing to I/O device register */

    *val = XEN_PT_MERGE_VALUE(*val, dev_value, throughable_mask);

    /* update MSI-X */

    if ((*val & PCI_MSIX_FLAGS_ENABLE)

        && !(*val & PCI_MSIX_FLAGS_MASKALL)) {

        xen_pt_msix_update(s);

    } else if (!(*val & PCI_MSIX_FLAGS_ENABLE) && s->msix->enabled) {

        xen_pt_msix_disable(s);

    }

    debug_msix_enabled_old = s->msix->enabled;

    s->msix->enabled = !!(*val & PCI_MSIX_FLAGS_ENABLE);

    if (s->msix->enabled != debug_msix_enabled_old) {

        XEN_PT_LOG(&s->dev, "%s MSI-X\n",

                   s->msix->enabled ? "enable" : "disable");

    }

    return 0;

}


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

     while (!task.complete) {
+
+        nfs_set_events(client);
+
+        aio_poll(client->aio_context, true);
+
     }

static int64_t nfs_get_allocated_file_size(BlockDriverState *bs)

{

    NFSClient *client = bs->opaque;

    NFSRPC task = {0};

    struct stat st;

    if (bdrv_is_read_only(bs) &&

        !(bs->open_flags & BDRV_O_NOCACHE)) {

        return client->st_blocks * 512;

    }

    task.st = &st;

    if (nfs_fstat_async(client->context, client->fh, nfs_co_generic_cb,

                        &task) != 0) {

        return -ENOMEM;

    }

    while (!task.complete) {

        nfs_set_events(client);

        aio_poll(client->aio_context, true);

    }

    return (task.ret < 0 ? task.ret : st.st_blocks * 512);

}


cryptodev_builtin_get_aes_algo(uint32_t key_len, Error **errp)

{

    int algo;

    if (key_len == 128 / 8) {

        algo = QCRYPTO_CIPHER_ALG_AES_128;

    } else if (key_len == 192 / 8) {

        algo = QCRYPTO_CIPHER_ALG_AES_192;

    } else if (key_len == 256 / 8) {

        algo = QCRYPTO_CIPHER_ALG_AES_256;

    } else {

        error_setg(errp, "Unsupported key length :%u", key_len);

        return -1;

    }

    return algo;

}


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

 {

+    BlockDriverState *bs;
+
+    DriveInfo *dinfo;
+
+

     if (bs_snapshots)

static BlockDriverState *get_bs_snapshots(void)

{

    BlockDriverState *bs;

    DriveInfo *dinfo;

    if (bs_snapshots)

        return bs_snapshots;

    TAILQ_FOREACH(dinfo, &drives, next) {

        bs = dinfo->bdrv;

        if (bdrv_can_snapshot(bs))

            goto ok;

    }

    return NULL;

 ok:

    bs_snapshots = bs;

    return bs;

}


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

                      NetClientState *peer, Error **errp)

+{
+
+    const NetdevHubPortOptions *hubport;
+
+

     assert(opts->type == NET_CLIENT_OPTIONS_KIND_HUBPORT);

int net_init_hubport(const NetClientOptions *opts, const char *name,

                     NetClientState *peer, Error **errp)

{

    const NetdevHubPortOptions *hubport;

    assert(opts->type == NET_CLIENT_OPTIONS_KIND_HUBPORT);

    assert(!peer);

    hubport = opts->u.hubport;

    net_hub_add_port(hubport->hubid, name);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+uint64_t helper_addqv(CPUAlphaState *env, uint64_t op1, uint64_t op2)
+
+{
+
+    uint64_t tmp = op1;

+    op1 += op2;

     if (unlikely((tmp ^ op2 ^ (-1ULL)) & (tmp ^ op1) & (1ULL << 63))) {

uint64_t helper_addqv(CPUAlphaState *env, uint64_t op1, uint64_t op2)

{

    uint64_t tmp = op1;

    op1 += op2;

    if (unlikely((tmp ^ op2 ^ (-1ULL)) & (tmp ^ op1) & (1ULL << 63))) {

        arith_excp(env, GETPC(), EXC_M_IOV, 0);

    }

    return op1;

}


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

                    const uint8_t *src_data[4], const int src_linesizes[4],

+                   enum AVPixelFormat pix_fmt, int width, int height)
+
+{
+
+    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);

void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],

                   const uint8_t *src_data[4], const int src_linesizes[4],

                   enum AVPixelFormat pix_fmt, int width, int height)

{

    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);

    if (!desc || desc->flags & PIX_FMT_HWACCEL)

    if (desc->flags & PIX_FMT_PAL ||

        desc->flags & PIX_FMT_PSEUDOPAL) {

        av_image_copy_plane(dst_data[0], dst_linesizes[0],

                            src_data[0], src_linesizes[0],

                            width, height);

        /* copy the palette */

        memcpy(dst_data[1], src_data[1], 4*256);

    } else {

        int i, planes_nb = 0;

        for (i = 0; i < desc->nb_components; i++)

            planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1);

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

            int h = height;

            int bwidth = av_image_get_linesize(pix_fmt, width, i);

            if (i == 1 || i == 2) {

                h= -((-height)>>desc->log2_chroma_h);

            av_image_copy_plane(dst_data[i], dst_linesizes[i],

                                src_data[i], src_linesizes[i],

                                bwidth, h);


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

     kqemu_comm_base = 0xff000000 | 1;

+    qpi_io_memory = cpu_register_io_memory(
+
+                                           qpi_mem_read,
+
                                            qpi_mem_write, NULL);

     cpu_register_physical_memory(kqemu_comm_base & ~0xfff,

static void qpi_init(void)

{

    kqemu_comm_base = 0xff000000 | 1;

    qpi_io_memory = cpu_register_io_memory(

                                           qpi_mem_read,

                                           qpi_mem_write, NULL);

    cpu_register_physical_memory(kqemu_comm_base & ~0xfff,

                                 0x1000, qpi_io_memory);

}


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

             if (!p->vlc_state)

+                p->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState));
+
+            if (!p->vlc_state)
+
+                return AVERROR(ENOMEM);

         }

av_cold int ff_ffv1_init_slice_state(FFV1Context *f, FFV1Context *fs)

{

    int j;

    fs->plane_count  = f->plane_count;

    fs->transparency = f->transparency;

    for (j = 0; j < f->plane_count; j++) {

        PlaneContext *const p = &fs->plane[j];

        if (fs->ac) {

            if (!p->state)

                p->state = av_malloc_array(p->context_count, CONTEXT_SIZE *

                                     sizeof(uint8_t));

            if (!p->state)

                return AVERROR(ENOMEM);

        } else {

            if (!p->vlc_state)

                p->vlc_state = av_malloc_array(p->context_count, sizeof(VlcState));

            if (!p->vlc_state)

                return AVERROR(ENOMEM);

        }

    }

    if (fs->ac > 1) {

        //FIXME only redo if state_transition changed

        for (j = 1; j < 256; j++) {

            fs->c. one_state[      j] = f->state_transition[j];

            fs->c.zero_state[256 - j] = 256 - fs->c.one_state[j];

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s,
+
+                                      XenHostPCIDevice *dev)
+
 {

     uint16_t gpu_dev_id;

xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s,

                                      XenHostPCIDevice *dev)

{

    uint16_t gpu_dev_id;

    PCIDevice *d = &s->dev;

    gpu_dev_id = dev->device_id;

    igd_passthrough_isa_bridge_create(d->bus, gpu_dev_id);

}


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

 {

+    uint32_t tmp;
+
+    bool old_spsel = env->v7m.control & R_V7M_CONTROL_SPSEL_MASK;
+
+

     if (old_spsel != new_spsel) {

static void switch_v7m_sp(CPUARMState *env, bool new_spsel)

{

    uint32_t tmp;

    bool old_spsel = env->v7m.control & R_V7M_CONTROL_SPSEL_MASK;

    if (old_spsel != new_spsel) {

        tmp = env->v7m.other_sp;

        env->v7m.other_sp = env->regs[13];

        env->regs[13] = tmp;

        env->v7m.control = deposit32(env->v7m.control,

                                     R_V7M_CONTROL_SPSEL_SHIFT,

                                     R_V7M_CONTROL_SPSEL_LENGTH, new_spsel);

    }

}


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

         return ret;

+    pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+
+    pkt->stream_index = 0;
+
+    return 0;

 }

static int au_read_packet(AVFormatContext *s,

                          AVPacket *pkt)

{

    int ret;

    ret= av_get_packet(s->pb, pkt, BLOCK_SIZE *

                       s->streams[0]->codec->channels *

                       av_get_bits_per_sample(s->streams[0]->codec->codec_id) >> 3);

    if (ret < 0)

        return ret;

    pkt->flags &= ~AV_PKT_FLAG_CORRUPT;

    pkt->stream_index = 0;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
     if (mp3 && mp3->nb_frames_offset) {

         avio_seek(s->pb, mp3->nb_frames_offset, SEEK_SET);
+
+        avio_wb32(s->pb, s->streams[0]->nb_frames);
+
+        avio_seek(s->pb, 0, SEEK_END);
+
     }

static int mp3_write_trailer(struct AVFormatContext *s)

{

    uint8_t buf[ID3v1_TAG_SIZE];

    MP3Context *mp3 = s->priv_data;

    /* write the id3v1 tag */

    if (id3v1_create_tag(s, buf) > 0) {

        avio_write(s->pb, buf, ID3v1_TAG_SIZE);

    }

    /* write number of frames */

    if (mp3 && mp3->nb_frames_offset) {

        avio_seek(s->pb, mp3->nb_frames_offset, SEEK_SET);

        avio_wb32(s->pb, s->streams[0]->nb_frames);

        avio_seek(s->pb, 0, SEEK_END);

    }

    avio_flush(s->pb);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 ISADevice *isa_create(const char *name)

 {
+
+    DeviceState *dev;

ISADevice *isa_create(const char *name)

{

    DeviceState *dev;

    if (!isabus) {

        fprintf(stderr, "Tried to create isa device %s with no isa bus present.\n", name);

        return NULL;

    }

    dev = qdev_create(&isabus->qbus, name);

    return DO_UPCAST(ISADevice, qdev, dev);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void ich_ahci_register(void)

+{
+
     type_register_static(&ich_ahci_info);

     type_register_static_alias(&ich_ahci_info, "ahci");

static void ich_ahci_register(void)

{

    type_register_static(&ich_ahci_info);

    type_register_static_alias(&ich_ahci_info, "ahci");

}


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

     qemu_purge_queued_packets(nc);

+
+
+    if (s->down_script[0])
+
+        launch_script(s->down_script, s->down_script_arg, s->fd);

static void tap_cleanup(VLANClientState *nc)

{

    TAPState *s = DO_UPCAST(TAPState, nc, nc);

    if (s->vhost_net) {

        vhost_net_cleanup(s->vhost_net);

    }

    qemu_purge_queued_packets(nc);

    if (s->down_script[0])

        launch_script(s->down_script, s->down_script_arg, s->fd);

    tap_read_poll(s, 0);

    tap_write_poll(s, 0);

    close(s->fd);

}


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

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

     int err;

static void test_qemu_strtoul_whitespace(void)

{

    const char *str = "  \t  ";

    char f = 'X';

    const char *endptr = &f;

    unsigned long res = 999;

    int err;

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

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 0);

    g_assert(endptr == str);

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     sigemptyset(&set);

     sigaddset(&set, SIG_IPI);
+
+    sigaddset(&set, SIGIO);
+
+    sigaddset(&set, SIGALRM);
+
     sigaddset(&set, SIGBUS);

     sigaddset(&set, SIGINT);

static int qemu_signal_init(void)

{

    int sigfd;

    sigset_t set;

    /*

     * SIG_IPI must be blocked in the main thread and must not be caught

     * by sigwait() in the signal thread. Otherwise, the cpu thread will

     * not catch it reliably.

     */

    sigemptyset(&set);

    sigaddset(&set, SIG_IPI);

    sigaddset(&set, SIGIO);

    sigaddset(&set, SIGALRM);

    sigaddset(&set, SIGBUS);

    sigaddset(&set, SIGINT);

    sigaddset(&set, SIGHUP);

    sigaddset(&set, SIGTERM);

    pthread_sigmask(SIG_BLOCK, &set, NULL);

    sigdelset(&set, SIG_IPI);

    sigfd = qemu_signalfd(&set);

    if (sigfd == -1) {

        fprintf(stderr, "failed to create signalfd\n");

        return -errno;

    }

    fcntl_setfl(sigfd, O_NONBLOCK);

    qemu_set_fd_handler2(sigfd, NULL, sigfd_handler, NULL,

                         (void *)(intptr_t)sigfd);

    return 0;

}


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

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

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

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

{

	int i;

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

	{

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

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

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

		dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);

	}

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void usb_device_class_init(ObjectClass *klass, void *data)
+
+{
+
     DeviceClass *k = DEVICE_CLASS(klass);

     k->bus_type = TYPE_USB_BUS;

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

{

    DeviceClass *k = DEVICE_CLASS(klass);

    k->bus_type = TYPE_USB_BUS;

    k->init     = usb_qdev_init;

    k->unplug   = qdev_simple_unplug_cb;

    k->exit     = usb_qdev_exit;

    k->props    = usb_props;

}


static target_ulong helper_udiv_common(CPUSPARCState *env, target_ulong a,

                                       target_ulong b, int cc)

{

    SPARCCPU *cpu = sparc_env_get_cpu(env);

    int overflow = 0;

    uint64_t x0;

    uint32_t x1;

    x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32);

    x1 = (b & 0xffffffff);

    if (x1 == 0) {

        cpu_restore_state(CPU(cpu), GETPC());

        helper_raise_exception(env, TT_DIV_ZERO);

    }

    x0 = x0 / x1;

    if (x0 > 0xffffffff) {

        x0 = 0xffffffff;

        overflow = 1;

    }

    if (cc) {

        env->cc_dst = x0;

        env->cc_src2 = overflow;

        env->cc_op = CC_OP_DIV;

    }

    return x0;

}


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

                                hwaddr addr, uint32_t value)

+{
+
     taihu_cpld_writeb(opaque, addr, (value >> 8) & 0xFF);

     taihu_cpld_writeb(opaque, addr + 1, value & 0xFF);

static void taihu_cpld_writew (void *opaque,

                               hwaddr addr, uint32_t value)

{

    taihu_cpld_writeb(opaque, addr, (value >> 8) & 0xFF);

    taihu_cpld_writeb(opaque, addr + 1, value & 0xFF);

}


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

     relation = float32_compare(t0, t1, &env->fp_status);

+    if (unlikely(relation == float_relation_unordered)) {
+
+        update_fpscr(env, GETPC());
+
+    } else {

         env->sr_t = (relation == float_relation_equal);

void helper_fcmp_eq_FT(CPUSH4State *env, float32 t0, float32 t1)

{

    int relation;

    set_float_exception_flags(0, &env->fp_status);

    relation = float32_compare(t0, t1, &env->fp_status);

    if (unlikely(relation == float_relation_unordered)) {

        update_fpscr(env, GETPC());

    } else {

        env->sr_t = (relation == float_relation_equal);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void pxb_pcie_dev_realize(PCIDevice *dev, Error **errp)
+
+{
+
+    if (!pci_bus_is_express(dev->bus)) {

         error_setg(errp, "pxb-pcie devices cannot reside on a PCI bus");

static void pxb_pcie_dev_realize(PCIDevice *dev, Error **errp)

{

    if (!pci_bus_is_express(dev->bus)) {

        error_setg(errp, "pxb-pcie devices cannot reside on a PCI bus");

        return;

    }

    pxb_dev_realize_common(dev, true, errp);

}


--- a/source.c
+++ b/source.c
@@ -4,8 +4,8 @@
     if (overwrite || !getenv(name)) {
         size_t length = strlen(name) + strlen(value) + 2;
         char *string = g_malloc(length);
+        snprintf(string, length, "%s=%s", name, value);
+        result = putenv(string);
     }
     return result;
 }

int setenv(const char *name, const char *value, int overwrite)
{
    int result = 0;
    if (overwrite || !getenv(name)) {
        size_t length = strlen(name) + strlen(value) + 2;
        char *string = g_malloc(length);
        snprintf(string, length, "%s=%s", name, value);
        result = putenv(string);
    }
    return result;
}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static int h261_decode_gob_header(H261Context *h){

     unsigned int val;
+
+    MpegEncContext * const s = &h->s;
+

     /* Check for GOB Start Code */
+
     val = show_bits(&s->gb, 15);

     if(val)

static int h261_decode_gob_header(H261Context *h){

    unsigned int val;

    MpegEncContext * const s = &h->s;

    /* Check for GOB Start Code */

    val = show_bits(&s->gb, 15);

    if(val)

        return -1;

    /* We have a GBSC */

    skip_bits(&s->gb, 16);

    h->gob_number = get_bits(&s->gb, 4); /* GN */

    s->qscale = get_bits(&s->gb, 5); /* GQUANT */

    /* GEI */

    while (get_bits1(&s->gb) != 0) {

        skip_bits(&s->gb, 8);

    }

    if(s->qscale==0)

        return -1;

    // For the first transmitted macroblock in a GOB, MBA is the absolute address. For

    // subsequent macroblocks, MBA is the difference between the absolute addresses of

    // the macroblock and the last transmitted macroblock.

    h->current_mba = 0;

    h->mba_diff = 0;

    return 0;

}


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

 #if !defined(CONFIG_USER_ONLY)
+
+    /* Logical partitionning */
+
+    spr_register_kvm(env, SPR_LPCR, "LPCR",
+

                      &spr_read_generic, &spr_write_lpcr,

static void gen_spr_power5p_lpar(CPUPPCState *env)

{

#if !defined(CONFIG_USER_ONLY)

    /* Logical partitionning */

    spr_register_kvm(env, SPR_LPCR, "LPCR",

                     &spr_read_generic, &spr_write_lpcr,

                     KVM_REG_PPC_LPCR, LPCR_LPES0 | LPCR_LPES1);

#endif

}


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

     }
+
+    qemu_register_reset(qdev_reset, dev);
+
+    if (dev->info->vmsd) {
+
         vmstate_register_with_alias_id(dev, -1, dev->info->vmsd, dev,

                                        dev->instance_id_alias,

int qdev_init(DeviceState *dev)

{

    int rc;

    assert(dev->state == DEV_STATE_CREATED);

    rc = dev->info->init(dev, dev->info);

    if (rc < 0) {

        qdev_free(dev);

        return rc;

    }

    qemu_register_reset(qdev_reset, dev);

    if (dev->info->vmsd) {

        vmstate_register_with_alias_id(dev, -1, dev->info->vmsd, dev,

                                       dev->instance_id_alias,

                                       dev->alias_required_for_version);

    }

    dev->state = DEV_STATE_INITIALIZED;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     switch (codec) {
     case 1:
     case 3:
+        return old_codec1(ctx, top, left, w, h);
+        break;
+    case 37:
+        return old_codec37(ctx, top, left, w, h);
+        break;
     case 47:
         return old_codec47(ctx, top, left, w, h);
         break;

static int process_frame_obj(SANMVideoContext *ctx)
{
    uint16_t codec, top, left, w, h;
    codec = bytestream2_get_le16u(&ctx->gb);
    left  = bytestream2_get_le16u(&ctx->gb);
    top   = bytestream2_get_le16u(&ctx->gb);
    w     = bytestream2_get_le16u(&ctx->gb);
    h     = bytestream2_get_le16u(&ctx->gb);
    if (ctx->width < left + w || ctx->height < top + h) {
        if (av_image_check_size(FFMAX(left + w, ctx->width),
                                FFMAX(top  + h, ctx->height), 0, ctx->avctx) < 0)
        avcodec_set_dimensions(ctx->avctx, FFMAX(left + w, ctx->width),
                                           FFMAX(top  + h, ctx->height));
        init_sizes(ctx, FFMAX(left + w, ctx->width),
                        FFMAX(top  + h, ctx->height));
        if (init_buffers(ctx)) {
            av_log(ctx->avctx, AV_LOG_ERROR, "error resizing buffers\n");
            return AVERROR(ENOMEM);
    bytestream2_skip(&ctx->gb, 4);
    av_dlog(ctx->avctx, "subcodec %d\n", codec);
    switch (codec) {
    case 1:
    case 3:
        return old_codec1(ctx, top, left, w, h);
        break;
    case 37:
        return old_codec37(ctx, top, left, w, h);
        break;
    case 47:
        return old_codec47(ctx, top, left, w, h);
        break;
    default:
        avpriv_request_sample(ctx->avctx, "unknown subcodec %d", codec);
        return AVERROR_PATCHWELCOME;


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void read_table(AVFormatContext *avctx, AVStream *st,

                        int (*parse)(AVFormatContext *avctx, AVStream *st,

static void read_table(AVFormatContext *avctx, AVStream *st,

                       int (*parse)(AVFormatContext *avctx, AVStream *st,

                                    const char *name, int size))

{

    int count, i;

    AVIOContext *pb = avctx->pb;

    avio_skip(pb, 4);

    count = avio_rb32(pb);

    avio_skip(pb, 4);

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

        char name[17];

        int size;

        avio_read(pb, name, 16);

        name[sizeof(name) - 1] = 0;

        size = avio_rb32(pb);

        if (parse(avctx, st, name, size) < 0) {

            avpriv_request_sample(avctx, "Variable %s", name);

            avio_skip(pb, size);

        }

    }

}


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

                            void *out,
+
                            size_t len,

                            Error **errp)

int qcrypto_cipher_encrypt(QCryptoCipher *cipher,

                           const void *in,

                           void *out,

                           size_t len,

                           Error **errp)

{

    QCryptoCipherNettle *ctx = cipher->opaque;

    switch (cipher->mode) {

    case QCRYPTO_CIPHER_MODE_ECB:

        ctx->alg_encrypt(ctx->ctx_encrypt, len, out, in);

        break;

    case QCRYPTO_CIPHER_MODE_CBC:

        cbc_encrypt(ctx->ctx_encrypt, ctx->alg_encrypt,

                    ctx->niv, ctx->iv,

                    len, out, in);

        break;

    default:

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

                   cipher->alg);

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,9 +7,9 @@
     uint8_t *buf = NULL;

     uint8_t *buffer;
+
     size_t offset;
+
     ssize_t ret;

static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov,

                               int iovcnt, unsigned flags)

{

    uint8_t *buf = NULL;

    uint8_t *buffer;

    size_t offset;

    ssize_t ret;

    if (iovcnt == 1) {

        buffer = iov[0].iov_base;

        offset = iov[0].iov_len;

    } else {

        buf = g_new(uint8_t, NET_BUFSIZE);

        buffer = buf;

        offset = iov_to_buf(iov, iovcnt, 0, buf, NET_BUFSIZE);

    }

    if (flags & QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) {

        ret = nc->info->receive_raw(nc, buffer, offset);

    } else {

        ret = nc->info->receive(nc, buffer, offset);

    }

    g_free(buf);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)

+{

     MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;

int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)

{

    MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;

    int mmco_index = 0, i;

    assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count);

    if (h->short_ref_count &&

        h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count &&

        !(FIELD_PICTURE(h) && !h->first_field && h->cur_pic_ptr->reference)) {

        mmco[0].opcode        = MMCO_SHORT2UNUSED;

        mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num;

        mmco_index            = 1;

        if (FIELD_PICTURE(h)) {

            mmco[0].short_pic_num *= 2;

            mmco[1].opcode         = MMCO_SHORT2UNUSED;

            mmco[1].short_pic_num  = mmco[0].short_pic_num + 1;

            mmco_index             = 2;

        }

    }

    if (first_slice) {

        h->mmco_index = mmco_index;

    } else if (!first_slice && mmco_index >= 0 &&

               (mmco_index != h->mmco_index ||

                (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {

        av_log(h->avctx, AV_LOG_ERROR,

               "Inconsistent MMCO state between slices [%d, %d, %d]\n",

               mmco_index, h->mmco_index, i);

        return AVERROR_INVALIDDATA;

    }

    return 0;

}


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

+    snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id);

     if (snapshot_index < 0)

int qcow2_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)

{

    BDRVQcowState *s = bs->opaque;

    QCowSnapshot *sn;

    int i, snapshot_index, l1_size2;

    snapshot_index = find_snapshot_by_id_or_name(bs, snapshot_id);

    if (snapshot_index < 0)

        return -ENOENT;

    sn = &s->snapshots[snapshot_index];

    if (qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, -1) < 0)

        goto fail;

    if (qcow2_grow_l1_table(bs, sn->l1_size) < 0)

        goto fail;

    s->l1_size = sn->l1_size;

    l1_size2 = s->l1_size * sizeof(uint64_t);

    /* copy the snapshot l1 table to the current l1 table */

    if (bdrv_pread(bs->file, sn->l1_table_offset,

                   s->l1_table, l1_size2) != l1_size2)

        goto fail;

    if (bdrv_pwrite(bs->file, s->l1_table_offset,

                    s->l1_table, l1_size2) != l1_size2)

        goto fail;

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

        be64_to_cpus(&s->l1_table[i]);

    }

    if (qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, 1) < 0)

        goto fail;

#ifdef DEBUG_ALLOC

    qcow2_check_refcounts(bs);

#endif

    return 0;

 fail:

    return -EIO;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
         sock_id = atoi(ctx->fs_root);

         if (sock_id < 0) {
+
+            fprintf(stderr, "socket descriptor not initialized\n");
+
+        }
+
     }

     if (sock_id < 0) {

static int proxy_init(FsContext *ctx)

{

    V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy));

    int sock_id;

    if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {

        sock_id = connect_namedsocket(ctx->fs_root);

    } else {

        sock_id = atoi(ctx->fs_root);

        if (sock_id < 0) {

            fprintf(stderr, "socket descriptor not initialized\n");

        }

    }

    if (sock_id < 0) {

        g_free(proxy);

        return -1;

    }

    g_free(ctx->fs_root);

    ctx->fs_root = NULL;

    proxy->in_iovec.iov_base  = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->in_iovec.iov_len   = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;

    proxy->out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->out_iovec.iov_len  = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;

    ctx->private = proxy;

    proxy->sockfd = sock_id;

    qemu_mutex_init(&proxy->mutex);

    ctx->export_flags |= V9FS_PATHNAME_FSCONTEXT;

    ctx->exops.get_st_gen = proxy_ioc_getversion;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void ff_avg_h264_qpel16_mc13_msa(uint8_t *dst, const uint8_t *src,
+
+                                 ptrdiff_t stride)
+
 {

     avc_luma_hv_qrt_and_aver_dst_16x16_msa(src + stride - 2,

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

                                 ptrdiff_t stride)

{

    avc_luma_hv_qrt_and_aver_dst_16x16_msa(src + stride - 2,

                                           src - (stride * 2),

                                           stride, dst, stride);

}


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

     qemu_mutex_lock(&block_mig_state.lock);

+}

static void blk_mig_lock(void)

{

    qemu_mutex_lock(&block_mig_state.lock);

}


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

         /* Only the LOAD AND TEST instruction is available.  */
+
+        return val == 0;
+
+    }
+
 }

static int tcg_match_cmpi(TCGType type, tcg_target_long val)

{

    if (facilities & FACILITY_EXT_IMM) {

        /* The COMPARE IMMEDIATE instruction is available.  */

        if (type == TCG_TYPE_I32) {

            /* We have a 32-bit immediate and can compare against anything.  */

            return 1;

        } else {

            /* ??? We have no insight here into whether the comparison is

               signed or unsigned.  The COMPARE IMMEDIATE insn uses a 32-bit

               signed immediate, and the COMPARE LOGICAL IMMEDIATE insn uses

               a 32-bit unsigned immediate.  If we were to use the (semi)

               obvious "val == (int32_t)val" we would be enabling unsigned

               comparisons vs very large numbers.  The only solution is to

               take the intersection of the ranges.  */

            /* ??? Another possible solution is to simply lie and allow all

               constants here and force the out-of-range values into a temp

               register in tgen_cmp when we have knowledge of the actual

               comparison code in use.  */

            return val >= 0 && val <= 0x7fffffff;

        }

    } else {

        /* Only the LOAD AND TEST instruction is available.  */

        return val == 0;

    }

}


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

         case e_floor:

+        case e_ceil:
+
+        case e_trunc:
+
+        case e_sqrt:

         case e_not:

static int verify_expr(AVExpr *e)

{

    if (!e) return 0;

    switch (e->type) {

        case e_value:

        case e_const: return 1;

        case e_func0:

        case e_func1:

        case e_squish:

        case e_ld:

        case e_gauss:

        case e_isnan:

        case e_floor:

        case e_ceil:

        case e_trunc:

        case e_sqrt:

        case e_not:

        case e_random:

            return verify_expr(e->param[0]) && !e->param[2];

        case e_taylor:

            return verify_expr(e->param[0]) && verify_expr(e->param[1])

                   && (!e->param[2] || verify_expr(e->param[2]));

        default: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && !e->param[2];

    }

}