--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+static void user_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd,
+
+                                   const QDict *params)
+
+{
+
+    int ret;
+
+
+
     MonitorCompletionData *cb_data = g_malloc(sizeof(*cb_data));

     cb_data->mon = mon;

static void user_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd,

                                   const QDict *params)

{

    int ret;

    MonitorCompletionData *cb_data = g_malloc(sizeof(*cb_data));

    cb_data->mon = mon;

    cb_data->user_print = cmd->user_print;

    monitor_suspend(mon);

    ret = cmd->mhandler.cmd_async(mon, params,

                                  user_monitor_complete, cb_data);

    if (ret < 0) {

        monitor_resume(mon);

        g_free(cb_data);

    }

}


static void bdrv_delete(BlockDriverState *bs)

{

    assert(!bs->dev);

    assert(!bs->job);

    assert(bdrv_op_blocker_is_empty(bs));

    assert(!bs->refcnt);

    assert(QLIST_EMPTY(&bs->dirty_bitmaps));

    bdrv_close(bs);

    /* remove from list, if necessary */

    bdrv_make_anon(bs);

    g_free(bs);

}


--- a/source.c
+++ b/source.c
@@ -37,11 +37,11 @@
     entry.cksum.offset = cpu_to_le32(checksum_offset);

     entry.cksum.start = cpu_to_le32(start_offset);
+
+    entry.cksum.length = cpu_to_le32(size);
+
+
+
     g_array_append_vals(linker, &entry, sizeof entry);

 }

void bios_linker_loader_add_checksum(GArray *linker, const char *file,

                                     GArray *table,

                                     void *start, unsigned size,

                                     uint8_t *checksum)

{

    BiosLinkerLoaderEntry entry;

    ptrdiff_t checksum_offset = (gchar *)checksum - table->data;

    ptrdiff_t start_offset = (gchar *)start - table->data;

    assert(checksum_offset >= 0);

    assert(start_offset >= 0);

    assert(checksum_offset + 1 <= table->len);

    assert(start_offset + size <= table->len);

    assert(*checksum == 0x0);

    memset(&entry, 0, sizeof entry);

    strncpy(entry.cksum.file, file, sizeof entry.cksum.file - 1);

    entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_CHECKSUM);

    entry.cksum.offset = cpu_to_le32(checksum_offset);

    entry.cksum.start = cpu_to_le32(start_offset);

    entry.cksum.length = cpu_to_le32(size);

    g_array_append_vals(linker, &entry, sizeof entry);

}


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

+                                 ptrdiff_t stride)
+
 {

     avc_luma_vt_qrt_16w_msa(src - (stride * 2), stride, dst, stride, 16, 1);

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

                                 ptrdiff_t stride)

{

    avc_luma_vt_qrt_16w_msa(src - (stride * 2), stride, dst, stride, 16, 1);

}


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

     if (dev->state != DEV_STATE_CREATED) {

+        error_set(errp, QERR_PERMISSION_DENIED);
+
+        return;
+
+    }

static void qdev_set_legacy_property(DeviceState *dev, Visitor *v, void *opaque,

                                     const char *name, Error **errp)

{

    Property *prop = opaque;

    if (dev->state != DEV_STATE_CREATED) {

        error_set(errp, QERR_PERMISSION_DENIED);

        return;

    }

    if (prop->info->parse) {

        Error *local_err = NULL;

        char *ptr = NULL;

        visit_type_str(v, &ptr, name, &local_err);

        if (!local_err) {

            int ret;

            ret = prop->info->parse(dev, prop, ptr);

            if (ret != 0) {

                error_set(errp, QERR_INVALID_PARAMETER_VALUE,

                          name, prop->info->name);

            }

            g_free(ptr);

        } else {

            error_propagate(errp, local_err);

        }

    } else {

        error_set(errp, QERR_PERMISSION_DENIED);

    }

}


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

 {

static void elcr_ioport_write(void *opaque, target_phys_addr_t addr,

                              uint64_t val, unsigned size)

{

    PICCommonState *s = opaque;

    s->elcr = val & s->elcr_mask;

}


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

     }

+    /* bbbb   aaaa        */
+
+    if (req->overlap_offset >= offset + bytes) {
+
+        return false;

     }

static bool tracked_request_overlaps(BdrvTrackedRequest *req,

                                     int64_t offset, unsigned int bytes)

{

    /*        aaaa   bbbb */

    if (offset >= req->overlap_offset + req->overlap_bytes) {

        return false;

    }

    /* bbbb   aaaa        */

    if (req->overlap_offset >= offset + bytes) {

        return false;

    }

    return true;

}


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

+    if (err)
+
+        qdev_unplug(&s->dev.qdev, NULL);
+
 }

static void usb_msd_password_cb(void *opaque, int err)

{

    MSDState *s = opaque;

    if (!err)

        err = usb_device_attach(&s->dev);

    if (err)

        qdev_unplug(&s->dev.qdev, NULL);

}


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

     Coroutine *co;
+
+    SheepdogReqCo srco = {

         .sockfd = sockfd,

static int do_req(int sockfd, AioContext *aio_context, SheepdogReq *hdr,

                  void *data, unsigned int *wlen, unsigned int *rlen)

{

    Coroutine *co;

    SheepdogReqCo srco = {

        .sockfd = sockfd,

        .aio_context = aio_context,

        .hdr = hdr,

        .data = data,

        .wlen = wlen,

        .rlen = rlen,

        .ret = 0,

        .finished = false,

    };

    if (qemu_in_coroutine()) {

        do_co_req(&srco);

    } else {

        co = qemu_coroutine_create(do_co_req);

        qemu_coroutine_enter(co, &srco);

        while (!srco.finished) {

            aio_poll(aio_context, true);

        }

    }

    return srco.ret;

}


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

 {

+    CPUBreakpoint *bp;
+
+
+
+    if (unlikely(!TAILQ_EMPTY(&env->breakpoints))) {

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

static void check_breakpoint(CPUState *env, DisasContext *dc)

{

    CPUBreakpoint *bp;

    if (unlikely(!TAILQ_EMPTY(&env->breakpoints))) {

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

            if (bp->pc == dc->pc) {

                t_gen_raise_exception(dc, EXCP_DEBUG);

                dc->is_jmp = DISAS_UPDATE;

             }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void vnc_dpy_resize(DisplayChangeListener *dcl,
+
                            DisplayState *ds)

 {

static void vnc_dpy_resize(DisplayChangeListener *dcl,

                           DisplayState *ds)

{

    VncDisplay *vd = ds->opaque;

    VncState *vs;

    vnc_abort_display_jobs(vd);

    /* server surface */

    qemu_pixman_image_unref(vd->server);

    vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,

                                          ds_get_width(ds),

                                          ds_get_height(ds),

                                          NULL, 0);

    /* guest surface */

#if 0 /* FIXME */

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

        console_color_init(ds);

#endif

    qemu_pixman_image_unref(vd->guest.fb);

    vd->guest.fb = pixman_image_ref(ds->surface->image);

    vd->guest.format = ds->surface->format;

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

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

        vnc_colordepth(vs);

        vnc_desktop_resize(vs);

        if (vs->vd->cursor) {

            vnc_cursor_define(vs);

        }

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

    }

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int dump_iterate(DumpState *s)
+
 {

     RAMBlock *block;
+
+    int64_t size;

     int ret;
+
+

     while (1) {

static int dump_iterate(DumpState *s)

{

    RAMBlock *block;

    int64_t size;

    int ret;

    while (1) {

        block = s->block;

        size = block->length;

        if (s->has_filter) {

            size -= s->start;

            if (s->begin + s->length < block->offset + block->length) {

                size -= block->offset + block->length - (s->begin + s->length);

            }

        }

        ret = write_memory(s, block, s->start, size);

        if (ret == -1) {

            return ret;

        }

        ret = get_next_block(s, block);

        if (ret == 1) {

            dump_completed(s);

            return 0;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+static void add_to_pool(BufferPoolEntry *buf)
+
+{
+
+    AVBufferPool *pool;
+
+    BufferPoolEntry *cur, *end = buf;
+
+
+
     if (!buf)

         return;

static void add_to_pool(BufferPoolEntry *buf)

{

    AVBufferPool *pool;

    BufferPoolEntry *cur, *end = buf;

    if (!buf)

        return;

    pool = buf->pool;

    while (end->next)

        end = end->next;

    while ((cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, NULL, buf))) {

        /* pool is not empty, retrieve it and append it to our list */

        cur = get_pool(pool);

        end->next = cur;

        while (end->next)

            end = end->next;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static CPUArchState *find_cpu(uint32_t thread_id)

+{
+
+    CPUState *cpu;

+

     cpu = qemu_get_cpu(thread_id);

static CPUArchState *find_cpu(uint32_t thread_id)

{

    CPUState *cpu;

    cpu = qemu_get_cpu(thread_id);

    if (cpu == NULL) {

        return NULL;

    }

    return cpu->env_ptr;

}


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

                                   int codec_tag, int format,

static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb,

                                  int codec_tag, int format,

                                  int size)

{

    int video_codec_id = ff_codec_get_id(ff_codec_movvideo_tags, format);

    if (codec_tag &&

         (codec_tag != format &&

          (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id

                                 : codec_tag != MKTAG('j','p','e','g')))) {

        /* Multiple fourcc, we skip JPEG. This is not correct, we should

         * export it as a separate AVStream but this needs a few changes

         * in the MOV demuxer, patch welcome. */

        av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");

        avio_skip(pb, size);

        return 1;

    }

    if ( codec_tag == AV_RL32("avc1") ||

         codec_tag == AV_RL32("hvc1") ||

         codec_tag == AV_RL32("hev1")

    )

        av_log(c->fc, AV_LOG_WARNING, "Concatenated H.264 or H.265 might not play correctly.\n");

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
                               uint32_t value)

 {
+
+    m5206_mbar_state *s = (m5206_mbar_state *)opaque;
+
+    int width;
+
     offset &= 0x3ff;

     if (offset >= 0x200) {

static void m5206_mbar_writew(void *opaque, target_phys_addr_t offset,

                              uint32_t value)

{

    m5206_mbar_state *s = (m5206_mbar_state *)opaque;

    int width;

    offset &= 0x3ff;

    if (offset >= 0x200) {

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

    }

    width = m5206_mbar_width[offset >> 2];

    if (width > 2) {

        uint32_t tmp;

        tmp = m5206_mbar_readl(opaque, offset & ~3);

        if (offset & 3) {

            tmp = (tmp & 0xffff0000) | value;

        } else {

            tmp = (tmp & 0x0000ffff) | (value << 16);

        }

        m5206_mbar_writel(opaque, offset & ~3, tmp);

        return;

    } else if (width < 2) {

        m5206_mbar_writeb(opaque, offset, value >> 8);

        m5206_mbar_writeb(opaque, offset + 1, value & 0xff);

        return;

    }

    m5206_mbar_write(s, offset, value, 2);

}


--- a/source.c
+++ b/source.c
@@ -12,11 +12,11 @@
     s->block_size = be32_to_cpu(s->block_size);
     ret = bdrv_pread(bs->file, 128 + 4, &s->n_blocks, 4);
     if (ret < 0) {
+        return ret;
+    s->n_blocks = be32_to_cpu(s->n_blocks);
+    /* read offsets */
+    offsets_size = s->n_blocks * sizeof(uint64_t);
+    s->offsets = g_malloc(offsets_size);
     ret = bdrv_pread(bs->file, 128 + 4 + 4, s->offsets, offsets_size);
     if (ret < 0) {
         goto fail;

static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
                      Error **errp)
{
    BDRVCloopState *s = bs->opaque;
    uint32_t offsets_size, max_compressed_block_size = 1, i;
    int ret;
    bs->read_only = 1;
    /* read header */
    ret = bdrv_pread(bs->file, 128, &s->block_size, 4);
    if (ret < 0) {
        return ret;
    s->block_size = be32_to_cpu(s->block_size);
    ret = bdrv_pread(bs->file, 128 + 4, &s->n_blocks, 4);
    if (ret < 0) {
        return ret;
    s->n_blocks = be32_to_cpu(s->n_blocks);
    /* read offsets */
    offsets_size = s->n_blocks * sizeof(uint64_t);
    s->offsets = g_malloc(offsets_size);
    ret = bdrv_pread(bs->file, 128 + 4 + 4, s->offsets, offsets_size);
    if (ret < 0) {
        goto fail;
    for(i=0;i<s->n_blocks;i++) {
        s->offsets[i] = be64_to_cpu(s->offsets[i]);
        if (i > 0) {
            uint32_t size = s->offsets[i] - s->offsets[i - 1];
            if (size > max_compressed_block_size) {
                max_compressed_block_size = size;
    /* initialize zlib engine */
    s->compressed_block = g_malloc(max_compressed_block_size + 1);
    s->uncompressed_block = g_malloc(s->block_size);
    if (inflateInit(&s->zstream) != Z_OK) {
        ret = -EINVAL;
        goto fail;
    s->current_block = s->n_blocks;
    s->sectors_per_block = s->block_size/512;
    bs->total_sectors = s->n_blocks * s->sectors_per_block;
    qemu_co_mutex_init(&s->lock);
    return 0;
fail:
    g_free(s->offsets);
    g_free(s->compressed_block);
    g_free(s->uncompressed_block);
    return ret;


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

 {

+    struct etrax_serial *s = opaque;
+
+    D(CPUCRISState *env = s->env);
+
+    uint32_t r = 0;

ser_read(void *opaque, target_phys_addr_t addr, unsigned int size)

{

    struct etrax_serial *s = opaque;

    D(CPUCRISState *env = s->env);

    uint32_t r = 0;

    addr >>= 2;

    switch (addr)

    {

        case R_STAT_DIN:

            r = s->rx_fifo[(s->rx_fifo_pos - s->rx_fifo_len) & 15];

            if (s->rx_fifo_len) {

                r |= 1 << STAT_DAV;

            }

            r |= 1 << STAT_TR_RDY;

            r |= 1 << STAT_TR_IDLE;

            break;

        case RS_STAT_DIN:

            r = s->rx_fifo[(s->rx_fifo_pos - s->rx_fifo_len) & 15];

            if (s->rx_fifo_len) {

                r |= 1 << STAT_DAV;

                s->rx_fifo_len--;

            }

            r |= 1 << STAT_TR_RDY;

            r |= 1 << STAT_TR_IDLE;

            break;

        default:

            r = s->regs[addr];

            D(qemu_log("%s " TARGET_FMT_plx "=%x\n", __func__, addr, r));

            break;

    }

    return r;

}


--- 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
@@ -6,11 +6,11 @@

     AVABufferSinkParams *params;

+
+
+    if (!opaque) {
+
+        av_log(ctx, AV_LOG_ERROR,

                "No opaque field provided, an AVABufferSinkParams struct is required\n");

static av_cold int asink_init(AVFilterContext *ctx, const char *args, void *opaque)

{

    BufferSinkContext *buf = ctx->priv;

    AVABufferSinkParams *params;

    if (!opaque) {

        av_log(ctx, AV_LOG_ERROR,

               "No opaque field provided, an AVABufferSinkParams struct is required\n");

        return AVERROR(EINVAL);

    } else

        params = (AVABufferSinkParams *)opaque;

    buf->sample_fmts     = params->sample_fmts;

    buf->channel_layouts = params->channel_layouts;

    buf->packing_fmts    = params->packing_fmts;

    return common_init(ctx);

}


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

     if (io_thread_fd == -1) {

+        return;
+
+    }
+
+    do {

         ret = write(io_thread_fd, &val, sizeof(val));

void qemu_notify_event(void)

{

    /* Write 8 bytes to be compatible with eventfd.  */

    static const uint64_t val = 1;

    ssize_t ret;

    if (io_thread_fd == -1) {

        return;

    }

    do {

        ret = write(io_thread_fd, &val, sizeof(val));

    } while (ret < 0 && errno == EINTR);

    /* EAGAIN is fine, a read must be pending.  */

    if (ret < 0 && errno != EAGAIN) {

        fprintf(stderr, "qemu_notify_event: write() failed: %s\n",

                strerror(errno));

        exit(1);

    }

}


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

 {

+    const char *device = qdict_get_str(qdict, "device");

+    BlockDriverState *bs;

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

{

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

    BlockDriverState *bs;

    if (!strcmp(device, "all")) {

        bdrv_commit_all();

    } else {

        int ret;

        bs = bdrv_find(device);

        if (!bs) {

            qerror_report(QERR_DEVICE_NOT_FOUND, device);

            return;

        }

        ret = bdrv_commit(bs);

        if (ret == -EBUSY) {

            qerror_report(QERR_DEVICE_IN_USE, device);

            return;

        }

    }

}


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

     avio_wb32(pb, 0);                              /* size */

+    ffio_wfourcc(pb, "name");                      /* Data format */
+
+    avio_wb16(pb, strlen(reel_name));              /* string size */
+
     avio_wb16(pb, track->language);                /* langcode */

     avio_write(pb, reel_name, strlen(reel_name));  /* reel name */

static int mov_write_source_reference_tag(AVIOContext *pb, MOVTrack *track, const char *reel_name){

    int64_t pos = avio_tell(pb);

    avio_wb32(pb, 0);                              /* size */

    ffio_wfourcc(pb, "name");                      /* Data format */

    avio_wb16(pb, strlen(reel_name));              /* string size */

    avio_wb16(pb, track->language);                /* langcode */

    avio_write(pb, reel_name, strlen(reel_name));  /* reel name */

    return update_size(pb,pos);

}


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

+
     if (avctx == avctx_from)

         return 0;

static int mimic_decode_update_thread_context(AVCodecContext *avctx, const AVCodecContext *avctx_from)

{

    MimicContext *dst = avctx->priv_data, *src = avctx_from->priv_data;

    int i, ret;

    if (avctx == avctx_from)

        return 0;

    dst->cur_index  = src->next_cur_index;

    dst->prev_index = src->next_prev_index;

    memcpy(dst->flipped_ptrs, src->flipped_ptrs, sizeof(src->flipped_ptrs));

    for (i = 0; i < FF_ARRAY_ELEMS(dst->frames); i++) {

        ff_thread_release_buffer(avctx, &dst->frames[i]);

        if (src->frames[i].f->data[0]) {

            ret = ff_thread_ref_frame(&dst->frames[i], &src->frames[i]);

            if (ret < 0)

                return ret;

        }

    }

    return 0;

}


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

 {
+
+    AHCIQState *ahci;
+

     ahci = ahci_boot_and_enable();

static void test_identify(void)

{

    AHCIQState *ahci;

    ahci = ahci_boot_and_enable();

    ahci_test_identify(ahci);

    ahci_shutdown(ahci);

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
     while (!qemu_system_ready)

         qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100);
+
+
+
+    while (1) {
+
         cpu_exec_all();

         qemu_tcg_wait_io_event();

static void *tcg_cpu_thread_fn(void *arg)

{

    CPUState *env = arg;

    qemu_tcg_init_cpu_signals();

    qemu_thread_self(env->thread);

    /* signal CPU creation */

    qemu_mutex_lock(&qemu_global_mutex);

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

        env->created = 1;

    qemu_cond_signal(&qemu_cpu_cond);

    /* and wait for machine initialization */

    while (!qemu_system_ready)

        qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100);

    while (1) {

        cpu_exec_all();

        qemu_tcg_wait_io_event();

    }

    return NULL;

}


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

         .from = offset,

+        .len = count,

     };

int nbd_client_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset,

                                int count, BdrvRequestFlags flags)

{

    ssize_t ret;

    NBDClientSession *client = nbd_get_client_session(bs);

    NBDRequest request = {

        .type = NBD_CMD_WRITE_ZEROES,

        .from = offset,

        .len = count,

    };

    NBDReply reply;

    if (!(client->nbdflags & NBD_FLAG_SEND_WRITE_ZEROES)) {

        return -ENOTSUP;

    }

    if (flags & BDRV_REQ_FUA) {

        assert(client->nbdflags & NBD_FLAG_SEND_FUA);

        request.flags |= NBD_CMD_FLAG_FUA;

    }

    if (!(flags & BDRV_REQ_MAY_UNMAP)) {

        request.flags |= NBD_CMD_FLAG_NO_HOLE;

    }

    nbd_coroutine_start(client, &request);

    ret = nbd_co_send_request(bs, &request, NULL);

    if (ret < 0) {

        reply.error = -ret;

    } else {

        nbd_co_receive_reply(client, &request, &reply, NULL);

    }

    nbd_coroutine_end(bs, &request);

    return -reply.error;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+static void decode_v1_vector(CinepakEncContext *s, AVPicture *sub_pict, mb_info *mb, strip_info *info)
+
+{
+
+    int entry_size = s->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4;
+
+
+
+    sub_pict->data[0][0] =

             sub_pict->data[0][1] =

static void decode_v1_vector(CinepakEncContext *s, AVPicture *sub_pict, mb_info *mb, strip_info *info)

{

    int entry_size = s->pix_fmt == AV_PIX_FMT_YUV420P ? 6 : 4;

    sub_pict->data[0][0] =

            sub_pict->data[0][1] =

            sub_pict->data[0][    sub_pict->linesize[0]] =

            sub_pict->data[0][1+  sub_pict->linesize[0]] = info->v1_codebook[mb->v1_vector*entry_size];

    sub_pict->data[0][2] =

            sub_pict->data[0][3] =

            sub_pict->data[0][2+  sub_pict->linesize[0]] =

            sub_pict->data[0][3+  sub_pict->linesize[0]] = info->v1_codebook[mb->v1_vector*entry_size+1];

    sub_pict->data[0][2*sub_pict->linesize[0]] =

            sub_pict->data[0][1+2*sub_pict->linesize[0]] =

            sub_pict->data[0][  3*sub_pict->linesize[0]] =

            sub_pict->data[0][1+3*sub_pict->linesize[0]] = info->v1_codebook[mb->v1_vector*entry_size+2];

    sub_pict->data[0][2+2*sub_pict->linesize[0]] =

            sub_pict->data[0][3+2*sub_pict->linesize[0]] =

            sub_pict->data[0][2+3*sub_pict->linesize[0]] =

            sub_pict->data[0][3+3*sub_pict->linesize[0]] = info->v1_codebook[mb->v1_vector*entry_size+3];

    if(s->pix_fmt == AV_PIX_FMT_YUV420P) {

        sub_pict->data[1][0] =

            sub_pict->data[1][1] =

            sub_pict->data[1][    sub_pict->linesize[1]] =

            sub_pict->data[1][1+  sub_pict->linesize[1]] = info->v1_codebook[mb->v1_vector*entry_size+4];

        sub_pict->data[2][0] =

            sub_pict->data[2][1] =

            sub_pict->data[2][    sub_pict->linesize[2]] =

            sub_pict->data[2][1+  sub_pict->linesize[2]] = info->v1_codebook[mb->v1_vector*entry_size+5];

    }

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     inv = arith_get_model_sym(acoder, &ctx->edge_mode);

     val = arith_get_model_sym(acoder, &ctx->pivot) + 1;
+

     if (val > 2) {

static int decode_pivot(MSS1Context *ctx, ArithCoder *acoder, int base)

{

    int val, inv;

    inv = arith_get_model_sym(acoder, &ctx->edge_mode);

    val = arith_get_model_sym(acoder, &ctx->pivot) + 1;

    if (val > 2) {

        if ((base + 1) / 2 - 2 <= 0) {

            ctx->corrupted = 1;

            return 0;

        }

        val = arith_get_number(acoder, (base + 1) / 2 - 2) + 3;

    }

    if (val == base) {

        ctx->corrupted = 1;

        return 0;

    }

    return inv ? base - val : val;

}


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

     if (adts->write_adts) {

+        ff_adts_write_frame_header(adts, buf, pkt->size, adts->pce_size);
+
+        avio_write(pb, buf, ADTS_HEADER_SIZE);
+
+        if (adts->pce_size) {

             avio_write(pb, adts->pce_data, adts->pce_size);

static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)

{

    ADTSContext *adts = s->priv_data;

    AVIOContext *pb = s->pb;

    uint8_t buf[ADTS_HEADER_SIZE];

    if (!pkt->size)

        return 0;

    if (adts->write_adts) {

        ff_adts_write_frame_header(adts, buf, pkt->size, adts->pce_size);

        avio_write(pb, buf, ADTS_HEADER_SIZE);

        if (adts->pce_size) {

            avio_write(pb, adts->pce_data, adts->pce_size);

            adts->pce_size = 0;

        }

    }

    avio_write(pb, pkt->data, pkt->size);

    avio_flush(pb);

    return 0;

}


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

                                             int flags)
+
 {

     static RAMBlock *block = NULL;
@@ -13,7 +13,7 @@
     uint8_t len;

+
     if (flags & RAM_SAVE_FLAG_CONTINUE) {

         if (!block) {

static inline void *host_from_stream_offset(QEMUFile *f,

                                            ram_addr_t offset,

                                            int flags)

{

    static RAMBlock *block = NULL;

    char id[256];

    uint8_t len;

    if (flags & RAM_SAVE_FLAG_CONTINUE) {

        if (!block) {

            error_report("Ack, bad migration stream!");

            return NULL;

        }

        return memory_region_get_ram_ptr(block->mr) + offset;

    }

    len = qemu_get_byte(f);

    qemu_get_buffer(f, (uint8_t *)id, len);

    id[len] = 0;

    QTAILQ_FOREACH(block, &ram_list.blocks, next) {

        if (!strncmp(id, block->idstr, sizeof(id)))

            return memory_region_get_ram_ptr(block->mr) + offset;

    }

    error_report("Can't find block %s!", id);

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static V9fsFidState *lookup_fid(V9fsState *s, int32_t fid)
+
+{
+
+    V9fsFidState *f;

static V9fsFidState *lookup_fid(V9fsState *s, int32_t fid)

{

    V9fsFidState *f;

    for (f = s->fid_list; f; f = f->next) {

        if (f->fid == fid) {

            v9fs_do_setuid(s, f->uid);

            return f;

        }

    }

    return NULL;

}


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

     }

+
+
+    src_width = (s->xres + 3) & ~3;     /* Pad to a 4 pixels multiple */
+
+    if (s->bpp == pxa_lcdc_19pbpp || s->bpp == pxa_lcdc_18pbpp) {

         src_width *= 3;

static void pxa2xx_lcdc_dma0_redraw_rot270(PXA2xxLCDState *s,

               hwaddr addr, int *miny, int *maxy)

{

    DisplaySurface *surface = qemu_console_surface(s->con);

    int src_width, dest_width;

    drawfn fn = NULL;

    if (s->dest_width) {

        fn = s->line_fn[s->transp][s->bpp];

    }

    if (!fn) {

        return;

    }

    src_width = (s->xres + 3) & ~3;     /* Pad to a 4 pixels multiple */

    if (s->bpp == pxa_lcdc_19pbpp || s->bpp == pxa_lcdc_18pbpp) {

        src_width *= 3;

    } else if (s->bpp > pxa_lcdc_16bpp) {

        src_width *= 4;

    } else if (s->bpp > pxa_lcdc_8bpp) {

        src_width *= 2;

    }

    dest_width = s->yres * s->dest_width;

    *miny = 0;

    framebuffer_update_display(surface, s->sysmem,

                               addr, s->xres, s->yres,

                               src_width, -s->dest_width, dest_width,

                               s->invalidated,

                               fn, s->dma_ch[0].palette,

                               miny, maxy);

}


--- a/source.c
+++ b/source.c
@@ -37,11 +37,11 @@
     size = FFMIN(max_size, size);

     res = av_get_packet(s->pb, pkt, size);
+
+    if (res < 0)
+
+        return res;
+

static int aiff_read_packet(AVFormatContext *s,

                            AVPacket *pkt)

{

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

    AIFFInputContext *aiff = s->priv_data;

    int64_t max_size;

    int res, size;

    /* calculate size of remaining data */

    max_size = aiff->data_end - avio_tell(s->pb);

    if (max_size <= 0)

        return AVERROR_EOF;

    /* Now for that packet */

    if (st->codec->block_align >= 33) // GSM, QCLP, IMA4

        size = st->codec->block_align;

    else

        size = (MAX_SIZE / st->codec->block_align) * st->codec->block_align;

    size = FFMIN(max_size, size);

    res = av_get_packet(s->pb, pkt, size);

    if (res < 0)

        return res;

    /* Only one stream in an AIFF file */

    pkt->stream_index = 0;

    pkt->duration     = (res / st->codec->block_align) * aiff->block_duration;

    return 0;

}


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

     call_ref(ref0, ref1, ref2, BUF_SIZE / sizeof(int32_t));

+    call_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t));
+
+    if (memcmp(ref0, new0, BUF_SIZE) || memcmp(ref1, new1, BUF_SIZE) ||
+
+        memcmp(ref2, new2, BUF_SIZE))

         fail();

static void check_mct(uint8_t *ref0, uint8_t *ref1, uint8_t *ref2,

                      uint8_t *new0, uint8_t *new1, uint8_t *new2) {

    declare_func(void, void *src0, void *src1, void *src2, int csize);

    randomize_buffers();

    call_ref(ref0, ref1, ref2, BUF_SIZE / sizeof(int32_t));

    call_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t));

    if (memcmp(ref0, new0, BUF_SIZE) || memcmp(ref1, new1, BUF_SIZE) ||

        memcmp(ref2, new2, BUF_SIZE))

        fail();

    bench_new(new0, new1, new2, BUF_SIZE / sizeof(int32_t));

}


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

     int err;

+
+
+    if (mxf->metadata_sets_count+1 >= UINT_MAX / sizeof(*mxf->metadata_sets))
+
+        return AVERROR(ENOMEM);

     if ((err = av_reallocp_array(&mxf->metadata_sets, mxf->metadata_sets_count + 1,

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

{

    int err;

    if (mxf->metadata_sets_count+1 >= UINT_MAX / sizeof(*mxf->metadata_sets))

        return AVERROR(ENOMEM);

    if ((err = av_reallocp_array(&mxf->metadata_sets, mxf->metadata_sets_count + 1,

                                 sizeof(*mxf->metadata_sets))) < 0) {

        mxf->metadata_sets_count = 0;

        return err;

    }

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

    mxf->metadata_sets_count++;

    return 0;

}


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

     char *q = av_malloc(sizeof(char) * len);
+
+    if (!q) return -1;
+
+    strncpy(q, p, len);

     ret = atoi(q);

static int to_integer(char *p, int len)

{

    int ret;

    char *q = av_malloc(sizeof(char) * len);

    if (!q) return -1;

    strncpy(q, p, len);

    ret = atoi(q);

    av_free(q);

    return ret;

}


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

     /* find frame with lowest picture number */
+
     for (i = 1; s->delay_frames[i]; i++)

         if (s->delay_frames[i]->avframe->display_picture_number < out->avframe->display_picture_number) {

static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)

{

    DiracFrame *out = s->delay_frames[0];

    int i, out_idx  = 0;

    int ret;

    /* find frame with lowest picture number */

    for (i = 1; s->delay_frames[i]; i++)

        if (s->delay_frames[i]->avframe->display_picture_number < out->avframe->display_picture_number) {

            out     = s->delay_frames[i];

            out_idx = i;

        }

    for (i = out_idx; s->delay_frames[i]; i++)

        s->delay_frames[i] = s->delay_frames[i+1];

    if (out) {

        out->reference ^= DELAYED_PIC_REF;

        *got_frame = 1;

        if((ret = av_frame_ref(picture, out->avframe)) < 0)

            return ret;

    }

    return 0;

}


static int huff_build12(VLC *vlc, uint8_t *len)

{

    HuffEntry he[4096];

    uint32_t codes[4096];

    uint8_t bits[4096];

    uint16_t syms[4096];

    uint32_t code;

    int i;

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

        he[i].sym = 4095 - i;

        he[i].len = len[i];

        if (len[i] == 0)

            return AVERROR_INVALIDDATA;

    }

    AV_QSORT(he, 4096, HuffEntry, huff_cmp_len12);

    code = 1;

    for (i = 4095; i >= 0; i--) {

        codes[i] = code >> (32 - he[i].len);

        bits[i]  = he[i].len;

        syms[i]  = he[i].sym;

        code += 0x80000000u >> (he[i].len - 1);

    }

    ff_free_vlc(vlc);

    return ff_init_vlc_sparse(vlc, FFMIN(he[4095].len, 14), 4096,

                              bits,  sizeof(*bits),  sizeof(*bits),

                              codes, sizeof(*codes), sizeof(*codes),

                              syms,  sizeof(*syms),  sizeof(*syms), 0);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int line_out_init (HWVoiceOut *hw, struct audsettings *as)

 {

static int line_out_init (HWVoiceOut *hw, struct audsettings *as)

{

    SpiceVoiceOut *out = container_of (hw, SpiceVoiceOut, hw);

    struct audsettings settings;

#if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= 3

    settings.freq       = spice_server_get_best_playback_rate(NULL);

#else

    settings.freq       = SPICE_INTERFACE_PLAYBACK_FREQ;

#endif

    settings.nchannels  = SPICE_INTERFACE_PLAYBACK_CHAN;

    settings.fmt        = AUD_FMT_S16;

    settings.endianness = AUDIO_HOST_ENDIANNESS;

    audio_pcm_init_info (&hw->info, &settings);

    hw->samples = LINE_OUT_SAMPLES;

    out->active = 0;

    out->sin.base.sif = &playback_sif.base;

    qemu_spice_add_interface (&out->sin.base);

#if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= 3

    spice_server_set_playback_rate(&out->sin, settings.freq);

#endif

    return 0;

}


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

     assert(wanted_type == QCOW2_CLUSTER_ZERO ||
+
+           wanted_type == QCOW2_CLUSTER_UNALLOCATED);
+
+    for (i = 0; i < nb_clusters; i++) {
+
         uint64_t entry = be64_to_cpu(l2_table[i]);

         QCow2ClusterType type = qcow2_get_cluster_type(entry);

static int count_contiguous_clusters_unallocated(int nb_clusters,

                                                 uint64_t *l2_table,

                                                 QCow2ClusterType wanted_type)

{

    int i;

    assert(wanted_type == QCOW2_CLUSTER_ZERO ||

           wanted_type == QCOW2_CLUSTER_UNALLOCATED);

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

        uint64_t entry = be64_to_cpu(l2_table[i]);

        QCow2ClusterType type = qcow2_get_cluster_type(entry);

        if (type != wanted_type || entry & L2E_OFFSET_MASK) {

            break;

        }

    }

    return i;

}


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

+    /* vram (surfaces, 64bit, bar 4+5) */
+
+    if (qxl->vram_size_mb != -1) {
+
+        qxl->vram_size = qxl->vram_size_mb * 1024 * 1024;

     if (qxl->vram_size < qxl->vram32_size) {

static void qxl_init_ramsize(PCIQXLDevice *qxl)

{

    /* vga mode framebuffer / primary surface (bar 0, first part) */

    if (qxl->vgamem_size_mb < 8) {

        qxl->vgamem_size_mb = 8;

    qxl->vgamem_size = qxl->vgamem_size_mb * 1024 * 1024;

    /* vga ram (bar 0, total) */

    if (qxl->ram_size_mb != -1) {

        qxl->vga.vram_size = qxl->ram_size_mb * 1024 * 1024;

    if (qxl->vga.vram_size < qxl->vgamem_size * 2) {

        qxl->vga.vram_size = qxl->vgamem_size * 2;

    /* vram32 (surfaces, 32bit, bar 1) */

    if (qxl->vram32_size_mb != -1) {

        qxl->vram32_size = qxl->vram32_size_mb * 1024 * 1024;

    if (qxl->vram32_size < 4096) {

        qxl->vram32_size = 4096;

    /* vram (surfaces, 64bit, bar 4+5) */

    if (qxl->vram_size_mb != -1) {

        qxl->vram_size = qxl->vram_size_mb * 1024 * 1024;

    if (qxl->vram_size < qxl->vram32_size) {

        qxl->vram_size = qxl->vram32_size;

    if (qxl->revision == 1) {

        qxl->vram32_size = 4096;

        qxl->vram_size = 4096;

    qxl->vgamem_size = msb_mask(qxl->vgamem_size * 2 - 1);

    qxl->vga.vram_size = msb_mask(qxl->vga.vram_size * 2 - 1);

    qxl->vram32_size = msb_mask(qxl->vram32_size * 2 - 1);

    qxl->vram_size = msb_mask(qxl->vram_size * 2 - 1);


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void qmp_deserialize(void **native_out, void *datap,

+                            VisitorFunc visit, Error **errp)
+
 {

     QmpSerializeData *d = datap;

static void qmp_deserialize(void **native_out, void *datap,

                            VisitorFunc visit, Error **errp)

{

    QmpSerializeData *d = datap;

    QString *output_json = qobject_to_json(qmp_output_get_qobject(d->qov));

    QObject *obj = qobject_from_json(qstring_get_str(output_json));

    QDECREF(output_json);

    d->qiv = qmp_input_visitor_new(obj);

    qobject_decref(obj);

    visit(qmp_input_get_visitor(d->qiv), native_out, errp);

}


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

 {

+	DIS(fprintf (logfile, "move $s%u, $r%u\n", dc->op2, dc->op1));
+
+	cris_cc_mask(dc, 0);

 	tcg_gen_helper_0_2(helper_movl_reg_sreg,

static unsigned int dec_move_sr(DisasContext *dc)

{

	DIS(fprintf (logfile, "move $s%u, $r%u\n", dc->op2, dc->op1));

	cris_cc_mask(dc, 0);

	tcg_gen_helper_0_2(helper_movl_reg_sreg,

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

	return 2;

}


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

     double ret = 0;

+
+
+    ff_dlog(ctx, "get_scene_score()\n");

static double get_scene_score(AVFilterContext *ctx, AVFrame *crnt, AVFrame *next)

{

    FrameRateContext *s = ctx->priv;

    double ret = 0;

    ff_dlog(ctx, "get_scene_score()\n");

    if (crnt->height == next->height &&

        crnt->width  == next->width) {

        int64_t sad;

        double mafd, diff;

        ff_dlog(ctx, "get_scene_score() process\n");

        if (s->bitdepth == 8)

            sad = scene_sad8(s, crnt->data[0], crnt->linesize[0], next->data[0], next->linesize[0], crnt->height);

        else

            sad = scene_sad16(s, (const uint16_t*)crnt->data[0], crnt->linesize[0] >> 1, (const uint16_t*)next->data[0], next->linesize[0] >> 1, crnt->height);

        mafd = (double)sad * 100.0 / (crnt->height * crnt->width) / (1 << s->bitdepth);

        diff = fabs(mafd - s->prev_mafd);

        ret  = av_clipf(FFMIN(mafd, diff), 0, 100.0);

        s->prev_mafd = mafd;

    }

    ff_dlog(ctx, "get_scene_score() result is:%f\n", ret);

    return ret;

}


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

         tcg_out32(s, WRY | INSN_IMM13(val));

+    else
+
+        fprintf(stderr, "unimplemented sety %ld\n", (long)val);

 }

static inline void tcg_out_sety(TCGContext *s, tcg_target_long val)

{

    if (val == 0 || val == -1)

        tcg_out32(s, WRY | INSN_IMM13(val));

    else

        fprintf(stderr, "unimplemented sety %ld\n", (long)val);

}


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

     int i = 0;

+
+
+    pci_dev = DO_UPCAST(PCIDevice, qdev, dev);
+
+    pci_ide = DO_UPCAST(PCIIDEState, dev, pci_dev);

static int pci_piix3_xen_ide_unplug(DeviceState *dev)

{

    PCIDevice *pci_dev;

    PCIIDEState *pci_ide;

    DriveInfo *di;

    int i = 0;

    pci_dev = DO_UPCAST(PCIDevice, qdev, dev);

    pci_ide = DO_UPCAST(PCIIDEState, dev, pci_dev);

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

        di = drive_get_by_index(IF_IDE, i);

        if (di != NULL && di->bdrv != NULL && !di->bdrv->removable) {

            DeviceState *ds = bdrv_get_attached(di->bdrv);

            if (ds) {

                bdrv_detach(di->bdrv, ds);

            }

            bdrv_close(di->bdrv);

            pci_ide->bus[di->bus].ifs[di->unit].bs = NULL;

            drive_put_ref(di);

        }

    }

    qdev_reset_all(&(pci_ide->dev.qdev));

    return 0;

}


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

         cpu_outb(addr, val);
+
+        break;
+
+    case 2:
+
         cpu_outw(addr, val);

         break;

static void bw_io_write(void *opaque, target_phys_addr_t addr,

                        uint64_t val, unsigned size)

{

    switch (size) {

    case 1:

        cpu_outb(addr, val);

        break;

    case 2:

        cpu_outw(addr, val);

        break;

    case 4:

        cpu_outl(addr, val);

        break;

    default:

        abort();

    }

}


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

+
         ret = raw_write_scrubbed_bootsect(bs, buf);

         if (ret < 0) {

static int raw_write(BlockDriverState *bs, int64_t sector_num,

                     const uint8_t *buf, int nb_sectors)

{

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

        int ret;

        ret = raw_write_scrubbed_bootsect(bs, buf);

        if (ret < 0) {

            return ret;

        }

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

        if (ret < 0) {

            return ret;

        }

        return ret + 512;

    }

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

}


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

             s->counthigh, s->count);

+    s->count = count & TIMER_COUNT_MASK32;
+
+    s->counthigh = count >> 32;
+
 }

static void slavio_timer_get_out(SLAVIO_TIMERState *s)

{

    uint64_t count;

    count = s->limit - PERIODS_TO_LIMIT(ptimer_get_count(s->timer));

    DPRINTF("get_out: limit %" PRIx64 " count %x%08x\n", s->limit,

            s->counthigh, s->count);

    s->count = count & TIMER_COUNT_MASK32;

    s->counthigh = count >> 32;

}


--- a/source.c
+++ b/source.c
@@ -7,5 +7,5 @@
     s->width  = width;

     s->height = height;
+
+}

void avcodec_set_dimensions(AVCodecContext *s, int width, int height){

    s->coded_width = width;

    s->coded_height= height;

    s->width  = width;

    s->height = height;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 rgb48funcs(rgb, LE, PIX_FMT_RGB48LE)
+
 rgb48funcs(rgb, BE, PIX_FMT_RGB48BE)

 rgb48funcs(bgr, LE, PIX_FMT_BGR48LE)

rgb48funcs(rgb, LE, PIX_FMT_RGB48LE)

rgb48funcs(rgb, BE, PIX_FMT_RGB48BE)

rgb48funcs(bgr, LE, PIX_FMT_BGR48LE)

rgb48funcs(bgr, BE, PIX_FMT_BGR48BE)

#define input_pixel(i) ((origin == PIX_FMT_RGBA || origin == PIX_FMT_BGRA || \

                         origin == PIX_FMT_ARGB || origin == PIX_FMT_ABGR) ? AV_RN32A(&src[(i)*4]) : \

                        (isBE(origin) ? AV_RB16(&src[(i)*2]) : AV_RL16(&src[(i)*2])))

static av_always_inline void

rgb16_32ToY_c_template(uint8_t *dst, const uint8_t *src,

                       int width, enum PixelFormat origin,

                       int shr,   int shg,   int shb, int shp,

                       int maskr, int maskg, int maskb,

                       int rsh,   int gsh,   int bsh, int S)

{

    const int ry = RY << rsh, gy = GY << gsh, by = BY << bsh,

              rnd = 33 << (S - 1);

    int i;

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

        int px = input_pixel(i) >> shp;

        int b = (px & maskb) >> shb;

        int g = (px & maskg) >> shg;

        int r = (px & maskr) >> shr;

        dst[i] = (ry * r + gy * g + by * b + rnd) >> S;

    }

}


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

     struct timeval t2;

+
+
+    gettimeofday(&t2, NULL);
+
+

static void aio_write_done(void *opaque, int ret)

{

    struct aio_ctx *ctx = opaque;

    struct timeval t2;

    gettimeofday(&t2, NULL);

    if (ret < 0) {

        printf("aio_write failed: %s\n", strerror(-ret));

        goto out;

    }

    if (ctx->qflag) {

        goto out;

    }

    /* Finally, report back -- -C gives a parsable format */

    t2 = tsub(t2, ctx->t1);

    print_report("wrote", &t2, ctx->offset, ctx->qiov.size,

                 ctx->qiov.size, 1, ctx->Cflag);

out:

    qemu_io_free(ctx->buf);

    free(ctx);

}


--- a/source.c
+++ b/source.c
@@ -1,26 +1,26 @@
+static int local_rename(FsContext *ctx, const char *oldpath,
+
+                        const char *newpath)
+
+{
+
+    int err;

+    char *buffer, *buffer1;
+
+
+
+    if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
+
         err = local_create_mapped_attr_dir(ctx, newpath);

         if (err < 0) {
+
+            return err;
+
+        }
+
+        /* rename the .virtfs_metadata files */

         buffer = local_mapped_attr_path(ctx, oldpath);

static int local_rename(FsContext *ctx, const char *oldpath,

                        const char *newpath)

{

    int err;

    char *buffer, *buffer1;

    if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {

        err = local_create_mapped_attr_dir(ctx, newpath);

        if (err < 0) {

            return err;

        }

        /* rename the .virtfs_metadata files */

        buffer = local_mapped_attr_path(ctx, oldpath);

        buffer1 = local_mapped_attr_path(ctx, newpath);

        err = rename(buffer, buffer1);

        g_free(buffer);

        g_free(buffer1);

        if (err < 0 && errno != ENOENT) {

            return err;

        }

    }

    buffer = rpath(ctx, oldpath);

    buffer1 = rpath(ctx, newpath);

    err = rename(buffer, buffer1);

    g_free(buffer);

    g_free(buffer1);

    return err;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     float64 ret;

     clear_float_exceptions(env);
+
+    ret = int64_to_float64(src, &env->fp_status);
+
     check_ieee_exceptions(env);

     return ret;

float64 helper_fxtod(CPUSPARCState *env, int64_t src)

{

    float64 ret;

    clear_float_exceptions(env);

    ret = int64_to_float64(src, &env->fp_status);

    check_ieee_exceptions(env);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static RemoveResult remove_hpte(CPUPPCState *env, target_ulong ptex,

                                 target_ulong avpn,
+
                                 target_ulong flags,

                                 target_ulong *vp, target_ulong *rp)

static RemoveResult remove_hpte(CPUPPCState *env, target_ulong ptex,

                                target_ulong avpn,

                                target_ulong flags,

                                target_ulong *vp, target_ulong *rp)

{

    hwaddr hpte;

    target_ulong v, r, rb;

    if ((ptex * HASH_PTE_SIZE_64) & ~env->htab_mask) {

        return REMOVE_PARM;

    }

    hpte = ptex * HASH_PTE_SIZE_64;

    v = ppc_hash64_load_hpte0(env, hpte);

    r = ppc_hash64_load_hpte1(env, hpte);

    if ((v & HPTE64_V_VALID) == 0 ||

        ((flags & H_AVPN) && (v & ~0x7fULL) != avpn) ||

        ((flags & H_ANDCOND) && (v & avpn) != 0)) {

        return REMOVE_NOT_FOUND;

    }

    *vp = v;

    *rp = r;

    ppc_hash64_store_hpte0(env, hpte, HPTE64_V_HPTE_DIRTY);

    rb = compute_tlbie_rb(v, r, ptex);

    ppc_tlb_invalidate_one(env, rb);

    return REMOVE_SUCCESS;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void acquire_privilege(const char *name, Error **errp)
+
 {

     HANDLE token;
@@ -13,7 +13,7 @@
     if (OpenProcessToken(GetCurrentProcess(),

         TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &token))
+
     {

         if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) {

static void acquire_privilege(const char *name, Error **errp)

{

    HANDLE token;

    TOKEN_PRIVILEGES priv;

    Error *local_err = NULL;

    if (OpenProcessToken(GetCurrentProcess(),

        TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &token))

    {

        if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) {

            error_set(&local_err, QERR_QGA_COMMAND_FAILED,

                      "no luid for requested privilege");

            goto out;

        }

        priv.PrivilegeCount = 1;

        priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

        if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) {

            error_set(&local_err, QERR_QGA_COMMAND_FAILED,

                      "unable to acquire requested privilege");

            goto out;

        }

        CloseHandle(token);

    } else {

        error_set(&local_err, QERR_QGA_COMMAND_FAILED,

                  "failed to open privilege token");

    }

out:

    if (local_err) {

        error_propagate(errp, local_err);

    }

}


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

 {
+
+    uint64_t tmp;

     uint64_t result;

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

{

    uint64_t tmp;

    uint64_t result;

    DO_ABD(result, a, b, uint16_t);

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

    return result | (tmp << 32);

}


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

     int *image_line;

+    int frame_index;
+
     const int numcomps = image->numcomps;

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

             return 0;

+        }

     }

static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image)

{

    int compno;

    int x;

    int y;

    int width;

    int height;

    int *image_line;

    int frame_index;

    const int numcomps = image->numcomps;

    for (compno = 0; compno < numcomps; ++compno) {

        if (image->comps[compno].w > frame->linesize[compno]) {

            av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n");

            return 0;

        }

    }

    for (compno = 0; compno < numcomps; ++compno) {

        width  = avctx->width / image->comps[compno].dx;

        height = avctx->height / image->comps[compno].dy;

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

            image_line = image->comps[compno].data + y * image->comps[compno].w;

            frame_index = y * frame->linesize[compno];

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

                image_line[x] = frame->data[compno][frame_index++];

            for (; x < image->comps[compno].w; ++x) {

                image_line[x] = image_line[x - 1];

            }

        }

        for (; y < image->comps[compno].h; ++y) {

            image_line = image->comps[compno].data + y * image->comps[compno].w;

            for (x = 0; x < image->comps[compno].w; ++x) {

                image_line[x] = image_line[x - image->comps[compno].w];

            }

        }

    }

    return 1;

}


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

{

#ifdef HAVE_MMXFIXME

#else

	int i;

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

		dst[i]= src[2*i];

#endif

}


--- a/source.c
+++ b/source.c
@@ -10,7 +10,7 @@
     fd = buf_descriptor->fd;
     av_free(buf_descriptor);
     res = ioctl (fd, VIDIOC_QBUF, &buf);
+    if (res < 0) {
+        av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF)\n");
+    pkt->data = NULL;
+    pkt->size = 0;

static void mmap_release_buffer(AVPacket *pkt)
{
    struct v4l2_buffer buf;
    int res, fd;
    struct buff_data *buf_descriptor = pkt->priv;
    memset(&buf, 0, sizeof(struct v4l2_buffer));
    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    buf.memory = V4L2_MEMORY_MMAP;
    buf.index = buf_descriptor->index;
    fd = buf_descriptor->fd;
    av_free(buf_descriptor);
    res = ioctl (fd, VIDIOC_QBUF, &buf);
    if (res < 0) {
        av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF)\n");
    pkt->data = NULL;
    pkt->size = 0;


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

                                                  const char *model,

+                                                 const char *name,

                                                  int fd, int is_connected)

static NetSocketState *net_socket_fd_init_stream(VLANState *vlan,

                                                 const char *model,

                                                 const char *name,

                                                 int fd, int is_connected)

{

    NetSocketState *s;

    s = qemu_mallocz(sizeof(NetSocketState));

    s->fd = fd;

    s->vc = qemu_new_vlan_client(vlan, model, name,

                                 net_socket_receive, NULL, s);

    snprintf(s->vc->info_str, sizeof(s->vc->info_str),

             "socket: fd=%d", fd);

    if (is_connected) {

        net_socket_connect(s);

    } else {

        qemu_set_fd_handler(s->fd, NULL, net_socket_connect, s);

    }

    return s;

}


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

     }

+    msix_load(&proxy->pci_dev, f);

     if (msix_present(&proxy->pci_dev)) {

static int virtio_pci_load_config(void * opaque, QEMUFile *f)

{

    VirtIOPCIProxy *proxy = opaque;

    int ret;

    ret = pci_device_load(&proxy->pci_dev, f);

    if (ret) {

        return ret;

    }

    msix_load(&proxy->pci_dev, f);

    if (msix_present(&proxy->pci_dev)) {

        qemu_get_be16s(f, &proxy->vdev->config_vector);

    } else {

        proxy->vdev->config_vector = VIRTIO_NO_VECTOR;

    }

    if (proxy->vdev->config_vector != VIRTIO_NO_VECTOR) {

        return msix_vector_use(&proxy->pci_dev, proxy->vdev->config_vector);

    }

    /* Try to find out if the guest has bus master disabled, but is

       in ready state. Then we have a buggy guest OS. */

    if (!(proxy->vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) &&

        !(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {

        proxy->bugs |= VIRTIO_PCI_BUG_BUS_MASTER;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void test_visitor_in_fail_list(TestInputVisitorData *data,
                                       const void *unused)
 {
+    int64_t i64 = -1;
+    Error *err = NULL;
+    Visitor *v;
     /* Unvisited list tail */
     v = visitor_input_test_init(data, "[ 1, 2, 3 ]");
     visit_type_int(v, NULL, &i64, &error_abort);

static void test_visitor_in_fail_list(TestInputVisitorData *data,
                                      const void *unused)
{
    int64_t i64 = -1;
    Error *err = NULL;
    Visitor *v;
    /* Unvisited list tail */
    v = visitor_input_test_init(data, "[ 1, 2, 3 ]");
    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_check_list(v, &err);
}


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

         } else {

+            /* fall back on uncompressed */
+
+            count = count_pixels(ptr, w-x, bpp, 0);
+
+            *out++ = (count ^ xor_raw) + add_raw;

int ff_rle_encode(uint8_t *outbuf, int out_size, const uint8_t *ptr , int bpp, int w,

                  int add_rep, int xor_rep, int add_raw, int xor_raw)

{

    int count, x;

    uint8_t *out = outbuf;

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

        /* see if we can encode the next set of pixels with RLE */

        if((count = count_pixels(ptr, w-x, bpp, 1)) > 1) {

            if(out + bpp + 1 > outbuf + out_size) return -1;

            *out++ = (count ^ xor_rep) + add_rep;

            memcpy(out, ptr, bpp);

            out += bpp;

        } else {

            /* fall back on uncompressed */

            count = count_pixels(ptr, w-x, bpp, 0);

            *out++ = (count ^ xor_raw) + add_raw;

            if(out + bpp*count > outbuf + out_size) return -1;

            memcpy(out, ptr, bpp * count);

            out += bpp * count;

        }

        ptr += count * bpp;

    }

    return out - outbuf;

}


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

     }
+
+
+
+    while (rdma->nb_sent) {
+
         ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL);

         if (ret < 0) {

static int qemu_rdma_drain_cq(QEMUFile *f, RDMAContext *rdma)

{

    int ret;

    if (qemu_rdma_write_flush(f, rdma) < 0) {

        return -EIO;

    }

    while (rdma->nb_sent) {

        ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE, NULL);

        if (ret < 0) {

            fprintf(stderr, "rdma migration: complete polling error!\n");

            return -EIO;

        }

    }

    qemu_rdma_unregister_waiting(rdma);

    return 0;

}


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

+
+    /* Is it a skip block? */

     if (get_bits1(gb)) {

static int fic_decode_block(FICContext *ctx, GetBitContext *gb,

                            uint8_t *dst, int stride, int16_t *block, int *is_p)

{

    int i, num_coeff;

    /* Is it a skip block? */

    if (get_bits1(gb)) {

        *is_p = 1;

        return 0;

    }

    memset(block, 0, sizeof(*block) * 64);

    num_coeff = get_bits(gb, 7);

    if (num_coeff > 64)

        return AVERROR_INVALIDDATA;

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

        block[ff_zigzag_direct[i]] = get_se_golomb(gb) *

                                     ctx->qmat[ff_zigzag_direct[i]];

    fic_idct_put(dst, stride, block);

    return 0;

}


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

                     enum PixelFormat pix_fmt, int top_band, int left_band)

+{
+
+    int y_shift;
+
+    int x_shift;

int av_picture_crop(AVPicture *dst, const AVPicture *src,

                    enum PixelFormat pix_fmt, int top_band, int left_band)

{

    int y_shift;

    int x_shift;

    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)

        return -1;

    y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;

    x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;

    if (is_yuv_planar(&pix_fmt_info[pix_fmt])) {

    dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;

    dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift);

    dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift);

    } else{

        if(top_band % (1<<y_shift) || left_band % (1<<x_shift))

            return -1;

        if(left_band) //FIXME add support for this too

            return -1;

        dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;

    }

    dst->linesize[0] = src->linesize[0];

    dst->linesize[1] = src->linesize[1];

    dst->linesize[2] = src->linesize[2];

    return 0;

}


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

     uint32_t io_int_word = (isc << 27) | IO_INT_WORD_AI;

+
+
+    trace_css_adapter_interrupt(isc);

     s390_io_interrupt(cpu, 0, 0, 0, io_int_word);

void css_adapter_interrupt(uint8_t isc)

{

    S390CPU *cpu = s390_cpu_addr2state(0);

    uint32_t io_int_word = (isc << 27) | IO_INT_WORD_AI;

    trace_css_adapter_interrupt(isc);

    s390_io_interrupt(cpu, 0, 0, 0, io_int_word);

}


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

 {

+    uint32_t val;
+
+    val = ioport_read(2, addr);

     trace_cpu_in(addr, val);

uint32_t cpu_inl(pio_addr_t addr)

{

    uint32_t val;

    val = ioport_read(2, addr);

    trace_cpu_in(addr, val);

    LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);

    return val;

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
             gdb_set_stop_cpu(env);

             debug_requested = EXCP_DEBUG;
+
+            break;
+
+        }
+
     }

     return tcg_has_work();

bool tcg_cpu_exec(void)

{

    int ret = 0;

    if (next_cpu == NULL)

        next_cpu = first_cpu;

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

        CPUState *env = cur_cpu = next_cpu;

        qemu_clock_enable(vm_clock,

                          (cur_cpu->singlestep_enabled & SSTEP_NOTIMER) == 0);

        if (qemu_alarm_pending())

            break;

        if (cpu_can_run(env))

            ret = qemu_cpu_exec(env);

        else if (env->stop)

            break;

        if (ret == EXCP_DEBUG) {

            gdb_set_stop_cpu(env);

            debug_requested = EXCP_DEBUG;

            break;

        }

    }

    return tcg_has_work();

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void xilinx_axidma_init(Object *obj)

 {
+
+    XilinxAXIDMA *s = XILINX_AXI_DMA(obj);

     SysBusDevice *sbd = SYS_BUS_DEVICE(obj);

static void xilinx_axidma_init(Object *obj)

{

    XilinxAXIDMA *s = XILINX_AXI_DMA(obj);

    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);

    object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE,

                             (Object **)&s->tx_data_dev, &error_abort);

    object_property_add_link(obj, "axistream-control-connected",

                             TYPE_STREAM_SLAVE,

                             (Object **)&s->tx_control_dev, &error_abort);

    object_initialize(&s->rx_data_dev, sizeof(s->rx_data_dev),

                      TYPE_XILINX_AXI_DMA_DATA_STREAM);

    object_initialize(&s->rx_control_dev, sizeof(s->rx_control_dev),

                      TYPE_XILINX_AXI_DMA_CONTROL_STREAM);

    object_property_add_child(OBJECT(s), "axistream-connected-target",

                              (Object *)&s->rx_data_dev, &error_abort);

    object_property_add_child(OBJECT(s), "axistream-control-connected-target",

                              (Object *)&s->rx_control_dev, &error_abort);

    sysbus_init_irq(sbd, &s->streams[0].irq);

    sysbus_init_irq(sbd, &s->streams[1].irq);

    memory_region_init_io(&s->iomem, obj, &axidma_ops, s,

                          "xlnx.axi-dma", R_MAX * 4 * 2);

    sysbus_init_mmio(sbd, &s->iomem);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)

 {
+
+    int ret;
+
+
+
     ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);

     if (ret == -1)

static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)

{

    int ret;

    ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);

    if (ret == -1)

        return -errno;

    /*

     * This looks weird, but the aio code only consideres a request

     * successful if it has written the number full number of bytes.

     *

     * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command,

     * so in fact we return the ioctl command here to make posix_aio_read()

     * happy..

     */

    return aiocb->aio_nbytes;

}


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

     QLIST_FOREACH(timer_list, &clock->timerlists, list) {

+        timerlist_notify(timer_list);
+
+    }

 }

void qemu_clock_notify(QEMUClockType type)

{

    QEMUTimerList *timer_list;

    QEMUClock *clock = qemu_clock_ptr(type);

    QLIST_FOREACH(timer_list, &clock->timerlists, list) {

        timerlist_notify(timer_list);

    }

}


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

        ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)

+       || discard >= AVDISCARD_ALL
+
+       || nut->stream[stream_id].skip_until_key_frame){
+
+        url_fskip(bc, size);

         return 1;

static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){

    AVFormatContext *s= nut->avf;

    ByteIOContext *bc = &s->pb;

    int size, stream_id, flags, discard;

    int64_t pts, last_IP_pts;

    size= decode_frame_header(nut, &flags, &pts, &stream_id, frame_code);

    if(size < 0)

        return -1;

    if (flags & FLAG_KEY)

        nut->stream[stream_id].skip_until_key_frame=0;

    discard= s->streams[ stream_id ]->discard;

    last_IP_pts= s->streams[ stream_id ]->last_IP_pts;

    if(  (discard >= AVDISCARD_NONKEY && !(flags & FLAG_KEY))

       ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)

       || discard >= AVDISCARD_ALL

       || nut->stream[stream_id].skip_until_key_frame){

        url_fskip(bc, size);

        return 1;

    }

    av_get_packet(bc, pkt, size);

    pkt->stream_index = stream_id;

    if (flags & FLAG_KEY)

        pkt->flags |= PKT_FLAG_KEY;

    pkt->pts = pts;

    return 0;

}


void module_call_init(module_init_type type)

{

    ModuleTypeList *l;

    ModuleEntry *e;

    l = find_type(type);

    TAILQ_FOREACH(e, l, node) {

        e->init();

    }

}


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

     int num, denom, gain, bits1, bits2;

+    int i;
+
+

     num   = energy;

static void gain_scale(G723_1_Context *p, int16_t * buf, int energy)

{

    int num, denom, gain, bits1, bits2;

    int i;

    num   = energy;

    denom = 0;

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

        int64_t temp = buf[i] >> 2;

        temp  = av_clipl_int32(MUL64(temp, temp) << 1);

        denom = av_clipl_int32(denom + temp);

    }

    if (num && denom) {

        bits1   = normalize_bits(num,   31);

        bits2   = normalize_bits(denom, 31);

        num     = num << bits1 >> 1;

        denom <<= bits2;

        bits2 = 5 + bits1 - bits2;

        bits2 = FFMAX(0, bits2);

        gain = (num >> 1) / (denom >> 16);

        gain = square_root(gain << 16 >> bits2);

    } else {

        gain = 1 << 12;

    }

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

        p->pf_gain = (15 * p->pf_gain + gain + (1 << 3)) >> 4;

        buf[i]     = av_clip_int16((buf[i] * (p->pf_gain + (p->pf_gain >> 4)) +

                                   (1 << 10)) >> 11);

    }

}


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

     state->code_counterA_almost = 0;

+    state->code_counterB = 0;
+
+    state->code_counterB_checkfails = 0;
+
+    state->code_counterC = 0;

     state->code_counterC_unmatched = 0;

static void hdcd_reset(hdcd_state_t *state, unsigned rate)

{

    int i;

    state->window = 0;

    state->readahead = 32;

    state->arg = 0;

    state->control = 0;

    state->running_gain = 0;

    state->sustain = 0;

    state->sustain_reset = rate * 10;

    state->code_counterA = 0;

    state->code_counterA_almost = 0;

    state->code_counterB = 0;

    state->code_counterB_checkfails = 0;

    state->code_counterC = 0;

    state->code_counterC_unmatched = 0;

    state->count_peak_extend = 0;

    state->count_transient_filter = 0;

    for(i = 0; i < 16; i++) state->gain_counts[i] = 0;

    state->max_gain = 0;

    state->count_sustain_expired = -1;

}


--- a/source.c
+++ b/source.c
@@ -26,11 +26,11 @@
                     switch (*range_op) {
                     case '+':
                     {
+                        range.begin = r1val;
+                        range.end = r1val + (r2val - 1);
+                        break;
+                    case '-':
+                    {
                         range.end = r1val;
                         range.begin = r1val - (r2val - 1);
                         break;

void qemu_set_dfilter_ranges(const char *filter_spec)
{
    gchar **ranges = g_strsplit(filter_spec, ",", 0);
    if (ranges) {
        gchar **next = ranges;
        gchar *r = *next++;
        debug_regions = g_array_sized_new(FALSE, FALSE,
                                          sizeof(Range), g_strv_length(ranges));
        while (r) {
            char *range_op = strstr(r, "-");
            char *r2 = range_op ? range_op + 1 : NULL;
            if (!range_op) {
                range_op = strstr(r, "+");
                r2 = range_op ? range_op + 1 : NULL;
            if (!range_op) {
                range_op = strstr(r, "..");
                r2 = range_op ? range_op + 2 : NULL;
            if (range_op) {
                const char *e = NULL;
                uint64_t r1val, r2val;
                if ((qemu_strtoull(r, &e, 0, &r1val) == 0) &&
                    (qemu_strtoull(r2, NULL, 0, &r2val) == 0) &&
                    r2val > 0) {
                    struct Range range;
                    g_assert(e == range_op);
                    switch (*range_op) {
                    case '+':
                    {
                        range.begin = r1val;
                        range.end = r1val + (r2val - 1);
                        break;
                    case '-':
                    {
                        range.end = r1val;
                        range.begin = r1val - (r2val - 1);
                        break;
                    case '.':
                        range.begin = r1val;
                        range.end = r2val;
                        break;
                    default:
                        g_assert_not_reached();
                    g_array_append_val(debug_regions, range);
                } else {
                    g_error("Failed to parse range in: %s", r);
            } else {
                g_error("Bad range specifier in: %s", r);
            r = *next++;
        g_strfreev(ranges);


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

         bs = bs->file;

+    }
+
+
+
+    if (bs && bs->drv && bs->drv->bdrv_debug_is_suspended) {

         return bs->drv->bdrv_debug_is_suspended(bs, tag);

bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag)

{

    while (bs && bs->drv && !bs->drv->bdrv_debug_is_suspended) {

        bs = bs->file;

    }

    if (bs && bs->drv && bs->drv->bdrv_debug_is_suspended) {

        return bs->drv->bdrv_debug_is_suspended(bs, tag);

    }

    return false;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *qsb)

+{
+
+    QEMUSizedBuffer *out = qsb_create(NULL, qsb_get_length(qsb));
+
+    size_t i;

     ssize_t res;

QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *qsb)

{

    QEMUSizedBuffer *out = qsb_create(NULL, qsb_get_length(qsb));

    size_t i;

    ssize_t res;

    off_t pos = 0;

    if (!out) {

        return NULL;

    }

    for (i = 0; i < qsb->n_iov; i++) {

        res =  qsb_write_at(out, qsb->iov[i].iov_base,

                            pos, qsb->iov[i].iov_len);

        if (res < 0) {

            qsb_free(out);

            return NULL;

        }

        pos += res;

    }

    return out;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static bool gen_rsr_ccount(DisasContext *dc, TCGv_i32 d, uint32_t sr)
+
 {

     if (dc->tb->cflags & CF_USE_ICOUNT) {

static bool gen_rsr_ccount(DisasContext *dc, TCGv_i32 d, uint32_t sr)

{

    if (dc->tb->cflags & CF_USE_ICOUNT) {

        gen_io_start();

    }

    gen_helper_update_ccount(cpu_env);

    tcg_gen_mov_i32(d, cpu_SR[sr]);

    if (dc->tb->cflags & CF_USE_ICOUNT) {

        gen_io_end();

        return true;

    }

    return false;

}


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

     }

+
+
+    if (ctx->internal->buffer_pkt->data ||
+
+        ctx->internal->buffer_pkt->side_data_elems)

         return AVERROR(EAGAIN);

int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)

{

    if (!pkt) {

        ctx->internal->eof = 1;

        return 0;

    }

    if (ctx->internal->eof) {

        av_log(ctx, AV_LOG_ERROR, "A non-NULL packet sent after an EOF.\n");

        return AVERROR(EINVAL);

    }

    if (ctx->internal->buffer_pkt->data ||

        ctx->internal->buffer_pkt->side_data_elems)

        return AVERROR(EAGAIN);

    av_packet_move_ref(ctx->internal->buffer_pkt, pkt);

    return 0;

}


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

     ListElement *entry = NULL;
+

     if (fs == NULL) {

static void glfs_clear_preopened(glfs_t *fs)

{

    ListElement *entry = NULL;

    if (fs == NULL) {

        return;

    }

    QLIST_FOREACH(entry, &glfs_list, list) {

        if (entry->saved.fs == fs) {

            if (--entry->saved.ref) {

                return;

            }

            QLIST_REMOVE(entry, list);

            glfs_fini(entry->saved.fs);

            g_free(entry->saved.volume);

            g_free(entry);

        }

    }

}


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

     qemu_mutex_init(&ram_list.mutex);

+    memory_map_init();
+
+    io_mem_init();

 #endif

void cpu_exec_init_all(void)

{

#if !defined(CONFIG_USER_ONLY)

    qemu_mutex_init(&ram_list.mutex);

    memory_map_init();

    io_mem_init();

#endif

}


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

     const char *border = opt & QDIST_PR_BORDER ? "|" : "";

+    char *llabel, *rlabel;

     char *hgram;

char *qdist_pr(const struct qdist *dist, size_t n_bins, uint32_t opt)

{

    const char *border = opt & QDIST_PR_BORDER ? "|" : "";

    char *llabel, *rlabel;

    char *hgram;

    GString *s;

    if (dist->n == 0) {

        return NULL;

    }

    s = g_string_new("");

    llabel = qdist_pr_label(dist, n_bins, opt, true);

    rlabel = qdist_pr_label(dist, n_bins, opt, false);

    hgram = qdist_pr_plain(dist, n_bins);

    g_string_append_printf(s, "%s%s%s%s%s",

                           llabel, border, hgram, border, rlabel);

    g_free(llabel);

    g_free(rlabel);

    g_free(hgram);

    return g_string_free(s, FALSE);

}


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

     } else { //Node
+
+        int r;
+
+        length++;
+
         r = smacker_decode_tree(gb, hc, prefix, length);

         if(r)

static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t prefix, int length)

{

    if(length > 32) {

        av_log(NULL, AV_LOG_ERROR, "length too long\n");

        return AVERROR_INVALIDDATA;

    }

    if(!get_bits1(gb)){ //Leaf

        if(hc->current >= 256){

            av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");

            return AVERROR_INVALIDDATA;

        }

        if(length){

            hc->bits[hc->current] = prefix;

            hc->lengths[hc->current] = length;

        } else {

            hc->bits[hc->current] = 0;

            hc->lengths[hc->current] = 0;

        }

        hc->values[hc->current] = get_bits(gb, 8);

        hc->current++;

        if(hc->maxlength < length)

            hc->maxlength = length;

        return 0;

    } else { //Node

        int r;

        length++;

        r = smacker_decode_tree(gb, hc, prefix, length);

        if(r)

            return r;

        return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), length);

    }

}


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

+
+    ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);
+
+    if (ret == -1) {
+
         return -errno;

     }

static ssize_t handle_aiocb_ioctl(RawPosixAIOData *aiocb)

{

    int ret;

    ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);

    if (ret == -1) {

        return -errno;

    }

    /*

     * This looks weird, but the aio code only considers a request

     * successful if it has written the full number of bytes.

     *

     * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command,

     * so in fact we return the ioctl command here to make posix_aio_read()

     * happy..

     */

    return aiocb->aio_nbytes;

}


--- a/source.c
+++ b/source.c
@@ -22,11 +22,11 @@
         return ret;
     if (hwaccel) {
         if (hwaccel->alloc_frame) {
+            ret = hwaccel->alloc_frame(avctx, frame);
+            goto end;
+        }
+    } else
+        avctx->sw_pix_fmt = avctx->pix_fmt;
     ret = avctx->get_buffer2(avctx, frame, flags);
     if (ret >= 0)
         validate_avframe_allocation(avctx, frame);

static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
{
    const AVHWAccel *hwaccel = avctx->hwaccel;
    int override_dimensions = 1;
    int ret;
    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
        if ((ret = av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) < 0 || avctx->pix_fmt<0) {
            av_log(avctx, AV_LOG_ERROR, "video_get_buffer: image parameters invalid\n");
            return AVERROR(EINVAL);
        }
        if (frame->width <= 0 || frame->height <= 0) {
            frame->width  = FFMAX(avctx->width,  AV_CEIL_RSHIFT(avctx->coded_width,  avctx->lowres));
            frame->height = FFMAX(avctx->height, AV_CEIL_RSHIFT(avctx->coded_height, avctx->lowres));
            override_dimensions = 0;
        }
        if (frame->data[0] || frame->data[1] || frame->data[2] || frame->data[3]) {
            av_log(avctx, AV_LOG_ERROR, "pic->data[*]!=NULL in get_buffer_internal\n");
            return AVERROR(EINVAL);
        }
    }
    ret = ff_decode_frame_props(avctx, frame);
        return ret;
    if (hwaccel) {
        if (hwaccel->alloc_frame) {
            ret = hwaccel->alloc_frame(avctx, frame);
            goto end;
        }
    } else
        avctx->sw_pix_fmt = avctx->pix_fmt;
    ret = avctx->get_buffer2(avctx, frame, flags);
    if (ret >= 0)
        validate_avframe_allocation(avctx, frame);
end:
    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions &&
        !(avctx->codec->caps_internal & FF_CODEC_CAP_EXPORTS_CROPPING)) {
        frame->width  = avctx->width;
        frame->height = avctx->height;
    }
    return ret;
}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static inline int ohci_put_ed(OHCIState *ohci,
+
                               uint32_t addr, struct ohci_ed *ed)

 {

static inline int ohci_put_ed(OHCIState *ohci,

                              uint32_t addr, struct ohci_ed *ed)

{

    return put_dwords(ohci, addr, (uint32_t *)ed, sizeof(*ed) >> 2);

}


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

     int work[10];

+    int a = block_num + 1;
+
+    int b = NBLOCKS - a;
+
+    int x;

static int interp(RA144Context *ractx, int16_t *out, int block_num,

                  int copyold, int energy)

{

    int work[10];

    int a = block_num + 1;

    int b = NBLOCKS - a;

    int x;

    // Interpolate block coefficients from the this frame forth block and

    // last frame forth block

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

        out[x] = (a * ractx->lpc_coef[0][x] + b * ractx->lpc_coef[1][x])>> 2;

    if (eval_refl(work, out, ractx)) {

        // The interpolated coefficients are unstable, copy either new or old

        // coefficients

        int_to_int16(out, ractx->lpc_coef[copyold]);

        return rescale_rms(ractx->lpc_refl_rms[copyold], energy);

    } else {

        return rescale_rms(rms(work), energy);

    }

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
         VNC_DEBUG("VNC: TIGHT: initializing zlib stream %d\n", stream_id);

         VNC_DEBUG("VNC: TIGHT: opaque = %p | vs = %p\n", zstream->opaque, vs);
+
+        zstream->zalloc = vnc_zlib_zalloc;
+
+        zstream->zfree = vnc_zlib_zfree;
+

         err = deflateInit2(zstream, level, Z_DEFLATED, MAX_WBITS,

static int tight_init_stream(VncState *vs, int stream_id,

                             int level, int strategy)

{

    z_streamp zstream = &vs->tight_stream[stream_id];

    if (zstream->opaque == NULL) {

        int err;

        VNC_DEBUG("VNC: TIGHT: initializing zlib stream %d\n", stream_id);

        VNC_DEBUG("VNC: TIGHT: opaque = %p | vs = %p\n", zstream->opaque, vs);

        zstream->zalloc = vnc_zlib_zalloc;

        zstream->zfree = vnc_zlib_zfree;

        err = deflateInit2(zstream, level, Z_DEFLATED, MAX_WBITS,

                           MAX_MEM_LEVEL, strategy);

        if (err != Z_OK) {

            fprintf(stderr, "VNC: error initializing zlib\n");

            return -1;

        }

        vs->tight_levels[stream_id] = level;

        zstream->opaque = vs;

    }

    if (vs->tight_levels[stream_id] != level) {

        if (deflateParams(zstream, level, strategy) != Z_OK) {

            return -1;

        }

        vs->tight_levels[stream_id] = level;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+int pit_get_mode(PITState *pit, int channel)
+
 {

     PITChannelState *s = &pit->channels[channel];

int pit_get_mode(PITState *pit, int channel)

{

    PITChannelState *s = &pit->channels[channel];

    return s->mode;

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     unsigned char ival = byte + 0x16;

     const unsigned char * ptr = src + byte*2;
+
     int ptr_len = src_len - 1 - byte*2;

     unsigned char val = ival;

static int xan_huffman_decode(unsigned char *dest, int dest_len,

                              const unsigned char *src, int src_len)

{

    unsigned char byte = *src++;

    unsigned char ival = byte + 0x16;

    const unsigned char * ptr = src + byte*2;

    int ptr_len = src_len - 1 - byte*2;

    unsigned char val = ival;

    unsigned char *dest_end = dest + dest_len;

    GetBitContext gb;

    if (ptr_len < 0)

        return AVERROR_INVALIDDATA;

    init_get_bits(&gb, ptr, ptr_len * 8);

    while ( val != 0x16 ) {

        val = src[val - 0x17 + get_bits1(&gb) * byte];

        if ( val < 0x16 ) {

            if (dest >= dest_end)

                return 0;

            *dest++ = val;

            val = ival;

        }

    }

    return 0;

}


static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,

                               int h, const uint8_t *src, int size, int Uoff,

                               const int step)

{

    int i, j;

    GetBitContext gb;

    VLC vlc;

    Node nodes[512];

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

        nodes[i].count = bytestream_get_le32(&src);

    size -= 1024;

    if (ff_huff_build_tree(s->avctx, &vlc, 256, nodes, huff_cmp,

                           FF_HUFFMAN_FLAG_ZERO_COUNT) < 0)

        return -1;

    /* we have built Huffman table and are ready to decode plane */

    /* convert bits so they may be used by standard bitreader */

    s->dsp.bswap_buf((uint32_t *)s->tmpbuf, (const uint32_t *)src, size >> 2);

    init_get_bits(&gb, s->tmpbuf, size * 8);

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

        for(i = 0; i < w*step; i += step){

            dst[i] = get_vlc2(&gb, vlc.table, 9, 3);

            /* lines are stored as deltas between previous lines

             * and we need to add 0x80 to the first lines of chroma planes

             */

            if(j) dst[i] += dst[i - stride];

            else if(Uoff) dst[i] += 0x80;

        }

        dst += stride;

        if(get_bits_left(&gb) < 0){

            free_vlc(&vlc);

            return -1;

        }

    }

    free_vlc(&vlc);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static const unsigned char *seq_decode_op3(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)

 {

static const unsigned char *seq_decode_op3(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)

{

    int pos, offset;

    do {

        pos = *src++;

        offset = ((pos >> 3) & 7) * seq->frame.linesize[0] + (pos & 7);

        dst[offset] = *src++;

    } while (!(pos & 0x80));

    return src;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void migrate_check_parameter(QTestState *who, const char *parameter,

+                                    const char *value)

 {

static void migrate_check_parameter(QTestState *who, const char *parameter,

                                    const char *value)

{

    QDict *rsp, *rsp_return;

    const char *result;

    rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }");

    rsp_return = qdict_get_qdict(rsp, "return");

    result = g_strdup_printf("%" PRId64,

                             qdict_get_try_int(rsp_return,  parameter, -1));

    g_assert_cmpstr(result, ==, value);

    QDECREF(rsp);

}


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

     /* AioContext is released in .clean() */
+
+    state->aio_context = blk_get_aio_context(blk);
+
+    aio_context_acquire(state->aio_context);
+

     qmp_drive_backup(backup->device, backup->target,

static void drive_backup_prepare(BlkTransactionState *common, Error **errp)

{

    DriveBackupState *state = DO_UPCAST(DriveBackupState, common, common);

    BlockBackend *blk;

    DriveBackup *backup;

    Error *local_err = NULL;

    assert(common->action->kind == TRANSACTION_ACTION_KIND_DRIVE_BACKUP);

    backup = common->action->drive_backup;

    blk = blk_by_name(backup->device);

    if (!blk) {

        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,

                  "Device '%s' not found", backup->device);

        return;

    }

    /* AioContext is released in .clean() */

    state->aio_context = blk_get_aio_context(blk);

    aio_context_acquire(state->aio_context);

    qmp_drive_backup(backup->device, backup->target,

                     backup->has_format, backup->format,

                     backup->sync,

                     backup->has_mode, backup->mode,

                     backup->has_speed, backup->speed,

                     backup->has_bitmap, backup->bitmap,

                     backup->has_on_source_error, backup->on_source_error,

                     backup->has_on_target_error, backup->on_target_error,

                     &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }

    state->bs = blk_bs(blk);

    state->job = state->bs->job;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void set_acpi_power_state(IPMIBmcSim *ibs,
+
                           uint8_t *cmd, unsigned int cmd_len,

                           uint8_t *rsp, unsigned int *rsp_len,

static void set_acpi_power_state(IPMIBmcSim *ibs,

                          uint8_t *cmd, unsigned int cmd_len,

                          uint8_t *rsp, unsigned int *rsp_len,

                          unsigned int max_rsp_len)

{

    IPMI_CHECK_CMD_LEN(4);

    ibs->acpi_power_state[0] = cmd[2];

    ibs->acpi_power_state[1] = cmd[3];

}


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

     Suite *s;
+
+    TCase *qfloat_public_tcase;
+
+
+
     s = suite_create("QFloat test-suite");

static Suite *qfloat_suite(void)

{

    Suite *s;

    TCase *qfloat_public_tcase;

    s = suite_create("QFloat test-suite");

    qfloat_public_tcase = tcase_create("Public Interface");

    suite_add_tcase(s, qfloat_public_tcase);

    tcase_add_test(qfloat_public_tcase, qfloat_from_double_test);

    tcase_add_test(qfloat_public_tcase, qfloat_destroy_test);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -5,8 +5,8 @@
     int ret;
     if (s->icy_metadata_headers)
         len += strlen(s->icy_metadata_headers);
+    if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
+        return ret;
+    av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
     return 0;
 }

static int parse_icy(HTTPContext *s, const char *tag, const char *p)
{
    int len = 4 + strlen(p) + strlen(tag);
    int is_first = !s->icy_metadata_headers;
    int ret;
    if (s->icy_metadata_headers)
        len += strlen(s->icy_metadata_headers);
    if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0)
        return ret;
    av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
    return 0;
}


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

 {

+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));

     VirtioBusState *vbus = VIRTIO_BUS(qbus);

@@ -10,19 +10,19 @@

     int i, r;

+    if (!k->set_host_notifier) {

         fprintf(stderr, "binding does not support host notifiers\n");

         r = -ENOSYS;

         goto fail;
+
     }

+    for (i = 0; i < hdev->nvqs; ++i) {

         r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, true);

int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)

{

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

    VirtioBusState *vbus = VIRTIO_BUS(qbus);

    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);

    int i, r;

    if (!k->set_host_notifier) {

        fprintf(stderr, "binding does not support host notifiers\n");

        r = -ENOSYS;

        goto fail;

    }

    for (i = 0; i < hdev->nvqs; ++i) {

        r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, true);

        if (r < 0) {

            fprintf(stderr, "vhost VQ %d notifier binding failed: %d\n", i, -r);

            goto fail_vq;

        }

    }

    return 0;

fail_vq:

    while (--i >= 0) {

        r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, false);

        if (r < 0) {

            fprintf(stderr, "vhost VQ %d notifier cleanup error: %d\n", i, -r);

            fflush(stderr);

        }

        assert (r >= 0);

    }

fail:

    return r;

}


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

     uint32_t data = val & E1000_MDIC_DATA_MASK;

+    uint32_t addr = ((val & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT);
+
+
+
+    if ((val & E1000_MDIC_PHY_MASK) >> E1000_MDIC_PHY_SHIFT != 1) // phy #

         val = s->mac_reg[MDIC] | E1000_MDIC_ERROR;

set_mdic(E1000State *s, int index, uint32_t val)

{

    uint32_t data = val & E1000_MDIC_DATA_MASK;

    uint32_t addr = ((val & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT);

    if ((val & E1000_MDIC_PHY_MASK) >> E1000_MDIC_PHY_SHIFT != 1) // phy #

        val = s->mac_reg[MDIC] | E1000_MDIC_ERROR;

    else if (val & E1000_MDIC_OP_READ) {

        DBGOUT(MDIC, "MDIC read reg 0x%x\n", addr);

        if (!(phy_regcap[addr] & PHY_R)) {

            DBGOUT(MDIC, "MDIC read reg %x unhandled\n", addr);

            val |= E1000_MDIC_ERROR;

        } else

            val = (val ^ data) | s->phy_reg[addr];

    } else if (val & E1000_MDIC_OP_WRITE) {

        DBGOUT(MDIC, "MDIC write reg 0x%x, value 0x%x\n", addr, data);

        if (!(phy_regcap[addr] & PHY_W)) {

            DBGOUT(MDIC, "MDIC write reg %x unhandled\n", addr);

            val |= E1000_MDIC_ERROR;

        } else {

            if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) {

                phyreg_writeops[addr](s, index, data);

            }

            s->phy_reg[addr] = data;

        }

    }

    s->mac_reg[MDIC] = val | E1000_MDIC_READY;

    if (val & E1000_MDIC_INT_EN) {

        set_ics(s, 0, E1000_ICR_MDAC);

    }

}


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

 #if HAVE_BIGENDIAN
+
+    int i;
+
+    for (i = 0; i < s->frame.blocksize * s->channels; i++) {
+
         int16_t smp = av_le2ne16(samples[i]);

         av_md5_update(s->md5ctx, (uint8_t *)&smp, 2);

static void update_md5_sum(FlacEncodeContext *s, const int16_t *samples)

{

#if HAVE_BIGENDIAN

    int i;

    for (i = 0; i < s->frame.blocksize * s->channels; i++) {

        int16_t smp = av_le2ne16(samples[i]);

        av_md5_update(s->md5ctx, (uint8_t *)&smp, 2);

    }

#else

    av_md5_update(s->md5ctx, (const uint8_t *)samples, s->frame.blocksize*s->channels*2);

#endif

}


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

                                              unsigned size)

+{

     uint64_t data = 0;

static uint64_t memory_region_dispatch_read1(MemoryRegion *mr,

                                             hwaddr addr,

                                             unsigned size)

{

    uint64_t data = 0;

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

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

    }

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

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

    }

    /* FIXME: support unaligned access */

    access_with_adjusted_size(addr, &data, size,

                              mr->ops->impl.min_access_size,

                              mr->ops->impl.max_access_size,

                              memory_region_read_accessor, mr);

    return data;

}


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

         xen_be_printf(xendev, 0, "xc_evtchn_pending returned %d (expected %d)\n",

+                      port, xendev->local_port);
+
+        return;
+
+    }

     xc_evtchn_unmask(xendev->evtchndev, port);

static void xen_be_evtchn_event(void *opaque)

{

    struct XenDevice *xendev = opaque;

    evtchn_port_t port;

    port = xc_evtchn_pending(xendev->evtchndev);

    if (port != xendev->local_port) {

        xen_be_printf(xendev, 0, "xc_evtchn_pending returned %d (expected %d)\n",

                      port, xendev->local_port);

        return;

    }

    xc_evtchn_unmask(xendev->evtchndev, port);

    if (xendev->ops->event) {

        xendev->ops->event(xendev);

    }

}


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

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

     int err;

static void test_qemu_strtoul_empty(void)

{

    const char *str = "";

    char f = 'X';

    const char *endptr = &f;

    unsigned long res = 999;

    int err;

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

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 0);

    g_assert(endptr == str);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void clear_tco_status(const TestData *d)
+
+{
+
     qpci_io_writew(d->dev, d->tco_io_base + TCO1_STS, 0x0008);

     qpci_io_writew(d->dev, d->tco_io_base + TCO2_STS, 0x0002);

static void clear_tco_status(const TestData *d)

{

    qpci_io_writew(d->dev, d->tco_io_base + TCO1_STS, 0x0008);

    qpci_io_writew(d->dev, d->tco_io_base + TCO2_STS, 0x0002);

    qpci_io_writew(d->dev, d->tco_io_base + TCO2_STS, 0x0004);

}


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

     pl190_state *s;

+    qemu_irq *qi;

     int iomemtype;

qemu_irq *pl190_init(uint32_t base, qemu_irq irq, qemu_irq fiq)

{

    pl190_state *s;

    qemu_irq *qi;

    int iomemtype;

    s = (pl190_state *)qemu_mallocz(sizeof(pl190_state));

    iomemtype = cpu_register_io_memory(0, pl190_readfn,

                                       pl190_writefn, s);

    cpu_register_physical_memory(base, 0x00000fff, iomemtype);

    qi = qemu_allocate_irqs(pl190_set_irq, s, 32);

    s->base = base;

    s->irq = irq;

    s->fiq = fiq;

    pl190_reset(s);

    /* ??? Save/restore.  */

    return qi;

}


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

     if (err) {

+        fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
+
+        exit(1);
+
+    }

 #else /* _WIN32 */

static void qemu_cpu_kick_thread(CPUState *cpu)

{

#ifndef _WIN32

    int err;

    err = pthread_kill(cpu->thread->thread, SIG_IPI);

    if (err) {

        fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));

        exit(1);

    }

#else /* _WIN32 */

    if (!qemu_cpu_is_self(cpu)) {

        SuspendThread(cpu->hThread);

        cpu_signal(0);

        ResumeThread(cpu->hThread);

    }

#endif

}


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

     if(enc->codec_id == CODEC_ID_VORBIS)

+        return -1;

static int get_audio_frame_size(AVCodecContext *enc, int size)

{

    int frame_size;

    if(enc->codec_id == CODEC_ID_VORBIS)

        return -1;

    if (enc->frame_size <= 1) {

        int bits_per_sample = av_get_bits_per_sample(enc->codec_id);

        if (bits_per_sample) {

            if (enc->channels == 0)

                return -1;

            frame_size = (size << 3) / (bits_per_sample * enc->channels);

        } else {

            /* used for example by ADPCM codecs */

            if (enc->bit_rate == 0)

                return -1;

            frame_size = (size * 8 * enc->sample_rate) / enc->bit_rate;

        }

    } else {

        frame_size = enc->frame_size;

    }

    return frame_size;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 size_t mptsas_config_manufacturing_1(MPTSASState *s, uint8_t **data, int address)
+
 {

     /* VPD - all zeros */

size_t mptsas_config_manufacturing_1(MPTSASState *s, uint8_t **data, int address)

{

    /* VPD - all zeros */

    return MPTSAS_CONFIG_PACK(1, MPI_CONFIG_PAGETYPE_MANUFACTURING, 0x00,

                              "s256");

}


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

     if (card == NULL) {
+
+        return VREADER_NO_CARD;
+
+    }

vreader_xfr_bytes(VReader *reader,

                  unsigned char *send_buf, int send_buf_len,

                  unsigned char *receive_buf, int *receive_buf_len)

{

    VCardAPDU *apdu;

    VCardResponse *response = NULL;

    VCardStatus card_status;

    unsigned short status;

    VCard *card = vreader_get_card(reader);

    if (card == NULL) {

        return VREADER_NO_CARD;

    }

    apdu = vcard_apdu_new(send_buf, send_buf_len, &status);

    if (apdu == NULL) {

        response = vcard_make_response(status);

        card_status = VCARD_DONE;

    } else {

        g_debug("%s: CLS=0x%x,INS=0x%x,P1=0x%x,P2=0x%x,Lc=%d,Le=%d %s",

              __func__, apdu->a_cla, apdu->a_ins, apdu->a_p1, apdu->a_p2,

              apdu->a_Lc, apdu->a_Le, apdu_ins_to_string(apdu->a_ins));

        card_status = vcard_process_apdu(card, apdu, &response);

        if (response) {

            g_debug("%s: status=%d sw1=0x%x sw2=0x%x len=%d (total=%d)",

                  __func__, response->b_status, response->b_sw1,

                  response->b_sw2, response->b_len, response->b_total_len);

        }

    }

    assert(card_status == VCARD_DONE);

    if (card_status == VCARD_DONE) {

        int size = MIN(*receive_buf_len, response->b_total_len);

        memcpy(receive_buf, response->b_data, size);

        *receive_buf_len = size;

    }

    vcard_response_delete(response);

    vcard_apdu_delete(apdu);

    vcard_free(card); /* free our reference */

    return VREADER_OK;

}


--- a/source.c
+++ b/source.c
@@ -8,10 +8,10 @@
     cds->flags = (orb->ctrl0 & ORB_CTRL0_MASK_I2K ? CDS_F_I2K : 0) |
                  (orb->ctrl0 & ORB_CTRL0_MASK_C64 ? CDS_F_C64 : 0) |
                  (ccw->flags & CCW_FLAG_IDA ? CDS_F_IDA : 0);
+    cds->count = ccw->count;
+    cds->cda_orig = ccw->cda;
+    ccw_dstream_rewind(cds);
+    if (!(cds->flags & CDS_F_IDA)) {
         cds->op_handler = ccw_dstream_rw_noflags;
     } else {
         assert(false);

void ccw_dstream_init(CcwDataStream *cds, CCW1 const *ccw, ORB const *orb)
{
    /*
     * We don't support MIDA (an optional facility) yet and we
     * catch this earlier. Just for expressing the precondition.
     */
    g_assert(!(orb->ctrl1 & ORB_CTRL1_MASK_MIDAW));
    cds->flags = (orb->ctrl0 & ORB_CTRL0_MASK_I2K ? CDS_F_I2K : 0) |
                 (orb->ctrl0 & ORB_CTRL0_MASK_C64 ? CDS_F_C64 : 0) |
                 (ccw->flags & CCW_FLAG_IDA ? CDS_F_IDA : 0);
    cds->count = ccw->count;
    cds->cda_orig = ccw->cda;
    ccw_dstream_rewind(cds);
    if (!(cds->flags & CDS_F_IDA)) {
        cds->op_handler = ccw_dstream_rw_noflags;
    } else {
        assert(false);
    }
}


void helper_ldq_l_raw(uint64_t t0, uint64_t t1)

{

    env->lock = t1;

    ldl_raw(t1, t0);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,

+                            AVPacket *avpkt)
+
+{
+
+    const char *ptr = avpkt->data;

     int len, size = avpkt->size;

static int ass_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,

                            AVPacket *avpkt)

{

    const char *ptr = avpkt->data;

    int len, size = avpkt->size;

    ff_ass_init(data);

    while (size > 0) {

        len = ff_ass_add_rect(data, ptr, 0, 0/* FIXME: duration */, 1);

        if (len < 0)

            return len;

        ptr  += len;

        size -= len;

    }

    *got_sub_ptr = avpkt->size > 0;

    return avpkt->size;

}