idx
int64 | func
string | target
int64 |
|---|---|---|
198,695
|
mp_sint32 LoaderS3M::load(XMFileBase& f, XModule* module)
{
module->cleanUp();
// this will make code much easier to read
TXMHeader* header = &module->header;
TXMInstrument* instr = module->instr;
TXMSample* smp = module->smp;
TXMPattern* phead = module->phead;
// we're already out of memory here
if (!phead || !instr || !smp)
return MP_OUT_OF_MEMORY;
f.read(&header->name,1,28);
header->whythis1a = f.readByte();
if (f.readByte() != 16)
return MP_LOADER_FAILED; // no ST3 module
f.readByte(); // skip something
f.readByte(); // skip something
header->ordnum = f.readWord(); // number of positions in order list (songlength)
mp_ubyte* orders = new mp_ubyte[header->ordnum];
if (orders == NULL)
return MP_OUT_OF_MEMORY;
header->insnum = f.readWord(); // number of instruments
header->patnum = f.readWord(); // number of patterns
mp_sint32 flags = f.readWord(); // st3 flags
mp_sint32 Cvt = f.readWord();
header->flags = XModule::MODULE_ST3NEWINSTRUMENT | XModule::MODULE_ST3DUALCOMMANDS;
if (Cvt == 0x1300 || (flags & 64))
header->flags |= module->MODULE_OLDS3MVOLSLIDES;
header->flags |= module->MODULE_ST3NOTECUT;
/*mp_uword Ffi = */f.readWord();
f.read(header->sig,1,4);
header->mainvol = module->vol64to255(f.readByte()); // initial main volume
header->tempo = f.readByte(); // tempo
header->speed = f.readByte(); // speed
f.readByte(); // global volume? skipped...
f.readByte(); // ignore GUS click removal
/*mp_ubyte dp = */f.readByte();
f.readDword(); // skip something
f.readDword(); // skip something
f.readWord(); // skip some more...
mp_ubyte channelSettings[32];
f.read(channelSettings,1,32);
mp_sint32 numChannels = 0;
for (numChannels = 0; numChannels < 32; numChannels++)
if (channelSettings[numChannels] == 255)
break;
header->channum = numChannels; // number of channels
f.read(orders,1,header->ordnum);
mp_sint32 j = 0, i = 0;
for (i = 0; i < header->ordnum; i++)
{
if (orders[i] == 255)
break;
header->ord[j++] = orders[i];
}
header->ordnum = j; // final songlength
delete[] orders;
mp_uword* insParaPtrs = new mp_uword[header->insnum];
if (insParaPtrs == NULL)
return MP_OUT_OF_MEMORY;
f.readWords(insParaPtrs,header->insnum);
mp_uword* patParaPtrs = new mp_uword[header->patnum];
if (patParaPtrs == NULL)
{
delete[] insParaPtrs;
return MP_OUT_OF_MEMORY;
}
f.readWords(patParaPtrs,header->patnum);
//for (i = 0; i < header->insnum; i++)
//{
// printf("%x\n",insParaPtrs[i]*16);
//}
//////////////////////
// read instruments //
//////////////////////
mp_uint32* samplePtrs = new mp_uint32[header->insnum];
if (samplePtrs == NULL)
{
delete[] insParaPtrs;
delete[] patParaPtrs;
return MP_OUT_OF_MEMORY;
}
memset(samplePtrs,0,sizeof(mp_uint32)*header->insnum);
mp_sint32 s = 0;
for (i = 0; i < header->insnum; i++)
{
mp_uint32 insOffs = insParaPtrs[i]*16;
if (insOffs)
{
f.seekWithBaseOffset(insOffs);
// We can only read that if it's a sample
mp_ubyte type = f.readByte();
if (type == 1)
{
f.read(smp[s].name,1,12); // read dos filename
mp_ubyte bOffs = f.readByte();
mp_uword wOffs = f.readWord();
// stupid fileoffsets
samplePtrs[i] = (((mp_uint32)bOffs<<16)+(mp_uint32)wOffs)*16;
smp[s].flags = 1;
smp[s].pan = 0x80;
smp[s].samplen = f.readDword();
smp[s].loopstart = f.readDword();
mp_sint32 looplen = ((mp_sint32)f.readDword() - (mp_sint32)smp[s].loopstart);
if (looplen < 0)
looplen = 0;
smp[s].looplen = looplen;
smp[s].vol = module->vol64to255(f.readByte());
f.readByte(); // skip something
smp[s].res = f.readByte() == 0x04 ? 0xAD : 0; // packing
mp_ubyte flags = f.readByte();
// looping
if (flags & 1)
{
smp[s].type = 1;
}
// 16 bit sample
if (flags & 4)
{
smp[s].type |= 16;
smp[s].samplen >>= 1;
smp[s].loopstart >>= 1;
smp[s].looplen >>= 1;
}
mp_uint32 c4spd = f.readDword();
XModule::convertc4spd(c4spd,&smp[s].finetune,&smp[s].relnote);
#ifdef VERBOSE
printf("%i, %i\n",c4spd,module->getc4spd(smp[s].relnote,smp[s].finetune));
#endif
f.readDword(); // skip something
f.readDword(); // skip two internal words
f.readDword(); // skip internal dword
f.read(instr[i].name,1,28); // instrument name
f.readDword(); // skip signature
if (samplePtrs[i] && smp[s].samplen)
{
instr[i].samp=1;
for (j=0;j<120;j++)
instr[i].snum[j] = s;
s++;
}
}
else if (type == 0)
{
samplePtrs[i] = 0;
mp_ubyte buffer[12];
f.read(buffer,1,12); // read dos filename
f.readByte();
f.readWord();
f.readDword();
f.readDword();
f.readDword();
f.readByte();
f.readByte(); // skip something
f.readByte(); // skip packing
f.readByte();
f.readDword();
f.readDword(); // skip something
f.readDword(); // skip two internal words
f.readDword(); // skip internal dword
f.read(instr[i].name,1,28); // instrument name
f.readDword(); // skip signature
}
else
{
samplePtrs[i] = 0;
}
}
}
//////////////////////
// read patterns //
//////////////////////
mp_ubyte* pattern = new mp_ubyte[64*32*5];
if (pattern == NULL)
{
delete[] insParaPtrs;
delete[] patParaPtrs;
delete[] samplePtrs;
return MP_OUT_OF_MEMORY;
}
mp_uint32 songMaxChannels = 1;
for (i = 0; i < header->patnum; i++)
{
for (j = 0; j < 32*64; j++)
{
pattern[j*5] = 0xFF;
pattern[j*5+1] = 0;
pattern[j*5+2] = 0xFF;
pattern[j*5+3] = 0xFF;
pattern[j*5+4] = 0;
}
mp_uint32 patOffs = patParaPtrs[i]*16;
mp_uint32 maxChannels = 1;
if (patOffs)
{
f.seekWithBaseOffset(patOffs);
mp_uint32 size = f.readWord();
if (size > 2)
{
size-=2;
mp_ubyte* packed = new mp_ubyte[size+5];
if (packed == NULL)
{
delete[] insParaPtrs;
delete[] patParaPtrs;
delete[] samplePtrs;
delete[] pattern;
return MP_OUT_OF_MEMORY;
}
memset(packed, 0, size);
f.read(packed, 1, size);
mp_uint32 index = 0;
mp_uint32 row = 0;
while (index<size)
{
mp_ubyte pi = safeRead(packed, index, size);
if (pi == 0)
{
row++;
// one more safety net for incorrectly saved pattern sizes
if (row >= 64)
{
int i = 0;
i++;
i--;
break;
}
continue;
}
mp_uint32 chn = pi&31;
if (chn>maxChannels && (pi & (32+64+128)))
{
maxChannels = chn;
}
mp_ubyte* slot = pattern+(row*32*5)+chn*5;
if (pi & 32)
{
slot[0] = safeRead(packed, index, size, 0xFF);
slot[1] = safeRead(packed, index, size);
}
if (pi & 64)
{
slot[2] = safeRead(packed, index, size, 0xFF);
}
if (pi & 128)
{
slot[3] = safeRead(packed, index, size, 0xFF);
slot[4] = safeRead(packed, index, size);
}
}
maxChannels++;
if (maxChannels > header->channum)
maxChannels = header->channum;
delete[] packed;
}
if (maxChannels > songMaxChannels)
songMaxChannels = maxChannels;
}
convertS3MPattern(&phead[i], pattern, maxChannels, i);
}
if (header->channum > songMaxChannels)
header->channum = songMaxChannels;
delete[] pattern;
delete[] insParaPtrs;
delete[] patParaPtrs;
s = 0;
for (i = 0; i < header->insnum; i++)
{
mp_uint32 smpOffs = samplePtrs[i];
if (smpOffs)
{
f.seekWithBaseOffset(smpOffs);
if (!smp[s].samplen)
continue;
bool adpcm = (smp[s].res == 0xAD);
mp_sint32 result = module->loadModuleSample(f, s,
adpcm ? XModule::ST_PACKING_ADPCM : XModule::ST_UNSIGNED,
adpcm ? (XModule::ST_16BIT | XModule::ST_PACKING_ADPCM) : (XModule::ST_16BIT | XModule::ST_UNSIGNED));
if (result != MP_OK)
{
delete[] samplePtrs;
return result;
}
if (adpcm)
// no longer needed
smp[s].res = 0;
s++;
}
}
delete[] samplePtrs;
header->smpnum = s;
strcpy(header->tracker,"Screamtracker 3");
module->setDefaultPanning();
module->postProcessSamples();
return MP_OK;
}
| 1
|
283,751
|
static uint64_t zynq_slcr_compute_pll(uint64_t input, uint32_t ctrl_reg)
{
uint32_t mult = ((ctrl_reg & R_xxx_PLL_CTRL_PLL_FPDIV_MASK) >>
R_xxx_PLL_CTRL_PLL_FPDIV_SHIFT);
/* first, check if pll is bypassed */
if (ctrl_reg & R_xxx_PLL_CTRL_PLL_BYPASS_FORCE_MASK) {
return input;
}
/* is pll disabled ? */
if (ctrl_reg & (R_xxx_PLL_CTRL_PLL_RESET_MASK |
R_xxx_PLL_CTRL_PLL_PWRDWN_MASK)) {
return 0;
}
/* Consider zero feedback as maximum divide ratio possible */
if (!mult) {
mult = 1 << R_xxx_PLL_CTRL_PLL_FPDIV_LENGTH;
}
/* frequency multiplier -> period division */
return input / mult;
}
| 0
|
317,224
|
static void smack_inode_post_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
struct smack_known *skp;
struct inode_smack *isp = smack_inode(d_backing_inode(dentry));
if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) {
isp->smk_flags |= SMK_INODE_TRANSMUTE;
return;
}
if (strcmp(name, XATTR_NAME_SMACK) == 0) {
skp = smk_import_entry(value, size);
if (!IS_ERR(skp))
isp->smk_inode = skp;
} else if (strcmp(name, XATTR_NAME_SMACKEXEC) == 0) {
skp = smk_import_entry(value, size);
if (!IS_ERR(skp))
isp->smk_task = skp;
} else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0) {
skp = smk_import_entry(value, size);
if (!IS_ERR(skp))
isp->smk_mmap = skp;
}
return;
}
| 0
|
90,852
|
void GetAvailableSpace() {
quota_status_ = kQuotaStatusUnknown;
available_space_ = -1;
quota_manager_->GetAvailableSpace(
callback_factory_.NewCallback(
&QuotaManagerTest::DidGetAvailableSpace));
}
| 0
|
482,644
|
static inline unsigned int xt_write_recseq_begin(void)
{
unsigned int addend;
/*
* Low order bit of sequence is set if we already
* called xt_write_recseq_begin().
*/
addend = (__this_cpu_read(xt_recseq.sequence) + 1) & 1;
/*
* This is kind of a write_seqcount_begin(), but addend is 0 or 1
* We dont check addend value to avoid a test and conditional jump,
* since addend is most likely 1
*/
__this_cpu_add(xt_recseq.sequence, addend);
smp_mb();
return addend;
}
| 0
|
512,936
|
in_string::~in_string()
{
if (base)
{
// base was allocated on THD::mem_root => following is OK
for (uint i=0 ; i < count ; i++)
((String*) base)[i].free();
}
}
| 0
|
346,446
|
get_scriptname(scid_T id)
{
if (id == SID_MODELINE)
return (char_u *)_("modeline");
if (id == SID_CMDARG)
return (char_u *)_("--cmd argument");
if (id == SID_CARG)
return (char_u *)_("-c argument");
if (id == SID_ENV)
return (char_u *)_("environment variable");
if (id == SID_ERROR)
return (char_u *)_("error handler");
if (id == SID_WINLAYOUT)
return (char_u *)_("changed window size");
return SCRIPT_ITEM(id)->sn_name;
}
| 0
|
432,154
|
StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> PipelineD::prepareExecutor(
const intrusive_ptr<ExpressionContext>& expCtx,
const CollectionPtr& collection,
const NamespaceString& nss,
Pipeline* pipeline,
const boost::intrusive_ptr<DocumentSourceSort>& sortStage,
std::unique_ptr<GroupFromFirstDocumentTransformation> rewrittenGroupStage,
QueryMetadataBitSet unavailableMetadata,
const BSONObj& queryObj,
SkipThenLimit skipThenLimit,
const AggregateCommandRequest* aggRequest,
const MatchExpressionParser::AllowedFeatureSet& matcherFeatures,
bool* hasNoRequirements) {
invariant(hasNoRequirements);
// Any data returned from the inner executor must be owned.
size_t plannerOpts = QueryPlannerParams::DEFAULT;
if (pipeline->peekFront() && pipeline->peekFront()->constraints().isChangeStreamStage()) {
invariant(expCtx->tailableMode == TailableModeEnum::kTailableAndAwaitData);
plannerOpts |= (QueryPlannerParams::TRACK_LATEST_OPLOG_TS |
QueryPlannerParams::ASSERT_MIN_TS_HAS_NOT_FALLEN_OFF_OPLOG);
}
// The $_requestReshardingResumeToken parameter is only valid for an oplog scan.
if (aggRequest && aggRequest->getRequestReshardingResumeToken()) {
plannerOpts |= (QueryPlannerParams::TRACK_LATEST_OPLOG_TS |
QueryPlannerParams::ASSERT_MIN_TS_HAS_NOT_FALLEN_OFF_OPLOG);
}
// If there is a sort stage eligible for pushdown, serialize its SortPattern to a BSONObj. The
// BSONObj format is currently necessary to request that the sort is computed by the query layer
// inside the inner PlanExecutor. We also remove the $sort stage from the Pipeline, since it
// will be handled instead by PlanStage execution.
BSONObj sortObj;
if (sortStage) {
sortObj = sortStage->getSortKeyPattern()
.serialize(SortPattern::SortKeySerialization::kForPipelineSerialization)
.toBson();
pipeline->popFrontWithName(DocumentSourceSort::kStageName);
// Now that we've pushed down the sort, see if there is a $limit and $skip to push down
// also. We should not already have a limit or skip here, otherwise it would be incorrect
// for the caller to pass us a sort stage to push down, since the order matters.
invariant(!skipThenLimit.getLimit());
invariant(!skipThenLimit.getSkip());
// Since all $limit stages were already pushdowned to the sort stage, we are only looking
// for $skip stages.
auto skip = extractSkipForPushdown(pipeline);
// Since the limit from $sort is going before the extracted $skip stages, we construct
// 'LimitThenSkip' object and then convert it 'SkipThenLimit'.
skipThenLimit = LimitThenSkip(sortStage->getLimit(), skip).flip();
}
// Perform dependency analysis. In order to minimize the dependency set, we only analyze the
// stages that remain in the pipeline after pushdown. In particular, any dependencies for a
// $match or $sort pushed down into the query layer will not be reflected here.
auto deps = pipeline->getDependencies(unavailableMetadata);
*hasNoRequirements = deps.hasNoRequirements();
BSONObj projObj;
if (*hasNoRequirements) {
// This query might be eligible for count optimizations, since the remaining stages in the
// pipeline don't actually need to read any data produced by the query execution layer.
plannerOpts |= QueryPlannerParams::IS_COUNT;
} else {
// Build a BSONObj representing a projection eligible for pushdown. If there is an inclusion
// projection at the front of the pipeline, it will be removed and handled by the PlanStage
// layer. If a projection cannot be pushed down, an empty BSONObj will be returned.
// In most cases .find() behaves as if it evaluates in a predictable order:
// predicate, sort, skip, limit, projection.
// But there is at least one case where it runs the projection before the sort/skip/limit:
// when the predicate has a rooted $or. (In that case we plan each branch of the $or
// separately, using Subplan, and include the projection on each branch.)
// To work around this behavior, don't allow pushing down expressions if we are also going
// to push down a sort, skip or limit. We don't want the expressions to be evaluated on any
// documents that the sort/skip/limit would have filtered out. (The sort stage can be a
// top-k sort, which both sorts and limits.)
bool allowExpressions = !sortStage && !skipThenLimit.getSkip() && !skipThenLimit.getLimit();
projObj = buildProjectionForPushdown(deps, pipeline, allowExpressions);
plannerOpts |= QueryPlannerParams::RETURN_OWNED_DATA;
}
if (rewrittenGroupStage) {
// See if the query system can handle the $group and $sort stage using a DISTINCT_SCAN
// (SERVER-9507).
auto swExecutorGrouped = attemptToGetExecutor(expCtx,
collection,
nss,
queryObj,
projObj,
deps.metadataDeps(),
sortObj,
SkipThenLimit{boost::none, boost::none},
rewrittenGroupStage->groupId(),
aggRequest,
plannerOpts,
matcherFeatures);
if (swExecutorGrouped.isOK()) {
// Any $limit stage before the $group stage should make the pipeline ineligible for this
// optimization.
invariant(!sortStage || !sortStage->hasLimit());
// We remove the $sort and $group stages that begin the pipeline, because the executor
// will handle the sort, and the groupTransform (added below) will handle the $group
// stage.
pipeline->popFrontWithName(DocumentSourceSort::kStageName);
pipeline->popFrontWithName(DocumentSourceGroup::kStageName);
boost::intrusive_ptr<DocumentSource> groupTransform(
new DocumentSourceSingleDocumentTransformation(
expCtx,
std::move(rewrittenGroupStage),
"$groupByDistinctScan",
false /* independentOfAnyCollection */));
pipeline->addInitialSource(groupTransform);
return swExecutorGrouped;
} else if (swExecutorGrouped != ErrorCodes::NoQueryExecutionPlans) {
return swExecutorGrouped.getStatus().withContext(
"Failed to determine whether query system can provide a "
"DISTINCT_SCAN grouping");
}
}
return attemptToGetExecutor(expCtx,
collection,
nss,
queryObj,
projObj,
deps.metadataDeps(),
sortObj,
skipThenLimit,
boost::none, /* groupIdForDistinctScan */
aggRequest,
plannerOpts,
matcherFeatures);
}
| 0
|
198,983
|
SWTPM_NVRAM_CheckHeader(unsigned char *data, uint32_t length,
uint32_t *dataoffset, uint16_t *hdrflags,
uint8_t *hdrversion, bool quiet)
{
blobheader *bh = (blobheader *)data;
if (length < sizeof(bh)) {
if (!quiet)
logprintf(STDERR_FILENO,
"not enough bytes for header: %u\n", length);
return TPM_BAD_PARAMETER;
}
if (ntohl(bh->totlen) != length) {
if (!quiet)
logprintf(STDERR_FILENO,
"broken header: bh->totlen %u != %u\n",
htonl(bh->totlen), length);
return TPM_BAD_PARAMETER;
}
if (bh->min_version > BLOB_HEADER_VERSION) {
if (!quiet)
logprintf(STDERR_FILENO,
"Minimum required version for the blob is %d, we "
"only support version %d\n", bh->min_version,
BLOB_HEADER_VERSION);
return TPM_BAD_VERSION;
}
*hdrversion = bh->version;
*dataoffset = ntohs(bh->hdrsize);
*hdrflags = ntohs(bh->flags);
return TPM_SUCCESS;
}
| 1
|
477,302
|
void tipc_crypto_stop(struct tipc_crypto **crypto)
{
struct tipc_crypto *c = *crypto;
u8 k;
if (!c)
return;
/* Flush any queued works & destroy wq */
if (is_tx(c)) {
c->rekeying_intv = 0;
cancel_delayed_work_sync(&c->work);
destroy_workqueue(c->wq);
}
/* Release AEAD keys */
rcu_read_lock();
for (k = KEY_MIN; k <= KEY_MAX; k++)
tipc_aead_put(rcu_dereference(c->aead[k]));
rcu_read_unlock();
pr_debug("%s: has been stopped\n", c->name);
/* Free this crypto statistics */
free_percpu(c->stats);
*crypto = NULL;
kfree_sensitive(c);
}
| 0
|
477,265
|
static void tipc_aead_users_inc(struct tipc_aead __rcu *aead, int lim)
{
struct tipc_aead *tmp;
rcu_read_lock();
tmp = rcu_dereference(aead);
if (tmp)
atomic_add_unless(&tmp->users, 1, lim);
rcu_read_unlock();
}
| 0
|
252,327
|
mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip,
const char *pFilename,
mz_file_write_func pCallback,
void *pOpaque, mz_uint flags) {
int file_index = mz_zip_reader_locate_file(pZip, pFilename, NULL, flags);
if (file_index < 0) return MZ_FALSE;
return mz_zip_reader_extract_to_callback(pZip, file_index, pCallback, pOpaque,
flags);
}
| 0
|
259,183
|
static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
uint8_t profile_level;
int ret;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
if (atom.size >= (1<<28) || atom.size < 7)
return AVERROR_INVALIDDATA;
profile_level = avio_r8(pb);
if ((profile_level & 0xf0) != 0xc0)
return 0;
avio_seek(pb, 6, SEEK_CUR);
ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 7);
if (ret < 0)
return ret;
return 0;
}
| 0
|
440,880
|
LogPrintMarkers(void)
{
/* Show what the message marker symbols mean. */
LogWrite(0, "Markers: ");
LogMessageVerb(X_PROBED, 0, "probed, ");
LogMessageVerb(X_CONFIG, 0, "from config file, ");
LogMessageVerb(X_DEFAULT, 0, "default setting,\n\t");
LogMessageVerb(X_CMDLINE, 0, "from command line, ");
LogMessageVerb(X_NOTICE, 0, "notice, ");
LogMessageVerb(X_INFO, 0, "informational,\n\t");
LogMessageVerb(X_WARNING, 0, "warning, ");
LogMessageVerb(X_ERROR, 0, "error, ");
LogMessageVerb(X_NOT_IMPLEMENTED, 0, "not implemented, ");
LogMessageVerb(X_UNKNOWN, 0, "unknown.\n");
}
| 0
|
285,159
|
static char *__get_target_os(r_bin_ne_obj_t *bin) {
switch (bin->ne_header->targOS) {
case 1:
return "OS/2";
case 2:
return "Windows";
case 3:
return "European MS-DOS 4.x";
case 4:
return "Windows 386";
case 5:
return "BOSS (Borland Operating System Services)";
default:
return "Unknown";
}
}
| 0
|
224,218
|
R_API void r_io_bank_fini(RIO *io) {
r_return_if_fail (io);
if (io->banks) {
r_id_storage_foreach (io->banks, _bank_free_cb, NULL);
r_id_storage_free (io->banks);
io->banks = NULL;
}
}
| 0
|
282,873
|
int rsi_handle_card_ready(struct rsi_common *common, u8 *msg)
{
int status;
switch (common->fsm_state) {
case FSM_CARD_NOT_READY:
rsi_dbg(INIT_ZONE, "Card ready indication from Common HAL\n");
rsi_set_default_parameters(common);
if (rsi_send_common_dev_params(common) < 0)
return -EINVAL;
common->fsm_state = FSM_COMMON_DEV_PARAMS_SENT;
break;
case FSM_COMMON_DEV_PARAMS_SENT:
rsi_dbg(INIT_ZONE, "Card ready indication from WLAN HAL\n");
if (common->priv->device_model == RSI_DEV_9116) {
if (msg[16] != MAGIC_WORD) {
rsi_dbg(FSM_ZONE,
"%s: [EEPROM_READ] Invalid token\n",
__func__);
common->fsm_state = FSM_CARD_NOT_READY;
return -EINVAL;
}
memcpy(common->mac_addr, &msg[20], ETH_ALEN);
rsi_dbg(INIT_ZONE, "MAC Addr %pM", common->mac_addr);
}
/* Get usb buffer status register address */
common->priv->usb_buffer_status_reg = *(u32 *)&msg[8];
rsi_dbg(INFO_ZONE, "USB buffer status register = %x\n",
common->priv->usb_buffer_status_reg);
if (common->priv->device_model == RSI_DEV_9116)
status = rsi_load_9116_bootup_params(common);
else
status = rsi_load_bootup_params(common);
if (status < 0) {
common->fsm_state = FSM_CARD_NOT_READY;
return status;
}
common->fsm_state = FSM_BOOT_PARAMS_SENT;
break;
default:
rsi_dbg(ERR_ZONE,
"%s: card ready indication in invalid state %d.\n",
__func__, common->fsm_state);
return -EINVAL;
}
return 0;
}
| 0
|
359,364
|
DEFUN (ip_extcommunity_list_name_standard,
ip_extcommunity_list_name_standard_cmd,
"ip extcommunity-list standard WORD (deny|permit) .AA:NN",
IP_STR
EXTCOMMUNITY_LIST_STR
"Specify standard extcommunity-list\n"
"Extended Community list name\n"
"Specify community to reject\n"
"Specify community to accept\n"
EXTCOMMUNITY_VAL_STR)
{
return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
}
| 0
|
413,824
|
Method* LinkResolver::linktime_resolve_virtual_method_or_null(
const LinkInfo& link_info) {
EXCEPTION_MARK;
Method* method_result = linktime_resolve_virtual_method(link_info, THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
return NULL;
} else {
return method_result;
}
}
| 0
|
229,256
|
sstring to_string(const event::status_change::status_type t) {
using type = event::status_change::status_type;
switch (t) {
case type::UP: return "UP";
case type::DOWN: return "DOWN";
}
throw std::invalid_argument("unknown change type");
}
| 0
|
226,057
|
GF_Box *dec3_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_AC3ConfigBox, GF_ISOM_BOX_TYPE_DAC3);
tmp->cfg.is_ec3 = 1;
return (GF_Box *)tmp;
| 0
|
225,679
|
GF_Err dinf_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_DataInformationBox *dinf;
GF_Err e = gf_isom_box_array_read(s, bs);
if (e) {
return e;
}
dinf = (GF_DataInformationBox *)s;
if (!dinf->dref) {
if (! (gf_bs_get_cookie(bs) & GF_ISOM_BS_COOKIE_NO_LOGS) ) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Missing dref box in dinf\n"));
}
dinf->dref = (GF_DataReferenceBox *) gf_isom_box_new_parent(&dinf->child_boxes, GF_ISOM_BOX_TYPE_DREF);
}
return GF_OK;
}
| 0
|
232,328
|
GF_Err gf_isom_parse_movie_boxes(GF_ISOFile *mov, u32 *boxType, u64 *bytesMissing, Bool progressive_mode)
{
GF_Err e;
GF_Blob *blob = NULL;
//if associated file is a blob, lock blob before parsing !
if (mov->movieFileMap && ((mov->movieFileMap->type == GF_ISOM_DATA_MEM) || (mov->movieFileMap->type == GF_ISOM_DATA_FILE))) {
blob = ((GF_FileDataMap *)mov->movieFileMap)->blob;
}
if (blob)
gf_mx_p(blob->mx);
unused_bytes = 0;
e = gf_isom_parse_movie_boxes_internal(mov, boxType, bytesMissing, progressive_mode);
if (blob)
gf_mx_v(blob->mx);
return e;
}
| 0
|
424,913
|
static void iwl_trans_pcie_configure(struct iwl_trans *trans,
const struct iwl_trans_config *trans_cfg)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
trans_pcie->cmd_queue = trans_cfg->cmd_queue;
trans_pcie->cmd_fifo = trans_cfg->cmd_fifo;
trans_pcie->cmd_q_wdg_timeout = trans_cfg->cmd_q_wdg_timeout;
if (WARN_ON(trans_cfg->n_no_reclaim_cmds > MAX_NO_RECLAIM_CMDS))
trans_pcie->n_no_reclaim_cmds = 0;
else
trans_pcie->n_no_reclaim_cmds = trans_cfg->n_no_reclaim_cmds;
if (trans_pcie->n_no_reclaim_cmds)
memcpy(trans_pcie->no_reclaim_cmds, trans_cfg->no_reclaim_cmds,
trans_pcie->n_no_reclaim_cmds * sizeof(u8));
trans_pcie->rx_buf_size = trans_cfg->rx_buf_size;
trans_pcie->rx_page_order =
iwl_trans_get_rb_size_order(trans_pcie->rx_buf_size);
trans_pcie->bc_table_dword = trans_cfg->bc_table_dword;
trans_pcie->scd_set_active = trans_cfg->scd_set_active;
trans_pcie->sw_csum_tx = trans_cfg->sw_csum_tx;
trans_pcie->page_offs = trans_cfg->cb_data_offs;
trans_pcie->dev_cmd_offs = trans_cfg->cb_data_offs + sizeof(void *);
trans->command_groups = trans_cfg->command_groups;
trans->command_groups_size = trans_cfg->command_groups_size;
/* Initialize NAPI here - it should be before registering to mac80211
* in the opmode but after the HW struct is allocated.
* As this function may be called again in some corner cases don't
* do anything if NAPI was already initialized.
*/
if (trans_pcie->napi_dev.reg_state != NETREG_DUMMY)
init_dummy_netdev(&trans_pcie->napi_dev);
}
| 0
|
463,190
|
EXPORTED int annotate_delete_mailbox(struct mailbox *mailbox)
{
int r = 0;
char *fname = NULL;
annotate_db_t *d = NULL;
init_internal();
assert(mailbox);
/* remove any per-folder annotations from the global db */
r = _annotate_getdb(NULL, 0, /*don't create*/0, &d);
if (r == CYRUSDB_NOTFOUND) {
/* no global database, must not be anything to rename */
r = 0;
goto out;
}
if (r) goto out;
annotate_begin(d);
r = _annotate_rewrite(mailbox,
/*olduid*/0, /*olduserid*/NULL,
/*newmailbox*/NULL,
/*newuid*/0, /*newuserid*/NULL,
/*copy*/0);
if (r) goto out;
/* remove the entire per-folder database */
r = annotate_dbname_mailbox(mailbox, &fname);
if (r) goto out;
/* (gnb)TODO: do we even need to do this?? */
if (unlink(fname) < 0 && errno != ENOENT) {
syslog(LOG_ERR, "cannot unlink %s: %m", fname);
}
r = annotate_commit(d);
out:
annotate_putdb(&d);
free(fname);
return r;
}
| 0
|
406,210
|
static struct libmnt_table *append_fstab(struct libmnt_context *cxt,
struct libmnt_table *fstab,
const char *path)
{
if (!fstab) {
fstab = mnt_new_table();
if (!fstab)
err(MOUNT_EX_SYSERR, _("failed to initialize libmount table"));
mnt_table_set_parser_errcb(fstab, table_parser_errcb);
mnt_context_set_fstab(cxt, fstab);
}
if (mnt_table_parse_fstab(fstab, path))
errx(MOUNT_EX_USAGE,_("%s: failed to parse"), path);
return fstab;
}
| 0
|
233,857
|
static void do_box_sequence(deark *c, struct de_boxesctx *bctx,
i64 pos1, i64 len, i64 max_nboxes, int level)
{
i64 pos;
i64 box_len;
i64 endpos;
int ret;
i64 box_count = 0;
if(level >= 32) { // An arbitrary recursion limit.
return;
}
pos = pos1;
endpos = pos1 + len;
while(pos < endpos) {
if(max_nboxes>=0 && box_count>=max_nboxes) break;
ret = do_box(c, bctx, pos, endpos-pos, level, &box_len);
if(!ret) break;
box_count++;
pos += box_len;
}
}
| 0
|
274,656
|
callbacks_reload_layer_clicked (GtkButton *button, gpointer user_data)
{
gint index = callbacks_get_selected_row_index ();
if (index < 0) {
show_no_layers_warning ();
return;
}
render_remove_selected_objects_belonging_to_layer (
&screen.selectionInfo, mainProject->file[index]->image);
update_selected_object_message (FALSE);
gerbv_revert_file (mainProject, index);
render_refresh_rendered_image_on_screen ();
callbacks_update_layer_tree();
}
| 0
|
336,670
|
void reds_handle_channel_event(RedsState *reds, int event, SpiceChannelEventInfo *info)
{
reds->core.channel_event(&reds->core, event, info);
if (event == SPICE_CHANNEL_EVENT_DISCONNECTED) {
g_free(info);
}
}
| 0
|
90,748
|
void CountOriginType(const std::set<GURL>& origins,
SpecialStoragePolicy* policy,
size_t* protected_origins,
size_t* unlimited_origins) {
DCHECK(protected_origins);
DCHECK(unlimited_origins);
*protected_origins = 0;
*unlimited_origins = 0;
if (!policy)
return;
for (std::set<GURL>::const_iterator itr = origins.begin();
itr != origins.end();
++itr) {
if (policy->IsStorageProtected(*itr))
++*protected_origins;
if (policy->IsStorageUnlimited(*itr))
++*unlimited_origins;
}
}
| 0
|
331,774
|
void QPaintEngineEx::fillRect(const QRectF &r, const QBrush &brush)
{
qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(),
r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() };
QVectorPath vp(pts, 4, nullptr, QVectorPath::RectangleHint);
fill(vp, brush);
}
| 0
|
434,081
|
alist_expand(int *fnum_list, int fnum_len)
{
char_u **old_arg_files;
int old_arg_count;
char_u **new_arg_files;
int new_arg_file_count;
char_u *save_p_su = p_su;
int i;
// Don't use 'suffixes' here. This should work like the shell did the
// expansion. Also, the vimrc file isn't read yet, thus the user
// can't set the options.
p_su = empty_option;
old_arg_files = ALLOC_MULT(char_u *, GARGCOUNT);
if (old_arg_files != NULL)
{
for (i = 0; i < GARGCOUNT; ++i)
old_arg_files[i] = vim_strsave(GARGLIST[i].ae_fname);
old_arg_count = GARGCOUNT;
if (expand_wildcards(old_arg_count, old_arg_files,
&new_arg_file_count, &new_arg_files,
EW_FILE|EW_NOTFOUND|EW_ADDSLASH|EW_NOERROR) == OK
&& new_arg_file_count > 0)
{
alist_set(&global_alist, new_arg_file_count, new_arg_files,
TRUE, fnum_list, fnum_len);
FreeWild(old_arg_count, old_arg_files);
}
}
p_su = save_p_su;
}
| 0
|
477,977
|
void simplestring_add(simplestring* target, const char* source) {
if(target && source) {
simplestring_addn(target, source, strlen(source));
}
}
| 0
|
226,963
|
IRC_PROTOCOL_CALLBACK(734)
{
char *pos_args;
IRC_PROTOCOL_MIN_ARGS(5);
pos_args = (argc > 5) ?
((argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]) : NULL;
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, "monitor", NULL),
date,
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s (%s)",
weechat_prefix ("error"),
(pos_args && pos_args[0]) ? pos_args : "",
argv[3]);
return WEECHAT_RC_OK;
}
| 0
|
506,698
|
static int set_cn2(X509 *crt, const char *name)
{
return set_cn(crt, NID_commonName, "dummy value",
NID_commonName, name, 0);
}
| 0
|
437,389
|
onig_reg_init(regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag,
OnigEncoding enc, OnigSyntaxType* syntax)
{
int r;
xmemset(reg, 0, sizeof(*reg));
if (onig_inited == 0) {
#if 0
return ONIGERR_LIBRARY_IS_NOT_INITIALIZED;
#else
r = onig_initialize(&enc, 1);
if (r != 0)
return ONIGERR_FAIL_TO_INITIALIZE;
onig_warning("You didn't call onig_initialize() explicitly");
#endif
}
if (IS_NULL(reg))
return ONIGERR_INVALID_ARGUMENT;
if (ONIGENC_IS_UNDEF(enc))
return ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED;
if ((option & (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP))
== (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP)) {
return ONIGERR_INVALID_COMBINATION_OF_OPTIONS;
}
if ((option & ONIG_OPTION_NEGATE_SINGLELINE) != 0) {
option |= syntax->options;
option &= ~ONIG_OPTION_SINGLELINE;
}
else
option |= syntax->options;
(reg)->enc = enc;
(reg)->options = option;
(reg)->syntax = syntax;
(reg)->optimize = 0;
(reg)->exact = (UChar* )NULL;
(reg)->extp = (RegexExt* )NULL;
(reg)->p = (UChar* )NULL;
(reg)->alloc = 0;
(reg)->used = 0;
(reg)->name_table = (void* )NULL;
(reg)->case_fold_flag = case_fold_flag;
return 0;
}
| 0
|
238,560
|
static int check_core_relo(struct bpf_verifier_env *env,
const union bpf_attr *attr,
bpfptr_t uattr)
{
u32 i, nr_core_relo, ncopy, expected_size, rec_size;
struct bpf_core_relo core_relo = {};
struct bpf_prog *prog = env->prog;
const struct btf *btf = prog->aux->btf;
struct bpf_core_ctx ctx = {
.log = &env->log,
.btf = btf,
};
bpfptr_t u_core_relo;
int err;
nr_core_relo = attr->core_relo_cnt;
if (!nr_core_relo)
return 0;
if (nr_core_relo > INT_MAX / sizeof(struct bpf_core_relo))
return -EINVAL;
rec_size = attr->core_relo_rec_size;
if (rec_size < MIN_CORE_RELO_SIZE ||
rec_size > MAX_CORE_RELO_SIZE ||
rec_size % sizeof(u32))
return -EINVAL;
u_core_relo = make_bpfptr(attr->core_relos, uattr.is_kernel);
expected_size = sizeof(struct bpf_core_relo);
ncopy = min_t(u32, expected_size, rec_size);
/* Unlike func_info and line_info, copy and apply each CO-RE
* relocation record one at a time.
*/
for (i = 0; i < nr_core_relo; i++) {
/* future proofing when sizeof(bpf_core_relo) changes */
err = bpf_check_uarg_tail_zero(u_core_relo, expected_size, rec_size);
if (err) {
if (err == -E2BIG) {
verbose(env, "nonzero tailing record in core_relo");
if (copy_to_bpfptr_offset(uattr,
offsetof(union bpf_attr, core_relo_rec_size),
&expected_size, sizeof(expected_size)))
err = -EFAULT;
}
break;
}
if (copy_from_bpfptr(&core_relo, u_core_relo, ncopy)) {
err = -EFAULT;
break;
}
if (core_relo.insn_off % 8 || core_relo.insn_off / 8 >= prog->len) {
verbose(env, "Invalid core_relo[%u].insn_off:%u prog->len:%u\n",
i, core_relo.insn_off, prog->len);
err = -EINVAL;
break;
}
err = bpf_core_apply(&ctx, &core_relo, i,
&prog->insnsi[core_relo.insn_off / 8]);
if (err)
break;
bpfptr_add(&u_core_relo, rec_size);
}
return err;
}
| 0
|
441,819
|
SProcXkbGetDeviceInfo(ClientPtr client)
{
REQUEST(xkbGetDeviceInfoReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xkbGetDeviceInfoReq);
swaps(&stuff->deviceSpec);
swaps(&stuff->wanted);
swaps(&stuff->ledClass);
swaps(&stuff->ledID);
return ProcXkbGetDeviceInfo(client);
}
| 0
|
477,368
|
R_API void r_bin_java_print_element_pair_summary(RBinJavaElementValuePair *evp) {
if (!evp) {
eprintf ("Attempting to print an invalid RBinJavaElementValuePair *pair.\n");
return;
}
Eprintf ("Element Value Pair information:\n");
Eprintf (" EV Pair File Offset: 0x%08"PFMT64x "\n", evp->file_offset);
Eprintf (" EV Pair Element Name index: 0x%02x\n", evp->element_name_idx);
Eprintf (" EV Pair Element Name: %s\n", evp->name);
Eprintf (" EV Pair Element Value:\n");
r_bin_java_print_element_value_summary (evp->value);
}
| 0
|
238,631
|
static int check_map_func_compatibility(struct bpf_verifier_env *env,
struct bpf_map *map, int func_id)
{
if (!map)
return 0;
/* We need a two way check, first is from map perspective ... */
switch (map->map_type) {
case BPF_MAP_TYPE_PROG_ARRAY:
if (func_id != BPF_FUNC_tail_call)
goto error;
break;
case BPF_MAP_TYPE_PERF_EVENT_ARRAY:
if (func_id != BPF_FUNC_perf_event_read &&
func_id != BPF_FUNC_perf_event_output &&
func_id != BPF_FUNC_skb_output &&
func_id != BPF_FUNC_perf_event_read_value &&
func_id != BPF_FUNC_xdp_output)
goto error;
break;
case BPF_MAP_TYPE_RINGBUF:
if (func_id != BPF_FUNC_ringbuf_output &&
func_id != BPF_FUNC_ringbuf_reserve &&
func_id != BPF_FUNC_ringbuf_query)
goto error;
break;
case BPF_MAP_TYPE_STACK_TRACE:
if (func_id != BPF_FUNC_get_stackid)
goto error;
break;
case BPF_MAP_TYPE_CGROUP_ARRAY:
if (func_id != BPF_FUNC_skb_under_cgroup &&
func_id != BPF_FUNC_current_task_under_cgroup)
goto error;
break;
case BPF_MAP_TYPE_CGROUP_STORAGE:
case BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE:
if (func_id != BPF_FUNC_get_local_storage)
goto error;
break;
case BPF_MAP_TYPE_DEVMAP:
case BPF_MAP_TYPE_DEVMAP_HASH:
if (func_id != BPF_FUNC_redirect_map &&
func_id != BPF_FUNC_map_lookup_elem)
goto error;
break;
/* Restrict bpf side of cpumap and xskmap, open when use-cases
* appear.
*/
case BPF_MAP_TYPE_CPUMAP:
if (func_id != BPF_FUNC_redirect_map)
goto error;
break;
case BPF_MAP_TYPE_XSKMAP:
if (func_id != BPF_FUNC_redirect_map &&
func_id != BPF_FUNC_map_lookup_elem)
goto error;
break;
case BPF_MAP_TYPE_ARRAY_OF_MAPS:
case BPF_MAP_TYPE_HASH_OF_MAPS:
if (func_id != BPF_FUNC_map_lookup_elem)
goto error;
break;
case BPF_MAP_TYPE_SOCKMAP:
if (func_id != BPF_FUNC_sk_redirect_map &&
func_id != BPF_FUNC_sock_map_update &&
func_id != BPF_FUNC_map_delete_elem &&
func_id != BPF_FUNC_msg_redirect_map &&
func_id != BPF_FUNC_sk_select_reuseport &&
func_id != BPF_FUNC_map_lookup_elem &&
!may_update_sockmap(env, func_id))
goto error;
break;
case BPF_MAP_TYPE_SOCKHASH:
if (func_id != BPF_FUNC_sk_redirect_hash &&
func_id != BPF_FUNC_sock_hash_update &&
func_id != BPF_FUNC_map_delete_elem &&
func_id != BPF_FUNC_msg_redirect_hash &&
func_id != BPF_FUNC_sk_select_reuseport &&
func_id != BPF_FUNC_map_lookup_elem &&
!may_update_sockmap(env, func_id))
goto error;
break;
case BPF_MAP_TYPE_REUSEPORT_SOCKARRAY:
if (func_id != BPF_FUNC_sk_select_reuseport)
goto error;
break;
case BPF_MAP_TYPE_QUEUE:
case BPF_MAP_TYPE_STACK:
if (func_id != BPF_FUNC_map_peek_elem &&
func_id != BPF_FUNC_map_pop_elem &&
func_id != BPF_FUNC_map_push_elem)
goto error;
break;
case BPF_MAP_TYPE_SK_STORAGE:
if (func_id != BPF_FUNC_sk_storage_get &&
func_id != BPF_FUNC_sk_storage_delete)
goto error;
break;
case BPF_MAP_TYPE_INODE_STORAGE:
if (func_id != BPF_FUNC_inode_storage_get &&
func_id != BPF_FUNC_inode_storage_delete)
goto error;
break;
case BPF_MAP_TYPE_TASK_STORAGE:
if (func_id != BPF_FUNC_task_storage_get &&
func_id != BPF_FUNC_task_storage_delete)
goto error;
break;
case BPF_MAP_TYPE_BLOOM_FILTER:
if (func_id != BPF_FUNC_map_peek_elem &&
func_id != BPF_FUNC_map_push_elem)
goto error;
break;
default:
break;
}
/* ... and second from the function itself. */
switch (func_id) {
case BPF_FUNC_tail_call:
if (map->map_type != BPF_MAP_TYPE_PROG_ARRAY)
goto error;
if (env->subprog_cnt > 1 && !allow_tail_call_in_subprogs(env)) {
verbose(env, "tail_calls are not allowed in non-JITed programs with bpf-to-bpf calls\n");
return -EINVAL;
}
break;
case BPF_FUNC_perf_event_read:
case BPF_FUNC_perf_event_output:
case BPF_FUNC_perf_event_read_value:
case BPF_FUNC_skb_output:
case BPF_FUNC_xdp_output:
if (map->map_type != BPF_MAP_TYPE_PERF_EVENT_ARRAY)
goto error;
break;
case BPF_FUNC_ringbuf_output:
case BPF_FUNC_ringbuf_reserve:
case BPF_FUNC_ringbuf_query:
if (map->map_type != BPF_MAP_TYPE_RINGBUF)
goto error;
break;
case BPF_FUNC_get_stackid:
if (map->map_type != BPF_MAP_TYPE_STACK_TRACE)
goto error;
break;
case BPF_FUNC_current_task_under_cgroup:
case BPF_FUNC_skb_under_cgroup:
if (map->map_type != BPF_MAP_TYPE_CGROUP_ARRAY)
goto error;
break;
case BPF_FUNC_redirect_map:
if (map->map_type != BPF_MAP_TYPE_DEVMAP &&
map->map_type != BPF_MAP_TYPE_DEVMAP_HASH &&
map->map_type != BPF_MAP_TYPE_CPUMAP &&
map->map_type != BPF_MAP_TYPE_XSKMAP)
goto error;
break;
case BPF_FUNC_sk_redirect_map:
case BPF_FUNC_msg_redirect_map:
case BPF_FUNC_sock_map_update:
if (map->map_type != BPF_MAP_TYPE_SOCKMAP)
goto error;
break;
case BPF_FUNC_sk_redirect_hash:
case BPF_FUNC_msg_redirect_hash:
case BPF_FUNC_sock_hash_update:
if (map->map_type != BPF_MAP_TYPE_SOCKHASH)
goto error;
break;
case BPF_FUNC_get_local_storage:
if (map->map_type != BPF_MAP_TYPE_CGROUP_STORAGE &&
map->map_type != BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE)
goto error;
break;
case BPF_FUNC_sk_select_reuseport:
if (map->map_type != BPF_MAP_TYPE_REUSEPORT_SOCKARRAY &&
map->map_type != BPF_MAP_TYPE_SOCKMAP &&
map->map_type != BPF_MAP_TYPE_SOCKHASH)
goto error;
break;
case BPF_FUNC_map_pop_elem:
if (map->map_type != BPF_MAP_TYPE_QUEUE &&
map->map_type != BPF_MAP_TYPE_STACK)
goto error;
break;
case BPF_FUNC_map_peek_elem:
case BPF_FUNC_map_push_elem:
if (map->map_type != BPF_MAP_TYPE_QUEUE &&
map->map_type != BPF_MAP_TYPE_STACK &&
map->map_type != BPF_MAP_TYPE_BLOOM_FILTER)
goto error;
break;
case BPF_FUNC_sk_storage_get:
case BPF_FUNC_sk_storage_delete:
if (map->map_type != BPF_MAP_TYPE_SK_STORAGE)
goto error;
break;
case BPF_FUNC_inode_storage_get:
case BPF_FUNC_inode_storage_delete:
if (map->map_type != BPF_MAP_TYPE_INODE_STORAGE)
goto error;
break;
case BPF_FUNC_task_storage_get:
case BPF_FUNC_task_storage_delete:
if (map->map_type != BPF_MAP_TYPE_TASK_STORAGE)
goto error;
break;
default:
break;
}
return 0;
error:
verbose(env, "cannot pass map_type %d into func %s#%d\n",
map->map_type, func_id_name(func_id), func_id);
return -EINVAL;
}
| 0
|
237,877
|
qeh_in_on_close (struct lsquic_stream *stream, lsquic_stream_ctx_t *ctx)
{
struct qpack_enc_hdl *const qeh = (void *) ctx;
LSQ_DEBUG("closed incoming decoder stream");
qeh->qeh_dec_sm_in = NULL;
}
| 0
|
328,843
|
R_API void r_bin_java_get_method_json_definition(RBinJavaObj *bin, RBinJavaField *fm_type, PJ *pj) {
r_bin_java_get_fm_type_definition_json (bin, fm_type, pj, 1);
}
| 0
|
386,526
|
bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/) {
// Allocate Spline knots (group code 72):
if (groupCode==72) {
maxKnots = toInt(groupValue);
if (maxKnots>0) {
if (knots!=NULL) {
delete[] knots;
}
knots = new double[maxKnots];
for (int i=0; i<maxKnots; ++i) {
knots[i] = 0.0;
}
}
knotIndex=-1;
return true;
}
// Allocate Spline control points / weights (group code 73):
else if (groupCode==73) {
maxControlPoints = toInt(groupValue);
if (maxControlPoints>0) {
if (controlPoints!=NULL) {
delete[] controlPoints;
}
if (weights!=NULL) {
delete[] weights;
}
controlPoints = new double[3*maxControlPoints];
weights = new double[maxControlPoints];
for (int i=0; i<maxControlPoints; ++i) {
controlPoints[i*3] = 0.0;
controlPoints[i*3+1] = 0.0;
controlPoints[i*3+2] = 0.0;
weights[i] = 1.0;
}
}
controlPointIndex=-1;
weightIndex=-1;
return true;
}
// Allocate Spline fit points (group code 74):
else if (groupCode==74) {
maxFitPoints = toInt(groupValue);
if (maxFitPoints>0) {
if (fitPoints!=NULL) {
delete[] fitPoints;
}
fitPoints = new double[3*maxFitPoints];
for (int i=0; i<maxFitPoints; ++i) {
fitPoints[i*3] = 0.0;
fitPoints[i*3+1] = 0.0;
fitPoints[i*3+2] = 0.0;
}
}
fitPointIndex=-1;
return true;
}
// Process spline knot vertices (group code 40):
else if (groupCode==40) {
if (knotIndex<maxKnots-1) {
knotIndex++;
knots[knotIndex] = toReal(groupValue);
}
return true;
}
// Process spline control points (group codes 10/20/30):
else if (groupCode==10 || groupCode==20 ||
groupCode==30) {
if (controlPointIndex<maxControlPoints-1 && groupCode==10) {
controlPointIndex++;
}
if (controlPointIndex>=0 && controlPointIndex<maxControlPoints) {
controlPoints[3*controlPointIndex + (groupCode/10-1)] = toReal(groupValue);
}
return true;
}
// Process spline fit points (group codes 11/21/31):
else if (groupCode==11 || groupCode==21 || groupCode==31) {
if (fitPointIndex<maxFitPoints-1 && groupCode==11) {
fitPointIndex++;
}
if (fitPointIndex>=0 && fitPointIndex<maxFitPoints) {
fitPoints[3*fitPointIndex + ((groupCode-1)/10-1)] = toReal(groupValue);
}
return true;
}
// Process spline weights (group code 41)
else if (groupCode==41) {
if (weightIndex<maxControlPoints-1) {
weightIndex++;
}
if (weightIndex>=0 && weightIndex<maxControlPoints) {
weights[weightIndex] = toReal(groupValue);
}
return true;
}
return false;
}
| 0
|
382,793
|
static dynamicPtr * newDynamic (int initialSize, void *data, int freeOKFlag)
{
dynamicPtr *dp;
dp = (dynamicPtr *) gdMalloc (sizeof (dynamicPtr));
allocDynamic (dp, initialSize, data);
dp->pos = 0;
dp->freeOK = freeOKFlag;
return dp;
}
| 0
|
513,172
|
sys_var_pluginvar::sys_var_pluginvar(sys_var_chain *chain, const char *name_arg,
st_plugin_int *p, st_mysql_sys_var *pv)
: sys_var(chain, name_arg, pv->comment, pluginvar_sysvar_flags(pv),
0, pv->flags & PLUGIN_VAR_NOCMDOPT ? -1 : 0, NO_ARG,
pluginvar_show_type(pv), 0,
NULL, VARIABLE_NOT_IN_BINLOG, NULL, NULL, NULL),
plugin(p), plugin_var(pv)
{
plugin_var->name= name_arg;
plugin_opt_set_limits(&option, pv);
}
| 0
|
293,741
|
static RList *symbols(RBinFile *bf) {
RList *ret = r_list_newf (free);
if (!ret) {
return NULL;
}
RKernelCacheObj *obj = (RKernelCacheObj*) bf->o->bin_obj;
symbols_from_mach0 (ret, obj->mach0, bf, 0, 0);
HtPP *kernel_syms_by_addr = sdb_ht_new ();
if (!kernel_syms_by_addr) {
r_list_free (ret);
return NULL;
}
RListIter *iter;
RBinSymbol *sym;
ut64 enosys_addr = 0;
r_list_foreach (ret, iter, sym) {
r_strf_var (key, 64, "%"PFMT64x, sym->vaddr);
sdb_ht_insert (kernel_syms_by_addr, key, sym->dname ? sym->dname : sym->name);
if (!enosys_addr && strstr (sym->name, "enosys")) {
enosys_addr = sym->vaddr;
}
}
RList *syscalls = resolve_syscalls (obj, enosys_addr);
if (syscalls) {
r_list_foreach (syscalls, iter, sym) {
r_strf_var (key, 32, "%"PFMT64x, sym->vaddr);
sdb_ht_insert (kernel_syms_by_addr, key, sym->name);
r_list_append (ret, sym);
}
syscalls->free = NULL;
r_list_free (syscalls);
}
RList *subsystem = resolve_mig_subsystem (obj);
if (subsystem) {
r_list_foreach (subsystem, iter, sym) {
r_strf_var (key, 64, "%"PFMT64x, sym->vaddr);
sdb_ht_insert (kernel_syms_by_addr, key, sym->name);
r_list_append (ret, sym);
}
subsystem->free = NULL;
r_list_free (subsystem);
}
ensure_kexts_initialized (obj, bf);
RKext *kext;
int kiter;
ut64 *inits = NULL;
ut64 *terms = NULL;
r_kext_index_foreach (obj->kexts, kiter, kext) {
ut8 magicbytes[4];
r_buf_read_at (obj->cache_buf, kext->range.offset, magicbytes, 4);
int magic = r_read_le32 (magicbytes);
switch (magic) {
case MH_MAGIC_64:
symbols_from_mach0 (ret, kext->mach0, bf, kext->range.offset, r_list_length (ret));
symbols_from_stubs (ret, kernel_syms_by_addr, obj, bf, kext, r_list_length (ret));
process_constructors (obj, kext->mach0, ret, kext->range.offset, false, R_K_CONSTRUCTOR_TO_SYMBOL, kext_short_name (kext));
process_kmod_init_term (obj, kext, ret, &inits, &terms);
break;
default:
eprintf ("Unknown sub-bin\n");
break;
}
}
R_FREE (inits);
R_FREE (terms);
sdb_ht_free (kernel_syms_by_addr);
return ret;
}
| 0
|
384,782
|
linetabsize(char_u *s)
{
return linetabsize_col(0, s);
}
| 0
|
468,352
|
g_socket_client_get_proxy_resolver (GSocketClient *client)
{
if (client->priv->proxy_resolver)
return client->priv->proxy_resolver;
else
return g_proxy_resolver_get_default ();
}
| 0
|
500,072
|
kssl_krb5_get_server_rcache(krb5_context con, krb5_const krb5_data * data,
krb5_rcache * rcache)
{
if ( p_krb5_get_server_rcache )
return(p_krb5_get_server_rcache(con,data,rcache));
else
return KRB5KRB_ERR_GENERIC;
}
| 0
|
301,375
|
static uint64_t vfswrap_disk_free(vfs_handle_struct *handle, const char *path, bool small_query, uint64_t *bsize,
uint64_t *dfree, uint64_t *dsize)
{
uint64_t result;
result = sys_disk_free(handle->conn, path, small_query, bsize, dfree, dsize);
return result;
}
| 0
|
236,126
|
GF_Err text_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
u16 pSize;
GF_TextSampleEntryBox *ptr = (GF_TextSampleEntryBox*)s;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_bs_write_data(bs, ptr->reserved, 6);
gf_bs_write_u16(bs, ptr->dataReferenceIndex);
gf_bs_write_u32(bs, ptr->displayFlags); /*Display flags*/
gf_bs_write_u32(bs, ptr->textJustification); /*Text justification*/
gf_bs_write_data(bs, ptr->background_color, 6); /*Background color*/
gpp_write_box(bs, &ptr->default_box); /*Default text box*/
gf_bs_write_data(bs, ptr->reserved1, 8); /*Reserved*/
gf_bs_write_u16(bs, ptr->fontNumber); /*Font number*/
gf_bs_write_u16(bs, ptr->fontFace); /*Font face*/
gf_bs_write_u8(bs, ptr->reserved2); /*Reserved*/
gf_bs_write_u16(bs, ptr->reserved3); /*Reserved*/
gf_bs_write_data(bs, ptr->foreground_color, 6); /*Foreground color*/
//pSize assignment below is not a mistake
if (ptr->textName && (pSize = (u16) strlen(ptr->textName))) {
gf_bs_write_u8(bs, pSize); /*a Pascal string begins with its size*/
gf_bs_write_data(bs, ptr->textName, pSize); /*Font name*/
} else {
gf_bs_write_u8(bs, 0);
}
return GF_OK;
}
| 0
|
238,652
|
static int set_loop_callback_state(struct bpf_verifier_env *env,
struct bpf_func_state *caller,
struct bpf_func_state *callee,
int insn_idx)
{
/* bpf_loop(u32 nr_loops, void *callback_fn, void *callback_ctx,
* u64 flags);
* callback_fn(u32 index, void *callback_ctx);
*/
callee->regs[BPF_REG_1].type = SCALAR_VALUE;
callee->regs[BPF_REG_2] = caller->regs[BPF_REG_3];
/* unused */
__mark_reg_not_init(env, &callee->regs[BPF_REG_3]);
__mark_reg_not_init(env, &callee->regs[BPF_REG_4]);
__mark_reg_not_init(env, &callee->regs[BPF_REG_5]);
callee->in_callback_fn = true;
return 0;
}
| 0
|
226,024
|
GF_Err dinf_box_write(GF_Box *s, GF_BitStream *bs)
{
return gf_isom_box_write_header(s, bs);
}
| 0
|
267,950
|
R_API RBinPlugin *r_bin_file_cur_plugin(RBinFile *bf) {
return (bf && bf->o)? bf->o->plugin: NULL;
}
| 0
|
344,800
|
vdollar_percent_expand(int *parseerror, int dollar, int percent,
const char *string, va_list ap)
{
#define EXPAND_MAX_KEYS 16
u_int num_keys = 0, i;
struct {
const char *key;
const char *repl;
} keys[EXPAND_MAX_KEYS];
struct sshbuf *buf;
int r, missingvar = 0;
char *ret = NULL, *var, *varend, *val;
size_t len;
if ((buf = sshbuf_new()) == NULL)
fatal_f("sshbuf_new failed");
if (parseerror == NULL)
fatal_f("null parseerror arg");
*parseerror = 1;
/* Gather keys if we're doing percent expansion. */
if (percent) {
for (num_keys = 0; num_keys < EXPAND_MAX_KEYS; num_keys++) {
keys[num_keys].key = va_arg(ap, char *);
if (keys[num_keys].key == NULL)
break;
keys[num_keys].repl = va_arg(ap, char *);
if (keys[num_keys].repl == NULL) {
fatal_f("NULL replacement for token %s",
keys[num_keys].key);
}
}
if (num_keys == EXPAND_MAX_KEYS && va_arg(ap, char *) != NULL)
fatal_f("too many keys");
if (num_keys == 0)
fatal_f("percent expansion without token list");
}
/* Expand string */
for (i = 0; *string != '\0'; string++) {
/* Optionally process ${ENVIRONMENT} expansions. */
if (dollar && string[0] == '$' && string[1] == '{') {
string += 2; /* skip over '${' */
if ((varend = strchr(string, '}')) == NULL) {
error_f("environment variable '%s' missing "
"closing '}'", string);
goto out;
}
len = varend - string;
if (len == 0) {
error_f("zero-length environment variable");
goto out;
}
var = xmalloc(len + 1);
(void)strlcpy(var, string, len + 1);
if ((val = getenv(var)) == NULL) {
error_f("env var ${%s} has no value", var);
missingvar = 1;
} else {
debug3_f("expand ${%s} -> '%s'", var, val);
if ((r = sshbuf_put(buf, val, strlen(val))) !=0)
fatal_fr(r, "sshbuf_put ${}");
}
free(var);
string += len;
continue;
}
/*
* Process percent expansions if we have a list of TOKENs.
* If we're not doing percent expansion everything just gets
* appended here.
*/
if (*string != '%' || !percent) {
append:
if ((r = sshbuf_put_u8(buf, *string)) != 0)
fatal_fr(r, "sshbuf_put_u8 %%");
continue;
}
string++;
/* %% case */
if (*string == '%')
goto append;
if (*string == '\0') {
error_f("invalid format");
goto out;
}
for (i = 0; i < num_keys; i++) {
if (strchr(keys[i].key, *string) != NULL) {
if ((r = sshbuf_put(buf, keys[i].repl,
strlen(keys[i].repl))) != 0)
fatal_fr(r, "sshbuf_put %%-repl");
break;
}
}
if (i >= num_keys) {
error_f("unknown key %%%c", *string);
goto out;
}
}
if (!missingvar && (ret = sshbuf_dup_string(buf)) == NULL)
fatal_f("sshbuf_dup_string failed");
*parseerror = 0;
out:
sshbuf_free(buf);
return *parseerror ? NULL : ret;
#undef EXPAND_MAX_KEYS
}
| 0
|
512,774
|
Item_bool_rowready_func2* Ne_creator::create_swap(THD *thd, Item *a, Item *b) const
{
return new(thd->mem_root) Item_func_ne(thd, b, a);
}
| 0
|
236,208
|
void hclr_box_del(GF_Box *s)
{
gf_free(s);
}
| 0
|
474,076
|
euckr_is_allowed_reverse_match(const UChar* s, const UChar* end ARG_UNUSED, OnigEncoding enc ARG_UNUSED)
{
const UChar c = *s;
if (c <= 0x7e) return TRUE;
else return FALSE;
}
| 0
|
224,709
|
GF_Err iinf_on_child_box(GF_Box *s, GF_Box *a, Bool is_rem)
{
GF_ItemInfoBox *ptr = (GF_ItemInfoBox *)s;
if (a->type == GF_ISOM_BOX_TYPE_INFE) {
BOX_FIELD_LIST_ASSIGN(item_infos)
return GF_OK;
} else {
return GF_OK;
}
}
| 0
|
402,639
|
cmpstringp(const void *p1, const void *p2)
{
return strcmp(*(char * const *)p1, *(char * const *)p2);
}
| 0
|
226,259
|
GF_Err rtp_hnti_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_RTPBox *ptr = (GF_RTPBox *)s;
if (ptr == NULL) return GF_BAD_PARAM;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_bs_write_u32(bs, ptr->subType);
//don't write the NULL char!!!
gf_bs_write_data(bs, ptr->sdpText, (u32) strlen(ptr->sdpText));
return GF_OK;
}
| 0
|
459,101
|
static void tc_chain_tmplt_del(const struct tcf_proto_ops *tmplt_ops,
void *tmplt_priv)
{
/* If template ops are set, no work to do for us. */
if (!tmplt_ops)
return;
tmplt_ops->tmplt_destroy(tmplt_priv);
module_put(tmplt_ops->owner);
}
| 0
|
477,276
|
int tipc_crypto_key_init(struct tipc_crypto *c, struct tipc_aead_key *ukey,
u8 mode, bool master_key)
{
struct tipc_aead *aead = NULL;
int rc = 0;
/* Initiate with the new user key */
rc = tipc_aead_init(&aead, ukey, mode);
/* Attach it to the crypto */
if (likely(!rc)) {
rc = tipc_crypto_key_attach(c, aead, 0, master_key);
if (rc < 0)
tipc_aead_free(&aead->rcu);
}
return rc;
}
| 0
|
317,270
|
static int smk_curacc_on_task(struct task_struct *p, int access,
const char *caller)
{
struct smk_audit_info ad;
struct smack_known *skp = smk_of_task_struct_obj(p);
int rc;
smk_ad_init(&ad, caller, LSM_AUDIT_DATA_TASK);
smk_ad_setfield_u_tsk(&ad, p);
rc = smk_curacc(skp, access, &ad);
rc = smk_bu_task(p, access, rc);
return rc;
}
| 0
|
376,338
|
gpg_context_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
case PROP_ALWAYS_TRUST:
camel_gpg_context_set_always_trust (
CAMEL_GPG_CONTEXT (object),
g_value_get_boolean (value));
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
| 0
|
247,719
|
TestUtilOptionsV2& setExpectedServerCertDigest(const std::string& expected_server_cert_digest) {
expected_server_cert_digest_ = expected_server_cert_digest;
return *this;
}
| 0
|
450,362
|
static int vnc_refresh_server_surface(VncDisplay *vd)
{
int width = MIN(pixman_image_get_width(vd->guest.fb),
pixman_image_get_width(vd->server));
int height = MIN(pixman_image_get_height(vd->guest.fb),
pixman_image_get_height(vd->server));
int cmp_bytes, server_stride, line_bytes, guest_ll, guest_stride, y = 0;
uint8_t *guest_row0 = NULL, *server_row0;
VncState *vs;
int has_dirty = 0;
pixman_image_t *tmpbuf = NULL;
struct timeval tv = { 0, 0 };
if (!vd->non_adaptive) {
gettimeofday(&tv, NULL);
has_dirty = vnc_update_stats(vd, &tv);
}
/*
* Walk through the guest dirty map.
* Check and copy modified bits from guest to server surface.
* Update server dirty map.
*/
server_row0 = (uint8_t *)pixman_image_get_data(vd->server);
server_stride = guest_stride = guest_ll =
pixman_image_get_stride(vd->server);
cmp_bytes = MIN(VNC_DIRTY_PIXELS_PER_BIT * VNC_SERVER_FB_BYTES,
server_stride);
if (vd->guest.format != VNC_SERVER_FB_FORMAT) {
int width = pixman_image_get_width(vd->server);
tmpbuf = qemu_pixman_linebuf_create(VNC_SERVER_FB_FORMAT, width);
} else {
int guest_bpp =
PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
guest_stride = pixman_image_get_stride(vd->guest.fb);
guest_ll = pixman_image_get_width(vd->guest.fb)
* DIV_ROUND_UP(guest_bpp, 8);
}
line_bytes = MIN(server_stride, guest_ll);
for (;;) {
int x;
uint8_t *guest_ptr, *server_ptr;
unsigned long offset = find_next_bit((unsigned long *) &vd->guest.dirty,
height * VNC_DIRTY_BPL(&vd->guest),
y * VNC_DIRTY_BPL(&vd->guest));
if (offset == height * VNC_DIRTY_BPL(&vd->guest)) {
/* no more dirty bits */
break;
}
y = offset / VNC_DIRTY_BPL(&vd->guest);
x = offset % VNC_DIRTY_BPL(&vd->guest);
server_ptr = server_row0 + y * server_stride + x * cmp_bytes;
if (vd->guest.format != VNC_SERVER_FB_FORMAT) {
qemu_pixman_linebuf_fill(tmpbuf, vd->guest.fb, width, 0, y);
guest_ptr = (uint8_t *)pixman_image_get_data(tmpbuf);
} else {
guest_ptr = guest_row0 + y * guest_stride;
}
guest_ptr += x * cmp_bytes;
for (; x < DIV_ROUND_UP(width, VNC_DIRTY_PIXELS_PER_BIT);
x++, guest_ptr += cmp_bytes, server_ptr += cmp_bytes) {
int _cmp_bytes = cmp_bytes;
if (!test_and_clear_bit(x, vd->guest.dirty[y])) {
continue;
}
if ((x + 1) * cmp_bytes > line_bytes) {
_cmp_bytes = line_bytes - x * cmp_bytes;
}
assert(_cmp_bytes >= 0);
if (memcmp(server_ptr, guest_ptr, _cmp_bytes) == 0) {
continue;
}
memcpy(server_ptr, guest_ptr, _cmp_bytes);
if (!vd->non_adaptive) {
vnc_rect_updated(vd, x * VNC_DIRTY_PIXELS_PER_BIT,
y, &tv);
}
QTAILQ_FOREACH(vs, &vd->clients, next) {
set_bit(x, vs->dirty[y]);
}
has_dirty++;
}
y++;
}
qemu_pixman_image_unref(tmpbuf);
return has_dirty;
}
| 0
|
369,889
|
static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct inode *inode = dentry->d_inode;
int error = -EACCES;
/* We don't need a base pointer in the /proc filesystem */
path_put(&nd->path);
/* Are we allowed to snoop on the tasks file descriptors? */
if (!proc_fd_access_allowed(inode))
goto out;
error = PROC_I(inode)->op.proc_get_link(dentry, &nd->path);
out:
return ERR_PTR(error);
}
| 0
|
432,193
|
void cpu_exec_unrealizefn(CPUState *cpu)
{
}
| 0
|
359,376
|
DEFUN (no_neighbor_attr_unchanged4,
no_neighbor_attr_unchanged4_cmd,
NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
NO_STR
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"BGP attribute is propagated unchanged to this neighbor\n"
"Med attribute\n"
"As-path attribute\n"
"Nexthop attribute\n")
{
u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
if (strncmp (argv[1], "as-path", 1) == 0)
SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
else if (strncmp (argv[1], "next-hop", 1) == 0)
SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
bgp_node_safi (vty), flags);
}
| 0
|
221,691
|
int Socket::getPeerSourcePort() {
return ntohs(peer_adr.sin_port);
}
| 0
|
281,633
|
void CLASS parse_fuji (int offset)
{
unsigned entries, tag, len, save, c;
fseek (ifp, offset, SEEK_SET);
entries = get4();
if (entries > 255) return;
while (entries--) {
tag = get2();
len = get2();
save = ftell(ifp);
if (tag == 0x100) {
raw_height = get2();
raw_width = get2();
} else if (tag == 0x121) {
height = get2();
if ((width = get2()) == 4284) width += 3;
} else if (tag == 0x130) {
fuji_layout = fgetc(ifp) >> 7;
fuji_width = !(fgetc(ifp) & 8);
} else if (tag == 0x131) {
filters = 9;
FORC(36) xtrans[0][35-c] = fgetc(ifp) & 3;
} else if (tag == 0x2ff0) {
FORC4 cam_mul[c ^ 1] = get2();
} else if (tag == 0xc000) {
c = order;
order = 0x4949;
if ((tag = get4()) > 10000) tag = get4();
width = tag;
height = get4();
order = c;
}
fseek (ifp, save+len, SEEK_SET);
}
height <<= fuji_layout;
width >>= fuji_layout;
}
| 0
|
227,010
|
IRC_PROTOCOL_CALLBACK(cap)
{
char *ptr_caps, **caps_supported, **caps_added, **caps_removed;
char **caps_enabled, *pos_value, *str_name, **str_caps;
char str_msg_auth[512], **str_caps_enabled, **str_caps_disabled;
int num_caps_supported, num_caps_added, num_caps_removed;
int num_caps_enabled, sasl_to_do, sasl_mechanism;
int i, timeout, last_reply;
IRC_PROTOCOL_MIN_ARGS(4);
if (strcmp (argv[3], "LS") == 0)
{
if (argc > 4)
{
if (argc > 5 && (strcmp (argv[4], "*") == 0))
{
ptr_caps = argv_eol[5];
last_reply = 0;
}
else
{
ptr_caps = argv_eol[4];
last_reply = 1;
}
if (!server->checking_cap_ls)
{
weechat_hashtable_remove_all (server->cap_ls);
server->checking_cap_ls = 1;
}
if (last_reply)
server->checking_cap_ls = 0;
if (ptr_caps[0] == ':')
ptr_caps++;
caps_supported = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_caps_supported);
if (caps_supported)
{
for (i = 0; i < num_caps_supported; i++)
{
pos_value = strstr (caps_supported[i], "=");
if (pos_value)
{
str_name = strndup (caps_supported[i],
pos_value - caps_supported[i]);
if (str_name)
{
weechat_hashtable_set (server->cap_ls,
str_name, pos_value + 1);
free (str_name);
}
}
else
{
weechat_hashtable_set (server->cap_ls,
caps_supported[i], NULL);
}
}
}
if (last_reply)
{
str_caps = weechat_string_dyn_alloc (128);
weechat_hashtable_map_string (server->cap_ls,
irc_protocol_cap_print_cb,
str_caps);
weechat_printf_date_tags (
server->buffer, date, NULL,
_("%s%s: client capability, server supports: %s"),
weechat_prefix ("network"),
IRC_PLUGIN_NAME,
*str_caps);
weechat_string_dyn_free (str_caps, 1);
}
/* auto-enable capabilities only when connecting to server */
if (last_reply && !server->is_connected)
irc_protocol_cap_sync (server, 1);
if (caps_supported)
weechat_string_free_split (caps_supported);
}
}
else if (strcmp (argv[3], "LIST") == 0)
{
if (argc > 4)
{
if (argc > 5 && (strcmp (argv[4], "*") == 0))
{
ptr_caps = argv_eol[5];
last_reply = 0;
}
else
{
ptr_caps = argv_eol[4];
last_reply = 1;
}
if (!server->checking_cap_list)
{
weechat_hashtable_remove_all (server->cap_list);
server->checking_cap_list = 1;
}
if (last_reply)
server->checking_cap_list = 0;
if (ptr_caps[0] == ':')
ptr_caps++;
caps_enabled = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_caps_enabled);
if (caps_enabled)
{
for (i = 0; i < num_caps_enabled; i++)
{
pos_value = strstr (caps_enabled[i], "=");
if (pos_value)
{
str_name = strndup (caps_enabled[i],
pos_value - caps_enabled[i]);
if (str_name)
{
weechat_hashtable_set (server->cap_list,
str_name, pos_value + 1);
free (str_name);
}
}
else
{
weechat_hashtable_set (server->cap_list,
caps_enabled[i], NULL);
}
}
}
if (last_reply)
{
str_caps = weechat_string_dyn_alloc (128);
weechat_hashtable_map_string (server->cap_list,
irc_protocol_cap_print_cb,
str_caps);
weechat_printf_date_tags (
server->buffer, date, NULL,
_("%s%s: client capability, currently enabled: %s"),
weechat_prefix ("network"),
IRC_PLUGIN_NAME,
*str_caps);
weechat_string_dyn_free (str_caps, 1);
}
if (caps_enabled)
weechat_string_free_split (caps_enabled);
}
}
else if (strcmp (argv[3], "ACK") == 0)
{
if (argc > 4)
{
ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
sasl_to_do = 0;
str_caps_enabled = weechat_string_dyn_alloc (128);
str_caps_disabled = weechat_string_dyn_alloc (128);
caps_supported = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_caps_supported);
if (caps_supported)
{
for (i = 0; i < num_caps_supported; i++)
{
if (caps_supported[i][0] == '-')
{
if (*str_caps_disabled[0])
weechat_string_dyn_concat (str_caps_disabled, " ");
weechat_string_dyn_concat (str_caps_disabled,
caps_supported[i] + 1);
weechat_hashtable_remove (server->cap_list,
caps_supported[i] + 1);
}
else
{
if (*str_caps_enabled[0])
weechat_string_dyn_concat (str_caps_enabled, " ");
weechat_string_dyn_concat (str_caps_enabled,
caps_supported[i]);
weechat_hashtable_set (server->cap_list,
caps_supported[i], NULL);
if (strcmp (caps_supported[i], "sasl") == 0)
sasl_to_do = 1;
}
}
weechat_string_free_split (caps_supported);
}
if (*str_caps_enabled[0] && *str_caps_disabled[0])
{
weechat_printf_date_tags (
server->buffer, date, NULL,
_("%s%s: client capability, enabled: %s, disabled: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME,
*str_caps_enabled, *str_caps_disabled);
}
else if (*str_caps_enabled[0])
{
weechat_printf_date_tags (
server->buffer, date, NULL,
_("%s%s: client capability, enabled: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME,
*str_caps_enabled);
}
else if (*str_caps_disabled[0])
{
weechat_printf_date_tags (
server->buffer, date, NULL,
_("%s%s: client capability, disabled: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME,
*str_caps_disabled);
}
weechat_string_dyn_free (str_caps_enabled, 1);
weechat_string_dyn_free (str_caps_disabled, 1);
if (sasl_to_do)
{
sasl_mechanism = IRC_SERVER_OPTION_INTEGER(
server, IRC_SERVER_OPTION_SASL_MECHANISM);
if ((sasl_mechanism >= 0)
&& (sasl_mechanism < IRC_NUM_SASL_MECHANISMS))
{
snprintf (str_msg_auth, sizeof (str_msg_auth),
"AUTHENTICATE %s",
irc_sasl_mechanism_string[sasl_mechanism]);
weechat_string_toupper (str_msg_auth);
irc_server_sendf (server, 0, NULL, str_msg_auth);
if (server->hook_timer_sasl)
weechat_unhook (server->hook_timer_sasl);
timeout = IRC_SERVER_OPTION_INTEGER(
server, IRC_SERVER_OPTION_SASL_TIMEOUT);
server->hook_timer_sasl = weechat_hook_timer (
timeout * 1000,
0, 1,
&irc_server_timer_sasl_cb,
server, NULL);
}
}
}
}
else if (strcmp (argv[3], "NAK") == 0)
{
if (argc > 4)
{
ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
weechat_printf_date_tags (
server->buffer, date, NULL,
_("%s%s: client capability, refused: %s"),
weechat_prefix ("error"), IRC_PLUGIN_NAME, ptr_caps);
if (!server->is_connected)
irc_server_sendf (server, 0, NULL, "CAP END");
}
}
else if (strcmp (argv[3], "NEW") == 0)
{
if (argc > 4)
{
ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
weechat_printf_date_tags (
server->buffer, date, NULL,
_("%s%s: client capability, now available: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps);
caps_added = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_caps_added);
if (caps_added)
{
for (i = 0; i < num_caps_added; i++)
{
pos_value = strstr (caps_added[i], "=");
if (pos_value)
{
str_name = strndup (caps_added[i],
pos_value - caps_added[i]);
if (str_name)
{
weechat_hashtable_set (server->cap_ls,
str_name, pos_value + 1);
free (str_name);
}
}
else
{
weechat_hashtable_set (server->cap_ls,
caps_added[i], NULL);
}
}
weechat_string_free_split (caps_added);
}
/* TODO: SASL Reauthentication */
irc_protocol_cap_sync (server, 0);
}
}
else if (strcmp (argv[3], "DEL") == 0)
{
if (argc > 4)
{
ptr_caps = (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4];
weechat_printf_date_tags (
server->buffer, date, NULL,
_("%s%s: client capability, removed: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps);
caps_removed = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_caps_removed);
if (caps_removed)
{
for (i = 0; i < num_caps_removed; i++)
{
weechat_hashtable_remove (server->cap_ls, caps_removed[i]);
weechat_hashtable_remove (server->cap_list, caps_removed[i]);
}
weechat_string_free_split (caps_removed);
}
}
}
return WEECHAT_RC_OK;
}
| 0
|
291,811
|
static int rtrs_clt_read_req(struct rtrs_clt_io_req *req)
{
struct rtrs_clt_con *con = req->con;
struct rtrs_path *s = con->c.path;
struct rtrs_clt_path *clt_path = to_clt_path(s);
struct rtrs_msg_rdma_read *msg;
struct rtrs_ib_dev *dev = clt_path->s.dev;
struct ib_reg_wr rwr;
struct ib_send_wr *wr = NULL;
int ret, count = 0;
u32 imm, buf_id;
const size_t tsize = sizeof(*msg) + req->data_len + req->usr_len;
if (tsize > clt_path->chunk_size) {
rtrs_wrn(s,
"Read request failed, message size is %zu, bigger than CHUNK_SIZE %d\n",
tsize, clt_path->chunk_size);
return -EMSGSIZE;
}
if (req->sg_cnt) {
count = ib_dma_map_sg(dev->ib_dev, req->sglist, req->sg_cnt,
req->dir);
if (!count) {
rtrs_wrn(s,
"Read request failed, dma map failed\n");
return -EINVAL;
}
}
/* put our message into req->buf after user message*/
msg = req->iu->buf + req->usr_len;
msg->type = cpu_to_le16(RTRS_MSG_READ);
msg->usr_len = cpu_to_le16(req->usr_len);
if (count) {
ret = rtrs_map_sg_fr(req, count);
if (ret < 0) {
rtrs_err_rl(s,
"Read request failed, failed to map fast reg. data, err: %d\n",
ret);
ib_dma_unmap_sg(dev->ib_dev, req->sglist, req->sg_cnt,
req->dir);
return ret;
}
rwr = (struct ib_reg_wr) {
.wr.opcode = IB_WR_REG_MR,
.wr.wr_cqe = &fast_reg_cqe,
.mr = req->mr,
.key = req->mr->rkey,
.access = (IB_ACCESS_LOCAL_WRITE |
IB_ACCESS_REMOTE_WRITE),
};
wr = &rwr.wr;
msg->sg_cnt = cpu_to_le16(1);
msg->flags = cpu_to_le16(RTRS_MSG_NEED_INVAL_F);
msg->desc[0].addr = cpu_to_le64(req->mr->iova);
msg->desc[0].key = cpu_to_le32(req->mr->rkey);
msg->desc[0].len = cpu_to_le32(req->mr->length);
/* Further invalidation is required */
req->need_inv = !!RTRS_MSG_NEED_INVAL_F;
} else {
msg->sg_cnt = 0;
msg->flags = 0;
}
/*
* rtrs message will be after the space reserved for disk data and
* user message
*/
imm = req->permit->mem_off + req->data_len + req->usr_len;
imm = rtrs_to_io_req_imm(imm);
buf_id = req->permit->mem_id;
req->sg_size = sizeof(*msg);
req->sg_size += le16_to_cpu(msg->sg_cnt) * sizeof(struct rtrs_sg_desc);
req->sg_size += req->usr_len;
/*
* Update stats now, after request is successfully sent it is not
* safe anymore to touch it.
*/
rtrs_clt_update_all_stats(req, READ);
ret = rtrs_post_send_rdma(req->con, req, &clt_path->rbufs[buf_id],
req->data_len, imm, wr);
if (ret) {
rtrs_err_rl(s,
"Read request failed: error=%d path=%s [%s:%u]\n",
ret, kobject_name(&clt_path->kobj), clt_path->hca_name,
clt_path->hca_port);
if (req->mp_policy == MP_POLICY_MIN_INFLIGHT)
atomic_dec(&clt_path->stats->inflight);
req->need_inv = false;
if (req->sg_cnt)
ib_dma_unmap_sg(dev->ib_dev, req->sglist,
req->sg_cnt, req->dir);
}
return ret;
}
| 0
|
224,291
|
gopherSendComplete(const Comm::ConnectionPointer &conn, char *, size_t size, Comm::Flag errflag, int xerrno, void *data)
{
GopherStateData *gopherState = (GopherStateData *) data;
StoreEntry *entry = gopherState->entry;
debugs(10, 5, conn << " size: " << size << " errflag: " << errflag);
if (size > 0) {
fd_bytes(conn->fd, size, FD_WRITE);
statCounter.server.all.kbytes_out += size;
statCounter.server.other.kbytes_out += size;
}
if (!entry->isAccepting()) {
debugs(10, 3, "terminating due to bad " << *entry);
// TODO: Do not abuse connection for triggering cleanup.
gopherState->serverConn->close();
return;
}
if (errflag) {
const auto err = new ErrorState(ERR_WRITE_ERROR, Http::scServiceUnavailable, gopherState->fwd->request, gopherState->fwd->al);
err->xerrno = xerrno;
err->port = gopherState->fwd->request->url.port();
err->url = xstrdup(entry->url());
gopherState->fwd->fail(err);
gopherState->serverConn->close();
return;
}
/*
* OK. We successfully reach remote site. Start MIME typing
* stuff. Do it anyway even though request is not HTML type.
*/
entry->buffer();
gopherMimeCreate(gopherState);
switch (gopherState->type_id) {
case GOPHER_DIRECTORY:
/* we got to convert it first */
gopherState->conversion = GopherStateData::HTML_DIR;
gopherState->HTML_header_added = 0;
break;
case GOPHER_INDEX:
/* we got to convert it first */
gopherState->conversion = GopherStateData::HTML_INDEX_RESULT;
gopherState->HTML_header_added = 0;
break;
case GOPHER_CSO:
/* we got to convert it first */
gopherState->conversion = GopherStateData::HTML_CSO_RESULT;
gopherState->cso_recno = 0;
gopherState->HTML_header_added = 0;
break;
default:
gopherState->conversion = GopherStateData::NORMAL;
entry->flush();
}
/* Schedule read reply. */
AsyncCall::Pointer call = commCbCall(5,5, "gopherReadReply",
CommIoCbPtrFun(gopherReadReply, gopherState));
entry->delayAwareRead(conn, gopherState->replybuf, BUFSIZ, call);
}
| 0
|
317,309
|
static void smack_task_to_inode(struct task_struct *p, struct inode *inode)
{
struct inode_smack *isp = smack_inode(inode);
struct smack_known *skp = smk_of_task_struct_obj(p);
isp->smk_inode = skp;
isp->smk_flags |= SMK_INODE_INSTANT;
}
| 0
|
450,397
|
static int send_mono_rect(VncState *vs, int x, int y,
int w, int h, uint32_t bg, uint32_t fg)
{
ssize_t bytes;
int stream = 1;
int level = tight_conf[vs->tight->compression].mono_zlib_level;
#ifdef CONFIG_VNC_PNG
if (tight_can_send_png_rect(vs, w, h)) {
int ret;
int bpp = vs->client_pf.bytes_per_pixel * 8;
VncPalette *palette = palette_new(2, bpp);
palette_put(palette, bg);
palette_put(palette, fg);
ret = send_png_rect(vs, x, y, w, h, palette);
palette_destroy(palette);
return ret;
}
#endif
bytes = DIV_ROUND_UP(w, 8) * h;
vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4);
vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE);
vnc_write_u8(vs, 1);
switch (vs->client_pf.bytes_per_pixel) {
case 4:
{
uint32_t buf[2] = {bg, fg};
size_t ret = sizeof (buf);
if (vs->tight->pixel24) {
tight_pack24(vs, (unsigned char*)buf, 2, &ret);
}
vnc_write(vs, buf, ret);
tight_encode_mono_rect32(vs->tight->tight.buffer, w, h, bg, fg);
break;
}
case 2:
vnc_write(vs, &bg, 2);
vnc_write(vs, &fg, 2);
tight_encode_mono_rect16(vs->tight->tight.buffer, w, h, bg, fg);
break;
default:
vnc_write_u8(vs, bg);
vnc_write_u8(vs, fg);
tight_encode_mono_rect8(vs->tight->tight.buffer, w, h, bg, fg);
break;
}
vs->tight->tight.offset = bytes;
bytes = tight_compress_data(vs, stream, bytes, level, Z_DEFAULT_STRATEGY);
return (bytes >= 0);
}
| 0
|
313,556
|
static void rose_del_route_by_neigh(struct rose_neigh *rose_neigh)
{
struct rose_route *rose_route, *s;
rose_neigh->restarted = 0;
rose_stop_t0timer(rose_neigh);
rose_start_ftimer(rose_neigh);
skb_queue_purge(&rose_neigh->queue);
spin_lock_bh(&rose_route_list_lock);
rose_route = rose_route_list;
while (rose_route != NULL) {
if ((rose_route->neigh1 == rose_neigh && rose_route->neigh2 == rose_neigh) ||
(rose_route->neigh1 == rose_neigh && rose_route->neigh2 == NULL) ||
(rose_route->neigh2 == rose_neigh && rose_route->neigh1 == NULL)) {
s = rose_route->next;
rose_remove_route(rose_route);
rose_route = s;
continue;
}
if (rose_route->neigh1 == rose_neigh) {
rose_route->neigh1->use--;
rose_route->neigh1 = NULL;
rose_transmit_clear_request(rose_route->neigh2, rose_route->lci2, ROSE_OUT_OF_ORDER, 0);
}
if (rose_route->neigh2 == rose_neigh) {
rose_route->neigh2->use--;
rose_route->neigh2 = NULL;
rose_transmit_clear_request(rose_route->neigh1, rose_route->lci1, ROSE_OUT_OF_ORDER, 0);
}
rose_route = rose_route->next;
}
spin_unlock_bh(&rose_route_list_lock);
}
| 0
|
387,789
|
bool InstanceKlass::is_same_class_package(oop other_class_loader,
const Symbol* other_class_name) const {
if (class_loader() != other_class_loader) {
return false;
}
if (name()->fast_compare(other_class_name) == 0) {
return true;
}
{
ResourceMark rm;
bool bad_class_name = false;
const char* other_pkg =
ClassLoader::package_from_name((const char*) other_class_name->as_C_string(), &bad_class_name);
if (bad_class_name) {
return false;
}
// Check that package_from_name() returns NULL, not "", if there is no package.
assert(other_pkg == NULL || strlen(other_pkg) > 0, "package name is empty string");
const Symbol* const this_package_name =
this->package() != NULL ? this->package()->name() : NULL;
if (this_package_name == NULL || other_pkg == NULL) {
// One of the two doesn't have a package. Only return true if the other
// one also doesn't have a package.
return (const char*)this_package_name == other_pkg;
}
// Check if package is identical
return this_package_name->equals(other_pkg);
}
}
| 0
|
221,461
|
flatpak_context_load_for_deploy (FlatpakDeploy *deploy,
GError **error)
{
g_autoptr(FlatpakContext) context = NULL;
g_autoptr(FlatpakContext) overrides = NULL;
g_autoptr(GKeyFile) metakey = NULL;
metakey = flatpak_deploy_get_metadata (deploy);
context = flatpak_app_compute_permissions (metakey, NULL, error);
if (context == NULL)
return NULL;
overrides = flatpak_deploy_get_overrides (deploy);
flatpak_context_merge (context, overrides);
return g_steal_pointer (&context);
}
| 0
|
199,767
|
inbound_cap_ls (server *serv, char *nick, char *extensions_str,
const message_tags_data *tags_data)
{
char buffer[256]; /* buffer for requesting capabilities and emitting the signal */
guint32 want_cap; /* format the CAP REQ string based on previous capabilities being requested or not */
guint32 want_sasl; /* CAP END shouldn't be sent when SASL is requested, it needs further responses */
char **extensions;
int i;
EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPLIST, serv->server_session, nick,
extensions_str, NULL, NULL, 0, tags_data->timestamp);
want_cap = 0;
want_sasl = 0;
extensions = g_strsplit (extensions_str, " ", 0);
strcpy (buffer, "CAP REQ :");
for (i=0; extensions[i]; i++)
{
const char *extension = extensions[i];
if (!strcmp (extension, "identify-msg"))
{
strcat (buffer, "identify-msg ");
want_cap = 1;
}
if (!strcmp (extension, "multi-prefix"))
{
strcat (buffer, "multi-prefix ");
want_cap = 1;
}
if (!strcmp (extension, "away-notify"))
{
strcat (buffer, "away-notify ");
want_cap = 1;
}
if (!strcmp (extension, "account-notify"))
{
strcat (buffer, "account-notify ");
want_cap = 1;
}
if (!strcmp (extension, "extended-join"))
{
strcat (buffer, "extended-join ");
want_cap = 1;
}
if (!strcmp (extension, "userhost-in-names"))
{
strcat (buffer, "userhost-in-names ");
want_cap = 1;
}
/* bouncers can prefix a name space to the extension so we should use.
* znc <= 1.0 uses "znc.in/server-time" and newer use "znc.in/server-time-iso".
*/
if (!strcmp (extension, "znc.in/server-time-iso"))
{
strcat (buffer, "znc.in/server-time-iso ");
want_cap = 1;
}
if (!strcmp (extension, "znc.in/server-time"))
{
strcat (buffer, "znc.in/server-time ");
want_cap = 1;
}
if (prefs.hex_irc_cap_server_time
&& !strcmp (extension, "server-time"))
{
strcat (buffer, "server-time ");
want_cap = 1;
}
/* if the SASL password is set AND auth mode is set to SASL, request SASL auth */
if (!strcmp (extension, "sasl")
&& ((serv->loginmethod == LOGIN_SASL && strlen (serv->password) != 0)
|| (serv->loginmethod == LOGIN_SASLEXTERNAL && serv->have_cert)))
{
strcat (buffer, "sasl ");
want_cap = 1;
want_sasl = 1;
}
}
g_strfreev (extensions);
if (want_cap)
{
/* buffer + 9 = emit buffer without "CAP REQ :" */
EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPREQ, serv->server_session,
buffer + 9, NULL, NULL, NULL, 0,
tags_data->timestamp);
tcp_sendf (serv, "%s\r\n", g_strchomp (buffer));
}
if (!want_sasl)
{
/* if we use SASL, CAP END is dealt via raw numerics */
serv->sent_capend = TRUE;
tcp_send_len (serv, "CAP END\r\n", 9);
}
}
| 1
|
417,096
|
void PlayerGeneric::setAllowFilters(bool b)
{
allowFilters = b;
if (player)
player->setAllowFilters(allowFilters);
}
| 0
|
427,191
|
static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) {
Proto *f = fs->f;
fs->prev = ls->fs; /* linked list of funcstates */
fs->ls = ls;
ls->fs = fs;
fs->pc = 0;
fs->previousline = f->linedefined;
fs->iwthabs = 0;
fs->lasttarget = 0;
fs->freereg = 0;
fs->nk = 0;
fs->nabslineinfo = 0;
fs->np = 0;
fs->nups = 0;
fs->ndebugvars = 0;
fs->nactvar = 0;
fs->needclose = 0;
fs->firstlocal = ls->dyd->actvar.n;
fs->firstlabel = ls->dyd->label.n;
fs->bl = NULL;
f->source = ls->source;
luaC_objbarrier(ls->L, f, f->source);
f->maxstacksize = 2; /* registers 0/1 are always valid */
enterblock(fs, bl, 0);
}
| 0
|
386,565
|
bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/) {
// Allocate LWPolyline vertices (group code 90):
if (groupCode==90) {
maxVertices = toInt(groupValue);
if (maxVertices>0) {
if (vertices!=NULL) {
delete[] vertices;
}
vertices = new double[4*maxVertices];
for (int i=0; i<maxVertices; ++i) {
vertices[i*4] = 0.0;
vertices[i*4+1] = 0.0;
vertices[i*4+2] = 0.0;
vertices[i*4+3] = 0.0;
}
}
vertexIndex=-1;
return true;
}
// Process LWPolylines vertices (group codes 10/20/30/42):
else if (groupCode==10 || groupCode==20 ||
groupCode==30 || groupCode==42) {
if (vertexIndex<maxVertices-1 && groupCode==10) {
vertexIndex++;
}
if (groupCode<=30) {
if (vertexIndex>=0 && vertexIndex<maxVertices && vertexIndex>=0) {
vertices[4*vertexIndex + (groupCode/10-1)] = toReal(groupValue);
}
} else if (groupCode==42 && vertexIndex<maxVertices && vertexIndex>=0) {
vertices[4*vertexIndex + 3] = toReal(groupValue);
}
return true;
}
return false;
}
| 0
|
333,084
|
frag(nfa_state_T *start, Ptrlist *out)
{
Frag_T n;
n.start = start;
n.out = out;
return n;
}
| 0
|
215,038
|
gst_flxdec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
GstCaps *caps;
guint avail;
GstFlowReturn res = GST_FLOW_OK;
GstFlxDec *flxdec;
FlxHeader *flxh;
g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
flxdec = (GstFlxDec *) parent;
g_return_val_if_fail (flxdec != NULL, GST_FLOW_ERROR);
gst_adapter_push (flxdec->adapter, buf);
avail = gst_adapter_available (flxdec->adapter);
if (flxdec->state == GST_FLXDEC_READ_HEADER) {
if (avail >= FlxHeaderSize) {
const guint8 *data = gst_adapter_map (flxdec->adapter, FlxHeaderSize);
GstCaps *templ;
memcpy ((gchar *) & flxdec->hdr, data, FlxHeaderSize);
FLX_HDR_FIX_ENDIANNESS (&(flxdec->hdr));
gst_adapter_unmap (flxdec->adapter);
gst_adapter_flush (flxdec->adapter, FlxHeaderSize);
flxh = &flxdec->hdr;
/* check header */
if (flxh->type != FLX_MAGICHDR_FLI &&
flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX)
goto wrong_type;
GST_LOG ("size : %d", flxh->size);
GST_LOG ("frames : %d", flxh->frames);
GST_LOG ("width : %d", flxh->width);
GST_LOG ("height : %d", flxh->height);
GST_LOG ("depth : %d", flxh->depth);
GST_LOG ("speed : %d", flxh->speed);
flxdec->next_time = 0;
if (flxh->type == FLX_MAGICHDR_FLI) {
flxdec->frame_time = JIFFIE * flxh->speed;
} else if (flxh->speed == 0) {
flxdec->frame_time = GST_SECOND / 70;
} else {
flxdec->frame_time = flxh->speed * GST_MSECOND;
}
flxdec->duration = flxh->frames * flxdec->frame_time;
GST_LOG ("duration : %" GST_TIME_FORMAT,
GST_TIME_ARGS (flxdec->duration));
templ = gst_pad_get_pad_template_caps (flxdec->srcpad);
caps = gst_caps_copy (templ);
gst_caps_unref (templ);
gst_caps_set_simple (caps,
"width", G_TYPE_INT, flxh->width,
"height", G_TYPE_INT, flxh->height,
"framerate", GST_TYPE_FRACTION, (gint) GST_MSECOND,
(gint) flxdec->frame_time / 1000, NULL);
gst_pad_set_caps (flxdec->srcpad, caps);
gst_caps_unref (caps);
if (flxh->depth <= 8)
flxdec->converter =
flx_colorspace_converter_new (flxh->width, flxh->height);
if (flxh->type == FLX_MAGICHDR_FLC || flxh->type == FLX_MAGICHDR_FLX) {
GST_LOG ("(FLC) aspect_dx : %d", flxh->aspect_dx);
GST_LOG ("(FLC) aspect_dy : %d", flxh->aspect_dy);
GST_LOG ("(FLC) oframe1 : 0x%08x", flxh->oframe1);
GST_LOG ("(FLC) oframe2 : 0x%08x", flxh->oframe2);
}
flxdec->size = ((guint) flxh->width * (guint) flxh->height);
/* create delta and output frame */
flxdec->frame_data = g_malloc (flxdec->size);
flxdec->delta_data = g_malloc (flxdec->size);
flxdec->state = GST_FLXDEC_PLAYING;
}
} else if (flxdec->state == GST_FLXDEC_PLAYING) {
GstBuffer *out;
/* while we have enough data in the adapter */
while (avail >= FlxFrameChunkSize && res == GST_FLOW_OK) {
FlxFrameChunk flxfh;
guchar *chunk;
const guint8 *data;
GstMapInfo map;
chunk = NULL;
data = gst_adapter_map (flxdec->adapter, FlxFrameChunkSize);
memcpy (&flxfh, data, FlxFrameChunkSize);
FLX_FRAME_CHUNK_FIX_ENDIANNESS (&flxfh);
gst_adapter_unmap (flxdec->adapter);
switch (flxfh.id) {
case FLX_FRAME_TYPE:
/* check if we have the complete frame */
if (avail < flxfh.size)
goto need_more_data;
/* flush header */
gst_adapter_flush (flxdec->adapter, FlxFrameChunkSize);
chunk = gst_adapter_take (flxdec->adapter,
flxfh.size - FlxFrameChunkSize);
FLX_FRAME_TYPE_FIX_ENDIANNESS ((FlxFrameType *) chunk);
if (((FlxFrameType *) chunk)->chunks == 0)
break;
/* create 32 bits output frame */
// res = gst_pad_alloc_buffer_and_set_caps (flxdec->srcpad,
// GST_BUFFER_OFFSET_NONE,
// flxdec->size * 4, GST_PAD_CAPS (flxdec->srcpad), &out);
// if (res != GST_FLOW_OK)
// break;
out = gst_buffer_new_and_alloc (flxdec->size * 4);
/* decode chunks */
if (!flx_decode_chunks (flxdec,
((FlxFrameType *) chunk)->chunks,
chunk + FlxFrameTypeSize, flxdec->frame_data)) {
GST_ELEMENT_ERROR (flxdec, STREAM, DECODE,
("%s", "Could not decode chunk"), NULL);
return GST_FLOW_ERROR;
}
/* save copy of the current frame for possible delta. */
memcpy (flxdec->delta_data, flxdec->frame_data, flxdec->size);
gst_buffer_map (out, &map, GST_MAP_WRITE);
/* convert current frame. */
flx_colorspace_convert (flxdec->converter, flxdec->frame_data,
map.data);
gst_buffer_unmap (out, &map);
GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
flxdec->next_time += flxdec->frame_time;
res = gst_pad_push (flxdec->srcpad, out);
break;
default:
/* check if we have the complete frame */
if (avail < flxfh.size)
goto need_more_data;
gst_adapter_flush (flxdec->adapter, flxfh.size);
break;
}
g_free (chunk);
avail = gst_adapter_available (flxdec->adapter);
}
}
need_more_data:
return res;
/* ERRORS */
wrong_type:
{
GST_ELEMENT_ERROR (flxdec, STREAM, WRONG_TYPE, (NULL),
("not a flx file (type %x)", flxh->type));
gst_object_unref (flxdec);
return GST_FLOW_ERROR;
}
}
| 1
|
90,153
|
template<typename T> const T GetWirelessNetworkByPath(
const std::vector<T>& networks, const std::string& path) const {
typedef typename std::vector<T>::const_iterator iter_t;
iter_t iter = std::find_if(networks.begin(), networks.end(),
WirelessNetwork::ServicePathEq(path));
return (iter != networks.end()) ? *iter : NULL;
}
| 0
|
276,920
|
static int do_i2c_flags(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
struct udevice *dev;
uint flags;
int chip;
int ret;
if (argc < 2)
return CMD_RET_USAGE;
chip = hextoul(argv[1], NULL);
ret = i2c_get_cur_bus_chip(chip, &dev);
if (ret)
return i2c_report_err(ret, I2C_ERR_READ);
if (argc > 2) {
flags = hextoul(argv[2], NULL);
ret = i2c_set_chip_flags(dev, flags);
} else {
ret = i2c_get_chip_flags(dev, &flags);
if (!ret)
printf("%x\n", flags);
}
if (ret)
return i2c_report_err(ret, I2C_ERR_READ);
return 0;
}
| 0
|
446,420
|
static cache_hdr_t *read_cache_header(RzBuffer *cache_buf, ut64 offset) {
if (!cache_buf) {
return NULL;
}
cache_hdr_t *hdr = RZ_NEW0(cache_hdr_t);
if (!hdr) {
return NULL;
}
ut64 size = sizeof(cache_hdr_t);
if (rz_buf_fread_at(cache_buf, offset, (ut8 *)hdr, "16c4i7l16clii4l", 1) != size) {
free(hdr);
return NULL;
}
if (!rz_dyldcache_check_magic(hdr->magic)) {
free(hdr);
return NULL;
}
if (!hdr->imagesCount && !hdr->imagesOffset) {
if (!rz_buf_read_le32_at(cache_buf, 0x1c0 + offset, &hdr->imagesOffset) || !rz_buf_read_le32_at(cache_buf, 0x1c4 + offset, &hdr->imagesCount)) {
free(hdr);
return NULL;
}
}
return hdr;
}
| 0
|
312,412
|
qf_setprop_items_from_lines(
qf_info_T *qi,
int qf_idx,
dict_T *what,
dictitem_T *di,
int action)
{
char_u *errorformat = p_efm;
dictitem_T *efm_di;
int retval = FAIL;
// Use the user supplied errorformat settings (if present)
if ((efm_di = dict_find(what, (char_u *)"efm", -1)) != NULL)
{
if (efm_di->di_tv.v_type != VAR_STRING ||
efm_di->di_tv.vval.v_string == NULL)
return FAIL;
errorformat = efm_di->di_tv.vval.v_string;
}
// Only a List value is supported
if (di->di_tv.v_type != VAR_LIST || di->di_tv.vval.v_list == NULL)
return FAIL;
if (action == 'r')
qf_free_items(&qi->qf_lists[qf_idx]);
if (qf_init_ext(qi, qf_idx, NULL, NULL, &di->di_tv, errorformat,
FALSE, (linenr_T)0, (linenr_T)0, NULL, NULL) >= 0)
retval = OK;
return retval;
}
| 0
|
225,951
|
GF_Err esds_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_Err e=GF_OK;
u32 descSize;
GF_ESDBox *ptr = (GF_ESDBox *)s;
descSize = (u32) (ptr->size);
if (descSize) {
char *enc_desc = (char*)gf_malloc(sizeof(char) * descSize);
if (!enc_desc) return GF_OUT_OF_MEM;
//get the payload
gf_bs_read_data(bs, enc_desc, descSize);
//send it to the OD Codec
e = gf_odf_desc_read(enc_desc, descSize, (GF_Descriptor **) &ptr->desc);
//OK, free our desc
gf_free(enc_desc);
if (ptr->desc && (ptr->desc->tag!=GF_ODF_ESD_TAG) ) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Invalid descriptor tag 0x%x in esds\n", ptr->desc->tag));
gf_odf_desc_del((GF_Descriptor*)ptr->desc);
ptr->desc=NULL;
return GF_ISOM_INVALID_FILE;
}
if (e) {
ptr->desc = NULL;
} else {
/*fix broken files*/
if (ptr->desc && !ptr->desc->URLString) {
if (!ptr->desc->slConfig) {
ptr->desc->slConfig = (GF_SLConfig *) gf_odf_desc_new(GF_ODF_SLC_TAG);
ptr->desc->slConfig->predefined = SLPredef_MP4;
} else if (ptr->desc->slConfig->predefined != SLPredef_MP4) {
ptr->desc->slConfig->predefined = SLPredef_MP4;
gf_odf_slc_set_pref(ptr->desc->slConfig);
}
}
}
}
return e;
}
| 0
|
220,904
|
void LongestPathsLowerBounds(
int source, const std::pair<int, int>& target_range,
const std::vector<std::vector<int>>& outputs,
std::vector<DistanceFromSource>* longest_distance) {
std::deque<int> queue;
queue.emplace_front(source);
while (!queue.empty()) {
int node = queue.front();
queue.pop_front();
for (int fanout : outputs[node]) {
// 1) Only nodes in the target range can be on paths from source to one of
// its control outputs.
// 2) Since we only need a lower bound on the longest distance, we can
// skip nodes for which we have already proven have a path of
// length > 1 from the source.
if (fanout >= target_range.first && fanout <= target_range.second &&
(*longest_distance)[fanout] != TWO_OR_GREATER) {
(*longest_distance)[fanout] =
(*longest_distance)[fanout] == ZERO ? ONE : TWO_OR_GREATER;
queue.emplace_front(fanout);
}
}
}
}
| 0
|
326,093
|
regconcat(int *flagp)
{
char_u *first = NULL;
char_u *chain = NULL;
char_u *latest;
int flags;
int cont = TRUE;
*flagp = WORST; // Tentatively.
while (cont)
{
switch (peekchr())
{
case NUL:
case Magic('|'):
case Magic('&'):
case Magic(')'):
cont = FALSE;
break;
case Magic('Z'):
regflags |= RF_ICOMBINE;
skipchr_keepstart();
break;
case Magic('c'):
regflags |= RF_ICASE;
skipchr_keepstart();
break;
case Magic('C'):
regflags |= RF_NOICASE;
skipchr_keepstart();
break;
case Magic('v'):
reg_magic = MAGIC_ALL;
skipchr_keepstart();
curchr = -1;
break;
case Magic('m'):
reg_magic = MAGIC_ON;
skipchr_keepstart();
curchr = -1;
break;
case Magic('M'):
reg_magic = MAGIC_OFF;
skipchr_keepstart();
curchr = -1;
break;
case Magic('V'):
reg_magic = MAGIC_NONE;
skipchr_keepstart();
curchr = -1;
break;
default:
latest = regpiece(&flags);
if (latest == NULL || reg_toolong)
return NULL;
*flagp |= flags & (HASWIDTH | HASNL | HASLOOKBH);
if (chain == NULL) // First piece.
*flagp |= flags & SPSTART;
else
regtail(chain, latest);
chain = latest;
if (first == NULL)
first = latest;
break;
}
}
if (first == NULL) // Loop ran zero times.
first = regnode(NOTHING);
return first;
}
| 0
|
247,134
|
u32 gf_fs_get_max_resolution_chain_length(GF_FilterSession *session)
{
if (!session) return 0;
return session->max_resolve_chain_len;
}
| 0
|
512,619
|
int Regexp_processor_pcre::default_regex_flags()
{
return default_regex_flags_pcre(current_thd);
}
| 0
|
384,765
|
textpos2screenpos(
win_T *wp,
pos_T *pos,
int *rowp, // screen row
int *scolp, // start screen column
int *ccolp, // cursor screen column
int *ecolp) // end screen column
{
colnr_T scol = 0, ccol = 0, ecol = 0;
int row = 0;
int rowoff = 0;
colnr_T coloff = 0;
if (pos->lnum >= wp->w_topline && pos->lnum <= wp->w_botline)
{
colnr_T off;
colnr_T col;
int width;
row = plines_m_win(wp, wp->w_topline, pos->lnum - 1) + 1;
getvcol(wp, pos, &scol, &ccol, &ecol);
// similar to what is done in validate_cursor_col()
col = scol;
off = win_col_off(wp);
col += off;
width = wp->w_width - off + win_col_off2(wp);
// long line wrapping, adjust row
if (wp->w_p_wrap
&& col >= (colnr_T)wp->w_width
&& width > 0)
{
// use same formula as what is used in curs_columns()
rowoff = ((col - wp->w_width) / width + 1);
col -= rowoff * width;
}
col -= wp->w_leftcol;
if (col >= wp->w_width)
col = -1;
if (col >= 0 && row + rowoff <= wp->w_height)
coloff = col - scol + wp->w_wincol + 1;
else
// character is left, right or below of the window
row = rowoff = scol = ccol = ecol = 0;
}
*rowp = W_WINROW(wp) + row + rowoff;
*scolp = scol + coloff;
*ccolp = ccol + coloff;
*ecolp = ecol + coloff;
}
| 0
|
401,578
|
static int random_fasync(int fd, struct file *filp, int on)
{
return fasync_helper(fd, filp, on, &fasync);
}
| 0
|
432,155
|
PipelineD::buildInnerQueryExecutorGeneric(const CollectionPtr& collection,
const NamespaceString& nss,
const AggregateCommandRequest* aggRequest,
Pipeline* pipeline) {
// Make a last effort to optimize pipeline stages before potentially detaching them to be pushed
// down into the query executor.
pipeline->optimizePipeline();
Pipeline::SourceContainer& sources = pipeline->_sources;
auto expCtx = pipeline->getContext();
// Look for an initial match. This works whether we got an initial query or not. If not, it
// results in a "{}" query, which will be what we want in that case.
const BSONObj queryObj = pipeline->getInitialQuery();
if (!queryObj.isEmpty()) {
auto matchStage = dynamic_cast<DocumentSourceMatch*>(sources.front().get());
if (matchStage) {
// If a $match query is pulled into the cursor, the $match is redundant, and can be
// removed from the pipeline.
sources.pop_front();
} else {
// A $geoNear stage, the only other stage that can produce an initial query, is also
// a valid initial stage. However, we should be in prepareGeoNearCursorSource() instead.
MONGO_UNREACHABLE;
}
}
auto&& [sortStage, groupStage] = getSortAndGroupStagesFromPipeline(pipeline->_sources);
std::unique_ptr<GroupFromFirstDocumentTransformation> rewrittenGroupStage;
if (groupStage) {
rewrittenGroupStage = groupStage->rewriteGroupAsTransformOnFirstDocument();
}
// If there is a $limit or $skip stage (or multiple of them) that could be pushed down into the
// PlanStage layer, obtain the value of the limit and skip and remove the $limit and $skip
// stages from the pipeline.
//
// This analysis is done here rather than in 'optimizePipeline()' because swapping $limit before
// stages such as $project is not always useful, and can sometimes defeat other optimizations.
// In particular, in a sharded scenario a pipeline such as [$project, $limit] is preferable to
// [$limit, $project]. The former permits the execution of the projection operation to be
// parallelized across all targeted shards, whereas the latter would bring all of the data to a
// merging shard first, and then apply the projection serially. See SERVER-24981 for a more
// detailed discussion.
//
// This only handles the case in which the the $limit or $skip can logically be swapped to the
// front of the pipeline. We can also push down a $limit which comes after a $sort into the
// PlanStage layer, but that is handled elsewhere.
const auto skipThenLimit = extractSkipAndLimitForPushdown(pipeline);
auto unavailableMetadata = DocumentSourceMatch::isTextQuery(queryObj)
? DepsTracker::kDefaultUnavailableMetadata & ~DepsTracker::kOnlyTextScore
: DepsTracker::kDefaultUnavailableMetadata;
// Create the PlanExecutor.
bool shouldProduceEmptyDocs = false;
auto exec = uassertStatusOK(prepareExecutor(expCtx,
collection,
nss,
pipeline,
sortStage,
std::move(rewrittenGroupStage),
unavailableMetadata,
queryObj,
skipThenLimit,
aggRequest,
Pipeline::kAllowedMatcherFeatures,
&shouldProduceEmptyDocs));
const auto cursorType = shouldProduceEmptyDocs
? DocumentSourceCursor::CursorType::kEmptyDocuments
: DocumentSourceCursor::CursorType::kRegular;
// If this is a change stream pipeline or a resharding resume token has been requested, make
// sure that we tell DSCursor to track the oplog time.
const bool trackOplogTS =
(pipeline->peekFront() && pipeline->peekFront()->constraints().isChangeStreamStage()) ||
(aggRequest && aggRequest->getRequestReshardingResumeToken());
auto attachExecutorCallback =
[cursorType, trackOplogTS](const CollectionPtr& collection,
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> exec,
Pipeline* pipeline) {
auto cursor = DocumentSourceCursor::create(
collection, std::move(exec), pipeline->getContext(), cursorType, trackOplogTS);
pipeline->addInitialSource(std::move(cursor));
};
return std::make_pair(std::move(attachExecutorCallback), std::move(exec));
}
| 0
|
253,701
|
ccp_run_ecc_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
{
struct ccp_ecc_engine *ecc = &cmd->u.ecc;
ecc->ecc_result = 0;
if (!ecc->mod ||
(ecc->mod_len > CCP_ECC_MODULUS_BYTES))
return -EINVAL;
switch (ecc->function) {
case CCP_ECC_FUNCTION_MMUL_384BIT:
case CCP_ECC_FUNCTION_MADD_384BIT:
case CCP_ECC_FUNCTION_MINV_384BIT:
return ccp_run_ecc_mm_cmd(cmd_q, cmd);
case CCP_ECC_FUNCTION_PADD_384BIT:
case CCP_ECC_FUNCTION_PMUL_384BIT:
case CCP_ECC_FUNCTION_PDBL_384BIT:
return ccp_run_ecc_pm_cmd(cmd_q, cmd);
default:
return -EINVAL;
}
}
| 0
|
385,836
|
SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode)
{
struct path path;
int error;
unsigned int lookup_flags = LOOKUP_FOLLOW;
retry:
error = user_path_at(dfd, filename, lookup_flags, &path);
if (!error) {
error = chmod_common(&path, mode);
path_put(&path);
if (retry_estale(error, lookup_flags)) {
lookup_flags |= LOOKUP_REVAL;
goto retry;
}
}
return error;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.