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

+    fill_vaapi_RefPicList(slice_param->RefPicList0, sl->ref_list[0], sl->list_count > 0 ? sl->ref_count[0] : 0);
+
+    fill_vaapi_RefPicList(slice_param->RefPicList1, sl->ref_list[1], sl->list_count > 1 ? sl->ref_count[1] : 0);
+
+

     fill_vaapi_plain_pred_weight_table(h, 0,

static int vaapi_h264_decode_slice(AVCodecContext *avctx,

                                   const uint8_t  *buffer,

                                   uint32_t        size)

{

    H264Context * const h = avctx->priv_data;

    H264SliceContext *sl  = &h->slice_ctx[0];

    VASliceParameterBufferH264 *slice_param;

    ff_dlog(avctx, "vaapi_h264_decode_slice(): buffer %p, size %d\n",

            buffer, size);

    /* Fill in VASliceParameterBufferH264. */

    slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);

    if (!slice_param)

        return -1;

    slice_param->slice_data_bit_offset          = get_bits_count(&sl->gb);

    slice_param->first_mb_in_slice              = (sl->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + sl->mb_x;

    slice_param->slice_type                     = ff_h264_get_slice_type(sl);

    slice_param->direct_spatial_mv_pred_flag    = sl->slice_type == AV_PICTURE_TYPE_B ? sl->direct_spatial_mv_pred : 0;

    slice_param->num_ref_idx_l0_active_minus1   = sl->list_count > 0 ? sl->ref_count[0] - 1 : 0;

    slice_param->num_ref_idx_l1_active_minus1   = sl->list_count > 1 ? sl->ref_count[1] - 1 : 0;

    slice_param->cabac_init_idc                 = sl->cabac_init_idc;

    slice_param->slice_qp_delta                 = sl->qscale - h->pps.init_qp;

    slice_param->disable_deblocking_filter_idc  = sl->deblocking_filter < 2 ? !sl->deblocking_filter : sl->deblocking_filter;

    slice_param->slice_alpha_c0_offset_div2     = sl->slice_alpha_c0_offset / 2;

    slice_param->slice_beta_offset_div2         = sl->slice_beta_offset     / 2;

    slice_param->luma_log2_weight_denom         = sl->pwt.luma_log2_weight_denom;

    slice_param->chroma_log2_weight_denom       = sl->pwt.chroma_log2_weight_denom;

    fill_vaapi_RefPicList(slice_param->RefPicList0, sl->ref_list[0], sl->list_count > 0 ? sl->ref_count[0] : 0);

    fill_vaapi_RefPicList(slice_param->RefPicList1, sl->ref_list[1], sl->list_count > 1 ? sl->ref_count[1] : 0);

    fill_vaapi_plain_pred_weight_table(h, 0,

                                       &slice_param->luma_weight_l0_flag,   slice_param->luma_weight_l0,   slice_param->luma_offset_l0,

                                       &slice_param->chroma_weight_l0_flag, slice_param->chroma_weight_l0, slice_param->chroma_offset_l0);

    fill_vaapi_plain_pred_weight_table(h, 1,

                                       &slice_param->luma_weight_l1_flag,   slice_param->luma_weight_l1,   slice_param->luma_offset_l1,

                                       &slice_param->chroma_weight_l1_flag, slice_param->chroma_weight_l1, slice_param->chroma_offset_l1);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     CPUS390XState *env = &cpu->env;

     target_ulong raddr;
+
     int prot;

     uint64_t asc = env->psw.mask & PSW_MASK_ASC;

hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr)

{

    S390CPU *cpu = S390_CPU(cs);

    CPUS390XState *env = &cpu->env;

    target_ulong raddr;

    int prot;

    uint64_t asc = env->psw.mask & PSW_MASK_ASC;

    /* 31-Bit mode */

    if (!(env->psw.mask & PSW_MASK_64)) {

        vaddr &= 0x7fffffff;

    }

    mmu_translate(env, vaddr, MMU_INST_FETCH, asc, &raddr, &prot, false);

    return raddr;

}


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

+    assert(vec->enabled);
+
+    assert(vec->pending);
+
+

     pendgroupprio = vec->prio;

void armv7m_nvic_acknowledge_irq(void *opaque)

{

    NVICState *s = (NVICState *)opaque;

    CPUARMState *env = &s->cpu->env;

    const int pending = s->vectpending;

    const int running = nvic_exec_prio(s);

    int pendgroupprio;

    VecInfo *vec;

    assert(pending > ARMV7M_EXCP_RESET && pending < s->num_irq);

    vec = &s->vectors[pending];

    assert(vec->enabled);

    assert(vec->pending);

    pendgroupprio = vec->prio;

    if (pendgroupprio > 0) {

        pendgroupprio &= nvic_gprio_mask(s);

    }

    assert(pendgroupprio < running);

    trace_nvic_acknowledge_irq(pending, vec->prio);

    vec->active = 1;

    vec->pending = 0;

    env->v7m.exception = s->vectpending;

    nvic_irq_update(s);

}


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

     struct kvm_irq_routing_entry *entry;

+    int n;
+
+

     for (n = 0; n < s->irq_routes->nr; n++) {

static int kvm_update_routing_entry(KVMState *s,

                                    struct kvm_irq_routing_entry *new_entry)

{

    struct kvm_irq_routing_entry *entry;

    int n;

    for (n = 0; n < s->irq_routes->nr; n++) {

        entry = &s->irq_routes->entries[n];

        if (entry->gsi != new_entry->gsi) {

            continue;

        }

        entry->type = new_entry->type;

        entry->flags = new_entry->flags;

        entry->u = new_entry->u;

        kvm_irqchip_commit_routes(s);

        return 0;

    }

    return -ESRCH;

}


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

             return NULL;

+        }
+
+        entry = g_malloc0(sizeof(*entry));
+
+        entry->value = info;

         entry->next = list;

BlockDeviceInfoList *bdrv_named_nodes_list(Error **errp)

{

    BlockDeviceInfoList *list, *entry;

    BlockDriverState *bs;

    list = NULL;

    QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) {

        BlockDeviceInfo *info = bdrv_block_device_info(bs, errp);

        if (!info) {

            qapi_free_BlockDeviceInfoList(list);

            return NULL;

        }

        entry = g_malloc0(sizeof(*entry));

        entry->value = info;

        entry->next = list;

        list = entry;

    }

    return list;

}


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

+    while ((c = getopt(argc, argv,

                        "h"  /* help */

ivshmem_client_parse_args(IvshmemClientArgs *args, int argc, char *argv[])

{

    int c;

    while ((c = getopt(argc, argv,

                       "h"  /* help */

                       "v"  /* verbose */

                       "S:" /* unix_sock_path */

                      )) != -1) {

        switch (c) {

        case 'h': /* help */

            ivshmem_client_usage(argv[0], 0);

            break;

        case 'v': /* verbose */

            args->verbose = 1;

            break;

        case 'S': /* unix_sock_path */

            args->unix_sock_path = strdup(optarg);

            break;

        default:

            ivshmem_client_usage(argv[0], 1);

            break;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void usb_net_handle_destroy(USBDevice *dev)

 {
+
+    USBNetState *s = (USBNetState *) dev;

static void usb_net_handle_destroy(USBDevice *dev)

{

    USBNetState *s = (USBNetState *) dev;

    /* TODO: remove the nd_table[] entry */

    qemu_del_vlan_client(s->vc);

    rndis_clear_responsequeue(s);

    qemu_free(s);

}


--- a/source.c
+++ b/source.c
@@ -26,11 +26,11 @@
     if (header.size <= 1) {
         error_setg(errp, "Image size is too small (must be at least 2 bytes)");
     if (header.cluster_bits < 9 || header.cluster_bits > 16) {
+        error_setg(errp, "Cluster size must be between 512 and 64k");
+    if (header.crypt_method > QCOW_CRYPT_AES) {
+        error_setg(errp, "invalid encryption method in qcow header");
+    s->crypt_method_header = header.crypt_method;
+    if (s->crypt_method_header) {
         bs->encrypted = 1;
     s->cluster_bits = header.cluster_bits;
     s->cluster_size = 1 << s->cluster_bits;

static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
                     Error **errp)
{
    BDRVQcowState *s = bs->opaque;
    int len, i, shift, ret;
    QCowHeader header;
    ret = bdrv_pread(bs->file, 0, &header, sizeof(header));
    if (ret < 0) {
    be32_to_cpus(&header.magic);
    be32_to_cpus(&header.version);
    be64_to_cpus(&header.backing_file_offset);
    be32_to_cpus(&header.backing_file_size);
    be32_to_cpus(&header.mtime);
    be64_to_cpus(&header.size);
    be32_to_cpus(&header.crypt_method);
    be64_to_cpus(&header.l1_table_offset);
    if (header.magic != QCOW_MAGIC) {
        error_setg(errp, "Image not in qcow format");
    if (header.version != QCOW_VERSION) {
        char version[64];
        snprintf(version, sizeof(version), "QCOW version %" PRIu32,
                 header.version);
        error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
                  bs->device_name, "qcow", version);
        ret = -ENOTSUP;
    if (header.size <= 1) {
        error_setg(errp, "Image size is too small (must be at least 2 bytes)");
    if (header.cluster_bits < 9 || header.cluster_bits > 16) {
        error_setg(errp, "Cluster size must be between 512 and 64k");
    if (header.crypt_method > QCOW_CRYPT_AES) {
        error_setg(errp, "invalid encryption method in qcow header");
    s->crypt_method_header = header.crypt_method;
    if (s->crypt_method_header) {
        bs->encrypted = 1;
    s->cluster_bits = header.cluster_bits;
    s->cluster_size = 1 << s->cluster_bits;
    s->cluster_sectors = 1 << (s->cluster_bits - 9);
    s->l2_bits = header.l2_bits;
    s->l2_size = 1 << s->l2_bits;
    bs->total_sectors = header.size / 512;
    s->cluster_offset_mask = (1LL << (63 - s->cluster_bits)) - 1;
    /* read the level 1 table */
    shift = s->cluster_bits + s->l2_bits;
    s->l1_size = (header.size + (1LL << shift) - 1) >> shift;
    s->l1_table_offset = header.l1_table_offset;
    s->l1_table = g_malloc(s->l1_size * sizeof(uint64_t));
    ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table,
               s->l1_size * sizeof(uint64_t));
    if (ret < 0) {
    for(i = 0;i < s->l1_size; i++) {
        be64_to_cpus(&s->l1_table[i]);
    /* alloc L2 cache */
    s->l2_cache = g_malloc(s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t));
    s->cluster_cache = g_malloc(s->cluster_size);
    s->cluster_data = g_malloc(s->cluster_size);
    s->cluster_cache_offset = -1;
    /* read the backing file name */
    if (header.backing_file_offset != 0) {
        len = header.backing_file_size;
        if (len > 1023) {
            len = 1023;
        ret = bdrv_pread(bs->file, header.backing_file_offset,
                   bs->backing_file, len);
        if (ret < 0) {
        bs->backing_file[len] = '\0';
    /* Disable migration when qcow images are used */
    error_set(&s->migration_blocker,
              QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
              "qcow", bs->device_name, "live migration");
    migrate_add_blocker(s->migration_blocker);
    qemu_co_mutex_init(&s->lock);
    return 0;
 fail:
    g_free(s->l1_table);
    g_free(s->l2_cache);
    g_free(s->cluster_cache);
    g_free(s->cluster_data);
    return ret;


--- a/source.c
+++ b/source.c
@@ -9,10 +9,10 @@
     AVDictionaryEntry *opt_platform_entry;

     AVDictionaryEntry *opt_device_entry;
+
     LOCK_OPENCL

+    if (!gpu_env.init_count) {

         opt_platform_entry = av_dict_get(options, "platform_idx", NULL, 0);

int av_opencl_init(AVDictionary *options, AVOpenCLExternalEnv *ext_opencl_env)

{

    int ret = 0;

    AVDictionaryEntry *opt_build_entry;

    AVDictionaryEntry *opt_platform_entry;

    AVDictionaryEntry *opt_device_entry;

    LOCK_OPENCL

    if (!gpu_env.init_count) {

        opt_platform_entry = av_dict_get(options, "platform_idx", NULL, 0);

        opt_device_entry   = av_dict_get(options, "device_idx", NULL, 0);

        /* initialize devices, context, command_queue */

        gpu_env.usr_spec_dev_info.platform_idx = -1;

        gpu_env.usr_spec_dev_info.dev_idx = -1;

        if (opt_platform_entry) {

            gpu_env.usr_spec_dev_info.platform_idx = strtol(opt_platform_entry->value, NULL, 10);

        }

        if (opt_device_entry) {

            gpu_env.usr_spec_dev_info.dev_idx = strtol(opt_device_entry->value, NULL, 10);

        }

        ret = init_opencl_env(&gpu_env, ext_opencl_env);

        if (ret < 0)

            goto end;

    }

    /*initialize program, kernel_name, kernel_count*/

    opt_build_entry = av_dict_get(options, "build_options", NULL, 0);

    if (opt_build_entry)

        ret = compile_kernel_file(&gpu_env, opt_build_entry->value);

    else

        ret = compile_kernel_file(&gpu_env, NULL);

    if (ret < 0)

        goto end;

    av_assert1(gpu_env.kernel_code_count > 0);

    gpu_env.init_count++;

end:

    UNLOCK_OPENCL

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     s->con = graphic_console_init(vgafb_update_display,

                                   vgafb_invalidate_display,
+
+                                  NULL, NULL, s);
+
+
+
     return 0;

 }

static int milkymist_vgafb_init(SysBusDevice *dev)

{

    MilkymistVgafbState *s = FROM_SYSBUS(typeof(*s), dev);

    memory_region_init_io(&s->regs_region, &vgafb_mmio_ops, s,

            "milkymist-vgafb", R_MAX * 4);

    sysbus_init_mmio(dev, &s->regs_region);

    s->con = graphic_console_init(vgafb_update_display,

                                  vgafb_invalidate_display,

                                  NULL, NULL, s);

    return 0;

}


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

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

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

static void assert_codec_experimental(AVCodecContext *c, int encoder)

{

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

    AVCodec *codec;

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

        c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {

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

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

                codec_string, c->codec->name);

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

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

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

                   codec_string, codec->name);

        ffmpeg_exit(1);

    }

}


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

{

    QEMUBuffer *s = opaque;

    ssize_t len = qsb_get_length(s->qsb) - pos;

    if (len <= 0) {

        return 0;

    }

    if (len > size) {

        len = size;

    }

    return qsb_get_buffer(s->qsb, pos, len, buf);

}


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

     } else if (!strcmp(codec_name, "copy"))

+        st->stream_copy = 1;
+
+    else {
+
+        st->codec->codec_id = find_codec_or_die(codec_name, type, s->iformat == NULL);

         return s->oformat ? avcodec_find_encoder_by_name(codec_name) :

static AVCodec *choose_codec(OptionsContext *o, AVFormatContext *s, AVStream *st, enum AVMediaType type)

{

    char *codec_name = NULL;

    MATCH_PER_STREAM_OPT(codec_names, str, codec_name, s, st);

    if (!codec_name) {

        if (s->oformat) {

            st->codec->codec_id = av_guess_codec(s->oformat, NULL, s->filename, NULL, type);

            return avcodec_find_encoder(st->codec->codec_id);

        }

    } else if (!strcmp(codec_name, "copy"))

        st->stream_copy = 1;

    else {

        st->codec->codec_id = find_codec_or_die(codec_name, type, s->iformat == NULL);

        return s->oformat ? avcodec_find_encoder_by_name(codec_name) :

                            avcodec_find_decoder_by_name(codec_name);

    }

    return NULL;

}


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

     return migrate_xbzrle_cache_size();

int64_t qmp_query_migrate_cache_size(Error **errp)

{

    return migrate_xbzrle_cache_size();

}


int do_balloon(Monitor *mon, const QDict *params,

	       MonitorCompletion cb, void *opaque)

{

    int ret;

    if (kvm_enabled() && !kvm_has_sync_mmu()) {

        qerror_report(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon");

        return -1;

    }

    ret = qemu_balloon(qdict_get_int(params, "value"), cb, opaque);

    if (ret == 0) {

        qerror_report(QERR_DEVICE_NOT_ACTIVE, "balloon");

        return -1;

    }

    cb(opaque, NULL);

    return 0;

}


static inline uint64_t ucf64_dtoi(float64 d)

{

    union {

        uint64_t i;

        float64 d;

    } v;

    v.d = d;

    return v.i;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static inline void gen_st32(TCGv val, TCGv addr, int index)

+{

     tcg_gen_qemu_st32(val, addr, index);

static inline void gen_st32(TCGv val, TCGv addr, int index)

{

    tcg_gen_qemu_st32(val, addr, index);

    dead_tmp(val);

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     Monitor *mon = opaque;

+
+    if (!err) {
+
         hmp_cont(mon, NULL);

     }

static void hmp_cont_cb(void *opaque, int err)

{

    Monitor *mon = opaque;

    if (!err) {

        hmp_cont(mon, NULL);

    }

}


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

     mov_text_cleanup_ftab(m);
+
+
+    return 0;

 }

static int mov_text_decode_close(AVCodecContext *avctx)

{

    MovTextContext *m = avctx->priv_data;

    mov_text_cleanup_ftab(m);

    return 0;

}


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

     bool is_listen      = sock->has_server  ? sock->server  : true;

+    bool is_telnet      = sock->has_telnet  ? sock->telnet  : false;

     bool is_waitconnect = sock->has_wait    ? sock->wait    : false;

static CharDriverState *qmp_chardev_open_socket(ChardevSocket *sock,

                                                Error **errp)

{

    SocketAddress *addr = sock->addr;

    bool do_nodelay     = sock->has_nodelay ? sock->nodelay : false;

    bool is_listen      = sock->has_server  ? sock->server  : true;

    bool is_telnet      = sock->has_telnet  ? sock->telnet  : false;

    bool is_waitconnect = sock->has_wait    ? sock->wait    : false;

    int fd;

    if (is_listen) {

        fd = socket_listen(addr, errp);

    } else {

        fd = socket_connect(addr, errp, NULL, NULL);

    }

    if (error_is_set(errp)) {

        return NULL;

    }

    return qemu_chr_open_socket_fd(fd, do_nodelay, is_listen,

                                   is_telnet, is_waitconnect, errp);

}


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

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

+        if (offset == exynos4210_uart_regs[i].offset) {
+
+            return exynos4210_uart_regs[i].name;
+
+        }

     }

static const char *exynos4210_uart_regname(target_phys_addr_t  offset)

{

    int regs_number = sizeof(exynos4210_uart_regs) / sizeof(Exynos4210UartReg);

    int i;

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

        if (offset == exynos4210_uart_regs[i].offset) {

            return exynos4210_uart_regs[i].name;

        }

    }

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint)
+
 {

     qiov->iov = g_malloc(alloc_hint * sizeof(struct iovec));

void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint)

{

    qiov->iov = g_malloc(alloc_hint * sizeof(struct iovec));

    qiov->niov = 0;

    qiov->nalloc = alloc_hint;

    qiov->size = 0;

}


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

     QEMUPutKbdEntry *entry = QTAILQ_FIRST(&kbd_handlers);
+

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

void kbd_put_keycode(int keycode)

{

    QEMUPutKbdEntry *entry = QTAILQ_FIRST(&kbd_handlers);

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

        return;

    }

    if (entry) {

        entry->put_kbd(entry->opaque, keycode);

    }

}


--- a/source.c
+++ b/source.c
@@ -14,11 +14,11 @@
         r->req.resid -= r->req.sg->size;
         r->req.aiocb = dma_bdrv_read(s->qdev.conf.bs, r->req.sg, r->sector,
                                      scsi_dma_complete, r);
+    } else {
+        n = scsi_init_iovec(r, SCSI_DMA_BUF_SIZE);
+        bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);
+        r->req.aiocb = bdrv_aio_readv(s->qdev.conf.bs, r->sector, &r->qiov, n,
+                                      scsi_read_complete, r);
 done:
     if (!r->req.io_canceled) {
         scsi_req_unref(&r->req);

static void scsi_do_read(void *opaque, int ret)
{
    SCSIDiskReq *r = opaque;
    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
    uint32_t n;
    if (r->req.aiocb != NULL) {
        r->req.aiocb = NULL;
        bdrv_acct_done(s->qdev.conf.bs, &r->acct);
    if (ret < 0) {
        if (scsi_handle_rw_error(r, -ret)) {
            goto done;
    if (r->req.sg) {
        dma_acct_start(s->qdev.conf.bs, &r->acct, r->req.sg, BDRV_ACCT_READ);
        r->req.resid -= r->req.sg->size;
        r->req.aiocb = dma_bdrv_read(s->qdev.conf.bs, r->req.sg, r->sector,
                                     scsi_dma_complete, r);
    } else {
        n = scsi_init_iovec(r, SCSI_DMA_BUF_SIZE);
        bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);
        r->req.aiocb = bdrv_aio_readv(s->qdev.conf.bs, r->sector, &r->qiov, n,
                                      scsi_read_complete, r);
done:
    if (!r->req.io_canceled) {
        scsi_req_unref(&r->req);


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void mb_cpu_realizefn(DeviceState *dev, Error **errp)
+
 {
+
     MicroBlazeCPU *cpu = MICROBLAZE_CPU(dev);

     MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_GET_CLASS(dev);

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

{

    MicroBlazeCPU *cpu = MICROBLAZE_CPU(dev);

    MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_GET_CLASS(dev);

    cpu_reset(CPU(cpu));

    mcc->parent_realize(dev, errp);

}


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

     case FTYPE_CD:

+        if (eject_flag) {
+
+            if (ioctl (s->fd, CDROMEJECT, NULL) < 0)
+
+                perror("CDROMEJECT");

         } else {

static int raw_eject(BlockDriverState *bs, int eject_flag)

{

    BDRVRawState *s = bs->opaque;

    switch(s->type) {

    case FTYPE_CD:

        if (eject_flag) {

            if (ioctl (s->fd, CDROMEJECT, NULL) < 0)

                perror("CDROMEJECT");

        } else {

            if (ioctl (s->fd, CDROMCLOSETRAY, NULL) < 0)

                perror("CDROMEJECT");

        }

        break;

    case FTYPE_FD:

        {

            int fd;

            if (s->fd >= 0) {

                close(s->fd);

                s->fd = -1;

                raw_close_fd_pool(s);

            }

            fd = open(bs->filename, s->fd_open_flags | O_NONBLOCK);

            if (fd >= 0) {

                if (ioctl(fd, FDEJECT, 0) < 0)

                    perror("FDEJECT");

                close(fd);

            }

        }

        break;

    default:

        return -ENOTSUP;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static ExitStatus op_ex(DisasContext *s, DisasOps *o)

 {
+
     /* ??? Perhaps a better way to implement EXECUTE is to set a bit in

        tb->flags, (ab)use the tb->cs_base field as the address of
+
        the template in memory, and grab 8 bits of tb->flags/cflags for

        the contents of the register.  We would then recognize all this

static ExitStatus op_ex(DisasContext *s, DisasOps *o)

{

    /* ??? Perhaps a better way to implement EXECUTE is to set a bit in

       tb->flags, (ab)use the tb->cs_base field as the address of

       the template in memory, and grab 8 bits of tb->flags/cflags for

       the contents of the register.  We would then recognize all this

       in gen_intermediate_code_internal, generating code for exactly

       one instruction.  This new TB then gets executed normally.

       On the other hand, this seems to be mostly used for modifying

       MVC inside of memcpy, which needs a helper call anyway.  So

       perhaps this doesn't bear thinking about any further.  */

    TCGv_i64 tmp;

    update_psw_addr(s);

    update_cc_op(s);

    tmp = tcg_const_i64(s->next_pc);

    gen_helper_ex(cc_op, cpu_env, cc_op, o->in1, o->in2, tmp);

    tcg_temp_free_i64(tmp);

    set_cc_static(s);

    return NO_EXIT;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int swf_probe(AVProbeData *p)

 {
+
     if(p->buf_size < 15)

         return 0;

static int swf_probe(AVProbeData *p)

{

    if(p->buf_size < 15)

        return 0;

    /* check file header */

    if (   AV_RB24(p->buf) != AV_RB24("CWS")

        && AV_RB24(p->buf) != AV_RB24("FWS"))

        return 0;

    if (p->buf[3] >= 20)

        return AVPROBE_SCORE_MAX / 4;

    return AVPROBE_SCORE_MAX;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static inline void gen_op_fcmpes(int fccno, TCGv r_rs1, TCGv r_rs2)
+
 {

     gen_helper_fcmpes(cpu_env, r_rs1, r_rs2);

static inline void gen_op_fcmpes(int fccno, TCGv r_rs1, TCGv r_rs2)

{

    gen_helper_fcmpes(cpu_env, r_rs1, r_rs2);

}


int ff_get_line(AVIOContext *s, char *buf, int maxlen)

{

    int i = 0;

    char c;

    do {

        c = avio_r8(s);

        if (c && i < maxlen-1)

            buf[i++] = c;

    } while (c != '\n' && c != '\r' && c);

    if (c == '\r' && avio_r8(s) != '\n')

        avio_skip(s, -1);

    buf[i] = 0;

    return i;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,

                                     uint64_t id)
+
 {

     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);

USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,

                                    uint64_t id)

{

    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);

    USBPacket *p;

    while ((p = QTAILQ_FIRST(&uep->queue)) != NULL) {

        if (p->id == id) {

            return p;

        }

    }

    return NULL;

}


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

 {

+    errno = EPERM;
+
     return -1;

 }

static int v9fs_synth_mkdir(FsContext *fs_ctx, V9fsPath *path,

                       const char *buf, FsCred *credp)

{

    errno = EPERM;

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void msi_uninit(struct PCIDevice *dev)
+
+{

     uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev));

void msi_uninit(struct PCIDevice *dev)

{

    uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev));

    uint8_t cap_size = msi_cap_sizeof(flags);

    pci_del_capability(dev, PCI_CAP_ID_MSIX, cap_size);

    MSI_DEV_PRINTF(dev, "uninit\n");

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int nprobe(AVFormatContext *s, uint8_t *enc_header, const uint8_t *n_val)

 {

static int nprobe(AVFormatContext *s, uint8_t *enc_header, const uint8_t *n_val)

{

    OMAContext *oc = s->priv_data;

    uint32_t pos, taglen, datalen;

    struct AVDES av_des;

    if (!enc_header || !n_val)

        return -1;

    pos = OMA_ENC_HEADER_SIZE + oc->k_size;

    if (!memcmp(&enc_header[pos], "EKB ", 4))

        pos += 32;

    if (AV_RB32(&enc_header[pos]) != oc->rid)

        av_log(s, AV_LOG_DEBUG, "Mismatching RID\n");

    taglen = AV_RB32(&enc_header[pos+32]);

    datalen = AV_RB32(&enc_header[pos+36]) >> 4;

    pos += 44 + taglen;

    av_des_init(&av_des, n_val, 192, 1);

    while (datalen-- > 0) {

        av_des_crypt(&av_des, oc->r_val, &enc_header[pos], 2, NULL, 1);

        kset(s, oc->r_val, NULL, 16);

        if (!rprobe(s, enc_header, oc->r_val))

            return 0;

        pos += 16;

    }

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     k->is_bridge = 1;

     k->vendor_id = PCI_VENDOR_ID_INTEL;
+
+    k->device_id = PCI_DEVICE_ID_INTEL_82801BA_11;
+
+    k->revision = ICH9_D2P_A2_REVISION;
+
     k->init = i82801b11_bridge_initfn;

     k->config_write = pci_bridge_write_config;

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

{

    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

    DeviceClass *dc = DEVICE_CLASS(klass);

    k->is_bridge = 1;

    k->vendor_id = PCI_VENDOR_ID_INTEL;

    k->device_id = PCI_DEVICE_ID_INTEL_82801BA_11;

    k->revision = ICH9_D2P_A2_REVISION;

    k->init = i82801b11_bridge_initfn;

    k->config_write = pci_bridge_write_config;

    set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);

}


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

         }
+
+        if (is_clcp_track(track)) {
+
+            mov_write_tapt_tag(pb, track);
+
         }

     }

static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,

                              MOVTrack *track, AVStream *st)

{

    int64_t pos = avio_tell(pb);

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

    ffio_wfourcc(pb, "trak");

    mov_write_tkhd_tag(pb, track, st);

    if (supports_edts(mov))

        mov_write_edts_tag(pb, track);  // PSP Movies and several other cases require edts box

    if (track->tref_tag)

        mov_write_tref_tag(pb, track);

    mov_write_mdia_tag(pb, track);

    if (track->mode == MODE_PSP)

        mov_write_uuid_tag_psp(pb, track); // PSP Movies require this uuid box

    if (track->tag == MKTAG('r','t','p',' '))

        mov_write_udta_sdp(pb, track);

    if (track->mode == MODE_MOV) {

        if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {

            double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);

            if (st->sample_aspect_ratio.num && 1.0 != sample_aspect_ratio) {

                mov_write_tapt_tag(pb, track);

            }

        }

        if (is_clcp_track(track)) {

            mov_write_tapt_tag(pb, track);

        }

    }

    return update_size(pb, pos);

}


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

+    frame = mxf->last_indexed_edit_unit + mxf->edit_units_count;
+
+
+
+    // write system metadata pack

     avio_write(pb, system_metadata_pack_key, 16);

static void mxf_write_system_item(AVFormatContext *s)

{

    MXFContext *mxf = s->priv_data;

    AVIOContext *pb = s->pb;

    unsigned frame;

    uint32_t time_code;

    frame = mxf->last_indexed_edit_unit + mxf->edit_units_count;

    // write system metadata pack

    avio_write(pb, system_metadata_pack_key, 16);

    klv_encode_ber4_length(pb, 57);

    avio_w8(pb, 0x5c); // UL, user date/time stamp, picture and sound item present

    avio_w8(pb, 0x04); // content package rate

    avio_w8(pb, 0x00); // content package type

    avio_wb16(pb, 0x00); // channel handle

    avio_wb16(pb, mxf->tc.start + frame); // continuity count

    if (mxf->essence_container_count > 1)

        avio_write(pb, multiple_desc_ul, 16);

    else {

        MXFStreamContext *sc = s->streams[0]->priv_data;

        avio_write(pb, mxf_essence_container_uls[sc->index].container_ul, 16);

    }

    avio_w8(pb, 0);

    avio_wb64(pb, 0);

    avio_wb64(pb, 0); // creation date/time stamp

    avio_w8(pb, 0x81); // SMPTE 12M time code

    time_code = av_timecode_get_smpte_from_framenum(&mxf->tc, frame);

    avio_wb32(pb, time_code);

    avio_wb32(pb, 0); // binary group data

    avio_wb64(pb, 0);

    // write system metadata package set

    avio_write(pb, system_metadata_package_set_key, 16);

    klv_encode_ber4_length(pb, 35);

    avio_w8(pb, 0x83); // UMID

    avio_wb16(pb, 0x20);

    mxf_write_umid(s, 1);

}


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

     if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))

+        return -1;
+
+    oggstream->header_len[0] = 51;
+
+    oggstream->header[0] = av_mallocz(51); // per ogg flac specs

     p = oggstream->header[0];

static int ogg_build_flac_headers(AVCodecContext *avctx,

                                  OGGStreamContext *oggstream, int bitexact)

{

    const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;

    enum FLACExtradataFormat format;

    uint8_t *streaminfo;

    uint8_t *p;

    if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))

        return -1;

    oggstream->header_len[0] = 51;

    oggstream->header[0] = av_mallocz(51); // per ogg flac specs

    p = oggstream->header[0];

    bytestream_put_byte(&p, 0x7F);

    bytestream_put_buffer(&p, "FLAC", 4);

    bytestream_put_byte(&p, 1); // major version

    bytestream_put_byte(&p, 0); // minor version

    bytestream_put_be16(&p, 1); // headers packets without this one

    bytestream_put_buffer(&p, "fLaC", 4);

    bytestream_put_byte(&p, 0x00); // streaminfo

    bytestream_put_be24(&p, 34);

    bytestream_put_buffer(&p, streaminfo, FLAC_STREAMINFO_SIZE);

    oggstream->header_len[1] = 1+3+4+strlen(vendor)+4;

    oggstream->header[1] = av_mallocz(oggstream->header_len[1]);

    p = oggstream->header[1];

    bytestream_put_byte(&p, 0x84); // last metadata block and vorbis comment

    bytestream_put_be24(&p, oggstream->header_len[1] - 4);

    bytestream_put_le32(&p, strlen(vendor));

    bytestream_put_buffer(&p, vendor, strlen(vendor));

    bytestream_put_le32(&p, 0); // user comment list length

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -51,11 +51,11 @@
 			if (optlen != TCPOLEN_MAXSEG)

 				continue;
+
+			if (!(ti->ti_flags & TH_SYN))
+
+				continue;
+
 			memcpy((char *) &mss, (char *) cp + 2, sizeof(mss));

 			NTOHS(mss);

tcp_dooptions(struct tcpcb *tp, u_char *cp, int cnt, struct tcpiphdr *ti)

{

	uint16_t mss;

	int opt, optlen;

	DEBUG_CALL("tcp_dooptions");

	DEBUG_ARGS((dfd," tp = %lx  cnt=%i \n", (long )tp, cnt));

	for (; cnt > 0; cnt -= optlen, cp += optlen) {

		opt = cp[0];

		if (opt == TCPOPT_EOL)

			break;

		if (opt == TCPOPT_NOP)

			optlen = 1;

		else {

			optlen = cp[1];

			if (optlen <= 0)

				break;

		}

		switch (opt) {

		default:

			continue;

		case TCPOPT_MAXSEG:

			if (optlen != TCPOLEN_MAXSEG)

				continue;

			if (!(ti->ti_flags & TH_SYN))

				continue;

			memcpy((char *) &mss, (char *) cp + 2, sizeof(mss));

			NTOHS(mss);

			(void) tcp_mss(tp, mss);	/* sets t_maxseg */

			break;

		}

	}

}


--- a/source.c
+++ b/source.c
@@ -55,11 +55,11 @@
             info->dimm = di;

             elem->value = info;
+
+            elem->next = NULL;
+
+            **prev = elem;
+
             *prev = &elem->next;

         }

int qmp_pc_dimm_device_list(Object *obj, void *opaque)

{

    MemoryDeviceInfoList ***prev = opaque;

    if (object_dynamic_cast(obj, TYPE_PC_DIMM)) {

        DeviceState *dev = DEVICE(obj);

        if (dev->realized) {

            MemoryDeviceInfoList *elem = g_new0(MemoryDeviceInfoList, 1);

            MemoryDeviceInfo *info = g_new0(MemoryDeviceInfo, 1);

            PCDIMMDeviceInfo *di = g_new0(PCDIMMDeviceInfo, 1);

            DeviceClass *dc = DEVICE_GET_CLASS(obj);

            PCDIMMDevice *dimm = PC_DIMM(obj);

            if (dev->id) {

                di->has_id = true;

                di->id = g_strdup(dev->id);

            }

            di->hotplugged = dev->hotplugged;

            di->hotpluggable = dc->hotpluggable;

            di->addr = dimm->addr;

            di->slot = dimm->slot;

            di->node = dimm->node;

            di->size = object_property_get_int(OBJECT(dimm), PC_DIMM_SIZE_PROP,

                                               NULL);

            di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem));

            info->dimm = di;

            elem->value = info;

            elem->next = NULL;

            **prev = elem;

            *prev = &elem->next;

        }

    }

    object_child_foreach(obj, qmp_pc_dimm_device_list, opaque);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)
+
 {

     s->chr_read(s->handler_opaque, buf, len);

void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)

{

    s->chr_read(s->handler_opaque, buf, len);

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     if (f->ops->rate_limit)

         return f->ops->rate_limit(f->opaque);
+
+
+
     return 0;

 }

int qemu_file_rate_limit(QEMUFile *f)

{

    if (f->ops->rate_limit)

        return f->ops->rate_limit(f->opaque);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void bt_submit_sco(struct HCIInfo *info,

+                const uint8_t *data, int length)
+
+{
+
+    struct bt_hci_s *hci = hci_from_info(info);

     uint16_t handle;

static void bt_submit_sco(struct HCIInfo *info,

                const uint8_t *data, int length)

{

    struct bt_hci_s *hci = hci_from_info(info);

    uint16_t handle;

    int datalen;

    if (length < 3)

        return;

    handle = acl_handle((data[1] << 8) | data[0]);

    datalen = data[2];

    length -= 3;

    if (bt_hci_handle_bad(hci, handle)) {

        fprintf(stderr, "%s: invalid SCO handle %03x\n",

                        __FUNCTION__, handle);

        return;

    }

    if (datalen > length) {

        fprintf(stderr, "%s: SCO packet too short (%iB < %iB)\n",

                        __FUNCTION__, length, datalen);

        return;

    }

    /* TODO */

    /* TODO: increase counter and send EVT_NUM_COMP_PKTS if synchronous

     * Flow Control is enabled.

     * (See Read/Write_Synchronous_Flow_Control_Enable on page 513 and

     * page 514.)  */

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void blk_io_limits_disable(BlockBackend *blk)
+
+{
+
+    assert(blk->public.throttle_group_member.throttle_state);

     bdrv_drained_begin(blk_bs(blk));

void blk_io_limits_disable(BlockBackend *blk)

{

    assert(blk->public.throttle_group_member.throttle_state);

    bdrv_drained_begin(blk_bs(blk));

    throttle_group_unregister_tgm(&blk->public.throttle_group_member);

    bdrv_drained_end(blk_bs(blk));

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void bufp_alloc(USBRedirDevice *dev,

     uint8_t *data, int len, int status, uint8_t ep)

static void bufp_alloc(USBRedirDevice *dev,

    uint8_t *data, int len, int status, uint8_t ep)

{

    struct buf_packet *bufp;

    if (!dev->endpoint[EP2I(ep)].bufpq_dropping_packets &&

        dev->endpoint[EP2I(ep)].bufpq_size >

            2 * dev->endpoint[EP2I(ep)].bufpq_target_size) {

        DPRINTF("bufpq overflow, dropping packets ep %02X\n", ep);

        dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 1;

    }

    /* Since we're interupting the stream anyways, drop enough packets to get

       back to our target buffer size */

    if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) {

        if (dev->endpoint[EP2I(ep)].bufpq_size >

                dev->endpoint[EP2I(ep)].bufpq_target_size) {

            free(data);

            return;

        }

        dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0;

    }

    bufp = g_malloc(sizeof(struct buf_packet));

    bufp->data   = data;

    bufp->len    = len;

    bufp->status = status;

    QTAILQ_INSERT_TAIL(&dev->endpoint[EP2I(ep)].bufpq, bufp, next);

    dev->endpoint[EP2I(ep)].bufpq_size++;

}


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

+    if (!nbd_server) {

         return FALSE;

static gboolean nbd_accept(QIOChannel *ioc, GIOCondition condition,

                           gpointer opaque)

{

    QIOChannelSocket *cioc;

    if (!nbd_server) {

        return FALSE;

    }

    cioc = qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc),

                                     NULL);

    if (!cioc) {

        return TRUE;

    }

    qio_channel_set_name(QIO_CHANNEL(cioc), "nbd-server");

    nbd_client_new(NULL, cioc,

                   nbd_server->tlscreds, NULL,

                   nbd_client_put);

    object_unref(OBJECT(cioc));

    return TRUE;

}


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

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

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

                     int yalpha, int uvalpha, int y,

                     enum AVPixelFormat target, int hasAlpha)

{

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

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

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

                  *abuf0 = hasAlpha ? abuf[0] : NULL,

                  *abuf1 = hasAlpha ? abuf[1] : NULL;

    int  yalpha1 = 4096 - yalpha;

    int uvalpha1 = 4096 - uvalpha;

    int i;

    int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4;

    int err[4] = {0};

    if(   target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE

       || target == AV_PIX_FMT_BGR8      || target == AV_PIX_FMT_RGB8)

        step = 1;

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

        int Y = ( buf0[i] * yalpha1  +  buf1[i] * yalpha             ) >> 10; //FIXME rounding

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

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

        int A;

        if (hasAlpha) {

            A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha + (1<<18)) >> 19;

            if (A & 0x100)

                A = av_clip_uint8(A);

        }

        yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);

        dest += step;

    }

    c->dither_error[0][i] = err[0];

    c->dither_error[1][i] = err[1];

    c->dither_error[2][i] = err[2];

}


--- a/source.c
+++ b/source.c
@@ -57,11 +57,11 @@
     s_fdt.node_off = offset;

     s_fdt.sphb = p->sphb;
+
+    pci_for_each_device(sec_bus, pci_bus_num(sec_bus),
+
+                        spapr_populate_pci_devices_dt,
+
                         &s_fdt);

 }

static void spapr_populate_pci_devices_dt(PCIBus *bus, PCIDevice *pdev,

                                          void *opaque)

{

    PCIBus *sec_bus;

    sPAPRFDT *p = opaque;

    int offset;

    sPAPRFDT s_fdt;

    uint32_t drc_index = spapr_phb_get_pci_drc_index(p->sphb, pdev);

    offset = spapr_create_pci_child_dt(p->sphb, pdev,

                                       drc_index, NULL,

                                       p->fdt, p->node_off);

    if (!offset) {

        error_report("Failed to create pci child device tree node");

        return;

    }

    if ((pci_default_read_config(pdev, PCI_HEADER_TYPE, 1) !=

         PCI_HEADER_TYPE_BRIDGE)) {

        return;

    }

    sec_bus = pci_bridge_get_sec_bus(PCI_BRIDGE(pdev));

    if (!sec_bus) {

        return;

    }

    s_fdt.fdt = p->fdt;

    s_fdt.node_off = offset;

    s_fdt.sphb = p->sphb;

    pci_for_each_device(sec_bus, pci_bus_num(sec_bus),

                        spapr_populate_pci_devices_dt,

                        &s_fdt);

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     char buffer[PATH_MAX];

     ret  = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS);
+
+    if (ret == -1 && errno == ENODATA) {
+
+        /*
+
          * We don't get ENODATA error when trying to remove a

          * posix acl that is not present. So don't throw the error

static int mp_pacl_removexattr(FsContext *ctx,

                               const char *path, const char *name)

{

    int ret;

    char buffer[PATH_MAX];

    ret  = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS);

    if (ret == -1 && errno == ENODATA) {

        /*

         * We don't get ENODATA error when trying to remove a

         * posix acl that is not present. So don't throw the error

         * even in case of mapped security model

         */

        errno = 0;

        ret = 0;

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -23,11 +23,11 @@
             dcl->gui_timer_interval < interval)

             interval = dcl->gui_timer_interval;
+
+        dcl = dcl->next;
+
+    }
+
     qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock(rt_clock));

 }

static void gui_update(void *opaque)

{

    uint64_t interval = GUI_REFRESH_INTERVAL;

    DisplayState *ds = opaque;

    DisplayChangeListener *dcl = ds->listeners;

    qemu_flush_coalesced_mmio_buffer();

    dpy_refresh(ds);

    while (dcl != NULL) {

        if (dcl->gui_timer_interval &&

            dcl->gui_timer_interval < interval)

            interval = dcl->gui_timer_interval;

        dcl = dcl->next;

    }

    qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock(rt_clock));

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     value = bswap32(value);

     if (port < s->pio.size) {
+
+        writel(s->pio_cpu_base + port, value);
+
+    } else {
+
         writel(s->mmio_cpu_base + port, value);

     }

static void qpci_spapr_io_writel(QPCIBus *bus, void *addr, uint32_t value)

{

    QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);

    uint64_t port = (uintptr_t)addr;

    value = bswap32(value);

    if (port < s->pio.size) {

        writel(s->pio_cpu_base + port, value);

    } else {

        writel(s->mmio_cpu_base + port, value);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
+{
+    int i, tmp, partition, method_type, rice_order;
+    int rice_bits, rice_esc;
+    int samples;
     method_type = get_bits(&s->gb, 2);
     if (method_type > 1) {
         av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",

static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
{
    int i, tmp, partition, method_type, rice_order;
    int rice_bits, rice_esc;
    int samples;
    method_type = get_bits(&s->gb, 2);
    if (method_type > 1) {
        av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",
               method_type);
    rice_order = get_bits(&s->gb, 4);
    samples= s->blocksize >> rice_order;
    if (pred_order > samples) {
        av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n",
               pred_order, samples);
    rice_bits = 4 + method_type;
    rice_esc  = (1 << rice_bits) - 1;
    decoded += pred_order;
    i= pred_order;
    for (partition = 0; partition < (1 << rice_order); partition++) {
        tmp = get_bits(&s->gb, rice_bits);
        if (tmp == rice_esc) {
            tmp = get_bits(&s->gb, 5);
            for (; i < samples; i++)
                *decoded++ = get_sbits_long(&s->gb, tmp);
        } else {
            for (; i < samples; i++) {
                *decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
        i= 0;
    return 0;


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void av_image_copy_plane(uint8_t       *dst, int dst_linesize,

+                         const uint8_t *src, int src_linesize,
+
+                         int bytewidth, int height)
+
+{

     if (!dst || !src)

void av_image_copy_plane(uint8_t       *dst, int dst_linesize,

                         const uint8_t *src, int src_linesize,

                         int bytewidth, int height)

{

    if (!dst || !src)

        return;

    for (;height > 0; height--) {

        memcpy(dst, src, bytewidth);

        dst += dst_linesize;

        src += src_linesize;

    }

}


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

     av_freep(&s->mb_type);

+    av_freep(&s->p_mv_table);
+
+    av_freep(&s->b_forw_mv_table);
+
+    av_freep(&s->b_back_mv_table);

     av_freep(&s->b_bidir_forw_mv_table);

void MPV_common_end(MpegEncContext *s)

{

    int i;

    av_freep(&s->mb_type);

    av_freep(&s->p_mv_table);

    av_freep(&s->b_forw_mv_table);

    av_freep(&s->b_back_mv_table);

    av_freep(&s->b_bidir_forw_mv_table);

    av_freep(&s->b_bidir_back_mv_table);

    av_freep(&s->b_direct_mv_table);

    av_freep(&s->motion_val);

    av_freep(&s->dc_val[0]);

    av_freep(&s->ac_val[0]);

    av_freep(&s->coded_block);

    av_freep(&s->mbintra_table);

    av_freep(&s->cbp_table);

    av_freep(&s->pred_dir_table);

    av_freep(&s->me.scratchpad);

    av_freep(&s->me.map);

    av_freep(&s->me.score_map);

    av_freep(&s->mbskip_table);

    av_freep(&s->bitstream_buffer);

    av_freep(&s->tex_pb_buffer);

    av_freep(&s->pb2_buffer);

    av_freep(&s->edge_emu_buffer);

    av_freep(&s->co_located_type_table);

    av_freep(&s->field_mv_table);

    av_freep(&s->field_select_table);

    av_freep(&s->avctx->stats_out);

    av_freep(&s->ac_stats);

    av_freep(&s->error_status_table);

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

        free_picture(s, &s->picture[i]);

    }

    s->context_initialized = 0;

}


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

     //const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;

+
+
+    a0 = row[0];
+
+    a1 = row[1];

     a2 = row[2];


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

     av_strlcpy(s->ptr, text, FFMIN(s->end - s->ptr, len + 1));

+    s->ptr += len;
+
 }

static void mov_text_text_cb(void *priv, const char *text, int len)

{

    MovTextContext *s = priv;

    av_strlcpy(s->ptr, text, FFMIN(s->end - s->ptr, len + 1));

    s->ptr += len;

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
         /* e500v2 can only do even TLB size bits */

         ps++;
+
+    }
+
+    size = (ps << MAS1_TSIZE_SHIFT);
+
     tlb->mas1 = MAS1_VALID | size;

     tlb->mas2 = 0;

static void mmubooke_create_initial_mapping(CPUPPCState *env)

{

    struct boot_info *bi = env->load_info;

    ppcmas_tlb_t *tlb = booke206_get_tlbm(env, 1, 0, 0);

    hwaddr size, dt_end;

    int ps;

    /* Our initial TLB entry needs to cover everything from 0 to

       the device tree top */

    dt_end = bi->dt_base + bi->dt_size;

    ps = booke206_page_size_to_tlb(dt_end) + 1;

    if (ps & 1) {

        /* e500v2 can only do even TLB size bits */

        ps++;

    }

    size = (ps << MAS1_TSIZE_SHIFT);

    tlb->mas1 = MAS1_VALID | size;

    tlb->mas2 = 0;

    tlb->mas7_3 = 0;

    tlb->mas7_3 |= MAS3_UR | MAS3_UW | MAS3_UX | MAS3_SR | MAS3_SW | MAS3_SX;

    env->tlb_dirty = true;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static void client_close(NBDClient *client)

 {

     if (client->closing) {

+        return;
+
     }

static void client_close(NBDClient *client)

{

    if (client->closing) {

        return;

    }

    client->closing = true;

    /* Force requests to finish.  They will drop their own references,

     * then we'll close the socket and free the NBDClient.

     */

    qio_channel_shutdown(client->ioc, QIO_CHANNEL_SHUTDOWN_BOTH,

                         NULL);

    /* Also tell the client, so that they release their reference.  */

    if (client->close) {

        client->close(client);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int vmdk_is_allocated(BlockDriverState *bs, int64_t sector_num,

+                             int nb_sectors, int *pnum)
+
+{
+
+    BDRVVmdkState *s = bs->opaque;

     int64_t index_in_cluster, n, ret;

static int vmdk_is_allocated(BlockDriverState *bs, int64_t sector_num,

                             int nb_sectors, int *pnum)

{

    BDRVVmdkState *s = bs->opaque;

    int64_t index_in_cluster, n, ret;

    uint64_t offset;

    VmdkExtent *extent;

    extent = find_extent(s, sector_num, NULL);

    if (!extent) {

        return 0;

    }

    ret = get_cluster_offset(bs, extent, NULL,

                            sector_num * 512, 0, &offset);

    /* get_cluster_offset returning 0 means success */

    ret = !ret;

    index_in_cluster = sector_num % extent->cluster_sectors;

    n = extent->cluster_sectors - index_in_cluster;

    if (n > nb_sectors) {

        n = nb_sectors;

    }

    *pnum = n;

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
     switch (saddr) {

     case BONITO_INTISR:
+
+        return s->regs[saddr];
+
+    default:
+
         return s->regs[saddr];

     }

static uint64_t bonito_readl(void *opaque, target_phys_addr_t addr,

                             unsigned size)

{

    PCIBonitoState *s = opaque;

    uint32_t saddr;

    saddr = (addr - BONITO_REGBASE) >> 2;

    DPRINTF("bonito_readl "TARGET_FMT_plx"\n", addr);

    switch (saddr) {

    case BONITO_INTISR:

        return s->regs[saddr];

    default:

        return s->regs[saddr];

    }

}


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

      * hash value/pteg group index is normalized by htab_mask

+     */
+
+    if (((ptex & ~7ULL) / HPTES_PER_GROUP) & ~cpu->env.htab_mask) {
+
         return false;

     }

static inline bool valid_ptex(PowerPCCPU *cpu, target_ulong ptex)

{

    /*

     * hash value/pteg group index is normalized by htab_mask

     */

    if (((ptex & ~7ULL) / HPTES_PER_GROUP) & ~cpu->env.htab_mask) {

        return false;

    }

    return true;

}


--- a/source.c
+++ b/source.c
@@ -18,10 +18,10 @@
         error_reportf_err(err, "Initialization of device %s failed: ",

                           object_get_typename(OBJECT(dev)));
+
+        exit(1);
+
+    }
+

 }

void qdev_init_nofail(DeviceState *dev)

{

    Error *err = NULL;

    assert(!dev->realized);

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

    if (err) {

        error_reportf_err(err, "Initialization of device %s failed: ",

                          object_get_typename(OBJECT(dev)));

        exit(1);

    }

}


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

 	fprintf (stderr, "%s", __func__);
+
+	for (i = 0; i < 0x10; i++)
+
+	{
+
 		p1 = mmap(NULL, pagesize, PROT_READ,

 			  MAP_PRIVATE,

void check_file_unfixed_eof_mmaps(void)

{

	char *cp;

	unsigned int *p1;

	uintptr_t p;

	int i;

	fprintf (stderr, "%s", __func__);

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

	{

		p1 = mmap(NULL, pagesize, PROT_READ,

			  MAP_PRIVATE,

			  test_fd,

			  (test_fsize - sizeof *p1) & ~pagemask);

		fail_unless (p1 != MAP_FAILED);

		/* Make sure we get pages aligned with the pagesize. The

		   target expects this.  */

		p = (uintptr_t) p1;

		fail_unless ((p & pagemask) == 0);

		/* Verify that the file maps was made correctly.  */

		fail_unless (p1[(test_fsize & pagemask) / sizeof *p1 - 1]

			     == ((test_fsize - sizeof *p1) / sizeof *p1));

		/* Verify that the end of page is accessable and zeroed.  */

		cp = (void *) p1;

		fail_unless (cp[pagesize - 4] == 0);

		munmap (p1, pagesize);

	}

	fprintf (stderr, " passed\n");

}


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
                                               "NE2000", sizeof(PCINE2000State),

                                               devfn,
+
                                               NULL, NULL);

     pci_conf = d->dev.config;

PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)

{

    PCINE2000State *d;

    NE2000State *s;

    uint8_t *pci_conf;

    d = (PCINE2000State *)pci_register_device(bus,

                                              "NE2000", sizeof(PCINE2000State),

                                              devfn,

                                              NULL, NULL);

    pci_conf = d->dev.config;

    pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);

    pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8029);

    pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);

    pci_conf[0x0e] = 0x00; // header_type

    pci_conf[0x3d] = 1; // interrupt pin 0

    pci_register_io_region(&d->dev, 0, 0x100,

                           PCI_ADDRESS_SPACE_IO, ne2000_map);

    s = &d->ne2000;

    s->irq = d->dev.irq[0];

    s->pci_dev = (PCIDevice *)d;

    memcpy(s->macaddr, nd->macaddr, 6);

    ne2000_reset(s);

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

                                 ne2000_receive, ne2000_can_receive, s);

    qemu_format_nic_info_str(s->vc, s->macaddr);

    register_savevm("ne2000", -1, 3, ne2000_save, ne2000_load, s);

    return (PCIDevice *)d;

}


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

+{
+
+    BlockAIOCBSync *acb = opaque;
+
+

     if (!acb->is_write && acb->ret >= 0) {

static void bdrv_aio_bh_cb(void *opaque)

{

    BlockAIOCBSync *acb = opaque;

    if (!acb->is_write && acb->ret >= 0) {

        qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);

    }

    qemu_vfree(acb->bounce);

    acb->common.cb(acb->common.opaque, acb->ret);

    qemu_bh_delete(acb->bh);

    acb->bh = NULL;

    qemu_aio_unref(acb);

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         atomic_load_explicit(&progress[field], memory_order_acquire) >= n)

         return;
+
+
+
+    p = f->owner->internal->thread_ctx;
+

     if (f->owner->debug&FF_DEBUG_THREADS)

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

{

    PerThreadContext *p;

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

    if (!progress ||

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

        return;

    p = f->owner->internal->thread_ctx;

    if (f->owner->debug&FF_DEBUG_THREADS)

        av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n", progress, n, field);

    pthread_mutex_lock(&p->progress_mutex);

    atomic_store(&progress[field], n);

    pthread_cond_broadcast(&p->progress_cond);

    pthread_mutex_unlock(&p->progress_mutex);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void check_pred8x8l(H264PredContext *h, uint8_t *buf0, uint8_t *buf1,
+
+                           int codec, int chroma_format, int bit_depth)
+
+{

     if (chroma_format == 1 && codec_ids[codec] == AV_CODEC_ID_H264) {

static void check_pred8x8l(H264PredContext *h, uint8_t *buf0, uint8_t *buf1,

                           int codec, int chroma_format, int bit_depth)

{

    if (chroma_format == 1 && codec_ids[codec] == AV_CODEC_ID_H264) {

        int pred_mode;

        for (pred_mode = 0; pred_mode < 12; pred_mode++) {

            if (check_pred_func(h->pred8x8l[pred_mode], "8x8l", pred4x4_modes[codec][pred_mode])) {

                int neighbors;

                for (neighbors = 0; neighbors <= 0xc000; neighbors += 0x4000) {

                    int has_topleft  = neighbors & 0x8000;

                    int has_topright = neighbors & 0x4000;

                    if ((pred_mode == DIAG_DOWN_RIGHT_PRED || pred_mode == VERT_RIGHT_PRED) && !has_topleft)

                        continue; /* Those aren't allowed according to the spec */

                    randomize_buffers();

                    call_ref(src0, has_topleft, has_topright, (ptrdiff_t)24*SIZEOF_PIXEL);

                    call_new(src1, has_topleft, has_topright, (ptrdiff_t)24*SIZEOF_PIXEL);

                    if (memcmp(buf0, buf1, BUF_SIZE))

                        fail();

                    bench_new(src1, has_topleft, has_topright, (ptrdiff_t)24*SIZEOF_PIXEL);

                }

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
     memset(&io_header, 0, sizeof(io_header));

     io_header.interface_id = 'S';
+
+    io_header.dxfer_direction = SG_DXFER_FROM_DEV;
+
+    io_header.dxfer_len = sizeof(buf);
+
     io_header.dxferp = buf;

     io_header.cmdp = cmd;

static int get_blocksize(BlockDriverState *bdrv)

{

    uint8_t cmd[10];

    uint8_t buf[8];

    uint8_t sensebuf[8];

    sg_io_hdr_t io_header;

    int ret;

    memset(cmd, 0, sizeof(cmd));

    memset(buf, 0, sizeof(buf));

    cmd[0] = READ_CAPACITY_10;

    memset(&io_header, 0, sizeof(io_header));

    io_header.interface_id = 'S';

    io_header.dxfer_direction = SG_DXFER_FROM_DEV;

    io_header.dxfer_len = sizeof(buf);

    io_header.dxferp = buf;

    io_header.cmdp = cmd;

    io_header.cmd_len = sizeof(cmd);

    io_header.mx_sb_len = sizeof(sensebuf);

    io_header.sbp = sensebuf;

    io_header.timeout = 6000; /* XXX */

    ret = bdrv_ioctl(bdrv, SG_IO, &io_header);

    if (ret < 0)

        return -1;

    return (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7];

}


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

     BDRVRBDState *s = bs->opaque;
+
+    int r;
+
+

     r = rbd_snap_rollback(s->image, snapshot_name);

static int qemu_rbd_snap_rollback(BlockDriverState *bs,

                                  const char *snapshot_name)

{

    BDRVRBDState *s = bs->opaque;

    int r;

    r = rbd_snap_rollback(s->image, snapshot_name);

    return r;

}


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

     }

+
+
+    /* TODO: Check for resize-capable KVM implementations */
+
+

     error_setg(errp,

void kvmppc_check_papr_resize_hpt(Error **errp)

{

    if (!kvm_enabled()) {

        return;

    }

    /* TODO: Check for resize-capable KVM implementations */

    error_setg(errp,

               "Hash page table resizing not available with this KVM version");

}


void OPPROTO op_addl_ESI_T0(void)

{

    ESI = (uint32_t)(ESI + T0);

}


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

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

ram_addr_t xen_ram_addr_from_mapcache(void *ptr)

{

    MapCacheEntry *entry = NULL;

    MapCacheRev *reventry;

    hwaddr paddr_index;

    hwaddr size;

    int found = 0;

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

        if (reventry->vaddr_req == ptr) {

            paddr_index = reventry->paddr_index;

            size = reventry->size;

            found = 1;

            break;

        }

    }

    if (!found) {

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

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

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

                    reventry->vaddr_req);

        }

        abort();

        return 0;

    }

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

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

        entry = entry->next;

    }

    if (!entry) {

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

        return 0;

    }

    return (reventry->paddr_index << MCACHE_BUCKET_SHIFT) +

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

}


--- a/source.c
+++ b/source.c
@@ -1,27 +1,27 @@
 DISAS_INSN(divl)
+
+{
+
     TCGv num;

+    TCGv den;
+
     TCGv reg;

+    uint16_t ext;
+
+

+    ext = read_im16(env, s);
+
+    if (ext & 0x87f8) {

+        gen_exception(s, s->pc - 4, EXCP_UNSUPPORTED);

+        return;
+
     }
+
     num = DREG(ext, 12);

     reg = DREG(ext, 0);

DISAS_INSN(divl)

{

    TCGv num;

    TCGv den;

    TCGv reg;

    uint16_t ext;

    ext = read_im16(env, s);

    if (ext & 0x87f8) {

        gen_exception(s, s->pc - 4, EXCP_UNSUPPORTED);

        return;

    }

    num = DREG(ext, 12);

    reg = DREG(ext, 0);

    tcg_gen_mov_i32(QREG_DIV1, num);

    SRC_EA(env, den, OS_LONG, 0, NULL);

    tcg_gen_mov_i32(QREG_DIV2, den);

    if (ext & 0x0800) {

        gen_helper_divs(cpu_env, tcg_const_i32(0));

    } else {

        gen_helper_divu(cpu_env, tcg_const_i32(0));

    }

    if ((ext & 7) == ((ext >> 12) & 7)) {

        /* div */

        tcg_gen_mov_i32 (reg, QREG_DIV1);

    } else {

        /* rem */

        tcg_gen_mov_i32 (reg, QREG_DIV2);

    }

    set_cc_op(s, CC_OP_FLAGS);

}


--- a/source.c
+++ b/source.c
@@ -9,9 +9,9 @@
     if (cpu_memory_rw_debug(env, bp->pc, &int3, 1, 0) || int3 != 0xcc ||

         cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&bp->saved_insn, 1, 1))
+
+        return -EINVAL;
+
+    return 0;

 }

int kvm_arch_remove_sw_breakpoint(CPUState *env, struct kvm_sw_breakpoint *bp)

{

    uint8_t int3;

    if (cpu_memory_rw_debug(env, bp->pc, &int3, 1, 0) || int3 != 0xcc ||

        cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&bp->saved_insn, 1, 1))

        return -EINVAL;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *value)

+{
+
+    int res;
+
+

     res = bdrv_attach(value, dev);

int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *value)

{

    int res;

    res = bdrv_attach(value, dev);

    if (res < 0) {

        error_report("Can't attach drive %s to %s.%s: %s",

                     bdrv_get_device_name(value),

                     dev->id ? dev->id : dev->info->name,

                     name, strerror(-res));

        return -1;

    }

    qdev_prop_set(dev, name, &value, PROP_TYPE_DRIVE);

    return 0;

}


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

                           uint8_t *rsp, unsigned int *rsp_len,

static void add_sel_entry(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(18);

    if (sel_add_event(ibs, cmd + 2)) {

        rsp[2] = IPMI_CC_OUT_OF_SPACE;

        return;

    }

    /* sel_add_event fills in the record number. */

    IPMI_ADD_RSP_DATA(cmd[2]);

    IPMI_ADD_RSP_DATA(cmd[3]);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+void pc_cmos_set_s3_resume(void *opaque, int irq, int level)
+
+{

     ISADevice *s = opaque;

void pc_cmos_set_s3_resume(void *opaque, int irq, int level)

{

    ISADevice *s = opaque;

    if (level) {

        rtc_set_memory(s, 0xF, 0xFE);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void memory_region_iommu_replay(MemoryRegion *mr, IOMMUNotifier *n,

+                                bool is_write)
+
+{
+
+    hwaddr addr, granularity;

     IOMMUTLBEntry iotlb;

void memory_region_iommu_replay(MemoryRegion *mr, IOMMUNotifier *n,

                                bool is_write)

{

    hwaddr addr, granularity;

    IOMMUTLBEntry iotlb;

    IOMMUAccessFlags flag = is_write ? IOMMU_WO : IOMMU_RO;

    /* If the IOMMU has its own replay callback, override */

    if (mr->iommu_ops->replay) {

        mr->iommu_ops->replay(mr, n);

        return;

    }

    granularity = memory_region_iommu_get_min_page_size(mr);

    for (addr = 0; addr < memory_region_size(mr); addr += granularity) {

        iotlb = mr->iommu_ops->translate(mr, addr, flag);

        if (iotlb.perm != IOMMU_NONE) {

            n->notify(n, &iotlb);

        }

        /* if (2^64 - MR size) < granularity, it's possible to get an

         * infinite loop here.  This should catch such a wraparound */

        if ((addr + granularity) < addr) {

            break;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -11,9 +11,9 @@
     while (info->name) {

         spapr_cpu_core_register(info);
+
+        info++;
+
+    }

 }

static void spapr_cpu_core_register_types(void)

{

    const SPAPRCoreInfo *info = spapr_cores;

    type_register_static(&spapr_cpu_core_type_info);

    while (info->name) {

        spapr_cpu_core_register(info);

        info++;

    }

}


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

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

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

static int encode_ext_header(Wmv2Context *w){

    MpegEncContext * const s= &w->s;

    PutBitContext pb;

    int code;

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

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

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

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

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

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

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

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

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

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

    flush_put_bits(&pb);

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

    return 0;

}


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

 {

+    char command[CONTROL_BUFFER_SIZE];
+
+    const int stor_codes[] = {150, 0};
+
+

     snprintf(command, sizeof(command), "STOR %s\r\n", s->path);

static int ftp_store(FTPContext *s)

{

    char command[CONTROL_BUFFER_SIZE];

    const int stor_codes[] = {150, 0};

    snprintf(command, sizeof(command), "STOR %s\r\n", s->path);

    if (!ftp_send_command(s, command, stor_codes, NULL))

        return AVERROR(EIO);

    s->state = UPLOADING;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void dmg_refresh_limits(BlockDriverState *bs, Error **errp)
+
 {

     bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */

static void dmg_refresh_limits(BlockDriverState *bs, Error **errp)

{

    bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void qvirtio_pci_set_features(QVirtioDevice *d, uint32_t features)

+{

     QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;

static void qvirtio_pci_set_features(QVirtioDevice *d, uint32_t features)

{

    QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;

    qpci_io_writel(dev->pdev, dev->addr + VIRTIO_PCI_GUEST_FEATURES, features);

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
     v9fs_string_init(&xvalue);

     xvalue.size = size;
+
+    xvalue.data = g_malloc(size);
+
+    memcpy(xvalue.data, value, size);
+

     retval = v9fs_request(ctx->private, T_LSETXATTR, value, "sssdd",

static int proxy_lsetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name,

                           void *value, size_t size, int flags)

{

    int retval;

    V9fsString xname, xvalue;

    v9fs_string_init(&xname);

    v9fs_string_sprintf(&xname, "%s", name);

    v9fs_string_init(&xvalue);

    xvalue.size = size;

    xvalue.data = g_malloc(size);

    memcpy(xvalue.data, value, size);

    retval = v9fs_request(ctx->private, T_LSETXATTR, value, "sssdd",

                          fs_path, &xname, &xvalue, size, flags);

    v9fs_string_free(&xname);

    v9fs_string_free(&xvalue);

    if (retval < 0) {

        errno = -retval;

    }

    return retval;

}


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

     memory_region_transaction_begin();

+    as->root = root;
+
+    as->current_map = g_new(FlatView, 1);
+
+    flatview_init(as->current_map);

void address_space_init(AddressSpace *as, MemoryRegion *root)

{

    memory_region_transaction_begin();

    as->root = root;

    as->current_map = g_new(FlatView, 1);

    flatview_init(as->current_map);

    QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link);

    as->name = NULL;

    memory_region_transaction_commit();

    address_space_init_dispatch(as);

}


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

     for (ch = 0; ch < c->nchannels; ch++) {
+
         int shift = chs_get_lsb_width(s, c, band, ch);

+        if (shift) {

             int32_t *msb = b->msb_sample_buffer[ch];

static void chs_assemble_msbs_lsbs(DCAXllDecoder *s, DCAXllChSet *c, int band)

{

    DCAXllBand *b = &c->bands[band];

    int n, ch, nsamples = s->nframesamples;

    for (ch = 0; ch < c->nchannels; ch++) {

        int shift = chs_get_lsb_width(s, c, band, ch);

        if (shift) {

            int32_t *msb = b->msb_sample_buffer[ch];

            if (b->nscalablelsbs[ch]) {

                int32_t *lsb = b->lsb_sample_buffer[ch];

                int adj = b->bit_width_adjust[ch];

                for (n = 0; n < nsamples; n++)

                    msb[n] = msb[n] * (1 << shift) + (lsb[n] << adj);

            } else {

                for (n = 0; n < nsamples; n++)

                    msb[n] = msb[n] * (1 << shift);

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                 int line, int left, uint8_t lru[3][8])

 {
+
     int x, y;

     int width    = frame->width;

static int dx2_decode_slice_rgb(GetBitContext *gb, AVFrame *frame,

                                int line, int left, uint8_t lru[3][8])

{

    int x, y;

    int width    = frame->width;

    int stride   = frame->linesize[0];

    uint8_t *dst = frame->data[0] + stride * line;

    for (y = 0; y < left && get_bits_left(gb) > 16; y++) {

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

            dst[x * 3 + 0] = decode_sym(gb, lru[0]);

            dst[x * 3 + 1] = decode_sym(gb, lru[1]);

            dst[x * 3 + 2] = decode_sym(gb, lru[2]);

        }

        dst += stride;

    }

    return y;

}


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

     MP3Context  *mp3 = s->priv_data;
+

     if (pkt->data && pkt->size >= 4) {

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

{

    MP3Context  *mp3 = s->priv_data;

    if (pkt->data && pkt->size >= 4) {

        MPADecodeHeader c;

        int av_unused base;

        avpriv_mpegaudio_decode_header(&c, AV_RB32(pkt->data));

        if (!mp3->initial_bitrate)

            mp3->initial_bitrate = c.bit_rate;

        if ((c.bit_rate == 0) || (mp3->initial_bitrate != c.bit_rate))

            mp3->has_variable_bitrate = 1;

#ifdef FILTER_VBR_HEADERS

        /* filter out XING and INFO headers. */

        base = 4 + xing_offtbl[c.lsf == 1][c.nb_channels == 1];

        if (base + 4 <= pkt->size) {

            uint32_t v = AV_RB32(pkt->data + base);

            if (MKBETAG('X','i','n','g') == v || MKBETAG('I','n','f','o') == v)

                return 0;

        }

        /* filter out VBRI headers. */

        base = 4 + 32;

        if (base + 4 <= pkt->size && MKBETAG('V','B','R','I') == AV_RB32(pkt->data + base))

            return 0;

#endif

        if (mp3->xing_offset)

            mp3_xing_add_frame(mp3, pkt);

    }

    return ff_raw_write_packet(s, pkt);

}


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

         if (ret) {
+
+            perror("qemu_madvise");
+
+            fprintf(stderr,
+
                     "Need MADV_DONTFORK in absence of synchronous KVM MMU\n");

             exit(1);

void kvm_setup_guest_memory(void *start, size_t size)

{

#ifdef CONFIG_VALGRIND_H

    VALGRIND_MAKE_MEM_DEFINED(start, size);

#endif

    if (!kvm_has_sync_mmu()) {

        int ret = qemu_madvise(start, size, QEMU_MADV_DONTFORK);

        if (ret) {

            perror("qemu_madvise");

            fprintf(stderr,

                    "Need MADV_DONTFORK in absence of synchronous KVM MMU\n");

            exit(1);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,3 +1,3 @@
 void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg)
+{
     *cfg = ts->cfg;

void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg)
{
    *cfg = ts->cfg;


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void helper_mtc0_index(CPUMIPSState *env, target_ulong arg1)

+{
+
+    int num = 1;
+
+    unsigned int tmp = env->tlb->nb_tlb;

void helper_mtc0_index(CPUMIPSState *env, target_ulong arg1)

{

    int num = 1;

    unsigned int tmp = env->tlb->nb_tlb;

    do {

        tmp >>= 1;

        num <<= 1;

    } while (tmp);

    env->CP0_Index = (env->CP0_Index & 0x80000000) | (arg1 & (num - 1));

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)
+
+{
+
+    const char *priority = x509 ? "NORMAL" : "NORMAL:+ANON-DH";
+
     int rc;
+

     rc = gnutls_priority_set_direct(s, priority, NULL);

static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)

{

    const char *priority = x509 ? "NORMAL" : "NORMAL:+ANON-DH";

    int rc;

    rc = gnutls_priority_set_direct(s, priority, NULL);

    if (rc != GNUTLS_E_SUCCESS) {

        return -1;

    }

    return 0;

}


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

     DisasContext *dc = container_of(dcbase, DisasContext, base);
+
     target_ulong pc_next = disas_insn(dc, cpu);

static void i386_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)

{

    DisasContext *dc = container_of(dcbase, DisasContext, base);

    target_ulong pc_next = disas_insn(dc, cpu);

    if (dc->tf || (dc->base.tb->flags & HF_INHIBIT_IRQ_MASK)) {

        /* if single step mode, we generate only one instruction and

           generate an exception */

        /* if irq were inhibited with HF_INHIBIT_IRQ_MASK, we clear

           the flag and abort the translation to give the irqs a

           chance to happen */

        dc->base.is_jmp = DISAS_TOO_MANY;

    } else if ((dc->base.tb->cflags & CF_USE_ICOUNT)

               && ((dc->base.pc_next & TARGET_PAGE_MASK)

                   != ((dc->base.pc_next + TARGET_MAX_INSN_SIZE - 1)

                       & TARGET_PAGE_MASK)

                   || (dc->base.pc_next & ~TARGET_PAGE_MASK) == 0)) {

        /* Do not cross the boundary of the pages in icount mode,

           it can cause an exception. Do it only when boundary is

           crossed by the first instruction in the block.

           If current instruction already crossed the bound - it's ok,

           because an exception hasn't stopped this code.

         */

        dc->base.is_jmp = DISAS_TOO_MANY;

    } else if ((pc_next - dc->base.pc_first) >= (TARGET_PAGE_SIZE - 32)) {

        dc->base.is_jmp = DISAS_TOO_MANY;

    }

    dc->base.pc_next = pc_next;

}


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

     /* Don't actually halt the CPU, just yield back to top
+
+     * level loop. This is not going into a "low power state"
+
+     * (ie halting until some event occurs), so we never take
+
      * a configurable trap to a different exception level.

      */

void HELPER(wfe)(CPUARMState *env)

{

    CPUState *cs = CPU(arm_env_get_cpu(env));

    /* Don't actually halt the CPU, just yield back to top

     * level loop. This is not going into a "low power state"

     * (ie halting until some event occurs), so we never take

     * a configurable trap to a different exception level.

     */

    cs->exception_index = EXCP_YIELD;

    cpu_loop_exit(cs);

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
     gen_flush_cc_op(s);

     if (op > 1) {
+
+        /* Bcc */
+
+        l1 = gen_new_label();
+
         gen_jmpcc(s, ((insn >> 8) & 0xf) ^ 1, l1);

         gen_jmp_tb(s, 1, base + offset);

DISAS_INSN(branch)

{

    int32_t offset;

    uint32_t base;

    int op;

    int l1;

    base = s->pc;

    op = (insn >> 8) & 0xf;

    offset = (int8_t)insn;

    if (offset == 0) {

        offset = cpu_ldsw_code(env, s->pc);

        s->pc += 2;

    } else if (offset == -1) {

        offset = read_im32(env, s);

    }

    if (op == 1) {

        /* bsr */

        gen_push(s, tcg_const_i32(s->pc));

    }

    gen_flush_cc_op(s);

    if (op > 1) {

        /* Bcc */

        l1 = gen_new_label();

        gen_jmpcc(s, ((insn >> 8) & 0xf) ^ 1, l1);

        gen_jmp_tb(s, 1, base + offset);

        gen_set_label(l1);

        gen_jmp_tb(s, 0, s->pc);

    } else {

        /* Unconditional branch.  */

        gen_jmp_tb(s, 0, base + offset);

    }

}


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

     if (!src->buf) {
+
+        ret = packet_alloc(&dst->buf, src->size);
+
+        if (ret < 0)
+
             goto fail;

         memcpy(dst->buf->data, src->data, src->size);

int av_packet_ref(AVPacket *dst, AVPacket *src)

{

    int ret;

    ret = av_packet_copy_props(dst, src);

    if (ret < 0)

        return ret;

    if (!src->buf) {

        ret = packet_alloc(&dst->buf, src->size);

        if (ret < 0)

            goto fail;

        memcpy(dst->buf->data, src->data, src->size);

    } else

        dst->buf = av_buffer_ref(src->buf);

    dst->size = src->size;

    dst->data = dst->buf->data;

    return 0;

fail:

    av_packet_free_side_data(dst);

    return ret;

}


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

     case 0x500:
+
+        /* KVM hypercall */
+
+        r = s390_virtio_hypercall(env);
+
         break;

     case 0x44:

uint64_t HELPER(diag)(CPUS390XState *env, uint32_t num, uint64_t mem,

                      uint64_t code)

{

    uint64_t r;

    switch (num) {

    case 0x500:

        /* KVM hypercall */

        r = s390_virtio_hypercall(env);

        break;

    case 0x44:

        /* yield */

        r = 0;

        break;

    case 0x308:

        /* ipl */

        r = 0;

        break;

    default:

        r = -1;

        break;

    }

    if (r) {

        program_interrupt(env, PGM_OPERATION, ILEN_LATER_INC);

    }

    return r;

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
             return OBJECT(iface);

         }
+
+    }
+
+
+
     /* Check if obj is an interface and its containing object is a direct

      * ancestor of typename */

Object *object_dynamic_cast(Object *obj, const char *typename)

{

    GSList *i;

    /* Check if typename is a direct ancestor */

    if (object_is_type(obj, typename)) {

        return obj;

    }

    /* Check if obj has an interface of typename */

    for (i = obj->interfaces; i; i = i->next) {

        Interface *iface = i->data;

        if (object_is_type(OBJECT(iface), typename)) {

            return OBJECT(iface);

        }

    }

    /* Check if obj is an interface and its containing object is a direct

     * ancestor of typename */

    if (object_is_type(obj, TYPE_INTERFACE)) {

        Interface *iface = INTERFACE(obj);

        if (object_is_type(iface->obj, typename)) {

            return iface->obj;

        }

    }

    return NULL;

}


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

         error_propagate(errp, local_err);

+        return NULL;
+
+    }
+
+

     qio_channel_set_delay(QIO_CHANNEL(sioc), false);

static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr_flat,

                                                  Error **errp)

{

    SocketAddressLegacy *saddr = socket_address_crumple(saddr_flat);

    QIOChannelSocket *sioc;

    Error *local_err = NULL;

    sioc = qio_channel_socket_new();

    qio_channel_set_name(QIO_CHANNEL(sioc), "nbd-client");

    qio_channel_socket_connect_sync(sioc,

                                    saddr,

                                    &local_err);

    qapi_free_SocketAddressLegacy(saddr);

    if (local_err) {

        object_unref(OBJECT(sioc));

        error_propagate(errp, local_err);

        return NULL;

    }

    qio_channel_set_delay(QIO_CHANNEL(sioc), false);

    return sioc;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void rbd_finish_aiocb(rbd_completion_t c, RADOSCB *rcb)
+
 {

+    int ret;
+
+    rcb->ret = rbd_aio_get_return_value(c);
+
     rbd_aio_release(c);

     ret = qemu_rbd_send_pipe(rcb->s, rcb);

static void rbd_finish_aiocb(rbd_completion_t c, RADOSCB *rcb)

{

    int ret;

    rcb->ret = rbd_aio_get_return_value(c);

    rbd_aio_release(c);

    ret = qemu_rbd_send_pipe(rcb->s, rcb);

    if (ret < 0) {

        error_report("failed writing to acb->s->fds");

        g_free(rcb);

    }

}


static void FUNC(transquant_bypass8x8)(uint8_t *_dst, int16_t *coeffs,

                                       ptrdiff_t stride)

{

    int x, y;

    pixel *dst = (pixel *)_dst;

    stride /= sizeof(pixel);

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

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

            dst[x] += *coeffs;

            coeffs++;

        }

        dst += stride;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 envlist_to_environ(const envlist_t *envlist, size_t *count)

 {
+
+	struct envlist_entry *entry;

 	char **env, **penv;
+

 	penv = env = malloc((envlist->el_count + 1) * sizeof (char *));

envlist_to_environ(const envlist_t *envlist, size_t *count)

{

	struct envlist_entry *entry;

	char **env, **penv;

	penv = env = malloc((envlist->el_count + 1) * sizeof (char *));

	if (env == NULL)

		return (NULL);

	for (entry = envlist->el_entries.lh_first; entry != NULL;

	    entry = entry->ev_link.le_next) {

		*(penv++) = strdup(entry->ev_var);

	}

	*penv = NULL; /* NULL terminate the list */

	if (count != NULL)

		*count = envlist->el_count;

	return (env);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)
+
+{

     int i, j, lag, max_corr = 0;

static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)

{

    int i, j, lag, max_corr = 0;

    float max_ratio;

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

        float corr, s0 = 0.0f, s1 = 0.0f;

        const int start = FFMAX(0, i - 1024);

        for (j = start; j < 2048; j++) {

            const int idx = j - i + 1024;

            s0 += new[j]*buf[idx];

            s1 += buf[idx]*buf[idx];

        }

        corr = s1 > 0.0f ? s0/sqrt(s1) : 0.0f;

        if (corr > max_corr) {

            max_corr = corr;

            lag = i;

            max_ratio = corr/(2048-start);

        }

    }

    ltp->lag = FFMAX(av_clip_uintp2(lag, 11), 0);

    ltp->coef_idx = quant_array_idx(max_ratio, ltp_coef, 8);

    ltp->coef = ltp_coef[ltp->coef_idx];

}


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

+    CPUMIPSState *other_cpu = first_cpu;
+
+    target_ulong prev = env->mvp->CP0_MVPControl;

+
+
     do {

         /* Turn off all VPEs except the one executing the dvpe.  */

target_ulong helper_dvpe(CPUMIPSState *env)

{

    CPUMIPSState *other_cpu = first_cpu;

    target_ulong prev = env->mvp->CP0_MVPControl;

    do {

        /* Turn off all VPEs except the one executing the dvpe.  */

        if (other_cpu != env) {

            other_cpu->mvp->CP0_MVPControl &= ~(1 << CP0MVPCo_EVP);

            mips_vpe_sleep(other_cpu);

        }

        other_cpu = other_cpu->next_cpu;

    } while (other_cpu);

    return prev;

}


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

     int y;
+
+
+
     for (y = 0; y != block_size; y++, pdest += pitch, psrc += pitch)

         memcpy(pdest, psrc, block_size * sizeof(pdest[0]));

static void copy_block(uint16_t *pdest, uint16_t *psrc, int block_size, int pitch)

{

    int y;

    for (y = 0; y != block_size; y++, pdest += pitch, psrc += pitch)

        memcpy(pdest, psrc, block_size * sizeof(pdest[0]));

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
              * to cancel dma with bmdma_cmd_writeb with BM_CMD_START not

              * set).
+
+             *
+
+             * In the future we'll be able to safely cancel the I/O if the
+
              * whole DMA operation will be submitted to disk with a single

              * aio operation with preadv/pwritev.

void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val)

{

#ifdef DEBUG_IDE

    printf("%s: 0x%08x\n", __func__, val);

#endif

    /* Ignore writes to SSBM if it keeps the old value */

    if ((val & BM_CMD_START) != (bm->cmd & BM_CMD_START)) {

        if (!(val & BM_CMD_START)) {

            /*

             * We can't cancel Scatter Gather DMA in the middle of the

             * operation or a partial (not full) DMA transfer would reach

             * the storage so we wait for completion instead (we beahve

             * like if the DMA was completed by the time the guest trying

             * to cancel dma with bmdma_cmd_writeb with BM_CMD_START not

             * set).

             *

             * In the future we'll be able to safely cancel the I/O if the

             * whole DMA operation will be submitted to disk with a single

             * aio operation with preadv/pwritev.

             */

            if (bm->bus->dma->aiocb) {

                qemu_aio_flush();

                assert(bm->bus->dma->aiocb == NULL);

                assert((bm->status & BM_STATUS_DMAING) == 0);

            }

        } else {

            bm->cur_addr = bm->addr;

            if (!(bm->status & BM_STATUS_DMAING)) {

                bm->status |= BM_STATUS_DMAING;

                /* start dma transfer if possible */

                if (bm->dma_cb)

                    bm->dma_cb(bmdma_active_if(bm), 0);

            }

        }

    }

    bm->cmd = val & 0x09;

}


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

     int l2_start_index = l2_index & ~(L1_ENTRIES_PER_SECTOR - 1);
+
     int start_offset = (8 * l2_index) & ~511;

     int end_offset = (8 * (l2_index + num) + 511) & ~511;

static int write_l2_entries(BlockDriverState *bs, uint64_t *l2_table,

    uint64_t l2_offset, int l2_index, int num)

{

    int l2_start_index = l2_index & ~(L1_ENTRIES_PER_SECTOR - 1);

    int start_offset = (8 * l2_index) & ~511;

    int end_offset = (8 * (l2_index + num) + 511) & ~511;

    size_t len = end_offset - start_offset;

    int ret;

    BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE);

    ret = bdrv_pwrite(bs->file, l2_offset + start_offset,

        &l2_table[l2_start_index], len);

    if (ret < 0) {

        return ret;

    }

    return 0;

}


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

     fdctrl->state &= ~FD_CTRL_SLEEP;

+    if (FD_STATE(fdctrl->data_state) == FD_STATE_CMD) {

         FLOPPY_ERROR("can't read data in CMD state\n");

static uint32_t fdctrl_read_data (fdctrl_t *fdctrl)

{

    fdrive_t *cur_drv;

    uint32_t retval = 0;

    int pos, len;

    cur_drv = get_cur_drv(fdctrl);

    fdctrl->state &= ~FD_CTRL_SLEEP;

    if (FD_STATE(fdctrl->data_state) == FD_STATE_CMD) {

        FLOPPY_ERROR("can't read data in CMD state\n");

        return 0;

    }

    pos = fdctrl->data_pos;

    if (FD_STATE(fdctrl->data_state) == FD_STATE_DATA) {

        pos %= FD_SECTOR_LEN;

        if (pos == 0) {

            len = fdctrl->data_len - fdctrl->data_pos;

            if (len > FD_SECTOR_LEN)

                len = FD_SECTOR_LEN;

            bdrv_read(cur_drv->bs, fd_sector(cur_drv),

                      fdctrl->fifo, len);

        }

    }

    retval = fdctrl->fifo[pos];

    if (++fdctrl->data_pos == fdctrl->data_len) {

        fdctrl->data_pos = 0;

        /* Switch from transfer mode to status mode

         * then from status mode to command mode

         */

        if (FD_STATE(fdctrl->data_state) == FD_STATE_DATA) {

            fdctrl_stop_transfer(fdctrl, 0x20, 0x00, 0x00);

        } else {

            fdctrl_reset_fifo(fdctrl);

            fdctrl_reset_irq(fdctrl);

        }

    }

    FLOPPY_DPRINTF("data register: 0x%02x\n", retval);

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void parser_context_free(JSONParserContext *ctxt)
+
+{
+
+    if (ctxt) {
+
         while (!g_queue_is_empty(ctxt->buf)) {

             parser_context_pop_token(ctxt);

static void parser_context_free(JSONParserContext *ctxt)

{

    if (ctxt) {

        while (!g_queue_is_empty(ctxt->buf)) {

            parser_context_pop_token(ctxt);

        }

        qobject_decref(ctxt->current);

        g_queue_free(ctxt->buf);

        g_free(ctxt);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+static gint range_compare(gconstpointer a, gconstpointer b)
+
+{
+
+    Range *ra = (Range *)a, *rb = (Range *)b;
+
     if (ra->begin == rb->begin && ra->end == rb->end) {

         return 0;

static gint range_compare(gconstpointer a, gconstpointer b)

{

    Range *ra = (Range *)a, *rb = (Range *)b;

    if (ra->begin == rb->begin && ra->end == rb->end) {

        return 0;

    } else if (range_get_last(ra->begin, ra->end) <

               range_get_last(rb->begin, rb->end)) {

        return -1;

    } else {

        return 1;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)

+{

     DisasContext *dc = container_of(dcbase, DisasContext, base);

static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)

{

    DisasContext *dc = container_of(dcbase, DisasContext, base);

    dc->insn_start_idx = tcg_op_buf_count();

    tcg_gen_insn_start(dc->pc, 0, 0);

}


--- a/source.c
+++ b/source.c
@@ -13,8 +13,8 @@
     r3d->video_offsets_count = (atom->size - 8) / 4;

     r3d->video_offsets = av_malloc(atom->size);
+
+    if (!r3d->video_offsets)

         return AVERROR(ENOMEM);

static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)

{

    R3DContext *r3d = s->priv_data;

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

    int i;

    r3d->video_offsets_count = (atom->size - 8) / 4;

    r3d->video_offsets = av_malloc(atom->size);

    if (!r3d->video_offsets)

        return AVERROR(ENOMEM);

    for (i = 0; i < r3d->video_offsets_count; i++) {

        r3d->video_offsets[i] = avio_rb32(s->pb);

        if (!r3d->video_offsets[i]) {

            r3d->video_offsets_count = i;

            break;

        }

        av_dlog(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]);

    }

    if (st->r_frame_rate.num)

        st->duration = av_rescale_q(r3d->video_offsets_count,

                                    (AVRational){st->r_frame_rate.den,

                                                 st->r_frame_rate.num},

                                    st->time_base);

    av_dlog(s, "duration %"PRId64"\n", st->duration);

    return 0;

}


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

     MIPSCPU *cpu = mips_env_get_cpu(env);
+
     uint32_t val, old;

+    uint32_t mask = env->CP0_Status_rw_bitmask;

void helper_mtc0_status(CPUMIPSState *env, target_ulong arg1)

{

    MIPSCPU *cpu = mips_env_get_cpu(env);

    uint32_t val, old;

    uint32_t mask = env->CP0_Status_rw_bitmask;

    if (env->insn_flags & ISA_MIPS32R6) {

        if (extract32(env->CP0_Status, CP0St_KSU, 2) == 0x3) {

            mask &= ~(3 << CP0St_KSU);

        }

        mask &= ~(0x00180000 & arg1);

    }

    val = arg1 & mask;

    old = env->CP0_Status;

    env->CP0_Status = (env->CP0_Status & ~mask) | val;

    if (env->CP0_Config3 & (1 << CP0C3_MT)) {

        sync_c0_status(env, env, env->current_tc);

    } else {

        compute_hflags(env);

    }

    if (qemu_loglevel_mask(CPU_LOG_EXEC)) {

        qemu_log("Status %08x (%08x) => %08x (%08x) Cause %08x",

                old, old & env->CP0_Cause & CP0Ca_IP_mask,

                val, val & env->CP0_Cause & CP0Ca_IP_mask,

                env->CP0_Cause);

        switch (env->hflags & MIPS_HFLAG_KSU) {

        case MIPS_HFLAG_UM: qemu_log(", UM\n"); break;

        case MIPS_HFLAG_SM: qemu_log(", SM\n"); break;

        case MIPS_HFLAG_KM: qemu_log("\n"); break;

        default:

            cpu_abort(CPU(cpu), "Invalid MMU mode!\n");

            break;

        }

    }

}


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

     }
+
     avio_wl24(pb, 0); //frames count will be here

     avio_w8(pb, 0xC5);

static int vc1test_write_header(AVFormatContext *s)

{

    AVCodecContext *avc = s->streams[0]->codec;

    AVIOContext *pb = s->pb;

    if (avc->codec_id != CODEC_ID_WMV3) {

        av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n");

        return -1;

    }

    avio_wl24(pb, 0); //frames count will be here

    avio_w8(pb, 0xC5);

    avio_wl32(pb, 4);

    avio_write(pb, avc->extradata, 4);

    avio_wl32(pb, avc->height);

    avio_wl32(pb, avc->width);

    avio_wl32(pb, 0xC);

    avio_wl24(pb, 0); // hrd_buffer

    avio_w8(pb, 0x80); // level|cbr|res1

    avio_wl32(pb, 0); // hrd_rate

    if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1)

        avio_wl32(pb, s->streams[0]->r_frame_rate.den);

    else

        avio_wl32(pb, 0xFFFFFFFF); //variable framerate

    avpriv_set_pts_info(s->streams[0], 32, 1, 1000);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -14,11 +14,11 @@
 #endif
     env->hflags2 |= HF2_GIF_MASK;
     cpu_x86_update_cr0(env, 0x60000010);
+    env->a20_mask = ~0x0;
+    env->smbase = 0x30000;
+    env->idt.limit = 0xffff;
+    env->gdt.limit = 0xffff;
+    env->ldt.limit = 0xffff;
     env->ldt.flags = DESC_P_MASK | (2 << DESC_TYPE_SHIFT);
     env->tr.limit = 0xffff;
     env->tr.flags = DESC_P_MASK | (11 << DESC_TYPE_SHIFT);

static void x86_cpu_reset(CPUState *s)
{
    X86CPU *cpu = X86_CPU(s);
    X86CPUClass *xcc = X86_CPU_GET_CLASS(cpu);
    CPUX86State *env = &cpu->env;
    int i;
    xcc->parent_reset(s);
    memset(env, 0, offsetof(CPUX86State, breakpoints));
    tlb_flush(env, 1);
    env->old_exception = -1;
    /* init to reset state */
#ifdef CONFIG_SOFTMMU
    env->hflags |= HF_SOFTMMU_MASK;
#endif
    env->hflags2 |= HF2_GIF_MASK;
    cpu_x86_update_cr0(env, 0x60000010);
    env->a20_mask = ~0x0;
    env->smbase = 0x30000;
    env->idt.limit = 0xffff;
    env->gdt.limit = 0xffff;
    env->ldt.limit = 0xffff;
    env->ldt.flags = DESC_P_MASK | (2 << DESC_TYPE_SHIFT);
    env->tr.limit = 0xffff;
    env->tr.flags = DESC_P_MASK | (11 << DESC_TYPE_SHIFT);
    cpu_x86_load_seg_cache(env, R_CS, 0xf000, 0xffff0000, 0xffff,
                           DESC_P_MASK | DESC_S_MASK | DESC_CS_MASK |
                           DESC_R_MASK | DESC_A_MASK);
    cpu_x86_load_seg_cache(env, R_DS, 0, 0, 0xffff,
                           DESC_P_MASK | DESC_S_MASK | DESC_W_MASK |
                           DESC_A_MASK);
    cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0xffff,
                           DESC_P_MASK | DESC_S_MASK | DESC_W_MASK |
                           DESC_A_MASK);
    cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffff,
                           DESC_P_MASK | DESC_S_MASK | DESC_W_MASK |
                           DESC_A_MASK);
    cpu_x86_load_seg_cache(env, R_FS, 0, 0, 0xffff,
                           DESC_P_MASK | DESC_S_MASK | DESC_W_MASK |
                           DESC_A_MASK);
    cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0xffff,
                           DESC_P_MASK | DESC_S_MASK | DESC_W_MASK |
                           DESC_A_MASK);
    env->eip = 0xfff0;
    env->regs[R_EDX] = env->cpuid_version;
    env->eflags = 0x2;
    /* FPU init */
    for (i = 0; i < 8; i++) {
        env->fptags[i] = 1;
    }
    env->fpuc = 0x37f;
    env->mxcsr = 0x1f80;
    env->xstate_bv = XSTATE_FP | XSTATE_SSE;
    env->pat = 0x0007040600070406ULL;
    env->msr_ia32_misc_enable = MSR_IA32_MISC_ENABLE_DEFAULT;
    memset(env->dr, 0, sizeof(env->dr));
    env->dr[6] = DR6_FIXED_1;
    env->dr[7] = DR7_FIXED_1;
    cpu_breakpoint_remove_all(env, BP_CPU);
    cpu_watchpoint_remove_all(env, BP_CPU);
#if !defined(CONFIG_USER_ONLY)
    /* We hard-wire the BSP to the first CPU. */
    if (s->cpu_index == 0) {
        apic_designate_bsp(env->apic_state);
    }
    s->halted = !cpu_is_bsp(cpu);
#endif
}


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

 {

+    if (asce & _SEGMENT_ENTRY_INV) {
+
+        DPRINTF("%s: SEG=0x%" PRIx64 " invalid\n", __func__, asce);
+
+        trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw);

         return -1;

static int mmu_translate_sfaa(CPUS390XState *env, target_ulong vaddr,

                              uint64_t asc, uint64_t asce, target_ulong *raddr,

                              int *flags, int rw)

{

    if (asce & _SEGMENT_ENTRY_INV) {

        DPRINTF("%s: SEG=0x%" PRIx64 " invalid\n", __func__, asce);

        trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw);

        return -1;

    }

    if (asce & _SEGMENT_ENTRY_RO) {

        *flags &= ~PAGE_WRITE;

    }

    *raddr = (asce & 0xfffffffffff00000ULL) | (vaddr & 0xfffff);

    PTE_DPRINTF("%s: SEG=0x%" PRIx64 "\n", __func__, asce);

    return 0;

}