--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     QVirtIOSCSI *vs;

     uint8_t buf[512] = { 0 };
+
+    const uint8_t write_same_cdb[CDB_SIZE] = { 0x41, 0x00, 0x00, 0x00, 0x00,
+
+                                               0x01, 0x00, 0x00, 0x02, 0x00 };
+

     qvirtio_scsi_start("-drive file=blkdebug::null-co://,if=none,id=dr1"

static void test_unaligned_write_same(void)

{

    QVirtIOSCSI *vs;

    uint8_t buf[512] = { 0 };

    const uint8_t write_same_cdb[CDB_SIZE] = { 0x41, 0x00, 0x00, 0x00, 0x00,

                                               0x01, 0x00, 0x00, 0x02, 0x00 };

    qvirtio_scsi_start("-drive file=blkdebug::null-co://,if=none,id=dr1"

                       ",format=raw,file.align=4k "

                       "-device scsi-disk,drive=dr1,lun=0,scsi-id=1");

    vs = qvirtio_scsi_pci_init(PCI_SLOT);

    g_assert_cmphex(0, ==,

        virtio_scsi_do_command(vs, write_same_cdb, NULL, 0, buf, 512));

    qvirtio_scsi_pci_free(vs);

    qvirtio_scsi_stop();

}


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

     bs->cyls = cyls;
+
+    bs->heads = heads;
+
     bs->secs = secs;

 }

void bdrv_set_geometry_hint(BlockDriverState *bs,

                            int cyls, int heads, int secs)

{

    bs->cyls = cyls;

    bs->heads = heads;

    bs->secs = secs;

}


--- a/source.c
+++ b/source.c
@@ -28,11 +28,11 @@
         if (bkt->avg > THROTTLE_VALUE_MAX || bkt->max > THROTTLE_VALUE_MAX) {
             error_setg(errp, "bps/iops/max values must be within [0, %lld]",
                        THROTTLE_VALUE_MAX);
+        if (!bkt->burst_length) {
+            error_setg(errp, "the burst length cannot be 0");
+        if (bkt->burst_length > 1 && !bkt->max) {
+            error_setg(errp, "burst length set without burst rate");
+        if (bkt->max && !bkt->avg) {
             error_setg(errp, "bps_max/iops_max require corresponding"
                        " bps/iops values");
         if (bkt->max && bkt->max < bkt->avg) {

bool throttle_is_valid(ThrottleConfig *cfg, Error **errp)
{
    int i;
    bool bps_flag, ops_flag;
    bool bps_max_flag, ops_max_flag;
    bps_flag = cfg->buckets[THROTTLE_BPS_TOTAL].avg &&
               (cfg->buckets[THROTTLE_BPS_READ].avg ||
                cfg->buckets[THROTTLE_BPS_WRITE].avg);
    ops_flag = cfg->buckets[THROTTLE_OPS_TOTAL].avg &&
               (cfg->buckets[THROTTLE_OPS_READ].avg ||
                cfg->buckets[THROTTLE_OPS_WRITE].avg);
    bps_max_flag = cfg->buckets[THROTTLE_BPS_TOTAL].max &&
                  (cfg->buckets[THROTTLE_BPS_READ].max  ||
                   cfg->buckets[THROTTLE_BPS_WRITE].max);
    ops_max_flag = cfg->buckets[THROTTLE_OPS_TOTAL].max &&
                   (cfg->buckets[THROTTLE_OPS_READ].max ||
                   cfg->buckets[THROTTLE_OPS_WRITE].max);
    if (bps_flag || ops_flag || bps_max_flag || ops_max_flag) {
        error_setg(errp, "bps/iops/max total values and read/write values"
                   " cannot be used at the same time");
    if (cfg->op_size &&
        !cfg->buckets[THROTTLE_OPS_TOTAL].avg &&
        !cfg->buckets[THROTTLE_OPS_READ].avg &&
        !cfg->buckets[THROTTLE_OPS_WRITE].avg) {
        error_setg(errp, "iops size requires an iops value to be set");
    for (i = 0; i < BUCKETS_COUNT; i++) {
        LeakyBucket *bkt = &cfg->buckets[i];
        if (bkt->avg > THROTTLE_VALUE_MAX || bkt->max > THROTTLE_VALUE_MAX) {
            error_setg(errp, "bps/iops/max values must be within [0, %lld]",
                       THROTTLE_VALUE_MAX);
        if (!bkt->burst_length) {
            error_setg(errp, "the burst length cannot be 0");
        if (bkt->burst_length > 1 && !bkt->max) {
            error_setg(errp, "burst length set without burst rate");
        if (bkt->max && !bkt->avg) {
            error_setg(errp, "bps_max/iops_max require corresponding"
                       " bps/iops values");
        if (bkt->max && bkt->max < bkt->avg) {
            error_setg(errp, "bps_max/iops_max cannot be lower than bps/iops");
    return true;


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

 {

+    FWCfgState *s = FW_CFG(dev);
+
+    MachineState *machine = MACHINE(qdev_get_machine());
+
+

     assert(!object_resolve_path(FW_CFG_PATH, NULL));

static void fw_cfg_init1(DeviceState *dev)

{

    FWCfgState *s = FW_CFG(dev);

    MachineState *machine = MACHINE(qdev_get_machine());

    assert(!object_resolve_path(FW_CFG_PATH, NULL));

    object_property_add_child(OBJECT(machine), FW_CFG_NAME, OBJECT(s), NULL);

    qdev_init_nofail(dev);

    fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);

    fw_cfg_add_bytes(s, FW_CFG_UUID, &qemu_uuid, 16);

    fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)!machine->enable_graphics);

    fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);

    fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);

    fw_cfg_bootsplash(s);

    fw_cfg_reboot(s);

    s->machine_ready.notify = fw_cfg_machine_ready;

    qemu_add_machine_init_done_notifier(&s->machine_ready);

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
     env->sr = 0x2700;

 #endif
+
+    m68k_switch_sp(env);
+
+    /* ??? FP regs should be initialized to NaN.  */
+
     cpu_m68k_set_ccr(env, 0);

     /* TODO: We should set PC from the interrupt vector.  */

static void m68k_cpu_reset(CPUState *s)

{

    M68kCPU *cpu = M68K_CPU(s);

    M68kCPUClass *mcc = M68K_CPU_GET_CLASS(cpu);

    CPUM68KState *env = &cpu->env;

    mcc->parent_reset(s);

    memset(env, 0, offsetof(CPUM68KState, end_reset_fields));

#if !defined(CONFIG_USER_ONLY)

    env->sr = 0x2700;

#endif

    m68k_switch_sp(env);

    /* ??? FP regs should be initialized to NaN.  */

    cpu_m68k_set_ccr(env, 0);

    /* TODO: We should set PC from the interrupt vector.  */

    env->pc = 0;

}


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

         BlockDriverState **file)

+{
+
+    BlockDriverState *p;
+
+    int64_t ret = 0;

     bool first = true;

static int64_t coroutine_fn bdrv_co_get_block_status_above(BlockDriverState *bs,

        BlockDriverState *base,

        bool want_zero,

        int64_t sector_num,

        int nb_sectors,

        int *pnum,

        BlockDriverState **file)

{

    BlockDriverState *p;

    int64_t ret = 0;

    bool first = true;

    assert(bs != base);

    for (p = bs; p != base; p = backing_bs(p)) {

        ret = bdrv_co_get_block_status(p, want_zero, sector_num, nb_sectors,

                                       pnum, file);

        if (ret < 0) {

            break;

        }

        if (ret & BDRV_BLOCK_ZERO && ret & BDRV_BLOCK_EOF && !first) {

            /*

             * Reading beyond the end of the file continues to read

             * zeroes, but we can only widen the result to the

             * unallocated length we learned from an earlier

             * iteration.

             */

            *pnum = nb_sectors;

        }

        if (ret & (BDRV_BLOCK_ZERO | BDRV_BLOCK_DATA)) {

            break;

        }

        /* [sector_num, pnum] unallocated on this layer, which could be only

         * the first part of [sector_num, nb_sectors].  */

        nb_sectors = MIN(nb_sectors, *pnum);

        first = false;

    }

    return ret;

}


static inline void IRQ_setbit(IRQQueue *q, int n_IRQ)

{

    set_bit(q->queue, n_IRQ);

}


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

     visit(qapi_dealloc_get_visitor(qdv), &native_in, errp);

+
+
+    qapi_dealloc_visitor_cleanup(qdv);

 }

static void dealloc_helper(void *native_in, VisitorFunc visit, Error **errp)

{

    QapiDeallocVisitor *qdv = qapi_dealloc_visitor_new();

    visit(qapi_dealloc_get_visitor(qdv), &native_in, errp);

    qapi_dealloc_visitor_cleanup(qdv);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,

                                                int is_signed)
+
 {

     if (get_rac(c, state + 0))

static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,

                                               int is_signed)

{

    if (get_rac(c, state + 0))

        return 0;

    else {

        int i, e, a;

        e = 0;

        while (get_rac(c, state + 1 + FFMIN(e, 9))) { // 1..10

            e++;

            if (e > 31)

                return AVERROR_INVALIDDATA;

        }

        a = 1;

        for (i = e - 1; i >= 0; i--)

            a += a + get_rac(c, state + 22 + FFMIN(i, 9));  // 22..31

        e = -(is_signed && get_rac(c, state + 11 + FFMIN(e, 10))); // 11..21

        return (a ^ e) - e;

    }

}


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

         trace_usb_ehci_port_reset(port, 0);

+        if (dev) {
+
+            usb_attach(&s->ports[port], dev);
+
+            usb_send_msg(dev, USB_MSG_RESET);

             *portsc &= ~PORTSC_CSC;

static void handle_port_status_write(EHCIState *s, int port, uint32_t val)

{

    uint32_t *portsc = &s->portsc[port];

    USBDevice *dev = s->ports[port].dev;

    /* Clear rwc bits */

    *portsc &= ~(val & PORTSC_RWC_MASK);

    /* The guest may clear, but not set the PED bit */

    *portsc &= val | ~PORTSC_PED;

    /* POWNER is masked out by RO_MASK as it is RO when we've no companion */

    handle_port_owner_write(s, port, val);

    /* And finally apply RO_MASK */

    val &= PORTSC_RO_MASK;

    if ((val & PORTSC_PRESET) && !(*portsc & PORTSC_PRESET)) {

        trace_usb_ehci_port_reset(port, 1);

    }

    if (!(val & PORTSC_PRESET) &&(*portsc & PORTSC_PRESET)) {

        trace_usb_ehci_port_reset(port, 0);

        if (dev) {

            usb_attach(&s->ports[port], dev);

            usb_send_msg(dev, USB_MSG_RESET);

            *portsc &= ~PORTSC_CSC;

        }

        /*

         *  Table 2.16 Set the enable bit(and enable bit change) to indicate

         *  to SW that this port has a high speed device attached

         */

        if (dev && (dev->speedmask & USB_SPEED_MASK_HIGH)) {

            val |= PORTSC_PED;

        }

    }

    *portsc &= ~PORTSC_RO_MASK;

    *portsc |= val;

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
         acb->req.error = bdrv_co_do_writev(bs, acb->req.sector,

             acb->req.nb_sectors, acb->req.qiov, acb->req.flags);
+
+    }
+
+
+
     acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb);

     qemu_bh_schedule(acb->bh);

static void coroutine_fn bdrv_co_do_rw(void *opaque)

{

    BlockAIOCBCoroutine *acb = opaque;

    BlockDriverState *bs = acb->common.bs;

    if (!acb->is_write) {

        acb->req.error = bdrv_co_do_readv(bs, acb->req.sector,

            acb->req.nb_sectors, acb->req.qiov, acb->req.flags);

    } else {

        acb->req.error = bdrv_co_do_writev(bs, acb->req.sector,

            acb->req.nb_sectors, acb->req.qiov, acb->req.flags);

    }

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

    qemu_bh_schedule(acb->bh);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign)
+
+{
+
+    struct kvm_ioeventfd kick = {

         .datamatch = val,

int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign)

{

    struct kvm_ioeventfd kick = {

        .datamatch = val,

        .addr = addr,

        .len = 2,

        .flags = KVM_IOEVENTFD_FLAG_DATAMATCH | KVM_IOEVENTFD_FLAG_PIO,

        .fd = fd,

    };

    int r;

    if (!kvm_enabled())

        return -ENOSYS;

    if (!assign)

        kick.flags |= KVM_IOEVENTFD_FLAG_DEASSIGN;

    r = kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &kick);

    if (r < 0)

        return r;

    return 0;

}


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

                                       int rc, int *result)

+{

     BlockDriverState *bs;

static BlockJob *test_block_job_start(unsigned int iterations,

                                      bool use_timer,

                                      int rc, int *result)

{

    BlockDriverState *bs;

    TestBlockJob *s;

    TestBlockJobCBData *data;

    data = g_new0(TestBlockJobCBData, 1);

    bs = bdrv_new();

    s = block_job_create(&test_block_job_driver, bs, 0, test_block_job_cb,

                         data, &error_abort);

    s->iterations = iterations;

    s->use_timer = use_timer;

    s->rc = rc;

    s->result = result;

    s->common.co = qemu_coroutine_create(test_block_job_run);

    data->job = s;

    data->result = result;

    qemu_coroutine_enter(s->common.co, s);

    return &s->common;

}


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

     if ((error = pa_simple_write(s->pa, buf, size, &error))) {
+
+        av_log(s, AV_LOG_ERROR, "pa_simple_write failed: %s\n", pa_strerror(error));
+
+        return AVERROR(EIO);
+
     }

static int pulse_write_packet(AVFormatContext *h, AVPacket *pkt)

{

    PulseData *s = h->priv_data;

    int size     = pkt->size;

    uint8_t *buf = pkt->data;

    int error;

    if (s->stream_index != pkt->stream_index)

        return 0;

    if ((error = pa_simple_write(s->pa, buf, size, &error))) {

        av_log(s, AV_LOG_ERROR, "pa_simple_write failed: %s\n", pa_strerror(error));

        return AVERROR(EIO);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     BDRVQcowState *s = bs->opaque;

     uint64_t cluster_offset;
+
     int ret;

static int coroutine_fn qcow2_co_is_allocated(BlockDriverState *bs,

        int64_t sector_num, int nb_sectors, int *pnum)

{

    BDRVQcowState *s = bs->opaque;

    uint64_t cluster_offset;

    int ret;

    *pnum = nb_sectors;

    /* FIXME We can get errors here, but the bdrv_co_is_allocated interface

     * can't pass them on today */

    qemu_co_mutex_lock(&s->lock);

    ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset);

    qemu_co_mutex_unlock(&s->lock);

    if (ret < 0) {

        *pnum = 0;

    }

    return (cluster_offset != 0) || (ret == QCOW2_CLUSTER_ZERO);

}


--- a/source.c
+++ b/source.c
@@ -49,11 +49,11 @@
         ERROR(errp, "listening on socket!");

         goto err;
+
+    }
+
+
+
     DPRINTF("rdma_listen success\n");

void rdma_start_incoming_migration(const char *host_port, Error **errp)

{

    int ret;

    RDMAContext *rdma;

    Error *local_err = NULL;

    DPRINTF("Starting RDMA-based incoming migration\n");

    rdma = qemu_rdma_data_init(host_port, &local_err);

    if (rdma == NULL) {

        goto err;

    }

    ret = qemu_rdma_dest_init(rdma, &local_err);

    if (ret) {

        goto err;

    }

    DPRINTF("qemu_rdma_dest_init success\n");

    ret = rdma_listen(rdma->listen_id, 5);

    if (ret) {

        ERROR(errp, "listening on socket!");

        goto err;

    }

    DPRINTF("rdma_listen success\n");

    qemu_set_fd_handler2(rdma->channel->fd, NULL,

                         rdma_accept_incoming_migration, NULL,

                            (void *)(intptr_t) rdma);

    return;

err:

    error_propagate(errp, local_err);

    g_free(rdma);

}


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

         int x, y;

+        uint8_t *pin, *pout;
+
+        for (y = y0; y < (y0 + h); y++) {

             pin = cur_buf->data[0] + y * cur_buf->linesize[0] + extract->rgba_map[A];

static int draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)

{

    AlphaExtractContext *extract = inlink->dst->priv;

    AVFilterBufferRef *cur_buf = inlink->cur_buf;

    AVFilterBufferRef *out_buf = inlink->dst->outputs[0]->out_buf;

    if (extract->is_packed_rgb) {

        int x, y;

        uint8_t *pin, *pout;

        for (y = y0; y < (y0 + h); y++) {

            pin = cur_buf->data[0] + y * cur_buf->linesize[0] + extract->rgba_map[A];

            pout = out_buf->data[0] + y * out_buf->linesize[0];

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

                *pout = *pin;

                pout += 1;

                pin += 4;

            }

        }

    } else if (cur_buf->linesize[A] == out_buf->linesize[Y]) {

        const int linesize = cur_buf->linesize[A];

        memcpy(out_buf->data[Y] + y0 * linesize,

               cur_buf->data[A] + y0 * linesize,

               linesize * h);

    } else {

        const int linesize = FFMIN(out_buf->linesize[Y], cur_buf->linesize[A]);

        int y;

        for (y = y0; y < (y0 + h); y++) {

            memcpy(out_buf->data[Y] + y * out_buf->linesize[Y],

                   cur_buf->data[A] + y * cur_buf->linesize[A],

                   linesize);

        }

    }

    return ff_draw_slice(inlink->dst->outputs[0], y0, h, slice_dir);

}


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

+    s->log = logs.log;
+
+
+
+exit:

     return ret;

int vhdx_log_write_and_flush(BlockDriverState *bs, BDRVVHDXState *s,

                             void *data, uint32_t length, uint64_t offset)

{

    int ret = 0;

    VHDXLogSequence logs = { .valid = true,

                             .count = 1,

                             .hdr = { 0 } };

    /* Make sure data written (new and/or changed blocks) is stable

     * on disk, before creating log entry */

    bdrv_flush(bs);

    ret = vhdx_log_write(bs, s, data, length, offset);

    if (ret < 0) {

        goto exit;

    }

    logs.log = s->log;

    /* Make sure log is stable on disk */

    bdrv_flush(bs);

    ret = vhdx_log_flush(bs, s, &logs);

    if (ret < 0) {

        goto exit;

    }

    s->log = logs.log;

exit:

    return ret;

}


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

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

             *endptr = nptr;

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

                 int64_t *result)

{

    char *p;

    int err = 0;

    if (!nptr) {

        if (endptr) {

            *endptr = nptr;

        }

        err = -EINVAL;

    } else {

        errno = 0;

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

        err = check_strtox_error(endptr, p, errno);

    }

    return err;

}


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

+
+    if (cpu->irqstate_saved_size == 0) {
+
+        return 0;
+
     }

     irq_state.buf = (uint64_t) cpu->irqstate;

int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu)

{

    CPUState *cs = CPU(cpu);

    struct kvm_s390_irq_state irq_state;

    int r;

    if (!kvm_check_extension(kvm_state, KVM_CAP_S390_IRQ_STATE)) {

        return -ENOSYS;

    }

    if (cpu->irqstate_saved_size == 0) {

        return 0;

    }

    irq_state.buf = (uint64_t) cpu->irqstate;

    irq_state.len = cpu->irqstate_saved_size;

    r = kvm_vcpu_ioctl(cs, KVM_S390_SET_IRQ_STATE, &irq_state);

    if (r) {

        error_report("Setting interrupt state failed %d", r);

    }

    return r;

}


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

     ptrdiff_t disp = tcg_ptr_byte_diff(target, pc);
+
+    assert(in_range_b(disp));

     return disp & 0x3fffffc;

static uint32_t reloc_pc24_val(tcg_insn_unit *pc, tcg_insn_unit *target)

{

    ptrdiff_t disp = tcg_ptr_byte_diff(target, pc);

    assert(in_range_b(disp));

    return disp & 0x3fffffc;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     if ((magic_number != FLIC_FILE_MAGIC_1) &&

         (magic_number != FLIC_FILE_MAGIC_2) &&
+
+        (magic_number != FLIC_FILE_MAGIC_3))
+
+        return 0;
+

     return AVPROBE_SCORE_MAX;

static int flic_probe(AVProbeData *p)

{

    int magic_number;

    if (p->buf_size < 6)

        return 0;

    magic_number = AV_RL16(&p->buf[4]);

    if ((magic_number != FLIC_FILE_MAGIC_1) &&

        (magic_number != FLIC_FILE_MAGIC_2) &&

        (magic_number != FLIC_FILE_MAGIC_3))

        return 0;

    return AVPROBE_SCORE_MAX;

}


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

     struct kvm_irq_routing_entry *entry;

+    int n;
+
+

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

static int kvm_update_routing_entry(KVMState *s,

                                    struct kvm_irq_routing_entry *new_entry)

{

    struct kvm_irq_routing_entry *entry;

    int n;

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

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

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

            continue;

        }

        entry->type = new_entry->type;

        entry->flags = new_entry->flags;

        entry->u = new_entry->u;

        kvm_irqchip_commit_routes(s);

        return 0;

    }

    return -ESRCH;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     char buf[CONTROL_BUFFER_SIZE], opts_format[20];

     AVDictionary *opts = NULL;
+
+    FTPContext *s = h->priv_data;
+
+
+
     if (!s->conn_data) {

         /* Enter passive mode */

static int ftp_connect_data_connection(URLContext *h)

{

    int err;

    char buf[CONTROL_BUFFER_SIZE], opts_format[20];

    AVDictionary *opts = NULL;

    FTPContext *s = h->priv_data;

    if (!s->conn_data) {

        /* Enter passive mode */

        if ((err = ftp_passive_mode(s)) < 0) {

            av_dlog(h, "Set passive mode failed\n");

            return err;

        }

        /* Open data connection */

        ff_url_join(buf, sizeof(buf), "tcp", NULL, s->hostname, s->server_data_port, NULL);

        if (s->rw_timeout != -1) {

            snprintf(opts_format, sizeof(opts_format), "%d", s->rw_timeout);

            av_dict_set(&opts, "timeout", opts_format, 0);

        } /* if option is not given, don't pass it and let tcp use its own default */

        err = ffurl_open(&s->conn_data, buf, AVIO_FLAG_READ_WRITE,

                         &h->interrupt_callback, &opts);

        av_dict_free(&opts);

        if (err < 0)

            return err;

        if (s->position)

            if ((err = ftp_restart(s, s->position)) < 0)

                return err;

    }

    s->state = READY;

    return 0;

}


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

 {

+    if (dc->ccount_delta > 0) {
+
+        TCGv_i32 tmp = tcg_const_i32(dc->ccount_delta);
+
         dc->ccount_delta = 0;

         gen_helper_advance_ccount(cpu_env, tmp);

static void gen_advance_ccount(DisasContext *dc)

{

    if (dc->ccount_delta > 0) {

        TCGv_i32 tmp = tcg_const_i32(dc->ccount_delta);

        dc->ccount_delta = 0;

        gen_helper_advance_ccount(cpu_env, tmp);

        tcg_temp_free(tmp);

    }

}


static void print_tag(const char *str, unsigned int tag, int size)

{

    dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n",

           str, tag & 0xff,

           (tag >> 8) & 0xff,

           (tag >> 16) & 0xff,

           (tag >> 24) & 0xff,

           size);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static void spr_write_tbl(DisasContext *ctx, int sprn, int gprn)
+
 {

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

static void spr_write_tbl(DisasContext *ctx, int sprn, int gprn)

{

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

        gen_io_start();

    }

    gen_helper_store_tbl(cpu_env, cpu_gpr[gprn]);

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

        gen_io_end();

        gen_stop_exception(ctx);

    }

}


static inline void downmix_2f_1r_to_dolby(float *samples)

{

    int i;

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

        samples[i] -= samples[i + 512];

        samples[i + 256] += samples[i + 512];

        samples[i + 512] = 0;

    }

}


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

     memcpy(&fst->codec, codec, sizeof(AVCodecContext));

+
+    stream->streams[stream->nb_streams++] = fst;
+
+    return fst;
+
 }

AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec)

{

    AVStream *fst;

    fst = av_mallocz(sizeof(AVStream));

    if (!fst)

        return NULL;

    fst->priv_data = av_mallocz(sizeof(FeedData));

    memcpy(&fst->codec, codec, sizeof(AVCodecContext));

    stream->streams[stream->nb_streams++] = fst;

    return fst;

}


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

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

     int err;

static void test_qemu_strtoll_empty(void)

{

    const char *str = "";

    char f = 'X';

    const char *endptr = &f;

    int64_t res = 999;

    int err;

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

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 0);

    g_assert(endptr == str);

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
+int boot_sector_init(const char *fname)
+
 {
+
     FILE *f = fopen(fname, "w");

     size_t len = sizeof boot_sector;

+    if (!f) {
+
         fprintf(stderr, "Couldn't open \"%s\": %s", fname, strerror(errno));

         return 1;

int boot_sector_init(const char *fname)

{

    FILE *f = fopen(fname, "w");

    size_t len = sizeof boot_sector;

    if (!f) {

        fprintf(stderr, "Couldn't open \"%s\": %s", fname, strerror(errno));

        return 1;

    }

    /* For Open Firmware based system, we can use a Forth script instead */

    if (strcmp(qtest_get_arch(), "ppc64") == 0) {

        len = sprintf((char *)boot_sector, "\\ Bootscript\n%x %x c! %x %x c!\n",

                LOW(SIGNATURE), BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET,

                HIGH(SIGNATURE), BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET + 1);

    }

    fwrite(boot_sector, 1, len, f);

    fclose(f);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)

+{

     DynBuffer *d = opaque;

static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)

{

    DynBuffer *d = opaque;

    int new_size, new_allocated_size;

    /* reallocate buffer if needed */

    new_size = d->pos + buf_size;

    new_allocated_size = d->allocated_size;

    if(new_size < d->pos || new_size > INT_MAX/2)

        return -1;

    while (new_size > new_allocated_size) {

        if (!new_allocated_size)

            new_allocated_size = new_size;

        else

            new_allocated_size += new_allocated_size / 2 + 1;

    }

    if (new_allocated_size > d->allocated_size) {

        d->buffer = av_realloc(d->buffer, new_allocated_size);

        if(d->buffer == NULL)

             return -1234;

        d->allocated_size = new_allocated_size;

    }

    memcpy(d->buffer + d->pos, buf, buf_size);

    d->pos = new_size;

    if (d->pos > d->size)

        d->size = d->pos;

    return buf_size;

}


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

 {

+    MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
+

     mirror_drain(s);

static void coroutine_fn mirror_pause(BlockJob *job)

{

    MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);

    mirror_drain(s);

}


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

     s->time_base.num = pts_num/gcd;

+    s->time_base.den = pts_den/gcd;
+
+
+
+    if(gcd>1)

         av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd);

void av_set_pts_info(AVStream *s, int pts_wrap_bits,

                     unsigned int pts_num, unsigned int pts_den)

{

    unsigned int gcd= av_gcd(pts_num, pts_den);

    s->pts_wrap_bits = pts_wrap_bits;

    s->time_base.num = pts_num/gcd;

    s->time_base.den = pts_den/gcd;

    if(gcd>1)

        av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd);

}


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

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

+        size_t len = iov[i].iov_len;
+
+
+
+        memcpy(packet->data + packet->size, iov[i].iov_base, len);

         packet->size += len;

static ssize_t qemu_enqueue_packet_iov(VLANClientState *sender,

                                       const struct iovec *iov, int iovcnt,

                                       NetPacketSent *sent_cb)

{

    VLANPacket *packet;

    size_t max_len = 0;

    int i;

    max_len = calc_iov_length(iov, iovcnt);

    packet = qemu_malloc(sizeof(VLANPacket) + max_len);

    packet->sender = sender;

    packet->sent_cb = sent_cb;

    packet->size = 0;

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

        size_t len = iov[i].iov_len;

        memcpy(packet->data + packet->size, iov[i].iov_base, len);

        packet->size += len;

    }

    TAILQ_INSERT_TAIL(&sender->vlan->send_queue, packet, entry);

    return packet->size;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+void restore_state_to_opc(CPUARMState *env, TranslationBlock *tb, int pc_pos)
+
+{
+
     if (is_a64(env)) {

         env->pc = tcg_ctx.gen_opc_pc[pc_pos];

void restore_state_to_opc(CPUARMState *env, TranslationBlock *tb, int pc_pos)

{

    if (is_a64(env)) {

        env->pc = tcg_ctx.gen_opc_pc[pc_pos];

    } else {

        env->regs[15] = tcg_ctx.gen_opc_pc[pc_pos];

    }

    env->condexec_bits = gen_opc_condexec_bits[pc_pos];

}


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

 {

+    notifier_remove(n);
+
+    if (mr->iommu_ops->notify_stopped &&

         QLIST_EMPTY(&mr->iommu_notify.notifiers)) {

void memory_region_unregister_iommu_notifier(MemoryRegion *mr, Notifier *n)

{

    notifier_remove(n);

    if (mr->iommu_ops->notify_stopped &&

        QLIST_EMPTY(&mr->iommu_notify.notifiers)) {

        mr->iommu_ops->notify_stopped(mr);

    }

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
         vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;

         qemu_mod_timer(vd->timer, qemu_get_clock(rt_clock) +
+
+                       vd->timer_interval);
+
+        return;
+
     }

static void vnc_refresh(void *opaque)

{

    VncDisplay *vd = opaque;

    VncState *vs, *vn;

    int has_dirty, rects = 0;

    vga_hw_update();

    if (vnc_trylock_display(vd)) {

        vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;

        qemu_mod_timer(vd->timer, qemu_get_clock(rt_clock) +

                       vd->timer_interval);

        return;

    }

    has_dirty = vnc_refresh_server_surface(vd);

    vnc_unlock_display(vd);

    QTAILQ_FOREACH_SAFE(vs, &vd->clients, next, vn) {

        rects += vnc_update_client(vs, has_dirty);

        /* vs might be free()ed here */

    }

    /* vd->timer could be NULL now if the last client disconnected,

     * in this case don't update the timer */

    if (vd->timer == NULL)

        return;

    if (has_dirty && rects) {

        vd->timer_interval /= 2;

        if (vd->timer_interval < VNC_REFRESH_INTERVAL_BASE)

            vd->timer_interval = VNC_REFRESH_INTERVAL_BASE;

    } else {

        vd->timer_interval += VNC_REFRESH_INTERVAL_INC;

        if (vd->timer_interval > VNC_REFRESH_INTERVAL_MAX)

            vd->timer_interval = VNC_REFRESH_INTERVAL_MAX;

    }

    qemu_mod_timer(vd->timer, qemu_get_clock(rt_clock) + vd->timer_interval);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)

 {

static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)

{

#if COMPILE_TEMPLATE_MMX

    RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24);

#else

    int i;

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

        int b= src1[3*i + 0];

        int g= src1[3*i + 1];

        int r= src1[3*i + 2];

        dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;

        dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;

    }

#endif /* COMPILE_TEMPLATE_MMX */

    assert(src1 == src2);

}


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

     v8u16 add;

+    v4u32 sum;
+
+
+
+    src_top = LD_UB(src - stride);

     add = __msa_hadd_u_h(src_top, src_top);

static void intra_predict_mad_cow_dc_l0t_8x8_msa(uint8_t *src, int32_t stride)

{

    uint8_t lp_cnt;

    uint32_t src0, src1, src2 = 0;

    uint32_t out0, out1, out2;

    v16u8 src_top;

    v8u16 add;

    v4u32 sum;

    src_top = LD_UB(src - stride);

    add = __msa_hadd_u_h(src_top, src_top);

    sum = __msa_hadd_u_w(add, add);

    src0 = __msa_copy_u_w((v4i32) sum, 0);

    src1 = __msa_copy_u_w((v4i32) sum, 1);

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

        src2 += src[lp_cnt * stride - 1];

    }

    src2 = (src0 + src2 + 4) >> 3;

    src0 = (src0 + 2) >> 2;

    src1 = (src1 + 2) >> 2;

    out0 = src0 * 0x01010101;

    out1 = src1 * 0x01010101;

    out2 = src2 * 0x01010101;

    for (lp_cnt = 4; lp_cnt--;) {

        SW(out2, src);

        SW(out1, src + 4);

        SW(out0, src + stride * 4);

        SW(out1, src + stride * 4 + 4);

        src += stride;

    }

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     int res, i;
     const struct dc1394_frame_format *fmt = NULL;
     const struct dc1394_frame_rate *fps = NULL;
+    if (dc1394_read_common(c, &fmt, &fps) != 0)
+       return -1;
+    /* Now let us prep the hardware. */
+    dc1394->d = dc1394_new();
+    if (dc1394_camera_enumerate(dc1394->d, &list) != DC1394_SUCCESS || !list) {
         av_log(c, AV_LOG_ERROR, "Unable to look for an IIDC camera.\n");
     if (list->num == 0) {
         av_log(c, AV_LOG_ERROR, "No cameras found.\n");

static int dc1394_read_header(AVFormatContext *c)
{
    dc1394_data* dc1394 = c->priv_data;
    dc1394camera_list_t *list;
    int res, i;
    const struct dc1394_frame_format *fmt = NULL;
    const struct dc1394_frame_rate *fps = NULL;
    if (dc1394_read_common(c, &fmt, &fps) != 0)
       return -1;
    /* Now let us prep the hardware. */
    dc1394->d = dc1394_new();
    if (dc1394_camera_enumerate(dc1394->d, &list) != DC1394_SUCCESS || !list) {
        av_log(c, AV_LOG_ERROR, "Unable to look for an IIDC camera.\n");
    if (list->num == 0) {
        av_log(c, AV_LOG_ERROR, "No cameras found.\n");
    /* FIXME: To select a specific camera I need to search in list its guid */
    dc1394->camera = dc1394_camera_new (dc1394->d, list->ids[0].guid);
    if (list->num > 1) {
        av_log(c, AV_LOG_INFO, "Working with the first camera found\n");
    /* Freeing list of cameras */
    dc1394_camera_free_list (list);
    /* Select MAX Speed possible from the cam */
    if (dc1394->camera->bmode_capable>0) {
       dc1394_video_set_operation_mode(dc1394->camera, DC1394_OPERATION_MODE_1394B);
       i = DC1394_ISO_SPEED_800;
    } else {
       i = DC1394_ISO_SPEED_400;
    for (res = DC1394_FAILURE; i >= DC1394_ISO_SPEED_MIN && res != DC1394_SUCCESS; i--) {
            res=dc1394_video_set_iso_speed(dc1394->camera, i);
    if (res != DC1394_SUCCESS) {
        av_log(c, AV_LOG_ERROR, "Couldn't set ISO Speed\n");
        goto out_camera;
    if (dc1394_video_set_mode(dc1394->camera, fmt->frame_size_id) != DC1394_SUCCESS) {
        av_log(c, AV_LOG_ERROR, "Couldn't set video format\n");
        goto out_camera;
    if (dc1394_video_set_framerate(dc1394->camera,fps->frame_rate_id) != DC1394_SUCCESS) {
        av_log(c, AV_LOG_ERROR, "Couldn't set framerate %d \n",fps->frame_rate);
        goto out_camera;
    if (dc1394_capture_setup(dc1394->camera, 10, DC1394_CAPTURE_FLAGS_DEFAULT)!=DC1394_SUCCESS) {
        av_log(c, AV_LOG_ERROR, "Cannot setup camera \n");
        goto out_camera;
    if (dc1394_video_set_transmission(dc1394->camera, DC1394_ON) !=DC1394_SUCCESS) {
        av_log(c, AV_LOG_ERROR, "Cannot start capture\n");
        goto out_camera;
    return 0;
out_camera:
    dc1394_capture_stop(dc1394->camera);
    dc1394_video_set_transmission(dc1394->camera, DC1394_OFF);
    dc1394_camera_free (dc1394->camera);
out:
    dc1394_free(dc1394->d);
    return -1;


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int64_t ff_read_timestamp(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit,

+                                 int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ))
+
 {

     return wrap_timestamp(s->streams[stream_index], read_timestamp(s, stream_index, ppos, pos_limit));

static int64_t ff_read_timestamp(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit,

                                 int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ))

{

    return wrap_timestamp(s->streams[stream_index], read_timestamp(s, stream_index, ppos, pos_limit));

}


--- a/source.c
+++ b/source.c
@@ -1,19 +1,19 @@
 static MemoryRegionSection *address_space_lookup_region(AddressSpaceDispatch *d,

                                                         hwaddr addr,
+
+                                                        bool resolve_subpage)
+
 {

+    MemoryRegionSection *section = atomic_read(&d->mru_section);

     subpage_t *subpage;

     bool update;

+
+
     if (section && section != &d->map.sections[PHYS_SECTION_UNASSIGNED] &&

         section_covers_addr(section, addr)) {

static MemoryRegionSection *address_space_lookup_region(AddressSpaceDispatch *d,

                                                        hwaddr addr,

                                                        bool resolve_subpage)

{

    MemoryRegionSection *section = atomic_read(&d->mru_section);

    subpage_t *subpage;

    bool update;

    if (section && section != &d->map.sections[PHYS_SECTION_UNASSIGNED] &&

        section_covers_addr(section, addr)) {

        update = false;

    } else {

        section = phys_page_find(d, addr);

        update = true;

    }

    if (resolve_subpage && section->mr->subpage) {

        subpage = container_of(section->mr, subpage_t, iomem);

        section = &d->map.sections[subpage->sub_section[SUBPAGE_IDX(addr)]];

    }

    if (update) {

        atomic_set(&d->mru_section, section);

    }

    return section;

}


static av_cold int decode_init(AVCodecContext *avctx)

{

    ASV1Context *const a = avctx->priv_data;

    const int scale      = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;

    int i;

    if (avctx->extradata_size < 1) {

        av_log(avctx, AV_LOG_ERROR, "No extradata provided\n");

        return AVERROR_INVALIDDATA;

    }

    ff_asv_common_init(avctx);

    ff_blockdsp_init(&a->bdsp, avctx);

    ff_idctdsp_init(&a->idsp, avctx);

    init_vlcs(a);

    ff_init_scantable(a->idsp.idct_permutation, &a->scantable, ff_asv_scantab);

    avctx->pix_fmt = AV_PIX_FMT_YUV420P;

    a->inv_qscale = avctx->extradata[0];

    if (a->inv_qscale == 0) {

        av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");

        if (avctx->codec_id == AV_CODEC_ID_ASV1)

            a->inv_qscale = 6;

        else

            a->inv_qscale = 10;

    }

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

        int index = ff_asv_scantab[i];

        a->intra_matrix[i] = 64 * scale * ff_mpeg1_default_intra_matrix[index] /

                             a->inv_qscale;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void qemu_thread_self(QemuThread *thread)

+{

     thread->thread = pthread_self();

void qemu_thread_self(QemuThread *thread)

{

    thread->thread = pthread_self();

}


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

     return block_mig_state.blk_enable == 1;

static bool block_is_active(void *opaque)

{

    return block_mig_state.blk_enable == 1;

}


static void pxa2xx_rtc_piupdate(PXA2xxRTCState *s)

{

    int64_t rt = qemu_get_clock(rt_clock);

    if (s->rtsr & (1 << 15))

        s->last_swcr += rt - s->last_pi;

    s->last_pi = rt;

}


--- a/source.c
+++ b/source.c
@@ -11,9 +11,9 @@
                              ErrorClass_lookup[err->err_class],

                              qerror_human(err));
+
+
+
+    return qobject_to_qdict(obj);

 }

static QDict *build_qmp_error_dict(const QError *err)

{

    QObject *obj;

    obj = qobject_from_jsonf("{ 'error': { 'class': %s, 'desc': %p } }",

                             ErrorClass_lookup[err->err_class],

                             qerror_human(err));

    return qobject_to_qdict(obj);

}


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

     AudioState *audio;

+    musicpal_audio_state *s;
+
+    i2c_interface *i2c;

     int iomemtype;

static i2c_interface *musicpal_audio_init(qemu_irq irq)

{

    AudioState *audio;

    musicpal_audio_state *s;

    i2c_interface *i2c;

    int iomemtype;

    audio = AUD_init();

    if (!audio) {

        AUD_log(audio_name, "No audio state\n");

        return NULL;

    }

    s = qemu_mallocz(sizeof(musicpal_audio_state));

    s->irq = irq;

    i2c = qemu_mallocz(sizeof(i2c_interface));

    i2c->bus = i2c_init_bus();

    i2c->current_addr = -1;

    s->wm = wm8750_init(i2c->bus, audio);

    if (!s->wm)

        return NULL;

    i2c_set_slave_address(s->wm, MP_WM_ADDR);

    wm8750_data_req_set(s->wm, audio_callback, s);

    iomemtype = cpu_register_io_memory(0, musicpal_audio_readfn,

                       musicpal_audio_writefn, s);

    cpu_register_physical_memory(MP_AUDIO_BASE, MP_AUDIO_SIZE, iomemtype);

    qemu_register_reset(musicpal_audio_reset, s);

    return i2c;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
         sock_id = atoi(ctx->fs_root);

         if (sock_id < 0) {
+
+            fprintf(stderr, "socket descriptor not initialized\n");
+
+        }
+
     }

     if (sock_id < 0) {

static int proxy_init(FsContext *ctx)

{

    V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy));

    int sock_id;

    if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {

        sock_id = connect_namedsocket(ctx->fs_root);

    } else {

        sock_id = atoi(ctx->fs_root);

        if (sock_id < 0) {

            fprintf(stderr, "socket descriptor not initialized\n");

        }

    }

    if (sock_id < 0) {

        g_free(proxy);

        return -1;

    }

    g_free(ctx->fs_root);

    ctx->fs_root = NULL;

    proxy->in_iovec.iov_base  = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->in_iovec.iov_len   = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;

    proxy->out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->out_iovec.iov_len  = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;

    ctx->private = proxy;

    proxy->sockfd = sock_id;

    qemu_mutex_init(&proxy->mutex);

    ctx->export_flags |= V9FS_PATHNAME_FSCONTEXT;

    ctx->exops.get_st_gen = proxy_ioc_getversion;

    return 0;

}


void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t size)

{

    uint32_t mask;

    switch (size) {

        case 4: mask = 3; break;

        case 2: mask = 1; break;

        default:

        case 1: mask = 0; break;

    }

    if (addr & mask) {

            qemu_log("unaligned access addr=%x size=%d, wr=%d\n",

                     addr, size, wr);

            if (!(env->sregs[SR_MSR] & MSR_EE)) {

                return;

            }

            env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (wr << 10) \

                                 | (dr & 31) << 5;

            if (size == 4) {

                env->sregs[SR_ESR] |= 1 << 11;

            }

            helper_raise_exception(EXCP_HW_EXCP);

    }

}


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

 {

+    return strcmp(a, b);

 }

static int qsort_strcmp(const void *a, const void *b)

{

    return strcmp(a, b);

}


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

+    if (sector_num < 0 ||

         nb_sectors < 0)

static int bdrv_wr_badreq_sectors(BlockDriverState *bs,

                                  int64_t sector_num, int nb_sectors)

{

    if (sector_num < 0 ||

        nb_sectors < 0)

        return 1;

    if (sector_num > bs->total_sectors - nb_sectors) {

        if (bs->autogrow)

            bs->total_sectors = sector_num + nb_sectors;

        else

            return 1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -45,9 +45,9 @@
             blk_dev_change_media_cb(bs->blk, true);

         }
+
+    }
+
+    return ret;
+
 }

int bdrv_set_key(BlockDriverState *bs, const char *key)

{

    int ret;

    if (bs->backing_hd && bs->backing_hd->encrypted) {

        ret = bdrv_set_key(bs->backing_hd, key);

        if (ret < 0)

            return ret;

        if (!bs->encrypted)

            return 0;

    }

    if (!bs->encrypted) {

        return -EINVAL;

    } else if (!bs->drv || !bs->drv->bdrv_set_key) {

        return -ENOMEDIUM;

    }

    ret = bs->drv->bdrv_set_key(bs, key);

    if (ret < 0) {

        bs->valid_key = 0;

    } else if (!bs->valid_key) {

        bs->valid_key = 1;

        if (bs->blk) {

            /* call the change callback now, we skipped it on open */

            blk_dev_change_media_cb(bs->blk, true);

        }

    }

    return ret;

}


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

     info->qdev.init = ssi_slave_init;

+    info->qdev.bus_type = BUS_TYPE_SSI;
+
+    qdev_register(&info->qdev);

 }

void ssi_register_slave(SSISlaveInfo *info)

{

    assert(info->qdev.size >= sizeof(SSISlave));

    info->qdev.init = ssi_slave_init;

    info->qdev.bus_type = BUS_TYPE_SSI;

    qdev_register(&info->qdev);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr)

 {
+
+    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);

     uint8_t val;

uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr)

{

    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);

    uint8_t val;

    k->get_config(vdev, vdev->config);

    if (addr > (vdev->config_len - sizeof(val)))

        return (uint32_t)-1;

    val = ldub_p(vdev->config + addr);

    return val;

}


static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *pls)

{

    while (pls->n_main_streams < pls->ctx->nb_streams) {

        int ist_idx = pls->n_main_streams;

        AVStream *st = avformat_new_stream(s, NULL);

        AVStream *ist = pls->ctx->streams[ist_idx];

        if (!st)

            return AVERROR(ENOMEM);

        st->id = pls->index;

        set_stream_info_from_input_stream(st, pls, ist);

        dynarray_add(&pls->main_streams, &pls->n_main_streams, st);

        add_stream_to_programs(s, pls, st);

    }

    return 0;

}


av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)

{

    int n = 1 << nbits;

    int i;

    s->nbits    = nbits;

    s->inverse  = inverse;

    ff_init_ff_cos_tabs(nbits+2);

    s->costab = ff_cos_tabs[nbits+2];

    s->csc2 = av_malloc(n/2 * sizeof(FFTSample));

    if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) {

        av_free(s->csc2);

        return -1;

    }

    for (i = 0; i < n/2; i++)

        s->csc2[i] = 0.5 / sin((M_PI / (2*n) * (2*i + 1)));

    switch(inverse) {

    case DCT_I  : s->dct_calc = ff_dct_calc_I_c; break;

    case DCT_II : s->dct_calc = ff_dct_calc_II_c ; break;

    case DCT_III: s->dct_calc = ff_dct_calc_III_c; break;

    case DST_I  : s->dct_calc = ff_dst_calc_I_c; break;

    }

    if (inverse == DCT_II && nbits == 5)

        s->dct_calc = dct32_func;

    s->dct32 = dct32;

    if (HAVE_MMX)     ff_dct_init_mmx(s);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
     const uint8_t *raw = buf + (s->avctx->width*s->avctx->height/16);

     int x,y,i;
+

     i = 0;

static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *buf_end){

    const uint8_t *raw = buf + (s->avctx->width*s->avctx->height/16);

    int x,y,i;

    i = 0;

    for(y=0; y<s->avctx->height/4; y++)

    for(x=0; x<s->avctx->width/4 && buf+i<buf_end; x++) {

        if (buf[i]==0xFF) {

            unsigned char *dst = s->frame.data[0] + (y*4)*s->frame.linesize[0] + x*4;

            if (raw+16<buf_end && *raw==0xFF) { /* intra */

                raw++;

                memcpy(dst, raw, 4);

                memcpy(dst+s->frame.linesize[0], raw+4, 4);

                memcpy(dst+2*s->frame.linesize[0], raw+8, 4);

                memcpy(dst+3*s->frame.linesize[0], raw+12, 4);

                raw+=16;

            }else if(raw<buf_end) {  /* inter using second-last frame as reference */

                int xoffset = (*raw & 0xF) - 7;

                int yoffset = ((*raw >> 4)) - 7;

                if (s->last2_frame.data[0])

                    cmv_motcomp(s->frame.data[0], s->frame.linesize[0],

                                s->last2_frame.data[0], s->last2_frame.linesize[0],

                                x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);

                raw++;

            }

        }else{  /* inter using last frame as reference */

            int xoffset = (buf[i] & 0xF) - 7;

            int yoffset = ((buf[i] >> 4)) - 7;

            cmv_motcomp(s->frame.data[0], s->frame.linesize[0],

                      s->last_frame.data[0], s->last_frame.linesize[0],

                      x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);

        }

        i++;

    }

}


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

     while (prefix_val < 5 && GET_CABAC(elem_offset[CU_QP_DELTA] + inc)) {

+        prefix_val++;

         inc = 1;

int ff_hevc_cu_qp_delta_abs(HEVCContext *s)

{

    int prefix_val = 0;

    int suffix_val = 0;

    int inc = 0;

    while (prefix_val < 5 && GET_CABAC(elem_offset[CU_QP_DELTA] + inc)) {

        prefix_val++;

        inc = 1;

    }

    if (prefix_val >= 5) {

        int k = 0;

        while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) {

            suffix_val += 1 << k;

            k++;

        }

        if (k == CABAC_MAX_BIN)

            av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k);

        while (k--)

            suffix_val += get_cabac_bypass(&s->HEVClc->cc) << k;

    }

    return prefix_val + suffix_val;

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     write_subsystem_identification();

     /*
+
      * The IPL PSW is at address 0. We also must not overwrite the

      * content of non-BIOS memory after we loaded the guest, so we

static void jump_to_IPL_code(uint64_t address)

{

    /* store the subsystem information _after_ the bootmap was loaded */

    write_subsystem_identification();

    /*

     * The IPL PSW is at address 0. We also must not overwrite the

     * content of non-BIOS memory after we loaded the guest, so we

     * save the original content and restore it in jump_to_IPL_2.

     */

    ResetInfo *current = 0;

    save = *current;

    current->ipl_addr = (uint32_t) (uint64_t) &jump_to_IPL_2;

    current->ipl_continue = address & 0x7fffffff;

    debug_print_int("set IPL addr to", current->ipl_continue);

    /* Ensure the guest output starts fresh */

    sclp_print("\n");

    /*

     * HACK ALERT.

     * We use the load normal reset to keep r15 unchanged. jump_to_IPL_2

     * can then use r15 as its stack pointer.

     */

    asm volatile("lghi 1,1\n\t"

                 "diag 1,1,0x308\n\t"

                 : : : "1", "memory");

    virtio_panic("\n! IPL returns !\n");

}


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

+    if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) {
+
+        nvdimm_acpi_hotplug(&pcms->acpi_nvdimm_state);
+
     }

 }

static void pc_dimm_post_plug(HotplugHandler *hotplug_dev,

                              DeviceState *dev, Error **errp)

{

    PCMachineState *pcms = PC_MACHINE(hotplug_dev);

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

        nvdimm_acpi_hotplug(&pcms->acpi_nvdimm_state);

    }

}


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

         } else if (s->recv_fifo.count >= s->recv_fifo.itl) {

+           tmp_iir = UART_IIR_RDI;
+
+        }
+
+    } else if ((s->ier & UART_IER_THRI) && s->thr_ipending) {

         tmp_iir = UART_IIR_THRI;

static void serial_update_irq(SerialState *s)

{

    uint8_t tmp_iir = UART_IIR_NO_INT;

    if ((s->ier & UART_IER_RLSI) && (s->lsr & UART_LSR_INT_ANY)) {

        tmp_iir = UART_IIR_RLSI;

    } else if ((s->ier & UART_IER_RDI) && s->timeout_ipending) {

        /* Note that(s->ier & UART_IER_RDI) can mask this interrupt,

         * this is not in the specification but is observed on existing

         * hardware.  */

        tmp_iir = UART_IIR_CTI;

    } else if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR)) {

        if (!(s->fcr & UART_FCR_FE)) {

           tmp_iir = UART_IIR_RDI;

        } else if (s->recv_fifo.count >= s->recv_fifo.itl) {

           tmp_iir = UART_IIR_RDI;

        }

    } else if ((s->ier & UART_IER_THRI) && s->thr_ipending) {

        tmp_iir = UART_IIR_THRI;

    } else if ((s->ier & UART_IER_MSI) && (s->msr & UART_MSR_ANY_DELTA)) {

        tmp_iir = UART_IIR_MSI;

    }

    s->iir = tmp_iir | (s->iir & 0xF0);

    if (tmp_iir != UART_IIR_NO_INT) {

        qemu_irq_raise(s->irq);

    } else {

        qemu_irq_lower(s->irq);

    }

}


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

     uint8_t *p, *p0;

+
+
+    ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
+
+

     size = offset + ff_vorbiscomment_length(*m, vendor) + framing_bit;

static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact,

                                        int *header_len, AVDictionary **m, int framing_bit)

{

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

    int size;

    uint8_t *p, *p0;

    ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);

    size = offset + ff_vorbiscomment_length(*m, vendor) + framing_bit;

    p = av_mallocz(size);

    if (!p)

        return NULL;

    p0 = p;

    p += offset;

    ff_vorbiscomment_write(&p, m, vendor);

    if (framing_bit)

        bytestream_put_byte(&p, 1);

    *header_len = size;

    return p0;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 void helper_fxtract(void)

+{

+    CPU86_LDoubleU temp;
+
+    unsigned int expdif;
+
+

     temp.d = ST0;

void helper_fxtract(void)

{

    CPU86_LDoubleU temp;

    unsigned int expdif;

    temp.d = ST0;

    expdif = EXPD(temp) - EXPBIAS;

    /*DP exponent bias*/

    ST0 = expdif;

    fpush();

    BIASEXPONENT(temp);

    ST0 = temp.d;

}


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

     return timerlist_has_timers(
+
+        main_loop_tlg.tl[type]);

 }

bool qemu_clock_has_timers(QEMUClockType type)

{

    return timerlist_has_timers(

        main_loop_tlg.tl[type]);

}


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

+    while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {

         FFServerStream *feed;

static void handle_child_exit(int sig)

{

    pid_t pid;

    int status;

    while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {

        FFServerStream *feed;

        for (feed = config.first_feed; feed; feed = feed->next) {

            if (feed->pid == pid) {

                int uptime = time(0) - feed->pid_start;

                feed->pid = 0;

                fprintf(stderr, "%s: Pid %d exited with status %d after %d seconds\n", feed->filename, pid, status, uptime);

                if (uptime < 30)

                    /* Turn off any more restarts */

                    feed->child_argv = 0;

            }

        }

    }

    need_to_start_children = 1;

}


static inline uint8_t *ram_chunk_end(const RDMALocalBlock *rdma_ram_block,

                                     uint64_t i)

{

    uint8_t *result = ram_chunk_start(rdma_ram_block, i) +

                                         (1UL << RDMA_REG_CHUNK_SHIFT);

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

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

    }

    return result;

}


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

     do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1],

void helper_rfi(CPUPPCState *env)

{

    do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1],

           ~((target_ulong)0x783F0000), 1);

}


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

     DeviceState *dev = DEVICE(sbd);
+
     struct omap2_gpif_s *s = OMAP2_GPIO(dev);

+    int i;

+    if (!s->iclk) {

         hw_error("omap2-gpio: iclk not connected\n");

@@ -18,8 +18,8 @@

     if (s->mpu_model < omap3430) {

+        s->modulecount = (s->mpu_model < omap2430) ? 4 : 5;
+
         memory_region_init_io(&s->iomem, OBJECT(s), &omap2_gpif_top_ops, s,

                               "omap2.gpio", 0x1000);

static int omap2_gpio_init(SysBusDevice *sbd)

{

    DeviceState *dev = DEVICE(sbd);

    struct omap2_gpif_s *s = OMAP2_GPIO(dev);

    int i;

    if (!s->iclk) {

        hw_error("omap2-gpio: iclk not connected\n");

    }

    if (s->mpu_model < omap3430) {

        s->modulecount = (s->mpu_model < omap2430) ? 4 : 5;

        memory_region_init_io(&s->iomem, OBJECT(s), &omap2_gpif_top_ops, s,

                              "omap2.gpio", 0x1000);

        sysbus_init_mmio(sbd, &s->iomem);

    } else {

        s->modulecount = 6;

    }

    s->modules = g_new0(struct omap2_gpio_s, s->modulecount);

    s->handler = g_new0(qemu_irq, s->modulecount * 32);

    qdev_init_gpio_in(dev, omap2_gpio_set, s->modulecount * 32);

    qdev_init_gpio_out(dev, s->handler, s->modulecount * 32);

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

        struct omap2_gpio_s *m = &s->modules[i];

        if (!s->fclk[i]) {

            hw_error("omap2-gpio: fclk%d not connected\n", i);

        }

        m->revision = (s->mpu_model < omap3430) ? 0x18 : 0x25;

        m->handler = &s->handler[i * 32];

        sysbus_init_irq(sbd, &m->irq[0]); /* mpu irq */

        sysbus_init_irq(sbd, &m->irq[1]); /* dsp irq */

        sysbus_init_irq(sbd, &m->wkup);

        memory_region_init_io(&m->iomem, OBJECT(s), &omap2_gpio_module_ops, m,

                              "omap.gpio-module", 0x1000);

        sysbus_init_mmio(sbd, &m->iomem);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
             replay_state.current_step += count;
             if (replay_state.instructions_count == 0) {
                 assert(replay_state.data_kind == EVENT_INSTRUCTION);
+                replay_finish_event();
+                /* Wake up iothread. This is required because
+                   timers will not expire until clock counters
+                   will be read from the log. */
+                qemu_notify_event();
             }
         }
         replay_mutex_unlock();

void replay_account_executed_instructions(void)
{
    if (replay_mode == REPLAY_MODE_PLAY) {
        replay_mutex_lock();
        if (replay_state.instructions_count > 0) {
            int count = (int)(replay_get_current_step()
                              - replay_state.current_step);
            replay_state.instructions_count -= count;
            replay_state.current_step += count;
            if (replay_state.instructions_count == 0) {
                assert(replay_state.data_kind == EVENT_INSTRUCTION);
                replay_finish_event();
                /* Wake up iothread. This is required because
                   timers will not expire until clock counters
                   will be read from the log. */
                qemu_notify_event();
            }
        }
        replay_mutex_unlock();
    }
}


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

 {

+    NvmeDeleteQ *c = (NvmeDeleteQ *)cmd;

     NvmeCQueue *cq;

+    uint16_t qid = le16_to_cpu(c->qid);

static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeCmd *cmd)

{

    NvmeDeleteQ *c = (NvmeDeleteQ *)cmd;

    NvmeCQueue *cq;

    uint16_t qid = le16_to_cpu(c->qid);

    if (!qid || nvme_check_cqid(n, qid)) {

        return NVME_INVALID_CQID | NVME_DNR;

    }

    cq = n->cq[qid];

    if (!QTAILQ_EMPTY(&cq->sq_list)) {

        return NVME_INVALID_QUEUE_DEL;

    }

    nvme_free_cq(cq, n);

    return NVME_SUCCESS;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+ram_addr_t migration_bitmap_find_dirty(RAMState *rs, RAMBlock *rb,

                                        ram_addr_t start,

@@ -11,7 +11,7 @@
     unsigned long nr = base + (start >> TARGET_PAGE_BITS);

     uint64_t rb_size = rb->used_length;
+
     unsigned long size = base + (rb_size >> TARGET_PAGE_BITS);

     unsigned long *bitmap;

ram_addr_t migration_bitmap_find_dirty(RAMState *rs, RAMBlock *rb,

                                       ram_addr_t start,

                                       ram_addr_t *ram_addr_abs)

{

    unsigned long base = rb->offset >> TARGET_PAGE_BITS;

    unsigned long nr = base + (start >> TARGET_PAGE_BITS);

    uint64_t rb_size = rb->used_length;

    unsigned long size = base + (rb_size >> TARGET_PAGE_BITS);

    unsigned long *bitmap;

    unsigned long next;

    bitmap = atomic_rcu_read(&rs->ram_bitmap)->bmap;

    if (rs->ram_bulk_stage && nr > base) {

        next = nr + 1;

    } else {

        next = find_next_bit(bitmap, size, nr);

    }

    *ram_addr_abs = next << TARGET_PAGE_BITS;

    return (next - base) << TARGET_PAGE_BITS;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 void helper_fitoq(CPUSPARCState *env, int32_t src)

 {
+
+    /* No possible exceptions converting int to long double.  */

     QT0 = int32_to_float128(src, &env->fp_status);

void helper_fitoq(CPUSPARCState *env, int32_t src)

{

    /* No possible exceptions converting int to long double.  */

    QT0 = int32_to_float128(src, &env->fp_status);

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     char val_str[128];

     int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
+

     print_section_header("format");

static void show_format(WriterContext *w, AVFormatContext *fmt_ctx)

{

    char val_str[128];

    int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;

    print_section_header("format");

    print_str("filename",         fmt_ctx->filename);

    print_int("nb_streams",       fmt_ctx->nb_streams);

    print_str("format_name",      fmt_ctx->iformat->name);

    print_str("format_long_name", fmt_ctx->iformat->long_name);

    print_time("start_time",      fmt_ctx->start_time, &AV_TIME_BASE_Q);

    print_time("duration",        fmt_ctx->duration,   &AV_TIME_BASE_Q);

    if (size >= 0) print_val    ("size", size, unit_byte_str);

    else           print_str_opt("size", "N/A");

    if (fmt_ctx->bit_rate > 0) print_val    ("bit_rate", fmt_ctx->bit_rate, unit_bit_per_second_str);

    else                       print_str_opt("bit_rate", "N/A");

    show_tags(fmt_ctx->metadata);

    print_section_footer("format");

    fflush(stdout);

}


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

+{

     BlockDriverAIOCBSync *acb = opaque;

static void bdrv_aio_bh_cb(void *opaque)

{

    BlockDriverAIOCBSync *acb = opaque;

    if (!acb->is_write)

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

    qemu_vfree(acb->bounce);

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

    qemu_bh_delete(acb->bh);

    acb->bh = NULL;

    qemu_aio_release(acb);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void kqemu_record_pc(unsigned long pc)
+
+{
+
+    unsigned long h;
+
     PCRecord **pr, *r;

static void kqemu_record_pc(unsigned long pc)

{

    unsigned long h;

    PCRecord **pr, *r;

    h = pc / PC_REC_SIZE;

    h = h ^ (h >> PC_REC_HASH_BITS);

    h &= (PC_REC_HASH_SIZE - 1);

    pr = &pc_rec_hash[h];

    for(;;) {

        r = *pr;

        if (r == NULL)

            break;

        if (r->pc == pc) {

            r->count++;

            return;

        }

        pr = &r->next;

    }

    r = malloc(sizeof(PCRecord));

    r->count = 1;

    r->pc = pc;

    r->next = NULL;

    *pr = r;

    nb_pc_records++;

}


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

     mxf->local_tags = av_calloc(item_num, item_len);

+    if (!mxf->local_tags)
+
+        return AVERROR(ENOMEM);
+
+    mxf->local_tags_count = item_num;

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

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

{

    MXFContext *mxf = arg;

    int item_num = avio_rb32(pb);

    int item_len = avio_rb32(pb);

    if (item_len != 18) {

        avpriv_request_sample(pb, "Primer pack item length %d", item_len);

        return AVERROR_PATCHWELCOME;

    }

    if (item_num > 65536) {

        av_log(mxf->fc, AV_LOG_ERROR, "item_num %d is too large\n", item_num);

        return AVERROR_INVALIDDATA;

    }

    mxf->local_tags = av_calloc(item_num, item_len);

    if (!mxf->local_tags)

        return AVERROR(ENOMEM);

    mxf->local_tags_count = item_num;

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

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void pxa2xx_screen_dump(void *opaque, const char *filename)

 {

static void pxa2xx_screen_dump(void *opaque, const char *filename)

{

    /* TODO */

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 vmxnet3_init_msix(VMXNET3State *s)

+{

     PCIDevice *d = PCI_DEVICE(s);

vmxnet3_init_msix(VMXNET3State *s)

{

    PCIDevice *d = PCI_DEVICE(s);

    int res = msix_init(d, VMXNET3_MAX_INTRS,

                        &s->msix_bar,

                        VMXNET3_MSIX_BAR_IDX, VMXNET3_OFF_MSIX_TABLE,

                        &s->msix_bar,

                        VMXNET3_MSIX_BAR_IDX, VMXNET3_OFF_MSIX_PBA(s),

                        VMXNET3_MSIX_OFFSET(s));

    if (0 > res) {

        VMW_WRPRN("Failed to initialize MSI-X, error %d", res);

        s->msix_used = false;

    } else {

        if (!vmxnet3_use_msix_vectors(s, VMXNET3_MAX_INTRS)) {

            VMW_WRPRN("Failed to use MSI-X vectors, error %d", res);

            msix_uninit(d, &s->msix_bar, &s->msix_bar);

            s->msix_used = false;

        } else {

            s->msix_used = true;

        }

    }

    return s->msix_used;

}


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

     connect_addr->type = SOCKET_ADDRESS_KIND_UNIX;

+    connect_addr->u.q_unix = g_new0(UnixSocketAddress, 1);
+
+    connect_addr->u.q_unix->path = g_strdup(TEST_SOCKET);
+
+

     test_io_channel(async, listen_addr, connect_addr, true);

static void test_io_channel_unix(bool async)

{

    SocketAddress *listen_addr = g_new0(SocketAddress, 1);

    SocketAddress *connect_addr = g_new0(SocketAddress, 1);

#define TEST_SOCKET "test-io-channel-socket.sock"

    listen_addr->type = SOCKET_ADDRESS_KIND_UNIX;

    listen_addr->u.q_unix = g_new0(UnixSocketAddress, 1);

    listen_addr->u.q_unix->path = g_strdup(TEST_SOCKET);

    connect_addr->type = SOCKET_ADDRESS_KIND_UNIX;

    connect_addr->u.q_unix = g_new0(UnixSocketAddress, 1);

    connect_addr->u.q_unix->path = g_strdup(TEST_SOCKET);

    test_io_channel(async, listen_addr, connect_addr, true);

    qapi_free_SocketAddress(listen_addr);

    qapi_free_SocketAddress(connect_addr);

    unlink(TEST_SOCKET);

}


--- a/source.c
+++ b/source.c
@@ -1,19 +1,19 @@
+static int img_open_password(BlockBackend *blk, const char *filename,
+
+                             int flags, bool quiet)
+
+{
+
+    BlockDriverState *bs;
+
+    char password[256];

+
+
     bs = blk_bs(blk);

     if (bdrv_is_encrypted(bs) && bdrv_key_required(bs) &&
+
         !(flags & BDRV_O_NO_IO)) {

         qprintf(quiet, "Disk image '%s' is encrypted.\n", filename);

static int img_open_password(BlockBackend *blk, const char *filename,

                             int flags, bool quiet)

{

    BlockDriverState *bs;

    char password[256];

    bs = blk_bs(blk);

    if (bdrv_is_encrypted(bs) && bdrv_key_required(bs) &&

        !(flags & BDRV_O_NO_IO)) {

        qprintf(quiet, "Disk image '%s' is encrypted.\n", filename);

        if (qemu_read_password(password, sizeof(password)) < 0) {

            error_report("No password given");

            return -1;

        }

        if (bdrv_set_key(bs, password) < 0) {

            error_report("invalid password");

            return -1;

        }

    }

    return 0;

}


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

+{
+
+    if (migration_bitmap) {
+
+        memory_global_dirty_log_stop();

         g_free(migration_bitmap);

static void migration_end(void)

{

    if (migration_bitmap) {

        memory_global_dirty_log_stop();

        g_free(migration_bitmap);

        migration_bitmap = NULL;

    }

    if (XBZRLE.cache) {

        cache_fini(XBZRLE.cache);

        g_free(XBZRLE.cache);

        g_free(XBZRLE.encoded_buf);

        g_free(XBZRLE.current_buf);

        g_free(XBZRLE.decoded_buf);

        XBZRLE.cache = NULL;

    }

}


static int kvm_irqchip_get_virq(KVMState *s)

{

    uint32_t *word = s->used_gsi_bitmap;

    int max_words = ALIGN(s->gsi_count, 32) / 32;

    int i, bit;

    bool retry = true;

again:

    /* Return the lowest unused GSI in the bitmap */

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

        bit = ffs(~word[i]);

        if (!bit) {

            continue;

        }

        return bit - 1 + i * 32;

    }

    if (retry) {

        retry = false;

        kvm_flush_dynamic_msi_routes(s);

        goto again;

    }

    return -ENOSPC;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void update_sse_status(CPUX86State *env)

+{

     int rnd_type;

@@ -11,8 +11,8 @@
     switch (env->mxcsr & SSE_RC_MASK) {

     default:
+
+    case SSE_RC_NEAR:

         rnd_type = float_round_nearest_even;

static void update_sse_status(CPUX86State *env)

{

    int rnd_type;

    /* set rounding mode */

    switch (env->mxcsr & SSE_RC_MASK) {

    default:

    case SSE_RC_NEAR:

        rnd_type = float_round_nearest_even;

        break;

    case SSE_RC_DOWN:

        rnd_type = float_round_down;

        break;

    case SSE_RC_UP:

        rnd_type = float_round_up;

        break;

    case SSE_RC_CHOP:

        rnd_type = float_round_to_zero;

        break;

    }

    set_float_rounding_mode(rnd_type, &env->sse_status);

    /* set denormals are zero */

    set_flush_inputs_to_zero((env->mxcsr & SSE_DAZ) ? 1 : 0, &env->sse_status);

    /* set flush to zero */

    set_flush_to_zero((env->mxcsr & SSE_FZ) ? 1 : 0, &env->fp_status);

}


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

     RTPDemuxContext *s = s1->priv_data;

+    uint32_t rtp_ts;

static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)

{

    RTPDemuxContext *s = s1->priv_data;

    uint32_t rtp_ts;

#if defined(DEBUG)

    printf("RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp);

#endif

    if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) s->first_rtcp_ntp_time = ntp_time;

    s->last_rtcp_ntp_time = ntp_time;

    rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, AV_TIME_BASE_Q,

                          s1->streams[0]->time_base) + s->base_timestamp;

    put_byte(s1->pb, (RTP_VERSION << 6));

    put_byte(s1->pb, 200);

    put_be16(s1->pb, 6); /* length in words - 1 */

    put_be32(s1->pb, s->ssrc);

    put_be32(s1->pb, ntp_time / 1000000);

    put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);

    put_be32(s1->pb, rtp_ts);

    put_be32(s1->pb, s->packet_count);

    put_be32(s1->pb, s->octet_count);

    put_flush_packet(s1->pb);

}


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

 {

+    MIPSnetState *s = opaque;
+
+

     if (s->busy)

static int mipsnet_can_receive(void *opaque)

{

    MIPSnetState *s = opaque;

    if (s->busy)

        return 0;

    return !mipsnet_buffer_full(s);

}


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

     int16_t *samples = data;
+
     MACEContext *ctx = avctx->priv_data;
+
     int i, j, k;

static int mace3_decode_frame(AVCodecContext *avctx,

                              void *data, int *data_size,

                              const uint8_t *buf, int buf_size)

{

    int16_t *samples = data;

    MACEContext *ctx = avctx->priv_data;

    int i, j, k;

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

        int16_t *output = samples + i;

        for (j=0; j < buf_size / 2 / avctx->channels; j++)

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

                uint8_t pkt = buf[i*2 + j*2*avctx->channels + k];

                chomp3(&ctx->chd[i], output, pkt       &7, MACEtab1, MACEtab2,

                       8, avctx->channels);

                output += avctx->channels;

                chomp3(&ctx->chd[i], output,(pkt >> 3) &3, MACEtab3, MACEtab4,

                       4, avctx->channels);

                output += avctx->channels;

                chomp3(&ctx->chd[i], output, pkt >> 5    , MACEtab1, MACEtab2,

                       8, avctx->channels);

                output += avctx->channels;

            }

    }

    *data_size = 2 * 3 * buf_size;

    return buf_size;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
                                   int weight_src, int offset)

 {
+
+    avc_wgt_8width_msa(src, stride,
+
                        height, log2_denom, weight_src, offset);

 }

void ff_weight_h264_pixels8_8_msa(uint8_t *src, int stride,

                                  int height, int log2_denom,

                                  int weight_src, int offset)

{

    avc_wgt_8width_msa(src, stride,

                       height, log2_denom, weight_src, offset);

}


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

     for (other = first_cpu; other; other = other->next_cpu) {

+        if (other->running) {
+
+            pending_cpus++;
+
+            cpu_interrupt(other, CPU_INTERRUPT_EXIT);

         }

static inline void start_exclusive(void)

{

    CPUState *other;

    pthread_mutex_lock(&exclusive_lock);

    exclusive_idle();

    pending_cpus = 1;

    /* Make all other cpus stop executing.  */

    for (other = first_cpu; other; other = other->next_cpu) {

        if (other->running) {

            pending_cpus++;

            cpu_interrupt(other, CPU_INTERRUPT_EXIT);

        }

    }

    if (pending_cpus > 1) {

        pthread_cond_wait(&exclusive_cond, &exclusive_lock);

    }

}


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
     if (!s->connected || s->max_size <= 0) {

         return TRUE;
+
     }

     len = sizeof(buf);

static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)

{

    CharDriverState *chr = opaque;

    TCPCharDriver *s = chr->opaque;

    uint8_t buf[READ_BUF_LEN];

    int len, size;

    if (!s->connected || s->max_size <= 0) {

        return TRUE;

    }

    len = sizeof(buf);

    if (len > s->max_size)

        len = s->max_size;

    size = tcp_chr_recv(chr, (void *)buf, len);

    if (size == 0) {

        /* connection closed */

        s->connected = 0;

        if (s->listen_chan) {

            s->listen_tag = g_io_add_watch(s->listen_chan, G_IO_IN, tcp_chr_accept, chr);

        }

        if (s->tag) {

            g_source_remove(s->tag);

            s->tag = 0;

        }

        g_io_channel_unref(s->chan);

        s->chan = NULL;

        closesocket(s->fd);

        s->fd = -1;

        qemu_chr_be_event(chr, CHR_EVENT_CLOSED);

    } else if (size > 0) {

        if (s->do_telnetopt)

            tcp_chr_process_IAC_bytes(chr, s, buf, &size);

        if (size > 0)

            qemu_chr_be_write(chr, buf, size);

    }

    return TRUE;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 iscsi_aio_cancel(BlockDriverAIOCB *blockacb)

 {
+
     IscsiAIOCB *acb = (IscsiAIOCB *)blockacb;
+
+    IscsiLun *iscsilun = acb->iscsilun;

iscsi_aio_cancel(BlockDriverAIOCB *blockacb)

{

    IscsiAIOCB *acb = (IscsiAIOCB *)blockacb;

    IscsiLun *iscsilun = acb->iscsilun;

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

    acb->canceled = 1;

    /* send a task mgmt call to the target to cancel the task on the target */

    iscsi_task_mgmt_abort_task_async(iscsilun->iscsi, acb->task,

                                     iscsi_abort_task_cb, NULL);

    /* then also cancel the task locally in libiscsi */

    iscsi_scsi_task_cancel(iscsilun->iscsi, acb->task);

}


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

+    seq->avctx = avctx;
+
+    avctx->pix_fmt = AV_PIX_FMT_PAL8;
+
+

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

static av_cold int seqvideo_decode_init(AVCodecContext *avctx)

{

    SeqVideoContext *seq = avctx->priv_data;

    seq->avctx = avctx;

    avctx->pix_fmt = AV_PIX_FMT_PAL8;

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

    return 0;

}


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

     if (ret < 0) {

+        reply.error = -ret;
+
+    } else {
+
+        nbd_co_receive_reply(client, &request, &reply, NULL);

     }

int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset,

                          uint64_t bytes, QEMUIOVector *qiov, int flags)

{

    NbdClientSession *client = nbd_get_client_session(bs);

    struct nbd_request request = {

        .type = NBD_CMD_WRITE,

        .from = offset,

        .len = bytes,

    };

    struct nbd_reply reply;

    ssize_t ret;

    if (flags & BDRV_REQ_FUA) {

        assert(client->nbdflags & NBD_FLAG_SEND_FUA);

        request.type |= NBD_CMD_FLAG_FUA;

    }

    assert(bytes <= NBD_MAX_BUFFER_SIZE);

    nbd_coroutine_start(client, &request);

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

    if (ret < 0) {

        reply.error = -ret;

    } else {

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

    }

    nbd_coroutine_end(client, &request);

    return -reply.error;

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     CharDriverState *chr;

+
     if (is_daemonized()) {

         error_report("cannot use stdio with -daemonize");

static CharDriverState *qemu_chr_open_stdio(ChardevStdio *opts)

{

    CharDriverState *chr;

    if (is_daemonized()) {

        error_report("cannot use stdio with -daemonize");

        return NULL;

    }

    old_fd0_flags = fcntl(0, F_GETFL);

    tcgetattr (0, &oldtty);

    qemu_set_nonblock(0);

    atexit(term_exit);

    chr = qemu_chr_open_fd(0, 1);

    chr->chr_close = qemu_chr_close_stdio;

    chr->chr_set_echo = qemu_chr_set_echo_stdio;

    if (opts->has_signal) {

        stdio_allow_signal = opts->signal;

    }

    qemu_chr_fe_set_echo(chr, false);

    return chr;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void qemu_acl_reset(qemu_acl *acl)
+
 {
+
     qemu_acl_entry *entry;

void qemu_acl_reset(qemu_acl *acl)

{

    qemu_acl_entry *entry;

    /* Put back to deny by default, so there is no window

     * of "open access" while the user re-initializes the

     * access control list */

    acl->defaultDeny = 1;

    QTAILQ_FOREACH(entry, &acl->entries, next) {

        QTAILQ_REMOVE(&acl->entries, entry, next);

        free(entry->match);

        free(entry);

    }

    acl->nentries = 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int read_probe(AVProbeData *pd)
+
 {

     if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) <= pd->buf_size - 4 &&

static int read_probe(AVProbeData *pd)

{

    if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) <= pd->buf_size - 4 &&

        !memcmp(pd->buf + 4, MAGIC, strlen(MAGIC)))

        return AVPROBE_SCORE_MAX;

    return 0;

}


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

         if (!g->switch_point)

+            return;
+
+        /* XXX: check this for 8000Hz case */
+
+        n = 1;

     } else {

static void compute_antialias_fixed(MPADecodeContext *s, GranuleDef *g)

{

    int32_t *ptr, *csa;

    int n, i;

    /* we antialias only "long" bands */

    if (g->block_type == 2) {

        if (!g->switch_point)

            return;

        /* XXX: check this for 8000Hz case */

        n = 1;

    } else {

        n = SBLIMIT - 1;

    }

    ptr = g->sb_hybrid + 18;

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

        int tmp0, tmp1, tmp2;

        csa = &csa_table[0][0];

#define INT_AA(j) \

            tmp0 = ptr[-1-j];\

            tmp1 = ptr[   j];\

            tmp2= MULH(tmp0 + tmp1, csa[0+4*j]);\

            ptr[-1-j] = 4*(tmp2 - MULH(tmp1, csa[2+4*j]));\

            ptr[   j] = 4*(tmp2 + MULH(tmp0, csa[3+4*j]));

        INT_AA(0)

        INT_AA(1)

        INT_AA(2)

        INT_AA(3)

        INT_AA(4)

        INT_AA(5)

        INT_AA(6)

        INT_AA(7)

        ptr += 18;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc,
+
                                    const int16_t *hLumFilter,

                                    const int16_t *hLumFilterPos, int hLumFilterSize,

static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, int dstWidth, const uint8_t *src, int srcW, int xInc,

                                   const int16_t *hLumFilter,

                                   const int16_t *hLumFilterPos, int hLumFilterSize,

                                   uint8_t *formatConvBuffer,

                                   uint32_t *pal, int isAlpha)

{

    void (*toYV12)(uint8_t *, const uint8_t *, int, uint32_t *) = isAlpha ? c->alpToYV12 : c->lumToYV12;

    void (*convertRange)(uint16_t *, int) = isAlpha ? NULL : c->lumConvertRange;

    src += isAlpha ? c->alpSrcOffset : c->lumSrcOffset;

    if (toYV12) {

        toYV12(formatConvBuffer, src, srcW, pal);

        src= formatConvBuffer;

    }

    if (!c->hyscale_fast) {

        c->hScale(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize);

    } else { // fast bilinear upscale / crap downscale

        c->hyscale_fast(c, dst, dstWidth, src, srcW, xInc);

    }

    if (convertRange)

        convertRange(dst, dstWidth);

}


static int l2_load(BlockDriverState *bs, uint64_t l2_offset,

    uint64_t **l2_table)

{

    BDRVQcowState *s = bs->opaque;

    int min_index;

    int ret;

    /* seek if the table for the given offset is in the cache */

    *l2_table = seek_l2_table(s, l2_offset);

    if (*l2_table != NULL) {

        return 0;

    }

    /* not found: load a new entry in the least used one */

    min_index = l2_cache_new_entry(bs);

    *l2_table = s->l2_cache + (min_index << s->l2_bits);

    BLKDBG_EVENT(bs->file, BLKDBG_L2_LOAD);

    ret = bdrv_pread(bs->file, l2_offset, *l2_table,

        s->l2_size * sizeof(uint64_t));

    if (ret < 0) {

        return ret;

    }

    s->l2_cache_offsets[min_index] = l2_offset;

    s->l2_cache_counts[min_index] = 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void OPPROTO op_405_check_satu (void)

+{

     if (unlikely(T0 < T2)) {

void OPPROTO op_405_check_satu (void)

{

    if (unlikely(T0 < T2)) {

        /* Saturate result */

        T0 = -1;

    }

    RETURN();

}


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

     do_405_check_ov();

void OPPROTO op_405_check_ov (void)

{

    do_405_check_ov();

    RETURN();

}


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

     double sync_threshold, diff;
+
+
+
+    /* update delay to follow master synchronisation source */
+
     if (get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER) {

         /* if video is slave, we try to correct big delays by

static double compute_target_delay(double delay, VideoState *is)

{

    double sync_threshold, diff;

    /* update delay to follow master synchronisation source */

    if (get_master_sync_type(is) != AV_SYNC_VIDEO_MASTER) {

        /* if video is slave, we try to correct big delays by

           duplicating or deleting a frame */

        diff = get_video_clock(is) - get_master_clock(is);

        /* skip or repeat frame. We take into account the

           delay to compute the threshold. I still don't know

           if it is the best guess */

        sync_threshold = FFMAX(AV_SYNC_THRESHOLD, delay);

        if (fabs(diff) < AV_NOSYNC_THRESHOLD) {

            if (diff <= -sync_threshold)

                delay = 0;

            else if (diff >= sync_threshold)

                delay = 2 * delay;

        }

    }

    av_dlog(NULL, "video: delay=%0.3f A-V=%f\n",

            delay, -diff);

    return delay;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void portio_list_destroy(PortioList *piolist)

+{
+
     g_free(piolist->regions);

     g_free(piolist->aliases);

void portio_list_destroy(PortioList *piolist)

{

    g_free(piolist->regions);

    g_free(piolist->aliases);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void acpi_set_pci_info(void)

+{

     PCIBus *bus = find_i440fx(); /* TODO: Q35 support */

static void acpi_set_pci_info(void)

{

    PCIBus *bus = find_i440fx(); /* TODO: Q35 support */

    unsigned bsel_alloc = 0;

    if (bus) {

        /* Scan all PCI buses. Set property to enable acpi based hotplug. */

        pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_alloc);

    }

}


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

     uint64_t size;

+    uint8_t *buf;

     int err;

@@ -15,7 +15,7 @@
     if (c->fc->nb_streams < 1) // will happen with jp2 files

         return 0;
+
     st= c->fc->streams[c->fc->nb_streams-1];

     size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;

static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom)

{

    AVStream *st;

    uint64_t size;

    uint8_t *buf;

    int err;

    if (c->fc->nb_streams < 1) // will happen with jp2 files

        return 0;

    st= c->fc->streams[c->fc->nb_streams-1];

    size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;

    if (size > INT_MAX || (uint64_t)atom.size > INT_MAX)

        return AVERROR_INVALIDDATA;

    if ((err = av_reallocp(&st->codec->extradata, size)) < 0) {

        st->codec->extradata_size = 0;

        return err;

    }

    buf = st->codec->extradata + st->codec->extradata_size;

    st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;

    AV_WB32(       buf    , atom.size + 8);

    AV_WL32(       buf + 4, atom.type);

    avio_read(pb, buf + 8, atom.size);

    return 0;

}


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

     visit_type_UserDefNestedList(v, (UserDefNestedList **)native, NULL, errp);
+
 }

static void visit_nested_struct_list(Visitor *v, void **native, Error **errp)

{

    visit_type_UserDefNestedList(v, (UserDefNestedList **)native, NULL, errp);

}


--- a/source.c
+++ b/source.c
@@ -1,16 +1,16 @@
 static void v4l2_free_buffer(void *opaque, uint8_t *unused)

 {
+
+    V4L2Buffer* avbuf = opaque;
+
     V4L2m2mContext *s = buf_to_m2mctx(avbuf);

+
+
     atomic_fetch_sub_explicit(&s->refcount, 1, memory_order_acq_rel);

+    if (s->reinit) {

         if (!atomic_load(&s->refcount))

static void v4l2_free_buffer(void *opaque, uint8_t *unused)

{

    V4L2Buffer* avbuf = opaque;

    V4L2m2mContext *s = buf_to_m2mctx(avbuf);

    atomic_fetch_sub_explicit(&s->refcount, 1, memory_order_acq_rel);

    if (s->reinit) {

        if (!atomic_load(&s->refcount))

            sem_post(&s->refsync);

        return;

    }

    if (avbuf->context->streamon) {

        ff_v4l2_buffer_enqueue(avbuf);

        return;

    }

    if (!atomic_load(&s->refcount))

        ff_v4l2_m2m_codec_end(s->avctx);

}


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

     aio_set_event_notifier(ctx, &data.e, NULL);

+    g_assert(!aio_poll(ctx, false));
+
+    g_assert_cmpint(data.n, ==, 1);
+
+

     event_notifier_cleanup(&data.e);

static void test_wait_event_notifier(void)

{

    EventNotifierTestData data = { .n = 0, .active = 1 };

    event_notifier_init(&data.e, false);

    aio_set_event_notifier(ctx, &data.e, event_ready_cb);

    g_assert(!aio_poll(ctx, false));

    g_assert_cmpint(data.n, ==, 0);

    g_assert_cmpint(data.active, ==, 1);

    event_notifier_set(&data.e);

    g_assert(aio_poll(ctx, false));

    g_assert_cmpint(data.n, ==, 1);

    g_assert_cmpint(data.active, ==, 0);

    g_assert(!aio_poll(ctx, false));

    g_assert_cmpint(data.n, ==, 1);

    g_assert_cmpint(data.active, ==, 0);

    aio_set_event_notifier(ctx, &data.e, NULL);

    g_assert(!aio_poll(ctx, false));

    g_assert_cmpint(data.n, ==, 1);

    event_notifier_cleanup(&data.e);

}


int kvmppc_remove_spapr_tce(void *table, int fd, uint32_t window_size)

{

    long len;

    if (fd < 0) {

        return -1;

    }

    len = (window_size / SPAPR_TCE_PAGE_SIZE)*sizeof(sPAPRTCE);

    if ((munmap(table, len) < 0) ||

        (close(fd) < 0)) {

        fprintf(stderr, "KVM: Unexpected error removing TCE table: %s",

                strerror(errno));

        /* Leak the table */

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void do_hybrid_window(int order, int n, int non_rec, const float *in,
+
+                             float *out, float *hist, float *out2,
+
+                             const float *window)
+
 {

     int i;

static void do_hybrid_window(int order, int n, int non_rec, const float *in,

                             float *out, float *hist, float *out2,

                             const float *window)

{

    int i;

    float buffer1[order + 1];

    float buffer2[order + 1];

    float work[order + n + non_rec];

    /* update history */

    memmove(hist, hist + n, (order + non_rec)*sizeof(*hist));

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

        hist[order + non_rec + i] = in[n-i-1];

    colmult(work, window, hist, order + n + non_rec);

    convolve(buffer1, work + order    , n      , order);

    convolve(buffer2, work + order + n, non_rec, order);

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

        out2[i] = out2[i] * 0.5625 + buffer1[i];

        out [i] = out2[i]          + buffer2[i];

    }

    /* Multiply by the white noise correcting factor (WNCF) */

    *out *= 257./256.;

}


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

     MpegEncContext * const s = &h->s;

+    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
+
+    int n;

static inline void write_back_non_zero_count(H264Context *h){

    MpegEncContext * const s = &h->s;

    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;

    int n;

    for( n = 0; n < 16+4+4; n++ )

        h->non_zero_count[mb_xy][n] = h->non_zero_count_cache[scan8[n]];

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     NBDExport *exp;

+
+    csock = client->sock;
+
+    if (length) {
+

static int nbd_handle_list(NBDClient *client, uint32_t length)

{

    int csock;

    NBDExport *exp;

    csock = client->sock;

    if (length) {

        return nbd_send_rep(csock, NBD_REP_ERR_INVALID, NBD_OPT_LIST);

    /* For each export, send a NBD_REP_SERVER reply. */

    QTAILQ_FOREACH(exp, &exports, next) {

        if (nbd_send_rep_list(csock, exp)) {

            return -EINVAL;

    /* Finish with a NBD_REP_ACK. */

    return nbd_send_rep(csock, NBD_REP_ACK, NBD_OPT_LIST);


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

     if (!kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) {

+        /* nothing to do */
+
+        return 0;
+
+    }

static int kvm_s390_io_adapter_map(S390FLICState *fs, uint32_t id,

                                   uint64_t map_addr, bool do_map)

{

    struct kvm_s390_io_adapter_req req = {

        .id = id,

        .type = do_map ? KVM_S390_IO_ADAPTER_MAP : KVM_S390_IO_ADAPTER_UNMAP,

        .addr = map_addr,

    };

    struct kvm_device_attr attr = {

        .group = KVM_DEV_FLIC_ADAPTER_MODIFY,

        .addr = (uint64_t)&req,

    };

    KVMS390FLICState *flic = KVM_S390_FLIC(fs);

    int r;

    if (!kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) {

        /* nothing to do */

        return 0;

    }

    r = ioctl(flic->fd, KVM_SET_DEVICE_ATTR, &attr);

    return r ? -errno : 0;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     VqaContext *s = avctx->priv_data;

+
+    av_free(s->codebook);
+
+    av_free(s->next_codebook_buffer);
+
     av_free(s->decode_buffer);

static av_cold int vqa_decode_end(AVCodecContext *avctx)

{

    VqaContext *s = avctx->priv_data;

    av_free(s->codebook);

    av_free(s->next_codebook_buffer);

    av_free(s->decode_buffer);

    if (s->frame.data[0])

        avctx->release_buffer(avctx, &s->frame);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
                 int size = 16 >> i;

                 for (j = 0; j < 16; j++)
+
+                    if (check_func(tab[i][j], "%s_h264_qpel_%d_mc%d%d_%d", op_name, size, j & 3, j >> 2, bit_depth)) {
+
+                        randomize_buffers();
+
                         call_ref(dst0, src0, (ptrdiff_t)size * SIZEOF_PIXEL);

                         call_new(dst1, src1, (ptrdiff_t)size * SIZEOF_PIXEL);

void checkasm_check_h264qpel(void)

{

    LOCAL_ALIGNED_16(uint8_t, buf0, [BUF_SIZE]);

    LOCAL_ALIGNED_16(uint8_t, buf1, [BUF_SIZE]);

    LOCAL_ALIGNED_16(uint8_t, dst0, [BUF_SIZE]);

    LOCAL_ALIGNED_16(uint8_t, dst1, [BUF_SIZE]);

    H264QpelContext h;

    int op, bit_depth, i, j;

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

        qpel_mc_func (*tab)[16] = op ? h.avg_h264_qpel_pixels_tab : h.put_h264_qpel_pixels_tab;

        const char *op_name = op ? "avg" : "put";

        for (bit_depth = 8; bit_depth <= 10; bit_depth++) {

            ff_h264qpel_init(&h, bit_depth);

            for (i = 0; i < (op ? 3 : 4); i++) {

                int size = 16 >> i;

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

                    if (check_func(tab[i][j], "%s_h264_qpel_%d_mc%d%d_%d", op_name, size, j & 3, j >> 2, bit_depth)) {

                        randomize_buffers();

                        call_ref(dst0, src0, (ptrdiff_t)size * SIZEOF_PIXEL);

                        call_new(dst1, src1, (ptrdiff_t)size * SIZEOF_PIXEL);

                        if (memcmp(buf0, buf1, BUF_SIZE) || memcmp(dst0, dst1, BUF_SIZE))

                            fail();

                        bench_new(dst1, src1, (ptrdiff_t)size * SIZEOF_PIXEL);

                    }

            }

        }

        report("%s", op_name);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+int ff_h264_check_intra_pred_mode(H264Context *h, int mode){

     MpegEncContext * const s = &h->s;

int ff_h264_check_intra_pred_mode(H264Context *h, int mode){

    MpegEncContext * const s = &h->s;

    static const int8_t top [7]= {LEFT_DC_PRED8x8, 1,-1,-1};

    static const int8_t left[7]= { TOP_DC_PRED8x8,-1, 2,-1,DC_128_PRED8x8};

    if(mode > 6U) {

        av_log(h->s.avctx, AV_LOG_ERROR, "out of range intra chroma pred mode at %d %d\n", s->mb_x, s->mb_y);

        return -1;

    }

    if(!(h->top_samples_available&0x8000)){

        mode= top[ mode ];

        if(mode<0){

            av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);

            return -1;

        }

    }

    if((h->left_samples_available&0x8080) != 0x8080){

        mode= left[ mode ];

        if(h->left_samples_available&0x8080){ //mad cow disease mode, aka MBAFF + constrained_intra_pred

            mode= ALZHEIMER_DC_L0T_PRED8x8 + (!(h->left_samples_available&0x8000)) + 2*(mode == DC_128_PRED8x8);

        }

        if(mode<0){

            av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);

            return -1;

        }

    }

    return mode;

}


--- a/source.c
+++ b/source.c
@@ -20,7 +20,7 @@
         len = strlen(se->idstr);
         qemu_put_byte(f, len);
         qemu_put_buffer(f, (uint8_t *)se->idstr, len);
+        qemu_put_be32(f, se->instance_id);
         qemu_put_be32(f, se->version_id);
         vmstate_save(f, se);
     }

int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f)
{
    SaveStateEntry *se;
    QTAILQ_FOREACH(se, &savevm_handlers, entry) {
        if (se->save_live_state == NULL)
            continue;
        /* Section type */
        qemu_put_byte(f, QEMU_VM_SECTION_END);
        qemu_put_be32(f, se->section_id);
        se->save_live_state(mon, f, QEMU_VM_SECTION_END, se->opaque);
    }
    QTAILQ_FOREACH(se, &savevm_handlers, entry) {
        int len;
	if (se->save_state == NULL && se->vmsd == NULL)
	    continue;
        /* Section type */
        qemu_put_byte(f, QEMU_VM_SECTION_FULL);
        qemu_put_be32(f, se->section_id);
        /* ID string */
        len = strlen(se->idstr);
        qemu_put_byte(f, len);
        qemu_put_buffer(f, (uint8_t *)se->idstr, len);
        qemu_put_be32(f, se->instance_id);
        qemu_put_be32(f, se->version_id);
        vmstate_save(f, se);
    }
    qemu_put_byte(f, QEMU_VM_EOF);
    if (qemu_file_has_error(f))
        return -EIO;
    return 0;
}


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

     /* setup pci memory mapping */

+    pc_pci_as_mapping_init(OBJECT(mch), mch->system_memory,

                            mch->pci_address_space);

static void mch_realize(PCIDevice *d, Error **errp)

{

    int i;

    MCHPCIState *mch = MCH_PCI_DEVICE(d);

    /* setup pci memory mapping */

    pc_pci_as_mapping_init(OBJECT(mch), mch->system_memory,

                           mch->pci_address_space);

    /* smram */

    cpu_smm_register(&mch_set_smm, mch);

    memory_region_init_alias(&mch->smram_region, OBJECT(mch), "smram-region",

                             mch->pci_address_space, 0xa0000, 0x20000);

    memory_region_add_subregion_overlap(mch->system_memory, 0xa0000,

                                        &mch->smram_region, 1);

    memory_region_set_enabled(&mch->smram_region, false);

    init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory,

             mch->pci_address_space, &mch->pam_regions[0],

             PAM_BIOS_BASE, PAM_BIOS_SIZE);

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

        init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory,

                 mch->pci_address_space, &mch->pam_regions[i+1],

                 PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE);

    }

    /* Intel IOMMU (VT-d) */

    if (qemu_opt_get_bool(qemu_get_machine_opts(), "iommu", false)) {

        mch_init_dmar(mch);

    }

}


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

     r = sclp_service_call(sccb, code);
+
+    if (r < 0) {
+
+        enter_pgmcheck(cpu, -r);
+
     }

     setcc(cpu, r);

static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,

                                 uint16_t ipbh0)

{

    CPUS390XState *env = &cpu->env;

    uint32_t sccb;

    uint64_t code;

    int r = 0;

    cpu_synchronize_state(CPU(cpu));

    if (env->psw.mask & PSW_MASK_PSTATE) {

        enter_pgmcheck(cpu, PGM_PRIVILEGED);

        return 0;

    }

    sccb = env->regs[ipbh0 & 0xf];

    code = env->regs[(ipbh0 & 0xf0) >> 4];

    r = sclp_service_call(sccb, code);

    if (r < 0) {

        enter_pgmcheck(cpu, -r);

    }

    setcc(cpu, r);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static int bdrv_has_snapshot(BlockDriverState *bs)
+
 {

     return (bs &&

static int bdrv_has_snapshot(BlockDriverState *bs)

{

    return (bs &&

            !bdrv_is_removable(bs) &&

            !bdrv_is_read_only(bs));

}


static void print_sdp(void)

{

    char sdp[16384];

    int i;

    AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files);

    if (!avc)

        exit(1);

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

        avc[i] = output_files[i]->ctx;

    av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp));

    printf("SDP:\n%s\n", sdp);

    fflush(stdout);

    av_freep(&avc);

}