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

         if (!s->is_unix) {

+            socket_set_cork(s->sock, 1);
+
+        }
+
+        rc = nbd_send_request(s->sock, request);

         if (rc >= 0) {

static int nbd_co_send_request(NbdClientSession *s,

    struct nbd_request *request,

    QEMUIOVector *qiov, int offset)

{

    AioContext *aio_context;

    int rc, ret;

    qemu_co_mutex_lock(&s->send_mutex);

    s->send_coroutine = qemu_coroutine_self();

    aio_context = bdrv_get_aio_context(s->bs);

    aio_set_fd_handler(aio_context, s->sock,

                       nbd_reply_ready, nbd_restart_write, s);

    if (qiov) {

        if (!s->is_unix) {

            socket_set_cork(s->sock, 1);

        }

        rc = nbd_send_request(s->sock, request);

        if (rc >= 0) {

            ret = qemu_co_sendv(s->sock, qiov->iov, qiov->niov,

                                offset, request->len);

            if (ret != request->len) {

                rc = -EIO;

            }

        }

        if (!s->is_unix) {

            socket_set_cork(s->sock, 0);

        }

    } else {

        rc = nbd_send_request(s->sock, request);

    }

    aio_set_fd_handler(aio_context, s->sock, nbd_reply_ready, NULL, s);

    s->send_coroutine = NULL;

    qemu_co_mutex_unlock(&s->send_mutex);

    return rc;

}


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

                   int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
+
+                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
+
+                  int64_t (*seek)(void *opaque, int64_t offset, int whence))
+
 {

     AVIOContext *s = av_mallocz(sizeof(AVIOContext));

AVIOContext *avio_alloc_context(

                  unsigned char *buffer,

                  int buffer_size,

                  int write_flag,

                  void *opaque,

                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int64_t (*seek)(void *opaque, int64_t offset, int whence))

{

    AVIOContext *s = av_mallocz(sizeof(AVIOContext));

    ffio_init_context(s, buffer, buffer_size, write_flag, opaque,

                  read_packet, write_packet, seek);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -25,9 +25,9 @@
     case 3:

         gen_helper_fcmpes_fcc3(cpu_env, r_rs1, r_rs2);
+
+        break;
+
+    }
+
 }

static inline void gen_op_fcmpes(int fccno, TCGv_i32 r_rs1, TCGv_i32 r_rs2)

{

    switch (fccno) {

    case 0:

        gen_helper_fcmpes(cpu_env, r_rs1, r_rs2);

        break;

    case 1:

        gen_helper_fcmpes_fcc1(cpu_env, r_rs1, r_rs2);

        break;

    case 2:

        gen_helper_fcmpes_fcc2(cpu_env, r_rs1, r_rs2);

        break;

    case 3:

        gen_helper_fcmpes_fcc3(cpu_env, r_rs1, r_rs2);

        break;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
+int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan)

 {

     const char *ifname;
+

     ifname = qemu_opt_get(opts, "ifname");

int net_init_tap(QemuOpts *opts, const char *name, VLANState *vlan)

{

    const char *ifname;

    ifname = qemu_opt_get(opts, "ifname");

    if (!ifname) {

        error_report("tap: no interface name");

        return -1;

    }

    if (tap_win32_init(vlan, "tap", name, ifname) == -1) {

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 bool block_job_is_paused(BlockJob *job)
+
 {

     return job->paused;

bool block_job_is_paused(BlockJob *job)

{

    return job->paused;

}


--- a/source.c
+++ b/source.c
@@ -1,1 +1,1 @@
+static inline void gen_check_tlb_flush(DisasContext *ctx) { }


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

     case MODE_SELECT:

+    case MODE_SELECT_10:
+
+        /* This also clears the sense buffer for REQUEST SENSE.  */
+
+        scsi_req_complete(&r->req, GOOD);

         break;

static void scsi_disk_emulate_write_data(SCSIRequest *req)

{

    SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);

    if (r->iov.iov_len) {

        int buflen = r->iov.iov_len;

        DPRINTF("Write buf_len=%zd\n", buflen);

        r->iov.iov_len = 0;

        scsi_req_data(&r->req, buflen);

        return;

    }

    switch (req->cmd.buf[0]) {

    case MODE_SELECT:

    case MODE_SELECT_10:

        /* This also clears the sense buffer for REQUEST SENSE.  */

        scsi_req_complete(&r->req, GOOD);

        break;

    default:

        abort();

    }

}


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

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

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

static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){

//    MpegMuxContext *s = ctx->priv_data;

    int i;

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

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

        StreamInfo *stream = st->priv_data;

        PacketDesc *pkt_desc;

        while((pkt_desc= stream->predecode_packet)

              && scr > pkt_desc->dts){ //FIXME > vs >=

            if(stream->buffer_index < pkt_desc->size ||

               stream->predecode_packet == stream->premux_packet){

                av_log(ctx, AV_LOG_ERROR,

                       "buffer underflow i=%d bufi=%d size=%d\n",

                       i, stream->buffer_index, pkt_desc->size);

                break;

            }

            stream->buffer_index -= pkt_desc->size;

            stream->predecode_packet= pkt_desc->next;

            av_freep(&pkt_desc);

        }

    }

    return 0;

}


static void test_qemu_strtoull_underflow(void)

{

    const char *str = "-99999999999999999999999999999999999999999999";

    char f = 'X';

    const char *endptr = &f;

    uint64_t res = 999;

    int err;

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

    g_assert_cmpint(err, ==, -ERANGE);

    g_assert_cmpint(res, ==, -1);

    g_assert(endptr == str + strlen(str));

}


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

     if (object_property_get_bool(qdev_get_machine(), "iommu", NULL)) {
+
+        error_report("warning: i440fx doesn't support emulated iommu");
+
     }

 }

static void i440fx_realize(PCIDevice *dev, Error **errp)

{

    dev->config[I440FX_SMRAM] = 0x02;

    if (object_property_get_bool(qdev_get_machine(), "iommu", NULL)) {

        error_report("warning: i440fx doesn't support emulated iommu");

    }

}


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 static int tee_write_trailer(AVFormatContext *avf)

+{

     TeeContext *tee = avf->priv_data;

+    AVFormatContext *avf2;
+
+    int ret_all = 0, ret;

+    unsigned i;

static int tee_write_trailer(AVFormatContext *avf)

{

    TeeContext *tee = avf->priv_data;

    AVFormatContext *avf2;

    int ret_all = 0, ret;

    unsigned i;

    for (i = 0; i < tee->nb_slaves; i++) {

        avf2 = tee->slaves[i].avf;

        if ((ret = av_write_trailer(avf2)) < 0)

            if (!ret_all)

                ret_all = ret;

        if (!(avf2->oformat->flags & AVFMT_NOFILE))

            ff_format_io_close(avf2, &avf2->pb);

    }

    close_slaves(avf);

    return ret_all;

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
     s->irq = irq;

     s->slave.event = pxa2xx_i2c_event;
+
+    s->slave.recv = pxa2xx_i2c_rx;
+
+    s->slave.send = pxa2xx_i2c_tx;
+
     s->bus = i2c_init_bus();

struct pxa2xx_i2c_s *pxa2xx_i2c_init(target_phys_addr_t base,

                qemu_irq irq, int ioregister)

{

    int iomemtype;

    struct pxa2xx_i2c_s *s = (struct pxa2xx_i2c_s *)

            i2c_slave_init(i2c_init_bus(), 0, sizeof(struct pxa2xx_i2c_s));

    s->base = base;

    s->irq = irq;

    s->slave.event = pxa2xx_i2c_event;

    s->slave.recv = pxa2xx_i2c_rx;

    s->slave.send = pxa2xx_i2c_tx;

    s->bus = i2c_init_bus();

    if (ioregister) {

        iomemtype = cpu_register_io_memory(0, pxa2xx_i2c_readfn,

                        pxa2xx_i2c_writefn, s);

        cpu_register_physical_memory(s->base & 0xfffff000, 0xfff, iomemtype);

    }

    register_savevm("pxa2xx_i2c", base, 0,

                    pxa2xx_i2c_save, pxa2xx_i2c_load, s);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
+static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
+
+{
+
     int fill_char = 0x00;

     if (sample_fmt == AV_SAMPLE_FMT_U8)

static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)

{

    int fill_char = 0x00;

    if (sample_fmt == AV_SAMPLE_FMT_U8)

        fill_char = 0x80;

    memset(buf, fill_char, size);

}


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

     switch (s390_cpu_get_state(cpu)) {
+
+    case CPU_STATE_STOPPED:
+
+        /* the restart irq has to be delivered prior to any other pending irq */
+
         cpu_synchronize_state(cs);

         do_restart_interrupt(&cpu->env);

static void sigp_restart(CPUState *cs, run_on_cpu_data arg)

{

    S390CPU *cpu = S390_CPU(cs);

    SigpInfo *si = arg.host_ptr;

    struct kvm_s390_irq irq = {

        .type = KVM_S390_RESTART,

    };

    switch (s390_cpu_get_state(cpu)) {

    case CPU_STATE_STOPPED:

        /* the restart irq has to be delivered prior to any other pending irq */

        cpu_synchronize_state(cs);

        do_restart_interrupt(&cpu->env);

        s390_cpu_set_state(CPU_STATE_OPERATING, cpu);

        break;

    case CPU_STATE_OPERATING:

        kvm_s390_vcpu_interrupt(cpu, &irq);

        break;

    }

    si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;

}


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

+
     if (n->promisc)

         return 1;
+

     if (!memcmp(&ptr[12], vlan, sizeof(vlan))) {

static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)

{

    static const uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

    static const uint8_t vlan[] = {0x81, 0x00};

    uint8_t *ptr = (uint8_t *)buf;

    int i;

    if (n->promisc)

        return 1;

    if (!memcmp(&ptr[12], vlan, sizeof(vlan))) {

        int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff;

        if (!(n->vlans[vid >> 5] & (1U << (vid & 0x1f))))

            return 0;

    }

    if (ptr[0] & 1) { // multicast

        if (!memcmp(ptr, bcast, sizeof(bcast))) {

            return 1;

        } else if (n->allmulti) {

            return 1;

        }

    } else { // unicast

        if (!memcmp(ptr, n->mac, ETH_ALEN)) {

            return 1;

        }

    }

    for (i = 0; i < n->mac_table.in_use; i++) {

        if (!memcmp(ptr, &n->mac_table.macs[i * ETH_ALEN], ETH_ALEN))

            return 1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int webvtt_event_to_ass(AVBPrint *buf, const char *p)
+
 {

     int i, again, skip = 0;

static int webvtt_event_to_ass(AVBPrint *buf, const char *p)

{

    int i, again, skip = 0;

    while (*p) {

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

            const char *from = webvtt_tag_replace[i].from;

            const size_t len = strlen(from);

            if (!strncmp(p, from, len)) {

                av_bprintf(buf, "%s", webvtt_tag_replace[i].to);

                p += len;

                again = 1;

                break;

            }

        }

        if (!*p)

            break;

        if (again) {

            again = 0;

            skip = 0;

            continue;

        }

        if (*p == '<')

            skip = 1;

        else if (*p == '>')

            skip = 0;

        else if (p[0] == '\n' && p[1])

            av_bprintf(buf, "\\N");

        else if (!skip && *p != '\r')

            av_bprint_chars(buf, *p, 1);

        p++;

    }

    return 0;

}


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

+{

     PIIX4PMState *s = opaque;

static uint32_t pci_up_read(void *opaque, uint32_t addr)

{

    PIIX4PMState *s = opaque;

    uint32_t val = s->pci0_status.up;

    PIIX4_DPRINTF("pci_up_read %x\n", val);

    return val;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
         QTAILQ_REMOVE(&v->stack, e, node);

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

     g_free(v);

void qmp_output_visitor_cleanup(QmpOutputVisitor *v)

{

    QStackEntry *e, *tmp;

    QTAILQ_FOREACH_SAFE(e, &v->stack, node, tmp) {

        QTAILQ_REMOVE(&v->stack, e, node);

        g_free(e);

    }

    qobject_decref(v->root);

    g_free(v);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count){
+
     int i, j, pos, ch;

     int taps  = s->dither.ns_taps;

void RENAME(swri_noise_shaping)(SwrContext *s, AudioData *dsts, const AudioData *srcs, const AudioData *noises, int count){

    int i, j, pos, ch;

    int taps  = s->dither.ns_taps;

    float S   = s->dither.ns_scale;

    float S_1 = s->dither.ns_scale_1;

    av_assert2((taps&3) != 2);

    av_assert2((taps&3) != 3 || s->dither.ns_coeffs[taps] == 0);

    for (ch=0; ch<srcs->ch_count; ch++) {

        const float *noise = ((const float *)noises->ch[ch]) + s->dither.noise_pos;

        const DELEM *src = (const DELEM*)srcs->ch[ch];

        DELEM *dst = (DELEM*)dsts->ch[ch];

        float *ns_errors = s->dither.ns_errors[ch];

        const float *ns_coeffs = s->dither.ns_coeffs;

        pos  = s->dither.ns_pos;

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

            double d1, d = src[i]*S_1;

            for(j=0; j<taps-2; j+=4) {

                d -= ns_coeffs[j    ] * ns_errors[pos + j    ]

                    +ns_coeffs[j + 1] * ns_errors[pos + j + 1]

                    +ns_coeffs[j + 2] * ns_errors[pos + j + 2]

                    +ns_coeffs[j + 3] * ns_errors[pos + j + 3];

            }

            if(j < taps)

                d -= ns_coeffs[j] * ns_errors[pos + j];

            pos = pos ? pos - 1 : taps - 1;

            d1 = rint(d + noise[i]);

            ns_errors[pos + taps] = ns_errors[pos] = d1 - d;

            d1 *= S;

            CLIP(d1);

            dst[i] = d1;

        }

    }

    s->dither.ns_pos = pos;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 int qemu_opts_set(QemuOptsList *list, const char *id,

+                  const char *name, const char *value)
+
 {

     QemuOpts *opts;

int qemu_opts_set(QemuOptsList *list, const char *id,

                  const char *name, const char *value)

{

    QemuOpts *opts;

    opts = qemu_opts_create(list, id, 1);

    if (opts == NULL) {

        return -1;

    }

    return qemu_opt_set(opts, name, value);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop)

 {
+
+    _regs->gpr[1] = infop->start_stack;

 #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)

static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop)

{

    _regs->gpr[1] = infop->start_stack;

#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)

    if (get_ppc64_abi(infop) < 2) {

        _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_bias;

        infop->entry = ldq_raw(infop->entry) + infop->load_bias;

    } else {

        _regs->gpr[12] = infop->entry;  /* r12 set to global entry address */

    }

#endif

    _regs->nip = infop->entry;

}


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

             continue;

+        }
+
+        if (len < 0) {
+
+            goto cleanup;

         }

int qio_channel_writev_all(QIOChannel *ioc,

                           const struct iovec *iov,

                           size_t niov,

                           Error **errp)

{

    int ret = -1;

    struct iovec *local_iov = g_new(struct iovec, niov);

    struct iovec *local_iov_head = local_iov;

    unsigned int nlocal_iov = niov;

    nlocal_iov = iov_copy(local_iov, nlocal_iov,

                          iov, niov,

                          0, iov_size(iov, niov));

    while (nlocal_iov > 0) {

        ssize_t len;

        len = qio_channel_writev(ioc, local_iov, nlocal_iov, errp);

        if (len == QIO_CHANNEL_ERR_BLOCK) {

            qio_channel_wait(ioc, G_IO_OUT);

            continue;

        }

        if (len < 0) {

            goto cleanup;

        }

        iov_discard_front(&local_iov, &nlocal_iov, len);

    }

    ret = 0;

 cleanup:

    g_free(local_iov_head);

    return ret;

}


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

     state->code_counterA_almost = 0;

+    state->code_counterB = 0;
+
+    state->code_counterB_checkfails = 0;
+
+    state->code_counterC = 0;

     state->code_counterC_unmatched = 0;

static void hdcd_reset(hdcd_state_t *state, unsigned rate)

{

    int i;

    state->window = 0;

    state->readahead = 32;

    state->arg = 0;

    state->control = 0;

    state->running_gain = 0;

    state->sustain = 0;

    state->sustain_reset = rate * 10;

    state->code_counterA = 0;

    state->code_counterA_almost = 0;

    state->code_counterB = 0;

    state->code_counterB_checkfails = 0;

    state->code_counterC = 0;

    state->code_counterC_unmatched = 0;

    state->count_peak_extend = 0;

    state->count_transient_filter = 0;

    for(i = 0; i < 16; i++) state->gain_counts[i] = 0;

    state->max_gain = 0;

    state->count_sustain_expired = -1;

}


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

+    if (init_get_bits8(&gb, buf, size) < 0)
+
+        return DCA_PARSE_ERROR_INVALIDDATA;
+

     return ff_dca_parse_core_frame_header(h, &gb);

int avpriv_dca_parse_core_frame_header(DCACoreFrameHeader *h, const uint8_t *buf, int size)

{

    GetBitContext gb;

    if (init_get_bits8(&gb, buf, size) < 0)

        return DCA_PARSE_ERROR_INVALIDDATA;

    return ff_dca_parse_core_frame_header(h, &gb);

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static av_cold int pcx_end(AVCodecContext *avctx) {

     PCXContext *s = avctx->priv_data;

static av_cold int pcx_end(AVCodecContext *avctx) {

    PCXContext *s = avctx->priv_data;

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

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

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void fill_prstatus(struct target_elf_prstatus *prstatus,
+
+                          const TaskState *ts, int signr)
+
+{

     (void) memset(prstatus, 0, sizeof (*prstatus));

static void fill_prstatus(struct target_elf_prstatus *prstatus,

                          const TaskState *ts, int signr)

{

    (void) memset(prstatus, 0, sizeof (*prstatus));

    prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;

    prstatus->pr_pid = ts->ts_tid;

    prstatus->pr_ppid = getppid();

    prstatus->pr_pgrp = getpgrp();

    prstatus->pr_sid = getsid(0);

#ifdef BSWAP_NEEDED

    bswap_prstatus(prstatus);

#endif

}


--- a/source.c
+++ b/source.c
@@ -5,10 +5,10 @@
     RAMBlock *block;

     ram_addr_t last = 0;
+
+
+
+    QTAILQ_FOREACH(block, &ram_list.blocks, next)

         last = MAX(last, block->offset + block->length);

ram_addr_t last_ram_offset(void)

{

    RAMBlock *block;

    ram_addr_t last = 0;

    QTAILQ_FOREACH(block, &ram_list.blocks, next)

        last = MAX(last, block->offset + block->length);

    return last;

}


--- a/source.c
+++ b/source.c
@@ -11,11 +11,11 @@
         delta = active_timers[QEMU_CLOCK_VIRTUAL]->expire_time -

                      qemu_get_clock(vm_clock);
+
+    } else {
+
+        /* To avoid problems with overflow limit this to 2^32.  */
+
         delta = INT32_MAX;

     }

static int64_t qemu_next_deadline(void)

{

    int64_t delta;

    if (active_timers[QEMU_CLOCK_VIRTUAL]) {

        delta = active_timers[QEMU_CLOCK_VIRTUAL]->expire_time -

                     qemu_get_clock(vm_clock);

    } else {

        /* To avoid problems with overflow limit this to 2^32.  */

        delta = INT32_MAX;

    }

    if (delta < 0)

        delta = 0;

    return delta;

}


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

 {

+    DeviceClass *dc = DEVICE_CLASS(oc);
+
     dc->realize = spapr_cpu_core_realize;

 }

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

{

    DeviceClass *dc = DEVICE_CLASS(oc);

    dc->realize = spapr_cpu_core_realize;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+void msix_load(PCIDevice *dev, QEMUFile *f)
+
+{
+
+    unsigned n = dev->msix_entries_nr;

     unsigned int vector;

void msix_load(PCIDevice *dev, QEMUFile *f)

{

    unsigned n = dev->msix_entries_nr;

    unsigned int vector;

    if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) {

        return;

    }

    msix_free_irq_entries(dev);

    qemu_get_buffer(f, dev->msix_table_page, n * PCI_MSIX_ENTRY_SIZE);

    qemu_get_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8);

    msix_update_function_masked(dev);

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

        msix_handle_mask_update(dev, vector, true);

    }

}


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

     qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,

+                               &break_enabled);
+
+}

static void uart_send_breaks(UartState *s)

{

    int break_enabled = 1;

    qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,

                               &break_enabled);

}


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

     uint32_t val, size, addr;
+
     uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);

     PCIDevice *dev = find_dev(spapr, buid, rtas_ld(args, 0));

static void rtas_ibm_write_pci_config(sPAPREnvironment *spapr,

                                      uint32_t token, uint32_t nargs,

                                      target_ulong args,

                                      uint32_t nret, target_ulong rets)

{

    uint32_t val, size, addr;

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

    PCIDevice *dev = find_dev(spapr, buid, rtas_ld(args, 0));

    if (!dev) {

        rtas_st(rets, 0, -1);

        return;

    }

    val = rtas_ld(args, 4);

    size = rtas_ld(args, 3);

    addr = rtas_pci_cfgaddr(rtas_ld(args, 0));

    pci_default_write_config(dev, addr, val, size);

    rtas_st(rets, 0, 0);

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     TypeInfo ti = {

         .name       = name,
+
+        .parent     = TYPE_MACHINE,
+
+        .class_init = machine_class_init,
+
         .class_data = (void *)m,

     };

int qemu_register_machine(QEMUMachine *m)

{

    char *name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL);

    TypeInfo ti = {

        .name       = name,

        .parent     = TYPE_MACHINE,

        .class_init = machine_class_init,

        .class_data = (void *)m,

    };

    type_register(&ti);

    g_free(name);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     CPUState *cs = arg;

     S390CPU *cpu = S390_CPU(cs);
+
+    struct kvm_s390_irq irq = {
+
+        .type = KVM_S390_RESTART,
+
     };

static void sigp_cpu_restart(void *arg)

{

    CPUState *cs = arg;

    S390CPU *cpu = S390_CPU(cs);

    struct kvm_s390_irq irq = {

        .type = KVM_S390_RESTART,

    };

    kvm_s390_vcpu_interrupt(cpu, &irq);

    s390_cpu_set_state(CPU_STATE_OPERATING, cpu);

}


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

                                  ptrdiff_t stride)

+{
+
     avc_luma_mid_16w_msa(src - (2 * stride) - 2, stride, dst, stride, 16);

 }

void ff_put_h264_qpel16_mc22_msa(uint8_t *dst, const uint8_t *src,

                                 ptrdiff_t stride)

{

    avc_luma_mid_16w_msa(src - (2 * stride) - 2, stride, dst, stride, 16);

}


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

     ssize_t ret;

static ssize_t mp_pacl_getxattr(FsContext *ctx, const char *path,

                                const char *name, void *value, size_t size)

{

    char *buffer;

    ssize_t ret;

    buffer = rpath(ctx, path);

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

    g_free(buffer);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int oss_poll_out (HWVoiceOut *hw)

+{

     OSSVoiceOut *oss = (OSSVoiceOut *) hw;

static int oss_poll_out (HWVoiceOut *hw)

{

    OSSVoiceOut *oss = (OSSVoiceOut *) hw;

    return qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void free_buffers(VP8Context *s)
+
+{
+
+    int i;
+
     if (s->thread_data)

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

static void free_buffers(VP8Context *s)

{

    int i;

    if (s->thread_data)

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

            av_freep(&s->thread_data[i].filter_strength);

            av_freep(&s->thread_data[i].edge_emu_buffer);

        }

    av_freep(&s->thread_data);

    av_freep(&s->macroblocks_base);

    av_freep(&s->intra4x4_pred_mode_top);

    av_freep(&s->top_nnz);

    av_freep(&s->top_border);

    s->macroblocks = NULL;

}


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
     timestamp = FFMAX(timestamp, 0);

+
     if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {

         /* calculate new byte position based on target frame position */

static int read_seek(AVFormatContext *s, int stream_index,

                     int64_t timestamp, int flags)

{

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

    CaffContext *caf = s->priv_data;

    int64_t pos;

    timestamp = FFMAX(timestamp, 0);

    if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {

        /* calculate new byte position based on target frame position */

        pos = caf->bytes_per_packet * timestamp / caf->frames_per_packet;

        if (caf->data_size > 0)

            pos = FFMIN(pos, caf->data_size);

        caf->packet_cnt = pos / caf->bytes_per_packet;

        caf->frame_cnt  = caf->frames_per_packet * caf->packet_cnt;

    } else if (st->nb_index_entries) {

        caf->packet_cnt = av_index_search_timestamp(st, timestamp, flags);

        caf->frame_cnt  = st->index_entries[caf->packet_cnt].timestamp;

        pos             = st->index_entries[caf->packet_cnt].pos;

    } else {

        return -1;

    }

    avio_seek(s->pb, pos + caf->data_start, SEEK_SET);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static inline void gen_outs(DisasContext *s, TCGMemOp ot)
+
 {

     if (s->base.tb->cflags & CF_USE_ICOUNT) {

static inline void gen_outs(DisasContext *s, TCGMemOp ot)

{

    if (s->base.tb->cflags & CF_USE_ICOUNT) {

        gen_io_start();

    }

    gen_string_movl_A0_ESI(s);

    gen_op_ld_v(s, ot, cpu_T0, cpu_A0);

    tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_EDX]);

    tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff);

    tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T0);

    gen_helper_out_func(ot, cpu_tmp2_i32, cpu_tmp3_i32);

    gen_op_movl_T0_Dshift(ot);

    gen_op_add_reg_T0(s->aflag, R_ESI);

    gen_bpt_io(s, cpu_tmp2_i32, ot);

    if (s->base.tb->cflags & CF_USE_ICOUNT) {

        gen_io_end();

    }

}


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

+
+    if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {
+
+            memcpy(buf, bs->boot_sector_data, 512);
+
         sector_num++;

         nb_sectors--;

int bdrv_read(BlockDriverState *bs, int64_t sector_num,

              uint8_t *buf, int nb_sectors)

{

    BlockDriver *drv = bs->drv;

    if (!drv)

        return -ENOMEDIUM;

    if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) {

            memcpy(buf, bs->boot_sector_data, 512);

        sector_num++;

        nb_sectors--;

        buf += 512;

        if (nb_sectors == 0)

            return 0;

    }

    if (drv->bdrv_pread) {

        int ret, len;

        len = nb_sectors * 512;

        ret = drv->bdrv_pread(bs, sector_num * 512, buf, len);

        if (ret < 0)

            return ret;

        else if (ret != len)

            return -EINVAL;

        else {

	    bs->rd_bytes += (unsigned) len;

	    bs->rd_ops ++;

            return 0;

	}

    } else {

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

    }

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
     int ret = 0;

     switch (frame->format) {
+
         case AV_PIX_FMT_YUV420P:

             ret = SDL_UpdateYUVTexture(tex, NULL, frame->data[0], frame->linesize[0],

static int upload_texture(SDL_Texture *tex, AVFrame *frame, struct SwsContext **img_convert_ctx) {

    int ret = 0;

    switch (frame->format) {

        case AV_PIX_FMT_YUV420P:

            ret = SDL_UpdateYUVTexture(tex, NULL, frame->data[0], frame->linesize[0],

                                                  frame->data[1], frame->linesize[1],

                                                  frame->data[2], frame->linesize[2]);

            break;

        case AV_PIX_FMT_BGRA:

            ret = SDL_UpdateTexture(tex, NULL, frame->data[0], frame->linesize[0]);

            break;

        default:

            /* This should only happen if we are not using avfilter... */

            *img_convert_ctx = sws_getCachedContext(*img_convert_ctx,

                frame->width, frame->height, frame->format, frame->width, frame->height,

                AV_PIX_FMT_BGRA, sws_flags, NULL, NULL, NULL);

            if (*img_convert_ctx != NULL) {

                uint8_t *pixels;

                int pitch;

                if (!SDL_LockTexture(tex, NULL, (void **)&pixels, &pitch)) {

                    sws_scale(*img_convert_ctx, (const uint8_t * const *)frame->data, frame->linesize,

                              0, frame->height, &pixels, &pitch);

                    SDL_UnlockTexture(tex);

                }

            } else {

                av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n");

                ret = -1;

            }

            break;

    }

    return ret;

}


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

     char c;

+    int64_t start, end;

     const unsigned char *ptr = p->buf;

static int mpl2_probe(AVProbeData *p)

{

    int i;

    char c;

    int64_t start, end;

    const unsigned char *ptr = p->buf;

    const unsigned char *ptr_end = ptr + p->buf_size;

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

        if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", &start, &end, &c) != 3 &&

            sscanf(ptr, "[%"SCNd64"][]%c",          &start,       &c) != 2)

            return 0;

        ptr += strcspn(ptr, "\n") + 1;

        if (ptr >= ptr_end)

            return 0;

    }

    return AVPROBE_SCORE_MAX;

}


--- a/source.c
+++ b/source.c
@@ -29,9 +29,9 @@
     /* Pseudo-stereo - just copy left channel to right channel */

     if (ctx->channels == 2) {
+
+        memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1]));
+
+    }
+
 }

static void ape_unpack_mono(APEContext *ctx, int count)

{

    if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {

        /* We are pure silence, so we're done. */

        av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n");

        return;

    }

    entropy_decode(ctx, count, 0);

    ape_apply_filters(ctx, ctx->decoded[0], NULL, count);

    /* Now apply the predictor decoding */

    predictor_decode_mono(ctx, count);

    /* Pseudo-stereo - just copy left channel to right channel */

    if (ctx->channels == 2) {

        memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1]));

    }

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
     writable_mask = ~reg->ro_mask & valid_mask;

     cfg_entry->data = XEN_PT_MERGE_VALUE(*val, cfg_entry->data, writable_mask);
+
+
+
+    /* create value for writing to I/O device register */
+
     if (*val & PCI_COMMAND_INTX_DISABLE) {

         throughable_mask |= PCI_COMMAND_INTX_DISABLE;

static int xen_pt_cmd_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry,

                                uint16_t *val, uint16_t dev_value,

                                uint16_t valid_mask)

{

    XenPTRegInfo *reg = cfg_entry->reg;

    uint16_t writable_mask = 0;

    uint16_t throughable_mask = get_throughable_mask(s, reg, valid_mask);

    /* modify emulate register */

    writable_mask = ~reg->ro_mask & valid_mask;

    cfg_entry->data = XEN_PT_MERGE_VALUE(*val, cfg_entry->data, writable_mask);

    /* create value for writing to I/O device register */

    if (*val & PCI_COMMAND_INTX_DISABLE) {

        throughable_mask |= PCI_COMMAND_INTX_DISABLE;

    } else {

        if (s->machine_irq) {

            throughable_mask |= PCI_COMMAND_INTX_DISABLE;

        }

    }

    *val = XEN_PT_MERGE_VALUE(*val, dev_value, throughable_mask);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,
+
+                       BlockDriverCompletionFunc *cb, void *opaque,
+
+                       Error **errp)
+
 {

     BlockJob *job;

void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs,

                       BlockDriverCompletionFunc *cb, void *opaque,

                       Error **errp)

{

    BlockJob *job;

    if (bs->job || bdrv_in_use(bs)) {

        error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));

        return NULL;

    }

    bdrv_set_in_use(bs, 1);

    job = g_malloc0(job_type->instance_size);

    job->job_type      = job_type;

    job->bs            = bs;

    job->cb            = cb;

    job->opaque        = opaque;

    bs->job = job;

    return job;

}


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

         if (status & float_flag_underflow) {
+
+            env->fsr |= FSR_UFC;
+
+        }
+
         if (status & float_flag_divbyzero) {

             env->fsr |= FSR_DZC;

static void check_ieee_exceptions(CPUSPARCState *env)

{

    target_ulong status;

    status = get_float_exception_flags(&env->fp_status);

    if (status) {

        /* Copy IEEE 754 flags into FSR */

        if (status & float_flag_invalid) {

            env->fsr |= FSR_NVC;

        }

        if (status & float_flag_overflow) {

            env->fsr |= FSR_OFC;

        }

        if (status & float_flag_underflow) {

            env->fsr |= FSR_UFC;

        }

        if (status & float_flag_divbyzero) {

            env->fsr |= FSR_DZC;

        }

        if (status & float_flag_inexact) {

            env->fsr |= FSR_NXC;

        }

        if ((env->fsr & FSR_CEXC_MASK) & ((env->fsr & FSR_TEM_MASK) >> 23)) {

            /* Unmasked exception, generate a trap */

            env->fsr |= FSR_FTT_IEEE_EXCP;

            helper_raise_exception(env, TT_FP_EXCP);

        } else {

            /* Accumulate exceptions */

            env->fsr |= (env->fsr & FSR_CEXC_MASK) << 5;

        }

    }

}


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

                                  int width, int height,

+                                 int lumStride, int chromStride, int srcStride)

 {

static void RENAME(uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,

                                 int width, int height,

                                 int lumStride, int chromStride, int srcStride)

{

    int y;

    const int chromWidth = FF_CEIL_RSHIFT(width, 1);

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

        RENAME(extract_even)(src+1, ydst, width);

        if(y&1) {

            RENAME(extract_even2avg)(src-srcStride, src, udst, vdst, chromWidth);

            udst+= chromStride;

            vdst+= chromStride;

        }

        src += srcStride;

        ydst+= lumStride;

    }

    __asm__(

            EMMS"       \n\t"

            SFENCE"     \n\t"

            ::: "memory"

        );

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int print_uint32(DeviceState *dev, Property *prop, char *dest, size_t len)
+
+{

     uint32_t *ptr = qdev_get_prop_ptr(dev, prop);

static int print_uint32(DeviceState *dev, Property *prop, char *dest, size_t len)

{

    uint32_t *ptr = qdev_get_prop_ptr(dev, prop);

    return snprintf(dest, len, "%" PRIu32, *ptr);

}


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

         g_assert_cmpint(item->value->base->integer, ==, 42 + i);

+    }
+
+
+
+    qapi_free_UserDefOneList(head);

 }

static void test_visitor_in_list(TestInputVisitorData *data,

                                 const void *unused)

{

    UserDefOneList *item, *head = NULL;

    Error *err = NULL;

    Visitor *v;

    int i;

    v = visitor_input_test_init(data, "[ { 'string': 'string0', 'integer': 42 }, { 'string': 'string1', 'integer': 43 }, { 'string': 'string2', 'integer': 44 } ]");

    visit_type_UserDefOneList(v, &head, NULL, &err);

    g_assert(!err);

    g_assert(head != NULL);

    for (i = 0, item = head; item; item = item->next, i++) {

        char string[12];

        snprintf(string, sizeof(string), "string%d", i);

        g_assert_cmpstr(item->value->string, ==, string);

        g_assert_cmpint(item->value->base->integer, ==, 42 + i);

    }

    qapi_free_UserDefOneList(head);

}


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

                                      RowContext *row, int n)

+{
+
     return dnxhd_decode_dct_block(ctx, row, n, 6, 8, 4);

 }

static int dnxhd_decode_dct_block_10(const DNXHDContext *ctx,

                                     RowContext *row, int n)

{

    return dnxhd_decode_dct_block(ctx, row, n, 6, 8, 4);

}


--- a/source.c
+++ b/source.c
@@ -6,11 +6,11 @@
         for (i = 0; i < c->nb_as; i++)
             av_dict_free(&c->as[i].metadata);
         av_freep(&c->as);
+        c->nb_as = 0;
+    }
+    if (!c->streams)
+        return;
+    for (i = 0; i < s->nb_streams; i++) {
         OutputStream *os = &c->streams[i];
         if (os->ctx && os->ctx_inited)
             av_write_trailer(os->ctx);

static void dash_free(AVFormatContext *s)
{
    DASHContext *c = s->priv_data;
    int i, j;
    if (c->as) {
        for (i = 0; i < c->nb_as; i++)
            av_dict_free(&c->as[i].metadata);
        av_freep(&c->as);
        c->nb_as = 0;
    }
    if (!c->streams)
        return;
    for (i = 0; i < s->nb_streams; i++) {
        OutputStream *os = &c->streams[i];
        if (os->ctx && os->ctx_inited)
            av_write_trailer(os->ctx);
        if (os->ctx && os->ctx->pb)
            ffio_free_dyn_buf(&os->ctx->pb);
        ff_format_io_close(s, &os->out);
        if (os->ctx)
            avformat_free_context(os->ctx);
        for (j = 0; j < os->nb_segments; j++)
            av_free(os->segments[j]);
        av_free(os->segments);
    }
    av_freep(&c->streams);
}


--- a/source.c
+++ b/source.c
@@ -39,11 +39,11 @@
         ret = vdev->vq[vdev->queue_sel].vring.num;

         break;
+
+    case VIRTIO_PCI_QUEUE_SEL:
+
+        ret = vdev->queue_sel;
+
         break;

     case VIRTIO_PCI_STATUS:

static uint32_t virtio_ioport_read(void *opaque, uint32_t addr)

{

    VirtIODevice *vdev = to_virtio_device(opaque);

    uint32_t ret = 0xFFFFFFFF;

    addr -= vdev->addr;

    switch (addr) {

    case VIRTIO_PCI_HOST_FEATURES:

        ret = vdev->get_features(vdev);

        ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);

        break;

    case VIRTIO_PCI_GUEST_FEATURES:

        ret = vdev->features;

        break;

    case VIRTIO_PCI_QUEUE_PFN:

        ret = vdev->vq[vdev->queue_sel].pfn;

        break;

    case VIRTIO_PCI_QUEUE_NUM:

        ret = vdev->vq[vdev->queue_sel].vring.num;

        break;

    case VIRTIO_PCI_QUEUE_SEL:

        ret = vdev->queue_sel;

        break;

    case VIRTIO_PCI_STATUS:

        ret = vdev->status;

        break;

    case VIRTIO_PCI_ISR:

        /* reading from the ISR also clears it. */

        ret = vdev->isr;

        vdev->isr = 0;

        virtio_update_irq(vdev);

        break;

    default:

        break;

    }

    return ret;

}


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

         list_fmts(av_get_sample_fmt_string, AV_SAMPLE_FMT_NB);
+
+        ffmpeg_exit(0);
+
+    }

 }

static void opt_audio_sample_fmt(const char *arg)

{

    if (strcmp(arg, "list"))

        audio_sample_fmt = av_get_sample_fmt(arg);

    else {

        list_fmts(av_get_sample_fmt_string, AV_SAMPLE_FMT_NB);

        ffmpeg_exit(0);

    }

}


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

     cpu_exec_init();

+
+
+    env = qemu_mallocz(sizeof(CPUPPCState));
+
+    if (!env)

         return NULL;

CPUPPCState *cpu_ppc_init(void)

{

    CPUPPCState *env;

    cpu_exec_init();

    env = qemu_mallocz(sizeof(CPUPPCState));

    if (!env)

        return NULL;

#if !defined(CONFIG_USER_ONLY) && defined (USE_OPEN_FIRMWARE)

    setup_machine(env, 0);

#else

//    env->spr[PVR] = 0; /* Basic PPC */

    env->spr[PVR] = 0x00080100; /* G3 CPU */

//    env->spr[PVR] = 0x00083100; /* MPC755 (G3 embedded) */

//    env->spr[PVR] = 0x00070100; /* IBM 750FX */

#endif

    tlb_flush(env, 1);

#if defined (DO_SINGLE_STEP)

    /* Single step trace mode */

    msr_se = 1;

#endif

    msr_fp = 1; /* Allow floating point exceptions */

    msr_me = 1; /* Allow machine check exceptions  */

#if defined(CONFIG_USER_ONLY)

    msr_pr = 1;

    cpu_ppc_register(env, 0x00080000);

#else

    env->nip = 0xFFFFFFFC;

#endif

    env->access_type = ACCESS_INT;

    cpu_single_env = env;

    return env;

}


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

 {

+    return strstart(prop->type, "link<", NULL);

 }

static inline bool object_property_is_link(ObjectProperty *prop)

{

    return strstart(prop->type, "link<", NULL);

}


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

+                   NetClientState *peer)
+
 {

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

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

                   NetClientState *peer)

{

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

}


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

     /* If the address-part contains a colon, it's an IPv6 IP so needs [] */
+
+    if (strstr(address, ":")) {
+
+        snprintf(buf, len, "[%s]:%u", address, port);

     } else {

static void combine_addr(char *buf, size_t len, const char* address,

                         uint16_t port)

{

    /* If the address-part contains a colon, it's an IPv6 IP so needs [] */

    if (strstr(address, ":")) {

        snprintf(buf, len, "[%s]:%u", address, port);

    } else {

        snprintf(buf, len, "%s:%u", address, port);

    }

}


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

     Coroutine *co;
+
+    BlockAIOCBCoroutine *acb;

BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs,

        int64_t sector_num, int nb_sectors,

        BlockCompletionFunc *cb, void *opaque)

{

    Coroutine *co;

    BlockAIOCBCoroutine *acb;

    trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque);

    acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);

    acb->need_bh = true;

    acb->req.error = -EINPROGRESS;

    acb->req.sector = sector_num;

    acb->req.nb_sectors = nb_sectors;

    co = qemu_coroutine_create(bdrv_aio_discard_co_entry);

    qemu_coroutine_enter(co, acb);

    bdrv_co_maybe_schedule_bh(acb);

    return &acb->common;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 int64_t bdrv_get_block_status(BlockDriverState *bs,

+                              int64_t sector_num,
+
+                              int nb_sectors, int *pnum,

                               BlockDriverState **file)

int64_t bdrv_get_block_status(BlockDriverState *bs,

                              int64_t sector_num,

                              int nb_sectors, int *pnum,

                              BlockDriverState **file)

{

    return bdrv_get_block_status_above(bs, backing_bs(bs),

                                       sector_num, nb_sectors, pnum, file);

}


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

                                  const char *model,

+                                 const char *name,

                                  int fd)

static TAPState *net_tap_fd_init(VLANState *vlan,

                                 const char *model,

                                 const char *name,

                                 int fd)

{

    TAPState *s;

    s = qemu_mallocz(sizeof(TAPState));

    s->fd = fd;

    s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s);

    s->vc->fd_readv = tap_receive_iov;

    qemu_set_fd_handler(s->fd, tap_send, NULL, s);

    snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,26 +1,26 @@
+static MegasasCmd *megasas_next_frame(MegasasState *s,
+
+    hwaddr frame)
+
+{
+
+    MegasasCmd *cmd = NULL;

+    int num = 0, index;
+
+
+
+    cmd = megasas_lookup_frame(s, frame);
+
     if (cmd) {
+
+        trace_megasas_qf_found(cmd->index, cmd->pa);

+        return cmd;
+
     }
+
+    index = s->reply_queue_head;

     num = 0;

static MegasasCmd *megasas_next_frame(MegasasState *s,

    hwaddr frame)

{

    MegasasCmd *cmd = NULL;

    int num = 0, index;

    cmd = megasas_lookup_frame(s, frame);

    if (cmd) {

        trace_megasas_qf_found(cmd->index, cmd->pa);

        return cmd;

    }

    index = s->reply_queue_head;

    num = 0;

    while (num < s->fw_cmds) {

        if (!s->frames[index].pa) {

            cmd = &s->frames[index];

            break;

        }

        index = megasas_next_index(s, index, s->fw_cmds);

        num++;

    }

    if (!cmd) {

        trace_megasas_qf_failed(frame);

    }

    trace_megasas_qf_new(index, cmd);

    return cmd;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)

+{

+    int i;

     m->style_entries = AV_RB16(tsmb);

static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)

{

    int i;

    m->style_entries = AV_RB16(tsmb);

    tsmb += 2;

    // A single style record is of length 12 bytes.

    if (m->tracksize + m->size_var + 2 + m->style_entries * 12 > avpkt->size)

        return -1;

    m->box_flags |= STYL_BOX;

    for(i = 0; i < m->style_entries; i++) {

        m->s_temp = av_malloc(sizeof(*m->s_temp));

        if (!m->s_temp) {

            mov_text_cleanup(m);

            return AVERROR(ENOMEM);

        }

        m->s_temp->style_start = AV_RB16(tsmb);

        tsmb += 2;

        m->s_temp->style_end = AV_RB16(tsmb);

        tsmb += 2;

        m->s_temp->style_fontID = AV_RB16(tsmb);

        tsmb += 2;

        m->s_temp->style_flag = AV_RB8(tsmb);

        tsmb++;

        m->s_temp->fontsize = AV_RB8(tsmb);

        av_dynarray_add(&m->s, &m->count_s, m->s_temp);

        if(!m->s) {

            mov_text_cleanup(m);

            return AVERROR(ENOMEM);

        }

        tsmb++;

        // text-color-rgba

        tsmb += 4;

    }

    return 0;

}


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

     tcg_gen_ld_tl(t, cpu_env, offsetof(CPUState, spr[reg]));

+}

static always_inline void gen_load_spr(TCGv t, int reg)

{

    tcg_gen_ld_tl(t, cpu_env, offsetof(CPUState, spr[reg]));

}


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

     size_t size = s->cluster_size;
+

     if (s->refcount_block_cache_offset == 0) {

static int write_refcount_block(BlockDriverState *bs)

{

    BDRVQcowState *s = bs->opaque;

    size_t size = s->cluster_size;

    if (s->refcount_block_cache_offset == 0) {

        return 0;

    }

    BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE);

    if (bdrv_pwrite(bs->file, s->refcount_block_cache_offset,

            s->refcount_block_cache, size) != size)

    {

        return -EIO;

    }

    return 0;

}


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

     const DNXHDContext *ctx = avctx->priv_data;

+    uint32_t offset = ctx->mb_scan_index[rownb];

     RowContext *row = ctx->rows + threadnb;

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

                            int rownb, int threadnb)

{

    const DNXHDContext *ctx = avctx->priv_data;

    uint32_t offset = ctx->mb_scan_index[rownb];

    RowContext *row = ctx->rows + threadnb;

    int x;

    row->last_dc[0] =

    row->last_dc[1] =

    row->last_dc[2] = 1 << (ctx->bit_depth + 2); // for levels +2^(bitdepth-1)

    init_get_bits(&row->gb, ctx->buf + offset, (ctx->buf_size - offset) << 3);

    for (x = 0; x < ctx->mb_width; x++) {

        //START_TIMER;

        dnxhd_decode_macroblock(ctx, row, data, x, rownb);

        //STOP_TIMER("decode macroblock");

    }

    return 0;

}


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

     BlockDriverState *bs = opaque;

static void bdrv_throttle_read_timer_cb(void *opaque)

{

    BlockDriverState *bs = opaque;

    qemu_co_enter_next(&bs->throttled_reqs[0]);

}


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

             new_pkt.destruct= av_destruct_packet;

+        }
+
+        *pkt= new_pkt;
+
+

         bsfc= bsfc->next;

static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){

    while(bsfc){

        AVPacket new_pkt= *pkt;

        int a= av_bitstream_filter_filter(bsfc, avctx, NULL,

                                          &new_pkt.data, &new_pkt.size,

                                          pkt->data, pkt->size,

                                          pkt->flags & PKT_FLAG_KEY);

        if(a){

            av_free_packet(pkt);

            new_pkt.destruct= av_destruct_packet;

        }

        *pkt= new_pkt;

        bsfc= bsfc->next;

    }

    av_interleaved_write_frame(s, pkt);

}


--- a/source.c
+++ b/source.c
@@ -1,20 +1,20 @@
 void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size)
+
+{
+
+	const uint16_t *end;
+
+	uint8_t *d = (uint8_t *)dst;
+
+	const uint16_t *s = (uint16_t *)src;
+
+	end = s + src_size/2;
+
+	while(s < end)

 	{

+		register uint16_t bgr;

 		bgr = *s++;

void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size)

{

	const uint16_t *end;

	uint8_t *d = (uint8_t *)dst;

	const uint16_t *s = (uint16_t *)src;

	end = s + src_size/2;

	while(s < end)

	{

		register uint16_t bgr;

		bgr = *s++;

		#ifdef WORDS_BIGENDIAN

			*d++ = 0;

			*d++ = (bgr&0x1F)<<3;

			*d++ = (bgr&0x7E0)>>3;

			*d++ = (bgr&0xF800)>>8;

		#else

			*d++ = (bgr&0xF800)>>8;

			*d++ = (bgr&0x7E0)>>3;

			*d++ = (bgr&0x1F)<<3;

			*d++ = 0;

		#endif

	}

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static void ERROR(const char *str)
+
+{

         fprintf(stderr, "%s\n", str);

static void ERROR(const char *str)

{

        fprintf(stderr, "%s\n", str);

        exit(1);

}


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

     /* PIO data access allowed only when DRQ bit is set. The result of a read
+
      * during PIO in is indeterminate, return 0 and don't move forward. */

     if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {

uint32_t ide_data_readw(void *opaque, uint32_t addr)

{

    IDEBus *bus = opaque;

    IDEState *s = idebus_active_if(bus);

    uint8_t *p;

    int ret;

    /* PIO data access allowed only when DRQ bit is set. The result of a read

     * during PIO in is indeterminate, return 0 and don't move forward. */

    if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) {

        return 0;

    }

    p = s->data_ptr;

    if (p + 2 > s->data_end) {

        return 0;

    }

    ret = cpu_to_le16(*(uint16_t *)p);

    p += 2;

    s->data_ptr = p;

    if (p >= s->data_end)

        s->end_transfer_func(s);

    return ret;

}


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

     if (index >= MAX_CONSOLES)

+        return;

     if (active_console) {

void console_select(unsigned int index)

{

    TextConsole *s;

    if (index >= MAX_CONSOLES)

        return;

    if (active_console) {

        active_console->g_width = ds_get_width(active_console->ds);

        active_console->g_height = ds_get_height(active_console->ds);

    }

    s = consoles[index];

    if (s) {

        DisplayState *ds = s->ds;

        if (active_console->cursor_timer) {

            qemu_del_timer(active_console->cursor_timer);

        }

        active_console = s;

        if (ds_get_bits_per_pixel(s->ds)) {

            ds->surface = qemu_resize_displaysurface(ds, s->g_width, s->g_height);

        } else {

            s->ds->surface->width = s->width;

            s->ds->surface->height = s->height;

        }

        if (s->cursor_timer) {

            qemu_mod_timer(s->cursor_timer,

                   qemu_get_clock_ms(rt_clock) + CONSOLE_CURSOR_PERIOD / 2);

        }

        dpy_resize(s->ds);

        vga_hw_invalidate();

    }

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
+
+{

     int len = strlen(str);

void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)

{

    int len = strlen(str);

    if (len > 0) {

        len++;

        ffio_wfourcc(pb, tag);

        avio_wl32(pb, len);

        avio_put_str(pb, str);

        if (len & 1)

            avio_w8(pb, 0);

    }

}


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

     int ret;

+
+
+    ret = avformat_alloc_output_context2(&wc->avf, wc->oformat, NULL, NULL);
+
     if (ret < 0)

         return ret;

static int chunk_mux_init(AVFormatContext *s)

{

    WebMChunkContext *wc = s->priv_data;

    AVFormatContext *oc;

    int ret;

    ret = avformat_alloc_output_context2(&wc->avf, wc->oformat, NULL, NULL);

    if (ret < 0)

        return ret;

    oc = wc->avf;

    oc->interrupt_callback = s->interrupt_callback;

    oc->max_delay          = s->max_delay;

    av_dict_copy(&oc->metadata, s->metadata, 0);

    oc->priv_data = av_mallocz(oc->oformat->priv_data_size);

    if (!oc->priv_data) {

        avio_close(oc->pb);

        return AVERROR(ENOMEM);

    }

    *(const AVClass**)oc->priv_data = oc->oformat->priv_class;

    av_opt_set_defaults(oc->priv_data);

    av_opt_set_int(oc->priv_data, "dash", 1, 0);

    av_opt_set_int(oc->priv_data, "cluster_time_limit", wc->chunk_duration, 0);

    av_opt_set_int(oc->priv_data, "live", 1, 0);

    oc->streams = s->streams;

    oc->nb_streams = s->nb_streams;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static uint32_t timer_int_route(struct HPETTimer *timer)
+
+{
+
     uint32_t route;

     route = (timer->config & HPET_TN_INT_ROUTE_MASK) >> HPET_TN_INT_ROUTE_SHIFT;

static uint32_t timer_int_route(struct HPETTimer *timer)

{

    uint32_t route;

    route = (timer->config & HPET_TN_INT_ROUTE_MASK) >> HPET_TN_INT_ROUTE_SHIFT;

    return route;

}


static CharDriverState *qemu_chr_open_ringbuf(const char *id,

                                              ChardevBackend *backend,

                                              ChardevReturn *ret,

                                              Error **errp)

{

    ChardevRingbuf *opts = backend->u.ringbuf;

    CharDriverState *chr;

    RingBufCharDriver *d;

    chr = qemu_chr_alloc();

    d = g_malloc(sizeof(*d));

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

    /* The size must be power of 2 */

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

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

        goto fail;

    }

    d->prod = 0;

    d->cons = 0;

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

    chr->opaque = d;

    chr->chr_write = ringbuf_chr_write;

    chr->chr_close = ringbuf_chr_close;

    return chr;

fail:

    g_free(d);

    g_free(chr);

    return NULL;

}


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

     MSS12Context *c = &ctx->c;

+    int ret;
+
     c->avctx = avctx;

     avctx->coded_frame = &ctx->pic;

static av_cold int mss2_decode_init(AVCodecContext *avctx)

{

    MSS2Context * const ctx = avctx->priv_data;

    MSS12Context *c = &ctx->c;

    int ret;

    c->avctx = avctx;

    avctx->coded_frame = &ctx->pic;

    if (ret = ff_mss12_decode_init(c, 1, &ctx->sc[0], &ctx->sc[1]))

        return ret;

    c->pal_stride   = c->mask_stride;

    c->pal_pic      = av_malloc(c->pal_stride * avctx->height);

    c->last_pal_pic = av_malloc(c->pal_stride * avctx->height);

    if (!c->pal_pic || !c->last_pal_pic) {

        mss2_decode_end(avctx);

        return AVERROR(ENOMEM);

    }

    if (ret = wmv9_init(avctx)) {

        mss2_decode_end(avctx);

        return ret;

    }

    ff_mss2dsp_init(&ctx->dsp);

    avctx->pix_fmt = c->free_colours == 127 ? AV_PIX_FMT_RGB555

                                            : AV_PIX_FMT_RGB24;

    return 0;

}


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

         if (!float64_is_nan(src0)

+            && !float64_is_nan(src1)) {
+
+            res = 0;
+
+            if (float64_lt_quiet(src0, res, &env->fp_status))

                 res = float64_chs(res);

float64 helper_sub_cmpf64(CPUM68KState *env, float64 src0, float64 src1)

{

    /* ??? This may incorrectly raise exceptions.  */

    /* ??? Should flush denormals to zero.  */

    float64 res;

    res = float64_sub(src0, src1, &env->fp_status);

    if (float64_is_nan(res)) {

        /* +/-inf compares equal against itself, but sub returns nan.  */

        if (!float64_is_nan(src0)

            && !float64_is_nan(src1)) {

            res = 0;

            if (float64_lt_quiet(src0, res, &env->fp_status))

                res = float64_chs(res);

        }

    }

    return res;

}


--- a/source.c
+++ b/source.c
@@ -29,11 +29,11 @@
     if (bs && qdev_prop_set_drive(dev, "drive", bs)) {

         abort();
+
+    }
+
+    qdev_prop_set_uint32(dev, "num-blocks", nb_blocs);
+
     qdev_prop_set_uint32(dev, "sector-length", sector_len);

     qdev_prop_set_uint8(dev, "width", width);

type_init(pflash_cfi02_register_types)

pflash_t *pflash_cfi02_register(hwaddr base,

                                DeviceState *qdev, const char *name,

                                hwaddr size,

                                BlockDriverState *bs, uint32_t sector_len,

                                int nb_blocs, int nb_mappings, int width,

                                uint16_t id0, uint16_t id1,

                                uint16_t id2, uint16_t id3,

                                uint16_t unlock_addr0, uint16_t unlock_addr1,

                                int be)

{

    DeviceState *dev = qdev_create(NULL, TYPE_CFI_PFLASH02);

    if (bs && qdev_prop_set_drive(dev, "drive", bs)) {

        abort();

    }

    qdev_prop_set_uint32(dev, "num-blocks", nb_blocs);

    qdev_prop_set_uint32(dev, "sector-length", sector_len);

    qdev_prop_set_uint8(dev, "width", width);

    qdev_prop_set_uint8(dev, "mappings", nb_mappings);

    qdev_prop_set_uint8(dev, "big-endian", !!be);

    qdev_prop_set_uint16(dev, "id0", id0);

    qdev_prop_set_uint16(dev, "id1", id1);

    qdev_prop_set_uint16(dev, "id2", id2);

    qdev_prop_set_uint16(dev, "id3", id3);

    qdev_prop_set_uint16(dev, "unlock-addr0", unlock_addr0);

    qdev_prop_set_uint16(dev, "unlock-addr1", unlock_addr1);

    qdev_prop_set_string(dev, "name", name);

    qdev_init_nofail(dev);

    sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);

    return CFI_PFLASH02(dev);

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void hscroll(AVCodecContext *avctx)

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

     if (s->y < avctx->height - s->font_height) {

static void hscroll(AVCodecContext *avctx)

{

    AnsiContext *s = avctx->priv_data;

    int i;

    if (s->y < avctx->height - s->font_height) {

        s->y += s->font_height;

        return;

    }

    i = 0;

    for (; i < avctx->height - s->font_height; i++)

        memcpy(s->frame->data[0] + i * s->frame->linesize[0],

               s->frame->data[0] + (i + s->font_height) * s->frame->linesize[0],

               avctx->width);

    for (; i < avctx->height; i++)

        memset(s->frame->data[0] + i * s->frame->linesize[0],

            DEFAULT_BG_COLOR, avctx->width);

}


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

     CPUState *cs = CPU(obj);
+
     AlphaCPU *cpu = ALPHA_CPU(obj);

     CPUAlphaState *env = &cpu->env;

static void alpha_cpu_initfn(Object *obj)

{

    CPUState *cs = CPU(obj);

    AlphaCPU *cpu = ALPHA_CPU(obj);

    CPUAlphaState *env = &cpu->env;

    cs->env_ptr = env;

    cpu_exec_init(cs, &error_abort);

    tlb_flush(cs, 1);

    alpha_translate_init();

#if defined(CONFIG_USER_ONLY)

    env->ps = PS_USER_MODE;

    cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD

                               | FPCR_UNFD | FPCR_INED | FPCR_DNOD

                               | FPCR_DYN_NORMAL));

#endif

    env->lock_addr = -1;

    env->fen = 1;

}


--- a/source.c
+++ b/source.c
@@ -1,28 +1,28 @@
 void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1)

 {
+
+    int cssid, ssid, schid, m;

     SubchDev *sch;

     int ret = -ENODEV;

     int cc;
+
+

+    if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) {
+
+        program_interrupt(&cpu->env, PGM_OPERAND, 4);
+
         return;
+
     }
+
     trace_ioinst_sch_id("rsch", cssid, ssid, schid);

+    sch = css_find_subch(m, cssid, ssid, schid);

     if (sch && css_subch_visible(sch)) {

void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1)

{

    int cssid, ssid, schid, m;

    SubchDev *sch;

    int ret = -ENODEV;

    int cc;

    if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) {

        program_interrupt(&cpu->env, PGM_OPERAND, 4);

        return;

    }

    trace_ioinst_sch_id("rsch", cssid, ssid, schid);

    sch = css_find_subch(m, cssid, ssid, schid);

    if (sch && css_subch_visible(sch)) {

        ret = css_do_rsch(sch);

    }

    switch (ret) {

    case -ENODEV:

        cc = 3;

        break;

    case -EINVAL:

        cc = 2;

        break;

    case 0:

        cc = 0;

        break;

    default:

        cc = 1;

        break;

    }

    setcc(cpu, cc);

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void test_reconnect(void)
+
+{
+
     gchar *path = g_strdup_printf("/%s/vhost-user/reconnect/subprocess",

                                   qtest_get_arch());

static void test_reconnect(void)

{

    gchar *path = g_strdup_printf("/%s/vhost-user/reconnect/subprocess",

                                  qtest_get_arch());

    g_test_trap_subprocess(path, 0, 0);

    g_test_trap_assert_passed();

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     inited = 1;

+
+    /* devices */
+
+    REGISTER_MUXDEMUX (AUDIO_BEOS, audio_beos);
+
     REGISTER_DEMUXER  (BKTR, bktr);

     REGISTER_DEMUXER  (DV1394, dv1394);

void avdevice_register_all(void)

{

    static int inited;

    if (inited)

        return;

    inited = 1;

    /* devices */

    REGISTER_MUXDEMUX (AUDIO_BEOS, audio_beos);

    REGISTER_DEMUXER  (BKTR, bktr);

    REGISTER_DEMUXER  (DV1394, dv1394);

    REGISTER_MUXDEMUX (OSS, oss);

    REGISTER_DEMUXER  (V4L2, v4l2);

    REGISTER_DEMUXER  (V4L, v4l);

    REGISTER_DEMUXER  (X11_GRAB_DEVICE, x11_grab_device);

    /* external libraries */

    REGISTER_DEMUXER  (LIBDC1394, libdc1394);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static int flac_probe(AVProbeData *p)
+
+{
+
+    uint8_t *bufptr = p->buf;

     uint8_t *end    = p->buf + p->buf_size;

static int flac_probe(AVProbeData *p)

{

    uint8_t *bufptr = p->buf;

    uint8_t *end    = p->buf + p->buf_size;

    if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0;

    else                                            return AVPROBE_SCORE_MAX/2;

}


static int dynticks_start_timer(struct qemu_alarm_timer *t)

{

    struct sigevent ev;

    timer_t host_timer;

    struct sigaction act;

    sigfillset(&act.sa_mask);

    act.sa_flags = 0;

    act.sa_handler = host_alarm_handler;

    sigaction(SIGALRM, &act, NULL);

    /*

     * Initialize ev struct to 0 to avoid valgrind complaining

     * about uninitialized data in timer_create call

     */

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

    ev.sigev_value.sival_int = 0;

    ev.sigev_notify = SIGEV_SIGNAL;

#ifdef SIGEV_THREAD_ID

    if (qemu_signalfd_available()) {

        ev.sigev_notify = SIGEV_THREAD_ID;

        ev._sigev_un._tid = qemu_get_thread_id();

    }

#endif /* SIGEV_THREAD_ID */

    ev.sigev_signo = SIGALRM;

    if (timer_create(CLOCK_REALTIME, &ev, &host_timer)) {

        perror("timer_create");

        return -1;

    }

    t->timer = host_timer;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,18 +1,18 @@
+int decode_luma_intra_block(VC9Context *v, int mquant)
+
+{
+
+    GetBitContext *gb = &v->s.gb;

+    int dcdiff;
+
+

     dcdiff = get_vlc2(gb, v->luma_dc_vlc->table,
+
+                      DC_VLC_BITS, 2);

+    if (dcdiff)

     {

int decode_luma_intra_block(VC9Context *v, int mquant)

{

    GetBitContext *gb = &v->s.gb;

    int dcdiff;

    dcdiff = get_vlc2(gb, v->luma_dc_vlc->table,

                      DC_VLC_BITS, 2);

    if (dcdiff)

    {

        if (dcdiff == 119 /* ESC index value */)

        {

            /* TODO: Optimize */

            if (mquant == 1) dcdiff = get_bits(gb, 10);

            else if (mquant == 2) dcdiff = get_bits(gb, 9);

            else dcdiff = get_bits(gb, 8);

        }

        else

        {

            if (mquant == 1)

                dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3;

            else if (mquant == 2)

                dcdiff = (dcdiff<<1) + get_bits(gb, 1) - 1;

        }

        if (get_bits(gb, 1))

            dcdiff = -dcdiff;

    }

    /* FIXME: 8.1.1.15, p(1)13, coeff scaling for Adv Profile */

    return 0;

}


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

     QEMUPutKbdEntry *entry = QTAILQ_FIRST(&kbd_handlers);
+

     if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {

void kbd_put_keycode(int keycode)

{

    QEMUPutKbdEntry *entry = QTAILQ_FIRST(&kbd_handlers);

    if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {

        return;

    }

    if (entry) {

        entry->put_kbd(entry->opaque, keycode);

    }

}


--- a/source.c
+++ b/source.c
@@ -2,6 +2,6 @@
                         DeviceState *dev, Error **errp)
 {
     MachineState *ms = MACHINE(hotplug_dev);
+    S390CPU *cpu = S390_CPU(dev);
     g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu);
     ms->possible_cpus->cpus[cpu->env.core_id].cpu = OBJECT(dev);

static void s390_cpu_plug(HotplugHandler *hotplug_dev,
                        DeviceState *dev, Error **errp)
{
    MachineState *ms = MACHINE(hotplug_dev);
    S390CPU *cpu = S390_CPU(dev);
    g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu);
    ms->possible_cpus->cpus[cpu->env.core_id].cpu = OBJECT(dev);


--- a/source.c
+++ b/source.c
@@ -1,14 +1,14 @@
 int net_handle_fd_param(Monitor *mon, const char *param)
+
+{

     if (!qemu_isdigit(param[0])) {

         int fd;

+

+        fd = monitor_get_fd(mon, param);

         if (fd == -1) {

int net_handle_fd_param(Monitor *mon, const char *param)

{

    if (!qemu_isdigit(param[0])) {

        int fd;

        fd = monitor_get_fd(mon, param);

        if (fd == -1) {

            error_report("No file descriptor named %s found", param);

            return -1;

        }

        return fd;

    } else {

        return strtol(param, NULL, 0);

    }

}


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

     xenstore = xs_daemon_open();

+    if (!xenstore) {
+
         xen_be_printf(NULL, 0, "can't connect to xenstored\n");

         return -1;

int xen_be_init(void)

{

    xenstore = xs_daemon_open();

    if (!xenstore) {

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

        return -1;

    }

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

        goto err;

    }

    if (xen_xc == XC_HANDLER_INITIAL_VALUE) {

        /* Check if xen_init() have been called */

        goto err;

    }

    return 0;

err:

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

    xs_daemon_close(xenstore);

    xenstore = NULL;

    return -1;

}


static int read_cpuinfo(const char *field, char *value, int len)

{

    FILE *f;

    int ret = -1;

    int field_len = strlen(field);

    char line[512];

    f = fopen("/proc/cpuinfo", "r");

    if (!f) {

        return -1;

    }

    do {

        if(!fgets(line, sizeof(line), f)) {

            break;

        }

        if (!strncmp(line, field, field_len)) {

            strncpy(value, line, len);

            ret = 0;

            break;

        }

    } while(*line);

    fclose(f);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
     new_block->host = host;

     if (host) {
+
+        new_block->flags |= RAM_PREALLOC;
+
+    }
+
     addr = ram_block_add(new_block, &local_err);

     if (local_err) {

ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,

                                   MemoryRegion *mr, Error **errp)

{

    RAMBlock *new_block;

    ram_addr_t addr;

    Error *local_err = NULL;

    size = TARGET_PAGE_ALIGN(size);

    new_block = g_malloc0(sizeof(*new_block));

    new_block->mr = mr;

    new_block->used_length = size;

    new_block->max_length = max_size;

    new_block->fd = -1;

    new_block->host = host;

    if (host) {

        new_block->flags |= RAM_PREALLOC;

    }

    addr = ram_block_add(new_block, &local_err);

    if (local_err) {

        g_free(new_block);

        error_propagate(errp, local_err);

        return -1;

    }

    return addr;

}


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

 {

+    AcpiPciHpState *s = opaque;

     uint32_t val = 0;

static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)

{

    AcpiPciHpState *s = opaque;

    uint32_t val = 0;

    int bsel = s->hotplug_select;

    if (bsel < 0 || bsel > ACPI_PCIHP_MAX_HOTPLUG_BUS) {

        return 0;

    }

    switch (addr) {

    case PCI_UP_BASE:

        val = s->acpi_pcihp_pci_status[bsel].up;

        if (!s->legacy_piix) {

            s->acpi_pcihp_pci_status[bsel].up = 0;

        }

        ACPI_PCIHP_DPRINTF("pci_up_read %" PRIu32 "\n", val);

        break;

    case PCI_DOWN_BASE:

        val = s->acpi_pcihp_pci_status[bsel].down;

        ACPI_PCIHP_DPRINTF("pci_down_read %" PRIu32 "\n", val);

        break;

    case PCI_EJ_BASE:

        /* No feature defined yet */

        ACPI_PCIHP_DPRINTF("pci_features_read %" PRIu32 "\n", val);

        break;

    case PCI_RMV_BASE:

        val = s->acpi_pcihp_pci_status[bsel].hotplug_enable;

        ACPI_PCIHP_DPRINTF("pci_rmv_read %" PRIu32 "\n", val);

        break;

    case PCI_SEL_BASE:

        val = s->hotplug_select;

        ACPI_PCIHP_DPRINTF("pci_sel_read %" PRIu32 "\n", val);

    default:

        break;

    }

    return val;

}


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

     int ret = avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);
+
+    if (ret < 0) {
+
+        av_free(rdt);
+
         return NULL;

     }

rdt_new_context (void)

{

    PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));

    int ret = avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);

    if (ret < 0) {

        av_free(rdt);

        return NULL;

    }

    return rdt;

}


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

     int hours, minutes, seconds;
+
+    int64_t time;

static void mpeg4_encode_gop_header(MpegEncContext *s)

{

    int hours, minutes, seconds;

    int64_t time;

    put_bits(&s->pb, 16, 0);

    put_bits(&s->pb, 16, GOP_STARTCODE);

    time = s->current_picture_ptr->f.pts;

    if (s->reordered_input_picture[1])

        time = FFMIN(time, s->reordered_input_picture[1]->f.pts);

    time = time * s->avctx->time_base.num;

    seconds  = time / s->avctx->time_base.den;

    minutes  = seconds / 60;

    seconds %= 60;

    hours    = minutes / 60;

    minutes %= 60;

    hours   %= 24;

    put_bits(&s->pb, 5, hours);

    put_bits(&s->pb, 6, minutes);

    put_bits(&s->pb, 1, 1);

    put_bits(&s->pb, 6, seconds);

    put_bits(&s->pb, 1, !!(s->flags & CODEC_FLAG_CLOSED_GOP));

    put_bits(&s->pb, 1, 0);  // broken link == NO

    s->last_time_base = time / s->avctx->time_base.den;

    ff_mpeg4_stuffing(&s->pb);

}


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

     sPAPRDRConnectorClass *drck;

+
+
+    if (!drc) {
+
+        return RTAS_OUT_PARAM_ERROR;

     }

static uint32_t rtas_set_isolation_state(uint32_t idx, uint32_t state)

{

    sPAPRDRConnector *drc = spapr_drc_by_index(idx);

    sPAPRDRConnectorClass *drck;

    if (!drc) {

        return RTAS_OUT_PARAM_ERROR;

    }

    drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);

    return drck->set_isolation_state(drc, state);

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
     if (!avctx->coded_frame)

         return AVERROR(ENOMEM);
+
+
+
+    avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
+
     avctx->coded_frame->key_frame = 1;

static av_cold int pam_encode_init(AVCodecContext *avctx)

{

    avctx->coded_frame = av_frame_alloc();

    if (!avctx->coded_frame)

        return AVERROR(ENOMEM);

    avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;

    avctx->coded_frame->key_frame = 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -3,9 +3,9 @@
                              void *opaque, Error **errp)

 {
+
+    S390CPU *cpu = S390_CPU(obj);
+
     int64_t value = cpu->id;

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

                             void *opaque, Error **errp)

{

    S390CPU *cpu = S390_CPU(obj);

    int64_t value = cpu->id;

    visit_type_int(v, name, &value, errp);

}


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

         avctx->pix_fmt = AV_PIX_FMT_BGR24;

+        break;
+
+    default:
+
+        av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");

         return AVERROR_INVALIDDATA;

static av_cold int msrle_decode_init(AVCodecContext *avctx)

{

    MsrleContext *s = avctx->priv_data;

    s->avctx = avctx;

    switch (avctx->bits_per_coded_sample) {

    case 4:

    case 8:

        avctx->pix_fmt = AV_PIX_FMT_PAL8;

        break;

    case 24:

        avctx->pix_fmt = AV_PIX_FMT_BGR24;

        break;

    default:

        av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");

        return AVERROR_INVALIDDATA;

    }

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

    return 0;

}


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

     /*

+     * FIXME should set error when unvisited elements remain.  Mostly
+
+     * harmless, as the generated visits always visit all elements.

      */

opts_check_list(Visitor *v, Error **errp)

{

    /*

     * FIXME should set error when unvisited elements remain.  Mostly

     * harmless, as the generated visits always visit all elements.

     */

}


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

     VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus);

+    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
+
+    VirtIOSCSIReq *req;
+
+    uint32_t n;

static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq)

{

    SCSIBus *bus = sreq->bus;

    VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus);

    VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);

    VirtIOSCSIReq *req;

    uint32_t n;

    req = g_malloc(sizeof(*req));

    qemu_get_be32s(f, &n);

    assert(n < vs->conf.num_queues);

    qemu_get_buffer(f, (unsigned char *)&req->elem, sizeof(req->elem));

    /* TODO: add a way for SCSIBusInfo's load_request to fail,

     * and fail migration instead of asserting here.

     * When we do, we might be able to re-enable NDEBUG below.

     */

#ifdef NDEBUG

#error building with NDEBUG is not supported

#endif

    assert(req->elem.in_num <= ARRAY_SIZE(req->elem.in_sg));

    assert(req->elem.out_num <= ARRAY_SIZE(req->elem.out_sg));

    virtio_scsi_parse_req(s, vs->cmd_vqs[n], req);

    scsi_req_ref(sreq);

    req->sreq = sreq;

    if (req->sreq->cmd.mode != SCSI_XFER_NONE) {

        int req_mode =

            (req->elem.in_num > 1 ? SCSI_XFER_FROM_DEV : SCSI_XFER_TO_DEV);

        assert(req->sreq->cmd.mode == req_mode);

    }

    return req;

}


--- a/source.c
+++ b/source.c
@@ -19,11 +19,11 @@
 		     dc->op2, dc->op1, dc->postinc ? "+]" : "]"));

+
+	/* prepare store. Address in T0, value in T1.  */
+
+	if (dc->op2 == PR_CCS)
+
 		cris_evaluate_flags(dc);

 	t0 = tcg_temp_new(TCG_TYPE_TL);

static unsigned int dec_move_pm(DisasContext *dc)

{

	TCGv t0;

	int memsize;

	memsize = preg_sizes[dc->op2];

	DIS(fprintf (logfile, "move.%c $p%u, [$r%u%s\n",

		     memsize_char(memsize),

		     dc->op2, dc->op1, dc->postinc ? "+]" : "]"));

	/* prepare store. Address in T0, value in T1.  */

	if (dc->op2 == PR_CCS)

		cris_evaluate_flags(dc);

	t0 = tcg_temp_new(TCG_TYPE_TL);

	t_gen_mov_TN_preg(t0, dc->op2);

	cris_flush_cc_state(dc);

	gen_store(dc, cpu_R[dc->op1], t0, memsize);

	tcg_temp_free(t0);

	cris_cc_mask(dc, 0);

	if (dc->postinc)

		tcg_gen_addi_tl(cpu_R[dc->op1], cpu_R[dc->op1], memsize);

	return 2;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int pci_unregister_device(DeviceState *dev)

 {

@@ -7,7 +7,7 @@
     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);

+
     pci_unregister_io_regions(pci_dev);

     pci_del_option_rom(pci_dev);

static int pci_unregister_device(DeviceState *dev)

{

    PCIDevice *pci_dev = PCI_DEVICE(dev);

    PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);

    pci_unregister_io_regions(pci_dev);

    pci_del_option_rom(pci_dev);

    if (pc->exit) {

        pc->exit(pci_dev);

    }

    do_pci_unregister_device(pci_dev);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,7 +7,7 @@
     AVIStream *ast, *next_ast = next_st->priv_data;

     int64_t ts, next_ts, ts_min = INT64_MAX;
+
     AVStream *st, *sub_st = NULL;

     int i;

static AVStream *get_subtitle_pkt(AVFormatContext *s, AVStream *next_st,

                                  AVPacket *pkt)

{

    AVIStream *ast, *next_ast = next_st->priv_data;

    int64_t ts, next_ts, ts_min = INT64_MAX;

    AVStream *st, *sub_st = NULL;

    int i;

    next_ts = av_rescale_q(next_ast->frame_offset, next_st->time_base,

                           AV_TIME_BASE_Q);

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

        st  = s->streams[i];

        ast = st->priv_data;

        if (st->discard < AVDISCARD_ALL && ast->sub_pkt.data) {

            ts = av_rescale_q(ast->sub_pkt.dts, st->time_base, AV_TIME_BASE_Q);

            if (ts <= next_ts && ts < ts_min) {

                ts_min = ts;

                sub_st = st;

            }

        }

    }

    if (sub_st) {

        ast = sub_st->priv_data;

        *pkt = ast->sub_pkt;

        pkt->stream_index = sub_st->index;

        if (av_read_packet(ast->sub_ctx, &ast->sub_pkt) < 0)

            ast->sub_pkt.data = NULL;

    }

    return sub_st;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+void sd_set_cb(SDState *sd, qemu_irq readonly, qemu_irq insert)
+
+{

     sd->readonly_cb = readonly;

void sd_set_cb(SDState *sd, qemu_irq readonly, qemu_irq insert)

{

    sd->readonly_cb = readonly;

    sd->inserted_cb = insert;

    qemu_set_irq(readonly, sd->bdrv ? bdrv_is_read_only(sd->bdrv) : 0);

    qemu_set_irq(insert, sd->bdrv ? bdrv_is_inserted(sd->bdrv) : 0);

}


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

 {

static void gen_advance_ccount_cond(DisasContext *dc)

{

    if (dc->ccount_delta > 0) {

        TCGv_i32 tmp = tcg_const_i32(dc->ccount_delta);

        gen_helper_advance_ccount(cpu_env, tmp);

        tcg_temp_free(tmp);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,19 +1,19 @@
 int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,

+                          int first_header_size, uint8_t *header_start[3],

                           int header_len[3])

 {

     int i, j;
+

+    if (AV_RB16(extradata) == first_header_size) {

         for (i=0; i<3; i++) {
+
             header_len[i] = AV_RB16(extradata);

             extradata += 2;

int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,

                          int first_header_size, uint8_t *header_start[3],

                          int header_len[3])

{

    int i, j;

    if (AV_RB16(extradata) == first_header_size) {

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

            header_len[i] = AV_RB16(extradata);

            extradata += 2;

            header_start[i] = extradata;

            extradata += header_len[i];

        }

    } else if (extradata[0] == 2) {

        for (i=0,j=1; i<2; i++,j++) {

            header_len[i] = 0;

            for (; j<extradata_size && extradata[j]==0xff; j++) {

                header_len[i] += 0xff;

            }

            if (j >= extradata_size)

                return -1;

            header_len[i] += extradata[j];

        }

        header_len[2] = extradata_size - header_len[0] - header_len[1] - j;

        extradata += j;

        header_start[0] = extradata;

        header_start[1] = header_start[0] + header_len[0];

        header_start[2] = header_start[1] + header_len[1];

    } else {

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,2 +1,2 @@
+static void s390_cpu_model_initfn(Object *obj)
 {


--- a/source.c
+++ b/source.c
@@ -1,25 +1,25 @@
 static void mux_chr_update_read_handler(CharDriverState *chr,

+                                        GMainContext *context)

 {

     MuxDriver *d = chr->opaque;
+
+    int idx;

+
+
+    if (d->mux_cnt >= MAX_MUX) {
+
+        fprintf(stderr, "Cannot add I/O handlers, MUX array is full\n");
+
         return;

     }

+
     if (chr->mux_idx == -1) {

         chr->mux_idx = d->mux_cnt++;

static void mux_chr_update_read_handler(CharDriverState *chr,

                                        GMainContext *context)

{

    MuxDriver *d = chr->opaque;

    int idx;

    if (d->mux_cnt >= MAX_MUX) {

        fprintf(stderr, "Cannot add I/O handlers, MUX array is full\n");

        return;

    }

    if (chr->mux_idx == -1) {

        chr->mux_idx = d->mux_cnt++;

    }

    idx = chr->mux_idx;

    d->ext_opaque[idx] = chr->handler_opaque;

    d->chr_can_read[idx] = chr->chr_can_read;

    d->chr_read[idx] = chr->chr_read;

    d->chr_event[idx] = chr->chr_event;

    /* Fix up the real driver with mux routines */

    if (d->mux_cnt == 1) {

        qemu_chr_add_handlers_full(d->drv, mux_chr_can_read,

                                   mux_chr_read,

                                   mux_chr_event,

                                   chr, context);

    }

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

        mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_OUT);

    }

    d->focus = idx;

    mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN);

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
             && instance_id <= se->instance_id) {

             instance_id = se->instance_id + 1;
+
+        }
+
+    }
+
     return instance_id;

 }

static int calculate_new_instance_id(const char *idstr)

{

    SaveStateEntry *se;

    int instance_id = 0;

    TAILQ_FOREACH(se, &savevm_handlers, entry) {

        if (strcmp(idstr, se->idstr) == 0

            && instance_id <= se->instance_id) {

            instance_id = se->instance_id + 1;

        }

    }

    return instance_id;

}


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

     static const int rv30_p_types[6] = { RV34_MB_SKIP, RV34_MB_P_16x16, RV34_MB_P_8x8, -1, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };

+    static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };

     MpegEncContext *s = &r->s;

static int rv30_decode_mb_info(RV34DecContext *r)

{

    static const int rv30_p_types[6] = { RV34_MB_SKIP, RV34_MB_P_16x16, RV34_MB_P_8x8, -1, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };

    static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };

    MpegEncContext *s = &r->s;

    GetBitContext *gb = &s->gb;

    int code = svq3_get_ue_golomb(gb);

    if(code > 11){

        av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");

        return -1;

    }

    if(code > 5){

        av_log(s->avctx, AV_LOG_ERROR, "dquant needed\n");

        code -= 6;

    }

    if(s->pict_type != AV_PICTURE_TYPE_B)

        return rv30_p_types[code];

    else

        return rv30_b_types[code];

}


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

+    idx = FFMIN(idx, *count);

int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,

                   AVFilterPad **pads, AVFilterLink ***links,

                   AVFilterPad *newpad)

{

    AVFilterLink **newlinks;

    AVFilterPad *newpads;

    unsigned i;

    idx = FFMIN(idx, *count);

    newpads  = av_realloc_array(*pads,  *count + 1, sizeof(AVFilterPad));

    newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*));

    if (newpads)

        *pads  = newpads;

    if (newlinks)

        *links = newlinks;

    if (!newpads || !newlinks)

        return AVERROR(ENOMEM);

    memmove(*pads  + idx + 1, *pads  + idx, sizeof(AVFilterPad)   * (*count - idx));

    memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx));

    memcpy(*pads + idx, newpad, sizeof(AVFilterPad));

    (*links)[idx] = NULL;

    (*count)++;

    for (i = idx + 1; i < *count; i++)

        if (*links[i])

            (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 static void usb_host_set_config(USBHostDevice *s, int config, USBPacket *p)

+{
+
+    int rc;
+
+

     trace_usb_host_set_config(s->bus_num, s->addr, config);

static void usb_host_set_config(USBHostDevice *s, int config, USBPacket *p)

{

    int rc;

    trace_usb_host_set_config(s->bus_num, s->addr, config);

    usb_host_release_interfaces(s);

    usb_host_detach_kernel(s);

    rc = libusb_set_configuration(s->dh, config);

    if (rc != 0) {

        usb_host_libusb_error("libusb_set_configuration", rc);

        p->status = USB_RET_STALL;

        if (rc == LIBUSB_ERROR_NO_DEVICE) {

            usb_host_nodev(s);

        }

        return;

    }

    p->status = usb_host_claim_interfaces(s, config);

    if (p->status != USB_RET_SUCCESS) {

        return;

    }

    usb_host_ep_update(s);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap)

+{
+
     struct kvm_set_guest_debug_data data;
+

     data.dbg.control = 0;

int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap)

{

    struct kvm_set_guest_debug_data data;

    data.dbg.control = 0;

    if (env->singlestep_enabled)

        data.dbg.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;

    kvm_arch_update_guest_debug(env, &data.dbg);

    data.dbg.control |= reinject_trap;

    data.env = env;

    on_vcpu(env, kvm_invoke_set_guest_debug, &data);

    return data.err;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 int qemu_devtree_add_subnode(void *fdt, const char *name)
+
 {

     int offset;
@@ -8,11 +8,11 @@

     char *basename = strrchr(dupname, '/');

+    int retval;
+
+

+    if (!basename) {

         return -1;

int qemu_devtree_add_subnode(void *fdt, const char *name)

{

    int offset;

    char *dupname = g_strdup(name);

    char *basename = strrchr(dupname, '/');

    int retval;

    if (!basename) {

        return -1;

    }

    basename[0] = '\0';

    basename++;

    offset = fdt_path_offset(fdt, dupname);

    if (offset < 0) {

        return offset;

    }

    retval = fdt_add_subnode(fdt, offset, basename);

    g_free(dupname);

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -44,11 +44,11 @@
         error_setg_errno(errp, errno, "failed to create child process");
         return;
     }
+    ga_wait_child(pid, &status, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
+        return;
+    }
     if (!WIFEXITED(status)) {
         error_setg(errp, "child process has terminated abnormally");
         return;

void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
{
    int ret;
    int status;
    pid_t pid;
    Error *local_err = NULL;
    struct timeval tv;
    /* If user has passed a time, validate and set it. */
    if (has_time) {
        /* year-2038 will overflow in case time_t is 32bit */
        if (time_ns / 1000000000 != (time_t)(time_ns / 1000000000)) {
            error_setg(errp, "Time %" PRId64 " is too large", time_ns);
            return;
        }
        tv.tv_sec = time_ns / 1000000000;
        tv.tv_usec = (time_ns % 1000000000) / 1000;
        g_date_set_time_t(&date, tv.tv_sec);
        if (date.year < 1970 || date.year >= 2070) {
            error_setg_errno(errp, errno, "Invalid time");
            return;
        }
        ret = settimeofday(&tv, NULL);
        if (ret < 0) {
            error_setg_errno(errp, errno, "Failed to set time to guest");
            return;
        }
    }
    /* Now, if user has passed a time to set and the system time is set, we
     * just need to synchronize the hardware clock. However, if no time was
     * passed, user is requesting the opposite: set the system time from the
     * hardware clock (RTC). */
    pid = fork();
    if (pid == 0) {
        setsid();
        reopen_fd_to_null(0);
        reopen_fd_to_null(1);
        reopen_fd_to_null(2);
        /* Use '/sbin/hwclock -w' to set RTC from the system time,
         * or '/sbin/hwclock -s' to set the system time from RTC. */
        execle("/sbin/hwclock", "hwclock", has_time ? "-w" : "-s",
               NULL, environ);
        _exit(EXIT_FAILURE);
    } else if (pid < 0) {
        error_setg_errno(errp, errno, "failed to create child process");
        return;
    }
    ga_wait_child(pid, &status, &local_err);
    if (local_err) {
        error_propagate(errp, local_err);
        return;
    }
    if (!WIFEXITED(status)) {
        error_setg(errp, "child process has terminated abnormally");
        return;
    }
    if (WEXITSTATUS(status)) {
        error_setg(errp, "hwclock failed to set hardware clock to system time");
        return;
    }
}


--- a/source.c
+++ b/source.c
@@ -65,9 +65,9 @@
     QLIST_REMOVE(acb, aiocb_siblings);

     qemu_co_queue_restart_all(&s->overwrapping_queue);
+
+
+
+    return acb->ret;
+
 }

static coroutine_fn int sd_co_discard(BlockDriverState *bs, int64_t sector_num,

                                      int nb_sectors)

{

    SheepdogAIOCB *acb;

    QEMUIOVector dummy;

    BDRVSheepdogState *s = bs->opaque;

    int ret;

    if (!s->discard_supported) {

            return 0;

    }

    acb = sd_aio_setup(bs, &dummy, sector_num, nb_sectors);

    acb->aiocb_type = AIOCB_DISCARD_OBJ;

    acb->aio_done_func = sd_finish_aiocb;

retry:

    if (check_overwrapping_aiocb(s, acb)) {

        qemu_co_queue_wait(&s->overwrapping_queue);

        goto retry;

    }

    ret = sd_co_rw_vector(acb);

    if (ret <= 0) {

        QLIST_REMOVE(acb, aiocb_siblings);

        qemu_co_queue_restart_all(&s->overwrapping_queue);

        qemu_aio_unref(acb);

        return ret;

    }

    qemu_coroutine_yield();

    QLIST_REMOVE(acb, aiocb_siblings);

    qemu_co_queue_restart_all(&s->overwrapping_queue);

    return acb->ret;

}


--- a/source.c
+++ b/source.c
@@ -1,19 +1,19 @@
 static int jp2_find_codestream(J2kDecoderContext *s)
+
 {
+
+    uint32_t atom_size;
+
+    int found_codestream = 0, search_range = 10;

+

+    // skip jpeg2k signature atom
+
     s->buf += 12;

+
     while(!found_codestream && search_range && s->buf_end - s->buf >= 8) {

         atom_size = AV_RB32(s->buf);

static int jp2_find_codestream(J2kDecoderContext *s)

{

    uint32_t atom_size;

    int found_codestream = 0, search_range = 10;

    // skip jpeg2k signature atom

    s->buf += 12;

    while(!found_codestream && search_range && s->buf_end - s->buf >= 8) {

        atom_size = AV_RB32(s->buf);

        if(AV_RB32(s->buf + 4) == JP2_CODESTREAM) {

            found_codestream = 1;

            s->buf += 8;

        } else {

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

                return 0;

            s->buf += atom_size;

            search_range--;

        }

    }

    if(found_codestream)

        return 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static int v9fs_synth_renameat(FsContext *ctx, V9fsPath *olddir,
+
+                               const char *old_name, V9fsPath *newdir,

                                const char *new_name)

static int v9fs_synth_renameat(FsContext *ctx, V9fsPath *olddir,

                               const char *old_name, V9fsPath *newdir,

                               const char *new_name)

{

    errno = EPERM;

    return -1;

}


--- a/source.c
+++ b/source.c
@@ -27,11 +27,11 @@
         src_pr = src_px + w;

+
+        for (; src_px < src_pr; src_px++, dst_px++)
+
+            *dst_px = *src_px;
+
     }

 }

static void gif_copy_img_rect(const uint32_t *src, uint32_t *dst,

                              int linesize, int l, int t, int w, int h)

{

    const int y_start = t * linesize;

    const uint32_t *src_px, *src_pr,

                   *src_py = src + y_start,

                   *dst_py = dst + y_start;

    const uint32_t *src_pb = src_py + t * linesize;

    uint32_t *dst_px;

    for (; src_py < src_pb; src_py += linesize, dst_py += linesize) {

        src_px = src_py + l;

        dst_px = (uint32_t *)dst_py + l;

        src_pr = src_px + w;

        for (; src_px < src_pr; src_px++, dst_px++)

            *dst_px = *src_px;

    }

}


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

     gen_op_store_403_pb(sprn - SPR_403_PBL1);

+    RET_STOP(ctx);
+
+}

static void spr_write_403_pbr (void *opaque, int sprn)

{

    DisasContext *ctx = opaque;

    gen_op_store_403_pb(sprn - SPR_403_PBL1);

    RET_STOP(ctx);

}


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

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

+        *obj = value;
+
+    }
+
+}

void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp)

{

    int64_t value;

    if (v->type_uint64) {

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

    } else {

        value = *obj;

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

        *obj = value;

    }

}


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

     bool iops_flag;

+
+
+    assert(io_limits);
+
+

     bps_flag  = (io_limits->bps[BLOCK_IO_LIMIT_TOTAL] != 0)

static bool do_check_io_limits(BlockIOLimit *io_limits)

{

    bool bps_flag;

    bool iops_flag;

    assert(io_limits);

    bps_flag  = (io_limits->bps[BLOCK_IO_LIMIT_TOTAL] != 0)

                 && ((io_limits->bps[BLOCK_IO_LIMIT_READ] != 0)

                 || (io_limits->bps[BLOCK_IO_LIMIT_WRITE] != 0));

    iops_flag = (io_limits->iops[BLOCK_IO_LIMIT_TOTAL] != 0)

                 && ((io_limits->iops[BLOCK_IO_LIMIT_READ] != 0)

                 || (io_limits->iops[BLOCK_IO_LIMIT_WRITE] != 0));

    if (bps_flag || iops_flag) {

        return false;

    }

    return true;

}


--- a/source.c
+++ b/source.c
@@ -41,11 +41,11 @@
         int count    =get_be32(pb);

         int duration =get_be32(pb);
+
+
+
+        sc->ctts_data[i].count   = count;
+
         sc->ctts_data[i].duration= duration;

     }

static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)

{

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

    MOVStreamContext *sc = st->priv_data;

    unsigned int i, entries;

    get_byte(pb); /* version */

    get_be24(pb); /* flags */

    entries = get_be32(pb);

    dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);

    if(entries >= UINT_MAX / sizeof(*sc->ctts_data))

        return -1;

    sc->ctts_data = av_malloc(entries * sizeof(*sc->ctts_data));

    if (!sc->ctts_data)

        return AVERROR(ENOMEM);

    sc->ctts_count = entries;

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

        int count    =get_be32(pb);

        int duration =get_be32(pb);

        sc->ctts_data[i].count   = count;

        sc->ctts_data[i].duration= duration;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void ivshmem_check_memdev_is_busy(Object *obj, const char *name,

                                          Object *val, Error **errp)

static void ivshmem_check_memdev_is_busy(Object *obj, const char *name,

                                         Object *val, Error **errp)

{

    if (host_memory_backend_is_mapped(MEMORY_BACKEND(val))) {

        char *path = object_get_canonical_path_component(val);

        error_setg(errp, "can't use already busy memdev: %s", path);

        g_free(path);

    } else {

        qdev_prop_allow_set_link_before_realize(obj, name, val, errp);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size_t bufsize)
+
+{
+
+	int offset;
+
+	int channels,freq,size;
+
+
+
+	offset = is_adx(buf,bufsize);
+
 	if (offset==0) return 0;

static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size_t bufsize)

{

	int offset;

	int channels,freq,size;

	offset = is_adx(buf,bufsize);

	if (offset==0) return 0;

	channels = buf[7];

	freq = read_long(buf+8);

	size = read_long(buf+12);

//	printf("freq=%d ch=%d\n",freq,channels);

	avctx->sample_rate = freq;

	avctx->channels = channels;

	avctx->bit_rate = freq*channels*18*8/32;

//	avctx->frame_size = 18*channels;

	return offset;

}


static int advanced_decode_i_mbs(VC9Context *v)

{

  int i, x, y, cbpcy, mqdiff, absmq, mquant, ac_pred, condover,

    current_mb = 0, over_flags_mb = 0;

    for (y=0; y<v->height_mb; y++)

    {

        for (x=0; x<v->width_mb; x++)

        {

            if (v->ac_pred_plane[i])

                ac_pred = get_bits(&v->gb, 1);

            if (condover == 3 && v->over_flags_plane)

                over_flags_mb = get_bits(&v->gb, 1);

            GET_MQUANT();

        }

        current_mb++;

    }

    return 0;

}