Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
FFmpeg
libavcodec/vp8.c
static void vp8_decode_flush_impl(AVCodecContext *avctx, int force, int is_close) { VP8Context *s = avctx->priv_data; int i; if (!avctx->is_copy || force) { for (i = 0; i < 5; i++) if (s->frames[i].data[0]) vp8_release_frame(s, &s->frames[i], is_close); ...
[ 1, 0 ]
qemu
qemu-char.c
static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr(0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(term_exit); chr = q...
[ 1, 0 ]
qemu
target/ppc/kvm.c
static int kvm_ppc_register_host_cpu_type(void) { TypeInfo type_info = { .name = TYPE_HOST_POWERPC_CPU, .class_init = kvmppc_host_cpu_class_init, }; PowerPCCPUClass *pvr_pcc; DeviceClass *dc; int i; pvr_pcc = kvm_ppc_get_host_cpu_class(); if (pvr_pcc == NULL) { return -1; } ...
[ 1, 0 ]
FFmpeg
libswresample/rematrix_template.c
static void RENAME(mix8to2)(SAMPLE **out, const SAMPLE **in, COEFF *coeffp, integer len) { int i; for (i = 0; i < len; i++) { INTER t = in[2][i] * coeffp[0 * 8 + 2] + in[3][i] * coeffp[0 * 8 + 3]; out[0][i] = R(t + in[0][i] * (INTER)coeffp[0 * 8 + 0] + in[4]...
[ 1, 0 ]
qemu
hw/9pfs/virtio-9p-debug.c
static void pprint_data(V9fsPDU *pdu, int rx, size_t *offsetp, const char *name) { struct iovec *sg = get_sg(pdu, rx); size_t offset = *offsetp; unsigned int count; int32_t size; int total, i, j; ssize_t len; if (rx) { count = pdu->elem.in_num; } else count = pdu->elem.out_num; }
[ 1, 0 ]
qemu
qobject/qdict.c
static QObject *qdict_get_obj(const QDict *qdict, const char *key, QType type) { QObject *obj; obj = qdict_get(qdict, key); assert(obj != NULL); assert(qobject_type(obj) == type); return obj; }
[ 1, 0 ]
FFmpeg
Changelog
int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, int *copy_buf) { switch (mode) { case VERT_PRED: if (!mb_x && mb_y) { *copy_buf = 1; return mode; } /* fall-through */ case DIAG_DOWN_LEFT_PRED: case VERT_LEFT_PRED: retu...
[ 1, 0 ]
FFmpeg
libavcodec/mips/h264qpel_msa.c
void ff_avg_h264_qpel8_mc22_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_mid_and_aver_dst_8w_msa(src - (2 * stride) - 2, stride, dst, stride, 8); }
[ 0, 0 ]
FFmpeg
libavcodec/ppc/check_altivec.c
int has_altivec(void) { #ifdef __AMIGAOS4__ ULONG result = 0; extern struct ExecIFace *IExec; IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); if (result == VECTORTYPE_ALTIVEC) return 1; #elif __APPLE__ int sels[2] = {CTL_HW, HW_VECTORUNIT}; int has_vu = 0; size_t len = sizeof(has_...
[ 1, 1 ]
qemu
linux-user/main.c
static void gen_mfsrin(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 2...
[ 1, 0 ]
qemu
include/qemu/thread-posix.h
void qemu_sem_wait(QemuSemaphore *sem) { #if defined(__APPLE__) || defined(__NetBSD__) pthread_mutex_lock(&sem->lock); --sem->count; while (sem->count < 0) { pthread_cond_wait(&sem->cond, &sem->lock); } pthread_mutex_unlock(&sem->lock); #else int rc; do { rc = sem_wait(&sem->sem); } ...
[ 1, 0 ]
FFmpeg
libswscale/cs_test.c
void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) { long i; /* writes 1 byte o much and might cause alignment issues on some architectures? for(i=0; i<num_pixels; i++) ((unsigned *)(&dst[i*3])) = ((un...
[ 1, 1 ]
qemu
include/qapi/visitor-impl.h
void visit_start_list(Visitor *v, const char *name, GenericList **list, size_t size, Error **errp) { Error *err = NULL; assert(!list || size >= sizeof(GenericList)); v->start_list(v, name, list, size, &err); if (list && v->type == VISITOR_INPUT) { assert(!(err && *list)); } ...
[ 1, 0 ]
qemu
qemu-thread-win32.c
static unsigned __stdcall win32_start_routine(void *arg) { struct QemuThreadData data = *(struct QemuThreadData *)arg; QemuThread *thread = data.thread; free(arg); TlsSetValue(qemu_thread_tls_index, thread); /* * Use DuplicateHandle instead of assigning thread->thread in the * creating thread to...
[ 1, 0 ]
FFmpeg
libavcodec/vp8.c
static int vp8_alloc_frame(VP8Context *s, AVFrame *f) { int ret; if ((ret = ff_thread_get_buffer(s->avctx, f)) < 0) return ret; if (!s->maps_are_invalid && s->num_maps_to_be_freed) { f->ref_index[0] = s->segmentation_maps[--s->num_maps_to_be_freed]; } else if (!(f->ref_index[0] = av_mallocz(s->mb...
[ 1, 0 ]
qemu
hw/qxl.c
static void qxl_destroy_primary(PCIQXLDevice *d) { if (d->mode == QXL_MODE_UNDEFINED) { return; } dprint(d, 1, "%s\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0); }
[ 1, 0 ]
qemu
hw/acpi/pcihp.c
void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus, MemoryRegion *address_space_io, bool bridges_enabled) { s->io_len = ACPI_PCIHP_SIZE; s->io_base = ACPI_PCIHP_ADDR; s->root = root_bus; s->legacy_piix = !bridges_enabled; if (s->legacy_piix) { unsigned *bu...
[ 1, 0 ]
qemu
qapi/opts-visitor.c
opts_check_struct(Visitor *v, Error **errp) { OptsVisitor *ov = to_ov(v); GHashTableIter iter; GQueue *any; if (ov->depth > 0) { return; } /* we should have processed all (distinct) QemuOpt instances */ g_hash_table_iter_init(&iter, ov->unprocessed_opts); if (g_hash_table_iter_next(&iter, N...
[ 1, 0 ]
FFmpeg
libavcodec/dvdsubdec.c
static int append_to_cached_buf(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVDSubContext *ctx = avctx->priv_data; if (ctx->buf_size > 0xffff - buf_size) { av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct " "too large SPU packets ab...
[ 1, 0 ]
FFmpeg
libavcodec/aic.c
static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst, int band, int slice_width) { int has_skips, coeff_type, coeff_bits, skip_type, skip_bits; const int num_coeffs = aic_num_band_coeffs[band]; const uint8_t *scan = aic_scan[band]; int mb, idx, val; has_skips = get_...
[ 0, 0 ]
qemu
target-s390x/cpu.h
uint64_t HELPER(lra)(CPUS390XState *env, uint64_t addr) { CPUState *cs = CPU(s390_env_get_cpu(env)); uint32_t cc = 0; int old_exc = cs->exception_index; uint64_t asc = env->psw.mask & PSW_MASK_ASC; uint64_t ret; int flags; /* XXX incomplete - has more corner cases */ if (!(env->psw.mask & PSW_M...
[ 1, 1 ]
FFmpeg
libavformat/rtsp.c
static int sdp_probe(AVProbeData *p1) { const char *p = p1->buf, *p_end = p1->buf + p1->buf_size; /* we look for a line beginning "c=IN IP4" */ while (p < p_end && *p != '\0') { if (p + sizeof("c=IN IP4") - 1 < p_end && av_strstart(p, "c=IN IP4", NULL)) return AVPROBE_SCORE_MAX / 2; while (p ...
[ 1, 0 ]
FFmpeg
ffmpeg.c
static int rm_write_packet(AVFormatContext *s, AVPacket *pkt) { if (s->streams[pkt->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO) return rm_write_audio(s, pkt->data, pkt->size); else return rm_write_video(s, pkt->data, pkt->size); }
[ 1, 0 ]
qemu
HACKING
static uint64_t cs_mem_read(void *opaque, target_phys_addr_t addr, unsigned size) { CSState *s = opaque; uint32_t saddr, ret; saddr = addr >> 2; switch (saddr) { case 1: switch (CS_RAP(s)) { case 3: // Write only ret = 0; break; default: r...
[ 0, 0 ]
qemu
ui/trace-events
static int vnc_auth_sasl_check_ssf(VncState *vs) { const void *val; int err, ssf; if (!vs->sasl.wantSSF) return 1; err = sasl_getprop(vs->sasl.conn, SASL_SSF, &val); if (err != SASL_OK) return 0; ssf = *(const int *)val; VNC_DEBUG("negotiated an SSF of %d\n", ssf); if (ssf < 56) ...
[ 1, 0 ]
qemu
hw/pci/pcie.c
void pcie_cap_slot_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { uint8_t *exp_cap; PCIDevice *pci_dev = PCI_DEVICE(dev); pcie_cap_slot_hotplug_common(PCI_DEVICE(hotplug_dev), dev, &exp_cap, errp); /* Don't send event when device is enabled during q...
[ 1, 1 ]
qemu
osdep.c
int qemu_socket(int domain, int type, int protocol) { int ret; #ifdef SOCK_CLOEXEC ret = socket(domain, type | SOCK_CLOEXEC, protocol); #else ret = socket(domain, type, protocol); if (ret >= 0) { qemu_set_cloexec(ret); } #endif return ret; }
[ 1, 0 ]
qemu
target-microblaze/op_helper.c
static void dec_fpu(DisasContext *dc) { if ((dc->tb_flags & MSR_EE_FLAG) && !(dc->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK) && !((dc->env->pvr.regs[2] & PVR2_USE_FPU_MASK))) { tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP); t_gen_raise_exception(dc, EXCP_HW_EXCP); return; } ...
[ 1, 0 ]
qemu
target-ppc/cpu.h
static void do_dcbz(target_ulong addr, int dcache_line_size) { addr &= ~(dcache_line_size - 1); int i; for (i = 0; i < dcache_line_size; i += 4) { stl(addr + i, 0); } if (env->reserve == addr) env->reserve = (target_ulong)-1ULL; }
[ 0, 0 ]
qemu
op-i386.c
void OPPROTO op_int_im(void) { EIP = PARAM1; raise_exception(EXCP0D_GPF); }
[ 0, 0 ]
qemu
target-arm/translate.c
static inline TCGv gen_ld16s(TCGv addr, int index) { TCGv tmp = new_tmp(); tcg_gen_qemu_ld16s(tmp, addr, index); return tmp; }
[ 1, 0 ]
qemu
console.c
static int qemu_chr_open_stdio(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { return -EBUSY; } if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr(0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(t...
[ 1, 0 ]
qemu
hw/serial.c
static uint32_t serial_ioport_read(void *opaque, uint32_t addr) { SerialState *s = opaque; uint32_t ret; addr &= 7; switch (addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { ret = s->divider & 0xff; } else { ret = s->rbr; s->lsr &= ~(UART_LSR_DR | UART_LSR_BI); ...
[ 1, 0 ]
FFmpeg
libswresample/resample.c
static int RENAME(resample_linear)(ResampleContext *c, DELEM *dst, const DELEM *src, int n, int update_ctx) { int dst_index; int index = c->index; int frac = c->frac; int sample_index = index >> c->phase_shift; #if FILTER_SHIFT == 0 ...
[ 1, 0 ]
FFmpeg
libavcodec/dsputil.c
static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels, int line_size) { int i; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; /* read the pixels */ for (i = 0; i < 2; i++) { pixels[0] = cm[pixels[0] + block[0]]; ...
[ 1, 0 ]
FFmpeg
libavformat/mxfdec.c
static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) { KLVPacket klv; while (!s->pb->eof_reached) { if (klv_read_packet(&klv, s->pb) < 0) return -1; PRINT_KEY(s, "read packet", klv.key); av_dlog(s, "size %" PRIu64 " offset %#" PRIx64 "\n", klv.length, klv.offset); ...
[ 1, 0 ]
FFmpeg
ffmpeg.c
static int codec_get_buffer(AVCodecContext *s, AVFrame *frame) { InputStream *ist = s->opaque; FrameBuffer *buf; int ret, i; if (!ist->buffer_pool && (ret = alloc_buffer(s, ist, &ist->buffer_pool)) < 0) return ret; buf = ist->buffer_pool; ist->buffer_pool = buf->next; buf->next = NULL; if (buf->w !=...
[ 1, 1 ]
FFmpeg
postproc/rgb2rgb.c
void palette8tobgr16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) { unsigned i; for (i = 0; i < num_pixels; i++) ((uint16_t *)dst)[i] = bswap_16(((uint16_t *)palette)[src[i]]); }
[ 1, 0 ]
FFmpeg
libavfilter/avcodec.c
int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) { dst->pts = src->pts; dst->pos = av_frame_get_pkt_pos(src); dst->format = src->format; switch (dst->type) { case AVMEDIA_TYPE_VIDEO: dst->video->w = src->width; dst->video->h = src->height; dst->video->sample_aspec...
[ 1, 0 ]
qemu
qemu-coroutine.c
void coroutine_fn qemu_coroutine_yield(void) { Coroutine *self = qemu_coroutine_self(); Coroutine *to = self->caller; trace_qemu_coroutine_yield(self, to); if (!to) { fprintf(stderr, "Co-routine is yielding to no one\n"); abort(); } self->caller = NULL; coroutine_swap(self, to); }
[ 1, 0 ]
qemu
hw/block/fdc.c
static void hpet_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = hpet_realize; dc->reset = hpet_reset; dc->vmsd = &vmstate_hpet; dc->props = hpet_device_properties; }
[ 1, 0 ]
qemu
block.c
void qmp_block_job_set_speed(const char *device, int64_t value, Error **errp) { BlockJob *job = find_block_job(device); if (!job) { error_set(errp, QERR_DEVICE_NOT_ACTIVE, device); return; } if (block_job_set_speed(job, value) < 0) { error_set(errp, QERR_NOT_SUPPORTED); } }
[ 0, 0 ]
qemu
HACKING
static void mcf_intc_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { int offset; mcf_intc_state *s = (mcf_intc_state *)opaque; offset = addr & 0xff; if (offset >= 0x40 && offset < 0x80) { int n = offset - 0x40; s->icr[n] = val; if (val ...
[ 1, 0 ]
qemu
cputlb.c
void stl_phys_notdirty(hwaddr addr, uint32_t val) { uint8_t *ptr; MemoryRegionSection *section; section = phys_page_find(address_space_memory.dispatch, addr >> TARGET_PAGE_BITS); if (!memory_region_is_ram(section->mr) || section->readonly) { addr = memory_region_section_addr(section, addr); ...
[ 1, 0 ]
qemu
block/block-backend.c
static bool cmd_write_multiple(IDEState *s, uint8_t cmd) { bool lba48 = (cmd == WIN_MULTWRITE_EXT); int n; if (!s->bs || !s->mult_sectors) { ide_abort_command(s); return true; } ide_cmd_lba48_transform(s, lba48); s->req_nb_sectors = s->mult_sectors; n = MIN(s->nsector, s->req_nb_sectors);...
[ 0, 0 ]
FFmpeg
libavcodec/nvenc.c
static av_cold int nvenc_open_session(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs; NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS encode_session_params = {0}; NVENCSTATUS nv_status...
[ 0, 0 ]
FFmpeg
libavcodec/mpegaudiodec.c
static void compute_antialias_float(MPADecodeContext *s, GranuleDef *g) { float *ptr; int n, i; /* we antialias only "long" bands */ if (g->block_type == 2) { if (!g->switch_point) return; /* XXX: check this for 8000Hz case */ n = 1; } else { ...
[ 1, 1 ]
qemu
ui/console.c
QemuConsole *qemu_console_lookup_by_device(DeviceState *dev, uint32_t head) { Error *local_err = NULL; Object *obj; uint32_t h; int i; for (i = 0; i < nb_consoles; i++) { if (!consoles[i]) { continue; } obj = object_property_get_link(OBJECT(consoles[i]), ...
[ 1, 0 ]
qemu
cpus.c
void qemu_system_vmstop_request(RunState state) { vmstop_requested = state; qemu_notify_event(); }
[ 1, 0 ]
qemu
hw/sun4u.c
static void ebus_mmio_mapfunc(PCIDevice *pci_dev, int region_num, pcibus_t addr, pcibus_t size, int type) { EBUS_DPRINTF("Mapping region %d registers at %" FMT_PCIBUS "\n", region_num, addr); switch (region_num) { case 0: isa_mmio_init(addr, 0x1000000); ...
[ 1, 0 ]
qemu
target/arm/cpu.c
static void arm926_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); cpu->dtb_compatible = "arm,arm926"; set_feature(&cpu->env, ARM_FEATURE_V5); set_feature(&cpu->env, ARM_FEATURE_VFP); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN); cpu->m...
[ 1, 0 ]
FFmpeg
libavformat/mp3dec.c
static int check(AVIOContext *pb, int64_t pos, uint32_t *ret_header) { int64_t ret = avio_seek(pb, pos, SEEK_SET); uint8_t header_buf[4]; unsigned header; MPADecodeHeader sd; if (ret < 0) return CHECK_SEEK_FAILED; ret = avio_read(pb, &header_buf[0], 4); if (ret < 0) return CHECK_SEEK_FAI...
[ 1, 0 ]
FFmpeg
libavformat/matroskadec.c
static void matroska_merge_packets(AVPacket *out, AVPacket *in) { out->data = av_realloc(out->data, out->size + in->size); memcpy(out->data + out->size, in->data, in->size); out->size += in->size; av_destruct_packet(in); av_free(in); }
[ 1, 0 ]
qemu
block/qapi.c
static void test_validate_fail_struct(TestInputVisitorData *data, const void *unused) { TestStruct *p = NULL; Error *err = NULL; Visitor *v; v = validate_test_init( data, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }"); visit_type_T...
[ 0, 0 ]
qemu
hw/xen_platform.c
static void platform_fixed_ioport_init(PCIXenPlatformState *s) { register_ioport_write(XEN_PLATFORM_IOPORT, 16, 4, platform_fixed_ioport_writel, s); register_ioport_write(XEN_PLATFORM_IOPORT, 16, 2, platform_fixed_ioport_writew, s); register_ioport_write(XEN_PLA...
[ 0, 0 ]
qemu
hw/i386/acpi-build.c
static int vtd_page_walk(VTDContextEntry *ce, uint64_t start, uint64_t end, vtd_page_walk_hook hook_fn, void *private, bool notify_unmap) { dma_addr_t addr = vtd_ce_get_slpt_base(ce); uint32_t level = vtd_ce_get_level(ce); if (!vtd_iova_range_check(start, ce...
[ 0, 0 ]
qemu
block.c
static void bdrv_io_limits_intercept(BlockDriverState *bs, int nb_sectors, bool is_write) { /* does this io must wait */ bool must_wait = throttle_schedule_timer(&bs->throttle_state, is_write); /* if must wait or any request of this t...
[ 0, 0 ]
qemu
tcg/aarch64/tcg-target.inc.c
static inline uint64_t tcg_opc_movi_a(int qp, TCGReg dst, int64_t src) { assert(src == sextract64(src, 0, 22)); return tcg_opc_a5(qp, OPC_ADDL_A5, dst, src, TCG_REG_R0); }
[ 0, 0 ]
qemu
HACKING
static void vgafb_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { MilkymistVgafbState *s = opaque; trace_milkymist_vgafb_memory_write(addr, value); addr >>= 2; switch (addr) { case R_CTRL: s->regs[addr] = value; vgafb_resize(s); break...
[ 1, 0 ]
qemu
disas.c
static void do_help(int argc, const char **argv) { help_cmd(argv[1]); }
[ 0, 0 ]
qemu
block/raw-posix.c
MigrationState *tcp_start_outgoing_migration(Monitor *mon, const char *host_port, int64_t bandwidth_limit, int detach, int blk, ...
[ 1, 0 ]
FFmpeg
libavfilter/vf_unsharp.c
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) { UnsharpContext *unsharp = ctx->priv; int lmsize_x = 5, cmsize_x = 0; int lmsize_y = 5, cmsize_y = 0; double lamount = 1.0f, camount = 0.0f; if (args) sscanf(args, "%d:%d:%lf:%d:%d:%lf", &lmsize_x, &lmsize_y, &lamount, ...
[ 1, 0 ]
FFmpeg
libavcodec/libx265.c
static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet) { libx265Context *ctx = avctx->priv_data; x265_picture x265pic; x265_picture x265pic_out = {{0}}; x265_nal *nal; uint8_t *dst; int payload = 0; int nnal; int ret; ...
[ 1, 0 ]
qemu
translate-all.c
int page_check_range(target_ulong start, target_ulong len, int flags) { PageDesc *p; target_ulong end; target_ulong addr; /* This function should never be called with addresses outside the guest address space. If this assert fires, it probably indicates a missing call to h2g_valid. */ #if TA...
[ 1, 0 ]
FFmpeg
libavformat/concatdec.c
static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile, unsigned *nb_files_alloc) { ConcatContext *cat = avf->priv_data; ConcatFile *file; char *url; size_t url_len; if (cat->safe > 0 && !safe_filename(filename)) { av_log(avf, AV_LOG_ERROR, "Unsafe file na...
[ 1, 0 ]
FFmpeg
libavcodec/mpegvideo.c
int ff_find_unused_picture(MpegEncContext *s, int shared) { int i; if (shared) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].data[0] == NULL && s->picture[i].type == 0) return i; } } else { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].data[0] =...
[ 1, 1 ]
FFmpeg
libavformat/mux.c
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) { int ret, flush = 0; if (pkt) { AVStream *st = s->streams[pkt->stream_index]; // FIXME/XXX/HACK drop zero sized packets if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size == 0) return 0; av_dlog(s, "av_int...
[ 1, 1 ]
FFmpeg
doc/muxers.texi
static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st) { MpegTSWrite *ts = s->priv_data; MpegTSWriteStream *ts_st = st->priv_data; uint8_t *q; uint8_t buf[TS_PACKET_SIZE]; q = buf; *q++ = 0x47; *q++ = ts_st->pid >> 8; *q++ = ts_st->pid; *q++ = 0x20 | ts_st->cc; /* Adaptation on...
[ 1, 0 ]
FFmpeg
libavcodec/me_cmp.c
static int quant_psnr8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, ptrdiff_t stride, int h) { LOCAL_ALIGNED_16(int16_t, temp, [64 * 2]); int16_t *const bak = temp + 64; int sum = 0, i; av_assert2(h == 8); s->mb_intra = 0; s->pdsp.diff_pixels(temp, src1, src2, stri...
[ 1, 1 ]
qemu
hw/scsi/virtio-scsi.c
void virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq) { VirtIOSCSIReq *req, *next; QTAILQ_HEAD(, VirtIOSCSIReq) reqs = QTAILQ_HEAD_INITIALIZER(reqs); while ((req = virtio_scsi_pop_req(s, vq))) { if (virtio_scsi_handle_cmd_req_prepare(s, req)) { QTAILQ_INSERT_TAIL(&reqs, req, next); } ...
[ 1, 0 ]
qemu
hw/s390x/event-facility.c
static int event_qdev_init(DeviceState *qdev) { SCLPEvent *event = DO_UPCAST(SCLPEvent, qdev, qdev); SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event); return child->init(event); }
[ 1, 0 ]
FFmpeg
libavcodec/wavpack.c
static int update_error_limit(WavpackFrameContext *ctx) { int i, br[2], sl[2]; for (i = 0; i <= ctx->stereo_in; i++) { if (ctx->ch[i].bitrate_acc > UINT_MAX - ctx->ch[i].bitrate_delta) return AVERROR_INVALIDDATA; ctx->ch[i].bitrate_acc += ctx->ch[i].bitrate_delta; br[i] = ctx->ch[i].bitrate...
[ 1, 0 ]
qemu
block.c
static void bdrv_co_io_em_complete(void *opaque, int ret) { CoroutineIOCompletion *co = opaque; co->ret = ret; qemu_coroutine_enter(co->coroutine, NULL); }
[ 1, 0 ]
qemu
hw/ppc/spapr_drc.c
static void realize(DeviceState *d, Error **errp) { sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(d); sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); Object *root_container; char link_name[256]; gchar *child_name; Error *err = NULL; DPRINTFN("drc realize: %x", drck->get_index(drc)); ...
[ 1, 0 ]
qemu
hw/net/virtio-net.c
static void virtio_net_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); dc->exit = virtio_net_device_exit; dc->props = virtio_net_properties; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); vdc->init = virtio_ne...
[ 1, 0 ]
qemu
hw/i2c.h
static inline void menelaus_rtc_stop(struct menelaus_s *s) { qemu_del_timer(s->rtc.hz); s->rtc.next = -qemu_get_clock(rt_clock); if (s->rtc.next < 1) s->rtc.next = 1; }
[ 1, 0 ]
qemu
hw/mcf5206.c
static void m5206_mbar_writeb(void *opaque, target_phys_addr_t offset, uint32_t value) { m5206_mbar_state *s = (m5206_mbar_state *)opaque; int width; offset &= 0x3ff; if (offset > 0x200) { hw_error("Bad MBAR write offset 0x%x", (int)offset); } width = m5206_mbar_wid...
[ 1, 0 ]
qemu
block/qcow2.c
static bool is_zero_sectors(BlockDriverState *bs, int64_t start, uint32_t count) { int nr; BlockDriverState *file; int64_t res; if (!count) { return true; res = bdrv_get_block_status_above(bs, NULL, start, count, &nr, &file); return res >= 0 && (res & BDRV_BLOCK_ZERO) && ...
[ 1, 0 ]
FFmpeg
libavcodec/sanm.c
static void fill_block(uint16_t *pdest, uint16_t color, int block_size, int pitch) { int x, y; pitch -= block_size; for (y = 0; y != block_size; y++, pdest += pitch) for (x = 0; x != block_size; x++) *pdest++ = color; }
[ 1, 0 ]
qemu
tests/ivshmem-test.c
static void test_ivshmem_single(void) { IVState state, *s; uint32_t data[1024]; int i; setup_vm(&state); s = &state; /* valid io */ out_reg(s, INTRMASK, 0); in_reg(s, INTRSTATUS); in_reg(s, IVPOSITION); out_reg(s, INTRMASK, 0xffffffff); g_assert_cmpuint(in_reg(s, INTRMASK), ==, 0xfffff...
[ 1, 1 ]
qemu
tests/tco-test.c
static void test_tco_second_timeout_none(void) { TestData td; const uint16_t ticks = TCO_SECS_TO_TICKS(256); QDict *ad; td.args = "-watchdog-action none"; td.noreboot = false; test_init(&td); stop_tco(&td); clear_tco_status(&td); reset_on_second_timeout(true); set_tco_timeout(&td, ticks);...
[ 1, 0 ]
qemu
iohandler.c
int qemu_set_fd_handler2(int fd, IOCanReadHandler *fd_read_poll, IOHandler *fd_read, IOHandler *fd_write, void *opaque) { IOHandlerRecord *ioh; if (!fd_read && !fd_write) { QLIST_FOREACH(ioh, &io_handlers, next) { if (ioh->fd == fd) { ioh->deleted ...
[ 1, 1 ]
qemu
block.c
static int bdrv_prwv_co(BdrvChild *child, int64_t offset, QEMUIOVector *qiov, bool is_write, BdrvRequestFlags flags) { Coroutine *co; RwCo rwco = { .child = child, .offset = offset, .qiov = qiov, .is_write = is_write, .ret = NOT...
[ 1, 0 ]
qemu
linux-user/signal.c
static void setup_frame(int sig, struct target_sigaction *ka, target_sigset_t *set, CPUM68KState *env) { struct target_sigframe *frame; abi_ulong frame_addr; abi_ulong retcode_addr; abi_ulong sc_addr; int err = 0; int i; frame_addr = get_sigframe(ka, env, sizeof *frame); ...
[ 1, 0 ]
qemu
qom/cpu.c
static void openrisc_cpu_realizefn(DeviceState *dev, Error **errp) { OpenRISCCPU *cpu = OPENRISC_CPU(dev); OpenRISCCPUClass *occ = OPENRISC_CPU_GET_CLASS(dev); cpu_reset(CPU(cpu)); occ->parent_realize(dev, errp); }
[ 1, 0 ]
FFmpeg
libavcodec/h264.c
static void init_dequant8_coeff_table(H264Context *h) { int i, q, x; const int transpose = (h->h264dsp.h264_idct8_add != ff_h264_idct8_add_c); // FIXME ugly h->dequant8_coeff[0] = h->dequant8_buffer[0]; h->dequant8_coeff[1] = h->dequant8_buffer[1]; for (i = 0; i < 2; i++) { if (i && !memcmp(h-...
[ 1, 1 ]
qemu
cpus.c
static int64_t cpu_get_clock_locked(void) { int64_t ti; if (!timers_state.cpu_ticks_enabled) { ti = timers_state.cpu_clock_offset; } else { ti = get_clock(); ti += timers_state.cpu_clock_offset; } return ti; }
[ 1, 0 ]
qemu
tests/test-cutils.c
static void test_qemu_strtoul_whitespace(void) { const char *str = " \t "; 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, ==, 0); g_assert(endptr == str); }
[ 1, 0 ]
qemu
docs/qapi-code-gen.txt
static void test_validate_fail_struct_nested(TestInputVisitorData *data, const void *unused) { UserDefTwo *udp = NULL; Error *err = NULL; Visitor *v; v = validate_test_init( data, "{ 'string0': 'string0', 'dict1': { 'string1': 'string1', 'dict2': " ...
[ 1, 0 ]
qemu
hw/hpet.c
static void update_irq(struct HPETTimer *timer) { qemu_irq irq; int route; if (timer->tn <= 1 && hpet_in_legacy_mode()) { /* if LegacyReplacementRoute bit is set, HPET specification requires * timer0 be routed to IRQ0 in NON-APIC or IRQ2 in the I/O APIC, * timer1 be routed to IRQ8 in NON-APIC...
[ 1, 0 ]
qemu
hw/virtio/virtio.c
void virtio_reset(void *opaque) { VirtIODevice *vdev = opaque; VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); int i; virtio_set_status(vdev, 0); if (current_cpu) { /* Guest initiated reset */ vdev->device_endian = virtio_current_cpu_endian(); } else { /* System reset */ vde...
[ 1, 0 ]
qemu
hw/net/vmxnet3.c
static uint64_t vmxnet3_get_command_status(VMXNET3State *s) { uint64_t ret; switch (s->last_command) { case VMXNET3_CMD_ACTIVATE_DEV: ret = (s->device_active) ? 0 : -1; VMW_CFPRN("Device active: %" PRIx64, ret); break; case VMXNET3_CMD_RESET_DEV: case VMXNET3_CMD_QUIESCE_DEV: case VMXN...
[ 1, 0 ]
qemu
acl.c
void cpu_breakpoint_remove_by_ref(CPUState *env, CPUBreakpoint *breakpoint) { #if defined(TARGET_HAS_ICE) TAILQ_REMOVE(&env->breakpoints, breakpoint, entry); breakpoint_invalidate(env, breakpoint->pc); qemu_free(breakpoint); #endif }
[ 0, 0 ]
FFmpeg
libavformat/mov.c
static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) { AVIndexEntry *sample = NULL; int64_t best_dts = INT64_MAX; int i; for (i = 0; i < s->nb_streams; i++) { AVStream *avst = s->streams[i]; MOVStreamContext *msc = avst->priv_data; if (msc->pb && msc->current_sample <...
[ 1, 0 ]
qemu
Makefile.objs
static int ram_load(QEMUFile *f, void *opaque, int version_id) { ram_addr_t addr; int flags; if (version_id != 3) return -EINVAL; do { addr = qemu_get_be64(f); flags = addr & ~TARGET_PAGE_MASK; addr &= TARGET_PAGE_MASK; if (flags & RAM_SAVE_FLAG_MEM_SIZE) { if (addr != last_...
[ 1, 0 ]
qemu
HACKING
static uint64_t cirrus_linear_bitblt_read(void *opaque, target_phys_addr_t addr, unsigned size) { CirrusVGAState *s = opaque; uint32_t ret; /* XXX handle bitblt */ (void)s; ret = 0xff; return ret; }
[ 1, 1 ]
FFmpeg
libavutil/opt.c
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); ...
[ 1, 0 ]
FFmpeg
libavcodec/dvdsubenc.c
static void count_colors(AVCodecContext *avctx, unsigned hits[33], const AVSubtitleRect *r) { DVDSubtitleContext *dvdc = avctx->priv_data; unsigned count[256] = {0}; uint32_t *palette = (uint32_t *)r->pict.data[1]; uint32_t color; int x, y, i, j, match, d, best_d, av_uninit(bes...
[ 1, 0 ]
qemu
memory.c
static MemTxResult memory_region_read_with_attrs_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, ...
[ 1, 0 ]
qemu
target-ppc/kvm.c
void kvm_arch_remove_all_hw_breakpoints(void) {}
[ 1, 0 ]