idx
int64
func
string
target
int64
294,597
dt_lite_strftime(int argc, VALUE *argv, VALUE self) { return date_strftime_internal(argc, argv, self, "%Y-%m-%dT%H:%M:%S%:z", set_tmx); }
0
253,586
smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *fid) { return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid); }
0
198,736
static int rsi_send_beacon(struct rsi_common *common) { struct sk_buff *skb = NULL; u8 dword_align_bytes = 0; skb = dev_alloc_skb(MAX_MGMT_PKT_SIZE); if (!skb) return -ENOMEM; memset(skb->data, 0, MAX_MGMT_PKT_SIZE); dword_align_bytes = ((unsigned long)skb->data & 0x3f); if (dword_align_bytes) skb_pull(skb, (64 - dword_align_bytes)); if (rsi_prepare_beacon(common, skb)) { rsi_dbg(ERR_ZONE, "Failed to prepare beacon\n"); return -EINVAL; } skb_queue_tail(&common->tx_queue[MGMT_BEACON_Q], skb); rsi_set_event(&common->tx_thread.event); rsi_dbg(DATA_TX_ZONE, "%s: Added to beacon queue\n", __func__); return 0; }
1
213,528
int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct cgroup_fs_context *ctx = cgroup_fc2context(fc); struct cgroup_subsys *ss; struct fs_parse_result result; int opt, i; opt = fs_parse(fc, cgroup1_fs_parameters, param, &result); if (opt == -ENOPARAM) { if (strcmp(param->key, "source") == 0) { if (fc->source) return invalf(fc, "Multiple sources not supported"); fc->source = param->string; param->string = NULL; return 0; } for_each_subsys(ss, i) { if (strcmp(param->key, ss->legacy_name)) continue; if (!cgroup_ssid_enabled(i) || cgroup1_ssid_disabled(i)) return invalfc(fc, "Disabled controller '%s'", param->key); ctx->subsys_mask |= (1 << i); return 0; } return invalfc(fc, "Unknown subsys name '%s'", param->key); } if (opt < 0) return opt; switch (opt) { case Opt_none: /* Explicitly have no subsystems */ ctx->none = true; break; case Opt_all: ctx->all_ss = true; break; case Opt_noprefix: ctx->flags |= CGRP_ROOT_NOPREFIX; break; case Opt_clone_children: ctx->cpuset_clone_children = true; break; case Opt_cpuset_v2_mode: ctx->flags |= CGRP_ROOT_CPUSET_V2_MODE; break; case Opt_xattr: ctx->flags |= CGRP_ROOT_XATTR; break; case Opt_release_agent: /* Specifying two release agents is forbidden */ if (ctx->release_agent) return invalfc(fc, "release_agent respecified"); ctx->release_agent = param->string; param->string = NULL; break; case Opt_name: /* blocked by boot param? */ if (cgroup_no_v1_named) return -ENOENT; /* Can't specify an empty name */ if (!param->size) return invalfc(fc, "Empty name"); if (param->size > MAX_CGROUP_ROOT_NAMELEN - 1) return invalfc(fc, "Name too long"); /* Must match [\w.-]+ */ for (i = 0; i < param->size; i++) { char c = param->string[i]; if (isalnum(c)) continue; if ((c == '.') || (c == '-') || (c == '_')) continue; return invalfc(fc, "Invalid name"); } /* Specifying two names is forbidden */ if (ctx->name) return invalfc(fc, "name respecified"); ctx->name = param->string; param->string = NULL; break; } return 0; }
1
333,503
static inline LineContribType * _gdContributionsAlloc(unsigned int line_length, unsigned int windows_size) { unsigned int u = 0; LineContribType *res; int overflow_error = 0; res = (LineContribType *) gdMalloc(sizeof(LineContribType)); if (!res) { return NULL; } res->WindowSize = windows_size; res->LineLength = line_length; if (overflow2(line_length, sizeof(ContributionType))) { gdFree(res); return NULL; } res->ContribRow = (ContributionType *) gdMalloc(line_length * sizeof(ContributionType)); if (res->ContribRow == NULL) { gdFree(res); return NULL; } for (u = 0 ; u < line_length ; u++) { if (overflow2(windows_size, sizeof(double))) { overflow_error = 1; } else { res->ContribRow[u].Weights = (double *) gdMalloc(windows_size * sizeof(double)); } if (overflow_error == 1 || res->ContribRow[u].Weights == NULL) { unsigned int i; u--; for (i=0;i<=u;i++) { gdFree(res->ContribRow[i].Weights); } gdFree(res); return NULL; } } return res; }
0
252,323
size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len, const void *pSrc_buf, size_t src_buf_len, int flags) { tinfl_decompressor decomp; tinfl_status status; tinfl_init(&decomp); status = tinfl_decompress(&decomp, (const mz_uint8 *)pSrc_buf, &src_buf_len, (mz_uint8 *)pOut_buf, (mz_uint8 *)pOut_buf, &out_buf_len, (flags & ~TINFL_FLAG_HAS_MORE_INPUT) | TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF); return (status != TINFL_STATUS_DONE) ? TINFL_DECOMPRESS_MEM_TO_MEM_FAILED : out_buf_len; }
0
212,083
static int ismt_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data) { int ret; unsigned long time_left; dma_addr_t dma_addr = 0; /* address of the data buffer */ u8 dma_size = 0; enum dma_data_direction dma_direction = 0; struct ismt_desc *desc; struct ismt_priv *priv = i2c_get_adapdata(adap); struct device *dev = &priv->pci_dev->dev; u8 *dma_buffer = PTR_ALIGN(&priv->buffer[0], 16); desc = &priv->hw[priv->head]; /* Initialize the DMA buffer */ memset(priv->buffer, 0, sizeof(priv->buffer)); /* Initialize the descriptor */ memset(desc, 0, sizeof(struct ismt_desc)); desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, read_write); /* Always clear the log entries */ memset(priv->log, 0, ISMT_LOG_ENTRIES * sizeof(u32)); /* Initialize common control bits */ if (likely(pci_dev_msi_enabled(priv->pci_dev))) desc->control = ISMT_DESC_INT | ISMT_DESC_FAIR; else desc->control = ISMT_DESC_FAIR; if ((flags & I2C_CLIENT_PEC) && (size != I2C_SMBUS_QUICK) && (size != I2C_SMBUS_I2C_BLOCK_DATA)) desc->control |= ISMT_DESC_PEC; switch (size) { case I2C_SMBUS_QUICK: dev_dbg(dev, "I2C_SMBUS_QUICK\n"); break; case I2C_SMBUS_BYTE: if (read_write == I2C_SMBUS_WRITE) { /* * Send Byte * The command field contains the write data */ dev_dbg(dev, "I2C_SMBUS_BYTE: WRITE\n"); desc->control |= ISMT_DESC_CWRL; desc->wr_len_cmd = command; } else { /* Receive Byte */ dev_dbg(dev, "I2C_SMBUS_BYTE: READ\n"); dma_size = 1; dma_direction = DMA_FROM_DEVICE; desc->rd_len = 1; } break; case I2C_SMBUS_BYTE_DATA: if (read_write == I2C_SMBUS_WRITE) { /* * Write Byte * Command plus 1 data byte */ dev_dbg(dev, "I2C_SMBUS_BYTE_DATA: WRITE\n"); desc->wr_len_cmd = 2; dma_size = 2; dma_direction = DMA_TO_DEVICE; dma_buffer[0] = command; dma_buffer[1] = data->byte; } else { /* Read Byte */ dev_dbg(dev, "I2C_SMBUS_BYTE_DATA: READ\n"); desc->control |= ISMT_DESC_CWRL; desc->wr_len_cmd = command; desc->rd_len = 1; dma_size = 1; dma_direction = DMA_FROM_DEVICE; } break; case I2C_SMBUS_WORD_DATA: if (read_write == I2C_SMBUS_WRITE) { /* Write Word */ dev_dbg(dev, "I2C_SMBUS_WORD_DATA: WRITE\n"); desc->wr_len_cmd = 3; dma_size = 3; dma_direction = DMA_TO_DEVICE; dma_buffer[0] = command; dma_buffer[1] = data->word & 0xff; dma_buffer[2] = data->word >> 8; } else { /* Read Word */ dev_dbg(dev, "I2C_SMBUS_WORD_DATA: READ\n"); desc->wr_len_cmd = command; desc->control |= ISMT_DESC_CWRL; desc->rd_len = 2; dma_size = 2; dma_direction = DMA_FROM_DEVICE; } break; case I2C_SMBUS_PROC_CALL: dev_dbg(dev, "I2C_SMBUS_PROC_CALL\n"); desc->wr_len_cmd = 3; desc->rd_len = 2; dma_size = 3; dma_direction = DMA_BIDIRECTIONAL; dma_buffer[0] = command; dma_buffer[1] = data->word & 0xff; dma_buffer[2] = data->word >> 8; break; case I2C_SMBUS_BLOCK_DATA: if (read_write == I2C_SMBUS_WRITE) { /* Block Write */ dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: WRITE\n"); dma_size = data->block[0] + 1; dma_direction = DMA_TO_DEVICE; desc->wr_len_cmd = dma_size; desc->control |= ISMT_DESC_BLK; dma_buffer[0] = command; memcpy(&dma_buffer[1], &data->block[1], dma_size - 1); } else { /* Block Read */ dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); dma_size = I2C_SMBUS_BLOCK_MAX; dma_direction = DMA_FROM_DEVICE; desc->rd_len = dma_size; desc->wr_len_cmd = command; desc->control |= (ISMT_DESC_BLK | ISMT_DESC_CWRL); } break; case I2C_SMBUS_BLOCK_PROC_CALL: dev_dbg(dev, "I2C_SMBUS_BLOCK_PROC_CALL\n"); dma_size = I2C_SMBUS_BLOCK_MAX; desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, 1); desc->wr_len_cmd = data->block[0] + 1; desc->rd_len = dma_size; desc->control |= ISMT_DESC_BLK; dma_direction = DMA_BIDIRECTIONAL; dma_buffer[0] = command; memcpy(&dma_buffer[1], &data->block[1], data->block[0]); break; case I2C_SMBUS_I2C_BLOCK_DATA: /* Make sure the length is valid */ if (data->block[0] < 1) data->block[0] = 1; if (data->block[0] > I2C_SMBUS_BLOCK_MAX) data->block[0] = I2C_SMBUS_BLOCK_MAX; if (read_write == I2C_SMBUS_WRITE) { /* i2c Block Write */ dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: WRITE\n"); dma_size = data->block[0] + 1; dma_direction = DMA_TO_DEVICE; desc->wr_len_cmd = dma_size; desc->control |= ISMT_DESC_I2C; dma_buffer[0] = command; memcpy(&dma_buffer[1], &data->block[1], dma_size - 1); } else { /* i2c Block Read */ dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: READ\n"); dma_size = data->block[0]; dma_direction = DMA_FROM_DEVICE; desc->rd_len = dma_size; desc->wr_len_cmd = command; desc->control |= (ISMT_DESC_I2C | ISMT_DESC_CWRL); /* * Per the "Table 15-15. I2C Commands", * in the External Design Specification (EDS), * (Document Number: 508084, Revision: 2.0), * the _rw bit must be 0 */ desc->tgtaddr_rw = ISMT_DESC_ADDR_RW(addr, 0); } break; default: dev_err(dev, "Unsupported transaction %d\n", size); return -EOPNOTSUPP; } /* map the data buffer */ if (dma_size != 0) { dev_dbg(dev, " dev=%p\n", dev); dev_dbg(dev, " data=%p\n", data); dev_dbg(dev, " dma_buffer=%p\n", dma_buffer); dev_dbg(dev, " dma_size=%d\n", dma_size); dev_dbg(dev, " dma_direction=%d\n", dma_direction); dma_addr = dma_map_single(dev, dma_buffer, dma_size, dma_direction); if (dma_mapping_error(dev, dma_addr)) { dev_err(dev, "Error in mapping dma buffer %p\n", dma_buffer); return -EIO; } dev_dbg(dev, " dma_addr = %pad\n", &dma_addr); desc->dptr_low = lower_32_bits(dma_addr); desc->dptr_high = upper_32_bits(dma_addr); } reinit_completion(&priv->cmp); /* Add the descriptor */ ismt_submit_desc(priv); /* Now we wait for interrupt completion, 1s */ time_left = wait_for_completion_timeout(&priv->cmp, HZ*1); /* unmap the data buffer */ if (dma_size != 0) dma_unmap_single(dev, dma_addr, dma_size, dma_direction); if (unlikely(!time_left)) { dev_err(dev, "completion wait timed out\n"); ret = -ETIMEDOUT; goto out; } /* do any post processing of the descriptor here */ ret = ismt_process_desc(desc, data, priv, size, read_write); out: /* Update the ring pointer */ priv->head++; priv->head %= ISMT_DESC_ENTRIES; return ret; }
1
259,317
static void fix_index_entry_timestamps(AVStream* st, int end_index, int64_t end_ts, int64_t* frame_duration_buffer, int frame_duration_buffer_size) { FFStream *const sti = ffstream(st); int i = 0; av_assert0(end_index >= 0 && end_index <= sti->nb_index_entries); for (i = 0; i < frame_duration_buffer_size; i++) { end_ts -= frame_duration_buffer[frame_duration_buffer_size - 1 - i]; sti->index_entries[end_index - 1 - i].timestamp = end_ts; } }
0
90,771
void QuotaManager::GetCachedOrigins( StorageType type, std::set<GURL>* origins) { DCHECK(origins); LazyInitialize(); switch (type) { case kStorageTypeTemporary: DCHECK(temporary_usage_tracker_.get()); temporary_usage_tracker_->GetCachedOrigins(origins); return; case kStorageTypePersistent: DCHECK(persistent_usage_tracker_.get()); persistent_usage_tracker_->GetCachedOrigins(origins); return; default: NOTREACHED(); } }
0
220,024
explicit AddManySparseToTensorsMapOp(OpKernelConstruction* context) : SparseTensorAccessingOp(context) {}
0
273,084
uuid_make(char *str) { uint16_t uuid[8]; time_t now; int i; now = time(NULL); srand((unsigned int)now); for (i = 0; i < ARRAY_SIZE(uuid); i++) { uuid[i] = (uint16_t)rand(); // time_hi_and_version, set version to 4 (=random) if (i == 3) uuid[i] = (uuid[i] & 0x0FFF) | 0x4000; // clock_seq, variant 1 if (i == 4) uuid[i] = (uuid[i] & 0x3FFF) | 0x8000; if (i == 2 || i == 3 || i == 4 || i == 5) str += sprintf(str, "-"); str += sprintf(str, "%04" PRIX16, uuid[i]); } }
0
336,631
static void reds_mig_cleanup(RedsState *reds) { if (reds->mig_inprogress) { if (reds->mig_wait_connect || reds->mig_wait_disconnect) { SpiceMigrateInterface *sif; spice_assert(reds->migration_interface); sif = SPICE_UPCAST(SpiceMigrateInterface, reds->migration_interface->base.sif); if (reds->mig_wait_connect) { sif->migrate_connect_complete(reds->migration_interface); } else { if (sif->migrate_end_complete) { sif->migrate_end_complete(reds->migration_interface); } } } reds->mig_inprogress = FALSE; reds->mig_wait_connect = FALSE; reds->mig_wait_disconnect = FALSE; red_timer_cancel(reds->mig_timer); reds_mig_cleanup_wait_disconnect(reds); } }
0
244,065
GF_Err chnl_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_ChannelLayoutBox *ptr = (GF_ChannelLayoutBox *) s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u8(bs, ptr->layout.stream_structure); if (ptr->layout.stream_structure & 1) { gf_bs_write_u8(bs, ptr->layout.definedLayout); if (ptr->layout.definedLayout==0) { u32 i; for (i=0; i<ptr->layout.channels_count; i++) { gf_bs_write_u8(bs, ptr->layout.layouts[i].position); if (ptr->layout.layouts[i].position==126) { gf_bs_write_int(bs, ptr->layout.layouts[i].azimuth, 16); gf_bs_write_int(bs, ptr->layout.layouts[i].elevation, 8); } } } else { gf_bs_write_u64(bs, ptr->layout.omittedChannelsMap); } } if (ptr->layout.stream_structure & 2) { gf_bs_write_u8(bs, ptr->layout.object_count); } return GF_OK; }
0
329,887
span_renderer_fini (cairo_abstract_span_renderer_t *_r, cairo_int_status_t status) { cairo_image_span_renderer_t *r = (cairo_image_span_renderer_t *) _r; TRACE ((stderr, "%s\n", __FUNCTION__)); if (likely (status == CAIRO_INT_STATUS_SUCCESS)) { if (r->base.finish) r->base.finish (r); } if (likely (status == CAIRO_INT_STATUS_SUCCESS && r->bpp == 0)) { const cairo_composite_rectangles_t *composite = r->composite; pixman_image_composite32 (r->op, r->src, r->mask, to_pixman_image (composite->surface), composite->unbounded.x + r->u.mask.src_x, composite->unbounded.y + r->u.mask.src_y, 0, 0, composite->unbounded.x, composite->unbounded.y, composite->unbounded.width, composite->unbounded.height); } if (r->src) pixman_image_unref (r->src); if (r->mask) pixman_image_unref (r->mask); }
0
482,471
atEndOfLine(const FileInfo *file) { return file->linepos >= file->linelen; }
0
384,853
vim_strsize(char_u *s) { return vim_strnsize(s, (int)MAXCOL); }
0
234,194
init_dwarf_regnames_x86_64 (void) { dwarf_regnames = dwarf_regnames_x86_64; dwarf_regnames_count = ARRAY_SIZE (dwarf_regnames_x86_64); dwarf_regnames_lookup_func = regname_internal_by_table_only; }
0
437,723
static int cx23888_ir_rx_g_parameters(struct v4l2_subdev *sd, struct v4l2_subdev_ir_parameters *p) { struct cx23888_ir_state *state = to_state(sd); mutex_lock(&state->rx_params_lock); memcpy(p, &state->rx_params, sizeof(struct v4l2_subdev_ir_parameters)); mutex_unlock(&state->rx_params_lock); return 0; }
0
424,911
static ssize_t iwl_dbgfs_fh_reg_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { struct iwl_trans *trans = file->private_data; char *buf = NULL; ssize_t ret; ret = iwl_dump_fh(trans, &buf); if (ret < 0) return ret; if (!buf) return -EINVAL; ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); kfree(buf); return ret; }
0
313,843
restore_visual_mode(void) { if (VIsual_mode_orig != NUL) { curbuf->b_visual.vi_mode = VIsual_mode_orig; VIsual_mode_orig = NUL; } }
0
309,897
getmouse(MEVENT * aevent) { return NCURSES_SP_NAME(getmouse) (CURRENT_SCREEN, aevent); }
0
424,929
static int iwl_pcie_nic_init(struct iwl_trans *trans) { struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); int ret; /* nic_init */ spin_lock(&trans_pcie->irq_lock); ret = iwl_pcie_apm_init(trans); spin_unlock(&trans_pcie->irq_lock); if (ret) return ret; iwl_pcie_set_pwr(trans, false); iwl_op_mode_nic_config(trans->op_mode); /* Allocate the RX queue, or reset if it is already allocated */ iwl_pcie_rx_init(trans); /* Allocate or reset and init all Tx and Command queues */ if (iwl_pcie_tx_init(trans)) return -ENOMEM; if (trans->trans_cfg->base_params->shadow_reg_enable) { /* enable shadow regs in HW */ iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, 0x800FFFFF); IWL_DEBUG_INFO(trans, "Enabling shadow registers in device\n"); } return 0; }
0
405,376
static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, struct xfrm_dst **bundle, int nx, const struct flowi *fl, struct dst_entry *dst) { const struct xfrm_state_afinfo *afinfo; const struct xfrm_mode *inner_mode; struct net *net = xp_net(policy); unsigned long now = jiffies; struct net_device *dev; struct xfrm_dst *xdst_prev = NULL; struct xfrm_dst *xdst0 = NULL; int i = 0; int err; int header_len = 0; int nfheader_len = 0; int trailer_len = 0; int tos; int family = policy->selector.family; xfrm_address_t saddr, daddr; xfrm_flowi_addr_get(fl, &saddr, &daddr, family); tos = xfrm_get_tos(fl, family); dst_hold(dst); for (; i < nx; i++) { struct xfrm_dst *xdst = xfrm_alloc_dst(net, family); struct dst_entry *dst1 = &xdst->u.dst; err = PTR_ERR(xdst); if (IS_ERR(xdst)) { dst_release(dst); goto put_states; } bundle[i] = xdst; if (!xdst_prev) xdst0 = xdst; else /* Ref count is taken during xfrm_alloc_dst() * No need to do dst_clone() on dst1 */ xfrm_dst_set_child(xdst_prev, &xdst->u.dst); if (xfrm[i]->sel.family == AF_UNSPEC) { inner_mode = xfrm_ip2inner_mode(xfrm[i], xfrm_af2proto(family)); if (!inner_mode) { err = -EAFNOSUPPORT; dst_release(dst); goto put_states; } } else inner_mode = &xfrm[i]->inner_mode; xdst->route = dst; dst_copy_metrics(dst1, dst); if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) { __u32 mark = 0; int oif; if (xfrm[i]->props.smark.v || xfrm[i]->props.smark.m) mark = xfrm_smark_get(fl->flowi_mark, xfrm[i]); family = xfrm[i]->props.family; oif = fl->flowi_oif ? : fl->flowi_l3mdev; dst = xfrm_dst_lookup(xfrm[i], tos, oif, &saddr, &daddr, family, mark); err = PTR_ERR(dst); if (IS_ERR(dst)) goto put_states; } else dst_hold(dst); dst1->xfrm = xfrm[i]; xdst->xfrm_genid = xfrm[i]->genid; dst1->obsolete = DST_OBSOLETE_FORCE_CHK; dst1->lastuse = now; dst1->input = dst_discard; rcu_read_lock(); afinfo = xfrm_state_afinfo_get_rcu(inner_mode->family); if (likely(afinfo)) dst1->output = afinfo->output; else dst1->output = dst_discard_out; rcu_read_unlock(); xdst_prev = xdst; header_len += xfrm[i]->props.header_len; if (xfrm[i]->type->flags & XFRM_TYPE_NON_FRAGMENT) nfheader_len += xfrm[i]->props.header_len; trailer_len += xfrm[i]->props.trailer_len; } xfrm_dst_set_child(xdst_prev, dst); xdst0->path = dst; err = -ENODEV; dev = dst->dev; if (!dev) goto free_dst; xfrm_init_path(xdst0, dst, nfheader_len); xfrm_init_pmtu(bundle, nx); for (xdst_prev = xdst0; xdst_prev != (struct xfrm_dst *)dst; xdst_prev = (struct xfrm_dst *) xfrm_dst_child(&xdst_prev->u.dst)) { err = xfrm_fill_dst(xdst_prev, dev, fl); if (err) goto free_dst; xdst_prev->u.dst.header_len = header_len; xdst_prev->u.dst.trailer_len = trailer_len; header_len -= xdst_prev->u.dst.xfrm->props.header_len; trailer_len -= xdst_prev->u.dst.xfrm->props.trailer_len; } return &xdst0->u.dst; put_states: for (; i < nx; i++) xfrm_state_put(xfrm[i]); free_dst: if (xdst0) dst_release_immediate(&xdst0->u.dst); return ERR_PTR(err); }
0
459,199
static struct tc_action *tcf_exts_first_act(struct tcf_exts *exts) { if (exts->nr_actions == 0) return NULL; else return exts->actions[0]; }
0
513,089
Item_hex_constant(THD *thd): Item_literal(thd) { hex_string_init(thd, "", 0); }
0
468,348
connection_attempt_unref (gpointer pointer) { ConnectionAttempt *attempt = pointer; if (g_ref_count_dec (&attempt->ref)) { g_clear_object (&attempt->address); g_clear_object (&attempt->socket); g_clear_object (&attempt->connection); g_clear_object (&attempt->cancellable); if (attempt->timeout_source) { g_source_destroy (attempt->timeout_source); g_source_unref (attempt->timeout_source); } g_free (attempt); } }
0
498,918
pax_decode_header (struct tar_sparse_file *file) { if (file->stat_info->sparse_major > 0) { uintmax_t u; char nbuf[UINTMAX_STRSIZE_BOUND]; union block *blk; char *p; size_t i; off_t start; #define COPY_BUF(b,buf,src) do \ { \ char *endp = b->buffer + BLOCKSIZE; \ char *dst = buf; \ do \ { \ if (dst == buf + UINTMAX_STRSIZE_BOUND -1) \ { \ ERROR ((0, 0, _("%s: numeric overflow in sparse archive member"), \ file->stat_info->orig_file_name)); \ return false; \ } \ if (src == endp) \ { \ set_next_block_after (b); \ b = find_next_block (); \ if (!b) \ FATAL_ERROR ((0, 0, _("Unexpected EOF in archive"))); \ src = b->buffer; \ endp = b->buffer + BLOCKSIZE; \ } \ *dst = *src++; \ } \ while (*dst++ != '\n'); \ dst[-1] = 0; \ } while (0) start = current_block_ordinal (); set_next_block_after (current_header); blk = find_next_block (); if (!blk) FATAL_ERROR ((0, 0, _("Unexpected EOF in archive"))); p = blk->buffer; COPY_BUF (blk,nbuf,p); if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t))) { ERROR ((0, 0, _("%s: malformed sparse archive member"), file->stat_info->orig_file_name)); return false; } file->stat_info->sparse_map_size = u; file->stat_info->sparse_map = xcalloc (file->stat_info->sparse_map_size, sizeof (*file->stat_info->sparse_map)); file->stat_info->sparse_map_avail = 0; for (i = 0; i < file->stat_info->sparse_map_size; i++) { struct sp_array sp; COPY_BUF (blk,nbuf,p); if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t))) { ERROR ((0, 0, _("%s: malformed sparse archive member"), file->stat_info->orig_file_name)); return false; } sp.offset = u; COPY_BUF (blk,nbuf,p); if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t))) { ERROR ((0, 0, _("%s: malformed sparse archive member"), file->stat_info->orig_file_name)); return false; } sp.numbytes = u; sparse_add_map (file->stat_info, &sp); } set_next_block_after (blk); file->dumped_size += BLOCKSIZE * (current_block_ordinal () - start); } return true; }
0
312,539
qf_parse_fmt_t(regmatch_T *rmp, int midx, qffields_T *fields) { if (rmp->startp[midx] == NULL) return QF_FAIL; fields->type = *rmp->startp[midx]; return QF_OK; }
0
236,165
void gpp_read_style(GF_BitStream *bs, GF_StyleRecord *rec) { rec->startCharOffset = gf_bs_read_u16(bs); rec->endCharOffset = gf_bs_read_u16(bs); rec->fontID = gf_bs_read_u16(bs); rec->style_flags = gf_bs_read_u8(bs); rec->font_size = gf_bs_read_u8(bs); rec->text_color = gpp_read_rgba(bs); }
0
401,576
int __must_check get_random_bytes_arch(void *buf, int nbytes) { int left = nbytes; char *p = buf; trace_get_random_bytes_arch(left, _RET_IP_); while (left) { unsigned long v; int chunk = min_t(int, left, sizeof(unsigned long)); if (!arch_get_random_long(&v)) break; memcpy(p, &v, chunk); p += chunk; left -= chunk; } return nbytes - left; }
0
359,850
static inline Quantum GetAlpha(unsigned int word,TIM2ColorEncoding ce) { switch(ce) { case RGBA16: return ScaleCharToQuantum((word>>3*5&0x1F)==0?0:0xFF); case RGBA32: /* 0x80 -> 1.0 alpha. Multiply by 2 and clamp to 0xFF */ return ScaleCharToQuantum(MagickMin((word>>3*8&0xFF)<<1,0xFF)); default: return 0xFF; } }
0
512,272
longlong Item_func_dyncol_check::val_int() { char buff[STRING_BUFFER_USUAL_SIZE]; String tmp(buff, sizeof(buff), &my_charset_bin); DYNAMIC_COLUMN col; String *str; enum enum_dyncol_func_result rc; str= args[0]->val_str(&tmp); if (args[0]->null_value) goto null; col.length= str->length(); /* We do not change the string, so could do this trick */ col.str= (char *)str->ptr(); rc= mariadb_dyncol_check(&col); if (rc < 0 && rc != ER_DYNCOL_FORMAT) { dynamic_column_error_message(rc); goto null; } null_value= FALSE; return rc == ER_DYNCOL_OK; null: null_value= TRUE; return 0; }
0
353,237
void SplashOutputDev::eoClip(GfxState *state) { SplashPath path = convertPath(state, state->getPath(), true); splash->clipToPath(&path, true); }
0
512,582
longlong Item_func_isnotnull::val_int() { DBUG_ASSERT(fixed == 1); return args[0]->is_null() ? 0 : 1; }
0
226,348
void audio_sample_entry_box_del(GF_Box *s) { GF_MPEGAudioSampleEntryBox *ptr = (GF_MPEGAudioSampleEntryBox *)s; if (ptr == NULL) return; gf_isom_sample_entry_predestroy((GF_SampleEntryBox *)s); if (ptr->slc) gf_odf_desc_del((GF_Descriptor *)ptr->slc); gf_free(ptr); }
0
255,031
static int adts_write_frame_header(ADTSContext *ctx, uint8_t *buf, int size, int pce_size) { PutBitContext pb; unsigned full_frame_size = (unsigned)ADTS_HEADER_SIZE + size + pce_size; if (full_frame_size > ADTS_MAX_FRAME_BYTES) { av_log(NULL, AV_LOG_ERROR, "ADTS frame size too large: %u (max %d)\n", full_frame_size, ADTS_MAX_FRAME_BYTES); return AVERROR_INVALIDDATA; } init_put_bits(&pb, buf, ADTS_HEADER_SIZE); /* adts_fixed_header */ put_bits(&pb, 12, 0xfff); /* syncword */ put_bits(&pb, 1, ctx->mpeg_id); /* ID */ put_bits(&pb, 2, 0); /* layer */ put_bits(&pb, 1, 1); /* protection_absent */ put_bits(&pb, 2, ctx->objecttype); /* profile_objecttype */ put_bits(&pb, 4, ctx->sample_rate_index); put_bits(&pb, 1, 0); /* private_bit */ put_bits(&pb, 3, ctx->channel_conf); /* channel_configuration */ put_bits(&pb, 1, 0); /* original_copy */ put_bits(&pb, 1, 0); /* home */ /* adts_variable_header */ put_bits(&pb, 1, 0); /* copyright_identification_bit */ put_bits(&pb, 1, 0); /* copyright_identification_start */ put_bits(&pb, 13, full_frame_size); /* aac_frame_length */ put_bits(&pb, 11, 0x7ff); /* adts_buffer_fullness */ put_bits(&pb, 2, 0); /* number_of_raw_data_blocks_in_frame */ flush_put_bits(&pb); return 0; }
0
513,147
static void unlock_variables(THD *thd, struct system_variables *vars) { intern_plugin_unlock(NULL, vars->table_plugin); intern_plugin_unlock(NULL, vars->tmp_table_plugin); intern_plugin_unlock(NULL, vars->enforced_table_plugin); vars->table_plugin= vars->tmp_table_plugin= vars->enforced_table_plugin= NULL; }
0
338,182
WasmBinaryBuilder::getByteView(size_t size) { if (size > input.size() || pos > input.size() - size) { throwError("unexpected end of input"); } pos += size; return {input.data() + (pos - size), input.data() + pos}; }
0
344,257
int luaV_tointeger (const TValue *obj, lua_Integer *p, F2Imod mode) { TValue v; if (l_strton(obj, &v)) /* does 'obj' point to a numerical string? */ obj = &v; /* change it to point to its corresponding number */ return luaV_tointegerns(obj, p, mode); }
0
353,020
directoryStringSubstringsMatch( int *matchp, slap_mask_t flags, Syntax *syntax, MatchingRule *mr, struct berval *value, void *assertedValue ) { int match = 0; SubstringsAssertion *sub = assertedValue; struct berval left = *value; ber_len_t i; int priorspace=0; if ( !BER_BVISNULL( &sub->sa_initial ) ) { if ( sub->sa_initial.bv_len > left.bv_len ) { /* not enough left */ match = 1; goto done; } match = memcmp( sub->sa_initial.bv_val, left.bv_val, sub->sa_initial.bv_len ); if ( match != 0 ) { goto done; } left.bv_val += sub->sa_initial.bv_len; left.bv_len -= sub->sa_initial.bv_len; priorspace = ASCII_SPACE( sub->sa_initial.bv_val[sub->sa_initial.bv_len] ); } if ( sub->sa_any ) { for ( i = 0; !BER_BVISNULL( &sub->sa_any[i] ); i++ ) { ber_len_t idx; char *p; if( priorspace && !BER_BVISEMPTY( &sub->sa_any[i] ) && ASCII_SPACE( sub->sa_any[i].bv_val[0] )) { /* allow next space to match */ left.bv_val--; left.bv_len++; } priorspace=0; retry: if ( BER_BVISEMPTY( &sub->sa_any[i] ) ) { continue; } if ( sub->sa_any[i].bv_len > left.bv_len ) { /* not enough left */ match = 1; goto done; } p = memchr( left.bv_val, *sub->sa_any[i].bv_val, left.bv_len ); if( p == NULL ) { match = 1; goto done; } idx = p - left.bv_val; if ( idx >= left.bv_len ) { /* this shouldn't happen */ return LDAP_OTHER; } left.bv_val = p; left.bv_len -= idx; if ( sub->sa_any[i].bv_len > left.bv_len ) { /* not enough left */ match = 1; goto done; } match = memcmp( left.bv_val, sub->sa_any[i].bv_val, sub->sa_any[i].bv_len ); if ( match != 0 ) { left.bv_val++; left.bv_len--; goto retry; } left.bv_val += sub->sa_any[i].bv_len; left.bv_len -= sub->sa_any[i].bv_len; priorspace = ASCII_SPACE( sub->sa_any[i].bv_val[sub->sa_any[i].bv_len] ); } } if ( !BER_BVISNULL( &sub->sa_final ) ) { if( priorspace && !BER_BVISEMPTY( &sub->sa_final ) && ASCII_SPACE( sub->sa_final.bv_val[0] )) { /* allow next space to match */ left.bv_val--; left.bv_len++; } if ( sub->sa_final.bv_len > left.bv_len ) { /* not enough left */ match = 1; goto done; } match = memcmp( sub->sa_final.bv_val, &left.bv_val[left.bv_len - sub->sa_final.bv_len], sub->sa_final.bv_len ); if ( match != 0 ) { goto done; } } done: *matchp = match; return LDAP_SUCCESS; }
0
231,715
void onConnectionMigration( QuicServerConnectionState& conn, const folly::SocketAddress& newPeerAddress, bool isIntentional) { if (conn.migrationState.numMigrations >= kMaxNumMigrationsAllowed) { if (conn.qLogger) { conn.qLogger->addPacketDrop( 0, QuicTransportStatsCallback::toString( PacketDropReason::PEER_ADDRESS_CHANGE)); } QUIC_STATS( conn.statsCallback, onPacketDropped, PacketDropReason::PEER_ADDRESS_CHANGE); throw QuicTransportException( "Too many migrations", TransportErrorCode::INVALID_MIGRATION); } ++conn.migrationState.numMigrations; bool hasPendingPathChallenge = conn.pendingEvents.pathChallenge.has_value(); // Clear any pending path challenge frame that is not sent conn.pendingEvents.pathChallenge = folly::none; auto& previousPeerAddresses = conn.migrationState.previousPeerAddresses; auto it = std::find( previousPeerAddresses.begin(), previousPeerAddresses.end(), newPeerAddress); if (it == previousPeerAddresses.end()) { // Send new path challenge uint64_t pathData; folly::Random::secureRandom(&pathData, sizeof(pathData)); conn.pendingEvents.pathChallenge = PathChallengeFrame(pathData); // If we are already in the middle of a migration reset // the available bytes in the rate-limited window, but keep the // window. conn.pathValidationLimiter = std::make_unique<PendingPathRateLimiter>(conn.udpSendPacketLen); } else { previousPeerAddresses.erase(it); } // At this point, path validation scheduled, writable bytes limit set // However if this is NAT rebinding, keep congestion state unchanged bool isNATRebinding = maybeNATRebinding(newPeerAddress, conn.peerAddress); // Cancel current path validation if any if (hasPendingPathChallenge || conn.outstandingPathValidation) { conn.pendingEvents.schedulePathValidationTimeout = false; conn.outstandingPathValidation = folly::none; // Only change congestion & rtt state if not NAT rebinding if (!isNATRebinding) { recoverOrResetCongestionAndRttState(conn, newPeerAddress); } } else { // Only add validated addresses to previousPeerAddresses conn.migrationState.previousPeerAddresses.push_back(conn.peerAddress); // Only change congestion & rtt state if not NAT rebinding if (!isNATRebinding) { // Current peer address is validated, // remember its congestion state and rtt stats CongestionAndRttState state = moveCurrentCongestionAndRttState(conn); recoverOrResetCongestionAndRttState(conn, newPeerAddress); conn.migrationState.lastCongestionAndRtt = std::move(state); } } if (conn.qLogger) { conn.qLogger->addConnectionMigrationUpdate(isIntentional); } conn.peerAddress = newPeerAddress; }
0
200,934
testBackingParse(const void *args) { const struct testBackingParseData *data = args; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_autofree char *xml = NULL; g_autoptr(virStorageSource) src = NULL; int rc; int erc = data->rv; /* expect failure return code with NULL expected data */ if (!data->expect) erc = -1; if ((rc = virStorageSourceNewFromBackingAbsolute(data->backing, &src)) != erc) { fprintf(stderr, "expected return value '%d' actual '%d'\n", erc, rc); return -1; } if (!src) return 0; if (src && !data->expect) { fprintf(stderr, "parsing of backing store string '%s' should " "have failed\n", data->backing); return -1; } if (virDomainDiskSourceFormat(&buf, src, "source", 0, false, 0, true, NULL) < 0 || !(xml = virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); return -1; } if (STRNEQ(xml, data->expect)) { fprintf(stderr, "\n backing store string '%s'\n" "expected storage source xml:\n%s\n" "actual storage source xml:\n%s\n", data->backing, data->expect, xml); return -1; } return 0; }
1
259,224
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries, ctts_count = 0; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "track[%u].ctts.entries = %u\n", c->fc->nb_streams - 1, entries); if (!entries) return 0; if (entries >= UINT_MAX / sizeof(*sc->ctts_data)) return AVERROR_INVALIDDATA; av_freep(&sc->ctts_data); sc->ctts_data = av_fast_realloc(NULL, &sc->ctts_allocated_size, entries * sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { int count = avio_rb32(pb); int duration = avio_rb32(pb); if (count <= 0) { av_log(c->fc, AV_LOG_TRACE, "ignoring CTTS entry with count=%d duration=%d\n", count, duration); continue; } add_ctts_entry(&sc->ctts_data, &ctts_count, &sc->ctts_allocated_size, count, duration); av_log(c->fc, AV_LOG_TRACE, "count=%d, duration=%d\n", count, duration); if (FFNABS(duration) < -(1<<28) && i+2<entries) { av_log(c->fc, AV_LOG_WARNING, "CTTS invalid\n"); av_freep(&sc->ctts_data); sc->ctts_count = 0; return 0; } if (i+2<entries) mov_update_dts_shift(sc, duration, c->fc); } sc->ctts_count = ctts_count; if (pb->eof_reached) { av_log(c->fc, AV_LOG_WARNING, "reached eof, corrupted CTTS atom\n"); return AVERROR_EOF; } av_log(c->fc, AV_LOG_TRACE, "dts shift %d\n", sc->dts_shift); return 0; }
0
498,089
char *fmtalloc(const char *format, ...) { struct strbuf sb = STRBUF_INIT; va_list args; va_start(args, format); strbuf_vaddf(&sb, format, args); va_end(args); return strbuf_detach(&sb, NULL); }
0
90,220
virtual bool offline_mode() const { return offline_mode_; }
0
312,555
qf_store_title(qf_list_T *qfl, char_u *title) { VIM_CLEAR(qfl->qf_title); if (title != NULL) { char_u *p = alloc_id(STRLEN(title) + 2, aid_qf_title); qfl->qf_title = p; if (p != NULL) STRCPY(p, title); } }
0
234,130
regname_internal_by_table_only (unsigned int regno) { if (dwarf_regnames != NULL && regno < dwarf_regnames_count && dwarf_regnames [regno] != NULL) return dwarf_regnames [regno]; return NULL; }
0
424,905
static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, enum iwl_d3_status *status, bool test, bool reset) { struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); u32 val; int ret; if (test) { iwl_enable_interrupts(trans); *status = IWL_D3_STATUS_ALIVE; goto out; } iwl_set_bit(trans, CSR_GP_CNTRL, BIT(trans->trans_cfg->csr->flag_mac_access_req)); ret = iwl_finish_nic_init(trans, trans->trans_cfg); if (ret) return ret; /* * Reconfigure IVAR table in case of MSIX or reset ict table in * MSI mode since HW reset erased it. * Also enables interrupts - none will happen as * the device doesn't know we're waking it up, only when * the opmode actually tells it after this call. */ iwl_pcie_conf_msix_hw(trans_pcie); if (!trans_pcie->msix_enabled) iwl_pcie_reset_ict(trans); iwl_enable_interrupts(trans); iwl_pcie_set_pwr(trans, false); if (!reset) { iwl_clear_bit(trans, CSR_GP_CNTRL, BIT(trans->trans_cfg->csr->flag_mac_access_req)); } else { iwl_trans_pcie_tx_reset(trans); ret = iwl_pcie_rx_init(trans); if (ret) { IWL_ERR(trans, "Failed to resume the device (RX reset)\n"); return ret; } } IWL_DEBUG_POWER(trans, "WFPM value upon resume = 0x%08X\n", iwl_read_umac_prph(trans, WFPM_GP2)); val = iwl_read32(trans, CSR_RESET); if (val & CSR_RESET_REG_FLAG_NEVO_RESET) *status = IWL_D3_STATUS_RESET; else *status = IWL_D3_STATUS_ALIVE; out: if (*status == IWL_D3_STATUS_ALIVE && trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) { trans_pcie->sx_complete = false; iwl_write_umac_prph(trans, UREG_DOORBELL_TO_ISR6, UREG_DOORBELL_TO_ISR6_RESUME); ret = wait_event_timeout(trans_pcie->sx_waitq, trans_pcie->sx_complete, 2 * HZ); /* * Invalidate it toward next suspend. */ trans_pcie->sx_complete = false; if (!ret) { IWL_ERR(trans, "Timeout exiting D3\n"); return -ETIMEDOUT; } } return 0; }
0
199,834
ins_compl_stop(int c, int prev_mode, int retval) { char_u *ptr; int want_cindent; // Get here when we have finished typing a sequence of ^N and // ^P or other completion characters in CTRL-X mode. Free up // memory that was used, and make sure we can redo the insert. if (compl_curr_match != NULL || compl_leader != NULL || c == Ctrl_E) { // If any of the original typed text has been changed, eg when // ignorecase is set, we must add back-spaces to the redo // buffer. We add as few as necessary to delete just the part // of the original text that has changed. // When using the longest match, edited the match or used // CTRL-E then don't use the current match. if (compl_curr_match != NULL && compl_used_match && c != Ctrl_E) ptr = compl_curr_match->cp_str; else ptr = NULL; ins_compl_fixRedoBufForLeader(ptr); } want_cindent = (get_can_cindent() && cindent_on()); // When completing whole lines: fix indent for 'cindent'. // Otherwise, break line if it's too long. if (compl_cont_mode == CTRL_X_WHOLE_LINE) { // re-indent the current line if (want_cindent) { do_c_expr_indent(); want_cindent = FALSE; // don't do it again } } else { int prev_col = curwin->w_cursor.col; // put the cursor on the last char, for 'tw' formatting if (prev_col > 0) dec_cursor(); // only format when something was inserted if (!arrow_used && !ins_need_undo_get() && c != Ctrl_E) insertchar(NUL, 0, -1); if (prev_col > 0 && ml_get_curline()[curwin->w_cursor.col] != NUL) inc_cursor(); } // If the popup menu is displayed pressing CTRL-Y means accepting // the selection without inserting anything. When // compl_enter_selects is set the Enter key does the same. if ((c == Ctrl_Y || (compl_enter_selects && (c == CAR || c == K_KENTER || c == NL))) && pum_visible()) retval = TRUE; // CTRL-E means completion is Ended, go back to the typed text. // but only do this, if the Popup is still visible if (c == Ctrl_E) { ins_compl_delete(); if (compl_leader != NULL) ins_bytes(compl_leader + get_compl_len()); else if (compl_first_match != NULL) ins_bytes(compl_orig_text + get_compl_len()); retval = TRUE; } auto_format(FALSE, TRUE); // Trigger the CompleteDonePre event to give scripts a chance to // act upon the completion before clearing the info, and restore // ctrl_x_mode, so that complete_info() can be used. ctrl_x_mode = prev_mode; ins_apply_autocmds(EVENT_COMPLETEDONEPRE); ins_compl_free(); compl_started = FALSE; compl_matches = 0; if (!shortmess(SHM_COMPLETIONMENU)) msg_clr_cmdline(); // necessary for "noshowmode" ctrl_x_mode = CTRL_X_NORMAL; compl_enter_selects = FALSE; if (edit_submode != NULL) { edit_submode = NULL; showmode(); } #ifdef FEAT_CMDWIN if (c == Ctrl_C && cmdwin_type != 0) // Avoid the popup menu remains displayed when leaving the // command line window. update_screen(0); #endif // Indent now if a key was typed that is in 'cinkeys'. if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0))) do_c_expr_indent(); // Trigger the CompleteDone event to give scripts a chance to act // upon the end of completion. ins_apply_autocmds(EVENT_COMPLETEDONE); return retval; }
1
512,761
Item_bool_rowready_func2* Lt_creator::create_swap(THD *thd, Item *a, Item *b) const { return new(thd->mem_root) Item_func_gt(thd, b, a); }
0
277,480
size_t mobi_trie_get_inflgroups(char **infl_strings, MOBITrie * const root, const char *string) { /* travers trie and get values for each substring */ if (root == NULL) { return MOBI_PARAM_ERR; } size_t count = 0; size_t length = strlen(string); MOBITrie *node = root; while (node && length > 0) { char **values = NULL; size_t values_count = 0; node = mobi_trie_get_next(&values, &values_count, node, string[length - 1]); length--; for (size_t j = 0; j < values_count; j++) { if (count == INDX_INFLSTRINGS_MAX) { debug_print("Inflection strings array too small (%d)\n", INDX_INFLSTRINGS_MAX); break; } char infl_string[INDX_LABEL_SIZEMAX + 1]; const size_t suffix_length = strlen(values[j]); if (length + suffix_length > INDX_LABEL_SIZEMAX) { debug_print("Label too long (%zu + %zu)\n", length, suffix_length); continue; } memcpy(infl_string, string, length); memcpy(infl_string + length, values[j], suffix_length); infl_string[length + suffix_length] = '\0'; infl_strings[count++] = strdup(infl_string); } } return count; }
0
291,806
int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt_sess *clt) { return (int)clt->max_reconnect_attempts; }
0
234,252
dwarf_select_sections_all (void) { do_debug_info = 1; do_debug_abbrevs = 1; do_debug_lines = FLAG_DEBUG_LINES_RAW; do_debug_pubnames = 1; do_debug_pubtypes = 1; do_debug_aranges = 1; do_debug_ranges = 1; do_debug_frames = 1; do_debug_macinfo = 1; do_debug_str = 1; do_debug_loc = 1; do_gdb_index = 1; do_trace_info = 1; do_trace_abbrevs = 1; do_trace_aranges = 1; do_debug_addr = 1; do_debug_cu_index = 1; do_follow_links = 1; do_debug_links = 1; do_debug_str_offsets = 1; }
0
344,770
set_rdomain(int fd, const char *name) { #if defined(HAVE_SYS_SET_RDOMAIN) return sys_set_rdomain(fd, name); #elif defined(__OpenBSD__) int rtable; const char *errstr; if (name == NULL) return 0; /* default table */ rtable = (int)strtonum(name, 0, 255, &errstr); if (errstr != NULL) { /* Shouldn't happen */ error("Invalid routing domain \"%s\": %s", name, errstr); return -1; } if (setsockopt(fd, SOL_SOCKET, SO_RTABLE, &rtable, sizeof(rtable)) == -1) { error("Failed to set routing domain %d on fd %d: %s", rtable, fd, strerror(errno)); return -1; } return 0; #else /* defined(__OpenBSD__) */ error("Setting routing domain is not supported on this platform"); return -1; #endif }
0
438,660
static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev) { struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev); struct virtproc_info *vrp = vch->vrp; struct device *dev = &rpdev->dev; int err = 0; /* need to tell remote processor's name service about this channel ? */ if (rpdev->announce && rpdev->ept && virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) { struct rpmsg_ns_msg nsm; strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE); nsm.addr = cpu_to_rpmsg32(rpdev, rpdev->ept->addr); nsm.flags = cpu_to_rpmsg32(rpdev, RPMSG_NS_CREATE); err = rpmsg_sendto(rpdev->ept, &nsm, sizeof(nsm), RPMSG_NS_ADDR); if (err) dev_err(dev, "failed to announce service %d\n", err); } return err; }
0
338,071
bool WasmBinaryBuilder::maybeVisitMemoryInit(Expression*& out, uint32_t code) { if (code != BinaryConsts::MemoryInit) { return false; } auto* curr = allocator.alloc<MemoryInit>(); curr->size = popNonVoidExpression(); curr->offset = popNonVoidExpression(); curr->dest = popNonVoidExpression(); curr->segment = getU32LEB(); if (getInt8() != 0) { throwError("Unexpected nonzero memory index"); } curr->finalize(); out = curr; return true; }
0
207,719
display_dollar(colnr_T col) { colnr_T save_col; if (!redrawing()) return; cursor_off(); save_col = curwin->w_cursor.col; curwin->w_cursor.col = col; if (has_mbyte) { char_u *p; // If on the last byte of a multi-byte move to the first byte. p = ml_get_curline(); curwin->w_cursor.col -= (*mb_head_off)(p, p + col); } curs_columns(FALSE); // recompute w_wrow and w_wcol if (curwin->w_wcol < curwin->w_width) { edit_putchar('$', FALSE); dollar_vcol = curwin->w_virtcol; } curwin->w_cursor.col = save_col; }
1
482,503
allocateSpaceInTranslationTable(const FileInfo *file, TranslationTableOffset *offset, int size, TranslationTableHeader **table) { /* allocate memory for table and expand previously allocated memory if necessary */ int spaceNeeded = ((size + OFFSETSIZE - 1) / OFFSETSIZE) * OFFSETSIZE; TranslationTableOffset newTableSize = (*table)->bytesUsed + spaceNeeded; TranslationTableOffset tableSize = (*table)->tableSize; if (newTableSize > tableSize) { TranslationTableHeader *newTable; newTableSize += (newTableSize / OFFSETSIZE); newTable = realloc(*table, newTableSize); if (!newTable) { compileError(file, "Not enough memory for translation table."); _lou_outOfMemory(); } memset(((unsigned char *)newTable) + tableSize, 0, newTableSize - tableSize); /* update references to the old table */ { TranslationTableChainEntry *entry; for (entry = translationTableChain; entry != NULL; entry = entry->next) if (entry->table == *table) entry->table = (TranslationTableHeader *)newTable; } newTable->tableSize = newTableSize; *table = newTable; } if (offset != NULL) { *offset = ((*table)->bytesUsed - sizeof(**table)) / OFFSETSIZE; (*table)->bytesUsed += spaceNeeded; } return 1; }
0
335,422
ex_behave(exarg_T *eap) { if (STRCMP(eap->arg, "mswin") == 0) { set_option_value_give_err((char_u *)"selection", 0L, (char_u *)"exclusive", 0); set_option_value_give_err((char_u *)"selectmode", 0L, (char_u *)"mouse,key", 0); set_option_value_give_err((char_u *)"mousemodel", 0L, (char_u *)"popup", 0); set_option_value_give_err((char_u *)"keymodel", 0L, (char_u *)"startsel,stopsel", 0); } else if (STRCMP(eap->arg, "xterm") == 0) { set_option_value_give_err((char_u *)"selection", 0L, (char_u *)"inclusive", 0); set_option_value_give_err((char_u *)"selectmode", 0L, (char_u *)"", 0); set_option_value_give_err((char_u *)"mousemodel", 0L, (char_u *)"extend", 0); set_option_value_give_err((char_u *)"keymodel", 0L, (char_u *)"", 0); } else semsg(_(e_invalid_argument_str), eap->arg); }
0
240,307
put_reedit_in_typebuf(int silent) { char_u buf[3]; if (restart_edit != NUL) { if (restart_edit == 'V') { buf[0] = 'g'; buf[1] = 'R'; buf[2] = NUL; } else { buf[0] = restart_edit == 'I' ? 'i' : restart_edit; buf[1] = NUL; } if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, silent) == OK) restart_edit = NUL; } }
0
226,187
GF_Err edts_on_child_box(GF_Box *s, GF_Box *a, Bool is_rem) { GF_EditBox *ptr = (GF_EditBox *)s; if (a->type == GF_ISOM_BOX_TYPE_ELST) { BOX_FIELD_ASSIGN(editList, GF_EditListBox) return GF_OK; } else { return GF_OK; } return GF_OK; }
0
230,989
mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p) { mrb_callinfo *ci = mrb->c->ci; if (ci->cci == CINFO_NONE) { return exec_irep(mrb, self, p); } else { mrb_value ret; if (MRB_PROC_CFUNC_P(p)) { if (MRB_PROC_NOARG_P(p)) { check_method_noarg(mrb, ci); } cipush(mrb, 0, CINFO_DIRECT, mrb_vm_ci_target_class(ci), p, ci->mid, ci->n|(ci->nk<<4)); ret = MRB_PROC_CFUNC(p)(mrb, self); cipop(mrb); } else { mrb_int keep = mrb_ci_bidx(ci) + 1; /* receiver + block */ ret = mrb_top_run(mrb, p, self, keep); } if (mrb->exc && mrb->jmp) { mrb_exc_raise(mrb, mrb_obj_value(mrb->exc)); } return ret; } }
0
224,478
const GF_FilterRegister *txtin_register(GF_FilterSession *session) { return &TXTInRegister;
0
432,324
MemoryRegion *flatview_translate(struct uc_struct *uc, FlatView *fv, hwaddr addr, hwaddr *xlat, hwaddr *plen, bool is_write, MemTxAttrs attrs) { MemoryRegion *mr; MemoryRegionSection section; AddressSpace *as = NULL; /* This can be MMIO, so setup MMIO bit. */ section = flatview_do_translate(uc, fv, addr, xlat, plen, NULL, is_write, true, &as, attrs); mr = section.mr; return mr; }
0
473,857
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower, OnigEncoding enc ARG_UNUSED) { const UChar* p = *pp; if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { *lower++ = 's'; *lower = 's'; (*pp)++; return 2; } *lower = ENC_ISO_8859_4_TO_LOWER_CASE(*p); (*pp)++; return 1; /* return byte length of converted char to lower */ }
0
512,694
void set_with_sum_func() { m_with_sum_func= true; }
0
513,100
my_decimal *val_decimal(my_decimal *to) { return cached_time.to_decimal(to); }
0
238,788
findmatch(oparg_T *oap, int initc) { return findmatchlimit(oap, initc, 0, 0); }
0
310,158
test_tparm(const char *name, int *number) { char *format = tigetstr(name); if ((format = validate(name)) != 0) { char *result = tparm(format, number[0], number[1], number[2], number[3], number[4], number[5], number[6], number[7], number[8]); if (v_opt > 1) printf(".. %2d = %2d %2d %2d %2d %2d %2d %2d %2d %2d %s\n", result != 0 ? (int) strlen(result) : -1, number[0], number[1], number[2], number[3], number[4], number[5], number[6], number[7], number[8], name); } }
0
513,288
join_read_next_same_or_null(READ_RECORD *info) { int error; if ((error= join_read_next_same(info)) >= 0) return error; JOIN_TAB *tab= info->table->reginfo.join_tab; /* Test if we have already done a read after null key */ if (*tab->ref.null_ref_key) return -1; // All keys read *tab->ref.null_ref_key= 1; // Set null byte return safe_index_read(tab); // then read null keys }
0
332,370
get_op_type(int char1, int char2) { int i; if (char1 == 'r') // ignore second character return OP_REPLACE; if (char1 == '~') // when tilde is an operator return OP_TILDE; if (char1 == 'g' && char2 == Ctrl_A) // add return OP_NR_ADD; if (char1 == 'g' && char2 == Ctrl_X) // subtract return OP_NR_SUB; if (char1 == 'z' && char2 == 'y') // OP_YANK return OP_YANK; for (i = 0; ; ++i) { if (opchars[i][0] == char1 && opchars[i][1] == char2) break; if (i == (int)ARRAY_LENGTH(opchars) - 1) { internal_error("get_op_type()"); break; } } return i; }
0
328,984
R_API RBinJavaAttrInfo *r_bin_java_unknown_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) { return r_bin_java_default_attr_new (bin, buffer, sz, buf_offset); }
0
253,572
static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, loff_t off, loff_t len, bool keep_size) { struct inode *inode; struct cifsInodeInfo *cifsi; struct cifsFileInfo *cfile = file->private_data; long rc = -EOPNOTSUPP; unsigned int xid; __le64 eof; xid = get_xid(); inode = d_inode(cfile->dentry); cifsi = CIFS_I(inode); trace_smb3_falloc_enter(xid, cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, off, len); /* if file not oplocked can't be sure whether asking to extend size */ if (!CIFS_CACHE_READ(cifsi)) if (keep_size == false) { trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, off, len, rc); free_xid(xid); return rc; } /* * Extending the file */ if ((keep_size == false) && i_size_read(inode) < off + len) { rc = inode_newsize_ok(inode, off + len); if (rc) goto out; if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0) smb2_set_sparse(xid, tcon, cfile, inode, false); eof = cpu_to_le64(off + len); rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, cfile->pid, &eof); if (rc == 0) { cifsi->server_eof = off + len; cifs_setsize(inode, off + len); cifs_truncate_page(inode->i_mapping, inode->i_size); truncate_setsize(inode, off + len); } goto out; } /* * Files are non-sparse by default so falloc may be a no-op * Must check if file sparse. If not sparse, and since we are not * extending then no need to do anything since file already allocated */ if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0) { rc = 0; goto out; } if (keep_size == true) { /* * We can not preallocate pages beyond the end of the file * in SMB2 */ if (off >= i_size_read(inode)) { rc = 0; goto out; } /* * For fallocates that are partially beyond the end of file, * clamp len so we only fallocate up to the end of file. */ if (off + len > i_size_read(inode)) { len = i_size_read(inode) - off; } } if ((keep_size == true) || (i_size_read(inode) >= off + len)) { /* * At this point, we are trying to fallocate an internal * regions of a sparse file. Since smb2 does not have a * fallocate command we have two otions on how to emulate this. * We can either turn the entire file to become non-sparse * which we only do if the fallocate is for virtually * the whole file, or we can overwrite the region with zeroes * using SMB2_write, which could be prohibitevly expensive * if len is large. */ /* * We are only trying to fallocate a small region so * just write it with zero. */ if (len <= 1024 * 1024) { rc = smb3_simple_fallocate_range(xid, tcon, cfile, off, len); goto out; } /* * Check if falloc starts within first few pages of file * and ends within a few pages of the end of file to * ensure that most of file is being forced to be * fallocated now. If so then setting whole file sparse * ie potentially making a few extra pages at the beginning * or end of the file non-sparse via set_sparse is harmless. */ if ((off > 8192) || (off + len + 8192 < i_size_read(inode))) { rc = -EOPNOTSUPP; goto out; } } smb2_set_sparse(xid, tcon, cfile, inode, false); rc = 0; out: if (rc) trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, off, len, rc); else trace_smb3_falloc_done(xid, cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, off, len); free_xid(xid); return rc; }
0
272,342
find_slot_for_token(cms_context *cms, PK11SlotInfo **slot) { if (!cms->tokenname) { cms->log(cms, LOG_ERR, "no token name specified"); return -1; } char *tokenname = resolve_token_name(cms->tokenname); dprintf("setting password function to %s", cms->func ? "cms->func" : "SECU_GetModulePassword"); PK11_SetPasswordFunc(cms->func ? cms->func : SECU_GetModulePassword); PK11SlotList *slots = NULL; slots = PK11_GetAllTokens(CKM_RSA_PKCS, PR_FALSE, PR_TRUE, cms); if (!slots) cnreterr(-1, cms, "could not get pk11 token list"); PK11SlotListElement *psle = NULL; psle = PK11_GetFirstSafe(slots); if (!psle) { save_port_err() { PK11_FreeSlotList(slots); } cnreterr(-1, cms, "could not get pk11 safe"); } while (psle) { if (!strcmp(tokenname, PK11_GetTokenName(psle->slot))) break; psle = PK11_GetNextSafe(slots, psle, PR_FALSE); } if (!psle) { save_port_err() { PK11_FreeSlotList(slots); } nssreterr(-1, "Could not find token \"%s\"", tokenname); } SECStatus status; if (PK11_NeedLogin(psle->slot) && !PK11_IsLoggedIn(psle->slot, cms)) { status = PK11_Authenticate(psle->slot, PR_TRUE, cms); if (status != SECSuccess) { save_port_err() { int err = PORT_GetError(); PK11_DestroySlotListElement(slots, &psle); PK11_FreeSlotList(slots); cms->log(cms, LOG_ERR, "authentication failed for token \"%s\": %s", tokenname, PORT_ErrorToString(err)); } return -1; } } *slot = psle->slot; PK11_DestroySlotListElement(slots, &psle); PK11_FreeSlotList(slots); return 0; }
0
318,100
static int rsi_resume(struct usb_interface *intf) { /* Not yet implemented */ return -ENOSYS; }
0
208,140
int main(int argc, char **argv) { int c, rc = MOUNT_EX_SUCCESS, all = 0, show_labels = 0; struct libmnt_context *cxt; struct libmnt_table *fstab = NULL; char *srcbuf = NULL; char *types = NULL; unsigned long oper = 0; enum { MOUNT_OPT_SHARED = CHAR_MAX + 1, MOUNT_OPT_SLAVE, MOUNT_OPT_PRIVATE, MOUNT_OPT_UNBINDABLE, MOUNT_OPT_RSHARED, MOUNT_OPT_RSLAVE, MOUNT_OPT_RPRIVATE, MOUNT_OPT_RUNBINDABLE, MOUNT_OPT_TARGET, MOUNT_OPT_SOURCE }; static const struct option longopts[] = { { "all", 0, 0, 'a' }, { "fake", 0, 0, 'f' }, { "fstab", 1, 0, 'T' }, { "fork", 0, 0, 'F' }, { "help", 0, 0, 'h' }, { "no-mtab", 0, 0, 'n' }, { "read-only", 0, 0, 'r' }, { "ro", 0, 0, 'r' }, { "verbose", 0, 0, 'v' }, { "version", 0, 0, 'V' }, { "read-write", 0, 0, 'w' }, { "rw", 0, 0, 'w' }, { "options", 1, 0, 'o' }, { "test-opts", 1, 0, 'O' }, { "pass-fd", 1, 0, 'p' }, { "types", 1, 0, 't' }, { "uuid", 1, 0, 'U' }, { "label", 1, 0, 'L'}, { "bind", 0, 0, 'B' }, { "move", 0, 0, 'M' }, { "rbind", 0, 0, 'R' }, { "make-shared", 0, 0, MOUNT_OPT_SHARED }, { "make-slave", 0, 0, MOUNT_OPT_SLAVE }, { "make-private", 0, 0, MOUNT_OPT_PRIVATE }, { "make-unbindable", 0, 0, MOUNT_OPT_UNBINDABLE }, { "make-rshared", 0, 0, MOUNT_OPT_RSHARED }, { "make-rslave", 0, 0, MOUNT_OPT_RSLAVE }, { "make-rprivate", 0, 0, MOUNT_OPT_RPRIVATE }, { "make-runbindable", 0, 0, MOUNT_OPT_RUNBINDABLE }, { "no-canonicalize", 0, 0, 'c' }, { "internal-only", 0, 0, 'i' }, { "show-labels", 0, 0, 'l' }, { "target", 1, 0, MOUNT_OPT_TARGET }, { "source", 1, 0, MOUNT_OPT_SOURCE }, { NULL, 0, 0, 0 } }; static const ul_excl_t excl[] = { /* rows and cols in in ASCII order */ { 'B','M','R', /* bind,move,rbind */ MOUNT_OPT_SHARED, MOUNT_OPT_SLAVE, MOUNT_OPT_PRIVATE, MOUNT_OPT_UNBINDABLE, MOUNT_OPT_RSHARED, MOUNT_OPT_RSLAVE, MOUNT_OPT_RPRIVATE, MOUNT_OPT_RUNBINDABLE }, { 'L','U', MOUNT_OPT_SOURCE }, /* label,uuid,source */ { 0 } }; int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; sanitize_env(); setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); atexit(close_stdout); mnt_init_debug(0); cxt = mnt_new_context(); if (!cxt) err(MOUNT_EX_SYSERR, _("libmount context allocation failed")); mnt_context_set_tables_errcb(cxt, table_parser_errcb); while ((c = getopt_long(argc, argv, "aBcfFhilL:Mno:O:p:rRsU:vVwt:T:", longopts, NULL)) != -1) { /* only few options are allowed for non-root users */ if (mnt_context_is_restricted(cxt) && !strchr("hlLUVvpris", c) && c != MOUNT_OPT_TARGET && c != MOUNT_OPT_SOURCE) exit_non_root(option_to_longopt(c, longopts)); err_exclusive_options(c, longopts, excl, excl_st); switch(c) { case 'a': all = 1; break; case 'c': mnt_context_disable_canonicalize(cxt, TRUE); break; case 'f': mnt_context_enable_fake(cxt, TRUE); break; case 'F': mnt_context_enable_fork(cxt, TRUE); break; case 'h': usage(stdout); break; case 'i': mnt_context_disable_helpers(cxt, TRUE); break; case 'n': mnt_context_disable_mtab(cxt, TRUE); break; case 'r': if (mnt_context_append_options(cxt, "ro")) err(MOUNT_EX_SYSERR, _("failed to append options")); readwrite = 0; break; case 'v': mnt_context_enable_verbose(cxt, TRUE); break; case 'V': print_version(); break; case 'w': if (mnt_context_append_options(cxt, "rw")) err(MOUNT_EX_SYSERR, _("failed to append options")); readwrite = 1; break; case 'o': if (mnt_context_append_options(cxt, optarg)) err(MOUNT_EX_SYSERR, _("failed to append options")); break; case 'O': if (mnt_context_set_options_pattern(cxt, optarg)) err(MOUNT_EX_SYSERR, _("failed to set options pattern")); break; case 'p': warnx(_("--pass-fd is no longer supported")); break; case 'L': xasprintf(&srcbuf, "LABEL=\"%s\"", optarg); mnt_context_disable_swapmatch(cxt, 1); mnt_context_set_source(cxt, srcbuf); free(srcbuf); break; case 'U': xasprintf(&srcbuf, "UUID=\"%s\"", optarg); mnt_context_disable_swapmatch(cxt, 1); mnt_context_set_source(cxt, srcbuf); free(srcbuf); break; case 'l': show_labels = 1; break; case 't': types = optarg; break; case 'T': fstab = append_fstab(cxt, fstab, optarg); break; case 's': mnt_context_enable_sloppy(cxt, TRUE); break; case 'B': oper |= MS_BIND; break; case 'M': oper |= MS_MOVE; break; case 'R': oper |= (MS_BIND | MS_REC); break; case MOUNT_OPT_SHARED: oper |= MS_SHARED; break; case MOUNT_OPT_SLAVE: oper |= MS_SLAVE; break; case MOUNT_OPT_PRIVATE: oper |= MS_PRIVATE; break; case MOUNT_OPT_UNBINDABLE: oper |= MS_UNBINDABLE; break; case MOUNT_OPT_RSHARED: oper |= (MS_SHARED | MS_REC); break; case MOUNT_OPT_RSLAVE: oper |= (MS_SLAVE | MS_REC); break; case MOUNT_OPT_RPRIVATE: oper |= (MS_PRIVATE | MS_REC); break; case MOUNT_OPT_RUNBINDABLE: oper |= (MS_UNBINDABLE | MS_REC); break; case MOUNT_OPT_TARGET: mnt_context_disable_swapmatch(cxt, 1); mnt_context_set_target(cxt, optarg); break; case MOUNT_OPT_SOURCE: mnt_context_disable_swapmatch(cxt, 1); mnt_context_set_source(cxt, optarg); break; default: usage(stderr); break; } } argc -= optind; argv += optind; if (fstab && !mnt_context_is_nocanonicalize(cxt)) { /* * We have external (context independent) fstab instance, let's * make a connection between the fstab and the canonicalization * cache. */ struct libmnt_cache *cache = mnt_context_get_cache(cxt); mnt_table_set_cache(fstab, cache); } if (!mnt_context_get_source(cxt) && !mnt_context_get_target(cxt) && !argc && !all) { if (oper) usage(stderr); print_all(cxt, types, show_labels); goto done; } if (oper && (types || all || mnt_context_get_source(cxt))) usage(stderr); if (types && (all || strchr(types, ',') || strncmp(types, "no", 2) == 0)) mnt_context_set_fstype_pattern(cxt, types); else if (types) mnt_context_set_fstype(cxt, types); if (all) { /* * A) Mount all */ rc = mount_all(cxt); goto done; } else if (argc == 0 && (mnt_context_get_source(cxt) || mnt_context_get_target(cxt))) { /* * B) mount -L|-U|--source|--target */ if (mnt_context_is_restricted(cxt) && mnt_context_get_source(cxt) && mnt_context_get_target(cxt)) exit_non_root(NULL); } else if (argc == 1) { /* * C) mount [-L|-U|--source] <target> * mount <source|target> * * non-root may specify source *or* target, but not both */ if (mnt_context_is_restricted(cxt) && mnt_context_get_source(cxt)) exit_non_root(NULL); mnt_context_set_target(cxt, argv[0]); } else if (argc == 2 && !mnt_context_get_source(cxt) && !mnt_context_get_target(cxt)) { /* * D) mount <source> <target> */ if (mnt_context_is_restricted(cxt)) exit_non_root(NULL); mnt_context_set_source(cxt, argv[0]); mnt_context_set_target(cxt, argv[1]); } else usage(stderr); if (oper) { /* MS_PROPAGATION operations, let's set the mount flags */ mnt_context_set_mflags(cxt, oper); /* For -make* or --bind is fstab unnecessary */ mnt_context_set_optsmode(cxt, MNT_OMODE_NOTAB); } rc = mnt_context_mount(cxt); rc = mk_exit_code(cxt, rc); if (rc == MOUNT_EX_SUCCESS && mnt_context_is_verbose(cxt)) success_message(cxt); done: mnt_free_context(cxt); mnt_free_table(fstab); return rc; }
1
508,873
Lex_input_stream::get_escape_func(THD *thd, my_wc_t sep) const { return thd->backslash_escapes() ? (sep == '"' ? my_wc_mb_utf8_escape_double_quote_and_backslash: my_wc_mb_utf8_escape_single_quote_and_backslash) : (sep == '"' ? my_wc_mb_utf8_escape_double_quote: my_wc_mb_utf8_escape_single_quote); }
0
513,217
bool check_valid_path(const char *path, size_t len) { size_t prefix= my_strcspn(files_charset_info, path, path + len, FN_DIRSEP); return prefix < len; }
0
509,561
static handler *maria_create_handler(handlerton *hton, TABLE_SHARE * table, MEM_ROOT *mem_root) { return new (mem_root) ha_maria(hton, table); }
0
362,299
static int usb_audio_probe(struct usb_interface *intf, const struct usb_device_id *usb_id) { struct usb_device *dev = interface_to_usbdev(intf); const struct snd_usb_audio_quirk *quirk = (const struct snd_usb_audio_quirk *)usb_id->driver_info; struct snd_usb_audio *chip; int i, err; struct usb_host_interface *alts; int ifnum; u32 id; alts = &intf->altsetting[0]; ifnum = get_iface_desc(alts)->bInterfaceNumber; id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), le16_to_cpu(dev->descriptor.idProduct)); if (get_alias_id(dev, &id)) quirk = get_alias_quirk(dev, id); if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum) return -ENXIO; err = snd_usb_apply_boot_quirk(dev, intf, quirk, id); if (err < 0) return err; /* * found a config. now register to ALSA */ /* check whether it's already registered */ chip = NULL; mutex_lock(&register_mutex); for (i = 0; i < SNDRV_CARDS; i++) { if (usb_chip[i] && usb_chip[i]->dev == dev) { if (atomic_read(&usb_chip[i]->shutdown)) { dev_err(&dev->dev, "USB device is in the shutdown state, cannot create a card instance\n"); err = -EIO; goto __error; } chip = usb_chip[i]; atomic_inc(&chip->active); /* avoid autopm */ break; } } if (! chip) { /* it's a fresh one. * now look for an empty slot and create a new card instance */ for (i = 0; i < SNDRV_CARDS; i++) if (!usb_chip[i] && (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) && (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) { if (enable[i]) { err = snd_usb_audio_create(intf, dev, i, quirk, id, &chip); if (err < 0) goto __error; chip->pm_intf = intf; break; } else if (vid[i] != -1 || pid[i] != -1) { dev_info(&dev->dev, "device (%04x:%04x) is disabled\n", USB_ID_VENDOR(id), USB_ID_PRODUCT(id)); err = -ENOENT; goto __error; } } if (!chip) { dev_err(&dev->dev, "no available usb audio device\n"); err = -ENODEV; goto __error; } } dev_set_drvdata(&dev->dev, chip); /* * For devices with more than one control interface, we assume the * first contains the audio controls. We might need a more specific * check here in the future. */ if (!chip->ctrl_intf) chip->ctrl_intf = alts; chip->txfr_quirk = 0; err = 1; /* continue */ if (quirk && quirk->ifnum != QUIRK_NO_INTERFACE) { /* need some special handlings */ err = snd_usb_create_quirk(chip, intf, &usb_audio_driver, quirk); if (err < 0) goto __error; } if (err > 0) { /* create normal USB audio interfaces */ err = snd_usb_create_streams(chip, ifnum); if (err < 0) goto __error; err = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error); if (err < 0) goto __error; } /* we are allowed to call snd_card_register() many times */ err = snd_card_register(chip->card); if (err < 0) goto __error; usb_chip[chip->index] = chip; chip->num_interfaces++; usb_set_intfdata(intf, chip); atomic_dec(&chip->active); mutex_unlock(&register_mutex); return 0; __error: if (chip) { /* chip->active is inside the chip->card object, * decrement before memory is possibly returned. */ atomic_dec(&chip->active); if (!chip->num_interfaces) snd_card_free(chip->card); } mutex_unlock(&register_mutex); return err; }
0
488,330
int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end) { struct address_space *mapping = inode->i_mapping; /* * If the underlying filesystem is not going to provide * a way to truncate a range of blocks (punch a hole) - * we should return failure right now. */ if (!inode->i_op || !inode->i_op->truncate_range) return -ENOSYS; mutex_lock(&inode->i_mutex); down_write(&inode->i_alloc_sem); unmap_mapping_range(mapping, offset, (end - offset), 1); truncate_inode_pages_range(mapping, offset, end); unmap_mapping_range(mapping, offset, (end - offset), 1); inode->i_op->truncate_range(inode, offset, end); up_write(&inode->i_alloc_sem); mutex_unlock(&inode->i_mutex); return 0; }
0
252,361
static FP16 float_to_half_full(FP32 f) { FP16 o = {0}; // Based on ISPC reference code (with minor modifications) if (f.s.Exponent == 0) // Signed zero/denormal (which will underflow) o.s.Exponent = 0; else if (f.s.Exponent == 255) // Inf or NaN (all exponent bits set) { o.s.Exponent = 31; o.s.Mantissa = f.s.Mantissa ? 0x200 : 0; // NaN->qNaN and Inf->Inf } else // Normalized number { // Exponent unbias the single, then bias the halfp int newexp = f.s.Exponent - 127 + 15; if (newexp >= 31) // Overflow, return signed infinity o.s.Exponent = 31; else if (newexp <= 0) // Underflow { if ((14 - newexp) <= 24) // Mantissa might be non-zero { unsigned int mant = f.s.Mantissa | 0x800000; // Hidden 1 bit o.s.Mantissa = mant >> (14 - newexp); if ((mant >> (13 - newexp)) & 1) // Check for rounding o.u++; // Round, might overflow into exp bit, but this is OK } } else { o.s.Exponent = static_cast<unsigned int>(newexp); o.s.Mantissa = f.s.Mantissa >> 13; if (f.s.Mantissa & 0x1000) // Check for rounding o.u++; // Round, might overflow to inf, this is OK } } o.s.Sign = f.s.Sign; return o; }
0
292,139
void LinkResolver::resolve_invokespecial(CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, TRAPS) { LinkInfo link_info(pool, index, CHECK); resolve_special_call(result, recv, link_info, CHECK); }
0
309,963
TransformLine(NCURSES_SP_DCLx int const lineno) { int firstChar, oLastChar, nLastChar; NCURSES_CH_T *newLine = NewScreen(SP_PARM)->_line[lineno].text; NCURSES_CH_T *oldLine = CurScreen(SP_PARM)->_line[lineno].text; int n; bool attrchanged = FALSE; TR(TRACE_UPDATE, (T_CALLED("TransformLine(%p, %d)"), (void *) SP_PARM, lineno)); /* copy new hash value to old one */ if (SP_PARM->oldhash && SP_PARM->newhash) SP_PARM->oldhash[lineno] = SP_PARM->newhash[lineno]; /* * If we have colors, there is the possibility of having two color pairs * that display as the same colors. For instance, Lynx does this. Check * for this case, and update the old line with the new line's colors when * they are equivalent. */ if (SP_PARM->_coloron) { int oldPair; int newPair; for (n = 0; n < screen_columns(SP_PARM); n++) { if (!CharEq(newLine[n], oldLine[n])) { oldPair = GetPair(oldLine[n]); newPair = GetPair(newLine[n]); if (oldPair != newPair && unColor(oldLine[n]) == unColor(newLine[n])) { if (oldPair < SP_PARM->_pair_limit && newPair < SP_PARM->_pair_limit && (isSamePair(SP_PARM->_color_pairs[oldPair], SP_PARM->_color_pairs[newPair]))) { SetPair(oldLine[n], GetPair(newLine[n])); } } } } } if (ceol_standout_glitch && clr_eol) { firstChar = 0; while (firstChar < screen_columns(SP_PARM)) { if (!SameAttrOf(newLine[firstChar], oldLine[firstChar])) { attrchanged = TRUE; break; } firstChar++; } } firstChar = 0; if (attrchanged) { /* we may have to disregard the whole line */ GoTo(NCURSES_SP_ARGx lineno, firstChar); ClrToEOL(NCURSES_SP_ARGx ClrBlank(NCURSES_SP_ARGx CurScreen(SP_PARM)), FALSE); PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno, 0, screen_columns(SP_PARM) - 1); #if USE_XMC_SUPPORT /* * This is a very simple loop to paint characters which may have the * magic cookie glitch embedded. It doesn't know much about video * attributes which are continued from one line to the next. It * assumes that we have filtered out requests for attribute changes * that do not get mapped to blank positions. * * FIXME: we are not keeping track of where we put the cookies, so this * will work properly only once, since we may overwrite a cookie in a * following operation. */ } else if (magic_cookie_glitch > 0) { GoTo(NCURSES_SP_ARGx lineno, firstChar); for (n = 0; n < screen_columns(SP_PARM); n++) { int m = n + magic_cookie_glitch; /* check for turn-on: * If we are writing an attributed blank, where the * previous cell is not attributed. */ if (ISBLANK(newLine[n]) && ((n > 0 && xmc_turn_on(SP_PARM, newLine[n - 1], newLine[n])) || (n == 0 && lineno > 0 && xmc_turn_on(SP_PARM, xmc_new(SP_PARM, lineno - 1, screen_columns(SP_PARM) - 1), newLine[n])))) { n = m; } PutChar(NCURSES_SP_ARGx CHREF(newLine[n])); /* check for turn-off: * If we are writing an attributed non-blank, where the * next cell is blank, and not attributed. */ if (!ISBLANK(newLine[n]) && ((n + 1 < screen_columns(SP_PARM) && xmc_turn_off(SP_PARM, newLine[n], newLine[n + 1])) || (n + 1 >= screen_columns(SP_PARM) && lineno + 1 < screen_lines(SP_PARM) && xmc_turn_off(SP_PARM, newLine[n], xmc_new(SP_PARM, lineno + 1, 0))))) { n = m; } } #endif } else { NCURSES_CH_T blank; /* it may be cheap to clear leading whitespace with clr_bol */ blank = newLine[0]; if (clr_bol && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) { int oFirstChar, nFirstChar; for (oFirstChar = 0; oFirstChar < screen_columns(SP_PARM); oFirstChar++) if (!CharEq(oldLine[oFirstChar], blank)) break; for (nFirstChar = 0; nFirstChar < screen_columns(SP_PARM); nFirstChar++) if (!CharEq(newLine[nFirstChar], blank)) break; if (nFirstChar == oFirstChar) { firstChar = nFirstChar; /* find the first differing character */ while (firstChar < screen_columns(SP_PARM) && CharEq(newLine[firstChar], oldLine[firstChar])) firstChar++; } else if (oFirstChar > nFirstChar) { firstChar = nFirstChar; } else { /* oFirstChar < nFirstChar */ firstChar = oFirstChar; if (SP_PARM->_el1_cost < nFirstChar - oFirstChar) { if (nFirstChar >= screen_columns(SP_PARM) && SP_PARM->_el_cost <= SP_PARM->_el1_cost) { GoTo(NCURSES_SP_ARGx lineno, 0); UpdateAttrs(SP_PARM, blank); NCURSES_PUTP2("clr_eol", clr_eol); } else { GoTo(NCURSES_SP_ARGx lineno, nFirstChar - 1); UpdateAttrs(SP_PARM, blank); NCURSES_PUTP2("clr_bol", clr_bol); } while (firstChar < nFirstChar) oldLine[firstChar++] = blank; } } } else { /* find the first differing character */ while (firstChar < screen_columns(SP_PARM) && CharEq(newLine[firstChar], oldLine[firstChar])) firstChar++; } /* if there wasn't one, we're done */ if (firstChar >= screen_columns(SP_PARM)) { TR(TRACE_UPDATE, (T_RETURN(""))); return; } blank = newLine[screen_columns(SP_PARM) - 1]; if (!can_clear_with(NCURSES_SP_ARGx CHREF(blank))) { /* find the last differing character */ nLastChar = screen_columns(SP_PARM) - 1; while (nLastChar > firstChar && CharEq(newLine[nLastChar], oldLine[nLastChar])) nLastChar--; if (nLastChar >= firstChar) { GoTo(NCURSES_SP_ARGx lineno, firstChar); PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno, firstChar, nLastChar); memcpy(oldLine + firstChar, newLine + firstChar, (unsigned) (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T)); } TR(TRACE_UPDATE, (T_RETURN(""))); return; } /* find last non-blank character on old line */ oLastChar = screen_columns(SP_PARM) - 1; while (oLastChar > firstChar && CharEq(oldLine[oLastChar], blank)) oLastChar--; /* find last non-blank character on new line */ nLastChar = screen_columns(SP_PARM) - 1; while (nLastChar > firstChar && CharEq(newLine[nLastChar], blank)) nLastChar--; if ((nLastChar == firstChar) && (SP_PARM->_el_cost < (oLastChar - nLastChar))) { GoTo(NCURSES_SP_ARGx lineno, firstChar); if (!CharEq(newLine[firstChar], blank)) PutChar(NCURSES_SP_ARGx CHREF(newLine[firstChar])); ClrToEOL(NCURSES_SP_ARGx blank, FALSE); } else if ((nLastChar != oLastChar) && (!CharEq(newLine[nLastChar], oldLine[oLastChar]) || !(SP_PARM->_nc_sp_idcok && NCURSES_SP_NAME(has_ic) (NCURSES_SP_ARG)))) { GoTo(NCURSES_SP_ARGx lineno, firstChar); if ((oLastChar - nLastChar) > SP_PARM->_el_cost) { if (PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno, firstChar, nLastChar)) { GoTo(NCURSES_SP_ARGx lineno, nLastChar + 1); } ClrToEOL(NCURSES_SP_ARGx blank, FALSE); } else { n = max(nLastChar, oLastChar); PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno, firstChar, n); } } else { int nLastNonblank = nLastChar; int oLastNonblank = oLastChar; /* find the last characters that really differ */ /* can be -1 if no characters differ */ while (CharEq(newLine[nLastChar], oldLine[oLastChar])) { /* don't split a wide char */ if (isWidecExt(newLine[nLastChar]) && !CharEq(newLine[nLastChar - 1], oldLine[oLastChar - 1])) break; nLastChar--; oLastChar--; if (nLastChar == -1 || oLastChar == -1) break; } n = min(oLastChar, nLastChar); if (n >= firstChar) { GoTo(NCURSES_SP_ARGx lineno, firstChar); PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno, firstChar, n); } if (oLastChar < nLastChar) { int m = max(nLastNonblank, oLastNonblank); #if USE_WIDEC_SUPPORT if (n) { while (isWidecExt(newLine[n + 1]) && n) { --n; --oLastChar; /* increase cost */ } } else if (n >= firstChar && isWidecBase(newLine[n])) { while (isWidecExt(newLine[n + 1])) { ++n; ++oLastChar; /* decrease cost */ } } #endif GoTo(NCURSES_SP_ARGx lineno, n + 1); if ((nLastChar < nLastNonblank) || InsCharCost(SP_PARM, nLastChar - oLastChar) > (m - n)) { PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno, n + 1, m); } else { InsStr(NCURSES_SP_ARGx &newLine[n + 1], nLastChar - oLastChar); } } else if (oLastChar > nLastChar) { GoTo(NCURSES_SP_ARGx lineno, n + 1); if (DelCharCost(SP_PARM, oLastChar - nLastChar) > SP_PARM->_el_cost + nLastNonblank - (n + 1)) { if (PutRange(NCURSES_SP_ARGx oldLine, newLine, lineno, n + 1, nLastNonblank)) { GoTo(NCURSES_SP_ARGx lineno, nLastNonblank + 1); } ClrToEOL(NCURSES_SP_ARGx blank, FALSE); } else { /* * The delete-char sequence will * effectively shift in blanks from the * right margin of the screen. Ensure * that they are the right color by * setting the video attributes from * the last character on the row. */ UpdateAttrs(SP_PARM, blank); DelChar(NCURSES_SP_ARGx oLastChar - nLastChar); } } } } /* update the code's internal representation */ if (screen_columns(SP_PARM) > firstChar) memcpy(oldLine + firstChar, newLine + firstChar, (unsigned) (screen_columns(SP_PARM) - firstChar) * sizeof(NCURSES_CH_T)); TR(TRACE_UPDATE, (T_RETURN(""))); return; }
0
231,800
Buf getCryptoStreamData() { CHECK(!serverWrites.empty()); auto cryptoBuf = IOBuf::create(0); AckStates ackStates; for (auto& serverWrite : serverWrites) { auto packetQueue = bufToQueue(serverWrite->clone()); auto result = clientReadCodec->parsePacket(packetQueue, ackStates); auto& parsedPacket = *result.regularPacket(); for (auto& frame : parsedPacket.frames) { if (frame.type() != QuicFrame::Type::ReadCryptoFrame) { continue; } cryptoBuf->prependChain(frame.asReadCryptoFrame()->data->clone()); } } return cryptoBuf; }
0
336,805
lprn_get_params(gx_device * dev, gs_param_list * plist) { gx_device_lprn *const lprn = (gx_device_lprn *) dev; int code = gdev_prn_get_params(dev, plist); int ncode; if (code < 0) return code; if ((ncode = param_write_bool(plist, "ManualFeed", &lprn->ManualFeed)) < 0) code = ncode; if ((ncode = param_write_bool(plist, "NegativePrint", &lprn->NegativePrint)) < 0) code = ncode; if ((ncode = param_write_bool(plist, "Tumble", &lprn->Tumble)) < 0) code = ncode; if ((ncode = param_write_bool(plist, "RITOff", &lprn->RITOff)) < 0) code = ncode; if ((ncode = param_write_int(plist, "BlockLine", &lprn->BlockLine)) < 0) code = ncode; if ((ncode = param_write_int(plist, "BlockWidth", &lprn->nBw)) < 0) code = ncode; if ((ncode = param_write_int(plist, "BlockHeight", &lprn->nBh)) < 0) code = ncode; if ((ncode = param_write_bool(plist, "ShowBubble", &lprn->ShowBubble)) < 0) code = ncode; return code; }
0
90,206
virtual bool cellular_connecting() const { return false; }
0
238,578
static int check_cfg(struct bpf_verifier_env *env) { int insn_cnt = env->prog->len; int *insn_stack, *insn_state; int ret = 0; int i; insn_state = env->cfg.insn_state = kvcalloc(insn_cnt, sizeof(int), GFP_KERNEL); if (!insn_state) return -ENOMEM; insn_stack = env->cfg.insn_stack = kvcalloc(insn_cnt, sizeof(int), GFP_KERNEL); if (!insn_stack) { kvfree(insn_state); return -ENOMEM; } insn_state[0] = DISCOVERED; /* mark 1st insn as discovered */ insn_stack[0] = 0; /* 0 is the first instruction */ env->cfg.cur_stack = 1; while (env->cfg.cur_stack > 0) { int t = insn_stack[env->cfg.cur_stack - 1]; ret = visit_insn(t, insn_cnt, env); switch (ret) { case DONE_EXPLORING: insn_state[t] = EXPLORED; env->cfg.cur_stack--; break; case KEEP_EXPLORING: break; default: if (ret > 0) { verbose(env, "visit_insn internal bug\n"); ret = -EFAULT; } goto err_free; } } if (env->cfg.cur_stack < 0) { verbose(env, "pop stack internal bug\n"); ret = -EFAULT; goto err_free; } for (i = 0; i < insn_cnt; i++) { if (insn_state[i] != EXPLORED) { verbose(env, "unreachable insn %d\n", i); ret = -EINVAL; goto err_free; } } ret = 0; /* cfg looks good */ err_free: kvfree(insn_state); kvfree(insn_stack); env->cfg.insn_state = env->cfg.insn_stack = NULL; return ret; }
0
498,103
void html_attrf(const char *fmt, ...) { va_list ap; struct strbuf sb = STRBUF_INIT; va_start(ap, fmt); strbuf_vaddf(&sb, fmt, ap); va_end(ap); html_attr(sb.buf); strbuf_release(&sb); }
0
369,143
static int io_eventfd_register(struct io_ring_ctx *ctx, void __user *arg, unsigned int eventfd_async) { struct io_ev_fd *ev_fd; __s32 __user *fds = arg; int fd; ev_fd = rcu_dereference_protected(ctx->io_ev_fd, lockdep_is_held(&ctx->uring_lock)); if (ev_fd) return -EBUSY; if (copy_from_user(&fd, fds, sizeof(*fds))) return -EFAULT; ev_fd = kmalloc(sizeof(*ev_fd), GFP_KERNEL); if (!ev_fd) return -ENOMEM; ev_fd->cq_ev_fd = eventfd_ctx_fdget(fd); if (IS_ERR(ev_fd->cq_ev_fd)) { int ret = PTR_ERR(ev_fd->cq_ev_fd); kfree(ev_fd); return ret; } ev_fd->eventfd_async = eventfd_async; ctx->has_evfd = true; rcu_assign_pointer(ctx->io_ev_fd, ev_fd); return 0;
0
427,220
static void codestring (expdesc *e, TString *s) { e->f = e->t = NO_JUMP; e->k = VKSTR; e->u.strval = s; }
0
177,175
WebFrameProxy* WebProcessProxy::webFrame(uint64_t frameID) const { return isGoodKey<WebFrameProxyMap>(frameID) ? m_frameMap.get(frameID).get() : 0; }
0
276,956
PackedAudioWriter::WriteSample(AP4_Sample& sample, AP4_DataBuffer& sample_data, AP4_SampleDescription* sample_description, AP4_ByteStream& output) { AP4_AudioSampleDescription* audio_desc = AP4_DYNAMIC_CAST(AP4_AudioSampleDescription, sample_description); if (audio_desc == NULL) { return AP4_ERROR_INVALID_FORMAT; } if (sample_description->GetFormat() == AP4_SAMPLE_FORMAT_MP4A) { AP4_MpegAudioSampleDescription* mpeg_audio_desc = AP4_DYNAMIC_CAST(AP4_MpegAudioSampleDescription, sample_description); if (mpeg_audio_desc == NULL) return AP4_ERROR_NOT_SUPPORTED; if (mpeg_audio_desc->GetMpeg4AudioObjectType() != AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_LC && mpeg_audio_desc->GetMpeg4AudioObjectType() != AP4_MPEG4_AUDIO_OBJECT_TYPE_AAC_MAIN && mpeg_audio_desc->GetMpeg4AudioObjectType() != AP4_MPEG4_AUDIO_OBJECT_TYPE_SBR && mpeg_audio_desc->GetMpeg4AudioObjectType() != AP4_MPEG4_AUDIO_OBJECT_TYPE_PS) { return AP4_ERROR_NOT_SUPPORTED; } unsigned int sample_rate = mpeg_audio_desc->GetSampleRate(); unsigned int channel_count = mpeg_audio_desc->GetChannelCount(); const AP4_DataBuffer& dsi = mpeg_audio_desc->GetDecoderInfo(); if (dsi.GetDataSize()) { AP4_Mp4AudioDecoderConfig dec_config; AP4_Result result = dec_config.Parse(dsi.GetData(), dsi.GetDataSize()); if (AP4_SUCCEEDED(result)) { sample_rate = dec_config.m_SamplingFrequency; channel_count = dec_config.m_ChannelCount; } } unsigned int sampling_frequency_index = GetSamplingFrequencyIndex(sample_rate); unsigned int channel_configuration = channel_count; WriteAdtsHeader(output, sample.GetSize(), sampling_frequency_index, channel_configuration); } else if (sample_description->GetFormat() == AP4_SAMPLE_FORMAT_AC_4) { WriteAc4Header(output, sample.GetSize()); } return output.Write(sample_data.GetData(), sample_data.GetDataSize()); }
0
369,356
static inline void io_rw_done(struct kiocb *kiocb, ssize_t ret) { switch (ret) { case -EIOCBQUEUED: break; case -ERESTARTSYS: case -ERESTARTNOINTR: case -ERESTARTNOHAND: case -ERESTART_RESTARTBLOCK: /* * We can't just restart the syscall, since previously * submitted sqes may already be in progress. Just fail this * IO with EINTR. */ ret = -EINTR; fallthrough; default: kiocb->ki_complete(kiocb, ret); } }
0
437,354
concat_opt_exact_str(OptExact* to, UChar* s, UChar* end, OnigEncoding enc) { int i, j, len; UChar *p; for (i = to->len, p = s; p < end && i < OPT_EXACT_MAXLEN; ) { len = enclen(enc, p); if (i + len > OPT_EXACT_MAXLEN) break; for (j = 0; j < len && p < end; j++) to->s[i++] = *p++; } to->len = i; }
0
244,005
void vmhd_box_del(GF_Box *s) { GF_VideoMediaHeaderBox *ptr = (GF_VideoMediaHeaderBox *)s; if (ptr == NULL) return; gf_free(ptr); }
0
220,391
mrb_ary_rindex_m(mrb_state *mrb, mrb_value self) { mrb_value obj = mrb_get_arg1(mrb); mrb_int i, len; for (i = RARRAY_LEN(self) - 1; i >= 0; i--) { if (mrb_equal(mrb, RARRAY_PTR(self)[i], obj)) { return mrb_int_value(mrb, i); } if (i > (len = RARRAY_LEN(self))) { i = len; } } return mrb_nil_value(); }
0
195,692
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) { Queue_t * pxNewQueue; size_t xQueueSizeInBytes; uint8_t * pucQueueStorage; configASSERT( uxQueueLength > ( UBaseType_t ) 0 ); /* Allocate enough space to hold the maximum number of items that * can be in the queue at any time. It is valid for uxItemSize to be * zero in the case the queue is used as a semaphore. */ xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */ /* Check for multiplication overflow. */ configASSERT( ( uxItemSize == 0 ) || ( uxQueueLength == ( xQueueSizeInBytes / uxItemSize ) ) ); /* Allocate the queue and storage area. Justification for MISRA * deviation as follows: pvPortMalloc() always ensures returned memory * blocks are aligned per the requirements of the MCU stack. In this case * pvPortMalloc() must return a pointer that is guaranteed to meet the * alignment requirements of the Queue_t structure - which in this case * is an int8_t *. Therefore, whenever the stack alignment requirements * are greater than or equal to the pointer to char requirements the cast * is safe. In other cases alignment requirements are not strict (one or * two bytes). */ pxNewQueue = ( Queue_t * ) pvPortMalloc( sizeof( Queue_t ) + xQueueSizeInBytes ); /*lint !e9087 !e9079 see comment above. */ if( pxNewQueue != NULL ) { /* Jump past the queue structure to find the location of the queue * storage area. */ pucQueueStorage = ( uint8_t * ) pxNewQueue; pucQueueStorage += sizeof( Queue_t ); /*lint !e9016 Pointer arithmetic allowed on char types, especially when it assists conveying intent. */ #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) { /* Queues can be created either statically or dynamically, so * note this task was created dynamically in case it is later * deleted. */ pxNewQueue->ucStaticallyAllocated = pdFALSE; } #endif /* configSUPPORT_STATIC_ALLOCATION */ prvInitialiseNewQueue( uxQueueLength, uxItemSize, pucQueueStorage, ucQueueType, pxNewQueue ); } else { traceQUEUE_CREATE_FAILED( ucQueueType ); mtCOVERAGE_TEST_MARKER(); } return pxNewQueue; }
1
269,315
static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){ for(; i<w; i++){ dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift); } if((width^lift_high)&1){ dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift); } }
0
226,018
GF_Box *svhd_box_new() { ISOM_DECL_BOX_ALLOC(GF_SphericalVideoInfoBox, GF_ISOM_BOX_TYPE_SVHD); return (GF_Box *)tmp;
0