label
int64
0
1
func1
stringlengths
23
97k
id
int64
0
27.3k
0
static void test_qemu_strtoull_correct(void) { const char *str = "12345 foo"; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 12345); g_assert(endptr == str + 5); }
16,317
0
static void test_visitor_in_enum(TestInputVisitorData *data, const void *unused) { Error *err = NULL; Visitor *v; EnumOne i; for (i = 0; EnumOne_lookup[i]; i++) { EnumOne res = -1; v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]); visit_type_EnumOne(v, &res, NULL, &err); g_assert(!err); g_assert_cmpint(i, ==,...
16,320
0
static void v9fs_lock(void *opaque) { int8_t status; V9fsFlock *flock; size_t offset = 7; struct stat stbuf; V9fsFidState *fidp; int32_t fid, err = 0; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; flock = g_malloc(sizeof(*flock)); pdu_unmarshal(pdu, offset, "dbdqqds", &fid, &flock->type, &flock->flags, &flock->start, &...
16,321
0
int ff_intrax8_decode_picture(IntraX8Context *const w, int dquant, int quant_offset) { MpegEncContext *const s = w->s; int mb_xy; assert(s); w->use_quant_matrix = get_bits1(&s->gb); w->dquant = dquant; w->quant = dquant >> 1; w->qsum = quant_offset; w->divide_quant_dc_luma = ((1 << 16) + (w->quant >> 1)) / w->quant; if...
16,322
0
void commit_start(BlockDriverState *bs, BlockDriverState *base, BlockDriverState *top, int64_t speed, BlockdevOnError on_error, BlockDriverCompletionFunc *cb, void *opaque, Error **errp) { CommitBlockJob *s; BlockReopenQueue *reopen_queue = NULL; int orig_overlay_flags; int orig_base_flags; BlockDriverState *overlay_bs...
16,323
0
static void blizzard_screen_dump(void *opaque, const char *filename, bool cswitch, Error **errp) { BlizzardState *s = (BlizzardState *) opaque; DisplaySurface *surface = qemu_console_surface(s->con); blizzard_update_display(opaque); if (s && surface_data(surface)) { ppm_save(filename, surface, errp); } }
16,324
0
static void lan9118_writew(void *opaque, target_phys_addr_t offset, uint32_t val) { lan9118_state *s = (lan9118_state *)opaque; offset &= 0xff; if (s->write_word_prev_offset != (offset & ~0x3)) { /* New offset, reset word counter */ s->write_word_n = 0; s->write_word_prev_offset = offset & ~0x3; } if (offset & 0x2) { s...
16,325
0
int float32_eq( float32 a, float32 b STATUS_PARAM ) { if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) { float_raise( float_flag_invalid STATUS_VAR); } ret...
16,326
0
int chsc_sei_nt2_get_event(void *res) { ChscSeiNt2Res *nt2_res = (ChscSeiNt2Res *)res; PciCcdfAvail *accdf; PciCcdfErr *eccdf; int rc = 1; SeiContainer *sei_cont; S390pciState *s = S390_PCI_HOST_BRIDGE( object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL)); if (!s) { return rc; } sei_cont = QTAILQ_FIRST(&s->pending_sei...
16,327
0
static void icount_adjust_rt(void *opaque) { timer_mod(icount_rt_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) + 1000); icount_adjust(); }
16,328
0
static inline int tcg_target_const_match(tcg_target_long val, const TCGArgConstraint *arg_ct) { int ct; ct = arg_ct->ct; if (ct & TCG_CT_CONST) return 1; else if ((ct & TCG_CT_CONST_S11) && ABS(val) == (ABS(val) & 0x3ff)) return 1; else if ((ct & TCG_CT_CONST_S13) && ABS(val) == (ABS(val) & 0xfff)) return 1; else retur...
16,329
0
static void iscsi_close(BlockDriverState *bs) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = iscsilun->iscsi; iscsi_detach_aio_context(bs); if (iscsi_is_logged_in(iscsi)) { iscsi_logout_sync(iscsi); } iscsi_destroy_context(iscsi); g_free(iscsilun->zeroblock); g_free(iscsilun->allocationmap); memset(is...
16,330
0
void i2c_register_slave(I2CSlaveInfo *info) { assert(info->qdev.size >= sizeof(i2c_slave)); info->qdev.init = i2c_slave_qdev_init; info->qdev.bus_type = BUS_TYPE_I2C; qdev_register(&info->qdev); }
16,331
0
static int img_compare(int argc, char **argv) { const char *fmt1 = NULL, *fmt2 = NULL, *cache, *filename1, *filename2; BlockBackend *blk1, *blk2; BlockDriverState *bs1, *bs2; int64_t total_sectors1, total_sectors2; uint8_t *buf1 = NULL, *buf2 = NULL; int pnum1, pnum2; int allocated1, allocated2; int ret = 0; /* return ...
16,332
0
static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) { struct video_data *s = s1->priv_data; AVStream *st; int width, height; int res, frame_rate, frame_rate_base; uint32_t desired_format, capabilities; const char *video_device; if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)...
16,333
0
static void handle_keyup(DisplayState *ds, SDL_Event *ev) { int mod_state; if (!alt_grab) { mod_state = (ev->key.keysym.mod & gui_grab_code); } else { mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT)); } if (!mod_state && gui_key_modifier_pressed) { gui_key_modifier_pressed = 0; if (gui_keysym == 0) { /*...
16,334
0
static int mpegts_resync(ByteIOContext *pb) { int c, i; for(i = 0;i < MAX_RESYNC_SIZE; i++) { c = url_fgetc(pb); if (c < 0) return -1; if (c == 0x47) { url_fseek(pb, -1, SEEK_CUR); return 0; } } /* no sync found */ return -1; }
16,336
1
static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size) { PutBitContext pb; int buf_pos, len; if (buf_size < 5) return -1; init_put_bits(&pb, buf, buf_size * 8); put_bits(&pb, 4, (s->block_width >> 4) - 1); put_bits(&pb, 12, s->image_width); put_bits(&pb, 4, (s->block_height >> 4) - 1); put_bits(&pb, ...
16,337
1
void usb_ohci_init_pxa(target_phys_addr_t base, int num_ports, int devfn, qemu_irq irq) { OHCIState *ohci = (OHCIState *)qemu_mallocz(sizeof(OHCIState)); usb_ohci_init(ohci, num_ports, devfn, irq, OHCI_TYPE_PXA, "OHCI USB"); ohci->mem_base = base; cpu_register_physical_memory(ohci->mem_base, 0xfff, ohci->mem); }
16,338
1
static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *bguf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y) { const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1]; const int16_t *buf1= buf0; //FIXME needed for RGB1/BGR1 if (uvalpha < 2048) { // note...
16,340
1
VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf) { V9fsState *s; int i, len; struct stat stat; FsTypeEntry *fse; s = (V9fsState *)virtio_common_init("virtio-9p", VIRTIO_ID_9P, sizeof(struct virtio_9p_config)+ MAX_TAG_LEN, sizeof(V9fsState)); /* initialize pdu allocator */ QLIST_INIT(&s->free_list); for (i...
16,341
1
int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2) { CPUS390XState *env = &cpu->env; S390PCIBusDevice *pbdev; uint64_t offset; uint64_t data; MemoryRegion *mr; uint8_t len; uint32_t fh; uint8_t pcias; cpu_synchronize_state(CPU(cpu)); if (env->psw.mask & PSW_MASK_PSTATE) { program_interrupt(env, PGM_PRIVILEGED...
16,342
1
static void vnc_client_cache_auth(VncState *client) { if (!client->info) { return; } #ifdef CONFIG_VNC_TLS if (client->tls.session && client->tls.dname) { client->info->has_x509_dname = true; client->info->x509_dname = g_strdup(client->tls.dname); } #endif #ifdef CONFIG_VNC_SASL if (client->sasl.conn && client->sasl.us...
16,343
1
static void add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1, const int8_t *s2, const int8_t *s3) { int i; int v[3]; v[0] = 0; for (i=!skip_first; i<3; i++) v[i] = (gain_val_tab[n][i] * m[i]) >> gain_exp_tab[n]; dest[i] = (s1[i]*v[0] + s2[i]*v[1] + s3[i]*v[2]) >> 12;
16,344
1
void qtest_qmp(QTestState *s, const char *fmt, ...) { va_list ap; bool has_reply = false; int nesting = 0; /* Send QMP request */ va_start(ap, fmt); socket_sendf(s->qmp_fd, fmt, ap); va_end(ap); /* Receive reply */ while (!has_reply || nesting > 0) { ssize_t len; char c; len = read(s->qmp_fd, &c, 1); if (len == -1 && e...
16,345
1
static void vmxnet3_reset(VMXNET3State *s) { VMW_CBPRN("Resetting vmxnet3..."); vmxnet3_deactivate_device(s); vmxnet3_reset_interrupt_states(s); vmxnet_tx_pkt_reset(s->tx_pkt); s->drv_shmem = 0; s->tx_sop = true; s->skip_current_tx_pkt = false; }
16,346
1
static av_cold int X264_close(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; av_freep(&avctx->extradata); av_free(x4->sei); if (x4->enc) x264_encoder_close(x4->enc); av_frame_free(&avctx->coded_frame); return 0; }
16,347
1
static always_inline void gen_op_subfo_64 (void) { gen_op_move_T2_T0(); gen_op_subf(); gen_op_check_subfo_64(); }
16,349
1
int slirp_can_output(void) { return 1; }
16,350
1
int main(int argc, char **argv, char **envp) { struct target_pt_regs regs1, *regs = &regs1; struct image_info info1, *info = &info1; struct linux_binprm bprm; TaskState *ts; CPUArchState *env; CPUState *cpu; int optind; char **target_environ, **wrk; char **target_argv; int target_argc; int i; int ret; int execfd; modul...
16,351
1
static int aiff_read_header(AVFormatContext *s, AVFormatParameters *ap) { int size, filesize; offset_t offset = 0; uint32_t tag; unsigned version = AIFF_C_VERSION1; ByteIOContext *pb = s->pb; AVStream * st = s->streams[0]; /* check FORM header */ filesize = get_tag(pb, &tag); if (filesize < 0 || tag != MKTAG('F', 'O', ...
16,353
1
static int start_frame_overlay(AVFilterLink *inlink, AVFilterBufferRef *inpicref) { AVFilterContext *ctx = inlink->dst; OverlayContext *over = ctx->priv; inlink->cur_buf = NULL; over->overpicref = inpicref; over->overpicref->pts = av_rescale_q(inpicref->pts, ctx->inputs[OVERLAY]->time_base, ctx->outputs[0]->time_base);...
16,354
1
int bdrv_file_open(BlockDriverState **pbs, const char *filename, QDict *options, int flags, Error **errp) { BlockDriverState *bs; BlockDriver *drv; const char *drvname; bool allow_protocol_prefix = false; Error *local_err = NULL; int ret; /* NULL means an empty set of options */ if (options == NULL) { options = qdict_n...
16,355
1
ser_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { ETRAXSerial *s = opaque; uint32_t value = val64; unsigned char ch = val64; D(qemu_log("%s " TARGET_FMT_plx "=%x\n", __func__, addr, value)); addr >>= 2; switch (addr) { case RW_DOUT: qemu_chr_fe_write(s->chr, &ch, 1); s->regs[R_INTR] |= 3; s->pen...
16,356
1
static av_cold int X264_init(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; int sw,sh; if (avctx->global_quality > 0) av_log(avctx, AV_LOG_WARNING, "-qscale is ignored, -crf is recommended.\n"); x264_param_default(&x4->params); x4->params.b_deblocking_filter = avctx->flags & CODEC_FLAG_LOOP_FILTER; if (x4...
16,357
1
int vhost_dev_init(struct vhost_dev *hdev, void *opaque, VhostBackendType backend_type) { uint64_t features; int i, r; if (vhost_set_backend_type(hdev, backend_type) < 0) { if (hdev->vhost_ops->vhost_backend_init(hdev, opaque) < 0) { return -errno; QLIST_INSERT_HEAD(&vhost_devices, hdev, entry); r = hdev->vhost_ops->vh...
16,359
1
static int vnc_display_disable_login(DisplayState *ds) { VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display; if (!vs) { return -1; } if (vs->password) { g_free(vs->password); } vs->password = NULL; if (vs->auth == VNC_AUTH_NONE) { vs->auth = VNC_AUTH_VNC; } return 0; }
16,362
1
static int vfio_connect_container(VFIOGroup *group) { VFIOContainer *container; int ret, fd; if (group->container) { return 0; } QLIST_FOREACH(container, &container_list, next) { if (!ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &container->fd)) { group->container = container; QLIST_INSERT_HEAD(&container->group_list, gr...
16,363
1
static void v9fs_fsync(void *opaque) { int err; int32_t fid; int datasync; size_t offset = 7; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dd", &fid, &datasync); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_fsync(pdu, fidp,...
16,364
1
static float quantize_and_encode_band_cost(struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) { const float IQ = ff_aac_pow2sf_tab[200 + scale_idx - SCALE_ONE_POS + SCALE_DIV_512]; const float Q = ff_aac_po...
16,366
1
static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, char **export, Error **errp) { SocketAddress *saddr; if (qdict_haskey(options, "path") == qdict_haskey(options, "host")) { if (qdict_haskey(options, "path")) { error_setg(errp, "path and host may not be used at the same time."); } else { error_setg(errp,...
16,367
1
static void init_excp_602 (CPUPPCState *env) { #if !defined(CONFIG_USER_ONLY) env->excp_vectors[POWERPC_EXCP_RESET] = 0x00000100; env->excp_vectors[POWERPC_EXCP_MCHECK] = 0x00000200; env->excp_vectors[POWERPC_EXCP_DSI] = 0x00000300; env->excp_vectors[POWERPC_EXCP_ISI] = 0x00000400; env->excp_vectors[POWERPC_EXCP_EXTERN...
16,368
1
int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix) { BDRVQcowState *s = bs->opaque; int64_t size, i, highest_cluster, nb_clusters; int refcount1, refcount2; QCowSnapshot *sn; uint16_t *refcount_table; int ret; size = bdrv_getlength(bs->file); if (size < 0) { res->check_errors++; re...
16,369
1
BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs, const char *backing_file) { char *filename_full = NULL; char *backing_file_full = NULL; char *filename_tmp = NULL; int is_protocol = 0; BlockDriverState *curr_bs = NULL; BlockDriverState *retval = NULL; if (!bs || !bs->drv || !backing_file) { return NULL; ...
16,371
1
static void test_ivshmem_pair(void) { IVState state1, state2, *s1, *s2; char *data; int i; setup_vm(&state1); s1 = &state1; setup_vm(&state2); s2 = &state2; data = g_malloc0(TMPSHMSIZE); /* host write, guest 1 & 2 read */ memset(tmpshmem, 0x42, TMPSHMSIZE); qtest_memread(s1->qtest, (uintptr_t)s1->mem_base, data, TMPSHM...
16,372
1
int ff_h264_execute_decode_slices(H264Context *h, unsigned context_count) { AVCodecContext *const avctx = h->avctx; H264SliceContext *sl; int i; av_assert0(context_count && h->slice_ctx[context_count - 1].mb_y < h->mb_height); if (h->avctx->hwaccel || h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) return 0; i...
16,373
1
static void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename) { GList *l; for (l = global_props; l; l = l->next) { GlobalProperty *prop = l->data; Error *err = NULL; if (strcmp(typename, prop->driver) != 0) { continue; } prop->used = true; object_property_parse(OBJECT(dev), prop->value, prop->prope...
16,374
1
static int lag_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; LagarithContext *l = avctx->priv_data; AVFrame *const p = &l->picture; uint8_t frametype = 0; uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9; uint32_t off...
16,375
1
static int sd_parse_uri(BDRVSheepdogState *s, const char *filename, char *vdi, uint32_t *snapid, char *tag) { URI *uri; QueryParams *qp = NULL; int ret = 0; uri = uri_parse(filename); if (!uri) { return -EINVAL; } /* transport */ if (!strcmp(uri->scheme, "sheepdog")) { s->is_unix = false; } else if (!strcmp(uri->scheme...
16,376
1
static void test_visitor_in_errors(TestInputVisitorData *data, const void *unused) { TestStruct *p = NULL; Error *err = NULL; Visitor *v; strList *q = NULL; UserDefTwo *r = NULL; WrapAlternate *s = NULL; v = visitor_input_test_init(data, "{ 'integer': false, 'boolean': 'foo', " "'string': -42 }"); visit_type_TestStruct...
16,377
1
BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_flush(bs, opaque); Coroutine *co; BlockAIOCBCoroutine *acb; /* Matched by bdrv_co_complete's bdrv_dec_in_flight. */ bdrv_inc_in_flight(bs); acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); acb->need_bh = ...
16,378
1
static int filter_packet(void *log_ctx, AVPacket *pkt, AVFormatContext *fmt_ctx, AVBitStreamFilterContext *bsf_ctx) { AVCodecContext *enc_ctx = fmt_ctx->streams[pkt->stream_index]->codec; int ret; while (bsf_ctx) { AVPacket new_pkt = *pkt; ret = av_bitstream_filter_filter(bsf_ctx, enc_ctx, NULL, &new_pkt.data, &new_pkt...
16,379
1
VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf, virtio_net_conf *net) { VirtIONet *n; n = (VirtIONet *)virtio_common_init("virtio-net", VIRTIO_ID_NET, sizeof(struct virtio_net_config), sizeof(VirtIONet)); n->vdev.get_config = virtio_net_get_config; n->vdev.set_config = virtio_net_set_config; n->vdev.get_...
16,380
1
int cpu_x86_register(X86CPU *cpu, const char *cpu_model) { CPUX86State *env = &cpu->env; x86_def_t def1, *def = &def1; Error *error = NULL; char *name, *features; gchar **model_pieces; memset(def, 0, sizeof(*def)); model_pieces = g_strsplit(cpu_model, ",", 2); if (!model_pieces[0]) { error_setg(&error, "Invalid/empty C...
16,381
1
static int srt_encode_frame(AVCodecContext *avctx, unsigned char *buf, int bufsize, const AVSubtitle *sub) { SRTContext *s = avctx->priv_data; ASSDialog *dialog; int i, len, num; s->ptr = s->buffer; s->end = s->ptr + sizeof(s->buffer); for (i=0; i<sub->num_rects; i++) { if (sub->rects[i]->type != SUBTITLE_ASS) { av_log...
16,382
1
static int img_info(int argc, char **argv) { int c; OutputFormat output_format = OFORMAT_HUMAN; bool chain = false; const char *filename, *fmt, *output; ImageInfoList *list; bool image_opts = false; fmt = NULL; output = NULL; for(;;) { int option_index = 0; static const struct option long_options[] = { {"help", no_argu...
16,383
1
void pp_postprocess(const uint8_t * src[3], const int srcStride[3], uint8_t * dst[3], const int dstStride[3], int width, int height, const QP_STORE_T *QP_store, int QPStride, pp_mode *vm, void *vc, int pict_type) { int mbWidth = (width+15)>>4; int mbHeight= (height+15)>>4; PPMode *mode = vm; PPContext *c = vc; int minS...
16,384
0
static int handle_sigp(S390CPU *cpu, uint8_t ipa1, uint32_t ipb) { CPUS390XState *env = &cpu->env; const uint8_t r1 = ipa1 >> 4; const uint8_t r3 = ipa1 & 0x0f; int ret; uint8_t order; uint64_t *status_reg; uint64_t param; S390CPU *dst_cpu = NULL; cpu_synchronize_state(CPU(cpu)); /* get order code */ order = decode_bas...
16,386
0
static void bt_hci_done(struct HCIInfo *info) { struct bt_hci_s *hci = hci_from_info(info); int handle; bt_device_done(&hci->device); if (hci->device.lmp_name) g_free((void *) hci->device.lmp_name); /* Be gentle and send DISCONNECT to all connected peers and those * currently waiting for us to accept or reject a connec...
16,387
0
static int get_port(const struct sockaddr_storage *ss) { sockaddr_union ssu = (sockaddr_union){.storage = *ss}; if (ss->ss_family == AF_INET) return ntohs(ssu.in.sin_port); #if HAVE_STRUCT_SOCKADDR_IN6 if (ss->ss_family == AF_INET6) return ntohs(ssu.in6.sin6_port); #endif return 0; }
16,388
0
int avformat_network_deinit(void) { #if CONFIG_NETWORK ff_network_close(); ff_tls_deinit(); ff_network_inited_globally = 0; #endif return 0; }
16,389
0
void ff_avg_h264_qpel8_mc02_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_vt_and_aver_dst_8x8_msa(src - (stride * 2), stride, dst, stride); }
16,390
0
static void gen_spr_vtb(CPUPPCState *env) { spr_register(env, SPR_VTB, "VTB", SPR_NOACCESS, SPR_NOACCESS, &spr_read_tbl, SPR_NOACCESS, 0x00000000); }
16,391
0
static void bswap_note(struct elf_note *en) { bswap32s(&en->n_namesz); bswap32s(&en->n_descsz); bswap32s(&en->n_type); }
16,392
0
void ide_init_drive(IDEState *s, DriveInfo *dinfo, const char *version, const char *serial) { int cylinders, heads, secs; uint64_t nb_sectors; s->bs = dinfo->bdrv; bdrv_get_geometry(s->bs, &nb_sectors); bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); s->cylinders = cylinders; s->heads = heads; s->sectors = secs;...
16,393
0
static inline int dmg_read_chunk(BlockDriverState *bs, uint64_t sector_num) { BDRVDMGState *s = bs->opaque; if (!is_sector_in_chunk(s, s->current_chunk, sector_num)) { int ret; uint32_t chunk = search_chunk(s, sector_num); #ifdef CONFIG_BZIP2 uint64_t total_out; #endif if (chunk >= s->n_chunks) { return -1; } s->curren...
16,394
0
static void qmp_output_add_obj(QmpOutputVisitor *qov, const char *name, QObject *value) { QStackEntry *e = QTAILQ_FIRST(&qov->stack); QObject *cur = e ? e->value : NULL; if (!cur) { /* FIXME we should require the user to reset the visitor, rather * than throwing away the previous root */ qobject_decref(qov->root); qov-...
16,395
0
static GenericList *qapi_dealloc_next_list(Visitor *v, GenericList **list, Error **errp) { GenericList *retval = *list; g_free(retval->value); *list = retval->next; return retval; }
16,397
0
static int nbd_co_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors) { BDRVNBDState *s = bs->opaque; struct nbd_request request; struct nbd_reply reply; if (!(s->nbdflags & NBD_FLAG_SEND_TRIM)) { return 0; } request.type = NBD_CMD_TRIM; request.from = sector_num * 512;; request.len = nb_sectors * 512; nb...
16,398
0
static bool memory_region_access_valid(MemoryRegion *mr, target_phys_addr_t addr, unsigned size) { if (!mr->ops->valid.unaligned && (addr & (size - 1))) { return false; } /* Treat zero as compatibility all valid */ if (!mr->ops->valid.max_access_size) { return true; } if (size > mr->ops->valid.max_access_size || size <...
16,399
0
static int pci_pcnet_init(PCIDevice *pci_dev) { PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, pci_dev); PCNetState *s = &d->state; uint8_t *pci_conf; #if 0 printf("sizeof(RMD)=%d, sizeof(TMD)=%d\n", sizeof(struct pcnet_RMD), sizeof(struct pcnet_TMD)); #endif pci_conf = pci_dev->config; pci_config_set_vendor_id(p...
16,400
0
static int dvvideo_encode_close(AVCodecContext *avctx) { av_frame_free(&avctx->coded_frame); return 0; }
16,401
0
void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, bool smm_enabled, qemu_irq sci_irq) { memory_region_init(&pm->io, OBJECT(lpc_pci), "ich9-pm", ICH9_PMIO_SIZE); memory_region_set_enabled(&pm->io, false); memory_region_add_subregion(pci_address_space_io(lpc_pci), 0, &pm->io); acpi_pm_tmr_init(&pm->acpi_regs, ich9...
16,402
0
static inline int gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb, int search_pc) { DisasContext dc1, *dc = &dc1; uint8_t *pc_ptr; uint16_t *gen_opc_end; int flags, j, lj; uint8_t *pc_start; uint8_t *cs_base; /* generate intermediate code */ pc_start = (uint8_t *)tb->pc; cs_base = (uint8_t *)tb->cs_b...
16,403
0
static void nbd_detach_aio_context(BlockDriverState *bs) { BDRVNBDState *s = bs->opaque; nbd_client_session_detach_aio_context(&s->client); }
16,404
0
void *g_malloc0_n(size_t nmemb, size_t size) { size_t sz; void *ptr; __coverity_negative_sink__(nmemb); __coverity_negative_sink__(size); sz = nmemb * size; ptr = __coverity_alloc__(size); __coverity_writeall0__(ptr); __coverity_mark_as_afm_allocated__(ptr, AFM_free); return ptr; }
16,405
0
static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr) { M48t59State *NVRAM = opaque; uint32_t retval; retval = m48t59_read(NVRAM, addr); return retval; }
16,407
0
static void coroutine_fn commit_run(void *opaque) { CommitBlockJob *s = opaque; BlockDriverState *active = s->active; BlockDriverState *top = s->top; BlockDriverState *base = s->base; BlockDriverState *overlay_bs; int64_t sector_num, end; int ret = 0; int n = 0; void *buf; int bytes_written = 0; int64_t base_len; ret =...
16,413
0
static int nvme_start_ctrl(NvmeCtrl *n) { uint32_t page_bits = NVME_CC_MPS(n->bar.cc) + 12; uint32_t page_size = 1 << page_bits; if (n->cq[0] || n->sq[0] || !n->bar.asq || !n->bar.acq || n->bar.asq & (page_size - 1) || n->bar.acq & (page_size - 1) || NVME_CC_MPS(n->bar.cc) < NVME_CAP_MPSMIN(n->bar.cap) || NVME_CC_MPS(n...
16,416
0
static void netmap_send(void *opaque) { NetmapState *s = opaque; struct netmap_ring *ring = s->me.rx; /* Keep sending while there are available packets into the netmap RX ring and the forwarding path towards the peer is open. */ while (!nm_ring_empty(ring) && qemu_can_send_packet(&s->nc)) { uint32_t i; uint32_t idx; bo...
16,417
0
static uint64_t gpio_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct gpio_state_t *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_PA_DIN: r = s->regs[RW_PA_DOUT] & s->regs[RW_PA_OE]; /* Encode pins from the nand. */ r |= s->nand->rdy << 7; break; case R_PD_DIN: r = s->regs[RW_PD_DOUT...
16,418
0
static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr) { struct vfio_region_info *rom = NULL, *opregion = NULL, *host = NULL, *lpc = NULL; VFIOQuirk *quirk; VFIOIGDQuirk *igd; PCIDevice *lpc_bridge; int i, ret, ggms_mb, gms_mb = 0, gen; uint64_t *bdsm_size; uint32_t gmch; uint16_t cmd_orig, cmd; Error *err ...
16,420
0
int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr, int is_write1, int mmu_idx) { uint64_t ptep, pte; target_ulong pde_addr, pte_addr; int error_code, is_dirty, prot, page_size, is_write, is_user; target_phys_addr_t paddr; uint32_t page_offset; target_ulong vaddr, virt_addr; is_user = mmu_idx == MMU_USER_...
16,421
1
static void test_qga_invalid_args(gconstpointer fix) { const TestFixture *fixture = fix; QDict *ret, *error; const gchar *class, *desc; ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping', " "'arguments': {'foo': 42 }}"); g_assert_nonnull(ret); error = qdict_get_qdict(ret, "error"); class = qdict_get_try_str(error, "cl...
16,423
1
int ff_mlz_decompression(MLZ* mlz, GetBitContext* gb, int size, unsigned char *buff) { MLZDict *dict = mlz->dict; unsigned long output_chars; int string_code, last_string_code, char_code; string_code = 0; char_code = -1; last_string_code = -1; output_chars = 0; while (output_chars < size) { string_code = input_code(gb,...
16,424
1
static void kvm_client_set_memory(struct CPUPhysMemoryClient *client, target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset, bool log_dirty) { kvm_set_phys_mem(start_addr, size, phys_offset, log_dirty); }
16,426
1
static void balloon_stats_set_poll_interval(Object *obj, struct Visitor *v, void *opaque, const char *name, Error **errp) { VirtIOBalloon *s = opaque; Error *local_err = NULL; int64_t value; visit_type_int(v, &value, name, &local_err); if (local_err) { error_propagate(errp, local_err); return; } if (value < 0) { error_...
16,428
1
static OutputStream *choose_output(void) { int i; int64_t opts_min = INT64_MAX; OutputStream *ost_min = NULL; for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; int64_t opts = av_rescale_q(ost->st->cur_dts, ost->st->time_base, AV_TIME_BASE_Q); if (!ost->finished && opts < opts_min) { opts_...
16,429
1
static int vfio_msi_setup(VFIOPCIDevice *vdev, int pos) { uint16_t ctrl; bool msi_64bit, msi_maskbit; int ret, entries; if (pread(vdev->vbasedev.fd, &ctrl, sizeof(ctrl), vdev->config_offset + pos + PCI_CAP_FLAGS) != sizeof(ctrl)) { return -errno; } ctrl = le16_to_cpu(ctrl); msi_64bit = !!(ctrl & PCI_MSI_FLAGS_64BIT); m...
16,430
1
static void gen_advance_ccount(DisasContext *dc) { gen_advance_ccount_cond(dc); dc->ccount_delta = 0; }
16,432
1
void init_paths(const char *prefix) { char pref_buf[PATH_MAX]; if (prefix[0] == '\0' || !strcmp(prefix, "/")) return; if (prefix[0] != '/') { char *cwd = getcwd(NULL, 0); size_t pref_buf_len = sizeof(pref_buf); if (!cwd) abort(); pstrcpy(pref_buf, sizeof(pref_buf), cwd); pstrcat(pref_buf, pref_buf_len, "/"); pstrcat(pr...
16,433
1
int bdrv_all_create_snapshot(QEMUSnapshotInfo *sn, BlockDriverState *vm_state_bs, uint64_t vm_state_size, BlockDriverState **first_bad_bs) { int err = 0; BlockDriverState *bs; BdrvNextIterator it; for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) { AioContext *ctx = bdrv_get_aio_context(bs); aio_context_acquire(ctx);...
16,434
1
void tb_target_set_jmp_target(uintptr_t tc_ptr, uintptr_t jmp_addr, uintptr_t addr) { if (TCG_TARGET_REG_BITS == 64) { tcg_insn_unit i1, i2; intptr_t tb_diff = addr - tc_ptr; intptr_t br_diff = addr - (jmp_addr + 4); uint64_t pair; /* This does not exercise the range of the branch, but we do still need to be able to lo...
16,436
1
static av_always_inline int setup_classifs(vorbis_context *vc, vorbis_residue *vr, uint8_t *do_not_decode, unsigned ch_used, int partition_count) { int p, j, i; unsigned c_p_c = vc->codebooks[vr->classbook].dimensions; unsigned inverse_class = ff_inverse[vr->classifications]; unsigned temp, temp2; for (p = 0, j = 0; j ...
16,438
1
static int xan_unpack(uint8_t *dest, const int dest_len, const uint8_t *src, const int src_len) { uint8_t opcode; int size; uint8_t *orig_dest = dest; const uint8_t *src_end = src + src_len; const uint8_t *dest_end = dest + dest_len; while (dest < dest_end) { opcode = *src++; if (opcode < 0xe0) { int size2, back; if ((...
16,439
1
static void qht_do_test(unsigned int mode, size_t init_entries) { qht_init(&ht, 0, mode); insert(0, N); check(0, N, true); check_n(N); check(-N, -1, false); iter_check(N); rm(101, 102); check_n(N - 1); insert(N, N * 2); check_n(N + N - 1); rm(N, N * 2); check_n(N - 1); insert(101, 102); check_n(N); rm(10, 200); check_n...
16,440
0
static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack* track) { int64_t maxTrackLenTemp; put_be32(pb, 0x5c); /* size (always 0x5c) */ put_tag(pb, "tkhd"); put_be32(pb, 0xf); /* version & flags (track enabled) */ put_be32(pb, track->time); /* creation time */ put_be32(pb, track->time); /* modification time */ put_be...
16,441
1
static void quantize_and_encode_band_cost_NONE_mips(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, const float ROUNDING) { av_assert0(0); }
16,442
1
int qcrypto_cipher_setiv(QCryptoCipher *cipher, const uint8_t *iv, size_t niv, Error **errp) { QCryptoCipherNettle *ctx = cipher->opaque; if (niv != ctx->niv) { error_setg(errp, "Expected IV size %zu not %zu", ctx->niv, niv); return -1; } memcpy(ctx->iv, iv, niv); return 0; }
16,443
1
static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *int_mask, bool queuing) { UHCIAsync *async; int len = 0, max_len; uint8_t pid; USBDevice *dev; USBEndpoint *ep; /* Is active ? */ if (!(td->ctrl & TD_CTRL_ACTIVE)) return TD_RESULT_NEXT_QH; async = uhci_async_find_td(s, addr, td); if (async) ...
16,444