--- a/source.c
+++ b/source.c
@@ -5,11 +5,11 @@
     int sg[2], limit, cur_qtzd_reconst;

+
     const int cur_part_reconst = band->s_zero + cur_diff < 0;

+
     sg[0] = sign_lookup[cur_part_reconst != band->part_reconst_mem[0]];

     sg[1] = sign_lookup[cur_part_reconst == band->part_reconst_mem[1]];

static void do_adaptive_prediction(struct G722Band *band, const int cur_diff)

{

    int sg[2], limit, cur_qtzd_reconst;

    const int cur_part_reconst = band->s_zero + cur_diff < 0;

    sg[0] = sign_lookup[cur_part_reconst != band->part_reconst_mem[0]];

    sg[1] = sign_lookup[cur_part_reconst == band->part_reconst_mem[1]];

    band->part_reconst_mem[1] = band->part_reconst_mem[0];

    band->part_reconst_mem[0] = cur_part_reconst;

    band->pole_mem[1] = av_clip((sg[0] * av_clip(band->pole_mem[0], -8191, 8191) >> 5) +

                                (sg[1] << 7) + (band->pole_mem[1] * 127 >> 7), -12288, 12288);

    limit = 15360 - band->pole_mem[1];

    band->pole_mem[0] = av_clip(-192 * sg[0] + (band->pole_mem[0] * 255 >> 8), -limit, limit);

    s_zero(cur_diff, band);

    cur_qtzd_reconst = av_clip_int16((band->s_predictor + cur_diff) << 1);

    band->s_predictor = av_clip_int16(band->s_zero +

                                      (band->pole_mem[0] * cur_qtzd_reconst >> 15) +

                                      (band->pole_mem[1] * band->prev_qtzd_reconst >> 15));

    band->prev_qtzd_reconst = cur_qtzd_reconst;

}


--- a/source.c
+++ b/source.c
@@ -5,5 +5,5 @@
     LIST_REMOVE (e, entries);

     qemu_free (e);
+
+}

void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)

{

    LIST_REMOVE (e, entries);

    qemu_free (e);

}


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

         size -= ret;

+    }
+
+
+
+    g_free(buffer);

     return dropped;

static ssize_t drop_sync(int fd, size_t size)

{

    ssize_t ret, dropped = size;

    uint8_t *buffer = g_malloc(MIN(65536, size));

    while (size > 0) {

        ret = read_sync(fd, buffer, MIN(65536, size));

        if (ret < 0) {

            g_free(buffer);

            return ret;

        }

        assert(ret <= size);

        size -= ret;

    }

    g_free(buffer);

    return dropped;

}


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

 {

+#if defined(CONFIG_USER_ONLY)
+
+    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
+
+#else

     TCGv t0;

static void gen_tlbsx_booke206(DisasContext *ctx)

{

#if defined(CONFIG_USER_ONLY)

    gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

#else

    TCGv t0;

    if (unlikely(!ctx->mem_idx)) {

        gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);

        return;

    }

    if (rA(ctx->opcode)) {

        t0 = tcg_temp_new();

        tcg_gen_mov_tl(t0, cpu_gpr[rD(ctx->opcode)]);

    } else {

        t0 = tcg_const_tl(0);

    }

    tcg_gen_add_tl(t0, t0, cpu_gpr[rB(ctx->opcode)]);

    gen_helper_booke206_tlbsx(cpu_env, t0);

#endif

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 iscsi_unmap_cb(struct iscsi_context *iscsi, int status,

                      void *command_data, void *opaque)
+
+{
+
     IscsiAIOCB *acb = opaque;

@@ -12,8 +12,8 @@

         qemu_aio_release(acb);

+        scsi_free_scsi_task(acb->task);
+
         acb->task = NULL;

         return;

iscsi_unmap_cb(struct iscsi_context *iscsi, int status,

                     void *command_data, void *opaque)

{

    IscsiAIOCB *acb = opaque;

    if (acb->canceled != 0) {

        qemu_aio_release(acb);

        scsi_free_scsi_task(acb->task);

        acb->task = NULL;

        return;

    }

    acb->status = 0;

    if (status < 0) {

        error_report("Failed to unmap data on iSCSI lun. %s",

                     iscsi_get_error(iscsi));

        acb->status = -EIO;

    }

    iscsi_schedule_bh(acb);

    scsi_free_scsi_task(acb->task);

    acb->task = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int protocol_version(VncState *vs, char *version, size_t len)
+
+{
+
+    char local[13];
+
     int maj, min;

static int protocol_version(VncState *vs, char *version, size_t len)

{

    char local[13];

    int maj, min;

    memcpy(local, version, 12);

    local[12] = 0;

    if (sscanf(local, "RFB %03d.%03d\n", &maj, &min) != 2) {

	vnc_client_error(vs);

	return 0;

    }

    vnc_write_u32(vs, 1); /* None */

    vnc_flush(vs);

    vnc_read_when(vs, protocol_client_init, 1);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static int monitor_fprintf(FILE *stream, const char *fmt, ...)

 {
+
+    va_list ap;
+
     va_start(ap, fmt);

     monitor_vprintf((Monitor *)stream, fmt, ap);

static int monitor_fprintf(FILE *stream, const char *fmt, ...)

{

    va_list ap;

    va_start(ap, fmt);

    monitor_vprintf((Monitor *)stream, fmt, ap);

    va_end(ap);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -7,11 +7,11 @@
                 CharDriverState *chr)

 {
+
+    struct omap_sti_s *s = (struct omap_sti_s *)
+
+            g_malloc0(sizeof(struct omap_sti_s));
+

     s->irq = irq;

static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta,

                MemoryRegion *sysmem,

                target_phys_addr_t channel_base, qemu_irq irq, omap_clk clk,

                CharDriverState *chr)

{

    struct omap_sti_s *s = (struct omap_sti_s *)

            g_malloc0(sizeof(struct omap_sti_s));

    s->irq = irq;

    omap_sti_reset(s);

    s->chr = chr ?: qemu_chr_new("null", "null", NULL);

    memory_region_init_io(&s->iomem, &omap_sti_ops, s, "omap.sti",

                          omap_l4_region_size(ta, 0));

    omap_l4_attach(ta, 0, &s->iomem);

    memory_region_init_io(&s->iomem_fifo, &omap_sti_fifo_ops, s,

                          "omap.sti.fifo", 0x10000);

    memory_region_add_subregion(sysmem, channel_base, &s->iomem_fifo);

    return s;

}


static int decode_cabac_mb_ref( H264Context *h, int list, int n ) {

    int refa = h->ref_cache[list][scan8[n] - 1];

    int refb = h->ref_cache[list][scan8[n] - 8];

    int ref  = 0;

    int ctx  = 0;

    if( h->slice_type_nos == FF_B_TYPE) {

        if( refa > 0 && !h->direct_cache[scan8[n] - 1] )

            ctx++;

        if( refb > 0 && !h->direct_cache[scan8[n] - 8] )

            ctx += 2;

    } else {

        if( refa > 0 )

            ctx++;

        if( refb > 0 )

            ctx += 2;

    }

    while( get_cabac( &h->cabac, &h->cabac_state[54+ctx] ) ) {

        ref++;

        if( ctx < 4 )

            ctx = 4;

        else

            ctx = 5;

        if(ref >= 32 /*h->ref_list[list]*/){

            av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_ref\n");

            return 0; //FIXME we should return -1 and check the return everywhere

        }

    }

    return ref;

}


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

     avc_luma_hz_4w_msa(src - 2, stride, dst, stride, 4);
+
+}

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

                                ptrdiff_t stride)

{

    avc_luma_hz_4w_msa(src - 2, stride, dst, stride, 4);

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
 START_TEST(qlist_destroy_test)

+{
+
+    int i;
+
+    QList *qlist;

START_TEST(qlist_destroy_test)

{

    int i;

    QList *qlist;

    qlist = qlist_new();

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

        qlist_append(qlist, qint_from_int(i));

    QDECREF(qlist);

}


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

 {

+    NetSocketState *s = opaque;
+
+    uint32_t len;
+
     len = htonl(size);

static void net_socket_receive(void *opaque, const uint8_t *buf, size_t size)

{

    NetSocketState *s = opaque;

    uint32_t len;

    len = htonl(size);

    send_all(s->fd, (const uint8_t *)&len, sizeof(len));

    send_all(s->fd, buf, size);

}


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

     setup_sigcontext(&uc->tuc_mcontext, env, set->sig[0]);

+    /* FIXME: Save coprocessor signal frame.  */
+
+    for(i = 0; i < TARGET_NSIG_WORDS; i++) {
+
+        __put_user(set->sig[i], &uc->tuc_sigmask.sig[i]);

     }

static void setup_sigframe_v2(struct target_ucontext_v2 *uc,

                              target_sigset_t *set, CPUState *env)

{

    struct target_sigaltstack stack;

    int i;

    /* Clear all the bits of the ucontext we don't use.  */

    memset(uc, 0, offsetof(struct target_ucontext_v2, tuc_mcontext));

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

    __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp);

    __put_user(target_sigaltstack_used.ss_size, &stack.ss_size);

    __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags);

    memcpy(&uc->tuc_stack, &stack, sizeof(stack));

    setup_sigcontext(&uc->tuc_mcontext, env, set->sig[0]);

    /* FIXME: Save coprocessor signal frame.  */

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

        __put_user(set->sig[i], &uc->tuc_sigmask.sig[i]);

    }

}


--- a/source.c
+++ b/source.c
@@ -7,16 +7,16 @@
     uint8_t *line;

     for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){
+
         J2kTile *tile = s->tile + tileno;

         if (s->planar){

+            for (compno = 0; compno < s->ncomponents; compno++){

                 J2kComponent *comp = tile->comp + compno;

+                int *dst = comp->data;

                 line = s->picture->data[compno]

@@ -25,7 +25,7 @@
                        + comp->coord[0][0];

                 for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){
+
                     uint8_t *ptr = line;

                     for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++)

static void copy_frame(J2kEncoderContext *s)

{

    int tileno, compno, i, y, x;

    uint8_t *line;

    for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){

        J2kTile *tile = s->tile + tileno;

        if (s->planar){

            for (compno = 0; compno < s->ncomponents; compno++){

                J2kComponent *comp = tile->comp + compno;

                int *dst = comp->data;

                line = s->picture->data[compno]

                       + comp->coord[1][0] * s->picture->linesize[compno]

                       + comp->coord[0][0];

                for (y = comp->coord[1][0]; y < comp->coord[1][1]; y++){

                    uint8_t *ptr = line;

                    for (x = comp->coord[0][0]; x < comp->coord[0][1]; x++)

                        *dst++ = *ptr++ - (1 << 7);

                    line += s->picture->linesize[compno];

                }

            }

        } else{

            line = s->picture->data[0] + tile->comp[0].coord[1][0] * s->picture->linesize[0]

                   + tile->comp[0].coord[0][0] * s->ncomponents;

            i = 0;

            for (y = tile->comp[0].coord[1][0]; y < tile->comp[0].coord[1][1]; y++){

                uint8_t *ptr = line;

                for (x = tile->comp[0].coord[0][0]; x < tile->comp[0].coord[0][1]; x++, i++){

                    for (compno = 0; compno < s->ncomponents; compno++){

                        tile->comp[compno].data[i] = *ptr++  - (1 << 7);

                    }

                }

                line += s->picture->linesize[0];

            }

        }

    }

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
+static int net_vhost_chardev_opts(void *opaque,
+
+                                  const char *name, const char *value,
+
+                                  Error **errp)
+
+{

+    VhostUserChardevProps *props = opaque;
+

+
     if (strcmp(name, "backend") == 0 && strcmp(value, "socket") == 0) {

         props->is_socket = true;

static int net_vhost_chardev_opts(void *opaque,

                                  const char *name, const char *value,

                                  Error **errp)

{

    VhostUserChardevProps *props = opaque;

    if (strcmp(name, "backend") == 0 && strcmp(value, "socket") == 0) {

        props->is_socket = true;

    } else if (strcmp(name, "path") == 0) {

        props->is_unix = true;

    } else if (strcmp(name, "server") == 0) {

    } else {

        error_setg(errp,

                   "vhost-user does not support a chardev with option %s=%s",

                   name, value);

        return -1;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 int AUD_read (SWVoiceIn *sw, void *buf, int size)

 {
+
+    int bytes;
+
+
+
     if (!sw) {

         /* XXX: Consider options */

int AUD_read (SWVoiceIn *sw, void *buf, int size)

{

    int bytes;

    if (!sw) {

        /* XXX: Consider options */

        return size;

    }

    if (!sw->hw->enabled) {

        dolog ("Reading from disabled voice %s\n", SW_NAME (sw));

        return 0;

    }

    bytes = sw->hw->pcm_ops->read (sw, buf, size);

    return bytes;

}


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

 		tcg_gen_ext16s_i32(d, s);

+	else if(GET_TCGV(d) != GET_TCGV(s))
+
+		tcg_gen_mov_tl(d, s);
+
 }

static inline void t_gen_sext(TCGv d, TCGv s, int size)

{

	if (size == 1)

		tcg_gen_ext8s_i32(d, s);

	else if (size == 2)

		tcg_gen_ext16s_i32(d, s);

	else if(GET_TCGV(d) != GET_TCGV(s))

		tcg_gen_mov_tl(d, s);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)

+{

     VirtIOGPU *g = opaque;

static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)

{

    VirtIOGPU *g = opaque;

    if (idx > g->conf.max_outputs) {

        return -1;

    }

    g->req_state[idx].x = info->xoff;

    g->req_state[idx].y = info->yoff;

    g->req_state[idx].width = info->width;

    g->req_state[idx].height = info->height;

    if (info->width && info->height) {

        g->enabled_output_bitmask |= (1 << idx);

    } else {

        g->enabled_output_bitmask &= ~(1 << idx);

    }

    /* send event to guest */

    virtio_gpu_notify_event(g, VIRTIO_GPU_EVENT_DISPLAY);

    return 0;

}


void kvm_s390_crw_mchk(S390CPU *cpu)

{

    kvm_s390_interrupt_internal(cpu, KVM_S390_MCHK, 1 << 28,

                                0x00400f1d40330000, 1);

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
         return omap_badwidth_write32(opaque, addr, value);

     }
+
+
+
+    switch (addr) {
+
     case 0x00:	/* IMIF_PRIO */

     case 0x04:	/* EMIFS_PRIO */

static void omap_tcmi_write(void *opaque, target_phys_addr_t addr,

                            uint64_t value, unsigned size)

{

    struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;

    if (size != 4) {

        return omap_badwidth_write32(opaque, addr, value);

    }

    switch (addr) {

    case 0x00:	/* IMIF_PRIO */

    case 0x04:	/* EMIFS_PRIO */

    case 0x08:	/* EMIFF_PRIO */

    case 0x10:	/* EMIFS_CS0_CONFIG */

    case 0x14:	/* EMIFS_CS1_CONFIG */

    case 0x18:	/* EMIFS_CS2_CONFIG */

    case 0x1c:	/* EMIFS_CS3_CONFIG */

    case 0x20:	/* EMIFF_SDRAM_CONFIG */

    case 0x24:	/* EMIFF_MRS */

    case 0x28:	/* TIMEOUT1 */

    case 0x2c:	/* TIMEOUT2 */

    case 0x30:	/* TIMEOUT3 */

    case 0x3c:	/* EMIFF_SDRAM_CONFIG_2 */

    case 0x40:	/* EMIFS_CFG_DYN_WAIT */

        s->tcmi_regs[addr >> 2] = value;

        break;

    case 0x0c:	/* EMIFS_CONFIG */

        s->tcmi_regs[addr >> 2] = (value & 0xf) | (1 << 4);

        break;

    default:

        OMAP_BAD_REG(addr);

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void vmgenid_set_guid_auto_test(void)
+
 {
+
     const char *cmd;

     QemuUUID measured;

static void vmgenid_set_guid_auto_test(void)

{

    const char *cmd;

    QemuUUID measured;

    cmd = "-machine accel=tcg -device vmgenid,id=testvgid," "guid=auto";

    qtest_start(cmd);

    read_guid_from_memory(&measured);

    /* Just check that the GUID is non-null */

    g_assert(!qemu_uuid_is_null(&measured));

    qtest_quit(global_qtest);

}


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

                 && flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {

+            cpu_watchpoint_remove_by_ref(env, wp);
+
+            return 0;
+
+        }

     }

int cpu_watchpoint_remove(CPUState *env, target_ulong addr, target_ulong len,

                          int flags)

{

    target_ulong len_mask = ~(len - 1);

    CPUWatchpoint *wp;

    TAILQ_FOREACH(wp, &env->watchpoints, entry) {

        if (addr == wp->vaddr && len_mask == wp->len_mask

                && flags == (wp->flags & ~BP_WATCHPOINT_HIT)) {

            cpu_watchpoint_remove_by_ref(env, wp);

            return 0;

        }

    }

    return -ENOENT;

}


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

     qemu_del_timer(d->autoneg_timer);

+    memset(d->phy_reg, 0, sizeof d->phy_reg);
+
+    memmove(d->phy_reg, phy_reg_init, sizeof phy_reg_init);
+
+    memset(d->mac_reg, 0, sizeof d->mac_reg);

     memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init);

static void e1000_reset(void *opaque)

{

    E1000State *d = opaque;

    qemu_del_timer(d->autoneg_timer);

    memset(d->phy_reg, 0, sizeof d->phy_reg);

    memmove(d->phy_reg, phy_reg_init, sizeof phy_reg_init);

    memset(d->mac_reg, 0, sizeof d->mac_reg);

    memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init);

    d->rxbuf_min_shift = 1;

    memset(&d->tx, 0, sizeof d->tx);

    if (d->nic->nc.link_down) {

        e1000_link_down(d);

    }

    /* Some guests expect pre-initialized RAH/RAL (AddrValid flag + MACaddr) */

    d->mac_reg[RA] = 0;

    d->mac_reg[RA + 1] = E1000_RAH_AV;

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

        d->mac_reg[RA] |= macaddr[i] << (8 * i);

        d->mac_reg[RA + 1] |= (i < 2) ? macaddr[i + 4] << (8 * i) : 0;

    }

}


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

         unsigned size)

+{

     UartState *s = (UartState *)opaque;

static uint64_t uart_read(void *opaque, target_phys_addr_t offset,

        unsigned size)

{

    UartState *s = (UartState *)opaque;

    uint32_t c = 0;

    offset >>= 2;

    if (offset > R_MAX) {

        return 0;

    } else if (offset == R_TX_RX) {

        uart_read_rx_fifo(s, &c);

        return c;

    }

    return s->r[offset];

}


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

   m_free(so->so_m);
+
+
+
+  if(so->so_next && so->so_prev)
+
     remque(so);  /* crashes if so is not in a queue */

sofree(struct socket *so)

{

  Slirp *slirp = so->slirp;

  struct mbuf *ifm;

  for (ifm = (struct mbuf *) slirp->if_fastq.qh_link;

       (struct quehead *) ifm != &slirp->if_fastq;

       ifm = ifm->ifq_next) {

    if (ifm->ifq_so == so) {

      ifm->ifq_so = NULL;

  for (ifm = (struct mbuf *) slirp->if_batchq.qh_link;

       (struct quehead *) ifm != &slirp->if_batchq;

       ifm = ifm->ifq_next) {

    if (ifm->ifq_so == so) {

      ifm->ifq_so = NULL;

  if (so->so_emu==EMU_RSH && so->extra) {

	sofree(so->extra);

	so->extra=NULL;

  if (so == slirp->tcp_last_so) {

      slirp->tcp_last_so = &slirp->tcb;

  } else if (so == slirp->udp_last_so) {

      slirp->udp_last_so = &slirp->udb;

  } else if (so == slirp->icmp_last_so) {

      slirp->icmp_last_so = &slirp->icmp;

  m_free(so->so_m);

  if(so->so_next && so->so_prev)

    remque(so);  /* crashes if so is not in a queue */

  free(so);


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

     }
+
+
+
+    ret = qemu_config_parse(f, config_groups, filename);
+
     if (ret < 0) {

         error_setg(errp, "Could not parse blkdebug config file");

static int read_config(BDRVBlkdebugState *s, const char *filename, Error **errp)

{

    FILE *f;

    int ret;

    struct add_rule_data d;

    f = fopen(filename, "r");

    if (f == NULL) {

        error_setg_errno(errp, errno, "Could not read blkdebug config file");

        return -errno;

    }

    ret = qemu_config_parse(f, config_groups, filename);

    if (ret < 0) {

        error_setg(errp, "Could not parse blkdebug config file");

        ret = -EINVAL;

        goto fail;

    }

    d.s = s;

    d.action = ACTION_INJECT_ERROR;

    qemu_opts_foreach(&inject_error_opts, add_rule, &d, 0);

    d.action = ACTION_SET_STATE;

    qemu_opts_foreach(&set_state_opts, add_rule, &d, 0);

    ret = 0;

fail:

    qemu_opts_reset(&inject_error_opts);

    qemu_opts_reset(&set_state_opts);

    fclose(f);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -5,10 +5,10 @@
     TestData d;

     uint16_t val;
+

+    d.args = NULL;

     d.noreboot = true;

static void test_tco1_control_bits(void)

{

    TestData d;

    uint16_t val;

    d.args = NULL;

    d.noreboot = true;

    test_init(&d);

    val = TCO_LOCK;

    qpci_io_writew(d.dev, d.tco_io_base + TCO1_CNT, val);

    val &= ~TCO_LOCK;

    qpci_io_writew(d.dev, d.tco_io_base + TCO1_CNT, val);

    g_assert_cmpint(qpci_io_readw(d.dev, d.tco_io_base + TCO1_CNT), ==,

                    TCO_LOCK);

    qtest_end();

}


--- a/source.c
+++ b/source.c
@@ -1,13 +1,13 @@
 int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size)

+{

     int ret = -ENOSYS;

 #ifdef KVM_CAP_COALESCED_MMIO

     KVMState *s = kvm_state;
+

     if (s->coalesced_mmio) {

int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size)

{

    int ret = -ENOSYS;

#ifdef KVM_CAP_COALESCED_MMIO

    KVMState *s = kvm_state;

    if (s->coalesced_mmio) {

        struct kvm_coalesced_mmio_zone zone;

        zone.addr = start;

        zone.size = size;

        ret = kvm_vm_ioctl(s, KVM_REGISTER_COALESCED_MMIO, &zone);

    }

#endif

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -15,11 +15,11 @@
      * for(i=0 ; i<bitamount/64 ; i++)

      *     (int64_t)out[i] = 0x37c511f237c511f2^av_be2ne64(int64_t)in[i]);
+
+     * Buffer alignment needs to be checked. */
+
+
+
     off = (intptr_t)inbuffer & 3;

     buf = (const uint32_t*) (inbuffer - off);

static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){

    int i, off;

    uint32_t c;

    const uint32_t* buf;

    uint32_t* obuf = (uint32_t*) out;

    /* FIXME: 64 bit platforms would be able to do 64 bits at a time.

     * I'm too lazy though, should be something like

     * for(i=0 ; i<bitamount/64 ; i++)

     *     (int64_t)out[i] = 0x37c511f237c511f2^av_be2ne64(int64_t)in[i]);

     * Buffer alignment needs to be checked. */

    off = (intptr_t)inbuffer & 3;

    buf = (const uint32_t*) (inbuffer - off);

    c = av_be2ne32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8))));

    bytes += 3 + off;

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

        obuf[i] = c ^ buf[i];

    return off;

}


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

     if (!bs) {

+        return;

     }

+
     target = bdrv_lookup_bs(backup->target, backup->target, errp);

     if (!target) {

static void blockdev_backup_prepare(BlkActionState *common, Error **errp)

{

    BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common);

    BlockdevBackup *backup;

    BlockDriverState *bs, *target;

    Error *local_err = NULL;

    assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);

    backup = common->action->u.blockdev_backup.data;

    bs = qmp_get_root_bs(backup->device, errp);

    if (!bs) {

        return;

    }

    target = bdrv_lookup_bs(backup->target, backup->target, errp);

    if (!target) {

        return;

    }

    /* AioContext is released in .clean() */

    state->aio_context = bdrv_get_aio_context(bs);

    if (state->aio_context != bdrv_get_aio_context(target)) {

        state->aio_context = NULL;

        error_setg(errp, "Backup between two IO threads is not implemented");

        return;

    }

    aio_context_acquire(state->aio_context);

    state->bs = bs;

    bdrv_drained_begin(state->bs);

    do_blockdev_backup(backup, common->block_job_txn, &local_err);

    if (local_err) {

        error_propagate(errp, local_err);

        return;

    }

    state->job = state->bs->job;

}


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

                          NULL);
+
+    nbd_recv_coroutines_enter_all(bs);
+
+
+
     nbd_client_detach_aio_context(bs);

     object_unref(OBJECT(client->sioc));

static void nbd_teardown_connection(BlockDriverState *bs)

{

    NBDClientSession *client = nbd_get_client_session(bs);

    if (!client->ioc) { /* Already closed */

        return;

    }

    /* finish any pending coroutines */

    qio_channel_shutdown(client->ioc,

                         QIO_CHANNEL_SHUTDOWN_BOTH,

                         NULL);

    nbd_recv_coroutines_enter_all(bs);

    nbd_client_detach_aio_context(bs);

    object_unref(OBJECT(client->sioc));

    client->sioc = NULL;

    object_unref(OBJECT(client->ioc));

    client->ioc = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void __attribute__((destructor)) coroutine_cleanup(void)

+{
+
+    Coroutine *co;
+
     Coroutine *tmp;

static void __attribute__((destructor)) coroutine_cleanup(void)

{

    Coroutine *co;

    Coroutine *tmp;

    QSLIST_FOREACH_SAFE(co, &pool, pool_next, tmp) {

        QSLIST_REMOVE_HEAD(&pool, pool_next);

        qemu_coroutine_delete(co);

    }

}


static void win_chr_readfile(CharDriverState *chr)

{

    WinCharState *s = chr->opaque;

    int ret, err;

    uint8_t buf[1024];

    DWORD size;

    ZeroMemory(&s->orecv, sizeof(s->orecv));

    s->orecv.hEvent = s->hrecv;

    ret = ReadFile(s->hcom, buf, s->len, &size, &s->orecv);

    if (!ret) {

        err = GetLastError();

        if (err == ERROR_IO_PENDING) {

            ret = GetOverlappedResult(s->hcom, &s->orecv, &size, TRUE);

        }

    }

    if (size > 0) {

        qemu_chr_read(chr, buf, size);

    }

}


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

     s->datapos = s->buffer;

+    s->datalen = len;
+
+    spice_server_char_device_wakeup(&s->sin);
+
+    return len;

 }

static int spice_chr_write(CharDriverState *chr, const uint8_t *buf, int len)

{

    SpiceCharDriver *s = chr->opaque;

    vmc_register_interface(s);

    assert(s->datalen == 0);

    if (s->bufsize < len) {

        s->bufsize = len;

        s->buffer = g_realloc(s->buffer, s->bufsize);

    }

    memcpy(s->buffer, buf, len);

    s->datapos = s->buffer;

    s->datalen = len;

    spice_server_char_device_wakeup(&s->sin);

    return len;

}


PPC_OP(subfc)

{

    T0 = T1 - T0;

    if (T0 <= T1) {

        xer_ca = 1;

    } else {

        xer_ca = 0;

    }

    RETURN();

}


static void h261_encode_motion(H261Context * h, int val){

    MpegEncContext * const s = &h->s;

    int sign, code;

    if(val==0){

        code = 0;

        put_bits(&s->pb,h261_mv_tab[code][1],h261_mv_tab[code][0]);

    }

    else{

        if(val > 16)

            val -=32;

        if(val < -16)

            val+=32;

        sign = val < 0;

        code = sign ? -val : val;

        put_bits(&s->pb,h261_mv_tab[code][1],h261_mv_tab[code][0]);

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

    }

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static int vhost_user_reset_device(struct vhost_dev *dev)

 {
+
     VhostUserMsg msg = {

         .request = VHOST_USER_RESET_OWNER,

static int vhost_user_reset_device(struct vhost_dev *dev)

{

    VhostUserMsg msg = {

        .request = VHOST_USER_RESET_OWNER,

        .flags = VHOST_USER_VERSION,

    };

    vhost_user_write(dev, &msg, NULL, 0);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -21,11 +21,11 @@
         url_fseek(bc, nut->packet_size_pos, SEEK_SET);

         for(i=get_length(size); i < get_length(nut->written_packet_size); i+=7)
+
+            put_byte(bc, 0x80);
+
+        put_v(bc, size);
+

         url_fseek(bc, cur, SEEK_SET);

static int update_packetheader(NUTContext *nut, ByteIOContext *bc, int additional_size){

    int64_t start= nut->packet_start;

    int64_t cur= url_ftell(bc);

    int size= cur - start + additional_size;

    if(size != nut->written_packet_size){

        int i;

        assert( size <= nut->written_packet_size );

        url_fseek(bc, nut->packet_size_pos, SEEK_SET);

        for(i=get_length(size); i < get_length(nut->written_packet_size); i+=7)

            put_byte(bc, 0x80);

        put_v(bc, size);

        url_fseek(bc, cur, SEEK_SET);

        nut->written_packet_size= size; //FIXME may fail if multiple updates with differing sizes, as get_length may differ

    }

    return 0;

}


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

 {

+    int buckets[RADIX_PASSES][NBUCKETS];
+
+    RCCMPEntry *tmp = av_malloc_array(size, sizeof(*tmp));
+
+    radix_count(data, size, buckets);

     radix_sort_pass(tmp, data, size, buckets[0], 0);

static void radix_sort(RCCMPEntry *data, int size)

{

    int buckets[RADIX_PASSES][NBUCKETS];

    RCCMPEntry *tmp = av_malloc_array(size, sizeof(*tmp));

    radix_count(data, size, buckets);

    radix_sort_pass(tmp, data, size, buckets[0], 0);

    radix_sort_pass(data, tmp, size, buckets[1], 1);

    if (buckets[2][NBUCKETS - 1] || buckets[3][NBUCKETS - 1]) {

        radix_sort_pass(tmp, data, size, buckets[2], 2);

        radix_sort_pass(data, tmp, size, buckets[3], 3);

    }

    av_free(tmp);

}


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

+    etsec->rx_first_in_frame = 1;
+
+    etsec->rx_remaining_data = etsec->rx_buffer_len;
+
+    RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__,

                etsec->rx_buffer_len, etsec->rx_padding);

static void rx_init_frame(eTSEC *etsec, const uint8_t *buf, size_t size)

{

    uint32_t fcb_size = 0;

    uint8_t  prsdep   = (etsec->regs[RCTRL].value >> RCTRL_PRSDEP_OFFSET)

        & RCTRL_PRSDEP_MASK;

    if (prsdep != 0) {

        /* Prepend FCB (FCB size + RCTRL[PAL]) */

        fcb_size = 8 + ((etsec->regs[RCTRL].value >> 16) & 0x1F);

        etsec->rx_fcb_size = fcb_size;

        /* TODO: fill_FCB(etsec); */

        memset(etsec->rx_fcb, 0x0, sizeof(etsec->rx_fcb));

    } else {

        etsec->rx_fcb_size = 0;

    }

    if (etsec->rx_buffer != NULL) {

        g_free(etsec->rx_buffer);

    }

    /* Do not copy the frame for now */

    etsec->rx_buffer     = (uint8_t *)buf;

    etsec->rx_buffer_len = size;

    /* CRC padding (We don't have to compute the CRC) */

    etsec->rx_padding = 4;

    etsec->rx_first_in_frame = 1;

    etsec->rx_remaining_data = etsec->rx_buffer_len;

    RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__,

               etsec->rx_buffer_len, etsec->rx_padding);

}


static inline int gen_iwmmxt_address(DisasContext *s, uint32_t insn, TCGv dest)

{

    int rd;

    uint32_t offset;

    TCGv tmp;

    rd = (insn >> 16) & 0xf;

    tmp = load_reg(s, rd);

    offset = (insn & 0xff) << ((insn >> 7) & 2);

    if (insn & (1 << 24)) {

        /* Pre indexed */

        if (insn & (1 << 23))

            tcg_gen_addi_i32(tmp, tmp, offset);

        else

            tcg_gen_addi_i32(tmp, tmp, -offset);

        tcg_gen_mov_i32(dest, tmp);

        if (insn & (1 << 21))

            store_reg(s, rd, tmp);

        else

            dead_tmp(tmp);

    } else if (insn & (1 << 21)) {

        /* Post indexed */

        tcg_gen_mov_i32(dest, tmp);

        if (insn & (1 << 23))

            tcg_gen_addi_i32(tmp, tmp, offset);

        else

            tcg_gen_addi_i32(tmp, tmp, -offset);

        store_reg(s, rd, tmp);

    } else if (!(insn & (1 << 23)))

        return 1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -13,11 +13,11 @@
     /* let's disallow possible ambiguous cases */

     if (size > (MAX_MALLOC_SIZE-16))
+
+        return NULL;
+
+
+
 #if CONFIG_MEMALIGN_HACK

     //FIXME this isn't aligned correctly, though it probably isn't needed

void *av_realloc(void *ptr, size_t size)

{

#if CONFIG_MEMALIGN_HACK

    int diff;

#endif

    /* let's disallow possible ambiguous cases */

    if (size > (MAX_MALLOC_SIZE-16))

        return NULL;

#if CONFIG_MEMALIGN_HACK

    //FIXME this isn't aligned correctly, though it probably isn't needed

    if(!ptr) return av_malloc(size);

    diff= ((char*)ptr)[-1];

    return (char*)realloc((char*)ptr - diff, size + diff) + diff;

#else

    return realloc(ptr, size + !size);

#endif

}


--- a/source.c
+++ b/source.c
@@ -3,11 +3,11 @@
                          uint64_t data, unsigned size)

 {
+
+    NE2000State *s = opaque;
+
+
+
     if (addr < 0x10 && size == 1) {

         ne2000_ioport_write(s, addr, data);

static void ne2000_write(void *opaque, target_phys_addr_t addr,

                         uint64_t data, unsigned size)

{

    NE2000State *s = opaque;

    if (addr < 0x10 && size == 1) {

        ne2000_ioport_write(s, addr, data);

    } else if (addr == 0x10) {

        if (size <= 2) {

            ne2000_asic_ioport_write(s, addr, data);

        } else {

            ne2000_asic_ioport_writel(s, addr, data);

        }

    } else if (addr == 0x1f && size == 1) {

        ne2000_reset_ioport_write(s, addr, data);

    }

}


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

     VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(sreq->bus->qbus.parent);

+    vscsi_req *req = sreq->hba_private;
+
+    uint8_t *buf;
+
+    int rc = 0;

static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)

{

    VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(sreq->bus->qbus.parent);

    vscsi_req *req = sreq->hba_private;

    uint8_t *buf;

    int rc = 0;

    DPRINTF("VSCSI: SCSI xfer complete tag=0x%x len=0x%x, req=%p\n",

            sreq->tag, len, req);

    if (req == NULL) {

        fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", sreq->tag);

        return;

    }

    if (len) {

        buf = scsi_req_get_buf(sreq);

        rc = vscsi_srp_transfer_data(s, req, req->writing, buf, len);

    }

    if (rc < 0) {

        fprintf(stderr, "VSCSI: RDMA error rc=%d!\n", rc);

        vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);

        scsi_req_abort(req->sreq, CHECK_CONDITION);

        return;

    }

    /* Start next chunk */

    req->data_len -= rc;

    scsi_req_continue(sreq);

}


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

     sclp_service_interrupt(0);

static void trigger_console_data(void *opaque, int n, int level)

{

    sclp_service_interrupt(0);

}


--- a/source.c
+++ b/source.c
@@ -1,9 +1,9 @@
 static void s390_virtio_blk_class_init(ObjectClass *klass, void *data)

+{
+
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
     VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);

    k->init = s390_virtio_blk_init;

    dc->props = s390_virtio_blk_properties;

    dc->alias = "virtio-blk";

}


--- 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
@@ -5,9 +5,9 @@
     const char *str = "";

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

     int err;

static void test_qemu_strtol_empty(void)

{

    const char *str = "";

    char f = 'X';

    const char *endptr = &f;

    long res = 999;

    int err;

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

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 0);

    g_assert(endptr == str);

}


--- 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;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,

                          int is_write, hwaddr access_len)
+
 {

     if (buffer != bounce.buffer) {

void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,

                         int is_write, hwaddr access_len)

{

    if (buffer != bounce.buffer) {

        if (is_write) {

            ram_addr_t addr1 = qemu_ram_addr_from_host_nofail(buffer);

            while (access_len) {

                unsigned l;

                l = TARGET_PAGE_SIZE;

                if (l > access_len)

                    l = access_len;

                invalidate_and_set_dirty(addr1, l);

                addr1 += l;

                access_len -= l;

            }

        }

        if (xen_enabled()) {

            xen_invalidate_map_cache_entry(buffer);

        }

        return;

    }

    if (is_write) {

        address_space_write(as, bounce.addr, bounce.buffer, access_len);

    }

    qemu_vfree(bounce.buffer);

    bounce.buffer = NULL;

    cpu_notify_map_clients();

}


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

     {

+	uint32_t a = (*current)->address;

 	if ((a & ~0x1F) == (address & ~0x1F))

void helper_ocbi(CPUSH4State *env, uint32_t address)

{

    memory_content **current = &(env->movcal_backup);

    while (*current)

    {

	uint32_t a = (*current)->address;

	if ((a & ~0x1F) == (address & ~0x1F))

	{

	    memory_content *next = (*current)->next;

            cpu_stl_data(env, a, (*current)->value);

	    if (next == NULL)

	    {

		env->movcal_backup_tail = current;

	    }

	    free (*current);

	    *current = next;

	    break;

	}

    }

}


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

     rsp = qmp_dispatch(QOBJECT(req));

+    if (rsp) {
+
+        ret = send_response(s, rsp);
+
+        if (ret) {

             g_warning("error sending response: %s", strerror(ret));

static void process_command(GAState *s, QDict *req)

{

    QObject *rsp = NULL;

    int ret;

    g_assert(req);

    g_debug("processing command");

    rsp = qmp_dispatch(QOBJECT(req));

    if (rsp) {

        ret = send_response(s, rsp);

        if (ret) {

            g_warning("error sending response: %s", strerror(ret));

        }

        qobject_decref(rsp);

    } else {

        g_warning("error getting response");

    }

}


--- a/source.c
+++ b/source.c
@@ -61,11 +61,11 @@
         } else {

             /* too big difference : may be initial PTS errors, so
+
+               reset A-V filter */
+
+            is->audio_diff_avg_count = 0;
+
             is->audio_diff_cum       = 0;

         }

static int synchronize_audio(VideoState *is, int nb_samples)

{

    int wanted_nb_samples = nb_samples;

    /* if not master, then we try to remove or add samples to correct the clock */

    if (get_master_sync_type(is) != AV_SYNC_AUDIO_MASTER) {

        double diff, avg_diff;

        int min_nb_samples, max_nb_samples;

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

        if (fabs(diff) < AV_NOSYNC_THRESHOLD) {

            is->audio_diff_cum = diff + is->audio_diff_avg_coef * is->audio_diff_cum;

            if (is->audio_diff_avg_count < AUDIO_DIFF_AVG_NB) {

                /* not enough measures to have a correct estimate */

                is->audio_diff_avg_count++;

            } else {

                /* estimate the A-V difference */

                avg_diff = is->audio_diff_cum * (1.0 - is->audio_diff_avg_coef);

                if (fabs(avg_diff) >= is->audio_diff_threshold) {

                    wanted_nb_samples = nb_samples + (int)(diff * is->audio_src.freq);

                    min_nb_samples = ((nb_samples * (100 - SAMPLE_CORRECTION_PERCENT_MAX) / 100));

                    max_nb_samples = ((nb_samples * (100 + SAMPLE_CORRECTION_PERCENT_MAX) / 100));

                    wanted_nb_samples = FFMIN(FFMAX(wanted_nb_samples, min_nb_samples), max_nb_samples);

                }

                av_dlog(NULL, "diff=%f adiff=%f sample_diff=%d apts=%0.3f %f\n",

                        diff, avg_diff, wanted_nb_samples - nb_samples,

                        is->audio_clock, is->audio_diff_threshold);

            }

        } else {

            /* too big difference : may be initial PTS errors, so

               reset A-V filter */

            is->audio_diff_avg_count = 0;

            is->audio_diff_cum       = 0;

        }

    }

    return wanted_nb_samples;

}


--- a/source.c
+++ b/source.c
@@ -10,11 +10,11 @@
         ide_transfer_stop(s);
     s->status |= BUSY_STAT;
     if (n > s->req_nb_sectors) {
+        n = s->req_nb_sectors;
+#if defined(DEBUG_IDE)
+    printf("sector=%" PRId64 "\n", sector_num);
+#endif
+    s->iov.iov_base = s->io_buffer;
     s->iov.iov_len  = n * BDRV_SECTOR_SIZE;
     qemu_iovec_init_external(&s->qiov, &s->iov, 1);
     bdrv_acct_start(s->bs, &s->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);

void ide_sector_read(IDEState *s)
{
    int64_t sector_num;
    int n;
    s->status = READY_STAT | SEEK_STAT;
    s->error = 0; /* not needed by IDE spec, but needed by Windows */
    sector_num = ide_get_sector(s);
    n = s->nsector;
    if (n == 0) {
        ide_transfer_stop(s);
    s->status |= BUSY_STAT;
    if (n > s->req_nb_sectors) {
        n = s->req_nb_sectors;
#if defined(DEBUG_IDE)
    printf("sector=%" PRId64 "\n", sector_num);
#endif
    s->iov.iov_base = s->io_buffer;
    s->iov.iov_len  = n * BDRV_SECTOR_SIZE;
    qemu_iovec_init_external(&s->qiov, &s->iov, 1);
    bdrv_acct_start(s->bs, &s->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ);
    s->pio_aiocb = bdrv_aio_readv(s->bs, sector_num, &s->qiov, n,
                                  ide_sector_read_cb, s);


--- a/source.c
+++ b/source.c
@@ -1,12 +1,12 @@
 static int common_bind(struct common *c)
+
+{
+
     uint64_t mfn;
+

+    if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &mfn) == -1)

 	return -1;

static int common_bind(struct common *c)

{

    uint64_t mfn;

    if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &mfn) == -1)

	return -1;

    assert(mfn == (xen_pfn_t)mfn);

    if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)

	return -1;

    c->page = xc_map_foreign_range(xen_xc, c->xendev.dom,

				   XC_PAGE_SIZE,

				   PROT_READ | PROT_WRITE, mfn);

    if (c->page == NULL)

	return -1;

    xen_be_bind_evtchn(&c->xendev);

    xen_be_printf(&c->xendev, 1, "ring mfn %"PRIx64", remote-port %d, local-port %d\n",

		  mfn, c->xendev.remote_port, c->xendev.local_port);

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
+static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm)
+
 {

     return host_memory_backend_get_memory(dimm->hostmem, &error_abort);

static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm)

{

    return host_memory_backend_get_memory(dimm->hostmem, &error_abort);

}


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

+    case Index_Data:
+
+        if (!(s->dregs[MODE_And_ID] & MODE2))
+
+            iaddr = s->regs[Index_Address] & 0x0f;

         else

static uint64_t cs_read (void *opaque, target_phys_addr_t addr, unsigned size)

{

    CSState *s = opaque;

    uint32_t saddr, iaddr, ret;

    saddr = addr;

    iaddr = ~0U;

    switch (saddr) {

    case Index_Address:

        ret = s->regs[saddr] & ~0x80;

        break;

    case Index_Data:

        if (!(s->dregs[MODE_And_ID] & MODE2))

            iaddr = s->regs[Index_Address] & 0x0f;

        else

            iaddr = s->regs[Index_Address] & 0x1f;

        ret = s->dregs[iaddr];

        if (iaddr == Error_Status_And_Initialization) {

            /* keep SEAL happy */

            if (s->aci_counter) {

                ret |= 1 << 5;

                s->aci_counter -= 1;

            }

        }

        break;

    default:

        ret = s->regs[saddr];

        break;

    }

    dolog ("read %d:%d -> %d\n", saddr, iaddr, ret);

    return ret;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 av_cold void ff_mlz_init_dict(void* context, MLZ *mlz) {
+
     mlz->dict = av_malloc_array(TABLE_SIZE, sizeof(*mlz->dict));

av_cold void ff_mlz_init_dict(void* context, MLZ *mlz) {

    mlz->dict = av_malloc_array(TABLE_SIZE, sizeof(*mlz->dict));

    mlz->flush_code            = FLUSH_CODE;

    mlz->current_dic_index_max = DIC_INDEX_INIT;

    mlz->dic_code_bit          = CODE_BIT_INIT;

    mlz->bump_code             = (DIC_INDEX_INIT - 1);

    mlz->next_code             = FIRST_CODE;

    mlz->freeze_flag           = 0;

    mlz->context               = context;

}


--- a/source.c
+++ b/source.c
@@ -37,9 +37,9 @@
             if(j>=d->nb_components)

                 av_assert0(!c->plane && !c->step_minus1 && !c->offset_plus1 && !c->shift && !c->depth_minus1);
+
+        }
+
+    }
+
 }

void ff_check_pixfmt_descriptors(void){

    int i, j;

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

        const AVPixFmtDescriptor *d = &av_pix_fmt_descriptors[i];

        if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags)

            continue;

//         av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name);

        av_assert0(d->log2_chroma_w <= 3);

        av_assert0(d->log2_chroma_h <= 3);

        av_assert0(d->nb_components <= 4);

        av_assert0(d->name && d->name[0]);

        av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & PIX_FMT_ALPHA));

        av_assert2(av_get_pix_fmt(d->name) == i);

        for (j=0; j<FF_ARRAY_ELEMS(d->comp); j++) {

            const AVComponentDescriptor *c = &d->comp[j];

            if(j>=d->nb_components)

                av_assert0(!c->plane && !c->step_minus1 && !c->offset_plus1 && !c->shift && !c->depth_minus1);

        }

    }

}


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

     CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);
+
+
+
+    *ptr = qemu_chr_find(str);

     if (*ptr == NULL)

static int parse_chr(DeviceState *dev, Property *prop, const char *str)

{

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

    *ptr = qemu_chr_find(str);

    if (*ptr == NULL)

        return -ENOENT;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
 static void raw_refresh_limits(BlockDriverState *bs, Error **errp)

 {
+
+    BDRVRawState *s = bs->opaque;
+
+    struct stat st;
+

     if (!fstat(s->fd, &st)) {

static void raw_refresh_limits(BlockDriverState *bs, Error **errp)

{

    BDRVRawState *s = bs->opaque;

    struct stat st;

    if (!fstat(s->fd, &st)) {

        if (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode)) {

            int ret = hdev_get_max_transfer_length(bs, s->fd);

            if (ret > 0 && ret <= BDRV_REQUEST_MAX_BYTES) {

                bs->bl.max_transfer = pow2floor(ret);

    raw_probe_alignment(bs, s->fd, errp);

    bs->bl.min_mem_alignment = s->buf_align;

    bs->bl.opt_mem_alignment = MAX(s->buf_align, getpagesize());


--- a/source.c
+++ b/source.c
@@ -15,7 +15,7 @@
         if (value) {

             error_setg(errp,
+
                        "remove -mem-prealloc to use the prealloc property");

             return;

static void host_memory_backend_set_prealloc(Object *obj, bool value,

                                             Error **errp)

{

    Error *local_err = NULL;

    HostMemoryBackend *backend = MEMORY_BACKEND(obj);

    if (backend->force_prealloc) {

        if (value) {

            error_setg(errp,

                       "remove -mem-prealloc to use the prealloc property");

            return;

        }

    }

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

        backend->prealloc = value;

        return;

    }

    if (value && !backend->prealloc) {

        int fd = memory_region_get_fd(&backend->mr);

        void *ptr = memory_region_get_ram_ptr(&backend->mr);

        uint64_t sz = memory_region_size(&backend->mr);

        os_mem_prealloc(fd, ptr, sz, &local_err);

        if (local_err) {

            error_propagate(errp, local_err);

            return;

        }

        backend->prealloc = true;

    }

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static void host_signal_handler(int host_signum, siginfo_t *info,
+
+                                void *puc)
+
+{

     int sig;

static void host_signal_handler(int host_signum, siginfo_t *info,

                                void *puc)

{

    int sig;

    target_siginfo_t tinfo;

    /* the CPU emulator uses some host signals to detect exceptions,

       we forward to it some signals */

    if ((host_signum == SIGSEGV || host_signum == SIGBUS)

        && info->si_code > 0) {

        if (cpu_signal_handler(host_signum, info, puc))

            return;

    }

    /* get target signal number */

    sig = host_to_target_signal(host_signum);

    if (sig < 1 || sig > TARGET_NSIG)

        return;

#if defined(DEBUG_SIGNAL)

    fprintf(stderr, "qemu: got signal %d\n", sig);

#endif

    host_to_target_siginfo_noswap(&tinfo, info);

    if (queue_signal(thread_env, sig, &tinfo) == 1) {

        /* interrupt the virtual CPU as soon as possible */

        cpu_interrupt(thread_env, CPU_INTERRUPT_EXIT);

    }

}


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

     v = g_malloc0(sizeof(*v));

+
+
+    v->visitor.type = VISITOR_INPUT;
+
+    v->visitor.type_int64 = parse_type_int64;

     v->visitor.type_uint64 = parse_type_uint64;

StringInputVisitor *string_input_visitor_new(const char *str)

{

    StringInputVisitor *v;

    v = g_malloc0(sizeof(*v));

    v->visitor.type = VISITOR_INPUT;

    v->visitor.type_int64 = parse_type_int64;

    v->visitor.type_uint64 = parse_type_uint64;

    v->visitor.type_size = parse_type_size;

    v->visitor.type_bool = parse_type_bool;

    v->visitor.type_str = parse_type_str;

    v->visitor.type_number = parse_type_number;

    v->visitor.start_list = start_list;

    v->visitor.next_list = next_list;

    v->visitor.end_list = end_list;

    v->visitor.optional = parse_optional;

    v->string = str;

    v->head = true;

    return v;

}


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

     }

+

     bus = PCI_BUS(qdev_get_parent_bus(qdev));

static int pci_qdev_init(DeviceState *qdev)

{

    PCIDevice *pci_dev = (PCIDevice *)qdev;

    PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);

    PCIBus *bus;

    int rc;

    bool is_default_rom;

    /* initialize cap_present for pci_is_express() and pci_config_size() */

    if (pc->is_express) {

        pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;

    }

    bus = PCI_BUS(qdev_get_parent_bus(qdev));

    pci_dev = do_pci_register_device(pci_dev, bus,

                                     object_get_typename(OBJECT(qdev)),

                                     pci_dev->devfn);

    if (pci_dev == NULL)

        return -1;

    if (pc->init) {

        rc = pc->init(pci_dev);

        if (rc != 0) {

            do_pci_unregister_device(pci_dev);

            return rc;

        }

    }

    /* rom loading */

    is_default_rom = false;

    if (pci_dev->romfile == NULL && pc->romfile != NULL) {

        pci_dev->romfile = g_strdup(pc->romfile);

        is_default_rom = true;

    }

    pci_add_option_rom(pci_dev, is_default_rom);

    return 0;

}


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

     uint32_t rval;

+
+
+    rval = fs->regs[addr >> 2];
+
     D(printf("%s %x=%x\n", __func__, addr, rval));

     return rval;

pic_read(void *opaque, target_phys_addr_t addr, unsigned int size)

{

    struct etrax_pic *fs = opaque;

    uint32_t rval;

    rval = fs->regs[addr >> 2];

    D(printf("%s %x=%x\n", __func__, addr, rval));

    return rval;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static int irq_cpu_hotplug_init(SCLPEvent *event)
+
 {

     irq_cpu_hotplug = *qemu_allocate_irqs(trigger_signal, event, 1);

static int irq_cpu_hotplug_init(SCLPEvent *event)

{

    irq_cpu_hotplug = *qemu_allocate_irqs(trigger_signal, event, 1);

    return 0;

}


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

     void * ptr;
+

     ptr = mmap(0, s->ivshmem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);

static int create_shared_memory_BAR(IVShmemState *s, int fd, uint8_t attr,

                                    Error **errp)

{

    void * ptr;

    ptr = mmap(0, s->ivshmem_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);

    if (ptr == MAP_FAILED) {

        error_setg_errno(errp, errno, "Failed to mmap shared memory");

        return -1;

    }

    s->shm_fd = fd;

    memory_region_init_ram_ptr(&s->ivshmem, OBJECT(s), "ivshmem.bar2",

                               s->ivshmem_size, ptr);

    vmstate_register_ram(&s->ivshmem, DEVICE(s));

    memory_region_add_subregion(&s->bar, 0, &s->ivshmem);

    /* region for shared memory */

    pci_register_bar(PCI_DEVICE(s), 2, attr, &s->bar);

    return 0;

}


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

     dc->bus_type = TYPE_XENSYSBUS;

+
+
+
+
+
 }

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);

    k->init = xen_sysdev_init;

    dc->props = xen_sysdev_properties;

    dc->bus_type = TYPE_XENSYSBUS;

}


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

             continue;

+        }
+
+        if (st->output) {
+
+            AUD_close_out(&a->card, st->voice.out);

         } else {

static void hda_audio_exit(HDACodecDevice *hda)

{

    HDAAudioState *a = HDA_AUDIO(hda);

    HDAAudioStream *st;

    int i;

    dprint(a, 1, "%s\n", __FUNCTION__);

    for (i = 0; i < ARRAY_SIZE(a->st); i++) {

        st = a->st + i;

        if (st->node == NULL) {

            continue;

        }

        if (st->output) {

            AUD_close_out(&a->card, st->voice.out);

        } else {

            AUD_close_in(&a->card, st->voice.in);

        }

    }

    AUD_remove_card(&a->card);

}


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

     case DATA_OFFSET + 3:       /* when only one byte read */

+        return uart_pop(uart);
+
+
+
+    case STATUS_OFFSET:

         /* Read Only */

static uint64_t grlib_apbuart_read(void *opaque, target_phys_addr_t addr,

                                   unsigned size)

{

    UART     *uart = opaque;

    addr &= 0xff;

    /* Unit registers */

    switch (addr) {

    case DATA_OFFSET:

    case DATA_OFFSET + 3:       /* when only one byte read */

        return uart_pop(uart);

    case STATUS_OFFSET:

        /* Read Only */

        return uart->status;

    case CONTROL_OFFSET:

        return uart->control;

    case SCALER_OFFSET:

        /* Not supported */

        return 0;

    default:

        trace_grlib_apbuart_readl_unknown(addr);

        return 0;

    }

}


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

     s->stdio_file = stdio_file;
+
+
+
+    if (mode[0] == 'r') {
+
         s->file = qemu_fopen_ops(s, &stdio_pipe_read_ops);

     } else {

QEMUFile *qemu_popen_cmd(const char *command, const char *mode)

{

    FILE *stdio_file;

    QEMUFileStdio *s;

    if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {

        fprintf(stderr, "qemu_popen: Argument validity check failed\n");

        return NULL;

    }

    stdio_file = popen(command, mode);

    if (stdio_file == NULL) {

        return NULL;

    }

    s = g_malloc0(sizeof(QEMUFileStdio));

    s->stdio_file = stdio_file;

    if (mode[0] == 'r') {

        s->file = qemu_fopen_ops(s, &stdio_pipe_read_ops);

    } else {

        s->file = qemu_fopen_ops(s, &stdio_pipe_write_ops);

    }

    return s->file;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
+
+{
+
+        mp_image_t *dmpi;

static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)

{

        mp_image_t *dmpi;

        // hope we'll get DR buffer:

        dmpi=ff_vf_get_image(vf->next, IMGFMT_YV12,

                          MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE |

                          ((vf->priv->scaleh == 1) ? MP_IMGFLAG_READABLE : 0),

                          mpi->w * vf->priv->scalew,

                          mpi->h / vf->priv->scaleh - vf->priv->skipline);

        toright(dmpi->planes, mpi->planes, dmpi->stride,

                mpi->stride, mpi->w, mpi->h, vf->priv);

        return ff_vf_next_put_image(vf,dmpi, pts);

}


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

     if (pci_get_word(pdev->config + PCI_VENDOR_ID) != PCI_VENDOR_ID_REALTEK ||

+        pci_get_word(pdev->config + PCI_DEVICE_ID) != 0x8168 || nr != 2) {

         return;

static void vfio_probe_rtl8168_bar2_window_quirk(VFIOPCIDevice *vdev, int nr)

{

    PCIDevice *pdev = &vdev->pdev;

    VFIOQuirk *quirk;

    if (pci_get_word(pdev->config + PCI_VENDOR_ID) != PCI_VENDOR_ID_REALTEK ||

        pci_get_word(pdev->config + PCI_DEVICE_ID) != 0x8168 || nr != 2) {

        return;

    }

    quirk = g_malloc0(sizeof(*quirk));

    quirk->vdev = vdev;

    quirk->data.bar = nr;

    memory_region_init_io(&quirk->mem, OBJECT(vdev), &vfio_rtl8168_window_quirk,

                          quirk, "vfio-rtl8168-window-quirk", 8);

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

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

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

    trace_vfio_probe_rtl8168_bar2_window_quirk(vdev->vbasedev.name);

}


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

                                        ram_addr_t start,

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

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

     unsigned long *bitmap;

ram_addr_t migration_bitmap_find_dirty(RAMState *rs, RAMBlock *rb,

                                       ram_addr_t start,

                                       ram_addr_t *ram_addr_abs)

{

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

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

    uint64_t rb_size = rb->used_length;

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

    unsigned long *bitmap;

    unsigned long next;

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

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

        next = nr + 1;

    } else {

        next = find_next_bit(bitmap, size, nr);

    }

    *ram_addr_abs = next << TARGET_PAGE_BITS;

    return (next - base) << TARGET_PAGE_BITS;

}


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

+{

     CFHDContext *s = avctx->priv_data;

static void free_buffers(AVCodecContext *avctx)

{

    CFHDContext *s = avctx->priv_data;

    int i;

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

        av_freep(&s->plane[i].idwt_buf);

        av_freep(&s->plane[i].idwt_tmp);

    }

    s->a_height = 0;

    s->a_width  = 0;

}


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

+{

     BlockDriverState *bs = opaque;

static void nbd_restart_write(void *opaque)

{

    BlockDriverState *bs = opaque;

    qemu_coroutine_enter(nbd_get_client_session(bs)->send_coroutine, NULL);

}


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

+    aio_context_acquire(client->aio_context);
+
+    nfs_service(client->context, POLLIN);
+
     nfs_set_events(client);

     aio_context_release(client->aio_context);

static void nfs_process_read(void *arg)

{

    NFSClient *client = arg;

    aio_context_acquire(client->aio_context);

    nfs_service(client->context, POLLIN);

    nfs_set_events(client);

    aio_context_release(client->aio_context);

}


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

      * Then we set UNIT_ATTENTION, by which the guest will
+
+     * detect a new CD in the drive.  See ide_atapi_cmd() for details.
+
+     */
+
     s->cdrom_changed = 1;

     s->events.new_media = true;

static void ide_cd_change_cb(void *opaque, bool load)

{

    IDEState *s = opaque;

    uint64_t nb_sectors;

    s->tray_open = !load;

    bdrv_get_geometry(s->bs, &nb_sectors);

    s->nb_sectors = nb_sectors;

    /*

     * First indicate to the guest that a CD has been removed.  That's

     * done on the next command the guest sends us.

     *

     * Then we set UNIT_ATTENTION, by which the guest will

     * detect a new CD in the drive.  See ide_atapi_cmd() for details.

     */

    s->cdrom_changed = 1;

    s->events.new_media = true;

    s->events.eject_request = false;

    ide_set_irq(s->bus);

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static struct omap_32khz_timer_s *omap_os_timer_init(MemoryRegion *memory,
+
                 hwaddr base,

                 qemu_irq irq, omap_clk clk)

static struct omap_32khz_timer_s *omap_os_timer_init(MemoryRegion *memory,

                hwaddr base,

                qemu_irq irq, omap_clk clk)

{

    struct omap_32khz_timer_s *s = (struct omap_32khz_timer_s *)

            g_malloc0(sizeof(struct omap_32khz_timer_s));

    s->timer.irq = irq;

    s->timer.clk = clk;

    s->timer.timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_timer_tick, &s->timer);

    omap_os_timer_reset(s);

    omap_timer_clk_setup(&s->timer);

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

                          "omap-os-timer", 0x800);

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

    return s;

}


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

     if (acb->cmd == RBD_AIO_READ) {
+
         qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size);

     }

static void rbd_aio_bh_cb(void *opaque)

{

    RBDAIOCB *acb = opaque;

    if (acb->cmd == RBD_AIO_READ) {

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

    }

    qemu_vfree(acb->bounce);

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

    qemu_bh_delete(acb->bh);

    acb->bh = NULL;

    qemu_aio_release(acb);

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,

+                              const char *filename, const char *mime_type,

                               enum AVMediaType type)

enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,

                              const char *filename, const char *mime_type,

                              enum AVMediaType type)

{

    if (av_match_name("segment", fmt->name) || av_match_name("ssegment", fmt->name)) {

        fmt = av_guess_format(NULL, filename, NULL);

    }

    if (type == AVMEDIA_TYPE_VIDEO) {

        enum AVCodecID codec_id = AV_CODEC_ID_NONE;

#if CONFIG_IMAGE2_MUXER

        if (!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")) {

            codec_id = ff_guess_image2_codec(filename);

        }

#endif

        if (codec_id == AV_CODEC_ID_NONE)

            codec_id = fmt->video_codec;

        return codec_id;

    } else if (type == AVMEDIA_TYPE_AUDIO)

        return fmt->audio_codec;

    else if (type == AVMEDIA_TYPE_SUBTITLE)

        return fmt->subtitle_codec;

    else

        return AV_CODEC_ID_NONE;

}


--- a/source.c
+++ b/source.c
@@ -1,5 +1,5 @@
 static struct omap_prcm_s *omap_prcm_init(struct omap_target_agent_s *ta,
+
                 qemu_irq mpu_int, qemu_irq dsp_int, qemu_irq iva_int,

                 struct omap_mpu_state_s *mpu)

static struct omap_prcm_s *omap_prcm_init(struct omap_target_agent_s *ta,

                qemu_irq mpu_int, qemu_irq dsp_int, qemu_irq iva_int,

                struct omap_mpu_state_s *mpu)

{

    struct omap_prcm_s *s = (struct omap_prcm_s *)

            g_malloc0(sizeof(struct omap_prcm_s));

    s->irq[0] = mpu_int;

    s->irq[1] = dsp_int;

    s->irq[2] = iva_int;

    s->mpu = mpu;

    omap_prcm_coldreset(s);

    memory_region_init_io(&s->iomem0, NULL, &omap_prcm_ops, s, "omap.pcrm0",

                          omap_l4_region_size(ta, 0));

    memory_region_init_io(&s->iomem1, NULL, &omap_prcm_ops, s, "omap.pcrm1",

                          omap_l4_region_size(ta, 1));

    omap_l4_attach(ta, 0, &s->iomem0);

    omap_l4_attach(ta, 1, &s->iomem1);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -1,24 +1,24 @@
+static int alac_set_info(ALACContext *alac)
+
 {

     const unsigned char *ptr = alac->avctx->extradata;
+
+
+
     ptr += 4; /* size */
+
     ptr += 4; /* alac */
+
+    ptr += 4; /* 0 ? */
+
+
+
     if(AV_RB32(ptr) >= UINT_MAX/4){

         av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n");

+        return -1;

     }

static int alac_set_info(ALACContext *alac)

{

    const unsigned char *ptr = alac->avctx->extradata;

    ptr += 4; /* size */

    ptr += 4; /* alac */

    ptr += 4; /* 0 ? */

    if(AV_RB32(ptr) >= UINT_MAX/4){

        av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n");

        return -1;

    }

    /* buffer size / 2 ? */

    alac->setinfo_max_samples_per_frame = bytestream_get_be32(&ptr);

    ptr++;                          /* ??? */

    alac->setinfo_sample_size           = *ptr++;

    alac->setinfo_rice_historymult      = *ptr++;

    alac->setinfo_rice_initialhistory   = *ptr++;

    alac->setinfo_rice_kmodifier        = *ptr++;

    alac->numchannels                   = *ptr++;

    bytestream_get_be16(&ptr);      /* ??? */

    bytestream_get_be32(&ptr);      /* max coded frame size */

    bytestream_get_be32(&ptr);      /* bitrate ? */

    bytestream_get_be32(&ptr);      /* samplerate */

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 int avpriv_unlock_avformat(void)
+
+{

+    if (lockmgr_cb) {

         if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE))

int avpriv_unlock_avformat(void)

{

    if (lockmgr_cb) {

        if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE))

            return -1;

    }

    return 0;

}


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

     fail_unless(qobject_type(obj) == QTYPE_QINT);

+
+
+    qint = qobject_to_qint(obj);
+
+    fail_unless(qint_get_int(qint) == value64);

START_TEST(vararg_number)

{

    QObject *obj;

    QInt *qint;

    QFloat *qfloat;

    int value = 0x2342;

    int64_t value64 = 0x2342342343LL;

    double valuef = 2.323423423;

    obj = qobject_from_jsonf("%d", value);

    fail_unless(obj != NULL);

    fail_unless(qobject_type(obj) == QTYPE_QINT);

    qint = qobject_to_qint(obj);

    fail_unless(qint_get_int(qint) == value);

    QDECREF(qint);

    obj = qobject_from_jsonf("%" PRId64, value64);

    fail_unless(obj != NULL);

    fail_unless(qobject_type(obj) == QTYPE_QINT);

    qint = qobject_to_qint(obj);

    fail_unless(qint_get_int(qint) == value64);

    QDECREF(qint);

    obj = qobject_from_jsonf("%f", valuef);

    fail_unless(obj != NULL);

    fail_unless(qobject_type(obj) == QTYPE_QFLOAT);

    qfloat = qobject_to_qfloat(obj);

    fail_unless(qfloat_get_double(qfloat) == valuef);

    QDECREF(qfloat);

}


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

 {

+    return NULL;

 }

void *get_mmap_addr(unsigned long size)

{

    return NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
+static void parse_context_init(SchroParseUnitContext *parse_ctx,
+
+                               const uint8_t *buf, int buf_size)

 {

static void parse_context_init(SchroParseUnitContext *parse_ctx,

                               const uint8_t *buf, int buf_size)

{

    parse_ctx->buf           = buf;

    parse_ctx->buf_size      = buf_size;

}


--- a/source.c
+++ b/source.c
@@ -1,10 +1,10 @@
+static int ram_decompress_open(RamDecompressState *s, QEMUFile *f)
+
+{
+
+    int ret;
+
+    memset(s, 0, sizeof(*s));

     s->f = f;

static int ram_decompress_open(RamDecompressState *s, QEMUFile *f)

{

    int ret;

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

    s->f = f;

    ret = inflateInit(&s->zstream);

    if (ret != Z_OK)

        return -1;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
 static void spapr_phb_vfio_class_init(ObjectClass *klass, void *data)

+{

+    DeviceClass *dc = DEVICE_CLASS(klass);

     sPAPRPHBClass *spc = SPAPR_PCI_HOST_BRIDGE_CLASS(klass);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    sPAPRPHBClass *spc = SPAPR_PCI_HOST_BRIDGE_CLASS(klass);

    dc->props = spapr_phb_vfio_properties;

    spc->finish_realize = spapr_phb_vfio_finish_realize;

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static int hevc_decode_nal_units(const uint8_t *buf, int buf_size, HEVCParamSets *ps,

                                  int is_nalff, int nal_length_size, void *logctx)

@@ -9,15 +9,15 @@
     int ret = 0;

     H2645Packet pkt = { 0 };
+
+
+
     ret = ff_h2645_packet_split(&pkt, buf, buf_size, logctx, is_nalff, nal_length_size, AV_CODEC_ID_HEVC, 1);

     if (ret < 0) {

         goto done;
+
     }

static int hevc_decode_nal_units(const uint8_t *buf, int buf_size, HEVCParamSets *ps,

                                 int is_nalff, int nal_length_size, void *logctx)

{

    int i;

    int ret = 0;

    H2645Packet pkt = { 0 };

    ret = ff_h2645_packet_split(&pkt, buf, buf_size, logctx, is_nalff, nal_length_size, AV_CODEC_ID_HEVC, 1);

    if (ret < 0) {

        goto done;

    }

    for (i = 0; i < pkt.nb_nals; i++) {

        H2645NAL *nal = &pkt.nals[i];

        /* ignore everything except parameter sets and VCL NALUs */

        switch (nal->type) {

        case HEVC_NAL_VPS: ff_hevc_decode_nal_vps(&nal->gb, logctx, ps);    break;

        case HEVC_NAL_SPS: ff_hevc_decode_nal_sps(&nal->gb, logctx, ps, 1); break;

        case HEVC_NAL_PPS: ff_hevc_decode_nal_pps(&nal->gb, logctx, ps);    break;

        default:

            av_log(logctx, AV_LOG_VERBOSE, "Ignoring NAL type %d in extradata\n", nal->type);

            break;

        }

    }

done:

    ff_h2645_packet_uninit(&pkt);

    return ret;

}


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

 {

+    DeviceClass *dc = DEVICE_CLASS(klass);

     SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);

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

{

    DeviceClass *dc = DEVICE_CLASS(klass);

    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);

    k->init = spapr_vio_bridge_init;

    dc->no_user = 1;

}


--- a/source.c
+++ b/source.c
@@ -1,11 +1,11 @@
+static uint32_t regtype_to_ss(uint8_t type)
+
+{

+    if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
+
         return 3;
+
     }

     if (type == PCI_BASE_ADDRESS_SPACE_IO) {

static uint32_t regtype_to_ss(uint8_t type)

{

    if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) {

        return 3;

    }

    if (type == PCI_BASE_ADDRESS_SPACE_IO) {

        return 1;

    }

    return 2;

}


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

     CPU_FOREACH(cs) {

+        async_run_on_cpu(cs, ppc_cpu_do_nmi_on_cpu, RUN_ON_CPU_NULL);
+
+    }

 }

static void spapr_nmi(NMIState *n, int cpu_index, Error **errp)

{

    CPUState *cs;

    CPU_FOREACH(cs) {

        async_run_on_cpu(cs, ppc_cpu_do_nmi_on_cpu, RUN_ON_CPU_NULL);

    }

}


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

     err = qemu_strtoul(str, &endptr, 0, &res);
+
+
+
+    g_assert_cmpint(err, ==, 0);
+
     g_assert_cmpint(res, ==, 123);

     g_assert(endptr == str + 3);

static void test_qemu_strtoul_trailing(void)

{

    const char *str = "123xxx";

    char f = 'X';

    const char *endptr = &f;

    unsigned long res = 999;

    int err;

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

    g_assert_cmpint(err, ==, 0);

    g_assert_cmpint(res, ==, 123);

    g_assert(endptr == str + 3);

}


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

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

         g_free(co);

static void qemu_coroutine_thread_cleanup(void *opaque)

{

    CoroutineThreadState *s = opaque;

    Coroutine *co;

    Coroutine *tmp;

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

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

        g_free(co);

    }

    g_free(s);

}


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

 {

+    StreamBlockJob *s;
+
+    Coroutine *co;
+
+

     s = block_job_create(&stream_job_type, bs, cb, opaque, errp);

void stream_start(BlockDriverState *bs, BlockDriverState *base,

                  const char *base_id, BlockDriverCompletionFunc *cb,

                  void *opaque, Error **errp)

{

    StreamBlockJob *s;

    Coroutine *co;

    s = block_job_create(&stream_job_type, bs, cb, opaque, errp);

    if (!s) {

        return;

    }

    s->base = base;

    if (base_id) {

        pstrcpy(s->backing_file_id, sizeof(s->backing_file_id), base_id);

    }

    co = qemu_coroutine_create(stream_run);

    trace_stream_start(bs, base, s, co, opaque);

    qemu_coroutine_enter(co, s);

}


--- a/source.c
+++ b/source.c
@@ -1,8 +1,8 @@
+static inline void check_hwrena(CPUMIPSState *env, int reg)

 {

+    if ((env->hflags & MIPS_HFLAG_CP0) || (env->CP0_HWREna & (1 << reg))) {

         return;

static inline void check_hwrena(CPUMIPSState *env, int reg)

{

    if ((env->hflags & MIPS_HFLAG_CP0) || (env->CP0_HWREna & (1 << reg))) {

        return;

    }

    do_raise_exception(env, EXCP_RI, GETPC());

}


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

     unsigned int sclp_active_selection_mask;
+
+    unsigned int sclp_cp_receive_mask;
+
+
+
     ReadEventData *red = (ReadEventData *) sccb;

static void read_event_data(SCLPEventFacility *ef, SCCB *sccb)

{

    unsigned int sclp_active_selection_mask;

    unsigned int sclp_cp_receive_mask;

    ReadEventData *red = (ReadEventData *) sccb;

    if (be16_to_cpu(sccb->h.length) != SCCB_SIZE) {

        sccb->h.response_code = cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LENGTH);

        goto out;

    }

    sclp_cp_receive_mask = ef->receive_mask;

    /* get active selection mask */

    switch (sccb->h.function_code) {

    case SCLP_UNCONDITIONAL_READ:

        sclp_active_selection_mask = sclp_cp_receive_mask;

        break;

    case SCLP_SELECTIVE_READ:

        if (!(sclp_cp_receive_mask & be32_to_cpu(red->mask))) {

            sccb->h.response_code =

                    cpu_to_be16(SCLP_RC_INVALID_SELECTION_MASK);

            goto out;

        }

        sclp_active_selection_mask = be32_to_cpu(red->mask);

        break;

    default:

        sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_FUNCTION);

        goto out;

    }

    sccb->h.response_code = cpu_to_be16(

            handle_sccb_read_events(ef, sccb, sclp_active_selection_mask));

out:

    return;

}


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

     av_freep(&ctx->par_out->extradata);
+
+    ctx->par_out->extradata_size = 0;
+

     return 0;

static int aac_adtstoasc_init(AVBSFContext *ctx)

{

    av_freep(&ctx->par_out->extradata);

    ctx->par_out->extradata_size = 0;

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -1,7 +1,7 @@
 static void mirror_complete(BlockJob *job, Error **errp)

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

     int ret;

static void mirror_complete(BlockJob *job, Error **errp)

{

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

    int ret;

    ret = bdrv_open_backing_file(s->target);

    if (ret < 0) {

        char backing_filename[PATH_MAX];

        bdrv_get_full_backing_filename(s->target, backing_filename,

                                       sizeof(backing_filename));

        error_set(errp, QERR_OPEN_FILE_FAILED, backing_filename);

        return;

    }

    if (!s->synced) {

        error_set(errp, QERR_BLOCK_JOB_NOT_READY, job->bs->device_name);

        return;

    }

    s->should_complete = true;

    block_job_resume(job);

}


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

+{
+
+    VirtIOBlockDataPlane *s = opaque;
+

     do {

static void *data_plane_thread(void *opaque)

{

    VirtIOBlockDataPlane *s = opaque;

    do {

        aio_poll(s->ctx, true);

    } while (!s->stopping || s->num_reqs > 0);

    return NULL;

}


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

+{

     G726Context* c = avctx->priv_data;

static av_cold int g726_init(AVCodecContext * avctx)

{

    G726Context* c = avctx->priv_data;

    unsigned int index= (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate - 2;

    if (avctx->bit_rate % avctx->sample_rate && avctx->codec->encode) {

        av_log(avctx, AV_LOG_ERROR, "Bitrate - Samplerate combination is invalid\n");

        return -1;

    }

    if(avctx->channels != 1){

        av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");

        return -1;

    }

    if(index>3){

        av_log(avctx, AV_LOG_ERROR, "Unsupported number of bits %d\n", index+2);

        return -1;

    }

    g726_reset(c, index);

    c->code_size = index+2;

    avctx->coded_frame = avcodec_alloc_frame();

    if (!avctx->coded_frame)

        return AVERROR(ENOMEM);

    avctx->coded_frame->key_frame = 1;

    if (avctx->codec->decode)

        avctx->sample_fmt = SAMPLE_FMT_S16;

    return 0;

}


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

     ff_wmv2_common_init(w);
+
+
+
+    return ff_intrax8_common_init(&w->x8, &w->s.idsp, &w->s);
+
 }

static av_cold int wmv2_decode_init(AVCodecContext *avctx)

{

    Wmv2Context *const w = avctx->priv_data;

    int ret;

    if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)

        return ret;

    ff_wmv2_common_init(w);

    return ff_intrax8_common_init(&w->x8, &w->s.idsp, &w->s);

}


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

     if (extent->compressed) {

+        if (!extent->has_marker) {

             ret = -EINVAL;

static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset,

                            int64_t offset_in_cluster, const uint8_t *buf,

                            int nb_sectors, int64_t sector_num)

{

    int ret;

    VmdkGrainMarker *data = NULL;

    uLongf buf_len;

    const uint8_t *write_buf = buf;

    int write_len = nb_sectors * 512;

    if (extent->compressed) {

        if (!extent->has_marker) {

            ret = -EINVAL;

            goto out;

        }

        buf_len = (extent->cluster_sectors << 9) * 2;

        data = g_malloc(buf_len + sizeof(VmdkGrainMarker));

        if (compress(data->data, &buf_len, buf, nb_sectors << 9) != Z_OK ||

                buf_len == 0) {

            ret = -EINVAL;

            goto out;

        }

        data->lba = sector_num;

        data->size = buf_len;

        write_buf = (uint8_t *)data;

        write_len = buf_len + sizeof(VmdkGrainMarker);

    }

    ret = bdrv_pwrite(extent->file,

                        cluster_offset + offset_in_cluster,

                        write_buf,

                        write_len);

    if (ret != write_len) {

        ret = ret < 0 ? ret : -EIO;

        goto out;

    }

    ret = 0;

 out:

    g_free(data);

    return ret;

}


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

     assert(offset < 128);

+    value = regfile[offset];
+
+
+
+    DPRINTF("read [0x%02x] = 0x%04x\n", offset, value);

uint32_t lm4549_read(lm4549_state *s, target_phys_addr_t offset)

{

    uint16_t *regfile = s->regfile;

    uint32_t value = 0;

    /* Read the stored value */

    assert(offset < 128);

    value = regfile[offset];

    DPRINTF("read [0x%02x] = 0x%04x\n", offset, value);

    return value;

}


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

 {

+    VGACommonState *s = opaque;
+
+    uint32_t val;

     val = s->vbe_index;

static uint32_t vbe_ioport_read_index(void *opaque, uint32_t addr)

{

    VGACommonState *s = opaque;

    uint32_t val;

    val = s->vbe_index;

    return val;

}


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

 {

+    CPUMIPSState *env;
+
+    MIPSCPU *cpu;

     int i;

static void create_cpu_without_cps(const char *cpu_model,

                                   qemu_irq *cbus_irq, qemu_irq *i8259_irq)

{

    CPUMIPSState *env;

    MIPSCPU *cpu;

    int i;

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

        cpu = cpu_mips_init(cpu_model);

        if (cpu == NULL) {

            fprintf(stderr, "Unable to find CPU definition\n");

            exit(1);

        }

        /* Init internal devices */

        cpu_mips_irq_init_cpu(cpu);

        cpu_mips_clock_init(cpu);

        qemu_register_reset(main_cpu_reset, cpu);

    }

    cpu = MIPS_CPU(first_cpu);

    env = &cpu->env;

    *i8259_irq = env->irq[2];

    *cbus_irq = env->irq[4];

}


--- a/source.c
+++ b/source.c
@@ -1,15 +1,15 @@
 iscsi_readv_writev_bh_cb(void *p)

 {
+
     IscsiAIOCB *acb = p;

+
     qemu_bh_delete(acb->bh);

+
+
     if (!acb->canceled) {

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

iscsi_readv_writev_bh_cb(void *p)

{

    IscsiAIOCB *acb = p;

    qemu_bh_delete(acb->bh);

    if (!acb->canceled) {

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

    }

    qemu_aio_release(acb);

    if (acb->canceled) {

        return;

    }

    scsi_free_scsi_task(acb->task);

    acb->task = NULL;

}


--- a/source.c
+++ b/source.c
@@ -1,27 +1,27 @@
 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
+
+{
+
+    if (lockmgr_cb) {
+
+        // There is no good way to rollback a failure to destroy the

+        // mutex, so we ignore failures.
+
+        lockmgr_cb(&codec_mutex,    AV_LOCK_DESTROY);
+
+        lockmgr_cb(&avformat_mutex, AV_LOCK_DESTROY);
+
         lockmgr_cb     = NULL;
+
+        codec_mutex    = NULL;

         avformat_mutex = NULL;
+
+    }
+

+
     if (cb) {

         void *new_codec_mutex    = NULL;

int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))

{

    if (lockmgr_cb) {

        // There is no good way to rollback a failure to destroy the

        // mutex, so we ignore failures.

        lockmgr_cb(&codec_mutex,    AV_LOCK_DESTROY);

        lockmgr_cb(&avformat_mutex, AV_LOCK_DESTROY);

        lockmgr_cb     = NULL;

        codec_mutex    = NULL;

        avformat_mutex = NULL;

    }

    if (cb) {

        void *new_codec_mutex    = NULL;

        void *new_avformat_mutex = NULL;

        int err;

        if (err = cb(&new_codec_mutex, AV_LOCK_CREATE)) {

            return err > 0 ? AVERROR_UNKNOWN : err;

        }

        if (err = cb(&new_avformat_mutex, AV_LOCK_CREATE)) {

            // Ignore failures to destroy the newly created mutex.

            cb(&new_codec_mutex, AV_LOCK_DESTROY);

            return err > 0 ? AVERROR_UNKNOWN : err;

        }

        lockmgr_cb     = cb;

        codec_mutex    = new_codec_mutex;

        avformat_mutex = new_avformat_mutex;

    }

    return 0;

}


--- a/source.c
+++ b/source.c
@@ -5,10 +5,10 @@
                                               Error **errp)

 {
+
+    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);
+
+    uint32_t value = s->pci_hole.begin;

static void i440fx_pcihost_get_pci_hole_start(Object *obj, Visitor *v,

                                              const char *name, void *opaque,

                                              Error **errp)

{

    I440FXState *s = I440FX_PCI_HOST_BRIDGE(obj);

    uint32_t value = s->pci_hole.begin;

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

}


--- a/source.c
+++ b/source.c
@@ -1,4 +1,4 @@
+static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,

                       uint32_t sums[][MAX_PARTITIONS])

@@ -6,7 +6,7 @@

     int i, j;

+    int parts;

     uint32_t *res, *res_end;

static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,

                      uint32_t sums[][MAX_PARTITIONS])

{

    int i, j;

    int parts;

    uint32_t *res, *res_end;

    /* sums for highest level */

    parts   = (1 << pmax);

    res     = &data[pred_order];

    res_end = &data[n >> pmax];

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

        uint32_t sum = 0;

        while (res < res_end)

            sum += *(res++);

        sums[pmax][i] = sum;

        res_end += n >> pmax;

    }

    /* sums for lower levels */

    for (i = pmax - 1; i >= pmin; i--) {

        parts = (1 << i);

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

            sums[i][j] = sums[i+1][2*j] + sums[i+1][2*j+1];

    }

}


--- a/source.c
+++ b/source.c
@@ -3,7 +3,7 @@
                                int order, double *ref)

 {
+
     int i;

     double signal = 0.0f, avg_err = 0.0f;

double ff_lpc_calc_ref_coefs_f(LPCContext *s, const float *samples, int len,

                               int order, double *ref)

{

    int i;

    double signal = 0.0f, avg_err = 0.0f;

    double autoc[MAX_LPC_ORDER+1] = {0}, error[MAX_LPC_ORDER+1] = {0};

    const double a = 0.5f, b = 1.0f - a;

    /* Apply windowing */

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

        double weight = a - b*cos((2*M_PI*i)/(len - 1));

        s->windowed_samples[i] = weight*samples[i];

    }

    s->lpc_compute_autocorr(s->windowed_samples, len, order, autoc);

    signal = autoc[0];

    compute_ref_coefs(autoc, order, ref, error);

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

        avg_err = (avg_err + error[i])/2.0f;

    return signal/avg_err;

}


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

+    DPRINTF2("iso-in status %d ep %02X len %d id %"PRIu64"\n",

              iso_packet->status, ep, data_len, id);

static void usbredir_iso_packet(void *priv, uint64_t id,

    struct usb_redir_iso_packet_header *iso_packet,

    uint8_t *data, int data_len)

{

    USBRedirDevice *dev = priv;

    uint8_t ep = iso_packet->endpoint;

    DPRINTF2("iso-in status %d ep %02X len %d id %"PRIu64"\n",

             iso_packet->status, ep, data_len, id);

    if (dev->endpoint[EP2I(ep)].type != USB_ENDPOINT_XFER_ISOC) {

        ERROR("received iso packet for non iso endpoint %02X\n", ep);

        free(data);

        return;

    }

    if (dev->endpoint[EP2I(ep)].iso_started == 0) {

        DPRINTF("received iso packet for non started stream ep %02X\n", ep);

        free(data);

        return;

    }

    /* bufp_alloc also adds the packet to the ep queue */

    bufp_alloc(dev, data, data_len, iso_packet->status, ep);

}


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

     int iomemtype;

+    struct pxa2xx_pcmcia_s *s;

+
     s = (struct pxa2xx_pcmcia_s *)

+            qemu_mallocz(sizeof(struct pxa2xx_pcmcia_s));

struct pxa2xx_pcmcia_s *pxa2xx_pcmcia_init(target_phys_addr_t base)

{

    int iomemtype;

    struct pxa2xx_pcmcia_s *s;

    s = (struct pxa2xx_pcmcia_s *)

            qemu_mallocz(sizeof(struct pxa2xx_pcmcia_s));

    /* Socket I/O Memory Space */

    s->io_base = base | 0x00000000;

    iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_io_readfn,

                    pxa2xx_pcmcia_io_writefn, s);

    cpu_register_physical_memory(s->io_base, 0x03ffffff, iomemtype);

    /* Then next 64 MB is reserved */

    /* Socket Attribute Memory Space */

    s->attr_base = base | 0x08000000;

    iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_attr_readfn,

                    pxa2xx_pcmcia_attr_writefn, s);

    cpu_register_physical_memory(s->attr_base, 0x03ffffff, iomemtype);

    /* Socket Common Memory Space */

    s->common_base = base | 0x0c000000;

    iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_common_readfn,

                    pxa2xx_pcmcia_common_writefn, s);

    cpu_register_physical_memory(s->common_base, 0x03ffffff, iomemtype);

    if (base == 0x30000000)

        s->slot.slot_string = "PXA PC Card Socket 1";

    else

        s->slot.slot_string = "PXA PC Card Socket 0";

    s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0];

    pcmcia_socket_register(&s->slot);

    return s;

}


--- a/source.c
+++ b/source.c
@@ -59,11 +59,11 @@
             if (bs0->drv && bs0->backing_hd) {
                 bs0 = bs0->backing_hd;
                 (*p_image_info)->has_backing_image = true;
+                p_image_info = &((*p_image_info)->backing_image);
+            } else {
+                break;
+            }
+        }
     }
     *p_info = info;
     return;

void bdrv_query_info(BlockDriverState *bs,
                     BlockInfo **p_info,
                     Error **errp)
{
    BlockInfo *info = g_malloc0(sizeof(*info));
    BlockDriverState *bs0;
    ImageInfo **p_image_info;
    Error *local_err = NULL;
    info->device = g_strdup(bs->device_name);
    info->type = g_strdup("unknown");
    info->locked = bdrv_dev_is_medium_locked(bs);
    info->removable = bdrv_dev_has_removable_media(bs);
    if (bdrv_dev_has_removable_media(bs)) {
        info->has_tray_open = true;
        info->tray_open = bdrv_dev_is_tray_open(bs);
    }
    if (bdrv_iostatus_is_enabled(bs)) {
        info->has_io_status = true;
        info->io_status = bs->iostatus;
    }
    if (bs->dirty_bitmap) {
        info->has_dirty = true;
        info->dirty = g_malloc0(sizeof(*info->dirty));
        info->dirty->count = bdrv_get_dirty_count(bs) * BDRV_SECTOR_SIZE;
        info->dirty->granularity =
         ((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bs->dirty_bitmap));
    }
    if (bs->drv) {
        info->has_inserted = true;
        info->inserted = g_malloc0(sizeof(*info->inserted));
        info->inserted->file = g_strdup(bs->filename);
        info->inserted->ro = bs->read_only;
        info->inserted->drv = g_strdup(bs->drv->format_name);
        info->inserted->encrypted = bs->encrypted;
        info->inserted->encryption_key_missing = bdrv_key_required(bs);
        if (bs->backing_file[0]) {
            info->inserted->has_backing_file = true;
            info->inserted->backing_file = g_strdup(bs->backing_file);
        }
        info->inserted->backing_file_depth = bdrv_get_backing_file_depth(bs);
        if (bs->io_limits_enabled) {
            ThrottleConfig cfg;
            throttle_get_config(&bs->throttle_state, &cfg);
            info->inserted->bps     = cfg.buckets[THROTTLE_BPS_TOTAL].avg;
            info->inserted->bps_rd  = cfg.buckets[THROTTLE_BPS_READ].avg;
            info->inserted->bps_wr  = cfg.buckets[THROTTLE_BPS_WRITE].avg;
            info->inserted->iops    = cfg.buckets[THROTTLE_OPS_TOTAL].avg;
            info->inserted->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg;
            info->inserted->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg;
        }
        bs0 = bs;
        p_image_info = &info->inserted->image;
        while (1) {
            bdrv_query_image_info(bs0, p_image_info, &local_err);
            if (error_is_set(&local_err)) {
                error_propagate(errp, local_err);
                goto err;
            }
            if (bs0->drv && bs0->backing_hd) {
                bs0 = bs0->backing_hd;
                (*p_image_info)->has_backing_image = true;
                p_image_info = &((*p_image_info)->backing_image);
            } else {
                break;
            }
        }
    }
    *p_info = info;
    return;
 err:
    qapi_free_BlockInfo(info);
}


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

     switch (op2) {
+
+    case 2: /* CLREX */
+
+        gen_clrex(s, insn);
+
         return;

     case 4: /* DSB */

static void handle_sync(DisasContext *s, uint32_t insn,

                        unsigned int op1, unsigned int op2, unsigned int crm)

{

    if (op1 != 3) {

        unallocated_encoding(s);

        return;

    }

    switch (op2) {

    case 2: /* CLREX */

        gen_clrex(s, insn);

        return;

    case 4: /* DSB */

    case 5: /* DMB */

    case 6: /* ISB */

        /* We don't emulate caches so barriers are no-ops */

        return;

    default:

        unallocated_encoding(s);

        return;

    }

}


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

     VirtIONetCcw *dev = VIRTIO_NET_CCW(ccw_dev);

+    DeviceState *vdev = DEVICE(&dev->vdev);
+
+    Error *err = NULL;
+
+

     virtio_net_set_netclient_name(&dev->vdev, qdev->id,

static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp)

{

    DeviceState *qdev = DEVICE(ccw_dev);

    VirtIONetCcw *dev = VIRTIO_NET_CCW(ccw_dev);

    DeviceState *vdev = DEVICE(&dev->vdev);

    Error *err = NULL;

    virtio_net_set_netclient_name(&dev->vdev, qdev->id,

                                  object_get_typename(OBJECT(qdev)));

    qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));

    object_property_set_bool(OBJECT(vdev), true, "realized", &err);

    if (err) {

        error_propagate(errp, err);

    }

}


--- a/source.c
+++ b/source.c
@@ -17,11 +17,11 @@
         retval = 0;

         break;
+
+    case MFI_OMSG0:
+
+    case MFI_OSP0:
+
         retval = (megasas_use_msix(s) ? MFI_FWSTATE_MSIX_SUPPORTED : 0) |

             (s->fw_state & MFI_FWSTATE_MASK) |

static uint64_t megasas_mmio_read(void *opaque, target_phys_addr_t addr,

                                  unsigned size)

{

    MegasasState *s = opaque;

    uint32_t retval = 0;

    switch (addr) {

    case MFI_IDB:

        retval = 0;

        break;

    case MFI_OMSG0:

    case MFI_OSP0:

        retval = (megasas_use_msix(s) ? MFI_FWSTATE_MSIX_SUPPORTED : 0) |

            (s->fw_state & MFI_FWSTATE_MASK) |

            ((s->fw_sge & 0xff) << 16) |

            (s->fw_cmds & 0xFFFF);

        break;

    case MFI_OSTS:

        if (megasas_intr_enabled(s) && s->doorbell) {

            retval = MFI_1078_RM | 1;

        }

        break;

    case MFI_OMSK:

        retval = s->intr_mask;

        break;

    case MFI_ODCR0:

        retval = s->doorbell;

        break;

    default:

        trace_megasas_mmio_invalid_readl(addr);

        break;

    }

    trace_megasas_mmio_readl(addr, retval);

    return retval;

}


--- a/source.c
+++ b/source.c
@@ -1,6 +1,6 @@
 static inline void RENAME(yuv2bgr24_2)(SwsContext *c, const uint16_t *buf0,
+
+                                       const uint16_t *buf1, const uint16_t *ubuf0,

                                        const uint16_t *ubuf1, const uint16_t *vbuf0,

static inline void RENAME(yuv2bgr24_2)(SwsContext *c, const uint16_t *buf0,

                                       const uint16_t *buf1, const uint16_t *ubuf0,

                                       const uint16_t *ubuf1, const uint16_t *vbuf0,

                                       const uint16_t *vbuf1, const uint16_t *abuf0,

                                       const uint16_t *abuf1, uint8_t *dest,

                                       int dstW, int yalpha, int uvalpha, int y)

{

    x86_reg uv_off = c->uv_off << 1;

    //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(

    __asm__ volatile(

        "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"

        "mov        %4, %%"REG_b"               \n\t"

        "push %%"REG_BP"                        \n\t"

        YSCALEYUV2RGB(%%REGBP, %5, %6)

        "pxor    %%mm7, %%mm7                   \n\t"

        WRITEBGR24(%%REGb, 8280(%5), %%REGBP)

        "pop %%"REG_BP"                         \n\t"

        "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"

        :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),

           "a" (&c->redDither), "m"(uv_off)

    );

}


--- a/source.c
+++ b/source.c
@@ -9,11 +9,11 @@
         if( tc0[i] < 0 ) {

             pix += 4*ystride;
+
+            continue;
+
+        }
+
         for( d = 0; d < 4; d++ ) {

             const int p0 = pix[-1*xstride];

static inline void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int *tc0)

{

    int i, d;

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

        if( tc0[i] < 0 ) {

            pix += 4*ystride;

            continue;

        }

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

            const int p0 = pix[-1*xstride];

            const int p1 = pix[-2*xstride];

            const int p2 = pix[-3*xstride];

            const int q0 = pix[0];

            const int q1 = pix[1*xstride];

            const int q2 = pix[2*xstride];

            if( ABS( p0 - q0 ) < alpha &&

                ABS( p1 - p0 ) < beta &&

                ABS( q1 - q0 ) < beta ) {

                int tc = tc0[i];

                int i_delta;

                if( ABS( p2 - p0 ) < beta ) {

                    pix[-2*xstride] = p1 + clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0[i], tc0[i] );

                    tc++;

                }

                if( ABS( q2 - q0 ) < beta ) {

                    pix[xstride] = q1 + clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0[i], tc0[i] );

                    tc++;

                }

                i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );

                pix[-xstride] = clip_uint8( p0 + i_delta );    /* p0' */

                pix[0]        = clip_uint8( q0 - i_delta );    /* q0' */

            }

            pix += ystride;

        }

    }

}


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

         break;

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

                 TARGET_FMT_plx, addr << 2);

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

                       unsigned size)

{

    MilkymistPFPUState *s = opaque;

    trace_milkymist_pfpu_memory_write(addr, value);

    addr >>= 2;

    switch (addr) {

    case R_CTL:

        if (value & CTL_START_BUSY) {

            pfpu_start(s);

        }

        break;

    case R_MESHBASE:

    case R_HMESHLAST:

    case R_VMESHLAST:

    case R_CODEPAGE:

    case R_VERTICES:

    case R_COLLISIONS:

    case R_STRAYWRITES:

    case R_LASTDMA:

    case R_PC:

    case R_DREGBASE:

    case R_CODEBASE:

        s->regs[addr] = value;

        break;

    case GPR_BEGIN ...  GPR_END:

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

        break;

    case MICROCODE_BEGIN ...  MICROCODE_END:

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

        break;

    default:

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

                TARGET_FMT_plx, addr << 2);

        break;

    }

}