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

                            rom->isrom ? "rom" : "ram",

+                           rom->name);
+
+        } else {
+
+            monitor_printf(mon, "fw=%s%s%s"

                            " size=0x%06zx name=\"%s\" \n",

void do_info_roms(Monitor *mon)

{

    Rom *rom;

    QTAILQ_FOREACH(rom, &roms, next) {

        if (!rom->fw_file) {

            monitor_printf(mon, "addr=" TARGET_FMT_plx

                           " size=0x%06zx mem=%s name=\"%s\" \n",

                           rom->addr, rom->romsize,

                           rom->isrom ? "rom" : "ram",

                           rom->name);

        } else {

            monitor_printf(mon, "fw=%s%s%s"

                           " size=0x%06zx name=\"%s\" \n",

                           rom->fw_dir ? rom->fw_dir : "",

                           rom->fw_dir ? "/" : "",

                           rom->fw_file,

                           rom->romsize,

                           rom->name);

        }

    }

}


int check_params(const char * const *params, const char *str)

{

    int name_buf_size = 1;

    const char *p;

    char *name_buf;

    int i, len;

    int ret = 0;

    for (i = 0; params[i] != NULL; i++) {

        len = strlen(params[i]) + 1;

        if (len > name_buf_size) {

            name_buf_size = len;

        }

    }

    name_buf = qemu_malloc(name_buf_size);

    p = str;

    while (*p != '\0') {

        p = get_opt_name(name_buf, name_buf_size, p, '=');

        if (*p != '=') {

            ret = -1;

            break;

        }

        p++;

        for(i = 0; params[i] != NULL; i++)

            if (!strcmp(params[i], name_buf))

                break;

        if (params[i] == NULL) {

            ret = -1;

            break;

        }

        p = get_opt_value(NULL, 0, p);

        if (*p != ',')

            break;

        p++;

    }

    qemu_free(name_buf);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
                              uint8_t *aDest, int dstW, int chrDstW)

 {
+
+    int p= 4;
+
+    const int16_t *src[4]= { alpSrc + dstW, lumSrc + dstW, chrUSrc + chrDstW, chrVSrc + chrDstW };
+
     uint8_t *dst[4]= { aDest, dest, uDest, vDest };

     x86_reg counter[4]= { dstW, dstW, chrDstW, chrDstW };

static void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc,

                             const int16_t *chrUSrc, const int16_t *chrVSrc,

                             const int16_t *alpSrc,

                             uint8_t *dest, uint8_t *uDest, uint8_t *vDest,

                             uint8_t *aDest, int dstW, int chrDstW)

{

    int p= 4;

    const int16_t *src[4]= { alpSrc + dstW, lumSrc + dstW, chrUSrc + chrDstW, chrVSrc + chrDstW };

    uint8_t *dst[4]= { aDest, dest, uDest, vDest };

    x86_reg counter[4]= { dstW, dstW, chrDstW, chrDstW };

    while (p--) {

        if (dst[p]) {

            __asm__ volatile(

                "mov %2, %%"REG_a"                    \n\t"

                ".p2align               4             \n\t" /* FIXME Unroll? */

                "1:                                   \n\t"

                "movq  (%0, %%"REG_a", 2), %%mm0      \n\t"

                "movq 8(%0, %%"REG_a", 2), %%mm1      \n\t"

                "psraw                 $7, %%mm0      \n\t"

                "psraw                 $7, %%mm1      \n\t"

                "packuswb           %%mm1, %%mm0      \n\t"

                MOVNTQ(%%mm0, (%1, %%REGa))

                "add                   $8, %%"REG_a"  \n\t"

                "jnc                   1b             \n\t"

                :: "r" (src[p]), "r" (dst[p] + counter[p]),

                   "g" (-counter[p])

                : "%"REG_a

            );

        }

    }

}


static int make_ydt24_entry(int p1, int p2, int16_t *ydt)

{

    int lo, hi;

    lo = ydt[p1];

    hi = ydt[p2];

    return (lo + (hi << 8) + (hi << 16)) << 1;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     pix = *s->stream_ptr++;

+
+    for (y = 0; y < 8; y++) {
+
+        memset(s->pixel_ptr, pix, 8);
+
         s->pixel_ptr += s->stride;

     }

static int ipvideo_decode_block_opcode_0xE(IpvideoContext *s)

{

    int y;

    unsigned char pix;

    /* 1-color encoding: the whole block is 1 solid color */

    CHECK_STREAM_PTR(1);

    pix = *s->stream_ptr++;

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

        memset(s->pixel_ptr, pix, 8);

        s->pixel_ptr += s->stride;

    }

    /* report success */

    return 0;

}


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

     if (msix_enabled(pci_dev)) {
+
+        trace_usb_xhci_irq_msix(v);
+
+        msix_notify(pci_dev, v);
+

static void xhci_intr_raise(XHCIState *xhci, int v)

{

    PCIDevice *pci_dev = PCI_DEVICE(xhci);

    xhci->intr[v].erdp_low |= ERDP_EHB;

    xhci->intr[v].iman |= IMAN_IP;

    xhci->usbsts |= USBSTS_EINT;

    if (!(xhci->intr[v].iman & IMAN_IE)) {

    if (!(xhci->usbcmd & USBCMD_INTE)) {

    if (msix_enabled(pci_dev)) {

        trace_usb_xhci_irq_msix(v);

        msix_notify(pci_dev, v);

    if (msi_enabled(pci_dev)) {

        trace_usb_xhci_irq_msi(v);

        msi_notify(pci_dev, v);

    if (v == 0) {

        trace_usb_xhci_irq_intx(1);

        pci_irq_assert(pci_dev);


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 int xen_be_init(void)

+{
+
+    xenstore = xs_daemon_open();
+
+    if (!xenstore) {

         xen_be_printf(NULL, 0, "can't connect to xenstored\n");

int xen_be_init(void)

{

    xenstore = xs_daemon_open();

    if (!xenstore) {

        xen_be_printf(NULL, 0, "can't connect to xenstored\n");

        return -1;

    }

    if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0) {

        goto err;

    }

    xen_xc = xc_interface_open();

    if (xen_xc == -1) {

        xen_be_printf(NULL, 0, "can't open xen interface\n");

        goto err;

    }

    return 0;

err:

    qemu_set_fd_handler(xs_fileno(xenstore), NULL, NULL, NULL);

    xs_daemon_close(xenstore);

    xenstore = NULL;

    return -1;

}


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

     PCIDevice *d;

+    I440FXState *s;

     PIIX3State *piix3;

PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic)

{

    DeviceState *dev;

    PCIBus *b;

    PCIDevice *d;

    I440FXState *s;

    PIIX3State *piix3;

    dev = qdev_create(NULL, "i440FX-pcihost");

    s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev));

    b = pci_bus_new(&s->busdev.qdev, NULL, 0);

    s->bus = b;

    qdev_init(dev);

    d = pci_create_simple(b, 0, "i440FX");

    *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);

    piix3 = DO_UPCAST(PIIX3State, dev,

                                 pci_create_simple(b, -1, "PIIX3"));

    piix3->pic = pic;

    pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3, 4);

    (*pi440fx_state)->piix3 = piix3;

    *piix3_devfn = piix3->dev.devfn;

    return b;

}


--- a/source.c
+++ b/source.c
@@ -6,10 +6,10 @@
             monitor_hd[i] = NULL;
         }
         is_first_init = 0;
+    }
+    for (i = 0; i < MAX_MON; i++) {
+        if (monitor_hd[i] == NULL) {
+            monitor_hd[i] = hd;
             break;
         }
     }

void monitor_init(CharDriverState *hd, int show_banner)
{
    int i;
    if (is_first_init) {
        for (i = 0; i < MAX_MON; i++) {
            monitor_hd[i] = NULL;
        }
        is_first_init = 0;
    }
    for (i = 0; i < MAX_MON; i++) {
        if (monitor_hd[i] == NULL) {
            monitor_hd[i] = hd;
            break;
        }
    }
    hide_banner = !show_banner;
    qemu_chr_add_handlers(hd, term_can_read, term_read, term_event, NULL);
}


static int get_uint8(QEMUFile *f, void *pv, size_t size)

{

    uint8_t *v = pv;

    qemu_get_8s(f, v);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int pte32_check (mmu_ctx_t *ctx,

+                        target_ulong pte0, target_ulong pte1, int h, int rw)
+
 {

     return _pte_check(ctx, 0, pte0, pte1, h, rw);

static int pte32_check (mmu_ctx_t *ctx,

                        target_ulong pte0, target_ulong pte1, int h, int rw)

{

    return _pte_check(ctx, 0, pte0, pte1, h, rw);

}


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

 {

+    uint8_t indices[16];

     int x, y;

static inline void rgtc_block_internal(uint8_t *dst, ptrdiff_t stride,

                                       const uint8_t *block,

                                       const int *color_tab)

{

    uint8_t indices[16];

    int x, y;

    decompress_indices(indices, block + 2);

    /* Only one or two channels are stored at most, since it only used to

     * compress specular (black and white) or normal (red and green) maps.

     * Although the standard says to zero out unused components, many

     * implementations fill all of them with the same value. */

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

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

            int i = indices[x + y * 4];

            /* Interval expansion from [-1 1] or [0 1] to [0 255]. */

            int c = color_tab[i];

            uint32_t pixel = RGBA(c, c, c, 255);

            AV_WL32(dst + x * 4 + y * stride, pixel);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
         error_setg(&bs->backing_blocker,

                    "device is used as backing hd of '%s'",
+
                    bdrv_get_device_name(bs));

     }

void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd)

{

    if (bs->backing_hd) {

        assert(bs->backing_blocker);

        bdrv_op_unblock_all(bs->backing_hd, bs->backing_blocker);

    } else if (backing_hd) {

        error_setg(&bs->backing_blocker,

                   "device is used as backing hd of '%s'",

                   bdrv_get_device_name(bs));

    }

    bs->backing_hd = backing_hd;

    if (!backing_hd) {

        error_free(bs->backing_blocker);

        bs->backing_blocker = NULL;

        goto out;

    }

    bs->open_flags &= ~BDRV_O_NO_BACKING;

    pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_hd->filename);

    pstrcpy(bs->backing_format, sizeof(bs->backing_format),

            backing_hd->drv ? backing_hd->drv->format_name : "");

    bdrv_op_block_all(bs->backing_hd, bs->backing_blocker);

    /* Otherwise we won't be able to commit due to check in bdrv_commit */

    bdrv_op_unblock(bs->backing_hd, BLOCK_OP_TYPE_COMMIT,

                    bs->backing_blocker);

out:

    bdrv_refresh_limits(bs, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+int check_tm_pred8x8_mode(int mode, int mb_x, int mb_y)
+
 {

     if (!mb_x)

int check_tm_pred8x8_mode(int mode, int mb_x, int mb_y)

{

    if (!mb_x)

        return mb_y ? VERT_PRED8x8 : DC_129_PRED8x8;

    else

        return mb_y ? mode : HOR_PRED8x8;

}


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

+    /* cannot proceed if image has snapshots */

     if (s->nb_snapshots) {

static int qcow2_truncate(BlockDriverState *bs, int64_t offset)

{

    BDRVQcowState *s = bs->opaque;

    int ret, new_l1_size;

    if (offset & 511) {

        return -EINVAL;

    }

    /* cannot proceed if image has snapshots */

    if (s->nb_snapshots) {

        return -ENOTSUP;

    }

    /* shrinking is currently not supported */

    if (offset < bs->total_sectors * 512) {

        return -ENOTSUP;

    }

    new_l1_size = size_to_l1(s, offset);

    ret = qcow2_grow_l1_table(bs, new_l1_size);

    if (ret < 0) {

        return ret;

    }

    /* write updated header.size */

    offset = cpu_to_be64(offset);

    ret = bdrv_pwrite(bs->file, offsetof(QCowHeader, size),

                      &offset, sizeof(uint64_t));

    if (ret < 0) {

        return ret;

    }

    s->l1_vm_state_index = new_l1_size;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,22 +1,22 @@
+static void display_picref(AVFilterBufferRef *picref, AVRational time_base)

 {

+    int x, y;

+    uint8_t *p0, *p;

     int64_t delay;
+

+
     if (picref->pts != AV_NOPTS_VALUE) {
+
         if (last_pts != AV_NOPTS_VALUE) {
+
             /* sleep roughly the right amount of time;

+             * usleep is in microseconds, just like AV_TIME_BASE. */

             delay = av_rescale_q(picref->pts - last_pts,

static void display_picref(AVFilterBufferRef *picref, AVRational time_base)

{

    int x, y;

    uint8_t *p0, *p;

    int64_t delay;

    if (picref->pts != AV_NOPTS_VALUE) {

        if (last_pts != AV_NOPTS_VALUE) {

            /* sleep roughly the right amount of time;

             * usleep is in microseconds, just like AV_TIME_BASE. */

            delay = av_rescale_q(picref->pts - last_pts,

                                 time_base, AV_TIME_BASE_Q);

            if (delay > 0 && delay < 1000000)

                usleep(delay);

        }

        last_pts = picref->pts;

    }

    /* Trivial ASCII grayscale display. */

    p0 = picref->data[0];

    puts("\033c");

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

        p = p0;

        for (x = 0; x < picref->video->w; x++)

            putchar(" .-+#"[*(p++) / 52]);

        putchar('\n');

        p0 += picref->linesize[0];

    }

    fflush(stdout);

}


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

     if (!context.err) {

+        vm_start();
+
+        return 0;
+
+    } else {

         return -1;

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

{

    struct bdrv_iterate_context context = { mon, 0 };

    if (incoming_expected) {

        qerror_report(QERR_MIGRATION_EXPECTED);

        return -1;

    }

    bdrv_iterate(encrypted_bdrv_it, &context);

    /* only resume the vm if all keys are set and valid */

    if (!context.err) {

        vm_start();

        return 0;

    } else {

        return -1;

    }

}


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

     pkt->stream_index = 0;
+
+    return 0;
+
 }

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

{

    if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0)

        return AVERROR(EIO);

    pkt->stream_index = 0;

    return 0;

}


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

     if (ctx->h264_initialized)

+        ff_h264_decoder.close(avctx);
+
+    return 0;
+
 }

static av_cold int vdadec_close(AVCodecContext *avctx)

{

    VDADecoderContext *ctx = avctx->priv_data;

    /* release buffers and decoder */

    ff_vda_destroy_decoder(&ctx->vda_ctx);

    /* close H.264 decoder */

    if (ctx->h264_initialized)

        ff_h264_decoder.close(avctx);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     char buf[1024];

+
+    p = cmdline;
+
+    nb_args = 0;
+
     for(;;) {

         while (qemu_isspace(*p))

static void parse_cmdline(const char *cmdline,

                         int *pnb_args, char **args)

{

    const char *p;

    int nb_args, ret;

    char buf[1024];

    p = cmdline;

    nb_args = 0;

    for(;;) {

        while (qemu_isspace(*p))

            p++;

        if (*p == '\0')

            break;

        if (nb_args >= MAX_ARGS)

            break;

        ret = get_str(buf, sizeof(buf), &p);

        args[nb_args] = g_strdup(buf);

        nb_args++;

        if (ret < 0)

            break;

    }

    *pnb_args = nb_args;

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
     case 0x08:	/* READ_TIM */

         return omap_timer_read(s);
+
+    }
+
+
+
     OMAP_BAD_REG(addr);

     return 0;

static uint64_t omap_mpu_timer_read(void *opaque, target_phys_addr_t addr,

                                    unsigned size)

{

    struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *) opaque;

    if (size != 4) {

        return omap_badwidth_read32(opaque, addr);

    }

    switch (addr) {

    case 0x00:	/* CNTL_TIMER */

        return (s->enable << 5) | (s->ptv << 2) | (s->ar << 1) | s->st;

    case 0x04:	/* LOAD_TIM */

        break;

    case 0x08:	/* READ_TIM */

        return omap_timer_read(s);

    }

    OMAP_BAD_REG(addr);

    return 0;

}


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

     if (mr->ops->old_portio) {
+
+        const MemoryRegionPortio *mrp = find_portio(mr, offset, width, false);
+
+
+
         *data = ((uint64_t)1 << (width * 8)) - 1;

         if (mrp) {

static void memory_region_iorange_read(IORange *iorange,

                                       uint64_t offset,

                                       unsigned width,

                                       uint64_t *data)

{

    MemoryRegion *mr = container_of(iorange, MemoryRegion, iorange);

    if (mr->ops->old_portio) {

        const MemoryRegionPortio *mrp = find_portio(mr, offset, width, false);

        *data = ((uint64_t)1 << (width * 8)) - 1;

        if (mrp) {

            *data = mrp->read(mr->opaque, offset - mrp->offset);

        }

        return;

    }

    *data = mr->ops->read(mr->opaque, offset, width);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param,
+
+                    uint64_t param64)
+
+{
+
     CPUS390XState *env = &cpu->env;

void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param,

                    uint64_t param64)

{

    CPUS390XState *env = &cpu->env;

    if (env->ext_index == MAX_EXT_QUEUE - 1) {

        /* ugh - can't queue anymore. Let's drop. */

        return;

    }

    env->ext_index++;

    assert(env->ext_index < MAX_EXT_QUEUE);

    env->ext_queue[env->ext_index].code = code;

    env->ext_queue[env->ext_index].param = param;

    env->ext_queue[env->ext_index].param64 = param64;

    env->pending_int |= INTERRUPT_EXT;

    cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int adts_write_header(AVFormatContext *s)

 {
+
     ADTSContext *adts = s->priv_data;

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

static int adts_write_header(AVFormatContext *s)

{

    ADTSContext *adts = s->priv_data;

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

    if(avc->extradata_size > 0)

        decode_extradata(adts, avc->extradata, avc->extradata_size);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+ssize_t pt_getxattr(FsContext *ctx, const char *path, const char *name,
+
+                    void *value, size_t size)
+
+{
+
+    char *buffer;

     ssize_t ret;

ssize_t pt_getxattr(FsContext *ctx, const char *path, const char *name,

                    void *value, size_t size)

{

    char *buffer;

    ssize_t ret;

    buffer = rpath(ctx, path);

    ret = lgetxattr(buffer, name, value, size);

    g_free(buffer);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -13,7 +13,7 @@
     memcpy(lpc->chip_config + addr, &val, len);

     pci_bus_fire_intx_routing_notifier(lpc->d.bus);
+
+    ich9_cc_update(lpc);
+
+}

static void ich9_cc_write(void *opaque, hwaddr addr,

                          uint64_t val, unsigned len)

{

    ICH9LPCState *lpc = (ICH9LPCState *)opaque;

    ich9_cc_addr_len(&addr, &len);

    memcpy(lpc->chip_config + addr, &val, len);

    pci_bus_fire_intx_routing_notifier(lpc->d.bus);

    ich9_cc_update(lpc);

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     bitmap_size = bdrv_nb_sectors(bs);

     if (bitmap_size < 0) {
+
+        error_setg_errno(errp, -bitmap_size, "could not get length of device");
+
+        errno = -bitmap_size;
+
         return NULL;

     }

BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, int granularity,

                                          Error **errp)

{

    int64_t bitmap_size;

    BdrvDirtyBitmap *bitmap;

    assert((granularity & (granularity - 1)) == 0);

    granularity >>= BDRV_SECTOR_BITS;

    assert(granularity);

    bitmap_size = bdrv_nb_sectors(bs);

    if (bitmap_size < 0) {

        error_setg_errno(errp, -bitmap_size, "could not get length of device");

        errno = -bitmap_size;

        return NULL;

    }

    bitmap = g_new0(BdrvDirtyBitmap, 1);

    bitmap->bitmap = hbitmap_alloc(bitmap_size, ffs(granularity) - 1);

    QLIST_INSERT_HEAD(&bs->dirty_bitmaps, bitmap, list);

    return bitmap;

}


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

     file_oformat = guess_format(arg, NULL, NULL);

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

     }

static void opt_format(const char *arg)

{

    /* compatibility stuff for pgmyuv */

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

        opt_image_format(arg);

        arg = "image";

    }

    file_iformat = av_find_input_format(arg);

    file_oformat = guess_format(arg, NULL, NULL);

    if (!file_iformat && !file_oformat) {

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

        exit(1);

    }

}


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

             section = &phys_sections[phys_section_rom];

+        }
+
+        io_mem_write(section->mr, addr, val, 4);
+
+    } else {

         unsigned long addr1 = (memory_region_get_ram_addr(section->mr)

void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val)

{

    uint8_t *ptr;

    MemoryRegionSection *section;

    section = phys_page_find(address_space_memory.dispatch, addr >> TARGET_PAGE_BITS);

    if (!memory_region_is_ram(section->mr) || section->readonly) {

        addr = memory_region_section_addr(section, addr);

        if (memory_region_is_ram(section->mr)) {

            section = &phys_sections[phys_section_rom];

        }

        io_mem_write(section->mr, addr, val, 4);

    } else {

        unsigned long addr1 = (memory_region_get_ram_addr(section->mr)

                               & TARGET_PAGE_MASK)

            + memory_region_section_addr(section, addr);

        ptr = qemu_get_ram_ptr(addr1);

        stl_p(ptr, val);

        if (unlikely(in_migration)) {

            if (!cpu_physical_memory_is_dirty(addr1)) {

                /* invalidate code */

                tb_invalidate_phys_page_range(addr1, addr1 + 4, 0);

                /* set dirty bit */

                cpu_physical_memory_set_dirty_flags(

                    addr1, (0xff & ~CODE_DIRTY_FLAG));

            }

        }

    }

}


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

     int i;

+    ThreadContext *c= avctx->internal->frame_thread_encoder;

void ff_frame_thread_encoder_free(AVCodecContext *avctx){

    int i;

    ThreadContext *c= avctx->internal->frame_thread_encoder;

    pthread_mutex_lock(&c->task_fifo_mutex);

    c->exit = 1;

    pthread_cond_broadcast(&c->task_fifo_cond);

    pthread_mutex_unlock(&c->task_fifo_mutex);

    for (i=0; i<avctx->thread_count; i++) {

         pthread_join(c->worker[i], NULL);

    }

    pthread_mutex_destroy(&c->task_fifo_mutex);

    pthread_mutex_destroy(&c->finished_task_mutex);

    pthread_mutex_destroy(&c->buffer_mutex);

    pthread_cond_destroy(&c->task_fifo_cond);

    pthread_cond_destroy(&c->finished_task_cond);

    av_fifo_freep(&c->task_fifo);

    av_freep(&avctx->internal->frame_thread_encoder);

}


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

     async_context_pop();
+
+
+
+    return ret;
+
 }

int qed_write_l1_table_sync(BDRVQEDState *s, unsigned int index,

                            unsigned int n)

{

    int ret = -EINPROGRESS;

    async_context_push();

    qed_write_l1_table(s, index, n, qed_sync_cb, &ret);

    while (ret == -EINPROGRESS) {

        qemu_aio_wait();

    }

    async_context_pop();

    return ret;

}


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

     if (!s->in_len) {

+        ret = USB_RET_NAK;
+
+        return ret;
+
+    }

     ret = s->in_len - s->in_ptr;

static int usb_net_handle_datain(USBNetState *s, USBPacket *p)

{

    int ret = USB_RET_NAK;

    if (s->in_ptr > s->in_len) {

        s->in_ptr = s->in_len = 0;

        ret = USB_RET_NAK;

        return ret;

    }

    if (!s->in_len) {

        ret = USB_RET_NAK;

        return ret;

    }

    ret = s->in_len - s->in_ptr;

    if (ret > p->iov.size) {

        ret = p->iov.size;

    }

    usb_packet_copy(p, &s->in_buf[s->in_ptr], ret);

    s->in_ptr += ret;

    if (s->in_ptr >= s->in_len &&

                    (is_rndis(s) || (s->in_len & (64 - 1)) || !ret)) {

        /* no short packet necessary */

        s->in_ptr = s->in_len = 0;

    }

#ifdef TRAFFIC_DEBUG

    fprintf(stderr, "usbnet: data in len %zu return %d", p->iov.size, ret);

    iov_hexdump(p->iov.iov, p->iov.niov, stderr, "usbnet", ret);

#endif

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int get_cod(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties)

 {
+
     J2kCodingStyle tmp;
+
     int compno;

+    if (s->buf_end - s->buf < 5)

         return AVERROR(EINVAL);

static int get_cod(J2kDecoderContext *s, J2kCodingStyle *c, uint8_t *properties)

{

    J2kCodingStyle tmp;

    int compno;

    if (s->buf_end - s->buf < 5)

        return AVERROR(EINVAL);

    tmp.log2_prec_width  =

    tmp.log2_prec_height = 15;

    tmp.csty = bytestream_get_byte(&s->buf);

    if (bytestream_get_byte(&s->buf)){ // progression level

        av_log(s->avctx, AV_LOG_ERROR, "only LRCP progression supported\n");

        return -1;

    }

    tmp.nlayers = bytestream_get_be16(&s->buf);

        tmp.mct = bytestream_get_byte(&s->buf); // multiple component transformation

    get_cox(s, &tmp);

    for (compno = 0; compno < s->ncomponents; compno++){

        if (!(properties[compno] & HAD_COC))

            memcpy(c + compno, &tmp, sizeof(J2kCodingStyle));

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void OPPROTO op_subfme (void)

+{
+
     T0 = ~T0 + xer_ca - 1;

     if (likely((uint32_t)T0 != (uint32_t)-1))

void OPPROTO op_subfme (void)

{

    T0 = ~T0 + xer_ca - 1;

    if (likely((uint32_t)T0 != (uint32_t)-1))

        xer_ca = 1;

    RETURN();

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){

     const int stride= 16*2;
+
     const int xStride= 16;

     int a,b,c,d,e;
@@ -11,10 +11,10 @@

     a= block[stride*0 + xStride*0];
+
+    b= block[stride*0 + xStride*1];
+
+    c= block[stride*1 + xStride*0];

     d= block[stride*1 + xStride*1];

void FUNCC(ff_h264_chroma_dc_dequant_idct)(int16_t *_block, int qmul){

    const int stride= 16*2;

    const int xStride= 16;

    int a,b,c,d,e;

    dctcoef *block = (dctcoef*)_block;

    a= block[stride*0 + xStride*0];

    b= block[stride*0 + xStride*1];

    c= block[stride*1 + xStride*0];

    d= block[stride*1 + xStride*1];

    e= a-b;

    a= a+b;

    b= c-d;

    c= c+d;

    block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7;

    block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;

    block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;

    block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static int posix_aio_flush(void *opaque)
+
 {

     PosixAioState *s = opaque;

static int posix_aio_flush(void *opaque)

{

    PosixAioState *s = opaque;

    return !!s->first_aio;

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
                                        &rsdt->table_offset_entry[i],

                                        sizeof(uint32_t));
+
+    }
+
+    build_header(linker, table_data,
+
                  (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);

 }

build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,

           const char *oem_id, const char *oem_table_id)

{

    AcpiRsdtDescriptorRev1 *rsdt;

    size_t rsdt_len;

    int i;

    const int table_data_len = (sizeof(uint32_t) * table_offsets->len);

    rsdt_len = sizeof(*rsdt) + table_data_len;

    rsdt = acpi_data_push(table_data, rsdt_len);

    memcpy(rsdt->table_offset_entry, table_offsets->data, table_data_len);

    for (i = 0; i < table_offsets->len; ++i) {

        /* rsdt->table_offset_entry to be filled by Guest linker */

        bios_linker_loader_add_pointer(linker,

                                       ACPI_BUILD_TABLE_FILE,

                                       ACPI_BUILD_TABLE_FILE,

                                       &rsdt->table_offset_entry[i],

                                       sizeof(uint32_t));

    }

    build_header(linker, table_data,

                 (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int check_video_codec_tag(int codec_tag) {
+
+    if (codec_tag <= 0 || codec_tag > 15) {

+        return AVERROR(ENOSYS);

     } else

static int check_video_codec_tag(int codec_tag) {

    if (codec_tag <= 0 || codec_tag > 15) {

        return AVERROR(ENOSYS);

    } else

        return 0;

}


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

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

     avio_w8(pb, 0xC5);

static int vc1test_write_header(AVFormatContext *s)

{

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

    AVIOContext *pb = s->pb;

    if (avc->codec_id != CODEC_ID_WMV3) {

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

        return -1;

    }

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

    avio_w8(pb, 0xC5);

    avio_wl32(pb, 4);

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

    avio_wl32(pb, avc->height);

    avio_wl32(pb, avc->width);

    avio_wl32(pb, 0xC);

    avio_wl24(pb, 0); // hrd_buffer

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

    avio_wl32(pb, 0); // hrd_rate

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

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

    else

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

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

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void spapr_machine_2_3_class_init(ObjectClass *oc, void *data)

+{
+
+    MachineClass *mc = MACHINE_CLASS(oc);
+

     mc->name = "pseries-2.3";

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

{

    MachineClass *mc = MACHINE_CLASS(oc);

    mc->name = "pseries-2.3";

    mc->desc = "pSeries Logical Partition (PAPR compliant) v2.3";

    mc->alias = "pseries";

    mc->is_default = 1;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,

                          int flags)
+
 {
+
     MIPSCPU *cpu = MIPS_CPU(cs);

     CPUMIPSState *env = &cpu->env;
@@ -13,8 +13,8 @@

     cpu_fprintf(f, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx
+
+                " LO=0x" TARGET_FMT_lx " ds %04x "

                 TARGET_FMT_lx " " TARGET_FMT_ld "\n",

void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,

                         int flags)

{

    MIPSCPU *cpu = MIPS_CPU(cs);

    CPUMIPSState *env = &cpu->env;

    int i;

    cpu_fprintf(f, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx

                " LO=0x" TARGET_FMT_lx " ds %04x "

                TARGET_FMT_lx " " TARGET_FMT_ld "\n",

                env->active_tc.PC, env->active_tc.HI[0], env->active_tc.LO[0],

                env->hflags, env->btarget, env->bcond);

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

        if ((i & 3) == 0)

            cpu_fprintf(f, "GPR%02d:", i);

        cpu_fprintf(f, " %s " TARGET_FMT_lx, regnames[i], env->active_tc.gpr[i]);

        if ((i & 3) == 3)

            cpu_fprintf(f, "\n");

    }

    cpu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

                env->CP0_Status, env->CP0_Cause, env->CP0_EPC);

    cpu_fprintf(f, "    Config0 0x%08x Config1 0x%08x LLAddr 0x%016"

                PRIx64 "\n",

                env->CP0_Config0, env->CP0_Config1, env->lladdr);

    cpu_fprintf(f, "    Config2 0x%08x Config3 0x%08x\n",

                env->CP0_Config2, env->CP0_Config3);

    cpu_fprintf(f, "    Config4 0x%08x Config5 0x%08x\n",

                env->CP0_Config4, env->CP0_Config5);

    if (env->hflags & MIPS_HFLAG_FPU)

        fpu_dump_state(env, f, cpu_fprintf, flags);

#if defined(TARGET_MIPS64) && defined(MIPS_DEBUG_SIGN_EXTENSIONS)

    cpu_mips_check_sign_extensions(env, f, cpu_fprintf, flags);

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void qemu_chr_parse_common(QemuOpts *opts, ChardevCommon *backend)
+
+{
+
+    const char *logfile = qemu_opt_get(opts, "logfile");

static void qemu_chr_parse_common(QemuOpts *opts, ChardevCommon *backend)

{

    const char *logfile = qemu_opt_get(opts, "logfile");

    backend->has_logfile = logfile != NULL;

    backend->logfile = logfile ? g_strdup(logfile) : NULL;

    backend->has_logappend = true;

    backend->logappend = qemu_opt_get_bool(opts, "logappend", false);

}


static int curl_aio_flush(void *opaque)

{

    BDRVCURLState *s = opaque;

    int i, j;

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

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

            if (s->states[i].acb[j]) {

                return 1;

            }

        }

    }

    return 0;

}


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

 {

+    DeviceState *dev;

DeviceState *qdev_create(BusState *bus, const char *name)

{

    DeviceState *dev;

    dev = qdev_try_create(bus, name);

    if (!dev) {

        hw_error("Unknown device '%s' for bus '%s'\n", name, bus->info->name);

    }

    return dev;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 int64_t HELPER(nabs_i64)(int64_t val)

 {
+
+    if (val < 0) {
+
         return val;

     } else {

int64_t HELPER(nabs_i64)(int64_t val)

{

    if (val < 0) {

        return val;

    } else {

        return -val;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void nbd_client_new(NBDExport *exp,

                     QIOChannelSocket *sioc,

@@ -13,7 +13,7 @@
     NBDClient *client;

     NBDClientNewData *data = g_new(NBDClientNewData, 1);
+

     client = g_malloc0(sizeof(NBDClient));

void nbd_client_new(NBDExport *exp,

                    QIOChannelSocket *sioc,

                    QCryptoTLSCreds *tlscreds,

                    const char *tlsaclname,

                    void (*close_fn)(NBDClient *))

{

    NBDClient *client;

    NBDClientNewData *data = g_new(NBDClientNewData, 1);

    client = g_malloc0(sizeof(NBDClient));

    client->refcount = 1;

    client->exp = exp;

    client->tlscreds = tlscreds;

    if (tlscreds) {

        object_ref(OBJECT(client->tlscreds));

    }

    client->tlsaclname = g_strdup(tlsaclname);

    client->sioc = sioc;

    object_ref(OBJECT(client->sioc));

    client->ioc = QIO_CHANNEL(sioc);

    object_ref(OBJECT(client->ioc));

    client->close = close_fn;

    data->client = client;

    data->co = qemu_coroutine_create(nbd_co_client_start, data);

    qemu_coroutine_enter(data->co);

}


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

     AioContext *ctx = (AioContext *) source;

+
+
+    assert(callback == NULL);
+
     aio_dispatch(ctx, true);

     return true;

aio_ctx_dispatch(GSource     *source,

                 GSourceFunc  callback,

                 gpointer     user_data)

{

    AioContext *ctx = (AioContext *) source;

    assert(callback == NULL);

    aio_dispatch(ctx, true);

    return true;

}


--- a/source.c
+++ b/source.c
@@ -13,9 +13,9 @@
         bs->open_flags |= BDRV_O_CACHE_WB;

     } else {
+
+        bs->open_flags &= ~BDRV_O_CACHE_WB;
+
+    }
+
 }

void bdrv_set_enable_write_cache(BlockDriverState *bs, bool wce)

{

    bs->enable_write_cache = wce;

    /* so a reopen() will preserve wce */

    if (wce) {

        bs->open_flags |= BDRV_O_CACHE_WB;

    } else {

        bs->open_flags &= ~BDRV_O_CACHE_WB;

    }

}


--- 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
@@ -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
@@ -2,11 +2,11 @@
                                                         uint32_t id)
 {
     int i;
+    MatroskaLevel1Element *elem;
+    // Some files link to all clusters; useless.
+    if (id == MATROSKA_ID_CLUSTER)
+    // There can be multiple seekheads.
+    if (id != MATROSKA_ID_SEEKHEAD) {
         for (i = 0; i < matroska->num_level1_elems; i++) {
             if (matroska->level1_elems[i].id == id)
                 return &matroska->level1_elems[i];

static MatroskaLevel1Element *matroska_find_level1_elem(MatroskaDemuxContext *matroska,
                                                        uint32_t id)
{
    int i;
    MatroskaLevel1Element *elem;
    // Some files link to all clusters; useless.
    if (id == MATROSKA_ID_CLUSTER)
    // There can be multiple seekheads.
    if (id != MATROSKA_ID_SEEKHEAD) {
        for (i = 0; i < matroska->num_level1_elems; i++) {
            if (matroska->level1_elems[i].id == id)
                return &matroska->level1_elems[i];
        }
    }
    // Only a completely broken file would have more elements.
    // It also provides a low-effort way to escape from circular seekheads
    // (every iteration will add a level1 entry).
    if (matroska->num_level1_elems >= FF_ARRAY_ELEMS(matroska->level1_elems)) {
        av_log(matroska->ctx, AV_LOG_ERROR, "Too many level1 elements or circular seekheads.\n");
    }
    elem = &matroska->level1_elems[matroska->num_level1_elems++];
    *elem = (MatroskaLevel1Element){.id = id};
    return elem;
}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void object_get_link_property(Object *obj, Visitor *v, void *opaque,
+
                                      const char *name, Error **errp)

 {

static void object_get_link_property(Object *obj, Visitor *v, void *opaque,

                                     const char *name, Error **errp)

{

    Object **child = opaque;

    gchar *path;

    if (*child) {

        path = object_get_canonical_path(*child);

        visit_type_str(v, &path, name, errp);

        g_free(path);

    } else {

        path = (gchar *)"";

        visit_type_str(v, &path, name, errp);

    }

}


--- a/source.c
+++ b/source.c
@@ -45,11 +45,11 @@
                 codec_string, codec->name);

         codec = encoder ?
+
+            avcodec_find_encoder(codec->id) :
+
+            avcodec_find_decoder(codec->id);
+
         if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))

             fprintf(stderr, "Or use the non experimental %s '%s'.\n",

static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict)

{

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

    AVCodec *codec;

    if(!name)

        return CODEC_ID_NONE;

    codec = encoder ?

        avcodec_find_encoder_by_name(name) :

        avcodec_find_decoder_by_name(name);

    if(!codec) {

        fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);

        ffmpeg_exit(1);

    }

    if(codec->type != type) {

        fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);

        ffmpeg_exit(1);

    }

    if(codec->capabilities & CODEC_CAP_EXPERIMENTAL &&

       strict > FF_COMPLIANCE_EXPERIMENTAL) {

        fprintf(stderr, "%s '%s' is experimental and might produce bad "

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

                codec_string, codec->name);

        codec = encoder ?

            avcodec_find_encoder(codec->id) :

            avcodec_find_decoder(codec->id);

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

            fprintf(stderr, "Or use the non experimental %s '%s'.\n",

                    codec_string, codec->name);

        ffmpeg_exit(1);

    }

    return codec->id;

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
+static uint64_t boston_lcd_read(void *opaque, hwaddr addr,
+
+                                unsigned size)
+
+{
+
+    BostonState *s = opaque;
+
+    uint64_t val = 0;
+
+
+
+    switch (size) {

+    case 8:

         val |= (uint64_t)s->lcd_content[(addr + 7) & 0x7] << 56;

static uint64_t boston_lcd_read(void *opaque, hwaddr addr,

                                unsigned size)

{

    BostonState *s = opaque;

    uint64_t val = 0;

    switch (size) {

    case 8:

        val |= (uint64_t)s->lcd_content[(addr + 7) & 0x7] << 56;

        val |= (uint64_t)s->lcd_content[(addr + 6) & 0x7] << 48;

        val |= (uint64_t)s->lcd_content[(addr + 5) & 0x7] << 40;

        val |= (uint64_t)s->lcd_content[(addr + 4) & 0x7] << 32;

        /* fall through */

    case 4:

        val |= (uint64_t)s->lcd_content[(addr + 3) & 0x7] << 24;

        val |= (uint64_t)s->lcd_content[(addr + 2) & 0x7] << 16;

        /* fall through */

    case 2:

        val |= (uint64_t)s->lcd_content[(addr + 1) & 0x7] << 8;

        /* fall through */

    case 1:

        val |= (uint64_t)s->lcd_content[(addr + 0) & 0x7];

        break;

    }

    return val;

}


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

                               uint32_t value)

+{

     m5206_mbar_state *s = (m5206_mbar_state *)opaque;

static void m5206_mbar_writel(void *opaque, target_phys_addr_t offset,

                              uint32_t value)

{

    m5206_mbar_state *s = (m5206_mbar_state *)opaque;

    int width;

    offset &= 0x3ff;

    if (offset > 0x200) {

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

    }

    width = m5206_mbar_width[offset >> 2];

    if (width < 4) {

        m5206_mbar_writew(opaque, offset, value >> 16);

        m5206_mbar_writew(opaque, offset + 2, value & 0xffff);

        return;

    }

    m5206_mbar_write(s, offset, value, 4);

}


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

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

+        return bs->drv->bdrv_debug_remove_breakpoint(bs, tag);
+
+    }
+
+

     return -ENOTSUP;

int bdrv_debug_remove_breakpoint(BlockDriverState *bs, const char *tag)

{

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

        bs = bs->file;

    }

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

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

    }

    return -ENOTSUP;

}


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

     unsigned *bsel_alloc = opaque;

+    unsigned *bus_bsel;

static void *acpi_set_bsel(PCIBus *bus, void *opaque)

{

    unsigned *bsel_alloc = opaque;

    unsigned *bus_bsel;

    if (qbus_is_hotpluggable(BUS(bus))) {

        bus_bsel = g_malloc(sizeof *bus_bsel);

        *bus_bsel = (*bsel_alloc)++;

        object_property_add_uint32_ptr(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,

                                       bus_bsel, NULL);

    }

    return bsel_alloc;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void mvp_init (CPUMIPSState *env, const mips_def_t *def)

 {
+
+    env->mvp = qemu_mallocz(sizeof(CPUMIPSMVPContext));
+
+
+
     /* MVPConf1 implemented, TLB sharable, no gating storage support,

        programmable cache partitioning implemented, number of allocatable

static void mvp_init (CPUMIPSState *env, const mips_def_t *def)

{

    env->mvp = qemu_mallocz(sizeof(CPUMIPSMVPContext));

    /* MVPConf1 implemented, TLB sharable, no gating storage support,

       programmable cache partitioning implemented, number of allocatable

       and sharable TLB entries, MVP has allocatable TCs, 2 VPEs

       implemented, 5 TCs implemented. */

    env->mvp->CP0_MVPConf0 = (1 << CP0MVPC0_M) | (1 << CP0MVPC0_TLBS) |

                             (0 << CP0MVPC0_GS) | (1 << CP0MVPC0_PCP) |

// TODO: actually do 2 VPEs.

//                             (1 << CP0MVPC0_TCA) | (0x1 << CP0MVPC0_PVPE) |

//                             (0x04 << CP0MVPC0_PTC);

                             (1 << CP0MVPC0_TCA) | (0x0 << CP0MVPC0_PVPE) |

                             (0x04 << CP0MVPC0_PTC);

    /* Usermode has no TLB support */

    if (!env->user_mode_only)

        env->mvp->CP0_MVPConf0 |= (env->tlb->nb_tlb << CP0MVPC0_PTLBE);

    /* Allocatable CP1 have media extensions, allocatable CP1 have FP support,

       no UDI implemented, no CP2 implemented, 1 CP1 implemented. */

    env->mvp->CP0_MVPConf1 = (1 << CP0MVPC1_CIM) | (1 << CP0MVPC1_CIF) |

                             (0x0 << CP0MVPC1_PCX) | (0x0 << CP0MVPC1_PCP2) |

                             (0x1 << CP0MVPC1_PCP1);

}


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

     CPUState *cs = CPU(obj);
+
     SuperHCPU *cpu = SUPERH_CPU(obj);

     CPUSH4State *env = &cpu->env;

static void superh_cpu_initfn(Object *obj)

{

    CPUState *cs = CPU(obj);

    SuperHCPU *cpu = SUPERH_CPU(obj);

    CPUSH4State *env = &cpu->env;

    cs->env_ptr = env;

    cpu_exec_init(cs, &error_abort);

    env->movcal_backup_tail = &(env->movcal_backup);

    if (tcg_enabled()) {

        sh4_translate_init();

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int coroutine_fn nfs_co_readv(BlockDriverState *bs,
+
+                                     int64_t sector_num, int nb_sectors,
+
+                                     QEMUIOVector *iov)

 {

static int coroutine_fn nfs_co_readv(BlockDriverState *bs,

                                     int64_t sector_num, int nb_sectors,

                                     QEMUIOVector *iov)

{

    NFSClient *client = bs->opaque;

    NFSRPC task;

    nfs_co_init_task(client, &task);

    task.iov = iov;

    if (nfs_pread_async(client->context, client->fh,

                        sector_num * BDRV_SECTOR_SIZE,

                        nb_sectors * BDRV_SECTOR_SIZE,

                        nfs_co_generic_cb, &task) != 0) {

        return -ENOMEM;

    }

    while (!task.complete) {

        nfs_set_events(client);

        qemu_coroutine_yield();

    }

    if (task.ret < 0) {

        return task.ret;

    }

    /* zero pad short reads */

    if (task.ret < iov->size) {

        qemu_iovec_memset(iov, task.ret, 0, iov->size - task.ret);

    }

    return 0;

}


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

 {
+
+    av_frame_free(&avctx->coded_frame);

     return 0;

static av_cold int pnm_encode_close(AVCodecContext *avctx)

{

    av_frame_free(&avctx->coded_frame);

    return 0;

}


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

         s->lambda= s->lambda_table[0];

+        //FIXME broken
+
+    }else
+
+        s->lambda= s->current_picture.quality;

 //printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality);

static int estimate_qp(MpegEncContext *s, int dry_run){

    if (s->next_lambda){

        s->current_picture_ptr->quality=

        s->current_picture.quality = s->next_lambda;

        if(!dry_run) s->next_lambda= 0;

    } else if (!s->fixed_qscale) {

        s->current_picture_ptr->quality=

        s->current_picture.quality = ff_rate_estimate_qscale(s, dry_run);

        if (s->current_picture.quality < 0)

            return -1;

    }

    if(s->adaptive_quant){

        switch(s->codec_id){

        case CODEC_ID_MPEG4:

            if (CONFIG_MPEG4_ENCODER)

                ff_clean_mpeg4_qscales(s);

            break;

        case CODEC_ID_H263:

        case CODEC_ID_H263P:

        case CODEC_ID_FLV1:

            if (CONFIG_H263_ENCODER||CONFIG_H263P_ENCODER||CONFIG_FLV_ENCODER)

                ff_clean_h263_qscales(s);

            break;

        }

        s->lambda= s->lambda_table[0];

        //FIXME broken

    }else

        s->lambda= s->current_picture.quality;

//printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality);

    update_qscale(s);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)

 {
+
+    TAKDemuxContext *tc = s->priv_data;
+
+    int ret;
+

     if (tc->mlast_frame) {

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

{

    TAKDemuxContext *tc = s->priv_data;

    int ret;

    if (tc->mlast_frame) {

        AVIOContext *pb = s->pb;

        int64_t size, left;

        left = tc->data_end - avio_tell(s->pb);

        size = FFMIN(left, 1024);

        if (size <= 0)

            return AVERROR_EOF;

        ret = av_get_packet(pb, pkt, size);

        if (ret < 0)

            return ret;

        pkt->stream_index = 0;

    } else {

        ret = ff_raw_read_partial_packet(s, pkt);

    }

    return ret;

}


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

     {

+        case R_TCSR:
+
+            if (value & TCSR_TINT)
+
+                value &= ~TCSR_TINT;

timer_write(void *opaque, hwaddr addr,

            uint64_t val64, unsigned int size)

{

    struct timerblock *t = opaque;

    struct xlx_timer *xt;

    unsigned int timer;

    uint32_t value = val64;

    addr >>= 2;

    timer = timer_from_addr(addr);

    xt = &t->timers[timer];

    D(fprintf(stderr, "%s addr=%x val=%x (timer=%d off=%d)\n",

             __func__, addr * 4, value, timer, addr & 3));

    /* Further decoding to address a specific timers reg.  */

    addr &= 3;

    switch (addr)

    {

        case R_TCSR:

            if (value & TCSR_TINT)

                value &= ~TCSR_TINT;

            xt->regs[addr] = value;

            if (value & TCSR_ENT)

                timer_enable(xt);

            break;

        default:

            if (addr < ARRAY_SIZE(xt->regs))

                xt->regs[addr] = value;

            break;

    }

    timer_update_irq(t);

}


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

     s->height = height;
+
+}

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

    s->coded_width = width;

    s->coded_height= height;

    s->width  = width;

    s->height = height;

}


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

 {

+    DeviceState *dev;
+
+
+
+    if (nand_flash_ids[chip_id].size == 0) {

         hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__);

DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id)

{

    DeviceState *dev;

    if (nand_flash_ids[chip_id].size == 0) {

        hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__);

    }

    dev = DEVICE(object_new(TYPE_NAND));

    qdev_prop_set_uint8(dev, "manufacturer_id", manf_id);

    qdev_prop_set_uint8(dev, "chip_id", chip_id);

    if (blk) {

        qdev_prop_set_drive(dev, "drive", blk, &error_fatal);

    }

    qdev_init_nofail(dev);

    return dev;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int qcow2_mark_clean(BlockDriverState *bs)

 {
+
     BDRVQcowState *s = bs->opaque;

+
     if (s->incompatible_features & QCOW2_INCOMPAT_DIRTY) {

         int ret = bdrv_flush(bs);

static int qcow2_mark_clean(BlockDriverState *bs)

{

    BDRVQcowState *s = bs->opaque;

    if (s->incompatible_features & QCOW2_INCOMPAT_DIRTY) {

        int ret = bdrv_flush(bs);

        if (ret < 0) {

            return ret;

        }

        s->incompatible_features &= ~QCOW2_INCOMPAT_DIRTY;

        return qcow2_update_header(bs);

    }

    return 0;

}


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

             avpriv_fmt_conversion_table[i].codec_id == codec_id) {

+            return avpriv_fmt_conversion_table[i].ff_fmt;
+
+        }
+
+    }

enum AVPixelFormat avpriv_fmt_v4l2ff(uint32_t v4l2_fmt, enum AVCodecID codec_id)

{

    int i;

    for (i = 0; avpriv_fmt_conversion_table[i].codec_id != AV_CODEC_ID_NONE; i++) {

        if (avpriv_fmt_conversion_table[i].v4l2_fmt == v4l2_fmt &&

            avpriv_fmt_conversion_table[i].codec_id == codec_id) {

            return avpriv_fmt_conversion_table[i].ff_fmt;

        }

    }

    return AV_PIX_FMT_NONE;

}


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

+    phys_ram_dirty = qemu_realloc(phys_ram_dirty,
+
+        (last_ram_offset + size) >> TARGET_PAGE_BITS);
+
+    memset(phys_ram_dirty + (last_ram_offset >> TARGET_PAGE_BITS),

            0xff, size >> TARGET_PAGE_BITS);

ram_addr_t qemu_ram_alloc(ram_addr_t size)

{

    RAMBlock *new_block;

#ifdef CONFIG_KQEMU

    if (kqemu_phys_ram_base) {

        return kqemu_ram_alloc(size);

    }

#endif

    size = TARGET_PAGE_ALIGN(size);

    new_block = qemu_malloc(sizeof(*new_block));

    new_block->host = qemu_vmalloc(size);

    new_block->offset = last_ram_offset;

    new_block->length = size;

    new_block->next = ram_blocks;

    ram_blocks = new_block;

    phys_ram_dirty = qemu_realloc(phys_ram_dirty,

        (last_ram_offset + size) >> TARGET_PAGE_BITS);

    memset(phys_ram_dirty + (last_ram_offset >> TARGET_PAGE_BITS),

           0xff, size >> TARGET_PAGE_BITS);

    last_ram_offset += size;

    if (kvm_enabled())

        kvm_setup_guest_memory(new_block->host, size);

    return new_block->offset;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void gen_check_cpenable(DisasContext *dc, unsigned cp)

 {

static void gen_check_cpenable(DisasContext *dc, unsigned cp)

{

    if (option_enabled(dc, XTENSA_OPTION_COPROCESSOR) &&

            !(dc->cpenable & (1 << cp))) {

        gen_exception_cause(dc, COPROCESSOR0_DISABLED + cp);

        dc->is_jmp = DISAS_UPDATE;

    }

}


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

                                             uint64_t *values)

+{

     uint32_t *propcells;

@@ -19,7 +19,7 @@
     uint32_t hival;

+
     propcells = g_new0(uint32_t, numvalues * 2);

int qemu_fdt_setprop_sized_cells_from_array(void *fdt,

                                            const char *node_path,

                                            const char *property,

                                            int numvalues,

                                            uint64_t *values)

{

    uint32_t *propcells;

    uint64_t value;

    int cellnum, vnum, ncells;

    uint32_t hival;

    propcells = g_new0(uint32_t, numvalues * 2);

    cellnum = 0;

    for (vnum = 0; vnum < numvalues; vnum++) {

        ncells = values[vnum * 2];

        if (ncells != 1 && ncells != 2) {

            return -1;

        }

        value = values[vnum * 2 + 1];

        hival = cpu_to_be32(value >> 32);

        if (ncells > 1) {

            propcells[cellnum++] = hival;

        } else if (hival != 0) {

            return -1;

        }

        propcells[cellnum++] = cpu_to_be32(value);

    }

    return qemu_fdt_setprop(fdt, node_path, property, propcells,

                            cellnum * sizeof(uint32_t));

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 iscsi_unmap_cb(struct iscsi_context *iscsi, int status,

                      void *command_data, void *opaque)
+
+{
+
     IscsiAIOCB *acb = opaque;

@@ -12,8 +12,8 @@

         qemu_aio_release(acb);

+        scsi_free_scsi_task(acb->task);
+
         acb->task = NULL;

         return;

iscsi_unmap_cb(struct iscsi_context *iscsi, int status,

                     void *command_data, void *opaque)

{

    IscsiAIOCB *acb = opaque;

    if (acb->canceled != 0) {

        qemu_aio_release(acb);

        scsi_free_scsi_task(acb->task);

        acb->task = NULL;

        return;

    }

    acb->status = 0;

    if (status < 0) {

        error_report("Failed to unmap data on iSCSI lun. %s",

                     iscsi_get_error(iscsi));

        acb->status = -EIO;

    }

    iscsi_schedule_bh(acb);

    scsi_free_scsi_task(acb->task);

    acb->task = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
+static void vp8_decode_flush_impl(AVCodecContext *avctx, int force, int is_close)

 {
+
     VP8Context *s = avctx->priv_data;
+
     int i;

+
+
     if (!avctx->is_copy || force) {

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

static void vp8_decode_flush_impl(AVCodecContext *avctx, int force, int is_close)

{

    VP8Context *s = avctx->priv_data;

    int i;

    if (!avctx->is_copy || force) {

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

            if (s->frames[i].data[0])

                vp8_release_frame(s, &s->frames[i], is_close);

    }

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

    free_buffers(s);

    s->maps_are_invalid = 1;

}


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

 {

+    int i;

     float *output = sce->ret_buf;

static void apply_window_and_mdct(AACEncContext *s, SingleChannelElement *sce,

                                  float *audio)

{

    int i;

    float *output = sce->ret_buf;

    apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, audio);

    if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE)

        s->mdct1024.mdct_calc(&s->mdct1024, sce->coeffs, output);

    else

        for (i = 0; i < 1024; i += 128)

            s->mdct128.mdct_calc(&s->mdct128, sce->coeffs + i, output + i*2);

    memcpy(audio, audio + 1024, sizeof(audio[0]) * 1024);

    memcpy(sce->pcoeffs, sce->coeffs, sizeof(sce->pcoeffs));

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)

+{
+
+    int ret;
+
+    FILE *f = fopen(filename, "rb");

int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)

{

    int ret;

    FILE *f = fopen(filename, "rb");

    if (!f) {

        av_log(NULL, AV_LOG_ERROR, "Cannot read file '%s': %s\n", filename,

               strerror(errno));

        return AVERROR(errno);

    }

    fseek(f, 0, SEEK_END);

    *size = ftell(f);

    fseek(f, 0, SEEK_SET);

    *bufptr = av_malloc(*size + 1);

    if (!*bufptr) {

        av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n");

        fclose(f);

        return AVERROR(ENOMEM);

    }

    ret = fread(*bufptr, 1, *size, f);

    if (ret < *size) {

        av_free(*bufptr);

        if (ferror(f)) {

            av_log(NULL, AV_LOG_ERROR, "Error while reading file '%s': %s\n",

                   filename, strerror(errno));

            ret = AVERROR(errno);

        } else

            ret = AVERROR_EOF;

    } else {

        ret = 0;

        (*bufptr)[(*size)++] = '\0';

    }

    fclose(f);

    return ret;

}


static void gen_lswx(DisasContext *ctx)

{

    TCGv t0;

    TCGv_i32 t1, t2, t3;

    gen_set_access_type(ctx, ACCESS_INT);

    /* NIP cannot be restored if the memory exception comes from an helper */

    gen_update_nip(ctx, ctx->nip - 4);

    t0 = tcg_temp_new();

    gen_addr_reg_index(ctx, t0);

    t1 = tcg_const_i32(rD(ctx->opcode));

    t2 = tcg_const_i32(rA(ctx->opcode));

    t3 = tcg_const_i32(rB(ctx->opcode));

    gen_helper_lswx(cpu_env, t0, t1, t2, t3);

    tcg_temp_free(t0);

    tcg_temp_free_i32(t1);

    tcg_temp_free_i32(t2);

    tcg_temp_free_i32(t3);

}


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

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

      */

void HELPER(wfe)(CPUARMState *env)

{

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

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

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

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

     * a configurable trap to a different exception level.

     */

    cs->exception_index = EXCP_YIELD;

    cpu_loop_exit(cs);

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     unsigned char pixel, count;

     unsigned char *orig = out_buf;
+

     while (1) {

static int expand_rle_row(SgiState *s, uint8_t *out_buf,

                          uint8_t *out_end, int pixelstride)

{

    unsigned char pixel, count;

    unsigned char *orig = out_buf;

    while (1) {

        if (bytestream2_get_bytes_left(&s->g) < 1)

            return AVERROR_INVALIDDATA;

        pixel = bytestream2_get_byteu(&s->g);

        if (!(count = (pixel & 0x7f))) {

            return (out_buf - orig) / pixelstride;

        }

        /* Check for buffer overflow. */

        if(out_buf + pixelstride * count >= out_end) return -1;

        if (pixel & 0x80) {

            while (count--) {

                *out_buf = bytestream2_get_byte(&s->g);

                out_buf += pixelstride;

            }

        } else {

            pixel = bytestream2_get_byte(&s->g);

            while (count--) {

                *out_buf = pixel;

                out_buf += pixelstride;

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     if (bytestream2_get_bytes_left(gbytes) < entries * 12) {

         return AVERROR_INVALIDDATA;
+
+    }
+
+
+
     for (i = 0; i < entries; i++) {

         if ((ret = exif_decode_tag(logctx, gbytes, le, depth, metadata)) < 0) {

int avpriv_exif_decode_ifd(void *logctx, GetByteContext *gbytes, int le,

                           int depth, AVDictionary **metadata)

{

    int i, ret;

    int entries;

    entries = ff_tget_short(gbytes, le);

    if (bytestream2_get_bytes_left(gbytes) < entries * 12) {

        return AVERROR_INVALIDDATA;

    }

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

        if ((ret = exif_decode_tag(logctx, gbytes, le, depth, metadata)) < 0) {

            return ret;

        }

    }

    // return next IDF offset or 0x000000000 or a value < 0 for failure

    return ff_tget_long(gbytes, le);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static bool pte32_match(target_ulong pte0, target_ulong pte1,

                         bool secondary, target_ulong ptem)
+
+{
+
     return (pte0 & HPTE32_V_VALID)

         && (secondary == !!(pte0 & HPTE32_V_SECONDARY))

static bool pte32_match(target_ulong pte0, target_ulong pte1,

                        bool secondary, target_ulong ptem)

{

    return (pte0 & HPTE32_V_VALID)

        && (secondary == !!(pte0 & HPTE32_V_SECONDARY))

        && HPTE32_V_COMPARE(pte0, ptem);

}


static int mpc8_probe(AVProbeData *p)

{

    const uint8_t *bs = p->buf + 4;

    const uint8_t *bs_end = bs + p->buf_size;

    int64_t size;

    if (p->buf_size < 16)

        return 0;

    if (AV_RL32(p->buf) != TAG_MPCK)

        return 0;

    while (bs < bs_end + 3) {

        int header_found = (bs[0] == 'S' && bs[1] == 'H');

        if (bs[0] < 'A' || bs[0] > 'Z' || bs[1] < 'A' || bs[1] > 'Z')

            return 0;

        bs += 2;

        size = bs_get_v(&bs);

        if (size < 2)

            return 0;

        if (bs + size - 2 >= bs_end)

            return AVPROBE_SCORE_EXTENSION - 1; // seems to be valid MPC but no header yet

        if (header_found) {

            if (size < 11 || size > 28)

                return 0;

            if (!AV_RL32(bs)) //zero CRC is invalid

                return 0;

            return AVPROBE_SCORE_MAX;

        } else {

            bs += size - 2;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first)
+
+{
+
+    unsigned i, bit;

     uint64_t pos;

void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first)

{

    unsigned i, bit;

    uint64_t pos;

    hbi->hb = hb;

    pos = first >> hb->granularity;

    hbi->pos = pos >> BITS_PER_LEVEL;

    hbi->granularity = hb->granularity;

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

        bit = pos & (BITS_PER_LONG - 1);

        pos >>= BITS_PER_LEVEL;

        /* Drop bits representing items before first.  */

        hbi->cur[i] = hb->levels[i][pos] & ~((1UL << bit) - 1);

        /* We have already added level i+1, so the lowest set bit has

         * been processed.  Clear it.

         */

        if (i != HBITMAP_LEVELS - 1) {

            hbi->cur[i] &= ~(1UL << bit);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     QObjectInputVisitor *qiv = to_qiv(v);

     QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
+
     QInt *qint;

static void qobject_input_type_int64(Visitor *v, const char *name, int64_t *obj,

                                     Error **errp)

{

    QObjectInputVisitor *qiv = to_qiv(v);

    QObject *qobj = qobject_input_get_object(qiv, name, true, errp);

    QInt *qint;

    if (!qobj) {

        return;

    }

    qint = qobject_to_qint(qobj);

    if (!qint) {

        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",

                   "integer");

        return;

    }

    *obj = qint_get_int(qint);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void vnc_dpy_update(DisplayChangeListener *dcl,

+                           DisplayState *ds,

                            int x, int y, int w, int h)

static void vnc_dpy_update(DisplayChangeListener *dcl,

                           DisplayState *ds,

                           int x, int y, int w, int h)

{

    int i;

    VncDisplay *vd = ds->opaque;

    struct VncSurface *s = &vd->guest;

    int width = ds_get_width(ds);

    int height = ds_get_height(ds);

    h += y;

    /* round x down to ensure the loop only spans one 16-pixel block per,

       iteration.  otherwise, if (x % 16) != 0, the last iteration may span

       two 16-pixel blocks but we only mark the first as dirty

    */

    w += (x % 16);

    x -= (x % 16);

    x = MIN(x, width);

    y = MIN(y, height);

    w = MIN(x + w, width) - x;

    h = MIN(h, height);

    for (; y < h; y++)

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

            set_bit((x + i) / 16, s->dirty[y]);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+uint64_t helper_sublv(CPUAlphaState *env, uint64_t op1, uint64_t op2)
+
+{
+
+    uint32_t res;

+    res = op1 - op2;

     if (unlikely((op1 ^ op2) & (res ^ op1) & (1UL << 31))) {

uint64_t helper_sublv(CPUAlphaState *env, uint64_t op1, uint64_t op2)

{

    uint32_t res;

    res = op1 - op2;

    if (unlikely((op1 ^ op2) & (res ^ op1) & (1UL << 31))) {

        arith_excp(env, GETPC(), EXC_M_IOV, 0);

    }

    return res;

}


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

     qemu_mutex_init(&ram_list.mutex);

+    memory_map_init();
+
+    io_mem_init();

 #endif

void cpu_exec_init_all(void)

{

#if !defined(CONFIG_USER_ONLY)

    qemu_mutex_init(&ram_list.mutex);

    memory_map_init();

    io_mem_init();

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void qcow2_close(BlockDriverState *bs)

+{

     BDRVQcowState *s = bs->opaque;

static void qcow2_close(BlockDriverState *bs)

{

    BDRVQcowState *s = bs->opaque;

    g_free(s->l1_table);

    /* else pre-write overlap checks in cache_destroy may crash */

    s->l1_table = NULL;

    if (!(bs->open_flags & BDRV_O_INCOMING)) {

        qcow2_cache_flush(bs, s->l2_table_cache);

        qcow2_cache_flush(bs, s->refcount_block_cache);

        qcow2_mark_clean(bs);

    }

    qcow2_cache_destroy(bs, s->l2_table_cache);

    qcow2_cache_destroy(bs, s->refcount_block_cache);

    g_free(s->unknown_header_fields);

    cleanup_unknown_header_ext(bs);

    g_free(s->cluster_cache);

    qemu_vfree(s->cluster_data);

    qcow2_refcount_close(bs);

    qcow2_free_snapshots(bs);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int get_qcc(J2kDecoderContext *s, int n, J2kQuantStyle *q, uint8_t *properties)

+{
+
     int compno;

static int get_qcc(J2kDecoderContext *s, int n, J2kQuantStyle *q, uint8_t *properties)

{

    int compno;

    if (s->buf_end - s->buf < 1)

        return AVERROR(EINVAL);

    compno = bytestream_get_byte(&s->buf);

    properties[compno] |= HAD_QCC;

    return get_qcx(s, n-1, q+compno);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void monitor_protocol_emitter(Monitor *mon, QObject *data,
+
+                                     QError *err)
+
+{

     QDict *qmp;

static void monitor_protocol_emitter(Monitor *mon, QObject *data,

                                     QError *err)

{

    QDict *qmp;

    trace_monitor_protocol_emitter(mon);

    if (!err) {

        /* success response */

        qmp = qdict_new();

        if (data) {

            qobject_incref(data);

            qdict_put_obj(qmp, "return", data);

        } else {

            /* return an empty QDict by default */

            qdict_put(qmp, "return", qdict_new());

        }

    } else {

        /* error response */

        qmp = build_qmp_error_dict(err);

    }

    if (mon->mc->id) {

        qdict_put_obj(qmp, "id", mon->mc->id);

        mon->mc->id = NULL;

    }

    monitor_json_emitter(mon, QOBJECT(qmp));

    QDECREF(qmp);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp)

+{

     unix_nonblocking_connect(path, unix_wait_for_connect, s, errp);

void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp)

{

    unix_nonblocking_connect(path, unix_wait_for_connect, s, errp);

}


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

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


--- a/source.c
+++ b/source.c
@@ -7,10 +7,10 @@
     port->opaque = opaque;

     port->index = index;
+
+    port->attach = attach;
+
+    TAILQ_INSERT_TAIL(&bus->free, port, next);

     bus->nfree++;

void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,

                       usb_attachfn attach)

{

    port->opaque = opaque;

    port->index = index;

    port->attach = attach;

    TAILQ_INSERT_TAIL(&bus->free, port, next);

    bus->nfree++;

}


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

 {

+#ifdef TARGET_I386

     uint32_t old = ((CPUX86State*)cpu_env)->regs[R_EAX];

void do_compare_and_swap32(void *cpu_env, int num)

{

#ifdef TARGET_I386

    uint32_t old = ((CPUX86State*)cpu_env)->regs[R_EAX];

    uint32_t *value = (uint32_t*)((CPUX86State*)cpu_env)->regs[R_ECX];

    DPRINTF("commpage: compare_and_swap32(%x,new,%p)\n", old, value);

    if(value && old == tswap32(*value))

    {

        uint32_t new = ((CPUX86State*)cpu_env)->regs[R_EDX];

        *value = tswap32(new);

        /* set zf flag */

        ((CPUX86State*)cpu_env)->eflags |= 0x40;

    }

    else

    {

        ((CPUX86State*)cpu_env)->regs[R_EAX] = tswap32(*value);

        /* unset zf flag */

        ((CPUX86State*)cpu_env)->eflags &= ~0x40;

    }

#else

    qerror("do_compare_and_swap32 unimplemented");

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void ppc_store_msr_32 (CPUPPCState *env, uint32_t value)
+
 {

     do_store_msr(env,

void ppc_store_msr_32 (CPUPPCState *env, uint32_t value)

{

    do_store_msr(env,

                 (do_load_msr(env) & ~0xFFFFFFFFULL) | (value & 0xFFFFFFFF));

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
                        now.size);

         register_subpage(d, &now);
+
+        remain.size -= now.size;
+
+        remain.offset_within_address_space += now.size;
+
         remain.offset_within_region += now.size;

     }

static void mem_add(MemoryListener *listener, MemoryRegionSection *section)

{

    AddressSpaceDispatch *d = container_of(listener, AddressSpaceDispatch, listener);

    MemoryRegionSection now = limit(*section), remain = limit(*section);

    if ((now.offset_within_address_space & ~TARGET_PAGE_MASK)

        || (now.size < TARGET_PAGE_SIZE)) {

        now.size = MIN(TARGET_PAGE_ALIGN(now.offset_within_address_space)

                       - now.offset_within_address_space,

                       now.size);

        register_subpage(d, &now);

        remain.size -= now.size;

        remain.offset_within_address_space += now.size;

        remain.offset_within_region += now.size;

    }

    while (remain.size >= TARGET_PAGE_SIZE) {

        now = remain;

        if (remain.offset_within_region & ~TARGET_PAGE_MASK) {

            now.size = TARGET_PAGE_SIZE;

            register_subpage(d, &now);

        } else {

            now.size &= TARGET_PAGE_MASK;

            register_multipage(d, &now);

        }

        remain.size -= now.size;

        remain.offset_within_address_space += now.size;

        remain.offset_within_region += now.size;

    }

    now = remain;

    if (now.size) {

        register_subpage(d, &now);

    }

}


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

     check_hwrena(env, 4);

target_ulong helper_rdhwr_performance(CPUMIPSState *env)

{

    check_hwrena(env, 4);

    return env->CP0_Performance0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void nvdimm_acpi_hotplug(AcpiNVDIMMState *state)

 {
+
     nvdimm_build_fit_buffer(&state->fit_buf);

 }

void nvdimm_acpi_hotplug(AcpiNVDIMMState *state)

{

    nvdimm_build_fit_buffer(&state->fit_buf);

}


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

 {

+    uint32_t dmalen;

     int target;

static uint32_t get_cmd(ESPState *s, uint8_t *buf)

{

    uint32_t dmalen;

    int target;

    dmalen = s->rregs[ESP_TCLO] | (s->rregs[ESP_TCMID] << 8);

    target = s->wregs[ESP_WBUSID] & 7;

    DPRINTF("get_cmd: len %d target %d\n", dmalen, target);

    if (s->dma) {

        s->dma_memory_read(s->dma_opaque, buf, dmalen);

    } else {

        buf[0] = 0;

        memcpy(&buf[1], s->ti_buf, dmalen);

        dmalen++;

    }

    s->ti_size = 0;

    s->ti_rptr = 0;

    s->ti_wptr = 0;

    if (s->current_dev) {

        /* Started a new command before the old one finished.  Cancel it.  */

        s->current_dev->cancel_io(s->current_dev, 0);

        s->async_len = 0;

    }

    if (target >= ESP_MAX_DEVS || !s->scsi_dev[target]) {

        // No such drive

        s->rregs[ESP_RSTAT] = 0;

        s->rregs[ESP_RINTR] = INTR_DC;

        s->rregs[ESP_RSEQ] = SEQ_0;

        esp_raise_irq(s);

        return 0;

    }

    s->current_dev = s->scsi_dev[target];

    return dmalen;

}


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

         if (hwaccels[i].pix_fmt == pix_fmt &&

+            (!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[i].id == selected_hwaccel_id))
+
+            return &hwaccels[i];
+
     return NULL;

 }

static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt, enum HWAccelID selected_hwaccel_id)

{

    int i;

    for (i = 0; hwaccels[i].name; i++)

        if (hwaccels[i].pix_fmt == pix_fmt &&

            (!selected_hwaccel_id || selected_hwaccel_id == HWACCEL_AUTO || hwaccels[i].id == selected_hwaccel_id))

            return &hwaccels[i];

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static void bt_dummy_lmp_disconnect_master(struct bt_link_s *link)
+
 {

     fprintf(stderr, "%s: stray LMP_detach received, fixme\n", __func__);

static void bt_dummy_lmp_disconnect_master(struct bt_link_s *link)

{

    fprintf(stderr, "%s: stray LMP_detach received, fixme\n", __func__);

    exit(-1);

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c);

     vp56_rac_get(c);
+
+    ff_vp56_init_dequant(s, vp56_rac_gets(c, 6));
+
+    if (s->framep[VP56_FRAME_CURRENT]->key_frame)
+
     {

         vp56_rac_gets(c, 8);

static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,

                            int *golden_frame)

{

    VP56RangeCoder *c = &s->c;

    int rows, cols;

    ff_vp56_init_range_decoder(&s->c, buf, buf_size);

    s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c);

    vp56_rac_get(c);

    ff_vp56_init_dequant(s, vp56_rac_gets(c, 6));

    if (s->framep[VP56_FRAME_CURRENT]->key_frame)

    {

        vp56_rac_gets(c, 8);

        if(vp56_rac_gets(c, 5) > 5)

        vp56_rac_gets(c, 2);

        if (vp56_rac_get(c)) {

            av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n");

        rows = vp56_rac_gets(c, 8);  /* number of stored macroblock rows */

        cols = vp56_rac_gets(c, 8);  /* number of stored macroblock cols */

        vp56_rac_gets(c, 8);  /* number of displayed macroblock rows */

        vp56_rac_gets(c, 8);  /* number of displayed macroblock cols */

        vp56_rac_gets(c, 2);

        if (!s->macroblocks || /* first frame */

            16*cols != s->avctx->coded_width ||

            16*rows != s->avctx->coded_height) {

            avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);

            return 2;

    } else if (!s->macroblocks)

    return 1;


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

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

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

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

{

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

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

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

        return AVERROR(ERANGE);

    }

    switch (o->type) {

    case AV_OPT_TYPE_FLAGS:

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

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

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

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

    case AV_OPT_TYPE_RATIONAL:

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

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

        break;

    default:

        return AVERROR(EINVAL);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 MemoryRegion *pci_address_space_io(PCIDevice *dev)

+{

     return dev->bus->address_space_io;

MemoryRegion *pci_address_space_io(PCIDevice *dev)

{

    return dev->bus->address_space_io;

}


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

         offset = offset >> 9;

+        offset_end = (offset_end + 511) >> 9;
+
+        bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),
+
+                   offset_end - offset);

     }

static void pflash_update(pflash_t *pfl, int offset,

                          int size)

{

    int offset_end;

    if (pfl->bs) {

        offset_end = offset + size;

        /* round to sectors */

        offset = offset >> 9;

        offset_end = (offset_end + 511) >> 9;

        bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9),

                   offset_end - offset);

    }

}


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

     my = y + deltay;

+
+
+    /* check MV against frame boundaries */
+
+    if ((mx < 0) || (mx > ri->width - sz) ||

         (my < 0) || (my > ri->height - sz)) {

static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax,

                                        int deltay, int sz)

{

    int mx, my, cp;

    mx = x + deltax;

    my = y + deltay;

    /* check MV against frame boundaries */

    if ((mx < 0) || (mx > ri->width - sz) ||

        (my < 0) || (my > ri->height - sz)) {

        av_log(ri->avctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",

            mx, my, ri->width, ri->height);

        return;

    }

    if (ri->last_frame->data[0] == NULL) {

        av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");

        return;

    }

    for(cp = 0; cp < 3; cp++) {

        int outstride = ri->current_frame->linesize[cp];

        int instride  = ri->last_frame   ->linesize[cp];

        block_copy(ri->current_frame->data[cp] + y*outstride + x,

                   ri->last_frame->data[cp] + my*instride + mx,

                   outstride, instride, sz);

    }

}


--- a/source.c
+++ b/source.c
@@ -2,11 +2,11 @@
 {
     int mod_state, win;
     struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
+    if (alt_grab) {
+        mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) ==
+            (gui_grab_code | KMOD_LSHIFT);
+    } else if (ctrl_grab) {
+        mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL;
     } else {
         mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
     gui_key_modifier_pressed = mod_state;

static void handle_keydown(SDL_Event *ev)
{
    int mod_state, win;
    struct sdl2_console *scon = get_scon_from_window(ev->key.windowID);
    if (alt_grab) {
        mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) ==
            (gui_grab_code | KMOD_LSHIFT);
    } else if (ctrl_grab) {
        mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL;
    } else {
        mod_state = (SDL_GetModState() & gui_grab_code) == gui_grab_code;
    gui_key_modifier_pressed = mod_state;
    if (gui_key_modifier_pressed) {
        switch (ev->key.keysym.scancode) {
        case SDL_SCANCODE_2:
        case SDL_SCANCODE_3:
        case SDL_SCANCODE_4:
        case SDL_SCANCODE_5:
        case SDL_SCANCODE_6:
        case SDL_SCANCODE_7:
        case SDL_SCANCODE_8:
        case SDL_SCANCODE_9:
            win = ev->key.keysym.scancode - SDL_SCANCODE_1;
            if (win < sdl2_num_outputs) {
                sdl2_console[win].hidden = !sdl2_console[win].hidden;
                if (sdl2_console[win].real_window) {
                    if (sdl2_console[win].hidden) {
                        SDL_HideWindow(sdl2_console[win].real_window);
                    } else {
                        SDL_ShowWindow(sdl2_console[win].real_window);
                gui_keysym = 1;
            break;
        case SDL_SCANCODE_F:
            toggle_full_screen(scon);
            gui_keysym = 1;
            break;
        case SDL_SCANCODE_U:
            sdl2_window_destroy(scon);
            sdl2_window_create(scon);
            if (!scon->opengl) {
                /* re-create scon->texture */
                sdl2_2d_switch(&scon->dcl, scon->surface);
            gui_keysym = 1;
            break;
#if 0
        case SDL_SCANCODE_KP_PLUS:
        case SDL_SCANCODE_KP_MINUS:
            if (!gui_fullscreen) {
                int scr_w, scr_h;
                int width, height;
                SDL_GetWindowSize(scon->real_window, &scr_w, &scr_h);
                width = MAX(scr_w + (ev->key.keysym.scancode ==
                                     SDL_SCANCODE_KP_PLUS ? 50 : -50),
                            160);
                height = (surface_height(scon->surface) * width) /
                    surface_width(scon->surface);
                fprintf(stderr, "%s: scale to %dx%d\n",
                        __func__, width, height);
                sdl_scale(scon, width, height);
                sdl2_redraw(scon);
                gui_keysym = 1;
#endif
        default:
            break;
    if (!gui_keysym) {
        sdl2_process_key(scon, &ev->key);


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

     }

+
+
+    for (i = 0; i < xcrs.nr_xcrs; i++) {
+
+        /* Only support xcr0 now */

         if (xcrs.xcrs[i].xcr == 0) {

static int kvm_get_xcrs(X86CPU *cpu)

{

    CPUX86State *env = &cpu->env;

    int i, ret;

    struct kvm_xcrs xcrs;

    if (!kvm_has_xcrs()) {

        return 0;

    }

    ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_XCRS, &xcrs);

    if (ret < 0) {

        return ret;

    }

    for (i = 0; i < xcrs.nr_xcrs; i++) {

        /* Only support xcr0 now */

        if (xcrs.xcrs[i].xcr == 0) {

            env->xcr0 = xcrs.xcrs[i].value;

            break;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
+static int check_for_block_signature(BlockDriverState *bs, const uint8_t *buf)
+
 {

     static const uint8_t signatures[][4] = {

+        { 'Q', 'F', 'I', 0xfb }, /* qcow/qcow2 */
+
+        { 'C', 'O', 'W', 'D' }, /* VMDK3 */
+
+        { 'V', 'M', 'D', 'K' }, /* VMDK4 */
+
         { 'O', 'O', 'O', 'M' }, /* UML COW */

+        {}

     };

static int check_for_block_signature(BlockDriverState *bs, const uint8_t *buf)

{

    static const uint8_t signatures[][4] = {

        { 'Q', 'F', 'I', 0xfb }, /* qcow/qcow2 */

        { 'C', 'O', 'W', 'D' }, /* VMDK3 */

        { 'V', 'M', 'D', 'K' }, /* VMDK4 */

        { 'O', 'O', 'O', 'M' }, /* UML COW */

        {}

    };

    int i;

    for (i = 0; signatures[i][0] != 0; i++) {

        if (memcmp(buf, signatures[i], 4) == 0) {

            return 1;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int my_log2(unsigned int i)

+{

     unsigned int iLog2 = 0;

static int my_log2(unsigned int i)

{

    unsigned int iLog2 = 0;

    while ((i >> iLog2) > 1)

	iLog2++;

    return iLog2;

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     char *normal_boot_order = opaque;

     static int first = 1;
+

     /* Restore boot order and remove ourselves after the first boot */

void restore_boot_order(void *opaque)

{

    char *normal_boot_order = opaque;

    static int first = 1;

    /* Restore boot order and remove ourselves after the first boot */

    if (first) {

        first = 0;

        return;

    }

    qemu_boot_set(normal_boot_order, NULL);

    qemu_unregister_reset(restore_boot_order, normal_boot_order);

    g_free(normal_boot_order);

}


--- a/source.c
+++ b/source.c
@@ -35,11 +35,11 @@
          * with registered range.

          */
+
+        if (iommu_notifier->start > entry.iova + entry.addr_mask + 1 ||
+
+            iommu_notifier->end < entry.iova) {
+
             continue;

         }

void memory_region_notify_iommu(MemoryRegion *mr,

                                IOMMUTLBEntry entry)

{

    IOMMUNotifier *iommu_notifier;

    IOMMUNotifierFlag request_flags;

    assert(memory_region_is_iommu(mr));

    if (entry.perm & IOMMU_RW) {

        request_flags = IOMMU_NOTIFIER_MAP;

    } else {

        request_flags = IOMMU_NOTIFIER_UNMAP;

    }

    IOMMU_NOTIFIER_FOREACH(iommu_notifier, mr) {

        /*

         * Skip the notification if the notification does not overlap

         * with registered range.

         */

        if (iommu_notifier->start > entry.iova + entry.addr_mask + 1 ||

            iommu_notifier->end < entry.iova) {

            continue;

        }

        if (iommu_notifier->notifier_flags & request_flags) {

            iommu_notifier->notify(iommu_notifier, &entry);

        }

    }

}


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

                  PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |

+                 PCI_STATUS_DEVSEL_MEDIUM);
+
+    pci_set_byte(dev->config + PCI_REVISION_ID, 0x11);
+
+    pci_set_byte(dev->config + PCI_HEADER_TYPE,

                  pci_get_byte(dev->config + PCI_HEADER_TYPE) |

static void apb_pci_bridge_init(PCIBus *b)

{

    PCIDevice *dev = pci_bridge_get_device(b);

    /*

     * command register:

     * According to PCI bridge spec, after reset

     *   bus master bit is off

     *   memory space enable bit is off

     * According to manual (805-1251.pdf).

     *   the reset value should be zero unless the boot pin is tied high

     *   (which is true) and thus it should be PCI_COMMAND_MEMORY.

     */

    pci_set_word(dev->config + PCI_COMMAND,

                 PCI_COMMAND_MEMORY);

    pci_set_word(dev->config + PCI_STATUS,

                 PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |

                 PCI_STATUS_DEVSEL_MEDIUM);

    pci_set_byte(dev->config + PCI_REVISION_ID, 0x11);

    pci_set_byte(dev->config + PCI_HEADER_TYPE,

                 pci_get_byte(dev->config + PCI_HEADER_TYPE) |

                 PCI_HEADER_TYPE_MULTI_FUNCTION);

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
+int do_subchannel_work_passthrough(SubchDev *sch)
+
 {

     int ret = 0;

     SCSW *s = &sch->curr_status.scsw;

+

+    if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) {

         /* TODO: Clear handling */

int do_subchannel_work_passthrough(SubchDev *sch)

{

    int ret = 0;

    SCSW *s = &sch->curr_status.scsw;

    if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) {

        /* TODO: Clear handling */

        sch_handle_clear_func(sch);

    } else if (s->ctrl & SCSW_FCTL_HALT_FUNC) {

        /* TODO: Halt handling */

        sch_handle_halt_func(sch);

    } else if (s->ctrl & SCSW_FCTL_START_FUNC) {

        ret = sch_handle_start_func_passthrough(sch);

    }

    return ret;

}


static inline int l3_unscale(int value, int exponent)

{

    unsigned int m;

    int e;

    e  = table_4_3_exp  [4 * value + (exponent & 3)];

    m  = table_4_3_value[4 * value + (exponent & 3)];

    e -= exponent >> 2;

    assert(e >= 1);

    if (e > 31)

        return 0;

    m = (m + (1 << (e - 1))) >> e;

    return m;

}


--- a/source.c
+++ b/source.c
@@ -1,16 +1,16 @@
 static ram_addr_t get_start_block(DumpState *s)
+
 {
+
     RAMBlock *block;

+
+
     if (!s->has_filter) {

+        s->block = QTAILQ_FIRST(&ram_list.blocks);
+
+        return 0;

     }

static ram_addr_t get_start_block(DumpState *s)

{

    RAMBlock *block;

    if (!s->has_filter) {

        s->block = QTAILQ_FIRST(&ram_list.blocks);

        return 0;

    }

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

        if (block->offset >= s->begin + s->length ||

            block->offset + block->length <= s->begin) {

            /* This block is out of the range */

            continue;

        }

        s->block = block;

        if (s->begin > block->offset) {

            s->start = s->begin - block->offset;

        } else {

            s->start = 0;

        }

        return s->start;

    }

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
     extent->l1_size = l1_size;

     extent->l1_entry_sectors = l2_size * cluster_sectors;
+
+    extent->l2_size = l2_size;
+
+    extent->cluster_sectors = cluster_sectors;
+

     if (s->num_extents > 1) {

static VmdkExtent *vmdk_add_extent(BlockDriverState *bs,

                           BlockDriverState *file, bool flat, int64_t sectors,

                           int64_t l1_offset, int64_t l1_backup_offset,

                           uint32_t l1_size,

                           int l2_size, unsigned int cluster_sectors)

{

    VmdkExtent *extent;

    BDRVVmdkState *s = bs->opaque;

    s->extents = g_realloc(s->extents,

                              (s->num_extents + 1) * sizeof(VmdkExtent));

    extent = &s->extents[s->num_extents];

    s->num_extents++;

    memset(extent, 0, sizeof(VmdkExtent));

    extent->file = file;

    extent->flat = flat;

    extent->sectors = sectors;

    extent->l1_table_offset = l1_offset;

    extent->l1_backup_table_offset = l1_backup_offset;

    extent->l1_size = l1_size;

    extent->l1_entry_sectors = l2_size * cluster_sectors;

    extent->l2_size = l2_size;

    extent->cluster_sectors = cluster_sectors;

    if (s->num_extents > 1) {

        extent->end_sector = (*(extent - 1)).end_sector + extent->sectors;

    } else {

        extent->end_sector = extent->sectors;

    }

    bs->total_sectors = extent->end_sector;

    return extent;

}


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

     s->msix->ctrl_offset = real_offset;

+
+
+    *data = reg->init_val;
+
+    return 0;

 }

static int xen_pt_msixctrl_reg_init(XenPCIPassthroughState *s,

                                    XenPTRegInfo *reg, uint32_t real_offset,

                                    uint32_t *data)

{

    PCIDevice *d = &s->dev;

    uint16_t reg_field = 0;

    /* use I/O device register's value as initial value */

    reg_field = pci_get_word(d->config + real_offset);

    if (reg_field & PCI_MSIX_FLAGS_ENABLE) {

        XEN_PT_LOG(d, "MSIX already enabled, disabling it first\n");

        xen_host_pci_set_word(&s->real_device, real_offset,

                              reg_field & ~PCI_MSIX_FLAGS_ENABLE);

    }

    s->msix->ctrl_offset = real_offset;

    *data = reg->init_val;

    return 0;

}


static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track)

{

    int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width,

                               track->enc->sample_aspect_ratio.den);

    int64_t pos = avio_tell(pb);

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

    ffio_wfourcc(pb, "tapt");

    avio_wb32(pb, 20);

    ffio_wfourcc(pb, "clef");

    avio_wb32(pb, 0);

    avio_wb32(pb, width << 16);

    avio_wb32(pb, track->enc->height << 16);

    avio_wb32(pb, 20);

    ffio_wfourcc(pb, "enof");

    avio_wb32(pb, 0);

    avio_wb32(pb, track->enc->width << 16);

    avio_wb32(pb, track->enc->height << 16);

    return updateSize(pb, pos);

};


--- a/source.c
+++ b/source.c
@@ -3,10 +3,10 @@
     unsigned long *p = map + BIT_WORD(start);
     const long size = start + nr;
     int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
+    unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
+    while (nr - bits_to_set >= 0) {
+        *p |= mask_to_set;
+        nr -= bits_to_set;
         bits_to_set = BITS_PER_LONG;
         mask_to_set = ~0UL;
         p++;

void bitmap_set(unsigned long *map, long start, long nr)
{
    unsigned long *p = map + BIT_WORD(start);
    const long size = start + nr;
    int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
    unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
    while (nr - bits_to_set >= 0) {
        *p |= mask_to_set;
        nr -= bits_to_set;
        bits_to_set = BITS_PER_LONG;
        mask_to_set = ~0UL;
        p++;
    }
    if (nr) {
        mask_to_set &= BITMAP_LAST_WORD_MASK(size);
        *p |= mask_to_set;
    }
}


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

     int off;

+
+
+    off = snprintf(path, sizeof(path), "%s", qdev_fw_name(dev));
+
+    if (d->ioport_id) {

         snprintf(path + off, sizeof(path) - off, "@%04x", d->ioport_id);

static char *isabus_get_fw_dev_path(DeviceState *dev)

{

    ISADevice *d = (ISADevice*)dev;

    char path[40];

    int off;

    off = snprintf(path, sizeof(path), "%s", qdev_fw_name(dev));

    if (d->ioport_id) {

        snprintf(path + off, sizeof(path) - off, "@%04x", d->ioport_id);

    }

    return strdup(path);

}


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

     /* Emit either the reg,imm or reg,reg form of a data-processing insn.

+     * rhs must satisfy the "rI" constraint.
+
+     */
+
+    if (rhs_is_const) {

         int rot = encode_imm(rhs);

static inline void tcg_out_dat_rI(TCGContext *s, int cond, int opc, TCGArg dst,

                                  TCGArg lhs, TCGArg rhs, int rhs_is_const)

{

    /* Emit either the reg,imm or reg,reg form of a data-processing insn.

     * rhs must satisfy the "rI" constraint.

     */

    if (rhs_is_const) {

        int rot = encode_imm(rhs);

        assert(rot >= 0);

        tcg_out_dat_imm(s, cond, opc, dst, lhs, rotl(rhs, rot) | (rot << 7));

    } else {

        tcg_out_dat_reg(s, cond, opc, dst, lhs, rhs, SHIFT_IMM_LSL(0));

    }

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
                       const uint8_t *buf, int start, int buf_size, int is_8bit)
 {
+    GetBitContext gb;
+    int bit_len;
+    int x, y, len, color;
+    uint8_t *d;
+    if (start >= buf_size)
     bit_len = (buf_size - start) * 8;
     init_get_bits(&gb, buf + start, bit_len);
     x = 0;

static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
                      const uint8_t *buf, int start, int buf_size, int is_8bit)
{
    GetBitContext gb;
    int bit_len;
    int x, y, len, color;
    uint8_t *d;
    if (start >= buf_size)
    bit_len = (buf_size - start) * 8;
    init_get_bits(&gb, buf + start, bit_len);
    x = 0;
    y = 0;
    d = bitmap;
    for(;;) {
        if (get_bits_count(&gb) > bit_len)
        if (is_8bit)
            len = decode_run_8bit(&gb, &color);
        else
            len = decode_run_2bit(&gb, &color);
        len = FFMIN(len, w - x);
        memset(d + x, color, len);
        x += len;
        if (x >= w) {
            y++;
            if (y >= h)
                break;
            d += linesize;
            x = 0;
            /* byte align */
            align_get_bits(&gb);
        }
    }
    return 0;
}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     V9fsSynthOpenState *synth_open = fs->private;

     V9fsSynthNode *node = synth_open->node;
+
+    if (!node->attr->read) {
+
+        errno = EPERM;
+
         return -1;

     }

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

                                 const struct iovec *iov,

                                 int iovcnt, off_t offset)

{

    int i, count = 0, rcount;

    V9fsSynthOpenState *synth_open = fs->private;

    V9fsSynthNode *node = synth_open->node;

    if (!node->attr->read) {

        errno = EPERM;

        return -1;

    }

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

        rcount = node->attr->read(iov[i].iov_base, iov[i].iov_len,

                                  offset, node->private);

        offset += rcount;

        count  += rcount;

        /* If we read less than requested. we are done */

        if (rcount < iov[i].iov_len) {

            break;

        }

    }

    return count;

}