--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void test_smram_lock(void)
 {
+    QPCIBus *pcibus;
+    QPCIDevice *pcidev;
+    QDict *response;
+    pcibus = qpci_init_pc(NULL);
+    g_assert(pcibus != NULL);
     pcidev = qpci_device_find(pcibus, 0);
     g_assert(pcidev != NULL);
     /* check open is settable */

static void test_smram_lock(void)
{
    QPCIBus *pcibus;
    QPCIDevice *pcidev;
    QDict *response;
    pcibus = qpci_init_pc(NULL);
    g_assert(pcibus != NULL);
    pcidev = qpci_device_find(pcibus, 0);
    g_assert(pcidev != NULL);
    /* check open is settable */
    smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN, false);
    g_assert(smram_test_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN) == false);
    smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN, true);
    g_assert(smram_test_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN) == true);
    /* lock, check open is cleared & not settable */
    smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_LCK, true);
    g_assert(smram_test_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN) == false);
    smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN, true);
    g_assert(smram_test_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN) == false);
    /* reset */
    response = qmp("{'execute': 'system_reset', 'arguments': {} }");
    g_assert(response);
    g_assert(!qdict_haskey(response, "error"));
    QDECREF(response);
    /* check open is settable again */
    smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN, false);
    g_assert(smram_test_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN) == false);
    smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN, true);
    g_assert(smram_test_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN) == true);
}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 const char *path(const char *name)
+
 {

     /* Only do absolute paths: quick and dirty, but should mostly be OK.

const char *path(const char *name)

{

    /* Only do absolute paths: quick and dirty, but should mostly be OK.

       Could do relative by tracking cwd. */

    if (!base || name[0] != '/')

	return name;

    return follow_path(base, name) ?: name;

}


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

 {

+    visit_complete(data->ov, &data->obj);
+
     g_assert(data->obj);

     return data->obj;

static QObject *visitor_get(TestOutputVisitorData *data)

{

    visit_complete(data->ov, &data->obj);

    g_assert(data->obj);

    return data->obj;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 int64_t qmp_query_migrate_cache_size(Error **errp)
+
 {

     return migrate_xbzrle_cache_size();

int64_t qmp_query_migrate_cache_size(Error **errp)

{

    return migrate_xbzrle_cache_size();

}


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

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

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

{

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

}


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

     if (r1->count < r2->count)

+        return 1;
+
+    else if (r1->count == r2->count)
+
+        return 0;

     else

static int pc_rec_cmp(const void *p1, const void *p2)

{

    PCRecord *r1 = *(PCRecord **)p1;

    PCRecord *r2 = *(PCRecord **)p2;

    if (r1->count < r2->count)

        return 1;

    else if (r1->count == r2->count)

        return 0;

    else

        return -1;

}


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

     pfd.revents = 0;

+    g_poll(&pfd, 1, 0);
+
+    if (pfd.revents & G_IO_HUP) {
+
+        pty_chr_state(chr, 0);

     } else {

static void pty_chr_update_read_handler_locked(CharDriverState *chr)

{

    PtyCharDriver *s = chr->opaque;

    GPollFD pfd;

    pfd.fd = g_io_channel_unix_get_fd(s->fd);

    pfd.events = G_IO_OUT;

    pfd.revents = 0;

    g_poll(&pfd, 1, 0);

    if (pfd.revents & G_IO_HUP) {

        pty_chr_state(chr, 0);

    } else {

        pty_chr_state(chr, 1);

    }

}


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

     }
+
+
+
+    rtas_st(rets, 0, 0); /* Success */
+
     rtas_st(rets, 1, ics->irqs[nr - ics->offset].server);

     rtas_st(rets, 2, ics->irqs[nr - ics->offset].priority);

static void rtas_get_xive(sPAPREnvironment *spapr, uint32_t token,

                          uint32_t nargs, target_ulong args,

                          uint32_t nret, target_ulong rets)

{

    struct ics_state *ics = spapr->icp->ics;

    uint32_t nr;

    if ((nargs != 1) || (nret != 3)) {

        rtas_st(rets, 0, -3);

        return;

    }

    nr = rtas_ld(args, 0);

    if (!ics_valid_irq(ics, nr)) {

        rtas_st(rets, 0, -3);

        return;

    }

    rtas_st(rets, 0, 0); /* Success */

    rtas_st(rets, 1, ics->irqs[nr - ics->offset].server);

    rtas_st(rets, 2, ics->irqs[nr - ics->offset].priority);

}


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

     return s->ops->lstat(&s->ctx, path->data, stbuf);
+
 }

static int v9fs_do_lstat(V9fsState *s, V9fsString *path, struct stat *stbuf)

{

    return s->ops->lstat(&s->ctx, path->data, stbuf);

}


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

         if (state) {

+            trace_mptsas_irq_msi(s);
+
+            msi_notify(pci, 0);
+
+        }

     }

static void mptsas_update_interrupt(MPTSASState *s)

{

    PCIDevice *pci = (PCIDevice *) s;

    uint32_t state = s->intr_status & ~(s->intr_mask | MPI_HIS_IOP_DOORBELL_STATUS);

    if (s->msi_in_use && msi_enabled(pci)) {

        if (state) {

            trace_mptsas_irq_msi(s);

            msi_notify(pci, 0);

        }

    }

    trace_mptsas_irq_intx(s, !!state);

    pci_set_irq(pci, !!state);

}


--- a/source.c
+++ b/source.c
@@ -13,7 +13,7 @@
     offset = iov_to_buf(iov, iovcnt, 0, buffer, sizeof(buffer));

+
+    return nc->info->receive(nc, buffer, offset);
+
+}

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

                               int iovcnt)

{

    uint8_t buffer[4096];

    size_t offset;

    offset = iov_to_buf(iov, iovcnt, 0, buffer, sizeof(buffer));

    return nc->info->receive(nc, buffer, offset);

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
         .region_add = mem_add,

         .region_nop = mem_add,
+
+        .priority = 0,
+
+    };
+
     d->as = as;

     as->dispatch = d;

void address_space_init_dispatch(AddressSpace *as)

{

    AddressSpaceDispatch *d = g_new(AddressSpaceDispatch, 1);

    d->phys_map  = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 0 };

    d->listener = (MemoryListener) {

        .begin = mem_begin,

        .region_add = mem_add,

        .region_nop = mem_add,

        .priority = 0,

    };

    d->as = as;

    as->dispatch = d;

    memory_listener_register(&d->listener, as);

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@
     dnxhd_load_picture(ctx, data);
  encode_coding_unit:
     for (i = 0; i < 3; i++) {
+        ctx->src[i] = ctx->frame.data[i];
+        if (ctx->interlaced && ctx->cur_field)
+            ctx->src[i] += ctx->frame.linesize[i];
+    }
+    dnxhd_write_header(avctx, buf);
     if (avctx->mb_decision == FF_MB_DECISION_RD)
         ret = dnxhd_encode_rdo(avctx, ctx);
     else

static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
{
    DNXHDEncContext *ctx = avctx->priv_data;
    int first_field = 1;
    int offset, i, ret;
    if (buf_size < ctx->cid_table->frame_size) {
        av_log(avctx, AV_LOG_ERROR, "output buffer is too small to compress picture\n");
        return -1;
    }
    dnxhd_load_picture(ctx, data);
 encode_coding_unit:
    for (i = 0; i < 3; i++) {
        ctx->src[i] = ctx->frame.data[i];
        if (ctx->interlaced && ctx->cur_field)
            ctx->src[i] += ctx->frame.linesize[i];
    }
    dnxhd_write_header(avctx, buf);
    if (avctx->mb_decision == FF_MB_DECISION_RD)
        ret = dnxhd_encode_rdo(avctx, ctx);
    else
        ret = dnxhd_encode_fast(avctx, ctx);
    if (ret < 0) {
        av_log(avctx, AV_LOG_ERROR, "picture could not fit ratecontrol constraints\n");
        return -1;
    }
    dnxhd_setup_threads_slices(ctx, buf);
    offset = 0;
    for (i = 0; i < ctx->m.mb_height; i++) {
        AV_WB32(ctx->msip + i * 4, offset);
        offset += ctx->slice_size[i];
        assert(!(ctx->slice_size[i] & 3));
    }
    avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*));
    AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF
    if (ctx->interlaced && first_field) {
        first_field     = 0;
        ctx->cur_field ^= 1;
        buf      += ctx->cid_table->coding_unit_size;
        buf_size -= ctx->cid_table->coding_unit_size;
        goto encode_coding_unit;
    }
    ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA;
    return ctx->cid_table->frame_size;
}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int draw_glyphs(DrawTextContext *dtext, AVFilterBufferRef *picref,
+
                        int width, int height, const uint8_t rgbcolor[4], const uint8_t yuvcolor[4], int x, int y)

 {

static int draw_glyphs(DrawTextContext *dtext, AVFilterBufferRef *picref,

                       int width, int height, const uint8_t rgbcolor[4], const uint8_t yuvcolor[4], int x, int y)

{

    char *text = dtext->text;

    uint32_t code = 0;

    int i;

    uint8_t *p;

    Glyph *glyph = NULL;

    for (i = 0, p = text; *p; i++) {

        Glyph dummy = { 0 };

        GET_UTF8(code, *p++, continue;);

        /* skip new line chars, just go to new line */

        if (code == '\n' || code == '\r' || code == '\t')

            continue;

        dummy.code = code;

        glyph = av_tree_find(dtext->glyphs, &dummy, (void *)glyph_cmp, NULL);

        if (glyph->bitmap.pixel_mode != FT_PIXEL_MODE_MONO &&

            glyph->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY)

            return AVERROR(EINVAL);

        if (dtext->is_packed_rgb) {

            draw_glyph_rgb(picref, &glyph->bitmap,

                           dtext->positions[i].x+x, dtext->positions[i].y+y, width, height,

                           dtext->pixel_step[0], rgbcolor, dtext->rgba_map);

        } else {

            draw_glyph_yuv(picref, &glyph->bitmap,

                           dtext->positions[i].x+x, dtext->positions[i].y+y, width, height,

                           yuvcolor, dtext->hsub, dtext->vsub);

        }

    }

    return 0;

}


void virtio_submit_multiwrite(BlockDriverState *bs, MultiReqBuffer *mrb)

{

    int i, ret;

    if (!mrb->num_writes) {

        return;

    }

    ret = bdrv_aio_multiwrite(bs, mrb->blkreq, mrb->num_writes);

    if (ret != 0) {

        for (i = 0; i < mrb->num_writes; i++) {

            if (mrb->blkreq[i].error) {

                virtio_blk_rw_complete(mrb->blkreq[i].opaque, -EIO);

            }

        }

    }

    mrb->num_writes = 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+static int swf_write_audio(AVFormatContext *s, const uint8_t *buf, int size)
+
+{
+
+    ByteIOContext *pb = &s->pb;
+

     put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG);

static int swf_write_audio(AVFormatContext *s, const uint8_t *buf, int size)

{

    ByteIOContext *pb = &s->pb;

    put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG);

    put_buffer(pb, buf, size);

    put_swf_end_tag(s);

    put_flush_packet(&s->pb);

    return 0;

}


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

                                     uint8_t *buf, int nb_sectors)

+{
+
+    int ret;
+
     BDRVCowState *s = bs->opaque;

     qemu_co_mutex_lock(&s->lock);

static coroutine_fn int cow_co_read(BlockDriverState *bs, int64_t sector_num,

                                    uint8_t *buf, int nb_sectors)

{

    int ret;

    BDRVCowState *s = bs->opaque;

    qemu_co_mutex_lock(&s->lock);

    ret = cow_read(bs, sector_num, buf, nb_sectors);

    qemu_co_mutex_unlock(&s->lock);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
     if (!filesize)

         goto done;
+
+
+
+    st = avformat_new_stream(s, NULL);
+
     if (!st)

         goto done;

static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)

{

    char mime[1024];

    char description[1024];

    unsigned int filesize;

    AVStream *st;

    int64_t pos = avio_tell(pb);

    avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));

    if (strcmp(mime, "image/jpeg"))

        goto done;

    avio_r8(pb);

    avio_get_str16le(pb, INT_MAX, description, sizeof(description));

    filesize = avio_rl32(pb);

    if (!filesize)

        goto done;

    st = avformat_new_stream(s, NULL);

    if (!st)

        goto done;

    av_dict_set(&st->metadata, "title", description, 0);

    st->codec->codec_id   = AV_CODEC_ID_MJPEG;

    st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;

    st->codec->extradata  = av_mallocz(filesize);

    if (!st->codec->extradata)

        goto done;

    st->codec->extradata_size = filesize;

    avio_read(pb, st->codec->extradata, filesize);

done:

    avio_seek(pb, pos + length, SEEK_SET);

}


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

         return 0;

+    if (!vm_running)
+
+        return 0;
+
     return 1;

 }

static int cpu_can_run(CPUState *env)

{

    if (env->stop)

        return 0;

    if (env->stopped)

        return 0;

    if (!vm_running)

        return 0;

    return 1;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void breakpoint_invalidate(CPUArchState *env, target_ulong pc)
+
 {

     tb_invalidate_phys_addr(cpu_get_phys_page_debug(env, pc));

static void breakpoint_invalidate(CPUArchState *env, target_ulong pc)

{

    tb_invalidate_phys_addr(cpu_get_phys_page_debug(env, pc));

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static bool is_iso_bc_entry_compatible(IsoBcSection *s)

 {
+
     return true;

 }

static bool is_iso_bc_entry_compatible(IsoBcSection *s)

{

    return true;

}


--- a/source.c
+++ b/source.c
@@ -37,11 +37,11 @@
     g_free(data);

+
+    /* Merge any subsequent list elements that now also overlap */
+
+    while (l->next && range_compare(l->data, l->next->data) == 0) {
+
         GList *new_l;

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

{

    GList *l;

    /* Range lists require no empty ranges */

    assert(data->begin < data->end || (data->begin && !data->end));

    /* Skip all list elements strictly less than data */

    for (l = list; l && range_compare(l->data, data) < 0; l = l->next) {

    }

    if (!l || range_compare(l->data, data) > 0) {

        /* Rest of the list (if any) is strictly greater than @data */

        return g_list_insert_before(list, l, data);

    }

    /* Current list element overlaps @data, merge the two */

    range_extend(l->data, data);

    g_free(data);

    /* Merge any subsequent list elements that now also overlap */

    while (l->next && range_compare(l->data, l->next->data) == 0) {

        GList *new_l;

        range_extend(l->data, l->next->data);

        g_free(l->next->data);

        new_l = g_list_delete_link(list, l->next);

        assert(new_l == list);

    }

    return list;

}


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

     PCIBonitoState *s = opaque;

static void bonito_ldma_writel(void *opaque, target_phys_addr_t addr,

                               uint64_t val, unsigned size)

{

    PCIBonitoState *s = opaque;

    ((uint32_t *)(&s->bonldma))[addr/sizeof(uint32_t)] = val & 0xffffffff;

}


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

     /* Device tree style name device@reg */

+    name = g_strdup_printf("%s@%x", pc->dt_name, dev->reg);
+
+
+
+    return name;

 }

static char *spapr_vio_get_dev_name(DeviceState *qdev)

{

    VIOsPAPRDevice *dev = VIO_SPAPR_DEVICE(qdev);

    VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev);

    char *name;

    /* Device tree style name device@reg */

    name = g_strdup_printf("%s@%x", pc->dt_name, dev->reg);

    return name;

}


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

+    for (i = 0; i < st->nb_side_data; i++) {

         sd = &st->side_data[i];

int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,

                            uint8_t *data, size_t size)

{

    AVPacketSideData *sd, *tmp;

    int i;

    for (i = 0; i < st->nb_side_data; i++) {

        sd = &st->side_data[i];

        if (sd->type == type) {

            av_freep(&sd->data);

            sd->data = data;

            sd->size = size;

            return 0;

        }

    }

    tmp = av_realloc_array(st->side_data, st->nb_side_data + 1, sizeof(*tmp));

    if (!tmp) {

        return AVERROR(ENOMEM);

    }

    st->side_data = tmp;

    st->nb_side_data++;

    sd = &st->side_data[st->nb_side_data - 1];

    sd->type = type;

    sd->data = data;

    sd->size = size;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -47,11 +47,11 @@
                                     &vd->lwebsock_tag,

                                     &vd->nlwebsock,
+
+                                    errp) < 0) {
+
+            return -1;
+
         }

     }

static int vnc_display_listen(VncDisplay *vd,

                              SocketAddressLegacy **saddr,

                              size_t nsaddr,

                              SocketAddressLegacy **wsaddr,

                              size_t nwsaddr,

                              Error **errp)

{

    size_t i;

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

        if (vnc_display_listen_addr(vd, saddr[i],

                                    "vnc-listen",

                                    &vd->lsock,

                                    &vd->lsock_tag,

                                    &vd->nlsock,

                                    errp) < 0) {

            return -1;

        }

    }

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

        if (vnc_display_listen_addr(vd, wsaddr[i],

                                    "vnc-ws-listen",

                                    &vd->lwebsock,

                                    &vd->lwebsock_tag,

                                    &vd->nlwebsock,

                                    errp) < 0) {

            return -1;

        }

    }

    return 0;

}


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

         printf("TAG:");

+        writer_print_string(wctx, tag->key, tag->value);
+
+    }

 }

static void default_show_tags(WriterContext *wctx, AVDictionary *dict)

{

    AVDictionaryEntry *tag = NULL;

    while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) {

        printf("TAG:");

        writer_print_string(wctx, tag->key, tag->value);

    }

}


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

     int64_t v;

+    uint32 res;

     v = float32_to_int64_round_to_zero(a STATUS_VAR);
+
     if (v < 0) {

         res = 0;

uint32 float32_to_uint32_round_to_zero( float32 a STATUS_PARAM )

{

    int64_t v;

    uint32 res;

    v = float32_to_int64_round_to_zero(a STATUS_VAR);

    if (v < 0) {

        res = 0;

        float_raise( float_flag_invalid STATUS_VAR);

    } else if (v > 0xffffffff) {

        res = 0xffffffff;

        float_raise( float_flag_invalid STATUS_VAR);

    } else {

        res = v;

    }

    return res;

}


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

     st = avformat_new_stream(s, NULL);
+
     if (!st) {

         ret = AVERROR(ENOMEM);

int ff_raw_video_read_header(AVFormatContext *s)

{

    AVStream *st;

    FFRawVideoDemuxerContext *s1 = s->priv_data;

    AVRational framerate;

    int ret = 0;

    st = avformat_new_stream(s, NULL);

    if (!st) {

        ret = AVERROR(ENOMEM);

        goto fail;

    }

    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;

    st->codec->codec_id = s->iformat->raw_codec_id;

    st->need_parsing = AVSTREAM_PARSE_FULL;

    if ((ret = av_parse_video_rate(&framerate, s1->framerate)) < 0) {

        av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate);

        goto fail;

    }

    st->r_frame_rate = st->avg_frame_rate = framerate;

    avpriv_set_pts_info(st, 64, framerate.den, framerate.num);

fail:

    return ret;

}


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

+
+    (*s->cirrus_rop) (s, dst, src,
+
+                      s->cirrus_blt_dstpitch, 0,
+
                       s->cirrus_blt_width, s->cirrus_blt_height);

     cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,

static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,

					    const uint8_t * src)

{

    uint8_t *dst;

    dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);

    if (blit_is_unsafe(s, false))

        return 0;

    (*s->cirrus_rop) (s, dst, src,

                      s->cirrus_blt_dstpitch, 0,

                      s->cirrus_blt_width, s->cirrus_blt_height);

    cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,

                             s->cirrus_blt_dstpitch, s->cirrus_blt_width,

                             s->cirrus_blt_height);

    return 1;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 int qemu_mutex_trylock(QemuMutex *mutex)

+{
+
+    int owned;
+

     owned = TryEnterCriticalSection(&mutex->lock);

int qemu_mutex_trylock(QemuMutex *mutex)

{

    int owned;

    owned = TryEnterCriticalSection(&mutex->lock);

    if (owned) {

        assert(mutex->owner == 0);

        mutex->owner = GetCurrentThreadId();

    }

    return !owned;

}


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

+    ov = g_new0(sPAPROptionVector, 1);
+
+    ov->bitmap = bitmap_new(OV_MAXBITS);
+

sPAPROptionVector *spapr_ovec_new(void)

{

    sPAPROptionVector *ov;

    ov = g_new0(sPAPROptionVector, 1);

    ov->bitmap = bitmap_new(OV_MAXBITS);

    return ov;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+void g_free(void *ptr)
+
+{
+
     /* FIXME: We should unmark the reserved pages here.  However this gets

        complicated when one target page spans multiple host pages, so we

void g_free(void *ptr)

{

    /* FIXME: We should unmark the reserved pages here.  However this gets

       complicated when one target page spans multiple host pages, so we

       don't bother.  */

    size_t *p;

    p = (size_t *)((char *)ptr - 16);

    munmap(p, *p);

}


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

     do {

+        len = read(fd, buffer, sizeof(buffer));
+
+    } while ((len == -1 && errno == EINTR) || len == sizeof(buffer));
+
+}

static void qemu_event_read(void *opaque)

{

    int fd = (intptr_t)opaque;

    ssize_t len;

    char buffer[512];

    /* Drain the notify pipe.  For eventfd, only 8 bytes will be read.  */

    do {

        len = read(fd, buffer, sizeof(buffer));

    } while ((len == -1 && errno == EINTR) || len == sizeof(buffer));

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     int64_t fmt, fact;

+
+    ffio_wfourcc(pb, "RIFF");
+
+    avio_wl32(pb, 0); /* file length */
+
     ffio_wfourcc(pb, "WAVE");

static int wav_write_header(AVFormatContext *s)

{

    WAVContext *wav = s->priv_data;

    AVIOContext *pb = s->pb;

    int64_t fmt, fact;

    ffio_wfourcc(pb, "RIFF");

    avio_wl32(pb, 0); /* file length */

    ffio_wfourcc(pb, "WAVE");

    /* format header */

    fmt = ff_start_tag(pb, "fmt ");

    if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) {

        av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE format\n",

               s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE");

        av_free(wav);

        return -1;

    }

    ff_end_tag(pb, fmt);

    if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */

        && s->pb->seekable) {

        fact = ff_start_tag(pb, "fact");

        avio_wl32(pb, 0);

        ff_end_tag(pb, fact);

    }

    av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);

    wav->maxpts = wav->last_duration = 0;

    wav->minpts = INT64_MAX;

    /* data header */

    wav->data = ff_start_tag(pb, "data");

    avio_flush(pb);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void qemu_aio_wait_end(void)

 {


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

 #if !defined(CONFIG_USER_ONLY)
+
+    if (cpu_interrupts_enabled(env)) {
+
+
+        cpu_check_irqs(env);

     }

void helper_retry(CPUSPARCState *env)

{

    trap_state *tsptr = cpu_tsptr(env);

    env->pc = tsptr->tpc;

    env->npc = tsptr->tnpc;

    cpu_put_ccr(env, tsptr->tstate >> 32);

    env->asi = (tsptr->tstate >> 24) & 0xff;

    cpu_change_pstate(env, (tsptr->tstate >> 8) & 0xf3f);

    cpu_put_cwp64(env, tsptr->tstate & 0xff);

    if (cpu_has_hypervisor(env)) {

        uint32_t new_gl = (tsptr->tstate >> 40) & 7;

        env->hpstate = env->htstate[env->tl];

        cpu_gl_switch_gregs(env, new_gl);

        env->gl = new_gl;

    }

    env->tl--;

    trace_win_helper_retry(env->tl);

#if !defined(CONFIG_USER_ONLY)

    if (cpu_interrupts_enabled(env)) {

        cpu_check_irqs(env);

    }

#endif

}


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

+    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
+
+         || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
+
+       ) {

         if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {

int float64_le_quiet( float64 a, float64 b STATUS_PARAM )

{

    flag aSign, bSign;

    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )

         || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )

       ) {

        if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {

            float_raise( float_flag_invalid STATUS_VAR);

        }

        return 0;

    }

    aSign = extractFloat64Sign( a );

    bSign = extractFloat64Sign( b );

    if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 );

    return ( a == b ) || ( aSign ^ ( a < b ) );

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,

+                                 void *opaque)
+
+{
+
+    if (mon->rs) {

         readline_start(mon->rs, "Password: ", 1, readline_func, opaque);

static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,

                                 void *opaque)

{

    if (mon->rs) {

        readline_start(mon->rs, "Password: ", 1, readline_func, opaque);

        /* prompt is printed on return from the command handler */

        return 0;

    } else {

        monitor_printf(mon, "terminal does not support password prompting\n");

        return -ENOTTY;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
+
     int i, j;

     uint32_t c;

int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){

    int i, j;

    uint32_t c;

    if (bits < 8 || bits > 32 || poly >= (1LL<<bits))

        return -1;

    if (ctx_size != sizeof(AVCRC)*257 && ctx_size != sizeof(AVCRC)*1024)

        return -1;

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

        if (le) {

            for (c = i, j = 0; j < 8; j++)

                c = (c>>1)^(poly & (-(c&1)));

            ctx[i] = c;

        } else {

            for (c = i << 24, j = 0; j < 8; j++)

                c = (c<<1) ^ ((poly<<(32-bits)) & (((int32_t)c)>>31) );

            ctx[i] = av_bswap32(c);

        }

    }

    ctx[256]=1;

#if !CONFIG_SMALL

    if(ctx_size >= sizeof(AVCRC)*1024)

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

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

                ctx[256*(j+1) + i]= (ctx[256*j + i]>>8) ^ ctx[ ctx[256*j + i]&0xFF ];

#endif

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void pc_q35_init_1_5(QEMUMachineInitArgs *args)

 {

static void pc_q35_init_1_5(QEMUMachineInitArgs *args)

{

    has_pci_info = false;

    pc_q35_init(args);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **errp)

 {
+
+    VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(ccw_dev);
+
+    DeviceState *vdev = DEVICE(&dev->vdev);
+
     Error *err = NULL;

static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **errp)

{

    VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(ccw_dev);

    DeviceState *vdev = DEVICE(&dev->vdev);

    Error *err = NULL;

    qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));

    object_property_set_bool(OBJECT(vdev), true, "realized", &err);

    if (err) {

        error_propagate(errp, err);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
 static inline void RENAME(bgr15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
+
+{
+
 	int i;
+
+        assert(src1==src2);
+
+	for(i=0; i<width; i++)
+
+	{
+
+		int d0= ((uint32_t*)src1)[i];
+
+

 		int dl= (d0&0x03E07C1F);

static inline void RENAME(bgr15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)

{

	int i;

        assert(src1==src2);

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

	{

		int d0= ((uint32_t*)src1)[i];

		int dl= (d0&0x03E07C1F);

		int dh= ((d0>>5)&0x03E0F81F);

		int dh2= (dh>>11) + (dh<<21);

		int d= dh2 + dl;

		int b= d&0x7F;

		int r= (d>>10)&0x7F;

		int g= d>>21;

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

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

	}

}


static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data)

{

    exit(0);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,23 +1,23 @@
 static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,

+                              char *buf, size_t bufsz)
+
 {

+    ssize_t tsize = -1;
+
+    char *buffer;

     char *path = fs_path->data;

     if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||
+
         (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {

         int fd;
+
         buffer = rpath(fs_ctx, path);

         fd = open(buffer, O_RDONLY | O_NOFOLLOW);

static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,

                              char *buf, size_t bufsz)

{

    ssize_t tsize = -1;

    char *buffer;

    char *path = fs_path->data;

    if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||

        (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {

        int fd;

        buffer = rpath(fs_ctx, path);

        fd = open(buffer, O_RDONLY | O_NOFOLLOW);

        g_free(buffer);

        if (fd == -1) {

            return -1;

        }

        do {

            tsize = read(fd, (void *)buf, bufsz);

        } while (tsize == -1 && errno == EINTR);

        close(fd);

    } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||

               (fs_ctx->export_flags & V9FS_SM_NONE)) {

        buffer = rpath(fs_ctx, path);

        tsize = readlink(buffer, buf, bufsz);

        g_free(buffer);

    }

    return tsize;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
     v9fs_co_run_in_worker(

         {
+
+            err = s->ops->mknod(&s->ctx, path->data, &cred);
+
+            if (err < 0) {
+
                 err = -errno;

             }

int v9fs_co_mknod(V9fsState *s, V9fsString *path, uid_t uid,

                  gid_t gid, dev_t dev, mode_t mode)

{

    int err;

    FsCred cred;

    cred_init(&cred);

    cred.fc_uid  = uid;

    cred.fc_gid  = gid;

    cred.fc_mode = mode;

    cred.fc_rdev = dev;

    v9fs_co_run_in_worker(

        {

            err = s->ops->mknod(&s->ctx, path->data, &cred);

            if (err < 0) {

                err = -errno;

            }

        });

    return err;

}


uint32_t HELPER(lpebr)(CPUS390XState *env, uint32_t f1, uint32_t f2)

{

    float32 v1;

    float32 v2 = env->fregs[f2].d;

    v1 = float32_abs(v2);

    env->fregs[f1].d = v1;

    return set_cc_nz_f32(v1);

}


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

     /* Check cancellation *before* setting busy = false, too!  */
+
+    if (block_job_is_cancelled(job)) {
+
+        return;
+
     }

void block_job_sleep_ns(BlockJob *job, QEMUClockType type, int64_t ns)

{

    assert(job->busy);

    /* Check cancellation *before* setting busy = false, too!  */

    if (block_job_is_cancelled(job)) {

        return;

    }

    job->busy = false;

    if (block_job_is_paused(job)) {

        qemu_coroutine_yield();

    } else {

        co_aio_sleep_ns(blk_get_aio_context(job->blk), type, ns);

    }

    job->busy = true;

}


void mpeg1_init_vlc(MpegEncContext *s)

{

    static int done = 0;

    if (!done) {

        init_vlc(&dc_lum_vlc, 9, 12,

                 vlc_dc_lum_bits, 1, 1,

                 vlc_dc_lum_code, 2, 2);

        init_vlc(&dc_chroma_vlc, 9, 12,

                 vlc_dc_chroma_bits, 1, 1,

                 vlc_dc_chroma_code, 2, 2);

        init_vlc(&mv_vlc, 9, 17,

                 &mbMotionVectorTable[0][1], 2, 1,

                 &mbMotionVectorTable[0][0], 2, 1);

        init_vlc(&mbincr_vlc, 9, 35,

                 &mbAddrIncrTable[0][1], 2, 1,

                 &mbAddrIncrTable[0][0], 2, 1);

        init_vlc(&mb_pat_vlc, 9, 63,

                 &mbPatTable[0][1], 2, 1,

                 &mbPatTable[0][0], 2, 1);

        init_vlc(&mb_ptype_vlc, 6, 32,

                 &table_mb_ptype[0][1], 2, 1,

                 &table_mb_ptype[0][0], 2, 1);

        init_vlc(&mb_btype_vlc, 6, 32,

                 &table_mb_btype[0][1], 2, 1,

                 &table_mb_btype[0][0], 2, 1);

        init_rl(&rl_mpeg1);

        init_rl(&rl_mpeg2);

        /* cannot use generic init because we must add the EOB code */

        init_vlc(&rl_mpeg1.vlc, 9, rl_mpeg1.n + 2,

                 &rl_mpeg1.table_vlc[0][1], 4, 2,

                 &rl_mpeg1.table_vlc[0][0], 4, 2);

        init_vlc(&rl_mpeg2.vlc, 9, rl_mpeg2.n + 2,

                 &rl_mpeg2.table_vlc[0][1], 4, 2,

                 &rl_mpeg2.table_vlc[0][0], 4, 2);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void exception_action(CPUState *cpu)
+
+{
+
+#if defined(TARGET_I386)
+
     X86CPU *x86_cpu = X86_CPU(cpu);

     CPUX86State *env1 = &x86_cpu->env;

static void exception_action(CPUState *cpu)

{

#if defined(TARGET_I386)

    X86CPU *x86_cpu = X86_CPU(cpu);

    CPUX86State *env1 = &x86_cpu->env;

    raise_exception_err(env1, cpu->exception_index, env1->error_code);

#else

    cpu_loop_exit(cpu);

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb,

                                     AVStream *st, MOVStreamContext *sc,

static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb,

                                    AVStream *st, MOVStreamContext *sc,

                                    int size)

{

    // ttxt stsd contains display flags, justification, background

    // color, fonts, and default styles, so fake an atom to read it

    MOVAtom fake_atom = { .size = size };

    // mp4s contains a regular esds atom

    if (st->codec->codec_tag != AV_RL32("mp4s"))

        mov_read_glbl(c, pb, fake_atom);

    st->codec->width  = sc->width;

    st->codec->height = sc->height;

}


static void FUNCC(pred8x8_top_dc)(uint8_t *_src, int stride){

    int i;

    int dc0, dc1;

    pixel4 dc0splat, dc1splat;

    pixel *src = (pixel*)_src;

    stride /= sizeof(pixel);

    dc0=dc1=0;

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

        dc0+= src[i-stride];

        dc1+= src[4+i-stride];

    }

    dc0splat = PIXEL_SPLAT_X4((dc0 + 2)>>2);

    dc1splat = PIXEL_SPLAT_X4((dc1 + 2)>>2);

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

        ((pixel4*)(src+i*stride))[0]= dc0splat;

        ((pixel4*)(src+i*stride))[1]= dc1splat;

    }

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

        ((pixel4*)(src+i*stride))[0]= dc0splat;

        ((pixel4*)(src+i*stride))[1]= dc1splat;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+static void scsi_read_data(SCSIDevice *d, uint32_t tag)
+
+{
+
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);
+
+    SCSIDiskReq *r;

+
     r = scsi_find_request(s, tag);

     if (!r) {

static void scsi_read_data(SCSIDevice *d, uint32_t tag)

{

    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);

    SCSIDiskReq *r;

    r = scsi_find_request(s, tag);

    if (!r) {

        BADF("Bad read tag 0x%x\n", tag);

        /* ??? This is the wrong error.  */

        scsi_command_complete(r, CHECK_CONDITION, HARDWARE_ERROR);

        return;

    }

    scsi_read_request(r);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void term_show_prompt2(void)

+{
+
+    term_printf("(qemu) ");

     fflush(stdout);

static void term_show_prompt2(void)

{

    term_printf("(qemu) ");

    fflush(stdout);

    term_last_cmd_buf_index = 0;

    term_last_cmd_buf_size = 0;

    term_esc_state = IS_NORM;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+static int find_snapshot_by_id_or_name(BlockDriverState *bs, const char *name)
+
+{
+
+    BDRVQcowState *s = bs->opaque;
+
+    int i, ret;

+

     ret = find_snapshot_by_id(bs, name);

static int find_snapshot_by_id_or_name(BlockDriverState *bs, const char *name)

{

    BDRVQcowState *s = bs->opaque;

    int i, ret;

    ret = find_snapshot_by_id(bs, name);

    if (ret >= 0)

        return ret;

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

        if (!strcmp(s->snapshots[i].name, name))

            return i;

    }

    return -1;

}


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

     sun4m_common_init(ram_size, boot_device, ds, kernel_filename,

+                      kernel_cmdline, initrd_filename, cpu_model,
+
+                      0);
+
+}

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

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

                       const char *kernel_filename, const char *kernel_cmdline,

                       const char *initrd_filename, const char *cpu_model)

{

    if (cpu_model == NULL)

        cpu_model = "Fujitsu MB86904";

    sun4m_common_init(ram_size, boot_device, ds, kernel_filename,

                      kernel_cmdline, initrd_filename, cpu_model,

                      0);

}


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

     memset(registered_avfilters, 0, sizeof(registered_avfilters));

void avfilter_uninit(void)

{

    memset(registered_avfilters, 0, sizeof(registered_avfilters));

    next_registered_avfilter_idx = 0;

}


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

     mutex_lock(&lock);

+    if (idle_threads == 0 && cur_threads < max_threads)
+
+        spawn_thread();
+
+    TAILQ_INSERT_TAIL(&request_list, aiocb, node);

     mutex_unlock(&lock);

static void qemu_paio_submit(struct qemu_paiocb *aiocb)

{

    aiocb->ret = -EINPROGRESS;

    aiocb->active = 0;

    mutex_lock(&lock);

    if (idle_threads == 0 && cur_threads < max_threads)

        spawn_thread();

    TAILQ_INSERT_TAIL(&request_list, aiocb, node);

    mutex_unlock(&lock);

    cond_signal(&cond);

}


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

     CPUState *cs = CPU(obj);
+
     SPARCCPU *cpu = SPARC_CPU(obj);

     CPUSPARCState *env = &cpu->env;

static void sparc_cpu_initfn(Object *obj)

{

    CPUState *cs = CPU(obj);

    SPARCCPU *cpu = SPARC_CPU(obj);

    CPUSPARCState *env = &cpu->env;

    cs->env_ptr = env;

    cpu_exec_init(cs, &error_abort);

    if (tcg_enabled()) {

        gen_intermediate_code_init(env);

    }

}


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

     if (IS_USER(s)) {
+
         gen_exception(s, s->pc - 2, EXCP_PRIVILEGE);

         return;

DISAS_INSN(wdebug)

{

    if (IS_USER(s)) {

        gen_exception(s, s->pc - 2, EXCP_PRIVILEGE);

        return;

    }

    /* TODO: Implement wdebug.  */

    qemu_assert(0, "WDEBUG not implemented");

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata,
+
                         const char *magic, ID3v2ExtraMeta **extra_meta)

 {

void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata,

                        const char *magic, ID3v2ExtraMeta **extra_meta)

{

    id3v2_read_internal(pb, metadata, NULL, magic, extra_meta);

}


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

     acb->aio_type = QEMU_AIO_IOCTL;
+
+    acb->aio_fildes = fd;
+
+    acb->ev_signo = SIGUSR2;
+
     acb->async_context_id = get_async_context_id();

     acb->aio_offset = 0;

BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,

        unsigned long int req, void *buf,

        BlockDriverCompletionFunc *cb, void *opaque)

{

    struct qemu_paiocb *acb;

    acb = qemu_aio_get(&raw_aio_pool, bs, cb, opaque);

    if (!acb)

        return NULL;

    acb->aio_type = QEMU_AIO_IOCTL;

    acb->aio_fildes = fd;

    acb->ev_signo = SIGUSR2;

    acb->async_context_id = get_async_context_id();

    acb->aio_offset = 0;

    acb->aio_ioctl_buf = buf;

    acb->aio_ioctl_cmd = req;

    acb->next = posix_aio_state->first_aio;

    posix_aio_state->first_aio = acb;

    qemu_paio_submit(acb);

    return &acb->common;

}


--- a/source.c
+++ b/source.c
@@ -17,9 +17,9 @@
     if (did > 0)

         rom_add_blob_fixed("read", buf, did, dst_addr);
+
+    g_free(buf);
+
+    return did;
+
 }

ssize_t read_targphys(const char *name,

                      int fd, target_phys_addr_t dst_addr, size_t nbytes)

{

    uint8_t *buf;

    ssize_t did;

    buf = g_malloc(nbytes);

    did = read(fd, buf, nbytes);

    if (did > 0)

        rom_add_blob_fixed("read", buf, did, dst_addr);

    g_free(buf);

    return did;

}


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

+
+    qemu_get_timedate(&tm, spapr->rtc_offset);
+
+
+
     rtas_st(rets, 0, 0); /* Success */

     rtas_st(rets, 1, tm.tm_year + 1900);

static void rtas_get_time_of_day(sPAPREnvironment *spapr,

                                 uint32_t token, uint32_t nargs,

                                 target_ulong args,

                                 uint32_t nret, target_ulong rets)

{

    struct tm tm;

    if (nret != 8) {

        rtas_st(rets, 0, -3);

        return;

    }

    qemu_get_timedate(&tm, spapr->rtc_offset);

    rtas_st(rets, 0, 0); /* Success */

    rtas_st(rets, 1, tm.tm_year + 1900);

    rtas_st(rets, 2, tm.tm_mon + 1);

    rtas_st(rets, 3, tm.tm_mday);

    rtas_st(rets, 4, tm.tm_hour);

    rtas_st(rets, 5, tm.tm_min);

    rtas_st(rets, 6, tm.tm_sec);

    rtas_st(rets, 7, 0); /* we don't do nanoseconds */

}


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

         if (!comp->reslevel)
+
             continue;

void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)

{

    int reslevelno, bandno, precno;

    for (reslevelno = 0;

         comp->reslevel && reslevelno < codsty->nreslevels;

         reslevelno++) {

        Jpeg2000ResLevel *reslevel;

        if (!comp->reslevel)

            continue;

        reslevel = comp->reslevel + reslevelno;

        for (bandno = 0; bandno < reslevel->nbands; bandno++) {

            Jpeg2000Band *band;

            if (!reslevel->band)

                continue;

            band = reslevel->band + bandno;

            for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++) {

                if (band->prec) {

                    Jpeg2000Prec *prec = band->prec + precno;

                    av_freep(&prec->zerobits);

                    av_freep(&prec->cblkincl);

                    av_freep(&prec->cblk);

                }

            }

            av_freep(&band->prec);

        }

        av_freep(&reslevel->band);

    }

    ff_dwt_destroy(&comp->dwt);

    av_freep(&comp->reslevel);

    av_freep(&comp->i_data);

    av_freep(&comp->f_data);

}


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

     case ICSR0:

+        return s->status[0];
+
+    case ICSR1:
+
+        return s->status[1] | (1 << 3);			/* TNF */

     case ICFOR:

static uint64_t pxa2xx_fir_read(void *opaque, hwaddr addr,

                                unsigned size)

{

    PXA2xxFIrState *s = (PXA2xxFIrState *) opaque;

    uint8_t ret;

    switch (addr) {

    case ICCR0:

        return s->control[0];

    case ICCR1:

        return s->control[1];

    case ICCR2:

        return s->control[2];

    case ICDR:

        s->status[0] &= ~0x01;

        s->status[1] &= ~0x72;

        if (s->rx_len) {

            s->rx_len --;

            ret = s->rx_fifo[s->rx_start ++];

            s->rx_start &= 63;

            pxa2xx_fir_update(s);

            return ret;

        }

        printf("%s: Rx FIFO underrun.\n", __FUNCTION__);

        break;

    case ICSR0:

        return s->status[0];

    case ICSR1:

        return s->status[1] | (1 << 3);			/* TNF */

    case ICFOR:

        return s->rx_len;

    default:

        printf("%s: Bad register " REG_FMT "\n", __FUNCTION__, addr);

        break;

    }

    return 0;

}


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

 {

+    AVDictionaryEntry *t;

     if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {

void assert_avoptions(AVDictionary *m)

{

    AVDictionaryEntry *t;

    if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) {

        av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key);

        exit(1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int tta_decode_init(AVCodecContext * avctx)
 {
     TTAContext *s = avctx->priv_data;
+    int i;
+    s->avctx = avctx;
+    // 30bytes includes a seektable with one frame
+    if (avctx->extradata_size < 30)
+    init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size);
     if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc("TTA1")))
     {
         /* signature */

static int tta_decode_init(AVCodecContext * avctx)
{
    TTAContext *s = avctx->priv_data;
    int i;
    s->avctx = avctx;
    // 30bytes includes a seektable with one frame
    if (avctx->extradata_size < 30)
    init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size);
    if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc("TTA1")))
    {
        /* signature */
        skip_bits(&s->gb, 32);
//        if (get_bits_long(&s->gb, 32) != bswap_32(ff_get_fourcc("TTA1"))) {
//            av_log(s->avctx, AV_LOG_ERROR, "Missing magic\n");
//            return -1;
//        }
        s->flags = get_le16(&s->gb);
        if (s->flags != 1 && s->flags != 3)
        {
            av_log(s->avctx, AV_LOG_ERROR, "Invalid flags\n");
        s->is_float = (s->flags == FORMAT_FLOAT);
        avctx->channels = s->channels = get_le16(&s->gb);
        avctx->bits_per_sample = get_le16(&s->gb);
        s->bps = (avctx->bits_per_sample + 7) / 8;
        avctx->sample_rate = get_le32(&s->gb);
        if(avctx->sample_rate > 1000000){ //prevent FRAME_TIME * avctx->sample_rate from overflowing and sanity check
            av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
        s->data_length = get_le32(&s->gb);
        skip_bits(&s->gb, 32); // CRC32 of header
        if (s->is_float)
        {
            avctx->sample_fmt = SAMPLE_FMT_FLT;
            av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n");
        else switch(s->bps) {
//            case 1: avctx->sample_fmt = SAMPLE_FMT_U8; break;
            case 2: avctx->sample_fmt = SAMPLE_FMT_S16; break;
//            case 3: avctx->sample_fmt = SAMPLE_FMT_S24; break;
            case 4: avctx->sample_fmt = SAMPLE_FMT_S32; break;
            default:
                av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n");
        // FIXME: horribly broken, but directly from reference source
#define FRAME_TIME 1.04489795918367346939
        s->frame_length = (int)(FRAME_TIME * avctx->sample_rate);
        s->last_frame_length = s->data_length % s->frame_length;
        s->total_frames = s->data_length / s->frame_length +
                        (s->last_frame_length ? 1 : 0);
        av_log(s->avctx, AV_LOG_DEBUG, "flags: %x chans: %d bps: %d rate: %d block: %d\n",
            s->flags, avctx->channels, avctx->bits_per_sample, avctx->sample_rate,
            avctx->block_align);
        av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
            s->data_length, s->frame_length, s->last_frame_length, s->total_frames);
        // FIXME: seek table
        for (i = 0; i < s->total_frames; i++)
            skip_bits(&s->gb, 32);
        skip_bits(&s->gb, 32); // CRC32 of seektable
        s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels);
    } else {
        av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n");
    return 0;


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static inline void tcg_out_ldst(TCGContext *s, int ret, int addr, int offset, int op)
+
+{

     if (offset == (offset & 0xfff))

static inline void tcg_out_ldst(TCGContext *s, int ret, int addr, int offset, int op)

{

    if (offset == (offset & 0xfff))

        tcg_out32(s, op | INSN_RD(ret) | INSN_RS1(addr) |

                  INSN_IMM13(offset));

    else

        fprintf(stderr, "unimplemented %s with offset %d\n", __func__, offset);

}


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

     const uint8_t *src = pic->data[0];

+    int x, y;

+

     for (y = 0; y < avctx->height; y++) {

static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst)

{

    DPXContext *s = avctx->priv_data;

    const uint8_t *src = pic->data[0];

    int x, y;

    for (y = 0; y < avctx->height; y++) {

        for (x = 0; x < avctx->width; x++) {

            int value;

            if (s->big_endian) {

                value = ((AV_RB16(src + 6*x + 4) & 0xFFC0) >> 4)

                      | ((AV_RB16(src + 6*x + 2) & 0xFFC0) << 6)

                      | ((AV_RB16(src + 6*x + 0) & 0xFFC0) << 16);

            } else {

                value = ((AV_RL16(src + 6*x + 4) & 0xFFC0) >> 4)

                      | ((AV_RL16(src + 6*x + 2) & 0xFFC0) << 6)

                      | ((AV_RL16(src + 6*x + 0) & 0xFFC0) << 16);

            }

            write32(dst, value);

            dst += 4;

        }

        src += pic->linesize[0];

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+int pt_removexattr(FsContext *ctx, const char *path, const char *name)
+
+{
+
+    char *buffer;
+
+    int ret;

int pt_removexattr(FsContext *ctx, const char *path, const char *name)

{

    char *buffer;

    int ret;

    buffer = rpath(ctx, path);

    ret = lremovexattr(path, name);

    g_free(buffer);

    return ret;

}


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

+    cpu->cpu_index = UNASSIGNED_CPU_INDEX;

     cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;

static void cpu_common_initfn(Object *obj)

{

    CPUState *cpu = CPU(obj);

    CPUClass *cc = CPU_GET_CLASS(obj);

    cpu->cpu_index = UNASSIGNED_CPU_INDEX;

    cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;

    /* *-user doesn't have configurable SMP topology */

    /* the default value is changed by qemu_init_vcpu() for softmmu */

    cpu->nr_cores = 1;

    cpu->nr_threads = 1;

    qemu_mutex_init(&cpu->work_mutex);

    QTAILQ_INIT(&cpu->breakpoints);

    QTAILQ_INIT(&cpu->watchpoints);

    cpu->trace_dstate = bitmap_new(trace_get_vcpu_event_count());

    cpu_exec_initfn(cpu);

}


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

     MonitorQAPIEventState *evstate = opaque;

+    MonitorQAPIEventConf *evconf = &monitor_qapi_event_conf[evstate->event];

static void monitor_qapi_event_handler(void *opaque)

{

    MonitorQAPIEventState *evstate = opaque;

    MonitorQAPIEventConf *evconf = &monitor_qapi_event_conf[evstate->event];

    trace_monitor_protocol_event_handler(evstate->event, evstate->qdict);

    qemu_mutex_lock(&monitor_lock);

    if (evstate->qdict) {

        int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);

        monitor_qapi_event_emit(evstate->event, evstate->qdict);

        QDECREF(evstate->qdict);

        evstate->qdict = NULL;

        timer_mod_ns(evstate->timer, now + evconf->rate);

    } else {

        g_hash_table_remove(monitor_qapi_event_state, evstate);

        QDECREF(evstate->data);

        timer_free(evstate->timer);

        g_free(evstate);

    }

    qemu_mutex_unlock(&monitor_lock);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void gen_lq(DisasContext *ctx)
+
+{

+#if defined(CONFIG_USER_ONLY)

     gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

@@ -12,18 +12,18 @@

     TCGv EA;

+
+
     /* Restore CPU state */

     if (unlikely(ctx->mem_idx == 0)) {

         gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
+
+        return;
+
     }
+
     ra = rA(ctx->opcode);

     rd = rD(ctx->opcode);

static void gen_lq(DisasContext *ctx)

{

#if defined(CONFIG_USER_ONLY)

    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

#else

    int ra, rd;

    TCGv EA;

    /* Restore CPU state */

    if (unlikely(ctx->mem_idx == 0)) {

        gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

        return;

    }

    ra = rA(ctx->opcode);

    rd = rD(ctx->opcode);

    if (unlikely((rd & 1) || rd == ra)) {

        gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);

        return;

    }

    if (unlikely(ctx->le_mode)) {

        /* Little-endian mode is not handled */

        gen_exception_err(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);

        return;

    }

    gen_set_access_type(ctx, ACCESS_INT);

    EA = tcg_temp_new();

    gen_addr_imm_index(ctx, EA, 0x0F);

    gen_qemu_ld64(ctx, cpu_gpr[rd], EA);

    gen_addr_add(ctx, EA, EA, 8);

    gen_qemu_ld64(ctx, cpu_gpr[rd+1], EA);

    tcg_temp_free(EA);

#endif

}


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

     if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON))

+        av_log(NULL, AV_LOG_ERROR, "vector_fmul_scalar failed\n");
+
+
+
+    return ret;

 }

static int test_vector_fmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,

                                   const float *v1, float scale)

{

    LOCAL_ALIGNED(32, float, cdst, [LEN]);

    LOCAL_ALIGNED(32, float, odst, [LEN]);

    int ret;

    cdsp->vector_fmul_scalar(cdst, v1, scale, LEN);

    fdsp->vector_fmul_scalar(odst, v1, scale, LEN);

    if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON))

        av_log(NULL, AV_LOG_ERROR, "vector_fmul_scalar failed\n");

    return ret;

}


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

 {

+    TCGv_i64 tmp1 = tcg_temp_new_i64();

+    TCGv_i64 tmp2 = tcg_temp_new_i64();

static TCGv_i64 gen_mulu_i64_i32(TCGv a, TCGv b)

{

    TCGv_i64 tmp1 = tcg_temp_new_i64();

    TCGv_i64 tmp2 = tcg_temp_new_i64();

    tcg_gen_extu_i32_i64(tmp1, a);

    dead_tmp(a);

    tcg_gen_extu_i32_i64(tmp2, b);

    dead_tmp(b);

    tcg_gen_mul_i64(tmp1, tmp1, tmp2);

    tcg_temp_free_i64(tmp2);

    return tmp1;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void qxl_reset_state(PCIQXLDevice *d)

 {
+
+    QXLRam *ram = d->ram;

     QXLRom *rom = d->rom;

static void qxl_reset_state(PCIQXLDevice *d)

{

    QXLRam *ram = d->ram;

    QXLRom *rom = d->rom;

    assert(SPICE_RING_IS_EMPTY(&ram->cmd_ring));

    assert(SPICE_RING_IS_EMPTY(&ram->cursor_ring));

    d->shadow_rom.update_id = cpu_to_le32(0);

    *rom = d->shadow_rom;

    qxl_rom_set_dirty(d);

    init_qxl_ram(d);

    d->num_free_res = 0;

    d->last_release = NULL;

    memset(&d->ssd.dirty, 0, sizeof(d->ssd.dirty));

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     dc->realize = hpet_realize;

     dc->reset = hpet_reset;
+
+    dc->vmsd = &vmstate_hpet;
+
+    dc->props = hpet_device_properties;
+

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    dc->realize = hpet_realize;

    dc->reset = hpet_reset;

    dc->vmsd = &vmstate_hpet;

    dc->props = hpet_device_properties;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void virtio_config_writeb(VirtIODevice *vdev, uint32_t addr, uint32_t data)

 {
+
     VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);

     uint8_t val = data;

void virtio_config_writeb(VirtIODevice *vdev, uint32_t addr, uint32_t data)

{

    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);

    uint8_t val = data;

    if (addr > (vdev->config_len - sizeof(val)))

        return;

    stb_p(vdev->config + addr, val);

    if (k->set_config) {

        k->set_config(vdev, vdev->config);

    }

}


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

+    visit_start_list(v, NULL, NULL, 0, &error_abort);
+
+    visit_type_int(v, NULL, &i64, &error_abort);
+
+    g_assert_cmpint(i64, ==, 1);

     visit_type_int(v, NULL, &i64, &error_abort);

static void test_visitor_in_fail_list(TestInputVisitorData *data,

                                      const void *unused)

{

    int64_t i64 = -1;

    Visitor *v;

    /* Unvisited list tail */

    v = visitor_input_test_init(data, "[ 1, 2, 3 ]");

    visit_start_list(v, NULL, NULL, 0, &error_abort);

    visit_type_int(v, NULL, &i64, &error_abort);

    g_assert_cmpint(i64, ==, 1);

    visit_type_int(v, NULL, &i64, &error_abort);

    g_assert_cmpint(i64, ==, 2);

    visit_end_list(v, NULL);

    /* BUG: unvisited tail not reported; actually not reportable by design */

}


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

     int i;
+
     int32_t *dst = (int32_t *) _dst;

     const uint16_t *src = (const uint16_t *) _src;

static void hScale16_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src,

                       const int16_t *filter,

                       const int16_t *filterPos, int filterSize)

{

    int i;

    int32_t *dst = (int32_t *) _dst;

    const uint16_t *src = (const uint16_t *) _src;

    int bits = av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1;

    int sh = (bits <= 7) ? 11 : (bits - 4);

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

        int j;

        int srcPos = filterPos[i];

        unsigned int val = 0;

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

            val += src[srcPos + j] * filter[filterSize * i + j];

        }

        // filter=14 bit, input=16 bit, output=30 bit, >> 11 makes 19 bit

        dst[i] = FFMIN(val >> sh, (1 << 19) - 1);

    }

}


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

 {
+
 #if HAVE_TERMIOS_H

     if(!run_as_daemon){

static void term_init(void)

{

#if HAVE_TERMIOS_H

    if(!run_as_daemon){

    struct termios tty;

    tcgetattr (0, &tty);

    oldtty = tty;

    atexit(term_exit);

    tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP

                          |INLCR|IGNCR|ICRNL|IXON);

    tty.c_oflag |= OPOST;

    tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);

    tty.c_cflag &= ~(CSIZE|PARENB);

    tty.c_cflag |= CS8;

    tty.c_cc[VMIN] = 1;

    tty.c_cc[VTIME] = 0;

    tcsetattr (0, TCSANOW, &tty);

    signal(SIGQUIT, sigterm_handler); /* Quit (POSIX).  */

    }

#endif

    avformat_network_deinit();

    signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).    */

    signal(SIGTERM, sigterm_handler); /* Termination (ANSI).  */

#ifdef SIGXCPU

    signal(SIGXCPU, sigterm_handler);

#endif

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     if (graphic_rotate && (evt->kind == INPUT_EVENT_KIND_ABS)) {

             qemu_input_transform_abs_rotate(evt);
+
+
+
+
+    /* send event */

     s = qemu_input_find_handler(1 << evt->kind);

void qemu_input_event_send(QemuConsole *src, InputEvent *evt)

{

    QemuInputHandlerState *s;

    if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {

    qemu_input_event_trace(src, evt);

    /* pre processing */

    if (graphic_rotate && (evt->kind == INPUT_EVENT_KIND_ABS)) {

            qemu_input_transform_abs_rotate(evt);

    /* send event */

    s = qemu_input_find_handler(1 << evt->kind);

    s->handler->event(s->dev, src, evt);

    s->events++;


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline void os_host_main_loop_wait(int *timeout)

 {

static inline void os_host_main_loop_wait(int *timeout)

{

}


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

     int id = get_current_cpu(s);

+    return timerblock_read(&s->timerblock[id * 2], addr, size);
+
+}

static uint64_t arm_thistimer_read(void *opaque, target_phys_addr_t addr,

                                   unsigned size)

{

    arm_mptimer_state *s = (arm_mptimer_state *)opaque;

    int id = get_current_cpu(s);

    return timerblock_read(&s->timerblock[id * 2], addr, size);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void default_drive(int enable, int snapshot, int use_scsi,

+                          BlockInterfaceType type, int index,
+
+                          const char *optstr)
+
+{

     QemuOpts *opts;

static void default_drive(int enable, int snapshot, int use_scsi,

                          BlockInterfaceType type, int index,

                          const char *optstr)

{

    QemuOpts *opts;

    if (type == IF_DEFAULT) {

        type = use_scsi ? IF_SCSI : IF_IDE;

    }

    if (!enable || drive_get_by_index(type, index)) {

        return;

    }

    opts = drive_add(type, index, NULL, optstr);

    if (snapshot) {

        drive_enable_snapshot(opts, NULL);

    }

    if (!drive_init(opts, use_scsi)) {

        exit(1);

    }

}


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

     int64_t cpu_id;

+
+
+    cpu_id = k->get_arch_id(cpu);
+
+    if ((cpu_id / 8) >= ACPI_GPE_PROC_LEN) {

         error_setg(errp, "acpi: invalid cpu id: %" PRIi64, cpu_id);

static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu,

                                     Error **errp)

{

    CPUClass *k = CPU_GET_CLASS(cpu);

    int64_t cpu_id;

    cpu_id = k->get_arch_id(cpu);

    if ((cpu_id / 8) >= ACPI_GPE_PROC_LEN) {

        error_setg(errp, "acpi: invalid cpu id: %" PRIi64, cpu_id);

        return;

    }

    g->sts[cpu_id / 8] |= (1 << (cpu_id % 8));

}


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

                        uint8_t offset, uint8_t size)

+{
+
     int ret;

+    Error *local_err = NULL;

int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,

                       uint8_t offset, uint8_t size)

{

    int ret;

    Error *local_err = NULL;

    ret = pci_add_capability2(pdev, cap_id, offset, size, &local_err);

    if (local_err) {

        assert(ret < 0);

        error_report_err(local_err);

    } else {

        /* success implies a positive offset in config space */

        assert(ret > 0);

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 static ExitStatus gen_bcond(DisasContext *ctx, TCGCond cond, int ra,
+
                             int32_t disp, int mask)
+
+{

+    TCGv cmp_tmp;

+

     if (mask) {

static ExitStatus gen_bcond(DisasContext *ctx, TCGCond cond, int ra,

                            int32_t disp, int mask)

{

    TCGv cmp_tmp;

    if (mask) {

        cmp_tmp = tcg_temp_new();

        tcg_gen_andi_i64(cmp_tmp, load_gpr(ctx, ra), 1);

    } else {

        cmp_tmp = load_gpr(ctx, ra);

    }

    return gen_bcond_internal(ctx, cond, cmp_tmp, disp);

}


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

         qemu_coroutine_delete(co);

+    }
+
+
+
+    qemu_mutex_destroy(&pool_lock);

 }

static void __attribute__((destructor)) coroutine_pool_cleanup(void)

{

    Coroutine *co;

    Coroutine *tmp;

    QSLIST_FOREACH_SAFE(co, &pool, pool_next, tmp) {

        QSLIST_REMOVE_HEAD(&pool, pool_next);

        qemu_coroutine_delete(co);

    }

    qemu_mutex_destroy(&pool_lock);

}


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

     sysbus_init_mmio(dev, 0x1000, pci_mem_config);

+    sysbus_init_mmio(dev, 0x1000, pci_mem_data);
+
+    return 0;
+
+}

static int pci_dec_21154_init_device(SysBusDevice *dev)

{

    UNINState *s;

    int pci_mem_config, pci_mem_data;

    /* Uninorth bridge */

    s = FROM_SYSBUS(UNINState, dev);

    // XXX: s = &pci_bridge[2];

    pci_mem_config = cpu_register_io_memory(pci_unin_config_read,

                                            pci_unin_config_write, s);

    pci_mem_data = cpu_register_io_memory(pci_unin_main_read,

                                          pci_unin_main_write, &s->host_state);

    sysbus_init_mmio(dev, 0x1000, pci_mem_config);

    sysbus_init_mmio(dev, 0x1000, pci_mem_data);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
         val >>= 24;

+
+    cpu_physical_memory_write(addr, (uint8_t*)&val, len);
+
+
+
     if (conditional_wait(ch))

         goto wait;

static void store_word(DBDMA_channel *ch, int key, uint32_t addr,

                      uint16_t len)

{

    dbdma_cmd *current = &ch->current;

    uint32_t val;

    DBDMA_DPRINTF("store_word\n");

    /* only implements KEY_SYSTEM */

    if (key != KEY_SYSTEM) {

        printf("DBDMA: STORE_WORD, unimplemented key %x\n", key);

        kill_channel(ch);

        return;

    }

    val = current->cmd_dep;

    if (len == 2)

        val >>= 16;

    else if (len == 1)

        val >>= 24;

    cpu_physical_memory_write(addr, (uint8_t*)&val, len);

    if (conditional_wait(ch))

        goto wait;

    current->xfer_status = cpu_to_le16(be32_to_cpu(ch->regs[DBDMA_STATUS]));

    dbdma_cmdptr_save(ch);

    ch->regs[DBDMA_STATUS] &= cpu_to_be32(~FLUSH);

    conditional_interrupt(ch);

    next(ch);

wait:

    qemu_bh_schedule(dbdma_bh);

}


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

 {

+    return bs->open_flags;

 }

int bdrv_get_flags(BlockDriverState *bs)

{

    return bs->open_flags;

}


--- a/source.c
+++ b/source.c
@@ -61,11 +61,11 @@
         if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
             return ret;
         planes[0] = img->planes[VPX_PLANE_Y];
+        planes[1] = img->planes[VPX_PLANE_U];
+        planes[2] = img->planes[VPX_PLANE_V];
+        planes[3] =
+            ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] : NULL;
+        linesizes[0] = img->stride[VPX_PLANE_Y];
         linesizes[1] = img->stride[VPX_PLANE_U];
         linesizes[2] = img->stride[VPX_PLANE_V];
         linesizes[3] =

static int vpx_decode(AVCodecContext *avctx,
                      void *data, int *got_frame, AVPacket *avpkt)
{
    VPxContext *ctx = avctx->priv_data;
    AVFrame *picture = data;
    const void *iter = NULL;
    const void *iter_alpha = NULL;
    struct vpx_image *img, *img_alpha;
    int ret;
    uint8_t *side_data = NULL;
    int side_data_size = 0;
    ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
    if (ret)
        return ret;
    side_data = av_packet_get_side_data(avpkt,
                                        AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
                                        &side_data_size);
    if (side_data_size > 1) {
        const uint64_t additional_id = AV_RB64(side_data);
        side_data += 8;
        side_data_size -= 8;
        if (additional_id == 1) {  // 1 stands for alpha channel data.
            if (!ctx->has_alpha_channel) {
                ctx->has_alpha_channel = 1;
                ret = vpx_init(avctx,
#if CONFIG_LIBVPX_VP8_DECODER && CONFIG_LIBVPX_VP9_DECODER
                               (avctx->codec_id == AV_CODEC_ID_VP8) ?
                               &vpx_codec_vp8_dx_algo : &vpx_codec_vp9_dx_algo,
#elif CONFIG_LIBVPX_VP8_DECODER
                               &vpx_codec_vp8_dx_algo,
#else
                               &vpx_codec_vp9_dx_algo,
#endif
                               1);
                if (ret)
                    return ret;
            ret = decode_frame(avctx, &ctx->decoder_alpha, side_data,
                               side_data_size);
            if (ret)
                return ret;
    if ((img = vpx_codec_get_frame(&ctx->decoder, &iter)) &&
        (!ctx->has_alpha_channel ||
         (img_alpha = vpx_codec_get_frame(&ctx->decoder_alpha, &iter_alpha)))) {
        uint8_t *planes[4];
        int linesizes[4];
        if ((ret = set_pix_fmt(avctx, img, ctx->has_alpha_channel)) < 0) {
#ifdef VPX_IMG_FMT_HIGHBITDEPTH
            av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
                   img->fmt, img->bit_depth);
#else
            av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
                   img->fmt, 8);
#endif
            return ret;
        if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) {
            av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
                   avctx->width, avctx->height, img->d_w, img->d_h);
            ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
            if (ret < 0)
                return ret;
        if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
            return ret;
        planes[0] = img->planes[VPX_PLANE_Y];
        planes[1] = img->planes[VPX_PLANE_U];
        planes[2] = img->planes[VPX_PLANE_V];
        planes[3] =
            ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] : NULL;
        linesizes[0] = img->stride[VPX_PLANE_Y];
        linesizes[1] = img->stride[VPX_PLANE_U];
        linesizes[2] = img->stride[VPX_PLANE_V];
        linesizes[3] =
            ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0;
        av_image_copy(picture->data, picture->linesize, (const uint8_t**)planes,
                      linesizes, avctx->pix_fmt, img->d_w, img->d_h);
        *got_frame           = 1;
    return avpkt->size;


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

 {

+    SaveState *state = opaque;

     const char *current_name = MACHINE_GET_CLASS(current_machine)->name;

static int configuration_post_load(void *opaque, int version_id)

{

    SaveState *state = opaque;

    const char *current_name = MACHINE_GET_CLASS(current_machine)->name;

    if (strncmp(state->name, current_name, state->len) != 0) {

        error_report("Machine type received is '%s' and local is '%s'",

                     state->name, current_name);

        return -EINVAL;

    }

    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);

}


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

                                  uint64_t value, unsigned size)

+{
+
+    PXA2xxPICState *s = (PXA2xxPICState *) opaque;
+
+

     switch (offset) {

static void pxa2xx_pic_mem_write(void *opaque, hwaddr offset,

                                 uint64_t value, unsigned size)

{

    PXA2xxPICState *s = (PXA2xxPICState *) opaque;

    switch (offset) {

    case ICMR:	/* Mask register */

        s->int_enabled[0] = value;

        break;

    case ICMR2:	/* Mask register 2 */

        s->int_enabled[1] = value;

        break;

    case ICLR:	/* Level register */

        s->is_fiq[0] = value;

        break;

    case ICLR2:	/* Level register 2 */

        s->is_fiq[1] = value;

        break;

    case ICCR:	/* Idle mask */

        s->int_idle = (value & 1) ? 0 : ~0;

        break;

    case IPR0  ... IPR31:

        s->priority[0  + ((offset - IPR0 ) >> 2)] = value & 0x8000003f;

        break;

    case IPR32 ... IPR39:

        s->priority[32 + ((offset - IPR32) >> 2)] = value & 0x8000003f;

        break;

    default:

        printf("%s: Bad register offset " REG_FMT "\n", __FUNCTION__, offset);

        return;

    }

    pxa2xx_pic_update(opaque);

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
+static av_always_inline void filter_common(uint8_t *p, ptrdiff_t stride,
+
                                            int is4tap)

 {

     LOAD_PIXELS
+
     int a, f1, f2;

     const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
+

     a = 3 * (q0 - p0);

static av_always_inline void filter_common(uint8_t *p, ptrdiff_t stride,

                                           int is4tap)

{

    LOAD_PIXELS

    int a, f1, f2;

    const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;

    a = 3 * (q0 - p0);

    if (is4tap)

        a += clip_int8(p1 - q1);

    a = clip_int8(a);

    // We deviate from the spec here with c(a+3) >> 3

    // since that's what libvpx does.

    f1 = FFMIN(a + 4, 127) >> 3;

    f2 = FFMIN(a + 3, 127) >> 3;

    // Despite what the spec says, we do need to clamp here to

    // be bitexact with libvpx.

    p[-1 * stride] = cm[p0 + f2];

    p[ 0 * stride] = cm[q0 - f1];

    // only used for _inner on blocks without high edge variance

    if (!is4tap) {

        a = (f1 + 1) >> 1;

        p[-2 * stride] = cm[p1 + a];

        p[ 1 * stride] = cm[q1 - a];

    }

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
     sd_set_cardstatus(sd);

     sd_set_sdstatus(sd);
+
+
+
+    if (sd->wp_groups)
+
         g_free(sd->wp_groups);

     sd->wp_switch = sd->blk ? blk_is_read_only(sd->blk) : false;

static void sd_reset(SDState *sd)

{

    uint64_t size;

    uint64_t sect;

    if (sd->blk) {

        blk_get_geometry(sd->blk, &sect);

    } else {

        sect = 0;

    }

    size = sect << 9;

    sect = sd_addr_to_wpnum(size) + 1;

    sd->state = sd_idle_state;

    sd->rca = 0x0000;

    sd_set_ocr(sd);

    sd_set_scr(sd);

    sd_set_cid(sd);

    sd_set_csd(sd, size);

    sd_set_cardstatus(sd);

    sd_set_sdstatus(sd);

    if (sd->wp_groups)

        g_free(sd->wp_groups);

    sd->wp_switch = sd->blk ? blk_is_read_only(sd->blk) : false;

    sd->wpgrps_size = sect;

    sd->wp_groups = bitmap_new(sd->wpgrps_size);

    memset(sd->function_group, 0, sizeof(sd->function_group));

    sd->erase_start = 0;

    sd->erase_end = 0;

    sd->size = size;

    sd->blk_len = 0x200;

    sd->pwd_len = 0;

    sd->expecting_acmd = false;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void qmp_migrate_set_downtime(double value, Error **errp)

 {
+
+    value *= 1e9;

     value = MAX(0, MIN(UINT64_MAX, value));

void qmp_migrate_set_downtime(double value, Error **errp)

{

    value *= 1e9;

    value = MAX(0, MIN(UINT64_MAX, value));

    max_downtime = (uint64_t)value;

}


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

+    if (!ioc) {
+
+        error_setg(errp, "No listener socket available");
+
+        return;

     }

static void vnc_init_basic_info_from_server_addr(QIOChannelSocket *ioc,

                                                 VncBasicInfo *info,

                                                 Error **errp)

{

    SocketAddress *addr = NULL;

    if (!ioc) {

        error_setg(errp, "No listener socket available");

        return;

    }

    addr = qio_channel_socket_get_local_address(ioc, errp);

    if (!addr) {

        return;

    }

    vnc_init_basic_info(addr, info, errp);

    qapi_free_SocketAddress(addr);

}


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

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

+        HPETTimer *timer = &s->timer[i];
+
+        timer->qemu_timer = qemu_new_timer(vm_clock, hpet_timer, timer);
+
+    }

     hpet_reset(s);

void hpet_init(qemu_irq *irq) {

    int i, iomemtype;

    HPETState *s;

    dprintf ("hpet_init\n");

    s = qemu_mallocz(sizeof(HPETState));

    hpet_statep = s;

    s->irqs = irq;

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

        HPETTimer *timer = &s->timer[i];

        timer->qemu_timer = qemu_new_timer(vm_clock, hpet_timer, timer);

    }

    hpet_reset(s);

    vmstate_register(-1, &vmstate_hpet, s);

    qemu_register_reset(hpet_reset, s);

    /* HPET Area */

    iomemtype = cpu_register_io_memory(hpet_ram_read,

                                       hpet_ram_write, s);

    cpu_register_physical_memory(HPET_BASE, 0x400, iomemtype);

}


int64_t object_property_get_int(Object *obj, const char *name,

                                Error **errp)

{

    QObject *ret = object_property_get_qobject(obj, name, errp);

    QInt *qint;

    int64_t retval;

    if (!ret) {

        return -1;

    }

    qint = qobject_to_qint(ret);

    if (!qint) {

        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "int");

        retval = -1;

    } else {

        retval = qint_get_int(qint);

    }

    QDECREF(qint);

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void qemu_system_reset(bool report)

 {

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

     mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;
+

     cpu_synchronize_all_states();

void qemu_system_reset(bool report)

{

    MachineClass *mc;

    mc = current_machine ? MACHINE_GET_CLASS(current_machine) : NULL;

    cpu_synchronize_all_states();

    if (mc && mc->reset) {

        mc->reset();

    } else {

        qemu_devices_reset();

    }

    if (report) {

        qapi_event_send_reset(&error_abort);

    }

    cpu_synchronize_all_post_reset();

}


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

     ssize_t ret;
+
+#ifdef CONFIG_PREADV
+
+    ret = preadv(fs->fd, iov, iovcnt, offset);
+
 #else

     ret = lseek(fs->fd, offset, SEEK_SET);

static ssize_t proxy_preadv(FsContext *ctx, V9fsFidOpenState *fs,

                            const struct iovec *iov,

                            int iovcnt, off_t offset)

{

    ssize_t ret;

#ifdef CONFIG_PREADV

    ret = preadv(fs->fd, iov, iovcnt, offset);

#else

    ret = lseek(fs->fd, offset, SEEK_SET);

    if (ret >= 0) {

        ret = readv(fs->fd, iov, iovcnt);

    }

#endif

    return ret;

}


static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){

    if(get_rac(c, state+0))

        return 0;

    else{

        int i, e, a;

        e= 0;

        while(get_rac(c, state+1 + e)){ //1..10

            e++;

        }

        assert(e<=9);

        a= 1;

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

            a += a + get_rac(c, state+22 + i); //22..31

        }

        if(is_signed && get_rac(c, state+11 + e)) //11..21

            return -a;

        else

            return a;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void cin_decode_rle(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)

 {

+    int len, code;

     unsigned char *dst_end = dst + dst_size;

static void cin_decode_rle(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)

{

    int len, code;

    unsigned char *dst_end = dst + dst_size;

    const unsigned char *src_end = src + src_size;

    while (src < src_end && dst < dst_end) {

        code = *src++;

        if (code & 0x80) {

            len = code - 0x7F;

            memset(dst, *src++, FFMIN(len, dst_end - dst));

        } else {

            len = code + 1;

            memcpy(dst, src, FFMIN(len, dst_end - dst));

            src += len;

        }

        dst += len;

    }

}


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

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

                             unsigned int max_rsp_len)

static void chassis_control(IPMIBmcSim *ibs,

                            uint8_t *cmd, unsigned int cmd_len,

                            uint8_t *rsp, unsigned int *rsp_len,

                            unsigned int max_rsp_len)

{

    IPMIInterface *s = ibs->parent.intf;

    IPMIInterfaceClass *k = IPMI_INTERFACE_GET_CLASS(s);

    IPMI_CHECK_CMD_LEN(3);

    switch (cmd[2] & 0xf) {

    case 0: /* power down */

        rsp[2] = k->do_hw_op(s, IPMI_POWEROFF_CHASSIS, 0);

        break;

    case 1: /* power up */

        rsp[2] = k->do_hw_op(s, IPMI_POWERON_CHASSIS, 0);

        break;

    case 2: /* power cycle */

        rsp[2] = k->do_hw_op(s, IPMI_POWERCYCLE_CHASSIS, 0);

        break;

    case 3: /* hard reset */

        rsp[2] = k->do_hw_op(s, IPMI_RESET_CHASSIS, 0);

        break;

    case 4: /* pulse diagnostic interrupt */

        rsp[2] = k->do_hw_op(s, IPMI_PULSE_DIAG_IRQ, 0);

        break;

    case 5: /* soft shutdown via ACPI by overtemp emulation */

        rsp[2] = k->do_hw_op(s,

                             IPMI_SHUTDOWN_VIA_ACPI_OVERTEMP, 0);

        break;

    default:

        rsp[2] = IPMI_CC_INVALID_DATA_FIELD;

        return;

    }

}


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

     va_end(ap);

+    err->msg = qerror_format(fmt, err->obj);
+
+
+
+    *errp = err;

 }

void error_set(Error **errp, const char *fmt, ...)

{

    Error *err;

    va_list ap;

    if (errp == NULL) {

        return;

    }

    assert(*errp == NULL);

    err = g_malloc0(sizeof(*err));

    va_start(ap, fmt);

    err->obj = qobject_to_qdict(qobject_from_jsonv(fmt, &ap));

    va_end(ap);

    err->msg = qerror_format(fmt, err->obj);

    *errp = err;

}


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

     if (dev->attached) {

+        usb_device_detach(dev);
+
+    }
+
+    usb_device_handle_destroy(dev);

     if (dev->port) {

static int usb_qdev_exit(DeviceState *qdev)

{

    USBDevice *dev = USB_DEVICE(qdev);

    if (dev->attached) {

        usb_device_detach(dev);

    }

    usb_device_handle_destroy(dev);

    if (dev->port) {

        usb_release_port(dev);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static bool ranges_can_merge(Range *range1, Range *range2)
+
 {

     return !(range1->end < range2->begin || range2->end < range1->begin);

static bool ranges_can_merge(Range *range1, Range *range2)

{

    return !(range1->end < range2->begin || range2->end < range1->begin);

}


--- a/source.c
+++ b/source.c
@@ -13,7 +13,7 @@
     c->dv_demux = dv_init_demux(s);

     if (!c->dv_demux)
+
         return -1;

static int dv_read_header(AVFormatContext *s,

                          AVFormatParameters *ap)

{

    unsigned state;

    RawDVContext *c = s->priv_data;

    c->dv_demux = dv_init_demux(s);

    if (!c->dv_demux)

        return -1;

    state = get_be32(s->pb);

    while ((state & 0xffffff7f) != 0x1f07003f) {

        if (url_feof(s->pb)) {

            av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");

            return -1;

        }

        state = (state << 8) | get_byte(s->pb);

    }

    AV_WB32(c->buf, state);

    if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||

        url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)

        return AVERROR(EIO);

    c->dv_demux->sys = dv_frame_profile(c->buf);

    if (!c->dv_demux->sys) {

        av_log(s, AV_LOG_ERROR, "Can't determine profile of DV input stream.\n");

        return -1;

    }

    s->bit_rate = av_rescale_q(c->dv_demux->sys->frame_size, (AVRational){8,1},

                               c->dv_demux->sys->time_base);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void vmgenid_set_guid_auto_test(void)
+
 {
+
     const char *cmd;

     QemuUUID measured;

static void vmgenid_set_guid_auto_test(void)

{

    const char *cmd;

    QemuUUID measured;

    cmd = "-machine accel=tcg -device vmgenid,id=testvgid," "guid=auto";

    qtest_start(cmd);

    read_guid_from_memory(&measured);

    /* Just check that the GUID is non-null */

    g_assert(!qemu_uuid_is_null(&measured));

    qtest_quit(global_qtest);

}


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

     if (bit_depth == 8) {

+        c->h264_v_loop_filter_luma   = ff_h264_v_loop_filter_luma_neon;
+
+        c->h264_h_loop_filter_luma   = ff_h264_h_loop_filter_luma_neon;
+
+        if(chroma_format_idc == 1){

         c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;

static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth,

                                      const int chroma_format_idc)

{

#if HAVE_NEON

    if (bit_depth == 8) {

        c->h264_v_loop_filter_luma   = ff_h264_v_loop_filter_luma_neon;

        c->h264_h_loop_filter_luma   = ff_h264_h_loop_filter_luma_neon;

        if(chroma_format_idc == 1){

        c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;

        c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;

        }

        c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;

        c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon;

        c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon;

        c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon;

        c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon;

        c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon;

        c->h264_idct_add        = ff_h264_idct_add_neon;

        c->h264_idct_dc_add     = ff_h264_idct_dc_add_neon;

        c->h264_idct_add16      = ff_h264_idct_add16_neon;

        c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;

        if (chroma_format_idc <= 1)

            c->h264_idct_add8   = ff_h264_idct_add8_neon;

        c->h264_idct8_add       = ff_h264_idct8_add_neon;

        c->h264_idct8_dc_add    = ff_h264_idct8_dc_add_neon;

        c->h264_idct8_add4      = ff_h264_idct8_add4_neon;

    }

#endif // HAVE_NEON

}


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

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

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

static void apply_mdct(AC3EncodeContext *s)

{

    int blk, ch;

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

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

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

            const SampleType *input_samples = &s->planar_samples[ch][blk * AC3_BLOCK_SIZE];

            apply_window(&s->dsp, s->windowed_samples, input_samples, s->mdct.window, AC3_WINDOW_SIZE);

            block->exp_shift[ch] = normalize_samples(s);

            mdct512(&s->mdct, block->mdct_coef[ch], s->windowed_samples);

        }

    }

}


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

     qemu_mutex_init(&iothread->init_done_lock);

+    qemu_cond_init(&iothread->init_done_cond);
+
+
+
+    /* This assumes we are called from a thread with useful CPU affinity for us

      * to inherit.

static void iothread_complete(UserCreatable *obj, Error **errp)

{

    Error *local_error = NULL;

    IOThread *iothread = IOTHREAD(obj);

    iothread->stopping = false;

    iothread->thread_id = -1;

    iothread->ctx = aio_context_new(&local_error);

    if (!iothread->ctx) {

        error_propagate(errp, local_error);

        return;

    }

    qemu_mutex_init(&iothread->init_done_lock);

    qemu_cond_init(&iothread->init_done_cond);

    /* This assumes we are called from a thread with useful CPU affinity for us

     * to inherit.

     */

    qemu_thread_create(&iothread->thread, "iothread", iothread_run,

                       iothread, QEMU_THREAD_JOINABLE);

    /* Wait for initialization to complete */

    qemu_mutex_lock(&iothread->init_done_lock);

    while (iothread->thread_id == -1) {

        qemu_cond_wait(&iothread->init_done_cond,

                       &iothread->init_done_lock);

    }

    qemu_mutex_unlock(&iothread->init_done_lock);

}


static void opt_frame_aspect_ratio(const char *arg)

{

    int x = 0, y = 0;

    double ar = 0;

    const char *p;

    char *end;

    p = strchr(arg, ':');

    if (p) {

        x = strtol(arg, &end, 10);

        if (end == p)

            y = strtol(end+1, &end, 10);

        if (x > 0 && y > 0)

            ar = (double)x / (double)y;

    } else

        ar = strtod(arg, NULL);

    if (!ar) {

        fprintf(stderr, "Incorrect aspect ratio specification.\n");

        ffmpeg_exit(1);

    }

    frame_aspect_ratio = ar;

    x = vfilters ? strlen(vfilters) : 0;

    vfilters = av_realloc(vfilters, x+100);

    snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar);

}


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

         cpu_abort(cs, "Failed to read from exception vector table "

+                  "entry %08x\n", (unsigned)vec);
+
+    }
+
+    return addr;

 }

static uint32_t arm_v7m_load_vector(ARMCPU *cpu)

{

    CPUState *cs = CPU(cpu);

    CPUARMState *env = &cpu->env;

    MemTxResult result;

    hwaddr vec = env->v7m.vecbase + env->v7m.exception * 4;

    uint32_t addr;

    addr = address_space_ldl(cs->as, vec,

                             MEMTXATTRS_UNSPECIFIED, &result);

    if (result != MEMTX_OK) {

        /* Architecturally this should cause a HardFault setting HSFR.VECTTBL,

         * which would then be immediately followed by our failing to load

         * the entry vector for that HardFault, which is a Lockup case.

         * Since we don't model Lockup, we just report this guest error

         * via cpu_abort().

         */

        cpu_abort(cs, "Failed to read from exception vector table "

                  "entry %08x\n", (unsigned)vec);

    }

    return addr;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static av_cold int g726_init(AVCodecContext * avctx)

+{

     G726Context* c = avctx->priv_data;

static av_cold int g726_init(AVCodecContext * avctx)

{

    G726Context* c = avctx->priv_data;

    unsigned int index= (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate - 2;

    if (avctx->bit_rate % avctx->sample_rate && avctx->codec->encode) {

        av_log(avctx, AV_LOG_ERROR, "Bitrate - Samplerate combination is invalid\n");

        return -1;

    }

    if(avctx->channels != 1){

        av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");

        return -1;

    }

    if(index>3){

        av_log(avctx, AV_LOG_ERROR, "Unsupported number of bits %d\n", index+2);

        return -1;

    }

    g726_reset(c, index);

    c->code_size = index+2;

    avctx->coded_frame = avcodec_alloc_frame();

    if (!avctx->coded_frame)

        return AVERROR(ENOMEM);

    avctx->coded_frame->key_frame = 1;

    if (avctx->codec->decode)

        avctx->sample_fmt = SAMPLE_FMT_S16;

    return 0;

}


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

             return 0;

+    }
+
+    return f->buf[f->buf_index];
+
+}

static int qemu_peek_byte(QEMUFile *f)

{

    if (f->is_write)

        abort();

    if (f->buf_index >= f->buf_size) {

        qemu_fill_buffer(f);

        if (f->buf_index >= f->buf_size)

            return 0;

    }

    return f->buf[f->buf_index];

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 pvscsi_init_msi(PVSCSIState *s)
+
+{
+
     int res;

+    PCIDevice *d = PCI_DEVICE(s);

+

     res = msi_init(d, PVSCSI_MSI_OFFSET(s), PVSCSI_MSIX_NUM_VECTORS,

pvscsi_init_msi(PVSCSIState *s)

{

    int res;

    PCIDevice *d = PCI_DEVICE(s);

    res = msi_init(d, PVSCSI_MSI_OFFSET(s), PVSCSI_MSIX_NUM_VECTORS,

                   PVSCSI_USE_64BIT, PVSCSI_PER_VECTOR_MASK);

    if (res < 0) {

        trace_pvscsi_init_msi_fail(res);

        s->msi_used = false;

    } else {

        s->msi_used = true;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+int monitor_fdset_dup_fd_remove(int dupfd)
+
 {

     return -1;

int monitor_fdset_dup_fd_remove(int dupfd)

{

    return -1;

}


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

     if(!delay) delay=1; //SDL seems to be buggy when the delay is 0

+    SDL_AddTimer(delay, sdl_refresh_timer_cb, is);
+
 }

static void schedule_refresh(VideoState *is, int delay)

{

    if(!delay) delay=1; //SDL seems to be buggy when the delay is 0

    SDL_AddTimer(delay, sdl_refresh_timer_cb, is);

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     s->avctx = avctx;

+
+    avctx->pix_fmt = PIX_FMT_PAL8;
+
+    avctx->has_b_frames = 0;
+
     s->frame.data[0] = s->prev_frame.data[0] = NULL;

static int msrle_decode_init(AVCodecContext *avctx)

{

    MsrleContext *s = (MsrleContext *)avctx->priv_data;

    int i, j;

    unsigned char *palette;

    s->avctx = avctx;

    avctx->pix_fmt = PIX_FMT_PAL8;

    avctx->has_b_frames = 0;

    s->frame.data[0] = s->prev_frame.data[0] = NULL;

    /* convert palette */

    palette = (unsigned char *)s->avctx->extradata;

    memset (s->palette, 0, 256 * 4);

    for (i = 0, j = 0; i < s->avctx->extradata_size / 4; i++, j += 4)

        s->palette[i] =

            (palette[j + 2] << 16) |

            (palette[j + 1] <<  8) |

            (palette[j + 0] <<  0);

    return 0;

}


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

     int ret = 0;

+

     if (!dict || !data || !size)

int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)

{

    const uint8_t *end = data + size;

    int ret = 0;

    if (!dict || !data || !size)

        return ret;

    if (size && end[-1])

        return AVERROR_INVALIDDATA;

    while (data < end) {

        const uint8_t *key = data;

        const uint8_t *val = data + strlen(key) + 1;

        if (val >= end)

            return AVERROR_INVALIDDATA;

        ret = av_dict_set(dict, key, val, 0);

        if (ret < 0)

            break;

        data = val + strlen(val) + 1;

    }

    return ret;

}


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

     else if (ds_get_bytes_per_pixel(vs->ds) == 4)

+        jpeg_prepare_row32(vs, dst, x, y, count);
+
+    else
+
         jpeg_prepare_row16(vs, dst, x, y, count);

 }

static void jpeg_prepare_row(VncState *vs, uint8_t *dst, int x, int y,

                                       int count)

{

    if (vs->tight_pixel24)

        jpeg_prepare_row24(vs, dst, x, y, count);

    else if (ds_get_bytes_per_pixel(vs->ds) == 4)

        jpeg_prepare_row32(vs, dst, x, y, count);

    else

        jpeg_prepare_row16(vs, dst, x, y, count);

}


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

     }

+    s->esr = 0;
+
+    memset(s->icr, 0, sizeof(s->icr));
+
+    s->divide_conf = 0;

     s->count_shift = 0;

void apic_init_reset(DeviceState *dev)

{

    APICCommonState *s = APIC_COMMON(dev);

    APICCommonClass *info = APIC_COMMON_GET_CLASS(s);

    int i;

    if (!s) {

        return;

    }

    s->tpr = 0;

    s->spurious_vec = 0xff;

    s->log_dest = 0;

    s->dest_mode = 0xf;

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

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

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

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

        s->lvt[i] = APIC_LVT_MASKED;

    }

    s->esr = 0;

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

    s->divide_conf = 0;

    s->count_shift = 0;

    s->initial_count = 0;

    s->initial_count_load_time = 0;

    s->next_time = 0;

    s->wait_for_sipi = !cpu_is_bsp(s->cpu);

    if (s->timer) {

        timer_del(s->timer);

    }

    s->timer_expiry = -1;

    if (info->reset) {

        info->reset(s);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque)
+
 {

     balloon_event_fn = func;

void qemu_add_balloon_handler(QEMUBalloonEvent *func, void *opaque)

{

    balloon_event_fn = func;

    balloon_opaque = opaque;

}


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

+        set_bit(apic_id, cpu->found_cpus);
+
+    }
+
+

     object_child_foreach(o, acpi_add_cpu_info, opaque);

int acpi_add_cpu_info(Object *o, void *opaque)

{

    AcpiCpuInfo *cpu = opaque;

    uint64_t apic_id;

    if (object_dynamic_cast(o, TYPE_CPU)) {

        apic_id = object_property_get_int(o, "apic-id", NULL);

        assert(apic_id <= MAX_CPUMASK_BITS);

        set_bit(apic_id, cpu->found_cpus);

    }

    object_child_foreach(o, acpi_add_cpu_info, opaque);

    return 0;

}


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

         return -1;

+    }
+
+    if (read(fd, e_ident, sizeof(e_ident)) != sizeof(e_ident))
+
+        goto fail;

     if (e_ident[0] != ELFMAG0 ||

int load_elf(const char *filename, int64_t virt_to_phys_addend,

             uint64_t *pentry)

{

    int fd, data_order, must_swab, ret;

    uint8_t e_ident[EI_NIDENT];

    fd = open(filename, O_RDONLY | O_BINARY);

    if (fd < 0) {

        perror(filename);

        return -1;

    }

    if (read(fd, e_ident, sizeof(e_ident)) != sizeof(e_ident))

        goto fail;

    if (e_ident[0] != ELFMAG0 ||

        e_ident[1] != ELFMAG1 ||

        e_ident[2] != ELFMAG2 ||

        e_ident[3] != ELFMAG3)

        goto fail;

#ifdef WORDS_BIGENDIAN

    data_order = ELFDATA2MSB;

#else

    data_order = ELFDATA2LSB;

#endif

    must_swab = data_order != e_ident[EI_DATA];

    lseek(fd, 0, SEEK_SET);

    if (e_ident[EI_CLASS] == ELFCLASS64) {

        ret = load_elf64(fd, virt_to_phys_addend, must_swab, pentry);

    } else {

        ret = load_elf32(fd, virt_to_phys_addend, must_swab, pentry);

    }

    close(fd);

    return ret;

 fail:

    close(fd);

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,16 +1,16 @@
 void lance_init(NICInfo *nd, target_phys_addr_t leaddr, void *dma_opaque,

+                qemu_irq irq, qemu_irq *reset)

 {
+
     PCNetState *d;
+
+    int lance_io_memory;

+    qemu_check_nic_model(nd, "lance");

void lance_init(NICInfo *nd, target_phys_addr_t leaddr, void *dma_opaque,

                qemu_irq irq, qemu_irq *reset)

{

    PCNetState *d;

    int lance_io_memory;

    qemu_check_nic_model(nd, "lance");

    d = qemu_mallocz(sizeof(PCNetState));

    lance_io_memory =

        cpu_register_io_memory(0, lance_mem_read, lance_mem_write, d);

    d->dma_opaque = dma_opaque;

    *reset = *qemu_allocate_irqs(parent_lance_reset, d, 1);

    cpu_register_physical_memory(leaddr, 4, lance_io_memory);

    d->irq = irq;

    d->phys_mem_read = ledma_memory_read;

    d->phys_mem_write = ledma_memory_write;

    pcnet_common_init(d, nd);

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     bs = bdrv_find(str);

     if (bs == NULL) {
+
+        return -ENOENT;
+
+    }
+
     if (bdrv_attach_dev(bs, dev) < 0) {

         return -EEXIST;

static int parse_drive(DeviceState *dev, const char *str, void **ptr)

{

    BlockDriverState *bs;

    bs = bdrv_find(str);

    if (bs == NULL) {

        return -ENOENT;

    }

    if (bdrv_attach_dev(bs, dev) < 0) {

        return -EEXIST;

    }

    *ptr = bs;

    return 0;

}