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

 {

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

{

    int i;

    assert(src1==src2);

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

        int r= src1[6*i + 0] + src1[6*i + 3];

        int g= src1[6*i + 1] + src1[6*i + 4];

        int b= src1[6*i + 2] + src1[6*i + 5];

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

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

    }

}


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

     int x, y;
+

     int width    = frame->width;

static int dx2_decode_slice_420(GetBitContext *gb, AVFrame *frame,

                                int line, int left,

                                uint8_t lru[3][8])

{

    int x, y;

    int width    = frame->width;

    int ystride = frame->linesize[0];

    int ustride = frame->linesize[1];

    int vstride = frame->linesize[2];

    uint8_t *Y  = frame->data[0] + ystride * line;

    uint8_t *U  = frame->data[1] + (ustride >> 1) * line;

    uint8_t *V  = frame->data[2] + (vstride >> 1) * line;

    for (y = 0; y < left - 1 && get_bits_left(gb) > 16; y += 2) {

        for (x = 0; x < width; x += 2) {

            Y[x + 0 + 0 * ystride] = decode_sym(gb, lru[0]);

            Y[x + 1 + 0 * ystride] = decode_sym(gb, lru[0]);

            Y[x + 0 + 1 * ystride] = decode_sym(gb, lru[0]);

            Y[x + 1 + 1 * ystride] = decode_sym(gb, lru[0]);

            U[x >> 1] = decode_sym(gb, lru[1]) ^ 0x80;

            V[x >> 1] = decode_sym(gb, lru[2]) ^ 0x80;

        }

        Y += ystride << 1;

        U += ustride;

        V += vstride;

    }

    return y;

}


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

     if ( am->in_channels <= 0 ||  am->in_channels > AVRESAMPLE_MAX_CHANNELS ||
+
+        am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) {
+
+        av_log(am, AV_LOG_ERROR, "Invalid channel counts\n");
+
         return AVERROR(EINVAL);

     }

int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride)

{

    int i, o;

    if ( am->in_channels <= 0 ||  am->in_channels > AVRESAMPLE_MAX_CHANNELS ||

        am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) {

        av_log(am, AV_LOG_ERROR, "Invalid channel counts\n");

        return AVERROR(EINVAL);

    }

#define GET_MATRIX_CONVERT(suffix, scale)                                   \

    if (!am->matrix_ ## suffix[0]) {                                        \

        av_log(am, AV_LOG_ERROR, "matrix is not set\n");                    \

        return AVERROR(EINVAL);                                             \

    }                                                                       \

    for (o = 0; o < am->out_channels; o++)                                  \

        for (i = 0; i < am->in_channels; i++)                               \

            matrix[o * stride + i] = am->matrix_ ## suffix[o][i] * (scale);

    switch (am->coeff_type) {

    case AV_MIX_COEFF_TYPE_Q8:

        GET_MATRIX_CONVERT(q8, 1.0 / 256.0);

        break;

    case AV_MIX_COEFF_TYPE_Q15:

        GET_MATRIX_CONVERT(q15, 1.0 / 32768.0);

        break;

    case AV_MIX_COEFF_TYPE_FLT:

        GET_MATRIX_CONVERT(flt, 1.0);

        break;

    default:

        av_log(am, AV_LOG_ERROR, "Invalid mix coeff type\n");

        return AVERROR(EINVAL);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void vnc_flush(VncState *vs)
+
 {

     if (vs->output.offset)

void vnc_flush(VncState *vs)

{

    if (vs->output.offset)

        vnc_client_write(vs);

}


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

     ret = next_map.nodes_nb++;

+    assert(ret != PHYS_MAP_NODE_NIL);
+
+    assert(ret != next_map.nodes_nb_alloc);
+
+    for (i = 0; i < L2_SIZE; ++i) {

         next_map.nodes[ret][i].is_leaf = 0;

static uint16_t phys_map_node_alloc(void)

{

    unsigned i;

    uint16_t ret;

    ret = next_map.nodes_nb++;

    assert(ret != PHYS_MAP_NODE_NIL);

    assert(ret != next_map.nodes_nb_alloc);

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

        next_map.nodes[ret][i].is_leaf = 0;

        next_map.nodes[ret][i].ptr = PHYS_MAP_NODE_NIL;

    }

    return ret;

}


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

     /* num of iovec without vhdr */

+    uint32_t iov_len = pkt->payload_frags + NET_TX_PKT_PL_START_FRAG - 1;

     uint16_t csl;

static void net_tx_pkt_do_sw_csum(struct NetTxPkt *pkt)

{

    struct iovec *iov = &pkt->vec[NET_TX_PKT_L2HDR_FRAG];

    uint32_t csum_cntr;

    uint16_t csum = 0;

    uint32_t cso;

    /* num of iovec without vhdr */

    uint32_t iov_len = pkt->payload_frags + NET_TX_PKT_PL_START_FRAG - 1;

    uint16_t csl;

    struct ip_header *iphdr;

    size_t csum_offset = pkt->virt_hdr.csum_start + pkt->virt_hdr.csum_offset;

    /* Put zero to checksum field */

    iov_from_buf(iov, iov_len, csum_offset, &csum, sizeof csum);

    /* Calculate L4 TCP/UDP checksum */

    csl = pkt->payload_len;

    /* add pseudo header to csum */

    iphdr = pkt->vec[NET_TX_PKT_L3HDR_FRAG].iov_base;

    csum_cntr = eth_calc_ip4_pseudo_hdr_csum(iphdr, csl, &cso);

    /* data checksum */

    csum_cntr +=

        net_checksum_add_iov(iov, iov_len, pkt->virt_hdr.csum_start, csl, cso);

    /* Put the checksum obtained into the packet */

    csum = cpu_to_be16(net_checksum_finish(csum_cntr));

    iov_from_buf(iov, iov_len, csum_offset, &csum, sizeof csum);

}


--- a/source.c
+++ b/source.c
@@ -2,11 +2,11 @@
 {
     int i;
     f->slice_count = f->num_h_slices * f->num_v_slices;
+    av_assert0(f->slice_count > 0);
+    for (i = 0; i < f->slice_count; i++) {
+        FFV1Context *fs = av_mallocz(sizeof(*fs));
+        int sx          = i % f->num_h_slices;
+        int sy          = i / f->num_h_slices;
         int sxs         = f->avctx->width  *  sx      / f->num_h_slices;
         int sxe         = f->avctx->width  * (sx + 1) / f->num_h_slices;
         int sys         = f->avctx->height *  sy      / f->num_v_slices;

av_cold int ffv1_init_slice_contexts(FFV1Context *f)
{
    int i;
    f->slice_count = f->num_h_slices * f->num_v_slices;
    av_assert0(f->slice_count > 0);
    for (i = 0; i < f->slice_count; i++) {
        FFV1Context *fs = av_mallocz(sizeof(*fs));
        int sx          = i % f->num_h_slices;
        int sy          = i / f->num_h_slices;
        int sxs         = f->avctx->width  *  sx      / f->num_h_slices;
        int sxe         = f->avctx->width  * (sx + 1) / f->num_h_slices;
        int sys         = f->avctx->height *  sy      / f->num_v_slices;
        int sye         = f->avctx->height * (sy + 1) / f->num_v_slices;
        f->slice_context[i] = fs;
        memcpy(fs, f, sizeof(*fs));
        memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2));
        fs->slice_width  = sxe - sxs;
        fs->slice_height = sye - sys;
        fs->slice_x      = sxs;
        fs->slice_y      = sys;
        fs->sample_buffer = av_malloc(3 * MAX_PLANES * (fs->width + 6) *
                                      sizeof(*fs->sample_buffer));
        if (!fs->sample_buffer)
    }
    return 0;
}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void prepare_play(void)
+
+{
+
     AVOutputFormat *ofmt;

     ofmt = guess_format("audio_device", NULL, NULL);

void prepare_play(void)

{

    AVOutputFormat *ofmt;

    ofmt = guess_format("audio_device", NULL, NULL);

    if (!ofmt) {

        fprintf(stderr, "Could not find audio device\n");

        exit(1);

    }

    opt_output_file(audio_device);

}


--- a/source.c
+++ b/source.c
@@ -9,7 +9,7 @@
     const gchar *class, *desc;

+
     ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', "

                  "'arguments': {'foo': 42 }}");

static void test_qga_invalid_args(gconstpointer fix)

{

    const TestFixture *fixture = fix;

    QDict *ret, *error;

    const gchar *class, *desc;

    ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', "

                 "'arguments': {'foo': 42 }}");

    g_assert_nonnull(ret);

    error = qdict_get_qdict(ret, "error");

    class = qdict_get_try_str(error, "class");

    desc = qdict_get_try_str(error, "desc");

    g_assert_cmpstr(class, ==, "GenericError");

    g_assert_cmpstr(desc, ==, "QMP input object member 'foo' is unexpected");

    QDECREF(ret);

}


int DMA_read_memory (int nchan, void *buf, int pos, int len)

{

    struct dma_regs *r = &dma_controllers[nchan > 3].regs[nchan & 3];

    target_phys_addr_t addr = ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[ADDR];

    if (r->mode & 0x20) {

        int i;

        uint8_t *p = buf;

        cpu_physical_memory_read (addr - pos - len, buf, len);

        /* What about 16bit transfers? */

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

            uint8_t b = p[len - i - 1];

            p[i] = b;

        }

    }

    else

        cpu_physical_memory_read (addr + pos, buf, len);

    return len;

}


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

     switch (avctx->codec->id) {
+
+    case AV_CODEC_ID_8SVX_FIB: esc->table = fibonacci;    break;
+
+    case AV_CODEC_ID_8SVX_EXP: esc->table = exponential;  break;
+
     case AV_CODEC_ID_PCM_S8_PLANAR:

     case AV_CODEC_ID_8SVX_RAW: esc->table = NULL;         break;

static av_cold int eightsvx_decode_init(AVCodecContext *avctx)

{

    EightSvxContext *esc = avctx->priv_data;

    if (avctx->channels < 1 || avctx->channels > 2) {

        av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n");

        return AVERROR_INVALIDDATA;

    }

    switch (avctx->codec->id) {

    case AV_CODEC_ID_8SVX_FIB: esc->table = fibonacci;    break;

    case AV_CODEC_ID_8SVX_EXP: esc->table = exponential;  break;

    case AV_CODEC_ID_PCM_S8_PLANAR:

    case AV_CODEC_ID_8SVX_RAW: esc->table = NULL;         break;

    default:

        av_log(avctx, AV_LOG_ERROR, "Invalid codec id %d.\n", avctx->codec->id);

        return AVERROR_INVALIDDATA;

    }

    avctx->sample_fmt = AV_SAMPLE_FMT_U8P;

    avcodec_get_frame_defaults(&esc->frame);

    avctx->coded_frame = &esc->frame;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int wav_read_header(AVFormatContext *s,
+
                            AVFormatParameters *ap)

 {
@@ -10,7 +10,7 @@

     ByteIOContext *pb = s->pb;

+    AVStream *st;

     WAVContext *wav = s->priv_data;

static int wav_read_header(AVFormatContext *s,

                           AVFormatParameters *ap)

{

    int size;

    unsigned int tag;

    ByteIOContext *pb = s->pb;

    AVStream *st;

    WAVContext *wav = s->priv_data;

    /* check RIFF header */

    tag = get_le32(pb);

    if (tag != MKTAG('R', 'I', 'F', 'F'))

        return -1;

    get_le32(pb); /* file size */

    tag = get_le32(pb);

    if (tag != MKTAG('W', 'A', 'V', 'E'))

        return -1;

    /* parse fmt header */

    size = find_tag(pb, MKTAG('f', 'm', 't', ' '));

    if (size < 0)

        return -1;

    st = av_new_stream(s, 0);

    if (!st)

        return AVERROR(ENOMEM);

    get_wav_header(pb, st->codec, size);

    st->need_parsing = AVSTREAM_PARSE_FULL;

    av_set_pts_info(st, 64, 1, st->codec->sample_rate);

    size = find_tag(pb, MKTAG('d', 'a', 't', 'a'));

    if (size < 0)

        return -1;

    wav->data_end= url_ftell(pb) + size;

    return 0;

}


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

     ga_disable_logging(ga_state);
+
 }

static void disable_logging(void)

{

    ga_disable_logging(ga_state);

}


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

 {

+    AVIOContext *pb = s->pb;

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

@@ -15,7 +15,7 @@
         int64_t file_size = avio_tell(pb);

+
         avio_seek(pb, caf->data, SEEK_SET);

         avio_wb64(pb, file_size - caf->data - 8);

static int caf_write_trailer(AVFormatContext *s)

{

    AVIOContext *pb = s->pb;

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

    if (pb->seekable) {

        CAFContext *caf = s->priv_data;

        int64_t file_size = avio_tell(pb);

        avio_seek(pb, caf->data, SEEK_SET);

        avio_wb64(pb, file_size - caf->data - 8);

        avio_seek(pb, file_size, SEEK_SET);

        if (!enc->block_align) {

            ffio_wfourcc(pb, "pakt");

            avio_wb64(pb, caf->size_entries_used + 24);

            avio_wb64(pb, caf->packets); ///< mNumberPackets

            avio_wb64(pb, caf->packets * samples_per_packet(enc->codec_id, enc->channels)); ///< mNumberValidFrames

            avio_wb32(pb, 0); ///< mPrimingFrames

            avio_wb32(pb, 0); ///< mRemainderFrames

            avio_write(pb, caf->pkt_sizes, caf->size_entries_used);

            av_freep(&caf->pkt_sizes);

            caf->size_buffer_size = 0;

        }

        avio_flush(pb);

    }

    return 0;

}


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

 {

@@ -10,11 +10,11 @@

+    chr = g_malloc0(sizeof(CharDriverState));

     s = g_malloc0(sizeof(WinCharState));
+
+    chr->opaque = s;

     chr->chr_write = win_chr_write;

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

{

    const char *filename = qemu_opt_get(opts, "path");

    CharDriverState *chr;

    WinCharState *s;

    chr = g_malloc0(sizeof(CharDriverState));

    s = g_malloc0(sizeof(WinCharState));

    chr->opaque = s;

    chr->chr_write = win_chr_write;

    chr->chr_close = win_chr_close;

    if (win_chr_pipe_init(chr, filename) < 0) {

        g_free(s);

        g_free(chr);

        return -EIO;

    }

    qemu_chr_generic_open(chr);

    *_chr = chr;

    return 0;

}


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

     QEMUFile *f;

+
+
+    f = g_malloc0(sizeof(QEMUFile));
+
+

     f->opaque = opaque;

QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops)

{

    QEMUFile *f;

    f = g_malloc0(sizeof(QEMUFile));

    f->opaque = opaque;

    f->ops = ops;

    f->is_write = 0;

    return f;

}


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

         error_setg(errp,
+
                    "Unable to initialize GNUTLS library: %s",

                    gnutls_strerror(ret));

int qcrypto_init(Error **errp)

{

#ifdef CONFIG_GNUTLS

    int ret;

    ret = gnutls_global_init();

    if (ret < 0) {

        error_setg(errp,

                   "Unable to initialize GNUTLS library: %s",

                   gnutls_strerror(ret));

        return -1;

    }

#ifdef DEBUG_GNUTLS

    gnutls_global_set_log_level(10);

    gnutls_global_set_log_function(qcrypto_gnutls_log);

#endif

#endif

#ifdef CONFIG_GCRYPT

    if (!gcry_check_version(GCRYPT_VERSION)) {

        error_setg(errp, "Unable to initialize gcrypt");

        return -1;

    }

#ifdef QCRYPTO_INIT_GCRYPT_THREADS

    gcry_control(GCRYCTL_SET_THREAD_CBS, &qcrypto_gcrypt_thread_impl);

#endif /* QCRYPTO_INIT_GCRYPT_THREADS */

    gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);

#endif

    return 0;

}


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

     uint64_t phys   = le64_to_cpu(pqxl);

+    uint32_t slot   = (phys >> (64 -  8)) & 0xff;
+
+    uint64_t offset = phys & 0xffffffffffff;

+
+
     switch (group_id) {

     case MEMSLOT_GROUP_HOST:

void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, int group_id)

{

    uint64_t phys   = le64_to_cpu(pqxl);

    uint32_t slot   = (phys >> (64 -  8)) & 0xff;

    uint64_t offset = phys & 0xffffffffffff;

    switch (group_id) {

    case MEMSLOT_GROUP_HOST:

        return (void *)(intptr_t)offset;

    case MEMSLOT_GROUP_GUEST:

        PANIC_ON(slot >= NUM_MEMSLOTS);

        PANIC_ON(!qxl->guest_slots[slot].active);

        PANIC_ON(offset < qxl->guest_slots[slot].delta);

        offset -= qxl->guest_slots[slot].delta;

        PANIC_ON(offset > qxl->guest_slots[slot].size)

        return qxl->guest_slots[slot].ptr + offset;

    default:

        PANIC_ON(1);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static unsigned acpi_data_len(GArray *table)
+
+{
+
 #if GLIB_CHECK_VERSION(2, 14, 0)

     assert(g_array_get_element_size(table) == 1);

static unsigned acpi_data_len(GArray *table)

{

#if GLIB_CHECK_VERSION(2, 14, 0)

    assert(g_array_get_element_size(table) == 1);

#endif

    return table->len;

}


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

     unsigned long cx, len = 1 << 19;

+    int r;

     struct kvm_s390_cmma_log clog = {

static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)

{

    KVMS390StAttribState *sas = KVM_S390_STATTRIB(sa);

    MachineState *machine = MACHINE(qdev_get_machine());

    unsigned long max = machine->maxram_size / TARGET_PAGE_SIZE;

    unsigned long cx, len = 1 << 19;

    int r;

    struct kvm_s390_cmma_log clog = {

        .flags = 0,

        .mask = ~0ULL,

    };

    if (sas->incoming_buffer) {

        for (cx = 0; cx + len <= max; cx += len) {

            clog.start_gfn = cx;

            clog.count = len;

            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);

            r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);

            if (r) {

                error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));

                return;

            }

        }

        if (cx < max) {

            clog.start_gfn = cx;

            clog.count = max - cx;

            clog.values = (uint64_t)(sas->incoming_buffer + cx * len);

            r = kvm_vm_ioctl(kvm_state, KVM_S390_SET_CMMA_BITS, &clog);

            if (r) {

                error_report("KVM_S390_SET_CMMA_BITS failed: %s", strerror(-r));

            }

        }

        g_free(sas->incoming_buffer);

        sas->incoming_buffer = NULL;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static inline void gen_op_eval_fbu(TCGv dst, TCGv src,
+
+                                    unsigned int fcc_offset)

 {

static inline void gen_op_eval_fbu(TCGv dst, TCGv src,

                                    unsigned int fcc_offset)

{

    gen_mov_reg_FCC0(dst, src, fcc_offset);

    gen_mov_reg_FCC1(cpu_tmp0, src, fcc_offset);

    tcg_gen_and_tl(dst, dst, cpu_tmp0);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static uint8_t qvirtio_pci_config_readb(QVirtioDevice *d, uint64_t off)

+{

     QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;

static uint8_t qvirtio_pci_config_readb(QVirtioDevice *d, uint64_t off)

{

    QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;

    return qpci_io_readb(dev->pdev, CONFIG_BASE(dev) + off);

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     ByteIOContext *pb = s->pb;

     uint8_t *streaminfo = s->streams[0]->codec->extradata;
+
+    int len = s->streams[0]->codec->extradata_size;
+
+    int64_t file_size;
+

     if (streaminfo && len > 0 && !url_is_streamed(s->pb)) {

static int flac_write_trailer(struct AVFormatContext *s)

{

    ByteIOContext *pb = s->pb;

    uint8_t *streaminfo = s->streams[0]->codec->extradata;

    int len = s->streams[0]->codec->extradata_size;

    int64_t file_size;

    if (streaminfo && len > 0 && !url_is_streamed(s->pb)) {

        file_size = url_ftell(pb);

        url_fseek(pb, 8, SEEK_SET);

        put_buffer(pb, streaminfo, len);

        url_fseek(pb, file_size, SEEK_SET);

        put_flush_packet(pb);

    }

    return 0;

}


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

+    if (!kvm_has_xsave())
+
+        return kvm_get_fpu(env);
+
+

     xsave = qemu_memalign(4096, sizeof(struct kvm_xsave));

static int kvm_get_xsave(CPUState *env)

{

#ifdef KVM_CAP_XSAVE

    struct kvm_xsave* xsave;

    int ret, i;

    uint16_t cwd, swd, twd, fop;

    if (!kvm_has_xsave())

        return kvm_get_fpu(env);

    xsave = qemu_memalign(4096, sizeof(struct kvm_xsave));

    ret = kvm_vcpu_ioctl(env, KVM_GET_XSAVE, xsave);

    if (ret < 0) {

        qemu_free(xsave);

        return ret;

    }

    cwd = (uint16_t)xsave->region[0];

    swd = (uint16_t)(xsave->region[0] >> 16);

    twd = (uint16_t)xsave->region[1];

    fop = (uint16_t)(xsave->region[1] >> 16);

    env->fpstt = (swd >> 11) & 7;

    env->fpus = swd;

    env->fpuc = cwd;

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

        env->fptags[i] = !((twd >> i) & 1);

    env->mxcsr = xsave->region[XSAVE_MXCSR];

    memcpy(env->fpregs, &xsave->region[XSAVE_ST_SPACE],

            sizeof env->fpregs);

    memcpy(env->xmm_regs, &xsave->region[XSAVE_XMM_SPACE],

            sizeof env->xmm_regs);

    env->xstate_bv = *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV];

    memcpy(env->ymmh_regs, &xsave->region[XSAVE_YMMH_SPACE],

            sizeof env->ymmh_regs);

    qemu_free(xsave);

    return 0;

#else

    return kvm_get_fpu(env);

#endif

}


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

                                const char *default_devaddr)

+{

     Error *err = NULL;

PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,

                               const char *default_model,

                               const char *default_devaddr)

{

    Error *err = NULL;

    PCIDevice *res;

    if (qemu_show_nic_models(nd->model, pci_nic_models))

        exit(0);

    res = pci_nic_init(nd, rootbus, default_model, default_devaddr, &err);

    if (!res) {

        error_report_err(err);

        exit(1);

    }

    return res;

}


uint64_t helper_mulldo(CPUPPCState *env, uint64_t arg1, uint64_t arg2)

{

    int64_t th;

    uint64_t tl;

    muls64(&tl, (uint64_t *)&th, arg1, arg2);

    /* If th != 0 && th != -1, then we had an overflow */

    if (likely((uint64_t)(th + 1) <= 1)) {

        env->ov = 0;

    } else {

        env->so = env->ov = 1;

    }

    return (int64_t)tl;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static inline bool use_goto_tb(DisasContext *s, int n, uint64_t dest)
+
 {

     /* No direct tb linking with singlestep (either QEMU's or the ARM

static inline bool use_goto_tb(DisasContext *s, int n, uint64_t dest)

{

    /* No direct tb linking with singlestep (either QEMU's or the ARM

     * debug architecture kind) or deterministic io

     */

    if (s->base.singlestep_enabled || s->ss_active || (s->base.tb->cflags & CF_LAST_IO)) {

        return false;

    }

#ifndef CONFIG_USER_ONLY

    /* Only link tbs from inside the same guest page */

    if ((s->base.tb->pc & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) {

        return false;

    }

#endif

    return true;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void SET_TYPE(resample_nearest)(void *dst0, int dst_index, const void *src0, int index)

 {
+
+    FELEM *dst = dst0;

     const FELEM *src = src0;

static void SET_TYPE(resample_nearest)(void *dst0, int dst_index, const void *src0, int index)

{

    FELEM *dst = dst0;

    const FELEM *src = src0;

    dst[dst_index] = src[index];

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void pci_vpb_map(SysBusDevice *dev, target_phys_addr_t base)

+{
+
+    PCIVPBState *s = (PCIVPBState *)dev;
+
+    /* Selfconfig area.  */

     memory_region_add_subregion(get_system_memory(), base + 0x01000000,

static void pci_vpb_map(SysBusDevice *dev, target_phys_addr_t base)

{

    PCIVPBState *s = (PCIVPBState *)dev;

    /* Selfconfig area.  */

    memory_region_add_subregion(get_system_memory(), base + 0x01000000,

                                &s->mem_config);

    /* Normal config area.  */

    memory_region_add_subregion(get_system_memory(), base + 0x02000000,

                                &s->mem_config2);

    if (s->realview) {

        /* IO memory area.  */

        memory_region_add_subregion(get_system_memory(), base + 0x03000000,

                                    &s->isa);

    }

}


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

     PCIBridge *s = DO_UPCAST(PCIBridge, dev, dev);
+
+
+
+    pci_config_set_vendor_id(s->dev.config, s->vid);
+
     pci_config_set_device_id(s->dev.config, s->did);

static int pci_bridge_initfn(PCIDevice *dev)

{

    PCIBridge *s = DO_UPCAST(PCIBridge, dev, dev);

    pci_config_set_vendor_id(s->dev.config, s->vid);

    pci_config_set_device_id(s->dev.config, s->did);

    s->dev.config[0x04] = 0x06; // command = bus master, pci mem

    s->dev.config[0x05] = 0x00;

    s->dev.config[0x06] = 0xa0; // status = fast back-to-back, 66MHz, no error

    s->dev.config[0x07] = 0x00; // status = fast devsel

    s->dev.config[0x08] = 0x00; // revision

    s->dev.config[0x09] = 0x00; // programming i/f

    pci_config_set_class(s->dev.config, PCI_CLASS_BRIDGE_PCI);

    s->dev.config[0x0D] = 0x10; // latency_timer

    s->dev.config[PCI_HEADER_TYPE] =

        PCI_HEADER_TYPE_MULTI_FUNCTION | PCI_HEADER_TYPE_BRIDGE; // header_type

    s->dev.config[0x1E] = 0xa0; // secondary status

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,18 +7,18 @@
     int64_t end;

     uint64_t tmp;
+
     int i;

     AVRational time_base;

+    nut->last_syncpoint_pos= url_ftell(bc)-8;

+    end= get_packetheader(nut, bc, 1);

     end += url_ftell(bc) - 4;

static int decode_syncpoint(NUTContext *nut){

    AVFormatContext *s= nut->avf;

    ByteIOContext *bc = &s->pb;

    int64_t end;

    uint64_t tmp;

    int i;

    AVRational time_base;

    nut->last_syncpoint_pos= url_ftell(bc)-8;

    end= get_packetheader(nut, bc, 1);

    end += url_ftell(bc) - 4;

    tmp= get_v(bc);

    get_v(bc); //back_ptr_div16

    time_base= nut->time_base[tmp % nut->time_base_count];

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

        nut->stream[i].last_pts= av_rescale_rnd(

            tmp / nut->time_base_count,

            time_base.num * (int64_t)nut->stream[i].time_base.den,

            time_base.den * (int64_t)nut->stream[i].time_base.num,

            AV_ROUND_DOWN);

        //last_key_frame ?

    }

    //FIXME put this in a reset func maybe

    if(skip_reserved(bc, end) || check_checksum(bc)){

        av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     if (s->irq_routes->nr == s->nr_allocated_irq_routes) {

         n = s->nr_allocated_irq_routes * 2;
+
+        if (n < 64) {
+
+            n = 64;
+
         }

         size = sizeof(struct kvm_irq_routing);

static void kvm_add_routing_entry(KVMState *s,

                                  struct kvm_irq_routing_entry *entry)

{

    struct kvm_irq_routing_entry *new;

    int n, size;

    if (s->irq_routes->nr == s->nr_allocated_irq_routes) {

        n = s->nr_allocated_irq_routes * 2;

        if (n < 64) {

            n = 64;

        }

        size = sizeof(struct kvm_irq_routing);

        size += n * sizeof(*new);

        s->irq_routes = g_realloc(s->irq_routes, size);

        s->nr_allocated_irq_routes = n;

    }

    n = s->irq_routes->nr++;

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

    memset(new, 0, sizeof(*new));

    new->gsi = entry->gsi;

    new->type = entry->type;

    new->flags = entry->flags;

    new->u = entry->u;

    set_gsi(s, entry->gsi);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,
+
+                                        uint64_t flags)
+
+{
+
     QEMUFileRDMA *rfile = opaque;

     RDMAContext *rdma = rfile->rdma;

static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,

                                        uint64_t flags)

{

    QEMUFileRDMA *rfile = opaque;

    RDMAContext *rdma = rfile->rdma;

    CHECK_ERROR_STATE();

    DDDPRINTF("start section: %" PRIu64 "\n", flags);

    qemu_put_be64(f, RAM_SAVE_FLAG_HOOK);

    qemu_fflush(f);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     trace_ps2_reset_keyboard(s);

     s->scan_enabled = 1;
+
+    s->scancode_set = 2;
+

     ps2_set_ledstate(s, 0);

static void ps2_reset_keyboard(PS2KbdState *s)

{

    trace_ps2_reset_keyboard(s);

    s->scan_enabled = 1;

    s->scancode_set = 2;

    ps2_set_ledstate(s, 0);

}


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

     }
+
+
+
+    if (ret == 0) {
+
         rdma->nb_sent++;

         DDDPRINTF("sent total: %d\n", rdma->nb_sent);

static int qemu_rdma_write_flush(QEMUFile *f, RDMAContext *rdma)

{

    int ret;

    if (!rdma->current_length) {

        return 0;

    }

    ret = qemu_rdma_write_one(f, rdma,

            rdma->current_index, rdma->current_addr, rdma->current_length);

    if (ret < 0) {

        return ret;

    }

    if (ret == 0) {

        rdma->nb_sent++;

        DDDPRINTF("sent total: %d\n", rdma->nb_sent);

    }

    rdma->current_length = 0;

    rdma->current_addr = 0;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,21 +1,21 @@
 const char *cpu_parse_cpu_model(const char *typename, const char *cpu_model)

 {
+
     ObjectClass *oc;

     CPUClass *cc;

     Error *err = NULL;

+    gchar **model_pieces;

     const char *cpu_type;

+

+    model_pieces = g_strsplit(cpu_model, ",", 2);
+

     oc = cpu_class_by_name(typename, model_pieces[0]);

const char *cpu_parse_cpu_model(const char *typename, const char *cpu_model)

{

    ObjectClass *oc;

    CPUClass *cc;

    Error *err = NULL;

    gchar **model_pieces;

    const char *cpu_type;

    model_pieces = g_strsplit(cpu_model, ",", 2);

    oc = cpu_class_by_name(typename, model_pieces[0]);

    if (oc == NULL) {

        g_strfreev(model_pieces);

        return NULL;

    }

    cpu_type = object_class_get_name(oc);

    cc = CPU_CLASS(oc);

    cc->parse_features(cpu_type, model_pieces[1], &err);

    g_strfreev(model_pieces);

    if (err != NULL) {

        error_report_err(err);

        return NULL;

    }

    return cpu_type;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx)

+{

     int cpu_flags = av_get_cpu_flags();

av_cold void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx)

{

    int cpu_flags = av_get_cpu_flags();

    if (have_vfp(cpu_flags)) {

        if (!have_vfpv3(cpu_flags)) {

            c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_vfp;

            c->int32_to_float_fmul_array8 = ff_int32_to_float_fmul_array8_vfp;

        }

    }

    if (have_neon(cpu_flags)) {

        c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon;

    }

}


static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx)

{

    uint16_t num_heads = vring_avail_idx(vq) - idx;

    /* Check it isn't doing very strange things with descriptor numbers. */

    if (num_heads > vq->vring.num) {

        error_report("Guest moved used index from %u to %u",

                     idx, vring_avail_idx(vq));

        exit(1);

    return num_heads;


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

         error_setg(errp, "acpi: device plug request for not supported device"

+                   " type: %s", object_get_typename(OBJECT(dev)));
+
+    }
+
+}

void ich9_pm_device_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,

                            Error **errp)

{

    ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev);

    if (lpc->pm.acpi_memory_hotplug.is_enabled &&

        object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {

        acpi_memory_plug_cb(hotplug_dev, &lpc->pm.acpi_memory_hotplug,

                            dev, errp);

    } else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {

        if (lpc->pm.cpu_hotplug_legacy) {

            legacy_acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.gpe_cpu, dev, errp);

        } else {

            acpi_cpu_plug_cb(hotplug_dev, &lpc->pm.cpuhp_state, dev, errp);

        }

    } else {

        error_setg(errp, "acpi: device plug request for not supported device"

                   " type: %s", object_get_typename(OBJECT(dev)));

    }

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+void fifo_realloc(FifoBuffer *f, int new_size){
+
     int old_size= f->end - f->buffer;

void fifo_realloc(FifoBuffer *f, int new_size){

    int old_size= f->end - f->buffer;

    if(old_size < new_size){

        uint8_t *old= f->buffer;

        f->buffer= av_realloc(f->buffer, new_size);

        f->rptr += f->buffer - old;

        f->wptr += f->buffer - old;

        if(f->wptr < f->rptr){

            memmove(f->rptr + new_size - old_size, f->rptr, f->buffer + old_size - f->rptr);

            f->rptr += new_size - old_size;

        }

        f->end= f->buffer + new_size;

    }

}


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

     uc->product_desc   = "QEMU USB Mouse";

+    uc->usb_desc       = &desc_mouse;
+
+    uc->handle_packet  = usb_generic_handle_packet;
+
+    uc->handle_reset   = usb_hid_handle_reset;

     uc->handle_control = usb_hid_handle_control;

static void usb_mouse_class_initfn(ObjectClass *klass, void *data)

{

    USBDeviceClass *uc = USB_DEVICE_CLASS(klass);

    uc->init           = usb_mouse_initfn;

    uc->product_desc   = "QEMU USB Mouse";

    uc->usb_desc       = &desc_mouse;

    uc->handle_packet  = usb_generic_handle_packet;

    uc->handle_reset   = usb_hid_handle_reset;

    uc->handle_control = usb_hid_handle_control;

    uc->handle_data    = usb_hid_handle_data;

    uc->handle_destroy = usb_hid_handle_destroy;

}


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

+    visit_type_number(data->ov, NULL, &value, &error_abort);
+
+
+
+    obj = visitor_get(data);

     g_assert(qobject_type(obj) == QTYPE_QFLOAT);

static void test_visitor_out_number(TestOutputVisitorData *data,

                                    const void *unused)

{

    double value = 3.14;

    QObject *obj;

    visit_type_number(data->ov, NULL, &value, &error_abort);

    obj = visitor_get(data);

    g_assert(qobject_type(obj) == QTYPE_QFLOAT);

    g_assert(qfloat_get_double(qobject_to_qfloat(obj)) == value);

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
     /* if found, seek there */

     if (index >= 0){
+
+        c->curframe = st->index_entries[index].pos;
+
+        return 0;
+
     }

     /* if timestamp is out of bounds, return error */

static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)

{

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

    MPCContext *c = s->priv_data;

    AVPacket pkt1, *pkt = &pkt1;

    int ret;

    int index = av_index_search_timestamp(st, timestamp - DELAY_FRAMES, flags);

    uint32_t lastframe;

    /* if found, seek there */

    if (index >= 0){

        c->curframe = st->index_entries[index].pos;

        return 0;

    }

    /* if timestamp is out of bounds, return error */

    if(timestamp < 0 || timestamp >= c->fcount)

        return -1;

    timestamp -= DELAY_FRAMES;

    /* seek to the furthest known position and read packets until

       we reach desired position */

    lastframe = c->curframe;

    if(c->frames_noted) c->curframe = c->frames_noted - 1;

    while(c->curframe < timestamp){

        ret = av_read_frame(s, pkt);

        if (ret < 0){

            c->curframe = lastframe;

            return ret;

        }

        av_free_packet(pkt);

    }

    return 0;

}


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

     unsigned int den, q, r;

void helper_divl_EAX_T0(void)

{

    unsigned int den, q, r;

    uint64_t num;

    num = ((uint32_t)EAX) | ((uint64_t)((uint32_t)EDX) << 32);

    den = T0;

    if (den == 0) {

        raise_exception(EXCP00_DIVZ);

    }

#ifdef BUGGY_GCC_DIV64

    r = div32(&q, num, den);

#else

    q = (num / den);

    r = (num % den);

#endif

    EAX = (uint32_t)q;

    EDX = (uint32_t)r;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void avcodec_flush_buffers(AVCodecContext *avctx)

+{

     if(HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)

void avcodec_flush_buffers(AVCodecContext *avctx)

{

    if(HAVE_PTHREADS && avctx->active_thread_type&FF_THREAD_FRAME)

        ff_thread_flush(avctx);

    if(avctx->codec->flush)

        avctx->codec->flush(avctx);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void serial_exit_core(SerialState *s)
 {
     qemu_chr_fe_deinit(&s->chr);
+    qemu_unregister_reset(serial_reset, s);
 }

void serial_exit_core(SerialState *s)
{
    qemu_chr_fe_deinit(&s->chr);
    qemu_unregister_reset(serial_reset, s);
}


--- a/source.c
+++ b/source.c
@@ -4,4 +4,4 @@
     QObject *qobj = qmp_input_get_object(qiv, name, true);
     if (qobject_type(qobj) != QTYPE_QNULL) {
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
+                   "null");

static void qmp_input_type_null(Visitor *v, const char *name, Error **errp)
{
    QmpInputVisitor *qiv = to_qiv(v);
    QObject *qobj = qmp_input_get_object(qiv, name, true);
    if (qobject_type(qobj) != QTYPE_QNULL) {
        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
                   "null");


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,

                           int timestamp, int size)
+
+{
+
+
+    pkt->data = av_malloc(size);

     if (!pkt->data)

int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,

                          int timestamp, int size)

{

    pkt->data = av_malloc(size);

    if (!pkt->data)

        return AVERROR(ENOMEM);

    pkt->data_size  = size;

    pkt->channel_id = channel_id;

    pkt->type       = type;

    pkt->timestamp  = timestamp;

    pkt->extra      = 0;

    pkt->ts_delta   = 0;

    return 0;


--- a/source.c
+++ b/source.c
@@ -7,9 +7,9 @@
     ssize_t ret;

+
+    do {
+
         ret = s->write(s, data, size);

     } while (ret == -1 && ((s->get_error(s)) == EINTR));

ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)

{

    FdMigrationState *s = opaque;

    ssize_t ret;

    do {

        ret = s->write(s, data, size);

    } while (ret == -1 && ((s->get_error(s)) == EINTR));

    if (ret == -1)

        ret = -(s->get_error(s));

    if (ret == -EAGAIN) {

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

    } else if (ret < 0) {

        s->state = MIG_STATE_ERROR;

        notifier_list_notify(&migration_state_notifiers, NULL);

    }

    return ret;

}


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

 {

+    AVFilterContext *ctx = inlink->dst;
+
+    TInterlaceContext *tinterlace = ctx->priv;
+

     if (tinterlace->cur)

static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)

{

    AVFilterContext *ctx = inlink->dst;

    TInterlaceContext *tinterlace = ctx->priv;

    if (tinterlace->cur)

        avfilter_unref_buffer(tinterlace->cur);

    tinterlace->cur  = tinterlace->next;

    tinterlace->next = picref;

}


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

 {

+    bdrv_lock_medium(bs->file->bs, locked);

 }

static void raw_lock_medium(BlockDriverState *bs, bool locked)

{

    bdrv_lock_medium(bs->file->bs, locked);

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     ESPState *s = opaque;

     uint32_t saddr;
+

+
     saddr = (addr >> s->it_shift) & (ESP_REGS - 1);

     DPRINTF("read reg[%d]: 0x%2.2x\n", saddr, s->rregs[saddr]);
@@ -18,7 +18,7 @@

         if (s->ti_size > 0) {

+            s->ti_size--;

             if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) {

static uint32_t esp_mem_readb(void *opaque, target_phys_addr_t addr)

{

    ESPState *s = opaque;

    uint32_t saddr;

    saddr = (addr >> s->it_shift) & (ESP_REGS - 1);

    DPRINTF("read reg[%d]: 0x%2.2x\n", saddr, s->rregs[saddr]);

    switch (saddr) {

    case ESP_FIFO:

        if (s->ti_size > 0) {

            s->ti_size--;

            if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) {

                /* Data in/out.  */

                fprintf(stderr, "esp: PIO data read not implemented\n");

                s->rregs[ESP_FIFO] = 0;

            } else {

                s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++];

            }

            esp_raise_irq(s);

        }

        if (s->ti_size == 0) {

            s->ti_rptr = 0;

            s->ti_wptr = 0;

        }

        break;

    case ESP_RINTR:

        // Clear interrupt/error status bits

        s->rregs[ESP_RSTAT] &= ~(STAT_GE | STAT_PE);

        esp_lower_irq(s);

        break;

    default:

        break;

    }

    return s->rregs[saddr];

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
                          bool notify_unmap)

 {
+
+    dma_addr_t addr = vtd_ce_get_slpt_base(ce);
+
+    uint32_t level = vtd_ce_get_level(ce);
+

     if (!vtd_iova_range_check(start, ce)) {

static int vtd_page_walk(VTDContextEntry *ce, uint64_t start, uint64_t end,

                         vtd_page_walk_hook hook_fn, void *private,

                         bool notify_unmap)

{

    dma_addr_t addr = vtd_ce_get_slpt_base(ce);

    uint32_t level = vtd_ce_get_level(ce);

    if (!vtd_iova_range_check(start, ce)) {

        return -VTD_FR_ADDR_BEYOND_MGAW;

    }

    if (!vtd_iova_range_check(end, ce)) {

        /* Fix end so that it reaches the maximum */

        end = vtd_iova_limit(ce);

    }

    return vtd_page_walk_level(addr, start, end, hook_fn, private,

                               level, true, true, notify_unmap);

}


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

     if ((ret = ff_thread_get_buffer(ctx, &f->tf, AV_GET_BUFFER_FLAG_REF)) < 0)
+
         return ret;

     sz = 64 * s->sb_cols * s->sb_rows;

static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)

{

    VP9Context *s = ctx->priv_data;

    int ret, sz;

    if ((ret = ff_thread_get_buffer(ctx, &f->tf, AV_GET_BUFFER_FLAG_REF)) < 0)

        return ret;

    sz = 64 * s->sb_cols * s->sb_rows;

    if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct VP9mvrefPair))))) {

        ff_thread_release_buffer(ctx, &f->tf);

        return AVERROR(ENOMEM);

    }

    f->segmentation_map = f->extradata->data;

    f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);

    // retain segmentation map if it doesn't update

    if (s->segmentation.enabled && !s->segmentation.update_map &&

        !s->keyframe && !s->intraonly) {

        memcpy(f->segmentation_map, s->frames[LAST_FRAME].segmentation_map, sz);

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
                        BIOSLinker *linker, GArray *dsm_dma_arrea)

 {
+
+    GSList *device_list;
+
+
+
     /* no NVDIMM device is plugged. */

     device_list = nvdimm_get_plugged_device_list();

void nvdimm_build_acpi(GArray *table_offsets, GArray *table_data,

                       BIOSLinker *linker, GArray *dsm_dma_arrea)

{

    GSList *device_list;

    /* no NVDIMM device is plugged. */

    device_list = nvdimm_get_plugged_device_list();

    if (!device_list) {

        return;

    }

    nvdimm_build_nfit(device_list, table_offsets, table_data, linker);

    nvdimm_build_ssdt(device_list, table_offsets, table_data, linker,

                      dsm_dma_arrea);

    g_slist_free(device_list);

}


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

 {
+
+    VirtIOBlockReq *req = opaque;
+
+
+
     if (ret) {

         if (virtio_blk_handle_rw_error(req, -ret, 0)) {

static void virtio_blk_flush_complete(void *opaque, int ret)

{

    VirtIOBlockReq *req = opaque;

    if (ret) {

        if (virtio_blk_handle_rw_error(req, -ret, 0)) {

            return;

        }

    }

    virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);

    block_acct_done(bdrv_get_stats(req->dev->bs), &req->acct);

    virtio_blk_free_request(req);

}


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

     if (error_is_set(errp)) {
+
+        monitor_printf(mon, "%s\n", error_get_pretty(*errp));
+
         error_free(*errp);

     }

static void hmp_handle_error(Monitor *mon, Error **errp)

{

    if (error_is_set(errp)) {

        monitor_printf(mon, "%s\n", error_get_pretty(*errp));

        error_free(*errp);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static inline void cris_ftag_d(unsigned int x)

 {

static inline void cris_ftag_d(unsigned int x)

{

	register unsigned int v asm("$r10") = x;

	asm ("ftagd\t[%0]\n" : : "r" (v) );

}


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

     RMContext *rm = s->priv_data;
+
+    AVStream *st;
+
+

     rm->old_format = 1;

static int rm_read_header_old(AVFormatContext *s, AVFormatParameters *ap)

{

    RMContext *rm = s->priv_data;

    AVStream *st;

    rm->old_format = 1;

    st = av_new_stream(s, 0);

    if (!st)

        goto fail;

    rm_read_audio_stream_info(s, st, 1);

    return 0;

 fail:

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     acpi_build(build_state->guest_info, &tables);

+
+    assert(acpi_data_len(tables.table_data) == build_state->table_size);
+
+
+
     /* Make sure RAM size is correct - in case it got changed by migration */

     qemu_ram_resize(build_state->table_ram, build_state->table_size,

static void acpi_build_update(void *build_opaque, uint32_t offset)

{

    AcpiBuildState *build_state = build_opaque;

    AcpiBuildTables tables;

    /* No state to update or already patched? Nothing to do. */

    if (!build_state || build_state->patched) {

        return;

    }

    build_state->patched = 1;

    acpi_build_tables_init(&tables);

    acpi_build(build_state->guest_info, &tables);

    assert(acpi_data_len(tables.table_data) == build_state->table_size);

    /* Make sure RAM size is correct - in case it got changed by migration */

    qemu_ram_resize(build_state->table_ram, build_state->table_size,

                    &error_abort);

    memcpy(qemu_get_ram_ptr(build_state->table_ram), tables.table_data->data,

           build_state->table_size);

    memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp));

    memcpy(qemu_get_ram_ptr(build_state->linker_ram), tables.linker->data,

           build_state->linker_size);

    cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram,

                                               build_state->table_size);

    acpi_build_tables_cleanup(&tables, true);

}


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

     qemu_free(blkdev->type);

+    qemu_free(blkdev->dev);
+
+    qemu_free(blkdev->devtype);
+
+    qemu_bh_delete(blkdev->bh);

     return 0;

static int blk_free(struct XenDevice *xendev)

{

    struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);

    struct ioreq *ioreq;

    while (!LIST_EMPTY(&blkdev->freelist)) {

	ioreq = LIST_FIRST(&blkdev->freelist);

        LIST_REMOVE(ioreq, list);

        qemu_iovec_destroy(&ioreq->v);

	qemu_free(ioreq);

    }

    qemu_free(blkdev->params);

    qemu_free(blkdev->mode);

    qemu_free(blkdev->type);

    qemu_free(blkdev->dev);

    qemu_free(blkdev->devtype);

    qemu_bh_delete(blkdev->bh);

    return 0;

}


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

     QObject *obj = qobject_from_json("{'abc':32", NULL);

static void unterminated_dict(void)

{

    QObject *obj = qobject_from_json("{'abc':32", NULL);

    g_assert(obj == NULL);

}


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

 {

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

     Visitor *v;

static void test_visitor_in_int_overflow(TestInputVisitorData *data,

                                         const void *unused)

{

    int64_t res = 0;

    Error *err = NULL;

    Visitor *v;

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

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

     * to visit_type_int. confirm this.

     */

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

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

    g_assert(err);

    error_free(err);

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     int frame_size = 1 << (venc->log2_blocksize[1] - 1);

     int subframes = frame_size / sf_size;
+
+
+
+    for (int sf = 0; sf < subframes; sf++) {
+
         cur = ff_bufqueue_get(&venc->bufqueue);

         *samples += cur->nb_samples;

static void move_audio(vorbis_enc_context *venc, float *audio, int *samples, int sf_size)

{

    AVFrame *cur = NULL;

    int frame_size = 1 << (venc->log2_blocksize[1] - 1);

    int subframes = frame_size / sf_size;

    for (int sf = 0; sf < subframes; sf++) {

        cur = ff_bufqueue_get(&venc->bufqueue);

        *samples += cur->nb_samples;

        for (int ch = 0; ch < venc->channels; ch++) {

            const float *input = (float *) cur->extended_data[ch];

            const size_t len  = cur->nb_samples * sizeof(float);

            memcpy(audio + ch*frame_size + sf*sf_size, input, len);

        }

        av_frame_free(&cur);

    }

}


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

     PosixAioState *s = opaque;

static int posix_aio_flush(void *opaque)

{

    PosixAioState *s = opaque;

    return !!s->first_aio;

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
                 if (!read_yesno()) {

                     fprintf(stderr, "Not overwriting - exiting\n");
+
+                    exit_program(1);
+
+                }
+
             }

             else {

static void assert_file_overwrite(const char *filename)

{

    if (file_overwrite && file_skip) {

        fprintf(stderr, "Error, both -y and -n supplied. Exiting.\n");

        exit_program(1);

    }

    if (!file_overwrite &&

        (strchr(filename, ':') == NULL || filename[1] == ':' ||

         av_strstart(filename, "file:", NULL))) {

        if (avio_check(filename, 0) == 0) {

            if (!using_stdin && !file_skip) {

                fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);

                fflush(stderr);

                if (!read_yesno()) {

                    fprintf(stderr, "Not overwriting - exiting\n");

                    exit_program(1);

                }

            }

            else {

                fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);

                exit_program(1);

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -25,11 +25,11 @@
         break;

     case 2:
+
+        bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);
+
+        break;
+
     case 3:

         if (bm->unit == 0)

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

{

    BMDMAState *bm = opaque;

    PCIIDEState *pci_dev = pci_from_bm(bm);

#ifdef DEBUG_IDE

    printf("bmdma: writeb 0x%02x : 0x%02x\n", addr, val);

#endif

    switch(addr & 3) {

    case 1:

        pci_dev->dev.config[MRDMODE] =

            (pci_dev->dev.config[MRDMODE] & ~0x30) | (val & 0x30);

        cmd646_update_irq(pci_dev);

        break;

    case 2:

        bm->status = (val & 0x60) | (bm->status & 1) | (bm->status & ~val & 0x06);

        break;

    case 3:

        if (bm->unit == 0)

            pci_dev->dev.config[UDIDETCR0] = val;

        else

            pci_dev->dev.config[UDIDETCR1] = val;

        break;

    }

}


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

     if (!vs->kbd_layout)

+        exit(1);
+
+
+
+    qemu_mutex_init(&vs->mutex);

     vnc_start_worker_thread();

void vnc_display_init(const char *id)

{

    VncDisplay *vs;

    if (vnc_display_find(id) != NULL) {

        return;

    }

    vs = g_malloc0(sizeof(*vs));

    vs->id = strdup(id);

    QTAILQ_INSERT_TAIL(&vnc_displays, vs, next);

    vs->lsock = -1;

#ifdef CONFIG_VNC_WS

    vs->lwebsock = -1;

#endif

    QTAILQ_INIT(&vs->clients);

    vs->expires = TIME_MAX;

    if (keyboard_layout) {

        trace_vnc_key_map_init(keyboard_layout);

        vs->kbd_layout = init_keyboard_layout(name2keysym, keyboard_layout);

    } else {

        vs->kbd_layout = init_keyboard_layout(name2keysym, "en-us");

    }

    if (!vs->kbd_layout)

        exit(1);

    qemu_mutex_init(&vs->mutex);

    vnc_start_worker_thread();

    vs->dcl.ops = &dcl_ops;

    register_displaychangelistener(&vs->dcl);

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static void vnc_write_pixels_generic(VncState *vs, void *pixels1, int size)

+{

     uint8_t buf[4];

+    if (vs->depth == 4) {

+        uint32_t *pixels = pixels1;

         int n, i;

@@ -16,7 +16,7 @@

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

+            vnc_convert_pixel(vs, buf, pixels[i]);

             vnc_write(vs, buf, vs->pix_bpp);

static void vnc_write_pixels_generic(VncState *vs, void *pixels1, int size)

{

    uint8_t buf[4];

    if (vs->depth == 4) {

        uint32_t *pixels = pixels1;

        int n, i;

        n = size >> 2;

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

            vnc_convert_pixel(vs, buf, pixels[i]);

            vnc_write(vs, buf, vs->pix_bpp);

        }

    } else if (vs->depth == 2) {

        uint16_t *pixels = pixels1;

        int n, i;

        n = size >> 1;

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

            vnc_convert_pixel(vs, buf, pixels[i]);

            vnc_write(vs, buf, vs->pix_bpp);

        }

    } else if (vs->depth == 1) {

        uint8_t *pixels = pixels1;

        int n, i;

        n = size;

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

            vnc_convert_pixel(vs, buf, pixels[i]);

            vnc_write(vs, buf, vs->pix_bpp);

        }

    } else {

        fprintf(stderr, "vnc_write_pixels_generic: VncState color depth not supported\n");

    }

}


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

     assert(ctx_pic);
+
+
+
+    fill_picture_parameters(avctx, ctx, s, &ctx_pic->pp);
+
     fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);

static int dxva2_mpeg2_start_frame(AVCodecContext *avctx,

                                   av_unused const uint8_t *buffer,

                                   av_unused uint32_t size)

{

    const struct MpegEncContext *s = avctx->priv_data;

    AVDXVAContext *ctx = avctx->hwaccel_context;

    struct dxva2_picture_context *ctx_pic =

        s->current_picture_ptr->hwaccel_picture_private;

    if (!DXVA_CONTEXT_VALID(avctx, ctx))

        return -1;

    assert(ctx_pic);

    fill_picture_parameters(avctx, ctx, s, &ctx_pic->pp);

    fill_quantization_matrices(avctx, ctx, s, &ctx_pic->qm);

    ctx_pic->slice_count    = 0;

    ctx_pic->bitstream_size = 0;

    ctx_pic->bitstream      = NULL;

    return 0;

}


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

     if (!nptr) {
+
+        if (endptr) {
+
+            *endptr = nptr;
+
         }

         err = -EINVAL;

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

                long *result)

{

    char *ep;

    int err = 0;

    if (!nptr) {

        if (endptr) {

            *endptr = nptr;

        }

        err = -EINVAL;

    } else {

        errno = 0;

        *result = strtol(nptr, &ep, base);

        err = check_strtox_error(nptr, ep, endptr, errno);

    }

    return err;

}


--- a/source.c
+++ b/source.c
@@ -5,9 +5,9 @@
     PCIAC97LinkState *d = opaque;

     AC97LinkState *s = &d->ac97;
+
+    dolog ("U nam readl %#x\n", addr);
+
     s->cas = 0;

     return ~0U;

static uint32_t nam_readl (void *opaque, uint32_t addr)

{

    PCIAC97LinkState *d = opaque;

    AC97LinkState *s = &d->ac97;

    dolog ("U nam readl %#x\n", addr);

    s->cas = 0;

    return ~0U;

}


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

     struct viosrp_adapter_info *sinfo;
+
     struct mad_adapter_info_data info;

     int rc;
+

     sinfo = &req->iu.mad.adapter_info;

+#if 0 /* What for ? */

     rc = spapr_tce_dma_read(&s->vdev, be64_to_cpu(sinfo->buffer),

static int vscsi_send_adapter_info(VSCSIState *s, vscsi_req *req)

{

    struct viosrp_adapter_info *sinfo;

    struct mad_adapter_info_data info;

    int rc;

    sinfo = &req->iu.mad.adapter_info;

#if 0 /* What for ? */

    rc = spapr_tce_dma_read(&s->vdev, be64_to_cpu(sinfo->buffer),

                            &info, be16_to_cpu(sinfo->common.length));

    if (rc) {

        fprintf(stderr, "vscsi_send_adapter_info: DMA read failure !\n");

    }

#endif

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

    strcpy(info.srp_version, SRP_VERSION);

    strncpy(info.partition_name, "qemu", sizeof("qemu"));

    info.partition_number = cpu_to_be32(0);

    info.mad_version = cpu_to_be32(1);

    info.os_type = cpu_to_be32(2);

    info.port_max_txu[0] = cpu_to_be32(VSCSI_MAX_SECTORS << 9);

    rc = spapr_tce_dma_write(&s->vdev, be64_to_cpu(sinfo->buffer),

                             &info, be16_to_cpu(sinfo->common.length));

    if (rc)  {

        fprintf(stderr, "vscsi_send_adapter_info: DMA write failure !\n");

    }

    sinfo->common.status = rc ? cpu_to_be32(1) : 0;

    return vscsi_send_iu(s, req, sizeof(*sinfo), VIOSRP_MAD_FORMAT);

}


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

         s->mode_8bit = 0;

+        avctx->pix_fmt = AV_PIX_FMT_RGB555;
+
+    }
+
+

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

static av_cold int msvideo1_decode_init(AVCodecContext *avctx)

{

    Msvideo1Context *s = avctx->priv_data;

    s->avctx = avctx;

    /* figure out the colorspace based on the presence of a palette */

    if (s->avctx->bits_per_coded_sample == 8) {

        s->mode_8bit = 1;

        avctx->pix_fmt = AV_PIX_FMT_PAL8;

    } else {

        s->mode_8bit = 0;

        avctx->pix_fmt = AV_PIX_FMT_RGB555;

    }

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

    return 0;

}


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

         len = iov_to_buf(elem.out_sg, elem.out_num,

+                         0, &event, sizeof(event));
+
+        if (vic->handle_status) {
+
+            vic->handle_status(vinput, &event);

         }

static void virtio_input_handle_sts(VirtIODevice *vdev, VirtQueue *vq)

{

    VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vdev);

    VirtIOInput *vinput = VIRTIO_INPUT(vdev);

    virtio_input_event event;

    VirtQueueElement elem;

    int len;

    while (virtqueue_pop(vinput->sts, &elem)) {

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

        len = iov_to_buf(elem.out_sg, elem.out_num,

                         0, &event, sizeof(event));

        if (vic->handle_status) {

            vic->handle_status(vinput, &event);

        }

        virtqueue_push(vinput->sts, &elem, len);

    }

    virtio_notify(vdev, vinput->sts);

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+static int find_snapshot_by_id_or_name(BlockDriverState *bs, const char *name)
+
+{
+
+    BDRVQcowState *s = bs->opaque;
+
+    int i, ret;

+

     ret = find_snapshot_by_id(bs, name);

static int find_snapshot_by_id_or_name(BlockDriverState *bs, const char *name)

{

    BDRVQcowState *s = bs->opaque;

    int i, ret;

    ret = find_snapshot_by_id(bs, name);

    if (ret >= 0)

        return ret;

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

        if (!strcmp(s->snapshots[i].name, name))

            return i;

    }

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)

 {
+
+    /* should be the case, see cirrus_bitblt_start */
+
+    assert(s->cirrus_blt_width > 0);
+
     assert(s->cirrus_blt_height > 0);

static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)

{

    /* should be the case, see cirrus_bitblt_start */

    assert(s->cirrus_blt_width > 0);

    assert(s->cirrus_blt_height > 0);

    if (s->cirrus_blt_width > CIRRUS_BLTBUFSIZE) {

        return true;

    }

    if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,

                              s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {

        return true;

    }

    if (dst_only) {

        return false;

    }

    if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,

                              s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {

        return true;

    }

    return false;

}


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

         goto fail;
+
+
+
+    ret = ff_end_frame(outlink);
+

 fail:

static int source_request_frame(AVFilterLink *outlink)

{

    Frei0rContext *frei0r = outlink->src->priv;

    AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);

    int ret;

    picref->video->pixel_aspect = (AVRational) {1, 1};

    picref->pts = frei0r->pts++;

    picref->pos = -1;

    ret = ff_start_frame(outlink, avfilter_ref_buffer(picref, ~0));

    if (ret < 0)

        goto fail;

    frei0r->update(frei0r->instance, av_rescale_q(picref->pts, frei0r->time_base, (AVRational){1,1000}),

                   NULL, (uint32_t *)picref->data[0]);

    ret = ff_draw_slice(outlink, 0, outlink->h, 1);

    if (ret < 0)

        goto fail;

    ret = ff_end_frame(outlink);

fail:

    avfilter_unref_buffer(picref);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 uint32_t pci_default_read_config(PCIDevice *d,

                                  uint32_t address, int len)
+
+{
+
     uint32_t val;
+
     switch(len) {

     case 1:

uint32_t pci_default_read_config(PCIDevice *d,

                                 uint32_t address, int len)

{

    uint32_t val;

    switch(len) {

    case 1:

        val = d->config[address];

        break;

    case 2:

        val = le16_to_cpu(*(uint16_t *)(d->config + address));

        break;

    default:

    case 4:

        val = le32_to_cpu(*(uint32_t *)(d->config + address));

        break;

    }

    return val;

}


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

+    vs->vd = vd;
+
     vs->ds = vd->ds;

     vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs);

static void vnc_connect(VncDisplay *vd, int csock)

{

    VncState *vs = qemu_mallocz(sizeof(VncState));

    vs->csock = csock;

    VNC_DEBUG("New client on socket %d\n", csock);

    dcl->idle = 0;

    socket_set_nonblock(vs->csock);

    qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);

    vs->vd = vd;

    vs->ds = vd->ds;

    vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs);

    vs->last_x = -1;

    vs->last_y = -1;

    vs->as.freq = 44100;

    vs->as.nchannels = 2;

    vs->as.fmt = AUD_FMT_S16;

    vs->as.endianness = 0;

    vnc_resize(vs);

    vnc_write(vs, "RFB 003.008\n", 12);

    vnc_flush(vs);

    vnc_read_when(vs, protocol_version, 12);

    memset(vs->old_data, 0, ds_get_linesize(vs->ds) * ds_get_height(vs->ds));

    memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));

    vnc_update_client(vs);

    reset_keys(vs);

    vs->next = vd->clients;

    vd->clients = vs;

}


--- a/source.c
+++ b/source.c
@@ -35,11 +35,11 @@
             node->io_notify) {

             node->pfd.revents = 0;
+
+            node->io_notify(node->e);
+
+
+
             /* aio_notify() does not count as progress */

             if (node->e != &ctx->notifier) {

static bool aio_dispatch_handlers(AioContext *ctx, HANDLE event)

{

    AioHandler *node;

    bool progress = false;

    /*

     * We have to walk very carefully in case aio_set_fd_handler is

     * called while we're walking.

     */

    node = QLIST_FIRST(&ctx->aio_handlers);

    while (node) {

        AioHandler *tmp;

        ctx->walking_handlers++;

        if (!node->deleted &&

            (node->pfd.revents || event_notifier_get_handle(node->e) == event) &&

            node->io_notify) {

            node->pfd.revents = 0;

            node->io_notify(node->e);

            /* aio_notify() does not count as progress */

            if (node->e != &ctx->notifier) {

                progress = true;

            }

        }

        tmp = node;

        node = QLIST_NEXT(node, node);

        ctx->walking_handlers--;

        if (!ctx->walking_handlers && tmp->deleted) {

            QLIST_REMOVE(tmp, node);

            g_free(tmp);

        }

    }

    return progress;

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
     ret = lseek(fs->fd, offset, SEEK_SET);

     if (ret >= 0) {
+
+        ret = writev(fs->fd, iov, iovcnt);
+
+    }
+
 #endif

 #ifdef CONFIG_SYNC_FILE_RANGE

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

                             const struct iovec *iov,

                             int iovcnt, off_t offset)

{

    ssize_t ret;

#ifdef CONFIG_PREADV

    ret = pwritev(fs->fd, iov, iovcnt, offset);

#else

    ret = lseek(fs->fd, offset, SEEK_SET);

    if (ret >= 0) {

        ret = writev(fs->fd, iov, iovcnt);

    }

#endif

#ifdef CONFIG_SYNC_FILE_RANGE

    if (ret > 0 && ctx->export_flags & V9FS_IMMEDIATE_WRITEOUT) {

        /*

         * Initiate a writeback. This is not a data integrity sync.

         * We want to ensure that we don't leave dirty pages in the cache

         * after write when writeout=immediate is sepcified.

         */

        sync_file_range(fs->fd, offset, ret,

                        SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE);

    }

#endif

    return ret;

}


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

 	uint32_t sector_offset_in_chunk;

+	if(dmg_read_chunk(bs, sector_num+i) != 0)
+
+	    return -1;
+
+	sector_offset_in_chunk = sector_num+i-s->sectors[s->current_chunk];

 	memcpy(buf+i*512,s->uncompressed_chunk+sector_offset_in_chunk*512,512);

static int dmg_read(BlockDriverState *bs, int64_t sector_num,

                    uint8_t *buf, int nb_sectors)

{

    BDRVDMGState *s = bs->opaque;

    int i;

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

	uint32_t sector_offset_in_chunk;

	if(dmg_read_chunk(bs, sector_num+i) != 0)

	    return -1;

	sector_offset_in_chunk = sector_num+i-s->sectors[s->current_chunk];

	memcpy(buf+i*512,s->uncompressed_chunk+sector_offset_in_chunk*512,512);

    }

    return 0;

}


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

 {

+    static const LxBoardDesc ml605_board = {
+
+        .flash_base = 0xf8000000,
+
         .flash_size = 0x01000000,

         .flash_sector_size = 0x20000,

static void xtensa_ml605_init(MachineState *machine)

{

    static const LxBoardDesc ml605_board = {

        .flash_base = 0xf8000000,

        .flash_size = 0x01000000,

        .flash_sector_size = 0x20000,

        .sram_size = 0x2000000,

    };

    lx_init(&ml605_board, machine);

}


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

         timer_del(state->buffered_io_timer);

+        xc_evtchn_unmask(state->xce_handle, state->bufioreq_local_port);
+
+    }
+
+}

static void handle_buffered_io(void *opaque)

{

    XenIOState *state = opaque;

    if (handle_buffered_iopage(state)) {

        timer_mod(state->buffered_io_timer,

                BUFFER_IO_MAX_DELAY + qemu_clock_get_ms(QEMU_CLOCK_REALTIME));

    } else {

        timer_del(state->buffered_io_timer);

        xc_evtchn_unmask(state->xce_handle, state->bufioreq_local_port);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void microdrive_realize(DeviceState *dev, Error **errp)

+{

     MicroDriveState *md = MICRODRIVE(dev);

static void microdrive_realize(DeviceState *dev, Error **errp)

{

    MicroDriveState *md = MICRODRIVE(dev);

    ide_init2(&md->bus, qemu_allocate_irqs(md_set_irq, md, 1)[0]);

}


--- a/source.c
+++ b/source.c
@@ -1,22 +1,22 @@
 void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe,

                                     VP8Frame *prev_frame, int is_vp7)
+
+{

     VP8Context *s = avctx->priv_data;

     int mb_x, mb_y;
+
+

     s->mv_min.y = -MARGIN;
+
+    s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
+
     for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
+
+        VP8Macroblock *mb = s->macroblocks_base +

                             ((s->mb_width + 1) * (mb_y + 1) + 1);

void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe,

                                    VP8Frame *prev_frame, int is_vp7)

{

    VP8Context *s = avctx->priv_data;

    int mb_x, mb_y;

    s->mv_min.y = -MARGIN;

    s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;

    for (mb_y = 0; mb_y < s->mb_height; mb_y++) {

        VP8Macroblock *mb = s->macroblocks_base +

                            ((s->mb_width + 1) * (mb_y + 1) + 1);

        int mb_xy = mb_y * s->mb_width;

        AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED * 0x01010101);

        s->mv_min.x = -MARGIN;

        s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;

        for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {

            if (mb_y == 0)

                AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top,

                         DC_PRED * 0x01010101);

            decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,

                           prev_frame && prev_frame->seg_map ?

                           prev_frame->seg_map->data + mb_xy : NULL, 1, is_vp7);

            s->mv_min.x -= 64;

            s->mv_max.x -= 64;

        }

        s->mv_min.y -= 64;

        s->mv_max.y -= 64;

    }

}


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

                       const char *name, Error **errp)

{

    DeviceState *dev = DEVICE(obj);

    Property *prop = opaque;

    char **ptr = qdev_get_prop_ptr(dev, prop);

    Error *local_err = NULL;

    char *str;

    if (dev->realized) {

        qdev_prop_set_after_realize(dev, name, errp);

        return;

    }

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

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }

    if (*ptr) {

        g_free(*ptr);

    }

    *ptr = str;

}


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
+static void ahci_pci_enable(AHCIQState *ahci)
+
+{
+
+    uint8_t reg;
+
+
+
+    start_ahci_device(ahci);

static void ahci_pci_enable(AHCIQState *ahci)

{

    uint8_t reg;

    start_ahci_device(ahci);

    switch (ahci->fingerprint) {

    case AHCI_INTEL_ICH9:

        /* ICH9 has a register at PCI 0x92 that

         * acts as a master port enabler mask. */

        reg = qpci_config_readb(ahci->dev, 0x92);

        reg |= 0x3F;

        qpci_config_writeb(ahci->dev, 0x92, reg);

        /* 0...0111111b -- bit significant, ports 0-5 enabled. */

        ASSERT_BIT_SET(qpci_config_readb(ahci->dev, 0x92), 0x3F);

        break;

    }

}


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

         case USB_SPEED_HIGH:

+            port->portsc |= PORTSC_SPEED_HIGH;
+
+            break;
+
+        case USB_SPEED_SUPER:

             port->portsc |= PORTSC_SPEED_SUPER;

static void xhci_port_update(XHCIPort *port, int is_detach)

{

    port->portsc = PORTSC_PP;

    if (port->uport->dev && port->uport->dev->attached && !is_detach &&

        (1 << port->uport->dev->speed) & port->speedmask) {

        port->portsc |= PORTSC_CCS;

        switch (port->uport->dev->speed) {

        case USB_SPEED_LOW:

            port->portsc |= PORTSC_SPEED_LOW;

            break;

        case USB_SPEED_FULL:

            port->portsc |= PORTSC_SPEED_FULL;

            break;

        case USB_SPEED_HIGH:

            port->portsc |= PORTSC_SPEED_HIGH;

            break;

        case USB_SPEED_SUPER:

            port->portsc |= PORTSC_SPEED_SUPER;

            break;

        }

    }

    if (xhci_running(port->xhci)) {

        port->portsc |= PORTSC_CSC;

        XHCIEvent ev = { ER_PORT_STATUS_CHANGE, CC_SUCCESS,

                         port->portnr << 24};

        xhci_event(port->xhci, &ev, 0);

        DPRINTF("xhci: port change event for port %d\n", port->portnr);

    }

}


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

 {

+    BDRVVPCState *s = bs->opaque;

     int ret;

static int vpc_read(BlockDriverState *bs, int64_t sector_num,

                    uint8_t *buf, int nb_sectors)

{

    BDRVVPCState *s = bs->opaque;

    int ret;

    int64_t offset;

    int64_t sectors, sectors_per_block;

    VHDFooter *footer = (VHDFooter *) s->footer_buf;

    if (cpu_to_be32(footer->type) == VHD_FIXED) {

        return bdrv_read(bs->file, sector_num, buf, nb_sectors);

    }

    while (nb_sectors > 0) {

        offset = get_sector_offset(bs, sector_num, 0);

        sectors_per_block = s->block_size >> BDRV_SECTOR_BITS;

        sectors = sectors_per_block - (sector_num % sectors_per_block);

        if (sectors > nb_sectors) {

            sectors = nb_sectors;

        }

        if (offset == -1) {

            memset(buf, 0, sectors * BDRV_SECTOR_SIZE);

        } else {

            ret = bdrv_pread(bs->file, offset, buf,

                sectors * BDRV_SECTOR_SIZE);

            if (ret != sectors * BDRV_SECTOR_SIZE) {

                return -1;

            }

        }

        nb_sectors -= sectors;

        sector_num += sectors;

        buf += sectors * BDRV_SECTOR_SIZE;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
     if (src_x != s->width)

         dxy |= motion_x & 1;
+
+    src_y = av_clip(src_y, -16, s->height);
+
+    if (src_y != s->height)
+
         dxy |= (motion_y & 1) << 1;

     src += src_y * s->linesize + src_x;

static inline int hpel_motion(MpegEncContext *s,

                              uint8_t *dest, uint8_t *src,

                              int src_x, int src_y,

                              op_pixels_func *pix_op,

                              int motion_x, int motion_y)

{

    int dxy = 0;

    int emu = 0;

    src_x += motion_x >> 1;

    src_y += motion_y >> 1;

    /* WARNING: do no forget half pels */

    src_x = av_clip(src_x, -16, s->width); // FIXME unneeded for emu?

    if (src_x != s->width)

        dxy |= motion_x & 1;

    src_y = av_clip(src_y, -16, s->height);

    if (src_y != s->height)

        dxy |= (motion_y & 1) << 1;

    src += src_y * s->linesize + src_x;

        if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) ||

            (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) {

            s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src,

                                     s->linesize, s->linesize,

                                     9, 9,

                                     src_x, src_y,

                                     s->h_edge_pos, s->v_edge_pos);

            src = s->edge_emu_buffer;

            emu = 1;

        }

    pix_op[dxy](dest, src, s->linesize, 8);

    return emu;

}


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

 {

+#ifdef TARGET_I386

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

void do_compare_and_swap32(void *cpu_env, int num)

{

#ifdef TARGET_I386

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

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

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

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

    {

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

        *value = tswap32(new);

        /* set zf flag */

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

    }

    else

    {

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

        /* unset zf flag */

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

    }

#else

    qerror("do_compare_and_swap32 unimplemented");

#endif

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     if(kbhit())

         return(getch());
+
+#elif defined(HAVE_TERMIOS_H)
+
+    int n = 1;
+
     unsigned char ch;

 #ifndef CONFIG_BEOS_NETSERVER

static int read_key(void)

{

#if defined(HAVE_CONIO_H)

    if(kbhit())

        return(getch());

#elif defined(HAVE_TERMIOS_H)

    int n = 1;

    unsigned char ch;

#ifndef CONFIG_BEOS_NETSERVER

    struct timeval tv;

    fd_set rfds;

    FD_ZERO(&rfds);

    FD_SET(0, &rfds);

    tv.tv_sec = 0;

    tv.tv_usec = 0;

    n = select(1, &rfds, NULL, NULL, &tv);

#endif

    if (n > 0) {

        n = read(0, &ch, 1);

        if (n == 1)

            return ch;

        return n;

    }

#endif

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
             /* XXX: dummy values */
             stream->packet_max_size = 4096;
             stream->nb_packets = 0;
+            stream->total_frames = stream->nb_packets;
+            break;
+        default:
+            return -1;
+    if (rv10_write_header(s, 0, 0))
         return AVERROR_INVALIDDATA;
     avio_flush(s->pb);
     return 0;

static int rm_write_header(AVFormatContext *s)
{
    RMMuxContext *rm = s->priv_data;
    StreamInfo *stream;
    int n;
    AVCodecContext *codec;
    for(n=0;n<s->nb_streams;n++) {
        s->streams[n]->id = n;
        codec = s->streams[n]->codec;
        stream = &rm->streams[n];
        memset(stream, 0, sizeof(StreamInfo));
        stream->num = n;
        stream->bit_rate = codec->bit_rate;
        stream->enc = codec;
        switch(codec->codec_type) {
        case AVMEDIA_TYPE_AUDIO:
            rm->audio_stream = stream;
            stream->frame_rate = (float)codec->sample_rate / (float)codec->frame_size;
            /* XXX: dummy values */
            stream->packet_max_size = 1024;
            stream->nb_packets = 0;
            stream->total_frames = stream->nb_packets;
            break;
        case AVMEDIA_TYPE_VIDEO:
            rm->video_stream = stream;
            stream->frame_rate = (float)codec->time_base.den / (float)codec->time_base.num;
            /* XXX: dummy values */
            stream->packet_max_size = 4096;
            stream->nb_packets = 0;
            stream->total_frames = stream->nb_packets;
            break;
        default:
            return -1;
    if (rv10_write_header(s, 0, 0))
        return AVERROR_INVALIDDATA;
    avio_flush(s->pb);
    return 0;


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
     if (uvalpha < 2048) {
         for (i = 0; i < (dstW >> 1); i++) {
             int Y1 = buf0[i * 2]     >> 7;
+            int Y2 = buf0[i * 2 + 1] >> 7;
+            int U  = ubuf0[i]        >> 7;
+            int V  = vbuf0[i]        >> 7;
+            int A1, A2;
+            const void *r =  c->table_rV[V],
                        *g = (c->table_gU[U] + c->table_gV[V]),
                        *b =  c->table_bU[U];
             if (hasAlpha) {

yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0,
                     const int16_t *ubuf[2], const int16_t *vbuf[2],
                     const int16_t *abuf0, uint8_t *dest, int dstW,
                     int uvalpha, int y, enum PixelFormat target,
                     int hasAlpha)
{
    const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];
    int i;
    if (uvalpha < 2048) {
        for (i = 0; i < (dstW >> 1); i++) {
            int Y1 = buf0[i * 2]     >> 7;
            int Y2 = buf0[i * 2 + 1] >> 7;
            int U  = ubuf0[i]        >> 7;
            int V  = vbuf0[i]        >> 7;
            int A1, A2;
            const void *r =  c->table_rV[V],
                       *g = (c->table_gU[U] + c->table_gV[V]),
                       *b =  c->table_bU[U];
            if (hasAlpha) {
                A1 = abuf0[i * 2    ] >> 7;
                A2 = abuf0[i * 2 + 1] >> 7;
            }
            yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
                          r, g, b, y, target, hasAlpha);
        }
    } else {
        const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];
        for (i = 0; i < (dstW >> 1); i++) {
            int Y1 =  buf0[i * 2]          >> 7;
            int Y2 =  buf0[i * 2 + 1]      >> 7;
            int U  = (ubuf0[i] + ubuf1[i]) >> 8;
            int V  = (vbuf0[i] + vbuf1[i]) >> 8;
            int A1, A2;
            const void *r =  c->table_rV[V],
                       *g = (c->table_gU[U] + c->table_gV[V]),
                       *b =  c->table_bU[U];
            if (hasAlpha) {
                A1 = abuf0[i * 2    ] >> 7;
                A2 = abuf0[i * 2 + 1] >> 7;
            }
            yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0,
                          r, g, b, y, target, hasAlpha);
        }
    }
}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void error_mem_write(void *opaque, target_phys_addr_t addr,

                             uint64_t value, unsigned size)
+
+{

     abort();

static void error_mem_write(void *opaque, target_phys_addr_t addr,

                            uint64_t value, unsigned size)

{

    abort();

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd)

+{
+
+    int ret;
+

     ret = read_block(ctx, bd);

static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd)

{

    int ret;

    ret = read_block(ctx, bd);

    if (ret)

        return ret;

    ret = decode_block(ctx, bd);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static inline void RENAME(palToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width, uint32_t *pal)
+
+{
+
 	int i;
+
+        assert(src1 == src2);
+
 	for(i=0; i<width; i++)

 	{

static inline void RENAME(palToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width, uint32_t *pal)

{

	int i;

        assert(src1 == src2);

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

	{

		int p= pal[src1[i]];

		dstU[i]= p>>8;

		dstV[i]= p>>16;

	}

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
         QSLIST_REMOVE_HEAD(&qov->stack, node);

         g_free(e);
+
+    }
+
+
+
     qobject_decref(qov->root);

     g_free(qov);

static void qmp_output_free(Visitor *v)

{

    QmpOutputVisitor *qov = to_qov(v);

    QStackEntry *e;

    while (!QSLIST_EMPTY(&qov->stack)) {

        e = QSLIST_FIRST(&qov->stack);

        QSLIST_REMOVE_HEAD(&qov->stack, node);

        g_free(e);

    }

    qobject_decref(qov->root);

    g_free(qov);

}


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

     Coroutine *co = opaque;

static void error_callback_bh(void *opaque)

{

    Coroutine *co = opaque;

    qemu_coroutine_enter(co);

}


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

     struct socket *so;

+    struct socket *head = (is_udp ? &udb : &tcb);
+
+    struct sockaddr_in addr;
+
+    int port = htons(host_port);

     socklen_t addr_len;

int slirp_remove_hostfwd(int is_udp, struct in_addr host_addr, int host_port)

{

    struct socket *so;

    struct socket *head = (is_udp ? &udb : &tcb);

    struct sockaddr_in addr;

    int port = htons(host_port);

    socklen_t addr_len;

    int n = 0;

 loop_again:

    for (so = head->so_next; so != head; so = so->so_next) {

        addr_len = sizeof(addr);

        if (getsockname(so->s, (struct sockaddr *)&addr, &addr_len) == 0 &&

            addr.sin_addr.s_addr == host_addr.s_addr &&

            addr.sin_port == port) {

            close(so->s);

            sofree(so);

            n++;

            goto loop_again;

        }

    }

    return n;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void qobject_input_optional(Visitor *v, const char *name, bool *present)

+{

     QObjectInputVisitor *qiv = to_qiv(v);

static void qobject_input_optional(Visitor *v, const char *name, bool *present)

{

    QObjectInputVisitor *qiv = to_qiv(v);

    QObject *qobj = qobject_input_get_object(qiv, name, false, NULL);

    if (!qobj) {

        *present = false;

        return;

    }

    *present = true;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 int pci_piix3_xen_ide_unplug(DeviceState *dev)

 {
+
     PCIIDEState *pci_ide;
+
     DriveInfo *di;

     int i = 0;

int pci_piix3_xen_ide_unplug(DeviceState *dev)

{

    PCIIDEState *pci_ide;

    DriveInfo *di;

    int i = 0;

    pci_ide = PCI_IDE(dev);

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

        di = drive_get_by_index(IF_IDE, i);

        if (di != NULL && !di->media_cd) {

            BlockBackend *blk = blk_by_legacy_dinfo(di);

            DeviceState *ds = blk_get_attached_dev(blk);

            if (ds) {

                blk_detach_dev(blk, ds);

            }

            pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;

            blk_unref(blk);

        }

    }

    qdev_reset_all(DEVICE(dev));

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
     buf_size -= 4;
     switch (compr) {
     case 0:
+        stride = (avctx->width * 3 + 3) & ~3;
+        if (buf_size < stride * avctx->height)
+        for (i = avctx->height - 1; i >= 0; i--) {
+            memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * 3);
+            buf += stride;
         }
         break;
     case 1:

static int aasc_decode_frame(AVCodecContext *avctx,
                              void *data, int *got_frame,
                              AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size       = avpkt->size;
    AascContext *s     = avctx->priv_data;
    int compr, i, stride, ret;
    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) {
        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
        return ret;
    }
    compr     = AV_RL32(buf);
    buf      += 4;
    buf_size -= 4;
    switch (compr) {
    case 0:
        stride = (avctx->width * 3 + 3) & ~3;
        if (buf_size < stride * avctx->height)
        for (i = avctx->height - 1; i >= 0; i--) {
            memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * 3);
            buf += stride;
        }
        break;
    case 1:
        bytestream2_init(&s->gb, buf, buf_size);
        ff_msrle_decode(avctx, (AVPicture*)s->frame, 8, &s->gb);
        break;
    default:
        av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
    }
    *got_frame = 1;
    if ((ret = av_frame_ref(data, s->frame)) < 0)
        return ret;
    /* report that the buffer was completely consumed */
    return buf_size;
}


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

{

    set_bit(q->queue, n_IRQ);

}


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

     if (lag) { /* Voiced */
+
         int16_t *vector_ptr = buf + PITCH_MAX;

         /* Attenuate */

static void residual_interp(int16_t *buf, int16_t *out, int lag,

                            int gain, int *rseed)

{

    int i;

    if (lag) { /* Voiced */

        int16_t *vector_ptr = buf + PITCH_MAX;

        /* Attenuate */

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

            out[i] = vector_ptr[i - lag] * 3 >> 2;

        av_memcpy_backptr((uint8_t*)(out + lag), lag * sizeof(*out),

                          (FRAME_LEN - lag) * sizeof(*out));

    } else {  /* Unvoiced */

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

            *rseed = *rseed * 521 + 259;

            out[i] = gain * *rseed >> 15;

        }

        memset(buf, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*buf));

    }

}


--- a/source.c
+++ b/source.c
@@ -45,11 +45,11 @@
         return AVERROR(ENOMEM);

+
+    ret = ff_mov_read_stsd_entries(c, pb, sc->stsd_count);
+
+    if (ret < 0)
+
         return ret;

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

{

    AVStream *st;

    MOVStreamContext *sc;

    int ret;

    if (c->fc->nb_streams < 1)

        return 0;

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

    sc = st->priv_data;

    avio_r8(pb); /* version */

    avio_rb24(pb); /* flags */

    sc->stsd_count = avio_rb32(pb); /* entries */

    /* Prepare space for hosting multiple extradata. */

    sc->extradata = av_mallocz_array(sc->stsd_count, sizeof(*sc->extradata));

    if (!sc->extradata)

        return AVERROR(ENOMEM);

    sc->extradata_size = av_mallocz_array(sc->stsd_count, sizeof(*sc->extradata_size));

    if (!sc->extradata_size)

        return AVERROR(ENOMEM);

    ret = ff_mov_read_stsd_entries(c, pb, sc->stsd_count);

    if (ret < 0)

        return ret;

    /* Restore back the primary extradata. */

    av_freep(&st->codecpar->extradata);

    st->codecpar->extradata_size = sc->extradata_size[0];

    if (sc->extradata_size[0]) {

        st->codecpar->extradata = av_mallocz(sc->extradata_size[0] + AV_INPUT_BUFFER_PADDING_SIZE);

        if (!st->codecpar->extradata)

            return AVERROR(ENOMEM);

        memcpy(st->codecpar->extradata, sc->extradata[0], sc->extradata_size[0]);

    }

    return 0;

}


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

             link->time_base = link->src->inputs[0]->time_base;

+        } else if (link->type == AVMEDIA_TYPE_AUDIO) {
+
+            link->channel_layout = link->src->inputs[0]->channel_layout;
+
+            link->sample_rate    = link->src->inputs[0]->sample_rate;

         }

int avfilter_default_config_output_link(AVFilterLink *link)

{

    if (link->src->input_count && link->src->inputs[0]) {

        if (link->type == AVMEDIA_TYPE_VIDEO) {

            link->w = link->src->inputs[0]->w;

            link->h = link->src->inputs[0]->h;

            link->time_base = link->src->inputs[0]->time_base;

        } else if (link->type == AVMEDIA_TYPE_AUDIO) {

            link->channel_layout = link->src->inputs[0]->channel_layout;

            link->sample_rate    = link->src->inputs[0]->sample_rate;

        }

    } else {

        /* XXX: any non-simple filter which would cause this branch to be taken

         * really should implement its own config_props() for this link. */

        return -1;

    }

    return 0;

}


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

     if (memcmp(buf, "FLV", 3))

+        return AVERROR_INVALIDDATA;

     buf      += 13;

static int parse_header(OutputStream *os, const uint8_t *buf, int buf_size)

{

    if (buf_size < 13)

        return AVERROR_INVALIDDATA;

    if (memcmp(buf, "FLV", 3))

        return AVERROR_INVALIDDATA;

    buf      += 13;

    buf_size -= 13;

    while (buf_size >= 11 + 4) {

        int type = buf[0];

        int size = AV_RB24(&buf[1]) + 11 + 4;

        if (size > buf_size)

            return AVERROR_INVALIDDATA;

        if (type == 8 || type == 9) {

            if (os->nb_extra_packets > FF_ARRAY_ELEMS(os->extra_packets))

                return AVERROR_INVALIDDATA;

            os->extra_packet_sizes[os->nb_extra_packets] = size;

            os->extra_packets[os->nb_extra_packets] = av_malloc(size);

            if (!os->extra_packets[os->nb_extra_packets])

                return AVERROR(ENOMEM);

            memcpy(os->extra_packets[os->nb_extra_packets], buf, size);

            os->nb_extra_packets++;

        } else if (type == 0x12) {

            if (os->metadata)

                return AVERROR_INVALIDDATA;

            os->metadata_size = size - 11 - 4;

            os->metadata      = av_malloc(os->metadata_size);

            if (!os->metadata)

                return AVERROR(ENOMEM);

            memcpy(os->metadata, buf + 11, os->metadata_size);

        }

        buf      += size;

        buf_size -= size;

    }

    if (!os->metadata)

        return AVERROR_INVALIDDATA;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -31,11 +31,11 @@
     fctx->delaying = 1;

     fctx->prev_thread = NULL;
+
+    // Make sure decode flush calls with size=0 won't return old frames
+
+    for (int i = 0; i < avctx->thread_count; i++)
+
         fctx->threads[i].got_frame = 0;

 }

void ff_thread_flush(AVCodecContext *avctx)

{

    FrameThreadContext *fctx = avctx->thread_opaque;

    if (!avctx->thread_opaque) return;

    park_frame_worker_threads(fctx, avctx->thread_count);

    if (fctx->prev_thread) {

        if (fctx->prev_thread != &fctx->threads[0])

            update_context_from_thread(fctx->threads[0].avctx, fctx->prev_thread->avctx, 0);

        if (avctx->codec->flush)

            avctx->codec->flush(fctx->threads[0].avctx);

    }

    fctx->next_decoding = fctx->next_finished = 0;

    fctx->delaying = 1;

    fctx->prev_thread = NULL;

    // Make sure decode flush calls with size=0 won't return old frames

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

        fctx->threads[i].got_frame = 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len)

 {
+
     int arch = !!(key & FW_CFG_ARCH_LOCAL);
+

     key &= FW_CFG_ENTRY_MASK;

void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len)

{

    int arch = !!(key & FW_CFG_ARCH_LOCAL);

    key &= FW_CFG_ENTRY_MASK;

    assert(key < FW_CFG_MAX_ENTRY);

    s->entries[arch][key].data = data;

    s->entries[arch][key].len = len;

}


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

     DeviceClass *dc = DEVICE_CLASS(klass);

+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+
+
+    k->config_read = i6300esb_config_read;

     k->config_write = i6300esb_config_write;

static void i6300esb_class_init(ObjectClass *klass, void *data)

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);

    k->config_read = i6300esb_config_read;

    k->config_write = i6300esb_config_write;

    k->realize = i6300esb_realize;

    k->vendor_id = PCI_VENDOR_ID_INTEL;

    k->device_id = PCI_DEVICE_ID_INTEL_ESB_9;

    k->class_id = PCI_CLASS_SYSTEM_OTHER;

    dc->reset = i6300esb_reset;

    dc->vmsd = &vmstate_i6300esb;

    set_bit(DEVICE_CATEGORY_MISC, dc->categories);

}


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

+    env = cpu_single_env;
+
+    if (!env)
+
         return;

     env->eflags = (env->eflags & ~(IF_MASK | IOPL_MASK)) |

static void qpi_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)

{

    CPUState *env;

    env = cpu_single_env;

    if (!env)

        return;

    env->eflags = (env->eflags & ~(IF_MASK | IOPL_MASK)) |

        (val & (IF_MASK | IOPL_MASK));

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 static int xen_host_pci_config_open(XenHostPCIDevice *d)

+{
+
+    char path[PATH_MAX];
+
     int rc;

     rc = xen_host_pci_sysfs_path(d, "config", path, sizeof (path));
+
     if (rc) {

         return rc;

static int xen_host_pci_config_open(XenHostPCIDevice *d)

{

    char path[PATH_MAX];

    int rc;

    rc = xen_host_pci_sysfs_path(d, "config", path, sizeof (path));

    if (rc) {

        return rc;

    }

    d->config_fd = open(path, O_RDWR);

    if (d->config_fd < 0) {

        return -errno;

    }

    return 0;

}


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

     struct vaapi_context * const vactx = avctx->hwaccel_context;

+    MpegEncContext *s = avctx->priv_data;

     int ret;

int ff_vaapi_mpeg_end_frame(AVCodecContext *avctx)

{

    struct vaapi_context * const vactx = avctx->hwaccel_context;

    MpegEncContext *s = avctx->priv_data;

    int ret;

    ret = ff_vaapi_commit_slices(vactx);

    if (ret < 0)

        goto finish;

    ret = ff_vaapi_render_picture(vactx,

                                  ff_vaapi_get_surface_id(&s->current_picture_ptr->f));

    if (ret < 0)

        goto finish;

    ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);

finish:

    ff_vaapi_common_end_frame(avctx);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -61,11 +61,11 @@
         if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
             return ret;
         planes[0] = img->planes[VPX_PLANE_Y];
+        planes[1] = img->planes[VPX_PLANE_U];
+        planes[2] = img->planes[VPX_PLANE_V];
+        planes[3] =
+            ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] : NULL;
+        linesizes[0] = img->stride[VPX_PLANE_Y];
         linesizes[1] = img->stride[VPX_PLANE_U];
         linesizes[2] = img->stride[VPX_PLANE_V];
         linesizes[3] =

static int vpx_decode(AVCodecContext *avctx,
                      void *data, int *got_frame, AVPacket *avpkt)
{
    VPxContext *ctx = avctx->priv_data;
    AVFrame *picture = data;
    const void *iter = NULL;
    const void *iter_alpha = NULL;
    struct vpx_image *img, *img_alpha;
    int ret;
    uint8_t *side_data = NULL;
    int side_data_size = 0;
    ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
    if (ret)
        return ret;
    side_data = av_packet_get_side_data(avpkt,
                                        AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
                                        &side_data_size);
    if (side_data_size > 1) {
        const uint64_t additional_id = AV_RB64(side_data);
        side_data += 8;
        side_data_size -= 8;
        if (additional_id == 1) {  // 1 stands for alpha channel data.
            if (!ctx->has_alpha_channel) {
                ctx->has_alpha_channel = 1;
                ret = vpx_init(avctx,
#if CONFIG_LIBVPX_VP8_DECODER && CONFIG_LIBVPX_VP9_DECODER
                               (avctx->codec_id == AV_CODEC_ID_VP8) ?
                               &vpx_codec_vp8_dx_algo : &vpx_codec_vp9_dx_algo,
#elif CONFIG_LIBVPX_VP8_DECODER
                               &vpx_codec_vp8_dx_algo,
#else
                               &vpx_codec_vp9_dx_algo,
#endif
                               1);
                if (ret)
                    return ret;
            ret = decode_frame(avctx, &ctx->decoder_alpha, side_data,
                               side_data_size);
            if (ret)
                return ret;
    if ((img = vpx_codec_get_frame(&ctx->decoder, &iter)) &&
        (!ctx->has_alpha_channel ||
         (img_alpha = vpx_codec_get_frame(&ctx->decoder_alpha, &iter_alpha)))) {
        uint8_t *planes[4];
        int linesizes[4];
        if ((ret = set_pix_fmt(avctx, img, ctx->has_alpha_channel)) < 0) {
#ifdef VPX_IMG_FMT_HIGHBITDEPTH
            av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
                   img->fmt, img->bit_depth);
#else
            av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d) / bit_depth (%d)\n",
                   img->fmt, 8);
#endif
            return ret;
        if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) {
            av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
                   avctx->width, avctx->height, img->d_w, img->d_h);
            ret = ff_set_dimensions(avctx, img->d_w, img->d_h);
            if (ret < 0)
                return ret;
        if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
            return ret;
        planes[0] = img->planes[VPX_PLANE_Y];
        planes[1] = img->planes[VPX_PLANE_U];
        planes[2] = img->planes[VPX_PLANE_V];
        planes[3] =
            ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] : NULL;
        linesizes[0] = img->stride[VPX_PLANE_Y];
        linesizes[1] = img->stride[VPX_PLANE_U];
        linesizes[2] = img->stride[VPX_PLANE_V];
        linesizes[3] =
            ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0;
        av_image_copy(picture->data, picture->linesize, (const uint8_t**)planes,
                      linesizes, avctx->pix_fmt, img->d_w, img->d_h);
        *got_frame           = 1;
    return avpkt->size;