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

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

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

         int rot = encode_imm(rhs);

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

                                  TCGArg lhs, TCGArg rhs, int rhs_is_const)

{

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

     * rhs must satisfy the "rI" constraint.

     */

    if (rhs_is_const) {

        int rot = encode_imm(rhs);

        assert(rot >= 0);

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

    } else {

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

    }

}


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

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

+        prefix_val++;

         inc = 1;

int ff_hevc_cu_qp_delta_abs(HEVCContext *s)

{

    int prefix_val = 0;

    int suffix_val = 0;

    int inc = 0;

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

        prefix_val++;

        inc = 1;

    }

    if (prefix_val >= 5) {

        int k = 0;

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

            suffix_val += 1 << k;

            k++;

        }

        if (k == CABAC_MAX_BIN)

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

        while (k--)

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

    }

    return prefix_val + suffix_val;

}


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

     fd_set fdset = dispr->fdset;
+
+

     /* wait until some of sockets become readable. */

dispatcher_wait(Dispatcher *dispr, uint32_t timeout)

{

    struct timeval tv;

    tv.tv_sec = timeout / 1000000;

    tv.tv_usec = timeout % 1000000;

    fd_set fdset = dispr->fdset;

    /* wait until some of sockets become readable. */

    int rc = select(dispr->max_sock + 1, &fdset, 0, 0, &tv);

    if (rc == -1) {

        vubr_die("select");

    }

    /* Timeout */

    if (rc == 0) {

        return 0;

    }

    /* Now call callback for every ready socket. */

    int sock;

    for (sock = 0; sock < dispr->max_sock + 1; sock++)

        if (FD_ISSET(sock, &fdset)) {

            Event *e = &dispr->events[sock];

            e->callback(sock, e->ctx);

        }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static uint64_t pci_host_data_read(void *opaque,

                                    hwaddr addr, unsigned len)
+
 {

     PCIHostState *s = opaque;

static uint64_t pci_host_data_read(void *opaque,

                                   hwaddr addr, unsigned len)

{

    PCIHostState *s = opaque;

    uint32_t val;

    if (!(s->config_reg & (1 << 31)))

        return 0xffffffff;

    val = pci_data_read(s->bus, s->config_reg | (addr & 3), len);

    PCI_DPRINTF("read addr " TARGET_FMT_plx " len %d val %x\n",

                addr, len, val);

    return val;

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int mp_user_setxattr(FsContext *ctx, const char *path, const char *name,
+
+                            void *value, size_t size, int flags)

 {

     char *buffer;
+
+    int ret;
+
+

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

static int mp_user_setxattr(FsContext *ctx, const char *path, const char *name,

                            void *value, size_t size, int flags)

{

    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 = lsetxattr(buffer, name, value, size, flags);

    g_free(buffer);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+    MOVContext *mov = s->priv_data;
+    MOVStreamContext *sc;
+    AVIndexEntry *sample;
     AVStream *st = NULL;
     int ret;
     mov->fc = s;

static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
{
    MOVContext *mov = s->priv_data;
    MOVStreamContext *sc;
    AVIndexEntry *sample;
    AVStream *st = NULL;
    int ret;
    mov->fc = s;
 retry:
    sample = mov_find_next_sample(s, &st);
    if (!sample) {
        mov->found_mdat = 0;
        if (!mov->next_root_atom)
            return AVERROR_EOF;
        avio_seek(s->pb, mov->next_root_atom, SEEK_SET);
        mov->next_root_atom = 0;
        if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
            url_feof(s->pb))
            return AVERROR_EOF;
        av_dlog(s, "read fragments, offset 0x%"PRIx64"\n", avio_tell(s->pb));
        goto retry;
    sc = st->priv_data;
    /* must be done just before reading, to avoid infinite loop on sample */
    sc->current_sample++;
    if (st->discard != AVDISCARD_ALL) {
        if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
            av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n",
                   sc->ffindex, sample->pos);
            return AVERROR_INVALIDDATA;
        ret = av_get_packet(sc->pb, pkt, sample->size);
        if (ret < 0)
            return ret;
        if (sc->has_palette) {
            uint8_t *pal;
            pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
            if (!pal) {
                av_log(mov->fc, AV_LOG_ERROR, "Cannot append palette to packet\n");
            } else {
                memcpy(pal, sc->palette, AVPALETTE_SIZE);
                sc->has_palette = 0;
#if CONFIG_DV_DEMUXER
        if (mov->dv_demux && sc->dv_audio_container) {
            avpriv_dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos);
            av_free(pkt->data);
            pkt->size = 0;
            ret = avpriv_dv_get_packet(mov->dv_demux, pkt);
            if (ret < 0)
                return ret;
#endif
    pkt->stream_index = sc->ffindex;
    pkt->dts = sample->timestamp;
    if (sc->ctts_data && sc->ctts_index < sc->ctts_count) {
        pkt->pts = pkt->dts + sc->dts_shift + sc->ctts_data[sc->ctts_index].duration;
        /* update ctts context */
        sc->ctts_sample++;
        if (sc->ctts_index < sc->ctts_count &&
            sc->ctts_data[sc->ctts_index].count == sc->ctts_sample) {
            sc->ctts_index++;
            sc->ctts_sample = 0;
        if (sc->wrong_dts)
            pkt->dts = AV_NOPTS_VALUE;
    } else {
        int64_t next_dts = (sc->current_sample < st->nb_index_entries) ?
            st->index_entries[sc->current_sample].timestamp : st->duration;
        pkt->duration = next_dts - pkt->dts;
        pkt->pts = pkt->dts;
    if (st->discard == AVDISCARD_ALL)
        goto retry;
    pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0;
    pkt->pos = sample->pos;
    av_dlog(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n",
            pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration);
    return 0;


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     uint64_t res = 999;

     int err;
+
+
+
+    err = qemu_strtoull(str, NULL, 0, &res);
+

     g_assert_cmpint(err, ==, 0);

static void test_qemu_strtoull_full_correct(void)

{

    const char *str = "18446744073709551614";

    uint64_t res = 999;

    int err;

    err = qemu_strtoull(str, NULL, 0, &res);

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 18446744073709551614LLU);

}


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

+

     if (addr < QPCI_PIO_LIMIT) {

void qpci_io_writeq(QPCIDevice *dev, void *data, uint64_t value)

{

    uintptr_t addr = (uintptr_t)data;

    if (addr < QPCI_PIO_LIMIT) {

        dev->bus->pio_writeq(dev->bus, addr, value);

    } else {

        value = cpu_to_le64(value);

        dev->bus->memwrite(dev->bus, addr, &value, sizeof(value));

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void tcg_gen_mb(TCGBar mb_type)

+{
+
     if (parallel_cpus) {

         tcg_gen_op1(INDEX_op_mb, mb_type);

void tcg_gen_mb(TCGBar mb_type)

{

    if (parallel_cpus) {

        tcg_gen_op1(INDEX_op_mb, mb_type);

    }

}


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

                            Object *owner,

+                           const MemoryRegionOps *ops,
+
+                           void *opaque,
+
+                           const char *name,

                            uint64_t size)

void memory_region_init_io(MemoryRegion *mr,

                           Object *owner,

                           const MemoryRegionOps *ops,

                           void *opaque,

                           const char *name,

                           uint64_t size)

{

    memory_region_init(mr, owner, name, size);

    mr->ops = ops;

    mr->opaque = opaque;

    mr->terminates = true;

    mr->ram_addr = ~(ram_addr_t)0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int check_strtox_error(const char **next, char *endptr,

                               int err)

static int check_strtox_error(const char **next, char *endptr,

                              int err)

{

    if (!next && *endptr) {

        return -EINVAL;

    }

    if (next) {

        *next = endptr;

    }

    return -err;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static int nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply,

                              int len)
+
 {

     NBDClient *client = req->client;

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

                             int len)

{

    NBDClient *client = req->client;

    int csock = client->sock;

    int rc, ret;

    qemu_co_mutex_lock(&client->send_lock);

    qemu_set_fd_handler2(csock, nbd_can_read, nbd_read,

                         nbd_restart_write, client);

    client->send_coroutine = qemu_coroutine_self();

    if (!len) {

        rc = nbd_send_reply(csock, reply);

        if (rc == -1) {

            rc = -errno;

        }

    } else {

        socket_set_cork(csock, 1);

        rc = nbd_send_reply(csock, reply);

        if (rc != -1) {

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

            if (ret != len) {

                errno = EIO;

                rc = -1;

            }

        }

        if (rc == -1) {

            rc = -errno;

        }

        socket_set_cork(csock, 0);

    }

    client->send_coroutine = NULL;

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

    qemu_co_mutex_unlock(&client->send_lock);

    return rc;

}


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

     phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;

+    /* we remove the notdirty callback only if the code has been
+
+       flushed */
+
+    if (dirty_flags == 0xff)

         tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);

static void notdirty_mem_writel(void *opaque, target_phys_addr_t ram_addr,

                                uint32_t val)

{

    int dirty_flags;

    dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];

    if (!(dirty_flags & CODE_DIRTY_FLAG)) {

#if !defined(CONFIG_USER_ONLY)

        tb_invalidate_phys_page_fast(ram_addr, 4);

        dirty_flags = phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS];

#endif

    }

    stl_p(qemu_get_ram_ptr(ram_addr), val);

    dirty_flags |= (0xff & ~CODE_DIRTY_FLAG);

    phys_ram_dirty[ram_addr >> TARGET_PAGE_BITS] = dirty_flags;

    /* we remove the notdirty callback only if the code has been

       flushed */

    if (dirty_flags == 0xff)

        tlb_set_dirty(cpu_single_env, cpu_single_env->mem_io_vaddr);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void div64(uint64_t *plow, uint64_t *phigh, uint64_t b)

 {

static void div64(uint64_t *plow, uint64_t *phigh, uint64_t b)

{

    uint64_t q, r, a1, a0;

    int i, qb;

    a0 = *plow;

    a1 = *phigh;

    if (a1 == 0) {

        q = a0 / b;

        r = a0 % b;

        *plow = q;

        *phigh = r;

    } else {

        /* XXX: use a better algorithm */

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

            a1 = (a1 << 1) | (a0 >> 63);

            if (a1 >= b) {

                a1 -= b;

                qb = 1;

            } else {

                qb = 0;

            }

            a0 = (a0 << 1) | qb;

        }

#if defined(DEBUG_MULDIV)

        printf("div: 0x%016llx%016llx / 0x%016llx: q=0x%016llx r=0x%016llx\n",

               *phigh, *plow, b, a0, a1);

#endif

        *plow = a0;

        *phigh = a1;

    }

}


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

     s->media_changed = 1;
+
+
+
+    return false;
+
 }

static bool cmd_write_dma(IDEState *s, uint8_t cmd)

{

    bool lba48 = (cmd == WIN_WRITEDMA_EXT);

    if (!s->bs) {

        ide_abort_command(s);

        return true;

    }

    ide_cmd_lba48_transform(s, lba48);

    ide_sector_start_dma(s, IDE_DMA_WRITE);

    s->media_changed = 1;

    return false;

}


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

                    NonBlockingConnectHandler *callback, void *opaque)

+{
+
+    QemuOpts *opts;
+
+    int fd;

int socket_connect(SocketAddress *addr, Error **errp,

                   NonBlockingConnectHandler *callback, void *opaque)

{

    QemuOpts *opts;

    int fd;

    opts = qemu_opts_create_nofail(&socket_optslist);

    switch (addr->kind) {

    case SOCKET_ADDRESS_KIND_INET:

        inet_addr_to_opts(opts, addr->inet);

        fd = inet_connect_opts(opts, errp, callback, opaque);

        break;

    case SOCKET_ADDRESS_KIND_UNIX:

        qemu_opt_set(opts, "path", addr->q_unix->path);

        fd = unix_connect_opts(opts, errp, callback, opaque);

        break;

    case SOCKET_ADDRESS_KIND_FD:

        fd = monitor_get_fd(cur_mon, addr->fd->str, errp);

        if (callback) {

            callback(fd, opaque);

        }

        break;

    default:

        abort();

    }

    qemu_opts_del(opts);

    return fd;

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static int mpegvideo_probe(AVProbeData *p)

 {
+
     uint32_t code= -1;

     int pic=0, seq=0, slice=0, pspack=0, vpes=0, apes=0, res=0, sicle=0;

     int i;
+
     uint32_t last = 0;

static int mpegvideo_probe(AVProbeData *p)

{

    uint32_t code= -1;

    int pic=0, seq=0, slice=0, pspack=0, vpes=0, apes=0, res=0, sicle=0;

    int i;

    uint32_t last = 0;

    for(i=0; i<p->buf_size; i++){

        code = (code<<8) + p->buf[i];

        if ((code & 0xffffff00) == 0x100) {

            switch(code){

            case     SEQ_START_CODE:   seq++; break;

            case PICTURE_START_CODE:   pic++; break;

            case    PACK_START_CODE: pspack++; break;

            case              0x1b6:

                                        res++; break;

            }

            if (code >= SLICE_START_CODE && code <= 0x1af) {

                if (last >= SLICE_START_CODE && last <= 0x1af) {

                    if (code >= last) slice++;

                    else              sicle++;

                }else{

                    if (code == SLICE_START_CODE) slice++;

                    else                          sicle++;

                }

            }

            if     ((code & 0x1f0) == VIDEO_ID)   vpes++;

            else if((code & 0x1e0) == AUDIO_ID)   apes++;

            last = code;

        }

    }

    if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !apes && !res && slice > sicle) {

        if(vpes) return AVPROBE_SCORE_EXTENSION / 4;

        else     return pic>1 ? AVPROBE_SCORE_EXTENSION + 1 : AVPROBE_SCORE_EXTENSION / 2; // +1 for .mpg

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+int qcow2_pre_write_overlap_check(BlockDriverState *bs, int chk, int64_t offset,
+
                                   int64_t size)

 {

int qcow2_pre_write_overlap_check(BlockDriverState *bs, int chk, int64_t offset,

                                  int64_t size)

{

    int ret = qcow2_check_metadata_overlap(bs, chk, offset, size);

    if (ret < 0) {

        return ret;

    } else if (ret > 0) {

        int metadata_ol_bitnr = ffs(ret) - 1;

        char *message;

        QObject *data;

        assert(metadata_ol_bitnr < QCOW2_OL_MAX_BITNR);

        fprintf(stderr, "qcow2: Preventing invalid write on metadata (overlaps "

                "with %s); image marked as corrupt.\n",

                metadata_ol_names[metadata_ol_bitnr]);

        message = g_strdup_printf("Prevented %s overwrite",

                metadata_ol_names[metadata_ol_bitnr]);

        data = qobject_from_jsonf("{ 'device': %s, 'msg': %s, 'offset': %"

                PRId64 ", 'size': %" PRId64 " }", bs->device_name, message,

                offset, size);

        monitor_protocol_event(QEVENT_BLOCK_IMAGE_CORRUPTED, data);

        g_free(message);

        qobject_decref(data);

        qcow2_mark_corrupt(bs);

        bs->drv = NULL; /* make BDS unusable */

        return -EIO;

    }

    return 0;

}


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

     use_icount = 2;
+
+
+
+    /* 125MIPS seems a reasonable initial guess at the guest speed.
+
        It will be corrected fairly quickly anyway.  */

     icount_time_shift = 3;

void configure_icount(const char *option)

{

    vmstate_register(NULL, 0, &vmstate_timers, &timers_state);

    if (!option)

        return;

    if (strcmp(option, "auto") != 0) {

        icount_time_shift = strtol(option, NULL, 0);

        use_icount = 1;

        return;

    }

    use_icount = 2;

    /* 125MIPS seems a reasonable initial guess at the guest speed.

       It will be corrected fairly quickly anyway.  */

    icount_time_shift = 3;

    /* Have both realtime and virtual time triggers for speed adjustment.

       The realtime trigger catches emulated time passing too slowly,

       the virtual time trigger catches emulated time passing too fast.

       Realtime triggers occur even when idle, so use them less frequently

       than VM triggers.  */

    icount_rt_timer = qemu_new_timer(rt_clock, icount_adjust_rt, NULL);

    qemu_mod_timer(icount_rt_timer,

                   qemu_get_clock(rt_clock) + 1000);

    icount_vm_timer = qemu_new_timer(vm_clock, icount_adjust_vm, NULL);

    qemu_mod_timer(icount_vm_timer,

                   qemu_get_clock(vm_clock) + get_ticks_per_sec() / 10);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void put_line(uint8_t *dst, int size, int width, const int *runs)

 {
+
     PutBitContext pb;

     int run, mode = ~0, pix_left = width, run_idx = 0;

static void put_line(uint8_t *dst, int size, int width, const int *runs)

{

    PutBitContext pb;

    int run, mode = ~0, pix_left = width, run_idx = 0;

    init_put_bits(&pb, dst, size * 8);

    while (pix_left > 0) {

        run       = runs[run_idx++];

        mode      = ~mode;

        pix_left -= run;

        for (; run > 16; run -= 16)

            put_sbits(&pb, 16, mode);

        if (run)

            put_sbits(&pb, run, mode);

    }

    flush_put_bits(&pb);

}


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

 {

+    PCIBonitoState *s = opaque;
+
+

     ((uint32_t *)(&s->boncop))[addr/sizeof(uint32_t)] = val & 0xffffffff;

static void bonito_cop_writel(void *opaque, target_phys_addr_t addr,

                              uint64_t val, unsigned size)

{

    PCIBonitoState *s = opaque;

    ((uint32_t *)(&s->boncop))[addr/sizeof(uint32_t)] = val & 0xffffffff;

}


--- 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
@@ -3,9 +3,9 @@
 {

     bs->boot_sector_enabled = 1;
+
+    if (size > 512)
+
         size = 512;

     memcpy(bs->boot_sector_data, data, size);

void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size)

{

    bs->boot_sector_enabled = 1;

    if (size > 512)

        size = 512;

    memcpy(bs->boot_sector_data, data, size);

    memset(bs->boot_sector_data + size, 0, 512 - size);

}


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

         end = l1 << 22;

+        if (pde & PG_PRESENT_MASK) {
+
+            if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
+
+                prot = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);

                 mem_print(mon, &start, &last_prot, end, prot);

static void mem_info_32(Monitor *mon, CPUState *env)

{

    int l1, l2, prot, last_prot;

    uint32_t pgd, pde, pte;

    target_phys_addr_t start, end;

    pgd = env->cr[3] & ~0xfff;

    last_prot = 0;

    start = -1;

    for(l1 = 0; l1 < 1024; l1++) {

        cpu_physical_memory_read(pgd + l1 * 4, &pde, 4);

        pde = le32_to_cpu(pde);

        end = l1 << 22;

        if (pde & PG_PRESENT_MASK) {

            if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {

                prot = pde & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);

                mem_print(mon, &start, &last_prot, end, prot);

            } else {

                for(l2 = 0; l2 < 1024; l2++) {

                    cpu_physical_memory_read((pde & ~0xfff) + l2 * 4, &pte, 4);

                    pte = le32_to_cpu(pte);

                    end = (l1 << 22) + (l2 << 12);

                    if (pte & PG_PRESENT_MASK) {

                        prot = pte & (PG_USER_MASK | PG_RW_MASK | PG_PRESENT_MASK);

                    } else {

                        prot = 0;

                    }

                    mem_print(mon, &start, &last_prot, end, prot);

                }

            }

        } else {

            prot = 0;

            mem_print(mon, &start, &last_prot, end, prot);

        }

    }

}


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

     if (host_bits & float_flag_inexact) {

+        target_bits |= UCF64_FPSCR_FLAG_INEXACT;
+
+    }
+
+    return target_bits;

 }

static inline int ucf64_exceptbits_from_host(int host_bits)

{

    int target_bits = 0;

    if (host_bits & float_flag_invalid) {

        target_bits |= UCF64_FPSCR_FLAG_INVALID;

    }

    if (host_bits & float_flag_divbyzero) {

        target_bits |= UCF64_FPSCR_FLAG_DIVZERO;

    }

    if (host_bits & float_flag_overflow) {

        target_bits |= UCF64_FPSCR_FLAG_OVERFLOW;

    }

    if (host_bits & float_flag_underflow) {

        target_bits |= UCF64_FPSCR_FLAG_UNDERFLOW;

    }

    if (host_bits & float_flag_inexact) {

        target_bits |= UCF64_FPSCR_FLAG_INEXACT;

    }

    return target_bits;

}


static CharDriverState *qemu_chr_open_ringbuf(const char *id,

                                              ChardevBackend *backend,

                                              ChardevReturn *ret,

                                              Error **errp)

{

    ChardevRingbuf *opts = backend->u.ringbuf;

    CharDriverState *chr;

    RingBufCharDriver *d;

    chr = qemu_chr_alloc();

    d = g_malloc(sizeof(*d));

    d->size = opts->has_size ? opts->size : 65536;

    /* The size must be power of 2 */

    if (d->size & (d->size - 1)) {

        error_setg(errp, "size of ringbuf chardev must be power of two");

        goto fail;

    }

    d->prod = 0;

    d->cons = 0;

    d->cbuf = g_malloc0(d->size);

    chr->opaque = d;

    chr->chr_write = ringbuf_chr_write;

    chr->chr_close = ringbuf_chr_close;

    return chr;

fail:

    g_free(d);

    g_free(chr);

    return NULL;

}


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

     int ret = 0;

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

+

+    if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) {

         /* TODO: Clear handling */

int do_subchannel_work_passthrough(SubchDev *sch)

{

    int ret = 0;

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

    if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) {

        /* TODO: Clear handling */

        sch_handle_clear_func(sch);

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

        /* TODO: Halt handling */

        sch_handle_halt_func(sch);

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

        ret = sch_handle_start_func_passthrough(sch);

    }

    return ret;

}


static bool iasl_installed(void)

{

    gchar *out = NULL, *out_err = NULL;

    bool ret;

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

    ret = g_spawn_command_line_sync("iasl", &out, &out_err, NULL, NULL);

    if (out_err) {

        ret = ret && (out_err[0] == '\0');

        g_free(out_err);

    }

    if (out) {

        g_free(out);

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void gen_rev16(TCGv var)
+
 {

     TCGv tmp = new_tmp();

     tcg_gen_shri_i32(tmp, var, 8);
+
     tcg_gen_andi_i32(tmp, tmp, 0x00ff00ff);

     tcg_gen_shli_i32(var, var, 8);

static void gen_rev16(TCGv var)

{

    TCGv tmp = new_tmp();

    tcg_gen_shri_i32(tmp, var, 8);

    tcg_gen_andi_i32(tmp, tmp, 0x00ff00ff);

    tcg_gen_shli_i32(var, var, 8);

    tcg_gen_andi_i32(var, var, 0xff00ff00);

    tcg_gen_or_i32(var, var, tmp);

    dead_tmp(tmp);

}


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

     s->txint = 1;
+
     if (!s->rxint_under_svc) {

         s->txint_under_svc = 1;

+        if (s->chn == chn_a) {

             s->rregs[R_INTR] |= INTR_TXINTA;

static inline void set_txint(ChannelState *s)

{

    s->txint = 1;

    if (!s->rxint_under_svc) {

        s->txint_under_svc = 1;

        if (s->chn == chn_a) {

            s->rregs[R_INTR] |= INTR_TXINTA;

            if (s->wregs[W_MINTR] & MINTR_STATUSHI)

                s->otherchn->rregs[R_IVEC] = IVEC_HITXINTA;

            else

                s->otherchn->rregs[R_IVEC] = IVEC_LOTXINTA;

        } else {

            s->rregs[R_IVEC] = IVEC_TXINTB;

            s->otherchn->rregs[R_INTR] |= INTR_TXINTB;

        }

    escc_update_irq(s);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static int qmp_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd,
+
                                  const QDict *params)

 {

static int qmp_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd,

                                 const QDict *params)

{

    return cmd->mhandler.cmd_async(mon, params, qmp_monitor_complete, mon);

}


--- 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
@@ -38,11 +38,11 @@

     for (m=0; days >= md[m]; m++)

+         days -= md[m];
+
+
+
+    tm->tm_year = y;  /* unlike gmtime_r we store complete year here */

     tm->tm_mon = m+1; /* unlike gmtime_r tm_mon is from 1 to 12 */

struct tm *brktimegm(time_t secs, struct tm *tm)

{

    int days, y, ny, m;

    int md[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

    days = secs / 86400;

    secs %= 86400;

    tm->tm_hour = secs / 3600;

    tm->tm_min = (secs % 3600) / 60;

    tm->tm_sec =  secs % 60;

    /* oh well, may be someone some day will invent a formula for this stuff */

    y = 1970; /* start "guessing" */

    while (days >= (ISLEAP(y)?366:365)) {

        ny = (y + days/366);

        days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1);

        y = ny;

    }

    md[1] = ISLEAP(y)?29:28;

    for (m=0; days >= md[m]; m++)

         days -= md[m];

    tm->tm_year = y;  /* unlike gmtime_r we store complete year here */

    tm->tm_mon = m+1; /* unlike gmtime_r tm_mon is from 1 to 12 */

    tm->tm_mday = days+1;

    return tm;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+int xics_alloc_block(XICSState *icp, int src, int num, bool lsi, bool align)

 {

int xics_alloc_block(XICSState *icp, int src, int num, bool lsi, bool align)

{

    int i, first = -1;

    ICSState *ics = &icp->ics[src];

    assert(src == 0);

    /*

     * MSIMesage::data is used for storing VIRQ so

     * it has to be aligned to num to support multiple

     * MSI vectors. MSI-X is not affected by this.

     * The hint is used for the first IRQ, the rest should

     * be allocated continuously.

     */

    if (align) {

        assert((num == 1) || (num == 2) || (num == 4) ||

               (num == 8) || (num == 16) || (num == 32));

        first = ics_find_free_block(ics, num, num);

    } else {

        first = ics_find_free_block(ics, num, 1);

    }

    if (first >= 0) {

        for (i = first; i < first + num; ++i) {

            ics_set_irq_type(ics, i, lsi);

        }

    }

    first += ics->offset;

    trace_xics_alloc_block(src, first, num, lsi, align);

    return first;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int net_init_vhost_user(const NetClientOptions *opts, const char *name,

+                   NetClientState *peer)
+
 {

     return net_vhost_user_init(peer, "vhost_user", 0, 0, 0);

int net_init_vhost_user(const NetClientOptions *opts, const char *name,

                   NetClientState *peer)

{

    return net_vhost_user_init(peer, "vhost_user", 0, 0, 0);

}


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

     if (env->exception_index == POWERPC_EXCP_PROGRAM &&
+
+        (env->error_code & POWERPC_EXCP_FP)) {
+
+        /* Differred floating-point exception after target FPR update */
+
         if (msr_fe0 != 0 || msr_fe1 != 0)

             helper_raise_exception_err(env->exception_index, env->error_code);

void helper_float_check_status (void)

{

#ifdef CONFIG_SOFTFLOAT

    if (env->exception_index == POWERPC_EXCP_PROGRAM &&

        (env->error_code & POWERPC_EXCP_FP)) {

        /* Differred floating-point exception after target FPR update */

        if (msr_fe0 != 0 || msr_fe1 != 0)

            helper_raise_exception_err(env->exception_index, env->error_code);

    } else {

        int status = get_float_exception_flags(&env->fp_status);

        if (status & float_flag_overflow) {

            float_overflow_excp();

        } else if (status & float_flag_underflow) {

            float_underflow_excp();

        } else if (status & float_flag_inexact) {

            float_inexact_excp();

        }

    }

#else

    if (env->exception_index == POWERPC_EXCP_PROGRAM &&

        (env->error_code & POWERPC_EXCP_FP)) {

        /* Differred floating-point exception after target FPR update */

        if (msr_fe0 != 0 || msr_fe1 != 0)

            helper_raise_exception_err(env->exception_index, env->error_code);

    }

#endif

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     data.start = -1ul;

     data.prot = 0;
+
+
+
+    for (i = 0; i < V_L1_SIZE; i++) {
+
         int rc = walk_memory_regions_1(&data, (abi_ulong)i << V_L1_SHIFT,

                                        V_L1_SHIFT / L2_BITS - 1, l1_map + i);

int walk_memory_regions(void *priv, walk_memory_regions_fn fn)

{

    struct walk_memory_regions_data data;

    uintptr_t i;

    data.fn = fn;

    data.priv = priv;

    data.start = -1ul;

    data.prot = 0;

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

        int rc = walk_memory_regions_1(&data, (abi_ulong)i << V_L1_SHIFT,

                                       V_L1_SHIFT / L2_BITS - 1, l1_map + i);

        if (rc != 0) {

            return rc;

        }

    }

    return walk_memory_regions_end(&data, 0, 0);

}


--- a/source.c
+++ b/source.c
@@ -12,11 +12,11 @@
                         &old_name, &newdirfid, &new_name);
     if (err < 0) {
     if (name_is_illegal(old_name.data) || name_is_illegal(new_name.data)) {
+        err = -ENOENT;
+    v9fs_path_write_lock(s);
+    err = v9fs_complete_renameat(pdu, olddirfid,
+                                 &old_name, newdirfid, &new_name);
+    v9fs_path_unlock(s);
     if (!err) {
         err = offset;
 out_err:

static void v9fs_renameat(void *opaque)
{
    ssize_t err = 0;
    size_t offset = 7;
    V9fsPDU *pdu = opaque;
    V9fsState *s = pdu->s;
    int32_t olddirfid, newdirfid;
    V9fsString old_name, new_name;
    v9fs_string_init(&old_name);
    v9fs_string_init(&new_name);
    err = pdu_unmarshal(pdu, offset, "dsds", &olddirfid,
                        &old_name, &newdirfid, &new_name);
    if (err < 0) {
    if (name_is_illegal(old_name.data) || name_is_illegal(new_name.data)) {
        err = -ENOENT;
    v9fs_path_write_lock(s);
    err = v9fs_complete_renameat(pdu, olddirfid,
                                 &old_name, newdirfid, &new_name);
    v9fs_path_unlock(s);
    if (!err) {
        err = offset;
out_err:
    pdu_complete(pdu, err);
    v9fs_string_free(&old_name);
    v9fs_string_free(&new_name);


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

     int64_t layout;

+

+    for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) {

         if (strlen(channel_layout_map[i].name) == name_len &&

static uint64_t get_channel_layout_single(const char *name, int name_len)

{

    int i;

    char *end;

    int64_t layout;

    for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) {

        if (strlen(channel_layout_map[i].name) == name_len &&

            !memcmp(channel_layout_map[i].name, name, name_len))

            return channel_layout_map[i].layout;

    }

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

        if (channel_names[i].name &&

            strlen(channel_names[i].name) == name_len &&

            !memcmp(channel_names[i].name, name, name_len))

            return (int64_t)1 << i;

    i = strtol(name, &end, 10);

    if ((end + 1 - name == name_len && *end  == 'c'))

        return av_get_default_channel_layout(i);

    layout = strtoll(name, &end, 0);

    if (end - name == name_len)

        return FFMAX(layout, 0);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -39,11 +39,11 @@
                     sw1 = sw->entries.le_next;

                     if (sw->rate) {
+
+                        st_rate_stop (sw->rate);
+
+                        sw->rate = NULL;
+
                     }

                     LIST_REMOVE (sw, entries);

void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)

{

    struct capture_callback *cb;

    for (cb = cap->cb_head.lh_first; cb; cb = cb->entries.le_next) {

        if (cb->opaque == cb_opaque) {

            cb->ops.destroy (cb_opaque);

            LIST_REMOVE (cb, entries);

            qemu_free (cb);

            if (!cap->cb_head.lh_first) {

                SWVoiceOut *sw = cap->hw.sw_head.lh_first, *sw1;

                while (sw) {

                    SWVoiceCap *sc = (SWVoiceCap *) sw;

#ifdef DEBUG_CAPTURE

                    dolog ("freeing %s\n", sw->name);

#endif

                    sw1 = sw->entries.le_next;

                    if (sw->rate) {

                        st_rate_stop (sw->rate);

                        sw->rate = NULL;

                    }

                    LIST_REMOVE (sw, entries);

                    LIST_REMOVE (sc, entries);

                    qemu_free (sc);

                    sw = sw1;

                }

                LIST_REMOVE (cap, entries);

                qemu_free (cap);

            }

            return;

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void mips_qemu_write (void *opaque, target_phys_addr_t addr,
+
+                             uint64_t val, unsigned size)

 {

static void mips_qemu_write (void *opaque, target_phys_addr_t addr,

                             uint64_t val, unsigned size)

{

    if ((addr & 0xffff) == 0 && val == 42)

        qemu_system_reset_request ();

    else if ((addr & 0xffff) == 4 && val == 42)

        qemu_system_shutdown_request ();

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...)

 {
+
     va_list ap;

void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...)

{

    va_list ap;

    va_start(ap, fmt);

    error_setv(errp, err_class, fmt, ap);

    va_end(ap);

}


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

     if (ret >= 0 && !(WIFEXITED(ret) && WEXITSTATUS(ret) == 0)) {

+        /* close succeeded, but non-zero exit code: */
+
+        ret = -EIO; /* fake errno value */
+
+    }

     return ret;

static int exec_close(MigrationState *s)

{

    int ret = 0;

    DPRINTF("exec_close\n");

    ret = qemu_fclose(s->opaque);

    s->opaque = NULL;

    s->fd = -1;

    if (ret >= 0 && !(WIFEXITED(ret) && WEXITSTATUS(ret) == 0)) {

        /* close succeeded, but non-zero exit code: */

        ret = -EIO; /* fake errno value */

    }

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
     case GPDR:		/* GPIO Pin-Direction registers */
         return s->dir[bank];
     case GRER:		/* GPIO Rising-Edge Detect Enable registers */
+        return s->rising[bank];
+    case GFER:		/* GPIO Falling-Edge Detect Enable registers */
+        return s->falling[bank];
+    case GAFR_L:	/* GPIO Alternate Function registers */
+        return s->gafr[bank * 2];
     case GAFR_U:	/* GPIO Alternate Function registers */
         return s->gafr[bank * 2 + 1];
     case GPLR:		/* GPIO Pin-Level registers */

static uint32_t pxa2xx_gpio_read(void *opaque, target_phys_addr_t offset)
{
    struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque;
    uint32_t ret;
    int bank;
    offset -= s->base;
    if (offset >= 0x200)
        return 0;
    bank = pxa2xx_gpio_regs[offset].bank;
    switch (pxa2xx_gpio_regs[offset].reg) {
    case GPDR:		/* GPIO Pin-Direction registers */
        return s->dir[bank];
    case GRER:		/* GPIO Rising-Edge Detect Enable registers */
        return s->rising[bank];
    case GFER:		/* GPIO Falling-Edge Detect Enable registers */
        return s->falling[bank];
    case GAFR_L:	/* GPIO Alternate Function registers */
        return s->gafr[bank * 2];
    case GAFR_U:	/* GPIO Alternate Function registers */
        return s->gafr[bank * 2 + 1];
    case GPLR:		/* GPIO Pin-Level registers */
        ret = (s->olevel[bank] & s->dir[bank]) |
                (s->ilevel[bank] & ~s->dir[bank]);
        if (s->read_notify)
            s->read_notify(s->opaque);
        return ret;
    case GEDR:		/* GPIO Edge Detect Status registers */
        return s->status[bank];
    default:
        cpu_abort(cpu_single_env,
                "%s: Bad offset " REG_FMT "\n", __FUNCTION__, offset);
    }
    return 0;
}


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

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

         g_free(migration_bitmap);

static void migration_end(void)

{

    if (migration_bitmap) {

        memory_global_dirty_log_stop();

        g_free(migration_bitmap);

        migration_bitmap = NULL;

    }

    if (XBZRLE.cache) {

        cache_fini(XBZRLE.cache);

        g_free(XBZRLE.cache);

        g_free(XBZRLE.encoded_buf);

        g_free(XBZRLE.current_buf);

        g_free(XBZRLE.decoded_buf);

        XBZRLE.cache = NULL;

    }

}


void helper_ldl_data(uint64_t t0, uint64_t t1)

{

    ldl_data(t1, t0);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+static bool check_irqchip_in_kernel(void)

+{

+    if (kvm_irqchip_in_kernel()) {
+
         return true;

     }

static bool check_irqchip_in_kernel(void)

{

    if (kvm_irqchip_in_kernel()) {

        return true;

    }

    error_report("pci-assign: error: requires KVM with in-kernel irqchip "

                 "enabled");

    return false;

}


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

     Visitor *v;

+
+
+    v = validate_test_init(data, "{ 'string': 'c', 'integer': 41, 'boolean': true }");
+
+

     visit_type_UserDefFlatUnion(v, &tmp, NULL, &err);

static void test_validate_fail_union_flat(TestInputVisitorData *data,

                                          const void *unused)

{

    UserDefFlatUnion *tmp = NULL;

    Error *err = NULL;

    Visitor *v;

    v = validate_test_init(data, "{ 'string': 'c', 'integer': 41, 'boolean': true }");

    visit_type_UserDefFlatUnion(v, &tmp, NULL, &err);

    g_assert(err);

    qapi_free_UserDefFlatUnion(tmp);

}


INLINE flag extractFloat32Sign( float32 a )

{

    return a>>31;

}


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

 {

+    NvmeDeleteQ *c = (NvmeDeleteQ *)cmd;

     NvmeCQueue *cq;

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

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

{

    NvmeDeleteQ *c = (NvmeDeleteQ *)cmd;

    NvmeCQueue *cq;

    uint16_t qid = le16_to_cpu(c->qid);

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

        return NVME_INVALID_CQID | NVME_DNR;

    }

    cq = n->cq[qid];

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

        return NVME_INVALID_QUEUE_DEL;

    }

    nvme_free_cq(cq, n);

    return NVME_SUCCESS;

}


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

     int i, ret, default_stream_exists = 0;

+
+
+    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, avio_tell(pb));
+
+    if (ret < 0)

         return ret;

static int mkv_write_tracks(AVFormatContext *s)

{

    MatroskaMuxContext *mkv = s->priv_data;

    AVIOContext *dyn_cp, *pb = s->pb;

    ebml_master tracks;

    int i, ret, default_stream_exists = 0;

    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, avio_tell(pb));

    if (ret < 0)

        return ret;

    ret = start_ebml_master_crc32(pb, &dyn_cp, &tracks, MATROSKA_ID_TRACKS, 0);

    if (ret < 0)

        return ret;

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

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

        default_stream_exists |= st->disposition & AV_DISPOSITION_DEFAULT;

    }

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

        ret = mkv_write_track(s, mkv, i, dyn_cp, default_stream_exists);

        if (ret < 0)

            return ret;

    }

    end_ebml_master_crc32(pb, &dyn_cp, mkv, tracks);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
 	cris_cc_mask(dc, CC_MASK_NZ);

 	l0 = tcg_temp_local_new(TCG_TYPE_TL);
+
+	dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, l0);
+
+	cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], cpu_R[dc->op2], l0, 4);
+
 	tcg_temp_free(l0);

 	return 2;

static unsigned int dec_bound_r(DisasContext *dc)

{

	TCGv l0;

	int size = memsize_zz(dc);

	DIS(fprintf (logfile, "bound.%c $r%u, $r%u\n",

		    memsize_char(size), dc->op1, dc->op2));

	cris_cc_mask(dc, CC_MASK_NZ);

	l0 = tcg_temp_local_new(TCG_TYPE_TL);

	dec_prep_move_r(dc, dc->op1, dc->op2, size, 0, l0);

	cris_alu(dc, CC_OP_BOUND, cpu_R[dc->op2], cpu_R[dc->op2], l0, 4);

	tcg_temp_free(l0);

	return 2;

}


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

     error_free(err);

+
+
+    /*
+
+     * cmdline-parsing via qemu_opts_parse() results in a QemuOpts entry

      * corresponding to the Object's ID to be added to the QemuOptsList

static void test_dummy_createcmdl(void)

{

    QemuOpts *opts;

    DummyObject *dobj;

    Error *err = NULL;

    const char *params = TYPE_DUMMY \

                         ",id=dev0," \

                         "bv=yes,sv=Hiss hiss hiss,av=platypus";

    qemu_add_opts(&qemu_object_opts);

    opts = qemu_opts_parse(&qemu_object_opts, params, true, &err);

    g_assert(err == NULL);

    g_assert(opts);

    dobj = DUMMY_OBJECT(user_creatable_add_opts(opts, &err));

    g_assert(err == NULL);

    g_assert(dobj);

    g_assert_cmpstr(dobj->sv, ==, "Hiss hiss hiss");

    g_assert(dobj->bv == true);

    g_assert(dobj->av == DUMMY_PLATYPUS);

    user_creatable_del("dev0", &err);

    g_assert(err == NULL);

    error_free(err);

    /*

     * cmdline-parsing via qemu_opts_parse() results in a QemuOpts entry

     * corresponding to the Object's ID to be added to the QemuOptsList

     * for objects. To avoid having this entry conflict with future

     * Objects using the same ID (which can happen in cases where

     * qemu_opts_parse() is used to parse the object params, such as

     * with hmp_object_add() at the time of this comment), we need to

     * check for this in user_creatable_del() and remove the QemuOpts if

     * it is present.

     *

     * FIXME: add an assert to verify that the QemuOpts is cleaned up

     * once the corresponding cleanup code is added.

     */

}


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

                                         omap_clk clk)
+
 {

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

static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory,

                                        hwaddr base,

                                        omap_clk clk)

{

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

    omap_pwl_reset(s);

    memory_region_init_io(&s->iomem, NULL, &omap_pwl_ops, s,

                          "omap-pwl", 0x800);

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

    omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+static void ebus_mmio_mapfunc(PCIDevice *pci_dev, int region_num,
+
+                              pcibus_t addr, pcibus_t size, int type)
+
+{
+
     EBUS_DPRINTF("Mapping region %d registers at %" FMT_PCIBUS "\n",

                  region_num, addr);

static void ebus_mmio_mapfunc(PCIDevice *pci_dev, int region_num,

                              pcibus_t addr, pcibus_t size, int type)

{

    EBUS_DPRINTF("Mapping region %d registers at %" FMT_PCIBUS "\n",

                 region_num, addr);

    switch (region_num) {

    case 0:

        isa_mmio_init(addr, 0x1000000);

        break;

    case 1:

        isa_mmio_init(addr, 0x800000);

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static const char *rpath(FsContext *ctx, const char *path)

+{
+
+    /* FIXME: so wrong... */

     static char buffer[4096];

static const char *rpath(FsContext *ctx, const char *path)

{

    /* FIXME: so wrong... */

    static char buffer[4096];

    snprintf(buffer, sizeof(buffer), "%s/%s", ctx->fs_root, path);

    return buffer;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 virtio_gpu_resource_attach_backing(VirtIOGPU *g,
                                    struct virtio_gpu_ctrl_command *cmd)
 {
+    struct virtio_gpu_simple_resource *res;
+    struct virtio_gpu_resource_attach_backing ab;
+    int ret;
+    VIRTIO_GPU_FILL_CMD(ab);
     trace_virtio_gpu_cmd_res_back_attach(ab.resource_id);
     res = virtio_gpu_find_resource(g, ab.resource_id);
     if (!res) {

virtio_gpu_resource_attach_backing(VirtIOGPU *g,
                                   struct virtio_gpu_ctrl_command *cmd)
{
    struct virtio_gpu_simple_resource *res;
    struct virtio_gpu_resource_attach_backing ab;
    int ret;
    VIRTIO_GPU_FILL_CMD(ab);
    trace_virtio_gpu_cmd_res_back_attach(ab.resource_id);
    res = virtio_gpu_find_resource(g, ab.resource_id);
    if (!res) {
        qemu_log_mask(LOG_GUEST_ERROR, "%s: illegal resource specified %d\n",
                      __func__, ab.resource_id);
        cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
    ret = virtio_gpu_create_mapping_iov(&ab, cmd, &res->addrs, &res->iov);
    if (ret != 0) {
    res->iov_cnt = ab.nr_entries;


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset)
+
 {

     if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {

static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset)

{

    if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {

        char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20];

        strcpy(pri_ip_src, inet_ntoa(ppkt->ip->ip_src));

        strcpy(pri_ip_dst, inet_ntoa(ppkt->ip->ip_dst));

        strcpy(sec_ip_src, inet_ntoa(spkt->ip->ip_src));

        strcpy(sec_ip_dst, inet_ntoa(spkt->ip->ip_dst));

        trace_colo_compare_ip_info(ppkt->size, pri_ip_src,

                                   pri_ip_dst, spkt->size,

                                   sec_ip_src, sec_ip_dst);

    }

    offset = ppkt->vnet_hdr_len + offset;

    if (ppkt->size == spkt->size) {

        return memcmp(ppkt->data + offset,

                      spkt->data + offset,

                      spkt->size - offset);

    } else {

        trace_colo_compare_main("Net packet size are not the same");

        return -1;

    }

}


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

     PCNetState *d = opaque;
+
+
+
+    if (addr < 16 && size == 1) {
+
         return pcnet_aprom_readb(d, addr);

     } else if (addr >= 0x10 && addr < 0x20 && size == 2) {

static uint64_t pcnet_ioport_read(void *opaque, target_phys_addr_t addr,

                                  unsigned size)

{

    PCNetState *d = opaque;

    if (addr < 16 && size == 1) {

        return pcnet_aprom_readb(d, addr);

    } else if (addr >= 0x10 && addr < 0x20 && size == 2) {

        return pcnet_ioport_readw(d, addr);

    } else if (addr >= 0x10 && addr < 0x20 && size == 4) {

        return pcnet_ioport_readl(d, addr);

    }

    return ((uint64_t)1 << (size * 8)) - 1;

}


--- a/source.c
+++ b/source.c
@@ -5,10 +5,10 @@
     addr &= ~(dcache_line_size - 1);

     int i;
+
+    for (i = 0 ; i < dcache_line_size ; i += 4) {
+
+        stl(addr + i , 0);

     }

static void do_dcbz(target_ulong addr, int dcache_line_size)

{

    addr &= ~(dcache_line_size - 1);

    int i;

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

        stl(addr + i , 0);

    }

    if (env->reserve == addr)

        env->reserve = (target_ulong)-1ULL;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void gen_check_sr(DisasContext *dc, uint32_t sr)

 {

static void gen_check_sr(DisasContext *dc, uint32_t sr)

{

    if (!xtensa_option_bits_enabled(dc->config, sregnames[sr].opt_bits)) {

        if (sregnames[sr].name) {

            qemu_log("SR %s is not configured\n", sregnames[sr].name);

        } else {

            qemu_log("SR %d is not implemented\n", sr);

        }

        gen_exception_cause(dc, ILLEGAL_INSTRUCTION_CAUSE);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,23 +1,23 @@
 static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,

+                              char *buf, size_t bufsz)
+
 {

+    ssize_t tsize = -1;
+
+    char *buffer;

     char *path = fs_path->data;

     if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||
+
         (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {

         int fd;
+
         buffer = rpath(fs_ctx, path);

         fd = open(buffer, O_RDONLY | O_NOFOLLOW);

static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,

                              char *buf, size_t bufsz)

{

    ssize_t tsize = -1;

    char *buffer;

    char *path = fs_path->data;

    if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||

        (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {

        int fd;

        buffer = rpath(fs_ctx, path);

        fd = open(buffer, O_RDONLY | O_NOFOLLOW);

        g_free(buffer);

        if (fd == -1) {

            return -1;

        }

        do {

            tsize = read(fd, (void *)buf, bufsz);

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

        close(fd);

    } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||

               (fs_ctx->export_flags & V9FS_SM_NONE)) {

        buffer = rpath(fs_ctx, path);

        tsize = readlink(buffer, buf, bufsz);

        g_free(buffer);

    }

    return tsize;

}


--- a/source.c
+++ b/source.c
@@ -6,11 +6,11 @@
         int fd;
         if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)) ||
             cmsg->cmsg_level != SOL_SOCKET ||
+            cmsg->cmsg_type != SCM_RIGHTS)
+            continue;
+        fd = *((int *)CMSG_DATA(cmsg));
+        if (fd < 0)
+            continue;
 #ifndef MSG_CMSG_CLOEXEC
         qemu_set_cloexec(fd);
 #endif

static void unix_process_msgfd(CharDriverState *chr, struct msghdr *msg)
{
    TCPCharDriver *s = chr->opaque;
    struct cmsghdr *cmsg;
    for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
        int fd;
        if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)) ||
            cmsg->cmsg_level != SOL_SOCKET ||
            cmsg->cmsg_type != SCM_RIGHTS)
            continue;
        fd = *((int *)CMSG_DATA(cmsg));
        if (fd < 0)
            continue;
#ifndef MSG_CMSG_CLOEXEC
        qemu_set_cloexec(fd);
#endif
        if (s->msgfd != -1)
            close(s->msgfd);
        s->msgfd = fd;
    }
}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
                                 uint32_t nargs, target_ulong args,

                                 uint32_t nret, target_ulong rets)
+
+{
+
+    VIOsPAPRBus *bus = spapr->vio_bus;
+
     VIOsPAPRDevice *dev;

     uint32_t unit, enable;

static void rtas_set_tce_bypass(PowerPCCPU *cpu, sPAPREnvironment *spapr,

                                uint32_t token,

                                uint32_t nargs, target_ulong args,

                                uint32_t nret, target_ulong rets)

{

    VIOsPAPRBus *bus = spapr->vio_bus;

    VIOsPAPRDevice *dev;

    uint32_t unit, enable;

    if (nargs != 2) {

        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);

        return;

    }

    unit = rtas_ld(args, 0);

    enable = rtas_ld(args, 1);

    dev = spapr_vio_find_by_reg(bus, unit);

    if (!dev) {

        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);

        return;

    }

    if (!dev->tcet) {

        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);

        return;

    }

    spapr_tce_set_bypass(dev->tcet, !!enable);

    rtas_st(rets, 0, RTAS_OUT_SUCCESS);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline void iwmmxt_store_reg(TCGv var, int reg)

 {

static inline void iwmmxt_store_reg(TCGv var, int reg)

{

    tcg_gen_st_i64(var, cpu_env, offsetof(CPUState, iwmmxt.regs[reg]));

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)

 {
+
     SRTContext *srt = avf->priv_data;

     int write_ts = avf->streams[0]->codec->codec_id != AV_CODEC_ID_SRT;

+
+
     srt->index++;

     if (write_ts) {

static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)

{

    SRTContext *srt = avf->priv_data;

    int write_ts = avf->streams[0]->codec->codec_id != AV_CODEC_ID_SRT;

    srt->index++;

    if (write_ts) {

        int64_t s = pkt->pts, e, d = pkt->duration;

        if (d <= 0)

            /* For backward compatibility, fallback to convergence_duration. */

            d = pkt->convergence_duration;

        if (s == AV_NOPTS_VALUE || d < 0) {

            av_log(avf, AV_LOG_ERROR, "Insufficient timestamps.\n");

            return AVERROR(EINVAL);

        }

        e = s + d;

        avio_printf(avf->pb, "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n",

                       srt->index,

                       (int)(s / 3600000),      (int)(s / 60000) % 60,

                       (int)(s /    1000) % 60, (int)(s %  1000),

                       (int)(e / 3600000),      (int)(e / 60000) % 60,

                       (int)(e /    1000) % 60, (int)(e %  1000));

    }

    avio_write(avf->pb, pkt->data, pkt->size);

    if (write_ts)

        avio_write(avf->pb, "\n\n", 2);

    avio_flush(avf->pb);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@
     dnxhd_load_picture(ctx, data);
  encode_coding_unit:
     for (i = 0; i < 3; i++) {
+        ctx->src[i] = ctx->frame.data[i];
+        if (ctx->interlaced && ctx->cur_field)
+            ctx->src[i] += ctx->frame.linesize[i];
+    }
+    dnxhd_write_header(avctx, buf);
     if (avctx->mb_decision == FF_MB_DECISION_RD)
         ret = dnxhd_encode_rdo(avctx, ctx);
     else

static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
{
    DNXHDEncContext *ctx = avctx->priv_data;
    int first_field = 1;
    int offset, i, ret;
    if (buf_size < ctx->cid_table->frame_size) {
        av_log(avctx, AV_LOG_ERROR, "output buffer is too small to compress picture\n");
        return -1;
    }
    dnxhd_load_picture(ctx, data);
 encode_coding_unit:
    for (i = 0; i < 3; i++) {
        ctx->src[i] = ctx->frame.data[i];
        if (ctx->interlaced && ctx->cur_field)
            ctx->src[i] += ctx->frame.linesize[i];
    }
    dnxhd_write_header(avctx, buf);
    if (avctx->mb_decision == FF_MB_DECISION_RD)
        ret = dnxhd_encode_rdo(avctx, ctx);
    else
        ret = dnxhd_encode_fast(avctx, ctx);
    if (ret < 0) {
        av_log(avctx, AV_LOG_ERROR, "picture could not fit ratecontrol constraints\n");
        return -1;
    }
    dnxhd_setup_threads_slices(ctx, buf);
    offset = 0;
    for (i = 0; i < ctx->m.mb_height; i++) {
        AV_WB32(ctx->msip + i * 4, offset);
        offset += ctx->slice_size[i];
        assert(!(ctx->slice_size[i] & 3));
    }
    avctx->execute(avctx, dnxhd_encode_thread, (void**)&ctx->thread[0], NULL, avctx->thread_count, sizeof(void*));
    AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF
    if (ctx->interlaced && first_field) {
        first_field     = 0;
        ctx->cur_field ^= 1;
        buf      += ctx->cid_table->coding_unit_size;
        buf_size -= ctx->cid_table->coding_unit_size;
        goto encode_coding_unit;
    }
    ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA;
    return ctx->cid_table->frame_size;
}


static void opt_frame_aspect_ratio(const char *arg)

{

    int x = 0, y = 0;

    double ar = 0;

    const char *p;

    char *end;

    p = strchr(arg, ':');

    if (p) {

        x = strtol(arg, &end, 10);

        if (end == p)

            y = strtol(end+1, &end, 10);

        if (x > 0 && y > 0)

            ar = (double)x / (double)y;

    } else

        ar = strtod(arg, NULL);

    if (!ar) {

        fprintf(stderr, "Incorrect aspect ratio specification.\n");

        ffmpeg_exit(1);

    }

    frame_aspect_ratio = ar;

    x = vfilters ? strlen(vfilters) : 0;

    vfilters = av_realloc(vfilters, x+100);

    snprintf(vfilters+x, x+100, "%csetdar=%f\n", x?',':' ', ar);

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@
         if (den && num) {
             pkt->duration = av_rescale(1, num * (int64_t)st->time_base.den * st->codec->ticks_per_frame, den * (int64_t)st->time_base.num);
     if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay == 0)
+        pkt->pts = pkt->dts;
+    //XXX/FIXME this is a temporary hack until all encoders output pts
+    if ((pkt->pts == 0 || pkt->pts == AV_NOPTS_VALUE) && pkt->dts == AV_NOPTS_VALUE && !delay) {
+        static int warned;
+        if (!warned) {
             av_log(s, AV_LOG_WARNING, "Encoder did not produce proper pts, making some up.\n");
             warned = 1;
         pkt->dts =

static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
{
    int delay = FFMAX(st->codec->has_b_frames, st->codec->max_b_frames > 0);
    int num, den, frame_size, i;
    av_dlog(s, "compute_pkt_fields2: pts:%s dts:%s cur_dts:%s b:%d size:%d st:%d\n",
            av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), delay, pkt->size, pkt->stream_index);
    /* duration field */
    if (pkt->duration == 0) {
        ff_compute_frame_duration(&num, &den, st, NULL, pkt);
        if (den && num) {
            pkt->duration = av_rescale(1, num * (int64_t)st->time_base.den * st->codec->ticks_per_frame, den * (int64_t)st->time_base.num);
    if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay == 0)
        pkt->pts = pkt->dts;
    //XXX/FIXME this is a temporary hack until all encoders output pts
    if ((pkt->pts == 0 || pkt->pts == AV_NOPTS_VALUE) && pkt->dts == AV_NOPTS_VALUE && !delay) {
        static int warned;
        if (!warned) {
            av_log(s, AV_LOG_WARNING, "Encoder did not produce proper pts, making some up.\n");
            warned = 1;
        pkt->dts =
//        pkt->pts= st->cur_dts;
            pkt->pts = st->pts.val;
    //calculate dts from pts
    if (pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
        st->pts_buffer[0] = pkt->pts;
        for (i = 1; i < delay + 1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++)
            st->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration;
        for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
            FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);
        pkt->dts = st->pts_buffer[0];
    if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
        ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
          st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {
        av_log(s, AV_LOG_ERROR,
               "Application provided invalid, non monotonically increasing dts to muxer in stream %d: %s >= %s\n",
               st->index, av_ts2str(st->cur_dts), av_ts2str(pkt->dts));
        return AVERROR(EINVAL);
    if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts) {
        av_log(s, AV_LOG_ERROR, "pts (%s) < dts (%s) in stream %d\n",
               av_ts2str(pkt->pts), av_ts2str(pkt->dts), st->index);
        return AVERROR(EINVAL);
    av_dlog(s, "av_write_frame: pts2:%s dts2:%s\n",
            av_ts2str(pkt->pts), av_ts2str(pkt->dts));
    st->cur_dts = pkt->dts;
    st->pts.val = pkt->dts;
    /* update pts */
    switch (st->codec->codec_type) {
    case AVMEDIA_TYPE_AUDIO:
        frame_size = (pkt->flags & AV_PKT_FLAG_UNCODED_FRAME) ?
                     ((AVFrame *)pkt->data)->nb_samples :
                     ff_get_audio_frame_size(st->codec, pkt->size, 1);
        /* HACK/FIXME, 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 */
        if (frame_size >= 0 && (pkt->size || st->pts.num != st->pts.den >> 1 || st->pts.val)) {
            frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
        break;
    case AVMEDIA_TYPE_VIDEO:
        frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
        break;
    default:
        break;
    return 0;


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         curval = stack[sp]->val;
     while (curval < threshold && sp >= 0) {
         if (curval < stack[sp]->val)
+            curval = stack[sp]->val;
+        while (curval < threshold) {
+            int ret;
+            if ((ret = get_bits(s, 1)) > 0) {
+                stack[sp]->vis++;
                 break;
             } else if (!ret)
                 curval++;

static int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node,
                           int threshold)
{
    Jpeg2000TgtNode *stack[30];
    int sp = -1, curval = 0;
    while (node && !node->vis) {
        stack[++sp] = node;
        node        = node->parent;
    }
    if (node)
        curval = node->val;
    else
        curval = stack[sp]->val;
    while (curval < threshold && sp >= 0) {
        if (curval < stack[sp]->val)
            curval = stack[sp]->val;
        while (curval < threshold) {
            int ret;
            if ((ret = get_bits(s, 1)) > 0) {
                stack[sp]->vis++;
                break;
            } else if (!ret)
                curval++;
            else
                return ret;
        }
        stack[sp]->val = curval;
        sp--;
    }
    return curval;
}


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

                     target_ulong alignment)

+{

     if ((VLAN_BD_ADDR(bd) % alignment)
+
         || (VLAN_BD_LEN(bd) % alignment)) {

         return -1;

static int check_bd(VIOsPAPRVLANDevice *dev, vlan_bd_t bd,

                    target_ulong alignment)

{

    if ((VLAN_BD_ADDR(bd) % alignment)

        || (VLAN_BD_LEN(bd) % alignment)) {

        return -1;

    }

    if (spapr_vio_check_tces(&dev->sdev, VLAN_BD_ADDR(bd),

                             VLAN_BD_LEN(bd), SPAPR_TCE_RW) != 0) {

        return -1;

    }

    return 0;

}


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

 {

+    long shift;

     int index;

static void spapr_reset_htab(sPAPRMachineState *spapr)

{

    long shift;

    int index;

    shift = kvmppc_reset_htab(spapr->htab_shift);

    if (shift > 0) {

        if (shift != spapr->htab_shift) {

            error_setg(&error_abort, "Requested HTAB allocation failed during reset");

        }

        /* Tell readers to update their file descriptor */

        if (spapr->htab_fd >= 0) {

            spapr->htab_fd_stale = true;

        }

    } else {

        memset(spapr->htab, 0, HTAB_SIZE(spapr));

        for (index = 0; index < HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; index++) {

            DIRTY_HPTE(HPTE(spapr->htab, index));

        }

    }

    /* Update the RMA size if necessary */

    if (spapr->vrma_adjust) {

        spapr->rma_size = kvmppc_rma_size(spapr_node0_size(),

                                          spapr->htab_shift);

    }

}


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

+
     if (s->max_size == 0) {

         return TRUE;

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

{

    CharDriverState *chr = opaque;

    NetCharDriver *s = chr->opaque;

    gsize bytes_read = 0;

    GIOStatus status;

    if (s->max_size == 0) {

        return TRUE;

    }

    status = g_io_channel_read_chars(s->chan, (gchar *)s->buf, sizeof(s->buf),

                                     &bytes_read, NULL);

    s->bufcnt = bytes_read;

    s->bufptr = s->bufcnt;

    if (status != G_IO_STATUS_NORMAL) {

        if (s->tag) {

            g_source_remove(s->tag);

            s->tag = 0;

        }

        return FALSE;

    }

    s->bufptr = 0;

    while (s->max_size > 0 && s->bufptr < s->bufcnt) {

        qemu_chr_be_write(chr, &s->buf[s->bufptr], 1);

        s->bufptr++;

        s->max_size = qemu_chr_be_can_write(chr);

    }

    return TRUE;

}


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

     TCGv tmp = new_tmp();

static void gen_op_iwmmxt_setpsr_nz(void)

{

    TCGv tmp = new_tmp();

    gen_helper_iwmmxt_setpsr_nz(tmp, cpu_M0);

    store_cpu_field(tmp, iwmmxt.cregs[ARM_IWMMXT_wCASF]);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void vnc_tight_start(VncState *vs)
+
+{

     buffer_reset(&vs->tight);

static void vnc_tight_start(VncState *vs)

{

    buffer_reset(&vs->tight);

    // make the output buffer be the zlib buffer, so we can compress it later

    vs->tight_tmp = vs->output;

    vs->output = vs->tight;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 uint32_t cpu_mips_get_count (CPUState *env)

 {
+
+    if (env->CP0_Cause & (1 << CP0Ca_DC)) {
+
+        return env->CP0_Count;

     } else {

uint32_t cpu_mips_get_count (CPUState *env)

{

    if (env->CP0_Cause & (1 << CP0Ca_DC)) {

        return env->CP0_Count;

    } else {

        return env->CP0_Count +

            (uint32_t)muldiv64(qemu_get_clock(vm_clock),

                               TIMER_FREQ, get_ticks_per_sec());

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int qemu_boot_set(const char *boot_order)
+
+{
+
     if (!boot_set_handler) {

         return -EINVAL;

int qemu_boot_set(const char *boot_order)

{

    if (!boot_set_handler) {

        return -EINVAL;

    }

    return boot_set_handler(boot_set_opaque, boot_order);

}


--- a/source.c
+++ b/source.c
@@ -5,10 +5,10 @@
     video_mb_qmax = atoi(arg);

     if (video_mb_qmax < 0 ||
+
+        video_mb_qmax > 31) {
+
+        fprintf(stderr, "qmax must be >= 1 and <= 31\n");

         exit(1);

static void opt_mb_qmax(const char *arg)

{

    video_mb_qmax = atoi(arg);

    if (video_mb_qmax < 0 ||

        video_mb_qmax > 31) {

        fprintf(stderr, "qmax must be >= 1 and <= 31\n");

        exit(1);

    }

}


static void lsp2polyf(const double *lsp, double *f, int lp_half_order)

{

    int i, j;

    f[0] = 1.0;

    f[1] = -2 * lsp[0];

    lsp -= 2;

    for(i=2; i<=lp_half_order; i++)

    {

        double val = -2 * lsp[2*i];

        f[i] = val * f[i-1] + 2*f[i-2];

        for(j=i-1; j>1; j--)

            f[j] += f[j-1] * val + f[j-2];

        f[1] += val;

    }

}


--- a/source.c
+++ b/source.c
@@ -4,11 +4,11 @@
 {
     VDPAUHWContext *hwctx = avctx->hwaccel_context;
     VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
+    VdpDecoderCreate *create;
+    void *func;
+    VdpStatus status;
+    /* See vdpau/vdpau.h for alignment constraints. */
+    uint32_t width  = (avctx->coded_width + 1) & ~1;
     uint32_t height = (avctx->coded_height + 3) & ~3;
     if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
         vdctx->decoder = hwctx->context.decoder;

MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2)
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
                         int level)
{
    VDPAUHWContext *hwctx = avctx->hwaccel_context;
    VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
    VdpDecoderCreate *create;
    void *func;
    VdpStatus status;
    /* See vdpau/vdpau.h for alignment constraints. */
    uint32_t width  = (avctx->coded_width + 1) & ~1;
    uint32_t height = (avctx->coded_height + 3) & ~3;
    if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
        vdctx->decoder = hwctx->context.decoder;
        vdctx->render  = hwctx->context.render;
        return 0; /* Decoder created by user */
    vdctx->device           = hwctx->device;
    vdctx->get_proc_address = hwctx->get_proc_address;
    status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE,
                                     &func);
    if (status != VDP_STATUS_OK)
        return vdpau_error(status);
    else
        create = func;
    status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER,
                                     &func);
    if (status != VDP_STATUS_OK)
        return vdpau_error(status);
    else
        vdctx->render = func;
    status = create(vdctx->device, profile, width, height, avctx->refs,
                    &vdctx->decoder);
    return vdpau_error(status);


uint64_t helper_fctiw(CPUPPCState *env, uint64_t arg)

{

    CPU_DoubleU farg;

    farg.ll = arg;

    if (unlikely(float64_is_signaling_nan(farg.d))) {

        /* sNaN conversion */

        farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN |

                                        POWERPC_EXCP_FP_VXCVI);

    } else if (unlikely(float64_is_quiet_nan(farg.d) ||

                        float64_is_infinity(farg.d))) {

        /* qNan / infinity conversion */

        farg.ll = fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI);

    } else {

        farg.ll = float64_to_int32(farg.d, &env->fp_status);

        /* XXX: higher bits are not supposed to be significant.

         *     to make tests easier, return the same as a real PowerPC 750

         */

        farg.ll |= 0xFFF80000ULL << 32;

    }

    return farg.ll;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static int send_extradata(APNGDemuxContext *ctx, AVPacket *pkt)
+
+{
+
+    if (!ctx->extra_data_updated) {
+
         uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, ctx->extra_data_size);
+
         if (!side_data)

             return AVERROR(ENOMEM);

static int send_extradata(APNGDemuxContext *ctx, AVPacket *pkt)

{

    if (!ctx->extra_data_updated) {

        uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, ctx->extra_data_size);

        if (!side_data)

            return AVERROR(ENOMEM);

        memcpy(side_data, ctx->extra_data, ctx->extra_data_size);

        ctx->extra_data_updated = 1;

    }

    return 0;

}


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

     } else {

+        if (addr == 0) {
+
+            if (s->read_reg_select) {
+
+                ret = s->isr;

             } else {

static uint64_t pic_ioport_read(void *opaque, target_phys_addr_t addr,

                                unsigned size)

{

    PICCommonState *s = opaque;

    int ret;

    if (s->poll) {

        ret = pic_get_irq(s);

        if (ret >= 0) {

            pic_intack(s, ret);

            ret |= 0x80;

        } else {

            ret = 0;

        }

        s->poll = 0;

    } else {

        if (addr == 0) {

            if (s->read_reg_select) {

                ret = s->isr;

            } else {

                ret = s->irr;

            }

        } else {

            ret = s->imr;

        }

    }

    DPRINTF("read: addr=0x%02x val=0x%02x\n", addr, ret);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
         L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1,

                                             width - 1, buf[0]);
+
+        return;
+
+    } else if (line == 1) {
+
         /* Second line, left predict first pixel, the rest of the line is median predicted

          * NOTE: In the case of RGB this pixel is top predicted */

static void lag_pred_line(LagarithContext *l, uint8_t *buf,

                          int width, int stride, int line)

{

    int L, TL;

    /* Left pixel is actually prev_row[width] */

    L = buf[width - stride - 1];

    if (!line) {

        /* Left prediction only for first line */

        L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1,

                                            width - 1, buf[0]);

        return;

    } else if (line == 1) {

        /* Second line, left predict first pixel, the rest of the line is median predicted

         * NOTE: In the case of RGB this pixel is top predicted */

        TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L;

    } else {

        /* Top left is 2 rows back, last pixel */

        TL = buf[width - (2 * stride) - 1];

    }

    add_lag_median_prediction(buf, buf - stride, buf,

                              width, &L, &TL);

}


--- a/source.c
+++ b/source.c
@@ -5,7 +5,7 @@
     VFIOQuirk *quirk;

     VFIOrtl8168Quirk *rtl;
+

     if (!vfio_pci_is(vdev, PCI_VENDOR_ID_REALTEK, 0x8168) || nr != 2) {

static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr)

{

    VFIOQuirk *quirk;

    VFIOrtl8168Quirk *rtl;

    if (!vfio_pci_is(vdev, PCI_VENDOR_ID_REALTEK, 0x8168) || nr != 2) {

        return;

    }

    quirk = g_malloc0(sizeof(*quirk));

    quirk->mem = g_malloc0(sizeof(MemoryRegion) * 2);

    quirk->nr_mem = 2;

    quirk->data = rtl = g_malloc0(sizeof(*rtl));

    rtl->vdev = vdev;

    memory_region_init_io(&quirk->mem[0], OBJECT(vdev),

                          &vfio_rtl_address_quirk, rtl,

                          "vfio-rtl8168-window-address-quirk", 4);

    memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem,

                                        0x74, &quirk->mem[0], 1);

    memory_region_init_io(&quirk->mem[1], OBJECT(vdev),

                          &vfio_rtl_data_quirk, rtl,

                          "vfio-rtl8168-window-data-quirk", 4);

    memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem,

                                        0x70, &quirk->mem[1], 1);

    QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);

    trace_vfio_quirk_rtl8168_probe(vdev->vbasedev.name);

}


--- a/source.c
+++ b/source.c
@@ -3,8 +3,8 @@
                                     int len)

 {
+
+    while (len-- >= 0)

         mant_cnt[bap[len]]++;

static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap,

                                    int len)

{

    while (len-- >= 0)

        mant_cnt[bap[len]]++;

}


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

                          unsigned int uid, ebml_master *tags)

+{
+
+    MatroskaMuxContext *mkv = s->priv_data;
+
+    ebml_master tag, targets;

     AVDictionaryEntry *t = NULL;

static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int elementid,

                         unsigned int uid, ebml_master *tags)

{

    MatroskaMuxContext *mkv = s->priv_data;

    ebml_master tag, targets;

    AVDictionaryEntry *t = NULL;

    int ret;

    if (!tags->pos) {

        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_tell(s->pb));

        if (ret < 0) return ret;

        *tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0);

    }

    tag     = start_ebml_master(s->pb, MATROSKA_ID_TAG,        0);

    targets = start_ebml_master(s->pb, MATROSKA_ID_TAGTARGETS, 0);

    if (elementid)

        put_ebml_uint(s->pb, elementid, uid);

    end_ebml_master(s->pb, targets);

    while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))

        if (av_strcasecmp(t->key, "title") &&

            av_strcasecmp(t->key, "encoding_tool"))

            mkv_write_simpletag(s->pb, t);

    end_ebml_master(s->pb, tag);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){

+    int      temp[16];

     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;

@@ -9,10 +9,10 @@

     rv34_row_transform(temp, block);
+
+    memset(block, 0, 16*sizeof(DCTELEM));
+
+

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

static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){

    int      temp[16];

    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;

    int      i;

    rv34_row_transform(temp, block);

    memset(block, 0, 16*sizeof(DCTELEM));

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

        const int z0 = 13*(temp[4*0+i] +    temp[4*2+i]) + 0x200;

        const int z1 = 13*(temp[4*0+i] -    temp[4*2+i]) + 0x200;

        const int z2 =  7* temp[4*1+i] - 17*temp[4*3+i];

        const int z3 = 17* temp[4*1+i] +  7*temp[4*3+i];

        dst[0] = cm[ dst[0] + ( (z0 + z3) >> 10 ) ];

        dst[1] = cm[ dst[1] + ( (z1 + z2) >> 10 ) ];

        dst[2] = cm[ dst[2] + ( (z1 - z2) >> 10 ) ];

        dst[3] = cm[ dst[3] + ( (z0 - z3) >> 10 ) ];

        dst  += stride;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)

+{
+
+    VideoState *is = opaque;
+
+    int audio_size, len1;

     int bytes_per_sec;

static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)

{

    VideoState *is = opaque;

    int audio_size, len1;

    int bytes_per_sec;

    int frame_size = av_samples_get_buffer_size(NULL, is->audio_tgt.channels, 1, is->audio_tgt.fmt, 1);

    double pts;

    audio_callback_time = av_gettime();

    while (len > 0) {

        if (is->audio_buf_index >= is->audio_buf_size) {

           audio_size = audio_decode_frame(is, &pts);

           if (audio_size < 0) {

                /* if error, just output silence */

               is->audio_buf      = is->silence_buf;

               is->audio_buf_size = sizeof(is->silence_buf) / frame_size * frame_size;

           } else {

               if (is->show_mode != SHOW_MODE_VIDEO)

                   update_sample_display(is, (int16_t *)is->audio_buf, audio_size);

               is->audio_buf_size = audio_size;

           }

           is->audio_buf_index = 0;

        }

        len1 = is->audio_buf_size - is->audio_buf_index;

        if (len1 > len)

            len1 = len;

        memcpy(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1);

        len -= len1;

        stream += len1;

        is->audio_buf_index += len1;

    }

    bytes_per_sec = is->audio_tgt.freq * is->audio_tgt.channels * av_get_bytes_per_sample(is->audio_tgt.fmt);

    is->audio_write_buf_size = is->audio_buf_size - is->audio_buf_index;

    /* Let's assume the audio driver that is used by SDL has two periods. */

    is->audio_current_pts = is->audio_clock - (double)(2 * is->audio_hw_buf_size + is->audio_write_buf_size) / bytes_per_sec;

    is->audio_current_pts_drift = is->audio_current_pts - audio_callback_time / 1000000.0;

    check_external_clock_sync(is, is->audio_current_pts);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int cris_mmu_enabled(uint32_t rw_gc_cfg)

 {
+
 	return (rw_gc_cfg & 12) != 0;

 }

static int cris_mmu_enabled(uint32_t rw_gc_cfg)

{

	return (rw_gc_cfg & 12) != 0;

}


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

     return block_mig_state.blk_enable == 1;

static bool block_is_active(void *opaque)

{

    return block_mig_state.blk_enable == 1;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,

+                                         FsCred *credp)
+
 {

     char buffer[PATH_MAX];

static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,

                                         FsCred *credp)

{

    char buffer[PATH_MAX];

    if (chmod(rpath(fs_ctx, path, buffer), credp->fc_mode & 07777) < 0) {

        return -1;

    }

    if (lchown(rpath(fs_ctx, path, buffer), credp->fc_uid,

                credp->fc_gid) < 0) {

        /*

         * If we fail to change ownership and if we are

         * using security model none. Ignore the error

         */

        if ((fs_ctx->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) {

            return -1;

        }

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -21,9 +21,9 @@
         exit(EXIT_SUCCESS);

     }
+
+
+
     if (pidfile) {

         if (!ga_open_pidfile(pidfile)) {

static void become_daemon(const char *pidfile)

{

#ifndef _WIN32

    pid_t pid, sid;

    pid = fork();

    if (pid < 0) {

        exit(EXIT_FAILURE);

    }

    if (pid > 0) {

        exit(EXIT_SUCCESS);

    }

    if (pidfile) {

        if (!ga_open_pidfile(pidfile)) {

            g_critical("failed to create pidfile");

            exit(EXIT_FAILURE);

        }

    }

    umask(0);

    sid = setsid();

    if (sid < 0) {

        goto fail;

    }

    if ((chdir("/")) < 0) {

        goto fail;

    }

    close(STDIN_FILENO);

    close(STDOUT_FILENO);

    close(STDERR_FILENO);

    return;

fail:

    unlink(pidfile);

    g_critical("failed to daemonize");

    exit(EXIT_FAILURE);

#endif

}


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

 {

+    QemuUUID expected, measured;

     gchar *cmd;

static void vmgenid_set_guid_test(void)

{

    QemuUUID expected, measured;

    gchar *cmd;

    g_assert(qemu_uuid_parse(VGID_GUID, &expected) == 0);

    cmd = g_strdup_printf("-machine accel=tcg -device vmgenid,id=testvgid,"

                          "guid=%s", VGID_GUID);

    qtest_start(cmd);

    /* Read the GUID from accessing guest memory */

    read_guid_from_memory(&measured);

    g_assert(memcmp(measured.data, expected.data, sizeof(measured.data)) == 0);

    qtest_quit(global_qtest);

    g_free(cmd);

}


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

     c->dir = opendir(h->filename);

+    if (!c->dir)
+
+        return AVERROR(errno);
+
+

     return 0;

static int file_open_dir(URLContext *h)

{

#if HAVE_DIRENT_H

    FileContext *c = h->priv_data;

    c->dir = opendir(h->filename);

    if (!c->dir)

        return AVERROR(errno);

    return 0;

#else

    return AVERROR(ENOSYS);

#endif /* HAVE_DIRENT_H */

}


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

     default:
+
+        error_setg(errp, "socket type unsupported for datagram");
+
+        fd = -1;
+
     }

     return fd;

int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)

{

    int fd;

    switch (remote->type) {

    case SOCKET_ADDRESS_KIND_INET:

        fd = inet_dgram_saddr(remote->u.inet, local ? local->u.inet : NULL, errp);

        break;

    default:

        error_setg(errp, "socket type unsupported for datagram");

        fd = -1;

    }

    return fd;

}


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

     if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003))

void OPPROTO op_check_reservation_64 (void)

{

    if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003))

        env->reserve = -1;

    RETURN();

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+void usb_packet_setup(USBPacket *p, int pid, uint8_t addr, uint8_t ep)
+
+{
+
     assert(!usb_packet_is_inflight(p));

     p->state = USB_PACKET_SETUP;

void usb_packet_setup(USBPacket *p, int pid, uint8_t addr, uint8_t ep)

{

    assert(!usb_packet_is_inflight(p));

    p->state = USB_PACKET_SETUP;

    p->pid = pid;

    p->devaddr = addr;

    p->devep = ep;

    p->result = 0;

    qemu_iovec_reset(&p->iov);

}


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

     ASS *ass = &ctx->ass;
+
     int i;

ASSStyle *ff_ass_style_get(ASSSplitContext *ctx, const char *style)

{

    ASS *ass = &ctx->ass;

    int i;

    if (!style || !*style)

        style = "Default";

    for (i=0; i<ass->styles_count; i++)

        if (!strcmp(ass->styles[i].name, style))

            return ass->styles + i;

    return NULL;

}


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

 #if defined(_VNC_DEBUG) && _VNC_DEBUG >= 2
+
+    gnutls_global_set_log_level(10);
+
+    gnutls_global_set_log_function(vnc_debug_gnutls_log);
+
 #endif

static int vnc_tls_initialize(void)

{

    static int tlsinitialized = 0;

    if (tlsinitialized)

	return 1;

    if (gnutls_global_init () < 0)

	return 0;

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

    if (gnutls_dh_params_init (&dh_params) < 0)

	return 0;

    if (gnutls_dh_params_generate2 (dh_params, DH_BITS) < 0)

	return 0;

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

    gnutls_global_set_log_level(10);

    gnutls_global_set_log_function(vnc_debug_gnutls_log);

#endif

    tlsinitialized = 1;

    return 1;

}


static target_ulong helper_sdiv_common(CPUSPARCState *env, target_ulong a,

                                       target_ulong b, int cc)

{

    SPARCCPU *cpu = sparc_env_get_cpu(env);

    int overflow = 0;

    int64_t x0;

    int32_t x1;

    x0 = (a & 0xffffffff) | ((int64_t) (env->y) << 32);

    x1 = (b & 0xffffffff);

    if (x1 == 0) {

        cpu_restore_state(CPU(cpu), GETPC());

        helper_raise_exception(env, TT_DIV_ZERO);

    }

    x0 = x0 / x1;

    if ((int32_t) x0 != x0) {

        x0 = x0 < 0 ? 0x80000000 : 0x7fffffff;

        overflow = 1;

    }

    if (cc) {

        env->cc_dst = x0;

        env->cc_src2 = overflow;

        env->cc_op = CC_OP_DIV;

    }

    return x0;

}


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

+    memory_region_init_io(&s->iomem, &omap_lpg_ops, s, "omap-lpg", 0x800);
+
+    memory_region_add_subregion(system_memory, base, &s->iomem);
+
+

     omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]);

static struct omap_lpg_s *omap_lpg_init(MemoryRegion *system_memory,

                                        target_phys_addr_t base, omap_clk clk)

{

    struct omap_lpg_s *s = (struct omap_lpg_s *)

            g_malloc0(sizeof(struct omap_lpg_s));

    s->tm = qemu_new_timer_ms(vm_clock, omap_lpg_tick, s);

    omap_lpg_reset(s);

    memory_region_init_io(&s->iomem, &omap_lpg_ops, s, "omap-lpg", 0x800);

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

    omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+void qemu_update_position(QEMUFile *f, size_t size)

 {

void qemu_update_position(QEMUFile *f, size_t size)

{

    f->pos += size;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 INLINE bits32 extractFloat32Frac( float32 a )

 {
+
+

     return a & 0x007FFFFF;

INLINE bits32 extractFloat32Frac( float32 a )

{

    return a & 0x007FFFFF;

}


--- a/source.c
+++ b/source.c
@@ -1,19 +1,19 @@
+AVFrameSideData *av_frame_new_side_data(AVFrame *frame,

+                                        enum AVFrameSideDataType type,

                                         int size)

 {

+    AVFrameSideData *ret, **tmp;
+
+
+
+    if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)

+        return NULL;
+

     tmp = av_realloc(frame->side_data,

AVFrameSideData *av_frame_new_side_data(AVFrame *frame,

                                        enum AVFrameSideDataType type,

                                        int size)

{

    AVFrameSideData *ret, **tmp;

    if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)

        return NULL;

    tmp = av_realloc(frame->side_data,

                     (frame->nb_side_data + 1) * sizeof(*frame->side_data));

    if (!tmp)

        return NULL;

    frame->side_data = tmp;

    ret = av_mallocz(sizeof(*ret));

    if (!ret)

        return NULL;

    if (size > 0) {

        ret->buf = av_buffer_alloc(size);

        if (!ret->buf) {

            av_freep(&ret);

            return NULL;

        }

        ret->data = ret->buf->data;

        ret->size = size;

    }

    ret->type = type;

    frame->side_data[frame->nb_side_data++] = ret;

    return ret;

}


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

     MemoryRegion *mr = memory_region_find(parent, addr, 1).mr;
+
+    if (!mr) {
+
+        return false;

     }

bool memory_region_present(MemoryRegion *parent, hwaddr addr)

{

    MemoryRegion *mr = memory_region_find(parent, addr, 1).mr;

    if (!mr) {

        return false;

    }

    memory_region_unref(mr);

    return true;

}


static void eval_coefs(int *coefs, const int *refl)

{

    int buffer[10];

    int *b1 = buffer;

    int *b2 = coefs;

    int x, y;

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

        b1[x] = refl[x] << 4;

        for (y=0; y < x; y++)

            b1[y] = ((refl[x] * b2[x-y-1]) >> 12) + b2[y];

        FFSWAP(int *, b1, b2);

    }

    for (x=0; x < 10; x++)

        coefs[x] >>= 4;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void qxl_hard_reset(PCIQXLDevice *d, int loadvm)

+{

     dprint(d, 1, "%s: start%s\n", __FUNCTION__,
+
            loadvm ? " (loadvm)" : "");

static void qxl_hard_reset(PCIQXLDevice *d, int loadvm)

{

    dprint(d, 1, "%s: start%s\n", __FUNCTION__,

           loadvm ? " (loadvm)" : "");

    qemu_mutex_unlock_iothread();

    d->ssd.worker->reset_cursor(d->ssd.worker);

    d->ssd.worker->reset_image_cache(d->ssd.worker);

    qemu_mutex_lock_iothread();

    qxl_reset_surfaces(d);

    qxl_reset_memslots(d);

    /* pre loadvm reset must not touch QXLRam.  This lives in

     * device memory, is migrated together with RAM and thus

     * already loaded at this point */

    if (!loadvm) {

        qxl_reset_state(d);

    }

    qemu_spice_create_host_memslot(&d->ssd);

    qxl_soft_reset(d);

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

}


--- a/source.c
+++ b/source.c
@@ -1,16 +1,16 @@
 void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp)

+{
+
+    int64_t value;

+    if (!error_is_set(errp)) {
+
+        if (v->type_uint32) {
+
             v->type_uint32(v, obj, name, errp);

+        } else {

             value = *obj;

void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp)

{

    int64_t value;

    if (!error_is_set(errp)) {

        if (v->type_uint32) {

            v->type_uint32(v, obj, name, errp);

        } else {

            value = *obj;

            v->type_int(v, &value, name, errp);

            if (value < 0 || value > UINT32_MAX) {

                error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",

                          "uint32_t");

                return;

            }

            *obj = value;

        }

    }

}


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

     gen_set_access_type(ctx, ACCESS_INT);
+
+    /* NIP cannot be restored if the memory exception comes from an helper */
+
+    gen_update_nip(ctx, ctx->nip - 4);
+
     t0 = tcg_temp_new();

     gen_addr_register(ctx, t0);

static void gen_lswi(DisasContext *ctx)

{

    TCGv t0;

    TCGv_i32 t1, t2;

    int nb = NB(ctx->opcode);

    int start = rD(ctx->opcode);

    int ra = rA(ctx->opcode);

    int nr;

    if (nb == 0)

        nb = 32;

    nr = nb / 4;

    if (unlikely(((start + nr) > 32  &&

                  start <= ra && (start + nr - 32) > ra) ||

                 ((start + nr) <= 32 && start <= ra && (start + nr) > ra))) {

        gen_inval_exception(ctx, POWERPC_EXCP_INVAL_LSWX);

        return;

    }

    gen_set_access_type(ctx, ACCESS_INT);

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

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

    t0 = tcg_temp_new();

    gen_addr_register(ctx, t0);

    t1 = tcg_const_i32(nb);

    t2 = tcg_const_i32(start);

    gen_helper_lsw(cpu_env, t0, t1, t2);

    tcg_temp_free(t0);

    tcg_temp_free_i32(t1);

    tcg_temp_free_i32(t2);

}


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

     mmio = g_malloc0(sizeof(subpage_t));

+
+
+    mmio->base = base;
+
+    memory_region_init_io(&mmio->iomem, &subpage_ops, mmio,

                           "subpage", TARGET_PAGE_SIZE);

static subpage_t *subpage_init(target_phys_addr_t base)

{

    subpage_t *mmio;

    mmio = g_malloc0(sizeof(subpage_t));

    mmio->base = base;

    memory_region_init_io(&mmio->iomem, &subpage_ops, mmio,

                          "subpage", TARGET_PAGE_SIZE);

    mmio->iomem.subpage = true;

#if defined(DEBUG_SUBPAGE)

    printf("%s: %p base " TARGET_FMT_plx " len %08x %d\n", __func__,

           mmio, base, TARGET_PAGE_SIZE, subpage_memory);

#endif

    subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, phys_section_unassigned);

    return mmio;

}


void lm32_debug_excp_handler(CPUState *cs)

{

    LM32CPU *cpu = LM32_CPU(cs);

    CPULM32State *env = &cpu->env;

    CPUBreakpoint *bp;

    if (cs->watchpoint_hit) {

        if (cs->watchpoint_hit->flags & BP_CPU) {

            cs->watchpoint_hit = NULL;

            if (check_watchpoints(env)) {

                raise_exception(env, EXCP_WATCHPOINT);

            } else {

                cpu_resume_from_signal(cs, NULL);

            }

        }

    } else {

        QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {

            if (bp->pc == env->pc) {

                if (bp->flags & BP_CPU) {

                    raise_exception(env, EXCP_BREAKPOINT);

                }

                break;

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
     for (i = 0; i < cpb_count; i++) {

         get_ue_golomb_long(&h->gb); /* bit_rate_value_minus1 */
+
+        get_ue_golomb_long(&h->gb); /* cpb_size_value_minus1 */
+
+        get_bits1(&h->gb);          /* cbr_flag */
+
     }

     sps->initial_cpb_removal_delay_length = get_bits(&h->gb, 5) + 1;

static inline int decode_hrd_parameters(H264Context *h, SPS *sps)

{

    int cpb_count, i;

    cpb_count = get_ue_golomb_31(&h->gb) + 1;

    if (cpb_count > 32U) {

        av_log(h->avctx, AV_LOG_ERROR, "cpb_count %d invalid\n", cpb_count);

        return AVERROR_INVALIDDATA;

    }

    get_bits(&h->gb, 4); /* bit_rate_scale */

    get_bits(&h->gb, 4); /* cpb_size_scale */

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

        get_ue_golomb_long(&h->gb); /* bit_rate_value_minus1 */

        get_ue_golomb_long(&h->gb); /* cpb_size_value_minus1 */

        get_bits1(&h->gb);          /* cbr_flag */

    }

    sps->initial_cpb_removal_delay_length = get_bits(&h->gb, 5) + 1;

    sps->cpb_removal_delay_length         = get_bits(&h->gb, 5) + 1;

    sps->dpb_output_delay_length          = get_bits(&h->gb, 5) + 1;

    sps->time_offset_length               = get_bits(&h->gb, 5);

    sps->cpb_cnt                          = cpb_count;

    return 0;

}


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

 {

+    const uint8_t *buf = avpkt->data;
+
+    int buf_size       = avpkt->size;
+
+    AMRWBContext *s    = avctx->priv_data;

     int mode;

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

                               int *data_size, AVPacket *avpkt)

{

    const uint8_t *buf = avpkt->data;

    int buf_size       = avpkt->size;

    AMRWBContext *s    = avctx->priv_data;

    int mode;

    int packet_size;

    static const uint8_t block_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};

    mode        = (buf[0] >> 3) & 0x000F;

    packet_size = block_size[mode];

    if (packet_size > buf_size) {

        av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n",

               buf_size, packet_size + 1);

        return AVERROR_INVALIDDATA;

    }

    D_IF_decode(s->state, buf, data, _good_frame);

    *data_size = 320 * 2;

    return packet_size;

}


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

     int i;
+
     int32_t *dst = (int32_t *) _dst;

     const uint16_t *src = (const uint16_t *) _src;

static void hScale16_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src,

                       const int16_t *filter,

                       const int16_t *filterPos, int filterSize)

{

    int i;

    int32_t *dst = (int32_t *) _dst;

    const uint16_t *src = (const uint16_t *) _src;

    int bits = av_pix_fmt_descriptors[c->srcFormat].comp[0].depth_minus1;

    int sh = (bits <= 7) ? 11 : (bits - 4);

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

        int j;

        int srcPos = filterPos[i];

        unsigned int val = 0;

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

            val += src[srcPos + j] * filter[filterSize * i + j];

        }

        // filter=14 bit, input=16 bit, output=30 bit, >> 11 makes 19 bit

        dst[i] = FFMIN(val >> sh, (1 << 19) - 1);

    }

}