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

     t2 = tsub(t2, ctx->t1);

+    print_report("wrote", &t2, ctx->offset, ctx->qiov.size,
+
+                 ctx->qiov.size, 1, ctx->Cflag);
+
+out:

     qemu_io_free(ctx->buf);

static void aio_write_done(void *opaque, int ret)

{

    struct aio_ctx *ctx = opaque;

    struct timeval t2;

    gettimeofday(&t2, NULL);

    if (ret < 0) {

        printf("aio_write failed: %s\n", strerror(-ret));

        goto out;

    }

    if (ctx->qflag) {

        goto out;

    }

    /* Finally, report back -- -C gives a parsable format */

    t2 = tsub(t2, ctx->t1);

    print_report("wrote", &t2, ctx->offset, ctx->qiov.size,

                 ctx->qiov.size, 1, ctx->Cflag);

out:

    qemu_io_free(ctx->buf);

    g_free(ctx);

}


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

     s->dpll = clk;
+
+    omap_dpll_reset(s);
+
+
+
     memory_region_add_subregion(memory, base, &s->iomem);

     return s;

static struct dpll_ctl_s  *omap_dpll_init(MemoryRegion *memory,

                           target_phys_addr_t base, omap_clk clk)

{

    struct dpll_ctl_s *s = g_malloc0(sizeof(*s));

    memory_region_init_io(&s->iomem, &omap_dpll_ops, s, "omap-dpll", 0x100);

    s->dpll = clk;

    omap_dpll_reset(s);

    memory_region_add_subregion(memory, base, &s->iomem);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void pcie_aer_root_init(PCIDevice *dev)

+{
+
+    uint16_t pos = dev->exp.aer_cap;
+
+

     pci_set_long(dev->wmask + pos + PCI_ERR_ROOT_COMMAND,

void pcie_aer_root_init(PCIDevice *dev)

{

    uint16_t pos = dev->exp.aer_cap;

    pci_set_long(dev->wmask + pos + PCI_ERR_ROOT_COMMAND,

                 PCI_ERR_ROOT_CMD_EN_MASK);

    pci_set_long(dev->w1cmask + pos + PCI_ERR_ROOT_STATUS,

                 PCI_ERR_ROOT_STATUS_REPORT_MASK);

}


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

+
+    virtio_net_set_multiqueue(n, !!(features & (1 << VIRTIO_NET_F_MQ)),
+
+                              !!(features & (1 << VIRTIO_NET_F_CTRL_VQ)));
+

     virtio_net_set_mrg_rx_bufs(n, !!(features & (1 << VIRTIO_NET_F_MRG_RXBUF)));

static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features)

{

    VirtIONet *n = VIRTIO_NET(vdev);

    int i;

    virtio_net_set_multiqueue(n, !!(features & (1 << VIRTIO_NET_F_MQ)),

                              !!(features & (1 << VIRTIO_NET_F_CTRL_VQ)));

    virtio_net_set_mrg_rx_bufs(n, !!(features & (1 << VIRTIO_NET_F_MRG_RXBUF)));

    if (n->has_vnet_hdr) {

        tap_set_offload(qemu_get_subqueue(n->nic, 0)->peer,

                        (features >> VIRTIO_NET_F_GUEST_CSUM) & 1,

                        (features >> VIRTIO_NET_F_GUEST_TSO4) & 1,

                        (features >> VIRTIO_NET_F_GUEST_TSO6) & 1,

                        (features >> VIRTIO_NET_F_GUEST_ECN)  & 1,

                        (features >> VIRTIO_NET_F_GUEST_UFO)  & 1);

    }

    for (i = 0;  i < n->max_queues; i++) {

        NetClientState *nc = qemu_get_subqueue(n->nic, i);

        if (!nc->peer || nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) {

            continue;

        }

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

            continue;

        }

        vhost_net_ack_features(tap_get_vhost_net(nc->peer), features);

    }

}


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

 {

+    char *p = dst;

     char *end = dst+dstlen-1;

static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len,

                               char *dst, int dstlen)

{

    char *p = dst;

    char *end = dst+dstlen-1;

    int i;

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

        uint8_t t, c = avio_r8(pb);

        if (c < 0x80 && p < end)

            *p++ = c;

        else

            PUT_UTF8(mac_to_unicode[c-0x80], t, if (p < end) *p++ = t;);

    }

    *p = 0;

    return p - dst;

}


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

 {

+    FeatureWordInfo *f = &feature_word_info[w];

     int i;

static void report_unavailable_features(FeatureWord w, uint32_t mask)

{

    FeatureWordInfo *f = &feature_word_info[w];

    int i;

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

        if (1 << i & mask) {

            const char *reg = get_register_name_32(f->cpuid_reg);

            assert(reg);

            fprintf(stderr, "warning: %s doesn't support requested feature: "

                "CPUID.%02XH:%s%s%s [bit %d]\n",

                kvm_enabled() ? "host" : "TCG",

                f->cpuid_eax, reg,

                f->feat_names[i] ? "." : "",

                f->feat_names[i] ? f->feat_names[i] : "", i);

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     if (local_err) {

         goto out;
+
+    }
+
+    /* change bootindex to a new one */
+
     d->conf.bootindex = boot_index;

static void ide_dev_set_bootindex(Object *obj, Visitor *v, const char *name,

                                  void *opaque, Error **errp)

{

    IDEDevice *d = IDE_DEVICE(obj);

    int32_t boot_index;

    Error *local_err = NULL;

    visit_type_int32(v, name, &boot_index, &local_err);

    if (local_err) {

        goto out;

    }

    /* check whether bootindex is present in fw_boot_order list  */

    check_boot_index(boot_index, &local_err);

    if (local_err) {

        goto out;

    }

    /* change bootindex to a new one */

    d->conf.bootindex = boot_index;

    if (d->unit != -1) {

        add_boot_device_path(d->conf.bootindex, &d->qdev,

                             d->unit ? "/disk@1" : "/disk@0");

    }

out:

    if (local_err) {

        error_propagate(errp, local_err);

    }

}


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

     qmp_output_add(qov, name, dict);
+
+    qmp_output_push(qov, dict, obj);
+
+}

static void qmp_output_start_struct(Visitor *v, const char *name, void **obj,

                                    size_t unused, Error **errp)

{

    QmpOutputVisitor *qov = to_qov(v);

    QDict *dict = qdict_new();

    qmp_output_add(qov, name, dict);

    qmp_output_push(qov, dict, obj);

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
+static int vnc_set_x509_credential(VncDisplay *vd,
+
+                                   const char *certdir,
+
+                                   const char *filename,
+
+                                   char **cred,
+
+                                   int ignoreMissing)
+
+{
+
+    struct stat sb;

+

     g_free(*cred);

static int vnc_set_x509_credential(VncDisplay *vd,

                                   const char *certdir,

                                   const char *filename,

                                   char **cred,

                                   int ignoreMissing)

{

    struct stat sb;

    g_free(*cred);

    *cred = g_malloc(strlen(certdir) + strlen(filename) + 2);

    strcpy(*cred, certdir);

    strcat(*cred, "/");

    strcat(*cred, filename);

    VNC_DEBUG("Check %s\n", *cred);

    if (stat(*cred, &sb) < 0) {

        g_free(*cred);

        *cred = NULL;

        if (ignoreMissing && errno == ENOENT)

            return 0;

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void aio_notify(AioContext *ctx)

+{

     /* Write e.g. bh->scheduled before reading ctx->dispatching.  */

void aio_notify(AioContext *ctx)

{

    /* Write e.g. bh->scheduled before reading ctx->dispatching.  */

    smp_mb();

    if (!ctx->dispatching) {

        event_notifier_set(&ctx->notifier);

    }

}


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

 {

+    h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0);

 }

static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)

{

    h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0);

}


int s390_cpu_restart(S390CPU *cpu)

{

    if (kvm_enabled()) {

        return kvm_s390_cpu_restart(cpu);

    }

    return -ENOSYS;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void test_parse_path_subprocess(void)
+
+{
+
     /* All these should work without issue */

     qemu_set_log_filename("/tmp/qemu.log");

static void test_parse_path_subprocess(void)

{

    /* All these should work without issue */

    qemu_set_log_filename("/tmp/qemu.log");

    qemu_set_log_filename("/tmp/qemu-%d.log");

    qemu_set_log_filename("/tmp/qemu.log.%d");

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp)
+
+{

+    if (!error_is_set(errp)) {

         return v->next_list(v, list, errp);

GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp)

{

    if (!error_is_set(errp)) {

        return v->next_list(v, list, errp);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static uint64_t watch_mem_read(void *opaque, target_phys_addr_t addr,
+
+                               unsigned size)
+
+{
+
     check_watchpoint(addr & ~TARGET_PAGE_MASK, ~(size - 1), BP_MEM_READ);

     switch (size) {

static uint64_t watch_mem_read(void *opaque, target_phys_addr_t addr,

                               unsigned size)

{

    check_watchpoint(addr & ~TARGET_PAGE_MASK, ~(size - 1), BP_MEM_READ);

    switch (size) {

    case 1: return ldub_phys(addr);

    case 2: return lduw_phys(addr);

    case 4: return ldl_phys(addr);

    default: abort();

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static off_t read_uint32(BlockDriverState *bs, int64_t offset)
+
+{
+
 	uint32_t buffer;

 	if (bdrv_pread(bs->file, offset, &buffer, 4) < 4)

static off_t read_uint32(BlockDriverState *bs, int64_t offset)

{

	uint32_t buffer;

	if (bdrv_pread(bs->file, offset, &buffer, 4) < 4)

		return 0;

	return be32_to_cpu(buffer);

}


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

     }

+    is_none_mode = mode == MIRROR_SYNC_MODE_NONE;
+
+    base = mode == MIRROR_SYNC_MODE_TOP ? backing_bs(bs) : NULL;
+
+    mirror_start_job(job_id, bs, target, replaces,

                      speed, granularity, buf_size, backing_mode,

void mirror_start(const char *job_id, BlockDriverState *bs,

                  BlockDriverState *target, const char *replaces,

                  int64_t speed, uint32_t granularity, int64_t buf_size,

                  MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,

                  BlockdevOnError on_source_error,

                  BlockdevOnError on_target_error,

                  bool unmap,

                  BlockCompletionFunc *cb,

                  void *opaque, Error **errp)

{

    bool is_none_mode;

    BlockDriverState *base;

    if (mode == MIRROR_SYNC_MODE_INCREMENTAL) {

        error_setg(errp, "Sync mode 'incremental' not supported");

        return;

    }

    is_none_mode = mode == MIRROR_SYNC_MODE_NONE;

    base = mode == MIRROR_SYNC_MODE_TOP ? backing_bs(bs) : NULL;

    mirror_start_job(job_id, bs, target, replaces,

                     speed, granularity, buf_size, backing_mode,

                     on_source_error, on_target_error, unmap, cb, opaque, errp,

                     &mirror_job_driver, is_none_mode, base);

}


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

+{

     Coroutine *co = opaque;

static void coroutine_enter_cb(void *opaque, int ret)

{

    Coroutine *co = opaque;

    qemu_coroutine_enter(co, NULL);

}


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

     int64_t end;
+
+    int hh1, mm1, ss1, ms1;

     int hh2, mm2, ss2, ms2;

static int read_ts(const char *s, int64_t *start, int *duration)

{

    int64_t end;

    int hh1, mm1, ss1, ms1;

    int hh2, mm2, ss2, ms2;

    if (sscanf(s, "%u:%u:%u.%u,%u:%u:%u.%u",

               &hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2) == 8) {

        end    = (hh2*3600 + mm2*60 + ss2) * 100 + ms2;

        *start = (hh1*3600 + mm1*60 + ss1) * 100 + ms1;

        *duration = end - *start;

        return 0;

    }

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void build_fadt(GArray *table_data, BIOSLinker *linker,

                        VirtMachineState *vms, unsigned dsdt_tbl_offset)
+
+{
+
+    AcpiFadtDescriptorRev5_1 *fadt = acpi_data_push(table_data, sizeof(*fadt));
+
     unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;

     uint16_t bootflags;

static void build_fadt(GArray *table_data, BIOSLinker *linker,

                       VirtMachineState *vms, unsigned dsdt_tbl_offset)

{

    AcpiFadtDescriptorRev5_1 *fadt = acpi_data_push(table_data, sizeof(*fadt));

    unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;

    uint16_t bootflags;

    switch (vms->psci_conduit) {

    case QEMU_PSCI_CONDUIT_DISABLED:

        bootflags = 0;

        break;

    case QEMU_PSCI_CONDUIT_HVC:

        bootflags = ACPI_FADT_ARM_PSCI_COMPLIANT | ACPI_FADT_ARM_PSCI_USE_HVC;

        break;

    case QEMU_PSCI_CONDUIT_SMC:

        bootflags = ACPI_FADT_ARM_PSCI_COMPLIANT;

        break;

    default:

        g_assert_not_reached();

    }

    /* Hardware Reduced = 1 and use PSCI 0.2+ */

    fadt->flags = cpu_to_le32(1 << ACPI_FADT_F_HW_REDUCED_ACPI);

    fadt->arm_boot_flags = cpu_to_le16(bootflags);

    /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */

    fadt->minor_revision = 0x1;

    /* DSDT address to be filled by Guest linker */

    bios_linker_loader_add_pointer(linker,

        ACPI_BUILD_TABLE_FILE, dsdt_entry_offset, sizeof(fadt->dsdt),

        ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset);

    build_header(linker, table_data,

                 (void *)fadt, "FACP", sizeof(*fadt), 5, NULL, NULL);

}


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

     rom_size += rom_paddr & ~TARGET_PAGE_MASK;

+    rom_paddr &= TARGET_PAGE_MASK;
+
+    rom_size = TARGET_PAGE_ALIGN(rom_size);
+
+

     memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr,

static void vapic_map_rom_writable(VAPICROMState *s)

{

    target_phys_addr_t rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK;

    MemoryRegionSection section;

    MemoryRegion *as;

    size_t rom_size;

    uint8_t *ram;

    as = sysbus_address_space(&s->busdev);

    if (s->rom_mapped_writable) {

        memory_region_del_subregion(as, &s->rom);

        memory_region_destroy(&s->rom);

    }

    /* grab RAM memory region (region @rom_paddr may still be pc.rom) */

    section = memory_region_find(as, 0, 1);

    /* read ROM size from RAM region */

    ram = memory_region_get_ram_ptr(section.mr);

    rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;

    s->rom_size = rom_size;

    /* We need to round to avoid creating subpages

     * from which we cannot run code. */

    rom_size += rom_paddr & ~TARGET_PAGE_MASK;

    rom_paddr &= TARGET_PAGE_MASK;

    rom_size = TARGET_PAGE_ALIGN(rom_size);

    memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr,

                             rom_size);

    memory_region_add_subregion_overlap(as, rom_paddr, &s->rom, 1000);

    s->rom_mapped_writable = true;

}


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

 {

+    s->aio_context = new_context;
+
+    s->completion_bh = aio_bh_new(new_context, qemu_laio_completion_bh, s);

     aio_set_event_notifier(new_context, &s->e, false,

void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context)

{

    s->aio_context = new_context;

    s->completion_bh = aio_bh_new(new_context, qemu_laio_completion_bh, s);

    aio_set_event_notifier(new_context, &s->e, false,

                           qemu_laio_completion_cb, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void virtio_queue_notify(VirtIODevice *vdev, int n)
+
+{

     if (n < VIRTIO_PCI_QUEUE_MAX) {

void virtio_queue_notify(VirtIODevice *vdev, int n)

{

    if (n < VIRTIO_PCI_QUEUE_MAX) {

        virtio_queue_notify_vq(&vdev->vq[n]);

    }

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
                         start >> hb->granularity, last >> hb->granularity);

+
+    start >>= hb->granularity;
+
+    last >>= hb->granularity;
+

void hbitmap_reset(HBitmap *hb, uint64_t start, uint64_t count)

{

    /* Compute range in the last layer.  */

    uint64_t last = start + count - 1;

    trace_hbitmap_reset(hb, start, count,

                        start >> hb->granularity, last >> hb->granularity);

    start >>= hb->granularity;

    last >>= hb->granularity;

    hb->count -= hb_count_between(hb, start, last);

    hb_reset_between(hb, HBITMAP_LEVELS - 1, start, last);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int kvm_arm_sync_mpstate_to_kvm(ARMCPU *cpu)

 {
+
     if (cap_has_mp_state) {

         struct kvm_mp_state mp_state = {

int kvm_arm_sync_mpstate_to_kvm(ARMCPU *cpu)

{

    if (cap_has_mp_state) {

        struct kvm_mp_state mp_state = {

            .mp_state =

            cpu->powered_off ? KVM_MP_STATE_STOPPED : KVM_MP_STATE_RUNNABLE

        };

        int ret = kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MP_STATE, &mp_state);

        if (ret) {

            fprintf(stderr, "%s: failed to set MP_STATE %d/%s\n",

                    __func__, ret, strerror(-ret));

            return -1;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static uint32_t scsi_init_iovec(SCSIDiskReq *r, size_t size)

+{
+
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
+
+

     if (!r->iov.iov_base) {

static uint32_t scsi_init_iovec(SCSIDiskReq *r, size_t size)

{

    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);

    if (!r->iov.iov_base) {

        r->buflen = size;

        r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->buflen);

    }

    r->iov.iov_len = MIN(r->sector_count * 512, r->buflen);

    qemu_iovec_init_external(&r->qiov, &r->iov, 1);

    return r->qiov.size / 512;

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h){
+
+	int x,y;
+
+	uint64_t ssd=0;
+
+

 //printf("%d %d\n", w, h);
+

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

static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h){

	int x,y;

	uint64_t ssd=0;

//printf("%d %d\n", w, h);

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

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

			int d= src1[x + y*stride1] - src2[x + y*stride2];

			ssd+= d*d;

//printf("%d", abs(src1[x + y*stride1] - src2[x + y*stride2])/26 );

		}

//printf("\n");

	}

	return ssd;

}


--- a/source.c
+++ b/source.c
@@ -3,6 +3,6 @@
     if (!kbd_timer) {
         kbd_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, qemu_input_queue_process,
                                  &kbd_queue);
+    if (queue_count < queue_limit) {
+        qemu_input_queue_delay(&kbd_queue, kbd_timer,
                                delay_ms ? delay_ms : kbd_default_delay_ms);

void qemu_input_event_send_key_delay(uint32_t delay_ms)
{
    if (!kbd_timer) {
        kbd_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, qemu_input_queue_process,
                                 &kbd_queue);
    if (queue_count < queue_limit) {
        qemu_input_queue_delay(&kbd_queue, kbd_timer,
                               delay_ms ? delay_ms : kbd_default_delay_ms);


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num)

+{
+
+    uint64_t r;
+
+

     switch (num) {

void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num)

{

    uint64_t r;

    switch (num) {

    case 0x500:

        /* KVM hypercall */

        qemu_mutex_lock_iothread();

        r = s390_virtio_hypercall(env);

        qemu_mutex_unlock_iothread();

        break;

    case 0x44:

        /* yield */

        r = 0;

        break;

    case 0x308:

        /* ipl */

        handle_diag_308(env, r1, r3);

        r = 0;

        break;

    default:

        r = -1;

        break;

    }

    if (r) {

        program_interrupt(env, PGM_OPERATION, ILEN_LATER_INC);

    }

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
     int is_alpha = (inlink == ctx->inputs[1]);

     struct FFBufQueue *queue =
+
         (is_alpha ? &merge->queue_alpha : &merge->queue_main);

     ff_bufqueue_add(ctx, queue, buf);

static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf)

{

    AVFilterContext *ctx = inlink->dst;

    AlphaMergeContext *merge = ctx->priv;

    int is_alpha = (inlink == ctx->inputs[1]);

    struct FFBufQueue *queue =

        (is_alpha ? &merge->queue_alpha : &merge->queue_main);

    ff_bufqueue_add(ctx, queue, buf);

    while (1) {

        AVFilterBufferRef *main_buf, *alpha_buf;

        if (!ff_bufqueue_peek(&merge->queue_main, 0) ||

            !ff_bufqueue_peek(&merge->queue_alpha, 0)) break;

        main_buf = ff_bufqueue_get(&merge->queue_main);

        alpha_buf = ff_bufqueue_get(&merge->queue_alpha);

        merge->frame_requested = 0;

        draw_frame(ctx, main_buf, alpha_buf);

        ff_filter_frame(ctx->outputs[0], avfilter_ref_buffer(main_buf, ~0));

        avfilter_unref_buffer(alpha_buf);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf)

 {
+
     int rc;

int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf)

{

    int rc;

    cmd->lba = -1;

    cmd->len = scsi_cdb_length(buf);

    switch (dev->type) {

    case TYPE_TAPE:

        rc = scsi_req_stream_xfer(cmd, dev, buf);

        break;

    case TYPE_MEDIUM_CHANGER:

        rc = scsi_req_medium_changer_xfer(cmd, dev, buf);

        break;

    default:

        rc = scsi_req_xfer(cmd, dev, buf);

        break;

    }

    if (rc != 0)

        return rc;

    memcpy(cmd->buf, buf, cmd->len);

    scsi_cmd_xfer_mode(cmd);

    cmd->lba = scsi_cmd_lba(cmd);

    return 0;

}


static void gif_put_bits_rev(PutBitContext *s, int n, unsigned int value)

{

    unsigned int bit_buf;

    int bit_cnt;

    //    printf("put_bits=%d %x\n", n, value);

    assert(n == 32 || value < (1U << n));

    bit_buf = s->bit_buf;

    bit_cnt = 32 - s->bit_left; /* XXX:lazyness... was = s->bit_cnt; */

    //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

    /* XXX: optimize */

    if (n < (32-bit_cnt)) {

        bit_buf |= value << (bit_cnt);

        bit_cnt+=n;

    } else {

        bit_buf |= value << (bit_cnt);

        *s->buf_ptr = bit_buf & 0xff;

        s->buf_ptr[1] = (bit_buf >> 8) & 0xff;

        s->buf_ptr[2] = (bit_buf >> 16) & 0xff;

        s->buf_ptr[3] = (bit_buf >> 24) & 0xff;

        //printf("bitbuf = %08x\n", bit_buf);

        s->buf_ptr+=4;

        if (s->buf_ptr >= s->buf_end)

            puts("bit buffer overflow !!"); // should never happen ! who got rid of the callback ???

//            flush_buffer_rev(s);

        bit_cnt=bit_cnt + n - 32;

        if (bit_cnt == 0) {

            bit_buf = 0;

        } else {

            bit_buf = value >> (n - bit_cnt);

        }

    }

    s->bit_buf = bit_buf;

    s->bit_left = 32 - bit_cnt;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int v9fs_synth_truncate(FsContext *ctx, V9fsPath *path, off_t offset)

+{
+
     errno = ENOSYS;

     return -1;

static int v9fs_synth_truncate(FsContext *ctx, V9fsPath *path, off_t offset)

{

    errno = ENOSYS;

    return -1;

}


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

     cpu = x86_env_get_cpu(env);
+
+    cs = CPU(cpu);
+
+    /* XXX: not complete but not completely erroneous */
+
     if (cs->cpu_index != 0 || CPU_NEXT(cs) != NULL) {

         /* more than one CPU: do not sleep because another CPU may

void helper_mwait(CPUX86State *env, int next_eip_addend)

{

    CPUState *cs;

    X86CPU *cpu;

    if ((uint32_t)env->regs[R_ECX] != 0) {

        raise_exception(env, EXCP0D_GPF);

    }

    cpu_svm_check_intercept_param(env, SVM_EXIT_MWAIT, 0);

    env->eip += next_eip_addend;

    cpu = x86_env_get_cpu(env);

    cs = CPU(cpu);

    /* XXX: not complete but not completely erroneous */

    if (cs->cpu_index != 0 || CPU_NEXT(cs) != NULL) {

        /* more than one CPU: do not sleep because another CPU may

           wake this one */

    } else {

        do_hlt(cpu);

    }

}


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

     /* See the comments in nvdimm_dsm_root(). */

+    if (!in->function) {
+
+        nvdimm_dsm_function0(0 /* No function supported other than
+
+                                  function 0 */, dsm_mem_addr);

         return;

static void nvdimm_dsm_device(NvdimmDsmIn *in, hwaddr dsm_mem_addr)

{

    /* See the comments in nvdimm_dsm_root(). */

    if (!in->function) {

        nvdimm_dsm_function0(0 /* No function supported other than

                                  function 0 */, dsm_mem_addr);

        return;

    }

    /* No function except function 0 is supported yet. */

    nvdimm_dsm_no_payload(1 /* Not Supported */, dsm_mem_addr);

}


static void virtio_blk_dma_restart_cb(void *opaque, int running,

                                      RunState state)

{

    VirtIOBlock *s = opaque;

    if (!running) {

        return;

    }

    if (!s->bh) {

        s->bh = qemu_bh_new(virtio_blk_dma_restart_bh, s);

        qemu_bh_schedule(s->bh);

    }

}


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

 {

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

{

    MXFPackage *package = arg;

    switch(tag) {

    case 0x4403:

        package->tracks_count = avio_rb32(pb);

        if (package->tracks_count >= UINT_MAX / sizeof(UID))

            return -1;

        package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));

        if (!package->tracks_refs)

            return -1;

        avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */

        avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));

        break;

    case 0x4401:

        /* UMID, only get last 16 bytes */

        avio_skip(pb, 16);

        avio_read(pb, package->package_uid, 16);

        break;

    case 0x4701:

        avio_read(pb, package->descriptor_ref, 16);

        break;

    }

    return 0;

}


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

+
+    again1:
+
+        len = write(daemon_pipe, &status, 1);
+
         if (len == -1 && (errno == EINTR)) {

             goto again1;

void os_setup_post(void)

{

    int fd = 0;

    if (daemonize) {

        uint8_t status = 0;

        ssize_t len;

    again1:

        len = write(daemon_pipe, &status, 1);

        if (len == -1 && (errno == EINTR)) {

            goto again1;

        }

        if (len != 1) {

            exit(1);

        }

        if (chdir("/")) {

            perror("not able to chdir to /");

            exit(1);

        }

        TFR(fd = qemu_open("/dev/null", O_RDWR));

        if (fd == -1) {

            exit(1);

        }

    }

    change_root();

    change_process_uid();

    if (daemonize) {

        dup2(fd, 0);

        dup2(fd, 1);

        dup2(fd, 2);

        close(fd);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void libschroedinger_free_frame(void *data)
+
+{
+
     FFSchroEncodedFrame *enc_frame = data;

static void libschroedinger_free_frame(void *data)

{

    FFSchroEncodedFrame *enc_frame = data;

    av_freep(&enc_frame->p_encbuf);

    av_free(enc_frame);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void pcnet_common_init(PCNetState *d, NICInfo *nd)

 {

+    d->poll_timer = qemu_new_timer(vm_clock, pcnet_poll_timer, d);

static void pcnet_common_init(PCNetState *d, NICInfo *nd)

{

    d->poll_timer = qemu_new_timer(vm_clock, pcnet_poll_timer, d);

    d->nd = nd;

    if (nd && nd->vlan) {

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

                                     pcnet_receive, pcnet_can_receive, d);

        qemu_format_nic_info_str(d->vc, d->nd->macaddr);

    } else {

        d->vc = NULL;

    }

    pcnet_h_reset(d);

    register_savevm("pcnet", -1, 2, pcnet_save, pcnet_load, d);

}


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

+    if (xen_enabled()) {
+
+        *ram_addr = xen_ram_addr_from_mapcache(ptr);
+
+        return 0;

     }

int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr)

{

    RAMBlock *block;

    uint8_t *host = ptr;

    if (xen_enabled()) {

        *ram_addr = xen_ram_addr_from_mapcache(ptr);

        return 0;

    }

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

        /* This case append when the block is not mapped. */

        if (block->host == NULL) {

            continue;

        }

        if (host - block->host < block->length) {

            *ram_addr = block->offset + (host - block->host);

            return 0;

        }

    }

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -13,7 +13,7 @@
     for (i = 0; i < book->nentries; i++) {

         float * vec = book->dimentions + i * book->ndimentions, d = book->pow2[i];
+
         int j;

         if (!book->lens[i])

static float *put_vector(vorbis_enc_codebook *book, PutBitContext *pb,

                         float *num)

{

    int i, entry = -1;

    float distance = FLT_MAX;

    assert(book->dimentions);

    for (i = 0; i < book->nentries; i++) {

        float * vec = book->dimentions + i * book->ndimentions, d = book->pow2[i];

        int j;

        if (!book->lens[i])

            continue;

        for (j = 0; j < book->ndimentions; j++)

            d -= vec[j] * num[j];

        if (distance > d) {

            entry    = i;

            distance = d;

        }

    }

    put_codeword(pb, book, entry);

    return &book->dimentions[entry * book->ndimentions];

}


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

 {

+    avctx->pix_fmt             = PIX_FMT_YUV444P10;
+
     avctx->bits_per_raw_sample = 10;

static av_cold int v410_decode_init(AVCodecContext *avctx)

{

    avctx->pix_fmt             = PIX_FMT_YUV444P10;

    avctx->bits_per_raw_sample = 10;

    if (avctx->width & 1) {

        av_log(avctx, AV_LOG_ERROR, "v410 requires width to be even.\n");

        return AVERROR_INVALIDDATA;

    }

    avctx->coded_frame = avcodec_alloc_frame();

    if (!avctx->coded_frame) {

        av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");

        return AVERROR(ENOMEM);

    }

    return 0;

}


static inline void downmix_dualmono_to_mono(float *samples)

{

    int i;

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

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

        samples[i + 256] = 0;

    }

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
         error_setg(errp, "can't create backend with size 0");

         return;
+
     }

     if (!fb->mem_path) {

file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)

{

    HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(backend);

    if (!backend->size) {

        error_setg(errp, "can't create backend with size 0");

        return;

    }

    if (!fb->mem_path) {

        error_setg(errp, "mem-path property not set");

        return;

    }

#ifndef CONFIG_LINUX

    error_setg(errp, "-mem-path not supported on this host");

#else

    if (!memory_region_size(&backend->mr)) {

        backend->force_prealloc = mem_prealloc;

        memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),

                                 object_get_canonical_path(OBJECT(backend)),

                                 backend->size, fb->share,

                                 fb->mem_path, errp);

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -8,11 +8,11 @@
         if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){
             AVFilterCommand **queue = &filter->command_queue, *next;
             while (*queue && (*queue)->time <= ts)
+                queue = &(*queue)->next;
+            next = *queue;
+            *queue = av_mallocz(sizeof(AVFilterCommand));
+            (*queue)->command = av_strdup(command);
+            (*queue)->arg     = av_strdup(arg);
             (*queue)->time    = ts;
             (*queue)->flags   = flags;
             (*queue)->next    = next;

int avfilter_graph_queue_command(AVFilterGraph *graph, const char *target, const char *command, const char *arg, int flags, double ts)
{
    int i;
    if(!graph)
        return 0;
    for (i = 0; i < graph->nb_filters; i++) {
        AVFilterContext *filter = graph->filters[i];
        if(filter && (!strcmp(target, "all") || !strcmp(target, filter->name) || !strcmp(target, filter->filter->name))){
            AVFilterCommand **queue = &filter->command_queue, *next;
            while (*queue && (*queue)->time <= ts)
                queue = &(*queue)->next;
            next = *queue;
            *queue = av_mallocz(sizeof(AVFilterCommand));
            (*queue)->command = av_strdup(command);
            (*queue)->arg     = av_strdup(arg);
            (*queue)->time    = ts;
            (*queue)->flags   = flags;
            (*queue)->next    = next;
            if(flags & AVFILTER_CMD_FLAG_ONE)
                return 0;
        }
    }
    return 0;
}


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

     if (pkt->duration < 0 || pkt->duration > INT_MAX) {

+        av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration);
+
+        return AVERROR(EINVAL);
+
+    }

     return 0;

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

{

    MOVMuxContext *mov = s->priv_data;

    MOVTrack *trk = &mov->tracks[pkt->stream_index];

    if (trk->entry) {

        int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts;

        if (duration < 0 || duration > INT_MAX) {

            av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n",

                duration, pkt->dts

            );

            pkt->dts = trk->cluster[trk->entry - 1].dts + 1;

            pkt->pts = AV_NOPTS_VALUE;

        }

    } else if (pkt->dts <= INT_MIN || pkt->dts >= INT_MAX) {

            av_log(s, AV_LOG_ERROR, "Application provided initial timestamp: %"PRId64" is out of range for mov/mp4 format\n",

                pkt->dts

            );

            pkt->dts = 0;

            pkt->pts = AV_NOPTS_VALUE;

    }

    if (pkt->duration < 0 || pkt->duration > INT_MAX) {

        av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration);

        return AVERROR(EINVAL);

    }

    return 0;

}


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

     WorkerTestData data = { .n = 0, .ret = -EINPROGRESS };
+
     data.aiocb = thread_pool_submit_aio(pool, worker_cb, &data,

                                         done_cb, &data);

static void test_submit_aio(void)

{

    WorkerTestData data = { .n = 0, .ret = -EINPROGRESS };

    data.aiocb = thread_pool_submit_aio(pool, worker_cb, &data,

                                        done_cb, &data);

    /* The callbacks are not called until after the first wait.  */

    active = 1;

    g_assert_cmpint(data.ret, ==, -EINPROGRESS);

    qemu_aio_wait_all();

    g_assert_cmpint(active, ==, 0);

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

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

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)

 {
+
+    int ret;
+
+
+
     ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);

     if (ret == -1)

static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)

{

    int ret;

    ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);

    if (ret == -1)

        return -errno;

    /*

     * This looks weird, but the aio code only consideres a request

     * successful if it has written the number full number of bytes.

     *

     * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command,

     * so in fact we return the ioctl command here to make posix_aio_read()

     * happy..

     */

    return aiocb->aio_nbytes;

}


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

                                                    sPAPREnvironment *spapr,

+                                                   uint32_t token,

                                                    uint32_t nargs,
+
                                                    target_ulong args,

                                                    uint32_t nret,
+
+                                                   target_ulong rets)
+
+{

     uint32_t config_addr = rtas_ld(args, 0);
+
     uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);

     unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3);

static void rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu,

                                                   sPAPREnvironment *spapr,

                                                   uint32_t token,

                                                   uint32_t nargs,

                                                   target_ulong args,

                                                   uint32_t nret,

                                                   target_ulong rets)

{

    uint32_t config_addr = rtas_ld(args, 0);

    uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);

    unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3);

    int ndev;

    sPAPRPHBState *phb = NULL;

    /* Fins sPAPRPHBState */

    phb = find_phb(spapr, buid);

    if (!phb) {

        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);

        return;

    }

    /* Find device descriptor and start IRQ */

    ndev = spapr_msicfg_find(phb, config_addr, false);

    if (ndev < 0) {

        trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr);

        rtas_st(rets, 0, RTAS_OUT_HW_ERROR);

        return;

    }

    intr_src_num = phb->msi_table[ndev].irq + ioa_intr_num;

    trace_spapr_pci_rtas_ibm_query_interrupt_source_number(ioa_intr_num,

                                                           intr_src_num);

    rtas_st(rets, 0, RTAS_OUT_SUCCESS);

    rtas_st(rets, 1, intr_src_num);

    rtas_st(rets, 2, 1);/* 0 == level; 1 == edge */

}


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

     uint16_t sel_mask, sel_value;

+    uint32_t status;
+
+    int cond;
+
+

     DBDMA_DPRINTF("conditional_interrupt\n");

static void conditional_interrupt(DBDMA_channel *ch)

{

    dbdma_cmd *current = &ch->current;

    uint16_t intr;

    uint16_t sel_mask, sel_value;

    uint32_t status;

    int cond;

    DBDMA_DPRINTF("conditional_interrupt\n");

    intr = le16_to_cpu(current->command) & INTR_MASK;

    switch(intr) {

    case INTR_NEVER:  /* don't interrupt */

        return;

    case INTR_ALWAYS: /* always interrupt */

        qemu_irq_raise(ch->irq);

        return;

    }

    status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;

    sel_mask = (be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) >> 16) & 0x0f;

    sel_value = be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) & 0x0f;

    cond = (status & sel_mask) == (sel_value & sel_mask);

    switch(intr) {

    case INTR_IFSET:  /* intr if condition bit is 1 */

        if (cond)

            qemu_irq_raise(ch->irq);

        return;

    case INTR_IFCLR:  /* intr if condition bit is 0 */

        if (!cond)

            qemu_irq_raise(ch->irq);

        return;

    }

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     PCIBus *bus = d->bus;

+
+    while (!pci_bus_is_root(bus)) {
+
+        d = bus->parent_dev;
+
         assert(d != NULL);

PCIBus *pci_device_root_bus(const PCIDevice *d)

{

    PCIBus *bus = d->bus;

    while (!pci_bus_is_root(bus)) {

        d = bus->parent_dev;

        assert(d != NULL);

        bus = d->bus;

    }

    return bus;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int vtd_remap_irq_get(IntelIOMMUState *iommu, uint16_t index, VTDIrq *irq)
+
 {

     VTD_IRTE irte = { 0 };

static int vtd_remap_irq_get(IntelIOMMUState *iommu, uint16_t index, VTDIrq *irq)

{

    VTD_IRTE irte = { 0 };

    int ret = 0;

    ret = vtd_irte_get(iommu, index, &irte);

    if (ret) {

        return ret;

    }

    irq->trigger_mode = irte.trigger_mode;

    irq->vector = irte.vector;

    irq->delivery_mode = irte.delivery_mode;

    /* Not support EIM yet: please refer to vt-d 9.10 DST bits */

#define  VTD_IR_APIC_DEST_MASK         (0xff00ULL)

#define  VTD_IR_APIC_DEST_SHIFT        (8)

    irq->dest = (le32_to_cpu(irte.dest_id) & VTD_IR_APIC_DEST_MASK) >> \

        VTD_IR_APIC_DEST_SHIFT;

    irq->dest_mode = irte.dest_mode;

    irq->redir_hint = irte.redir_hint;

    VTD_DPRINTF(IR, "remapping interrupt index %d: trig:%u,vec:%u,"

                "deliver:%u,dest:%u,dest_mode:%u", index,

                irq->trigger_mode, irq->vector, irq->delivery_mode,

                irq->dest, irq->dest_mode);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -34,11 +34,11 @@
             s->output = DCA_STEREO;
             avctx->channel_layout = CH_LAYOUT_STEREO;
         }
+    } else {
+        av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode);
+    }
+    /* There is nothing that prevents a dts frame to change channel configuration
+       but FFmpeg doesn't support that so only set the channels if it is previously
        unset. Ideally during the first probe for channels the crc should be checked
        and only set avctx->channels when the crc is ok. Right now the decoder could
        set the channels based on a broken first frame.*/

static int dca_decode_frame(AVCodecContext * avctx,
                            void *data, int *data_size,
                            AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    int i;
    int16_t *samples = data;
    DCAContext *s = avctx->priv_data;
    int channels;
    s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE);
    if (s->dca_buffer_size == -1) {
        av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
    }
    init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
    if (dca_parse_frame_header(s) < 0) {
        //seems like the frame is corrupt, try with the next one
        *data_size=0;
        return buf_size;
    }
    //set AVCodec values with parsed data
    avctx->sample_rate = s->sample_rate;
    avctx->bit_rate = s->bit_rate;
    channels = s->prim_channels + !!s->lfe;
    if (s->amode<16) {
        avctx->channel_layout = dca_core_channel_layout[s->amode];
        if (s->lfe) {
            avctx->channel_layout |= CH_LOW_FREQUENCY;
            s->channel_order_tab = dca_channel_reorder_lfe[s->amode];
        } else
            s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];
        if(avctx->request_channels == 2 && s->prim_channels > 2) {
            channels = 2;
            s->output = DCA_STEREO;
            avctx->channel_layout = CH_LAYOUT_STEREO;
        }
    } else {
        av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode);
    }
    /* There is nothing that prevents a dts frame to change channel configuration
       but FFmpeg doesn't support that so only set the channels if it is previously
       unset. Ideally during the first probe for channels the crc should be checked
       and only set avctx->channels when the crc is ok. Right now the decoder could
       set the channels based on a broken first frame.*/
    if (!avctx->channels)
        avctx->channels = channels;
    if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
    *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels;
    for (i = 0; i < (s->sample_blocks / 8); i++) {
        dca_decode_block(s);
        s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels);
        samples += 256 * channels;
    }
    return buf_size;
}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
                         struct in6_address *dst_addr)

 {
+
     struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr;

_eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,

                        size_t rthdr_offset,

                        struct ip6_ext_hdr *ext_hdr,

                        struct in6_address *dst_addr)

{

    struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr;

    if ((rthdr->rtype == 2) &&

        (rthdr->len == sizeof(struct in6_address) / 8) &&

        (rthdr->segleft == 1)) {

        size_t input_size = iov_size(pkt, pkt_frags);

        size_t bytes_read;

        if (input_size < rthdr_offset + sizeof(*ext_hdr)) {

            return false;

        }

        bytes_read = iov_to_buf(pkt, pkt_frags,

                                rthdr_offset + sizeof(*ext_hdr),

                                dst_addr, sizeof(*dst_addr));

        return bytes_read == sizeof(dst_addr);

    }

    return false;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
         int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1;

         int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);
+
+        int spatial_pred = (c+e)>>1;
+
+        int spatial_score = FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e)
+
                           + FFABS(cur[mrefs+1] - cur[prefs+1]) - 1;

static void filter_line_c(uint8_t *dst,

                          uint8_t *prev, uint8_t *cur, uint8_t *next,

                          int w, int prefs, int mrefs, int parity, int mode)

{

    int x;

    uint8_t *prev2 = parity ? prev : cur ;

    uint8_t *next2 = parity ? cur  : next;

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

        int c = cur[mrefs];

        int d = (prev2[0] + next2[0])>>1;

        int e = cur[prefs];

        int temporal_diff0 = FFABS(prev2[0] - next2[0]);

        int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1;

        int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1;

        int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2);

        int spatial_pred = (c+e)>>1;

        int spatial_score = FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e)

                          + FFABS(cur[mrefs+1] - cur[prefs+1]) - 1;

#define CHECK(j)\

    {   int score = FFABS(cur[mrefs-1+j] - cur[prefs-1-j])\

                  + FFABS(cur[mrefs  +j] - cur[prefs  -j])\

                  + FFABS(cur[mrefs+1+j] - cur[prefs+1-j]);\

        if (score < spatial_score) {\

            spatial_score= score;\

            spatial_pred= (cur[mrefs  +j] + cur[prefs  -j])>>1;\

        CHECK(-1) CHECK(-2) }} }}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int parse_audio(DBEContext *s, int start, int end, int seg_id)
+
 {

     int ch, ret, key = parse_key(s);
@@ -10,10 +10,10 @@

         if (!s->ch_size[ch]) {

+            s->channels[seg_id][ch].nb_groups = 0;

+            continue;
+
         }

         if ((ret = convert_input(s, s->ch_size[ch], key)) < 0)

static int parse_audio(DBEContext *s, int start, int end, int seg_id)

{

    int ch, ret, key = parse_key(s);

    for (ch = start; ch < end; ch++) {

        if (!s->ch_size[ch]) {

            s->channels[seg_id][ch].nb_groups = 0;

            continue;

        }

        if ((ret = convert_input(s, s->ch_size[ch], key)) < 0)

            return ret;

        if ((ret = parse_channel(s, ch, seg_id)) < 0) {

            if (s->avctx->err_recognition & AV_EF_EXPLODE)

                return ret;

            s->channels[seg_id][ch].nb_groups = 0;

        }

        skip_input(s, s->ch_size[ch]);

    }

    skip_input(s, 1);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int mp_user_removexattr(FsContext *ctx,
+
+                               const char *path, const char *name)

 {

     char *buffer;
+
+    int ret;
+
+

     if (strncmp(name, "user.virtfs.", 12) == 0) {

static int mp_user_removexattr(FsContext *ctx,

                               const char *path, const char *name)

{

    char *buffer;

    int ret;

    if (strncmp(name, "user.virtfs.", 12) == 0) {

        /*

         * Don't allow fetch of user.virtfs namesapce

         * in case of mapped security

         */

        errno = EACCES;

        return -1;

    }

    buffer = rpath(ctx, path);

    ret = lremovexattr(buffer, name);

    g_free(buffer);

    return ret;

}


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

     } else {
+
+        pagesize = getpagesize();
+
+    }
+

     return pagesize >= max_cpu_page_size;

bool kvmppc_is_mem_backend_page_size_ok(const char *obj_path)

{

    Object *mem_obj = object_resolve_path(obj_path, NULL);

    char *mempath = object_property_get_str(mem_obj, "mem-path", NULL);

    long pagesize;

    if (mempath) {

        pagesize = qemu_mempath_getpagesize(mempath);

    } else {

        pagesize = getpagesize();

    }

    return pagesize >= max_cpu_page_size;

}


--- a/source.c
+++ b/source.c
@@ -59,11 +59,11 @@
                     (int64_t)s->pts_den * st->codec.frame_rate_base);

         break;
+
+    default:
+
+        break;
+
     }

     return ret;

int av_write_frame(AVFormatContext *s, int stream_index, const uint8_t *buf,

                   int size)

{

    AVStream *st;

    int64_t pts_mask;

    int ret, frame_size;

    st = s->streams[stream_index];

    pts_mask = (1LL << s->pts_wrap_bits) - 1;

    ret = s->oformat->write_packet(s, stream_index, buf, size,

                                   st->pts.val & pts_mask);

    if (ret < 0)

        return ret;

    /* update pts */

    switch (st->codec.codec_type) {

    case CODEC_TYPE_AUDIO:

        frame_size = get_audio_frame_size(&st->codec, size);

        /* note, we skip the initial 0-size packets as they are most likely equal to the encoder delay,

           but it would be better if we had the real timestamps from the encoder */

//        av_log(s, AV_LOG_DEBUG, "%d %lld %lld\n", size, st->pts.num, st->pts.val);

        if (frame_size >= 0 && (size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {

            av_frac_add(&st->pts,

                        (int64_t)s->pts_den * frame_size);

        }

        break;

    case CODEC_TYPE_VIDEO:

        av_frac_add(&st->pts,

                    (int64_t)s->pts_den * st->codec.frame_rate_base);

        break;

    default:

        break;

    }

    return ret;

}


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

 {

+    DCTELEM prev_dc;
+
+    int code, i, sign;
+
+

     OPEN_READER(re, gb);

static av_always_inline void decode_dc_coeffs(GetBitContext *gb, DCTELEM *out,

                                              int blocks_per_slice)

{

    DCTELEM prev_dc;

    int code, i, sign;

    OPEN_READER(re, gb);

    DECODE_CODEWORD(code, FIRST_DC_CB);

    prev_dc = TOSIGNED(code);

    out[0] = prev_dc;

    out += 64; // dc coeff for the next block

    code = 5;

    sign = 0;

    for (i = 1; i < blocks_per_slice; i++, out += 64) {

        DECODE_CODEWORD(code, dc_codebook[FFMIN(code, 6)]);

        if(code) sign ^= -(code & 1);

        else     sign  = 0;

        prev_dc += (((code + 1) >> 1) ^ sign) - sign;

        out[0] = prev_dc;

    }

    CLOSE_READER(re, gb);

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
     av_freep(&film->stereo_buffer);

+
+    return 0;
+
+}

static int film_read_close(AVFormatContext *s)

{

    FilmDemuxContext *film = s->priv_data;

    av_freep(&film->sample_table);

    av_freep(&film->stereo_buffer);

    return 0;

}


int qemu_file_rate_limit(QEMUFile *f)

{

    if (qemu_file_get_error(f)) {

        return 1;

    }

    if (f->xfer_limit > 0 && f->bytes_xfer > f->xfer_limit) {

        return 1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     Coroutine *co;

     Coroutine *tmp;
+
+
+
+    QLIST_FOREACH_SAFE(co, &s->pool, pool_next, tmp) {
+
         g_free(DO_UPCAST(CoroutineUContext, base, co)->stack);

         g_free(co);

static void qemu_coroutine_thread_cleanup(void *opaque)

{

    CoroutineThreadState *s = opaque;

    Coroutine *co;

    Coroutine *tmp;

    QLIST_FOREACH_SAFE(co, &s->pool, pool_next, tmp) {

        g_free(DO_UPCAST(CoroutineUContext, base, co)->stack);

        g_free(co);

    }

    g_free(s);

}


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

     if (!vcon->chr) {
+
+        return;
+
+    }

     qemu_chr_fe_set_open(vcon->chr, guest_connected);

static void set_guest_connected(VirtIOSerialPort *port, int guest_connected)

{

    VirtConsole *vcon = VIRTIO_CONSOLE(port);

    if (!vcon->chr) {

        return;

    }

    qemu_chr_fe_set_open(vcon->chr, guest_connected);

}


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

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

+    cmd[0] = INQUIRY;
+
+    cmd[4] = sizeof(buf);
+
+

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

static int get_device_type(SCSIDiskState *s)

{

    BlockDriverState *bdrv = s->qdev.conf.bs;

    uint8_t cmd[16];

    uint8_t buf[36];

    uint8_t sensebuf[8];

    sg_io_hdr_t io_header;

    int ret;

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

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

    cmd[0] = INQUIRY;

    cmd[4] = sizeof(buf);

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

    io_header.interface_id = 'S';

    io_header.dxfer_direction = SG_DXFER_FROM_DEV;

    io_header.dxfer_len = sizeof(buf);

    io_header.dxferp = buf;

    io_header.cmdp = cmd;

    io_header.cmd_len = sizeof(cmd);

    io_header.mx_sb_len = sizeof(sensebuf);

    io_header.sbp = sensebuf;

    io_header.timeout = 6000; /* XXX */

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

    if (ret < 0 || io_header.driver_status || io_header.host_status) {

        return -1;

    }

    s->qdev.type = buf[0];

    if (buf[1] & 0x80) {

        s->features |= 1 << SCSI_DISK_F_REMOVABLE;

    }

    return 0;

}


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

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

+    s->arglen = qemu_get_be32(f);
+
+
+
+

     s->response_pos = qemu_get_be32(f);

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

{

    SSISlave *ss = SSI_SLAVE(opaque);

    ssi_sd_state *s = (ssi_sd_state *)opaque;

    int i;

    if (version_id != 1)

    s->mode = qemu_get_be32(f);

    s->cmd = qemu_get_be32(f);

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

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

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

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

    s->arglen = qemu_get_be32(f);

    s->response_pos = qemu_get_be32(f);

    s->stopping = qemu_get_be32(f);

    ss->cs = qemu_get_be32(f);

    return 0;


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

     return VTD_PAGE_SHIFT_4K + (level - 1) * VTD_SL_LEVEL_BITS;
+
 }

static inline uint32_t vtd_slpt_level_shift(uint32_t level)

{

    return VTD_PAGE_SHIFT_4K + (level - 1) * VTD_SL_LEVEL_BITS;

}


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

            changes, so it should be avoided. */

+        struct timeval tv;
+
+        gettimeofday(&tv, NULL);
+
+        return tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000);

     }

static int64_t get_clock(void)

{

#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000) \

	|| defined(__DragonFly__)

    if (use_rt_clock) {

        struct timespec ts;

        clock_gettime(CLOCK_MONOTONIC, &ts);

        return ts.tv_sec * 1000000000LL + ts.tv_nsec;

    } else

#endif

    {

        /* XXX: using gettimeofday leads to problems if the date

           changes, so it should be avoided. */

        struct timeval tv;

        gettimeofday(&tv, NULL);

        return tv.tv_sec * 1000000000LL + (tv.tv_usec * 1000);

    }

}


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

     if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K'

static int smacker_probe(AVProbeData *p)

{

    if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K'

        && (p->buf[3] == '2' || p->buf[3] == '4'))

        return AVPROBE_SCORE_MAX;

    else

        return 0;

}


--- a/source.c
+++ b/source.c
@@ -33,11 +33,11 @@
             continue;

         }
+
+        /* Write value and confirm it reads back as written
+
+         * (to catch read-only registers and partially read-only
+
          * registers where the incoming migration value doesn't match)

          */

bool write_list_to_cpustate(ARMCPU *cpu)

{

    int i;

    bool ok = true;

    for (i = 0; i < cpu->cpreg_array_len; i++) {

        uint32_t regidx = kvm_to_cpreg_id(cpu->cpreg_indexes[i]);

        uint64_t v = cpu->cpreg_values[i];

        const ARMCPRegInfo *ri;

        ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);

        if (!ri) {

            ok = false;

            continue;

        }

        if (ri->type & ARM_CP_NO_MIGRATE) {

            continue;

        }

        /* Write value and confirm it reads back as written

         * (to catch read-only registers and partially read-only

         * registers where the incoming migration value doesn't match)

         */

        write_raw_cp_reg(&cpu->env, ri, v);

        if (read_raw_cp_reg(&cpu->env, ri) != v) {

            ok = false;

        }

    }

    return ok;

}


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

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

     int i;

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

{

    AcpiSdtTable *temp;

    GError *error = NULL;

    GString *command_line = g_string_new(iasl);

    gint fd;

    gchar *out, *out_err;

    gboolean ret;

    int i;

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

    g_assert_no_error(error);

    close(fd);

    /* build command line */

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

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

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

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

    }

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

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

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

    g_assert_no_error(error);

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

                              &sdt->asl_len, &error);

    g_assert(ret);

    g_assert_no_error(error);

    g_assert(sdt->asl_len);

    g_free(out);

    g_free(out_err);

    g_string_free(command_line, true);

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     acb->count++;

     if (ret == 0) {
+
         acb->success_count++;

     } else {
+
         quorum_report_bad(acb, sacb->aiocb->bs->node_name, ret);

     }

static void quorum_aio_cb(void *opaque, int ret)

{

    QuorumChildRequest *sacb = opaque;

    QuorumAIOCB *acb = sacb->parent;

    BDRVQuorumState *s = acb->common.bs->opaque;

    sacb->ret = ret;

    acb->count++;

    if (ret == 0) {

        acb->success_count++;

    } else {

        quorum_report_bad(acb, sacb->aiocb->bs->node_name, ret);

    }

    assert(acb->count <= s->num_children);

    assert(acb->success_count <= s->num_children);

    if (acb->count < s->num_children) {

        return;

    }

    /* Do the vote on read */

    if (acb->is_read) {

        quorum_vote(acb);

    } else {

        quorum_has_too_much_io_failed(acb);

    }

    quorum_aio_finalize(acb);

}


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

+    vdev->nvectors = proxy->nvectors;
+
+    virtio_init_pci(proxy, vdev,
+
+                    PCI_VENDOR_ID_REDHAT_QUMRANET,

                     PCI_DEVICE_ID_VIRTIO_NET,

static int virtio_net_init_pci(PCIDevice *pci_dev)

{

    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);

    VirtIODevice *vdev;

    vdev = virtio_net_init(&pci_dev->qdev, &proxy->nic, &proxy->net);

    vdev->nvectors = proxy->nvectors;

    virtio_init_pci(proxy, vdev,

                    PCI_VENDOR_ID_REDHAT_QUMRANET,

                    PCI_DEVICE_ID_VIRTIO_NET,

                    PCI_CLASS_NETWORK_ETHERNET,

                    0x00);

    /* make the actual value visible */

    proxy->nvectors = vdev->nvectors;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     av_freep(&s->me.map);

     av_freep(&s->me.score_map);
+
+    av_freep(&s->blocks);
+
+    av_freep(&s->ac_val_base);
+
     s->block = NULL;

 }

static void free_duplicate_context(MpegEncContext *s)

{

    if (s == NULL)

        return;

    av_freep(&s->edge_emu_buffer);

    av_freep(&s->me.scratchpad);

    s->me.temp =

    s->rd_scratchpad =

    s->b_scratchpad =

    s->obmc_scratchpad = NULL;

    av_freep(&s->dct_error_sum);

    av_freep(&s->me.map);

    av_freep(&s->me.score_map);

    av_freep(&s->blocks);

    av_freep(&s->ac_val_base);

    s->block = NULL;

}


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

     QmpSerializeData *d = datap;

+    visit_free(qmp_output_get_visitor(d->qov));
+
+    visit_free(d->qiv);

static void qmp_cleanup(void *datap)

{

    QmpSerializeData *d = datap;

    visit_free(qmp_output_get_visitor(d->qov));

    visit_free(d->qiv);

    g_free(d);

}


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

         while (!data.done) {

+            aio_poll(aio_context, true);
+
+        }
+
+    }

     return data.ret;

int64_t bdrv_get_block_status_above(BlockDriverState *bs,

                                    BlockDriverState *base,

                                    int64_t sector_num,

                                    int nb_sectors, int *pnum)

{

    Coroutine *co;

    BdrvCoGetBlockStatusData data = {

        .bs = bs,

        .base = base,

        .sector_num = sector_num,

        .nb_sectors = nb_sectors,

        .pnum = pnum,

        .done = false,

    };

    if (qemu_in_coroutine()) {

        /* Fast-path if already in coroutine context */

        bdrv_get_block_status_above_co_entry(&data);

    } else {

        AioContext *aio_context = bdrv_get_aio_context(bs);

        co = qemu_coroutine_create(bdrv_get_block_status_above_co_entry);

        qemu_coroutine_enter(co, &data);

        while (!data.done) {

            aio_poll(aio_context, true);

        }

    }

    return data.ret;

}


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

     for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {
+
+        if (!blk->disable_perm) {
+
+            continue;
+
         }

void blk_resume_after_migration(Error **errp)

{

    BlockBackend *blk;

    Error *local_err = NULL;

    for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) {

        if (!blk->disable_perm) {

            continue;

        }

        blk->disable_perm = false;

        blk_set_perm(blk, blk->perm, blk->shared_perm, &local_err);

        if (local_err) {

            error_propagate(errp, local_err);

            blk->disable_perm = true;

            return;

        }

    }

}


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

 {

void wdt_i6300esb_init(void)

{

    watchdog_add_model(&model);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void decode_gain_info(GetBitContext *gb, int *gaininfo)

+{

     int i, n;

static void decode_gain_info(GetBitContext *gb, int *gaininfo)

{

    int i, n;

    while (get_bits1(gb)) {

        /* NOTHING */

    }

    n = get_bits_count(gb) - 1;     // amount of elements*2 to update

    i = 0;

    while (n--) {

        int index = get_bits(gb, 3);

        int gain = get_bits1(gb) ? get_bits(gb, 4) - 7 : -1;

        while (i <= index)

            gaininfo[i++] = gain;

    }

    while (i <= 8)

        gaininfo[i++] = 0;

}


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

      * If link is down and auto-negotiation is supported and ongoing,

+     * complete auto-negotiation immediately. This allows us to look
+
+     * at MII_SR_AUTONEG_COMPLETE to infer link status on load.
+
+     */

     if (nc->link_down &&

static void e1000_pre_save(void *opaque)

{

    E1000State *s = opaque;

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

    /* If the mitigation timer is active, emulate a timeout now. */

    if (s->mit_timer_on) {

        e1000_mit_timer(s);

    }

    /*

     * If link is down and auto-negotiation is supported and ongoing,

     * complete auto-negotiation immediately. This allows us to look

     * at MII_SR_AUTONEG_COMPLETE to infer link status on load.

     */

    if (nc->link_down &&

        s->compat_flags & E1000_FLAG_AUTONEG &&

        s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN &&

        s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG) {

         s->phy_reg[PHY_STATUS] |= MII_SR_AUTONEG_COMPLETE;

    }

}


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

         break;

+
+
+    default:
+
+        error_report("milkymist_pfpu: write access to unknown register 0x"

                 TARGET_FMT_plx, addr << 2);

static void pfpu_write(void *opaque, target_phys_addr_t addr, uint64_t value,

                       unsigned size)

{

    MilkymistPFPUState *s = opaque;

    trace_milkymist_pfpu_memory_write(addr, value);

    addr >>= 2;

    switch (addr) {

    case R_CTL:

        if (value & CTL_START_BUSY) {

            pfpu_start(s);

        }

        break;

    case R_MESHBASE:

    case R_HMESHLAST:

    case R_VMESHLAST:

    case R_CODEPAGE:

    case R_VERTICES:

    case R_COLLISIONS:

    case R_STRAYWRITES:

    case R_LASTDMA:

    case R_PC:

    case R_DREGBASE:

    case R_CODEBASE:

        s->regs[addr] = value;

        break;

    case GPR_BEGIN ...  GPR_END:

        s->gp_regs[addr - GPR_BEGIN] = value;

        break;

    case MICROCODE_BEGIN ...  MICROCODE_END:

        s->microcode[get_microcode_address(s, addr)] = value;

        break;

    default:

        error_report("milkymist_pfpu: write access to unknown register 0x"

                TARGET_FMT_plx, addr << 2);

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -11,7 +11,7 @@
     d.noreboot = true;

     test_init(&d);
+
     g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_bar, TCO_RLD), ==,

                     TCO_RLD_DEFAULT);

static void test_tco_defaults(void)

{

    TestData d;

    d.args = NULL;

    d.noreboot = true;

    test_init(&d);

    g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_bar, TCO_RLD), ==,

                    TCO_RLD_DEFAULT);

    /* TCO_DAT_IN & TCO_DAT_OUT */

    g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_bar, TCO_DAT_IN), ==,

                    (TCO_DAT_OUT_DEFAULT << 8) | TCO_DAT_IN_DEFAULT);

    /* TCO1_STS & TCO2_STS */

    g_assert_cmpint(qpci_io_readl(d.dev, d.tco_io_bar, TCO1_STS), ==,

                    (TCO2_STS_DEFAULT << 16) | TCO1_STS_DEFAULT);

    /* TCO1_CNT & TCO2_CNT */

    g_assert_cmpint(qpci_io_readl(d.dev, d.tco_io_bar, TCO1_CNT), ==,

                    (TCO2_CNT_DEFAULT << 16) | TCO1_CNT_DEFAULT);

    /* TCO_MESSAGE1 & TCO_MESSAGE2 */

    g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_bar, TCO_MESSAGE1), ==,

                    (TCO_MESSAGE2_DEFAULT << 8) | TCO_MESSAGE1_DEFAULT);

    g_assert_cmpint(qpci_io_readb(d.dev, d.tco_io_bar, TCO_WDCNT), ==,

                    TCO_WDCNT_DEFAULT);

    g_assert_cmpint(qpci_io_readb(d.dev, d.tco_io_bar, SW_IRQ_GEN), ==,

                    SW_IRQ_GEN_DEFAULT);

    g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_bar, TCO_TMR), ==,

                    TCO_TMR_DEFAULT);

    qtest_end();

}


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

+    visit_type_int(v, NULL, &res, &error_abort);
+
+    g_assert_cmpint(res, ==, value);
+
+}

static void test_visitor_in_int(TestInputVisitorData *data,

                                const void *unused)

{

    int64_t res = 0, value = -42;

    Visitor *v;

    v = visitor_input_test_init(data, "%" PRId64, value);

    visit_type_int(v, NULL, &res, &error_abort);

    g_assert_cmpint(res, ==, value);

}


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

+{

+    QPCIDevice *dev;

     void *bmdma_base, *ide_base;

+    uint8_t status;

static void test_bmdma_no_busmaster(void)

{

    QPCIDevice *dev;

    void *bmdma_base, *ide_base;

    uint8_t status;

    dev = get_pci_device(&bmdma_base, &ide_base);

    /* No PRDT_EOT, each entry addr 0/size 64k, and in theory qemu shouldn't be

     * able to access it anyway because the Bus Master bit in the PCI command

     * register isn't set. This is complete nonsense, but it used to be pretty

     * good at confusing and occasionally crashing qemu. */

    PrdtEntry prdt[4096] = { };

    status = send_dma_request(CMD_READ_DMA | CMDF_NO_BM, 0, 512,

                              prdt, ARRAY_SIZE(prdt), NULL);

    /* Not entirely clear what the expected result is, but this is what we get

     * in practice. At least we want to be aware of any changes. */

    g_assert_cmphex(status, ==, BM_STS_ACTIVE | BM_STS_INTR);

    assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR);

}


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

     return timer_head && (timer_head->expire_time <= current_time);

+}

static bool timer_expired_ns(QEMUTimer *timer_head, int64_t current_time)

{

    return timer_head && (timer_head->expire_time <= current_time);

}


--- a/source.c
+++ b/source.c
@@ -3,9 +3,9 @@
                                hwaddr size, unsigned client)

 {
+
+    assert(mr->terminates);
+
     cpu_physical_memory_test_and_clear_dirty(mr->ram_addr + addr, size,

                                              client);

void memory_region_reset_dirty(MemoryRegion *mr, hwaddr addr,

                               hwaddr size, unsigned client)

{

    assert(mr->terminates);

    cpu_physical_memory_test_and_clear_dirty(mr->ram_addr + addr, size,

                                             client);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void qdev_prop_set_globals_for_type(DeviceState *dev,
+
+                                const char *typename)

 {

static void qdev_prop_set_globals_for_type(DeviceState *dev,

                                const char *typename)

{

    GlobalProperty *prop;

    QTAILQ_FOREACH(prop, &global_props, next) {

        Error *err = NULL;

        if (strcmp(typename, prop->driver) != 0) {

            continue;

        }

        prop->used = true;

        object_property_parse(OBJECT(dev), prop->value, prop->property, &err);

        if (err != NULL) {

            assert(prop->user_provided);

            error_reportf_err(err, "Warning: global %s.%s=%s ignored: ",

                              prop->driver, prop->property, prop->value);

            return;

        }

    }

}


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

             }

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

         }

void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,

                                    DriveInfo *hd1, qemu_irq irq)

{

    int i;

    DriveInfo *dinfo;

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

        dinfo = i == 0 ? hd0 : hd1;

        ide_init1(bus, i);

        if (dinfo) {

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

                               dinfo->media_cd ? IDE_CD : IDE_HD, NULL,

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

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

                exit(1);

            }

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

        } else {

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

        }

    }

    bus->irq = irq;

    bus->dma = &ide_dma_nop;

}


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

         for (j = 0; j < sc->drefs_count; j++) {

+            av_freep(&sc->drefs[j].path);
+
+            av_freep(&sc->drefs[j].dir);
+
+        }

         av_freep(&sc->drefs);

static int mov_read_close(AVFormatContext *s)

{

    MOVContext *mov = s->priv_data;

    int i, j;

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

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

        MOVStreamContext *sc = st->priv_data;

        av_freep(&sc->ctts_data);

        for (j = 0; j < sc->drefs_count; j++) {

            av_freep(&sc->drefs[j].path);

            av_freep(&sc->drefs[j].dir);

        }

        av_freep(&sc->drefs);

        if (sc->pb && sc->pb != s->pb)

            avio_close(sc->pb);

        av_freep(&sc->chunk_offsets);

        av_freep(&sc->stsc_data);

        av_freep(&sc->sample_sizes);

        av_freep(&sc->keyframes);

        av_freep(&sc->stts_data);

        av_freep(&sc->stps_data);

        av_freep(&sc->rap_group);

        av_freep(&sc->display_matrix);

    }

    if (mov->dv_demux) {

        avformat_free_context(mov->dv_fctx);

        mov->dv_fctx = NULL;

    }

    av_freep(&mov->trex_data);

    return 0;

}


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

     } else if (strcmp(mode, "halt") == 0) {

+        shutdown_flag |= EWX_SHUTDOWN;

     } else if (strcmp(mode, "reboot") == 0) {

void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)

{

    UINT shutdown_flag = EWX_FORCE;

    slog("guest-shutdown called, mode: %s", mode);

    if (!has_mode || strcmp(mode, "powerdown") == 0) {

        shutdown_flag |= EWX_POWEROFF;

    } else if (strcmp(mode, "halt") == 0) {

        shutdown_flag |= EWX_SHUTDOWN;

    } else if (strcmp(mode, "reboot") == 0) {

        shutdown_flag |= EWX_REBOOT;

    } else {

        error_set(err, QERR_INVALID_PARAMETER_VALUE, "mode",

                  "halt|powerdown|reboot");

        return;

    }

    /* Request a shutdown privilege, but try to shut down the system

       anyway. */

    acquire_privilege(SE_SHUTDOWN_NAME, err);

    if (error_is_set(err)) {

        return;

    }

    if (!ExitWindowsEx(shutdown_flag, SHTDN_REASON_FLAG_PLANNED)) {

        slog("guest-shutdown failed: %d", GetLastError());

        error_set(err, QERR_UNDEFINED_ERROR);

    }

}


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

     case ARM_CPU_MODE_USR:
+
+        return 0;
+
+    case ARM_CPU_MODE_SYS:
+
     case ARM_CPU_MODE_SVC:

     case ARM_CPU_MODE_ABT:

static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type)

{

    /* Return true if it is not valid for us to switch to

     * this CPU mode (ie all the UNPREDICTABLE cases in

     * the ARM ARM CPSRWriteByInstr pseudocode).

    /* Changes to or from Hyp via MSR and CPS are illegal. */

        ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_HYP ||

         mode == ARM_CPU_MODE_HYP)) {

    switch (mode) {

    case ARM_CPU_MODE_USR:

        return 0;

    case ARM_CPU_MODE_SYS:

    case ARM_CPU_MODE_SVC:

    case ARM_CPU_MODE_ABT:

    case ARM_CPU_MODE_UND:

    case ARM_CPU_MODE_IRQ:

    case ARM_CPU_MODE_FIQ:

        /* Note that we don't implement the IMPDEF NSACR.RFR which in v7

         * allows FIQ mode to be Secure-only. (In v8 this doesn't exist.)

        return 0;

    case ARM_CPU_MODE_HYP:

        return !arm_feature(env, ARM_FEATURE_EL2)

            || arm_current_el(env) < 2 || arm_is_secure(env);

    case ARM_CPU_MODE_MON:

        return arm_current_el(env) < 3;

    default:


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

     addr &= 0x1f;

+#ifdef DEBUG
+
+    printf("uhci writel port=0x%04x val=0x%08x\n", addr, val);
+
+#endif

     switch(addr) {

static void uhci_ioport_writel(void *opaque, uint32_t addr, uint32_t val)

{

    UHCIState *s = opaque;

    addr &= 0x1f;

#ifdef DEBUG

    printf("uhci writel port=0x%04x val=0x%08x\n", addr, val);

#endif

    switch(addr) {

    case 0x08:

        s->fl_base_addr = val & ~0xfff;

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void qdev_property_add_static(DeviceState *dev, Property *prop,
+
+                              Error **errp)
+
+{
+
     Error *local_err = NULL;

     Object *obj = OBJECT(dev);

void qdev_property_add_static(DeviceState *dev, Property *prop,

                              Error **errp)

{

    Error *local_err = NULL;

    Object *obj = OBJECT(dev);

    /*

     * TODO qdev_prop_ptr does not have getters or setters.  It must

     * go now that it can be replaced with links.  The test should be

     * removed along with it: all static properties are read/write.

     */

    if (!prop->info->get && !prop->info->set) {

        return;

    }

    object_property_add(obj, prop->name, prop->info->name,

                        prop->info->get, prop->info->set,

                        prop->info->release,

                        prop, &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }

    object_property_set_description(obj, prop->name,

                                    prop->info->description,

                                    &error_abort);

    if (prop->info->set_default_value) {

        prop->info->set_default_value(obj, prop);

    }

}


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

     while (qemu_mutex_trylock(&qemu_global_mutex)) {
+
+        qemu_thread_signal(tcg_cpu_thread, SIGUSR1);
+
+        if (!qemu_mutex_timedlock(&qemu_global_mutex, msecs))
+
             break;

     }

static void qemu_signal_lock(unsigned int msecs)

{

    qemu_mutex_lock(&qemu_fair_mutex);

    while (qemu_mutex_trylock(&qemu_global_mutex)) {

        qemu_thread_signal(tcg_cpu_thread, SIGUSR1);

        if (!qemu_mutex_timedlock(&qemu_global_mutex, msecs))

            break;

    }

    qemu_mutex_unlock(&qemu_fair_mutex);

}


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

+    pdu_unmarshal(pdu, offset, "ds", &s->msize, &version);
+
+    trace_v9fs_version(pdu->tag, pdu->id, s->msize, version.data);
+
+

     virtfs_reset(pdu);

static void v9fs_version(void *opaque)

{

    V9fsPDU *pdu = opaque;

    V9fsState *s = pdu->s;

    V9fsString version;

    size_t offset = 7;

    pdu_unmarshal(pdu, offset, "ds", &s->msize, &version);

    trace_v9fs_version(pdu->tag, pdu->id, s->msize, version.data);

    virtfs_reset(pdu);

    if (!strcmp(version.data, "9P2000.u")) {

        s->proto_version = V9FS_PROTO_2000U;

    } else if (!strcmp(version.data, "9P2000.L")) {

        s->proto_version = V9FS_PROTO_2000L;

    } else {

        v9fs_string_sprintf(&version, "unknown");

    }

    offset += pdu_marshal(pdu, offset, "ds", s->msize, &version);

    trace_v9fs_version_return(pdu->tag, pdu->id, s->msize, version.data);

    complete_pdu(s, pdu, offset);

    v9fs_string_free(&version);

    return;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void scsi_remove_request(SCSIGenericReq *r)

+{

     qemu_free(r->buf);

static void scsi_remove_request(SCSIGenericReq *r)

{

    qemu_free(r->buf);

    scsi_req_free(&r->req);

}


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

     if (dev->state != DEV_STATE_CREATED) {

+        error_set(errp, QERR_PERMISSION_DENIED);
+
+        return;
+
+    }

static void qdev_set_legacy_property(DeviceState *dev, Visitor *v, void *opaque,

                                     const char *name, Error **errp)

{

    Property *prop = opaque;

    if (dev->state != DEV_STATE_CREATED) {

        error_set(errp, QERR_PERMISSION_DENIED);

        return;

    }

    if (prop->info->parse) {

        Error *local_err = NULL;

        char *ptr = NULL;

        visit_type_str(v, &ptr, name, &local_err);

        if (!local_err) {

            int ret;

            ret = prop->info->parse(dev, prop, ptr);

            if (ret != 0) {

                error_set(errp, QERR_INVALID_PARAMETER_VALUE,

                          name, prop->info->name);

            }

            g_free(ptr);

        } else {

            error_propagate(errp, local_err);

        }

    } else {

        error_set(errp, QERR_PERMISSION_DENIED);

    }

}


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

 {

+    int64_t res = 0;
+
     Error *err = NULL;

     Visitor *v;

static void test_visitor_in_int_overflow(TestInputVisitorData *data,

                                         const void *unused)

{

    int64_t res = 0;

    Error *err = NULL;

    Visitor *v;

    /* this will overflow a Qint/int64, so should be deserialized into

     * a QFloat/double field instead, leading to an error if we pass it

     * to visit_type_int. confirm this.

     */

    v = visitor_input_test_init(data, "%f", DBL_MAX);

    visit_type_int(v, &res, NULL, &err);

    g_assert(err);

    error_free(err);

}


--- a/source.c
+++ b/source.c
@@ -7,9 +7,9 @@
     uint8_t *buf = NULL;

     uint8_t *buffer;
+
     size_t offset;
+
     ssize_t ret;

static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov,

                               int iovcnt, unsigned flags)

{

    uint8_t *buf = NULL;

    uint8_t *buffer;

    size_t offset;

    ssize_t ret;

    if (iovcnt == 1) {

        buffer = iov[0].iov_base;

        offset = iov[0].iov_len;

    } else {

        buf = g_new(uint8_t, NET_BUFSIZE);

        buffer = buf;

        offset = iov_to_buf(iov, iovcnt, 0, buf, NET_BUFSIZE);

    }

    if (flags & QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) {

        ret = nc->info->receive_raw(nc, buffer, offset);

    } else {

        ret = nc->info->receive(nc, buffer, offset);

    }

    g_free(buf);

    return ret;

}


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

     strcpy(*cred, certdir);

+    strcat(*cred, "/");
+
+    strcat(*cred, filename);
+
+

     VNC_DEBUG("Check %s\n", *cred);

static int vnc_set_x509_credential(VncDisplay *vs,

				   const char *certdir,

				   const char *filename,

				   char **cred,

				   int ignoreMissing)

{

    struct stat sb;

    if (*cred) {

	qemu_free(*cred);

	*cred = NULL;

    }

    *cred = qemu_malloc(strlen(certdir) + strlen(filename) + 2);

    strcpy(*cred, certdir);

    strcat(*cred, "/");

    strcat(*cred, filename);

    VNC_DEBUG("Check %s\n", *cred);

    if (stat(*cred, &sb) < 0) {

	qemu_free(*cred);

	*cred = NULL;

	if (ignoreMissing && errno == ENOENT)

	    return 0;

	return -1;

    }

    return 0;

}


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

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

     }

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

                              MOVTrack *track, AVStream *st)

{

    int64_t pos = avio_tell(pb);

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

    ffio_wfourcc(pb, "trak");

    mov_write_tkhd_tag(pb, track, st);

    if (supports_edts(mov))

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

    if (track->tref_tag)

        mov_write_tref_tag(pb, track);

    mov_write_mdia_tag(pb, track);

    if (track->mode == MODE_PSP)

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

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

        mov_write_udta_sdp(pb, track);

    if (track->mode == MODE_MOV) {

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

            double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);

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

                mov_write_tapt_tag(pb, track);

            }

        }

        if (is_clcp_track(track)) {

            mov_write_tapt_tag(pb, track);

        }

    }

    return update_size(pb, pos);

}


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

         oldv = int128_make128(oldl, oldh);
+
+        fail = !int128_eq(oldv, cmpv);
+
+        if (fail) {
+
             newv = oldv;

         }

void HELPER(cdsg)(CPUS390XState *env, uint64_t addr,

                  uint32_t r1, uint32_t r3)

{

    uintptr_t ra = GETPC();

    Int128 cmpv = int128_make128(env->regs[r1 + 1], env->regs[r1]);

    Int128 newv = int128_make128(env->regs[r3 + 1], env->regs[r3]);

    Int128 oldv;

    bool fail;

    if (parallel_cpus) {

#ifndef CONFIG_ATOMIC128

        cpu_loop_exit_atomic(ENV_GET_CPU(env), ra);

#else

        int mem_idx = cpu_mmu_index(env, false);

        TCGMemOpIdx oi = make_memop_idx(MO_TEQ | MO_ALIGN_16, mem_idx);

        oldv = helper_atomic_cmpxchgo_be_mmu(env, addr, cmpv, newv, oi, ra);

        fail = !int128_eq(oldv, cmpv);

#endif

    } else {

        uint64_t oldh, oldl;

        check_alignment(env, addr, 16, ra);

        oldh = cpu_ldq_data_ra(env, addr + 0, ra);

        oldl = cpu_ldq_data_ra(env, addr + 8, ra);

        oldv = int128_make128(oldl, oldh);

        fail = !int128_eq(oldv, cmpv);

        if (fail) {

            newv = oldv;

        }

        cpu_stq_data_ra(env, addr + 0, int128_gethi(newv), ra);

        cpu_stq_data_ra(env, addr + 8, int128_getlo(newv), ra);

    }

    env->cc_op = fail;

    env->regs[r1] = int128_gethi(oldv);

    env->regs[r1 + 1] = int128_getlo(oldv);

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
+static int arm_gic_common_init(SysBusDevice *dev)
+
 {

+    GICState *s = FROM_SYSBUS(GICState, dev);

     int num_irq = s->num_irq;

+

     if (s->num_cpu > NCPU) {
+
         hw_error("requested %u CPUs exceeds GIC maximum %d\n",

+                 s->num_cpu, NCPU);

     }

static int arm_gic_common_init(SysBusDevice *dev)

{

    GICState *s = FROM_SYSBUS(GICState, dev);

    int num_irq = s->num_irq;

    if (s->num_cpu > NCPU) {

        hw_error("requested %u CPUs exceeds GIC maximum %d\n",

                 s->num_cpu, NCPU);

    }

    s->num_irq += GIC_BASE_IRQ;

    if (s->num_irq > GIC_MAXIRQ) {

        hw_error("requested %u interrupt lines exceeds GIC maximum %d\n",

                 num_irq, GIC_MAXIRQ);

    }

    /* ITLinesNumber is represented as (N / 32) - 1 (see

     * gic_dist_readb) so this is an implementation imposed

     * restriction, not an architectural one:

     */

    if (s->num_irq < 32 || (s->num_irq % 32)) {

        hw_error("%d interrupt lines unsupported: not divisible by 32\n",

                 num_irq);

    }

    register_savevm(NULL, "arm_gic", -1, 3, gic_save, gic_load, s);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -39,11 +39,11 @@
     case 5:

     case 6:
+
+        printf("%s: Audio GPIO%i %s.\n",
+
+                        __FUNCTION__, line - 4, level ? "high" : "low");
+
         break;

     }

static void palmte_onoff_gpios(void *opaque, int line, int level)

{

    switch (line) {

    case 0:

        printf("%s: current to MMC/SD card %sabled.\n",

                        __FUNCTION__, level ? "dis" : "en");

        break;

    case 1:

        printf("%s: internal speaker amplifier %s.\n",

                        __FUNCTION__, level ? "down" : "on");

        break;

    /* These LCD & Audio output signals have not been identified yet.  */

    case 2:

    case 3:

    case 4:

        printf("%s: LCD GPIO%i %s.\n",

                        __FUNCTION__, line - 1, level ? "high" : "low");

        break;

    case 5:

    case 6:

        printf("%s: Audio GPIO%i %s.\n",

                        __FUNCTION__, line - 4, level ? "high" : "low");

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2],

+                       const int32_t *ubuf[2], const int32_t *vbuf[2],
+
                        const int32_t *abuf[2], uint16_t *dest, int dstW,

                        int yalpha, int uvalpha, int y,

yuv2rgb48_2_c_template(SwsContext *c, const int32_t *buf[2],

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

                       const int32_t *abuf[2], uint16_t *dest, int dstW,

                       int yalpha, int uvalpha, int y,

                       enum PixelFormat target)

{

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

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

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

    int  yalpha1 = 4095 - yalpha;

    int uvalpha1 = 4095 - uvalpha;

    int i;

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

        int Y1 = (buf0[i * 2]     * yalpha1  + buf1[i * 2]     * yalpha) >> 14;

        int Y2 = (buf0[i * 2 + 1] * yalpha1  + buf1[i * 2 + 1] * yalpha) >> 14;

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

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

        int R, G, B;

        Y1 -= c->yuv2rgb_y_offset;

        Y2 -= c->yuv2rgb_y_offset;

        Y1 *= c->yuv2rgb_y_coeff;

        Y2 *= c->yuv2rgb_y_coeff;

        Y1 += 1 << 13;

        Y2 += 1 << 13;

        R = V * c->yuv2rgb_v2r_coeff;

        G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff;

        B =                            U * c->yuv2rgb_u2b_coeff;

        output_pixel(&dest[0], av_clip_uintp2(R_B + Y1, 30) >> 14);

        output_pixel(&dest[1], av_clip_uintp2(  G + Y1, 30) >> 14);

        output_pixel(&dest[2], av_clip_uintp2(B_R + Y1, 30) >> 14);

        output_pixel(&dest[3], av_clip_uintp2(R_B + Y2, 30) >> 14);

        output_pixel(&dest[4], av_clip_uintp2(  G + Y2, 30) >> 14);

        output_pixel(&dest[5], av_clip_uintp2(B_R + Y2, 30) >> 14);

        dest += 6;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 void qemu_thread_create(QemuThread *thread,

+                       void *(*start_routine)(void *),

                        void *arg, int mode)

+{

     HANDLE hThread;
+

     assert(mode == QEMU_THREAD_DETACHED);

void qemu_thread_create(QemuThread *thread,

                       void *(*start_routine)(void *),

                       void *arg, int mode)

{

    HANDLE hThread;

    assert(mode == QEMU_THREAD_DETACHED);

    struct QemuThreadData *data;

    qemu_thread_init();

    data = g_malloc(sizeof *data);

    data->thread = thread;

    data->start_routine = start_routine;

    data->arg = arg;

    hThread = (HANDLE) _beginthreadex(NULL, 0, win32_start_routine,

                                      data, 0, NULL);

    if (!hThread) {

        error_exit(GetLastError(), __func__);

    }

    CloseHandle(hThread);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void stw_be_phys(target_phys_addr_t addr, uint32_t val)

+{

     stw_phys_internal(addr, val, DEVICE_BIG_ENDIAN);

void stw_be_phys(target_phys_addr_t addr, uint32_t val)

{

    stw_phys_internal(addr, val, DEVICE_BIG_ENDIAN);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void __attribute__((__constructor__)) rcu_init(void)

 {

static void __attribute__((__constructor__)) rcu_init(void)

{

    QemuThread thread;

    qemu_mutex_init(&rcu_gp_lock);

    qemu_event_init(&rcu_gp_event, true);

    qemu_event_init(&rcu_call_ready_event, false);

    qemu_thread_create(&thread, "call_rcu", call_rcu_thread,

                       NULL, QEMU_THREAD_DETACHED);

    rcu_register_thread();

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void kvm_inject_x86_mce(CPUState *cenv, int bank, uint64_t status,

                         uint64_t mcg_status, uint64_t addr, uint64_t misc,

@@ -8,7 +8,7 @@

 #ifdef KVM_CAP_MCE

+    struct kvm_x86_mce mce = {

         .bank = bank,

void kvm_inject_x86_mce(CPUState *cenv, int bank, uint64_t status,

                        uint64_t mcg_status, uint64_t addr, uint64_t misc,

                        int abort_on_error)

{

#ifdef KVM_CAP_MCE

    struct kvm_x86_mce mce = {

        .bank = bank,

        .status = status,

        .mcg_status = mcg_status,

        .addr = addr,

        .misc = misc,

    };

    struct kvm_x86_mce_data data = {

            .env = cenv,

            .mce = &mce,

    };

    if (!cenv->mcg_cap) {

        fprintf(stderr, "MCE support is not enabled!\n");

        return;

    }

    run_on_cpu(cenv, kvm_do_inject_x86_mce, &data);

#else

    if (abort_on_error)

        abort();

#endif

}


--- a/source.c
+++ b/source.c
@@ -13,9 +13,9 @@
     if (env)

         env->last_io_time = cpu_get_time_fast();
+
+#endif
+
+    return val;
+
 }

uint32_t cpu_inl(CPUState *env, pio_addr_t addr)

{

    uint32_t val;

    val = ioport_read(2, addr);

    LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);

#ifdef CONFIG_KQEMU

    if (env)

        env->last_io_time = cpu_get_time_fast();

#endif

    return val;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static inline uint32_t get_hwc_address(SM501State *state, int crt)
+
 {

     uint32_t addr = crt ? state->dc_crt_hwc_addr : state->dc_panel_hwc_addr;

static inline uint32_t get_hwc_address(SM501State *state, int crt)

{

    uint32_t addr = crt ? state->dc_crt_hwc_addr : state->dc_panel_hwc_addr;

    return (addr & 0x03FFFFF0)/* >> 4*/;

}


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

     char *pr;

+

     qdist_init(&dist);

static void test_none(void)

{

    struct qdist dist;

    char *pr;

    qdist_init(&dist);

    g_assert(isnan(qdist_avg(&dist)));

    g_assert(isnan(qdist_xmin(&dist)));

    g_assert(isnan(qdist_xmax(&dist)));

    pr = qdist_pr_plain(&dist, 0);

    g_assert(pr == NULL);

    pr = qdist_pr_plain(&dist, 2);

    g_assert(pr == NULL);

    qdist_destroy(&dist);

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
+static uint32_t arm_v7m_load_vector(ARMCPU *cpu)
+
+
+
+{
+
+    CPUState *cs = CPU(cpu);
+
+    CPUARMState *env = &cpu->env;

+    MemTxResult result;

     hwaddr vec = env->v7m.vecbase + env->v7m.exception * 4;

static uint32_t arm_v7m_load_vector(ARMCPU *cpu)

{

    CPUState *cs = CPU(cpu);

    CPUARMState *env = &cpu->env;

    MemTxResult result;

    hwaddr vec = env->v7m.vecbase + env->v7m.exception * 4;

    uint32_t addr;

    addr = address_space_ldl(cs->as, vec,

                             MEMTXATTRS_UNSPECIFIED, &result);

    if (result != MEMTX_OK) {

        /* Architecturally this should cause a HardFault setting HSFR.VECTTBL,

         * which would then be immediately followed by our failing to load

         * the entry vector for that HardFault, which is a Lockup case.

         * Since we don't model Lockup, we just report this guest error

         * via cpu_abort().

         */

        cpu_abort(cs, "Failed to read from exception vector table "

                  "entry %08x\n", (unsigned)vec);

    }

    return addr;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+ObjectClass *object_class_dynamic_cast(ObjectClass *class,
+
+                                       const char *typename)
+
+{

     TypeImpl *target_type = type_get_by_name(typename);

ObjectClass *object_class_dynamic_cast(ObjectClass *class,

                                       const char *typename)

{

    TypeImpl *target_type = type_get_by_name(typename);

    TypeImpl *type = class->type;

    ObjectClass *ret = NULL;

    if (type->num_interfaces && type_is_ancestor(target_type, type_interface)) {

        int found = 0;

        GSList *i;

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

            ObjectClass *target_class = i->data;

            if (type_is_ancestor(target_class->type, target_type)) {

                ret = target_class;

                found++;

            }

         }

        /* The match was ambiguous, don't allow a cast */

        if (found > 1) {

            ret = NULL;

        }

    } else if (type_is_ancestor(type, target_type)) {

        ret = class;

    }

    return ret;

}


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

     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;

+    avctx->coded_frame->key_frame = 1;
+
+    avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
+
+    if(!avctx->codec_tag)

         avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);

static av_cold int raw_encode_init(AVCodecContext *avctx)

{

    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);

    avctx->coded_frame            = av_frame_alloc();

    if (!avctx->coded_frame)

        return AVERROR(ENOMEM);

    avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;

    avctx->coded_frame->key_frame = 1;

    avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);

    if(!avctx->codec_tag)

        avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static int qemu_chr_open_file_out(QemuOpts *opts, CharDriverState **_chr)

 {
+
+    int fd_out;

+
+
     TFR(fd_out = qemu_open(qemu_opt_get(opts, "path"),

                       O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666));

static int qemu_chr_open_file_out(QemuOpts *opts, CharDriverState **_chr)

{

    int fd_out;

    TFR(fd_out = qemu_open(qemu_opt_get(opts, "path"),

                      O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666));

    if (fd_out < 0) {

        return -errno;

    }

    *_chr = qemu_chr_open_fd(-1, fd_out);

    return 0;

}


static int net_rx_ok(void *opaque)

{

    struct XenNetDev *netdev = opaque;

    RING_IDX rc, rp;

    if (netdev->xendev.be_state != XenbusStateConnected)

	return 0;

    rc = netdev->rx_ring.req_cons;

    rp = netdev->rx_ring.sring->req_prod;

    xen_rmb();

    if (rc == rp || RING_REQUEST_CONS_OVERFLOW(&netdev->rx_ring, rc)) {

	xen_be_printf(&netdev->xendev, 2, "%s: no rx buffers (%d/%d)\n",

		      __FUNCTION__, rc, rp);

	return 0;

    }

    return 1;

}


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

 {
+
+    CinVideoContext *cin = avctx->priv_data;
+
+    unsigned int i;
+

     cin->avctx = avctx;

static av_cold int cinvideo_decode_init(AVCodecContext *avctx)

{

    CinVideoContext *cin = avctx->priv_data;

    unsigned int i;

    cin->avctx = avctx;

    avctx->pix_fmt = AV_PIX_FMT_PAL8;

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

    cin->bitmap_size = avctx->width * avctx->height;

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

        cin->bitmap_table[i] = av_mallocz(cin->bitmap_size);

        if (!cin->bitmap_table[i])

            av_log(avctx, AV_LOG_ERROR, "Can't allocate bitmap buffers.\n");

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
 	if (ret < 0) {

 		printf("aio_write failed: %s\n", strerror(-ret));
+
+		return;
+
+	}
+

 	if (ctx->qflag) {

aio_write_done(void *opaque, int ret)

{

	struct aio_ctx *ctx = opaque;

	struct timeval t2;

	gettimeofday(&t2, NULL);

	if (ret < 0) {

		printf("aio_write failed: %s\n", strerror(-ret));

		return;

	}

	if (ctx->qflag) {

		return;

	}

	/* Finally, report back -- -C gives a parsable format */

	t2 = tsub(t2, ctx->t1);

	print_report("wrote", &t2, ctx->offset, ctx->qiov.size,

		     ctx->qiov.size, 1, ctx->Cflag);

	qemu_io_free(ctx->buf);

	free(ctx);

}