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

 {

+    char *buf;
+
+    int i,len;
+
+

     bus->info = info;

void qbus_create_inplace(BusState *bus, BusInfo *info,

                         DeviceState *parent, const char *name)

{

    char *buf;

    int i,len;

    bus->info = info;

    bus->parent = parent;

    if (name) {

        /* use supplied name */

        bus->name = qemu_strdup(name);

    } else if (parent && parent->id) {

        /* parent device has id -> use it for bus name */

        len = strlen(parent->id) + 16;

        buf = qemu_malloc(len);

        snprintf(buf, len, "%s.%d", parent->id, parent->num_child_bus);

        bus->name = buf;

    } else {

        /* no id -> use lowercase bus type for bus name */

        len = strlen(info->name) + 16;

        buf = qemu_malloc(len);

        len = snprintf(buf, len, "%s.%d", info->name,

                       parent ? parent->num_child_bus : 0);

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

            buf[i] = qemu_tolower(buf[i]);

        bus->name = buf;

    }

    QLIST_INIT(&bus->children);

    if (parent) {

        QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling);

        parent->num_child_bus++;

    }

}


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

+{
+
     HostMemoryBackend *backend = MEMORY_BACKEND(obj);

static void host_memory_backend_init(Object *obj)

{

    HostMemoryBackend *backend = MEMORY_BACKEND(obj);

    backend->merge = qemu_opt_get_bool(qemu_get_machine_opts(),

                                       "mem-merge", true);

    backend->dump = qemu_opt_get_bool(qemu_get_machine_opts(),

                                      "dump-guest-core", true);

    backend->prealloc = mem_prealloc;

    object_property_add_bool(obj, "merge",

                        host_memory_backend_get_merge,

                        host_memory_backend_set_merge, NULL);

    object_property_add_bool(obj, "dump",

                        host_memory_backend_get_dump,

                        host_memory_backend_set_dump, NULL);

    object_property_add_bool(obj, "prealloc",

                        host_memory_backend_get_prealloc,

                        host_memory_backend_set_prealloc, NULL);

    object_property_add(obj, "size", "int",

                        host_memory_backend_get_size,

                        host_memory_backend_set_size, NULL, NULL, NULL);

    object_property_add(obj, "host-nodes", "int",

                        host_memory_backend_get_host_nodes,

                        host_memory_backend_set_host_nodes, NULL, NULL, NULL);

    object_property_add_enum(obj, "policy", "HostMemPolicy",

                             HostMemPolicy_lookup,

                             host_memory_backend_get_policy,

                             host_memory_backend_set_policy, NULL);

}


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

     /* Copy RTAS over */
+
+    cpu_physical_memory_write(spapr->rtas_addr, spapr->rtas_blob,
+
+                              spapr->rtas_size);
+

     /* Set up the entry state */

static void ppc_spapr_reset(void)

{

    sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());

    PowerPCCPU *first_ppc_cpu;

    uint32_t rtas_limit;

    /* Check for unknown sysbus devices */

    foreach_dynamic_sysbus_device(find_unknown_sysbus_device, NULL);

    /* Reset the hash table & recalc the RMA */

    spapr_reset_htab(spapr);

    qemu_devices_reset();

    /*

     * We place the device tree and RTAS just below either the top of the RMA,

     * or just below 2GB, whichever is lowere, so that it can be

     * processed with 32-bit real mode code if necessary

     */

    rtas_limit = MIN(spapr->rma_size, RTAS_MAX_ADDR);

    spapr->rtas_addr = rtas_limit - RTAS_MAX_SIZE;

    spapr->fdt_addr = spapr->rtas_addr - FDT_MAX_SIZE;

    /* Load the fdt */

    spapr_finalize_fdt(spapr, spapr->fdt_addr, spapr->rtas_addr,

                       spapr->rtas_size);

    /* Copy RTAS over */

    cpu_physical_memory_write(spapr->rtas_addr, spapr->rtas_blob,

                              spapr->rtas_size);

    /* Set up the entry state */

    first_ppc_cpu = POWERPC_CPU(first_cpu);

    first_ppc_cpu->env.gpr[3] = spapr->fdt_addr;

    first_ppc_cpu->env.gpr[5] = 0;

    first_cpu->halted = 0;

    first_ppc_cpu->env.nip = spapr->entry_point;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     if ((s->attributes & ATTR_BLINK))

         bg += 8;
+
+    if ((s->attributes & ATTR_REVERSE))
+
+        FFSWAP(int, fg, bg);
+
     if ((s->attributes & ATTR_CONCEALED))

         fg = bg;

static void draw_char(AVCodecContext *avctx, int c)

{

    AnsiContext *s = avctx->priv_data;

    int fg = s->fg;

    int bg = s->bg;

    if ((s->attributes & ATTR_BOLD))

        fg += 8;

    if ((s->attributes & ATTR_BLINK))

        bg += 8;

    if ((s->attributes & ATTR_REVERSE))

        FFSWAP(int, fg, bg);

    if ((s->attributes & ATTR_CONCEALED))

        fg = bg;

    ff_draw_pc_font(s->frame->data[0] + s->y * s->frame->linesize[0] + s->x,

                    s->frame->linesize[0], s->font, s->font_height, c, fg, bg);

    s->x += FONT_WIDTH;

    if (s->x >= avctx->width) {

        s->x = 0;

        hscroll(avctx);

    }

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
                                       Object *val, Error **errp)

 {
+
+    if (cryptodev_backend_is_used(CRYPTODEV_BACKEND(val))) {
+
+        char *path = object_get_canonical_path_component(val);
+
         error_setg(errp,

             "can't use already used cryptodev backend: %s", path);

virtio_crypto_check_cryptodev_is_used(const Object *obj, const char *name,

                                      Object *val, Error **errp)

{

    if (cryptodev_backend_is_used(CRYPTODEV_BACKEND(val))) {

        char *path = object_get_canonical_path_component(val);

        error_setg(errp,

            "can't use already used cryptodev backend: %s", path);

        g_free(path);

    } else {

        qdev_prop_allow_set_link_before_realize(obj, name, val, errp);

    }

}


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

     s->lfe_fir[0] = dca_lfe_fir0_c;
+
+    s->lfe_fir[1] = dca_lfe_fir1_c;
+
+    s->qmf_32_subbands = dca_qmf_32_subbands;

     s->int8x8_fmul_int32 = int8x8_fmul_int32_c;

av_cold void ff_dcadsp_init(DCADSPContext *s)

{

    s->lfe_fir[0] = dca_lfe_fir0_c;

    s->lfe_fir[1] = dca_lfe_fir1_c;

    s->qmf_32_subbands = dca_qmf_32_subbands;

    s->int8x8_fmul_int32 = int8x8_fmul_int32_c;

    if (ARCH_ARM) ff_dcadsp_init_arm(s);

    if (ARCH_X86) ff_dcadsp_init_x86(s);

}


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

       return 0;

+
+
+    return num / den;

 }

int32_t HELPER(sdiv)(int32_t num, int32_t den)

{

    if (den == 0)

      return 0;

    return num / den;

}


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

+    opts = drive_add(type, index, NULL, optstr);
+
+    if (snapshot) {
+
+        drive_enable_snapshot(opts, NULL);

     }

static void default_drive(int enable, int snapshot, BlockInterfaceType type,

                          int index, const char *optstr)

{

    QemuOpts *opts;

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

        return;

    }

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

    if (snapshot) {

        drive_enable_snapshot(opts, NULL);

    }

    if (!drive_new(opts, type)) {

        exit(1);

    }

}


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

                                   int flags, int y)

+{
+
+    const uint16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
+
+

     if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster

static void RENAME(yuv2yuyv422_1)(SwsContext *c, const uint16_t *buf0,

                                  const uint16_t *ubuf0, const uint16_t *ubuf1,

                                  const uint16_t *vbuf0, const uint16_t *vbuf1,

                                  const uint16_t *abuf0, uint8_t *dest,

                                  int dstW, int uvalpha, enum PixelFormat dstFormat,

                                  int flags, int y)

{

    const uint16_t *buf1= buf0; //FIXME needed for RGB1/BGR1

    if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster

        __asm__ volatile(

            "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"

            "mov        %4, %%"REG_b"               \n\t"

            "push %%"REG_BP"                        \n\t"

            YSCALEYUV2PACKED1(%%REGBP, %5)

            WRITEYUY2(%%REGb, 8280(%5), %%REGBP)

            "pop %%"REG_BP"                         \n\t"

            "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"

            :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),

               "a" (&c->redDither)

        );

    } else {

        __asm__ volatile(

            "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"

            "mov        %4, %%"REG_b"               \n\t"

            "push %%"REG_BP"                        \n\t"

            YSCALEYUV2PACKED1b(%%REGBP, %5)

            WRITEYUY2(%%REGb, 8280(%5), %%REGBP)

            "pop %%"REG_BP"                         \n\t"

            "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"

            :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),

               "a" (&c->redDither)

        );

    }

}


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

     if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {

+        goto badframe;

     }

long do_rt_sigreturn(CPUMIPSState *env)

{

    struct target_rt_sigframe *frame;

    abi_ulong frame_addr;

    sigset_t blocked;

    frame_addr = env->active_tc.gpr[29];

    trace_user_do_rt_sigreturn(env, frame_addr);

    if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {

        goto badframe;

    }

    target_to_host_sigset(&blocked, &frame->rs_uc.tuc_sigmask);

    set_sigmask(&blocked);

    restore_sigcontext(env, &frame->rs_uc.tuc_mcontext);

    if (do_sigaltstack(frame_addr +

                       offsetof(struct target_rt_sigframe, rs_uc.tuc_stack),

                       0, get_sp_from_cpustate(env)) == -EFAULT)

        goto badframe;

    env->active_tc.PC = env->CP0_EPC;

    mips_set_hflags_isa_mode_from_pc(env);

    /* I am not sure this is right, but it seems to work

    * maybe a problem with nested signals ? */

    env->CP0_EPC = 0;

    return -TARGET_QEMU_ESIGRETURN;

badframe:

    force_sig(TARGET_SIGSEGV/*, current*/);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)

 {
+
     uint16_t i;

static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)

{

    uint16_t i;

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

        Aml *dev = aml_device("C%03x", i);

        aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));

        aml_append(dev, aml_name_decl("_UID", aml_int(i)));

        aml_append(scope, dev);

    }

}


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

 {

+    QObject *arg;

+    QDict *qdict;

static void test_visitor_out_union_flat(TestOutputVisitorData *data,

                                        const void *unused)

{

    QObject *arg;

    QDict *qdict;

    UserDefFlatUnion *tmp = g_malloc0(sizeof(UserDefFlatUnion));

    tmp->enum1 = ENUM_ONE_VALUE1;

    tmp->string = g_strdup("str");

    tmp->u.value1 = g_malloc0(sizeof(UserDefA));

    tmp->integer = 41;

    tmp->u.value1->boolean = true;

    visit_type_UserDefFlatUnion(data->ov, NULL, &tmp, &error_abort);

    arg = qmp_output_get_qobject(data->qov);

    g_assert(qobject_type(arg) == QTYPE_QDICT);

    qdict = qobject_to_qdict(arg);

    g_assert_cmpstr(qdict_get_str(qdict, "enum1"), ==, "value1");

    g_assert_cmpstr(qdict_get_str(qdict, "string"), ==, "str");

    g_assert_cmpint(qdict_get_int(qdict, "integer"), ==, 41);

    g_assert_cmpint(qdict_get_bool(qdict, "boolean"), ==, true);

    qapi_free_UserDefFlatUnion(tmp);

    QDECREF(qdict);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void aio_co_schedule(AioContext *ctx, Coroutine *co)
 {
+    trace_aio_co_schedule(ctx, co);
     QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines,
                               co, co_scheduled_next);
     qemu_bh_schedule(ctx->co_schedule_bh);

void aio_co_schedule(AioContext *ctx, Coroutine *co)
{
    trace_aio_co_schedule(ctx, co);
    QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines,
                              co, co_scheduled_next);
    qemu_bh_schedule(ctx->co_schedule_bh);


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     OCVContext *ocv = ctx->priv;

     DilateContext *dilate = ocv->priv;
+
     char default_kernel_str[] = "3x3+0x0/rect";
+
     char *kernel_str;
+
     const char *buf = args;

     int ret;

static av_cold int dilate_init(AVFilterContext *ctx, const char *args)

{

    OCVContext *ocv = ctx->priv;

    DilateContext *dilate = ocv->priv;

    char default_kernel_str[] = "3x3+0x0/rect";

    char *kernel_str;

    const char *buf = args;

    int ret;

    dilate->nb_iterations = 1;

    if (args)

        kernel_str = av_get_token(&buf, "|");

    if ((ret = parse_iplconvkernel(&dilate->kernel,

                                   *kernel_str ? kernel_str : default_kernel_str,

                                   ctx)) < 0)

        return ret;

    av_free(kernel_str);

    sscanf(buf, "|%d", &dilate->nb_iterations);

    av_log(ctx, AV_LOG_VERBOSE, "iterations_nb:%d\n", dilate->nb_iterations);

    if (dilate->nb_iterations <= 0) {

        av_log(ctx, AV_LOG_ERROR, "Invalid non-positive value '%d' for nb_iterations\n",

               dilate->nb_iterations);

        return AVERROR(EINVAL);

    }

    return 0;

}


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

     /* movsbl */
+
+    assert(src < 4 || TCG_TARGET_REG_BITS == 64);

     tcg_out_modrm(s, OPC_MOVSBL + P_REXB_RM + rexw, dest, src);

static void tcg_out_ext8s(TCGContext *s, int dest, int src, int rexw)

{

    /* movsbl */

    assert(src < 4 || TCG_TARGET_REG_BITS == 64);

    tcg_out_modrm(s, OPC_MOVSBL + P_REXB_RM + rexw, dest, src);

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     uint64_t total_sectors;

+
+    if (nb_sectors > INT_MAX) {
+
+        return false;
+
     }

     if (sector & dev->sector_mask) {

static bool virtio_blk_sect_range_ok(VirtIOBlock *dev,

                                     uint64_t sector, size_t size)

{

    uint64_t nb_sectors = size >> BDRV_SECTOR_BITS;

    uint64_t total_sectors;

    if (nb_sectors > INT_MAX) {

        return false;

    }

    if (sector & dev->sector_mask) {

        return false;

    }

    if (size % dev->conf.conf.logical_block_size) {

        return false;

    }

    blk_get_geometry(dev->blk, &total_sectors);

    if (sector > total_sectors || nb_sectors > total_sectors - sector) {

        return false;

    }

    return true;

}


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

             avpriv_mpegaudio_decode_header(&mh, header))

+            break;
+
+        out_pos[i] = off;
+
+    }

static int check(AVIOContext *pb, int64_t pos, int64_t *out_pos)

{

    MPADecodeHeader mh = { 0 };

    int i;

    uint32_t header;

    int64_t off = 0;

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

        off = avio_seek(pb, pos + mh.frame_size, SEEK_SET);

        if (off < 0)

            break;

        header = avio_rb32(pb);

        if (ff_mpa_check_header(header) < 0 ||

            avpriv_mpegaudio_decode_header(&mh, header))

            break;

        out_pos[i] = off;

    }

    return i;

}


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

     NvmeCQueue *cq;
+

     sq->ctrl = n;

static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,

    uint16_t sqid, uint16_t cqid, uint16_t size)

{

    int i;

    NvmeCQueue *cq;

    sq->ctrl = n;

    sq->dma_addr = dma_addr;

    sq->sqid = sqid;

    sq->size = size;

    sq->cqid = cqid;

    sq->head = sq->tail = 0;

    sq->io_req = g_malloc(sq->size * sizeof(*sq->io_req));

    QTAILQ_INIT(&sq->req_list);

    QTAILQ_INIT(&sq->out_req_list);

    for (i = 0; i < sq->size; i++) {

        sq->io_req[i].sq = sq;

        QTAILQ_INSERT_TAIL(&(sq->req_list), &sq->io_req[i], entry);

    }

    sq->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_process_sq, sq);

    assert(n->cq[cqid]);

    cq = n->cq[cqid];

    QTAILQ_INSERT_TAIL(&(cq->sq_list), sq, entry);

    n->sq[sqid] = sq;

}


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

     switch (o->type) {
+
+    case AV_OPT_TYPE_FLAGS:
+
+    case AV_OPT_TYPE_INT:   *(int       *)dst= llrint(num/den)*intnum; break;
+
     case AV_OPT_TYPE_INT64: *(int64_t   *)dst= llrint(num/den)*intnum; break;

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

static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)

{

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

        av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range\n",

               num*intnum/den, o->name);

        return AVERROR(ERANGE);

    }

    switch (o->type) {

    case AV_OPT_TYPE_FLAGS:

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

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

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

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

    case AV_OPT_TYPE_RATIONAL:

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

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

        break;

    default:

        return AVERROR(EINVAL);

    }

    return 0;

}


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

         s->qdev.unit_attention = SENSE_CODE(MEDIUM_CHANGED);

+    }
+
+}

static void scsi_disk_unit_attention_reported(SCSIDevice *dev)

{

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

    if (s->media_changed) {

        s->media_changed = false;

        s->qdev.unit_attention = SENSE_CODE(MEDIUM_CHANGED);

    }

}


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

     VirtIOBalloon *s = opaque;

+
+
+    if (version_id != 1)
+
         return -EINVAL;

static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)

{

    VirtIOBalloon *s = opaque;

    if (version_id != 1)

        return -EINVAL;

    virtio_load(&s->vdev, f);

    s->num_pages = qemu_get_be32(f);

    s->actual = qemu_get_be32(f);

    qemu_get_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement));

    qemu_get_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t));

    qemu_get_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion));

    qemu_get_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void));

    return 0;

}


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

         bus->parent->num_child_bus--;

+    }
+
+
+    if (bus->qdev_allocated) {
+
         qemu_free(bus);

     }

void qbus_free(BusState *bus)

{

    DeviceState *dev;

    while ((dev = QLIST_FIRST(&bus->children)) != NULL) {

        qdev_free(dev);

    }

    if (bus->parent) {

        QLIST_REMOVE(bus, sibling);

        bus->parent->num_child_bus--;

    }

    if (bus->qdev_allocated) {

        qemu_free(bus);

    }

}


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

     BlockDriverState *bs = blk_bs(blk);

+    char *id;
+
+

     /* blk_eject is only called by qdevified devices */

void blk_eject(BlockBackend *blk, bool eject_flag)

{

    BlockDriverState *bs = blk_bs(blk);

    char *id;

    /* blk_eject is only called by qdevified devices */

    assert(!blk->legacy_dev);

    if (bs) {

        bdrv_eject(bs, eject_flag);

        id = blk_get_attached_dev_id(blk);

        qapi_event_send_device_tray_moved(blk_name(blk), id,

                                          eject_flag, &error_abort);

        g_free(id);

    }

}


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

{

#ifdef HAVE_MMXFIXME

#else

	int i;

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

	{

		dstU[i]= (src1[4*i + 1] + src2[4*i + 1])>>1;

		dstV[i]= (src1[4*i + 3] + src2[4*i + 3])>>1;

	}

#endif

}


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

                    av_pix_fmt_descriptors[st->codec->pix_fmt].name,

+                   codec->name,
+
+                   av_pix_fmt_descriptors[codec->pix_fmts[0]].name);
+
+            st->codec->pix_fmt = codec->pix_fmts[0];

         }

static void choose_pixel_fmt(AVStream *st, AVCodec *codec)

{

    if(codec && codec->pix_fmts){

        const enum PixelFormat *p= codec->pix_fmts;

        if(st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL){

            if(st->codec->codec_id==CODEC_ID_MJPEG){

                p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE};

            }else if(st->codec->codec_id==CODEC_ID_LJPEG){

                p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE};

            }

        }

        for(; *p!=-1; p++){

            if(*p == st->codec->pix_fmt)

                break;

        }

        if (*p == -1) {

            av_log(NULL, AV_LOG_WARNING,

                   "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n",

                   av_pix_fmt_descriptors[st->codec->pix_fmt].name,

                   codec->name,

                   av_pix_fmt_descriptors[codec->pix_fmts[0]].name);

            st->codec->pix_fmt = codec->pix_fmts[0];

        }

    }

}


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

         GIC_SET_TRIGGER(i);

+    }
+
+#ifdef NVIC
+
+    /* The NVIC is always enabled.  */

     s->enabled = 1;

static void gic_reset(gic_state *s)

{

    int i;

    memset(s->irq_state, 0, GIC_NIRQ * sizeof(gic_irq_state));

    for (i = 0 ; i < NUM_CPU(s); i++) {

        s->priority_mask[i] = 0xf0;

        s->current_pending[i] = 1023;

        s->running_irq[i] = 1023;

        s->running_priority[i] = 0x100;

#ifdef NVIC

        /* The NVIC doesn't have per-cpu interfaces, so enable by default.  */

        s->cpu_enabled[i] = 1;

#else

        s->cpu_enabled[i] = 0;

#endif

    }

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

        GIC_SET_ENABLED(i);

        GIC_SET_TRIGGER(i);

    }

#ifdef NVIC

    /* The NVIC is always enabled.  */

    s->enabled = 1;

#else

    s->enabled = 0;

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op,
+
+                           TCGOpcode opc, int nargs)
+
+{
+
+    int oi = s->gen_next_op_idx;
+
+    int prev = old_op - s->gen_op_buf;
+
+    int next = old_op->next;
+
     TCGOp *new_op;

TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op,

                           TCGOpcode opc, int nargs)

{

    int oi = s->gen_next_op_idx;

    int prev = old_op - s->gen_op_buf;

    int next = old_op->next;

    TCGOp *new_op;

    tcg_debug_assert(oi < OPC_BUF_SIZE);

    s->gen_next_op_idx = oi + 1;

    new_op = &s->gen_op_buf[oi];

    *new_op = (TCGOp){

        .opc = opc,

        .prev = prev,

        .next = next

    };

    s->gen_op_buf[next].prev = oi;

    old_op->next = oi;

    return new_op;

}


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

     d.args = NULL;
+
     d.noreboot = true;

+    test_init(&d);
+

     stop_tco(&d);

static void test_tco2_status_bits(void)

{

    TestData d;

    uint16_t ticks = 8;

    uint16_t val;

    int ret;

    d.args = NULL;

    d.noreboot = true;

    test_init(&d);

    stop_tco(&d);

    clear_tco_status(&d);

    reset_on_second_timeout(true);

    set_tco_timeout(&d, ticks);

    load_tco(&d);

    start_tco(&d);

    clock_step(ticks * TCO_TICK_NSEC * 2);

    val = qpci_io_readw(d.dev, d.tco_io_base + TCO2_STS);

    ret = val & (TCO_SECOND_TO_STS | TCO_BOOT_STS) ? 1 : 0;

    g_assert(ret == 1);

    qpci_io_writew(d.dev, d.tco_io_base + TCO2_STS, val);

    g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_base + TCO2_STS), ==, 0);

    qtest_end();

}


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

{

    unsigned v = le ? AV_RL16(*p) : AV_RB16(*p);

    *p += 2;

    return v;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int ogg_new_buf(struct ogg *ogg, int idx)

+{

     struct ogg_stream *os = ogg->streams + idx;

static int ogg_new_buf(struct ogg *ogg, int idx)

{

    struct ogg_stream *os = ogg->streams + idx;

    uint8_t *nb = av_malloc(os->bufsize);

    int size = os->bufpos - os->pstart;

    if(os->buf){

        memcpy(nb, os->buf + os->pstart, size);

        av_free(os->buf);

    }

    os->buf = nb;

    os->bufpos = size;

    os->pstart = 0;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int lvf_probe(AVProbeData *p)
+
+{

     if (AV_RL32(p->buf) == MKTAG('L', 'V', 'F', 'F'))

static int lvf_probe(AVProbeData *p)

{

    if (AV_RL32(p->buf) == MKTAG('L', 'V', 'F', 'F'))

        return AVPROBE_SCORE_EXTENSION;

    return 0;

}


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

                         unsigned int pallen)
+
 {

     unsigned int i;

static void pcx_palette(const uint8_t **src, uint32_t *dst,

                        unsigned int pallen)

{

    unsigned int i;

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

        *dst++ = bytestream_get_be24(src);

    if (pallen < 256)

        memset(dst, 0, (256 - pallen) * sizeof(*dst));

}


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

     inst |= (dest >> 2) & 0x3ffffff;

+    tcg_out32(s, inst);
+
+    return true;
+
+}

static bool tcg_out_opc_jmp(TCGContext *s, MIPSInsn opc, void *target)

{

    uintptr_t dest = (uintptr_t)target;

    uintptr_t from = (uintptr_t)s->code_ptr + 4;

    int32_t inst;

    /* The pc-region branch happens within the 256MB region of

       the delay slot (thus the +4).  */

    if ((from ^ dest) & -(1 << 28)) {

        return false;

    }

    assert((dest & 3) == 0);

    inst = opc;

    inst |= (dest >> 2) & 0x3ffffff;

    tcg_out32(s, inst);

    return true;

}


static int advanced_decode_i_mbs(VC9Context *v)

{

  int i, x, y, cbpcy, mqdiff, absmq, mquant, ac_pred, condover,

    current_mb = 0, over_flags_mb = 0;

    for (y=0; y<v->height_mb; y++)

    {

        for (x=0; x<v->width_mb; x++)

        {

            if (v->ac_pred_plane[i])

                ac_pred = get_bits(&v->gb, 1);

            if (condover == 3 && v->over_flags_plane)

                over_flags_mb = get_bits(&v->gb, 1);

            GET_MQUANT();

        }

        current_mb++;

    }

    return 0;

}


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

     if (ist->hwaccel_device) {
+
+        for (i = 0; i < FF_ARRAY_ELEMS(impl_map); i++)
+
+            if (!strcmp(ist->hwaccel_device, impl_map[i].name)) {
+
                 impl = impl_map[i].impl;

                 break;

static mfxIMPL choose_implementation(const InputStream *ist)

{

    static const struct {

        const char *name;

        mfxIMPL     impl;

    } impl_map[] = {

        { "auto",     MFX_IMPL_AUTO         },

        { "sw",       MFX_IMPL_SOFTWARE     },

        { "hw",       MFX_IMPL_HARDWARE     },

        { "auto_any", MFX_IMPL_AUTO_ANY     },

        { "hw_any",   MFX_IMPL_HARDWARE_ANY },

        { "hw2",      MFX_IMPL_HARDWARE2    },

        { "hw3",      MFX_IMPL_HARDWARE3    },

        { "hw4",      MFX_IMPL_HARDWARE4    },

    };

    mfxIMPL impl = MFX_IMPL_AUTO_ANY;

    int i;

    if (ist->hwaccel_device) {

        for (i = 0; i < FF_ARRAY_ELEMS(impl_map); i++)

            if (!strcmp(ist->hwaccel_device, impl_map[i].name)) {

                impl = impl_map[i].impl;

                break;

            }

        if (i == FF_ARRAY_ELEMS(impl_map))

            impl = strtol(ist->hwaccel_device, NULL, 0);

    }

    return impl;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int drive_init_func(QemuOpts *opts, void *opaque)
+
+{

     int *use_scsi = opaque;

static int drive_init_func(QemuOpts *opts, void *opaque)

{

    int *use_scsi = opaque;

    return drive_init(opts, *use_scsi) == NULL;

}


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

 {

+    tcg_gen_st_i32(var, cpu_env, offsetof(CPUState, iwmmxt.cregs[reg]));
+

 }

static inline void iwmmxt_store_creg(int reg, TCGv var)

{

    tcg_gen_st_i32(var, cpu_env, offsetof(CPUState, iwmmxt.cregs[reg]));

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int socket_close(void *opaque)
+
+{
+
     QEMUFileSocket *s = opaque;

     closesocket(s->fd);

static int socket_close(void *opaque)

{

    QEMUFileSocket *s = opaque;

    closesocket(s->fd);

    g_free(s);

    return 0;

}


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

     ac3_audio_block *ab = &ctx->audio_block;

+    float *samples = ctx->samples;
+
+    int got_cplchan = 0;
+
+    int dithflag = 0;

static int get_transform_coeffs(AC3DecodeContext * ctx)

{

    int i;

    ac3_audio_block *ab = &ctx->audio_block;

    float *samples = ctx->samples;

    int got_cplchan = 0;

    int dithflag = 0;

    samples += (ctx->bsi.flags & AC3_BSI_LFEON) ? 256 : 0;

    for (i = 0; i < ctx->bsi.nfchans; i++) {

        if ((ab->flags & AC3_AB_CPLINU) && (ab->chincpl & (1 << i)))

            dithflag = 0; /* don't generate dither until channels are decoupled */

        else

            dithflag = ab->dithflag & (1 << i);

        /* transform coefficients for individual channel */

        if (_get_transform_coeffs(ab->dexps[i], ab->bap[i], ab->chcoeffs[i], samples + (i * 256),

                    0, ab->endmant[i], dithflag, &ctx->gb, &ctx->state))

            return -1;

        /* tranform coefficients for coupling channels */

        if ((ab->flags & AC3_AB_CPLINU) && (ab->chincpl & (1 << i)) && !got_cplchan) {

            if (_get_transform_coeffs(ab->dcplexps, ab->cplbap, 1.0f, ab->cplcoeffs,

                        ab->cplstrtmant, ab->cplendmant, 0, &ctx->gb, &ctx->state))

                return -1;

            got_cplchan = 1;

        }

    }

    if (ctx->bsi.flags & AC3_BSI_LFEON)

        if (_get_transform_coeffs(ab->lfeexps, ab->lfebap, 1.0f, samples - 256, 0, 7, 0, &ctx->gb, &ctx->state))

                return -1;

    /* uncouple the channels from the coupling channel */

    if (ab->flags & AC3_AB_CPLINU)

        if (uncouple_channels(ctx))

            return -1;

    return 0;

}


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

     comp->offset = ntohll(comp->offset);

+    comp->length = ntohll(comp->length);
+
+}

static void network_to_compress(RDMACompress *comp)

{

    comp->value = ntohl(comp->value);

    comp->block_idx = ntohl(comp->block_idx);

    comp->offset = ntohll(comp->offset);

    comp->length = ntohll(comp->length);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)
+
+{
+
+#if HAVE_YASM
+
     int cpuflags = av_get_cpu_flags();

av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags)

{

#if HAVE_YASM

    int cpuflags = av_get_cpu_flags();

#if ARCH_X86_32

    if (HAVE_MMX && cpuflags & AV_CPU_FLAG_MMX) {

        c->idct_put  = ff_vp3_idct_put_mmx;

        c->idct_add  = ff_vp3_idct_add_mmx;

        c->idct_perm = FF_PARTTRANS_IDCT_PERM;

    }

#endif

    if (HAVE_MMXEXT && cpuflags & AV_CPU_FLAG_MMXEXT) {

        c->idct_dc_add = ff_vp3_idct_dc_add_mmx2;

        if (!(flags & CODEC_FLAG_BITEXACT)) {

            c->v_loop_filter = ff_vp3_v_loop_filter_mmx2;

            c->h_loop_filter = ff_vp3_h_loop_filter_mmx2;

        }

    }

    if (cpuflags & AV_CPU_FLAG_SSE2) {

        c->idct_put  = ff_vp3_idct_put_sse2;

        c->idct_add  = ff_vp3_idct_add_sse2;

        c->idct_perm = FF_TRANSPOSE_IDCT_PERM;

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int pci_unregister_device(DeviceState *dev)

 {

@@ -7,7 +7,7 @@
     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);

+
     pci_unregister_io_regions(pci_dev);

     pci_del_option_rom(pci_dev);

static int pci_unregister_device(DeviceState *dev)

{

    PCIDevice *pci_dev = PCI_DEVICE(dev);

    PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);

    pci_unregister_io_regions(pci_dev);

    pci_del_option_rom(pci_dev);

    if (pc->exit) {

        pc->exit(pci_dev);

    }

    do_pci_unregister_device(pci_dev);

    return 0;

}


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

+    for (i = 0; i < TERM_MAX_CMDS; i++) {
+
+	if (term_history[i] == NULL)
+
 	    break;

 	term_printf("%d: '%s'\n", i, term_history[i]);

static void do_info_history (void)

{

    int i;

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

	if (term_history[i] == NULL)

	    break;

	term_printf("%d: '%s'\n", i, term_history[i]);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline int cris_abs(int n)

 {

static inline int cris_abs(int n)

{

	int r;

	asm ("abs\t%1, %0\n" : "=r" (r) : "r" (n));

	return r;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int qcrypto_cipher_encrypt(QCryptoCipher *cipher,
                            const void *in,
+                           void *out,
+                           size_t len,
                            Error **errp)
 {
     QCryptoCipherBuiltin *ctxt = cipher->opaque;

int qcrypto_cipher_encrypt(QCryptoCipher *cipher,
                           const void *in,
                           void *out,
                           size_t len,
                           Error **errp)
{
    QCryptoCipherBuiltin *ctxt = cipher->opaque;
    return ctxt->encrypt(cipher, in, out, len, errp);


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

     CPUState *cs = CPU(obj);

+    MicroBlazeCPU *cpu = MICROBLAZE_CPU(obj);

     CPUMBState *env = &cpu->env;

static void mb_cpu_initfn(Object *obj)

{

    CPUState *cs = CPU(obj);

    MicroBlazeCPU *cpu = MICROBLAZE_CPU(obj);

    CPUMBState *env = &cpu->env;

    static bool tcg_initialized;

    cs->env_ptr = env;

    cpu_exec_init(cs, &error_abort);

    set_float_rounding_mode(float_round_nearest_even, &env->fp_status);

#ifndef CONFIG_USER_ONLY

    /* Inbound IRQ and FIR lines */

    qdev_init_gpio_in(DEVICE(cpu), microblaze_cpu_set_irq, 2);

#endif

    if (tcg_enabled() && !tcg_initialized) {

        tcg_initialized = true;

        mb_tcg_init();

    }

}


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

         if (state) {

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

     }

static void mptsas_update_interrupt(MPTSASState *s)

{

    PCIDevice *pci = (PCIDevice *) s;

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

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

        if (state) {

            trace_mptsas_irq_msi(s);

            msi_notify(pci, 0);

        }

    }

    trace_mptsas_irq_intx(s, !!state);

    pci_set_irq(pci, !!state);

}


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

                                 Error **errp)

+{

     VirtIODevice *vdev = VIRTIO_DEVICE(hotplug_dev);

static void virtio_scsi_hotplug(HotplugHandler *hotplug_dev, DeviceState *dev,

                                Error **errp)

{

    VirtIODevice *vdev = VIRTIO_DEVICE(hotplug_dev);

    VirtIOSCSI *s = VIRTIO_SCSI(vdev);

    SCSIDevice *sd = SCSI_DEVICE(dev);

    if (s->ctx && !s->dataplane_disabled) {

        VirtIOSCSIBlkChangeNotifier *insert_notifier, *remove_notifier;

        if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {

            return;

        }

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

        aio_context_acquire(s->ctx);

        blk_set_aio_context(sd->conf.blk, s->ctx);

        aio_context_release(s->ctx);

        insert_notifier = g_new0(VirtIOSCSIBlkChangeNotifier, 1);

        insert_notifier->n.notify = virtio_scsi_blk_insert_notifier;

        insert_notifier->s = s;

        insert_notifier->sd = sd;

        blk_add_insert_bs_notifier(sd->conf.blk, &insert_notifier->n);

        QTAILQ_INSERT_TAIL(&s->insert_notifiers, insert_notifier, next);

        remove_notifier = g_new0(VirtIOSCSIBlkChangeNotifier, 1);

        remove_notifier->n.notify = virtio_scsi_blk_remove_notifier;

        remove_notifier->s = s;

        remove_notifier->sd = sd;

        blk_add_remove_bs_notifier(sd->conf.blk, &remove_notifier->n);

        QTAILQ_INSERT_TAIL(&s->remove_notifiers, remove_notifier, next);

    }

    if (virtio_vdev_has_feature(vdev, VIRTIO_SCSI_F_HOTPLUG)) {

        virtio_scsi_push_event(s, sd,

                               VIRTIO_SCSI_T_TRANSPORT_RESET,

                               VIRTIO_SCSI_EVT_RESET_RESCAN);

    }

}


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

     if (nbd_send_negotiate(client)) {

+        shutdown(client->sock, 2);
+
+        close_fn(client);
+
+        return;

     }

void nbd_client_new(NBDExport *exp, int csock, void (*close_fn)(NBDClient *))

{

    NBDClient *client;

    client = g_malloc0(sizeof(NBDClient));

    client->refcount = 1;

    client->exp = exp;

    client->sock = csock;

    client->can_read = true;

    if (nbd_send_negotiate(client)) {

        shutdown(client->sock, 2);

        close_fn(client);

        return;

    }

    client->close = close_fn;

    qemu_co_mutex_init(&client->send_lock);

    nbd_set_handlers(client);

    if (exp) {

        QTAILQ_INSERT_TAIL(&exp->clients, client, next);

        nbd_export_get(exp);

    }

}


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

     struct addrinfo ai, *res;

+    int rc;

     const char *addr;

static struct addrinfo *inet_parse_connect_opts(QemuOpts *opts, Error **errp)

{

    struct addrinfo ai, *res;

    int rc;

    const char *addr;

    const char *port;

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

    ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;

    ai.ai_family = PF_UNSPEC;

    ai.ai_socktype = SOCK_STREAM;

    addr = qemu_opt_get(opts, "host");

    port = qemu_opt_get(opts, "port");

    if (addr == NULL || port == NULL) {

        error_setg(errp, "host and/or port not specified");

        return NULL;

    }

    if (qemu_opt_get_bool(opts, "ipv4", 0)) {

        ai.ai_family = PF_INET;

    }

    if (qemu_opt_get_bool(opts, "ipv6", 0)) {

        ai.ai_family = PF_INET6;

    }

    /* lookup */

    rc = getaddrinfo(addr, port, &ai, &res);

    if (rc != 0) {

        error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,

                   gai_strerror(rc));

        return NULL;

    }

    return res;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void common_end(FFV1Context *s){

     int i;

static void common_end(FFV1Context *s){

    int i;

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

        PlaneContext *p= &s->plane[i];

        av_freep(&p->state);

    }

}


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

                                        int64_t s, int64_t e)

+{

     Range *r = g_malloc0(sizeof(*r));

static void string_output_append_range(StringOutputVisitor *sov,

                                       int64_t s, int64_t e)

{

    Range *r = g_malloc0(sizeof(*r));

    r->begin = s;

    r->end = e + 1;

    sov->ranges = g_list_insert_sorted_merged(sov->ranges, r, range_compare);

}


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

             }

+            bdrv_attach_dev_nofail(dinfo->bdrv, &bus->ifs[i]);
+
+        } else {
+
+            ide_reset(&bus->ifs[i]);

         }

void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,

                                    DriveInfo *hd1, qemu_irq irq)

{

    int i;

    DriveInfo *dinfo;

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

        dinfo = i == 0 ? hd0 : hd1;

        ide_init1(bus, i);

        if (dinfo) {

            if (ide_init_drive(&bus->ifs[i], dinfo->bdrv,

                               dinfo->media_cd ? IDE_CD : IDE_HD, NULL,

                               *dinfo->serial ? dinfo->serial : NULL) < 0) {

                error_report("Can't set up IDE drive %s", dinfo->id);

                exit(1);

            }

            bdrv_attach_dev_nofail(dinfo->bdrv, &bus->ifs[i]);

        } else {

            ide_reset(&bus->ifs[i]);

        }

    }

    bus->irq = irq;

    bus->dma = &ide_dma_nop;

}


static int h263_probe(AVProbeData *p)

{

    int code;

    const uint8_t *d;

    if (p->buf_size < 6)

        return 0;

    d = p->buf;

    code = (d[0] << 14) | (d[1] << 6) | (d[2] >> 2);

    if (code == 0x20) {

        return 50;

    }

    return 0;

}


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

         return;

+
+
+    DPRINTF("cancelling migration\n");
+
+

     s->state = MIG_STATE_CANCELLED;

static void migrate_fd_cancel(MigrationState *s)

{

    if (s->state != MIG_STATE_ACTIVE)

        return;

    DPRINTF("cancelling migration\n");

    s->state = MIG_STATE_CANCELLED;

    notifier_list_notify(&migration_state_notifiers, s);

    migrate_fd_cleanup(s);

}


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

+    set_dirty_tracking(0);
+
+
+
+    while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {

         QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);

static void blk_mig_cleanup(Monitor *mon)

{

    BlkMigDevState *bmds;

    BlkMigBlock *blk;

    set_dirty_tracking(0);

    while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {

        QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);

        bdrv_set_in_use(bmds->bs, 0);

        drive_put_ref(drive_get_by_blockdev(bmds->bs));

        g_free(bmds->aio_bitmap);

        g_free(bmds);

    }

    while ((blk = QSIMPLEQ_FIRST(&block_mig_state.blk_list)) != NULL) {

        QSIMPLEQ_REMOVE_HEAD(&block_mig_state.blk_list, entry);

        g_free(blk->buf);

        g_free(blk);

    }

    monitor_printf(mon, "\n");

}


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

         if (client->fh) {

+            nfs_close(client->context, client->fh);

         }

static void nfs_client_close(NFSClient *client)

{

    if (client->context) {

        if (client->fh) {

            nfs_close(client->context, client->fh);

        }

        aio_set_fd_handler(client->aio_context, nfs_get_fd(client->context),

                           false, NULL, NULL, NULL, NULL);

        nfs_destroy_context(client->context);

    }

    memset(client, 0, sizeof(NFSClient));

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+av_cold int ff_vp8_decode_init(AVCodecContext *avctx)

 {

     VP8Context *s = avctx->priv_data;

     int ret;
+
+

     s->avctx = avctx;

av_cold int ff_vp8_decode_init(AVCodecContext *avctx)

{

    VP8Context *s = avctx->priv_data;

    int ret;

    s->avctx = avctx;

    avctx->pix_fmt = AV_PIX_FMT_YUV420P;

    avctx->internal->allocate_progress = 1;

    ff_videodsp_init(&s->vdsp, 8);

    ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1);

    ff_vp8dsp_init(&s->vp8dsp);

    if ((ret = vp8_init_frames(s)) < 0) {

        ff_vp8_decode_free(avctx);

        return ret;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static int get_buffer(AVCodecContext *avctx, AVFrame *pic)
+
+{
+
     pic->type = FF_BUFFER_TYPE_USER;

     pic->data[0] = (void *)1;

static int get_buffer(AVCodecContext *avctx, AVFrame *pic)

{

    pic->type = FF_BUFFER_TYPE_USER;

    pic->data[0] = (void *)1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;

     int alpha = alpha_table[index_a];
+
+    int beta  = beta_table[qp - qp_bd_offset + h->slice_beta_offset];
+
+    if (alpha ==0 || beta == 0) return;
+

     if( bS[0] < 4 ) {

static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {

    const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);

    int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;

    int alpha = alpha_table[index_a];

    int beta  = beta_table[qp - qp_bd_offset + h->slice_beta_offset];

    if (alpha ==0 || beta == 0) return;

    if( bS[0] < 4 ) {

        int8_t tc[4];

        tc[0] = tc0_table[index_a][bS[0*bsi]];

        tc[1] = tc0_table[index_a][bS[1*bsi]];

        tc[2] = tc0_table[index_a][bS[2*bsi]];

        tc[3] = tc0_table[index_a][bS[3*bsi]];

        h->h264dsp.h264_h_loop_filter_luma_mbaff(pix, stride, alpha, beta, tc);

    } else {

        h->h264dsp.h264_h_loop_filter_luma_mbaff_intra(pix, stride, alpha, beta);

    }

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     XenPTRegInfo *reg = cfg_entry->reg;

     uint32_t writable_mask = 0;
+
+    uint32_t old_addr = cfg_entry->data;
+
+
+
     /* check whether the type is 64 bit or not */

     if (!(s->msi->flags & PCI_MSI_FLAGS_64BIT)) {

static int xen_pt_msgaddr64_reg_write(XenPCIPassthroughState *s,

                                      XenPTReg *cfg_entry, uint32_t *val,

                                      uint32_t dev_value, uint32_t valid_mask)

{

    XenPTRegInfo *reg = cfg_entry->reg;

    uint32_t writable_mask = 0;

    uint32_t old_addr = cfg_entry->data;

    /* check whether the type is 64 bit or not */

    if (!(s->msi->flags & PCI_MSI_FLAGS_64BIT)) {

        XEN_PT_ERR(&s->dev,

                   "Can't write to the upper address without 64 bit support\n");

        return -1;

    }

    /* modify emulate register */

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

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

    /* update the msi_info too */

    s->msi->addr_hi = cfg_entry->data;

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

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

    /* update MSI */

    if (cfg_entry->data != old_addr) {

        if (s->msi->mapped) {

            xen_pt_msi_update(s);

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,8 +5,8 @@
     int ch, i, cbits;

     s->lpc_order = get_bits(&s->gb, 5) + 1;
+
+    s->lpc_scaling = get_bits(&s->gb, 4);

     s->lpc_intbits = get_bits(&s->gb, 3) + 1;

decode_lpc(WmallDecodeCtx *s)

{

    int ch, i, cbits;

    s->lpc_order = get_bits(&s->gb, 5) + 1;

    s->lpc_scaling = get_bits(&s->gb, 4);

    s->lpc_intbits = get_bits(&s->gb, 3) + 1;

    cbits = s->lpc_scaling + s->lpc_intbits;

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

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

	    s->lpc_coefs[ch][i] = get_sbits(&s->gb, cbits);

	}

    }

}


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

     while(chunk1!=chunk2) {

+	chunk3 = (chunk1+chunk2)/2;
+
+	if(s->sectors[chunk3]>sector_num)
+
+	    chunk2 = chunk3;

 	else if(s->sectors[chunk3]+s->sectorcounts[chunk3]>sector_num)

static inline uint32_t search_chunk(BDRVDMGState* s,int sector_num)

{

    /* binary search */

    uint32_t chunk1=0,chunk2=s->n_chunks,chunk3;

    while(chunk1!=chunk2) {

	chunk3 = (chunk1+chunk2)/2;

	if(s->sectors[chunk3]>sector_num)

	    chunk2 = chunk3;

	else if(s->sectors[chunk3]+s->sectorcounts[chunk3]>sector_num)

	    return chunk3;

	else

	    chunk1 = chunk3;

    }

    return s->n_chunks; /* error */

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void vfio_disable_interrupts(VFIOPCIDevice *vdev)
+
+{
+
+    switch (vdev->interrupt) {

+    case VFIO_INT_INTx:

         vfio_disable_intx(vdev);

static void vfio_disable_interrupts(VFIOPCIDevice *vdev)

{

    switch (vdev->interrupt) {

    case VFIO_INT_INTx:

        vfio_disable_intx(vdev);

        break;

    case VFIO_INT_MSI:

        vfio_disable_msi(vdev);

        break;

    case VFIO_INT_MSIX:

        vfio_disable_msix(vdev);

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+void qemu_del_vlan_client(VLANClientState *vc)

 {

+    if (vc->vlan) {
+
         QTAILQ_REMOVE(&vc->vlan->clients, vc, next);

+    } else {
+
         if (vc->send_queue) {

             qemu_del_net_queue(vc->send_queue);

void qemu_del_vlan_client(VLANClientState *vc)

{

    if (vc->vlan) {

        QTAILQ_REMOVE(&vc->vlan->clients, vc, next);

    } else {

        if (vc->send_queue) {

            qemu_del_net_queue(vc->send_queue);

        }

        QTAILQ_REMOVE(&non_vlan_clients, vc, next);

        if (vc->peer) {

            vc->peer->peer = NULL;

        }

    }

    if (vc->info->cleanup) {

        vc->info->cleanup(vc);

    }

    qemu_free(vc->name);

    qemu_free(vc->model);

    qemu_free(vc);

}


--- a/source.c
+++ b/source.c
@@ -5,10 +5,10 @@
     DeviceClass *k = DEVICE_CLASS(klass);

     k->realize = hda_codec_dev_realize;
+
+    k->exit = hda_codec_dev_exit;
+
+    set_bit(DEVICE_CATEGORY_SOUND, k->categories);

     k->bus_type = TYPE_HDA_BUS;

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

{

    DeviceClass *k = DEVICE_CLASS(klass);

    k->realize = hda_codec_dev_realize;

    k->exit = hda_codec_dev_exit;

    set_bit(DEVICE_CATEGORY_SOUND, k->categories);

    k->bus_type = TYPE_HDA_BUS;

    k->props = hda_props;

}


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

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

static void cloop_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,11 +1,11 @@
 static uint64_t jazz_led_read(void *opaque, target_phys_addr_t addr,

                               unsigned int size)
+
+{
+
+    LedState *s = opaque;
+
     uint8_t val;

static uint64_t jazz_led_read(void *opaque, target_phys_addr_t addr,

                              unsigned int size)

{

    LedState *s = opaque;

    uint8_t val;

    val = s->segments;

    trace_jazz_led_read(addr, val);

    return val;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int msvideo1_decode_init(AVCodecContext *avctx)

 {
+
+    Msvideo1Context *s = avctx->priv_data;
+
+
+
     s->avctx = avctx;

static int msvideo1_decode_init(AVCodecContext *avctx)

{

    Msvideo1Context *s = avctx->priv_data;

    s->avctx = avctx;

    /* figure out the colorspace based on the presence of a palette */

    if (s->avctx->palctrl) {

        s->mode_8bit = 1;

        avctx->pix_fmt = PIX_FMT_PAL8;

    } else {

        s->mode_8bit = 0;

        avctx->pix_fmt = PIX_FMT_RGB555;

    }

    dsputil_init(&s->dsp, avctx);

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

    return 0;

}


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

     CPUX86State *env1 = &x86_cpu->env;

static void exception_action(CPUState *cpu)

{

#if defined(TARGET_I386)

    X86CPU *x86_cpu = X86_CPU(cpu);

    CPUX86State *env1 = &x86_cpu->env;

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

#else

    cpu_loop_exit(cpu);

#endif

}


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

     if (env->stopped)
+
+        return 0;
+
+    if (!env->halted)
+
         return 1;

     if (qemu_cpu_has_work(env))

static int cpu_has_work(CPUState *env)

{

    if (env->stop)

        return 1;

    if (env->stopped)

        return 0;

    if (!env->halted)

        return 1;

    if (qemu_cpu_has_work(env))

        return 1;

    return 0;

}


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

         vmstate_unregister(dev->info->vmsd, dev);

+#endif
+
+    if (dev->info->reset)
+
+        qemu_unregister_reset(dev->info->reset, dev);

     LIST_REMOVE(dev, sibling);

void qdev_free(DeviceState *dev)

{

#if 0 /* FIXME: need sane vmstate_unregister function */

    if (dev->info->vmsd)

        vmstate_unregister(dev->info->vmsd, dev);

#endif

    if (dev->info->reset)

        qemu_unregister_reset(dev->info->reset, dev);

    LIST_REMOVE(dev, sibling);

    qemu_free(dev);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id)

 {
+
     VirtIOBlock *s = opaque;

static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id)

{

    VirtIOBlock *s = opaque;

    if (version_id != 2)

        return -EINVAL;

    virtio_load(&s->vdev, f);

    while (qemu_get_sbyte(f)) {

        VirtIOBlockReq *req = virtio_blk_alloc_request(s);

        qemu_get_buffer(f, (unsigned char*)&req->elem, sizeof(req->elem));

        req->next = s->rq;

        s->rq = req;

        virtqueue_map_sg(req->elem.in_sg, req->elem.in_addr,

            req->elem.in_num, 1);

        virtqueue_map_sg(req->elem.out_sg, req->elem.out_addr,

            req->elem.out_num, 0);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static int proxy_open(FsContext *ctx, V9fsPath *fs_path,
+
+                      int flags, V9fsFidOpenState *fs)
+
 {

     fs->fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, flags);

static int proxy_open(FsContext *ctx, V9fsPath *fs_path,

                      int flags, V9fsFidOpenState *fs)

{

    fs->fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, flags);

    if (fs->fd < 0) {

        errno = -fs->fd;

        fs->fd = -1;

    }

    return fs->fd;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int setup_common(char *argv[], int argv_sz)

+{

     memset(cur_ide, 0, sizeof(cur_ide));

static int setup_common(char *argv[], int argv_sz)

{

    memset(cur_ide, 0, sizeof(cur_ide));

    return append_arg(0, argv, argv_sz,

                      g_strdup("-nodefaults -display none"));

}


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

     value += addend;
+
     switch(type) {

     case R_386_PC32:

         value -= (uintptr_t)code_ptr;
+
         if (value != (int32_t)value) {

             tcg_abort();

static void patch_reloc(uint8_t *code_ptr, int type,

                        intptr_t value, intptr_t addend)

{

    value += addend;

    switch(type) {

    case R_386_PC32:

        value -= (uintptr_t)code_ptr;

        if (value != (int32_t)value) {

            tcg_abort();

        }

        *(uint32_t *)code_ptr = value;

        break;

    case R_386_PC8:

        value -= (uintptr_t)code_ptr;

        if (value != (int8_t)value) {

            tcg_abort();

        }

        *(uint8_t *)code_ptr = value;

        break;

    default:

        tcg_abort();

    }

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+static int vnc_tls_initialize(void)
+
+{
+
+    static int tlsinitialized = 0;
+
+
+
+    if (tlsinitialized)
+
         return 1;

static int vnc_tls_initialize(void)

{

    static int tlsinitialized = 0;

    if (tlsinitialized)

        return 1;

    if (gnutls_global_init () < 0)

        return 0;

    /* XXX ought to re-generate diffie-hellman params periodically */

    if (gnutls_dh_params_init (&dh_params) < 0)

        return 0;

    if (gnutls_dh_params_generate2 (dh_params, DH_BITS) < 0)

        return 0;

#if defined(_VNC_DEBUG) && _VNC_DEBUG >= 2

    gnutls_global_set_log_level(10);

    gnutls_global_set_log_function(vnc_debug_gnutls_log);

#endif

    tlsinitialized = 1;

    return 1;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,

                                       DeviceState *dev, Error **errp)
+
 {

     sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());

static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,

                                      DeviceState *dev, Error **errp)

{

    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());

    if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {

        uint32_t node;

        if (!smc->dr_lmb_enabled) {

            error_setg(errp, "Memory hotplug not supported for this machine");

            return;

        }

        node = object_property_get_int(OBJECT(dev), PC_DIMM_NODE_PROP, errp);

        if (*errp) {

            return;

        }

        spapr_memory_plug(hotplug_dev, dev, node, errp);

    }

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         trace_megasas_dcmd_invalid_xfer_len(cmd->index, cmd->iov_size,

                                             dcmd_size);
+
+        return MFI_STAT_INVALID_PARAMETER;
+
+    }
+
     dma_buf_write((uint8_t *)&info, cmd->iov_size, &cmd->qsg);

     trace_megasas_dcmd_unsupported(cmd->index, cmd->iov_size);

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

{

    struct mfi_ctrl_props info;

    size_t dcmd_size = sizeof(info);

    if (cmd->iov_size < dcmd_size) {

        trace_megasas_dcmd_invalid_xfer_len(cmd->index, cmd->iov_size,

                                            dcmd_size);

        return MFI_STAT_INVALID_PARAMETER;

    }

    dma_buf_write((uint8_t *)&info, cmd->iov_size, &cmd->qsg);

    trace_megasas_dcmd_unsupported(cmd->index, cmd->iov_size);

    return MFI_STAT_OK;

}


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

 {

+    NBDClient *client = req->client;
+
+
+
+    if (req->data) {

         qemu_vfree(req->data);

static void nbd_request_put(NBDRequest *req)

{

    NBDClient *client = req->client;

    if (req->data) {

        qemu_vfree(req->data);

    }

    g_slice_free(NBDRequest, req);

    if (client->nb_requests-- == MAX_NBD_REQUESTS) {

        qemu_notify_event();

    }

    nbd_client_put(client);

}


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

+
     if (!msi) {

         return;

void xen_pt_msi_disable(XenPCIPassthroughState *s)

{

    XenPTMSI *msi = s->msi;

    if (!msi) {

        return;

    }

    xen_pt_msi_set_enable(s, false);

    msi_msix_disable(s, msi_addr64(msi), msi->data, msi->pirq, false,

                     msi->initialized);

    /* clear msi info */

    msi->flags = 0;

    msi->mapped = false;

    msi->pirq = XEN_PT_UNASSIGNED_PIRQ;

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     int err = 0;

     if (!nptr) {
+
         if (endptr) {

             *endptr = nptr;

int qemu_strtoll(const char *nptr, const char **endptr, int base,

                 int64_t *result)

{

    char *p;

    int err = 0;

    if (!nptr) {

        if (endptr) {

            *endptr = nptr;

        }

        err = -EINVAL;

    } else {

        errno = 0;

        *result = strtoll(nptr, &p, base);

        err = check_strtox_error(endptr, p, errno);

    }

    return err;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int usb_wacom_initfn(USBDevice *dev)

 {
+
+    USBWacomState *s = DO_UPCAST(USBWacomState, dev, dev);
+
     s->dev.speed = USB_SPEED_FULL;

     s->changed = 1;

static int usb_wacom_initfn(USBDevice *dev)

{

    USBWacomState *s = DO_UPCAST(USBWacomState, dev, dev);

    s->dev.speed = USB_SPEED_FULL;

    s->changed = 1;

    return 0;

}


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

     g_free(filename);
+
+
+
+    if (opts == NULL) {
+
       return;

     }

static void pc_fw_add_pflash_drv(void)

{

    QemuOpts *opts;

    QEMUMachine *machine;

    char *filename;

    if (bios_name == NULL) {

        bios_name = BIOS_FILENAME;

    }

    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);

    opts = drive_add(IF_PFLASH, -1, filename, "readonly=on");

    g_free(filename);

    if (opts == NULL) {

      return;

    }

    machine = find_default_machine();

    if (machine == NULL) {

      return;

    }

    if (!drive_init(opts, machine->use_scsi)) {

        qemu_opts_del(opts);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void qbus_create_inplace(BusState *bus, const char *typename,
+
                          DeviceState *parent, const char *name)

 {

void qbus_create_inplace(BusState *bus, const char *typename,

                         DeviceState *parent, const char *name)

{

    object_initialize(bus, typename);

    qbus_realize(bus, parent, name);

}


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

     FlatRange *fr;

+    unsigned ioeventfd_nb = 0;

     MemoryRegionIoeventfd *ioeventfds = NULL;

static void address_space_update_ioeventfds(AddressSpace *as)

{

    FlatRange *fr;

    unsigned ioeventfd_nb = 0;

    MemoryRegionIoeventfd *ioeventfds = NULL;

    AddrRange tmp;

    unsigned i;

    FOR_EACH_FLAT_RANGE(fr, &as->current_map) {

        for (i = 0; i < fr->mr->ioeventfd_nb; ++i) {

            tmp = addrrange_shift(fr->mr->ioeventfds[i].addr,

                                  int128_sub(fr->addr.start,

                                             int128_make64(fr->offset_in_region)));

            if (addrrange_intersects(fr->addr, tmp)) {

                ++ioeventfd_nb;

                ioeventfds = g_realloc(ioeventfds,

                                          ioeventfd_nb * sizeof(*ioeventfds));

                ioeventfds[ioeventfd_nb-1] = fr->mr->ioeventfds[i];

                ioeventfds[ioeventfd_nb-1].addr = tmp;

            }

        }

    }

    address_space_add_del_ioeventfds(as, ioeventfds, ioeventfd_nb,

                                     as->ioeventfds, as->ioeventfd_nb);

    g_free(as->ioeventfds);

    as->ioeventfds = ioeventfds;

    as->ioeventfd_nb = ioeventfd_nb;

}


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

     TranslationBlock *tb;

+    tb = ctx->tb;
+
     if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {

         if (n == 0)

static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)

{

    TranslationBlock *tb;

    tb = ctx->tb;

    if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {

        if (n == 0)

            gen_op_goto_tb0(TBPARAM(tb));

        else

            gen_op_goto_tb1(TBPARAM(tb));

        gen_op_set_T1(dest);

        gen_op_b_T1();

        gen_op_set_T0((long)tb + n);

        if (ctx->singlestep_enabled)

            gen_op_debug();

        gen_op_exit_tb();

    } else {

        gen_op_set_T1(dest);

        gen_op_b_T1();

        gen_op_reset_T0();

        if (ctx->singlestep_enabled)

            gen_op_debug();

        gen_op_exit_tb();

    }

}


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

 {

+    GuestSuspendMode *mode = opaque;

     DWORD ret = 0;

static DWORD WINAPI do_suspend(LPVOID opaque)

{

    GuestSuspendMode *mode = opaque;

    DWORD ret = 0;

    if (!SetSuspendState(*mode == GUEST_SUSPEND_MODE_DISK, TRUE, TRUE)) {

        slog("failed to suspend guest, %s", GetLastError());

        ret = -1;

    }

    g_free(mode);

    return ret;

}


int avpriv_vsnprintf(char *restrict s, size_t n, const char *restrict fmt,

                     va_list ap)

{

    int ret;

    if (n == 0)

        return 0;

    else if (n > INT_MAX)

        return AVERROR(EINVAL);

    /* we use n - 1 here because if the buffer is not big enough, the MS

     * runtime libraries don't add a terminating zero at the end. MSDN

     * recommends to provide _snprintf/_vsnprintf() a buffer size that

     * is one less than the actual buffer, and zero it before calling

     * _snprintf/_vsnprintf() to workaround this problem.

     * See http://msdn.microsoft.com/en-us/library/1kt27hek(v=vs.80).aspx */

    memset(s, 0, n);

    ret = vsnprintf(s, n - 1, fmt, ap);

    if (ret == -1)

        ret = n;

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         if (value == 1 || value == 2) {

             qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
+
+        } else if (value == 3) {
+
+            qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
+
         }

     }

static void hb_regs_write(void *opaque, hwaddr offset,

                          uint64_t value, unsigned size)

{

    uint32_t *regs = opaque;

    if (offset == 0xf00) {

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

            qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);

        } else if (value == 3) {

            qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);

        }

    }

    regs[offset/4] = value;

}


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

         rc = nbd_send_reply(csock, reply);

+    } else {
+
+        socket_set_cork(csock, 1);
+
+        rc = nbd_send_reply(csock, reply);

         if (rc >= 0) {

static ssize_t nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply,

                                 int len)

{

    NBDClient *client = req->client;

    int csock = client->sock;

    ssize_t rc, ret;

    qemu_co_mutex_lock(&client->send_lock);

    qemu_set_fd_handler2(csock, nbd_can_read, nbd_read,

                         nbd_restart_write, client);

    client->send_coroutine = qemu_coroutine_self();

    if (!len) {

        rc = nbd_send_reply(csock, reply);

    } else {

        socket_set_cork(csock, 1);

        rc = nbd_send_reply(csock, reply);

        if (rc >= 0) {

            ret = qemu_co_send(csock, req->data, len);

            if (ret != len) {

                rc = -EIO;

            }

        }

        socket_set_cork(csock, 0);

    }

    client->send_coroutine = NULL;

    qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, NULL, client);

    qemu_co_mutex_unlock(&client->send_lock);

    return rc;

}


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

     g_source_unref(iwp->src);

+    iwp->src = NULL;
+
+}

static void io_watch_poll_finalize(GSource *source)

{

    IOWatchPoll *iwp = io_watch_poll_from_source(source);

    g_source_destroy(iwp->src);

    g_source_unref(iwp->src);

    iwp->src = NULL;

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     if (!value)

         return -1;
+
+    avio_read(pb, value, size);
+
+    value[size]=0;
+

     AV_WL32(key, tag);

static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size)

{

    AVIOContext *pb = s->pb;

    char key[5] = {0}, *value;

    size += (size & 1);

    if (size == UINT_MAX)

        return -1;

    value = av_malloc(size+1);

    if (!value)

        return -1;

    avio_read(pb, value, size);

    value[size]=0;

    AV_WL32(key, tag);

    return av_dict_set(st ? &st->metadata : &s->metadata, key, value,

                            AV_DICT_DONT_STRDUP_VAL);

}


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

             iocbs[len++] = &aiocb->iocb;

+            if (len == MAX_QUEUED_IO) {
+
+                break;
+
+            }

         }

static void ioq_submit(LinuxAioState *s)

{

    int ret, len;

    struct qemu_laiocb *aiocb;

    struct iocb *iocbs[MAX_QUEUED_IO];

    QSIMPLEQ_HEAD(, qemu_laiocb) completed;

    do {

        len = 0;

        QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) {

            iocbs[len++] = &aiocb->iocb;

            if (len == MAX_QUEUED_IO) {

                break;

            }

        }

        ret = io_submit(s->ctx, len, iocbs);

        if (ret == -EAGAIN) {

            break;

        }

        if (ret < 0) {

            abort();

        }

        s->io_q.n -= ret;

        aiocb = container_of(iocbs[ret - 1], struct qemu_laiocb, iocb);

        QSIMPLEQ_SPLIT_AFTER(&s->io_q.pending, aiocb, next, &completed);

    } while (ret == len && !QSIMPLEQ_EMPTY(&s->io_q.pending));

    s->io_q.blocked = (s->io_q.n > 0);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void skip_data_stream_element(GetBitContext *gb)

 {

static void skip_data_stream_element(GetBitContext *gb)

{

    int byte_align = get_bits1(gb);

    int count = get_bits(gb, 8);

    if (count == 255)

        count += get_bits(gb, 8);

    if (byte_align)

        align_get_bits(gb);

    skip_bits_long(gb, 8 * count);

}


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

     file_oformat = guess_format(arg, NULL, NULL);

+    if (!file_iformat && !file_oformat) {
+
+        fprintf(stderr, "Unknown input or output format: %s\n", arg);
+
+        exit(1);

     }

static void opt_format(const char *arg)

{

    /* compatibility stuff for pgmyuv */

    if (!strcmp(arg, "pgmyuv")) {

        opt_image_format(arg);

        arg = "image";

    }

    file_iformat = av_find_input_format(arg);

    file_oformat = guess_format(arg, NULL, NULL);

    if (!file_iformat && !file_oformat) {

        fprintf(stderr, "Unknown input or output format: %s\n", arg);

        exit(1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,24 +1,24 @@
+void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size)
+
+{
+
+    const uint8_t *r, *end = buf1 + size;
+
+    RTPMuxContext *s = s1->priv_data;
+
+
+
+    s->timestamp = s->cur_timestamp;
+
+    s->buf_ptr   = s->buf;

+    if (s->nal_length_size)
+
         r = ff_avc_mp4_find_startcode(buf1, end, s->nal_length_size) ? buf1 : end;
+
+    else

+        r = ff_avc_find_startcode(buf1, end);

     while (r < end) {

void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size)

{

    const uint8_t *r, *end = buf1 + size;

    RTPMuxContext *s = s1->priv_data;

    s->timestamp = s->cur_timestamp;

    s->buf_ptr   = s->buf;

    if (s->nal_length_size)

        r = ff_avc_mp4_find_startcode(buf1, end, s->nal_length_size) ? buf1 : end;

    else

        r = ff_avc_find_startcode(buf1, end);

    while (r < end) {

        const uint8_t *r1;

        if (s->nal_length_size) {

            r1 = ff_avc_mp4_find_startcode(r, end, s->nal_length_size);

            if (!r1)

                r1 = end;

            r += s->nal_length_size;

        } else {

            while (!*(r++));

            r1 = ff_avc_find_startcode(r, end);

        }

        nal_send(s1, r, r1 - r, r1 == end);

        r = r1;

    }

    flush_buffered(s1, 1);

}


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

     if (scsi_req_enqueue(sreq)) {

+        scsi_req_continue(sreq);
+
+    }
+
     bdrv_io_unplug(sreq->dev->conf.bs);

     scsi_req_unref(sreq);

void virtio_scsi_handle_cmd_req_submit(VirtIOSCSI *s, VirtIOSCSIReq *req)

{

    SCSIRequest *sreq = req->sreq;

    if (scsi_req_enqueue(sreq)) {

        scsi_req_continue(sreq);

    }

    bdrv_io_unplug(sreq->dev->conf.bs);

    scsi_req_unref(sreq);

}


static int pcm_decode_frame(AVCodecContext *avctx,
			    void *data, int *data_size,
			    uint8_t *buf, int buf_size)
{
    PCMDecode *s = avctx->priv_data;
    int n;
    short *samples;
    uint8_t *src;
    samples = data;
    src = buf;
    switch(avctx->codec->id) {
    case CODEC_ID_PCM_S16LE:
        n = buf_size >> 1;
        for(;n>0;n--) {
            *samples++ = src[0] | (src[1] << 8);
            src += 2;
        }
        break;
    case CODEC_ID_PCM_S16BE:
        n = buf_size >> 1;
        for(;n>0;n--) {
            *samples++ = (src[0] << 8) | src[1];
            src += 2;
        }
        break;
    case CODEC_ID_PCM_U16LE:
        n = buf_size >> 1;
        for(;n>0;n--) {
            *samples++ = (src[0] | (src[1] << 8)) - 0x8000;
            src += 2;
        }
        break;
    case CODEC_ID_PCM_U16BE:
        n = buf_size >> 1;
        for(;n>0;n--) {
            *samples++ = ((src[0] << 8) | src[1]) - 0x8000;
            src += 2;
        }
        break;
    case CODEC_ID_PCM_S8:
        n = buf_size;
        for(;n>0;n--) {
            *samples++ = src[0] << 8;
            src++;
        }
        break;
    case CODEC_ID_PCM_U8:
        n = buf_size;
        for(;n>0;n--) {
            *samples++ = ((int)src[0] - 128) << 8;
            src++;
        }
        break;
    case CODEC_ID_PCM_ALAW:
    case CODEC_ID_PCM_MULAW:
        n = buf_size;
        for(;n>0;n--) {
            *samples++ = s->table[src[0]];
            src++;
        }
        break;
    default:
        return -1;
    }
    *data_size = (uint8_t *)samples - (uint8_t *)data;
    return src - buf;
}


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

     int r = write(e->fd, &value, sizeof(value));

+    return r == sizeof(value);
+
 }

int event_notifier_set(EventNotifier *e)

{

    uint64_t value = 1;

    int r = write(e->fd, &value, sizeof(value));

    return r == sizeof(value);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index)

 {
+
     int code;

     code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2);

static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index)

{

    int code;

    code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2);

    if (code < 0) {

        av_log(s->avctx, AV_LOG_WARNING,

               "mjpeg_decode_dc: bad vlc: %d:%d (%p)\n",

               0, dc_index, &s->vlcs[0][dc_index]);

        return 0xffff;

    }

    if (code)

        return get_xbits(&s->gb, code);

    else

        return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void in_asm_used_var_warning_killer()
+
 {

  volatile int i= yCoeff+vrCoeff+ubCoeff+vgCoeff+ugCoeff+bF8+bFC+w400+w80+w10+

void in_asm_used_var_warning_killer()

{

 volatile int i= yCoeff+vrCoeff+ubCoeff+vgCoeff+ugCoeff+bF8+bFC+w400+w80+w10+

 bm00001111+bm00000111+bm11111000+b16Mask+g16Mask+r16Mask+b15Mask+g15Mask+r15Mask+temp0+asm_yalpha1+ asm_uvalpha1+

 M24A+M24B+M24C+w02 + funnyYCode[0]+ funnyUVCode[0]+b5Dither+g5Dither+r5Dither+g6Dither+dither4[0]+dither8[0];

 if(i) i=0;

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
         if (cur_cpu == cpu) {

             continue;
+
+        }
+
+        if (s390_cpu_get_state(cur_cpu) != CPU_STATE_STOPPED) {
+
             all_stopped = false;

         }

static int sigp_set_architecture(S390CPU *cpu, uint32_t param,

                                 uint64_t *status_reg)

{

    CPUState *cur_cs;

    S390CPU *cur_cpu;

    bool all_stopped = true;

    CPU_FOREACH(cur_cs) {

        cur_cpu = S390_CPU(cur_cs);

        if (cur_cpu == cpu) {

            continue;

        }

        if (s390_cpu_get_state(cur_cpu) != CPU_STATE_STOPPED) {

            all_stopped = false;

        }

    }

    *status_reg &= 0xffffffff00000000ULL;

    /* Reject set arch order, with czam we're always in z/Arch mode. */

    *status_reg |= (all_stopped ? SIGP_STAT_INVALID_PARAMETER :

                    SIGP_STAT_INCORRECT_STATE);

    return SIGP_CC_STATUS_STORED;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static PCIIDEState *pci_from_bm(BMDMAState *bm)

 {

static PCIIDEState *pci_from_bm(BMDMAState *bm)

{

    return bm->pci_dev;

}


--- a/source.c
+++ b/source.c
@@ -31,9 +31,9 @@
             aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier,

                                    false, NULL);
+
+        }
+
+    }
+
 }

static void virtio_scsi_clear_aio(VirtIOSCSI *s)

{

    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);

    int i;

    if (s->ctrl_vring) {

        aio_set_event_notifier(s->ctx, &s->ctrl_vring->host_notifier,

                               false, NULL);

    }

    if (s->event_vring) {

        aio_set_event_notifier(s->ctx, &s->event_vring->host_notifier,

                               false, NULL);

    }

    if (s->cmd_vrings) {

        for (i = 0; i < vs->conf.num_queues && s->cmd_vrings[i]; i++) {

            aio_set_event_notifier(s->ctx, &s->cmd_vrings[i]->host_notifier,

                                   false, NULL);

        }

    }

}


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

     WAVState *wav = opaque;

+    uint8_t rlen[4];

     uint8_t dlen[4];
+
+    uint32_t datalen = wav->bytes;
+
+    uint32_t rifflen = datalen + 36;
+
+
+
+    if (!wav->f) {
+
         return;

     }

static void wav_destroy (void *opaque)

{

    WAVState *wav = opaque;

    uint8_t rlen[4];

    uint8_t dlen[4];

    uint32_t datalen = wav->bytes;

    uint32_t rifflen = datalen + 36;

    if (!wav->f) {

        return;

    }

    le_store (rlen, rifflen, 4);

    le_store (dlen, datalen, 4);

    qemu_fseek (wav->f, 4, SEEK_SET);

    qemu_put_buffer (wav->f, rlen, 4);

    qemu_fseek (wav->f, 32, SEEK_CUR);

    qemu_put_buffer (wav->f, dlen, 4);

    qemu_fclose (wav->f);

    if (wav->path) {

        qemu_free (wav->path);

    }

}


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

     double ret = 0;
+
     SelectContext *select = ctx->priv;

     AVFilterBufferRef *prev_picref = select->prev_picref;

+
+    if (prev_picref &&

         picref->video->h    == prev_picref->video->h &&
+
         picref->video->w    == prev_picref->video->w &&

         picref->linesize[0] == prev_picref->linesize[0]) {

static double get_scene_score(AVFilterContext *ctx, AVFilterBufferRef *picref)

{

    double ret = 0;

    SelectContext *select = ctx->priv;

    AVFilterBufferRef *prev_picref = select->prev_picref;

    if (prev_picref &&

        picref->video->h    == prev_picref->video->h &&

        picref->video->w    == prev_picref->video->w &&

        picref->linesize[0] == prev_picref->linesize[0]) {

        int x, y;

        int64_t sad = 0;

        double mafd, diff;

        uint8_t *p1 =      picref->data[0];

        uint8_t *p2 = prev_picref->data[0];

        const int linesize = picref->linesize[0];

        for (y = 0; y < picref->video->h; y += 8)

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

                sad += select->c.sad[1](select,

                                        p1 + y * linesize + x,

                                        p2 + y * linesize + x,

                                        linesize, 8);

        emms_c();

        mafd = sad / (picref->video->h * picref->video->w * 3);

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

        ret  = av_clipf(FFMIN(mafd, diff) / 100., 0, 1);

        select->prev_mafd = mafd;

        avfilter_unref_buffer(prev_picref);

    }

    select->prev_picref = avfilter_ref_buffer(picref, ~0);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid)

 {

static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid)

{

    MXFContext *mxf = arg;

    int item_num = avio_rb32(pb);

    int item_len = avio_rb32(pb);

    if (item_len != 18) {

        av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n");

        return -1;

    }

    if (item_num > UINT_MAX / item_len)

        return -1;

    mxf->local_tags_count = item_num;

    mxf->local_tags = av_malloc(item_num*item_len);

    if (!mxf->local_tags)

        return -1;

    avio_read(pb, mxf->local_tags, item_num*item_len);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,

                  ThreadFrame *ref, const VP56mv *mv,

void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,

                 ThreadFrame *ref, const VP56mv *mv,

                 int x_off, int y_off, int block_w, int block_h,

                 int width, int height, int linesize,

                 vp8_mc_func mc_func[3][3])

{

    uint8_t *src = ref->f->data[0];

    if (AV_RN32A(mv)) {

        int mx = (mv->x << 1)&7, mx_idx = subpel_idx[0][mx];

        int my = (mv->y << 1)&7, my_idx = subpel_idx[0][my];

        x_off += mv->x >> 2;

        y_off += mv->y >> 2;

        // edge emulation

        ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 4, 0);

        src += y_off * linesize + x_off;

        if (x_off < mx_idx || x_off >= width  - block_w - subpel_idx[2][mx] ||

            y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {

            s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize,

                                     block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],

                                     x_off - mx_idx, y_off - my_idx, width, height);

            src = td->edge_emu_buffer + mx_idx + linesize * my_idx;

        }

        mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my);

    } else {

        ff_thread_await_progress(ref, (3 + y_off + block_h) >> 4, 0);

        mc_func[0][0](dst, linesize, src + y_off * linesize + x_off, linesize, block_h, 0, 0);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+strdup(str)

+	const char *str;
+
+{
+
 	char *bptr;

strdup(str)

	const char *str;

{

	char *bptr;

	bptr = (char *)malloc(strlen(str)+1);

	strcpy(bptr, str);

	return bptr;

}


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

     g_assert(!throttle_enabled(&cfg));

+

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

static void test_enabled(void)

{

    int i;

    throttle_config_init(&cfg);

    g_assert(!throttle_enabled(&cfg));

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

        throttle_config_init(&cfg);

        set_cfg_value(false, i, 150);

        g_assert(throttle_enabled(&cfg));

    }

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

        throttle_config_init(&cfg);

        set_cfg_value(false, i, -150);

        g_assert(!throttle_enabled(&cfg));

    }

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+uint32_t HELPER(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)
+
+{
+
+    uint64_t result;
+
+
+
+    shift &= 63;
+
     result = (uint64_t)val << shift;

uint32_t HELPER(shl_cc)(CPUM68KState *env, uint32_t val, uint32_t shift)

{

    uint64_t result;

    shift &= 63;

    result = (uint64_t)val << shift;

    env->cc_c = (result >> 32) & 1;

    env->cc_n = result;

    env->cc_z = result;

    env->cc_v = 0;

    env->cc_x = shift ? env->cc_c : env->cc_x;

    return result;

}


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

 {

+    OpenPICState *opp = opaque;

     uint32_t retval;

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

     retval = 0xFFFFFFFF;

+    if (addr & 0xF) {

         return retval;

static uint64_t openpic_src_read(void *opaque, uint64_t addr, unsigned len)

{

    OpenPICState *opp = opaque;

    uint32_t retval;

    int idx;

    DPRINTF("%s: addr %08x\n", __func__, addr);

    retval = 0xFFFFFFFF;

    if (addr & 0xF) {

        return retval;

    }

    addr = addr & 0xFFF0;

    idx = addr >> 5;

    if (addr & 0x10) {

        /* EXDE / IFEDE / IEEDE */

        retval = read_IRQreg_ide(opp, idx);

    } else {

        /* EXVP / IFEVP / IEEVP */

        retval = read_IRQreg_ipvp(opp, idx);

    }

    DPRINTF("%s: => %08x\n", __func__, retval);

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void pci_error_message(Monitor *mon)

 {

static void pci_error_message(Monitor *mon)

{

    monitor_printf(mon, "PCI devices not supported\n");

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void enable_device(PIIX4PMState *s, int slot)

+{

     s->ar.gpe.sts[0] |= PIIX4_PCI_HOTPLUG_STATUS;

static void enable_device(PIIX4PMState *s, int slot)

{

    s->ar.gpe.sts[0] |= PIIX4_PCI_HOTPLUG_STATUS;

    s->pci0_status.up |= (1 << slot);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void virtio_scsi_handle_ctrl_req(VirtIOSCSI *s, VirtIOSCSIReq *req)

 {

void virtio_scsi_handle_ctrl_req(VirtIOSCSI *s, VirtIOSCSIReq *req)

{

    VirtIODevice *vdev = (VirtIODevice *)s;

    uint32_t type;

    int r = 0;

    if (iov_to_buf(req->elem.out_sg, req->elem.out_num, 0,

                &type, sizeof(type)) < sizeof(type)) {

        virtio_scsi_bad_req();

        return;

    }

    virtio_tswap32s(vdev, &type);

    if (type == VIRTIO_SCSI_T_TMF) {

        if (virtio_scsi_parse_req(req, sizeof(VirtIOSCSICtrlTMFReq),

                    sizeof(VirtIOSCSICtrlTMFResp)) < 0) {

            virtio_scsi_bad_req();

        } else {

            r = virtio_scsi_do_tmf(s, req);

        }

    } else if (type == VIRTIO_SCSI_T_AN_QUERY ||

               type == VIRTIO_SCSI_T_AN_SUBSCRIBE) {

        if (virtio_scsi_parse_req(req, sizeof(VirtIOSCSICtrlANReq),

                    sizeof(VirtIOSCSICtrlANResp)) < 0) {

            virtio_scsi_bad_req();

        } else {

            req->resp.an.event_actual = 0;

            req->resp.an.response = VIRTIO_SCSI_S_OK;

        }

    }

    if (r == 0) {

        virtio_scsi_complete_req(req);

    } else {

        assert(r == -EINPROGRESS);

    }

}


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

                               unsigned len)

+{

     OpenPICState *opp = opaque;

static void openpic_src_write(void *opaque, hwaddr addr, uint64_t val,

                              unsigned len)

{

    OpenPICState *opp = opaque;

    int idx;

    DPRINTF("%s: addr %08x <= %08x\n", __func__, addr, val);

    if (addr & 0xF)

        return;

    addr = addr & 0xFFF0;

    idx = addr >> 5;

    if (addr & 0x10) {

        /* EXDE / IFEDE / IEEDE */

        write_IRQreg_ide(opp, idx, val);

    } else {

        /* EXVP / IFEVP / IEEVP */

        write_IRQreg_ipvp(opp, idx, val);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline void cris_fidx_d(unsigned int x)

 {

static inline void cris_fidx_d(unsigned int x)

{

	register unsigned int v asm("$r10") = x;

	asm ("fidxd\t[%0]\n" : : "r" (v) );

}


--- a/source.c
+++ b/source.c
@@ -29,9 +29,9 @@
     /* Pseudo-stereo - just copy left channel to right channel */

     if (ctx->channels == 2) {
+
+        memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1]));
+
+    }
+
 }

static void ape_unpack_mono(APEContext *ctx, int count)

{

    if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {

        /* We are pure silence, so we're done. */

        av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n");

        return;

    }

    entropy_decode(ctx, count, 0);

    ape_apply_filters(ctx, ctx->decoded[0], NULL, count);

    /* Now apply the predictor decoding */

    predictor_decode_mono(ctx, count);

    /* Pseudo-stereo - just copy left channel to right channel */

    if (ctx->channels == 2) {

        memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1]));

    }

}


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

     memory_region_init_io(&s->iomem, &malta_fpga_ops, s,
+
+                          "malta-fpga", 0x100000);
+
+    memory_region_init_alias(&s->iomem_lo, "malta-fpga",
+
                              &s->iomem, 0, 0x900);

     memory_region_init_alias(&s->iomem_hi, "malta-fpga",

static MaltaFPGAState *malta_fpga_init(MemoryRegion *address_space,

         target_phys_addr_t base, qemu_irq uart_irq, CharDriverState *uart_chr)

{

    MaltaFPGAState *s;

    s = (MaltaFPGAState *)g_malloc0(sizeof(MaltaFPGAState));

    memory_region_init_io(&s->iomem, &malta_fpga_ops, s,

                          "malta-fpga", 0x100000);

    memory_region_init_alias(&s->iomem_lo, "malta-fpga",

                             &s->iomem, 0, 0x900);

    memory_region_init_alias(&s->iomem_hi, "malta-fpga",

                             &s->iomem, 0xa00, 0x10000-0xa00);

    memory_region_add_subregion(address_space, base, &s->iomem_lo);

    memory_region_add_subregion(address_space, base + 0xa00, &s->iomem_hi);

    s->display = qemu_chr_new("fpga", "vc:320x200", malta_fpga_led_init);

    s->uart = serial_mm_init(address_space, base + 0x900, 3, uart_irq,

                             230400, uart_chr, DEVICE_NATIVE_ENDIAN);

    malta_fpga_reset(s);

    qemu_register_reset(malta_fpga_reset, s);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void gen_spr_vtb(CPUPPCState *env)

+{
+
+    spr_register(env, SPR_VTB, "VTB",

                  SPR_NOACCESS, SPR_NOACCESS,

static void gen_spr_vtb(CPUPPCState *env)

{

    spr_register(env, SPR_VTB, "VTB",

                 SPR_NOACCESS, SPR_NOACCESS,

                 &spr_read_tbl, SPR_NOACCESS,

                 0x00000000);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void cabac_init_decoder(HEVCContext *s)

 {

+    GetBitContext *gb = &s->HEVClc->gb;

     skip_bits(gb, 1);

static void cabac_init_decoder(HEVCContext *s)

{

    GetBitContext *gb = &s->HEVClc->gb;

    skip_bits(gb, 1);

    align_get_bits(gb);

    ff_init_cabac_decoder(&s->HEVClc->cc,

                          gb->buffer + get_bits_count(gb) / 8,

                          (get_bits_left(gb) + 7) / 8);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)

 {
+
     int dom, bus;

     unsigned slot;

PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)

{

    int dom, bus;

    unsigned slot;

    assert(!root->parent_dev);

    if (!root) {

        fprintf(stderr, "No primary PCI bus\n");

        return NULL;

    }

    if (!devaddr) {

        *devfnp = -1;

        return pci_find_bus_nr(root, 0);

    }

    if (pci_parse_devaddr(devaddr, &dom, &bus, &slot, NULL) < 0) {

        return NULL;

    }

    if (dom != 0) {

        fprintf(stderr, "No support for non-zero PCI domains\n");

        return NULL;

    }

    *devfnp = PCI_DEVFN(slot, 0);

    return pci_find_bus_nr(root, bus);

}


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

 {

+    DeviceState *dev;

     SysBusDevice *s;

static void idreg_init(target_phys_addr_t addr)

{

    DeviceState *dev;

    SysBusDevice *s;

    dev = qdev_create(NULL, "macio_idreg");

    qdev_init(dev);

    s = sysbus_from_qdev(dev);

    sysbus_mmio_map(s, 0, addr);

    cpu_physical_memory_write_rom(addr, idreg_data, sizeof(idreg_data));

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void apply_mdct(AC3EncodeContext *s)

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

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

static void apply_mdct(AC3EncodeContext *s)

{

    int blk, ch;

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

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

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

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

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

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

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

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         mr = piolist->regions[i];

         alias = piolist->aliases[i];
+
+        memory_region_del_subregion(piolist->address_space, alias);
+
+        memory_region_destroy(alias);
+
         memory_region_destroy(mr);

         g_free((MemoryRegionOps *)mr->ops);

void portio_list_del(PortioList *piolist)

{

    MemoryRegion *mr, *alias;

    unsigned i;

    for (i = 0; i < piolist->nr; ++i) {

        mr = piolist->regions[i];

        alias = piolist->aliases[i];

        memory_region_del_subregion(piolist->address_space, alias);

        memory_region_destroy(alias);

        memory_region_destroy(mr);

        g_free((MemoryRegionOps *)mr->ops);

        g_free(mr);

        g_free(alias);

        piolist->regions[i] = NULL;

        piolist->aliases[i] = NULL;

    }

}


static void bl_intrp(EVRCContext *e, float *ex, float delay)

{

    float *f;

    int offset, i, coef_idx;

    int16_t t;

    offset = lrintf(fabs(delay));

    t = (offset - delay + 0.5) * 8.0 + 0.5;

    if (t == 8) {

        t = 0;

        offset--;

    }

    f = ex - offset - 8;

    coef_idx = t * (2 * 8 + 1);

    ex[0] = 0.0;

    for (i = 0; i < 2 * 8 + 1; i++)

        ex[0] += e->interpolation_coeffs[coef_idx + i] * f[i];

}


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

     codec = hda_codec_find(&d->codecs, cad);
+
+    if (codec == NULL) {
+
+        dprint(d, 1, "%s: addressed non-existing codec\n", __FUNCTION__);
+
         return -1;

     }

static int intel_hda_send_command(IntelHDAState *d, uint32_t verb)

{

    uint32_t cad, nid, data;

    HDACodecDevice *codec;

    HDACodecDeviceClass *cdc;

    cad = (verb >> 28) & 0x0f;

    if (verb & (1 << 27)) {

        /* indirect node addressing, not specified in HDA 1.0 */

        dprint(d, 1, "%s: indirect node addressing (guest bug?)\n", __FUNCTION__);

        return -1;

    }

    nid = (verb >> 20) & 0x7f;

    data = verb & 0xfffff;

    codec = hda_codec_find(&d->codecs, cad);

    if (codec == NULL) {

        dprint(d, 1, "%s: addressed non-existing codec\n", __FUNCTION__);

        return -1;

    }

    cdc = HDA_CODEC_DEVICE_GET_CLASS(codec);

    cdc->command(codec, nid, data);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void pty_chr_read(void *opaque)
+
+{
+
+    CharDriverState *chr = opaque;

     PtyCharDriver *s = chr->opaque;

static void pty_chr_read(void *opaque)

{

    CharDriverState *chr = opaque;

    PtyCharDriver *s = chr->opaque;

    int size, len;

    uint8_t buf[1024];

    len = sizeof(buf);

    if (len > s->read_bytes)

        len = s->read_bytes;

    if (len == 0)

        return;

    size = read(s->fd, buf, len);

    if ((size == -1 && errno == EIO) ||

        (size == 0)) {

        pty_chr_state(chr, 0);

        return;

    }

    if (size > 0) {

        pty_chr_state(chr, 1);

        qemu_chr_read(chr, buf, size);

    }

}


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

                      const uint8_t *buf, int nb_sectors)
+
 {

     BDRVQcowState *s = bs->opaque;

     int ret, index_in_cluster, n;
+
     uint64_t cluster_offset;

     int n_end;
@@ -15,7 +15,7 @@

     while (nb_sectors > 0) {
+
         index_in_cluster = sector_num & (s->cluster_sectors - 1);

         n_end = index_in_cluster + nb_sectors;

static int qcow_write(BlockDriverState *bs, int64_t sector_num,

                     const uint8_t *buf, int nb_sectors)

{

    BDRVQcowState *s = bs->opaque;

    int ret, index_in_cluster, n;

    uint64_t cluster_offset;

    int n_end;

    while (nb_sectors > 0) {

        index_in_cluster = sector_num & (s->cluster_sectors - 1);

        n_end = index_in_cluster + nb_sectors;

        if (s->crypt_method &&

            n_end > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors)

            n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors;

        cluster_offset = alloc_cluster_offset(bs, sector_num << 9,

                                              index_in_cluster,

                                              n_end, &n);

        if (!cluster_offset)

            return -1;

        if (s->crypt_method) {

            encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1,

                            &s->aes_encrypt_key);

            ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512,

                              s->cluster_data, n * 512);

        } else {

            ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512);

        }

        if (ret != n * 512)

            return -1;

        nb_sectors -= n;

        sector_num += n;

        buf += n * 512;

    }

    s->cluster_cache_offset = -1; /* disable compressed cache */

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         if (value == 1 || value == 2) {

             qemu_system_reset_request();
+
+        } else if (value == 3) {
+
+            qemu_system_shutdown_request();
+
         }

     }

static void hb_regs_write(void *opaque, target_phys_addr_t offset,

                          uint64_t value, unsigned size)

{

    uint32_t *regs = opaque;

    if (offset == 0xf00) {

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

            qemu_system_reset_request();

        } else if (value == 3) {

            qemu_system_shutdown_request();

        }

    }

    regs[offset/4] = value;

}


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

     MSIMessage msg;
+
+
+
+    if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector])
+
         return;

     if (msix_is_masked(dev, vector)) {

void msix_notify(PCIDevice *dev, unsigned vector)

{

    MSIMessage msg;

    if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector])

        return;

    if (msix_is_masked(dev, vector)) {

        msix_set_pending(dev, vector);

        return;

    }

    msg = msix_get_message(dev, vector);

    stl_le_phys(&address_space_memory, msg.address, msg.data);

}


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

     case MPC8544_GUTS_ADDR_RSTCR:
+
+        if (value & MPC8544_GUTS_RSTCR_RESET) {
+
+            qemu_system_reset_request();
+
         }

         break;

static void mpc8544_guts_write(void *opaque, target_phys_addr_t addr,

                               uint64_t value, unsigned size)

{

    addr &= MPC8544_GUTS_MMIO_SIZE - 1;

    switch (addr) {

    case MPC8544_GUTS_ADDR_RSTCR:

        if (value & MPC8544_GUTS_RSTCR_RESET) {

            qemu_system_reset_request();

        }

        break;

    default:

        fprintf(stderr, "guts: Unknown register write: %x = %x\n",

                (int)addr, (unsigned)value);

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int vda_h264_uninit(AVCodecContext *avctx)

+{
+
     VDAContext *vda = avctx->internal->hwaccel_priv_data;

     av_freep(&vda->bitstream);

static int vda_h264_uninit(AVCodecContext *avctx)

{

    VDAContext *vda = avctx->internal->hwaccel_priv_data;

    av_freep(&vda->bitstream);

    if (vda->frame)

        CVPixelBufferRelease(vda->frame);

    return 0;

}


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

     if (avpriv_mpeg4audio_get_config(&mp4ac, codec->extradata,
+
+                                     codec->extradata_size * 8, 1) < 0) {
+
+        av_log(s, AV_LOG_WARNING,
+
                "Error parsing AAC extradata, unable to determine samplerate.\n");

         return;

static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec,

                                 int *sample_rate, int *output_sample_rate)

{

    MPEG4AudioConfig mp4ac;

    if (avpriv_mpeg4audio_get_config(&mp4ac, codec->extradata,

                                     codec->extradata_size * 8, 1) < 0) {

        av_log(s, AV_LOG_WARNING,

               "Error parsing AAC extradata, unable to determine samplerate.\n");

        return;

    }

    *sample_rate        = mp4ac.sample_rate;

    *output_sample_rate = mp4ac.ext_sample_rate;

}