idx
int64 | func
string | target
int64 |
|---|---|---|
185,211
|
void SoftVideoDecoderOMXComponent::handlePortSettingsChange(
bool *portWillReset, uint32_t width, uint32_t height,
CropSettingsMode cropSettingsMode, bool fakeStride) {
*portWillReset = false;
bool sizeChanged = (width != mWidth || height != mHeight);
bool updateCrop = (cropSettingsMode == kCropUnSet);
bool cropChanged = (cropSettingsMode == kCropChanged);
bool strideChanged = false;
if (fakeStride) {
OMX_PARAM_PORTDEFINITIONTYPE *def = &editPortInfo(kOutputPortIndex)->mDef;
if (def->format.video.nStride != (OMX_S32)width
|| def->format.video.nSliceHeight != (OMX_U32)height) {
strideChanged = true;
}
}
if (sizeChanged || cropChanged || strideChanged) {
mWidth = width;
mHeight = height;
if ((sizeChanged && !mIsAdaptive)
|| width > mAdaptiveMaxWidth
|| height > mAdaptiveMaxHeight) {
if (mIsAdaptive) {
if (width > mAdaptiveMaxWidth) {
mAdaptiveMaxWidth = width;
}
if (height > mAdaptiveMaxHeight) {
mAdaptiveMaxHeight = height;
}
}
updatePortDefinitions(updateCrop);
notify(OMX_EventPortSettingsChanged, kOutputPortIndex, 0, NULL);
mOutputPortSettingsChange = AWAITING_DISABLED;
*portWillReset = true;
} else {
updatePortDefinitions(updateCrop);
if (fakeStride) {
OMX_PARAM_PORTDEFINITIONTYPE *def = &editPortInfo(kOutputPortIndex)->mDef;
def->format.video.nStride = mWidth;
def->format.video.nSliceHeight = mHeight;
}
notify(OMX_EventPortSettingsChanged, kOutputPortIndex,
OMX_IndexConfigCommonOutputCrop, NULL);
}
}
}
| 0
|
449,777
|
stdmac_file(const SMacro *s, Token **params, int nparams)
{
(void)s;
(void)params;
(void)nparams;
return make_tok_qstr(NULL, src_get_fname());
}
| 0
|
447,228
|
static int __init efisubsys_init(void)
{
int error;
if (!efi_enabled(EFI_BOOT))
return 0;
/*
* Since we process only one efi_runtime_service() at a time, an
* ordered workqueue (which creates only one execution context)
* should suffice all our needs.
*/
efi_rts_wq = alloc_ordered_workqueue("efi_rts_wq", 0);
if (!efi_rts_wq) {
pr_err("Creating efi_rts_wq failed, EFI runtime services disabled.\n");
clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
return 0;
}
/* We register the efi directory at /sys/firmware/efi */
efi_kobj = kobject_create_and_add("efi", firmware_kobj);
if (!efi_kobj) {
pr_err("efi: Firmware registration failed.\n");
return -ENOMEM;
}
error = generic_ops_register();
if (error)
goto err_put;
if (efi_enabled(EFI_RUNTIME_SERVICES))
efivar_ssdt_load();
error = sysfs_create_group(efi_kobj, &efi_subsys_attr_group);
if (error) {
pr_err("efi: Sysfs attribute export failed with error %d.\n",
error);
goto err_unregister;
}
error = efi_runtime_map_init(efi_kobj);
if (error)
goto err_remove_group;
/* and the standard mountpoint for efivarfs */
error = sysfs_create_mount_point(efi_kobj, "efivars");
if (error) {
pr_err("efivars: Subsystem registration failed.\n");
goto err_remove_group;
}
return 0;
err_remove_group:
sysfs_remove_group(efi_kobj, &efi_subsys_attr_group);
err_unregister:
generic_ops_unregister();
err_put:
kobject_put(efi_kobj);
return error;
}
| 0
|
103,649
|
explicit BlockingWriteClient(AsyncSSLSocket::UniquePtr socket)
: socket_(std::move(socket)), bufLen_(2500), iovCount_(2000) {
// Fill buf_
buf_ = std::make_unique<uint8_t[]>(bufLen_);
for (uint32_t n = 0; n < sizeof(buf_); ++n) {
buf_[n] = n % 0xff;
}
// Initialize iov_
iov_ = std::make_unique<struct iovec[]>(iovCount_);
for (uint32_t n = 0; n < iovCount_; ++n) {
iov_[n].iov_base = buf_.get() + n;
if (n & 0x1) {
iov_[n].iov_len = n % bufLen_;
} else {
iov_[n].iov_len = bufLen_ - (n % bufLen_);
}
}
socket_->sslConn(this, std::chrono::milliseconds(100));
}
| 0
|
139,832
|
free_tang_keys_info(struct tang_keys_info* tki)
{
if (!tki) {
return;
}
json_t* to_free[] = {tki->m_keys, tki->m_rotated_keys,
tki->m_payload, tki->m_sign
};
size_t len = sizeof(to_free) / sizeof(to_free[0]);
for (size_t i = 0; i < len; i++) {
if (to_free[i] == NULL) {
continue;
}
json_decref(to_free[i]);
}
free(tki);
}
| 0
|
339,789
|
int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset,
unsigned int *bytes, uint64_t *cluster_offset)
{
BDRVQcow2State *s = bs->opaque;
unsigned int l2_index;
uint64_t l1_index, l2_offset, *l2_table;
int l1_bits, c;
unsigned int offset_in_cluster;
uint64_t bytes_available, bytes_needed, nb_clusters;
int ret;
offset_in_cluster = offset_into_cluster(s, offset);
bytes_needed = (uint64_t) *bytes + offset_in_cluster;
l1_bits = s->l2_bits + s->cluster_bits;
/* compute how many bytes there are between the start of the cluster
* containing offset and the end of the l1 entry */
bytes_available = (1ULL << l1_bits) - (offset & ((1ULL << l1_bits) - 1))
+ offset_in_cluster;
if (bytes_needed > bytes_available) {
bytes_needed = bytes_available;
}
*cluster_offset = 0;
/* seek to the l2 offset in the l1 table */
l1_index = offset >> l1_bits;
if (l1_index >= s->l1_size) {
ret = QCOW2_CLUSTER_UNALLOCATED;
goto out;
}
l2_offset = s->l1_table[l1_index] & L1E_OFFSET_MASK;
if (!l2_offset) {
ret = QCOW2_CLUSTER_UNALLOCATED;
goto out;
}
if (offset_into_cluster(s, l2_offset)) {
qcow2_signal_corruption(bs, true, -1, -1, "L2 table offset %#" PRIx64
" unaligned (L1 index: %#" PRIx64 ")",
l2_offset, l1_index);
return -EIO;
}
/* load the l2 table in memory */
ret = l2_load(bs, l2_offset, &l2_table);
if (ret < 0) {
return ret;
}
/* find the cluster offset for the given disk offset */
l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1);
*cluster_offset = be64_to_cpu(l2_table[l2_index]);
nb_clusters = size_to_clusters(s, bytes_needed);
/* bytes_needed <= *bytes + offset_in_cluster, both of which are unsigned
* integers; the minimum cluster size is 512, so this assertion is always
* true */
assert(nb_clusters <= INT_MAX);
ret = qcow2_get_cluster_type(*cluster_offset);
switch (ret) {
case QCOW2_CLUSTER_COMPRESSED:
/* Compressed clusters can only be processed one by one */
c = 1;
*cluster_offset &= L2E_COMPRESSED_OFFSET_SIZE_MASK;
break;
case QCOW2_CLUSTER_ZERO:
if (s->qcow_version < 3) {
qcow2_signal_corruption(bs, true, -1, -1, "Zero cluster entry found"
" in pre-v3 image (L2 offset: %#" PRIx64
", L2 index: %#x)", l2_offset, l2_index);
ret = -EIO;
goto fail;
}
c = count_contiguous_clusters_by_type(nb_clusters, &l2_table[l2_index],
QCOW2_CLUSTER_ZERO);
*cluster_offset = 0;
break;
case QCOW2_CLUSTER_UNALLOCATED:
/* how many empty clusters ? */
c = count_contiguous_clusters_by_type(nb_clusters, &l2_table[l2_index],
QCOW2_CLUSTER_UNALLOCATED);
*cluster_offset = 0;
break;
case QCOW2_CLUSTER_NORMAL:
/* how many allocated clusters ? */
c = count_contiguous_clusters(nb_clusters, s->cluster_size,
&l2_table[l2_index], QCOW_OFLAG_ZERO);
*cluster_offset &= L2E_OFFSET_MASK;
if (offset_into_cluster(s, *cluster_offset)) {
qcow2_signal_corruption(bs, true, -1, -1, "Data cluster offset %#"
PRIx64 " unaligned (L2 offset: %#" PRIx64
", L2 index: %#x)", *cluster_offset,
l2_offset, l2_index);
ret = -EIO;
goto fail;
}
break;
default:
abort();
}
qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
bytes_available = (int64_t)c * s->cluster_size;
out:
if (bytes_available > bytes_needed) {
bytes_available = bytes_needed;
}
/* bytes_available <= bytes_needed <= *bytes + offset_in_cluster;
* subtracting offset_in_cluster will therefore definitely yield something
* not exceeding UINT_MAX */
assert(bytes_available - offset_in_cluster <= UINT_MAX);
*bytes = bytes_available - offset_in_cluster;
return ret;
fail:
qcow2_cache_put(bs, s->l2_table_cache, (void **)&l2_table);
return ret;
}
| 0
|
145,384
|
R_API int r_core_bin_set_env(RCore *r, RBinFile *binfile) {
r_return_val_if_fail (r, false);
RBinObject *binobj = binfile? binfile->o: NULL;
RBinInfo *info = binobj? binobj->info: NULL;
if (info) {
int va = info->has_va;
const char *arch = info->arch;
ut16 bits = info->bits;
ut64 baseaddr = r_bin_get_baddr (r->bin);
r_config_set_i (r->config, "bin.baddr", baseaddr);
sdb_num_add (r->sdb, "orig_baddr", baseaddr, 0);
r_config_set (r->config, "asm.arch", arch);
r_config_set_i (r->config, "asm.bits", bits);
r_config_set (r->config, "anal.arch", arch);
if (info->cpu && *info->cpu) {
r_config_set (r->config, "anal.cpu", info->cpu);
} else {
r_config_set (r->config, "anal.cpu", arch);
}
r_asm_use (r->assembler, arch);
r_core_bin_info (r, R_CORE_BIN_ACC_ALL, R_MODE_SET, va, NULL, NULL);
r_core_bin_set_cur (r, binfile);
return true;
}
return false;
}
| 0
|
261,616
|
void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style)
{
gdPoint pts[363];
int i, pti;
int lx = 0, ly = 0;
int fx = 0, fy = 0;
if ((s % 360) == (e % 360)) {
s = 0; e = 360;
} else {
if (s > 360) {
s = s % 360;
}
if (e > 360) {
e = e % 360;
}
while (s < 0) {
s += 360;
}
while (e < s) {
e += 360;
}
if (s == e) {
s = 0; e = 360;
}
}
for (i = s, pti = 1; i <= e; i++, pti++) {
int x, y;
x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
if (i != s) {
if (!(style & gdChord)) {
if (style & gdNoFill) {
gdImageLine(im, lx, ly, x, y, color);
} else {
if (y == ly) {
pti--; /* don't add this point */
if (((i > 270 || i < 90) && x > lx) || ((i > 90 && i < 270) && x < lx)) {
/* replace the old x coord, if increasing on the
right side or decreasing on the left side */
pts[pti].x = x;
}
} else {
pts[pti].x = x;
pts[pti].y = y;
}
}
}
} else {
fx = x;
fy = y;
if (!(style & (gdChord | gdNoFill))) {
pts[0].x = cx;
pts[0].y = cy;
pts[pti].x = x;
pts[pti].y = y;
}
}
lx = x;
ly = y;
}
if (style & gdChord) {
if (style & gdNoFill) {
if (style & gdEdged) {
gdImageLine(im, cx, cy, lx, ly, color);
gdImageLine(im, cx, cy, fx, fy, color);
}
gdImageLine(im, fx, fy, lx, ly, color);
} else {
pts[0].x = fx;
pts[0].y = fy;
pts[1].x = lx;
pts[1].y = ly;
pts[2].x = cx;
pts[2].y = cy;
gdImageFilledPolygon(im, pts, 3, color);
}
} else {
if (style & gdNoFill) {
if (style & gdEdged) {
gdImageLine(im, cx, cy, lx, ly, color);
gdImageLine(im, cx, cy, fx, fy, color);
}
} else {
pts[pti].x = cx;
pts[pti].y = cy;
gdImageFilledPolygon(im, pts, pti+1, color);
}
}
}
| 0
|
403,440
|
static int default_local_infile_read(void *ptr, char *buf, uint buf_len)
{
int count;
default_local_infile_data*data = (default_local_infile_data *) ptr;
if ((count= (int) my_read(data->fd, (uchar *) buf, buf_len, MYF(0))) < 0)
{
data->error_num= EE_READ; /* the errmsg for not entire file read */
my_snprintf(data->error_msg, sizeof(data->error_msg)-1,
EE(EE_READ),
data->filename, my_errno);
}
return count;
}
| 0
|
389,852
|
opaque* ClientDiffieHellmanPublic::get_clientKey() const
{
return Yc_;
}
| 0
|
227,731
|
status_t ACodec::submitOutputMetadataBuffer() {
CHECK(storingMetadataInDecodedBuffers());
if (mMetadataBuffersToSubmit == 0)
return OK;
BufferInfo *info = dequeueBufferFromNativeWindow();
if (info == NULL) {
return ERROR_IO;
}
ALOGV("[%s] submitting output meta buffer ID %u for graphic buffer %p",
mComponentName.c_str(), info->mBufferID, info->mGraphicBuffer.get());
--mMetadataBuffersToSubmit;
info->checkWriteFence("submitOutputMetadataBuffer");
status_t err = mOMX->fillBuffer(mNode, info->mBufferID, info->mFenceFd);
info->mFenceFd = -1;
if (err == OK) {
info->mStatus = BufferInfo::OWNED_BY_COMPONENT;
}
return err;
}
| 0
|
453,830
|
int imap_reconnect (IMAP_DATA **p_idata)
{
CONTEXT *orig_ctx, new_ctx;
int rc = -1, i;
IMAP_DATA *idata = *p_idata;
HEADER *old_hdr, *new_hdr;
/* L10N:
Message displayed when IMAP connection is lost and Mutt
tries to reconnect.
*/
mutt_message _("Trying to reconnect...");
mutt_sleep (0);
orig_ctx = idata->ctx;
if (!orig_ctx)
goto cleanup;
if (mx_open_mailbox (orig_ctx->path,
orig_ctx->readonly ? MUTT_READONLY : 0,
&new_ctx) == NULL)
goto cleanup;
new_ctx.dontwrite = orig_ctx->dontwrite;
new_ctx.pattern = orig_ctx->pattern;
new_ctx.limit_pattern = orig_ctx->limit_pattern;
orig_ctx->pattern = NULL;
orig_ctx->limit_pattern = NULL;
if (idata->uid_validity == ((IMAP_DATA *) new_ctx.data)->uid_validity)
{
for (i = 0; i < new_ctx.msgcount; i++)
{
new_hdr = new_ctx.hdrs[i];
old_hdr = (HEADER *) int_hash_find (idata->uid_hash,
HEADER_DATA(new_hdr)->uid);
if (!old_hdr)
continue;
/* this logic is in part from mbox.c. */
if (old_hdr->changed)
{
mutt_set_flag (&new_ctx, new_hdr, MUTT_FLAG, old_hdr->flagged);
mutt_set_flag (&new_ctx, new_hdr, MUTT_REPLIED, old_hdr->replied);
mutt_set_flag (&new_ctx, new_hdr, MUTT_OLD, old_hdr->old);
mutt_set_flag (&new_ctx, new_hdr, MUTT_READ, old_hdr->read);
/* TODO: the ->env check is unfortunately voodoo that I
* haven't taken the time to track down yet. It's in other
* parts of the code but I don't know why yet. */
if (old_hdr->env && old_hdr->env->changed)
{
new_hdr->env->changed = old_hdr->env->changed;
new_hdr->changed = 1;
new_ctx.changed = 1;
if (old_hdr->env->changed & MUTT_ENV_CHANGED_IRT)
{
mutt_free_list (&new_hdr->env->in_reply_to);
new_hdr->env->in_reply_to = old_hdr->env->in_reply_to;
old_hdr->env->in_reply_to = NULL;
}
if (old_hdr->env->changed & MUTT_ENV_CHANGED_REFS)
{
mutt_free_list (&new_hdr->env->references);
new_hdr->env->references = old_hdr->env->references;
old_hdr->env->references = NULL;
}
if (old_hdr->env->changed & MUTT_ENV_CHANGED_XLABEL)
{
FREE (&new_hdr->env->x_label);
new_hdr->env->x_label = old_hdr->env->x_label;
old_hdr->env->x_label = NULL;
}
if (old_hdr->env->changed & MUTT_ENV_CHANGED_SUBJECT)
{
FREE (&new_hdr->env->subject);
new_hdr->env->subject = old_hdr->env->subject;
new_hdr->env->real_subj = old_hdr->env->real_subj;
old_hdr->env->subject = old_hdr->env->real_subj = NULL;
}
}
if (old_hdr->attach_del)
{
if (old_hdr->content->parts && !new_hdr->content->parts)
{
new_hdr->attach_del = 1;
new_hdr->changed = 1;
new_ctx.changed = 1;
new_hdr->content->parts = old_hdr->content->parts;
old_hdr->content->parts = NULL;
}
}
}
mutt_set_flag (&new_ctx, new_hdr, MUTT_DELETE, old_hdr->deleted);
mutt_set_flag (&new_ctx, new_hdr, MUTT_PURGE, old_hdr->purge);
mutt_set_flag (&new_ctx, new_hdr, MUTT_TAG, old_hdr->tagged);
}
}
rc = 0;
cleanup:
idata->status = IMAP_FATAL;
mx_fastclose_mailbox (orig_ctx);
imap_close_connection (idata);
if (rc != 0)
{
/* L10N:
Message when Mutt tries to reconnect to an IMAP mailbox but is
unable to.
*/
mutt_error _("Reconnect failed. Mailbox closed.");
}
else
{
memcpy (orig_ctx, &new_ctx, sizeof(CONTEXT));
idata = (IMAP_DATA *)orig_ctx->data;
idata->ctx = orig_ctx;
*p_idata = idata;
/* L10N:
Message when Mutt reconnects to an IMAP mailbox after a fatal error.
*/
mutt_error _("Reconnect succeeded.");
}
mutt_sleep (0);
return rc;
}
| 0
|
516,482
|
static bool not_null_fields_have_null_values(TABLE *table)
{
Field **orig_field= table->field;
Field **filled_field= table->field_to_fill();
if (filled_field != orig_field)
{
THD *thd=table->in_use;
for (uint i=0; i < table->s->fields; i++)
{
Field *of= orig_field[i];
Field *ff= filled_field[i];
if (ff != of)
{
// copy after-update flags to of, copy before-update flags to ff
swap_variables(uint32, of->flags, ff->flags);
if (ff->is_real_null())
{
ff->set_notnull(); // for next row WHERE condition in UPDATE
if (convert_null_to_field_value_or_error(of) || thd->is_error())
return true;
}
}
}
}
return false;
}
| 0
|
26,257
|
static bool hyperv_hypercall_available ( X86CPU * cpu ) {
return cpu -> hyperv_vapic || ( cpu -> hyperv_spinlock_attempts != HYPERV_SPINLOCK_NEVER_RETRY ) ;
}
| 0
|
86,415
|
static int mem_close(jas_stream_obj_t *obj)
{
jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj;
if (m->myalloc_ && m->buf_) {
jas_free(m->buf_);
m->buf_ = 0;
}
jas_free(obj);
return 0;
}
| 0
|
244,486
|
IntPoint AXObject::minimumScrollOffset() const {
ScrollableArea* area = getScrollableAreaIfScrollable();
if (!area)
return IntPoint();
return IntPoint(area->minimumScrollOffsetInt().width(),
area->minimumScrollOffsetInt().height());
}
| 0
|
296,751
|
static u64 core_reg_offset_from_id(u64 id)
{
return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE);
}
| 0
|
296,014
|
void PackLinuxElf32mipsel::defineSymbols(Filter const *ft)
{
PackLinuxElf32::defineSymbols(ft);
}
| 0
|
307,049
|
void AudioRendererHost::OnPauseStream(int stream_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
AudioEntry* entry = LookupById(stream_id);
if (!entry) {
SendErrorMessage(stream_id);
return;
}
entry->controller->Pause();
if (media_observer_)
media_observer_->OnSetAudioStreamPlaying(this, stream_id, false);
}
| 0
|
34,164
|
void sqlite3EndTable(
Parse *pParse, /* Parse context */
Token *pCons, /* The ',' token after the last column defn. */
Token *pEnd, /* The ')' before options in the CREATE TABLE */
u8 tabOpts, /* Extra table options. Usually 0. */
Select *pSelect /* Select from a "CREATE ... AS SELECT" */
){
Table *p; /* The new table */
sqlite3 *db = pParse->db; /* The database connection */
int iDb; /* Database in which the table lives */
Index *pIdx; /* An implied index of the table */
if( pEnd==0 && pSelect==0 ){
return;
}
assert( !db->mallocFailed );
p = pParse->pNewTable;
if( p==0 ) return;
if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){
p->tabFlags |= TF_Shadow;
}
/* If the db->init.busy is 1 it means we are reading the SQL off the
** "sqlite_master" or "sqlite_temp_master" table on the disk.
** So do not write to the disk again. Extract the root page number
** for the table from the db->init.newTnum field. (The page number
** should have been put there by the sqliteOpenCb routine.)
**
** If the root page number is 1, that means this is the sqlite_master
** table itself. So mark it read-only.
*/
if( db->init.busy ){
if( pSelect ){
sqlite3ErrorMsg(pParse, "");
return;
}
p->tnum = db->init.newTnum;
if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
}
assert( (p->tabFlags & TF_HasPrimaryKey)==0
|| p->iPKey>=0 || sqlite3PrimaryKeyIndex(p)!=0 );
assert( (p->tabFlags & TF_HasPrimaryKey)!=0
|| (p->iPKey<0 && sqlite3PrimaryKeyIndex(p)==0) );
/* Special processing for WITHOUT ROWID Tables */
if( tabOpts & TF_WithoutRowid ){
if( (p->tabFlags & TF_Autoincrement) ){
sqlite3ErrorMsg(pParse,
"AUTOINCREMENT not allowed on WITHOUT ROWID tables");
return;
}
if( (p->tabFlags & TF_HasPrimaryKey)==0 ){
sqlite3ErrorMsg(pParse, "PRIMARY KEY missing on table %s", p->zName);
return;
}
p->tabFlags |= TF_WithoutRowid | TF_NoVisibleRowid;
convertToWithoutRowidTable(pParse, p);
}
iDb = sqlite3SchemaToIndex(db, p->pSchema);
#ifndef SQLITE_OMIT_CHECK
/* Resolve names in all CHECK constraint expressions.
*/
if( p->pCheck ){
sqlite3ResolveSelfReference(pParse, p, NC_IsCheck, 0, p->pCheck);
}
#endif /* !defined(SQLITE_OMIT_CHECK) */
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
if( p->tabFlags & TF_HasGenerated ){
int ii, nNG = 0;
testcase( p->tabFlags & TF_HasVirtual );
testcase( p->tabFlags & TF_HasStored );
for(ii=0; ii<p->nCol; ii++){
u32 colFlags = p->aCol[ii].colFlags;
if( (colFlags & COLFLAG_GENERATED)!=0 ){
testcase( colFlags & COLFLAG_VIRTUAL );
testcase( colFlags & COLFLAG_STORED );
sqlite3ResolveSelfReference(pParse, p, NC_GenCol,
p->aCol[ii].pDflt, 0);
}else{
nNG++;
}
}
if( nNG==0 ){
sqlite3ErrorMsg(pParse, "must have at least one non-generated column");
return;
}
}
#endif
/* Estimate the average row size for the table and for all implied indices */
estimateTableWidth(p);
for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
estimateIndexWidth(pIdx);
}
/* If not initializing, then create a record for the new table
** in the SQLITE_MASTER table of the database.
**
** If this is a TEMPORARY table, write the entry into the auxiliary
** file instead of into the main database file.
*/
if( !db->init.busy ){
int n;
Vdbe *v;
char *zType; /* "view" or "table" */
char *zType2; /* "VIEW" or "TABLE" */
char *zStmt; /* Text of the CREATE TABLE or CREATE VIEW statement */
v = sqlite3GetVdbe(pParse);
if( NEVER(v==0) ) return;
sqlite3VdbeAddOp1(v, OP_Close, 0);
/*
** Initialize zType for the new view or table.
*/
if( p->pSelect==0 ){
/* A regular table */
zType = "table";
zType2 = "TABLE";
#ifndef SQLITE_OMIT_VIEW
}else{
/* A view */
zType = "view";
zType2 = "VIEW";
#endif
}
/* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT
** statement to populate the new table. The root-page number for the
** new table is in register pParse->regRoot.
**
** Once the SELECT has been coded by sqlite3Select(), it is in a
** suitable state to query for the column names and types to be used
** by the new table.
**
** A shared-cache write-lock is not required to write to the new table,
** as a schema-lock must have already been obtained to create it. Since
** a schema-lock excludes all other database users, the write-lock would
** be redundant.
*/
if( pSelect ){
SelectDest dest; /* Where the SELECT should store results */
int regYield; /* Register holding co-routine entry-point */
int addrTop; /* Top of the co-routine */
int regRec; /* A record to be insert into the new table */
int regRowid; /* Rowid of the next row to insert */
int addrInsLoop; /* Top of the loop for inserting rows */
Table *pSelTab; /* A table that describes the SELECT results */
regYield = ++pParse->nMem;
regRec = ++pParse->nMem;
regRowid = ++pParse->nMem;
assert(pParse->nTab==1);
sqlite3MayAbort(pParse);
sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb);
sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG);
pParse->nTab = 2;
addrTop = sqlite3VdbeCurrentAddr(v) + 1;
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);
if( pParse->nErr ) return;
pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect, SQLITE_AFF_BLOB);
if( pSelTab==0 ) return;
assert( p->aCol==0 );
p->nCol = p->nNVCol = pSelTab->nCol;
p->aCol = pSelTab->aCol;
pSelTab->nCol = 0;
pSelTab->aCol = 0;
sqlite3DeleteTable(db, pSelTab);
sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield);
sqlite3Select(pParse, pSelect, &dest);
if( pParse->nErr ) return;
sqlite3VdbeEndCoroutine(v, regYield);
sqlite3VdbeJumpHere(v, addrTop - 1);
addrInsLoop = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm);
VdbeCoverage(v);
sqlite3VdbeAddOp3(v, OP_MakeRecord, dest.iSdst, dest.nSdst, regRec);
sqlite3TableAffinity(v, p, 0);
sqlite3VdbeAddOp2(v, OP_NewRowid, 1, regRowid);
sqlite3VdbeAddOp3(v, OP_Insert, 1, regRec, regRowid);
sqlite3VdbeGoto(v, addrInsLoop);
sqlite3VdbeJumpHere(v, addrInsLoop);
sqlite3VdbeAddOp1(v, OP_Close, 1);
}
/* Compute the complete text of the CREATE statement */
if( pSelect ){
zStmt = createTableStmt(db, p);
}else{
Token *pEnd2 = tabOpts ? &pParse->sLastToken : pEnd;
n = (int)(pEnd2->z - pParse->sNameToken.z);
if( pEnd2->z[0]!=';' ) n += pEnd2->n;
zStmt = sqlite3MPrintf(db,
"CREATE %s %.*s", zType2, n, pParse->sNameToken.z
);
}
/* A slot for the record has already been allocated in the
** SQLITE_MASTER table. We just need to update that slot with all
** the information we've collected.
*/
sqlite3NestedParse(pParse,
"UPDATE %Q.%s "
"SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q "
"WHERE rowid=#%d",
db->aDb[iDb].zDbSName, MASTER_NAME,
zType,
p->zName,
p->zName,
pParse->regRoot,
zStmt,
pParse->regRowid
);
sqlite3DbFree(db, zStmt);
sqlite3ChangeCookie(pParse, iDb);
#ifndef SQLITE_OMIT_AUTOINCREMENT
/* Check to see if we need to create an sqlite_sequence table for
** keeping track of autoincrement keys.
*/
if( (p->tabFlags & TF_Autoincrement)!=0 ){
Db *pDb = &db->aDb[iDb];
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
if( pDb->pSchema->pSeqTab==0 ){
sqlite3NestedParse(pParse,
"CREATE TABLE %Q.sqlite_sequence(name,seq)",
pDb->zDbSName
);
}
}
#endif
/* Reparse everything to update our internal data structures */
sqlite3VdbeAddParseSchemaOp(v, iDb,
sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName));
}
/* Add the table to the in-memory representation of the database.
*/
if( db->init.busy ){
Table *pOld;
Schema *pSchema = p->pSchema;
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p);
if( pOld ){
assert( p==pOld ); /* Malloc must have failed inside HashInsert() */
sqlite3OomFault(db);
return;
}
pParse->pNewTable = 0;
db->mDbFlags |= DBFLAG_SchemaChange;
#ifndef SQLITE_OMIT_ALTERTABLE
if( !p->pSelect ){
const char *zName = (const char *)pParse->sNameToken.z;
int nName;
assert( !pSelect && pCons && pEnd );
if( pCons->z==0 ){
pCons = pEnd;
}
nName = (int)((const char *)pCons->z - zName);
p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
}
#endif
}
}
| 0
|
495,397
|
SSLNetVConnection::select_next_protocol(SSL *ssl, const unsigned char **out, unsigned char *outlen,
const unsigned char *in ATS_UNUSED, unsigned inlen ATS_UNUSED, void *)
{
SSLNetVConnection *netvc = SSLNetVCAccess(ssl);
const unsigned char *npn = nullptr;
unsigned npnsz = 0;
ink_release_assert(netvc != nullptr);
if (netvc->npnSet && netvc->npnSet->advertiseProtocols(&npn, &npnsz)) {
// SSL_select_next_proto chooses the first server-offered protocol that appears in the clients protocol set, ie. the
// server selects the protocol. This is a n^2 search, so it's preferable to keep the protocol set short.
#if HAVE_SSL_SELECT_NEXT_PROTO
if (SSL_select_next_proto((unsigned char **)out, outlen, npn, npnsz, in, inlen) == OPENSSL_NPN_NEGOTIATED) {
Debug("ssl", "selected ALPN protocol %.*s", (int)(*outlen), *out);
return SSL_TLSEXT_ERR_OK;
}
#endif /* HAVE_SSL_SELECT_NEXT_PROTO */
}
*out = nullptr;
*outlen = 0;
return SSL_TLSEXT_ERR_NOACK;
}
| 0
|
401,673
|
ZEND_API int ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
ZVAL_BOOL(result, !zend_is_identical(op1, op2));
return SUCCESS;
}
| 0
|
287,628
|
tiffcp(TIFF* in, TIFF* out)
{
uint16 bitspersample, samplesperpixel;
uint16 input_compression, input_photometric;
copyFunc cf;
uint32 width, length;
struct cpTag* p;
CopyField(TIFFTAG_IMAGEWIDTH, width);
CopyField(TIFFTAG_IMAGELENGTH, length);
CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);
CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
if (compression != (uint16)-1)
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
else
CopyField(TIFFTAG_COMPRESSION, compression);
TIFFGetFieldDefaulted(in, TIFFTAG_COMPRESSION, &input_compression);
TIFFGetFieldDefaulted(in, TIFFTAG_PHOTOMETRIC, &input_photometric);
if (input_compression == COMPRESSION_JPEG) {
/* Force conversion to RGB */
TIFFSetField(in, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
} else if (input_photometric == PHOTOMETRIC_YCBCR) {
/* Otherwise, can't handle subsampled input */
uint16 subsamplinghor,subsamplingver;
TIFFGetFieldDefaulted(in, TIFFTAG_YCBCRSUBSAMPLING,
&subsamplinghor, &subsamplingver);
if (subsamplinghor!=1 || subsamplingver!=1) {
fprintf(stderr, "tiffcp: %s: Can't copy/convert subsampled image.\n",
TIFFFileName(in));
return FALSE;
}
}
if (compression == COMPRESSION_JPEG) {
if (input_photometric == PHOTOMETRIC_RGB &&
jpegcolormode == JPEGCOLORMODE_RGB)
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);
else
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, input_photometric);
}
else if (compression == COMPRESSION_SGILOG
|| compression == COMPRESSION_SGILOG24)
TIFFSetField(out, TIFFTAG_PHOTOMETRIC,
samplesperpixel == 1 ?
PHOTOMETRIC_LOGL : PHOTOMETRIC_LOGLUV);
else if (input_compression == COMPRESSION_JPEG &&
samplesperpixel == 3 ) {
/* RGB conversion was forced above
hence the output will be of the same type */
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
}
else
CopyTag(TIFFTAG_PHOTOMETRIC, 1, TIFF_SHORT);
if (fillorder != 0)
TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
else
CopyTag(TIFFTAG_FILLORDER, 1, TIFF_SHORT);
/*
* Will copy `Orientation' tag from input image
*/
TIFFGetFieldDefaulted(in, TIFFTAG_ORIENTATION, &orientation);
switch (orientation) {
case ORIENTATION_BOTRIGHT:
case ORIENTATION_RIGHTBOT: /* XXX */
TIFFWarning(TIFFFileName(in), "using bottom-left orientation");
orientation = ORIENTATION_BOTLEFT;
/* fall thru... */
case ORIENTATION_LEFTBOT: /* XXX */
case ORIENTATION_BOTLEFT:
break;
case ORIENTATION_TOPRIGHT:
case ORIENTATION_RIGHTTOP: /* XXX */
default:
TIFFWarning(TIFFFileName(in), "using top-left orientation");
orientation = ORIENTATION_TOPLEFT;
/* fall thru... */
case ORIENTATION_LEFTTOP: /* XXX */
case ORIENTATION_TOPLEFT:
break;
}
TIFFSetField(out, TIFFTAG_ORIENTATION, orientation);
/*
* Choose tiles/strip for the output image according to
* the command line arguments (-tiles, -strips) and the
* structure of the input image.
*/
if (outtiled == -1)
outtiled = TIFFIsTiled(in);
if (outtiled) {
/*
* Setup output file's tile width&height. If either
* is not specified, use either the value from the
* input image or, if nothing is defined, use the
* library default.
*/
if (tilewidth == (uint32) -1)
TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);
if (tilelength == (uint32) -1)
TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);
TIFFDefaultTileSize(out, &tilewidth, &tilelength);
TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);
TIFFSetField(out, TIFFTAG_TILELENGTH, tilelength);
} else {
/*
* RowsPerStrip is left unspecified: use either the
* value from the input image or, if nothing is defined,
* use the library default.
*/
if (rowsperstrip == (uint32) 0) {
if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP,
&rowsperstrip)) {
rowsperstrip =
TIFFDefaultStripSize(out, rowsperstrip);
}
if (rowsperstrip > length && rowsperstrip != (uint32)-1)
rowsperstrip = length;
}
else if (rowsperstrip == (uint32) -1)
rowsperstrip = length;
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
}
if (config != (uint16) -1)
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
else
CopyField(TIFFTAG_PLANARCONFIG, config);
if (samplesperpixel <= 4)
CopyTag(TIFFTAG_TRANSFERFUNCTION, 4, TIFF_SHORT);
CopyTag(TIFFTAG_COLORMAP, 4, TIFF_SHORT);
/* SMinSampleValue & SMaxSampleValue */
switch (compression) {
case COMPRESSION_JPEG:
TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
break;
case COMPRESSION_JBIG:
CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);
CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);
CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);
CopyTag(TIFFTAG_FAXDCS, 1, TIFF_ASCII);
break;
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
case COMPRESSION_LZMA:
if (predictor != (uint16)-1)
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
else
CopyField(TIFFTAG_PREDICTOR, predictor);
if (preset != -1) {
if (compression == COMPRESSION_ADOBE_DEFLATE
|| compression == COMPRESSION_DEFLATE)
TIFFSetField(out, TIFFTAG_ZIPQUALITY, preset);
else if (compression == COMPRESSION_LZMA)
TIFFSetField(out, TIFFTAG_LZMAPRESET, preset);
}
break;
case COMPRESSION_CCITTFAX3:
case COMPRESSION_CCITTFAX4:
if (compression == COMPRESSION_CCITTFAX3) {
if (g3opts != (uint32) -1)
TIFFSetField(out, TIFFTAG_GROUP3OPTIONS,
g3opts);
else
CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);
} else
CopyTag(TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG);
CopyTag(TIFFTAG_BADFAXLINES, 1, TIFF_LONG);
CopyTag(TIFFTAG_CLEANFAXDATA, 1, TIFF_LONG);
CopyTag(TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG);
CopyTag(TIFFTAG_FAXRECVPARAMS, 1, TIFF_LONG);
CopyTag(TIFFTAG_FAXRECVTIME, 1, TIFF_LONG);
CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);
break;
}
{
uint32 len32;
void** data;
if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))
TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);
}
{
uint16 ninks;
const char* inknames;
if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
if (TIFFGetField(in, TIFFTAG_INKNAMES, &inknames)) {
int inknameslen = strlen(inknames) + 1;
const char* cp = inknames;
while (ninks > 1) {
cp = strchr(cp, '\0');
cp++;
inknameslen += (strlen(cp) + 1);
ninks--;
}
TIFFSetField(out, TIFFTAG_INKNAMES, inknameslen, inknames);
}
}
}
{
unsigned short pg0, pg1;
if (pageInSeq == 1) {
if (pageNum < 0) /* only one input file */ {
if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1))
TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
} else
TIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);
} else {
if (TIFFGetField(in, TIFFTAG_PAGENUMBER, &pg0, &pg1)) {
if (pageNum < 0) /* only one input file */
TIFFSetField(out, TIFFTAG_PAGENUMBER, pg0, pg1);
else
TIFFSetField(out, TIFFTAG_PAGENUMBER, pageNum++, 0);
}
}
}
for (p = tags; p < &tags[NTAGS]; p++)
CopyTag(p->tag, p->count, p->type);
cf = pickCopyFunc(in, out, bitspersample, samplesperpixel);
return (cf ? (*cf)(in, out, length, width, samplesperpixel) : FALSE);
}
| 1
|
473,987
|
connection_set_ssl_ssf(Connection *conn)
{
pthread_mutex_lock(&(conn->c_mutex));
if (conn->c_flags & CONN_FLAG_SSL) {
SSL_SecurityStatus(conn->c_prfd, NULL, NULL, NULL, &(conn->c_ssl_ssf), NULL, NULL);
} else {
conn->c_ssl_ssf = 0;
}
pthread_mutex_unlock(&(conn->c_mutex));
}
| 0
|
155,927
|
set_std_definitions(void)
{
add_std_definition("_PWD", NULL, get_cwd);
add_std_definition("_INSTANCE", NULL, get_instance);
}
| 0
|
231,293
|
void ExtensionRegistry::TriggerOnUnloaded(
const Extension* extension,
UnloadedExtensionInfo::Reason reason) {
CHECK(extension);
DCHECK(!enabled_extensions_.Contains(extension->id()));
FOR_EACH_OBSERVER(ExtensionRegistryObserver,
observers_,
OnExtensionUnloaded(browser_context_, extension, reason));
}
| 0
|
13,154
|
int RecordStack(CONTEXT* context,
int max_stack_size,
const void* instruction_pointers[],
Win32StackFrameUnwinder* frame_unwinder) {
#ifdef _WIN64
int i = 0;
for (; (i < max_stack_size) && context->Rip; ++i) {
instruction_pointers[i] = reinterpret_cast<const void*>(context->Rip);
if (!frame_unwinder->TryUnwind(context))
return i + 1;
}
return i;
#else
return 0;
#endif
}
| 1
|
247,905
|
LayerTreeHostTestKeepSwapPromiseMFBA() {}
| 0
|
364,335
|
xmlRegisterCharEncodingHandlersISO8859x (void) {
xmlNewCharEncodingHandler ("ISO-8859-2", ISO8859_2ToUTF8, UTF8ToISO8859_2);
xmlNewCharEncodingHandler ("ISO-8859-3", ISO8859_3ToUTF8, UTF8ToISO8859_3);
xmlNewCharEncodingHandler ("ISO-8859-4", ISO8859_4ToUTF8, UTF8ToISO8859_4);
xmlNewCharEncodingHandler ("ISO-8859-5", ISO8859_5ToUTF8, UTF8ToISO8859_5);
xmlNewCharEncodingHandler ("ISO-8859-6", ISO8859_6ToUTF8, UTF8ToISO8859_6);
xmlNewCharEncodingHandler ("ISO-8859-7", ISO8859_7ToUTF8, UTF8ToISO8859_7);
xmlNewCharEncodingHandler ("ISO-8859-8", ISO8859_8ToUTF8, UTF8ToISO8859_8);
xmlNewCharEncodingHandler ("ISO-8859-9", ISO8859_9ToUTF8, UTF8ToISO8859_9);
xmlNewCharEncodingHandler ("ISO-8859-10", ISO8859_10ToUTF8, UTF8ToISO8859_10);
xmlNewCharEncodingHandler ("ISO-8859-11", ISO8859_11ToUTF8, UTF8ToISO8859_11);
xmlNewCharEncodingHandler ("ISO-8859-13", ISO8859_13ToUTF8, UTF8ToISO8859_13);
xmlNewCharEncodingHandler ("ISO-8859-14", ISO8859_14ToUTF8, UTF8ToISO8859_14);
xmlNewCharEncodingHandler ("ISO-8859-15", ISO8859_15ToUTF8, UTF8ToISO8859_15);
xmlNewCharEncodingHandler ("ISO-8859-16", ISO8859_16ToUTF8, UTF8ToISO8859_16);
}
| 0
|
359,492
|
static unsigned long seg_base(struct x86_emulate_ctxt *ctxt, int seg)
{
if (ctxt->mode == X86EMUL_MODE_PROT64 && seg < VCPU_SREG_FS)
return 0;
return kvm_x86_ops->get_segment_base(ctxt->vcpu, seg);
}
| 0
|
45,727
|
static OPJ_BOOL opj_j2k_end_encoding(opj_j2k_t *p_j2k,
struct opj_stream_private *p_stream,
struct opj_event_mgr * p_manager)
{
/* preconditions */
assert(p_j2k != 00);
assert(p_manager != 00);
assert(p_stream != 00);
OPJ_UNUSED(p_stream);
OPJ_UNUSED(p_manager);
opj_tcd_destroy(p_j2k->m_tcd);
p_j2k->m_tcd = 00;
if (p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer) {
opj_free(p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer);
p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_buffer = 0;
p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current = 0;
}
if (p_j2k->m_specific_param.m_encoder.m_encoded_tile_data) {
opj_free(p_j2k->m_specific_param.m_encoder.m_encoded_tile_data);
p_j2k->m_specific_param.m_encoder.m_encoded_tile_data = 0;
}
p_j2k->m_specific_param.m_encoder.m_encoded_tile_size = 0;
return OPJ_TRUE;
}
| 0
|
444,521
|
TEST_P(Http2UpstreamIntegrationTest, RouterUpstreamResponseBeforeRequestComplete) {
testRouterUpstreamResponseBeforeRequestComplete();
}
| 0
|
40,435
|
bool audio_io_osx::Recording() const {
return is_recording_;
}
| 0
|
188,722
|
png_check_cHRM_fixed(png_structp png_ptr,
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y)
{
int ret = 1;
unsigned long xy_hi,xy_lo,yx_hi,yx_lo;
png_debug(1, "in function png_check_cHRM_fixed");
if (png_ptr == NULL)
return 0;
if (white_x < 0 || white_y <= 0 ||
red_x < 0 || red_y < 0 ||
green_x < 0 || green_y < 0 ||
blue_x < 0 || blue_y < 0)
{
png_warning(png_ptr,
"Ignoring attempt to set negative chromaticity value");
ret = 0;
}
if (white_x > (png_fixed_point) PNG_UINT_31_MAX ||
white_y > (png_fixed_point) PNG_UINT_31_MAX ||
red_x > (png_fixed_point) PNG_UINT_31_MAX ||
red_y > (png_fixed_point) PNG_UINT_31_MAX ||
green_x > (png_fixed_point) PNG_UINT_31_MAX ||
green_y > (png_fixed_point) PNG_UINT_31_MAX ||
blue_x > (png_fixed_point) PNG_UINT_31_MAX ||
blue_y > (png_fixed_point) PNG_UINT_31_MAX )
{
png_warning(png_ptr,
"Ignoring attempt to set chromaticity value exceeding 21474.83");
ret = 0;
}
if (white_x > 100000L - white_y)
{
png_warning(png_ptr, "Invalid cHRM white point");
ret = 0;
}
if (red_x > 100000L - red_y)
{
png_warning(png_ptr, "Invalid cHRM red point");
ret = 0;
}
if (green_x > 100000L - green_y)
{
png_warning(png_ptr, "Invalid cHRM green point");
ret = 0;
}
if (blue_x > 100000L - blue_y)
{
png_warning(png_ptr, "Invalid cHRM blue point");
ret = 0;
}
png_64bit_product(green_x - red_x, blue_y - red_y, &xy_hi, &xy_lo);
png_64bit_product(green_y - red_y, blue_x - red_x, &yx_hi, &yx_lo);
if (xy_hi == yx_hi && xy_lo == yx_lo)
{
png_warning(png_ptr,
"Ignoring attempt to set cHRM RGB triangle with zero area");
ret = 0;
}
return ret;
}
| 0
|
408,405
|
PyObject *PyString_AsEncodedString(PyObject *str,
const char *encoding,
const char *errors)
{
PyObject *v;
v = PyString_AsEncodedObject(str, encoding, errors);
if (v == NULL)
goto onError;
#ifdef Py_USING_UNICODE
/* Convert Unicode to a string using the default encoding */
if (PyUnicode_Check(v)) {
PyObject *temp = v;
v = PyUnicode_AsEncodedString(v, NULL, NULL);
Py_DECREF(temp);
if (v == NULL)
goto onError;
}
#endif
if (!PyString_Check(v)) {
PyErr_Format(PyExc_TypeError,
"encoder did not return a string object (type=%.400s)",
Py_TYPE(v)->tp_name);
Py_DECREF(v);
goto onError;
}
return v;
onError:
return NULL;
}
| 0
|
141,454
|
tv_get_string(typval_T *varp)
{
static char_u mybuf[NUMBUFLEN];
return tv_get_string_buf(varp, mybuf);
}
| 0
|
87,181
|
explicit ElementwiseOperationParser(OperationType operation_type)
: operation_type_(operation_type) {}
| 0
|
361,960
|
vte_sequence_handler_soft_reset (VteTerminal *terminal, GValueArray *params)
{
vte_terminal_reset(terminal, FALSE, FALSE);
}
| 0
|
335,582
|
static void jump_to_IPL_code(uint64_t address)
{
/* store the subsystem information _after_ the bootmap was loaded */
write_subsystem_identification();
/*
* The IPL PSW is at address 0. We also must not overwrite the
* content of non-BIOS memory after we loaded the guest, so we
* save the original content and restore it in jump_to_IPL_2.
*/
ResetInfo *current = 0;
save = *current;
current->ipl_addr = (uint32_t) (uint64_t) &jump_to_IPL_2;
current->ipl_continue = address & 0x7fffffff;
debug_print_int("set IPL addr to", current->ipl_continue);
/* Ensure the guest output starts fresh */
sclp_print("\n");
/*
* HACK ALERT.
* We use the load normal reset to keep r15 unchanged. jump_to_IPL_2
* can then use r15 as its stack pointer.
*/
asm volatile("lghi 1,1\n\t"
"diag 1,1,0x308\n\t"
: : : "1", "memory");
virtio_panic("\n! IPL returns !\n");
}
| 1
|
289,273
|
IN_PROC_BROWSER_TEST_F ( FramebustBlockBrowserTest , ModelAllowsRedirection ) {
const GURL blocked_urls [ ] = {
GURL ( chrome : : kChromeUIHistoryURL ) , GURL ( chrome : : kChromeUISettingsURL ) , GURL ( chrome : : kChromeUIVersionURL ) , }
;
auto * helper = GetFramebustTabHelper ( ) ;
for ( const GURL & url : blocked_urls ) {
helper -> AddBlockedUrl ( url , base : : BindOnce ( & FramebustBlockBrowserTest : : OnClick , base : : Unretained ( this ) ) ) ;
}
EXPECT_TRUE ( helper -> HasBlockedUrls ( ) ) ;
ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model ( browser ( ) -> content_setting_bubble_model_delegate ( ) , GetWebContents ( ) , browser ( ) -> profile ( ) ) ;
EXPECT_FALSE ( clicked_index_ . has_value ( ) ) ;
EXPECT_FALSE ( clicked_url_ . has_value ( ) ) ;
content : : TestNavigationObserver observer ( GetWebContents ( ) ) ;
framebust_block_bubble_model . OnListItemClicked ( 1 , ui : : EF_LEFT_MOUSE_BUTTON ) ;
observer . Wait ( ) ;
EXPECT_TRUE ( clicked_index_ . has_value ( ) ) ;
EXPECT_TRUE ( clicked_url_ . has_value ( ) ) ;
EXPECT_EQ ( 1u , clicked_index_ . value ( ) ) ;
EXPECT_EQ ( GURL ( chrome : : kChromeUISettingsURL ) , clicked_url_ . value ( ) ) ;
EXPECT_FALSE ( helper -> HasBlockedUrls ( ) ) ;
EXPECT_EQ ( blocked_urls [ 1 ] , GetWebContents ( ) -> GetLastCommittedURL ( ) ) ;
}
| 0
|
378,348
|
int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev)
{
#if defined(HAVE_MKNOD)
return mknod(path, mode, dev);
#else
/* No mknod system call. */
errno = ENOSYS;
return -1;
#endif
}
| 0
|
24,548
|
bool not_clause ( Node * clause ) {
return ( clause != NULL && IsA ( clause , BoolExpr ) && ( ( BoolExpr * ) clause ) -> boolop == NOT_EXPR ) ;
}
| 0
|
71,541
|
struct net_bridge_mdb_entry *br_multicast_new_group(struct net_bridge *br,
struct net_bridge_port *port, struct br_ip *group)
{
struct net_bridge_mdb_htable *mdb;
struct net_bridge_mdb_entry *mp;
int hash;
int err;
mdb = rcu_dereference_protected(br->mdb, 1);
if (!mdb) {
err = br_mdb_rehash(&br->mdb, BR_HASH_SIZE, 0);
if (err)
return ERR_PTR(err);
goto rehash;
}
hash = br_ip_hash(mdb, group);
mp = br_multicast_get_group(br, port, group, hash);
switch (PTR_ERR(mp)) {
case 0:
break;
case -EAGAIN:
rehash:
mdb = rcu_dereference_protected(br->mdb, 1);
hash = br_ip_hash(mdb, group);
break;
default:
goto out;
}
mp = kzalloc(sizeof(*mp), GFP_ATOMIC);
if (unlikely(!mp))
return ERR_PTR(-ENOMEM);
mp->br = br;
mp->addr = *group;
hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]);
mdb->size++;
out:
return mp;
}
| 0
|
5,927
|
int rose_parse_facilities(unsigned char *p,
struct rose_facilities_struct *facilities)
{
int facilities_len, len;
facilities_len = *p++;
if (facilities_len == 0)
return 0;
while (facilities_len > 0) {
if (*p == 0x00) {
facilities_len--;
p++;
switch (*p) {
case FAC_NATIONAL: /* National */
len = rose_parse_national(p + 1, facilities, facilities_len - 1);
if (len < 0)
return 0;
facilities_len -= len + 1;
p += len + 1;
break;
case FAC_CCITT: /* CCITT */
len = rose_parse_ccitt(p + 1, facilities, facilities_len - 1);
if (len < 0)
return 0;
facilities_len -= len + 1;
p += len + 1;
break;
default:
printk(KERN_DEBUG "ROSE: rose_parse_facilities - unknown facilities family %02X\n", *p);
facilities_len--;
p++;
break;
}
} else
break; /* Error in facilities format */
}
return 1;
}
| 1
|
198,980
|
void TabClosedNotificationObserver::set_for_browser_command(
bool for_browser_command) {
for_browser_command_ = for_browser_command;
}
| 0
|
166,961
|
bool ExtensionPrefs::ReadIntegerFromPref(
const DictionaryValue* ext, const std::string& pref_key, int* out_value) {
if (!ext->GetInteger(pref_key, out_value))
return false;
return out_value != NULL;
}
| 0
|
233,706
|
static void CL_SetServerInfo(serverInfo_t *server, const char *info, int ping) {
if (server) {
if (info) {
server->clients = atoi(Info_ValueForKey(info, "clients"));
Q_strncpyz(server->hostName,Info_ValueForKey(info, "hostname"), MAX_NAME_LENGTH);
Q_strncpyz(server->mapName, Info_ValueForKey(info, "mapname"), MAX_NAME_LENGTH);
server->maxClients = atoi(Info_ValueForKey(info, "sv_maxclients"));
Q_strncpyz(server->game,Info_ValueForKey(info, "game"), MAX_NAME_LENGTH);
server->gameType = atoi(Info_ValueForKey(info, "gametype"));
server->netType = atoi(Info_ValueForKey(info, "nettype"));
server->minPing = atoi(Info_ValueForKey(info, "minping"));
server->maxPing = atoi(Info_ValueForKey(info, "maxping"));
server->punkbuster = atoi(Info_ValueForKey(info, "punkbuster"));
server->g_humanplayers = atoi(Info_ValueForKey(info, "g_humanplayers"));
server->g_needpass = atoi(Info_ValueForKey(info, "g_needpass"));
}
server->ping = ping;
}
}
| 0
|
449,430
|
static int ttm_tt_set_page_caching(struct page *p,
enum ttm_caching_state c_old,
enum ttm_caching_state c_new)
{
int ret = 0;
if (PageHighMem(p))
return 0;
if (c_old != tt_cached) {
/* p isn't in the default caching state, set it to
* writeback first to free its current memtype. */
ret = ttm_set_pages_wb(p, 1);
if (ret)
return ret;
}
if (c_new == tt_wc)
ret = ttm_set_pages_wc(p, 1);
else if (c_new == tt_uncached)
ret = ttm_set_pages_uc(p, 1);
return ret;
}
| 0
|
155,918
|
acpi_status acpi_os_wait_command_ready(void)
{
int ret;
ret = acpi_debugger_wait_command_ready();
if (ret < 0)
return AE_ERROR;
return AE_OK;
}
| 0
|
252,005
|
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionImmutablePointFunction(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
return throwVMTypeError(exec);
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<FloatPoint>::create(impl->immutablePointFunction())));
return JSValue::encode(result);
}
| 0
|
23,475
|
static int replace_user_table ( THD * thd , TABLE * table , const LEX_USER & combo , ulong rights , bool revoke_grant , bool can_create_user , bool no_auto_create ) {
int error = - 1 ;
bool old_row_exists = 0 ;
const char * password = "" ;
uint password_len = 0 ;
char what = ( revoke_grant ) ? 'N' : 'Y' ;
uchar user_key [ MAX_KEY_LENGTH ] ;
LEX * lex = thd -> lex ;
DBUG_ENTER ( "replace_user_table" ) ;
safe_mutex_assert_owner ( & acl_cache -> lock ) ;
if ( combo . password . str && combo . password . str [ 0 ] ) {
if ( combo . password . length != SCRAMBLED_PASSWORD_CHAR_LENGTH && combo . password . length != SCRAMBLED_PASSWORD_CHAR_LENGTH_323 ) {
my_error ( ER_PASSWD_LENGTH , MYF ( 0 ) , SCRAMBLED_PASSWORD_CHAR_LENGTH ) ;
DBUG_RETURN ( - 1 ) ;
}
password_len = combo . password . length ;
password = combo . password . str ;
}
table -> use_all_columns ( ) ;
table -> field [ 0 ] -> store ( combo . host . str , combo . host . length , system_charset_info ) ;
table -> field [ 1 ] -> store ( combo . user . str , combo . user . length , system_charset_info ) ;
key_copy ( user_key , table -> record [ 0 ] , table -> key_info , table -> key_info -> key_length ) ;
if ( table -> file -> index_read_idx_map ( table -> record [ 0 ] , 0 , user_key , HA_WHOLE_KEY , HA_READ_KEY_EXACT ) ) {
if ( what == 'N' ) {
my_error ( ER_NONEXISTING_GRANT , MYF ( 0 ) , combo . user . str , combo . host . str ) ;
goto end ;
}
else if ( ! password_len && no_auto_create ) {
my_error ( ER_PASSWORD_NO_MATCH , MYF ( 0 ) ) ;
goto end ;
}
else if ( ! can_create_user ) {
my_error ( ER_CANT_CREATE_USER_WITH_GRANT , MYF ( 0 ) ) ;
goto end ;
}
old_row_exists = 0 ;
restore_record ( table , s -> default_values ) ;
table -> field [ 0 ] -> store ( combo . host . str , combo . host . length , system_charset_info ) ;
table -> field [ 1 ] -> store ( combo . user . str , combo . user . length , system_charset_info ) ;
table -> field [ 2 ] -> store ( password , password_len , system_charset_info ) ;
}
else {
old_row_exists = 1 ;
store_record ( table , record [ 1 ] ) ;
if ( combo . password . str ) table -> field [ 2 ] -> store ( password , password_len , system_charset_info ) ;
else if ( ! rights && ! revoke_grant && lex -> ssl_type == SSL_TYPE_NOT_SPECIFIED && ! lex -> mqh . specified_limits ) {
DBUG_RETURN ( 0 ) ;
}
}
Field * * tmp_field ;
ulong priv ;
uint next_field ;
for ( tmp_field = table -> field + 3 , priv = SELECT_ACL ;
* tmp_field && ( * tmp_field ) -> real_type ( ) == MYSQL_TYPE_ENUM && ( ( Field_enum * ) ( * tmp_field ) ) -> typelib -> count == 2 ;
tmp_field ++ , priv <<= 1 ) {
if ( priv & rights ) ( * tmp_field ) -> store ( & what , 1 , & my_charset_latin1 ) ;
}
rights = get_access ( table , 3 , & next_field ) ;
DBUG_PRINT ( "info" , ( "table fields: %d" , table -> s -> fields ) ) ;
if ( table -> s -> fields >= 31 ) {
switch ( lex -> ssl_type ) {
case SSL_TYPE_ANY : table -> field [ next_field ] -> store ( STRING_WITH_LEN ( "ANY" ) , & my_charset_latin1 ) ;
table -> field [ next_field + 1 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 2 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 3 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
break ;
case SSL_TYPE_X509 : table -> field [ next_field ] -> store ( STRING_WITH_LEN ( "X509" ) , & my_charset_latin1 ) ;
table -> field [ next_field + 1 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 2 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 3 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
break ;
case SSL_TYPE_SPECIFIED : table -> field [ next_field ] -> store ( STRING_WITH_LEN ( "SPECIFIED" ) , & my_charset_latin1 ) ;
table -> field [ next_field + 1 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 2 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 3 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
if ( lex -> ssl_cipher ) table -> field [ next_field + 1 ] -> store ( lex -> ssl_cipher , strlen ( lex -> ssl_cipher ) , system_charset_info ) ;
if ( lex -> x509_issuer ) table -> field [ next_field + 2 ] -> store ( lex -> x509_issuer , strlen ( lex -> x509_issuer ) , system_charset_info ) ;
if ( lex -> x509_subject ) table -> field [ next_field + 3 ] -> store ( lex -> x509_subject , strlen ( lex -> x509_subject ) , system_charset_info ) ;
break ;
case SSL_TYPE_NOT_SPECIFIED : break ;
case SSL_TYPE_NONE : table -> field [ next_field ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 1 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 2 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
table -> field [ next_field + 3 ] -> store ( "" , 0 , & my_charset_latin1 ) ;
break ;
}
next_field += 4 ;
USER_RESOURCES mqh = lex -> mqh ;
if ( mqh . specified_limits & USER_RESOURCES : : QUERIES_PER_HOUR ) table -> field [ next_field ] -> store ( ( longlong ) mqh . questions , TRUE ) ;
if ( mqh . specified_limits & USER_RESOURCES : : UPDATES_PER_HOUR ) table -> field [ next_field + 1 ] -> store ( ( longlong ) mqh . updates , TRUE ) ;
if ( mqh . specified_limits & USER_RESOURCES : : CONNECTIONS_PER_HOUR ) table -> field [ next_field + 2 ] -> store ( ( longlong ) mqh . conn_per_hour , TRUE ) ;
if ( table -> s -> fields >= 36 && ( mqh . specified_limits & USER_RESOURCES : : USER_CONNECTIONS ) ) table -> field [ next_field + 3 ] -> store ( ( longlong ) mqh . user_conn , TRUE ) ;
mqh_used = mqh_used || mqh . questions || mqh . updates || mqh . conn_per_hour ;
}
if ( old_row_exists ) {
if ( cmp_record ( table , record [ 1 ] ) ) {
if ( ( error = table -> file -> ha_update_row ( table -> record [ 1 ] , table -> record [ 0 ] ) ) && error != HA_ERR_RECORD_IS_THE_SAME ) {
table -> file -> print_error ( error , MYF ( 0 ) ) ;
error = - 1 ;
goto end ;
}
else error = 0 ;
}
}
else if ( ( error = table -> file -> ha_write_row ( table -> record [ 0 ] ) ) ) {
if ( table -> file -> is_fatal_error ( error , HA_CHECK_DUP ) ) {
table -> file -> print_error ( error , MYF ( 0 ) ) ;
error = - 1 ;
goto end ;
}
}
error = 0 ;
end : if ( ! error ) {
acl_cache -> clear ( 1 ) ;
if ( old_row_exists ) acl_update_user ( combo . user . str , combo . host . str , combo . password . str , password_len , lex -> ssl_type , lex -> ssl_cipher , lex -> x509_issuer , lex -> x509_subject , & lex -> mqh , rights ) ;
else acl_insert_user ( combo . user . str , combo . host . str , password , password_len , lex -> ssl_type , lex -> ssl_cipher , lex -> x509_issuer , lex -> x509_subject , & lex -> mqh , rights ) ;
}
DBUG_RETURN ( error ) ;
}
| 0
|
76,878
|
static void cdc_ncm_fix_modulus(struct usbnet *dev)
{
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
u32 val;
/*
* verify that the structure alignment is:
* - power of two
* - not greater than the maximum transmit length
* - not less than four bytes
*/
val = ctx->tx_ndp_modulus;
if ((val < USB_CDC_NCM_NDP_ALIGN_MIN_SIZE) ||
(val != ((-val) & val)) || (val >= ctx->tx_max)) {
dev_dbg(&dev->intf->dev, "Using default alignment: 4 bytes\n");
ctx->tx_ndp_modulus = USB_CDC_NCM_NDP_ALIGN_MIN_SIZE;
}
/*
* verify that the payload alignment is:
* - power of two
* - not greater than the maximum transmit length
* - not less than four bytes
*/
val = ctx->tx_modulus;
if ((val < USB_CDC_NCM_NDP_ALIGN_MIN_SIZE) ||
(val != ((-val) & val)) || (val >= ctx->tx_max)) {
dev_dbg(&dev->intf->dev, "Using default transmit modulus: 4 bytes\n");
ctx->tx_modulus = USB_CDC_NCM_NDP_ALIGN_MIN_SIZE;
}
/* verify the payload remainder */
if (ctx->tx_remainder >= ctx->tx_modulus) {
dev_dbg(&dev->intf->dev, "Using default transmit remainder: 0 bytes\n");
ctx->tx_remainder = 0;
}
/* adjust TX-remainder according to NCM specification. */
ctx->tx_remainder = ((ctx->tx_remainder - cdc_ncm_eth_hlen(dev)) &
(ctx->tx_modulus - 1));
}
| 0
|
304,560
|
PackLinuxElf64ppcle::getFilters() const
{
static const int filters[] = {
0xd0,
FT_END };
return filters;
}
| 0
|
369,882
|
void ssl_set_ciphersuites( ssl_context *ssl, const int *ciphersuites )
{
ssl->ciphersuites = ciphersuites;
}
| 0
|
293,120
|
gr_face* gr_make_face(const void* appFaceHandle/*non-NULL*/, gr_get_table_fn tablefn, unsigned int faceOptions)
{
const gr_face_ops ops = {sizeof(gr_face_ops), tablefn, NULL};
return gr_make_face_with_ops(appFaceHandle, &ops, faceOptions);
}
| 0
|
8,963
|
lyd_new_leaf(struct lyd_node *parent, const struct lys_module *module, const char *name, const char *val_str)
{
const struct lys_node *snode = NULL, *siblings;
if ((!parent && !module) || !name) {
LOGARG;
return NULL;
}
siblings = lyd_new_find_schema(parent, module, 0);
if (!siblings) {
LOGARG;
return NULL;
}
if (lys_getnext_data(module, lys_parent(siblings), name, strlen(name), LYS_LEAFLIST | LYS_LEAF, &snode) || !snode) {
LOGERR(siblings->module->ctx, LY_EINVAL, "Failed to find \"%s\" as a sibling to \"%s:%s\".",
name, lys_node_module(siblings)->name, siblings->name);
return NULL;
}
return _lyd_new_leaf(parent, snode, val_str, 0, 0);
}
| 1
|
198,437
|
void S_AL_SrcShutdown( void )
{
int i;
src_t *curSource;
if(!alSourcesInitialised)
return;
for(i = 0; i < srcCount; i++)
{
curSource = &srcList[i];
if(curSource->isLocked)
Com_DPrintf( S_COLOR_YELLOW "WARNING: Source %d is locked\n", i);
if(curSource->entity > 0)
entityList[curSource->entity].srcAllocated = qfalse;
qalSourceStop(srcList[i].alSource);
qalDeleteSources(1, &srcList[i].alSource);
}
memset(srcList, 0, sizeof(srcList));
alSourcesInitialised = qfalse;
}
| 0
|
458,460
|
dp_packet_l3_size(const struct dp_packet *b)
{
return OVS_LIKELY(b->l3_ofs != UINT16_MAX)
? (const char *)dp_packet_tail(b) - (const char *)dp_packet_l3(b)
- dp_packet_l2_pad_size(b)
: 0;
}
| 0
|
134,392
|
bool DefaultEnv::SetLogFile( const std::string &filepath )
{
Log *log = GetLog();
LogOutFile *out = new LogOutFile();
if( out->Open( filepath ) )
{
log->SetOutput( out );
return true;
}
delete out;
return false;
}
| 0
|
410,257
|
int dataSize() const
{
assert(isValid());
return data_size_;
}
| 0
|
136,482
|
dissect_usch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset, struct fp_info *p_fp_info)
{
gboolean is_control_frame;
/* Header CRC */
proto_tree_add_item(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN);
/* Frame Type */
is_control_frame = tvb_get_guint8(tvb, offset) & 0x01;
proto_tree_add_item(tree, hf_fp_ft, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
col_append_str(pinfo->cinfo, COL_INFO, is_control_frame ? " [Control] " : " [Data] ");
if (is_control_frame) {
dissect_common_control(tvb, pinfo, tree, offset, p_fp_info);
}
else {
guint cfn;
guint16 rx_timing_deviation;
proto_item *rx_timing_deviation_ti;
guint header_length = 0;
/* DATA */
/* CFN */
cfn = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_fp_cfn, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
col_append_fstr(pinfo->cinfo, COL_INFO, "CFN=%03u ", cfn);
/* TFI */
proto_tree_add_item(tree, hf_fp_usch_tfi, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* Rx Timing Deviation */
rx_timing_deviation = tvb_get_guint8(tvb, offset);
rx_timing_deviation_ti = proto_tree_add_item(tree, hf_fp_rx_timing_deviation,
tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
header_length = offset;
/* TB data */
offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, NULL, NULL);
/* QE */
proto_tree_add_item(tree, hf_fp_quality_estimate, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
/* CRCIs */
offset = dissect_crci_bits(tvb, pinfo, tree, p_fp_info, offset);
/* New IEs */
if ((p_fp_info->release == 7) &&
(tvb_reported_length_remaining(tvb, offset) > 2)) {
guint8 flags = tvb_get_guint8(tvb, offset);
guint8 bits_extended = flags & 0x01;
offset++;
if (bits_extended) {
guint8 extra_bits = tvb_get_guint8(tvb, offset) & 0x03;
proto_item_append_text(rx_timing_deviation_ti,
" (extended to %u)",
(rx_timing_deviation << 2) | extra_bits);
}
offset++;
}
/* Spare Extension and Payload CRC */
dissect_spare_extension_and_crc(tvb, pinfo, tree, 1, offset, header_length);
}
}
| 0
|
144,389
|
getftypest(stat_T *st)
{
char *t;
if (S_ISREG(st->st_mode))
t = "file";
else if (S_ISDIR(st->st_mode))
t = "dir";
else if (S_ISLNK(st->st_mode))
t = "link";
else if (S_ISBLK(st->st_mode))
t = "bdev";
else if (S_ISCHR(st->st_mode))
t = "cdev";
else if (S_ISFIFO(st->st_mode))
t = "fifo";
else if (S_ISSOCK(st->st_mode))
t = "socket";
else
t = "other";
return (char_u*)t;
}
| 0
|
291,825
|
static int __commit_inmem_pages(struct inode *inode,
struct list_head *revoke_list)
{
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
struct f2fs_inode_info *fi = F2FS_I(inode);
struct inmem_pages *cur, *tmp;
struct f2fs_io_info fio = {
.sbi = sbi,
.type = DATA,
.op = REQ_OP_WRITE,
.op_flags = REQ_SYNC | REQ_PRIO,
.io_type = FS_DATA_IO,
};
pgoff_t last_idx = ULONG_MAX;
int err = 0;
list_for_each_entry_safe(cur, tmp, &fi->inmem_pages, list) {
struct page *page = cur->page;
lock_page(page);
if (page->mapping == inode->i_mapping) {
trace_f2fs_commit_inmem_page(page, INMEM);
set_page_dirty(page);
f2fs_wait_on_page_writeback(page, DATA, true);
if (clear_page_dirty_for_io(page)) {
inode_dec_dirty_pages(inode);
remove_dirty_inode(inode);
}
retry:
fio.page = page;
fio.old_blkaddr = NULL_ADDR;
fio.encrypted_page = NULL;
fio.need_lock = LOCK_DONE;
err = do_write_data_page(&fio);
if (err) {
if (err == -ENOMEM) {
congestion_wait(BLK_RW_ASYNC, HZ/50);
cond_resched();
goto retry;
}
unlock_page(page);
break;
}
/* record old blkaddr for revoking */
cur->old_addr = fio.old_blkaddr;
last_idx = page->index;
}
unlock_page(page);
list_move_tail(&cur->list, revoke_list);
}
if (last_idx != ULONG_MAX)
f2fs_submit_merged_write_cond(sbi, inode, 0, last_idx, DATA);
if (!err)
__revoke_inmem_pages(inode, revoke_list, false, false);
return err;
}
| 0
|
476,841
|
void nft_flow_rule_destroy(struct nft_flow_rule *flow)
{
struct flow_action_entry *entry;
int i;
flow_action_for_each(i, entry, &flow->rule->action) {
switch (entry->id) {
case FLOW_ACTION_REDIRECT:
case FLOW_ACTION_MIRRED:
dev_put(entry->dev);
break;
default:
break;
}
}
kfree(flow->rule);
kfree(flow);
}
| 0
|
487,463
|
void ElectronBrowserClient::RegisterBrowserInterfaceBindersForServiceWorker(
mojo::BinderMapWithContext<const content::ServiceWorkerVersionBaseInfo&>*
map) {
map->Add<blink::mojom::BadgeService>(
base::BindRepeating(&BindBadgeServiceForServiceWorker));
}
| 0
|
413,610
|
_send_slurmstepd_init(int fd, int type, void *req,
slurm_addr_t *cli, slurm_addr_t *self,
hostset_t step_hset, uint16_t protocol_version)
{
int len = 0;
Buf buffer = NULL;
slurm_msg_t msg;
gid_t gid = (uid_t)-1;
gids_t *gids = NULL;
int rank, proto;
int parent_rank, children, depth, max_depth;
char *parent_alias = NULL;
char *user_name = NULL;
slurm_addr_t parent_addr = {0};
slurm_msg_t_init(&msg);
/* send type over to slurmstepd */
safe_write(fd, &type, sizeof(int));
/* step_hset can be NULL for batch scripts OR if the job was submitted
* by SlurmUser or root using the --no-allocate/-Z option and the job
* job credential validation by _check_job_credential() failed. If the
* job credential did not validate, then it did not come from slurmctld
* and there is no reason to send step completion messages to slurmctld.
*/
if (step_hset == NULL) {
bool send_error = false;
if (type == LAUNCH_TASKS) {
launch_tasks_request_msg_t *launch_req;
launch_req = (launch_tasks_request_msg_t *) req;
if (launch_req->job_step_id != SLURM_EXTERN_CONT)
send_error = true;
}
if (send_error) {
info("task rank unavailable due to invalid job "
"credential, step completion RPC impossible");
}
rank = -1;
parent_rank = -1;
children = 0;
depth = 0;
max_depth = 0;
} else if ((type == LAUNCH_TASKS) &&
(((launch_tasks_request_msg_t *)req)->alias_list)) {
/* In the cloud, each task talks directly to the slurmctld
* since node addressing is abnormal */
rank = 0;
parent_rank = -1;
children = 0;
depth = 0;
max_depth = 0;
} else {
#ifndef HAVE_FRONT_END
int count;
count = hostset_count(step_hset);
rank = hostset_find(step_hset, conf->node_name);
reverse_tree_info(rank, count, REVERSE_TREE_WIDTH,
&parent_rank, &children,
&depth, &max_depth);
if (rank > 0) { /* rank 0 talks directly to the slurmctld */
int rc;
/* Find the slurm_addr_t of this node's parent slurmd
* in the step host list */
parent_alias = hostset_nth(step_hset, parent_rank);
rc = slurm_conf_get_addr(parent_alias, &parent_addr);
if (rc != SLURM_SUCCESS) {
error("Failed looking up address for "
"NodeName %s", parent_alias);
/* parent_rank = -1; */
}
}
#else
/* In FRONT_END mode, one slurmd pretends to be all
* NodeNames, so we can't compare conf->node_name
* to the NodeNames in step_hset. Just send step complete
* RPC directly to the controller.
*/
rank = 0;
parent_rank = -1;
children = 0;
depth = 0;
max_depth = 0;
#endif
}
debug3("slurmstepd rank %d (%s), parent rank %d (%s), "
"children %d, depth %d, max_depth %d",
rank, conf->node_name,
parent_rank, parent_alias ? parent_alias : "NONE",
children, depth, max_depth);
if (parent_alias)
free(parent_alias);
/* send reverse-tree info to the slurmstepd */
safe_write(fd, &rank, sizeof(int));
safe_write(fd, &parent_rank, sizeof(int));
safe_write(fd, &children, sizeof(int));
safe_write(fd, &depth, sizeof(int));
safe_write(fd, &max_depth, sizeof(int));
safe_write(fd, &parent_addr, sizeof(slurm_addr_t));
/* send conf over to slurmstepd */
if (_send_slurmd_conf_lite(fd, conf) < 0)
goto rwfail;
/* send cli address over to slurmstepd */
buffer = init_buf(0);
slurm_pack_slurm_addr(cli, buffer);
len = get_buf_offset(buffer);
safe_write(fd, &len, sizeof(int));
safe_write(fd, get_buf_data(buffer), len);
free_buf(buffer);
buffer = NULL;
/* send self address over to slurmstepd */
if (self) {
buffer = init_buf(0);
slurm_pack_slurm_addr(self, buffer);
len = get_buf_offset(buffer);
safe_write(fd, &len, sizeof(int));
safe_write(fd, get_buf_data(buffer), len);
free_buf(buffer);
buffer = NULL;
} else {
len = 0;
safe_write(fd, &len, sizeof(int));
}
/* Send GRES information to slurmstepd */
gres_plugin_send_stepd(fd);
/* send cpu_frequency info to slurmstepd */
cpu_freq_send_info(fd);
/* send req over to slurmstepd */
switch(type) {
case LAUNCH_BATCH_JOB:
gid = (uid_t)((batch_job_launch_msg_t *)req)->gid;
user_name = ((batch_job_launch_msg_t *)req)->user_name;
msg.msg_type = REQUEST_BATCH_JOB_LAUNCH;
break;
case LAUNCH_TASKS:
gid = (uid_t)((launch_tasks_request_msg_t *)req)->gid;
user_name = ((launch_tasks_request_msg_t *)req)->user_name;
msg.msg_type = REQUEST_LAUNCH_TASKS;
break;
default:
error("Was sent a task I didn't understand");
break;
}
buffer = init_buf(0);
msg.data = req;
if (protocol_version == (uint16_t)NO_VAL)
proto = SLURM_PROTOCOL_VERSION;
else
proto = protocol_version;
msg.protocol_version = (uint16_t)proto;
pack_msg(&msg, buffer);
len = get_buf_offset(buffer);
safe_write(fd, &proto, sizeof(int));
safe_write(fd, &len, sizeof(int));
safe_write(fd, get_buf_data(buffer), len);
free_buf(buffer);
buffer = NULL;
if ((gids = _gids_cache_lookup(user_name, gid))) {
int i;
uint32_t tmp32;
safe_write(fd, &gids->ngids, sizeof(int));
for (i = 0; i < gids->ngids; i++) {
tmp32 = (uint32_t)gids->gids[i];
safe_write(fd, &tmp32, sizeof(uint32_t));
}
_dealloc_gids(gids);
} else {
len = 0;
safe_write(fd, &len, sizeof(int));
}
return 0;
rwfail:
if (buffer)
free_buf(buffer);
error("_send_slurmstepd_init failed");
return errno;
}
| 0
|
288,193
|
void CrosLibrary::TestApi::SetBrightnessLibrary(
BrightnessLibrary* library, bool own) {
library_->brightness_lib_.SetImpl(library, own);
}
| 1
|
243,084
|
void ExtensionInstallPrompt::ConfirmPermissionsForDelegatedInstall(
Delegate* delegate,
const Extension* extension,
const std::string& delegated_username,
const SkBitmap* icon) {
DCHECK(ui_loop_ == base::MessageLoop::current());
delegate_ = delegate;
extension_ = extension;
delegated_username_ = delegated_username;
SetIcon(icon);
prompt_ = new Prompt(DELEGATED_PERMISSIONS_PROMPT);
ShowConfirmation();
}
| 0
|
168,536
|
bool AXTableCell::computeAccessibilityIsIgnored(
IgnoredReasons* ignoredReasons) const {
AXObjectInclusion decision = defaultObjectInclusion(ignoredReasons);
if (decision == IncludeObject)
return false;
if (decision == IgnoreObject)
return true;
if (!isTableCell())
return AXLayoutObject::computeAccessibilityIsIgnored(ignoredReasons);
return false;
}
| 0
|
23,510
|
int vp9_full_pixel_diamond ( const VP9_COMP * cpi , MACROBLOCK * x , MV * mvp_full , int step_param , int sadpb , int further_steps , int do_refine , const vp9_variance_fn_ptr_t * fn_ptr , const MV * ref_mv , MV * dst_mv ) {
MV temp_mv ;
int thissme , n , num00 = 0 ;
int bestsme = cpi -> diamond_search_sad ( x , & cpi -> ss_cfg , mvp_full , & temp_mv , step_param , sadpb , & n , fn_ptr , ref_mv ) ;
if ( bestsme < INT_MAX ) bestsme = vp9_get_mvpred_var ( x , & temp_mv , ref_mv , fn_ptr , 1 ) ;
* dst_mv = temp_mv ;
if ( n > further_steps ) do_refine = 0 ;
while ( n < further_steps ) {
++ n ;
if ( num00 ) {
num00 -- ;
}
else {
thissme = cpi -> diamond_search_sad ( x , & cpi -> ss_cfg , mvp_full , & temp_mv , step_param + n , sadpb , & num00 , fn_ptr , ref_mv ) ;
if ( thissme < INT_MAX ) thissme = vp9_get_mvpred_var ( x , & temp_mv , ref_mv , fn_ptr , 1 ) ;
if ( num00 > further_steps - n ) do_refine = 0 ;
if ( thissme < bestsme ) {
bestsme = thissme ;
* dst_mv = temp_mv ;
}
}
}
if ( do_refine ) {
const int search_range = 8 ;
MV best_mv = * dst_mv ;
thissme = cpi -> refining_search_sad ( x , & best_mv , sadpb , search_range , fn_ptr , ref_mv ) ;
if ( thissme < INT_MAX ) thissme = vp9_get_mvpred_var ( x , & best_mv , ref_mv , fn_ptr , 1 ) ;
if ( thissme < bestsme ) {
bestsme = thissme ;
* dst_mv = best_mv ;
}
}
return bestsme ;
}
| 0
|
149,685
|
static int bin_mem(RCore *r, int mode) {
RList *mem = NULL;
if (!r) return false;
if (!IS_MODE_JSON(mode)) {
if (!(IS_MODE_RAD (mode) || IS_MODE_SET (mode))) {
r_cons_println ("[Memory]\n");
}
}
if (!(mem = r_bin_get_mem (r->bin))) {
if (IS_MODE_JSON (mode)) {
r_cons_print("[]");
}
return false;
}
if (IS_MODE_JSON (mode)) {
r_cons_print ("[");
bin_mem_print (mem, 7, 0, R_CORE_BIN_JSON);
r_cons_println ("]");
return true;
} else if (!(IS_MODE_RAD (mode) || IS_MODE_SET (mode))) {
bin_mem_print (mem, 7, 0, mode);
}
return true;
}
| 0
|
244,799
|
static int find_interface() {
fd_set read_fds;
struct mt_packet data;
struct sockaddr_in myip;
unsigned char emptymac[ETH_ALEN];
int testsocket;
struct timeval timeout;
int optval = 1;
struct net_interface *interface;
/* TODO: reread interfaces on HUP */
bzero(emptymac, ETH_ALEN);
if (net_get_interfaces(&interfaces) <= 0) {
fprintf(stderr, _("Error: No suitable devices found\n"));
exit(1);
}
DL_FOREACH(interfaces, interface) {
/* Skip loopback interfaces */
if (memcmp("lo", interface->name, 2) == 0) {
continue;
}
/* Initialize receiving socket on the device chosen */
myip.sin_family = AF_INET;
memcpy((void *)&myip.sin_addr, interface->ipv4_addr, IPV4_ALEN);
myip.sin_port = htons(sourceport);
/* Initialize socket and bind to udp port */
if ((testsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
continue;
}
setsockopt(testsocket, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval));
setsockopt(testsocket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));
if (bind(testsocket, (struct sockaddr *)&myip, sizeof(struct sockaddr_in)) == -1) {
close(testsocket);
continue;
}
/* Ensure that we have mac-address for this interface */
if (!interface->has_mac) {
close(testsocket);
continue;
}
/* Set the global socket handle and source mac address for send_udp() */
send_socket = testsocket;
memcpy(srcmac, interface->mac_addr, ETH_ALEN);
active_interface = interface;
/* Send a SESSIONSTART message with the current device */
init_packet(&data, MT_PTYPE_SESSIONSTART, srcmac, dstmac, sessionkey, 0);
send_udp(&data, 0);
timeout.tv_sec = connect_timeout;
timeout.tv_usec = 0;
FD_ZERO(&read_fds);
FD_SET(insockfd, &read_fds);
select(insockfd + 1, &read_fds, NULL, NULL, &timeout);
if (FD_ISSET(insockfd, &read_fds)) {
/* We got a response, this is the correct device to use */
return 1;
}
close(testsocket);
}
return 0;
}
| 0
|
439,413
|
int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
struct drm_file *file)
{
struct drm_i915_gem_context_destroy *args = data;
struct drm_i915_file_private *file_priv = file->driver_priv;
struct i915_gem_context *ctx;
if (args->pad != 0)
return -EINVAL;
if (args->ctx_id == DEFAULT_CONTEXT_HANDLE)
return -ENOENT;
if (mutex_lock_interruptible(&file_priv->context_idr_lock))
return -EINTR;
ctx = idr_remove(&file_priv->context_idr, args->ctx_id);
mutex_unlock(&file_priv->context_idr_lock);
if (!ctx)
return -ENOENT;
mutex_lock(&dev->struct_mutex);
context_close(ctx);
mutex_unlock(&dev->struct_mutex);
return 0;
}
| 0
|
396,222
|
ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate) /* {{{ */
{
zval *tmp;
if (UNEXPECTED(length > INT_MAX)) {
zend_error_noreturn(E_ERROR, "String overflow, max size is %d", INT_MAX);
}
MAKE_STD_ZVAL(tmp);
ZVAL_STRINGL(tmp, str, length, duplicate);
return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), dest);
}
| 0
|
262,986
|
static int is_neg_adv_abort(unsigned int status)
{
return status == CPL_ERR_RTX_NEG_ADVICE ||
status == CPL_ERR_PERSIST_NEG_ADVICE;
}
| 0
|
321,764
|
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)
{
GetBitContext gb;
int i;
init_get_bits(&gb, src, length * 8);
for (i = 0; i < 3; i++) {
if (read_len_table(s->len[i], &gb) < 0)
return -1;
if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0) {
return -1;
}
ff_free_vlc(&s->vlc[i]);
init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
s->bits[i], 4, 4, 0);
}
generate_joint_tables(s);
return (get_bits_count(&gb) + 7) / 8;
}
| 0
|
236,009
|
int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num)
{
BIGNUM *num_bn;
int result = 0;
char *hex;
num_bn = BN_new();
if (num_bn == NULL)
return -1;
ASN1_INTEGER_to_BN(num, num_bn);
if ((hex = BN_bn2hex(num_bn))) {
result = BIO_write(bio, "0x", 2) > 0;
result = result && BIO_write(bio, hex, strlen(hex)) > 0;
OPENSSL_free(hex);
}
BN_free(num_bn);
return result;
}
| 0
|
15,830
|
void rtadv_init ( struct zebra_vrf * zvrf ) {
;
}
| 0
|
383,854
|
PHP_METHOD(Phar, delete)
{
char *fname;
int fname_len;
char *error;
phar_entry_info *entry;
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->arc.archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
"Cannot write out phar archive, phar is read-only");
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
RETURN_FALSE;
}
if (phar_obj->arc.archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->arc.archive) TSRMLS_CC)) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "phar \"%s\" is persistent, unable to copy on write", phar_obj->arc.archive->fname);
return;
}
if (zend_hash_exists(&phar_obj->arc.archive->manifest, fname, (uint) fname_len)) {
if (SUCCESS == zend_hash_find(&phar_obj->arc.archive->manifest, fname, (uint) fname_len, (void**)&entry)) {
if (entry->is_deleted) {
/* entry is deleted, but has not been flushed to disk yet */
RETURN_TRUE;
} else {
entry->is_deleted = 1;
entry->is_modified = 1;
phar_obj->arc.archive->is_modified = 1;
}
}
} else {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Entry %s does not exist and cannot be deleted", fname);
RETURN_FALSE;
}
phar_flush(phar_obj->arc.archive, NULL, 0, 0, &error TSRMLS_CC);
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "%s", error);
efree(error);
}
RETURN_TRUE;
}
| 0
|
350,127
|
void MongoStatusInfo::fromStatus(JSContext* cx, Status status, JS::MutableHandleValue value) {
auto scope = getScope(cx);
JS::RootedValue undef(cx);
undef.setUndefined();
JS::AutoValueArray<1> args(cx);
ValueReader(cx, args[0]).fromStringData(status.reason());
JS::RootedObject error(cx);
scope->getProto<ErrorInfo>().newInstance(args, &error);
JS::RootedObject thisv(cx);
scope->getProto<MongoStatusInfo>().newObjectWithProto(&thisv, error);
ObjectWrapper thisvObj(cx, thisv);
thisvObj.defineProperty(InternedString::code,
JSPROP_ENUMERATE,
smUtils::wrapConstrainedMethod<Functions::code, false, MongoStatusInfo>,
nullptr);
thisvObj.defineProperty(
InternedString::reason,
JSPROP_ENUMERATE,
smUtils::wrapConstrainedMethod<Functions::reason, false, MongoStatusInfo>,
nullptr);
// We intentionally omit JSPROP_ENUMERATE to match how Error.prototype.stack is a non-enumerable
// property.
thisvObj.defineProperty(
InternedString::stack,
0,
smUtils::wrapConstrainedMethod<Functions::stack, false, MongoStatusInfo>,
nullptr);
JS_SetPrivate(thisv, scope->trackedNew<Status>(std::move(status)));
value.setObjectOrNull(thisv);
}
| 1
|
345,951
|
bool asn1_read_BOOLEAN_context(struct asn1_data *data, bool *v, int context)
{
uint8_t tmp = 0;
asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(context));
asn1_read_uint8(data, &tmp);
if (tmp == 0xFF) {
*v = true;
} else {
*v = false;
}
asn1_end_tag(data);
return !data->has_error;
}
| 1
|
463,174
|
Status explain(OperationContext* opCtx,
const std::string& dbname,
const BSONObj& cmdObj,
ExplainOptions::Verbosity verbosity,
BSONObjBuilder* out) const override {
const NamespaceString nss(parseNsCollectionRequired(dbname, cmdObj));
if (!nss.isValid()) {
return {ErrorCodes::InvalidNamespace,
str::stream() << "Invalid collection name: " << nss.ns()};
}
// Parse the command BSON to a QueryRequest.
const bool isExplain = true;
auto qrStatus = QueryRequest::makeFromFindCommand(nss, cmdObj, isExplain);
if (!qrStatus.isOK()) {
return qrStatus.getStatus();
}
// Finish the parsing step by using the QueryRequest to create a CanonicalQuery.
ExtensionsCallbackReal extensionsCallback(opCtx, &nss);
const boost::intrusive_ptr<ExpressionContext> expCtx;
auto statusWithCQ =
CanonicalQuery::canonicalize(opCtx,
std::move(qrStatus.getValue()),
expCtx,
extensionsCallback,
MatchExpressionParser::kAllowAllSpecialFeatures &
~MatchExpressionParser::AllowedFeatures::kIsolated);
if (!statusWithCQ.isOK()) {
return statusWithCQ.getStatus();
}
std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
// Acquire locks. If the namespace is a view, we release our locks and convert the query
// request into an aggregation command.
AutoGetCollectionOrViewForReadCommand ctx(opCtx, nss);
if (ctx.getView()) {
// Relinquish locks. The aggregation command will re-acquire them.
ctx.releaseLocksForView();
// Convert the find command into an aggregation using $match (and other stages, as
// necessary), if possible.
const auto& qr = cq->getQueryRequest();
auto viewAggregationCommand = qr.asAggregationCommand();
if (!viewAggregationCommand.isOK())
return viewAggregationCommand.getStatus();
// Create the agg request equivalent of the find operation, with the explain verbosity
// included.
auto aggRequest = AggregationRequest::parseFromBSON(
nss, viewAggregationCommand.getValue(), verbosity);
if (!aggRequest.isOK()) {
return aggRequest.getStatus();
}
try {
return runAggregate(
opCtx, nss, aggRequest.getValue(), viewAggregationCommand.getValue(), *out);
} catch (DBException& error) {
if (error.code() == ErrorCodes::InvalidPipelineOperator) {
return {ErrorCodes::InvalidPipelineOperator,
str::stream() << "Unsupported in view pipeline: " << error.what()};
}
return error.toStatus();
}
}
// The collection may be NULL. If so, getExecutor() should handle it by returning an
// execution tree with an EOFStage.
Collection* collection = ctx.getCollection();
// We have a parsed query. Time to get the execution plan for it.
auto statusWithPlanExecutor =
getExecutorFind(opCtx, collection, nss, std::move(cq), PlanExecutor::YIELD_AUTO);
if (!statusWithPlanExecutor.isOK()) {
return statusWithPlanExecutor.getStatus();
}
auto exec = std::move(statusWithPlanExecutor.getValue());
// Got the execution tree. Explain it.
Explain::explainStages(exec.get(), collection, verbosity, out);
return Status::OK();
}
| 0
|
61,429
|
static int svm_check_intercept(struct kvm_vcpu *vcpu,
struct x86_instruction_info *info,
enum x86_intercept_stage stage)
{
struct vcpu_svm *svm = to_svm(vcpu);
int vmexit, ret = X86EMUL_CONTINUE;
struct __x86_intercept icpt_info;
struct vmcb *vmcb = svm->vmcb;
if (info->intercept >= ARRAY_SIZE(x86_intercept_map))
goto out;
icpt_info = x86_intercept_map[info->intercept];
if (stage != icpt_info.stage)
goto out;
switch (icpt_info.exit_code) {
case SVM_EXIT_READ_CR0:
if (info->intercept == x86_intercept_cr_read)
icpt_info.exit_code += info->modrm_reg;
break;
case SVM_EXIT_WRITE_CR0: {
unsigned long cr0, val;
u64 intercept;
if (info->intercept == x86_intercept_cr_write)
icpt_info.exit_code += info->modrm_reg;
if (icpt_info.exit_code != SVM_EXIT_WRITE_CR0 ||
info->intercept == x86_intercept_clts)
break;
intercept = svm->nested.intercept;
if (!(intercept & (1ULL << INTERCEPT_SELECTIVE_CR0)))
break;
cr0 = vcpu->arch.cr0 & ~SVM_CR0_SELECTIVE_MASK;
val = info->src_val & ~SVM_CR0_SELECTIVE_MASK;
if (info->intercept == x86_intercept_lmsw) {
cr0 &= 0xfUL;
val &= 0xfUL;
/* lmsw can't clear PE - catch this here */
if (cr0 & X86_CR0_PE)
val |= X86_CR0_PE;
}
if (cr0 ^ val)
icpt_info.exit_code = SVM_EXIT_CR0_SEL_WRITE;
break;
}
case SVM_EXIT_READ_DR0:
case SVM_EXIT_WRITE_DR0:
icpt_info.exit_code += info->modrm_reg;
break;
case SVM_EXIT_MSR:
if (info->intercept == x86_intercept_wrmsr)
vmcb->control.exit_info_1 = 1;
else
vmcb->control.exit_info_1 = 0;
break;
case SVM_EXIT_PAUSE:
/*
* We get this for NOP only, but pause
* is rep not, check this here
*/
if (info->rep_prefix != REPE_PREFIX)
goto out;
case SVM_EXIT_IOIO: {
u64 exit_info;
u32 bytes;
if (info->intercept == x86_intercept_in ||
info->intercept == x86_intercept_ins) {
exit_info = ((info->src_val & 0xffff) << 16) |
SVM_IOIO_TYPE_MASK;
bytes = info->dst_bytes;
} else {
exit_info = (info->dst_val & 0xffff) << 16;
bytes = info->src_bytes;
}
if (info->intercept == x86_intercept_outs ||
info->intercept == x86_intercept_ins)
exit_info |= SVM_IOIO_STR_MASK;
if (info->rep_prefix)
exit_info |= SVM_IOIO_REP_MASK;
bytes = min(bytes, 4u);
exit_info |= bytes << SVM_IOIO_SIZE_SHIFT;
exit_info |= (u32)info->ad_bytes << (SVM_IOIO_ASIZE_SHIFT - 1);
vmcb->control.exit_info_1 = exit_info;
vmcb->control.exit_info_2 = info->next_rip;
break;
}
default:
break;
}
/* TODO: Advertise NRIPS to guest hypervisor unconditionally */
if (static_cpu_has(X86_FEATURE_NRIPS))
vmcb->control.next_rip = info->next_rip;
vmcb->control.exit_code = icpt_info.exit_code;
vmexit = nested_svm_exit_handled(svm);
ret = (vmexit == NESTED_EXIT_DONE) ? X86EMUL_INTERCEPTED
: X86EMUL_CONTINUE;
out:
return ret;
}
| 0
|
218,957
|
ofputil_encode_bundle_msgs(const struct ofputil_bundle_msg *bms,
size_t n_bms, struct ovs_list *requests,
enum ofputil_protocol protocol)
{
enum ofp_version version = ofputil_protocol_to_ofp_version(protocol);
for (size_t i = 0; i < n_bms; i++) {
struct ofpbuf *request = NULL;
switch ((int)bms[i].type) {
case OFPTYPE_FLOW_MOD:
request = ofputil_encode_flow_mod(&bms[i].fm, protocol);
break;
case OFPTYPE_GROUP_MOD:
request = ofputil_encode_group_mod(version, &bms[i].gm);
break;
case OFPTYPE_PACKET_OUT:
request = ofputil_encode_packet_out(&bms[i].po, protocol);
break;
default:
break;
}
if (request) {
ovs_list_push_back(requests, &request->list_node);
}
}
}
| 0
|
211,184
|
void WebSocket::OnClose(SocketStream* socket_stream) {
origin_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &WebSocket::DoClose));
}
| 0
|
84,630
|
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
AVFilterContext *ctx = inlink->dst;
BoxBlurContext *s = ctx->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out;
int plane;
int cw = FF_CEIL_RSHIFT(inlink->w, s->hsub), ch = FF_CEIL_RSHIFT(in->height, s->vsub);
int w[4] = { inlink->w, cw, cw, inlink->w };
int h[4] = { in->height, ch, ch, in->height };
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
av_frame_free(&in);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out, in);
for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++)
hblur(out->data[plane], out->linesize[plane],
in ->data[plane], in ->linesize[plane],
w[plane], h[plane], s->radius[plane], s->power[plane],
s->temp);
for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++)
vblur(out->data[plane], out->linesize[plane],
out->data[plane], out->linesize[plane],
w[plane], h[plane], s->radius[plane], s->power[plane],
s->temp);
av_frame_free(&in);
return ff_filter_frame(outlink, out);
}
| 0
|
239,477
|
void FrameView::setScrollPositionNonProgrammatically(const IntPoint& scrollPoint)
{
IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
if (newScrollPosition == scrollPosition())
return;
TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, false);
notifyScrollPositionChanged(newScrollPosition);
}
| 0
|
219,062
|
horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
{
TIFFPredictorState* sp = PredictorState(tif);
tmsize_t stride = sp->stride;
uint32 *wp = (uint32*) cp0;
tmsize_t wc = cc/4;
if((cc%(4*stride))!=0)
{
TIFFErrorExt(tif->tif_clientdata, "horDiff32",
"%s", "(cc%(4*stride))!=0");
return 0;
}
if (wc > stride) {
wc -= stride;
wp += wc - 1;
do {
REPEAT4(stride, wp[stride] -= wp[0]; wp--)
wc -= stride;
} while (wc > 0);
}
return 1;
}
| 0
|
117,032
|
static void FontView_ReformatOne(FontView *fv) {
FontView *fvs;
if ( fv->v==NULL || fv->colcnt==0 ) /* Can happen in scripts */
return;
GDrawSetCursor(fv->v,ct_watch);
fv->rowltot = (fv->b.map->enccount+fv->colcnt-1)/fv->colcnt;
GScrollBarSetBounds(fv->vsb,0,fv->rowltot,fv->rowcnt);
if ( fv->rowoff>fv->rowltot-fv->rowcnt ) {
fv->rowoff = fv->rowltot-fv->rowcnt;
if ( fv->rowoff<0 ) fv->rowoff =0;
GScrollBarSetPos(fv->vsb,fv->rowoff);
}
for ( fvs=(FontView *) (fv->b.sf->fv); fvs!=NULL; fvs=(FontView *) (fvs->b.nextsame) )
if ( fvs!=fv && fvs->b.sf==fv->b.sf )
break;
GDrawRequestExpose(fv->v,NULL,false);
GDrawSetCursor(fv->v,ct_pointer);
}
| 0
|
449,428
|
int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
{
struct ttm_bo_device *bdev = bo->bdev;
uint32_t page_flags = 0;
dma_resv_assert_held(bo->base.resv);
if (bo->ttm)
return 0;
if (bdev->need_dma32)
page_flags |= TTM_PAGE_FLAG_DMA32;
if (bdev->no_retry)
page_flags |= TTM_PAGE_FLAG_NO_RETRY;
switch (bo->type) {
case ttm_bo_type_device:
if (zero_alloc)
page_flags |= TTM_PAGE_FLAG_ZERO_ALLOC;
break;
case ttm_bo_type_kernel:
break;
case ttm_bo_type_sg:
page_flags |= TTM_PAGE_FLAG_SG;
break;
default:
pr_err("Illegal buffer object type\n");
return -EINVAL;
}
bo->ttm = bdev->driver->ttm_tt_create(bo, page_flags);
if (unlikely(bo->ttm == NULL))
return -ENOMEM;
return 0;
}
| 0
|
299,872
|
#ifdef cimg_use_half
inline half rol(const half a, const unsigned int n=1) {
return (half)rol((int)a,n);
| 0
|
206,910
|
void AcknowledgeBufferForGpu(
int32 route_id,
int gpu_host_id,
const std::string& received_mailbox,
bool skip_frame,
const scoped_refptr<ui::Texture>& texture_to_produce) {
AcceleratedSurfaceMsg_BufferPresented_Params ack;
uint32 sync_point = 0;
DCHECK(!texture_to_produce.get() || !skip_frame);
if (texture_to_produce.get()) {
GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
ack.mailbox_name = texture_to_produce->Produce();
sync_point = gl_helper ? gl_helper->InsertSyncPoint() : 0;
} else if (skip_frame) {
ack.mailbox_name = received_mailbox;
ack.sync_point = 0;
}
ack.sync_point = sync_point;
RenderWidgetHostImpl::AcknowledgeBufferPresent(
route_id, gpu_host_id, ack);
}
| 0
|
2,358
|
static const char* ConvertScalar(PyObject* v, complex128* out) {
if (PyComplex_Check(v)) {
*out = complex128(PyComplex_RealAsDouble(v), PyComplex_ImagAsDouble(v));
return nullptr;
} else if (PyIsInstance(v, &PyComplexFloatingArrType_Type)) { // NumPy
auto as_complex = PyComplex_AsCComplex(v);
*out = complex128(as_complex.real, as_complex.imag);
return nullptr;
}
return ErrorMixedTypes;
}
| 1
|
433,196
|
static int ad5755_probe(struct spi_device *spi)
{
enum ad5755_type type = spi_get_device_id(spi)->driver_data;
const struct ad5755_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad5755_state *st;
int ret;
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
if (indio_dev == NULL) {
dev_err(&spi->dev, "Failed to allocate iio device\n");
return -ENOMEM;
}
st = iio_priv(indio_dev);
spi_set_drvdata(spi, indio_dev);
st->chip_info = &ad5755_chip_info_tbl[type];
st->spi = spi;
st->pwr_down = 0xf;
indio_dev->dev.parent = &spi->dev;
indio_dev->name = spi_get_device_id(spi)->name;
indio_dev->info = &ad5755_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->num_channels = AD5755_NUM_CHANNELS;
if (spi->dev.of_node)
pdata = ad5755_parse_dt(&spi->dev);
else
pdata = spi->dev.platform_data;
if (!pdata) {
dev_warn(&spi->dev, "no platform data? using default\n");
pdata = &ad5755_default_pdata;
}
ret = ad5755_init_channels(indio_dev, pdata);
if (ret)
return ret;
ret = ad5755_setup_pdata(indio_dev, pdata);
if (ret)
return ret;
return devm_iio_device_register(&spi->dev, indio_dev);
}
| 0
|
437,642
|
static inline void spl_filesystem_object_get_file_name(spl_filesystem_object *intern) /* {{{ */
{
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
switch (intern->type) {
case SPL_FS_INFO:
case SPL_FS_FILE:
if (!intern->file_name) {
php_error_docref(NULL, E_ERROR, "Object not initialized");
}
break;
case SPL_FS_DIR:
{
size_t path_len = 0;
char *path = spl_filesystem_object_get_path(intern, &path_len);
if (intern->file_name) {
efree(intern->file_name);
}
/* if there is parent path, ammend it, otherwise just use the given path as is */
if (path_len == 0) {
intern->file_name_len = spprintf(
&intern->file_name, 0, "%s", intern->u.dir.entry.d_name);
} else {
intern->file_name_len = spprintf(
&intern->file_name, 0, "%s%c%s", path, slash, intern->u.dir.entry.d_name);
}
}
break;
}
} /* }}} */
| 0
|
123,229
|
usm_rgenerate_out_msg(int msgProcModel, /* (UNUSED) */
u_char * globalData, /* IN */
/*
* points at the msgGlobalData, which is of length given by next
* parameter.
*/
size_t globalDataLen, /* IN - Length of msg header data. */
int maxMsgSize, /* (UNUSED) */
int secModel, /* (UNUSED) */
u_char * secEngineID, /* IN - Pointer snmpEngineID. */
size_t secEngineIDLen, /* IN - SnmpEngineID length. */
char *secName, /* IN - Pointer to securityName. */
size_t secNameLen, /* IN - SecurityName length. */
int secLevel, /* IN - AuthNoPriv, authPriv etc. */
u_char * scopedPdu, /* IN */
/*
* Pointer to scopedPdu will be encrypted by USM if needed
* * and written to packet buffer immediately following
* * securityParameters, entire msg will be authenticated by
* * USM if needed.
*/
size_t scopedPduLen, /* IN - scopedPdu length. */
void *secStateRef, /* IN */
/*
* secStateRef, pointer to cached info provided only for
* * Response, otherwise NULL.
*/
u_char ** wholeMsg, /* IN/OUT */
/*
* Points at the pointer to the packet buffer, which might get extended
* if necessary via realloc().
*/
size_t * wholeMsgLen, /* IN/OUT */
/*
* Length of the entire packet buffer, **not** the length of the
* packet.
*/
size_t * offset /* IN/OUT */
/*
* Offset from the end of the packet buffer to the start of the packet,
* also known as the packet length.
*/
)
{
size_t msgAuthParmLen = 0;
u_int boots_uint;
u_int time_uint;
long boots_long;
long time_long;
/*
* Indirection because secStateRef values override parameters.
*
* None of these are to be free'd - they are either pointing to
* what's in the secStateRef or to something either in the
* actual parameter list or the user list.
*/
char *theName = NULL;
u_int theNameLength = 0;
u_char *theEngineID = NULL;
u_int theEngineIDLength = 0;
u_char *theAuthKey = NULL;
u_int theAuthKeyLength = 0;
const oid *theAuthProtocol = NULL;
u_int theAuthProtocolLength = 0;
u_char *thePrivKey = NULL;
u_int thePrivKeyLength = 0;
const oid *thePrivProtocol = NULL;
u_int thePrivProtocolLength = 0;
int theSecLevel = 0; /* No defined const for bad
* value (other then err). */
size_t salt_length = 0, save_salt_length = 0;
u_char salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
u_char authParams[USM_MAX_AUTHSIZE];
u_char iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
size_t sp_offset = 0, mac_offset = 0;
int rc = 0;
DEBUGMSGTL(("usm", "USM processing has begun (offset %d)\n", (int)*offset));
if (secStateRef != NULL) {
/*
* To hush the compiler for now. XXX
*/
struct usmStateReference *ref
= (struct usmStateReference *) secStateRef;
theName = ref->usr_name;
theNameLength = ref->usr_name_length;
theEngineID = ref->usr_engine_id;
theEngineIDLength = ref->usr_engine_id_length;
if (!theEngineIDLength) {
theEngineID = secEngineID;
theEngineIDLength = secEngineIDLen;
}
theAuthProtocol = ref->usr_auth_protocol;
theAuthProtocolLength = ref->usr_auth_protocol_length;
theAuthKey = ref->usr_auth_key;
theAuthKeyLength = ref->usr_auth_key_length;
thePrivProtocol = ref->usr_priv_protocol;
thePrivProtocolLength = ref->usr_priv_protocol_length;
thePrivKey = ref->usr_priv_key;
thePrivKeyLength = ref->usr_priv_key_length;
theSecLevel = ref->usr_sec_level;
}
/*
* * Identify the user record.
*/
else {
struct usmUser *user;
/*
* we do allow an unknown user name for
* unauthenticated requests.
*/
if ((user = usm_get_user(secEngineID, secEngineIDLen, secName))
== NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
DEBUGMSGTL(("usm", "Unknown User\n"));
return SNMPERR_USM_UNKNOWNSECURITYNAME;
}
theName = secName;
theNameLength = secNameLen;
theEngineID = secEngineID;
theSecLevel = secLevel;
theEngineIDLength = secEngineIDLen;
if (user) {
theAuthProtocol = user->authProtocol;
theAuthProtocolLength = user->authProtocolLen;
theAuthKey = user->authKey;
theAuthKeyLength = user->authKeyLen;
thePrivProtocol = user->privProtocol;
thePrivProtocolLength = user->privProtocolLen;
thePrivKey = user->privKey;
thePrivKeyLength = user->privKeyLen;
} else {
/*
* unknown users can not do authentication (obviously)
*/
theAuthProtocol = usmNoAuthProtocol;
theAuthProtocolLength =
sizeof(usmNoAuthProtocol) / sizeof(oid);
theAuthKey = NULL;
theAuthKeyLength = 0;
thePrivProtocol = usmNoPrivProtocol;
thePrivProtocolLength =
sizeof(usmNoPrivProtocol) / sizeof(oid);
thePrivKey = NULL;
thePrivKeyLength = 0;
}
} /* endif -- secStateRef==NULL */
/*
* From here to the end of the function, avoid reference to
* secName, secEngineID, secLevel, and associated lengths.
*/
/*
* Check to see if the user can use the requested sec services.
*/
if (usm_check_secLevel_vs_protocols(theSecLevel,
theAuthProtocol,
theAuthProtocolLength,
thePrivProtocol,
thePrivProtocolLength) == 1) {
DEBUGMSGTL(("usm", "Unsupported Security Level or type (%d)\n",
theSecLevel));
return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
}
/*
* * Retrieve the engine information.
* *
* * XXX No error is declared in the EoP when sending messages to
* * unknown engines, processing continues w/ boots/time == (0,0).
*/
if (get_enginetime(theEngineID, theEngineIDLength,
&boots_uint, &time_uint, FALSE) == -1) {
DEBUGMSGTL(("usm", "%s\n", "Failed to find engine data."));
}
boots_long = boots_uint;
time_long = time_uint;
if (theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
/*
* Initially assume that the ciphertext will end up the same size as
* the plaintext plus some padding. Really sc_encrypt ought to be able
* to grow this for us, a la asn_realloc_rbuild_<type> functions, but
* this will do for now.
*/
u_char *ciphertext = NULL;
size_t ciphertextlen = scopedPduLen + 64;
int priv_type = sc_get_privtype(thePrivProtocol,
thePrivProtocolLength);
if ((ciphertext = (u_char *) malloc(ciphertextlen)) == NULL) {
DEBUGMSGTL(("usm",
"couldn't malloc %d bytes for encrypted PDU\n",
(int)ciphertextlen));
return SNMPERR_MALLOC;
}
/*
* XXX Hardwired to seek into a 1DES private key!
*/
#ifdef HAVE_AES
if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
salt_length = BYTESIZE(USM_AES_SALT_LENGTH);
save_salt_length = BYTESIZE(USM_AES_SALT_LENGTH)/2;
if (!thePrivKey ||
usm_set_aes_iv(salt, &salt_length,
htonl(boots_uint), htonl(time_uint),
iv) == -1) {
DEBUGMSGTL(("usm", "Can't set AES iv.\n"));
SNMP_FREE(ciphertext);
return SNMPERR_USM_GENERICERROR;
}
}
#endif
#ifndef NETSNMP_DISABLE_DES
if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
salt_length = BYTESIZE(USM_DES_SALT_LENGTH);
save_salt_length = BYTESIZE(USM_DES_SALT_LENGTH);
if (!thePrivKey || (usm_set_salt(salt, &salt_length,
thePrivKey + 8,
thePrivKeyLength - 8,
iv) == -1)) {
DEBUGMSGTL(("usm", "Can't set DES-CBC salt.\n"));
SNMP_FREE(ciphertext);
return SNMPERR_USM_GENERICERROR;
}
}
#endif
#ifdef NETSNMP_ENABLE_TESTING_CODE
if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
dump_chunk("usm/dump", "This data was encrypted:",
scopedPdu, scopedPduLen);
}
#endif
if (sc_encrypt(thePrivProtocol, thePrivProtocolLength,
thePrivKey, thePrivKeyLength,
salt, salt_length,
scopedPdu, scopedPduLen,
ciphertext, &ciphertextlen) != SNMP_ERR_NOERROR) {
DEBUGMSGTL(("usm", "encryption error.\n"));
SNMP_FREE(ciphertext);
return SNMPERR_USM_ENCRYPTIONERROR;
}
/*
* Write the encrypted scopedPdu back into the packet buffer.
*/
*offset = 0;
rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_UNIVERSAL |
ASN_PRIMITIVE |
ASN_OCTET_STR),
ciphertext, ciphertextlen);
if (rc == 0) {
DEBUGMSGTL(("usm", "Encryption failed.\n"));
SNMP_FREE(ciphertext);
return SNMPERR_USM_ENCRYPTIONERROR;
}
#ifdef NETSNMP_ENABLE_TESTING_CODE
if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
dump_chunk("usm/dump", "salt + Encrypted form: ", salt,
salt_length);
dump_chunk("usm/dump", "wholeMsg:",
(*wholeMsg + *wholeMsgLen - *offset), *offset);
}
#endif
DEBUGMSGTL(("usm", "Encryption successful.\n"));
SNMP_FREE(ciphertext);
} else {
/*
* theSecLevel != SNMP_SEC_LEVEL_AUTHPRIV
*/
}
/*
* Start encoding the msgSecurityParameters.
*/
sp_offset = *offset;
DEBUGDUMPHEADER("send", "msgPrivacyParameters");
/*
* msgPrivacyParameters (warning: assumes DES salt).
*/
rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
| ASN_OCTET_STR),
iv,
save_salt_length);
DEBUGINDENTLESS();
if (rc == 0) {
DEBUGMSGTL(("usm", "building privParams failed.\n"));
return SNMPERR_TOO_LONG;
}
DEBUGDUMPHEADER("send", "msgAuthenticationParameters");
/*
* msgAuthenticationParameters.
*/
if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
|| theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
memset(authParams, 0, sizeof(authParams));
msgAuthParmLen =
sc_get_auth_maclen(sc_get_authtype(theAuthProtocol,
theAuthProtocolLength));
}
rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
| ASN_OCTET_STR), authParams,
msgAuthParmLen);
DEBUGINDENTLESS();
if (rc == 0) {
DEBUGMSGTL(("usm", "building authParams failed.\n"));
return SNMPERR_TOO_LONG;
}
/*
* Remember where to put the actual HMAC we calculate later on. An
* encoded OCTET STRING of length USM_MD5_AND_SHA_AUTH_LEN has an ASN.1
* header of length 2, hence the fudge factor. This works as long as
* auth lengths stay < 127.
*/
mac_offset = *offset - 2;
/*
* msgUserName.
*/
DEBUGDUMPHEADER("send", "msgUserName");
rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
| ASN_OCTET_STR),
(u_char *) theName, theNameLength);
DEBUGINDENTLESS();
if (rc == 0) {
DEBUGMSGTL(("usm", "building authParams failed.\n"));
return SNMPERR_TOO_LONG;
}
/*
* msgAuthoritativeEngineTime.
*/
DEBUGDUMPHEADER("send", "msgAuthoritativeEngineTime");
rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
ASN_INTEGER), &time_long,
sizeof(long));
DEBUGINDENTLESS();
if (rc == 0) {
DEBUGMSGTL(("usm",
"building msgAuthoritativeEngineTime failed.\n"));
return SNMPERR_TOO_LONG;
}
/*
* msgAuthoritativeEngineBoots.
*/
DEBUGDUMPHEADER("send", "msgAuthoritativeEngineBoots");
rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
ASN_INTEGER), &boots_long,
sizeof(long));
DEBUGINDENTLESS();
if (rc == 0) {
DEBUGMSGTL(("usm",
"building msgAuthoritativeEngineBoots failed.\n"));
return SNMPERR_TOO_LONG;
}
DEBUGDUMPHEADER("send", "msgAuthoritativeEngineID");
rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
| ASN_OCTET_STR), theEngineID,
theEngineIDLength);
DEBUGINDENTLESS();
if (rc == 0) {
DEBUGMSGTL(("usm", "building msgAuthoritativeEngineID failed.\n"));
return SNMPERR_TOO_LONG;
}
/*
* USM msgSecurityParameters sequence header
*/
rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_SEQUENCE |
ASN_CONSTRUCTOR),
*offset - sp_offset);
if (rc == 0) {
DEBUGMSGTL(("usm", "building usm security parameters failed.\n"));
return SNMPERR_TOO_LONG;
}
/*
* msgSecurityParameters OCTET STRING wrapper.
*/
rc = asn_realloc_rbuild_header(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
| ASN_OCTET_STR),
*offset - sp_offset);
if (rc == 0) {
DEBUGMSGTL(("usm", "building msgSecurityParameters failed.\n"));
return SNMPERR_TOO_LONG;
}
/*
* Copy in the msgGlobalData and msgVersion.
*/
while ((*wholeMsgLen - *offset) < globalDataLen) {
if (!asn_realloc(wholeMsg, wholeMsgLen)) {
DEBUGMSGTL(("usm", "building global data failed.\n"));
return SNMPERR_TOO_LONG;
}
}
*offset += globalDataLen;
memcpy(*wholeMsg + *wholeMsgLen - *offset, globalData, globalDataLen);
/*
* Total packet sequence.
*/
rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
(u_char) (ASN_SEQUENCE |
ASN_CONSTRUCTOR), *offset);
if (rc == 0) {
DEBUGMSGTL(("usm", "building master packet sequence failed.\n"));
return SNMPERR_TOO_LONG;
}
/*
* Now consider / do authentication.
*/
if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV ||
theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
size_t temp_sig_len = msgAuthParmLen;
u_char *temp_sig = (u_char *) malloc(temp_sig_len);
u_char *proto_msg = *wholeMsg + *wholeMsgLen - *offset;
size_t proto_msg_len = *offset;
if (temp_sig == NULL) {
DEBUGMSGTL(("usm", "Out of memory.\n"));
return SNMPERR_USM_GENERICERROR;
}
if (sc_generate_keyed_hash(theAuthProtocol, theAuthProtocolLength,
theAuthKey, theAuthKeyLength,
proto_msg, proto_msg_len,
temp_sig, &temp_sig_len)
!= SNMP_ERR_NOERROR) {
SNMP_FREE(temp_sig);
DEBUGMSGTL(("usm", "Signing failed.\n"));
return SNMPERR_USM_AUTHENTICATIONFAILURE;
}
if (temp_sig_len != msgAuthParmLen) {
SNMP_FREE(temp_sig);
DEBUGMSGTL(("usm", "Signing lengths failed.\n"));
return SNMPERR_USM_AUTHENTICATIONFAILURE;
}
memcpy(*wholeMsg + *wholeMsgLen - mac_offset, temp_sig,
msgAuthParmLen);
SNMP_FREE(temp_sig);
}
/*
* endif -- create keyed hash
*/
DEBUGMSGTL(("usm", "USM processing completed.\n"));
return SNMPERR_SUCCESS;
} /* end usm_rgenerate_out_msg() */
| 0
|
128,499
|
set_buffer_environ(Buffer *buf)
{
static Buffer *prev_buf = NULL;
static Line *prev_line = NULL;
static int prev_pos = -1;
Line *l;
if (buf == NULL)
return;
if (buf != prev_buf) {
set_environ("W3M_SOURCEFILE", buf->sourcefile);
set_environ("W3M_FILENAME", buf->filename);
set_environ("W3M_TITLE", buf->buffername);
set_environ("W3M_URL", parsedURL2Str(&buf->currentURL)->ptr);
set_environ("W3M_TYPE", buf->real_type ? buf->real_type : "unknown");
#ifdef USE_M17N
set_environ("W3M_CHARSET", wc_ces_to_charset(buf->document_charset));
#endif
}
l = buf->currentLine;
if (l && (buf != prev_buf || l != prev_line || buf->pos != prev_pos)) {
Anchor *a;
ParsedURL pu;
char *s = GetWord(buf);
set_environ("W3M_CURRENT_WORD", s ? s : "");
a = retrieveCurrentAnchor(buf);
if (a) {
parseURL2(a->url, &pu, baseURL(buf));
set_environ("W3M_CURRENT_LINK", parsedURL2Str(&pu)->ptr);
}
else
set_environ("W3M_CURRENT_LINK", "");
a = retrieveCurrentImg(buf);
if (a) {
parseURL2(a->url, &pu, baseURL(buf));
set_environ("W3M_CURRENT_IMG", parsedURL2Str(&pu)->ptr);
}
else
set_environ("W3M_CURRENT_IMG", "");
a = retrieveCurrentForm(buf);
if (a)
set_environ("W3M_CURRENT_FORM", form2str((FormItemList *)a->url));
else
set_environ("W3M_CURRENT_FORM", "");
set_environ("W3M_CURRENT_LINE", Sprintf("%ld",
l->real_linenumber)->ptr);
set_environ("W3M_CURRENT_COLUMN", Sprintf("%d",
buf->currentColumn +
buf->cursorX + 1)->ptr);
}
else if (!l) {
set_environ("W3M_CURRENT_WORD", "");
set_environ("W3M_CURRENT_LINK", "");
set_environ("W3M_CURRENT_IMG", "");
set_environ("W3M_CURRENT_FORM", "");
set_environ("W3M_CURRENT_LINE", "0");
set_environ("W3M_CURRENT_COLUMN", "0");
}
prev_buf = buf;
prev_line = l;
prev_pos = buf->pos;
}
| 0
|
450,216
|
ctnetlink_dump_timestamp(struct sk_buff *skb, const struct nf_conn *ct)
{
struct nlattr *nest_count;
const struct nf_conn_tstamp *tstamp;
tstamp = nf_conn_tstamp_find(ct);
if (!tstamp)
return 0;
nest_count = nla_nest_start(skb, CTA_TIMESTAMP);
if (!nest_count)
goto nla_put_failure;
if (nla_put_be64(skb, CTA_TIMESTAMP_START, cpu_to_be64(tstamp->start),
CTA_TIMESTAMP_PAD) ||
(tstamp->stop != 0 && nla_put_be64(skb, CTA_TIMESTAMP_STOP,
cpu_to_be64(tstamp->stop),
CTA_TIMESTAMP_PAD)))
goto nla_put_failure;
nla_nest_end(skb, nest_count);
return 0;
nla_put_failure:
return -1;
}
| 0
|
179,278
|
static void reflectedIntegralAttrAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObject* imp = V8TestObject::toNative(info.Holder());
v8SetReturnValueInt(info, imp->getIntegralAttribute(HTMLNames::reflectedintegralattrAttr));
}
| 0
|
318,516
|
static void put_swf_matrix(ByteIOContext *pb,
int a, int b, int c, int d, int tx, int ty)
{
PutBitContext p;
uint8_t buf[256];
init_put_bits(&p, buf, sizeof(buf));
put_bits(&p, 1, 1); /* a, d present */
put_bits(&p, 5, 20); /* nb bits */
put_bits(&p, 20, a);
put_bits(&p, 20, d);
put_bits(&p, 1, 1); /* b, c present */
put_bits(&p, 5, 20); /* nb bits */
put_bits(&p, 20, c);
put_bits(&p, 20, b);
put_bits(&p, 5, 20); /* nb bits */
put_bits(&p, 20, tx);
put_bits(&p, 20, ty);
flush_put_bits(&p);
put_buffer(pb, buf, pbBufPtr(&p) - p.buf);
}
| 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.