instruction
stringclasses
1 value
output
stringclasses
2 values
input
stringlengths
21
96.3k
negative
void parse_options(int argc, char **argv, const OptionDef *options, void (* parse_arg_function)(const char*)){ const char *opt, *arg; int optindex, handleoptions=1; const OptionDef *po; /* parse options */ optindex = 1; while (optindex < argc) { opt = argv[optindex++]; if (handleoptions && opt[0] == '-' && opt[1] != '\...
negative
static int dma_buf_rw(BMDMAState *bm, int is_write){ IDEState *s = bmdma_active_if(bm); struct { uint32_t addr; uint32_t size; } prd; int l, len; for(;;) { l = s->io_buffer_size - s->io_buffer_index; if (l <= 0) break; if (bm->cur_prd_len == 0) { /* end of table (with a fail safe of one page) */ if (bm->cur_prd_last ||...
negative
static void eepro100_cu_command(EEPRO100State * s, uint8_t val){ eepro100_tx_t tx; uint32_t cb_address; switch (val) { case CU_NOP: /* No operation. */ break; case CU_START: if (get_cu_state(s) != cu_idle) { /* Intel documentation says that CU must be idle for the CU * start command. Intel driver for Linux also starts ...
negative
void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val){ int op1; int op2; int crm; op1 = (insn >> 21) & 7; op2 = (insn >> 5) & 7; crm = insn & 0xf; switch ((insn >> 16) & 0xf) { case 0: /* ID codes. */ if (arm_feature(env, ARM_FEATURE_XSCALE)) break; if (arm_feature(env, ARM_FEATURE_OMAPCP)) break; if (arm_f...
negative
static void pci_pcnet_cleanup(NetClientState *nc){ PCNetState *d = qemu_get_nic_opaque(nc); pcnet_common_cleanup(d);}
negative
static void gen_mulo(DisasContext *ctx){ int l1 = gen_new_label(); TCGv_i64 t0 = tcg_temp_new_i64(); TCGv_i64 t1 = tcg_temp_new_i64(); TCGv t2 = tcg_temp_new(); /* Start with XER OV disabled, the most likely case */ tcg_gen_movi_tl(cpu_ov, 0); tcg_gen_extu_tl_i64(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_extu_tl_i64(t1, c...
negative
static void test_source_flush_event_notifier(void){ EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true }; event_notifier_init(&data.e, false); aio_set_event_notifier(ctx, &data.e, event_ready_cb); g_assert(g_main_context_iteration(NULL, false)); g_assert_cmpint(data.n, ==, 0); g_assert_cmpint(data.ac...
negative
uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg){ uint32_t mask; unsigned el = arm_current_el(env); /* First handle registers which unprivileged can read */ switch (reg) { case 0 ... 7: /* xPSR sub-fields */ mask = 0; if ((reg & 1) && el) { mask |= XPSR_EXCP; /* IPSR (unpriv. reads as zero) */ } if (!(reg & 4))...
negative
static void usbredir_control_packet(void *priv, uint32_t id, struct usb_redir_control_packet_header *control_packet, uint8_t *data, int data_len){ USBRedirDevice *dev = priv; int len = control_packet->length; AsyncURB *aurb; DPRINTF("ctrl-in status %d len %d id %u\n", control_packet->status, len, id); aurb = async_find...
negative
static int qemu_paio_submit(struct qemu_paiocb *aiocb, int is_write){ aiocb->is_write = is_write; aiocb->ret = -EINPROGRESS; aiocb->active = 0; mutex_lock(&lock); if (idle_threads == 0 && cur_threads < max_threads) spawn_thread(); TAILQ_INSERT_TAIL(&request_list, aiocb, node); mutex_unlock(&lock); cond_broadcast(&cond)...
negative
static void input_linux_event_keyboard(void *opaque){ InputLinux *il = opaque; struct input_event event; int rc; for (;;) { rc = read(il->fd, &event, sizeof(event)); if (rc != sizeof(event)) { if (rc < 0 && errno != EAGAIN) { fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno)); qemu_set_fd_handler(il->fd, NULL...
positive
static void v9fs_create(void *opaque){ int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat stbuf; V9fsString name; V9fsString extension; int iounit; V9fsPDU *pdu = opaque; v9fs_path_init(&path); pdu_unmarshal(pdu, offset, "dsdbs", &fid, &na...
positive
static int gen_neon_unzip(int rd, int rm, int size, int q){ TCGv tmp, tmp2; if (size == 3 || (!q && size == 2)) { return 1; } tmp = tcg_const_i32(rd); tmp2 = tcg_const_i32(rm); if (q) { switch (size) { case 0: gen_helper_neon_qunzip8(tmp, tmp2); break; case 1: gen_helper_neon_qunzip16(tmp, tmp2); break; case 2: gen_hel...
positive
static void gen_wait(DisasContext *ctx){ TCGv_i32 t0 = tcg_temp_new_i32(); tcg_gen_st_i32(t0, cpu_env, -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); tcg_temp_free_i32(t0); /* Stop translation, as the CPU is supposed to sleep from now */ gen_exception_err(ctx, EXCP_HLT, 1);}
positive
GuestExec *qmp_guest_exec(const char *path, bool has_arg, strList *arg, bool has_env, strList *env, bool has_input_data, const char *input_data, bool has_capture_output, bool capture_output, Error **err){ GPid pid; GuestExec *ge = NULL; GuestExecInfo *gei; char **argv, **envp; strList arglist; gboolean ret; GError *ger...
negative
static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat){ __asm__ volatile( "movq 24(%4), %%mm6 \n\t" "mov %3, %%"REG_a" \n\t" "pxor %%mm7, %%mm7 \n\t" "1: \n\t" PREFETCH" 64(%0) \n\t" "movd (%0), %%mm0 \n\t" "movd 2(%0), %%mm1 \n\t" "punpcklbw %...
positive
void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], VP8Macroblock *mb, int mb_x, int mb_y){ int x, y, mode, nnz; uint32_t 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 (mb_y && (s->deblock_filter || !mb_y) &...
positive
static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b, int is_arith){ int cb_x, cb_y, left, right, top, bottom; DiracArith c; GetBitContext gb; int cb_width = s->codeblock[b->level + (b->orientation != subband_ll)].width; int cb_height = s->codeblock[b->level + (b->orientation != subband_ll)]...
positive
static inline void RENAME(yuv2rgb2)(uint16_t *buf0, uint16_t *buf1, uint16_t *uvbuf0, uint16_t *uvbuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int dstbpp){int yalpha1=yalpha^4095;int uvalpha1=uvalpha^4095;if(fullUVIpol){#ifdef HAVE_MMXif(dstbpp == 32){asm volatile(FULL_YSCALEYUV2RGB"punpcklbw %%mm1, %%mm3\n\...
positive
static int wavpack_encode_block(WavPackEncodeContext *s, int32_t *samples_l, int32_t *samples_r, uint8_t *out, int out_size){ int block_size, start, end, data_size, tcount, temp, m = 0; int i, j, ret, got_extra = 0, nb_samples = s->block_samples; uint32_t crc = 0xffffffffu; struct Decorr *dpp; PutByteContext pb; if (!(...
positive
static void qemu_laio_process_completion(struct qemu_laio_state *s, struct qemu_laiocb *laiocb){ int ret; s->count--; ret = laiocb->ret; if (ret != -ECANCELED) { if (ret == laiocb->nbytes) ret = 0; else if (ret >= 0) ret = -EINVAL; laiocb->common.cb(laiocb->common.opaque, ret); } qemu_aio_release(laiocb);}
positive
void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg){ *cfg = ts->cfg;
positive
vreader_xfr_bytes(VReader *reader, unsigned char *send_buf, int send_buf_len, unsigned char *receive_buf, int *receive_buf_len){ VCardAPDU *apdu; VCardResponse *response = NULL; VCardStatus card_status; unsigned short status; VCard *card = vreader_get_card(reader); if (card == NULL) { return VREADER_NO_CARD; } apdu = v...
positive
static int tsc210x_load(QEMUFile *f, void *opaque, int version_id){ TSC210xState *s = (TSC210xState *) opaque; int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); int i; s->x = qemu_get_be16(f); s->y = qemu_get_be16(f); s->pressure = qemu_get_byte(f); s->state = qemu_get_byte(f); s->page = qemu_get_byte(f); s->offset ...
positive
static uint16_t eepro100_read2(EEPRO100State * s, uint32_t addr){ uint16_t val; if (addr <= sizeof(s->mem) - sizeof(val)) { memcpy(&val, &s->mem[addr], sizeof(val)); } switch (addr) { case SCBStatus: case SCBCmd: TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val)); break; case SCBeeprom: val = eepro100_rea...
positive
static int disas_cp15_insn(CPUState *env, DisasContext *s, uint32_t insn){ uint32_t rd; TCGv tmp, tmp2; /* M profile cores use memory mapped registers instead of cp15. */ if (arm_feature(env, ARM_FEATURE_M))return 1; if ((insn & (1 << 25)) == 0) { if (insn & (1 << 20)) { /* mrrc */ return 1; } /* mcrr. Used for block c...
positive
static int asf_write_packet(AVFormatContext *s, AVPacket *pkt){ ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; ASFStream *stream; AVCodecContext *codec; uint32_t packet_number; int64_t pts; int start_sec; int flags = pkt->flags; int ret; uint64_t offset = avio_tell(pb); codec = s->streams[pkt->stream_index]->...
positive
static void pl181_class_init(ObjectClass *klass, void *data){ SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *k = DEVICE_CLASS(klass); sdc->init = pl181_init; k->vmsd = &vmstate_pl181; k->reset = pl181_reset; k->no_user = 1;}
positive
static void ahci_start_transfer(IDEDMA *dma){ AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; uint32_t size = (uint32_t)(s->data_end - s->data_ptr); /* write == ram -> device */ uint16_t opts = le16_to_cpu(ad->cur_cmd->opts); int is_write = opts & AHCI_CMD_WRITE; int is_atapi = opts & ...
positive
void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d){ qemu_irq *irq; if (bus->dma == &bm->dma) { return; } bm->dma.ops = &bmdma_ops; bus->dma = &bm->dma; bm->irq = bus->irq; irq = qemu_allocate_irqs(bmdma_irq, bm, 1); bus->irq = *irq; bm->pci_dev = d;}
positive
static void qemu_tcg_wait_io_event(void){ CPUState *env; while (all_cpu_threads_idle()) { /* Start accounting real time to the virtual clock if the CPUs are idle. */ qemu_clock_warp(vm_clock); qemu_cond_wait(tcg_halt_cond, &qemu_global_mutex); } qemu_mutex_unlock(&qemu_global_mutex); /* * Users of qemu_global_mutex can...
positive
void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input){ int i, j, n, n8, n4, n2, n3; FFTDouble re, im; const uint16_t *revtab = s->revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; FFTComplex *x = (FFTComplex *)out; n = 1 << s->mdct_bits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3...
positive
int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags){ BlockDriverState *bs; int ret; bs = bdrv_new(""); if (!bs) return -ENOMEM; ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, NULL); if (ret < 0) { bdrv_delete(bs); return ret; } *pbs = bs; return 0;}
positive
static int sdp_parse_fmtp_config_h264(AVStream * stream, PayloadContext * h264_data, char *attr, char *value){ AVCodecContext *codec = stream->codec; assert(codec->codec_id == CODEC_ID_H264); assert(h264_data != NULL); if (!strcmp(attr, "packetization-mode")) { av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n"...
positive
void qpci_io_writeq(QPCIDevice *dev, void *data, uint64_t value){ uintptr_t addr = (uintptr_t)data; if (addr < QPCI_PIO_LIMIT) { dev->bus->pio_writeq(dev->bus, addr, value); } else { value = cpu_to_le64(value); dev->bus->memwrite(dev->bus, addr, &value, sizeof(value)); }}
positive
static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags, abi_ulong target_addr, socklen_t addrlen){ void *addr; void *host_msg; abi_long ret; if ((int)addrlen < 0) { return -TARGET_EINVAL; } host_msg = lock_user(VERIFY_READ, msg, len, 1); if (!host_msg) return -TARGET_EFAULT; if (fd_trans_target_to_host_...
positive
static int vscsi_srp_direct_data(VSCSIState *s, vscsi_req *req, uint8_t *buf, uint32_t len){ struct srp_direct_buf *md = req->cur_desc; uint32_t llen; int rc; dprintf("VSCSI: direct segment 0x%x bytes, va=0x%llx desc len=0x%x\n", len, (unsigned long long)md->va, md->len); llen = MIN(len, md->len); if (llen) { if (req->...
positive
static inline void flash_sync_area(Flash *s, int64_t off, int64_t len){ QEMUIOVector *iov = g_new(QEMUIOVector, 1); if (!s->blk || blk_is_read_only(s->blk)) { return; } assert(!(len % BDRV_SECTOR_SIZE)); qemu_iovec_init(iov, 1); qemu_iovec_add(iov, s->storage + off, len); blk_aio_pwritev(s->blk, off, iov, 0, blk_sync_c...
positive
static void gdb_vm_stopped(void *opaque, int reason){ GDBState *s = opaque; char buf[256]; int ret; if (s->state == RS_SYSCALL) /* disable single step if it was enable */ cpu_single_step(s->env, 0); if (reason == EXCP_DEBUG) {tb_flush(s->env); ret = SIGTRAP; } else if (reason == EXCP_INTERRUPT) { ret = SIGINT; } else {...
positive
void main_loop_wait(int timeout){ IOHandlerRecord *ioh; fd_set rfds, wfds, xfds; int ret, nfds;#ifdef _WIN32 int ret2, i;#endif struct timeval tv; PollingEntry *pe; /* XXX: need to suppress polling by better using win32 events */ ret = 0; for(pe = first_polling_entry; pe != NULL; pe = pe->next) { ret |= pe->func(pe->op...
positive
static int buf_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, int size){ QEMUBuffer *s = opaque; return qsb_write_at(s->qsb, buf, pos, size);}
positive
static void mv88w8618_eth_write(void *opaque, hwaddr offset, uint64_t value, unsigned size){ mv88w8618_eth_state *s = opaque; switch (offset) { case MP_ETH_SMIR: s->smir = value; break; case MP_ETH_PCXR: s->vlan_header = ((value >> MP_ETH_PCXR_2BSM_BIT) & 1) * 2; break; case MP_ETH_SDCMR: if (value & MP_ETH_CMD_TXHI) {...
positive
static int config_props(AVFilterLink *inlink){ FadeContext *s = inlink->dst->priv; const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(inlink->format); s->hsub = pixdesc->log2_chroma_w; s->vsub = pixdesc->log2_chroma_h; s->bpp = av_get_bits_per_pixel(pixdesc) >> 3; s->alpha &= !!(pixdesc->flags & AV_PIX_FMT_FLAG_AL...
positive
static void gen_msa(CPUMIPSState *env, DisasContext *ctx){ uint32_t opcode = ctx->opcode; check_insn(ctx, ASE_MSA); check_msa_access(ctx); switch (MASK_MSA_MINOR(opcode)) { case OPC_MSA_I8_00: case OPC_MSA_I8_01: case OPC_MSA_I8_02: gen_msa_i8(env, ctx); break; case OPC_MSA_I5_06: case OPC_MSA_I5_07: gen_msa_i5(env, ct...
positive
static BlockAIOCB *read_fifo_child(QuorumAIOCB *acb){ BDRVQuorumState *s = acb->common.bs->opaque; acb->qcrs[acb->child_iter].buf = qemu_blockalign(s->children[acb->child_iter]->bs, acb->qiov->size); qemu_iovec_init(&acb->qcrs[acb->child_iter].qiov, acb->qiov->niov); qemu_iovec_clone(&acb->qcrs[acb->child_iter].qiov, a...
positive
static void qmp_monitor_complete(void *opaque, QObject *ret_data){ monitor_protocol_emitter(opaque, ret_data);}
positive
static int old_codec37(SANMVideoContext *ctx, int top, int left, int width, int height){ int stride = ctx->pitch; int i, j, k, t; int skip_run = 0; int compr, mvoff, seq, flags; uint32_t decoded_size; uint8_t *dst, *prev; compr = bytestream2_get_byte(&ctx->gb); mvoff = bytestream2_get_byte(&ctx->gb); seq = bytestream2_...
positive
static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool *rebuild, void **refcount_table, int64_t *nb_clusters){ BDRVQcow2State *s = bs->opaque; int64_t i; QCowSnapshot *sn; int ret; if (!*refcount_table) { int64_t old_size = 0; ret = realloc_refcount_array(s, refcount_table, &...
positive
static uint64_t calc_rice_params(RiceContext *rc, uint32_t udata[FLAC_MAX_BLOCKSIZE], uint64_t sums[32][MAX_PARTITIONS], int pmin, int pmax, const int32_t *data, int n, int pred_order, int exact){ int i; uint64_t bits[MAX_PARTITION_ORDER+1]; int opt_porder; RiceContext tmp_rc; int kmax = (1 << rc->coding_mode) - 2; av_...
positive
static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp){ MemoryRegion *mr = host_memory_backend_get_memory(dimm->hostmem, errp); NVDIMMDevice *nvdimm = NVDIMM(dimm); uint64_t align, pmem_size, size = memory_region_size(mr); align = memory_region_get_alignment(mr); pmem_size = size - nvdimm->label_size; nvdimm->lab...
positive
ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff){ ReSampleContext *s; if (input_channels > MAX_CHANNELS) { av_log(NU...
positive
static void gen_sync(DisasContext *ctx){ uint32_t l = (ctx->opcode >> 21) & 3; /* * We may need to check for a pending TLB flush. * * We do this on ptesync (l == 2) on ppc64 and any sync pn ppc32. * * Additionally, this can only happen in kernel mode however so * check MSR_PR as well. */ if (((l == 2) || !(ctx->insns_f...
positive
static int qcrypto_ivgen_essiv_calculate(QCryptoIVGen *ivgen, uint64_t sector, uint8_t *iv, size_t niv, Error **errp){ QCryptoIVGenESSIV *essiv = ivgen->private; size_t ndata = qcrypto_cipher_get_block_len(ivgen->cipher); uint8_t *data = g_new(uint8_t, ndata); sector = cpu_to_le64(sector); memcpy(data, (uint8_t *)&sect...
positive
void ff_nut_free_sp(NUTContext *nut){ av_tree_enumerate(nut->syncpoints, NULL, NULL, enu_free); av_tree_destroy(nut->syncpoints);}
positive
static void memory_region_oldmmio_write_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask){ uint64_t tmp; tmp = (*value >> shift) & mask; trace_memory_region_ops_write(mr, addr, tmp, size); mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp);}
positive
static void scsi_cmd_xfer_mode(SCSICommand *cmd){ if (!cmd->xfer) { cmd->mode = SCSI_XFER_NONE; return; } switch (cmd->buf[0]) { case WRITE_6: case WRITE_10: case WRITE_VERIFY_10: case WRITE_12: case WRITE_VERIFY_12: case WRITE_16: case WRITE_VERIFY_16: case COPY: case COPY_VERIFY: case COMPARE: case CHANGE_DEFINITION:...
positive
static void test_visitor_in_union_flat(TestInputVisitorData *data, const void *unused){ Visitor *v; UserDefFlatUnion *tmp; UserDefUnionBase *base; v = visitor_input_test_init(data, "{ 'enum1': 'value1', " "'integer': 41, " "'string': 'str', " "'boolean': true }"); visit_type_UserDefFlatUnion(v, NULL, &tmp, &error_abort...
positive
static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap){ AVIOContext *pb = s->pb; APEContext *ape = s->priv_data; AVStream *st; uint32_t tag; int i; int total_blocks; int64_t pts; /* TODO: Skip any leading junk such as id3v2 tags */ ape->junklength = 0; tag = avio_rl32(pb); if (tag != MKTAG('M', 'A', '...
positive
static int buf_close(void *opaque){ QEMUBuffer *s = opaque; qsb_free(s->qsb); g_free(s); return 0;}
positive
static const struct URLProtocol *url_find_protocol(const char *filename){ const URLProtocol **protocols; char proto_str[128], proto_nested[128], *ptr; size_t proto_len = strspn(filename, URL_SCHEME_CHARS); int i; if (filename[proto_len] != ':' && (strncmp(filename, "subfile,", 8) || !strchr(filename + proto_len + 1, ':...
positive
void qmp_nbd_server_stop(Error **errp){ while (!QTAILQ_EMPTY(&close_notifiers)) { NBDCloseNotifier *cn = QTAILQ_FIRST(&close_notifiers); nbd_close_notifier(&cn->n, nbd_export_get_blockdev(cn->exp)); } qemu_set_fd_handler2(server_fd, NULL, NULL, NULL, NULL); close(server_fd); server_fd = -1;}
positive
int arm_reset_cpu(uint64_t cpuid){ CPUState *target_cpu_state; ARMCPU *target_cpu; DPRINTF("cpu %" PRId64 "\n", cpuid); /* change to the cpu we are resetting */ target_cpu_state = arm_get_cpu_by_id(cpuid); if (!target_cpu_state) { return QEMU_ARM_POWERCTL_INVALID_PARAM; } target_cpu = ARM_CPU(target_cpu_state); if (tar...
positive
static void postprocess_chroma(AVFrame *frame, int w, int h, int depth){ uint16_t *dstu = (uint16_t *)frame->data[1]; uint16_t *dstv = (uint16_t *)frame->data[2]; int16_t *srcu = (int16_t *)frame->data[1]; int16_t *srcv = (int16_t *)frame->data[2]; ptrdiff_t strideu = frame->linesize[1] / 2; ptrdiff_t stridev = frame->...
negative
static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags, ID3v2ExtraMeta **extra_meta){ int isv34, tlen, unsync; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; AVIOContext *pbx; unsigned char *buffer = NULL; int buffer_size =...
positive
static int ehci_state_fetchqtd(EHCIQueue *q){ EHCIqtd qtd; EHCIPacket *p; int again = 0; get_dwords(q->ehci, NLPTR_GET(q->qtdaddr), (uint32_t *) &qtd, sizeof(EHCIqtd) >> 2); ehci_trace_qtd(q, NLPTR_GET(q->qtdaddr), &qtd); p = QTAILQ_FIRST(&q->packets); if (p != NULL) { if (p->qtdaddr != q->qtdaddr || (!NLPTR_TBIT(p->qt...
negative
static av_always_inline int encode_line(FFV1Context *s, int w, int16_t *sample[3], int plane_index, int bits){ PlaneContext *const p = &s->plane[plane_index]; RangeCoder *const c = &s->c; int x; int run_index = s->run_index; int run_count = 0; int run_mode = 0; if (s->ac) { if (c->bytestream_end - c->bytestream < w * 2...
positive
static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t *buf, int buf_size){ struct Mp4vParseContext *pc = s1->priv_data; Mpeg4DecContext *dec_ctx = &pc->dec_ctx; MpegEncContext *s = &dec_ctx->m; GetBitContext gb1, *gb = &gb1; int ret; s->avctx = avctx; s->current_picture_ptr = &s-...
positive
void vnc_tls_client_cleanup(VncState *vs){ if (vs->tls.session) { gnutls_deinit(vs->tls.session); vs->tls.session = NULL; } g_free(vs->tls.dname);}
positive
void colo_do_failover(MigrationState *s){ /* Make sure VM stopped while failover happened. */ if (!colo_runstate_is_stopped()) { vm_stop_force_state(RUN_STATE_COLO); } if (get_colo_mode() == COLO_MODE_PRIMARY) { primary_vm_do_failover(); }}
positive
static void test_validate_union_flat(TestInputVisitorData *data, const void *unused){ UserDefFlatUnion *tmp = NULL; Visitor *v; Error *err = NULL; v = validate_test_init(data, "{ 'enum1': 'value1', " "'string': 'str', " "'boolean': true }"); /* TODO when generator bug is fixed, add 'integer': 41 */ visit_type_UserDefFl...
positive
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,long width, long height,long lumStride, long chromStride, long dstStride, long vertLumPerChroma){long y;const long chromWidth= width>>1;for(y=0; y<height; y++){#ifdef HAVE_MMX//FIXME handle 2 lines a o...
positive
int target_munmap(target_ulong start, target_ulong len){ target_ulong end, real_start, real_end, addr; int prot, ret;#ifdef DEBUG_MMAP printf("munmap: start=0x%lx len=0x%lx\n", start, len);#endif if (start & ~TARGET_PAGE_MASK) return -EINVAL; len = TARGET_PAGE_ALIGN(len); if (len == 0) return -EINVAL; end = start + len...
positive
int cpu_exec(CPUState *env){ int ret, interrupt_request; TranslationBlock *tb; uint8_t *tc_ptr; unsigned long next_tb; if (env->halted) { if (!cpu_has_work(env)) { return EXCP_HALTED; } env->halted = 0; } cpu_single_env = env; if (unlikely(exit_request)) { env->exit_request = 1; }#if defined(TARGET_I386) /* put eflags ...
negative
callback(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time){ AVFormatContext *s = priv_data; struct dshow_ctx *ctx = s->priv_data; AVPacketList **ppktl, *pktl_next;// dump_videohdr(s, vdhdr); WaitForSingleObject(ctx->mutex, INFINITE); if(shall_we_drop(s)) goto fail; pktl_next = av_mallocz(sizeof(AVPa...
positive
static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,uint8_t *dst,unsigned width, unsigned height,int srcStride1, int srcStride2,int srcStride3, int dstStride){ unsigned long y,x,w,h; w=width/2; h=height; for(y=0;y<h;y++){const uint8_t* yp=src1+srcStride1*y;const uint8_t...
positive
static int qio_channel_websock_handshake_process(QIOChannelWebsock *ioc, const char *line, size_t size, Error **errp){ int ret = -1; char *protocols = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL); char *version = qio_channel_websock_handshake_entry( line, size, QIO_CHANNEL_WEBSO...
positive
static void *av_mallocz_static(unsigned int size){ void *ptr = av_mallocz(size); if(ptr){ array_static =av_fast_realloc(array_static, &allocated_static, sizeof(void*)*(last_static+1)); if(!array_static) return NULL; array_static[last_static++] = ptr; } return ptr;}
positive
int index_from_key(const char *key){ int i; for (i = 0; QKeyCode_lookup[i] != NULL; i++) { if (!strcmp(key, QKeyCode_lookup[i])) { break; } } /* Return Q_KEY_CODE__MAX if the key is invalid */ return i;}
positive
static int mxf_read_primer_pack(MXFContext *mxf){ ByteIOContext *pb = mxf->fc->pb; int item_num = get_be32(pb); int item_len = get_be32(pb); if (item_len != 18) { av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n"); return -1; } if (item_num > UINT_MAX / item_len) return -1; mxf->local_tags_count = i...
positive
static void rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets){ uint32_t config_addr = rtas_ld(args, 0); uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2); unsigned int intr_src_num = -...
negative
static int convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size){ switch (AV_RB32(src)) { case DCA_SYNCWORD_CORE_BE: case DCA_SYNCWORD_SUBSTREAM: memcpy(dst, src, src_size); return src_size; case DCA_SYNCWORD_CORE_LE: case DCA_SYNCWORD_CORE_14B_BE: case DCA_SYNCWORD_CORE_14B_LE: return avpriv_...
negative
int ff_scale_image(uint8_t *dst_data[4], int dst_linesize[4], int dst_w, int dst_h, enum AVPixelFormat dst_pix_fmt, uint8_t * const src_data[4], int src_linesize[4], int src_w, int src_h, enum AVPixelFormat src_pix_fmt, void *log_ctx){ int ret; struct SwsContext *sws_ctx = sws_getContext(src_w, src_h, src_pix_fmt, dst_...
negative
static int ftp_read(URLContext *h, unsigned char *buf, int size){ FTPContext *s = h->priv_data; int read, err, retry_done = 0; av_dlog(h, "ftp protocol read %d bytes\n", size); retry: if (s->state == DISCONNECTED) { /* optimization */ if (s->position >= s->filesize) return 0; if ((err = ftp_connect_data_connection(h)) ...
positive
sPAPROptionVector *spapr_ovec_new(void){ sPAPROptionVector *ov; ov = g_new0(sPAPROptionVector, 1); ov->bitmap = bitmap_new(OV_MAXBITS); return ov;}
positive
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent){ char desc[DESC_SIZE]; uint32_t cid; const char *p_name, *cid_str; size_t cid_str_size; BDRVVmdkState *s = bs->opaque; if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) { return 0; } if (parent) { cid_str = "parentCID"; cid_str_size =...
positive
QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id){ QemuOpts *opts; QTAILQ_FOREACH(opts, &list->head, next) { if (!opts->id) { if (!id) { return opts; } continue; } if (strcmp(opts->id, id) != 0) { continue; } return opts; } return NULL;}
positive
static void do_video_out(AVFormatContext *s, OutputStream *ost, AVFrame *in_picture, float quality){ int ret, format_video_sync; AVPacket pkt; AVCodecContext *enc = ost->st->codec; int nb_frames; double sync_ipts, delta; double duration = 0; int frame_size = 0; InputStream *ist = NULL; if (ost->source_index >= 0) ist =...
positive
static av_cold int read_specific_config(ALSDecContext *ctx){ GetBitContext gb; uint64_t ht_size; int i, config_offset; MPEG4AudioConfig m4ac; ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; uint32_t als_id, header_size, trailer_size; init_get_bits(&gb, avctx->extradata, avctx->extradata_size...
positive
static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame){ V4L2m2mContext *s = avctx->priv_data; V4L2Context *const capture = &s->capture; V4L2Context *const output = &s->output; AVPacket avpkt = {0}; int ret; ret = ff_decode_get_packet(avctx, &avpkt); if (ret < 0 && ret != AVERROR_EOF) return ret; if (s->dr...
positive
static int jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, AVFrame *picture){ int compno, reslevelno, bandno; int x, y; uint8_t *line; Jpeg2000T1Context t1; /* Loop on tile components */ for (compno = 0; compno < s->ncomponents; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000Codi...
positive
static int rtmp_open(URLContext *s, const char *uri, int flags){ RTMPContext *rt = s->priv_data; char proto[8], hostname[256], path[1024], auth[100], *fname; char *old_app, *qmark, fname_buffer[1024]; uint8_t buf[2048]; int port; AVDictionary *opts = NULL; int ret; if (rt->listen_timeout > 0) rt->listen = 1; rt->is_inp...
positive
static int read_random(uint32_t *dst, const char *file){ int fd = open(file, O_RDONLY); int err = -1; if (fd == -1) return -1;#if HAVE_FCNTL && defined(O_NONBLOCK) if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK) != -1)#endif err = read(fd, dst, sizeof(*dst)); close(fd); return err;}
positive
static void enable_device(PIIX4PMState *s, int slot){ s->ar.gpe.sts[0] |= PIIX4_PCI_HOTPLUG_STATUS; s->pci0_status.up |= (1 << slot);}
positive
static QObject *parse_literal(JSONParserContext *ctxt){ QObject *token, *obj; JSONParserContext saved_ctxt = parser_context_save(ctxt); token = parser_context_pop_token(ctxt); if (token == NULL) { goto out; } switch (token_get_type(token)) { case JSON_STRING: obj = QOBJECT(qstring_from_escaped_str(ctxt, token)); break;...
positive
void cpu_loop(CPUM68KState *env){ CPUState *cs = CPU(m68k_env_get_cpu(env)); int trapnr; unsigned int n; target_siginfo_t info; TaskState *ts = cs->opaque; for(;;) { cpu_exec_start(cs); trapnr = cpu_exec(cs); cpu_exec_end(cs); process_queued_cpu_work(cs); switch(trapnr) { case EXCP_ILLEGAL: { if (ts->sim_syscalls) { ui...
positive
void do_savevm(Monitor *mon, const QDict *qdict){ DriveInfo *dinfo; BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1; int ret; QEMUFile *f; int saved_vm_running; uint32_t vm_state_size;#ifdef _WIN32 struct _timeb tb;#else struct timeval tv;#endif const char *name = qdict_get_try...
positive
int paio_init(void){ struct sigaction act; PosixAioState *s; int fds[2]; int ret; if (posix_aio_state) return 0; s = qemu_malloc(sizeof(PosixAioState)); sigfillset(&act.sa_mask); act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_handler = aio_signal_handler; sigaction(SIGUSR2, &act, NULL); s-...
positive
static int set_dirty_tracking(void){ BlkMigDevState *bmds; int ret; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE, NULL); if (!bmds->dirty_bitmap) { ret = -errno; goto fail; } } return 0;fail: QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_l...
positive
static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir){ SliceContext *slice = link->dst->priv; int y2, ret = 0; if (slice_dir == 1) { for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h) { ret = ff_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir); if (ret < 0) return ret; } if (y2 < y + h) ret...
positive
void cpu_check_irqs(CPUSPARCState *env){ CPUState *cs; if (env->pil_in && (env->interrupt_index == 0 || (env->interrupt_index & ~15) == TT_EXTINT)) { unsigned int i; for (i = 15; i > 0; i--) { if (env->pil_in & (1 << i)) { int old_interrupt = env->interrupt_index; env->interrupt_index = TT_EXTINT | i; if (old_interrupt...