static void FUNCC(pred8x8l_horizontal)(uint8_t *p_src, int has_topleft, int has_topright, int p_stride)

{

    pixel *src = (pixel*)p_src;

    int stride = p_stride>>(sizeof(pixel)-1);

    PREDICT_8x8_LOAD_LEFT;

#define ROW(y) ((pixel4*)(src+y*stride))[0] =\

               ((pixel4*)(src+y*stride))[1] = PIXEL_SPLAT_X4(l##y)

    ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7);

#undef ROW

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static void colo_old_packet_check_one_conn(void *opaque,
+
                                            void *user_data)

 {

static void colo_old_packet_check_one_conn(void *opaque,

                                           void *user_data)

{

    Connection *conn = opaque;

    GList *result = NULL;

    int64_t check_time = REGULAR_PACKET_CHECK_MS;

    result = g_queue_find_custom(&conn->primary_list,

                                 &check_time,

                                 (GCompareFunc)colo_old_packet_check_one);

    if (result) {

        /* do checkpoint will flush old packet */

        /* TODO: colo_notify_checkpoint();*/

    }

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
         lp->ptr = phys_map_node_alloc();

         p = next_map.nodes[lp->ptr];
+
+        if (level == 0) {
+
+            for (i = 0; i < P_L2_SIZE; i++) {
+
                 p[i].skip = 0;

                 p[i].ptr = PHYS_SECTION_UNASSIGNED;

static void phys_page_set_level(PhysPageEntry *lp, hwaddr *index,

                                hwaddr *nb, uint16_t leaf,

                                int level)

{

    PhysPageEntry *p;

    int i;

    hwaddr step = (hwaddr)1 << (level * P_L2_BITS);

    if (lp->skip && lp->ptr == PHYS_MAP_NODE_NIL) {

        lp->ptr = phys_map_node_alloc();

        p = next_map.nodes[lp->ptr];

        if (level == 0) {

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

                p[i].skip = 0;

                p[i].ptr = PHYS_SECTION_UNASSIGNED;

            }

        }

    } else {

        p = next_map.nodes[lp->ptr];

    }

    lp = &p[(*index >> (level * P_L2_BITS)) & (P_L2_SIZE - 1)];

    while (*nb && lp < &p[P_L2_SIZE]) {

        if ((*index & (step - 1)) == 0 && *nb >= step) {

            lp->skip = 0;

            lp->ptr = leaf;

            *index += step;

            *nb -= step;

        } else {

            phys_page_set_level(lp, index, nb, leaf, level - 1);

        }

        ++lp;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int print_int32(DeviceState *dev, Property *prop, char *dest, size_t len)
+
+{

     int32_t *ptr = qdev_get_prop_ptr(dev, prop);

static int print_int32(DeviceState *dev, Property *prop, char *dest, size_t len)

{

    int32_t *ptr = qdev_get_prop_ptr(dev, prop);

    return snprintf(dest, len, "%" PRId32, *ptr);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static inline void menelaus_rtc_start(MenelausState *s)

 {
+
+    s->rtc.next += qemu_get_clock(rt_clock);

     qemu_mod_timer(s->rtc.hz_tm, s->rtc.next);

static inline void menelaus_rtc_start(MenelausState *s)

{

    s->rtc.next += qemu_get_clock(rt_clock);

    qemu_mod_timer(s->rtc.hz_tm, s->rtc.next);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest)
+
+{

     int size = av_fifo_size(f);

int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest)

{

    int size = av_fifo_size(f);

    if (size < buf_size)

        return -1;

    do {

        int len = FFMIN(f->end - f->rptr, buf_size);

        if(func) func(dest, f->rptr, len);

        else{

            memcpy(dest, f->rptr, len);

            dest = (uint8_t*)dest + len;

        }

        av_fifo_drain(f, len);

        buf_size -= len;

    } while (buf_size > 0);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static void memory_region_oldmmio_write_accessor(MemoryRegion *mr,
+
                                                  hwaddr addr,

                                                  uint64_t *value,

static void memory_region_oldmmio_write_accessor(MemoryRegion *mr,

                                                 hwaddr addr,

                                                 uint64_t *value,

                                                 unsigned size,

                                                 unsigned shift,

                                                 uint64_t mask)

{

    uint64_t tmp;

    tmp = (*value >> shift) & mask;

    trace_memory_region_ops_write(mr, addr, tmp, size);

    mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp);

}


--- a/source.c
+++ b/source.c
@@ -19,7 +19,7 @@
         env->QF = ((val & CPSR_Q) != 0);

     if (mask & CPSR_T)
+
         env->thumb = ((val & CPSR_T) != 0);

     if (mask & CPSR_IT_0_1) {

void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)

{

    if (mask & CPSR_NZCV) {

        env->ZF = (~val) & CPSR_Z;

        env->NF = val;

        env->CF = (val >> 29) & 1;

        env->VF = (val << 3) & 0x80000000;

    }

    if (mask & CPSR_Q)

        env->QF = ((val & CPSR_Q) != 0);

    if (mask & CPSR_T)

        env->thumb = ((val & CPSR_T) != 0);

    if (mask & CPSR_IT_0_1) {

        env->condexec_bits &= ~3;

        env->condexec_bits |= (val >> 25) & 3;

    }

    if (mask & CPSR_IT_2_7) {

        env->condexec_bits &= 3;

        env->condexec_bits |= (val >> 8) & 0xfc;

    }

    if (mask & CPSR_GE) {

        env->GE = (val >> 16) & 0xf;

    }

    if ((env->uncached_cpsr ^ val) & mask & CPSR_M) {

        switch_mode(env, val & CPSR_M);

    }

    mask &= ~CACHED_CPSR_BITS;

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

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int dxv_decompress_raw(AVCodecContext *avctx)
 {
     DXVContext *ctx = avctx->priv_data;
     GetByteContext *gbc = &ctx->gbc;

static int dxv_decompress_raw(AVCodecContext *avctx)
{
    DXVContext *ctx = avctx->priv_data;
    GetByteContext *gbc = &ctx->gbc;
    bytestream2_get_buffer(gbc, ctx->tex_data, ctx->tex_size);
    return 0;
}


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

+    pcms->nvdimm = value;
+
 }

static void pc_machine_set_nvdimm(Object *obj, bool value, Error **errp)

{

    PCMachineState *pcms = PC_MACHINE(obj);

    pcms->nvdimm = value;

}


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

     view = as->current_map;
+
+    FOR_EACH_FLAT_RANGE(fr, view) {
+
+        MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, log_sync);

     }

void address_space_sync_dirty_bitmap(AddressSpace *as)

{

    FlatView *view;

    FlatRange *fr;

    view = as->current_map;

    FOR_EACH_FLAT_RANGE(fr, view) {

        MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, log_sync);

    }

}


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

         /* if an option with name opt_names[i] is present in opts_ctx then str is non-NULL */

+        if(str && ((opt->flags & flags) == flags))
+
+            av_set_string3(ctx, opt_names[i], str, 1, NULL);
+
+        /* We need to use a differnt system to pass options to the private context because

            it is not known which codec and thus context kind that will be when parsing options

void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec)

{

    int i;

    void *priv_ctx=NULL;

    if(!strcmp("AVCodecContext", (*(AVClass**)ctx)->class_name)){

        AVCodecContext *avctx= ctx;

        if(codec && codec->priv_class && avctx->priv_data){

            priv_ctx= avctx->priv_data;

        }

    } else if (!strcmp("AVFormatContext", (*(AVClass**)ctx)->class_name)) {

        AVFormatContext *avctx = ctx;

        if (avctx->oformat && avctx->oformat->priv_class) {

            priv_ctx = avctx->priv_data;

        }

    }

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

        char buf[256];

        const AVOption *opt;

        const char *str= av_get_string(opts_ctx, opt_names[i], &opt, buf, sizeof(buf));

        /* if an option with name opt_names[i] is present in opts_ctx then str is non-NULL */

        if(str && ((opt->flags & flags) == flags))

            av_set_string3(ctx, opt_names[i], str, 1, NULL);

        /* We need to use a differnt system to pass options to the private context because

           it is not known which codec and thus context kind that will be when parsing options

           we thus use opt_values directly instead of opts_ctx */

        if(!str && priv_ctx) {

            if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags))

                av_set_string3(priv_ctx, opt_names[i], opt_values[i], 0, NULL);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static QString *read_line(FILE *file, char *key)

+{

     char value[128];

static QString *read_line(FILE *file, char *key)

{

    char value[128];

    if (fscanf(file, "%s%s", key, value) == EOF)

        return NULL;

    remove_dots(key);

    return qstring_from_str(value);

}


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

         goto badframe;

+    }
+
+
+
+    if (do_sigaltstack(frame_addr +

             offsetof(struct target_rt_sigframe, uc.tuc_stack),

long do_rt_sigreturn(CPUARMState *env)

{

    struct target_rt_sigframe *frame = NULL;

    abi_ulong frame_addr = env->xregs[31];

    trace_user_do_rt_sigreturn(env, frame_addr);

    if (frame_addr & 15) {

        goto badframe;

    }

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

        goto badframe;

    }

    if (target_restore_sigframe(env, frame)) {

        goto badframe;

    }

    if (do_sigaltstack(frame_addr +

            offsetof(struct target_rt_sigframe, uc.tuc_stack),

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

        goto badframe;

    }

    unlock_user_struct(frame, frame_addr, 0);

    return env->xregs[0];

 badframe:

    unlock_user_struct(frame, frame_addr, 0);

    force_sig(TARGET_SIGSEGV);

    return 0;

}


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

 again:
+
+    entry = readdir(fs->dir.stream);
+
+    if (!entry) {
+
         return NULL;

     }

static struct dirent *local_readdir(FsContext *ctx, V9fsFidOpenState *fs)

{

    struct dirent *entry;

again:

    entry = readdir(fs->dir.stream);

    if (!entry) {

        return NULL;

    }

    if (ctx->export_flags & V9FS_SM_MAPPED) {

        entry->d_type = DT_UNKNOWN;

    } else if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {

        if (local_is_mapped_file_metadata(ctx, entry->d_name)) {

            /* skip the meta data directory */

            goto again;

        }

        entry->d_type = DT_UNKNOWN;

    }

    return entry;

}


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

+{
+
+    char *buffer;

     char *path = fs_path->data;

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

                      int flags, V9fsFidOpenState *fs)

{

    char *buffer;

    char *path = fs_path->data;

    int fd;

    buffer = rpath(ctx, path);

    fd = open(buffer, flags | O_NOFOLLOW);

    g_free(buffer);

    if (fd == -1) {

        return -1;

    }

    fs->fd = fd;

    return fs->fd;

}


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

 {

+    DeviceState *dev = DEVICE(sbd);

     struct omap_intr_handler_s *s = OMAP_INTC(dev);

static int omap_intc_init(SysBusDevice *sbd)

{

    DeviceState *dev = DEVICE(sbd);

    struct omap_intr_handler_s *s = OMAP_INTC(dev);

    if (!s->iclk) {

        hw_error("omap-intc: clk not connected\n");

    }

    s->nbanks = 1;

    sysbus_init_irq(sbd, &s->parent_intr[0]);

    sysbus_init_irq(sbd, &s->parent_intr[1]);

    qdev_init_gpio_in(dev, omap_set_intr, s->nbanks * 32);

    memory_region_init_io(&s->mmio, OBJECT(s), &omap_inth_mem_ops, s,

                          "omap-intc", s->size);

    sysbus_init_mmio(sbd, &s->mmio);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,19 +1,19 @@
 static inline uint16_t mipsdsp_lshift16(uint16_t a, uint8_t s,
+
                                         CPUMIPSState *env)
+
+{

+    uint8_t  sign;
+
+    uint16_t discard;

+

     if (s == 0) {

         return a;
+
     } else {

         sign = (a >> 15) & 0x01;

static inline uint16_t mipsdsp_lshift16(uint16_t a, uint8_t s,

                                        CPUMIPSState *env)

{

    uint8_t  sign;

    uint16_t discard;

    if (s == 0) {

        return a;

    } else {

        sign = (a >> 15) & 0x01;

        if (sign != 0) {

            discard = (((0x01 << (16 - s)) - 1) << s) |

                      ((a >> (14 - (s - 1))) & ((0x01 << s) - 1));

        } else {

            discard = a >> (14 - (s - 1));

        }

        if ((discard != 0x0000) && (discard != 0xFFFF)) {

            set_DSPControl_overflow_flag(1, 22, env);

        }

        return a << s;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void stream_pause(VideoState *is)
+
+{

+    is->paused = !is->paused;

+    if (!is->paused) {
+
         if(is->read_pause_return != AVERROR(ENOSYS)){

             is->video_current_pts = get_video_clock(is);

static void stream_pause(VideoState *is)

{

    is->paused = !is->paused;

    if (!is->paused) {

        if(is->read_pause_return != AVERROR(ENOSYS)){

            is->video_current_pts = get_video_clock(is);

        }

        is->frame_timer += (av_gettime() - is->video_current_pts_time) / 1000000.0;

        is->video_current_pts_time= av_gettime();

    }

}


static void t_gen_muls(TCGv d, TCGv d2, TCGv a, TCGv b)

{

	TCGv t0, t1;

	t0 = tcg_temp_new(TCG_TYPE_I64);

	t1 = tcg_temp_new(TCG_TYPE_I64);

	tcg_gen_ext32s_i64(t0, a);

	tcg_gen_ext32s_i64(t1, b);

	tcg_gen_mul_i64(t0, t0, t1);

	tcg_gen_trunc_i64_i32(d, t0);

	tcg_gen_shri_i64(t0, t0, 32);

	tcg_gen_trunc_i64_i32(d2, t0);

	tcg_temp_free(t0);

	tcg_temp_free(t1);

}


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

         default:

+            IVSHMEM_DPRINTF("why are we reading " TARGET_FMT_plx "\n", addr);
+
+            ret = 0;
+
+    }

static uint64_t ivshmem_io_read(void *opaque, target_phys_addr_t addr,

                                unsigned size)

{

    IVShmemState *s = opaque;

    uint32_t ret;

    switch (addr)

    {

        case INTRMASK:

            ret = ivshmem_IntrMask_read(s);

            break;

        case INTRSTATUS:

            ret = ivshmem_IntrStatus_read(s);

            break;

        case IVPOSITION:

            /* return my VM ID if the memory is mapped */

            if (s->shm_fd > 0) {

                ret = s->vm_id;

            } else {

                ret = -1;

            }

            break;

        default:

            IVSHMEM_DPRINTF("why are we reading " TARGET_FMT_plx "\n", addr);

            ret = 0;

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode)

+{

     int fd, ret;

static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode)

{

    int fd, ret;

    /* FIXME: this should be handled with fchmodat(AT_SYMLINK_NOFOLLOW).

     * Unfortunately, the linux kernel doesn't implement it yet. As an

     * alternative, let's open the file and use fchmod() instead. This

     * may fail depending on the permissions of the file, but it is the

     * best we can do to avoid TOCTTOU. We first try to open read-only

     * in case name points to a directory. If that fails, we try write-only

     * in case name doesn't point to a directory.

     */

    fd = openat_file(dirfd, name, O_RDONLY, 0);

    if (fd == -1) {

        /* In case the file is writable-only and isn't a directory. */

        if (errno == EACCES) {

            fd = openat_file(dirfd, name, O_WRONLY, 0);

        }

        if (fd == -1 && errno == EISDIR) {

            errno = EACCES;

        }

    }

    if (fd == -1) {

        return -1;

    }

    ret = fchmod(fd, mode);

    close_preserve_errno(fd);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void do_compute_hflags (CPUPPCState *env)
+
+{
+
     /* Compute current hflags */

     env->hflags = (msr_pr << MSR_PR) | (msr_le << MSR_LE) |

void do_compute_hflags (CPUPPCState *env)

{

    /* Compute current hflags */

    env->hflags = (msr_pr << MSR_PR) | (msr_le << MSR_LE) |

        (msr_fp << MSR_FP) | (msr_fe0 << MSR_FE0) | (msr_fe1 << MSR_FE1) |

        (msr_vr << MSR_VR) | (msr_ap << MSR_AP) | (msr_sa << MSR_SA) |

        (msr_se << MSR_SE) | (msr_be << MSR_BE);

#if defined (TARGET_PPC64)

    env->hflags |= (msr_sf << MSR_SF) | (msr_hv << MSR_HV);

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+unsigned int av_codec_get_tag(const AVCodecTag *tags[4], enum CodecID id)
+
+{
+
     int i;

     for(i=0; i<4 && tags[i]; i++){

unsigned int av_codec_get_tag(const AVCodecTag *tags[4], enum CodecID id)

{

    int i;

    for(i=0; i<4 && tags[i]; i++){

        int tag= codec_get_tag(tags[i], id);

        if(tag) return tag;

    }

    return 0;

}


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

     MMIOState *s = opaque;
+
+    addr >>= s->shift;
+
+    if (addr & 7)

         return ide_ioport_read(&s->bus, addr);

static uint64_t mmio_ide_read(void *opaque, target_phys_addr_t addr,

                              unsigned size)

{

    MMIOState *s = opaque;

    addr >>= s->shift;

    if (addr & 7)

        return ide_ioport_read(&s->bus, addr);

    else

        return ide_data_readw(&s->bus, 0);

}


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
     dprintf("handle_instruction 0x%x 0x%x\n", run->s390_sieic.ipa, run->s390_sieic.ipb);

     switch (ipa0) {
+
         case IPA0_PRIV:

             r = handle_priv(env, run, ipa1);

static int handle_instruction(CPUState *env, struct kvm_run *run)

{

    unsigned int ipa0 = (run->s390_sieic.ipa & 0xff00);

    uint8_t ipa1 = run->s390_sieic.ipa & 0x00ff;

    int ipb_code = (run->s390_sieic.ipb & 0x0fff0000) >> 16;

    int r = -1;

    dprintf("handle_instruction 0x%x 0x%x\n", run->s390_sieic.ipa, run->s390_sieic.ipb);

    switch (ipa0) {

        case IPA0_PRIV:

            r = handle_priv(env, run, ipa1);

            break;

        case IPA0_DIAG:

            r = handle_diag(env, run, ipb_code);

            break;

        case IPA0_SIGP:

            r = handle_sigp(env, run, ipa1);

            break;

    }

    if (r < 0) {

        enter_pgmcheck(env, 0x0001);

    }

    return r;

}


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

 {
+
+    MemoryRegion *mr;
+
+    Error *local_err = NULL;
+

     mr = host_memory_backend_get_memory(MEMORY_BACKEND(val), &local_err);

static void pc_dimm_check_memdev_is_busy(Object *obj, const char *name,

                                      Object *val, Error **errp)

{

    MemoryRegion *mr;

    Error *local_err = NULL;

    mr = host_memory_backend_get_memory(MEMORY_BACKEND(val), &local_err);

    if (local_err) {

        goto out;

    }

    if (memory_region_is_mapped(mr)) {

        char *path = object_get_canonical_path_component(val);

        error_setg(&local_err, "can't use already busy memdev: %s", path);

        g_free(path);

    } else {

        qdev_prop_allow_set_link_before_realize(obj, name, val, &local_err);

    }

out:

    error_propagate(errp, local_err);

}


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

         int top    = y + f;

+        int bottom = y + h + f;
+
+        if (p_x > right) {
+
+            x += p_x - right;

         } else if (p_x < left) {

static int xcbgrab_reposition(AVFormatContext *s,

                              xcb_query_pointer_reply_t *p,

                              xcb_get_geometry_reply_t *geo)

{

    XCBGrabContext *c = s->priv_data;

    int x = c->x, y = c->y, p_x = p->win_x, p_y = p->win_y;

    int w = c->width, h = c->height, f = c->follow_mouse;

    if (!p || !geo)

        return AVERROR(EIO);

    if (f == FOLLOW_CENTER) {

        x = p_x - w / 2;

        y = p_y - h / 2;

    } else {

        int left   = x + f;

        int right  = x + w - f;

        int top    = y + f;

        int bottom = y + h + f;

        if (p_x > right) {

            x += p_x - right;

        } else if (p_x < left) {

            x -= left - p_x;

        }

        if (p_y > bottom) {

            y += p_y - bottom;

        } else if (p_y < top) {

            y -= top - p_y;

        }

    }

    c->x = FFMIN(FFMAX(0, x), geo->width  - w);

    c->y = FFMIN(FFMAX(0, y), geo->height - h);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,

+                                         unsigned long *bitmap)

 {

static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,

                                         unsigned long *bitmap)

{

    unsigned int i, j;

    unsigned long page_number, addr, addr1, c;

    unsigned int len = ((section->size / TARGET_PAGE_SIZE) + HOST_LONG_BITS - 1) / HOST_LONG_BITS;

    /*

     * bitmap-traveling is faster than memory-traveling (for addr...)

     * especially when most of the memory is not dirty.

     */

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

        if (bitmap[i] != 0) {

            c = leul_to_cpu(bitmap[i]);

            do {

                j = ffsl(c) - 1;

                c &= ~(1ul << j);

                page_number = i * HOST_LONG_BITS + j;

                addr1 = page_number * TARGET_PAGE_SIZE;

                addr = section->offset_within_region + addr1;

                memory_region_set_dirty(section->mr, addr);

            } while (c != 0);

        }

    }

    return 0;

}


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

 {

+    uint32_t addr;
+
+    uint32_t mask;
+
+    uint32_t v;

     addr = bitband_addr(opaque, offset) & ~3;

static void bitband_writel(void *opaque, target_phys_addr_t offset,

                           uint32_t value)

{

    uint32_t addr;

    uint32_t mask;

    uint32_t v;

    addr = bitband_addr(opaque, offset) & ~3;

    mask = (1 << ((offset >> 2) & 31));

    mask = tswap32(mask);

    cpu_physical_memory_read(addr, (uint8_t *)&v, 4);

    if (value & 1)

        v |= mask;

    else

        v &= ~mask;

    cpu_physical_memory_write(addr, (uint8_t *)&v, 4);

}


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

     av_assert0(AV_SAMPLE_FMT_DBLP == 9);

+    av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4);
+
+    av_assert0(AV_PICTURE_TYPE_BI == 7);
+
+    av_assert0(LIBAVUTIL_VERSION_MICRO >= 100);

     av_assert0(HAVE_MMX2 == HAVE_MMXEXT);

unsigned avutil_version(void)

{

    av_assert0(AV_PIX_FMT_VDA_VLD == 81); //check if the pix fmt enum has not had anything inserted or removed by mistake

    av_assert0(AV_SAMPLE_FMT_DBLP == 9);

    av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4);

    av_assert0(AV_PICTURE_TYPE_BI == 7);

    av_assert0(LIBAVUTIL_VERSION_MICRO >= 100);

    av_assert0(HAVE_MMX2 == HAVE_MMXEXT);

    if (av_sat_dadd32(1, 2) != 5) {

        av_log(NULL, AV_LOG_FATAL, "Libavutil has been build with a broken binutils, please upgrade binutils and rebuild\n");

        abort();

    }

    ff_check_pixfmt_descriptors();

    return LIBAVUTIL_VERSION_INT;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+uint8_t qpci_io_readb(QPCIDevice *dev, void *data)
+
+{
+
     uintptr_t addr = (uintptr_t)data;

+

     if (addr < QPCI_PIO_LIMIT) {

uint8_t qpci_io_readb(QPCIDevice *dev, void *data)

{

    uintptr_t addr = (uintptr_t)data;

    if (addr < QPCI_PIO_LIMIT) {

        return dev->bus->pio_readb(dev->bus, addr);

    } else {

        uint8_t val;

        dev->bus->memread(dev->bus, addr, &val, sizeof(val));

        return val;

    }

}


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

         virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_TSO6);

+        virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_ECN);
+
+    }
+
+

     if (!peer_has_vnet_hdr(n) || !peer_has_ufo(n)) {

static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,

                                        Error **errp)

{

    VirtIONet *n = VIRTIO_NET(vdev);

    NetClientState *nc = qemu_get_queue(n->nic);

    /* Firstly sync all virtio-net possible supported features */

    features |= n->host_features;

    virtio_add_feature(&features, VIRTIO_NET_F_MAC);

    if (!peer_has_vnet_hdr(n)) {

        virtio_clear_feature(&features, VIRTIO_NET_F_CSUM);

        virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO4);

        virtio_clear_feature(&features, VIRTIO_NET_F_HOST_TSO6);

        virtio_clear_feature(&features, VIRTIO_NET_F_HOST_ECN);

        virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_CSUM);

        virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_TSO4);

        virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_TSO6);

        virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_ECN);

    }

    if (!peer_has_vnet_hdr(n) || !peer_has_ufo(n)) {

        virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_UFO);

        virtio_clear_feature(&features, VIRTIO_NET_F_HOST_UFO);

    }

    if (!get_vhost_net(nc->peer)) {

        return features;

    }

    return vhost_net_get_features(get_vhost_net(nc->peer), features);

}


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

                            bus->busnr, dev->addr, usb_speed(dev->speed), dev->devname);

+        }
+
+    }
+
+}

void usb_info(Monitor *mon)

{

    USBBus *bus;

    USBDevice *dev;

    USBPort *port;

    if (TAILQ_EMPTY(&busses)) {

        monitor_printf(mon, "USB support not enabled\n");

        return;

    }

    TAILQ_FOREACH(bus, &busses, next) {

        TAILQ_FOREACH(port, &bus->used, next) {

            dev = port->dev;

            if (!dev)

                continue;

            monitor_printf(mon, "  Device %d.%d, Speed %s Mb/s, Product %s\n",

                           bus->busnr, dev->addr, usb_speed(dev->speed), dev->devname);

        }

    }

}


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

     int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,

+    BlockDriverCompletionFunc *cb, void *opaque)
+
 {

     return bdrv_aio_readv(bs->file, sector_num, qiov, nb_sectors, cb, opaque);

static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs,

    int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,

    BlockDriverCompletionFunc *cb, void *opaque)

{

    return bdrv_aio_readv(bs->file, sector_num, qiov, nb_sectors, cb, opaque);

}


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

 {

+    AVFilterContext *ctx = fs->parent;

     LUT2Context *s = fs->opaque;
+
     AVFilterLink *outlink = ctx->outputs[0];

     AVFrame *out, *srcx, *srcy;

static int process_frame(FFFrameSync *fs)

{

    AVFilterContext *ctx = fs->parent;

    LUT2Context *s = fs->opaque;

    AVFilterLink *outlink = ctx->outputs[0];

    AVFrame *out, *srcx, *srcy;

    int ret;

    if ((ret = ff_framesync2_get_frame(&s->fs, 0, &srcx, 0)) < 0 ||

        (ret = ff_framesync2_get_frame(&s->fs, 1, &srcy, 0)) < 0)

        return ret;

    if (ctx->is_disabled) {

        out = av_frame_clone(srcx);

        if (!out)

            return AVERROR(ENOMEM);

    } else {

        out = ff_get_video_buffer(outlink, outlink->w, outlink->h);

        if (!out)

            return AVERROR(ENOMEM);

        av_frame_copy_props(out, srcx);

        s->lut2(s, out, srcx, srcy);

    }

    out->pts = av_rescale_q(s->fs.pts, s->fs.time_base, outlink->time_base);

    return ff_filter_frame(outlink, out);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int qemu_rdma_alloc_qp(RDMAContext *rdma)
+
+{
+
+    struct ibv_qp_init_attr attr = { 0 };
+
     int ret;

static int qemu_rdma_alloc_qp(RDMAContext *rdma)

{

    struct ibv_qp_init_attr attr = { 0 };

    int ret;

    attr.cap.max_send_wr = RDMA_SIGNALED_SEND_MAX;

    attr.cap.max_recv_wr = 3;

    attr.cap.max_send_sge = 1;

    attr.cap.max_recv_sge = 1;

    attr.send_cq = rdma->cq;

    attr.recv_cq = rdma->cq;

    attr.qp_type = IBV_QPT_RC;

    ret = rdma_create_qp(rdma->cm_id, rdma->pd, &attr);

    if (ret) {

        return -1;

    }

    rdma->qp = rdma->cm_id->qp;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void string_output_append(StringOutputVisitor *sov, int64_t a)

 {
+
+    Range *r = g_malloc0(sizeof(*r));
+
     r->begin = a;

     r->end = a + 1;

static void string_output_append(StringOutputVisitor *sov, int64_t a)

{

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

    r->begin = a;

    r->end = a + 1;

    sov->ranges = range_list_insert(sov->ranges, r);

}


--- a/source.c
+++ b/source.c
@@ -13,7 +13,7 @@
         acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb);

         qemu_bh_schedule(acb->bh);
+
+    }
+
+}

static void bdrv_co_maybe_schedule_bh(BlockAIOCBCoroutine *acb)

{

    acb->need_bh = false;

    if (acb->req.error != -EINPROGRESS) {

        BlockDriverState *bs = acb->common.bs;

        acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb);

        qemu_bh_schedule(acb->bh);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void scsi_req_dequeue(SCSIRequest *req)

 {

static void scsi_req_dequeue(SCSIRequest *req)

{

    trace_scsi_req_dequeue(req->dev->id, req->lun, req->tag);

    if (req->enqueued) {

        QTAILQ_REMOVE(&req->dev->requests, req, next);

        req->enqueued = false;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void rng_egd_free_request(RngRequest *req)
+
+{

     g_free(req->data);

static void rng_egd_free_request(RngRequest *req)

{

    g_free(req->data);

    g_free(req);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 bool qemu_peer_has_ufo(NetClientState *nc)

 {
+
+    if (!nc->peer || !nc->peer->info->has_ufo) {
+
         return false;

     }

bool qemu_peer_has_ufo(NetClientState *nc)

{

    if (!nc->peer || !nc->peer->info->has_ufo) {

        return false;

    }

    return nc->peer->info->has_ufo(nc->peer);

}


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

     uint8_t trigger_mode = (data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;

+    uint8_t delivery = (data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x7;
+
+    /* XXX: Ignore redirection hint. */
+
     apic_deliver_irq(dest, dest_mode, delivery, vector, trigger_mode);

 }

static void apic_send_msi(target_phys_addr_t addr, uint32_t data)

{

    uint8_t dest = (addr & MSI_ADDR_DEST_ID_MASK) >> MSI_ADDR_DEST_ID_SHIFT;

    uint8_t vector = (data & MSI_DATA_VECTOR_MASK) >> MSI_DATA_VECTOR_SHIFT;

    uint8_t dest_mode = (addr >> MSI_ADDR_DEST_MODE_SHIFT) & 0x1;

    uint8_t trigger_mode = (data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;

    uint8_t delivery = (data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x7;

    /* XXX: Ignore redirection hint. */

    apic_deliver_irq(dest, dest_mode, delivery, vector, trigger_mode);

}


--- a/source.c
+++ b/source.c
@@ -7,9 +7,9 @@
     qemu_put_be16(f, tm->tm_hour);

     qemu_put_be16(f, tm->tm_mday);
+
+    qemu_put_be16(f, tm->tm_min);
+
     qemu_put_be16(f, tm->tm_year);

 }

static void tm_put(QEMUFile *f, struct tm *tm) {

    qemu_put_be16(f, tm->tm_sec);

    qemu_put_be16(f, tm->tm_min);

    qemu_put_be16(f, tm->tm_hour);

    qemu_put_be16(f, tm->tm_mday);

    qemu_put_be16(f, tm->tm_min);

    qemu_put_be16(f, tm->tm_year);

}


float32 helper_fabs_FT(float32 t0)

{

    return float32_abs(t0);

}


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

     *filename = tempnam(".", prefix);

+#else
+
+    size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
+
+    *filename = av_malloc(len);

 #endif

int av_tempfile(char *prefix, char **filename) {

    int fd=-1;

#ifdef __MINGW32__

    *filename = tempnam(".", prefix);

#else

    size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */

    *filename = av_malloc(len);

#endif

    /* -----common section-----*/

    if (*filename == NULL) {

        av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");

        return -1;

    }

#ifdef __MINGW32__

    fd = open(*filename, _O_RDWR | _O_BINARY | _O_CREAT, 0444);

#else

    snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);

    fd = mkstemp(*filename);

    if (fd < 0) {

        snprintf(*filename, len, "./%sXXXXXX", prefix);

        fd = mkstemp(*filename);

    }

#endif

    /* -----common section-----*/

    if (fd < 0) {

        av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);

        return -1;

    }

    return fd; /* success */

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);

     VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
+
+
+
+    assert(!s->ctx);
+
     s->ctx = iothread_get_aio_context(vs->conf.iothread);

void virtio_scsi_set_iothread(VirtIOSCSI *s, IOThread *iothread)

{

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

    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);

    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);

    assert(!s->ctx);

    s->ctx = iothread_get_aio_context(vs->conf.iothread);

    /* Don't try if transport does not support notifiers. */

    if (!k->set_guest_notifiers || !k->ioeventfd_assign) {

        fprintf(stderr, "virtio-scsi: Failed to set iothread "

                   "(transport does not support notifiers)");

        exit(1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void qmp_cont(Error **errp)

+{
+
     Error *local_err = NULL;
+

     if (runstate_check(RUN_STATE_INMIGRATE)) {
@@ -16,7 +16,7 @@

                runstate_check(RUN_STATE_SHUTDOWN)) {

+        error_set(errp, QERR_RESET_REQUIRED);

         return;

void qmp_cont(Error **errp)

{

    Error *local_err = NULL;

    if (runstate_check(RUN_STATE_INMIGRATE)) {

        error_set(errp, QERR_MIGRATION_EXPECTED);

        return;

    } else if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||

               runstate_check(RUN_STATE_SHUTDOWN)) {

        error_set(errp, QERR_RESET_REQUIRED);

        return;

    } else if (runstate_check(RUN_STATE_SUSPENDED)) {

        return;

    }

    bdrv_iterate(iostatus_bdrv_it, NULL);

    bdrv_iterate(encrypted_bdrv_it, &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }

    vm_start();

}


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

     return data[offset];

+}

static uint8_t read_u8(uint8_t *data, size_t offset)

{

    return data[offset];

}


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

                              uint32_t *ecx, uint32_t *edx)

+{
+
+    *ebx = env->cpuid_vendor1;
+
+    *edx = env->cpuid_vendor2;

     *ecx = env->cpuid_vendor3;

static void get_cpuid_vendor(CPUX86State *env, uint32_t *ebx,

                             uint32_t *ecx, uint32_t *edx)

{

    *ebx = env->cpuid_vendor1;

    *edx = env->cpuid_vendor2;

    *ecx = env->cpuid_vendor3;

    /* sysenter isn't supported on compatibility mode on AMD, syscall

     * isn't supported in compatibility mode on Intel.

     * Normally we advertise the actual cpu vendor, but you can override

     * this if you want to use KVM's sysenter/syscall emulation

     * in compatibility mode and when doing cross vendor migration

     */

    if (kvm_enabled() && env->cpuid_vendor_override) {

        host_cpuid(0, 0, NULL, ebx, ecx, edx);

    }

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     X264Context *x4 = ctx->priv_data;

     uint8_t *p = buf;
+
+    int i;
+
+
+
     /* Write the SEI as part of the first frame. */

     if (x4->sei_size > 0 && nnal > 0) {

static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size,

                       x264_nal_t *nals, int nnal, int skip_sei)

{

    X264Context *x4 = ctx->priv_data;

    uint8_t *p = buf;

    int i;

    /* Write the SEI as part of the first frame. */

    if (x4->sei_size > 0 && nnal > 0) {

        if (x4->sei_size > size) {

            return -1;

        memcpy(p, x4->sei, x4->sei_size);

        p += x4->sei_size;

        x4->sei_size = 0;

        // why is x4->sei not freed?

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

        /* Don't put the SEI in extradata. */

        if (skip_sei && nals[i].i_type == NAL_SEI) {

            x4->sei_size = nals[i].i_payload;

            x4->sei      = av_malloc(x4->sei_size);

            memcpy(x4->sei, nals[i].p_payload, nals[i].i_payload);

            continue;

        memcpy(p, nals[i].p_payload, nals[i].i_payload);

        p += nals[i].i_payload;

    return p - buf;


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void wavpack_decode_flush(AVCodecContext *avctx)
+
+{
+
+    WavpackContext *s = avctx->priv_data;

     int i;

static void wavpack_decode_flush(AVCodecContext *avctx)

{

    WavpackContext *s = avctx->priv_data;

    int i;

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

        wv_reset_saved_context(s->fdec[i]);

}


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

         if (wp->flags & mask)

+            cpu_watchpoint_remove_by_ref(env, wp);
+
+    }
+
 }

void cpu_watchpoint_remove_all(CPUState *env, int mask)

{

    CPUWatchpoint *wp, *next;

    TAILQ_FOREACH_SAFE(wp, &env->watchpoints, entry, next) {

        if (wp->flags & mask)

            cpu_watchpoint_remove_by_ref(env, wp);

    }

}


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

     sPAPRDRConnectorClass *drck;

+
+
+    if (!drc) {
+
+        return RTAS_OUT_PARAM_ERROR;

     }

static uint32_t rtas_set_isolation_state(uint32_t idx, uint32_t state)

{

    sPAPRDRConnector *drc = spapr_drc_by_index(idx);

    sPAPRDRConnectorClass *drck;

    if (!drc) {

        return RTAS_OUT_PARAM_ERROR;

    }

    drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);

    return drck->set_isolation_state(drc, state);

}


--- a/source.c
+++ b/source.c
@@ -6,11 +6,11 @@
         return AVERROR_INVALIDDATA;
     s->width  = AV_RL16(&buf[4]);
     s->height = AV_RL16(&buf[6]);
+    ret = ff_set_dimensions(s->avctx, s->width, s->height);
+    if (ret < 0)
+        return ret;
+    fps = AV_RL16(&buf[10]);
+    if (fps > 0)
         s->avctx->time_base = (AVRational){ 1, fps };
     pal_start = AV_RL16(&buf[12]);
     pal_count = AV_RL16(&buf[14]);

static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)
{
    int pal_start, pal_count, i, ret, fps;
    if(buf_end - buf < 16) {
        av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
        return AVERROR_INVALIDDATA;
    s->width  = AV_RL16(&buf[4]);
    s->height = AV_RL16(&buf[6]);
    ret = ff_set_dimensions(s->avctx, s->width, s->height);
    if (ret < 0)
        return ret;
    fps = AV_RL16(&buf[10]);
    if (fps > 0)
        s->avctx->time_base = (AVRational){ 1, fps };
    pal_start = AV_RL16(&buf[12]);
    pal_count = AV_RL16(&buf[14]);
    buf += 16;
    for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) {
        s->palette[i] = AV_RB24(buf);
        buf += 3;
    return 0;


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+static int64_t qemu_icount_delta(void)
+
+{
+
+    if (!use_icount) {

+        return 5000 * (int64_t) 1000000;

     } else if (use_icount == 1) {

static int64_t qemu_icount_delta(void)

{

    if (!use_icount) {

        return 5000 * (int64_t) 1000000;

    } else if (use_icount == 1) {

        /* When not using an adaptive execution frequency

           we tend to get badly out of sync with real time,

           so just delay for a reasonable amount of time.  */

        return 0;

    } else {

        return cpu_get_icount() - cpu_get_clock();

    }

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
+static bool memory_region_dispatch_write(MemoryRegion *mr,

                                          hwaddr addr,
+
                                          uint64_t data,

                                          unsigned size)
+
 {
+
     if (!memory_region_access_valid(mr, addr, size, true)) {
+
         unassigned_mem_write(mr, addr, data, size);

         return true;

static bool memory_region_dispatch_write(MemoryRegion *mr,

                                         hwaddr addr,

                                         uint64_t data,

                                         unsigned size)

{

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

        unassigned_mem_write(mr, addr, data, size);

        return true;

    }

    adjust_endianness(mr, &data, size);

    if (mr->ops->write) {

        access_with_adjusted_size(addr, &data, size,

                                  mr->ops->impl.min_access_size,

                                  mr->ops->impl.max_access_size,

                                  memory_region_write_accessor, mr);

    } else {

        access_with_adjusted_size(addr, &data, size, 1, 4,

                                  memory_region_oldmmio_write_accessor, mr);

    }

    return false;

}


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

     int pw = w, ph = h;
+
     Jpeg2000TgtNode *res, *t, *t2;

     int32_t tt_size;

Jpeg2000TgtNode *ff_j2k_tag_tree_init(int w, int h)

{

    int pw = w, ph = h;

    Jpeg2000TgtNode *res, *t, *t2;

    int32_t tt_size;

    tt_size = tag_tree_size(w, h);

    t = res = av_mallocz(tt_size, sizeof(*t));

    if (!res)

        return NULL;

    while (w > 1 || h > 1) {

        int i, j;

        pw = w;

        ph = h;

        w  = (w + 1) >> 1;

        h  = (h + 1) >> 1;

        t2 = t + pw * ph;

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

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

                t[i * pw + j].parent = &t2[(i >> 1) * w + (j >> 1)];

        t = t2;

    }

    t[0].parent = NULL;

    return res;

}


static inline uint8_t *ram_chunk_end(const RDMALocalBlock *rdma_ram_block,

                                     uint64_t i)

{

    uint8_t *result = ram_chunk_start(rdma_ram_block, i) +

                                         (1UL << RDMA_REG_CHUNK_SHIFT);

    if (result > (rdma_ram_block->local_host_addr + rdma_ram_block->length)) {

        result = rdma_ram_block->local_host_addr + rdma_ram_block->length;

    }

    return result;

}


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

         error_setg(errp, "Memory backend has bad page size. "

+                   "Use 'memory-backend-file' with correct mem-path.");
+
+        return;
+
+    }

 }

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

                                  Error **errp)

{

    PCDIMMDevice *dimm = PC_DIMM(dev);

    PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);

    MemoryRegion *mr = ddc->get_memory_region(dimm);

    uint64_t size = memory_region_size(mr);

    char *mem_dev;

    if (size % SPAPR_MEMORY_BLOCK_SIZE) {

        error_setg(errp, "Hotplugged memory size must be a multiple of "

                      "%lld MB", SPAPR_MEMORY_BLOCK_SIZE / M_BYTE);

        return;

    }

    mem_dev = object_property_get_str(OBJECT(dimm), PC_DIMM_MEMDEV_PROP, NULL);

    if (mem_dev && !kvmppc_is_mem_backend_page_size_ok(mem_dev)) {

        error_setg(errp, "Memory backend has bad page size. "

                   "Use 'memory-backend-file' with correct mem-path.");

        return;

    }

}


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

 {

+    VLANState *vlan;
+
     VLANClientState *vc;

void net_host_device_remove(Monitor *mon, int vlan_id, const char *device)

{

    VLANState *vlan;

    VLANClientState *vc;

    vlan = qemu_find_vlan(vlan_id);

    if (!vlan) {

        monitor_printf(mon, "can't find vlan %d\n", vlan_id);

        return;

    }

   for(vc = vlan->first_client; vc != NULL; vc = vc->next)

        if (!strcmp(vc->name, device))

            break;

    if (!vc) {

        monitor_printf(mon, "can't find device %s\n", device);

        return;

    }

    qemu_del_vlan_client(vc);

}


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

 {

+    QObject *data;

     Monitor *mon = opaque;

static void monitor_qmp_event(void *opaque, int event)

{

    QObject *data;

    Monitor *mon = opaque;

    switch (event) {

    case CHR_EVENT_OPENED:

        mon->qmp.in_command_mode = false;

        data = get_qmp_greeting();

        monitor_json_emitter(mon, data);

        qobject_decref(data);

        mon_refcount++;

        break;

    case CHR_EVENT_CLOSED:

        json_message_parser_destroy(&mon->qmp.parser);

        json_message_parser_init(&mon->qmp.parser, handle_qmp_command);

        mon_refcount--;

        monitor_fdsets_cleanup();

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static av_cold int pcm_decode_init(AVCodecContext *avctx)
+
+{
+
+    PCMDecode *s = avctx->priv_data;
+
     int i;

static av_cold int pcm_decode_init(AVCodecContext *avctx)

{

    PCMDecode *s = avctx->priv_data;

    int i;

    if (avctx->channels <= 0) {

        av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");

        return AVERROR(EINVAL);

    }

    switch (avctx->codec->id) {

    case AV_CODEC_ID_PCM_ALAW:

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

            s->table[i] = alaw2linear(i);

        break;

    case AV_CODEC_ID_PCM_MULAW:

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

            s->table[i] = ulaw2linear(i);

        break;

    default:

        break;

    }

    avctx->sample_fmt = avctx->codec->sample_fmts[0];

    if (avctx->sample_fmt == AV_SAMPLE_FMT_S32)

        avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec->id);

    avcodec_get_frame_defaults(&s->frame);

    avctx->coded_frame = &s->frame;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void gen_iccci(DisasContext *ctx)
+
+{
+
 #if defined(CONFIG_USER_ONLY)

+    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

 #else

static void gen_iccci(DisasContext *ctx)

{

#if defined(CONFIG_USER_ONLY)

    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

#else

    if (unlikely(ctx->pr)) {

        gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

        return;

    }

    /* interpreted as no-op */

#endif

}


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

     n->multiqueue = multiqueue;
+
+
+
+    for (i = 2; i <= n->max_queues * 2 + 1; i++) {
+
         virtio_del_queue(vdev, i);

     }

static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl)

{

    VirtIODevice *vdev = VIRTIO_DEVICE(n);

    int i, max = multiqueue ? n->max_queues : 1;

    n->multiqueue = multiqueue;

    for (i = 2; i <= n->max_queues * 2 + 1; i++) {

        virtio_del_queue(vdev, i);

    }

    for (i = 1; i < max; i++) {

        n->vqs[i].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx);

        if (n->vqs[i].tx_timer) {

            n->vqs[i].tx_vq =

                virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer);

            n->vqs[i].tx_timer = qemu_new_timer_ns(vm_clock,

                                                   virtio_net_tx_timer,

                                                   &n->vqs[i]);

        } else {

            n->vqs[i].tx_vq =

                virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh);

            n->vqs[i].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[i]);

        }

        n->vqs[i].tx_waiting = 0;

        n->vqs[i].n = n;

    }

    if (ctrl) {

        n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl);

    }

    virtio_net_set_queues(n);

}


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

     AVFilterFormats *formats = NULL;
+
     int fmt;

static int query_formats(AVFilterContext *ctx)

{

    AVFilterFormats *formats = NULL;

    int fmt;

    for (fmt = 0; fmt < AV_PIX_FMT_NB; fmt++) {

        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);

        if (!(desc->flags & PIX_FMT_PAL ||

            fmt == AV_PIX_FMT_NV21 ||

            fmt == AV_PIX_FMT_NV12))

            ff_add_format(&formats, fmt);

    }

    ff_set_common_formats(ctx, formats);

    return 0;

}


static inline float32 ucf64_itos(uint32_t i)

{

    union {

        uint32_t i;

        float32 s;

    } v;

    v.i = i;

    return v.s;

}


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

 {

void OPPROTO op_movl_npc_T0(void)

{

    env->npc = T0;

}


static void net_socket_accept(void *opaque)

{

    NetSocketListenState *s = opaque;

    NetSocketState *s1;

    struct sockaddr_in saddr;

    socklen_t len;

    int fd;

    for(;;) {

        len = sizeof(saddr);

        fd = qemu_accept(s->fd, (struct sockaddr *)&saddr, &len);

        if (fd < 0 && errno != EINTR) {

            return;

        } else if (fd >= 0) {

            break;

        }

    }

    s1 = net_socket_fd_init(s->peer, s->model, s->name, fd, 1);

    if (s1) {

        snprintf(s1->nc.info_str, sizeof(s1->nc.info_str),

                 "socket: connection from %s:%d",

                 inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));

    }

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                          DeviceState *dev,

                                          uint8_t **exp_cap, Error **errp)
+
 {

     *exp_cap = hotplug_dev->config + hotplug_dev->exp.exp_cap;

static void pcie_cap_slot_hotplug_common(PCIDevice *hotplug_dev,

                                         DeviceState *dev,

                                         uint8_t **exp_cap, Error **errp)

{

    *exp_cap = hotplug_dev->config + hotplug_dev->exp.exp_cap;

    uint16_t sltsta = pci_get_word(*exp_cap + PCI_EXP_SLTSTA);

    PCIE_DEV_PRINTF(PCI_DEVICE(dev), "hotplug state: 0x%x\n", sltsta);

    if (sltsta & PCI_EXP_SLTSTA_EIS) {

        /* the slot is electromechanically locked.

         * This error is propagated up to qdev and then to HMP/QMP.

         */

        error_setg_errno(errp, -EBUSY, "slot is electromechanically locked");

    }

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     struct Stream *s = &ds->dma->streams[1];

     size_t ret;
+
+
+
+    if (!app) {
+
         hw_error("No stream app data!\n");

     }

xilinx_axidma_data_stream_push(StreamSlave *obj, unsigned char *buf, size_t len,

                               uint32_t *app)

{

    XilinxAXIDMAStreamSlave *ds = XILINX_AXI_DMA_DATA_STREAM(obj);

    struct Stream *s = &ds->dma->streams[1];

    size_t ret;

    if (!app) {

        hw_error("No stream app data!\n");

    }

    ret = stream_process_s2mem(s, buf, len, app);

    stream_update_irq(s);

    return ret;

}


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

     sPAPRPHBState *sphb = opaque;
+
+    GHashTableIter iter;
+
+    gpointer key, value;

     int i;
+
+
+
+    g_free(sphb->msi_devs);
+
     sphb->msi_devs = NULL;

     sphb->msi_devs_num = g_hash_table_size(sphb->msi);

static void spapr_pci_pre_save(void *opaque)

{

    sPAPRPHBState *sphb = opaque;

    GHashTableIter iter;

    gpointer key, value;

    int i;

    g_free(sphb->msi_devs);

    sphb->msi_devs = NULL;

    sphb->msi_devs_num = g_hash_table_size(sphb->msi);

    if (!sphb->msi_devs_num) {

        return;

    }

    sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig));

    g_hash_table_iter_init(&iter, sphb->msi);

    for (i = 0; g_hash_table_iter_next(&iter, &key, &value); ++i) {

        sphb->msi_devs[i].key = *(uint32_t *) key;

        sphb->msi_devs[i].value = *(spapr_pci_msi *) value;

    }

    if (sphb->pre_2_8_migration) {

        sphb->mig_liobn = sphb->dma_liobn[0];

        sphb->mig_mem_win_addr = sphb->mem_win_addr;

        sphb->mig_mem_win_size = sphb->mem_win_size;

        sphb->mig_io_win_addr = sphb->io_win_addr;

        sphb->mig_io_win_size = sphb->io_win_size;

        if ((sphb->mem64_win_size != 0)

            && (sphb->mem64_win_addr

                == (sphb->mem_win_addr + sphb->mem_win_size))) {

            sphb->mig_mem_win_size += sphb->mem64_win_size;

        }

    }

}


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

     uint8_t *textbuf;
+
     size_t textbuf_size;

static int load_textfile(AVFilterContext *ctx)

{

    DrawTextContext *s = ctx->priv;

    int err;

    uint8_t *textbuf;

    size_t textbuf_size;

    if ((err = av_file_map(s->textfile, &textbuf, &textbuf_size, 0, ctx)) < 0) {

        av_log(ctx, AV_LOG_ERROR,

               "The text file '%s' could not be read or is empty\n",

               s->textfile);

        return err;

    }

    if (!(s->text = av_realloc(s->text, textbuf_size + 1)))

        return AVERROR(ENOMEM);

    memcpy(s->text, textbuf, textbuf_size);

    s->text[textbuf_size] = 0;

    av_file_unmap(textbuf, textbuf_size);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int vhost_verify_ring_mappings(struct vhost_dev *dev,

+                                      uint64_t start_addr,

                                       uint64_t size)

@@ -11,15 +11,15 @@
     for (i = 0; i < dev->nvqs; ++i) {

         struct vhost_virtqueue *vq = dev->vqs + i;
+
         hwaddr l;

         void *p;
+

         if (!ranges_overlap(start_addr, size, vq->ring_phys, vq->ring_size)) {
+
             continue;

         }

static int vhost_verify_ring_mappings(struct vhost_dev *dev,

                                      uint64_t start_addr,

                                      uint64_t size)

{

    int i;

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

        struct vhost_virtqueue *vq = dev->vqs + i;

        hwaddr l;

        void *p;

        if (!ranges_overlap(start_addr, size, vq->ring_phys, vq->ring_size)) {

            continue;

        }

        l = vq->ring_size;

        p = cpu_physical_memory_map(vq->ring_phys, &l, 1);

        if (!p || l != vq->ring_size) {

            fprintf(stderr, "Unable to map ring buffer for ring %d\n", i);

            return -ENOMEM;

        }

        if (p != vq->ring) {

            fprintf(stderr, "Ring buffer relocated for ring %d\n", i);

            return -EBUSY;

        }

        cpu_physical_memory_unmap(p, l, 0, 0);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,9 +11,9 @@
     uint8_t *out_end;

+
+    /* Test buffer size. */
+
     if (offset * s->depth > bytestream2_get_bytes_left(&s->g))

         return AVERROR_INVALIDDATA;

static int read_uncompressed_sgi(unsigned char* out_buf, SgiState *s)

{

    int x, y, z;

    unsigned int offset = s->height * s->width * s->bytes_per_channel;

    GetByteContext gp[4];

    uint8_t *out_end;

    /* Test buffer size. */

    if (offset * s->depth > bytestream2_get_bytes_left(&s->g))

        return AVERROR_INVALIDDATA;

    /* Create a reader for each plane */

    for (z = 0; z < s->depth; z++) {

        gp[z] = s->g;

        bytestream2_skip(&gp[z], z * offset);

    }

    for (y = s->height - 1; y >= 0; y--) {

        out_end = out_buf + (y * s->linesize);

        if (s->bytes_per_channel == 1) {

            for (x = s->width; x > 0; x--) {

                bytestream2_get_bufferu(&gp[z], out_end, s->depth);

                out_end += s->depth;

            }

        } else {

            uint16_t *out16 = (uint16_t *)out_end;

            for (x = s->width; x > 0; x--)

                for (z = 0; z < s->depth; z++)

                    *out16++ = bytestream2_get_ne16u(&gp[z]);

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void rv40_v_weak_loop_filter(uint8_t *src, const int stride,

                                     const int filter_p1, const int filter_q1,

static void rv40_v_weak_loop_filter(uint8_t *src, const int stride,

                                    const int filter_p1, const int filter_q1,

                                    const int alpha, const int beta,

                                    const int lim_p0q0, const int lim_q1,

                                    const int lim_p1)

{

    rv40_weak_loop_filter(src, 1, stride, filter_p1, filter_q1,

                          alpha, beta, lim_p0q0, lim_q1, lim_p1);

}


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

 {

+    int jumpLabel;
+
+    jumpLabel = gen_new_label();
+
+    tcg_gen_brcond_tl(cond, r1, r2, jumpLabel);

static inline void gen_branch_cond(DisasContext *ctx, TCGCond cond, TCGv r1,

                                   TCGv r2, int16_t address)

{

    int jumpLabel;

    jumpLabel = gen_new_label();

    tcg_gen_brcond_tl(cond, r1, r2, jumpLabel);

    gen_goto_tb(ctx, 1, ctx->next_pc);

    gen_set_label(jumpLabel);

    gen_goto_tb(ctx, 0, ctx->pc + address * 2);

}


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

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

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

{

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

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void gen_abs(DisasContext *ctx)
+
+{
+
+    int l1 = gen_new_label();

     int l2 = gen_new_label();

static void gen_abs(DisasContext *ctx)

{

    int l1 = gen_new_label();

    int l2 = gen_new_label();

    tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rA(ctx->opcode)], 0, l1);

    tcg_gen_neg_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);

    tcg_gen_br(l2);

    gen_set_label(l1);

    tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);

    gen_set_label(l2);

    if (unlikely(Rc(ctx->opcode) != 0))

        gen_set_Rc0(ctx, cpu_gpr[rD(ctx->opcode)]);

}


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

     /*

+     * Reason: it crashes FIXME find and document the real reason
+
+     */
+
+    dk->user_creatable = false;

 }

static void spapr_dr_connector_class_init(ObjectClass *k, void *data)

{

    DeviceClass *dk = DEVICE_CLASS(k);

    sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_CLASS(k);

    dk->reset = reset;

    dk->realize = realize;

    dk->unrealize = unrealize;

    drck->set_isolation_state = set_isolation_state;

    drck->set_allocation_state = set_allocation_state;

    drck->release_pending = release_pending;

    drck->set_signalled = set_signalled;

    /*

     * Reason: it crashes FIXME find and document the real reason

     */

    dk->user_creatable = false;

}


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

     int mapped_node_id; /* set by -numa option */

+    int node_id = object_property_get_int(OBJECT(dev), "node-id", &error_abort);
+
+
+
+    /* by default CPUState::numa_node was 0 if it wasn't set explicitly

      * TODO: make it error when incomplete numa mapping support is removed

void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp)

{

    int mapped_node_id; /* set by -numa option */

    int node_id = object_property_get_int(OBJECT(dev), "node-id", &error_abort);

    /* by default CPUState::numa_node was 0 if it wasn't set explicitly

     * TODO: make it error when incomplete numa mapping support is removed

     */

    mapped_node_id = slot->props.node_id;

    if (!slot->props.has_node_id) {

        mapped_node_id = 0;

    }

    if (node_id == CPU_UNSET_NUMA_NODE_ID) {

        /* due to bug in libvirt, it doesn't pass node-id from props on

         * device_add as expected, so we have to fix it up here */

        object_property_set_int(OBJECT(dev), mapped_node_id, "node-id", errp);

    } else if (node_id != mapped_node_id) {

        error_setg(errp, "node-id=%d must match numa node specified "

                   "with -numa option", node_id);

    }

}


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

     Slirp *slirp = opaque;

+    struct ex_list *ex_ptr;
+
+
+
+    for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next)

         if (ex_ptr->ex_pty == 3) {

static void slirp_state_save(QEMUFile *f, void *opaque)

{

    Slirp *slirp = opaque;

    struct ex_list *ex_ptr;

    for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next)

        if (ex_ptr->ex_pty == 3) {

            struct socket *so;

            so = slirp_find_ctl_socket(slirp, ex_ptr->ex_addr,

                                       ntohs(ex_ptr->ex_fport));

            if (!so)

                continue;

            qemu_put_byte(f, 42);

            vmstate_save_state(f, &vmstate_slirp_socket, so, NULL);

        }

    qemu_put_byte(f, 0);

    qemu_put_be16(f, slirp->ip_id);

    slirp_bootp_save(f, slirp);

}


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

     if (prefix[0] != '/') {
+
+        char *cwd = getcwd(NULL, 0);

         size_t pref_buf_len = sizeof(pref_buf);

void init_paths(const char *prefix)

{

    char pref_buf[PATH_MAX];

    if (prefix[0] == '\0' ||

        !strcmp(prefix, "/"))

        return;

    if (prefix[0] != '/') {

        char *cwd = getcwd(NULL, 0);

        size_t pref_buf_len = sizeof(pref_buf);

        if (!cwd)

            abort();

        pstrcpy(pref_buf, sizeof(pref_buf), cwd);

        pstrcat(pref_buf, pref_buf_len, "/");

        pstrcat(pref_buf, pref_buf_len, prefix);

        free(cwd);

    } else

        pstrcpy(pref_buf, sizeof(pref_buf), prefix + 1);

    base = new_entry("", NULL, pref_buf);

    base = add_dir_maybe(base);

    if (base->num_entries == 0) {

        g_free(base->pathname);

        free(base->name);

        free(base);

        base = NULL;

    } else {

        set_parents(base, base);

    }

}


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

         error_setg(errp, "filter filter mirror needs 'outdev' "

+                   "property set");
+
+        return;
+
+    }

static void filter_mirror_setup(NetFilterState *nf, Error **errp)

{

    MirrorState *s = FILTER_MIRROR(nf);

    if (!s->outdev) {

        error_setg(errp, "filter filter mirror needs 'outdev' "

                   "property set");

        return;

    }

    s->chr_out = qemu_chr_find(s->outdev);

    if (s->chr_out == NULL) {

        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,

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

        return;

    }

    if (qemu_chr_fe_claim(s->chr_out) != 0) {

        error_setg(errp, QERR_DEVICE_IN_USE, s->outdev);

        return;

    }

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
                                    int16_t (*block)[64],

                                    int block_last_index[12],
+
+                                   int mb_width, int mb_height)
+
+{
+
     int ret = x8_vlc_init();

     if (ret < 0)

av_cold int ff_intrax8_common_init(AVCodecContext *avctx,

                                   IntraX8Context *w, IDCTDSPContext *idsp,

                                   int16_t (*block)[64],

                                   int block_last_index[12],

                                   int mb_width, int mb_height)

{

    int ret = x8_vlc_init();

    if (ret < 0)

        return ret;

    w->avctx = avctx;

    w->idsp = *idsp;

    w->mb_width  = mb_width;

    w->mb_height = mb_height;

    w->block = block;

    w->block_last_index = block_last_index;

    // two rows, 2 blocks per cannon mb

    w->prediction_table = av_mallocz(w->mb_width * 2 * 2);

    if (!w->prediction_table)

        return AVERROR(ENOMEM);

    ff_init_scantable(w->idsp.idct_permutation, &w->scantable[0],

                      ff_wmv1_scantable[0]);

    ff_init_scantable(w->idsp.idct_permutation, &w->scantable[1],

                      ff_wmv1_scantable[2]);

    ff_init_scantable(w->idsp.idct_permutation, &w->scantable[2],

                      ff_wmv1_scantable[3]);

    ff_intrax8dsp_init(&w->dsp);

    ff_blockdsp_init(&w->bdsp, avctx);

    return 0;

}


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

     memset(&data, 0, sizeof(data));
+
+    data.machine = MACHINE_Q35;
+
+    data.variant = ".memhp";

     test_acpi_one(" -m 128,slots=3,maxmem=1G -numa node", &data);

static void test_acpi_q35_tcg_memhp(void)

{

    test_data data;

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

    data.machine = MACHINE_Q35;

    data.variant = ".memhp";

    test_acpi_one(" -m 128,slots=3,maxmem=1G -numa node", &data);

    free_test_data(&data);

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     if (dc->format == OP_FMT_RI) {

         LOG_DIS("sli r%d, r%d, %d\n", dc->r1, dc->r0, dc->imm5);
+
     } else {

         LOG_DIS("sl r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1);

static void dec_sl(DisasContext *dc)

{

    if (dc->format == OP_FMT_RI) {

        LOG_DIS("sli r%d, r%d, %d\n", dc->r1, dc->r0, dc->imm5);

    } else {

        LOG_DIS("sl r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1);

    }

    if (!(dc->env->features & LM32_FEATURE_SHIFT)) {

        cpu_abort(dc->env, "hardware shifter is not available\n");

    }

    if (dc->format == OP_FMT_RI) {

        tcg_gen_shli_tl(cpu_R[dc->r1], cpu_R[dc->r0], dc->imm5);

    } else {

        TCGv t0 = tcg_temp_new();

        tcg_gen_andi_tl(t0, cpu_R[dc->r1], 0x1f);

        tcg_gen_shl_tl(cpu_R[dc->r2], cpu_R[dc->r0], t0);

        tcg_temp_free(t0);

    }

}


static void ne2000_cleanup(NetClientState *nc)

{

    NE2000State *s = qemu_get_nic_opaque(nc);

    s->nic = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)
+
+{
+
+    if (!s) {

         return;

void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s)

{

    if (!s) {

        return;

    }

    virtio_blk_data_plane_stop(s);

    g_free(s->batch_notify_vqs);

    qemu_bh_delete(s->bh);

    object_unref(OBJECT(s->iothread));

    g_free(s);

}


--- a/source.c
+++ b/source.c
@@ -20,11 +20,11 @@
     /* XXX: beware: this is false if VLE is supported */
     env->nip = nip & ~((target_ulong)0x00000003);
     hreg_store_msr(env, msr, 1);
+#if defined(DEBUG_OP)
+    cpu_dump_rfi(env->nip, env->msr);
+#endif
+    /* No need to raise an exception here,
+     * as rfi is always the last insn of a TB
      */
     cs->interrupt_request |= CPU_INTERRUPT_EXITTB;
 }

static inline void do_rfi(CPUPPCState *env, target_ulong nip, target_ulong msr,
                          target_ulong msrm, int keep_msrh)
{
    CPUState *cs = CPU(ppc_env_get_cpu(env));
#if defined(TARGET_PPC64)
    if (msr_is_64bit(env, msr)) {
        nip = (uint64_t)nip;
        msr &= (uint64_t)msrm;
    } else {
        nip = (uint32_t)nip;
        msr = (uint32_t)(msr & msrm);
        if (keep_msrh) {
            msr |= env->msr & ~((uint64_t)0xFFFFFFFF);
        }
    }
#else
    nip = (uint32_t)nip;
    msr &= (uint32_t)msrm;
#endif
    /* XXX: beware: this is false if VLE is supported */
    env->nip = nip & ~((target_ulong)0x00000003);
    hreg_store_msr(env, msr, 1);
#if defined(DEBUG_OP)
    cpu_dump_rfi(env->nip, env->msr);
#endif
    /* No need to raise an exception here,
     * as rfi is always the last insn of a TB
     */
    cs->interrupt_request |= CPU_INTERRUPT_EXITTB;
}


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

     qemu_get_buffer(f, config, sizeof config);
+
+    for (i = 0; i < sizeof config; ++i)
+
+        if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i])
+
             return -EINVAL;

     memcpy(s->config, config, sizeof config);

int pci_device_load(PCIDevice *s, QEMUFile *f)

{

    uint8_t config[PCI_CONFIG_SPACE_SIZE];

    uint32_t version_id;

    int i;

    version_id = qemu_get_be32(f);

    if (version_id > 2)

        return -EINVAL;

    qemu_get_buffer(f, config, sizeof config);

    for (i = 0; i < sizeof config; ++i)

        if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i])

            return -EINVAL;

    memcpy(s->config, config, sizeof config);

    pci_update_mappings(s);

    if (version_id >= 2)

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

            s->irq_state[i] = qemu_get_be32(f);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static inline int coef_test_compression(int coef)

 {
+
+    int tmp = coef >> 2;
+
+    int res = ff_ctz(tmp);
+
     if (res > 1)

         return 1;       /* ...00 ->  compressable    */

static inline int coef_test_compression(int coef)

{

    int tmp = coef >> 2;

    int res = ff_ctz(tmp);

    if (res > 1)

        return 1;       /* ...00 ->  compressable    */

    else if (res == 1)

        return 0;       /* ...10 ->  uncompressable  */

    else if (ff_ctz(tmp >> 1) > 0)

        return 0;       /* ...0 1 -> uncompressable  */

    else

        return 1;       /* ...1 1 -> compressable    */

}


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

     qemu_mutex_lock(&pool->lock);

+    if (pool->idle_threads == 0 && pool->cur_threads < pool->max_threads) {
+
+        spawn_thread(pool);
+
+    }

     QTAILQ_INSERT_TAIL(&pool->request_list, req, reqs);

BlockAIOCB *thread_pool_submit_aio(ThreadPool *pool,

        ThreadPoolFunc *func, void *arg,

        BlockCompletionFunc *cb, void *opaque)

{

    ThreadPoolElement *req;

    req = qemu_aio_get(&thread_pool_aiocb_info, NULL, cb, opaque);

    req->func = func;

    req->arg = arg;

    req->state = THREAD_QUEUED;

    req->pool = pool;

    QLIST_INSERT_HEAD(&pool->head, req, all);

    trace_thread_pool_submit(pool, req, arg);

    qemu_mutex_lock(&pool->lock);

    if (pool->idle_threads == 0 && pool->cur_threads < pool->max_threads) {

        spawn_thread(pool);

    }

    QTAILQ_INSERT_TAIL(&pool->request_list, req, reqs);

    qemu_mutex_unlock(&pool->lock);

    qemu_sem_post(&pool->sem);

    return &req->common;

}


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

     uint32_t msk = -1, tmp;

void OPPROTO op_POWER_slq (void)

{

    uint32_t msk = -1, tmp;

    msk = msk << (T1 & 0x1FUL);

    if (T1 & 0x20UL)

        msk = ~msk;

    T1 &= 0x1FUL;

    tmp = rotl32(T0, T1);

    T0 = tmp & msk;

    env->spr[SPR_MQ] = tmp;

    RETURN();

}


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

                            uint32_t token, uint32_t nargs, target_ulong args,

+                           uint32_t nret, target_ulong rets)
+
+{
+
+    if (nargs != 2 || nret != 1) {

         rtas_st(rets, 0, -3);

static void rtas_power_off(sPAPREnvironment *spapr,

                           uint32_t token, uint32_t nargs, target_ulong args,

                           uint32_t nret, target_ulong rets)

{

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

        rtas_st(rets, 0, -3);

        return;

    }

    qemu_system_shutdown_request();

    rtas_st(rets, 0, 0);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static int add_tonal_components(float *spectrum, int num_components,

+                                TonalComponent *components)
+
+{
+
+    int i, j, last_pos = -1;

     float *input, *output;

static int add_tonal_components(float *spectrum, int num_components,

                                TonalComponent *components)

{

    int i, j, last_pos = -1;

    float *input, *output;

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

        last_pos = FFMAX(components[i].pos + components[i].num_coefs, last_pos);

        input    = components[i].coef;

        output   = &spectrum[components[i].pos];

        for (j = 0; j < components[i].num_coefs; j++)

            output[i] += input[i];

    }

    return last_pos;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void test_visitor_out_native_list_int64(TestOutputVisitorData *data,

                                                const void *unused)
+
+{

     test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_S64);

static void test_visitor_out_native_list_int64(TestOutputVisitorData *data,

                                               const void *unused)

{

    test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_S64);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static uint32_t e1000e_macreg_read(e1000e_device *d, uint32_t reg)
+
 {

     return qpci_io_readl(d->pci_dev, d->mac_regs + reg);

static uint32_t e1000e_macreg_read(e1000e_device *d, uint32_t reg)

{

    return qpci_io_readl(d->pci_dev, d->mac_regs + reg);

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
         le32_to_cpus(&ptd.buffer);

         if (!(ptd.ctrl & TD_CTRL_ACTIVE)) {
+
+            break;
+
+        }
+
         if (uhci_queue_token(&ptd) != token) {

             break;

static void uhci_fill_queue(UHCIState *s, UHCI_TD *td)

{

    uint32_t int_mask = 0;

    uint32_t plink = td->link;

    uint32_t token = uhci_queue_token(td);

    UHCI_TD ptd;

    int ret;

    while (is_valid(plink)) {

        pci_dma_read(&s->dev, plink & ~0xf, &ptd, sizeof(ptd));

        le32_to_cpus(&ptd.link);

        le32_to_cpus(&ptd.ctrl);

        le32_to_cpus(&ptd.token);

        le32_to_cpus(&ptd.buffer);

        if (!(ptd.ctrl & TD_CTRL_ACTIVE)) {

            break;

        }

        if (uhci_queue_token(&ptd) != token) {

            break;

        }

        trace_usb_uhci_td_queue(plink & ~0xf, ptd.ctrl, ptd.token);

        ret = uhci_handle_td(s, plink, &ptd, &int_mask, true);

        if (ret == TD_RESULT_ASYNC_CONT) {

            break;

        }

        assert(ret == TD_RESULT_ASYNC_START);

        assert(int_mask == 0);

        if (ptd.ctrl & TD_CTRL_SPD) {

            break;

        }

        plink = ptd.link;

    }

}


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

 {

     LOAD_PIXELS
+
     int a, f1, f2;

     const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
+

     a = 3 * (q0 - p0);

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

                                           int is4tap)

{

    LOAD_PIXELS

    int a, f1, f2;

    const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;

    a = 3 * (q0 - p0);

    if (is4tap)

        a += clip_int8(p1 - q1);

    a = clip_int8(a);

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

    // since that's what libvpx does.

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

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

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

    // be bitexact with libvpx.

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

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

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

    if (!is4tap) {

        a = (f1 + 1) >> 1;

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

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

    }

}


--- a/source.c
+++ b/source.c
@@ -7,8 +7,8 @@
     JSONParserContext saved_ctxt = parser_context_save(ctxt);

+
+    token = parser_context_pop_token(ctxt);

     if (token == NULL) {

static QObject *parse_literal(JSONParserContext *ctxt)

{

    QObject *token, *obj;

    JSONParserContext saved_ctxt = parser_context_save(ctxt);

    token = parser_context_pop_token(ctxt);

    if (token == NULL) {

        goto out;

    }

    switch (token_get_type(token)) {

    case JSON_STRING:

        obj = QOBJECT(qstring_from_escaped_str(ctxt, token));

        break;

    case JSON_INTEGER:

        obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10)));

        break;

    case JSON_FLOAT:

        /* FIXME dependent on locale */

        obj = QOBJECT(qfloat_from_double(strtod(token_get_value(token), NULL)));

        break;

    default:

        goto out;

    }

    return obj;

out:

    parser_context_restore(ctxt, saved_ctxt);

    return NULL;

}


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

     TCPCharDriver *s = chr->opaque;
+
+    if (s->connected) {
+
+        return send_all(s->fd, buf, len);
+
     } else {

         /* (Re-)connect for unconnected writing */

static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)

{

    TCPCharDriver *s = chr->opaque;

    if (s->connected) {

        return send_all(s->fd, buf, len);

    } else {

        /* (Re-)connect for unconnected writing */

        tcp_chr_connect(chr);

        return 0;

    }

}


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

     len = strlen(msg);
+
+    x = (640/FONT_WIDTH  - len) / 2;
+
+    y = (480/FONT_HEIGHT - 1)   / 2;
+
     for (i = 0; i < len; i++) {

         glyph = qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont16, msg[i]);

static DisplaySurface *qemu_create_dummy_surface(void)

{

    static const char msg[] =

        "This VM has no graphic display device.";

    DisplaySurface *surface = qemu_create_displaysurface(640, 480);

    pixman_color_t bg = color_table_rgb[0][COLOR_BLACK];

    pixman_color_t fg = color_table_rgb[0][COLOR_WHITE];

    pixman_image_t *glyph;

    int len, x, y, i;

    len = strlen(msg);

    x = (640/FONT_WIDTH  - len) / 2;

    y = (480/FONT_HEIGHT - 1)   / 2;

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

        glyph = qemu_pixman_glyph_from_vgafont(FONT_HEIGHT, vgafont16, msg[i]);

        qemu_pixman_glyph_render(glyph, surface->image, &fg, &bg,

                                 x+i, y, FONT_WIDTH, FONT_HEIGHT);

        qemu_pixman_image_unref(glyph);

    }

    return surface;

}


static void intel_hda_set_st_ctl(IntelHDAState *d, const IntelHDAReg *reg, uint32_t old)

{

    bool output = reg->stream >= 4;

    IntelHDAStream *st = d->st + reg->stream;

    if (st->ctl & 0x01) {

        /* reset */

        dprint(d, 1, "st #%d: reset\n", reg->stream);

        st->ctl = 0;

    }

    if ((st->ctl & 0x02) != (old & 0x02)) {

        uint32_t stnr = (st->ctl >> 20) & 0x0f;

        /* run bit flipped */

        if (st->ctl & 0x02) {

            /* start */

            dprint(d, 1, "st #%d: start %d (ring buf %d bytes)\n",

                   reg->stream, stnr, st->cbl);

            intel_hda_parse_bdl(d, st);

            intel_hda_notify_codecs(d, stnr, true, output);

        } else {

            /* stop */

            dprint(d, 1, "st #%d: stop %d\n", reg->stream, stnr);

            intel_hda_notify_codecs(d, stnr, false, output);

        }

    }

    intel_hda_update_irq(d);

}


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

 	s->buggy_avid = 1;
+
+//	if (s->first_picture)
+
+//	    printf("mjpeg: workarounding buggy AVID\n");
+
     }

static int mjpeg_decode_com(MJpegDecodeContext *s)

{

    int i;

    UINT8 *cbuf;

    /* XXX: verify len field validity */

    unsigned int len = get_bits(&s->gb, 16)-2;

    cbuf = av_malloc(len+1);

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

	cbuf[i] = get_bits(&s->gb, 8);

    if (cbuf[i-1] == '\n')

	cbuf[i-1] = 0;

    else

	cbuf[i] = 0;

    printf("mjpeg comment: '%s'\n", cbuf);

    /* buggy avid, it puts EOI only at every 10th frame */

    if (!strcmp(cbuf, "AVID"))

    {

	s->buggy_avid = 1;

//	if (s->first_picture)

//	    printf("mjpeg: workarounding buggy AVID\n");

    }

    av_free(cbuf);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void ppc_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg)

+{
+
     cpu_synchronize_state(cs);

     ppc_cpu_do_system_reset(cs);

static void ppc_cpu_do_nmi_on_cpu(CPUState *cs, run_on_cpu_data arg)

{

    cpu_synchronize_state(cs);

    ppc_cpu_do_system_reset(cs);

}


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

     }
+
+
+
+    cpu_synchronize_state(CPU(si->cpu));
+

     if (kvm_s390_store_adtl_status(si->cpu, si->param)) {

static void sigp_store_adtl_status(void *arg)

{

    SigpInfo *si = arg;

    if (!kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS)) {

        set_sigp_status(si, SIGP_STAT_INVALID_ORDER);

        return;

    }

    /* cpu has to be stopped */

    if (s390_cpu_get_state(si->cpu) != CPU_STATE_STOPPED) {

        set_sigp_status(si, SIGP_STAT_INCORRECT_STATE);

        return;

    }

    /* parameter must be aligned to 1024-byte boundary */

    if (si->param & 0x3ff) {

        set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER);

        return;

    }

    cpu_synchronize_state(CPU(si->cpu));

    if (kvm_s390_store_adtl_status(si->cpu, si->param)) {

        set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER);

        return;

    }

    si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;

}


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

+    va_start(ap, fmt);

     if (mon) {

static void config_error(Monitor *mon, const char *fmt, ...)

{

    va_list ap;

    va_start(ap, fmt);

    if (mon) {

        monitor_vprintf(mon, fmt, ap);

    } else {

        fprintf(stderr, "qemu: ");

        vfprintf(stderr, fmt, ap);

        exit(1);

    }

    va_end(ap);

}


--- a/source.c
+++ b/source.c
@@ -43,9 +43,9 @@
         qemu_log("-net dump write error - stop dump\n");

         close(s->fd);
+
+        s->fd = -1;
+
+    }
+
 }

static void dump_receive(void *opaque, const uint8_t *buf, size_t size)

{

    DumpState *s = opaque;

    struct pcap_sf_pkthdr hdr;

    int64_t ts;

    int caplen;

    /* Early return in case of previous error. */

    if (s->fd < 0) {

        return;

    }

    ts = muldiv64(qemu_get_clock(vm_clock), 1000000, ticks_per_sec);

    caplen = size > s->pcap_caplen ? s->pcap_caplen : size;

    hdr.ts.tv_sec = ts / 1000000;

    hdr.ts.tv_usec = ts % 1000000;

    hdr.caplen = caplen;

    hdr.len = size;

    if (write(s->fd, &hdr, sizeof(hdr)) != sizeof(hdr) ||

        write(s->fd, buf, caplen) != caplen) {

        qemu_log("-net dump write error - stop dump\n");

        close(s->fd);

        s->fd = -1;

    }

}


static av_cold int rv30_decode_init(AVCodecContext *avctx)

{

    RV34DecContext *r = avctx->priv_data;

    int ret;

    r->rv30 = 1;

    if ((ret = ff_rv34_decode_init(avctx)) < 0)

        return ret;

    if(avctx->extradata_size < 2){

        av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");

        return -1;

    r->max_rpr = avctx->extradata[1] & 7;

    r->parse_slice_header = rv30_parse_slice_header;

    r->decode_intra_types = rv30_decode_intra_types;

    r->decode_mb_info     = rv30_decode_mb_info;

    r->loop_filter        = rv30_loop_filter;

    r->luma_dc_quant_i = rv30_luma_dc_quant;

    r->luma_dc_quant_p = rv30_luma_dc_quant;

    return 0;


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

     }

+
+
+    request.from = sector_num * 512;
+
+    request.len = nb_sectors * 512;

static int nbd_co_writev_1(NbdClientSession *client, int64_t sector_num,

                           int nb_sectors, QEMUIOVector *qiov,

                           int offset)

{

    struct nbd_request request = { .type = NBD_CMD_WRITE };

    struct nbd_reply reply;

    ssize_t ret;

    if (!bdrv_enable_write_cache(client->bs) &&

        (client->nbdflags & NBD_FLAG_SEND_FUA)) {

        request.type |= NBD_CMD_FLAG_FUA;

    }

    request.from = sector_num * 512;

    request.len = nb_sectors * 512;

    nbd_coroutine_start(client, &request);

    ret = nbd_co_send_request(client, &request, qiov, offset);

    if (ret < 0) {

        reply.error = -ret;

    } else {

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

    }

    nbd_coroutine_end(client, &request);

    return -reply.error;

}


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

     to->action = action;
+
+    SwitchToFiber(to->fiber);
+
+    return from->action;
+
 }

CoroutineAction qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,

                                      CoroutineAction action)

{

    CoroutineWin32 *from = DO_UPCAST(CoroutineWin32, base, from_);

    CoroutineWin32 *to = DO_UPCAST(CoroutineWin32, base, to_);

    current = to_;

    to->action = action;

    SwitchToFiber(to->fiber);

    return from->action;

}


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

     cc->do_interrupt = ppc_cpu_do_interrupt;

+    cc->dump_state = ppc_cpu_dump_state;
+
+    cc->dump_statistics = ppc_cpu_dump_statistics;
+
+    cc->set_pc = ppc_cpu_set_pc;

     cc->gdb_read_register = ppc_cpu_gdb_read_register;

static void ppc_cpu_class_init(ObjectClass *oc, void *data)

{

    PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);

    CPUClass *cc = CPU_CLASS(oc);

    DeviceClass *dc = DEVICE_CLASS(oc);

    pcc->parent_realize = dc->realize;

    dc->realize = ppc_cpu_realizefn;

    dc->unrealize = ppc_cpu_unrealizefn;

    pcc->parent_reset = cc->reset;

    cc->reset = ppc_cpu_reset;

    cc->class_by_name = ppc_cpu_class_by_name;

    cc->do_interrupt = ppc_cpu_do_interrupt;

    cc->dump_state = ppc_cpu_dump_state;

    cc->dump_statistics = ppc_cpu_dump_statistics;

    cc->set_pc = ppc_cpu_set_pc;

    cc->gdb_read_register = ppc_cpu_gdb_read_register;

    cc->gdb_write_register = ppc_cpu_gdb_write_register;

#ifndef CONFIG_USER_ONLY

    cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;

    cc->vmsd = &vmstate_ppc_cpu;

    cc->gdb_num_core_regs = 71;

    cc->gdb_core_xml_file = "power64-core.xml";

#else

    cc->gdb_core_xml_file = "power-core.xml";

}


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

     const DNXHDContext *ctx = avctx->priv_data;

+    uint32_t offset = ctx->mb_scan_index[rownb];

     RowContext *row = ctx->rows + threadnb;

static int dnxhd_decode_row(AVCodecContext *avctx, void *data,

                            int rownb, int threadnb)

{

    const DNXHDContext *ctx = avctx->priv_data;

    uint32_t offset = ctx->mb_scan_index[rownb];

    RowContext *row = ctx->rows + threadnb;

    int x;

    row->last_dc[0] =

    row->last_dc[1] =

    row->last_dc[2] = 1 << (ctx->bit_depth + 2); // for levels +2^(bitdepth-1)

    init_get_bits(&row->gb, ctx->buf + offset, (ctx->buf_size - offset) << 3);

    for (x = 0; x < ctx->mb_width; x++) {

        //START_TIMER;

        dnxhd_decode_macroblock(ctx, row, data, x, rownb);

        //STOP_TIMER("decode macroblock");

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+int fw_cfg_add_file(FWCfgState *s,  const char *filename, uint8_t *data,

                     uint32_t len)

@@ -6,23 +6,23 @@

     int i, index;

+
+
+    if (!s->files) {

         int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS;

         s->files = g_malloc0(dsize);

         fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, (uint8_t*)s->files, dsize);
+
     }

     index = be32_to_cpu(s->files->count);

+    if (index == FW_CFG_FILE_SLOTS) {

         fprintf(stderr, "fw_cfg: out of file slots\n");

int fw_cfg_add_file(FWCfgState *s,  const char *filename, uint8_t *data,

                    uint32_t len)

{

    int i, index;

    if (!s->files) {

        int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS;

        s->files = g_malloc0(dsize);

        fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, (uint8_t*)s->files, dsize);

    }

    index = be32_to_cpu(s->files->count);

    if (index == FW_CFG_FILE_SLOTS) {

        fprintf(stderr, "fw_cfg: out of file slots\n");

        return 0;

    }

    fw_cfg_add_bytes(s, FW_CFG_FILE_FIRST + index, data, len);

    pstrcpy(s->files->f[index].name, sizeof(s->files->f[index].name),

            filename);

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

        if (strcmp(s->files->f[index].name, s->files->f[i].name) == 0) {

            trace_fw_cfg_add_file_dupe(s, s->files->f[index].name);

            return 1;

        }

    }

    s->files->f[index].size   = cpu_to_be32(len);

    s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index);

    trace_fw_cfg_add_file(s, index, s->files->f[index].name, len);

    s->files->count = cpu_to_be32(index+1);

    return 1;

}


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

                                 const uint16_t *buf1, const uint16_t *ubuf0,

                                 const uint16_t *ubuf1, const uint16_t *vbuf0,

                                 const uint16_t *vbuf1, const uint16_t *abuf0,

                                 const uint16_t *abuf1, uint8_t *dest,

                                 int dstW, int yalpha, int uvalpha, int y)

{

    //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(

    __asm__ volatile(

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

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

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

        YSCALEYUV2RGB(%%REGBP, %5)

        "pxor    %%mm7, %%mm7                   \n\t"

        /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */

#ifdef DITHER1XBPP

        "paddusb "BLUE_DITHER"(%5), %%mm2      \n\t"

        "paddusb "GREEN_DITHER"(%5), %%mm4      \n\t"

        "paddusb "RED_DITHER"(%5), %%mm5      \n\t"

#endif

        WRITERGB16(%%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
@@ -11,8 +11,8 @@
     gint fd;

     gchar *out, *out_err;
+
+    gboolean ret;

     int i;

static void load_asl(GArray *sdts, AcpiSdtTable *sdt)

{

    AcpiSdtTable *temp;

    GError *error = NULL;

    GString *command_line = g_string_new(iasl);

    gint fd;

    gchar *out, *out_err;

    gboolean ret;

    int i;

    fd = g_file_open_tmp("asl-XXXXXX.dsl", &sdt->asl_file, &error);

    g_assert_no_error(error);

    close(fd);

    /* build command line */

    g_string_append_printf(command_line, " -p %s ", sdt->asl_file);

    for (i = 0; i < 2; ++i) { /* reference DSDT and SSDT */

        temp = &g_array_index(sdts, AcpiSdtTable, i);

        g_string_append_printf(command_line, "-e %s ", temp->aml_file);

    }

    g_string_append_printf(command_line, "-d %s", sdt->aml_file);

    /* pass 'out' and 'out_err' in order to be redirected */

    g_spawn_command_line_sync(command_line->str, &out, &out_err, NULL, &error);

    g_assert_no_error(error);

    ret = g_file_get_contents(sdt->asl_file, (gchar **)&sdt->asl,

                              &sdt->asl_len, &error);

    g_assert(ret);

    g_assert_no_error(error);

    g_assert(sdt->asl_len);

    g_free(out);

    g_free(out_err);

    g_string_free(command_line, true);

}


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

     QEMUFileFD *s = opaque;
+
+    ssize_t len;
+
+
+
     do {

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

static void fd_put_buffer(void *opaque, const uint8_t *buf,

                          int64_t pos, int size)

{

    QEMUFileFD *s = opaque;

    ssize_t len;

    do {

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

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

    if (len == -1)

        len = -errno;

    /* When the fd becomes writable again, register a callback to do

     * a put notify */

    if (len == -EAGAIN)

        qemu_set_fd_handler2(s->fd, NULL, NULL, fd_put_notify, s);

}


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

+
+    type = g_strdup_printf("child<%s>", child->info->name);
+
+
+
     qdev_property_add(dev, name, type, qdev_get_child_property,

                       NULL, NULL, child, errp);

void qdev_property_add_child(DeviceState *dev, const char *name,

                             DeviceState *child, Error **errp)

{

    gchar *type;

    type = g_strdup_printf("child<%s>", child->info->name);

    qdev_property_add(dev, name, type, qdev_get_child_property,

                      NULL, NULL, child, errp);

    qdev_ref(child);

    g_assert(child->parent == NULL);

    child->parent = dev;

    g_free(type);

}


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

     av_frame_free(&avctx->coded_frame);

+    return 0;
+
 }

static av_cold int bmp_encode_close(AVCodecContext *avctx)

{

    av_frame_free(&avctx->coded_frame);

    return 0;

}


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

 	ctrl->base = base;

+	ctrl->env = env;
+
+	ctrl->nr_channels = nr_channels;
+
+	ctrl->channels = qemu_mallocz(sizeof ctrl->channels[0] * nr_channels);

 	if (!ctrl->channels)

void *etraxfs_dmac_init(CPUState *env,

			target_phys_addr_t base, int nr_channels)

{

	struct fs_dma_ctrl *ctrl = NULL;

	int i;

	ctrl = qemu_mallocz(sizeof *ctrl);

	if (!ctrl)

		return NULL;

	ctrl->base = base;

	ctrl->env = env;

	ctrl->nr_channels = nr_channels;

	ctrl->channels = qemu_mallocz(sizeof ctrl->channels[0] * nr_channels);

	if (!ctrl->channels)

		goto err;

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

	{

		ctrl->channels[i].regmap = cpu_register_io_memory(0,

								  dma_read,

								  dma_write,

								  ctrl);

		cpu_register_physical_memory (base + i * 0x2000,

					      sizeof ctrl->channels[i].regs,

					      ctrl->channels[i].regmap);

	}

	/* Hax, we only support one DMA controller at a time.  */

	etraxfs_dmac = ctrl;

	return ctrl;

  err:

	qemu_free(ctrl->channels);

	qemu_free(ctrl);

	return NULL;

}


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

+{
+
     sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev);

static int spapr_tce_table_realize(DeviceState *dev)

{

    sPAPRTCETable *tcet = SPAPR_TCE_TABLE(dev);

    if (kvm_enabled()) {

        tcet->table = kvmppc_create_spapr_tce(tcet->liobn,

                                              tcet->nb_table <<

                                              tcet->page_shift,

                                              &tcet->fd,

                                              tcet->vfio_accel);

    }

    if (!tcet->table) {

        size_t table_size = tcet->nb_table * sizeof(uint64_t);

        tcet->table = g_malloc0(table_size);

    }

    trace_spapr_iommu_new_table(tcet->liobn, tcet, tcet->table, tcet->fd);

    memory_region_init_iommu(&tcet->iommu, OBJECT(dev), &spapr_iommu_ops,

                             "iommu-spapr",

                             (uint64_t)tcet->nb_table << tcet->page_shift);

    QLIST_INSERT_HEAD(&spapr_tce_tables, tcet, list);

    vmstate_register(DEVICE(tcet), tcet->liobn, &vmstate_spapr_tce_table,

                     tcet);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int tls_read(URLContext *h, uint8_t *buf, int size)

+{
+
     TLSContext *c = h->priv_data;

     size_t processed = 0;

static int tls_read(URLContext *h, uint8_t *buf, int size)

{

    TLSContext *c = h->priv_data;

    size_t processed = 0;

    int ret = SSLRead(c->ssl_context, buf, size, &processed);

    ret = map_ssl_error(ret, processed);

    if (ret > 0)

        return ret;

    if (ret == 0)

        return AVERROR_EOF;

    return print_tls_error(h, ret);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,

+             int srcSliceH, uint8_t* dst[], int dstStride[]){
+
     if(c->srcFormat == PIX_FMT_YUV422P){

+	srcStride[1] *= 2;

 	srcStride[2] *= 2;

static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,

             int srcSliceH, uint8_t* dst[], int dstStride[]){

    if(c->srcFormat == PIX_FMT_YUV422P){

	srcStride[1] *= 2;

	srcStride[2] *= 2;

    }

    assert(srcStride[1] == srcStride[2]);

    mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,

			     srcSliceH, dstStride[0], srcStride[0], srcStride[1]);

    return srcSliceH;

}


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

 {

+    int status;

     AVVideotoolboxContext *videotoolbox = avctx->hwaccel_context;

static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)

{

    int status;

    AVVideotoolboxContext *videotoolbox = avctx->hwaccel_context;

    VTContext *vtctx = avctx->internal->hwaccel_priv_data;

    av_buffer_unref(&frame->buf[0]);

    if (!videotoolbox->session || !vtctx->bitstream)

        return AVERROR_INVALIDDATA;

    status = videotoolbox_session_decode_frame(avctx);

    if (status) {

        av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status);

        return AVERROR_UNKNOWN;

    }

    if (!vtctx->frame)

        return AVERROR_UNKNOWN;

    return ff_videotoolbox_buffer_create(vtctx, frame);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void visit_start_list(Visitor *v, const char *name, Error **errp)
+
+{

     if (!error_is_set(errp)) {

void visit_start_list(Visitor *v, const char *name, Error **errp)

{

    if (!error_is_set(errp)) {

        v->start_list(v, name, errp);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void test_properties(const char *path)

 {

@@ -11,9 +11,9 @@
     QListEntry *entry;

+
     g_test_message("Obtaining properties of %s", path);
+
     response = qmp("{ 'execute': 'qom-list',"

                    "  'arguments': { 'path': '%s' } }", path);

static void test_properties(const char *path)

{

    char *child_path;

    QDict *response, *tuple;

    QList *list;

    QListEntry *entry;

    g_test_message("Obtaining properties of %s", path);

    response = qmp("{ 'execute': 'qom-list',"

                   "  'arguments': { 'path': '%s' } }", path);

    g_assert(response);

    g_assert(qdict_haskey(response, "return"));

    list = qobject_to_qlist(qdict_get(response, "return"));

    QLIST_FOREACH_ENTRY(list, entry) {

        tuple = qobject_to_qdict(qlist_entry_obj(entry));

        if (strstart(qdict_get_str(tuple, "type"), "child<", NULL)) {

            child_path = g_strdup_printf("%s/%s",

                                         path, qdict_get_str(tuple, "name"));

            test_properties(child_path);

            g_free(child_path);

        } else {

            const char *prop = qdict_get_str(tuple, "name");

            g_test_message("Testing property %s.%s", path, prop);

            response = qmp("{ 'execute': 'qom-get',"

                           "  'arguments': { 'path': '%s',"

                           "                 'property': '%s' } }",

                           path, prop);

            /* qom-get may fail but should not, e.g., segfault. */

            g_assert(response);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     qemu_pf_conv_put(ssd->conv);

     ssd->conv = NULL;
+
+    pthread_mutex_unlock(&ssd->lock);
+
+
+
     qemu_spice_destroy_host_primary(ssd);

     qemu_spice_create_host_primary(ssd);

void qemu_spice_display_resize(SimpleSpiceDisplay *ssd)

{

    dprint(1, "%s:\n", __FUNCTION__);

    pthread_mutex_lock(&ssd->lock);

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

    qemu_pf_conv_put(ssd->conv);

    ssd->conv = NULL;

    pthread_mutex_unlock(&ssd->lock);

    qemu_spice_destroy_host_primary(ssd);

    qemu_spice_create_host_primary(ssd);

    pthread_mutex_lock(&ssd->lock);

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

    ssd->notify++;

    pthread_mutex_unlock(&ssd->lock);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx,
+
                                           RowContext *row, int n)

 {

static void dnxhd_decode_dct_block_10_444(const DNXHDContext *ctx,

                                          RowContext *row, int n)

{

    dnxhd_decode_dct_block(ctx, row, n, 6, 32, 6);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)

+{

     time_t t = 631112400LL + 86400*av_int2dbl(value);

static void oledate_to_iso8601(char *buf, int buf_size, int64_t value)

{

    time_t t = 631112400LL + 86400*av_int2dbl(value);

    strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t));

}