idx
int64 | func
string | target
int64 |
|---|---|---|
430,400
|
static struct sw_flow_actions *nla_alloc_flow_actions(int size)
{
struct sw_flow_actions *sfa;
WARN_ON_ONCE(size > MAX_ACTIONS_BUFSIZE);
sfa = kmalloc(sizeof(*sfa) + size, GFP_KERNEL);
if (!sfa)
return ERR_PTR(-ENOMEM);
sfa->actions_len = 0;
return sfa;
}
| 0
|
247,352
|
unsigned int pgpDigParamsAlgo(pgpDigParams digp, unsigned int algotype)
{
unsigned int algo = 0; /* assume failure */
if (digp) {
switch (algotype) {
case PGPVAL_PUBKEYALGO:
algo = digp->pubkey_algo;
break;
case PGPVAL_HASHALGO:
algo = digp->hash_algo;
break;
}
}
return algo;
}
| 0
|
301,407
|
static off_t vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, off_t offset, int whence)
{
off_t result = 0;
START_PROFILE(syscall_lseek);
/* Cope with 'stat' file opens. */
if (fsp->fh->fd != -1)
result = lseek(fsp->fh->fd, offset, whence);
/*
* We want to maintain the fiction that we can seek
* on a fifo for file system purposes. This allows
* people to set up UNIX fifo's that feed data to Windows
* applications. JRA.
*/
if((result == -1) && (errno == ESPIPE)) {
result = 0;
errno = 0;
}
END_PROFILE(syscall_lseek);
return result;
}
| 0
|
234,782
|
static int chunk_usage_filter(struct btrfs_fs_info *fs_info,
u64 chunk_offset, struct btrfs_balance_args *bargs)
{
struct btrfs_block_group *cache;
u64 chunk_used, user_thresh;
int ret = 1;
cache = btrfs_lookup_block_group(fs_info, chunk_offset);
chunk_used = cache->used;
if (bargs->usage_min == 0)
user_thresh = 1;
else if (bargs->usage > 100)
user_thresh = cache->length;
else
user_thresh = div_factor_fine(cache->length, bargs->usage);
if (chunk_used < user_thresh)
ret = 0;
btrfs_put_block_group(cache);
return ret;
}
| 0
|
256,421
|
PJ_DEF(pj_status_t) pjmedia_rtcp_enable_xr( pjmedia_rtcp_session *sess,
pj_bool_t enable)
{
#if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0)
/* Check if request won't change anything */
if (!(enable ^ sess->xr_enabled))
return PJ_SUCCESS;
if (!enable) {
sess->xr_enabled = PJ_FALSE;
return PJ_SUCCESS;
}
pjmedia_rtcp_xr_init(&sess->xr_session, sess, 0, 1);
sess->xr_enabled = PJ_TRUE;
return PJ_SUCCESS;
#else
PJ_UNUSED_ARG(sess);
PJ_UNUSED_ARG(enable);
return PJ_ENOTSUP;
#endif
}
| 0
|
317,238
|
static int parse_sid(struct super_block *sb, const char *s, u32 *sid)
{
int rc = security_context_str_to_sid(&selinux_state, s,
sid, GFP_KERNEL);
if (rc)
pr_warn("SELinux: security_context_str_to_sid"
"(%s) failed for (dev %s, type %s) errno=%d\n",
s, sb->s_id, sb->s_type->name, rc);
return rc;
}
| 0
|
500,657
|
int sftp_packet_write(sftp_session sftp, uint8_t type, ssh_buffer payload){
int size;
if (buffer_prepend_data(payload, &type, sizeof(uint8_t)) < 0) {
ssh_set_error_oom(sftp->session);
return -1;
}
size = htonl(buffer_get_rest_len(payload));
if (buffer_prepend_data(payload, &size, sizeof(uint32_t)) < 0) {
ssh_set_error_oom(sftp->session);
return -1;
}
size = ssh_channel_write(sftp->channel, buffer_get_rest(payload),
buffer_get_rest_len(payload));
if (size < 0) {
return -1;
} else if((uint32_t) size != buffer_get_rest_len(payload)) {
ssh_log(sftp->session, SSH_LOG_PACKET,
"Had to write %d bytes, wrote only %d",
buffer_get_rest_len(payload),
size);
}
return size;
}
| 0
|
90,158
|
bool WifiNetwork::IsCertificateLoaded() const {
static const std::string settings_string("SETTINGS:");
static const std::string pkcs11_key("key_id");
if (cert_path_.find(settings_string) == 0) {
std::string::size_type idx = cert_path_.find(pkcs11_key);
if (idx != std::string::npos)
idx = cert_path_.find_first_not_of(kWhitespaceASCII,
idx + pkcs11_key.length());
if (idx != std::string::npos && cert_path_[idx] == '=')
return true;
}
return false;
}
| 0
|
390,610
|
XkbClientGone(pointer data,XID id)
{
DevicePtr pXDev = (DevicePtr)data;
if (!XkbRemoveResourceClient(pXDev,id)) {
ErrorF("[xkb] Internal Error! bad RemoveResourceClient in XkbClientGone\n");
}
return 1;
}
| 0
|
349,279
|
static void read_block_list(unsigned int *block_list, long long start,
unsigned int offset, int blocks)
{
int res;
TRACE("read_block_list: blocks %d\n", blocks);
res = read_inode_data(block_list, &start, &offset, blocks * sizeof(unsigned int));
if(res == FALSE)
EXIT_UNSQUASH("read_block_list: failed to read "
"inode index %lld:%d\n", start, offset);
SQUASHFS_INSWAP_INTS(block_list, blocks);
}
| 0
|
474,448
|
ObjectSetLoadedAttributes(
OBJECT *object, // IN: object attributes to finalize
TPM_HANDLE parentHandle // IN: the parent handle
)
{
OBJECT *parent = HandleToObject(parentHandle);
TPMA_OBJECT objectAttributes = object->publicArea.objectAttributes;
//
// Copy the stClear attribute from the public area. This could be overwritten
// if the parent has stClear SET
object->attributes.stClear =
IS_ATTRIBUTE(objectAttributes, TPMA_OBJECT, stClear);
// If parent handle is a permanent handle, it is a primary (unless it is NULL
if(parent == NULL)
{
object->attributes.primary = SET;
switch(parentHandle)
{
case TPM_RH_ENDORSEMENT:
object->attributes.epsHierarchy = SET;
break;
case TPM_RH_OWNER:
object->attributes.spsHierarchy = SET;
break;
case TPM_RH_PLATFORM:
object->attributes.ppsHierarchy = SET;
break;
default:
// Treat the temporary attribute as a hierarchy
object->attributes.temporary = SET;
object->attributes.primary = CLEAR;
break;
}
}
else
{
// is this a stClear object
object->attributes.stClear =
(IS_ATTRIBUTE(objectAttributes, TPMA_OBJECT, stClear)
|| (parent->attributes.stClear == SET));
object->attributes.epsHierarchy = parent->attributes.epsHierarchy;
object->attributes.spsHierarchy = parent->attributes.spsHierarchy;
object->attributes.ppsHierarchy = parent->attributes.ppsHierarchy;
// An object is temporary if its parent is temporary or if the object
// is external
object->attributes.temporary = parent->attributes.temporary
|| object->attributes.external;
}
// If this is an external object, set the QN == name but don't SET other
// key properties ('parent' or 'derived')
if(object->attributes.external)
object->qualifiedName = object->name;
else
{
// check attributes for different types of parents
if(IS_ATTRIBUTE(objectAttributes, TPMA_OBJECT, restricted)
&& !object->attributes.publicOnly
&& IS_ATTRIBUTE(objectAttributes, TPMA_OBJECT, decrypt)
&& object->publicArea.nameAlg != TPM_ALG_NULL)
{
// This is a parent. If it is not a KEYEDHASH, it is an ordinary parent.
// Otherwise, it is a derivation parent.
if(object->publicArea.type == TPM_ALG_KEYEDHASH)
object->attributes.derivation = SET;
else
object->attributes.isParent = SET;
}
ComputeQualifiedName(parentHandle, object->publicArea.nameAlg,
&object->name, &object->qualifiedName);
}
// Set slot occupied
ObjectSetInUse(object);
return;
}
| 0
|
267,964
|
R_API RBinField *r_bin_file_add_field(RBinFile *binfile, const char *classname, const char *name) {
//TODO: add_field into class
//eprintf ("TODO add field: %s \n", name);
return NULL;
}
| 0
|
503,853
|
SCM_DEFINE (scm_system_file_name_convention,
"system-file-name-convention", 0, 0, 0, (void),
"Return either @code{posix} or @code{windows}, depending on\n"
"what kind of system this Guile is running on.")
#define FUNC_NAME s_scm_system_file_name_convention
{
return sym_file_name_convention;
}
| 0
|
261,407
|
void read_coding_unit(thread_context* tctx,
int x0, int y0, // position of coding unit in frame
int log2CbSize,
int ctDepth)
{
de265_image* img = tctx->img;
const seq_parameter_set& sps = img->get_sps();
const pic_parameter_set& pps = img->get_pps();
slice_segment_header* shdr = tctx->shdr;
logtrace(LogSlice,"- read_coding_unit %d;%d cbsize:%d\n",x0,y0,1<<log2CbSize);
//QQprintf("- read_coding_unit %d;%d cbsize:%d\n",x0,y0,1<<log2CbSize);
img->set_log2CbSize(x0,y0, log2CbSize, true);
/* This is only required on corrupted input streams.
It may happen that there are several slices in the image that overlap.
In this case, flags would accumulate from both slices.
*/
img->clear_split_transform_flags(x0,y0, log2CbSize);
int nCbS = 1<<log2CbSize; // number of coding block samples
decode_quantization_parameters(tctx, x0,y0, x0, y0);
if (pps.transquant_bypass_enable_flag)
{
int transquant_bypass = decode_transquant_bypass_flag(tctx);
tctx->cu_transquant_bypass_flag = transquant_bypass;
if (transquant_bypass) {
img->set_cu_transquant_bypass(x0,y0,log2CbSize);
}
}
else {
tctx->cu_transquant_bypass_flag = 0;
}
uint8_t cu_skip_flag = 0;
if (shdr->slice_type != SLICE_TYPE_I) {
cu_skip_flag = decode_cu_skip_flag(tctx,x0,y0,ctDepth);
}
int IntraSplitFlag = 0;
enum PredMode cuPredMode;
if (cu_skip_flag) {
read_prediction_unit_SKIP(tctx,x0,y0,nCbS,nCbS);
img->set_PartMode(x0,y0, PART_2Nx2N); // need this for deblocking filter
img->set_pred_mode(x0,y0,log2CbSize, MODE_SKIP);
cuPredMode = MODE_SKIP;
logtrace(LogSlice,"CU pred mode: SKIP\n");
// DECODE
int nCS_L = 1<<log2CbSize;
decode_prediction_unit(tctx->decctx,tctx->shdr,tctx->img,tctx->motion,
x0,y0, 0,0, nCS_L, nCS_L,nCS_L, 0);
}
else /* not skipped */ {
if (shdr->slice_type != SLICE_TYPE_I) {
int pred_mode_flag = decode_pred_mode_flag(tctx);
cuPredMode = pred_mode_flag ? MODE_INTRA : MODE_INTER;
}
else {
cuPredMode = MODE_INTRA;
}
img->set_pred_mode(x0,y0,log2CbSize, cuPredMode);
logtrace(LogSlice,"CU pred mode: %s\n", cuPredMode==MODE_INTRA ? "INTRA" : "INTER");
enum PartMode PartMode;
if (cuPredMode != MODE_INTRA ||
log2CbSize == sps.Log2MinCbSizeY) {
PartMode = decode_part_mode(tctx, cuPredMode, log2CbSize);
if (PartMode==PART_NxN && cuPredMode==MODE_INTRA) {
IntraSplitFlag=1;
}
} else {
PartMode = PART_2Nx2N;
}
img->set_PartMode(x0,y0, PartMode); // needed for deblocking ?
logtrace(LogSlice, "PartMode: %s\n", part_mode_name(PartMode));
bool pcm_flag = false;
if (cuPredMode == MODE_INTRA) {
if (PartMode == PART_2Nx2N && sps.pcm_enabled_flag &&
log2CbSize >= sps.Log2MinIpcmCbSizeY &&
log2CbSize <= sps.Log2MaxIpcmCbSizeY) {
pcm_flag = decode_CABAC_term_bit(&tctx->cabac_decoder);
}
if (pcm_flag) {
img->set_pcm_flag(x0,y0,log2CbSize);
read_pcm_samples(tctx, x0,y0, log2CbSize);
}
else {
int pbOffset = (PartMode == PART_NxN) ? (nCbS/2) : nCbS;
int log2IntraPredSize = (PartMode == PART_NxN) ? (log2CbSize-1) : log2CbSize;
logtrace(LogSlice,"nCbS:%d pbOffset:%d\n",nCbS,pbOffset);
int prev_intra_luma_pred_flag[4];
int idx=0;
for (int j=0;j<nCbS;j+=pbOffset)
for (int i=0;i<nCbS;i+=pbOffset)
{
prev_intra_luma_pred_flag[idx++] = decode_prev_intra_luma_pred_flag(tctx);
}
int mpm_idx[4], rem_intra_luma_pred_mode[4];
idx=0;
int availableA0 = check_CTB_available(img, x0,y0, x0-1,y0);
int availableB0 = check_CTB_available(img, x0,y0, x0,y0-1);
for (int j=0;j<nCbS;j+=pbOffset)
for (int i=0;i<nCbS;i+=pbOffset)
{
if (prev_intra_luma_pred_flag[idx]) {
mpm_idx[idx] = decode_mpm_idx(tctx);
}
else {
rem_intra_luma_pred_mode[idx] = decode_rem_intra_luma_pred_mode(tctx);
}
int x = x0+i;
int y = y0+j;
// --- find intra prediction mode ---
int IntraPredMode;
int availableA = availableA0 || (i>0); // left candidate always available for right blk
int availableB = availableB0 || (j>0); // top candidate always available for bottom blk
int PUidx = (x>>sps.Log2MinPUSize) + (y>>sps.Log2MinPUSize)*sps.PicWidthInMinPUs;
enum IntraPredMode candModeList[3];
fillIntraPredModeCandidates(candModeList,x,y,PUidx,
availableA, availableB, img);
for (int i=0;i<3;i++)
logtrace(LogSlice,"candModeList[%d] = %d\n", i, candModeList[i]);
if (prev_intra_luma_pred_flag[idx]==1) {
IntraPredMode = candModeList[ mpm_idx[idx] ];
}
else {
// sort candModeList
if (candModeList[0] > candModeList[1]) {
std::swap(candModeList[0],candModeList[1]);
}
if (candModeList[0] > candModeList[2]) {
std::swap(candModeList[0],candModeList[2]);
}
if (candModeList[1] > candModeList[2]) {
std::swap(candModeList[1],candModeList[2]);
}
// skip modes in the list
// (we have 35 modes. skipping the 3 in the list gives us 32, which can be selected by 5 bits)
IntraPredMode = rem_intra_luma_pred_mode[idx];
for (int n=0;n<=2;n++) {
if (IntraPredMode >= candModeList[n]) { IntraPredMode++; }
}
}
logtrace(LogSlice,"IntraPredMode[%d][%d] = %d (log2blk:%d)\n",x,y,IntraPredMode, log2IntraPredSize);
img->set_IntraPredMode(PUidx, log2IntraPredSize,
(enum IntraPredMode)IntraPredMode);
idx++;
}
// set chroma intra prediction mode
if (sps.ChromaArrayType == CHROMA_444) {
// chroma 4:4:4
idx = 0;
for (int j=0;j<nCbS;j+=pbOffset)
for (int i=0;i<nCbS;i+=pbOffset) {
int x = x0+i;
int y = y0+j;
int intra_chroma_pred_mode = decode_intra_chroma_pred_mode(tctx);
int IntraPredMode = img->get_IntraPredMode(x,y);
int IntraPredModeC = map_chroma_pred_mode(intra_chroma_pred_mode, IntraPredMode);
logtrace(LogSlice,"IntraPredModeC[%d][%d]: %d (blksize:%d)\n",x,y,IntraPredModeC,
1<<log2IntraPredSize);
img->set_IntraPredModeC(x,y, log2IntraPredSize,
(enum IntraPredMode)IntraPredModeC,
intra_chroma_pred_mode == 4);
idx++;
}
}
else if (sps.ChromaArrayType != CHROMA_MONO) {
// chroma 4:2:0 and 4:2:2
int intra_chroma_pred_mode = decode_intra_chroma_pred_mode(tctx);
int IntraPredMode = img->get_IntraPredMode(x0,y0);
logtrace(LogSlice,"IntraPredMode: %d\n",IntraPredMode);
int IntraPredModeC = map_chroma_pred_mode(intra_chroma_pred_mode, IntraPredMode);
if (sps.ChromaArrayType == CHROMA_422) {
IntraPredModeC = map_chroma_422[ IntraPredModeC ];
}
img->set_IntraPredModeC(x0,y0, log2CbSize,
(enum IntraPredMode)IntraPredModeC,
intra_chroma_pred_mode == 4);
}
}
}
else { // INTER
int nCS = 1<<log2CbSize;
if (PartMode == PART_2Nx2N) {
read_prediction_unit(tctx,x0,y0,0,0,nCbS,nCbS,ctDepth,nCS,0);
}
else if (PartMode == PART_2NxN) {
read_prediction_unit(tctx,x0,y0,0,0 ,nCbS,nCbS/2,ctDepth,nCS,0);
read_prediction_unit(tctx,x0,y0,0,nCbS/2,nCbS,nCbS/2,ctDepth,nCS,1);
}
else if (PartMode == PART_Nx2N) {
read_prediction_unit(tctx,x0,y0,0,0 , nCbS/2,nCbS,ctDepth,nCS,0);
read_prediction_unit(tctx,x0,y0,nCbS/2,0,nCbS/2,nCbS,ctDepth,nCS,1);
}
else if (PartMode == PART_2NxnU) {
read_prediction_unit(tctx,x0,y0,0,0, nCbS,nCbS/4,ctDepth,nCS,0);
read_prediction_unit(tctx,x0,y0,0,nCbS/4,nCbS,nCbS*3/4,ctDepth,nCS,1);
}
else if (PartMode == PART_2NxnD) {
read_prediction_unit(tctx,x0,y0,0,0, nCbS,nCbS*3/4,ctDepth,nCS,0);
read_prediction_unit(tctx,x0,y0,0,nCbS*3/4,nCbS,nCbS/4,ctDepth,nCS,1);
}
else if (PartMode == PART_nLx2N) {
read_prediction_unit(tctx,x0,y0,0,0, nCbS/4,nCbS,ctDepth,nCS,0);
read_prediction_unit(tctx,x0,y0,nCbS/4,0,nCbS*3/4,nCbS,ctDepth,nCS,1);
}
else if (PartMode == PART_nRx2N) {
read_prediction_unit(tctx,x0,y0,0,0, nCbS*3/4,nCbS,ctDepth,nCS,0);
read_prediction_unit(tctx,x0,y0,nCbS*3/4,0,nCbS/4,nCbS,ctDepth,nCS,1);
}
else if (PartMode == PART_NxN) {
read_prediction_unit(tctx,x0,y0,0,0, nCbS/2,nCbS/2,ctDepth,nCS,0);
read_prediction_unit(tctx,x0,y0,nCbS/2,0, nCbS/2,nCbS/2,ctDepth,nCS,1);
read_prediction_unit(tctx,x0,y0,0,nCbS/2, nCbS/2,nCbS/2,ctDepth,nCS,2);
read_prediction_unit(tctx,x0,y0,nCbS/2,nCbS/2,nCbS/2,nCbS/2,ctDepth,nCS,3);
}
else {
assert(0); // undefined PartMode
}
} // INTER
// decode residual
if (!pcm_flag) { // !pcm
bool rqt_root_cbf;
uint8_t merge_flag = tctx->motion.merge_flag; // !!get_merge_flag(ctx,x0,y0);
if (cuPredMode != MODE_INTRA &&
!(PartMode == PART_2Nx2N && merge_flag)) {
rqt_root_cbf = !!decode_rqt_root_cbf(tctx);
}
else {
/* rqt_root_cbf=1 is inferred for Inter blocks with 2Nx2N, merge mode.
These must be some residual data, because otherwise, the CB could
also be coded in SKIP mode.
*/
rqt_root_cbf = true;
}
//set_rqt_root_cbf(ctx,x0,y0, log2CbSize, rqt_root_cbf);
if (rqt_root_cbf) {
int MaxTrafoDepth;
if (cuPredMode==MODE_INTRA) {
MaxTrafoDepth = sps.max_transform_hierarchy_depth_intra + IntraSplitFlag;
}
else {
MaxTrafoDepth = sps.max_transform_hierarchy_depth_inter;
}
logtrace(LogSlice,"MaxTrafoDepth: %d\n",MaxTrafoDepth);
uint8_t initial_chroma_cbf = 1;
if (sps.ChromaArrayType == CHROMA_MONO) {
initial_chroma_cbf = 0;
}
read_transform_tree(tctx, x0,y0, x0,y0, x0,y0, log2CbSize, 0,0,
MaxTrafoDepth, IntraSplitFlag, cuPredMode,
initial_chroma_cbf, initial_chroma_cbf);
}
} // !pcm
}
}
| 0
|
218,815
|
static MagickBooleanType ReadPSDMergedImage(const ImageInfo *image_info,
Image* image,const PSDInfo* psd_info,ExceptionInfo *exception)
{
MagickOffsetType
*sizes;
MagickBooleanType
status;
PSDCompressionType
compression;
ssize_t
i;
compression=(PSDCompressionType) ReadBlobMSBShort(image);
image->compression=ConvertPSDCompression(compression);
if (compression != Raw && compression != RLE)
{
(void) ThrowMagickException(exception,GetMagickModule(),
TypeWarning,"CompressionNotSupported","'%.20g'",(double) compression);
return(MagickFalse);
}
sizes=(MagickOffsetType *) NULL;
if (compression == RLE)
{
sizes=ReadPSDRLESizes(image,psd_info,image->rows*psd_info->channels);
if (sizes == (MagickOffsetType *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
status=MagickTrue;
for (i=0; i < (ssize_t) psd_info->channels; i++)
{
ssize_t
type;
type=i;
if ((type == 1) && (psd_info->channels == 2))
type=-1;
if (compression == RLE)
status=ReadPSDChannelRLE(image,psd_info,type,sizes+(i*image->rows),
exception);
else
status=ReadPSDChannelRaw(image,psd_info->channels,type,exception);
if (status != MagickFalse)
status=SetImageProgress(image,LoadImagesTag,(MagickOffsetType) i,
psd_info->channels);
if (status == MagickFalse)
break;
}
if ((status != MagickFalse) && (image->colorspace == CMYKColorspace))
status=NegateImage(image,MagickFalse);
if (status != MagickFalse)
status=CorrectPSDAlphaBlend(image_info,image,exception);
sizes=(MagickOffsetType *) RelinquishMagickMemory(sizes);
return(status);
}
| 0
|
436,148
|
static int io_accept(struct io_kiocb *req, unsigned int issue_flags)
{
struct io_accept *accept = &req->accept;
bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
unsigned int file_flags = force_nonblock ? O_NONBLOCK : 0;
int ret;
if (req->file->f_flags & O_NONBLOCK)
req->flags |= REQ_F_NOWAIT;
ret = __sys_accept4_file(req->file, file_flags, accept->addr,
accept->addr_len, accept->flags,
accept->nofile);
if (ret == -EAGAIN && force_nonblock)
return -EAGAIN;
if (ret < 0) {
if (ret == -ERESTARTSYS)
ret = -EINTR;
req_set_fail(req);
}
__io_req_complete(req, issue_flags, ret, 0);
return 0;
}
| 0
|
508,402
|
int setup_conds(THD *thd, TABLE_LIST *tables, List<TABLE_LIST> &leaves,
COND **conds)
{
SELECT_LEX *select_lex= thd->lex->current_select;
TABLE_LIST *table= NULL; // For HP compilers
/*
it_is_update set to TRUE when tables of primary SELECT_LEX (SELECT_LEX
which belong to LEX, i.e. most up SELECT) will be updated by
INSERT/UPDATE/LOAD
NOTE: using this condition helps to prevent call of prepare_check_option()
from subquery of VIEW, because tables of subquery belongs to VIEW
(see condition before prepare_check_option() call)
*/
bool it_is_update= (select_lex == &thd->lex->select_lex) &&
thd->lex->which_check_option_applicable();
bool save_is_item_list_lookup= select_lex->is_item_list_lookup;
TABLE_LIST *derived= select_lex->master_unit()->derived;
DBUG_ENTER("setup_conds");
/* Do not fix conditions for the derived tables that have been merged */
if (derived && derived->merged)
DBUG_RETURN(0);
select_lex->is_item_list_lookup= 0;
thd->mark_used_columns= MARK_COLUMNS_READ;
DBUG_PRINT("info", ("thd->mark_used_columns: %d", thd->mark_used_columns));
select_lex->cond_count= 0;
select_lex->between_count= 0;
select_lex->max_equal_elems= 0;
for (table= tables; table; table= table->next_local)
{
if (select_lex == &thd->lex->select_lex &&
select_lex->first_cond_optimization &&
table->merged_for_insert &&
table->prepare_where(thd, conds, FALSE))
goto err_no_arena;
}
if (*conds)
{
thd->where="where clause";
DBUG_EXECUTE("where",
print_where(*conds,
"WHERE in setup_conds",
QT_ORDINARY););
/*
Wrap alone field in WHERE clause in case it will be outer field of subquery
which need persistent pointer on it, but conds could be changed by optimizer
*/
if ((*conds)->type() == Item::FIELD_ITEM && !derived)
wrap_ident(thd, conds);
(*conds)->mark_as_condition_AND_part(NO_JOIN_NEST);
if ((!(*conds)->fixed && (*conds)->fix_fields(thd, conds)) ||
(*conds)->check_cols(1))
goto err_no_arena;
}
/*
Apply fix_fields() to all ON clauses at all levels of nesting,
including the ones inside view definitions.
*/
if (setup_on_expr(thd, tables, it_is_update))
goto err_no_arena;
if (!thd->stmt_arena->is_conventional())
{
/*
We are in prepared statement preparation code => we should store
WHERE clause changing for next executions.
We do this ON -> WHERE transformation only once per PS/SP statement.
*/
select_lex->where= *conds;
}
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
DBUG_RETURN(MY_TEST(thd->is_error()));
err_no_arena:
select_lex->is_item_list_lookup= save_is_item_list_lookup;
DBUG_RETURN(1);
}
| 0
|
437,352
|
set_optimize_exact(regex_t* reg, OptExact* e)
{
int r;
if (e->len == 0) return 0;
if (e->ignore_case) {
reg->exact = (UChar* )xmalloc(e->len);
CHECK_NULL_RETURN_MEMERR(reg->exact);
xmemcpy(reg->exact, e->s, e->len);
reg->exact_end = reg->exact + e->len;
reg->optimize = OPTIMIZE_STR_IC;
}
else {
int allow_reverse;
reg->exact = onigenc_strdup(reg->enc, e->s, e->s + e->len);
CHECK_NULL_RETURN_MEMERR(reg->exact);
reg->exact_end = reg->exact + e->len;
allow_reverse =
ONIGENC_IS_ALLOWED_REVERSE_MATCH(reg->enc, reg->exact, reg->exact_end);
if (e->len >= 3 || (e->len >= 2 && allow_reverse)) {
#ifdef USE_SUNDAY_QUICK_SEARCH_ALGORITHM
r = set_sunday_quick_search_skip_table(reg->exact, reg->exact_end,
reg->enc, reg->map,
&(reg->map_offset));
#else
r = set_bmh_search_skip_table(reg->exact, reg->exact_end,
reg->enc, reg->map);
#endif
if (r != 0) return r;
reg->optimize = (allow_reverse != 0
? OPTIMIZE_STR_FAST
: OPTIMIZE_STR_FAST_STEP_FORWARD);
}
else {
reg->optimize = OPTIMIZE_STR;
}
}
reg->dmin = e->mmd.min;
reg->dmax = e->mmd.max;
if (reg->dmin != INFINITE_LEN) {
reg->threshold_len = reg->dmin + (int )(reg->exact_end - reg->exact);
}
return 0;
}
| 0
|
343,213
|
static int generic_aton(const char *src, struct sockaddr_storage *a)
{
if (inet_pton(AF_INET6, src, &STORAGE_SIN_ADDR6(*a)) > 0) {
STORAGE_FAMILY(*a) = AF_INET6;
return 0;
}
if (inet_pton(AF_INET, src, &STORAGE_SIN_ADDR(*a)) > 0) {
STORAGE_FAMILY(*a) = AF_INET;
return 0;
}
memset(a, 0, sizeof *a);
return -1;
}
| 0
|
225,672
|
GF_Err gnra_box_size(GF_Box *s)
{
GF_GenericAudioSampleEntryBox *ptr = (GF_GenericAudioSampleEntryBox *)s;
s->type = GF_ISOM_BOX_TYPE_GNRA;
gf_isom_audio_sample_entry_size((GF_AudioSampleEntryBox *)s);
ptr->size += ptr->data_size;
return GF_OK;
}
| 0
|
450,382
|
static int zrle_compress_data(VncState *vs, int level)
{
z_streamp zstream = &vs->zrle->stream;
buffer_reset(&vs->zrle->zlib);
if (zstream->opaque != vs) {
int err;
zstream->zalloc = vnc_zlib_zalloc;
zstream->zfree = vnc_zlib_zfree;
err = deflateInit2(zstream, level, Z_DEFLATED, MAX_WBITS,
MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);
if (err != Z_OK) {
fprintf(stderr, "VNC: error initializing zlib\n");
return -1;
}
zstream->opaque = vs;
}
/* reserve memory in output buffer */
buffer_reserve(&vs->zrle->zlib, vs->zrle->zrle.offset + 64);
/* set pointers */
zstream->next_in = vs->zrle->zrle.buffer;
zstream->avail_in = vs->zrle->zrle.offset;
zstream->next_out = vs->zrle->zlib.buffer + vs->zrle->zlib.offset;
zstream->avail_out = vs->zrle->zlib.capacity - vs->zrle->zlib.offset;
zstream->data_type = Z_BINARY;
/* start encoding */
if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) {
fprintf(stderr, "VNC: error during zrle compression\n");
return -1;
}
vs->zrle->zlib.offset = vs->zrle->zlib.capacity - zstream->avail_out;
return vs->zrle->zlib.offset;
}
| 0
|
402,661
|
handle_sign_detached(context *ctx, struct pollfd *pollfd, socklen_t size)
{
handle_sign_helper(ctx, pollfd, size, 0, false);
}
| 0
|
317,333
|
static int __init enforcing_setup(char *str)
{
unsigned long enforcing;
if (!kstrtoul(str, 0, &enforcing))
selinux_enforcing_boot = enforcing ? 1 : 0;
return 1;
}
| 0
|
202,600
|
append_command(char_u *cmd)
{
char_u *s = cmd;
char_u *d;
STRCAT(IObuff, ": ");
d = IObuff + STRLEN(IObuff);
while (*s != NUL && d - IObuff < IOSIZE - 7)
{
if (enc_utf8 ? (s[0] == 0xc2 && s[1] == 0xa0) : *s == 0xa0)
{
s += enc_utf8 ? 2 : 1;
STRCPY(d, "<a0>");
d += 4;
}
else
MB_COPY_CHAR(s, d);
}
*d = NUL;
}
| 1
|
508,382
|
static bool check_lock_and_start_stmt(THD *thd,
Query_tables_list *prelocking_ctx,
TABLE_LIST *table_list)
{
int error;
thr_lock_type lock_type;
DBUG_ENTER("check_lock_and_start_stmt");
/*
Prelocking placeholder is not set for TABLE_LIST that
are directly used by TOP level statement.
*/
DBUG_ASSERT(table_list->prelocking_placeholder == false);
/*
TL_WRITE_DEFAULT and TL_READ_DEFAULT are supposed to be parser only
types of locks so they should be converted to appropriate other types
to be passed to storage engine. The exact lock type passed to the
engine is important as, for example, InnoDB uses it to determine
what kind of row locks should be acquired when executing statement
in prelocked mode or under LOCK TABLES with @@innodb_table_locks = 0.
Last argument routine_modifies_data for read_lock_type_for_table()
is ignored, as prelocking placeholder will never be set here.
*/
DBUG_ASSERT(table_list->prelocking_placeholder == false);
if (table_list->lock_type == TL_WRITE_DEFAULT)
lock_type= thd->update_lock_default;
else if (table_list->lock_type == TL_READ_DEFAULT)
lock_type= read_lock_type_for_table(thd, prelocking_ctx, table_list, true);
else
lock_type= table_list->lock_type;
if ((int) lock_type > (int) TL_WRITE_ALLOW_WRITE &&
(int) table_list->table->reginfo.lock_type <= (int) TL_WRITE_ALLOW_WRITE)
{
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),
table_list->table->alias.c_ptr());
DBUG_RETURN(1);
}
if ((error= table_list->table->file->start_stmt(thd, lock_type)))
{
table_list->table->file->print_error(error, MYF(0));
DBUG_RETURN(1);
}
/*
Record in transaction state tracking
*/
TRANSACT_TRACKER(add_trx_state(thd, lock_type,
table_list->table->file->has_transactions()));
DBUG_RETURN(0);
}
| 0
|
230,628
|
void get_merge_candidate_list_without_step_9(base_context* ctx,
const slice_segment_header* shdr,
const MotionVectorAccess& mvaccess,
de265_image* img,
int xC,int yC, int xP,int yP,
int nCS, int nPbW,int nPbH, int partIdx,
int max_merge_idx,
PBMotion* mergeCandList)
{
//int xOrigP = xP;
//int yOrigP = yP;
int nOrigPbW = nPbW;
int nOrigPbH = nPbH;
int singleMCLFlag; // single merge-candidate-list (MCL) flag
/* Use single MCL for CBs of size 8x8, except when parallel-merge-level is at 4x4.
Without this flag, PBs smaller than 8x8 would not receive as much merging candidates.
Having additional candidates might have these advantages:
- coding MVs for these small PBs is expensive, and
- since the PBs are not far away from a proper (neighboring) merging candidate,
the quality of the candidates will still be good.
*/
singleMCLFlag = (img->get_pps().log2_parallel_merge_level > 2 && nCS==8);
if (singleMCLFlag) {
xP=xC;
yP=yC;
nPbW=nCS;
nPbH=nCS;
partIdx=0;
}
int maxCandidates = max_merge_idx+1;
//MotionVectorSpec mergeCandList[5];
int numMergeCand=0;
// --- spatial merge candidates
numMergeCand = derive_spatial_merging_candidates(mvaccess,
img, xC,yC, nCS, xP,yP, singleMCLFlag,
nPbW,nPbH,partIdx, mergeCandList,
maxCandidates);
// --- collocated merge candidate
if (numMergeCand < maxCandidates) {
int refIdxCol[2] = { 0,0 };
MotionVector mvCol[2];
uint8_t predFlagLCol[2];
derive_temporal_luma_vector_prediction(ctx,img,shdr, xP,yP,nPbW,nPbH,
refIdxCol[0],0, &mvCol[0],
&predFlagLCol[0]);
uint8_t availableFlagCol = predFlagLCol[0];
predFlagLCol[1] = 0;
if (shdr->slice_type == SLICE_TYPE_B) {
derive_temporal_luma_vector_prediction(ctx,img,shdr,
xP,yP,nPbW,nPbH, refIdxCol[1],1, &mvCol[1],
&predFlagLCol[1]);
availableFlagCol |= predFlagLCol[1];
}
if (availableFlagCol) {
PBMotion* colVec = &mergeCandList[numMergeCand++];
colVec->mv[0] = mvCol[0];
colVec->mv[1] = mvCol[1];
colVec->predFlag[0] = predFlagLCol[0];
colVec->predFlag[1] = predFlagLCol[1];
colVec->refIdx[0] = refIdxCol[0];
colVec->refIdx[1] = refIdxCol[1];
}
}
// --- bipredictive merge candidates ---
if (shdr->slice_type == SLICE_TYPE_B) {
derive_combined_bipredictive_merging_candidates(ctx, shdr,
mergeCandList, &numMergeCand, maxCandidates);
}
// --- zero-vector merge candidates ---
derive_zero_motion_vector_candidates(shdr, mergeCandList, &numMergeCand, maxCandidates);
logtrace(LogMotion,"mergeCandList:\n");
for (int i=0;i<shdr->MaxNumMergeCand;i++)
{
//logtrace(LogMotion, " %d:%s\n", i, i==merge_idx ? " SELECTED":"");
logmvcand(mergeCandList[i]);
}
}
| 0
|
228,449
|
String WddxPacket::wrapValue(const String& start,
const String& end,
const String& varValue,
const String& varName,
bool hasVarTag) {
StringBuffer valueStr;
if (hasVarTag) {
valueStr.append("<var name='");
valueStr.append(varName);
valueStr.append("'>");
}
valueStr.append(start);
valueStr.append(varValue);
valueStr.append(end);
if (hasVarTag) {
valueStr.append("</var>");
}
return valueStr.detach();
}
| 0
|
400,730
|
void iov_iter_kvec(struct iov_iter *i, unsigned int direction,
const struct kvec *kvec, unsigned long nr_segs,
size_t count)
{
WARN_ON(direction & ~(READ | WRITE));
*i = (struct iov_iter){
.iter_type = ITER_KVEC,
.data_source = direction,
.kvec = kvec,
.nr_segs = nr_segs,
.iov_offset = 0,
.count = count
};
}
| 0
|
376,344
|
gpg_ctx_set_userid (struct _GpgCtx *gpg,
const gchar *userid)
{
g_slist_free_full (gpg->userids, g_free);
gpg->userids = NULL;
if (userid && *userid) {
gchar **uids = g_strsplit (userid, " ", -1);
if (!uids) {
gpg->userids = g_slist_append (gpg->userids, g_strdup (userid));
} else {
gint ii;
for (ii = 0; uids[ii]; ii++) {
const gchar *uid = uids[ii];
if (*uid) {
gpg->userids = g_slist_append (gpg->userids, g_strdup (uid));
}
}
g_strfreev (uids);
}
}
}
| 0
|
387,598
|
static int snd_ctl_check_elem_info(struct snd_card *card,
const struct snd_ctl_elem_info *info)
{
static const unsigned int max_value_counts[] = {
[SNDRV_CTL_ELEM_TYPE_BOOLEAN] = 128,
[SNDRV_CTL_ELEM_TYPE_INTEGER] = 128,
[SNDRV_CTL_ELEM_TYPE_ENUMERATED] = 128,
[SNDRV_CTL_ELEM_TYPE_BYTES] = 512,
[SNDRV_CTL_ELEM_TYPE_IEC958] = 1,
[SNDRV_CTL_ELEM_TYPE_INTEGER64] = 64,
};
if (info->type < SNDRV_CTL_ELEM_TYPE_BOOLEAN ||
info->type > SNDRV_CTL_ELEM_TYPE_INTEGER64) {
if (card)
dev_err(card->dev,
"control %i:%i:%i:%s:%i: invalid type %d\n",
info->id.iface, info->id.device,
info->id.subdevice, info->id.name,
info->id.index, info->type);
return -EINVAL;
}
if (info->type == SNDRV_CTL_ELEM_TYPE_ENUMERATED &&
info->value.enumerated.items == 0) {
if (card)
dev_err(card->dev,
"control %i:%i:%i:%s:%i: zero enum items\n",
info->id.iface, info->id.device,
info->id.subdevice, info->id.name,
info->id.index);
return -EINVAL;
}
if (info->count > max_value_counts[info->type]) {
if (card)
dev_err(card->dev,
"control %i:%i:%i:%s:%i: invalid count %d\n",
info->id.iface, info->id.device,
info->id.subdevice, info->id.name,
info->id.index, info->count);
return -EINVAL;
}
return 0;
}
| 0
|
90,758
|
void DidGetGlobalUsage(StorageType type, int64 usage,
int64 unlimited_usage) {
DCHECK_EQ(type_, type);
DCHECK_GE(usage, unlimited_usage);
global_usage_ = usage;
global_unlimited_usage_ = unlimited_usage;
CheckCompleted();
}
| 0
|
249,518
|
int processing_finish(png_structp png_ptr, png_infop info_ptr) {
unsigned char footer[12] = {0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130};
if (!png_ptr || !info_ptr) return 1;
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, 0);
return 1;
}
png_process_data(png_ptr, info_ptr, footer, 12);
png_destroy_read_struct(&png_ptr, &info_ptr, 0);
return 0;
}
| 0
|
338,183
|
bool WasmBinaryBuilder::maybeVisitTableSize(Expression*& out, uint32_t code) {
if (code != BinaryConsts::TableSize) {
return false;
}
Index tableIdx = getU32LEB();
if (tableIdx >= tables.size()) {
throwError("bad table index");
}
auto* curr = allocator.alloc<TableSize>();
curr->finalize();
// Defer setting the table name for later, when we know it.
tableRefs[tableIdx].push_back(curr);
out = curr;
return true;
}
| 0
|
385,812
|
static long do_sys_truncate(const char __user *pathname, loff_t length)
{
unsigned int lookup_flags = LOOKUP_FOLLOW;
struct path path;
int error;
if (length < 0) /* sorry, but loff_t says... */
return -EINVAL;
retry:
error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path);
if (!error) {
error = vfs_truncate(&path, length);
path_put(&path);
}
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
return error;
}
| 0
|
317,218
|
static unsigned int selinux_ip_output(struct sk_buff *skb,
u16 family)
{
struct sock *sk;
u32 sid;
if (!netlbl_enabled())
return NF_ACCEPT;
/* we do this in the LOCAL_OUT path and not the POST_ROUTING path
* because we want to make sure we apply the necessary labeling
* before IPsec is applied so we can leverage AH protection */
sk = skb->sk;
if (sk) {
struct sk_security_struct *sksec;
if (sk_listener(sk))
/* if the socket is the listening state then this
* packet is a SYN-ACK packet which means it needs to
* be labeled based on the connection/request_sock and
* not the parent socket. unfortunately, we can't
* lookup the request_sock yet as it isn't queued on
* the parent socket until after the SYN-ACK is sent.
* the "solution" is to simply pass the packet as-is
* as any IP option based labeling should be copied
* from the initial connection request (in the IP
* layer). it is far from ideal, but until we get a
* security label in the packet itself this is the
* best we can do. */
return NF_ACCEPT;
/* standard practice, label using the parent socket */
sksec = sk->sk_security;
sid = sksec->sid;
} else
sid = SECINITSID_KERNEL;
if (selinux_netlbl_skbuff_setsid(skb, family, sid) != 0)
return NF_DROP;
return NF_ACCEPT;
}
| 0
|
513,222
|
bool sys_var_pluginvar::session_update(THD *thd, set_var *var)
{
DBUG_ASSERT(!is_readonly());
DBUG_ASSERT(plugin_var->flags & PLUGIN_VAR_THDLOCAL);
DBUG_ASSERT(thd == current_thd);
mysql_mutex_lock(&LOCK_global_system_variables);
void *tgt= real_value_ptr(thd, OPT_SESSION);
const void *src= var->value ? (void*)&var->save_result
: (void*)real_value_ptr(thd, OPT_GLOBAL);
mysql_mutex_unlock(&LOCK_global_system_variables);
plugin_var->update(thd, plugin_var, tgt, src);
return false;
}
| 0
|
328,820
|
R_API ut32 r_bin_java_get_utf8_len_from_cp_item_list(RList *cp_list, ut64 idx) {
/*
Search through the Constant Pool list for the given CP Index.
If the idx not found by directly going to the list index,
the list will be walked and then the IDX will be checked.
rvalue: new ut32 .
*/
ut32 value = -1;
RListIter *iter;
if (!cp_list) {
return 0;
}
RBinJavaCPTypeObj *item = (RBinJavaCPTypeObj *) r_list_get_n (cp_list, idx);
if (item && (item->tag == R_BIN_JAVA_CP_UTF8) && item->metas->ord == idx) {
value = item->info.cp_utf8.length;
}
if (value == -1) {
r_list_foreach (cp_list, iter, item) {
if (item && (item->tag == R_BIN_JAVA_CP_UTF8) && item->metas->ord == idx) {
value = item->info.cp_utf8.length;
break;
}
}
}
return value;
}
| 0
|
344,796
|
strdelim(char **s)
{
return strdelim_internal(s, 1);
}
| 0
|
446,405
|
static ut64 estimate_slide(RzDyldCache *cache, ut64 value_mask, ut64 value_add) {
ut64 slide = 0;
if (cache->n_hdr > 1) {
return slide;
}
ut64 *classlist = malloc(64);
if (!classlist) {
goto beach;
}
RzListIter *iter;
RzDyldBinImage *bin;
rz_list_foreach (cache->bins, iter, bin) {
bool found_sample = false;
struct MACH0_(opts_t) opts = { 0 };
opts.header_at = bin->header_at;
struct MACH0_(obj_t) *mach0 = MACH0_(new_buf)(cache->buf, &opts);
if (!mach0) {
goto beach;
}
struct section_t *sections = NULL;
if (!(sections = MACH0_(get_sections)(mach0))) {
MACH0_(mach0_free)
(mach0);
goto beach;
}
int i;
int incomplete = 2;
int classlist_idx = 0, data_idx = 0;
for (i = 0; !sections[i].last && incomplete; i++) {
if (sections[i].size == 0) {
continue;
}
if (strstr(sections[i].name, "__objc_classlist")) {
incomplete--;
classlist_idx = i;
continue;
}
if (strstr(sections[i].name, "__objc_data")) {
incomplete--;
data_idx = i;
continue;
}
}
if (incomplete) {
goto next_bin;
}
int classlist_sample_size = RZ_MIN(64, sections[classlist_idx].size);
int n_classes = classlist_sample_size / 8;
ut64 sect_offset = sections[classlist_idx].offset + bin->hdr_offset;
if (rz_buf_fread_at(cache->buf, sect_offset, (ut8 *)classlist, "l", n_classes) < classlist_sample_size) {
goto next_bin;
}
ut64 data_addr = sections[data_idx].addr;
ut64 data_tail = data_addr & 0xfff;
ut64 data_tail_end = (data_addr + sections[data_idx].size) & 0xfff;
for (i = 0; i < n_classes; i++) {
ut64 cl_addr = (classlist[i] & value_mask) + value_add;
ut64 cl_tail = cl_addr & 0xfff;
if (cl_tail >= data_tail && cl_tail < data_tail_end) {
ut64 off = cl_tail - data_tail;
slide = ((cl_addr - off) & value_mask) - (data_addr & value_mask);
found_sample = true;
break;
}
}
next_bin:
MACH0_(mach0_free)
(mach0);
free(sections);
if (found_sample) {
break;
}
}
beach:
free(classlist);
return slide;
}
| 0
|
221,484
|
flatpak_run_extend_ld_path (FlatpakBwrap *bwrap,
const char *prepend,
const char *append)
{
g_autoptr(GString) ld_library_path = g_string_new (g_environ_getenv (bwrap->envp, "LD_LIBRARY_PATH"));
if (prepend != NULL && *prepend != '\0')
{
if (ld_library_path->len > 0)
g_string_prepend (ld_library_path, ":");
g_string_prepend (ld_library_path, prepend);
}
if (append != NULL && *append != '\0')
{
if (ld_library_path->len > 0)
g_string_append (ld_library_path, ":");
g_string_append (ld_library_path, append);
}
flatpak_bwrap_set_env (bwrap, "LD_LIBRARY_PATH", ld_library_path->str, TRUE);
}
| 0
|
246,444
|
RPVector *r_bin_wasm_get_datas(RBinWasmObj *bin) {
r_return_val_if_fail (bin && bin->g_sections, NULL);
return bin->g_datas? bin->g_datas: parse_unique_subsec_vec_by_id (bin, R_BIN_WASM_SECTION_DATA);
}
| 0
|
232,949
|
char *Curl_all_content_encodings(void)
{
size_t len = 0;
const struct content_encoding * const *cep;
const struct content_encoding *ce;
char *ace;
for(cep = encodings; *cep; cep++) {
ce = *cep;
if(!strcasecompare(ce->name, CONTENT_ENCODING_DEFAULT))
len += strlen(ce->name) + 2;
}
if(!len)
return strdup(CONTENT_ENCODING_DEFAULT);
ace = malloc(len);
if(ace) {
char *p = ace;
for(cep = encodings; *cep; cep++) {
ce = *cep;
if(!strcasecompare(ce->name, CONTENT_ENCODING_DEFAULT)) {
strcpy(p, ce->name);
p += strlen(p);
*p++ = ',';
*p++ = ' ';
}
}
p[-2] = '\0';
}
return ace;
}
| 0
|
353,221
|
void SplashOutputDev::updateStrokeAdjust(GfxState * /*state*/) {
#if 0 // the SA parameter supposedly defaults to false, but Acrobat
// apparently hardwires it to true
splash->setStrokeAdjust(state->getStrokeAdjust());
#endif
}
| 0
|
488,407
|
static void remove_migration_ptes(struct page *old, struct page *new)
{
if (PageAnon(new))
remove_anon_migration_ptes(old, new);
else
remove_file_migration_ptes(old, new);
}
| 0
|
393,506
|
static SQInteger array_pop(HSQUIRRELVM v)
{
return SQ_SUCCEEDED(sq_arraypop(v,1,SQTrue))?1:SQ_ERROR;
}
| 0
|
210,570
|
static RCoreSymCacheElement *parseDragons(RBinFile *bf, RBuffer *buf, int off, int bits, R_OWN char *file_name) {
D eprintf ("Dragons at 0x%x\n", off);
ut64 size = r_buf_size (buf);
if (off >= size) {
return NULL;
}
size -= off;
if (!size) {
return NULL;
}
ut8 *b = malloc (size);
if (!b) {
return NULL;
}
int available = r_buf_read_at (buf, off, b, size);
if (available != size) {
eprintf ("Warning: r_buf_read_at failed\n");
return NULL;
}
#if 0
// after the list of sections, there's a bunch of unknown
// data, brobably dwords, and then the same section list again
// this function aims to parse it.
0x00000138 |1a2b b2a1 0300 0000 1a2b b2a1 e055 0000| .+.......+...U..
n_segments ----. .--- how many sections ?
0x00000148 |0100 0000 ca55 0000 0400 0000 1800 0000| .....U..........
.---- how many symbols? 0xc7
0x00000158 |c700 0000 0000 0000 0000 0000 0104 0000| ................
0x00000168 |250b e803 0000 0100 0000 0000 bd55 0000| %............U..
0x00000178 |91bb e903 e35a b42c 93a4 340a 8746 9489| .....Z.,..4..F..
0x00000188 |0cea 4c40 0c00 0000 0900 0000 0000 0000| ..L@............
0x00000198 |0000 0000 0000 0000 0000 0000 0000 0000| ................
0x000001a8 |0080 0000 0000 0000 5f5f 5445 5854 0000| ........__TEXT..
0x000001b8 |0000 0000 0000 0000 0080 0000 0000 0000| ................
0x000001c8 |0040 0000 0000 0000 5f5f 4441 5441 0000| .@......__DATA..
0x000001d8 |0000 0000 0000 0000 00c0 0000 0000 0000| ................
0x000001e8 |0000 0100 0000 0000 5f5f 4c4c 564d 0000| ........__LLVM..
0x000001f8 |0000 0000 0000 0000 00c0 0100 0000 0000| ................
0x00000208 |00c0 0000 0000 0000 5f5f 4c49 4e4b 4544| ........__LINKED
0x00000218 |4954 0000 0000 0000 0000 0000 d069 0000| IT...........i..
#endif
// eprintf ("Dragon's magic:\n");
int magicCombo = 0;
if (!memcmp ("\x1a\x2b\xb2\xa1", b, 4)) { // 0x130 ?
magicCombo++;
}
if (!memcmp ("\x1a\x2b\xb2\xa1", b + 8, 4)) {
magicCombo++;
}
if (magicCombo != 2) {
// hack for C22F7494
available = r_buf_read_at (buf, off - 8, b, size);
if (available != size) {
eprintf ("Warning: r_buf_read_at failed\n");
return NULL;
}
if (!memcmp ("\x1a\x2b\xb2\xa1", b, 4)) { // 0x130 ?
off -= 8;
} else {
eprintf ("0x%08x parsing error: invalid magic retry\n", off);
}
}
D eprintf ("0x%08x magic OK\n", off);
D {
const int e0ss = r_read_le32 (b + 12);
eprintf ("0x%08x eoss 0x%x\n", off + 12, e0ss);
}
free (b);
return r_coresym_cache_element_new (bf, buf, off + 16, bits, file_name);
}
| 1
|
210,206
|
gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
{
char *pos = inbuf;
char *lpos = NULL;
char *tline = NULL;
LOCAL_ARRAY(char, line, TEMP_BUF_SIZE);
LOCAL_ARRAY(char, tmpbuf, TEMP_BUF_SIZE);
char *name = NULL;
char *selector = NULL;
char *host = NULL;
char *port = NULL;
char *escaped_selector = NULL;
const char *icon_url = NULL;
char gtype;
StoreEntry *entry = NULL;
memset(tmpbuf, '\0', TEMP_BUF_SIZE);
memset(line, '\0', TEMP_BUF_SIZE);
entry = gopherState->entry;
if (gopherState->conversion == GopherStateData::HTML_INDEX_PAGE) {
char *html_url = html_quote(entry->url());
gopherHTMLHeader(entry, "Gopher Index %s", html_url);
storeAppendPrintf(entry,
"<p>This is a searchable Gopher index. Use the search\n"
"function of your browser to enter search terms.\n"
"<ISINDEX>\n");
gopherHTMLFooter(entry);
/* now let start sending stuff to client */
entry->flush();
gopherState->HTML_header_added = 1;
return;
}
if (gopherState->conversion == GopherStateData::HTML_CSO_PAGE) {
char *html_url = html_quote(entry->url());
gopherHTMLHeader(entry, "CSO Search of %s", html_url);
storeAppendPrintf(entry,
"<P>A CSO database usually contains a phonebook or\n"
"directory. Use the search function of your browser to enter\n"
"search terms.</P><ISINDEX>\n");
gopherHTMLFooter(entry);
/* now let start sending stuff to client */
entry->flush();
gopherState->HTML_header_added = 1;
return;
}
String outbuf;
if (!gopherState->HTML_header_added) {
if (gopherState->conversion == GopherStateData::HTML_CSO_RESULT)
gopherHTMLHeader(entry, "CSO Search Result", NULL);
else
gopherHTMLHeader(entry, "Gopher Menu", NULL);
outbuf.append ("<PRE>");
gopherState->HTML_header_added = 1;
gopherState->HTML_pre = 1;
}
while (pos < inbuf + len) {
int llen;
int left = len - (pos - inbuf);
lpos = (char *)memchr(pos, '\n', left);
if (lpos) {
++lpos; /* Next line is after \n */
llen = lpos - pos;
} else {
llen = left;
}
if (gopherState->len + llen >= TEMP_BUF_SIZE) {
debugs(10, DBG_IMPORTANT, "GopherHTML: Buffer overflow. Lost some data on URL: " << entry->url() );
llen = TEMP_BUF_SIZE - gopherState->len - 1;
}
if (!lpos) {
/* there is no complete line in inbuf */
/* copy it to temp buffer */
/* note: llen is adjusted above */
memcpy(gopherState->buf + gopherState->len, pos, llen);
gopherState->len += llen;
break;
}
if (gopherState->len != 0) {
/* there is something left from last tx. */
memcpy(line, gopherState->buf, gopherState->len);
memcpy(line + gopherState->len, pos, llen);
llen += gopherState->len;
gopherState->len = 0;
} else {
memcpy(line, pos, llen);
}
line[llen + 1] = '\0';
/* move input to next line */
pos = lpos;
/* at this point. We should have one line in buffer to process */
if (*line == '.') {
/* skip it */
memset(line, '\0', TEMP_BUF_SIZE);
continue;
}
switch (gopherState->conversion) {
case GopherStateData::HTML_INDEX_RESULT:
case GopherStateData::HTML_DIR: {
tline = line;
gtype = *tline;
++tline;
name = tline;
selector = strchr(tline, TAB);
if (selector) {
*selector = '\0';
++selector;
host = strchr(selector, TAB);
if (host) {
*host = '\0';
++host;
port = strchr(host, TAB);
if (port) {
char *junk;
port[0] = ':';
junk = strchr(host, TAB);
if (junk)
*junk++ = 0; /* Chop port */
else {
junk = strchr(host, '\r');
if (junk)
*junk++ = 0; /* Chop port */
else {
junk = strchr(host, '\n');
if (junk)
*junk++ = 0; /* Chop port */
}
}
if ((port[1] == '0') && (!port[2]))
port[0] = 0; /* 0 means none */
}
/* escape a selector here */
escaped_selector = xstrdup(rfc1738_escape_part(selector));
switch (gtype) {
case GOPHER_DIRECTORY:
icon_url = mimeGetIconURL("internal-menu");
break;
case GOPHER_HTML:
case GOPHER_FILE:
icon_url = mimeGetIconURL("internal-text");
break;
case GOPHER_INDEX:
case GOPHER_CSO:
icon_url = mimeGetIconURL("internal-index");
break;
case GOPHER_IMAGE:
case GOPHER_GIF:
case GOPHER_PLUS_IMAGE:
icon_url = mimeGetIconURL("internal-image");
break;
case GOPHER_SOUND:
case GOPHER_PLUS_SOUND:
icon_url = mimeGetIconURL("internal-sound");
break;
case GOPHER_PLUS_MOVIE:
icon_url = mimeGetIconURL("internal-movie");
break;
case GOPHER_TELNET:
case GOPHER_3270:
icon_url = mimeGetIconURL("internal-telnet");
break;
case GOPHER_BIN:
case GOPHER_MACBINHEX:
case GOPHER_DOSBIN:
case GOPHER_UUENCODED:
icon_url = mimeGetIconURL("internal-binary");
break;
case GOPHER_INFO:
icon_url = NULL;
break;
default:
icon_url = mimeGetIconURL("internal-unknown");
break;
}
memset(tmpbuf, '\0', TEMP_BUF_SIZE);
if ((gtype == GOPHER_TELNET) || (gtype == GOPHER_3270)) {
if (strlen(escaped_selector) != 0)
snprintf(tmpbuf, TEMP_BUF_SIZE, "<IMG border=\"0\" SRC=\"%s\"> <A HREF=\"telnet://%s@%s%s%s/\">%s</A>\n",
icon_url, escaped_selector, rfc1738_escape_part(host),
*port ? ":" : "", port, html_quote(name));
else
snprintf(tmpbuf, TEMP_BUF_SIZE, "<IMG border=\"0\" SRC=\"%s\"> <A HREF=\"telnet://%s%s%s/\">%s</A>\n",
icon_url, rfc1738_escape_part(host), *port ? ":" : "",
port, html_quote(name));
} else if (gtype == GOPHER_INFO) {
snprintf(tmpbuf, TEMP_BUF_SIZE, "\t%s\n", html_quote(name));
} else {
if (strncmp(selector, "GET /", 5) == 0) {
/* WWW link */
snprintf(tmpbuf, TEMP_BUF_SIZE, "<IMG border=\"0\" SRC=\"%s\"> <A HREF=\"http://%s/%s\">%s</A>\n",
icon_url, host, rfc1738_escape_unescaped(selector + 5), html_quote(name));
} else {
/* Standard link */
snprintf(tmpbuf, TEMP_BUF_SIZE, "<IMG border=\"0\" SRC=\"%s\"> <A HREF=\"gopher://%s/%c%s\">%s</A>\n",
icon_url, host, gtype, escaped_selector, html_quote(name));
}
}
safe_free(escaped_selector);
outbuf.append(tmpbuf);
} else {
memset(line, '\0', TEMP_BUF_SIZE);
continue;
}
} else {
memset(line, '\0', TEMP_BUF_SIZE);
continue;
}
break;
} /* HTML_DIR, HTML_INDEX_RESULT */
case GopherStateData::HTML_CSO_RESULT: {
if (line[0] == '-') {
int code, recno;
char *s_code, *s_recno, *result;
s_code = strtok(line + 1, ":\n");
s_recno = strtok(NULL, ":\n");
result = strtok(NULL, "\n");
if (!result)
break;
code = atoi(s_code);
recno = atoi(s_recno);
if (code != 200)
break;
if (gopherState->cso_recno != recno) {
snprintf(tmpbuf, TEMP_BUF_SIZE, "</PRE><HR noshade size=\"1px\"><H2>Record# %d<br><i>%s</i></H2>\n<PRE>", recno, html_quote(result));
gopherState->cso_recno = recno;
} else {
snprintf(tmpbuf, TEMP_BUF_SIZE, "%s\n", html_quote(result));
}
outbuf.append(tmpbuf);
break;
} else {
int code;
char *s_code, *result;
s_code = strtok(line, ":");
result = strtok(NULL, "\n");
if (!result)
break;
code = atoi(s_code);
switch (code) {
case 200: {
/* OK */
/* Do nothing here */
break;
}
case 102: /* Number of matches */
case 501: /* No Match */
case 502: { /* Too Many Matches */
/* Print the message the server returns */
snprintf(tmpbuf, TEMP_BUF_SIZE, "</PRE><HR noshade size=\"1px\"><H2>%s</H2>\n<PRE>", html_quote(result));
outbuf.append(tmpbuf);
break;
}
}
}
} /* HTML_CSO_RESULT */
default:
break; /* do nothing */
} /* switch */
} /* while loop */
if (outbuf.size() > 0) {
entry->append(outbuf.rawBuf(), outbuf.size());
/* now let start sending stuff to client */
entry->flush();
}
outbuf.clean();
return;
}
| 1
|
309,978
|
can_change_color(void)
{
return NCURSES_SP_NAME(can_change_color) (CURRENT_SCREEN);
}
| 0
|
231,059
|
void vQueueUnregisterQueue( QueueHandle_t xQueue )
{
UBaseType_t ux;
/* See if the handle of the queue being unregistered in actually in the
* registry. */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
{
if( xQueueRegistry[ ux ].xHandle == xQueue )
{
/* Set the name to NULL to show that this slot if free again. */
xQueueRegistry[ ux ].pcQueueName = NULL;
/* Set the handle to NULL to ensure the same queue handle cannot
* appear in the registry twice if it is added, removed, then
* added again. */
xQueueRegistry[ ux ].xHandle = ( QueueHandle_t ) 0;
break;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */
| 0
|
437,282
|
noname_disable_map(Node** plink, GroupNumRemap* map, int* counter)
{
int r = 0;
Node* node = *plink;
switch (NODE_TYPE(node)) {
case NODE_LIST:
case NODE_ALT:
do {
r = noname_disable_map(&(NODE_CAR(node)), map, counter);
} while (r == 0 && IS_NOT_NULL(node = NODE_CDR(node)));
break;
case NODE_QUANT:
{
Node** ptarget = &(NODE_BODY(node));
Node* old = *ptarget;
r = noname_disable_map(ptarget, map, counter);
if (*ptarget != old && NODE_TYPE(*ptarget) == NODE_QUANT) {
onig_reduce_nested_quantifier(node, *ptarget);
}
}
break;
case NODE_ENCLOSURE:
{
EnclosureNode* en = ENCLOSURE_(node);
if (en->type == ENCLOSURE_MEMORY) {
if (NODE_IS_NAMED_GROUP(node)) {
(*counter)++;
map[en->m.regnum].new_val = *counter;
en->m.regnum = *counter;
r = noname_disable_map(&(NODE_BODY(node)), map, counter);
}
else {
*plink = NODE_BODY(node);
NODE_BODY(node) = NULL_NODE;
onig_node_free(node);
r = noname_disable_map(plink, map, counter);
}
}
else if (en->type == ENCLOSURE_IF_ELSE) {
r = noname_disable_map(&(NODE_ENCLOSURE_BODY(en)), map, counter);
if (r != 0) return r;
if (IS_NOT_NULL(en->te.Then)) {
r = noname_disable_map(&(en->te.Then), map, counter);
if (r != 0) return r;
}
if (IS_NOT_NULL(en->te.Else)) {
r = noname_disable_map(&(en->te.Else), map, counter);
if (r != 0) return r;
}
}
else
r = noname_disable_map(&(NODE_BODY(node)), map, counter);
}
break;
case NODE_ANCHOR:
if (IS_NOT_NULL(NODE_BODY(node)))
r = noname_disable_map(&(NODE_BODY(node)), map, counter);
break;
default:
break;
}
return r;
}
| 0
|
231,762
|
TEST_F(
QuicServerTransportForciblySetUDUPayloadSizeTest,
TestHandleTransportKnobParamForciblySetUDPPayloadSize) {
EXPECT_LT(server->getConn().udpSendPacketLen, 1452);
server->handleKnobParams(
{{static_cast<uint64_t>(
TransportKnobParamId::FORCIBLY_SET_UDP_PAYLOAD_SIZE),
1}});
EXPECT_EQ(server->getConn().udpSendPacketLen, 1452);
}
| 0
|
252,424
|
static void DecodeTiledPixelData(
unsigned char **out_images, int *width, int *height,
const int *requested_pixel_types, const unsigned char *data_ptr,
size_t data_len, int compression_type, int line_order, int data_width,
int data_height, int tile_offset_x, int tile_offset_y, int tile_size_x,
int tile_size_y, size_t pixel_data_size, size_t num_attributes,
const EXRAttribute *attributes, size_t num_channels,
const EXRChannelInfo *channels,
const std::vector<size_t> &channel_offset_list) {
assert(tile_offset_x * tile_size_x < data_width);
assert(tile_offset_y * tile_size_y < data_height);
// Compute actual image size in a tile.
if ((tile_offset_x + 1) * tile_size_x >= data_width) {
(*width) = data_width - (tile_offset_x * tile_size_x);
} else {
(*width) = tile_size_x;
}
if ((tile_offset_y + 1) * tile_size_y >= data_height) {
(*height) = data_height - (tile_offset_y * tile_size_y);
} else {
(*height) = tile_size_y;
}
// Image size = tile size.
DecodePixelData(out_images, requested_pixel_types, data_ptr, data_len,
compression_type, line_order, (*width), tile_size_y,
/* stride */ tile_size_x, /* y */ 0, /* line_no */ 0,
(*height), pixel_data_size, num_attributes, attributes,
num_channels, channels, channel_offset_list);
}
| 0
|
483,498
|
static int __init fdt_find_uefi_params(unsigned long node, const char *uname,
int depth, void *data)
{
struct param_info *info = data;
int i;
for (i = 0; i < ARRAY_SIZE(dt_params); i++) {
const char *subnode = dt_params[i].subnode;
if (depth != 1 || strcmp(uname, dt_params[i].uname) != 0) {
info->missing = dt_params[i].params[0].name;
continue;
}
if (subnode) {
int err = of_get_flat_dt_subnode_by_name(node, subnode);
if (err < 0)
return 0;
node = err;
}
return __find_uefi_params(node, info, dt_params[i].params);
}
return 0;
}
| 0
|
333,499
|
gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsigned int src_height, const gdImagePtr dst, const unsigned int new_width, const unsigned int new_height)
{
gdImagePtr tmp_im;
if (new_width == 0 || new_height == 0) {
return NULL;
}
tmp_im = gdImageCreateTrueColor(new_width, src_height);
if (tmp_im == NULL) {
return NULL;
}
gdImageSetInterpolationMethod(tmp_im, src->interpolation_id);
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
gdImageDestroy(tmp_im);
return dst;
}
| 0
|
238,464
|
static const char *disasm_kfunc_name(void *data, const struct bpf_insn *insn)
{
const struct btf_type *func;
struct btf *desc_btf;
if (insn->src_reg != BPF_PSEUDO_KFUNC_CALL)
return NULL;
desc_btf = find_kfunc_desc_btf(data, insn->imm, insn->off, NULL);
if (IS_ERR(desc_btf))
return "<error>";
func = btf_type_by_id(desc_btf, insn->imm);
return btf_name_by_offset(desc_btf, func->name_off);
}
| 0
|
225,858
|
GF_Box *reftype_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_TrackReferenceTypeBox, GF_ISOM_BOX_TYPE_REFT);
return (GF_Box *)tmp;
| 0
|
309,935
|
stripped(char *src)
{
char *dst = 0;
while (isspace(UChar(*src)))
src++;
if (*src != '\0') {
size_t len;
if ((dst = strdup(src)) == NULL) {
failed("strdup");
} else {
len = strlen(dst);
while (--len != 0 && isspace(UChar(dst[len])))
dst[len] = '\0';
}
}
return dst;
}
| 0
|
514,308
|
void multi_update::prepare_to_read_rows()
{
/*
update column maps now. it cannot be done in ::prepare() before the
optimizer, because the optimize might reset them (in
SELECT_LEX::update_used_tables()), it cannot be done in
::initialize_tables() after the optimizer, because the optimizer
might read rows from const tables
*/
for (TABLE_LIST *tl= update_tables; tl; tl= tl->next_local)
tl->table->mark_columns_needed_for_update();
}
| 0
|
234,819
|
static struct btrfs_device * btrfs_find_next_active_device(
struct btrfs_fs_devices *fs_devs, struct btrfs_device *device)
{
struct btrfs_device *next_device;
list_for_each_entry(next_device, &fs_devs->devices, dev_list) {
if (next_device != device &&
!test_bit(BTRFS_DEV_STATE_MISSING, &next_device->dev_state)
&& next_device->bdev)
return next_device;
}
return NULL;
}
| 0
|
226,430
|
Status AsGraphDefInternal(SerializationContext* ctx,
DatasetGraphDefBuilder* b,
Node** output) const override {
Node* indices_node;
TF_RETURN_IF_ERROR(b->AddTensor(sparse_tensor_.indices(), &indices_node));
Node* value_node;
TF_RETURN_IF_ERROR(b->AddTensor(sparse_tensor_.values(), &value_node));
Node* dense_shape_node;
std::vector<int64_t> dense_shape;
dense_shape.reserve(sparse_tensor_.shape().size());
for (int i = 0; i < sparse_tensor_.shape().size(); i++)
dense_shape.emplace_back(sparse_tensor_.shape()[i]);
TF_RETURN_IF_ERROR(b->AddVector(dense_shape, &dense_shape_node));
AttrValue val_dtype;
b->BuildAttrValue(sparse_tensor_.dtype(), &val_dtype);
TF_RETURN_IF_ERROR(
b->AddDataset(this, {indices_node, value_node, dense_shape_node},
{{"Tvalues", val_dtype}}, output));
return Status::OK();
}
| 0
|
301,354
|
static int vfswrap_fchown(vfs_handle_struct *handle, files_struct *fsp, uid_t uid, gid_t gid)
{
#ifdef HAVE_FCHOWN
int result;
START_PROFILE(syscall_fchown);
result = fchown(fsp->fh->fd, uid, gid);
END_PROFILE(syscall_fchown);
return result;
#else
errno = ENOSYS;
return -1;
#endif
}
| 0
|
445,972
|
fr_window_set_dialog (FrWindow *window,
const char *dialog_name,
GtkWidget *dialog)
{
g_object_set_data (G_OBJECT (dialog), DIALOG_NAME_KEY, (gpointer) _g_str_get_static (dialog_name));
g_hash_table_insert (window->priv->named_dialogs, (gpointer) dialog_name, dialog);
g_signal_connect (dialog,
"destroy",
G_CALLBACK (unset_dialog),
window);
}
| 0
|
301,436
|
static int vfswrap_chflags(vfs_handle_struct *handle, const char *path,
unsigned int flags)
{
#ifdef HAVE_CHFLAGS
return chflags(path, flags);
#else
errno = ENOSYS;
return -1;
#endif
}
| 0
|
401,519
|
bool rng_is_initialized(void)
{
return crng_ready();
}
| 0
|
248,247
|
DLLIMPORT int cfg_opt_rmtsec(cfg_opt_t *opt, const char *title)
{
unsigned int i, n;
if (!opt || !title) {
errno = EINVAL;
return CFG_FAIL;
}
if (!is_set(CFGF_TITLE, opt->flags))
return CFG_FAIL;
n = cfg_opt_size(opt);
for (i = 0; i < n; i++) {
cfg_t *sec = cfg_opt_getnsec(opt, i);
if (!sec || !sec->title)
return CFG_FAIL;
if (is_set(CFGF_NOCASE, opt->flags)) {
if (strcasecmp(title, sec->title) == 0)
break;
} else {
if (strcmp(title, sec->title) == 0)
break;
}
}
if (i == n)
return CFG_FAIL;
return cfg_opt_rmnsec(opt, i);
}
| 0
|
195,026
|
nfs4_file_open(struct inode *inode, struct file *filp)
{
struct nfs_open_context *ctx;
struct dentry *dentry = file_dentry(filp);
struct dentry *parent = NULL;
struct inode *dir;
unsigned openflags = filp->f_flags;
struct iattr attr;
int err;
/*
* If no cached dentry exists or if it's negative, NFSv4 handled the
* opens in ->lookup() or ->create().
*
* We only get this far for a cached positive dentry. We skipped
* revalidation, so handle it here by dropping the dentry and returning
* -EOPENSTALE. The VFS will retry the lookup/create/open.
*/
dprintk("NFS: open file(%pd2)\n", dentry);
err = nfs_check_flags(openflags);
if (err)
return err;
if ((openflags & O_ACCMODE) == 3)
return nfs_open(inode, filp);
/* We can't create new files here */
openflags &= ~(O_CREAT|O_EXCL);
parent = dget_parent(dentry);
dir = d_inode(parent);
ctx = alloc_nfs_open_context(file_dentry(filp), filp->f_mode, filp);
err = PTR_ERR(ctx);
if (IS_ERR(ctx))
goto out;
attr.ia_valid = ATTR_OPEN;
if (openflags & O_TRUNC) {
attr.ia_valid |= ATTR_SIZE;
attr.ia_size = 0;
filemap_write_and_wait(inode->i_mapping);
}
inode = NFS_PROTO(dir)->open_context(dir, ctx, openflags, &attr, NULL);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
switch (err) {
default:
goto out_put_ctx;
case -ENOENT:
case -ESTALE:
case -EISDIR:
case -ENOTDIR:
case -ELOOP:
goto out_drop;
}
}
if (inode != d_inode(dentry))
goto out_drop;
nfs_file_set_open_context(filp, ctx);
nfs_fscache_open_file(inode, filp);
err = 0;
out_put_ctx:
put_nfs_open_context(ctx);
out:
dput(parent);
return err;
out_drop:
d_drop(dentry);
err = -EOPENSTALE;
goto out_put_ctx;
}
| 1
|
402,626
|
generate_signed_attributes(cms_context *cms, SECItem *sattrs)
{
Attribute *attrs[5];
memset(attrs, '\0', sizeof (attrs));
SECItem encoded;
SECOidTag tag;
SECOidData *oid;
/* build the first attribute, which says we have no S/MIME
* capabilities whatsoever */
attrs[0] = PORT_ArenaZAlloc(cms->arena, sizeof (Attribute));
if (!attrs[0])
goto err;
oid = SECOID_FindOIDByTag(SEC_OID_PKCS9_SMIME_CAPABILITIES);
attrs[0]->attrType = oid->oid;
SECItem *smime_caps[2] = { NULL, NULL};
if (generate_empty_sequence(cms, &encoded) < 0)
goto err;
smime_caps[0] = SECITEM_ArenaDupItem(cms->arena, &encoded);
attrs[0]->attrValues = smime_caps;
/* build the second attribute, which says that this is
* a PKCS9 content blob thingy */
attrs[1] = PORT_ArenaZAlloc(cms->arena, sizeof (Attribute));
if (!attrs[1])
goto err;
oid = SECOID_FindOIDByTag(SEC_OID_PKCS9_CONTENT_TYPE);
attrs[1]->attrType = oid->oid;
SECItem *content_types[2] = { NULL, NULL };
tag = find_ms_oid_tag(SPC_INDIRECT_DATA_OBJID);
if (tag == SEC_OID_UNKNOWN)
goto err;
if (generate_object_id(cms, &encoded, tag) < 0)
goto err;
content_types[0] = SECITEM_ArenaDupItem(cms->arena, &encoded);
if (!content_types[0])
goto err;
attrs[1]->attrValues = content_types;
/* build the third attribute. This is our signing time. */
attrs[2] = PORT_ArenaZAlloc(cms->arena, sizeof (Attribute));
if (!attrs[2])
goto err;
oid = SECOID_FindOIDByTag(SEC_OID_PKCS9_SIGNING_TIME);
attrs[2]->attrType = oid->oid;
SECItem *signing_time[2] = { NULL, NULL };
if (generate_time(cms, &encoded, time(NULL)) < 0)
goto err;
signing_time[0] = SECITEM_ArenaDupItem(cms->arena, &encoded);
if (!signing_time[0])
goto err;
attrs[2]->attrValues = signing_time;
/* build the fourth attribute, which is our PKCS9 message
* digest (which is a SHA-whatever selected and generated elsewhere */
attrs[3] = PORT_ArenaZAlloc(cms->arena, sizeof (Attribute));
if (!attrs[3])
goto err;
oid = SECOID_FindOIDByTag(SEC_OID_PKCS9_MESSAGE_DIGEST);
attrs[3]->attrType = oid->oid;
SECItem *digest_values[2] = { NULL, NULL };
if (generate_octet_string(cms, &encoded, cms->ci_digest) < 0)
goto err;
digest_values[0] = SECITEM_ArenaDupItem(cms->arena, &encoded);
if (!digest_values[0])
goto err;
attrs[3]->attrValues = digest_values;
Attribute **attrtmp = attrs;
if (SEC_ASN1EncodeItem(cms->arena, sattrs, &attrtmp,
AttributeSetTemplate) == NULL)
goto err;
return 0;
err:
return -1;
}
| 0
|
457,876
|
load_cache (GeglProperties *op_magick_load)
{
if (!op_magick_load->user_data)
{
gchar *filename;
GeglNode *graph, *sink, *loader;
GeglBuffer *newbuf = NULL;
/* ImageMagick backed fallback FIXME: make this robust.
* maybe use pipes in a manner similar to the raw loader,
* or at least use a properly unique filename */
char *argv[4] = {"convert", NULL, NULL, NULL};
filename = g_build_filename (g_get_tmp_dir (), "gegl-magick.png", NULL);
argv[1] = g_strdup_printf ("%s[0]", op_magick_load->path);
argv[2] = filename;
if (!g_spawn_sync (NULL, argv, NULL, G_SPAWN_DEFAULT,
NULL, NULL, NULL, NULL, NULL, NULL))
g_warning ("Error executing ImageMagick convert program");
g_free (argv[1]);
graph = gegl_node_new ();
sink = gegl_node_new_child (graph,
"operation", "gegl:buffer-sink",
"buffer", &newbuf, NULL);
loader = gegl_node_new_child (graph,
"operation", "gegl:png-load",
"path", filename, NULL);
gegl_node_link_many (loader, sink, NULL);
gegl_node_process (sink);
op_magick_load->user_data = (gpointer) newbuf;
g_object_unref (graph);
g_free (filename);
}
}
| 0
|
202,748
|
static Image *ReadTGAImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
Image
*image;
MagickBooleanType
status;
PixelInfo
pixel;
Quantum
index;
register Quantum
*q;
register ssize_t
i,
x;
size_t
base,
flag,
offset,
real,
skip;
ssize_t
count,
y;
TGAInfo
tga_info;
unsigned char
j,
k,
pixels[4],
runlength;
unsigned int
alpha_bits;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Read TGA header information.
*/
count=ReadBlob(image,1,&tga_info.id_length);
tga_info.colormap_type=(unsigned char) ReadBlobByte(image);
tga_info.image_type=(TGAImageType) ReadBlobByte(image);
if ((count != 1) ||
((tga_info.image_type != TGAColormap) &&
(tga_info.image_type != TGARGB) &&
(tga_info.image_type != TGAMonochrome) &&
(tga_info.image_type != TGARLEColormap) &&
(tga_info.image_type != TGARLERGB) &&
(tga_info.image_type != TGARLEMonochrome)) ||
(((tga_info.image_type == TGAColormap) ||
(tga_info.image_type == TGARLEColormap)) &&
(tga_info.colormap_type == 0)))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
tga_info.colormap_index=ReadBlobLSBShort(image);
tga_info.colormap_length=ReadBlobLSBShort(image);
tga_info.colormap_size=(unsigned char) ReadBlobByte(image);
tga_info.x_origin=ReadBlobLSBShort(image);
tga_info.y_origin=ReadBlobLSBShort(image);
tga_info.width=(unsigned short) ReadBlobLSBShort(image);
tga_info.height=(unsigned short) ReadBlobLSBShort(image);
tga_info.bits_per_pixel=(unsigned char) ReadBlobByte(image);
tga_info.attributes=(unsigned char) ReadBlobByte(image);
if (EOFBlob(image) != MagickFalse)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
if ((((tga_info.bits_per_pixel <= 1) || (tga_info.bits_per_pixel >= 17)) &&
(tga_info.bits_per_pixel != 24) && (tga_info.bits_per_pixel != 32)))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
/*
Initialize image structure.
*/
image->columns=tga_info.width;
image->rows=tga_info.height;
alpha_bits=(tga_info.attributes & 0x0FU);
image->alpha_trait=(alpha_bits > 0) || (tga_info.bits_per_pixel == 32) ||
(tga_info.colormap_size == 32) ? BlendPixelTrait : UndefinedPixelTrait;
if ((tga_info.image_type != TGAColormap) &&
(tga_info.image_type != TGARLEColormap))
image->depth=(size_t) ((tga_info.bits_per_pixel <= 8) ? 8 :
(tga_info.bits_per_pixel <= 16) ? 5 : 8);
else
image->depth=(size_t) ((tga_info.colormap_size <= 8) ? 8 :
(tga_info.colormap_size <= 16) ? 5 : 8);
if ((tga_info.image_type == TGAColormap) ||
(tga_info.image_type == TGAMonochrome) ||
(tga_info.image_type == TGARLEColormap) ||
(tga_info.image_type == TGARLEMonochrome))
image->storage_class=PseudoClass;
image->compression=NoCompression;
if ((tga_info.image_type == TGARLEColormap) ||
(tga_info.image_type == TGARLEMonochrome) ||
(tga_info.image_type == TGARLERGB))
image->compression=RLECompression;
if (image->storage_class == PseudoClass)
{
if (tga_info.colormap_type != 0)
image->colors=tga_info.colormap_index+tga_info.colormap_length;
else
{
size_t
one;
one=1;
image->colors=one << tga_info.bits_per_pixel;
if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
}
if (tga_info.id_length != 0)
{
char
*comment;
size_t
length;
/*
TGA image comment.
*/
length=(size_t) tga_info.id_length;
comment=(char *) NULL;
if (~length >= (MagickPathExtent-1))
comment=(char *) AcquireQuantumMemory(length+MagickPathExtent,
sizeof(*comment));
if (comment == (char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
count=ReadBlob(image,tga_info.id_length,(unsigned char *) comment);
comment[tga_info.id_length]='\0';
(void) SetImageProperty(image,"comment",comment,exception);
comment=DestroyString(comment);
}
if (tga_info.attributes & (1UL << 4))
{
if (tga_info.attributes & (1UL << 5))
SetImageArtifact(image,"tga:image-origin","TopRight");
else
SetImageArtifact(image,"tga:image-origin","BottomRight");
}
else
{
if (tga_info.attributes & (1UL << 5))
SetImageArtifact(image,"tga:image-origin","TopLeft");
else
SetImageArtifact(image,"tga:image-origin","BottomLeft");
}
if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
return(image);
}
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
(void) ResetMagickMemory(&pixel,0,sizeof(pixel));
pixel.alpha=(MagickRealType) OpaqueAlpha;
if (tga_info.colormap_type != 0)
{
/*
Read TGA raster colormap.
*/
if (image->colors < tga_info.colormap_index)
image->colors=tga_info.colormap_index;
if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
for (i=0; i < (ssize_t) tga_info.colormap_index; i++)
image->colormap[i]=pixel;
for ( ; i < (ssize_t) image->colors; i++)
{
switch (tga_info.colormap_size)
{
case 8:
default:
{
/*
Gray scale.
*/
pixel.red=(MagickRealType) ScaleCharToQuantum((unsigned char)
ReadBlobByte(image));
pixel.green=pixel.red;
pixel.blue=pixel.red;
break;
}
case 15:
case 16:
{
QuantumAny
range;
/*
5 bits each of red green and blue.
*/
j=(unsigned char) ReadBlobByte(image);
k=(unsigned char) ReadBlobByte(image);
range=GetQuantumRange(5UL);
pixel.red=(MagickRealType) ScaleAnyToQuantum(1UL*(k & 0x7c) >> 2,
range);
pixel.green=(MagickRealType) ScaleAnyToQuantum((1UL*(k & 0x03)
<< 3)+(1UL*(j & 0xe0) >> 5),range);
pixel.blue=(MagickRealType) ScaleAnyToQuantum(1UL*(j & 0x1f),range);
break;
}
case 24:
{
/*
8 bits each of blue, green and red.
*/
pixel.blue=(MagickRealType) ScaleCharToQuantum((unsigned char)
ReadBlobByte(image));
pixel.green=(MagickRealType) ScaleCharToQuantum((unsigned char)
ReadBlobByte(image));
pixel.red=(MagickRealType) ScaleCharToQuantum((unsigned char)
ReadBlobByte(image));
break;
}
case 32:
{
/*
8 bits each of blue, green, red, and alpha.
*/
pixel.blue=(MagickRealType) ScaleCharToQuantum((unsigned char)
ReadBlobByte(image));
pixel.green=(MagickRealType) ScaleCharToQuantum((unsigned char)
ReadBlobByte(image));
pixel.red=(MagickRealType) ScaleCharToQuantum((unsigned char)
ReadBlobByte(image));
pixel.alpha=(MagickRealType) ScaleCharToQuantum((unsigned char)
ReadBlobByte(image));
break;
}
}
image->colormap[i]=pixel;
}
}
/*
Convert TGA pixels to pixel packets.
*/
base=0;
flag=0;
skip=MagickFalse;
real=0;
index=0;
runlength=0;
offset=0;
for (y=0; y < (ssize_t) image->rows; y++)
{
real=offset;
if (((unsigned char) (tga_info.attributes & 0x20) >> 5) == 0)
real=image->rows-real-1;
q=QueueAuthenticPixels(image,0,(ssize_t) real,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
if ((tga_info.image_type == TGARLEColormap) ||
(tga_info.image_type == TGARLERGB) ||
(tga_info.image_type == TGARLEMonochrome))
{
if (runlength != 0)
{
runlength--;
skip=flag != 0;
}
else
{
count=ReadBlob(image,1,&runlength);
if (count != 1)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
flag=runlength & 0x80;
if (flag != 0)
runlength-=128;
skip=MagickFalse;
}
}
if (skip == MagickFalse)
switch (tga_info.bits_per_pixel)
{
case 8:
default:
{
/*
Gray scale.
*/
index=(Quantum) ReadBlobByte(image);
if (tga_info.colormap_type != 0)
pixel=image->colormap[(ssize_t) ConstrainColormapIndex(image,
(ssize_t) index,exception)];
else
{
pixel.red=(MagickRealType) ScaleCharToQuantum((unsigned char)
index);
pixel.green=(MagickRealType) ScaleCharToQuantum((unsigned char)
index);
pixel.blue=(MagickRealType) ScaleCharToQuantum((unsigned char)
index);
}
break;
}
case 15:
case 16:
{
QuantumAny
range;
/*
5 bits each of RGB.
*/
if (ReadBlob(image,2,pixels) != 2)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
j=pixels[0];
k=pixels[1];
range=GetQuantumRange(5UL);
pixel.red=(MagickRealType) ScaleAnyToQuantum(1UL*(k & 0x7c) >> 2,
range);
pixel.green=(MagickRealType) ScaleAnyToQuantum((1UL*
(k & 0x03) << 3)+(1UL*(j & 0xe0) >> 5),range);
pixel.blue=(MagickRealType) ScaleAnyToQuantum(1UL*(j & 0x1f),range);
if (image->alpha_trait != UndefinedPixelTrait)
pixel.alpha=(MagickRealType) ((k & 0x80) == 0 ? (Quantum)
TransparentAlpha : (Quantum) OpaqueAlpha);
if (image->storage_class == PseudoClass)
index=(Quantum) ConstrainColormapIndex(image,((ssize_t) (k << 8))+
j,exception);
break;
}
case 24:
{
/*
BGR pixels.
*/
if (ReadBlob(image,3,pixels) != 3)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
pixel.blue=(MagickRealType) ScaleCharToQuantum(pixels[0]);
pixel.green=(MagickRealType) ScaleCharToQuantum(pixels[1]);
pixel.red=(MagickRealType) ScaleCharToQuantum(pixels[2]);
break;
}
case 32:
{
/*
BGRA pixels.
*/
if (ReadBlob(image,4,pixels) != 4)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
pixel.blue=(MagickRealType) ScaleCharToQuantum(pixels[0]);
pixel.green=(MagickRealType) ScaleCharToQuantum(pixels[1]);
pixel.red=(MagickRealType) ScaleCharToQuantum(pixels[2]);
pixel.alpha=(MagickRealType) ScaleCharToQuantum(pixels[3]);
break;
}
}
if (status == MagickFalse)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
if (image->storage_class == PseudoClass)
SetPixelIndex(image,index,q);
SetPixelRed(image,ClampToQuantum(pixel.red),q);
SetPixelGreen(image,ClampToQuantum(pixel.green),q);
SetPixelBlue(image,ClampToQuantum(pixel.blue),q);
if (image->alpha_trait != UndefinedPixelTrait)
SetPixelAlpha(image,ClampToQuantum(pixel.alpha),q);
q+=GetPixelChannels(image);
}
/*
if (((unsigned char) (tga_info.attributes & 0xc0) >> 6) == 4)
offset+=4;
else
*/
if (((unsigned char) (tga_info.attributes & 0xc0) >> 6) == 2)
offset+=2;
else
offset++;
if (offset >= image->rows)
{
base++;
offset=base;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
if (EOFBlob(image) != MagickFalse)
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
| 1
|
477,249
|
current_block(
oparg_T *oap,
long count,
int include, // TRUE == include white space
int what, // '(', '{', etc.
int other) // ')', '}', etc.
{
pos_T old_pos;
pos_T *pos = NULL;
pos_T start_pos;
pos_T *end_pos;
pos_T old_start, old_end;
char_u *save_cpo;
int sol = FALSE; // '{' at start of line
old_pos = curwin->w_cursor;
old_end = curwin->w_cursor; // remember where we started
old_start = old_end;
/*
* If we start on '(', '{', ')', '}', etc., use the whole block inclusive.
*/
if (!VIsual_active || EQUAL_POS(VIsual, curwin->w_cursor))
{
setpcmark();
if (what == '{') // ignore indent
while (inindent(1))
if (inc_cursor() != 0)
break;
if (gchar_cursor() == what)
// cursor on '(' or '{', move cursor just after it
++curwin->w_cursor.col;
}
else if (LT_POS(VIsual, curwin->w_cursor))
{
old_start = VIsual;
curwin->w_cursor = VIsual; // cursor at low end of Visual
}
else
old_end = VIsual;
/*
* Search backwards for unclosed '(', '{', etc..
* Put this position in start_pos.
* Ignore quotes here. Keep the "M" flag in 'cpo', as that is what the
* user wants.
*/
save_cpo = p_cpo;
p_cpo = (char_u *)(vim_strchr(p_cpo, CPO_MATCHBSL) != NULL ? "%M" : "%");
if ((pos = findmatch(NULL, what)) != NULL)
{
while (count-- > 0)
{
if ((pos = findmatch(NULL, what)) == NULL)
break;
curwin->w_cursor = *pos;
start_pos = *pos; // the findmatch for end_pos will overwrite *pos
}
}
else
{
while (count-- > 0)
{
if ((pos = findmatchlimit(NULL, what, FM_FORWARD, 0)) == NULL)
break;
curwin->w_cursor = *pos;
start_pos = *pos; // the findmatch for end_pos will overwrite *pos
}
}
p_cpo = save_cpo;
/*
* Search for matching ')', '}', etc.
* Put this position in curwin->w_cursor.
*/
if (pos == NULL || (end_pos = findmatch(NULL, other)) == NULL)
{
curwin->w_cursor = old_pos;
return FAIL;
}
curwin->w_cursor = *end_pos;
/*
* Try to exclude the '(', '{', ')', '}', etc. when "include" is FALSE.
* If the ending '}', ')' or ']' is only preceded by indent, skip that
* indent. But only if the resulting area is not smaller than what we
* started with.
*/
while (!include)
{
incl(&start_pos);
sol = (curwin->w_cursor.col == 0);
decl(&curwin->w_cursor);
while (inindent(1))
{
sol = TRUE;
if (decl(&curwin->w_cursor) != 0)
break;
}
/*
* In Visual mode, when the resulting area is not bigger than what we
* started with, extend it to the next block, and then exclude again.
*/
if (!LT_POS(start_pos, old_start) && !LT_POS(old_end, curwin->w_cursor)
&& VIsual_active)
{
curwin->w_cursor = old_start;
decl(&curwin->w_cursor);
if ((pos = findmatch(NULL, what)) == NULL)
{
curwin->w_cursor = old_pos;
return FAIL;
}
start_pos = *pos;
curwin->w_cursor = *pos;
if ((end_pos = findmatch(NULL, other)) == NULL)
{
curwin->w_cursor = old_pos;
return FAIL;
}
curwin->w_cursor = *end_pos;
}
else
break;
}
if (VIsual_active)
{
if (*p_sel == 'e')
inc(&curwin->w_cursor);
if (sol && gchar_cursor() != NUL)
inc(&curwin->w_cursor); // include the line break
VIsual = start_pos;
VIsual_mode = 'v';
redraw_curbuf_later(INVERTED); // update the inversion
showmode();
}
else
{
oap->start = start_pos;
oap->motion_type = MCHAR;
oap->inclusive = FALSE;
if (sol)
incl(&curwin->w_cursor);
else if (LTOREQ_POS(start_pos, curwin->w_cursor))
// Include the character under the cursor.
oap->inclusive = TRUE;
else
// End is before the start (no text in between <>, [], etc.): don't
// operate on any text.
curwin->w_cursor = start_pos;
}
return OK;
}
| 0
|
101,694
|
void WebProcessProxy::registerNewWebBackForwardListItem(WebBackForwardListItem* item)
{
ASSERT(!m_backForwardListItemMap.contains(item->itemID()));
m_backForwardListItemMap.set(item->itemID(), item);
}
| 0
|
415,189
|
reset_notify (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
(void) line;
do_reset (ctrl, 1);
return 0;
}
| 0
|
413,600
|
static bool myvalid(RIO *io, ut64 addr) {
if (addr < 0x100) {
return false;
}
if (addr == UT32_MAX || addr == UT64_MAX) { //the best of the best of the best :(
return false;
}
if (!r_io_is_valid_offset (io, addr, 0)) {
return false;
}
return true;
}
| 0
|
246,740
|
Bool print_version(char *arg_val, u32 param)
{
fprintf(stderr, "MP4Box - GPAC version %s\n"
"%s\n"
"GPAC Configuration: " GPAC_CONFIGURATION "\n"
"Features: %s %s\n", gf_gpac_version(), gf_gpac_copyright_cite(), gf_sys_features(GF_FALSE), gf_sys_features(GF_TRUE));
return GF_TRUE;
}
| 0
|
512,994
|
Item *Item_cond_or::copy_andor_structure(THD *thd)
{
Item_cond_or *item;
if ((item= new (thd->mem_root) Item_cond_or(thd, this)))
item->copy_andor_arguments(thd, this);
return item;
}
| 0
|
335,417
|
parse_command_modifiers(
exarg_T *eap,
char **errormsg,
cmdmod_T *cmod,
int skip_only)
{
char_u *orig_cmd = eap->cmd;
char_u *cmd_start = NULL;
int did_plus_cmd = FALSE;
char_u *p;
int starts_with_colon = FALSE;
int vim9script = in_vim9script();
int has_visual_range = FALSE;
CLEAR_POINTER(cmod);
cmod->cmod_flags = sticky_cmdmod_flags;
if (STRNCMP(eap->cmd, "'<,'>", 5) == 0)
{
// The automatically inserted Visual area range is skipped, so that
// typing ":cmdmod cmd" in Visual mode works without having to move the
// range to after the modififiers.
eap->cmd += 5;
cmd_start = eap->cmd;
has_visual_range = TRUE;
}
// Repeat until no more command modifiers are found.
for (;;)
{
while (*eap->cmd == ' ' || *eap->cmd == '\t' || *eap->cmd == ':')
{
if (*eap->cmd == ':')
starts_with_colon = TRUE;
++eap->cmd;
}
// in ex mode, an empty line works like :+
if (*eap->cmd == NUL && exmode_active
&& (getline_equal(eap->getline, eap->cookie, getexmodeline)
|| getline_equal(eap->getline, eap->cookie, getexline))
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
{
eap->cmd = (char_u *)"+";
did_plus_cmd = TRUE;
if (!skip_only)
ex_pressedreturn = TRUE;
}
// ignore comment and empty lines
if (comment_start(eap->cmd, starts_with_colon))
{
// a comment ends at a NL
if (eap->nextcmd == NULL)
{
eap->nextcmd = vim_strchr(eap->cmd, '\n');
if (eap->nextcmd != NULL)
++eap->nextcmd;
}
if (vim9script && has_cmdmod(cmod, FALSE))
*errormsg = _(e_command_modifier_without_command);
return FAIL;
}
if (*eap->cmd == NUL)
{
if (!skip_only)
{
ex_pressedreturn = TRUE;
if (vim9script && has_cmdmod(cmod, FALSE))
*errormsg = _(e_command_modifier_without_command);
}
return FAIL;
}
p = skip_range(eap->cmd, TRUE, NULL);
// In Vim9 script a variable can shadow a command modifier:
// verbose = 123
// verbose += 123
// silent! verbose = func()
// verbose.member = 2
// verbose[expr] = 2
// But not:
// verbose [a, b] = list
if (vim9script)
{
char_u *s, *n;
for (s = eap->cmd; ASCII_ISALPHA(*s); ++s)
;
n = skipwhite(s);
if (*n == '.' || *n == '=' || (*n != NUL && n[1] == '=')
|| *s == '[')
break;
}
switch (*p)
{
// When adding an entry, also modify cmd_exists().
case 'a': if (!checkforcmd_noparen(&eap->cmd, "aboveleft", 3))
break;
cmod->cmod_split |= WSP_ABOVE;
continue;
case 'b': if (checkforcmd_noparen(&eap->cmd, "belowright", 3))
{
cmod->cmod_split |= WSP_BELOW;
continue;
}
if (checkforcmd_opt(&eap->cmd, "browse", 3, TRUE))
{
#ifdef FEAT_BROWSE_CMD
cmod->cmod_flags |= CMOD_BROWSE;
#endif
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "botright", 2))
break;
cmod->cmod_split |= WSP_BOT;
continue;
case 'c': if (!checkforcmd_opt(&eap->cmd, "confirm", 4, TRUE))
break;
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
cmod->cmod_flags |= CMOD_CONFIRM;
#endif
continue;
case 'k': if (checkforcmd_noparen(&eap->cmd, "keepmarks", 3))
{
cmod->cmod_flags |= CMOD_KEEPMARKS;
continue;
}
if (checkforcmd_noparen(&eap->cmd, "keepalt", 5))
{
cmod->cmod_flags |= CMOD_KEEPALT;
continue;
}
if (checkforcmd_noparen(&eap->cmd, "keeppatterns", 5))
{
cmod->cmod_flags |= CMOD_KEEPPATTERNS;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "keepjumps", 5))
break;
cmod->cmod_flags |= CMOD_KEEPJUMPS;
continue;
case 'f': // only accept ":filter {pat} cmd"
{
char_u *reg_pat;
char_u *nulp = NULL;
int c = 0;
if (!checkforcmd_noparen(&p, "filter", 4)
|| *p == NUL
|| (ends_excmd(*p)
#ifdef FEAT_EVAL
// in ":filter #pat# cmd" # does not
// start a comment
&& (!vim9script || VIM_ISWHITE(p[1]))
#endif
))
break;
if (*p == '!')
{
cmod->cmod_filter_force = TRUE;
p = skipwhite(p + 1);
if (*p == NUL || ends_excmd(*p))
break;
}
#ifdef FEAT_EVAL
// Avoid that "filter(arg)" is recognized.
if (vim9script && !VIM_ISWHITE(p[-1]))
break;
#endif
if (skip_only)
p = skip_vimgrep_pat(p, NULL, NULL);
else
// NOTE: This puts a NUL after the pattern.
p = skip_vimgrep_pat_ext(p, ®_pat, NULL,
&nulp, &c);
if (p == NULL || *p == NUL)
break;
if (!skip_only)
{
cmod->cmod_filter_regmatch.regprog =
vim_regcomp(reg_pat, RE_MAGIC);
if (cmod->cmod_filter_regmatch.regprog == NULL)
break;
// restore the character overwritten by NUL
if (nulp != NULL)
*nulp = c;
}
eap->cmd = p;
continue;
}
// ":hide" and ":hide | cmd" are not modifiers
case 'h': if (p != eap->cmd || !checkforcmd_noparen(&p, "hide", 3)
|| *p == NUL || ends_excmd(*p))
break;
eap->cmd = p;
cmod->cmod_flags |= CMOD_HIDE;
continue;
case 'l': if (checkforcmd_noparen(&eap->cmd, "lockmarks", 3))
{
cmod->cmod_flags |= CMOD_LOCKMARKS;
continue;
}
if (checkforcmd_noparen(&eap->cmd, "legacy", 3))
{
if (ends_excmd2(p, eap->cmd))
{
*errormsg =
_(e_legacy_must_be_followed_by_command);
return FAIL;
}
cmod->cmod_flags |= CMOD_LEGACY;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "leftabove", 5))
break;
cmod->cmod_split |= WSP_ABOVE;
continue;
case 'n': if (checkforcmd_noparen(&eap->cmd, "noautocmd", 3))
{
cmod->cmod_flags |= CMOD_NOAUTOCMD;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "noswapfile", 3))
break;
cmod->cmod_flags |= CMOD_NOSWAPFILE;
continue;
case 'r': if (!checkforcmd_noparen(&eap->cmd, "rightbelow", 6))
break;
cmod->cmod_split |= WSP_BELOW;
continue;
case 's': if (checkforcmd_noparen(&eap->cmd, "sandbox", 3))
{
cmod->cmod_flags |= CMOD_SANDBOX;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "silent", 3))
break;
cmod->cmod_flags |= CMOD_SILENT;
if (*eap->cmd == '!' && !VIM_ISWHITE(eap->cmd[-1]))
{
// ":silent!", but not "silent !cmd"
eap->cmd = skipwhite(eap->cmd + 1);
cmod->cmod_flags |= CMOD_ERRSILENT;
}
continue;
case 't': if (checkforcmd_noparen(&p, "tab", 3))
{
if (!skip_only)
{
long tabnr = get_address(eap, &eap->cmd,
ADDR_TABS, eap->skip,
skip_only, FALSE, 1);
if (tabnr == MAXLNUM)
cmod->cmod_tab = tabpage_index(curtab) + 1;
else
{
if (tabnr < 0 || tabnr > LAST_TAB_NR)
{
*errormsg = _(e_invalid_range);
return FAIL;
}
cmod->cmod_tab = tabnr + 1;
}
}
eap->cmd = p;
continue;
}
if (!checkforcmd_noparen(&eap->cmd, "topleft", 2))
break;
cmod->cmod_split |= WSP_TOP;
continue;
case 'u': if (!checkforcmd_noparen(&eap->cmd, "unsilent", 3))
break;
cmod->cmod_flags |= CMOD_UNSILENT;
continue;
case 'v': if (checkforcmd_noparen(&eap->cmd, "vertical", 4))
{
cmod->cmod_split |= WSP_VERT;
continue;
}
if (checkforcmd_noparen(&eap->cmd, "vim9cmd", 4))
{
if (ends_excmd2(p, eap->cmd))
{
*errormsg =
_(e_vim9cmd_must_be_followed_by_command);
return FAIL;
}
cmod->cmod_flags |= CMOD_VIM9CMD;
continue;
}
if (!checkforcmd_noparen(&p, "verbose", 4))
break;
if (vim_isdigit(*eap->cmd))
{
cmod->cmod_verbose = atoi((char *)eap->cmd);
if (cmod->cmod_verbose == 0)
cmod->cmod_verbose = -1;
}
else
cmod->cmod_verbose = 1;
eap->cmd = p;
continue;
}
break;
}
if (has_visual_range)
{
if (eap->cmd > cmd_start)
{
// Move the '<,'> range to after the modifiers and insert a colon.
// Since the modifiers have been parsed put the colon on top of the
// space: "'<,'>mod cmd" -> "mod:'<,'>cmd
// Put eap->cmd after the colon.
if (did_plus_cmd)
{
size_t len = STRLEN(cmd_start);
// Special case: empty command may have been changed to "+":
// "'<,'>mod" -> "mod'<,'>+
mch_memmove(orig_cmd, cmd_start, len);
STRCPY(orig_cmd + len, "'<,'>+");
}
else
{
mch_memmove(cmd_start - 5, cmd_start, eap->cmd - cmd_start);
eap->cmd -= 5;
mch_memmove(eap->cmd - 1, ":'<,'>", 6);
}
}
else
// No modifiers, move the pointer back.
// Special case: empty command may have been changed to "+".
if (did_plus_cmd)
eap->cmd = (char_u *)"'<,'>+";
else
eap->cmd = orig_cmd;
}
return OK;
}
| 0
|
442,584
|
static void init_qxl_surface(QXLSurfaceCmd *qxl)
{
void *surface_mem;
memset(qxl, 0, sizeof(*qxl));
qxl->surface_id = 123;
qxl->u.surface_create.format = SPICE_SURFACE_FMT_32_xRGB;
qxl->u.surface_create.width = 128;
qxl->u.surface_create.stride = 512;
qxl->u.surface_create.height = 128;
surface_mem = g_malloc(0x10000);
qxl->u.surface_create.data = to_physical(surface_mem);
}
| 0
|
374,042
|
static const char *typeString(ut32 n, int *bits) {
*bits = 32;
if (n == 12) { // CPU_SUBTYPE_ARM_V7) {
return "arm";
}
if (n == 0x0100000c) { // arm64
*bits = 64;
return "arm";
}
if (n == 0x0200000c) { // arm64-32
// TODO: must change bits
*bits = 64;
return "arm";
}
return "x86";
}
| 0
|
310,107
|
vid_attr(attr_t newmode, NCURSES_PAIRS_T pair_arg, void *opts)
{
return NCURSES_SP_NAME(vid_attr) (CURRENT_SCREEN, newmode, pair_arg, opts);
}
| 0
|
369,885
|
static int proc_map_files_get_link(struct dentry *dentry, struct path *path)
{
unsigned long vm_start, vm_end;
struct vm_area_struct *vma;
struct task_struct *task;
struct mm_struct *mm;
int rc;
rc = -ENOENT;
task = get_proc_task(dentry->d_inode);
if (!task)
goto out;
mm = get_task_mm(task);
put_task_struct(task);
if (!mm)
goto out;
rc = dname_to_vma_addr(dentry, &vm_start, &vm_end);
if (rc)
goto out_mmput;
down_read(&mm->mmap_sem);
vma = find_exact_vma(mm, vm_start, vm_end);
if (vma && vma->vm_file) {
*path = vma->vm_file->f_path;
path_get(path);
rc = 0;
}
up_read(&mm->mmap_sem);
out_mmput:
mmput(mm);
out:
return rc;
}
| 0
|
263,381
|
Status ScatterNdTensorShape(InferenceContext* c) {
ShapeHandle output_shape;
TF_RETURN_IF_ERROR(c->WithRankAtLeast(c->input(0), 1, &output_shape));
ShapeHandle indices_shape;
TF_RETURN_IF_ERROR(c->WithRankAtLeast(c->input(1), 1, &indices_shape));
ShapeHandle updates_shape;
TF_RETURN_IF_ERROR(c->WithRankAtLeast(c->input(2), 1, &updates_shape));
return shape_inference::ScatterNdShapeHelper(c, indices_shape, updates_shape,
output_shape);
}
| 0
|
498,112
|
int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const char *value))
{
char *o, *t, *txt, *value = NULL, c;
if (!txt_)
return 0;
o = t = txt = xstrdup(txt_);
while ((c=*t) != '\0') {
if (c == '=') {
*t = '\0';
value = t + 1;
} else if (c == '+') {
*t = ' ';
} else if (c == '%') {
t = convert_query_hexchar(t);
} else if (c == '&') {
*t = '\0';
(*fn)(txt, value);
txt = t + 1;
value = NULL;
}
t++;
}
if (t != txt)
(*fn)(txt, value);
free(o);
return 0;
}
| 0
|
225,777
|
GF_Err rely_box_size(GF_Box *s)
{
s->size += 1;
return GF_OK;
}
| 0
|
522,338
|
static int64_t GetFilPos(GmfMshSct *msh)
{
#ifdef WITH_GMF_AIO
if(msh->typ & Bin)
return(lseek(msh->FilDes, 0, 1));
else
return(MYFTELL(msh->hdl));
#else
return(MYFTELL(msh->hdl));
#endif
}
| 0
|
343,226
|
static int dlmap_exit(DLHandler * const dlhandler)
{
if (dlhandler->map != NULL) {
free(dlhandler->map);
dlhandler->map = NULL;
dlhandler->sizeof_map = (size_t) 0U;
dlhandler->dlmap_size = (size_t) 0U;
}
return 0;
}
| 0
|
216,946
|
static void fix_dl_name(MEM_ROOT *root, LEX_STRING *dl)
{
const size_t so_ext_len= sizeof(SO_EXT) - 1;
if (my_strcasecmp(&my_charset_latin1, dl->str + dl->length - so_ext_len,
SO_EXT))
{
char *s= (char*)alloc_root(root, dl->length + so_ext_len + 1);
memcpy(s, dl->str, dl->length);
strcpy(s + dl->length, SO_EXT);
dl->str= s;
dl->length+= so_ext_len;
}
}
| 1
|
314,772
|
cdf_swap_header(cdf_header_t *h)
{
size_t i;
h->h_magic = CDF_TOLE8(h->h_magic);
h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]);
h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]);
h->h_revision = CDF_TOLE2(h->h_revision);
h->h_version = CDF_TOLE2(h->h_version);
h->h_byte_order = CDF_TOLE2(h->h_byte_order);
h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2);
h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2);
h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat);
h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory);
h->h_min_size_standard_stream =
CDF_TOLE4(h->h_min_size_standard_stream);
h->h_secid_first_sector_in_short_sat =
CDF_TOLE4((uint32_t)h->h_secid_first_sector_in_short_sat);
h->h_num_sectors_in_short_sat =
CDF_TOLE4(h->h_num_sectors_in_short_sat);
h->h_secid_first_sector_in_master_sat =
CDF_TOLE4((uint32_t)h->h_secid_first_sector_in_master_sat);
h->h_num_sectors_in_master_sat =
CDF_TOLE4(h->h_num_sectors_in_master_sat);
for (i = 0; i < __arraycount(h->h_master_sat); i++)
h->h_master_sat[i] = CDF_TOLE4((uint32_t)h->h_master_sat[i]);
}
| 0
|
459,002
|
http_linkh(const struct http *to, const struct http *fm, unsigned n)
{
assert(n < HTTP_HDR_FIRST);
Tcheck(fm->hd[n]);
to->hd[n] = fm->hd[n];
to->hdf[n] = fm->hdf[n];
http_VSLH(to, n);
}
| 0
|
359,548
|
DEFUN (address_family_ipv4,
address_family_ipv4_cmd,
"address-family ipv4",
"Enter Address Family command mode\n"
"Address family\n")
{
vty->node = BGP_IPV4_NODE;
return CMD_SUCCESS;
}
| 0
|
301,493
|
add_sound_suggest(
suginfo_T *su,
char_u *goodword,
int score, // soundfold score
langp_T *lp)
{
slang_T *slang = lp->lp_slang; // language for sound folding
int sfwordnr;
char_u *nrline;
int orgnr;
char_u theword[MAXWLEN];
int i;
int wlen;
char_u *byts;
idx_T *idxs;
int n;
int wordcount;
int wc;
int goodscore;
hash_T hash;
hashitem_T *hi;
sftword_T *sft;
int bc, gc;
int limit;
// It's very well possible that the same soundfold word is found several
// times with different scores. Since the following is quite slow only do
// the words that have a better score than before. Use a hashtable to
// remember the words that have been done.
hash = hash_hash(goodword);
hi = hash_lookup(&slang->sl_sounddone, goodword, hash);
if (HASHITEM_EMPTY(hi))
{
sft = alloc(sizeof(sftword_T) + STRLEN(goodword));
if (sft != NULL)
{
sft->sft_score = score;
STRCPY(sft->sft_word, goodword);
hash_add_item(&slang->sl_sounddone, hi, sft->sft_word, hash);
}
}
else
{
sft = HI2SFT(hi);
if (score >= sft->sft_score)
return;
sft->sft_score = score;
}
// Find the word nr in the soundfold tree.
sfwordnr = soundfold_find(slang, goodword);
if (sfwordnr < 0)
{
internal_error("add_sound_suggest()");
return;
}
// go over the list of good words that produce this soundfold word
nrline = ml_get_buf(slang->sl_sugbuf, (linenr_T)(sfwordnr + 1), FALSE);
orgnr = 0;
while (*nrline != NUL)
{
// The wordnr was stored in a minimal nr of bytes as an offset to the
// previous wordnr.
orgnr += bytes2offset(&nrline);
byts = slang->sl_fbyts;
idxs = slang->sl_fidxs;
// Lookup the word "orgnr" one of the two tries.
n = 0;
wordcount = 0;
for (wlen = 0; wlen < MAXWLEN - 3; ++wlen)
{
i = 1;
if (wordcount == orgnr && byts[n + 1] == NUL)
break; // found end of word
if (byts[n + 1] == NUL)
++wordcount;
// skip over the NUL bytes
for ( ; byts[n + i] == NUL; ++i)
if (i > byts[n]) // safety check
{
STRCPY(theword + wlen, "BAD");
wlen += 3;
goto badword;
}
// One of the siblings must have the word.
for ( ; i < byts[n]; ++i)
{
wc = idxs[idxs[n + i]]; // nr of words under this byte
if (wordcount + wc > orgnr)
break;
wordcount += wc;
}
theword[wlen] = byts[n + i];
n = idxs[n + i];
}
badword:
theword[wlen] = NUL;
// Go over the possible flags and regions.
for (; i <= byts[n] && byts[n + i] == NUL; ++i)
{
char_u cword[MAXWLEN];
char_u *p;
int flags = (int)idxs[n + i];
// Skip words with the NOSUGGEST flag
if (flags & WF_NOSUGGEST)
continue;
if (flags & WF_KEEPCAP)
{
// Must find the word in the keep-case tree.
find_keepcap_word(slang, theword, cword);
p = cword;
}
else
{
flags |= su->su_badflags;
if ((flags & WF_CAPMASK) != 0)
{
// Need to fix case according to "flags".
make_case_word(theword, cword, flags);
p = cword;
}
else
p = theword;
}
// Add the suggestion.
if (sps_flags & SPS_DOUBLE)
{
// Add the suggestion if the score isn't too bad.
if (score <= su->su_maxscore)
add_suggestion(su, &su->su_sga, p, su->su_badlen,
score, 0, FALSE, slang, FALSE);
}
else
{
// Add a penalty for words in another region.
if ((flags & WF_REGION)
&& (((unsigned)flags >> 16) & lp->lp_region) == 0)
goodscore = SCORE_REGION;
else
goodscore = 0;
// Add a small penalty for changing the first letter from
// lower to upper case. Helps for "tath" -> "Kath", which is
// less common than "tath" -> "path". Don't do it when the
// letter is the same, that has already been counted.
gc = PTR2CHAR(p);
if (SPELL_ISUPPER(gc))
{
bc = PTR2CHAR(su->su_badword);
if (!SPELL_ISUPPER(bc)
&& SPELL_TOFOLD(bc) != SPELL_TOFOLD(gc))
goodscore += SCORE_ICASE / 2;
}
// Compute the score for the good word. This only does letter
// insert/delete/swap/replace. REP items are not considered,
// which may make the score a bit higher.
// Use a limit for the score to make it work faster. Use
// MAXSCORE(), because RESCORE() will change the score.
// If the limit is very high then the iterative method is
// inefficient, using an array is quicker.
limit = MAXSCORE(su->su_sfmaxscore - goodscore, score);
if (limit > SCORE_LIMITMAX)
goodscore += spell_edit_score(slang, su->su_badword, p);
else
goodscore += spell_edit_score_limit(slang, su->su_badword,
p, limit);
// When going over the limit don't bother to do the rest.
if (goodscore < SCORE_MAXMAX)
{
// Give a bonus to words seen before.
goodscore = score_wordcount_adj(slang, goodscore, p, FALSE);
// Add the suggestion if the score isn't too bad.
goodscore = RESCORE(goodscore, score);
if (goodscore <= su->su_sfmaxscore)
add_suggestion(su, &su->su_ga, p, su->su_badlen,
goodscore, score, TRUE, slang, TRUE);
}
}
}
// smsg("word %s (%d): %s (%d)", sftword, sftnr, theword, orgnr);
}
}
| 0
|
247,619
|
void testSupportForStatelessSessionResumption(const std::string& server_ctx_yaml,
const std::string& client_ctx_yaml,
bool expect_support,
const Network::Address::IpVersion ip_version) {
Event::SimulatedTimeSystem time_system;
ContextManagerImpl manager(*time_system);
Stats::IsolatedStoreImpl server_stats_store;
Api::ApiPtr server_api = Api::createApiForTest(server_stats_store, time_system);
NiceMock<Runtime::MockLoader> runtime;
testing::NiceMock<Server::Configuration::MockTransportSocketFactoryContext>
server_factory_context;
ON_CALL(server_factory_context, api()).WillByDefault(ReturnRef(*server_api));
envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext server_tls_context;
TestUtility::loadFromYaml(TestEnvironment::substitute(server_ctx_yaml), server_tls_context);
auto server_cfg =
std::make_unique<ServerContextConfigImpl>(server_tls_context, server_factory_context);
ServerSslSocketFactory server_ssl_socket_factory(std::move(server_cfg), manager,
server_stats_store, {});
auto tcp_socket = std::make_shared<Network::Test::TcpListenSocketImmediateListen>(
Network::Test::getCanonicalLoopbackAddress(ip_version));
NiceMock<Network::MockTcpListenerCallbacks> callbacks;
Event::DispatcherPtr dispatcher(server_api->allocateDispatcher("test_thread"));
Network::ListenerPtr listener =
dispatcher->createListener(tcp_socket, callbacks, runtime, true, false);
envoy::extensions::transport_sockets::tls::v3::UpstreamTlsContext client_tls_context;
TestUtility::loadFromYaml(TestEnvironment::substitute(client_ctx_yaml), client_tls_context);
Stats::IsolatedStoreImpl client_stats_store;
Api::ApiPtr client_api = Api::createApiForTest(client_stats_store, time_system);
testing::NiceMock<Server::Configuration::MockTransportSocketFactoryContext>
client_factory_context;
ON_CALL(client_factory_context, api()).WillByDefault(ReturnRef(*client_api));
auto client_cfg =
std::make_unique<ClientContextConfigImpl>(client_tls_context, client_factory_context);
ClientSslSocketFactory ssl_socket_factory(std::move(client_cfg), manager, client_stats_store);
Network::ClientConnectionPtr client_connection = dispatcher->createClientConnection(
tcp_socket->connectionInfoProvider().localAddress(),
Network::Address::InstanceConstSharedPtr(), ssl_socket_factory.createTransportSocket(nullptr),
nullptr);
Network::MockConnectionCallbacks client_connection_callbacks;
client_connection->addConnectionCallbacks(client_connection_callbacks);
client_connection->connect();
StreamInfo::StreamInfoImpl stream_info(time_system, nullptr);
Network::ConnectionPtr server_connection;
EXPECT_CALL(callbacks, onAccept_(_))
.WillOnce(Invoke([&](Network::ConnectionSocketPtr& socket) -> void {
server_connection = dispatcher->createServerConnection(
std::move(socket), server_ssl_socket_factory.createTransportSocket(nullptr),
stream_info);
const SslHandshakerImpl* ssl_socket =
dynamic_cast<const SslHandshakerImpl*>(server_connection->ssl().get());
SSL* server_ssl_socket = ssl_socket->ssl();
SSL_CTX* server_ssl_context = SSL_get_SSL_CTX(server_ssl_socket);
if (expect_support) {
EXPECT_EQ(0, (SSL_CTX_get_options(server_ssl_context) & SSL_OP_NO_TICKET));
} else {
EXPECT_EQ(SSL_OP_NO_TICKET, (SSL_CTX_get_options(server_ssl_context) & SSL_OP_NO_TICKET));
}
}));
EXPECT_CALL(client_connection_callbacks, onEvent(Network::ConnectionEvent::Connected))
.WillOnce(Invoke([&](Network::ConnectionEvent) -> void {
client_connection->close(Network::ConnectionCloseType::NoFlush);
server_connection->close(Network::ConnectionCloseType::NoFlush);
dispatcher->exit();
}));
EXPECT_CALL(client_connection_callbacks, onEvent(Network::ConnectionEvent::LocalClose));
dispatcher->run(Event::Dispatcher::RunType::Block);
}
| 0
|
333,046
|
nfa_print_state2(FILE *debugf, nfa_state_T *state, garray_T *indent)
{
char_u *p;
if (state == NULL)
return;
fprintf(debugf, "(%2d)", abs(state->id));
// Output indent
p = (char_u *)indent->ga_data;
if (indent->ga_len >= 3)
{
int last = indent->ga_len - 3;
char_u save[2];
STRNCPY(save, &p[last], 2);
STRNCPY(&p[last], "+-", 2);
fprintf(debugf, " %s", p);
STRNCPY(&p[last], save, 2);
}
else
fprintf(debugf, " %s", p);
nfa_set_code(state->c);
fprintf(debugf, "%s (%d) (id=%d) val=%d\n",
code,
state->c,
abs(state->id),
state->val);
if (state->id < 0)
return;
state->id = abs(state->id) * -1;
// grow indent for state->out
indent->ga_len -= 1;
if (state->out1)
ga_concat(indent, (char_u *)"| ");
else
ga_concat(indent, (char_u *)" ");
ga_append(indent, '\0');
nfa_print_state2(debugf, state->out, indent);
// replace last part of indent for state->out1
indent->ga_len -= 3;
ga_concat(indent, (char_u *)" ");
ga_append(indent, '\0');
nfa_print_state2(debugf, state->out1, indent);
// shrink indent
indent->ga_len -= 3;
ga_append(indent, '\0');
}
| 0
|
366,301
|
static bool disconnect_mount(struct mount *mnt, enum umount_tree_flags how)
{
/* Leaving mounts connected is only valid for lazy umounts */
if (how & UMOUNT_SYNC)
return true;
/* A mount without a parent has nothing to be connected to */
if (!mnt_has_parent(mnt))
return true;
/* Because the reference counting rules change when mounts are
* unmounted and connected, umounted mounts may not be
* connected to mounted mounts.
*/
if (!(mnt->mnt_parent->mnt.mnt_flags & MNT_UMOUNT))
return true;
/* Has it been requested that the mount remain connected? */
if (how & UMOUNT_CONNECTED)
return false;
/* Is the mount locked such that it needs to remain connected? */
if (IS_MNT_LOCKED(mnt))
return false;
/* By default disconnect the mount */
return true;
}
| 0
|
405,392
|
static struct xfrm_policy *clone_policy(const struct xfrm_policy *old, int dir)
{
struct xfrm_policy *newp = xfrm_policy_alloc(xp_net(old), GFP_ATOMIC);
struct net *net = xp_net(old);
if (newp) {
newp->selector = old->selector;
if (security_xfrm_policy_clone(old->security,
&newp->security)) {
kfree(newp);
return NULL; /* ENOMEM */
}
newp->lft = old->lft;
newp->curlft = old->curlft;
newp->mark = old->mark;
newp->if_id = old->if_id;
newp->action = old->action;
newp->flags = old->flags;
newp->xfrm_nr = old->xfrm_nr;
newp->index = old->index;
newp->type = old->type;
newp->family = old->family;
memcpy(newp->xfrm_vec, old->xfrm_vec,
newp->xfrm_nr*sizeof(struct xfrm_tmpl));
spin_lock_bh(&net->xfrm.xfrm_policy_lock);
xfrm_sk_policy_link(newp, dir);
spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
xfrm_pol_put(newp);
}
return newp;
}
| 0
|
242,657
|
static GFINLINE Bool isor_is_local(const char *url)
{
if (!strnicmp(url, "file://", 7)) return GF_TRUE;
if (!strnicmp(url, "gmem://", 7)) return GF_TRUE;
if (!strnicmp(url, "gfio://", 7)) return GF_TRUE;
if (!strnicmp(url, "isobmff://", 10)) return GF_TRUE;
if (strstr(url, "://")) return GF_FALSE;
/*the rest is local (mounted on FS)*/
return GF_TRUE;
}
| 0
|
413,836
|
LinkInfo::LinkInfo(const constantPoolHandle& pool, int index, TRAPS) {
// resolve klass
_resolved_klass = pool->klass_ref_at(index, CHECK);
// Get name, signature, and static klass
_name = pool->name_ref_at(index);
_signature = pool->signature_ref_at(index);
_tag = pool->tag_ref_at(index);
_current_klass = pool->pool_holder();
_current_method = methodHandle();
// Coming from the constant pool always checks access
_check_access = true;
_check_loader_constraints = true;
}
| 0
|
343,220
|
static void keepalive(const int fd, int keep)
{
#ifdef SO_KEEPALIVE
{
setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &keep, sizeof keep);
}
#endif
}
| 0
|
312,585
|
set_errorlist(
win_T *wp,
list_T *list,
int action,
char_u *title,
dict_T *what)
{
qf_info_T *qi = &ql_info;
int retval = OK;
if (wp != NULL)
{
qi = ll_get_or_alloc_list(wp);
if (qi == NULL)
return FAIL;
}
if (action == 'f')
{
// Free the entire quickfix or location list stack
qf_free_stack(wp, qi);
return OK;
}
// A dict argument cannot be specified with a non-empty list argument
if (list->lv_len != 0 && what != NULL)
{
semsg(_(e_invalid_argument_str),
_("cannot have both a list and a \"what\" argument"));
return FAIL;
}
incr_quickfix_busy();
if (what != NULL)
retval = qf_set_properties(qi, what, action, title);
else
{
retval = qf_add_entries(qi, qi->qf_curlist, list, title, action);
if (retval == OK)
qf_list_changed(qf_get_curlist(qi));
}
decr_quickfix_busy();
return retval;
}
| 0
|
448,532
|
void bgp_update_restarted_peers(struct peer *peer)
{
if (!bgp_update_delay_active(peer->bgp))
return; /* BGP update delay has ended */
if (peer->update_delay_over)
return; /* This peer has already been considered */
if (bgp_debug_neighbor_events(peer))
zlog_debug("Peer %s: Checking restarted", peer->host);
if (peer_established(peer)) {
peer->update_delay_over = 1;
peer->bgp->restarted_peers++;
bgp_check_update_delay(peer->bgp);
}
}
| 0
|
220,404
|
ary_new_from_values(mrb_state *mrb, mrb_int size, const mrb_value *vals)
{
struct RArray *a = ary_new_capa(mrb, size);
array_copy(ARY_PTR(a), vals, size);
ARY_SET_LEN(a, size);
return a;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.