instruction
stringclasses
1 value
output
stringclasses
2 values
input
stringlengths
21
96.3k
positive
static int ohci_eof_timer_pre_load(void *opaque){ OHCIState *ohci = opaque; ohci_bus_start(ohci); return 0;}
positive
envlist_free(envlist_t *envlist){struct envlist_entry *entry;assert(envlist != NULL);while (envlist->el_entries.lh_first != NULL) {entry = envlist->el_entries.lh_first;QLIST_REMOVE(entry, ev_link);free((char *)entry->ev_var);free(entry);}free(envlist);}
positive
static void test_visitor_in_intList(TestInputVisitorData *data, const void *unused){ /* Note: the visitor *sorts* ranges *unsigned* */ int64_t expect1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20 }; int64_t expect2[] = { 32767, -32768, -32767 }; int64_t expect3[] = { INT64_MAX, INT64_MIN }; uint64_t expect4[] = { UINT64_MAX ...
positive
static void put_unused_buffer(QEMUFile *f, void *pv, size_t size){ static const uint8_t buf[1024]; int block_len; while (size > 0) { block_len = MIN(sizeof(buf), size); size -= block_len; qemu_put_buffer(f, buf, block_len); }}
positive
static int find_snapshot_by_id(BlockDriverState *bs, const char *id_str){ BDRVQcowState *s = bs->opaque; int i; for(i = 0; i < s->nb_snapshots; i++) { if (!strcmp(s->snapshots[i].id_str, id_str)) return i; } return -1;}
positive
static inline void vmsvga_update_rect(struct vmsvga_state_s *s, int x, int y, int w, int h){ DisplaySurface *surface = qemu_console_surface(s->vga.con); int line; int bypl; int width; int start; uint8_t *src; uint8_t *dst; if (x < 0) { fprintf(stderr, "%s: update x was < 0 (%d)\n", __func__, x); w += x; x = 0; } if (w ...
positive
static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range){ MatroskaDemuxContext *matroska = s->priv_data; EbmlList *seekhead_list = &matroska->seekhead; MatroskaSeekhead *seekhead = seekhead_list->elem; char *buf; int64_t cues_start = -1, cues_end = -1, before_pos, bandwidth; int i; int end = 0; // det...
positive
int avresample_convert(AVAudioResampleContext *avr, void **output, int out_plane_size, int out_samples, void **input, int in_plane_size, int in_samples){ AudioData input_buffer; AudioData output_buffer; AudioData *current_buffer; int ret; /* reset internal buffers */ if (avr->in_buffer) { avr->in_buffer->nb_samples = 0...
positive
static ssize_t rtl8139_do_receive(VLANClientState *nc, const uint8_t *buf, size_t size_, int do_interrupt){ RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque; /* size is the length of the buffer passed to the driver */ int size = size_; const uint8_t *dot1q_buf = NULL; uint32_t packet_header = 0; uint8_t buf1[MIN_B...
positive
static void decode_mb(MadContext *t, int inter){ MpegEncContext *s = &t->s; int mv_map = 0; int mv_x, mv_y; int j; if (inter) { int v = decode210(&s->gb); if (v < 2) { mv_map = v ? get_bits(&s->gb, 6) : 63; mv_x = decode_motion(&s->gb); mv_y = decode_motion(&s->gb); } else { mv_map = 0; } } for (j=0; j<6; j++) { if (mv...
positive
static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_output){ DVBSubContext *ctx = avctx->priv_data; DVBSubRegionDisplay *display; DVBSubDisplayDefinition *display_def = ctx->display_definition; DVBSubRegion *region; AVSubtitleRect *rect; DVBSubCLUT *clut; uint32_t *clut_table; int i; int offse...
positive
static bool vexpress_cfgctrl_read(arm_sysctl_state *s, unsigned int dcc, unsigned int function, unsigned int site, unsigned int position, unsigned int device, uint32_t *val){ /* We don't support anything other than DCC 0, board stack position 0 * or sites other than motherboard/daughterboard: */ if (dcc != 0 || positio...
positive
static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value, int codingset){ GetBitContext *gb = &v->s.gb; int index, escape, run = 0, level = 0, lst = 0; index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3); if (index != vc1_ac_sizes[codingset] - 1) { run = vc1_index_decode_...
positive
static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic, int trellis_node, int x, int y, int mbs_per_slice, ProresThreadData *td){ ProresContext *ctx = avctx->priv_data; int i, q, pq, xp, yp; const uint16_t *src; int slice_width_factor = av_log2(mbs_per_slice); int num_cblocks[MAX_PLANES], pwidth; int pla...
positive
static void process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof){ int i; int repeating = 0; AVPacket avpkt; if (ist->next_dts == AV_NOPTS_VALUE) ist->next_dts = ist->last_dts; if (!pkt) { /* EOF handling */ av_init_packet(&avpkt); avpkt.data = NULL; avpkt.size = 0; } else { avpkt = *pkt; } if (pkt &&...
positive
static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size_t bufsize){int offset;int channels,freq,size;offset = is_adx(buf,bufsize);if (offset==0) return 0;channels = buf[7];freq = read_long(buf+8);size = read_long(buf+12);//printf("freq=%d ch=%d\n",freq,channels);avctx->sample_rate = freq;avctx-...
positive
uint32_t pci_default_read_config(PCIDevice *d, uint32_t address, int len){ uint32_t val; switch(len) { case 1: val = d->config[address]; break; case 2: val = le16_to_cpu(*(uint16_t *)(d->config + address)); break; default: case 4: val = le32_to_cpu(*(uint32_t *)(d->config + address)); break; } return val;}
positive
static QDict *qmp_check_input_obj(QObject *input_obj, Error **errp){ const QDictEntry *ent; int has_exec_key = 0; QDict *input_dict; if (qobject_type(input_obj) != QTYPE_QDICT) { error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "object"); return NULL; } input_dict = qobject_to_qdict(input_obj); for (ent = qdict_first(input_d...
positive
static void vmxnet3_rx_need_csum_calculate(struct NetRxPkt *pkt, const void *pkt_data, size_t pkt_len){ struct virtio_net_hdr *vhdr; bool isip4, isip6, istcp, isudp; uint8_t *data; int len; if (!net_rx_pkt_has_virt_hdr(pkt)) { return; } vhdr = net_rx_pkt_get_vhdr(pkt); if (!VMXNET_FLAG_IS_SET(vhdr->flags, VIRTIO_NET_HD...
negative
int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top){ float Lbuf[91][32][2]; float Rbuf[91][32][2]; const int len = 32; int is34 = ps->is34bands; top += NR_BANDS[is34] - 64; memset(ps->delay+top, 0, (NR_BANDS[is34] - top)*sizeof(ps->delay[0])); if (top < NR_ALLPASS_BAND...
negative
static void bl_intrp(EVRCContext *e, float *ex, float delay){ float *f; int offset, i, coef_idx; int16_t t; offset = lrintf(fabs(delay)); t = (offset - delay + 0.5) * 8.0 + 0.5; if (t == 8) { t = 0; offset--; } f = ex - offset - 8; coef_idx = t * (2 * 8 + 1); ex[0] = 0.0; for (i = 0; i < 2 * 8 + 1; i++) ex[0] += e->int...
positive
static av_always_inline void fic_idct(int16_t *blk, int step, int shift, int rnd){ const int t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step]; const int t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step]; const int t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step]; const int t3 = 6393 * blk[1 * step] - 32139 * blk[7 ...
positive
static int qemu_rdma_alloc_pd_cq(RDMAContext *rdma){ /* allocate pd */ rdma->pd = ibv_alloc_pd(rdma->verbs); if (!rdma->pd) { fprintf(stderr, "failed to allocate protection domain\n"); return -1; } /* create completion channel */ rdma->comp_channel = ibv_create_comp_channel(rdma->verbs); if (!rdma->comp_channel) { fpri...
positive
static void qobject_input_type_int64(Visitor *v, const char *name, int64_t *obj, Error **errp){ QObjectInputVisitor *qiv = to_qiv(v); QObject *qobj = qobject_input_get_object(qiv, name, true, errp); QInt *qint; if (!qobj) { return; } qint = qobject_to_qint(qobj); if (!qint) { error_setg(errp, QERR_INVALID_PARAMETER_TYP...
positive
static void xlnx_zynqmp_class_init(ObjectClass *oc, void *data){ DeviceClass *dc = DEVICE_CLASS(oc); dc->props = xlnx_zynqmp_props; dc->realize = xlnx_zynqmp_realize;}
positive
static target_ulong h_send_logical_lan(CPUPPCState *env, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args){ target_ulong reg = args[0]; target_ulong *bufs = args + 1; target_ulong continue_token = args[7]; VIOsPAPRDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); VIOsPAPRVLANDevice *dev = (VIOs...
positive
static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t size){ VirtIONet *n = qemu_get_nic_opaque(nc); VirtIONetQueue *q = virtio_net_get_subqueue(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE]; struct virtio_net_hdr_mrg_rxbuf mhdr; unsigned mhdr_cnt = 0; s...
positive
static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos){ int count = ffio_read_varlen(bc); int skip_start = 0; int skip_end = 0; int channels = 0; int64_t channel_layout = 0; int sample_rate = 0; int width = 0; int height = 0; int i, ret; for (i=0; i<count; i++) { uint8_...
positive
static uint32_t epic_decode_pixel_pred(ePICContext *dc, int x, int y, const uint32_t *curr_row, const uint32_t *above_row){ uint32_t N, W, NW, pred; unsigned delta; int GN, GW, GNW, R, G, B; if (x && y) { W = curr_row[x - 1]; N = above_row[x]; NW = above_row[x - 1]; GN = (N >> G_shift) & 0xFF; GW = (W >> G_shift) & 0xF...
positive
static USBDevice *usb_host_device_open_addr(int bus_num, int addr, const char *prod_name){ int fd = -1, ret; USBDevice *d = NULL; USBHostDevice *dev; struct usbdevfs_connectinfo ci; char buf[1024]; printf("husb: open device %d.%d\n", bus_num, addr); if (!usb_host_device_path) { perror("husb: USB Host Device Path not se...
positive
static int vp9_decode_frame(AVCodecContext *avctx, void *frame, int *got_frame, AVPacket *pkt){ const uint8_t *data = pkt->data; int size = pkt->size; VP9Context *s = avctx->priv_data; int ret, i, j, ref; int retain_segmap_ref = s->s.frames[REF_FRAME_SEGMAP].segmentation_map && (!s->s.h.segmentation.enabled || !s->s.h....
positive
static void ccid_card_vscard_send_msg(PassthruState *s, VSCMsgType type, uint32_t reader_id, const uint8_t *payload, uint32_t length){ VSCMsgHeader scr_msg_header; scr_msg_header.type = htonl(type); scr_msg_header.reader_id = htonl(reader_id); scr_msg_header.length = htonl(length); qemu_chr_fe_write(s->cs, (uint8_t *)&...
positive
static int kvmclock_post_load(void *opaque, int version_id){ KVMClockState *s = opaque; struct kvm_clock_data data; data.clock = s->clock; data.flags = 0; return kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data);}
positive
static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64){ TCGReg datalo, datahi, addrlo, rbase; TCGReg addrhi __attribute__((unused)); TCGMemOpIdx oi; TCGMemOp opc, s_bits;#ifdef CONFIG_SOFTMMU int mem_index; tcg_insn_unit *label_ptr;#endif datalo = *args++; datahi = (TCG_TARGET_REG_BITS == 32 && is_6...
positive
static int decode_dvd_subtitles(AVSubtitle *sub_header, const uint8_t *buf, int buf_size){ int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos; int big_offsets, offset_size, is_8bit = 0; const uint8_t *yuv_palette = 0; uint8_t colormap[4], alpha[256]; int date; int i; int is_menu = 0; if (buf_size < 1...
positive
int ff_vaapi_render_picture(struct vaapi_context *vactx, VASurfaceID surface){ VABufferID va_buffers[3]; unsigned int n_va_buffers = 0; vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id); va_buffers[n_va_buffers++] = vactx->pic_param_buf_id; if (vactx->iq_matrix_buf_id) { vaUnmapBuffer(vactx->display, vactx->iq_mat...
positive
static av_cold int xcbgrab_read_header(AVFormatContext *s){ XCBGrabContext *c = s->priv_data; int screen_num, ret; const xcb_setup_t *setup; char *host = s->filename[0] ? s->filename : NULL; const char *opts = strchr(s->filename, '+'); if (opts) { sscanf(opts, "%d,%d", &c->x, &c->y); host = av_strdup(s->filename); host...
positive
static int parse_pixel_format(AVCodecContext *avctx){ DDSContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; char buf[32]; uint32_t flags, fourcc, gimp_tag; enum DDSDXGIFormat dxgi; int size, bpp, r, g, b, a; int alpha_exponent, ycocg_classic, ycocg_scaled, normal_map, array; /* Alternative DDS implementa...
positive
static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum){ if (o->max*den < num*intnum || o->min*den > num*intnum) { av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range\n", num*intnum/den, o->name); return AVERROR(ERANGE); } switch (o->type) { case AV_OPT_TYPE...
positive
static uint64_t itc_tag_read(void *opaque, hwaddr addr, unsigned size){ MIPSITUState *tag = (MIPSITUState *)opaque; uint64_t index = addr >> 3; uint64_t ret = 0; switch (index) { case 0 ... ITC_ADDRESSMAP_NUM: ret = tag->ITCAddressMap[index]; break; default: qemu_log_mask(LOG_GUEST_ERROR, "Read 0x%" PRIx64 "\n", addr);...
positive
static int calc_add_mv(RV34DecContext *r, int dir, int val){ int mul = dir ? -r->mv_weight2 : r->mv_weight1; return (val * mul + 0x2000) >> 14;}
positive
static void put_line(uint8_t *dst, int size, int width, const int *runs){ PutBitContext pb; int run, mode = ~0, pix_left = width, run_idx = 0; init_put_bits(&pb, dst, size * 8); while (pix_left > 0) { run = runs[run_idx++]; mode = ~mode; pix_left -= run; for (; run > 16; run -= 16) put_sbits(&pb, 16, mode); if (run) pu...
negative
int ff_load_image(uint8_t *data[4], int linesize[4], int *w, int *h, enum PixelFormat *pix_fmt, const char *filename, void *log_ctx){ AVInputFormat *iformat = NULL; AVFormatContext *format_ctx; AVCodec *codec; AVCodecContext *codec_ctx; AVFrame *frame; int frame_decoded, ret = 0; AVPacket pkt; av_register_all(); iforma...
negative
void ff_vdpau_h264_picture_complete(MpegEncContext *s){ H264Context *h = s->avctx->priv_data; struct vdpau_render_state *render; int i; render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; assert(render); render->info.h264.slice_count = h->slice_num; if (render->info.h264.slice_count < 1) return; for ...
negative
static void flat_print_int(WriterContext *wctx, const char *key, long long int value){ flat_print_key_prefix(wctx); printf("%s=%lld\n", key, value);}
negative
void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size){ while (size > 0) { int len = FFMIN(f->end - f->wptr, size); memcpy(f->wptr, buf, len); f->wptr += len; if (f->wptr >= f->end) f->wptr = f->buffer; buf += len; size -= len; }}
negative
static int handle_packets(MpegTSContext *ts, int nb_packets){ AVFormatContext *s = ts->stream; uint8_t packet[TS_PACKET_SIZE]; int packet_num, ret = 0; if (avio_tell(s->pb) != ts->last_pos) { int i; av_dlog("Skipping after seek\n"); /* seek detected, flush pes buffer */ for (i = 0; i < NB_PID_MAX; i++) { if (ts->pids[i...
negative
void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { const int mb_xy= mb_x + mb_y*h->mb_stride; const int mb_type = h->cur_pic.mb_type[mb_xy]; const int mvy_limit = IS_INTERLACED(mb_type) ? 2 : 4; int first_vertic...
negative
DIRAC_PIXOP(put, ff_put, mmx)DIRAC_PIXOP(avg, ff_avg, mmx)DIRAC_PIXOP(avg, ff_avg, mmxext)void ff_put_dirac_pixels16_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h){ if (h&3) ff_put_dirac_pixels16_c(dst, src, stride, h); else ff_put_pixels16_sse2(dst, src[0], stride, h);}
negative
static CharDriverState *qemu_chr_open_spice_vmc(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp){ const char *type = backend->u.spicevmc->type; const char **psubtype = spice_server_char_device_recognized_subtypes(); for (; *psubtype != NULL; ++psubtype) { if (strcmp(type, *psubtype) == 0) { br...
negative
void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables){ GArray *table_offsets; unsigned facs, dsdt, rsdt; AcpiCpuInfo cpu; AcpiPmInfo pm; AcpiMiscInfo misc; AcpiMcfgInfo mcfg; PcPciInfo pci; uint8_t *u; acpi_get_cpu_info(&cpu); acpi_get_pm_info(&pm); acpi_get_dsdt(&misc); acpi_get_hotplug_info(&misc); acpi_g...
negative
static uint32_t xen_platform_ioport_readb(void *opaque, uint32_t addr){ addr &= 0xff; if (addr == 0) { return platform_fixed_ioport_readb(opaque, XEN_PLATFORM_IOPORT); } else { return ~0u; }}
negative
static ssize_t mp_pacl_getxattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size){ char buffer[PATH_MAX]; return lgetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value, size);}
negative
void ga_command_state_init(GAState *s, GACommandState *cs){ if (vss_init(true)) { ga_command_state_add(cs, NULL, guest_fsfreeze_cleanup); }}
negative
int ff_vaapi_commit_slices(FFVAContext *vactx){ VABufferID *slice_buf_ids; VABufferID slice_param_buf_id, slice_data_buf_id; if (vactx->slice_count == 0) return 0; slice_buf_ids = av_fast_realloc(vactx->slice_buf_ids, &vactx->slice_buf_ids_alloc, (vactx->n_slice_buf_ids + 2) * sizeof(slice_buf_ids[0])); if (!slice_buf_...
negative
static void dec_scall(DisasContext *dc){ TCGv t0; int l1; if (dc->imm5 == 7) { LOG_DIS("scall\n"); } else if (dc->imm5 == 2) { LOG_DIS("break\n"); } else { cpu_abort(dc->env, "invalid opcode\n"); } t0 = tcg_temp_new(); l1 = gen_new_label(); if (dc->imm5 == 7) { tcg_gen_movi_tl(cpu_pc, dc->pc); t_gen_raise_exception(dc,...
negative
static void slavio_check_interrupts(void *opaque){ CPUState *env; SLAVIO_INTCTLState *s = opaque; uint32_t pending = s->intregm_pending; unsigned int i, j, max = 0; pending &= ~s->intregm_disabled; if (pending && !(s->intregm_disabled & 0x80000000)) {for (i = 0; i < 32; i++) { if (pending & (1 << i)) {if (max < s->intb...
negative
static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom){ int size; char *path; void *ptr; char name[32]; const VMStateDescription *vmsd; if (!pdev->romfile) return 0; if (strlen(pdev->romfile) == 0) return 0; if (!pdev->rom_bar) { /* * Load rom via fw_cfg instead of creating a rom bar, * for 0.11 compatibil...
negative
static char *qemu_rbd_next_tok(int max_len, char *src, char delim, const char *name, char **p, Error **errp){ int l; char *end; *p = NULL; if (delim != '\0') { for (end = src; *end; ++end) { if (*end == delim) { break; } if (*end == '\\' && end[1] != '\0') { end++; } } if (*end == delim) { *p = end + 1; *end = '\0'; } ...
negative
static int protocol_client_vencrypt_auth(VncState *vs, uint8_t *data, size_t len){ int auth = read_u32(data, 0); if (auth != vs->vd->subauth) { VNC_DEBUG("Rejecting auth %d\n", auth); vnc_write_u8(vs, 0); /* Reject auth */ vnc_flush(vs); vnc_client_error(vs); } else { VNC_DEBUG("Accepting auth %d, setting up TLS for ha...
negative
int64_t qemu_strtosz_metric(const char *nptr, char **end){ return do_strtosz(nptr, end, 'B', 1000);}
negative
static int l2_load(BlockDriverState *bs, uint64_t l2_offset, uint64_t **l2_table){ BDRVQcow2State *s = bs->opaque; int ret; ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset, (void**) l2_table); return ret;}
negative
static int mjpeg_decode_init(AVCodecContext *avctx){ MJpegDecodeContext *s = avctx->priv_data; MpegEncContext s2; s->avctx = avctx; /* ugly way to get the idct & scantable */ memset(&s2, 0, sizeof(MpegEncContext)); s2.flags= avctx->flags; s2.avctx= avctx;// s2->out_format = FMT_MJPEG; s2.width = 8; s2.height = 8; if (M...
negative
static int pci_std_vga_initfn(PCIDevice *dev){ PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev); VGACommonState *s = &d->vga; /* vga + console init */ vga_common_init(s); vga_init(s, pci_address_space(dev), pci_address_space_io(dev), true); s->con = graphic_console_init(s->update, s->invalidate, s->screen_dump, s->tex...
negative
static int tosa_dac_recv(I2CSlave *s){ printf("%s: recv not supported!!!\n", __FUNCTION__); return -1;}
negative
static int waveformat_from_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as){ memset (wfx, 0, sizeof (*wfx)); wfx->wFormatTag = WAVE_FORMAT_PCM; wfx->nChannels = as->nchannels; wfx->nSamplesPerSec = as->freq; wfx->nAvgBytesPerSec = as->freq << (as->nchannels == 2); wfx->nBlockAlign = 1 << (as->nchannels == 2); wfx-...
negative
static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque){ return bdrv_aio_readv(bs->file, sector_num, qiov, nb_sectors, cb, opaque);}
negative
static int blk_mig_save_dirty_block(Monitor *mon, QEMUFile *f, int is_async){ BlkMigDevState *bmds; int ret = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (mig_save_device_dirty(mon, f, bmds, is_async) == 0) { ret = 1; break; } } return ret;}
negative
float64 float64_sqrt( float64 a STATUS_PARAM ){ flag aSign; int16 aExp, zExp; bits64 aSig, zSig, doubleZSig; bits64 rem0, rem1, term0, term1; aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); aSign = extractFloat64Sign( a ); if ( aExp == 0x7FF ) { if ( aSig ) return propagateFloat64NaN( a, a STATUS_VAR ); ...
negative
static int dynticks_start_timer(struct qemu_alarm_timer *t){ struct sigevent ev; timer_t host_timer; struct sigaction act; sigfillset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = host_alarm_handler; sigaction(SIGALRM, &act, NULL); /* * Initialize ev struct to 0 to avoid valgrind complaining * about uninitialized d...
negative
void sysbus_register_withprop(SysBusDeviceInfo *info){ info->qdev.init = sysbus_device_init; info->qdev.bus_type = BUS_TYPE_SYSTEM; assert(info->qdev.size >= sizeof(SysBusDevice)); qdev_register(&info->qdev);}
negative
int qemu_timer_expired(QEMUTimer *timer_head, int64_t current_time){ if (!timer_head) return 0; return (timer_head->expire_time <= current_time);}
negative
static int cbs_read_se_golomb(CodedBitstreamContext *ctx, BitstreamContext *bc, const char *name, int32_t *write_to, int32_t range_min, int32_t range_max){ int32_t value; int position; if (ctx->trace_enable) { char bits[65]; uint32_t v; unsigned int k; int i, j; position = bitstream_tell(bc); for (i = 0; i < 32; i++) {...
negative
void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx){ /* test if maximum index reached */ if (index & 0x80000000) { if (index > env->cpuid_xlevel) index = env->cpuid_level; } else { if (index > env->cpuid_level) index = env->cpuid_level; } switch(index) { case...
negative
static uint32_t isa_mmio_readl(void *opaque, target_phys_addr_t addr){ return cpu_inl(addr & IOPORTS_MASK);}
negative
static always_inline int _pte_check (mmu_ctx_t *ctx, int is_64b, target_ulong pte0, target_ulong pte1, int h, int rw){ target_ulong ptem, mmask; int access, ret, pteh, ptev; access = 0; ret = -1; /* Check validity and table match */#if defined(TARGET_PPC64) if (is_64b) { ptev = pte64_is_valid(pte0); pteh = (pte0 >> 1) ...
negative
void qmp_block_job_resume(const char *device, Error **errp){ BlockJob *job = find_block_job(device); if (!job) { error_set(errp, QERR_BLOCK_JOB_NOT_ACTIVE, device); return; } trace_qmp_block_job_resume(job); block_job_resume(job);}
negative
int AUD_write (SWVoiceOut *sw, void *buf, int size){ int bytes; if (!sw) { /* XXX: Consider options */ return size; } if (!sw->hw->enabled) { dolog ("Writing to disabled voice %s\n", SW_NAME (sw)); return 0; } bytes = sw->hw->pcm_ops->write (sw, buf, size); return bytes;}
negative
static void option_rom_setup_reset(target_phys_addr_t addr, unsigned size){ RomResetData *rrd = qemu_malloc(sizeof *rrd); rrd->data = qemu_malloc(size); cpu_physical_memory_read(addr, rrd->data, size); rrd->addr = addr; rrd->size = size; qemu_register_reset(option_rom_reset, rrd);}
negative
static uint32_t drc_unisolate_physical(sPAPRDRConnector *drc){ /* cannot unisolate a non-existent resource, and, or resources * which are in an 'UNUSABLE' allocation state. (PAPR 2.7, * 13.5.3.5) */ if (!drc->dev) { return RTAS_OUT_NO_SUCH_INDICATOR; } drc->isolation_state = SPAPR_DR_ISOLATION_STATE_UNISOLATED; return ...
negative
static void monitor_command_cb(Monitor *mon, const char *cmdline, void *opaque){ monitor_suspend(mon); handle_user_command(mon, cmdline); monitor_resume(mon);}
positive
static void dct_unquantize_mpeg1_c(MpegEncContext *s, DCTELEM *block, int n, int qscale){ int i, level, nCoeffs; const UINT16 *quant_matrix; if(s->alternate_scan) nCoeffs= 64; else nCoeffs= s->block_last_index[n]+1; if (s->mb_intra) { if (n < 4) block[0] = block[0] * s->y_dc_scale; else block[0] = block[0] * s->c_dc_sc...
positive
static void balloon_stats_get_all(Object *obj, struct Visitor *v, void *opaque, const char *name, Error **errp){ Error *err = NULL; VirtIOBalloon *s = opaque; int i; if (!s->stats_last_update) { error_setg(errp, "guest hasn't updated any stats yet"); return; } visit_start_struct(v, NULL, "guest-stats", name, 0, &err); ...
positive
void qemuio_add_command(const cmdinfo_t *ci){ cmdtab = g_realloc(cmdtab, ++ncmds * sizeof(*cmdtab)); cmdtab[ncmds - 1] = *ci; qsort(cmdtab, ncmds, sizeof(*cmdtab), compare_cmdname);}
positive
static void max_x86_cpu_initfn(Object *obj){ X86CPU *cpu = X86_CPU(obj); CPUX86State *env = &cpu->env; KVMState *s = kvm_state; /* We can't fill the features array here because we don't know yet if * "migratable" is true or false. */ cpu->max_features = true; if (kvm_enabled()) { X86CPUDefinition host_cpudef = { }; uin...
positive
static int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vdev){ struct vfio_device_info dev_info = { .argsz = sizeof(dev_info) }; struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) }; int ret, i; ret = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, name); if (ret < 0) { error_report("vfio: err...
positive
static int parse_inputs(const char **buf, AVFilterInOut **currInputs, AVFilterInOut **openLinks, AVClass *log_ctx){ int pad = 0; while(**buf == '[') { char *name = parse_link_name(buf, log_ctx); AVFilterInOut *match; if(!name) return -1; /* First check if the label is not in the openLinks list */ match = extract_inout(...
positive
static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, Error **errp){ const char *buf; int bdrv_flags = 0; int on_read_error, on_write_error; BlockBackend *blk; BlockDriverState *bs; ThrottleConfig cfg; int snapshot = 0; Error *error = NULL; QemuOpts *opts; const char *id; bool has_driver_specific_opts; B...
positive
static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in){ AVFilterContext *last_filter; const AVFilter *buffer_filt = avfilter_get_by_name("buffer"); InputStream *ist = ifilter->ist; InputFile *f = input_files[ist->file_index]; AVRational tb = ist->framerate.num ? av_inv_q(ist->...
positive
static void do_video_stats(OutputStream *ost, int frame_size){ AVCodecContext *enc; int frame_number; double ti1, bitrate, avg_bitrate; /* this is executed just the first time do_video_stats is called */ if (!vstats_file) { vstats_file = fopen(vstats_filename, "w"); if (!vstats_file) { perror("fopen"); exit(1); } } enc...
positive
void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb, int mb_x, int mb_y){ AVCodecContext *avctx = s->avctx; int x, y, mode, nnz, tr; // for the first row, we need to run xchg_mb_border to init the top edge to 127 // otherwise, skip it if we aren't going to deblock if (!(avctx->flags & CODEC_FLAG_EMU_ED...
positive
Aml *aml_buffer(void){ Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER); return var;}
positive
static hwaddr ppc_hash64_pteg_search(PowerPCCPU *cpu, hwaddr hash, ppc_slb_t *slb, target_ulong ptem, ppc_hash_pte64_t *pte){ CPUPPCState *env = &cpu->env; int i; uint64_t token; target_ulong pte0, pte1; target_ulong pte_index; pte_index = (hash & env->htab_mask) * HPTES_PER_GROUP; token = ppc_hash64_start_access(cpu, ...
positive
static int qxl_init_common(PCIQXLDevice *qxl){ uint8_t* config = qxl->pci.config; uint32_t pci_device_rev; uint32_t io_size; qxl->mode = QXL_MODE_UNDEFINED; qxl->generation = 1; qxl->num_memslots = NUM_MEMSLOTS; qemu_mutex_init(&qxl->track_lock); qemu_mutex_init(&qxl->async_lock); qxl->current_async = QXL_UNDEFINED_IO;...
positive
static void create_header64(DumpState *s, Error **errp){ DiskDumpHeader64 *dh = NULL; KdumpSubHeader64 *kh = NULL; size_t size; uint32_t block_size; uint32_t sub_hdr_size; uint32_t bitmap_blocks; uint32_t status = 0; uint64_t offset_note; Error *local_err = NULL; /* write common header, the version of kdump-compressed ...
positive
static void test_rtas_get_time_of_day(void){ QOSState *qs; struct tm tm; uint32_t ns; uint64_t ret; time_t t1, t2; qs = qtest_spapr_boot("-machine pseries"); g_assert(qs != NULL); t1 = time(NULL); ret = qrtas_get_time_of_day(qs->alloc, &tm, &ns); g_assert_cmpint(ret, ==, 0); t2 = mktimegm(&tm); g_assert(t2 - t1 < 5); /...
positive
int qemu_opts_set(QemuOptsList *list, const char *id, const char *name, const char *value){ QemuOpts *opts; opts = qemu_opts_create(list, id, 1); if (opts == NULL) { return -1; } return qemu_opt_set(opts, name, value);}
positive
static int parse_icy(HTTPContext *s, const char *tag, const char *p){ int len = 4 + strlen(p) + strlen(tag); int is_first = !s->icy_metadata_headers; int ret; if (s->icy_metadata_headers) len += strlen(s->icy_metadata_headers); if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) return ret; av_strlcatf(s->icy_m...
positive
static av_cold void decode_init_vlc(void){ static int done = 0; if (!done) { int i; done = 1; init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5, &chroma_dc_coeff_token_len [0], 1, 1, &chroma_dc_coeff_token_bits[0], 1, 1, 1); for(i=0; i<4; i++){ init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, ...
positive
static USBDevice *usb_serial_init(USBBus *bus, const char *filename){ USBDevice *dev; CharDriverState *cdrv; uint32_t vendorid = 0, productid = 0; char label[32]; static int index; while (*filename && *filename != ':') { const char *p; char *e; if (strstart(filename, "vendorid=", &p)) { vendorid = strtol(p, &e, 16); if...