idx
int64
func
string
target
int64
398,526
static int abbrev_cmp(const void *a, const void *b) { const RzBinDwarfAbbrevDecl *first = a; const RzBinDwarfAbbrevDecl *second = b; if (first->offset > second->offset) { return 1; } else if (first->offset < second->offset) { return -1; } else { return 0; } }
0
229,144
static void flush_queued_data(VirtIOSerialPort *port) { assert(port); if (!virtio_queue_ready(port->ovq)) { return; } do_flush_queued_data(port, port->ovq, VIRTIO_DEVICE(port->vser)); }
0
281,095
static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst, int nfheader_len) { const struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(dst->ops->family); int err; if (!afinfo) return -EINVAL; err = afinfo->init_path(path, dst, nfheader_len); rcu_read_unlock(); return err; }
0
316,970
static int selinux_inode_rename(struct inode *old_inode, struct dentry *old_dentry, struct inode *new_inode, struct dentry *new_dentry) { return may_rename(old_inode, old_dentry, new_inode, new_dentry); }
0
517,422
static void do_home_file(HttpResponse res) { char buf[STRLEN]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_conf; s; s = s->next_conf) { if (s->type != Service_File) continue; if (header) { StringBuffer_append(res->outputbuffer, "<table id='header-row'>" "<tr>" "<th class='left first'>File</th>" "<th class='left'>Status</th>" "<th class='right'>Size</th>" "<th class='right'>Permission</th>" "<th class='right'>UID</th>" "<th class='right'>GID</th>" "</tr>"); header = false; } StringBuffer_append(res->outputbuffer, "<tr %s>" "<td class='left'><a href='%s'>%s</a></td>" "<td class='left'>%s</td>", on ? "class='stripe'" : "", s->name, s->name, get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s) || s->inf.file->size < 0) StringBuffer_append(res->outputbuffer, "<td class='right'>-</td>"); else StringBuffer_append(res->outputbuffer, "<td class='right'>%s</td>", Fmt_bytes2str(s->inf.file->size, (char[10]){})); if (! Util_hasServiceStatus(s) || s->inf.file->mode < 0) StringBuffer_append(res->outputbuffer, "<td class='right'>-</td>"); else StringBuffer_append(res->outputbuffer, "<td class='right'>%04o</td>", s->inf.file->mode & 07777); if (! Util_hasServiceStatus(s) || s->inf.file->uid < 0) StringBuffer_append(res->outputbuffer, "<td class='right'>-</td>"); else StringBuffer_append(res->outputbuffer, "<td class='right'>%d</td>", s->inf.file->uid); if (! Util_hasServiceStatus(s) || s->inf.file->gid < 0) StringBuffer_append(res->outputbuffer, "<td class='right'>-</td>"); else StringBuffer_append(res->outputbuffer, "<td class='right'>%d</td>", s->inf.file->gid); StringBuffer_append(res->outputbuffer, "</tr>"); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "</table>"); }
0
442,577
to_physical(const void *ptr) { return (uintptr_t) ptr; }
0
402,606
daemonize(cms_context *cms_ctx, char *certdir, int do_fork) { int rc = 0; context ctx = { .backup_cms = cms_ctx, .priority = do_fork ? LOG_PID : LOG_PID|LOG_PERROR, }; ctx.backup_cms = cms_ctx; ctx.backup_cms->log_priv = &ctx; ctx.sd = -1; if (getuid() != 0) { fprintf(stderr, "pesignd must be started as root"); exit(1); } check_socket(&ctx); openlog("pesignd", LOG_PID, LOG_DAEMON); if (do_fork) { pid_t pid; if ((pid = fork())) { sleep(2); return 0; } } ctx.pid = getpid(); write_pid_file(ctx.pid); ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_NOTICE, "pesignd starting (pid %d)", ctx.pid); daemon_logger(ctx.backup_cms, ctx.priority|LOG_NOTICE, "pesignd starting (pid %d)", ctx.pid); SECStatus status = NSS_Init(certdir); int error = errno; if (status != SECSuccess) { char *globpattern = NULL; rc = asprintf(&globpattern, "%s/cert*.db", certdir); if (rc > 0) { glob_t globbuf; memset(&globbuf, 0, sizeof(globbuf)); rc = glob(globpattern, GLOB_ERR, NULL, &globbuf); if (rc != 0) { errno = error; ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_NOTICE, "Could not open NSS database (\"%s\"): %m", PORT_ErrorToString(PORT_GetError())); exit(1); } } } if (status != SECSuccess) { errno = error; ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_NOTICE, "Could not initialize nss.\n" "NSS says \"%s\" errno says \"%m\"\n", PORT_ErrorToString(PORT_GetError())); exit(1); } status = register_oids(ctx.backup_cms); if (status != SECSuccess) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_NOTICE, "Could not register OIDs\n"); exit(1); } if (do_fork) { int fd = open("/dev/zero", O_RDONLY); if (fd < 0) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "could not open /dev/zero: %m"); exit(1); } close(STDIN_FILENO); rc = dup2(fd, STDIN_FILENO); if (rc < 0) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "could not set up standard input: %m"); exit(1); } close(fd); fd = open("/dev/null", O_WRONLY); if (fd < 0) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "could not open /dev/null: %m"); exit(1); } close(STDOUT_FILENO); rc = dup2(fd, STDOUT_FILENO); if (rc < 0) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "could not set up standard output: %m"); exit(1); } close(STDERR_FILENO); rc = dup2(fd, STDERR_FILENO); if (rc < 0) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "could not set up standard error: %m"); exit(1); } close(fd); } prctl(PR_SET_NAME, "pesignd", 0, 0, 0); setsid(); if (do_fork) { struct sigaction sa = { .sa_handler = quit_handler, }; sigaction(SIGQUIT, &sa, NULL); sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); } char *homedir = NULL; rc = get_uid_and_gid(&ctx, &homedir); if (rc < 0) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "could not get group and user information " "for pesign: %m"); exit(1); } chdir(homedir ? homedir : "/"); if (getuid() == 0) { /* process is running as root, drop privileges */ if (setgid(ctx.gid) != 0 || setgroups(0, NULL)) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "unable to drop group privileges: %m"); exit(1); } if (setuid(ctx.uid) != 0) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "unable to drop user privileges: %m"); exit(1); } } set_up_socket(&ctx); cms_set_pw_callback(ctx.backup_cms, get_password_fail); cms_set_pw_data(ctx.backup_cms, NULL); if (do_fork) ctx.backup_cms->log = daemon_logger; rc = handle_events(&ctx); status = NSS_Shutdown(); if (status != SECSuccess) { ctx.backup_cms->log(ctx.backup_cms, ctx.priority|LOG_ERR, "NSS_Shutdown failed: %s\n", PORT_ErrorToString(PORT_GetError())); exit(1); } return rc; }
0
437,001
static void mcba_usb_process_can(struct mcba_priv *priv, struct mcba_usb_msg_can *msg) { struct can_frame *cf; struct sk_buff *skb; struct net_device_stats *stats = &priv->netdev->stats; u16 sid; skb = alloc_can_skb(priv->netdev, &cf); if (!skb) return; sid = get_unaligned_be16(&msg->sid); if (sid & MCBA_SIDL_EXID_MASK) { /* SIDH | SIDL | EIDH | EIDL * 28 - 21 | 20 19 18 x x x 17 16 | 15 - 8 | 7 - 0 */ cf->can_id = CAN_EFF_FLAG; /* store 28-18 bits */ cf->can_id |= (sid & 0xffe0) << 13; /* store 17-16 bits */ cf->can_id |= (sid & 3) << 16; /* store 15-0 bits */ cf->can_id |= get_unaligned_be16(&msg->eid); } else { /* SIDH | SIDL * 10 - 3 | 2 1 0 x x x x x */ cf->can_id = (sid & 0xffe0) >> 5; } cf->len = can_cc_dlc2len(msg->dlc & MCBA_DLC_MASK); if (msg->dlc & MCBA_DLC_RTR_MASK) { cf->can_id |= CAN_RTR_FLAG; } else { memcpy(cf->data, msg->data, cf->len); stats->rx_bytes += cf->len; } stats->rx_packets++; can_led_event(priv->netdev, CAN_LED_EVENT_RX); netif_rx(skb); }
0
318,954
f_test_null_blob(typval_T *argvars UNUSED, typval_T *rettv) { rettv->v_type = VAR_BLOB; rettv->vval.v_blob = NULL; }
0
90,876
const std::set<GURL>& modified_origins() const { return modified_origins_; }
0
427,194
static void lastlistfield (FuncState *fs, ConsControl *cc) { if (cc->tostore == 0) return; if (hasmultret(cc->v.k)) { luaK_setmultret(fs, &cc->v); luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); cc->na--; /* do not count last expression (unknown number of elements) */ } else { if (cc->v.k != VVOID) luaK_exp2nextreg(fs, &cc->v); luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); } cc->na += cc->tostore; }
0
225,493
NodeDef* MutableGraphView::GetOrCreateIdentityConsumingSwitch( const OutputPort& fanin) { // We haven't found an existing node where we can anchor the control // dependency: add a new identity node. string identity_name = GeneratedNameForIdentityConsumingSwitch(fanin); NodeDef* identity_node = GetNode(identity_name); if (identity_node == nullptr) { NodeDef new_node; new_node.set_name(identity_name); new_node.set_op("Identity"); new_node.set_device(fanin.node->device()); (*new_node.mutable_attr())["T"].set_type(fanin.node->attr().at("T").type()); new_node.add_input(TensorIdToString({fanin.node->name(), fanin.port_id})); identity_node = AddNode(std::move(new_node)); } return identity_node; }
0
385,913
static int do_dentry_open(struct file *f, int (*open)(struct inode *, struct file *), const struct cred *cred) { static const struct file_operations empty_fops = {}; struct inode *inode; int error; f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE; if (unlikely(f->f_flags & O_PATH)) f->f_mode = FMODE_PATH; path_get(&f->f_path); inode = f->f_inode = f->f_path.dentry->d_inode; if (f->f_mode & FMODE_WRITE) { error = __get_file_write_access(inode, f->f_path.mnt); if (error) goto cleanup_file; if (!special_file(inode->i_mode)) file_take_write(f); } f->f_mapping = inode->i_mapping; file_sb_list_add(f, inode->i_sb); if (unlikely(f->f_mode & FMODE_PATH)) { f->f_op = &empty_fops; return 0; } f->f_op = fops_get(inode->i_fop); error = security_file_open(f, cred); if (error) goto cleanup_all; error = break_lease(inode, f->f_flags); if (error) goto cleanup_all; if (!open && f->f_op) open = f->f_op->open; if (open) { error = open(inode, f); if (error) goto cleanup_all; } if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) i_readcount_inc(inode); f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping); return 0; cleanup_all: fops_put(f->f_op); file_sb_list_del(f); if (f->f_mode & FMODE_WRITE) { put_write_access(inode); if (!special_file(inode->i_mode)) { /* * We don't consider this a real * mnt_want/drop_write() pair * because it all happenend right * here, so just reset the state. */ file_reset_write(f); __mnt_drop_write(f->f_path.mnt); } } cleanup_file: path_put(&f->f_path); f->f_path.mnt = NULL; f->f_path.dentry = NULL; f->f_inode = NULL; return error; }
0
512,803
void Item_func_case::reorder_args(uint start) { /* Reorder args, to have at first the optional CASE expression, then all WHEN expressions, then all THEN expressions. And the optional ELSE expression at the end. We reorder an even number of arguments, starting from start. */ uint count = (arg_count - start) / 2; const size_t size= sizeof(Item*) * count * 2; Item **arg_buffer= (Item **)my_safe_alloca(size); memcpy(arg_buffer, &args[start], size); for (uint i= 0; i < count; i++) { args[start + i]= arg_buffer[i*2]; args[start + i + count]= arg_buffer[i*2 + 1]; } my_safe_afree(arg_buffer, size); }
0
400,771
void iov_iter_xarray(struct iov_iter *i, unsigned int direction, struct xarray *xarray, loff_t start, size_t count) { BUG_ON(direction & ~1); *i = (struct iov_iter) { .iter_type = ITER_XARRAY, .data_source = direction, .xarray = xarray, .xarray_start = start, .count = count, .iov_offset = 0 }; }
0
254,752
njs_typed_array_compare_u32(const void *a, const void *b, void *c) { uint32_t au, bu; au = *(const uint32_t *) a; bu = *(const uint32_t *) b; return (au > bu) - (au < bu); }
0
248,322
DLLIMPORT cfg_validate_callback_t cfg_set_validate_func(cfg_t *cfg, const char *name, cfg_validate_callback_t vf) { cfg_opt_t *opt; cfg_validate_callback_t oldvf; opt = cfg_getopt_array(cfg->opts, cfg->flags, name); if (!opt) return NULL; oldvf = opt->validcb; opt->validcb = vf; return oldvf; }
0
459,521
static void stack_map_free(struct bpf_map *map) { struct bpf_stack_map *smap = container_of(map, struct bpf_stack_map, map); bpf_map_area_free(smap->elems); pcpu_freelist_destroy(&smap->freelist); bpf_map_area_free(smap); put_callchain_buffers(); }
0
468,383
g_socket_client_set_timeout (GSocketClient *client, guint timeout) { if (client->priv->timeout == timeout) return; client->priv->timeout = timeout; g_object_notify (G_OBJECT (client), "timeout"); }
0
438,670
static int rpmsg_recv_single(struct virtproc_info *vrp, struct device *dev, struct rpmsg_hdr *msg, unsigned int len) { struct rpmsg_endpoint *ept; struct scatterlist sg; bool little_endian = virtio_is_little_endian(vrp->vdev); unsigned int msg_len = __rpmsg16_to_cpu(little_endian, msg->len); int err; dev_dbg(dev, "From: 0x%x, To: 0x%x, Len: %d, Flags: %d, Reserved: %d\n", __rpmsg32_to_cpu(little_endian, msg->src), __rpmsg32_to_cpu(little_endian, msg->dst), msg_len, __rpmsg16_to_cpu(little_endian, msg->flags), __rpmsg32_to_cpu(little_endian, msg->reserved)); #if defined(CONFIG_DYNAMIC_DEBUG) dynamic_hex_dump("rpmsg_virtio RX: ", DUMP_PREFIX_NONE, 16, 1, msg, sizeof(*msg) + msg_len, true); #endif /* * We currently use fixed-sized buffers, so trivially sanitize * the reported payload length. */ if (len > vrp->buf_size || msg_len > (len - sizeof(struct rpmsg_hdr))) { dev_warn(dev, "inbound msg too big: (%d, %d)\n", len, msg_len); return -EINVAL; } /* use the dst addr to fetch the callback of the appropriate user */ mutex_lock(&vrp->endpoints_lock); ept = idr_find(&vrp->endpoints, __rpmsg32_to_cpu(little_endian, msg->dst)); /* let's make sure no one deallocates ept while we use it */ if (ept) kref_get(&ept->refcount); mutex_unlock(&vrp->endpoints_lock); if (ept) { /* make sure ept->cb doesn't go away while we use it */ mutex_lock(&ept->cb_lock); if (ept->cb) ept->cb(ept->rpdev, msg->data, msg_len, ept->priv, __rpmsg32_to_cpu(little_endian, msg->src)); mutex_unlock(&ept->cb_lock); /* farewell, ept, we don't need you anymore */ kref_put(&ept->refcount, __ept_release); } else dev_warn_ratelimited(dev, "msg received with no recipient\n"); /* publish the real size of the buffer */ rpmsg_sg_init(&sg, msg, vrp->buf_size); /* add the buffer back to the remote processor's virtqueue */ err = virtqueue_add_inbuf(vrp->rvq, &sg, 1, msg, GFP_KERNEL); if (err < 0) { dev_err(dev, "failed to add a virtqueue buffer: %d\n", err); return err; } return 0; }
0
359,643
community_list_set_vty (struct vty *vty, int argc, const char **argv, int style, int reject_all_digit_name) { int ret; int direct; char *str; /* Check the list type. */ if (strncmp (argv[1], "p", 1) == 0) direct = COMMUNITY_PERMIT; else if (strncmp (argv[1], "d", 1) == 0) direct = COMMUNITY_DENY; else { vty_out (vty, "%% Matching condition must be permit or deny%s", VTY_NEWLINE); return CMD_WARNING; } /* All digit name check. */ if (reject_all_digit_name && all_digit (argv[0])) { vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE); return CMD_WARNING; } /* Concat community string argument. */ if (argc > 1) str = argv_concat (argv, argc, 2); else str = NULL; /* When community_list_set() return nevetive value, it means malformed community string. */ ret = community_list_set (bgp_clist, argv[0], str, direct, style); /* Free temporary community list string allocated by argv_concat(). */ if (str) XFREE (MTYPE_TMP, str); if (ret < 0) { /* Display error string. */ community_list_perror (vty, ret); return CMD_WARNING; } return CMD_SUCCESS; }
0
238,443
static void scalar_min_max_lsh(struct bpf_reg_state *dst_reg, struct bpf_reg_state *src_reg) { u64 umax_val = src_reg->umax_value; u64 umin_val = src_reg->umin_value; /* scalar64 calc uses 32bit unshifted bounds so must be called first */ __scalar64_min_max_lsh(dst_reg, umin_val, umax_val); __scalar32_min_max_lsh(dst_reg, umin_val, umax_val); dst_reg->var_off = tnum_lshift(dst_reg->var_off, umin_val); /* We may learn something more from the var_off */ __update_reg_bounds(dst_reg); }
0
502,707
long SSL_CTX_set_timeout(SSL_CTX *s, long t) { long l; if (s == NULL) return (0); l = s->session_timeout; s->session_timeout = t; return (l); }
0
477,974
static void simplestring_init_str(simplestring* string) { string->str = (char*)malloc(SIMPLESTRING_INCR); if(string->str) { string->str[0] = 0; string->len = 0; string->size = SIMPLESTRING_INCR; } else { string->size = 0; } }
0
386,534
void DL_Dxf::writeDimStyleOverrides(DL_WriterA& dw, const DL_DimensionData& data) { if (version==DL_VERSION_2000) { dw.dxfString(1001, "ACAD"); dw.dxfString(1000, "DSTYLE"); dw.dxfString(1002, "{"); if (data.type&128) { // custom text position: dw.dxfInt(1070, 279); dw.dxfInt(1070, 2); } dw.dxfInt(1070, 144); dw.dxfReal(1040, data.linearFactor); dw.dxfInt(1070,40); dw.dxfReal(1040, data.dimScale); dw.dxfString(1002, "}"); } }
0
481,269
static void mlx5_fpga_conn_sq_cqe(struct mlx5_fpga_conn *conn, struct mlx5_cqe64 *cqe, u8 status) { struct mlx5_fpga_dma_buf *buf, *nextbuf; unsigned long flags; int ix; spin_lock_irqsave(&conn->qp.sq.lock, flags); ix = be16_to_cpu(cqe->wqe_counter) & (conn->qp.sq.size - 1); buf = conn->qp.sq.bufs[ix]; conn->qp.sq.bufs[ix] = NULL; conn->qp.sq.cc++; /* Handle backlog still under the spinlock to ensure message post order */ if (unlikely(!list_empty(&conn->qp.sq.backlog))) { if (likely(conn->qp.active)) { nextbuf = list_first_entry(&conn->qp.sq.backlog, struct mlx5_fpga_dma_buf, list); list_del(&nextbuf->list); mlx5_fpga_conn_post_send(conn, nextbuf); } } spin_unlock_irqrestore(&conn->qp.sq.lock, flags); if (unlikely(status && (status != MLX5_CQE_SYNDROME_WR_FLUSH_ERR))) mlx5_fpga_warn(conn->fdev, "SQ buf %p on FPGA QP %u completion status %d\n", buf, conn->fpga_qpn, status); else mlx5_fpga_dbg(conn->fdev, "SQ buf %p on FPGA QP %u completion status %d\n", buf, conn->fpga_qpn, status); mlx5_fpga_conn_unmap_buf(conn, buf); if (likely(buf->complete)) buf->complete(conn, conn->fdev, buf, status); if (unlikely(status)) conn->qp.active = false; }
0
241,367
void ValidateInputMatrixShapes( OpKernelContext* context, const TensorShapes& input_matrix_shapes) const final { Base::ValidateSquareSolver(context, input_matrix_shapes); }
0
197,015
GF_Err SetupWriters(MovieWriter *mw, GF_List *writers, u8 interleaving) { u32 i, trackCount; TrackWriter *writer; GF_TrackBox *trak; GF_ISOFile *movie = mw->movie; mw->total_samples = mw->nb_done = 0; if (!movie->moov) return GF_OK; trackCount = gf_list_count(movie->moov->trackList); for (i = 0; i < trackCount; i++) { trak = gf_isom_get_track(movie->moov, i+1); GF_SAFEALLOC(writer, TrackWriter); if (!writer) goto exit; writer->sampleNumber = 1; writer->mdia = trak->Media; writer->stbl = trak->Media->information->sampleTable; writer->timeScale = trak->Media->mediaHeader->timeScale; writer->all_dref_mode = Media_SelfContainedType(writer->mdia); if (trak->sample_encryption) writer->prevent_dispatch = GF_TRUE; writer->isDone = 0; writer->DTSprev = 0; writer->chunkDur = 0; writer->chunkSize = 0; writer->constant_size = writer->constant_dur = 0; if (writer->stbl->SampleSize->sampleSize) writer->constant_size = writer->stbl->SampleSize->sampleSize; if (writer->stbl->TimeToSample->nb_entries==1) { writer->constant_dur = writer->stbl->TimeToSample->entries[0].sampleDelta; if (writer->constant_dur>1) writer->constant_dur = 0; } if (!writer->constant_dur || !writer->constant_size || (writer->constant_size>=10)) writer->constant_size = writer->constant_dur = 0; writer->stsc = (GF_SampleToChunkBox *) gf_isom_box_new(GF_ISOM_BOX_TYPE_STSC); if (!writer->stsc) return GF_OUT_OF_MEM; if (writer->stbl->ChunkOffset->type == GF_ISOM_BOX_TYPE_STCO) { writer->stco = gf_isom_box_new(GF_ISOM_BOX_TYPE_STCO); } else { writer->stco = gf_isom_box_new(GF_ISOM_BOX_TYPE_CO64); } if (!writer->stco) return GF_OUT_OF_MEM; /*stops from chunk escape*/ if (interleaving) writer->stbl->MaxSamplePerChunk = 0; /*for progress, assume only one descIndex*/ if (Media_IsSelfContained(writer->mdia, 1)) mw->total_samples += writer->stbl->SampleSize->sampleCount; /*optimization for interleaving: put audio last (this can be overridden by priorities)*/ if (movie->storageMode != GF_ISOM_STORE_INTERLEAVED) { gf_list_add(writers, writer); } else { if (writer->mdia->information->InfoHeader && writer->mdia->information->InfoHeader->type == GF_ISOM_BOX_TYPE_SMHD) { gf_list_add(writers, writer); } else { gf_list_insert(writers, writer, 0); } } if (movie->sample_groups_in_traf && trak->Media->information->sampleTable) { gf_isom_box_array_del_parent(&trak->Media->information->sampleTable->child_boxes, trak->Media->information->sampleTable->sampleGroupsDescription); trak->Media->information->sampleTable->sampleGroupsDescription = NULL; } } return GF_OK; exit: CleanWriters(writers); return GF_OUT_OF_MEM; }
1
261,906
njs_string_from_char_code(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, njs_index_t is_point) { double num; u_char *p, *start, *end; ssize_t len; int32_t code; uint32_t cp; uint64_t length, size; njs_int_t ret; njs_uint_t i; njs_unicode_decode_t ctx; u_char buf[4]; size = 0; length = 0; cp = 0x00; end = buf + sizeof(buf); njs_utf16_decode_init(&ctx); for (i = 1; i < nargs; i++) { if (!njs_is_numeric(&args[i])) { ret = njs_value_to_numeric(vm, &args[i], &args[i]); if (ret != NJS_OK) { return ret; } } if (is_point) { num = njs_number(&args[i]); if (isnan(num)) { goto range_error; } code = num; if (code != num || code < 0 || code > 0x10FFFF) { goto range_error; } } else { code = njs_number_to_uint16(njs_number(&args[i])); } start = buf; len = njs_utf16_encode(code, &start, end); start = buf; cp = njs_utf16_decode(&ctx, (const u_char **) &start, start + len); if (cp > NJS_UNICODE_MAX_CODEPOINT) { if (cp == NJS_UNICODE_CONTINUE) { continue; } cp = NJS_UNICODE_REPLACEMENT; } size += njs_utf8_size(cp); length++; } if (cp == NJS_UNICODE_CONTINUE) { size += njs_utf8_size(NJS_UNICODE_REPLACEMENT); length++; } p = njs_string_alloc(vm, &vm->retval, size, length); if (njs_slow_path(p == NULL)) { return NJS_ERROR; } njs_utf16_decode_init(&ctx); for (i = 1; i < nargs; i++) { if (is_point) { code = njs_number(&args[i]); } else { code = njs_number_to_uint16(njs_number(&args[i])); } start = buf; len = njs_utf16_encode(code, &start, end); start = buf; cp = njs_utf16_decode(&ctx, (const u_char **) &start, start + len); if (cp > NJS_UNICODE_MAX_CODEPOINT) { if (cp == NJS_UNICODE_CONTINUE && i + 1 != nargs) { continue; } cp = NJS_UNICODE_REPLACEMENT; } p = njs_utf8_encode(p, cp); } return NJS_OK; range_error: njs_range_error(vm, NULL); return NJS_ERROR; }
0
391,629
void dlpar_sysfs_exit(void) { sysfs_remove_group(dlpar_kobj, &dlpar_attr_group); kobject_put(dlpar_kobj); }
0
238,571
static int check_cond_jmp_op(struct bpf_verifier_env *env, struct bpf_insn *insn, int *insn_idx) { struct bpf_verifier_state *this_branch = env->cur_state; struct bpf_verifier_state *other_branch; struct bpf_reg_state *regs = this_branch->frame[this_branch->curframe]->regs; struct bpf_reg_state *dst_reg, *other_branch_regs, *src_reg = NULL; u8 opcode = BPF_OP(insn->code); bool is_jmp32; int pred = -1; int err; /* Only conditional jumps are expected to reach here. */ if (opcode == BPF_JA || opcode > BPF_JSLE) { verbose(env, "invalid BPF_JMP/JMP32 opcode %x\n", opcode); return -EINVAL; } if (BPF_SRC(insn->code) == BPF_X) { if (insn->imm != 0) { verbose(env, "BPF_JMP/JMP32 uses reserved fields\n"); return -EINVAL; } /* check src1 operand */ err = check_reg_arg(env, insn->src_reg, SRC_OP); if (err) return err; if (is_pointer_value(env, insn->src_reg)) { verbose(env, "R%d pointer comparison prohibited\n", insn->src_reg); return -EACCES; } src_reg = &regs[insn->src_reg]; } else { if (insn->src_reg != BPF_REG_0) { verbose(env, "BPF_JMP/JMP32 uses reserved fields\n"); return -EINVAL; } } /* check src2 operand */ err = check_reg_arg(env, insn->dst_reg, SRC_OP); if (err) return err; dst_reg = &regs[insn->dst_reg]; is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32; if (BPF_SRC(insn->code) == BPF_K) { pred = is_branch_taken(dst_reg, insn->imm, opcode, is_jmp32); } else if (src_reg->type == SCALAR_VALUE && is_jmp32 && tnum_is_const(tnum_subreg(src_reg->var_off))) { pred = is_branch_taken(dst_reg, tnum_subreg(src_reg->var_off).value, opcode, is_jmp32); } else if (src_reg->type == SCALAR_VALUE && !is_jmp32 && tnum_is_const(src_reg->var_off)) { pred = is_branch_taken(dst_reg, src_reg->var_off.value, opcode, is_jmp32); } else if (reg_is_pkt_pointer_any(dst_reg) && reg_is_pkt_pointer_any(src_reg) && !is_jmp32) { pred = is_pkt_ptr_branch_taken(dst_reg, src_reg, opcode); } if (pred >= 0) { /* If we get here with a dst_reg pointer type it is because * above is_branch_taken() special cased the 0 comparison. */ if (!__is_pointer_value(false, dst_reg)) err = mark_chain_precision(env, insn->dst_reg); if (BPF_SRC(insn->code) == BPF_X && !err && !__is_pointer_value(false, src_reg)) err = mark_chain_precision(env, insn->src_reg); if (err) return err; } if (pred == 1) { /* Only follow the goto, ignore fall-through. If needed, push * the fall-through branch for simulation under speculative * execution. */ if (!env->bypass_spec_v1 && !sanitize_speculative_path(env, insn, *insn_idx + 1, *insn_idx)) return -EFAULT; *insn_idx += insn->off; return 0; } else if (pred == 0) { /* Only follow the fall-through branch, since that's where the * program will go. If needed, push the goto branch for * simulation under speculative execution. */ if (!env->bypass_spec_v1 && !sanitize_speculative_path(env, insn, *insn_idx + insn->off + 1, *insn_idx)) return -EFAULT; return 0; } other_branch = push_stack(env, *insn_idx + insn->off + 1, *insn_idx, false); if (!other_branch) return -EFAULT; other_branch_regs = other_branch->frame[other_branch->curframe]->regs; /* detect if we are comparing against a constant value so we can adjust * our min/max values for our dst register. * this is only legit if both are scalars (or pointers to the same * object, I suppose, but we don't support that right now), because * otherwise the different base pointers mean the offsets aren't * comparable. */ if (BPF_SRC(insn->code) == BPF_X) { struct bpf_reg_state *src_reg = &regs[insn->src_reg]; if (dst_reg->type == SCALAR_VALUE && src_reg->type == SCALAR_VALUE) { if (tnum_is_const(src_reg->var_off) || (is_jmp32 && tnum_is_const(tnum_subreg(src_reg->var_off)))) reg_set_min_max(&other_branch_regs[insn->dst_reg], dst_reg, src_reg->var_off.value, tnum_subreg(src_reg->var_off).value, opcode, is_jmp32); else if (tnum_is_const(dst_reg->var_off) || (is_jmp32 && tnum_is_const(tnum_subreg(dst_reg->var_off)))) reg_set_min_max_inv(&other_branch_regs[insn->src_reg], src_reg, dst_reg->var_off.value, tnum_subreg(dst_reg->var_off).value, opcode, is_jmp32); else if (!is_jmp32 && (opcode == BPF_JEQ || opcode == BPF_JNE)) /* Comparing for equality, we can combine knowledge */ reg_combine_min_max(&other_branch_regs[insn->src_reg], &other_branch_regs[insn->dst_reg], src_reg, dst_reg, opcode); if (src_reg->id && !WARN_ON_ONCE(src_reg->id != other_branch_regs[insn->src_reg].id)) { find_equal_scalars(this_branch, src_reg); find_equal_scalars(other_branch, &other_branch_regs[insn->src_reg]); } } } else if (dst_reg->type == SCALAR_VALUE) { reg_set_min_max(&other_branch_regs[insn->dst_reg], dst_reg, insn->imm, (u32)insn->imm, opcode, is_jmp32); } if (dst_reg->type == SCALAR_VALUE && dst_reg->id && !WARN_ON_ONCE(dst_reg->id != other_branch_regs[insn->dst_reg].id)) { find_equal_scalars(this_branch, dst_reg); find_equal_scalars(other_branch, &other_branch_regs[insn->dst_reg]); } /* detect if R == 0 where R is returned from bpf_map_lookup_elem(). * NOTE: these optimizations below are related with pointer comparison * which will never be JMP32. */ if (!is_jmp32 && BPF_SRC(insn->code) == BPF_K && insn->imm == 0 && (opcode == BPF_JEQ || opcode == BPF_JNE) && type_may_be_null(dst_reg->type)) { /* Mark all identical registers in each branch as either * safe or unknown depending R == 0 or R != 0 conditional. */ mark_ptr_or_null_regs(this_branch, insn->dst_reg, opcode == BPF_JNE); mark_ptr_or_null_regs(other_branch, insn->dst_reg, opcode == BPF_JEQ); } else if (!try_match_pkt_pointers(insn, dst_reg, &regs[insn->src_reg], this_branch, other_branch) && is_pointer_value(env, insn->dst_reg)) { verbose(env, "R%d pointer comparison prohibited\n", insn->dst_reg); return -EACCES; } if (env->log.level & BPF_LOG_LEVEL) print_insn_state(env, this_branch->frame[this_branch->curframe]); return 0; }
0
437,289
compile_length_string_node(Node* node, regex_t* reg) { int rlen, r, len, prev_len, slen, ambig; UChar *p, *prev; StrNode* sn; OnigEncoding enc = reg->enc; sn = STR_(node); if (sn->end <= sn->s) return 0; ambig = NODE_STRING_IS_AMBIG(node); p = prev = sn->s; prev_len = enclen(enc, p); p += prev_len; slen = 1; rlen = 0; for (; p < sn->end; ) { len = enclen(enc, p); if (len == prev_len) { slen++; } else { r = add_compile_string_length(prev, prev_len, slen, reg, ambig); rlen += r; prev = p; slen = 1; prev_len = len; } p += len; } r = add_compile_string_length(prev, prev_len, slen, reg, ambig); rlen += r; return rlen; }
0
225,999
void ctts_box_del(GF_Box *s) { GF_CompositionOffsetBox *ptr = (GF_CompositionOffsetBox *)s; if (ptr->entries) gf_free(ptr->entries); gf_free(ptr); }
0
317,278
static int smack_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen) { if (sock->sk != NULL && sock->sk->sk_family == PF_INET6) { if (addrlen < SIN6_LEN_RFC2133 || address->sa_family != AF_INET6) return -EINVAL; smk_ipv6_port_label(sock, address); } return 0; }
0
223,420
static unsigned int char_get_othercase_bit(compiler_common *common, PCRE2_SPTR cc) { /* Detects if the character and its othercase has only 1 bit difference. */ unsigned int c, oc, bit; #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8 int n; #endif #ifdef SUPPORT_UNICODE if (common->utf || common->ucp) { if (common->utf) { GETCHAR(c, cc); } else c = *cc; if (c <= 127) oc = common->fcc[c]; else oc = UCD_OTHERCASE(c); } else { c = *cc; oc = TABLE_GET(c, common->fcc, c); } #else c = *cc; oc = TABLE_GET(c, common->fcc, c); #endif SLJIT_ASSERT(c != oc); bit = c ^ oc; /* Optimized for English alphabet. */ if (c <= 127 && bit == 0x20) return (0 << 8) | 0x20; /* Since c != oc, they must have at least 1 bit difference. */ if (!is_powerof2(bit)) return 0; #if PCRE2_CODE_UNIT_WIDTH == 8 #ifdef SUPPORT_UNICODE if (common->utf && c > 127) { n = GET_EXTRALEN(*cc); while ((bit & 0x3f) == 0) { n--; bit >>= 6; } return (n << 8) | bit; } #endif /* SUPPORT_UNICODE */ return (0 << 8) | bit; #elif PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32 #ifdef SUPPORT_UNICODE if (common->utf && c > 65535) { if (bit >= (1u << 10)) bit >>= 10; else return (bit < 256) ? ((2 << 8) | bit) : ((3 << 8) | (bit >> 8)); } #endif /* SUPPORT_UNICODE */ return (bit < 256) ? ((0u << 8) | bit) : ((1u << 8) | (bit >> 8)); #endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */ }
0
226,082
#ifndef GPAC_DISABLE_ISOM_WRITE GF_Err dvvC_box_write(GF_Box *s, GF_BitStream *bs) { return dvcC_box_write(s, bs);
0
225,069
setKeepalivesIdle(PGconn *conn) { int idle; if (conn->keepalives_idle == NULL) return 1; if (!parse_int_param(conn->keepalives_idle, &idle, conn, "keepalives_idle")) return 0; if (idle < 0) idle = 0; #ifdef PG_TCP_KEEPALIVE_IDLE if (setsockopt(conn->sock, IPPROTO_TCP, PG_TCP_KEEPALIVE_IDLE, (char *) &idle, sizeof(idle)) < 0) { char sebuf[PG_STRERROR_R_BUFLEN]; appendPQExpBuffer(&conn->errorMessage, libpq_gettext("%s(%s) failed: %s\n"), "setsockopt", PG_TCP_KEEPALIVE_IDLE_STR, SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } #endif return 1; }
0
234,238
add_abbrev_attr (unsigned long attribute, unsigned long form, dwarf_signed_vma implicit_const, abbrev_list * list) { abbrev_attr *attr; attr = (abbrev_attr *) xmalloc (sizeof (*attr)); attr->attribute = attribute; attr->form = form; attr->implicit_const = implicit_const; attr->next = NULL; assert (list != NULL && list->last_abbrev != NULL); if (list->last_abbrev->first_attr == NULL) list->last_abbrev->first_attr = attr; else list->last_abbrev->last_attr->next = attr; list->last_abbrev->last_attr = attr; }
0
226,289
void sgpd_box_del(GF_Box *a) { GF_SampleGroupDescriptionBox *p = (GF_SampleGroupDescriptionBox *)a; while (gf_list_count(p->group_descriptions)) { void *ptr = gf_list_last(p->group_descriptions); sgpd_del_entry(p->grouping_type, ptr); gf_list_rem_last(p->group_descriptions); } gf_list_del(p->group_descriptions); gf_free(p);
0
242,613
Status GetBuffer(OpKernelContext* ctx, const NodeDef& ndef, Buffer** buf) { auto rm = ctx->resource_manager(); ContainerInfo cinfo; // Lambda for creating the Staging Area auto create_fn = [&ndef](Buffer** ret) -> Status { int64_t capacity; int64_t memory_limit; TF_RETURN_IF_ERROR(GetNodeAttr(ndef, "capacity", &capacity)); TF_RETURN_IF_ERROR(GetNodeAttr(ndef, "memory_limit", &memory_limit)); *ret = new Buffer(capacity, memory_limit); return Status::OK(); }; TF_RETURN_IF_ERROR(cinfo.Init(rm, ndef, true /* use name() */)); TF_RETURN_IF_ERROR(rm->LookupOrCreate<Buffer>(cinfo.container(), cinfo.name(), buf, create_fn)); return Status::OK(); }
0
413,587
static RList *recurse(RCore *core, RAnalBlock *from, RAnalBlock *dest) { recurse_bb (core, from->jump, dest); recurse_bb (core, from->fail, dest); /* same for all calls */ // TODO: RAnalBlock must contain a linked list of calls return NULL; }
0
247,576
TEST_P(SslSocketTest, GetUriWithUriSan) { const std::string client_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem" )EOF"; const std::string server_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem" validation_context: trusted_ca: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem" match_typed_subject_alt_names: - san_type: URI matcher: exact: "spiffe://lyft.com/test-team" )EOF"; TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, true, GetParam()); testUtil(test_options.setExpectedClientCertUri("spiffe://lyft.com/test-team") .setExpectedSerialNumber(TEST_SAN_URI_CERT_SERIAL)); }
0
314,509
PJ_DEF(unsigned) pjmedia_sdp_media_remove_all_attr(pjmedia_sdp_media *m, const char *name) { return pjmedia_sdp_attr_remove_all(&m->attr_count, m->attr, name); }
0
281,146
static int xfrm_policy_flo_check(struct flow_cache_object *flo) { struct xfrm_policy *pol = container_of(flo, struct xfrm_policy, flo); return !pol->walk.dead; }
0
281,158
static struct hlist_head *policy_hash_direct(struct net *net, const xfrm_address_t *daddr, const xfrm_address_t *saddr, unsigned short family, int dir) { unsigned int hmask = net->xfrm.policy_bydst[dir].hmask; unsigned int hash; u8 dbits; u8 sbits; __get_hash_thresh(net, family, dir, &dbits, &sbits); hash = __addr_hash(daddr, saddr, family, hmask, dbits, sbits); return rcu_dereference_check(net->xfrm.policy_bydst[dir].table, lockdep_is_held(&net->xfrm.xfrm_policy_lock)) + hash; }
0
281,156
void xfrm_policy_unregister_afinfo(const struct xfrm_policy_afinfo *afinfo) { struct dst_ops *dst_ops = afinfo->dst_ops; int i; for (i = 0; i < ARRAY_SIZE(xfrm_policy_afinfo); i++) { if (xfrm_policy_afinfo[i] != afinfo) continue; RCU_INIT_POINTER(xfrm_policy_afinfo[i], NULL); break; } synchronize_rcu(); dst_ops->kmem_cachep = NULL; dst_ops->check = NULL; dst_ops->negative_advice = NULL; dst_ops->link_failure = NULL; }
0
247,727
const std::string& expectedPeerCertChain() const { return expected_peer_cert_chain_; }
0
259,246
static int mov_rewrite_dvd_sub_extradata(AVStream *st) { char buf[256] = {0}; uint8_t *src = st->codecpar->extradata; int i, ret; if (st->codecpar->extradata_size != 64) return 0; if (st->codecpar->width > 0 && st->codecpar->height > 0) snprintf(buf, sizeof(buf), "size: %dx%d\n", st->codecpar->width, st->codecpar->height); av_strlcat(buf, "palette: ", sizeof(buf)); for (i = 0; i < 16; i++) { uint32_t yuv = AV_RB32(src + i * 4); uint32_t rgba = yuv_to_rgba(yuv); av_strlcatf(buf, sizeof(buf), "%06"PRIx32"%s", rgba, i != 15 ? ", " : ""); } if (av_strlcat(buf, "\n", sizeof(buf)) >= sizeof(buf)) return 0; ret = ff_alloc_extradata(st->codecpar, strlen(buf)); if (ret < 0) return ret; memcpy(st->codecpar->extradata, buf, st->codecpar->extradata_size); return 0; }
0
234,197
display_debug_types (struct dwarf_section *section, void *file) { return process_debug_info (section, file, section->abbrev_sec, false, true); }
0
404,732
int close_fd_get_file(unsigned int fd, struct file **res) { struct files_struct *files = current->files; int ret; spin_lock(&files->file_lock); ret = __close_fd_get_file(fd, res); spin_unlock(&files->file_lock); return ret; }
0
211,650
dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) { struct dev_data *dev = fd->private_data; ssize_t value, length = len; unsigned total; u32 tag; char *kbuf; spin_lock_irq(&dev->lock); if (dev->state > STATE_DEV_OPENED) { value = ep0_write(fd, buf, len, ptr); spin_unlock_irq(&dev->lock); return value; } spin_unlock_irq(&dev->lock); if ((len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) || (len > PAGE_SIZE * 4)) return -EINVAL; /* we might need to change message format someday */ if (copy_from_user (&tag, buf, 4)) return -EFAULT; if (tag != 0) return -EINVAL; buf += 4; length -= 4; kbuf = memdup_user(buf, length); if (IS_ERR(kbuf)) return PTR_ERR(kbuf); spin_lock_irq (&dev->lock); value = -EINVAL; if (dev->buf) { kfree(kbuf); goto fail; } dev->buf = kbuf; /* full or low speed config */ dev->config = (void *) kbuf; total = le16_to_cpu(dev->config->wTotalLength); if (!is_valid_config(dev->config, total) || total > length - USB_DT_DEVICE_SIZE) goto fail; kbuf += total; length -= total; /* optional high speed config */ if (kbuf [1] == USB_DT_CONFIG) { dev->hs_config = (void *) kbuf; total = le16_to_cpu(dev->hs_config->wTotalLength); if (!is_valid_config(dev->hs_config, total) || total > length - USB_DT_DEVICE_SIZE) goto fail; kbuf += total; length -= total; } else { dev->hs_config = NULL; } /* could support multiple configs, using another encoding! */ /* device descriptor (tweaked for paranoia) */ if (length != USB_DT_DEVICE_SIZE) goto fail; dev->dev = (void *)kbuf; if (dev->dev->bLength != USB_DT_DEVICE_SIZE || dev->dev->bDescriptorType != USB_DT_DEVICE || dev->dev->bNumConfigurations != 1) goto fail; dev->dev->bcdUSB = cpu_to_le16 (0x0200); /* triggers gadgetfs_bind(); then we can enumerate. */ spin_unlock_irq (&dev->lock); if (dev->hs_config) gadgetfs_driver.max_speed = USB_SPEED_HIGH; else gadgetfs_driver.max_speed = USB_SPEED_FULL; value = usb_gadget_probe_driver(&gadgetfs_driver); if (value != 0) { kfree (dev->buf); dev->buf = NULL; } else { /* at this point "good" hardware has for the first time * let the USB the host see us. alternatively, if users * unplug/replug that will clear all the error state. * * note: everything running before here was guaranteed * to choke driver model style diagnostics. from here * on, they can work ... except in cleanup paths that * kick in after the ep0 descriptor is closed. */ value = len; dev->gadget_registered = true; } return value; fail: spin_unlock_irq (&dev->lock); pr_debug ("%s: %s fail %zd, %p\n", shortname, __func__, value, dev); kfree (dev->buf); dev->buf = NULL; return value; }
1
226,400
void prhd_box_del(GF_Box *s) { gf_free(s);
0
402,605
do_shutdown(context *ctx, int nsockets, struct pollfd *pollfds) { unlink(SOCKPATH); unlink(PIDFILE); for (int i = 0; i < ctx->ntokennames; i++) free(ctx->tokennames[i]); if (ctx->tokennames) free(ctx->tokennames); ctx->backup_cms->log(ctx->backup_cms, ctx->priority|LOG_NOTICE, "pesignd exiting (pid %d)", getpid()); xfree(ctx->errstr); for (int i = 0; i < nsockets; i++) close(pollfds[i].fd); free(pollfds); }
0
513,081
virtual longlong val_time_packed(THD *thd) { return Time(thd, this, Time::Options_cmp(thd)).to_packed(); }
0
283,752
static void zynq_slcr_reset_init(Object *obj, ResetType type) { ZynqSLCRState *s = ZYNQ_SLCR(obj); int i; DB_PRINT("RESET\n"); s->regs[R_LOCKSTA] = 1; /* 0x100 - 0x11C */ s->regs[R_ARM_PLL_CTRL] = 0x0001A008; s->regs[R_DDR_PLL_CTRL] = 0x0001A008; s->regs[R_IO_PLL_CTRL] = 0x0001A008; s->regs[R_PLL_STATUS] = 0x0000003F; s->regs[R_ARM_PLL_CFG] = 0x00014000; s->regs[R_DDR_PLL_CFG] = 0x00014000; s->regs[R_IO_PLL_CFG] = 0x00014000; /* 0x120 - 0x16C */ s->regs[R_ARM_CLK_CTRL] = 0x1F000400; s->regs[R_DDR_CLK_CTRL] = 0x18400003; s->regs[R_DCI_CLK_CTRL] = 0x01E03201; s->regs[R_APER_CLK_CTRL] = 0x01FFCCCD; s->regs[R_USB0_CLK_CTRL] = s->regs[R_USB1_CLK_CTRL] = 0x00101941; s->regs[R_GEM0_RCLK_CTRL] = s->regs[R_GEM1_RCLK_CTRL] = 0x00000001; s->regs[R_GEM0_CLK_CTRL] = s->regs[R_GEM1_CLK_CTRL] = 0x00003C01; s->regs[R_SMC_CLK_CTRL] = 0x00003C01; s->regs[R_LQSPI_CLK_CTRL] = 0x00002821; s->regs[R_SDIO_CLK_CTRL] = 0x00001E03; s->regs[R_UART_CLK_CTRL] = 0x00003F03; s->regs[R_SPI_CLK_CTRL] = 0x00003F03; s->regs[R_CAN_CLK_CTRL] = 0x00501903; s->regs[R_DBG_CLK_CTRL] = 0x00000F03; s->regs[R_PCAP_CLK_CTRL] = 0x00000F01; /* 0x170 - 0x1AC */ s->regs[R_FPGA0_CLK_CTRL] = s->regs[R_FPGA1_CLK_CTRL] = s->regs[R_FPGA2_CLK_CTRL] = s->regs[R_FPGA3_CLK_CTRL] = 0x00101800; s->regs[R_FPGA0_THR_STA] = s->regs[R_FPGA1_THR_STA] = s->regs[R_FPGA2_THR_STA] = s->regs[R_FPGA3_THR_STA] = 0x00010000; /* 0x1B0 - 0x1D8 */ s->regs[R_BANDGAP_TRIP] = 0x0000001F; s->regs[R_PLL_PREDIVISOR] = 0x00000001; s->regs[R_CLK_621_TRUE] = 0x00000001; /* 0x200 - 0x25C */ s->regs[R_FPGA_RST_CTRL] = 0x01F33F0F; s->regs[R_RST_REASON] = 0x00000040; s->regs[R_BOOT_MODE] = 0x00000001; /* 0x700 - 0x7D4 */ for (i = 0; i < 54; i++) { s->regs[R_MIO + i] = 0x00001601; } for (i = 2; i <= 8; i++) { s->regs[R_MIO + i] = 0x00000601; } s->regs[R_MIO_MST_TRI0] = s->regs[R_MIO_MST_TRI1] = 0xFFFFFFFF; s->regs[R_CPU_RAM + 0] = s->regs[R_CPU_RAM + 1] = s->regs[R_CPU_RAM + 3] = s->regs[R_CPU_RAM + 4] = s->regs[R_CPU_RAM + 7] = 0x00010101; s->regs[R_CPU_RAM + 2] = s->regs[R_CPU_RAM + 5] = 0x01010101; s->regs[R_CPU_RAM + 6] = 0x00000001; s->regs[R_IOU + 0] = s->regs[R_IOU + 1] = s->regs[R_IOU + 2] = s->regs[R_IOU + 3] = 0x09090909; s->regs[R_IOU + 4] = s->regs[R_IOU + 5] = 0x00090909; s->regs[R_IOU + 6] = 0x00000909; s->regs[R_DMAC_RAM] = 0x00000009; s->regs[R_AFI0 + 0] = s->regs[R_AFI0 + 1] = 0x09090909; s->regs[R_AFI1 + 0] = s->regs[R_AFI1 + 1] = 0x09090909; s->regs[R_AFI2 + 0] = s->regs[R_AFI2 + 1] = 0x09090909; s->regs[R_AFI3 + 0] = s->regs[R_AFI3 + 1] = 0x09090909; s->regs[R_AFI0 + 2] = s->regs[R_AFI1 + 2] = s->regs[R_AFI2 + 2] = s->regs[R_AFI3 + 2] = 0x00000909; s->regs[R_OCM + 0] = 0x01010101; s->regs[R_OCM + 1] = s->regs[R_OCM + 2] = 0x09090909; s->regs[R_DEVCI_RAM] = 0x00000909; s->regs[R_CSG_RAM] = 0x00000001; s->regs[R_DDRIOB + 0] = s->regs[R_DDRIOB + 1] = s->regs[R_DDRIOB + 2] = s->regs[R_DDRIOB + 3] = 0x00000e00; s->regs[R_DDRIOB + 4] = s->regs[R_DDRIOB + 5] = s->regs[R_DDRIOB + 6] = 0x00000e00; s->regs[R_DDRIOB + 12] = 0x00000021; }
0
317,169
static struct inode_security_struct *inode_security(struct inode *inode) { __inode_security_revalidate(inode, NULL, true); return selinux_inode(inode); }
0
308,205
static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx, struct fastrpc_invoke_ctx *ctx, u32 kernel, uint32_t handle) { struct fastrpc_channel_ctx *cctx; struct fastrpc_user *fl = ctx->fl; struct fastrpc_msg *msg = &ctx->msg; cctx = fl->cctx; msg->pid = fl->tgid; msg->tid = current->pid; if (kernel) msg->pid = 0; msg->ctx = ctx->ctxid | fl->pd; msg->handle = handle; msg->sc = ctx->sc; msg->addr = ctx->buf ? ctx->buf->phys : 0; msg->size = roundup(ctx->msg_sz, PAGE_SIZE); fastrpc_context_get(ctx); return rpmsg_send(cctx->rpdev->ept, (void *)msg, sizeof(*msg)); }
0
352,968
UUIDValidate( Syntax *syntax, struct berval *in ) { int i; if( in->bv_len != 36 ) { return LDAP_INVALID_SYNTAX; } for( i=0; i<36; i++ ) { switch(i) { case 8: case 13: case 18: case 23: if( in->bv_val[i] != '-' ) { return LDAP_INVALID_SYNTAX; } break; default: if( !ASCII_HEX( in->bv_val[i]) ) { return LDAP_INVALID_SYNTAX; } } } return LDAP_SUCCESS; }
0
387,765
Method* InstanceKlass::find_method(const Array<Method*>* methods, const Symbol* name, const Symbol* signature) { return InstanceKlass::find_method_impl(methods, name, signature, find_overpass, find_static, find_private); }
0
466,171
static int em_bsr(struct x86_emulate_ctxt *ctxt) { u8 zf; __asm__ ("bsr %2, %0; setz %1" : "=r"(ctxt->dst.val), "=q"(zf) : "r"(ctxt->src.val)); ctxt->eflags &= ~X86_EFLAGS_ZF; if (zf) { ctxt->eflags |= X86_EFLAGS_ZF; /* Disable writeback. */ ctxt->dst.type = OP_NONE; } return X86EMUL_CONTINUE; }
0
369,930
static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen) { int error = -EACCES; struct inode *inode = dentry->d_inode; struct path path; /* Are we allowed to snoop on the tasks file descriptors? */ if (!proc_fd_access_allowed(inode)) goto out; error = PROC_I(inode)->op.proc_get_link(dentry, &path); if (error) goto out; error = do_proc_readlink(&path, buffer, buflen); path_put(&path); out: return error; }
0
359,603
community_direct_str (int direct) { switch (direct) { case COMMUNITY_DENY: return "deny"; case COMMUNITY_PERMIT: return "permit"; default: return "unknown"; } }
0
224,591
Status MaxPool3DGradShape(shape_inference::InferenceContext* c) { return UnchangedShapeWithRank(c, 5); }
0
463,126
static char *get_token(struct parse_state *state, const char *extra) { char *token; char *p; token = tok_next(&state->tok); if (!token) { parse_error(state, "invalid annotation attributes"); return NULL; } /* check the token */ if (extra == NULL) extra = ""; for (p = token ; *p && (isalnum(*p) || strchr(extra, *p)) ; p++) ; if (*p) { state->context = p; parse_error(state, "invalid character"); return NULL; } state->context = token; return token; }
0
318,957
assert_equalfile(typval_T *argvars) { char_u buf1[NUMBUFLEN]; char_u buf2[NUMBUFLEN]; int called_emsg_before = called_emsg; char_u *fname1 = tv_get_string_buf_chk(&argvars[0], buf1); char_u *fname2 = tv_get_string_buf_chk(&argvars[1], buf2); garray_T ga; FILE *fd1; FILE *fd2; char line1[200]; char line2[200]; int lineidx = 0; if (called_emsg > called_emsg_before) return 0; IObuff[0] = NUL; fd1 = mch_fopen((char *)fname1, READBIN); if (fd1 == NULL) { vim_snprintf((char *)IObuff, IOSIZE, (char *)e_cant_read_file_str, fname1); } else { fd2 = mch_fopen((char *)fname2, READBIN); if (fd2 == NULL) { fclose(fd1); vim_snprintf((char *)IObuff, IOSIZE, (char *)e_cant_read_file_str, fname2); } else { int c1, c2; long count = 0; long linecount = 1; for (;;) { c1 = fgetc(fd1); c2 = fgetc(fd2); if (c1 == EOF) { if (c2 != EOF) STRCPY(IObuff, "first file is shorter"); break; } else if (c2 == EOF) { STRCPY(IObuff, "second file is shorter"); break; } else { line1[lineidx] = c1; line2[lineidx] = c2; ++lineidx; if (c1 != c2) { vim_snprintf((char *)IObuff, IOSIZE, "difference at byte %ld, line %ld", count, linecount); break; } } ++count; if (c1 == NL) { ++linecount; lineidx = 0; } else if (lineidx + 2 == (int)sizeof(line1)) { mch_memmove(line1, line1 + 100, lineidx - 100); mch_memmove(line2, line2 + 100, lineidx - 100); lineidx -= 100; } } fclose(fd1); fclose(fd2); } } if (IObuff[0] != NUL) { prepare_assert_error(&ga); if (argvars[2].v_type != VAR_UNKNOWN) { char_u numbuf[NUMBUFLEN]; char_u *tofree; ga_concat(&ga, echo_string(&argvars[2], &tofree, numbuf, 0)); vim_free(tofree); ga_concat(&ga, (char_u *)": "); } ga_concat(&ga, IObuff); if (lineidx > 0) { line1[lineidx] = NUL; line2[lineidx] = NUL; ga_concat(&ga, (char_u *)" after \""); ga_concat(&ga, (char_u *)line1); if (STRCMP(line1, line2) != 0) { ga_concat(&ga, (char_u *)"\" vs \""); ga_concat(&ga, (char_u *)line2); } ga_concat(&ga, (char_u *)"\""); } assert_error(&ga); ga_clear(&ga); return 1; } return 0; }
0
361,754
static inline void em28xx_set_xclk_i2c_speed(struct em28xx *dev) { const struct em28xx_board *board = &em28xx_boards[dev->model]; u8 xclk = board->xclk, i2c_speed = board->i2c_speed; /* * Those are the default values for the majority of boards * Use those values if not specified otherwise at boards entry */ if (!xclk) xclk = EM28XX_XCLK_IR_RC5_MODE | EM28XX_XCLK_FREQUENCY_12MHZ; em28xx_write_reg(dev, EM28XX_R0F_XCLK, xclk); if (!i2c_speed) i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ; dev->i2c_speed = i2c_speed & 0x03; if (!dev->board.is_em2800) em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, i2c_speed); msleep(50); }
0
259,182
static void mov_estimate_video_delay(MOVContext *c, AVStream* st) { MOVStreamContext *msc = st->priv_data; FFStream *const sti = ffstream(st); int ctts_ind = 0; int ctts_sample = 0; int64_t pts_buf[MAX_REORDER_DELAY + 1]; // Circular buffer to sort pts. int buf_start = 0; int j, r, num_swaps; for (j = 0; j < MAX_REORDER_DELAY + 1; j++) pts_buf[j] = INT64_MIN; if (st->codecpar->video_delay <= 0 && msc->ctts_data && st->codecpar->codec_id == AV_CODEC_ID_H264) { st->codecpar->video_delay = 0; for (int ind = 0; ind < sti->nb_index_entries && ctts_ind < msc->ctts_count; ++ind) { // Point j to the last elem of the buffer and insert the current pts there. j = buf_start; buf_start = (buf_start + 1); if (buf_start == MAX_REORDER_DELAY + 1) buf_start = 0; pts_buf[j] = sti->index_entries[ind].timestamp + msc->ctts_data[ctts_ind].duration; // The timestamps that are already in the sorted buffer, and are greater than the // current pts, are exactly the timestamps that need to be buffered to output PTS // in correct sorted order. // Hence the video delay (which is the buffer size used to sort DTS and output PTS), // can be computed as the maximum no. of swaps any particular timestamp needs to // go through, to keep this buffer in sorted order. num_swaps = 0; while (j != buf_start) { r = j - 1; if (r < 0) r = MAX_REORDER_DELAY; if (pts_buf[j] < pts_buf[r]) { FFSWAP(int64_t, pts_buf[j], pts_buf[r]); ++num_swaps; } else { break; } j = r; } st->codecpar->video_delay = FFMAX(st->codecpar->video_delay, num_swaps); ctts_sample++; if (ctts_sample == msc->ctts_data[ctts_ind].count) { ctts_ind++; ctts_sample = 0; } } av_log(c->fc, AV_LOG_DEBUG, "Setting codecpar->delay to %d for stream st: %d\n", st->codecpar->video_delay, st->index); } }
0
248,323
DLLIMPORT int cfg_free_value(cfg_opt_t *opt) { if (!opt) { errno = EINVAL; return CFG_FAIL; } if (opt->comment && !is_set(CFGF_RESET, opt->flags)) { free(opt->comment); opt->comment = NULL; } if (opt->values) { unsigned int i; for (i = 0; i < opt->nvalues; i++) { if (opt->type == CFGT_STR) { free((void *)opt->values[i]->string); } else if (opt->type == CFGT_SEC) { opt->values[i]->section->path = NULL; /* Global search path */ cfg_free(opt->values[i]->section); } else if (opt->type == CFGT_PTR && opt->freecb && opt->values[i]->ptr) { (opt->freecb) (opt->values[i]->ptr); } free(opt->values[i]); } free(opt->values); } opt->values = NULL; opt->nvalues = 0; return CFG_SUCCESS; }
0
254,001
static void v4l2loopback_create_sysfs(struct video_device *vdev) { int res = 0; #define V4L2_SYSFS_CREATE(x) res = device_create_file(&vdev->dev, &dev_attr_##x); if (res < 0) break if (!vdev) return; do { V4L2_SYSFS_CREATE(format); V4L2_SYSFS_CREATE(buffers); V4L2_SYSFS_CREATE(max_openers); /* ... */ } while (0); if (res >= 0) return; dev_err(&vdev->dev, "%s error: %d\n", __func__, res); }
0
225,402
static void pix_format_set_size(struct v4l2_pix_format *f, const struct v4l2l_format *fmt, unsigned int width, unsigned int height) { f->width = width; f->height = height; if (fmt->flags & FORMAT_FLAGS_PLANAR) { f->bytesperline = width; /* Y plane */ f->sizeimage = (width * height * fmt->depth) >> 3; } else if (fmt->flags & FORMAT_FLAGS_COMPRESSED) { /* doesn't make sense for compressed formats */ f->bytesperline = 0; f->sizeimage = (width * height * fmt->depth) >> 3; } else { f->bytesperline = (width * fmt->depth) >> 3; f->sizeimage = height * f->bytesperline; } }
0
487,611
asmlinkage long sys_getpriority(int which, int who) { struct task_struct *g, *p; struct user_struct *user; long niceval, retval = -ESRCH; struct pid *pgrp; if (which > 2 || which < 0) return -EINVAL; read_lock(&tasklist_lock); switch (which) { case PRIO_PROCESS: if (who) p = find_task_by_pid(who); else p = current; if (p) { niceval = 20 - task_nice(p); if (niceval > retval) retval = niceval; } break; case PRIO_PGRP: if (who) pgrp = find_pid(who); else pgrp = task_pgrp(current); do_each_pid_task(pgrp, PIDTYPE_PGID, p) { niceval = 20 - task_nice(p); if (niceval > retval) retval = niceval; } while_each_pid_task(pgrp, PIDTYPE_PGID, p); break; case PRIO_USER: user = current->user; if (!who) who = current->uid; else if ((who != current->uid) && !(user = find_user(who))) goto out_unlock; /* No processes for this user */ do_each_thread(g, p) if (p->uid == who) { niceval = 20 - task_nice(p); if (niceval > retval) retval = niceval; } while_each_thread(g, p); if (who != current->uid) free_uid(user); /* for find_user() */ break; } out_unlock: read_unlock(&tasklist_lock); return retval; }
0
356,719
void Statement::Work_Bind(napi_env e, void* data) { STATEMENT_INIT(Baton); STATEMENT_MUTEX(mtx); sqlite3_mutex_enter(mtx); stmt->Bind(baton->parameters); sqlite3_mutex_leave(mtx); }
0
226,048
GF_Err hmhd_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_HintMediaHeaderBox *ptr = (GF_HintMediaHeaderBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u16(bs, ptr->maxPDUSize); gf_bs_write_u16(bs, ptr->avgPDUSize); gf_bs_write_u32(bs, ptr->maxBitrate); gf_bs_write_u32(bs, ptr->avgBitrate); gf_bs_write_u32(bs, ptr->slidingAverageBitrate); return GF_OK; }
0
343,227
int pureftpd_start(int argc, char *argv[], const char *home_directory_) { #ifndef NO_GETOPT_LONG int option_index = 0; #endif int fodder; int bypass_ipv6 = 0; struct passwd *pw; (void) home_directory_; #ifdef NON_ROOT_FTP home_directory = home_directory_; #endif client_init_reply_buf(); #ifdef HAVE_GETPAGESIZE page_size = (size_t) getpagesize(); #elif defined(_SC_PAGESIZE) page_size = (size_t) sysconf(_SC_PAGESIZE); #elif defined(_SC_PAGE_SIZE) page_size = (size_t) sysconf(_SC_PAGE_SIZE); #else page_size = (size_t) 4096U; #endif #ifdef HAVE_SETLOCALE # ifdef LC_MESSAGES (void) setlocale(LC_MESSAGES, MESSAGES_LOCALE); # endif # ifdef LC_CTYPE (void) setlocale(LC_CTYPE, "C"); # endif # ifdef LC_COLLATE (void) setlocale(LC_COLLATE, "C"); # endif #endif init_tz(); (void) strerror(ENOENT); #ifndef SAVE_DESCRIPTORS openlog("pure-ftpd", LOG_NDELAY | log_pid, DEFAULT_FACILITY); #endif #ifdef USE_CAPABILITIES set_initial_caps(); #endif set_signals(); loggedin = 0; #ifdef BANNER_ENVIRON # ifdef COOKIE { const char *a; if ((a = getenv("BANNER")) != NULL && *a != 0) { fortunes_file = strdup(a); } } # endif #endif #ifndef MINIMAL if (argc == 2 && *argv[1] != '-' && sc_build_command_line_from_file(argv[1], NULL, simpleconf_options, (sizeof simpleconf_options) / (sizeof simpleconf_options[0]), argv[0], &argc, &argv) != 0) { die(421, LOG_ERR, MSG_CONF_ERR); } #endif while ((fodder = #ifndef NO_GETOPT_LONG getopt_long(argc, argv, GETOPT_OPTIONS, long_options, &option_index) #else getopt(argc, argv, GETOPT_OPTIONS) #endif ) != -1) { switch (fodder) { case 's': { if ((pw = getpwnam("ftp")) != NULL || (pw = getpwnam("_ftp")) != NULL) { warez = pw->pw_uid; } else { logfile(LOG_ERR, MSG_NO_FTP_ACCOUNT); } break; } case '0': { no_truncate = 1; break; } case '4': { bypass_ipv6 = 1; break; } case '6': { no_ipv4 = 1; break; } case '1': { log_pid = LOG_PID; break; } #ifndef NO_STANDALONE case 'S': { char *struck; if ((struck = strchr(optarg, ',')) != NULL) { *struck = 0; if (*optarg != 0) { if (standalone_ip == NULL && (standalone_ip = strdup(optarg)) == NULL) { die_mem(); } } *struck = ','; if (struck[1] != 0) { if ((standalone_port = strdup(struck + 1)) == NULL) { die_mem(); } } } else { if ((standalone_port = strdup(optarg)) == NULL) { die_mem(); } } break; } #endif case 'D': { force_ls_a = 1; break; } #ifdef THROTTLING case 't': case 'T': { char *struck; const char *tr_bw_ul = NULL; const char *tr_bw_dl = NULL; if ((struck = strchr(optarg, ':')) != NULL) { *struck = 0; if (*optarg != 0) { tr_bw_ul = optarg; } if (struck[1] != 0) { tr_bw_dl = &struck[1]; } } else { tr_bw_ul = tr_bw_dl = optarg; } if ((tr_bw_ul == NULL || *tr_bw_ul == 0) && (tr_bw_dl == NULL || *tr_bw_dl == 0)) { bad_bw: die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_THROTTLING ": %s" , optarg); } if (tr_bw_dl != NULL) { if ((throttling_bandwidth_dl = strtoul(tr_bw_dl, NULL, 0) * 1024UL) == 0UL) { goto bad_bw; } } if (tr_bw_ul != NULL) { if ((throttling_bandwidth_ul = strtoul(tr_bw_ul, NULL, 0) * 1024UL) == 0UL) { goto bad_bw; } } throttling_delay = 1000000 / (throttling_bandwidth_dl | throttling_bandwidth_ul); if (fodder == 't') { throttling = 1; } else { throttling = 2; } break; } #endif case 'a': { const char *nptr; char *endptr; nptr = optarg; endptr = NULL; chroot_trustedgid = strtoul(nptr, &endptr, 0); if (!nptr || !*nptr || !endptr || *endptr) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_TRUSTED_GID ": %s" , optarg); } userchroot = 1; break; } case 'x': { dot_write_ok = 0; break; } case 'X': { dot_write_ok = dot_read_ok = 0; break; } case 'z': { dot_read_anon_ok = 1; break; } case 'Z': { be_customer_proof = 1; break; } case 'A': { userchroot = 2; break; } case 'w': { allowfxp = 1; break; } case 'W': { allowfxp = 2; break; } case 'd': { if (logging < 2) { logging++; } break; } case 'b': { broken_client_compat = 1; break; } case 'c': { const char *nptr; char *endptr; nptr = optarg; endptr = NULL; maxusers = (unsigned int) strtoul(nptr, &endptr, 0); if (!nptr || !*nptr || !endptr || *endptr || !maxusers) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_USER_LIMIT ": %s" , optarg); } break; } #ifndef NO_STANDALONE case 'B': { daemonize = 1; break; } case 'C': { const char *nptr; char *endptr; nptr = optarg; endptr = NULL; maxip = (unsigned int) strtoul(nptr, &endptr, 0); if (!nptr || !*nptr || !endptr || *endptr || !maxip) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_USER_LIMIT ": %s" , optarg); } break; } #endif #ifdef PER_USER_LIMITS case 'y': { int ret; ret = sscanf(optarg, "%u:%u", &per_user_max, &per_anon_max); if (ret != 2) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_USER_LIMIT ": %s" , optarg); } break; } #endif #ifdef WITH_TLS case '2': { char *struck; char *key_file_; if ((struck = strchr(optarg, ',')) != NULL) { *struck = 0; key_file_ = struck + 1; } else { key_file_ = optarg; } if (*optarg == 0 || *key_file_ == 0) { die(421, LOG_ERR, MSG_CONF_ERR ": TLS"); } if ((cert_file = strdup(optarg)) == NULL) { die_mem(); } if ((key_file = strdup(key_file_)) == NULL) { die_mem(); } break; } case '3': tls_extcert_parse(optarg); use_extcert++; break; case 'Y': { if ((enforce_tls_auth = atoi(optarg)) < 0 || enforce_tls_auth > 3) { die(421, LOG_ERR, MSG_CONF_ERR ": TLS"); } break; } case 'J': { while (*optarg == '-') { if (strncmp(optarg, "-S:", sizeof "-S:" - (size_t) 1U) == 0) { optarg += sizeof "-S:" - (size_t) 1U; } else if (strncmp(optarg, "-C:", sizeof "-C:" - (size_t) 1U) == 0) { optarg += sizeof "-C:" - (size_t) 1U; ssl_verify_client_cert = 1; } } if ((tlsciphersuite = strdup(optarg)) == NULL) { die_mem(); } break; } #endif case 'e': { anon_only = 1; break; } case 'E': { anon_only = -1; break; } #ifdef COOKIE case 'F': { # ifdef BANNER_ENVIRON free(fortunes_file); # endif fortunes_file = strdup(optarg); break; } #endif case 'f': { int n = 0; if (strcasecmp(optarg, "none") == 0) { no_syslog = 1; break; } while (facilitynames[n].c_name && strcasecmp(facilitynames[n].c_name, optarg) != 0) { n++; } if (facilitynames[n].c_name) { syslog_facility = facilitynames[n].c_val; } else { logfile(LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_FACILITY ": %s", optarg); } break; } case 'l': { const Authentication *auth_list_pnt = auth_list; const char *opt = optarg; Authentications *new_auth; size_t auth_name_len; for (;;) { auth_name_len = strlen(auth_list_pnt->name); if (strncasecmp(opt, auth_list_pnt->name, auth_name_len) == 0) { char *file = NULL; opt += auth_name_len; if (*opt == ':') { opt++; if (*opt != 0) { if ((file = strdup(opt)) == NULL) { die_mem(); } } } if (auth_list_pnt->parse != NULL) { auth_list_pnt->parse(file); } if ((new_auth = malloc(sizeof *new_auth)) == NULL) { die_mem(); } new_auth->auth = auth_list_pnt; new_auth->conf_file = file; new_auth->next = NULL; if (last_authentications == NULL) { first_authentications = new_auth; } else { last_authentications->next = new_auth; } last_authentications = new_auth; break; } auth_list_pnt++; if (auth_list_pnt->name == NULL) { die(421, LOG_ERR, MSG_AUTH_UNKNOWN ": %s", opt); } } break; } case 'm': { const char *nptr; char *endptr; nptr = optarg; endptr = NULL; maxload = strtod(nptr, &endptr); if (!nptr || !*nptr || !endptr || *endptr || maxload <= 0.0) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_LOAD_LIMIT ": %s" , optarg); } break; } case 'M': { allow_anon_mkdir = 1; break; } case 'N': { disallow_passive = 1; break; } #if defined(WITH_UPLOAD_SCRIPT) case 'o': { do_upload_script = 1; break; } #endif #ifdef WITH_ALTLOG case 'O': { char *optarg_copy; char *delpoint; if ((optarg_copy = strdup(optarg)) == NULL) { die_mem(); } if ((delpoint = strchr(optarg_copy, ALTLOG_DELIMITER)) == NULL) { altlog_format = ALTLOG_DEFAULT; delpoint = optarg_copy; } else { const AltLogPrefixes *altlogprefixes_pnt = altlogprefixes; *delpoint++ = 0; do { if (strcasecmp(optarg_copy, altlogprefixes_pnt->prefix) == 0) { altlog_format = altlogprefixes_pnt->format; break; } altlogprefixes_pnt++; } while (altlogprefixes_pnt->prefix != NULL); if (altlog_format == ALTLOG_NONE) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_UNKNOWN_ALTLOG ": %s", optarg_copy); } } if (*delpoint != '/') { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_SANITY_FILE_FAILURE, delpoint); } if (altlog_filename == NULL && (altlog_filename = strdup(delpoint)) == NULL) { die_mem(); } (void) free(optarg_copy); break; } #endif case 'p': { int ret; ret = sscanf(optarg, "%u:%u", &firstport, &lastport); if (ret != 2 || firstport < 1024U || lastport > 65535U || lastport < firstport) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_PORTS_RANGE ": %s" , optarg); } break; } case 'L': { int ret; ret = sscanf(optarg, "%u:%u", &max_ls_files, &max_ls_depth); if (ret != 2 || max_ls_files < 1U || max_ls_depth < 1U) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_LS_LIMITS ": %s" , optarg); } break; } #ifdef QUOTAS case 'n': { int ret; ret = sscanf(optarg, "%llu:%llu", &user_quota_files, &user_quota_size); if (ret != 2) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_QUOTA ": %s" , optarg); } user_quota_size *= (1024ULL * 1024ULL); break; } #endif case 'P': { if (force_passive_ip_s == NULL && (force_passive_ip_s = strdup(optarg)) == NULL) { die_mem(); } break; } #ifdef RATIOS case 'q': case 'Q': { int ret; ret = sscanf(optarg, "%u:%u", &ratio_upload, &ratio_download); if (ret != 2 || ratio_upload < 1U || ratio_download < 1U) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_RATIO ": %s" , optarg); } if (fodder == 'Q') { ratio_for_non_anon = 1; } break; } #endif case 'r': { autorename = 1; break; } case 'R': { nochmod = 1; break; } case 'K': { keepallfiles = 1; break; } #ifndef NO_STANDALONE case 'g': { if ((pid_file = strdup(optarg)) == NULL) { die_mem(); } break; } #endif case 'G': { disallow_rename = 1; break; } case 'H': { resolve_hostnames = 0; break; } case 'I': { const char *nptr; char *endptr; nptr = optarg; endptr = NULL; idletime = strtoul(nptr, &endptr, 0) * 60UL; if (idletime <= 0) { idletime = DEFAULT_IDLE; } break; } case 'i': { anon_noupload = 1; break; } case 'j': { create_home = 1; break; } case 'k': { const char *nptr; char *endptr; nptr = optarg; endptr = NULL; maxdiskusagepct = 1.0 - (strtod(nptr, &endptr) / 100.0); if (maxdiskusagepct >= 1.0 || maxdiskusagepct < 0.0) { maxdiskusagepct = 0.0; } break; } case 'u': { const char *nptr; char *endptr; long tmp; nptr = optarg; endptr = NULL; tmp = strtol(nptr, &endptr, 10); if (!nptr || !*nptr || !endptr || *endptr || tmp < 0) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_UID_LIMIT ": %s" , optarg); } useruid = (uid_t) tmp; break; } case 'U': { char *optarg_copy; char *struck; const char *tr_umask = NULL; const char *tr_umask_d = NULL; if ((optarg_copy = strdup(optarg)) == NULL) { die_mem(); } if ((struck = strchr(optarg_copy, ':')) != NULL) { *struck = 0; if (*optarg_copy != 0) { tr_umask = optarg_copy; } if (struck[1] != 0) { tr_umask_d = &struck[1]; } } else { tr_umask = tr_umask_d = optarg_copy; } if ((tr_umask == NULL || *tr_umask == 0) && (tr_umask_d == NULL || *tr_umask_d == 0)) { bad_umask: die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_UMASK ": %s", optarg_copy); } if (tr_umask != NULL) { if ((u_mask = strtoul(tr_umask, NULL, 8)) > 0777) { goto bad_umask; } } if (tr_umask_d != NULL) { if ((u_mask_d = strtoul(tr_umask_d, NULL, 8)) > 0777) { goto bad_umask; } } (void) free(optarg_copy); break; } #ifdef WITH_VIRTUAL_HOSTS case 'V': { if (trustedip == NULL && (trustedip = malloc(sizeof *trustedip)) == NULL) { die_mem(); } if (generic_aton(optarg, trustedip) != 0) { die(421, LOG_ERR, MSG_CONF_ERR ": " MSG_ILLEGAL_TRUSTED_IP); } break; } #endif #ifdef WITH_BONJOUR case 'v': { char *rdvname; char *end; if ((rdvname = strdup(optarg)) == NULL) { die_mem(); } doregistration(rdvname, strtoul(standalone_port, &end, 10)); break; } #endif case 'h': { #ifndef NON_ROOT_FTP if (geteuid() == (uid_t) 0) #endif { puts(PACKAGE " v" VERSION VERSION_PRIVSEP "\n"); } #ifndef NO_GETOPT_LONG { const struct option *options = long_options; do { printf("-%c\t--%s\t%s\n", options->val, options->name, options->has_arg ? "<opt>" : ""); options++; } while (options->name != NULL); } #endif exit(EXIT_SUCCESS); } default: die(421, LOG_ERR, MSG_ILLEGAL_OPTION); } } if (optind < argc) { die(421, LOG_ERR, MSG_INVALID_ARGUMENT, argv[optind]); } if (first_authentications == NULL) { if ((first_authentications = malloc(sizeof *first_authentications)) == NULL) { die_mem(); } first_authentications->auth = DEFAULT_AUTHENTICATION; first_authentications->conf_file = NULL; first_authentications->next = NULL; } #ifndef NO_STANDALONE dodaemonize(); #endif #ifndef SAVE_DESCRIPTORS if (no_syslog == 0 && (log_pid || syslog_facility != DEFAULT_FACILITY)) { closelog(); openlog("pure-ftpd", LOG_NDELAY | log_pid, syslog_facility); } #endif (void) umask((mode_t) 0); clearargs(argc, argv); idletime_noop = (double) idletime * 2.0; if (firstport) { unsigned int portmax; portmax = (lastport - firstport + 1) / 2; if (!maxusers || maxusers > portmax) { maxusers = portmax; /* ... so we don't run out of ports */ } } if (bypass_ipv6 == 0) { check_ipv6_support(); } #if defined(WITH_UPLOAD_SCRIPT) if (do_upload_script != 0) { upload_pipe_open(); } #endif #ifdef WITH_DIRALIASES if (init_aliases() != 0) { logfile(LOG_ERR, MSG_ALIASES_BROKEN_FILE); } #endif #ifdef WITH_TLS if (enforce_tls_auth > 0) { (void) tls_init_library(); } #endif #if !defined(NO_STANDALONE) && !defined(NO_INETD) if (check_standalone() != 0) { standalone_server(); } else { doit(); } #elif !defined(NO_STANDALONE) && defined(NO_INETD) standalone_server(); #elif defined(NO_STANDALONE) && !defined(NO_INETD) doit(); #else # error Configuration error #endif #ifdef WITH_UPLOAD_SCRIPT upload_pipe_close(); #endif { Authentications *auth_scan = first_authentications; Authentications *previous; while (auth_scan != NULL) { if (auth_scan->auth->exit != NULL) { auth_scan->auth->exit(); } free(auth_scan->conf_file); previous = auth_scan; auth_scan = auth_scan->next; free(previous); } } first_authentications = last_authentications = NULL; free(trustedip); #ifndef NO_STANDALONE iptrack_free(); unlink(pid_file); #endif closelog(); #ifdef WITH_TLS tls_free_library(); tls_extcert_exit(); free((void *) client_sni_name); #endif alt_arc4random_close(); _EXIT(EXIT_SUCCESS); return 0; }
0
484,712
uint32_t mobi_buffer_get_varlen_dec(MOBIBuffer *buf, size_t *len) { return _buffer_get_varlen(buf, len, -1); }
0
374,044
static bool check_buffer(RBinFile *bf, RBuffer *b) { ut8 buf[4]; r_buf_read_at (b, 0, buf, sizeof (buf)); return !memcmp (buf, "\x02\xff\x01\xff", 4); }
0
417,109
void PlayerGeneric::setSampleShift(mp_sint32 shift) { sampleShift = shift; if (mixer) mixer->setSampleShift(shift); }
0
259,155
static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int i; int64_t creation_time; int version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ if (version == 1) { creation_time = avio_rb64(pb); avio_rb64(pb); } else { creation_time = avio_rb32(pb); avio_rb32(pb); /* modification time */ } mov_metadata_creation_time(&c->fc->metadata, creation_time, c->fc); c->time_scale = avio_rb32(pb); /* time scale */ if (c->time_scale <= 0) { av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d, defaulting to 1\n", c->time_scale); c->time_scale = 1; } av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale); c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ // set the AVFormatContext duration because the duration of individual tracks // may be inaccurate if (!c->trex_data) c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale); avio_rb32(pb); /* preferred scale */ avio_rb16(pb); /* preferred volume */ avio_skip(pb, 10); /* reserved */ /* movie display matrix, store it in main context and use it later on */ for (i = 0; i < 3; i++) { c->movie_display_matrix[i][0] = avio_rb32(pb); // 16.16 fixed point c->movie_display_matrix[i][1] = avio_rb32(pb); // 16.16 fixed point c->movie_display_matrix[i][2] = avio_rb32(pb); // 2.30 fixed point } avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview duration */ avio_rb32(pb); /* poster time */ avio_rb32(pb); /* selection time */ avio_rb32(pb); /* selection duration */ avio_rb32(pb); /* current time */ avio_rb32(pb); /* next track ID */ return 0; }
0
482,472
addBackwardRuleWithSingleCell(const FileInfo *file, widechar cell, TranslationTableOffset ruleOffset, TranslationTableRule *rule, TranslationTableHeader **table) { /* direction = 1, rule->dotslen = 1 */ TranslationTableCharacter *dots; if (rule->opcode == CTO_SwapCc || rule->opcode == CTO_Repeated) return; /* too ambiguous */ // get the cell from the table, or if the cell is not defined yet, define it (without // adding attributes) dots = putDots(file, cell, table); // putDots may have moved table, so make sure rule is still valid rule = (TranslationTableRule *)&(*table)->ruleArea[ruleOffset]; if (rule->opcode >= CTO_Space && rule->opcode < CTO_UpLow) dots->definitionRule = ruleOffset; TranslationTableOffset *otherRule = &dots->otherRules; while (*otherRule) { TranslationTableRule *r = (TranslationTableRule *)&(*table)->ruleArea[*otherRule]; if (rule->charslen > r->charslen || r->dotslen == 0) break; if (r->opcode >= CTO_Space && r->opcode < CTO_UpLow) if (!(rule->opcode >= CTO_Space && rule->opcode < CTO_UpLow)) break; otherRule = &r->dotsnext; } rule->dotsnext = *otherRule; *otherRule = ruleOffset; }
0
437,337
add_rel_addr(regex_t* reg, int addr) { RelAddrType ra = (RelAddrType )addr; BB_ADD(reg, &ra, SIZE_RELADDR); return 0; }
0
225,849
GF_Err txtc_box_read(GF_Box *s, GF_BitStream *bs) { GF_TextConfigBox *ptr = (GF_TextConfigBox*)s; if ((u32)ptr->size >= (u32)0xFFFFFFFF) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Invalid size %llu in txtc box\n", ptr->size)); return GF_ISOM_INVALID_FILE; } ptr->config = (char *)gf_malloc(sizeof(char)*((u32) ptr->size+1)); if (!ptr->config) return GF_OUT_OF_MEM; gf_bs_read_data(bs, ptr->config, (u32) ptr->size); ptr->config[ptr->size] = 0; return GF_OK;
0
508,332
check_and_update_routine_version(THD *thd, Sroutine_hash_entry *rt, sp_head *sp) { ulong spc_version= sp_cache_version(); /* sp is NULL if there is no such routine. */ ulong version= sp ? sp->sp_cache_version() : spc_version; /* If the version in the parse tree is stale, or the version in the cache is stale and sp is not used, we need to reprepare. Sic: version != spc_version <--> sp is not NULL. */ if (rt->m_sp_cache_version != version || (version != spc_version && !sp->is_invoked())) { if (thd->m_reprepare_observer && thd->m_reprepare_observer->report_error(thd)) { /* Version of the sp cache is different from the previous execution of the prepared statement, and it is unacceptable for this SQLCOM. Error has been reported. */ DBUG_ASSERT(thd->is_error()); return TRUE; } /* Always maintain the latest cache version. */ rt->m_sp_cache_version= version; } return FALSE; }
0
512,417
void Item_cond::neg_arguments(THD *thd) { List_iterator<Item> li(list); Item *item; while ((item= li++)) /* Apply not transformation to the arguments */ { Item *new_item= item->neg_transformer(thd); if (!new_item) { if (!(new_item= new (thd->mem_root) Item_func_not(thd, item))) return; // Fatal OEM error } (void) li.replace(new_item); } }
0
508,860
int my_wc_mb_utf8_with_escape(CHARSET_INFO *cs, my_wc_t escape, my_wc_t wc, uchar *str, uchar *end) { DBUG_ASSERT(escape > 0); if (str + 1 >= end) return MY_CS_TOOSMALL2; // Not enough space, need at least two bytes. *str= (uchar)escape; int cnvres= my_charset_utf8_handler.wc_mb(cs, wc, str + 1, end); if (cnvres > 0) return cnvres + 1; // The character was normally put if (cnvres == MY_CS_ILUNI) return MY_CS_ILUNI; // Could not encode "wc" (e.g. non-BMP character) DBUG_ASSERT(cnvres <= MY_CS_TOOSMALL); return cnvres - 1; // Not enough space }
0
359,478
DEFUN (clear_ip_bgp_all, clear_ip_bgp_all_cmd, "clear ip bgp *", CLEAR_STR IP_STR BGP_STR "Clear all peers\n") { if (argc == 1) return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL); }
0
310,094
decode_xterm_1005(SCREEN *sp, MEVENT * eventp) { char kbuf[80]; size_t grabbed; size_t limit = (sizeof(kbuf) - 1); unsigned coords[2]; bool result; coords[0] = 0; coords[1] = 0; # if USE_PTHREADS_EINTR # if USE_WEAK_SYMBOLS if ((pthread_self) && (pthread_kill) && (pthread_equal)) # endif _nc_globals.read_thread = pthread_self(); # endif for (grabbed = 0; grabbed < limit;) { int res; res = (int) read( #if USE_EMX_MOUSE (M_FD(sp) >= 0) ? M_FD(sp) : sp->_ifd, #else sp->_ifd, #endif (kbuf + grabbed), (size_t) 1); if (res == -1) break; grabbed += (size_t) res; if (grabbed > 1) { size_t check = 1; int n; for (n = 0; n < 2; ++n) { int rc; if (check >= grabbed) break; rc = _nc_conv_to_utf32(&coords[n], kbuf + check, (unsigned) (grabbed - check)); if (!rc) break; check += (size_t) rc; } if (n >= 2) break; } } #if USE_PTHREADS_EINTR _nc_globals.read_thread = 0; #endif TR(TRACE_IEVENT, ("_nc_mouse_inline sees the following xterm data: %s", _nc_visbufn(kbuf, (int) grabbed))); /* there's only one mouse... */ eventp->id = NORMAL_EVENT; result = decode_X10_bstate(sp, eventp, UChar(kbuf[0])); eventp->x = (int) (coords[0] - ' ') - 1; eventp->y = (int) (coords[1] - ' ') - 1; return result; }
0
398,530
RZ_API ut64 rz_bin_dwarf_line_header_get_spec_op_advance_pc(const RzBinDwarfLineHeader *header, ut8 opcode) { rz_return_val_if_fail(header, 0); if (!header->line_range) { // to dodge division by zero return 0; } ut8 adj_opcode = rz_bin_dwarf_line_header_get_adj_opcode(header, opcode); return (adj_opcode / header->line_range) * header->min_inst_len; }
0
195,019
Status ConstantFolding::EvaluateOneFoldable(const NodeDef& node, std::vector<NodeDef>* outputs, bool* result_too_large) { TensorVector inputs; TensorVector output_tensors; auto inputs_cleanup = gtl::MakeCleanup([&inputs, &output_tensors] { for (const auto& input : inputs) { delete input.tensor; } for (const auto& output : output_tensors) { if (output.tensor) { delete output.tensor; } } }); size_t total_inputs_size = 0; for (const auto& input : node.input()) { const TensorId input_tensor = ParseTensorName(input); if (input_tensor.index() < 0) { // Control dependency break; } const NodeDef* input_node = node_map_->GetNode(input); if (!IsReallyConstant(*input_node)) { return Status(error::INVALID_ARGUMENT, strings::StrCat("Can't fold ", node.name(), ", its ", input, " isn't constant")); } TF_RETURN_IF_ERROR(CheckAttrExists(*input_node, "value")); const TensorProto& raw_val = input_node->attr().at("value").tensor(); if (raw_val.dtype() == DT_INVALID) { return Status( error::INVALID_ARGUMENT, strings::StrCat("A tensor in the input node, with TensorId of ", input_tensor.ToString(), " has a dtype of DT_INVALID.")); } Tensor* value = new Tensor(raw_val.dtype(), raw_val.tensor_shape()); if (!value->FromProto(raw_val)) { delete (value); return errors::InvalidArgument("Unable to make Tensor from proto for ", node.name(), " with shape ", raw_val.tensor_shape().DebugString()); } inputs.emplace_back(value); total_inputs_size += value->TotalBytes(); } TF_RETURN_IF_ERROR(EvaluateNode(node, inputs, &output_tensors)); if (output_tensors.empty()) { return Status(error::INVALID_ARGUMENT, "Expected at least one output."); } outputs->resize(output_tensors.size()); for (size_t i = 0; i < output_tensors.size(); i++) { string node_name = OptimizedNodeName(node, "-folded"); if (output_tensors.size() > 1) { node_name = strings::StrCat(node_name, "-", i); } if (output_tensors[i].tensor) { Status s = CreateNodeDef(node_name, output_tensors[i], &outputs->at(i), total_inputs_size); if (!s.ok()) { *result_too_large = true; return s; } } else { // Create an empty NodeDef to identify dead outputs (e.g. the output of a // switch that's not selected by the switch predicate). outputs->at(i) = NodeDef(); } } return Status::OK(); }
1
384,127
raptor_xml_writer_indent(raptor_xml_writer *xml_writer) { int num_spaces; if(!XML_WRITER_AUTO_INDENT(xml_writer)) { if(xml_writer->pending_newline) { raptor_iostream_write_byte('\n', xml_writer->iostr); xml_writer->pending_newline = 0; if(xml_writer->current_element) xml_writer->current_element->content_cdata_seen = 1; } return 0; } num_spaces = xml_writer->depth * XML_WRITER_INDENT(xml_writer); /* Do not write an extra newline at the start of the document * (after the XML declaration or XMP processing instruction has * been writtten) */ if(xml_writer->xml_declaration_checked == 1) xml_writer->xml_declaration_checked++; else { raptor_iostream_write_byte('\n', xml_writer->iostr); xml_writer->pending_newline = 0; } while(num_spaces > 0) { int count = (num_spaces > RAPTOR_GOOD_CAST(int, SPACES_BUFFER_SIZE)) ? RAPTOR_GOOD_CAST(int, SPACES_BUFFER_SIZE) : num_spaces; raptor_iostream_counted_string_write(spaces_buffer, count, xml_writer->iostr); num_spaces -= count; } if(xml_writer->current_element) xml_writer->current_element->content_cdata_seen = 1; return 0; }
0
263,499
void sco_exit(void) { bt_procfs_cleanup(&init_net, "sco"); debugfs_remove(sco_debugfs); hci_unregister_cb(&sco_cb); bt_sock_unregister(BTPROTO_SCO); proto_unregister(&sco_proto); }
0
421,394
static void parray(int d, js_Ast *list) { pc('['); while (list) { assert(list->type == AST_LIST); pexpi(d, COMMA, list->a); list = list->b; if (list) comma(); } pc(']'); }
0
338,214
Name WasmBinaryBuilder::getExceptionTargetName(int32_t offset) { BYN_TRACE("getExceptionTarget " << offset << std::endl); // We always start parsing a function by creating a block label and pushing it // in breakStack in getBlockOrSingleton, so if a 'delegate''s target is that // block, it does not mean it targets that block; it throws to the caller. if (breakStack.size() - 1 == size_t(offset)) { return DELEGATE_CALLER_TARGET; } size_t index = breakStack.size() - 1 - offset; if (index > breakStack.size()) { throwError("bad try index (high)"); } BYN_TRACE("exception target " << breakStack[index].name << std::endl); auto& ret = breakStack[index]; // if the delegate/rethrow is in literally unreachable code, then we will not // emit it anyhow, so do not note that the target has a reference to it if (!willBeIgnored) { exceptionTargetNames.insert(ret.name); } return ret.name; }
0
300,747
static void __tipc_shutdown(struct socket *sock, int error) { struct sock *sk = sock->sk; struct tipc_sock *tsk = tipc_sk(sk); struct net *net = sock_net(sk); long timeout = msecs_to_jiffies(CONN_TIMEOUT_DEFAULT); u32 dnode = tsk_peer_node(tsk); struct sk_buff *skb; /* Avoid that hi-prio shutdown msgs bypass msgs in link wakeup queue */ tipc_wait_for_cond(sock, &timeout, (!tsk->cong_link_cnt && !tsk_conn_cong(tsk))); /* Push out delayed messages if in Nagle mode */ tipc_sk_push_backlog(tsk, false); /* Remove pending SYN */ __skb_queue_purge(&sk->sk_write_queue); /* Remove partially received buffer if any */ skb = skb_peek(&sk->sk_receive_queue); if (skb && TIPC_SKB_CB(skb)->bytes_read) { __skb_unlink(skb, &sk->sk_receive_queue); kfree_skb(skb); } /* Reject all unreceived messages if connectionless */ if (tipc_sk_type_connectionless(sk)) { tsk_rej_rx_queue(sk, error); return; } switch (sk->sk_state) { case TIPC_CONNECTING: case TIPC_ESTABLISHED: tipc_set_sk_state(sk, TIPC_DISCONNECTING); tipc_node_remove_conn(net, dnode, tsk->portid); /* Send a FIN+/- to its peer */ skb = __skb_dequeue(&sk->sk_receive_queue); if (skb) { __skb_queue_purge(&sk->sk_receive_queue); tipc_sk_respond(sk, skb, error); break; } skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode, tsk_own_node(tsk), tsk_peer_port(tsk), tsk->portid, error); if (skb) tipc_node_xmit_skb(net, skb, dnode, tsk->portid); break; case TIPC_LISTEN: /* Reject all SYN messages */ tsk_rej_rx_queue(sk, error); break; default: __skb_queue_purge(&sk->sk_receive_queue); break; } }
0
432,261
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, int flags, CPUWatchpoint **watchpoint) { #if 0 CPUWatchpoint *wp; /* forbid ranges which are empty or run off the end of the address space */ if (len == 0 || (addr + len - 1) < addr) { error_report("tried to set invalid watchpoint at %" VADDR_PRIx ", len=%" VADDR_PRIu, addr, len); return -EINVAL; } wp = g_malloc(sizeof(*wp)); wp->vaddr = addr; wp->len = len; wp->flags = flags; /* keep all GDB-injected watchpoints in front */ if (flags & BP_GDB) { QTAILQ_INSERT_HEAD(&cpu->watchpoints, wp, entry); } else { QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry); } tlb_flush_page(cpu, addr); if (watchpoint) *watchpoint = wp; #endif return 0; }
0
411,779
handle_get_property (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer user_data) { A11yBusLauncher *app = user_data; if (g_strcmp0 (property_name, "IsEnabled") == 0) return g_variant_new ("b", app->a11y_enabled); else if (g_strcmp0 (property_name, "ScreenReaderEnabled") == 0) return g_variant_new ("b", app->screen_reader_enabled); else return NULL; }
0
248,766
static char *sanitize_cookie_path(const char *cookie_path) { size_t len; char *new_path = strdup(cookie_path); if(!new_path) return NULL; /* some stupid site sends path attribute with '"'. */ len = strlen(new_path); if(new_path[0] == '\"') { memmove((void *)new_path, (const void *)(new_path + 1), len); len--; } if(len && (new_path[len - 1] == '\"')) { new_path[len - 1] = 0x0; len--; } /* RFC6265 5.2.4 The Path Attribute */ if(new_path[0] != '/') { /* Let cookie-path be the default-path. */ strstore(&new_path, "/"); return new_path; } /* convert /hoge/ to /hoge */ if(len && new_path[len - 1] == '/') { new_path[len - 1] = 0x0; } return new_path; }
0
349,870
static int hw_atl_utils_mpi_set_speed(struct aq_hw_s *self, u32 speed) { u32 val = aq_hw_read_reg(self, HW_ATL_MPI_CONTROL_ADR); val = val & ~HW_ATL_MPI_SPEED_MSK; val |= speed << HW_ATL_MPI_SPEED_SHIFT; aq_hw_write_reg(self, HW_ATL_MPI_CONTROL_ADR, val); return 0; }
0
222,493
string DebugString(gtl::ArraySlice<NodeDef> instantiated_func_nodes) { std::vector<const NodeDef*> ptrs; for (const NodeDef& n : instantiated_func_nodes) { ptrs.push_back(&n); } return Print(ptrs); }
0
384,790
vim_isIDc(int c) { return (c > 0 && c < 0x100 && (g_chartab[c] & CT_ID_CHAR)); }
0
336,619
static void reds_get_spice_ticket(RedLinkInfo *link) { red_stream_async_read(link->stream, (uint8_t *)&link->tiTicketing.encrypted_ticket.encrypted_data, link->tiTicketing.rsa_size, reds_handle_ticket, link); }
0