idx
int64
func
string
target
int64
401
IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerWithDownloadsBrowserTest , TestWithDownloadsFromDifferentProfiles ) { ProfileManager * profile_manager = g_browser_process -> profile_manager ( ) ; Profile * other_profile = nullptr ; { base : : FilePath path = profile_manager -> user_data_dir ( ) . AppendASCII ( "test_profile" ) ; base : : ScopedAllowBlockingForTesting allow_blocking ; if ( ! base : : PathExists ( path ) ) ASSERT_TRUE ( base : : CreateDirectory ( path ) ) ; other_profile = Profile : : CreateProfile ( path , NULL , Profile : : CREATE_MODE_SYNCHRONOUS ) ; } profile_manager -> RegisterTestingProfile ( other_profile , true , false ) ; Browser * other_profile_browser = CreateBrowser ( other_profile ) ; SetDownloadPathForProfile ( browser ( ) -> profile ( ) ) ; SetDownloadPathForProfile ( other_profile ) ; ASSERT_NO_FATAL_FAILURE ( CreateStalledDownload ( browser ( ) ) ) ; { RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 1 ) ; browser ( ) -> window ( ) -> Close ( ) ; close_observer . Wait ( ) ; } ui_test_utils : : BrowserAddedObserver new_browser_observer ; TestBrowserCloseManager : : AttemptClose ( TestBrowserCloseManager : : USER_CHOICE_USER_CANCELS_CLOSE ) ; EXPECT_FALSE ( browser_shutdown : : IsTryingToQuit ( ) ) ; Browser * opened_browser = new_browser_observer . WaitForSingleNewBrowser ( ) ; EXPECT_EQ ( GURL ( chrome : : kChromeUIDownloadsURL ) , opened_browser -> tab_strip_model ( ) -> GetActiveWebContents ( ) -> GetURL ( ) ) ; EXPECT_EQ ( GURL ( "about:blank" ) , other_profile_browser -> tab_strip_model ( ) -> GetActiveWebContents ( ) -> GetURL ( ) ) ; RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 2 ) ; TestBrowserCloseManager : : AttemptClose ( TestBrowserCloseManager : : USER_CHOICE_USER_ALLOWS_CLOSE ) ; close_observer . Wait ( ) ; EXPECT_TRUE ( browser_shutdown : : IsTryingToQuit ( ) ) ; EXPECT_TRUE ( BrowserList : : GetInstance ( ) -> empty ( ) ) ; if ( browser_defaults : : kBrowserAliveWithNoWindows ) EXPECT_EQ ( 1 , DownloadCoreService : : NonMaliciousDownloadCountAllProfiles ( ) ) ; else EXPECT_EQ ( 0 , DownloadCoreService : : NonMaliciousDownloadCountAllProfiles ( ) ) ; }
1
225,258
void VideoRendererBase::Seek(base::TimeDelta time, const PipelineStatusCB& cb) { base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, kFlushed) << "Must flush prior to seeking."; DCHECK(!cb.is_null()); DCHECK(seek_cb_.is_null()); state_ = kSeeking; seek_cb_ = cb; seek_timestamp_ = time; AttemptRead_Locked(); }
0
516,392
MaybeLocal<Value> GetIssuerString( Environment* env, const BIOPointer& bio, X509* cert) { X509_NAME* issuer_name = X509_get_issuer_name(cert); if (X509_NAME_print_ex(bio.get(), issuer_name, 0, X509_NAME_FLAGS) <= 0) { USE(BIO_reset(bio.get())); return Undefined(env->isolate()); } return ToV8Value(env, bio); }
0
352,427
static bool ad_unpack(struct adouble *ad, const size_t nentries, size_t filesize) { size_t bufsize = talloc_get_size(ad->ad_data); size_t adentries, i; uint32_t eid, len, off; bool ok; /* * The size of the buffer ad->ad_data is checked when read, so * we wouldn't have to check our own offsets, a few extra * checks won't hurt though. We have to check the offsets we * read from the buffer anyway. */ if (bufsize < (AD_HEADER_LEN + (AD_ENTRY_LEN * nentries))) { DEBUG(1, ("bad size\n")); return false; } ad->ad_magic = RIVAL(ad->ad_data, 0); ad->ad_version = RIVAL(ad->ad_data, ADEDOFF_VERSION); if ((ad->ad_magic != AD_MAGIC) || (ad->ad_version != AD_VERSION)) { DEBUG(1, ("wrong magic or version\n")); return false; } memcpy(ad->ad_filler, ad->ad_data + ADEDOFF_FILLER, ADEDLEN_FILLER); adentries = RSVAL(ad->ad_data, ADEDOFF_NENTRIES); if (adentries != nentries) { DEBUG(1, ("invalid number of entries: %zu\n", adentries)); return false; } /* now, read in the entry bits */ for (i = 0; i < adentries; i++) { eid = RIVAL(ad->ad_data, AD_HEADER_LEN + (i * AD_ENTRY_LEN)); eid = get_eid(eid); off = RIVAL(ad->ad_data, AD_HEADER_LEN + (i * AD_ENTRY_LEN) + 4); len = RIVAL(ad->ad_data, AD_HEADER_LEN + (i * AD_ENTRY_LEN) + 8); if (!eid || eid >= ADEID_MAX) { DEBUG(1, ("bogus eid %d\n", eid)); return false; } /* * All entries other than the resource fork are * expected to be read into the ad_data buffer, so * ensure the specified offset is within that bound */ if ((off > bufsize) && (eid != ADEID_RFORK)) { DEBUG(1, ("bogus eid %d: off: %" PRIu32 ", len: %" PRIu32 "\n", eid, off, len)); return false; } /* * All entries besides FinderInfo and resource fork * must fit into the buffer. FinderInfo is special as * it may be larger then the default 32 bytes (if it * contains marshalled xattrs), but we will fixup that * in ad_convert(). And the resource fork is never * accessed directly by the ad_data buf (also see * comment above) anyway. */ if ((eid != ADEID_RFORK) && (eid != ADEID_FINDERI) && ((off + len) > bufsize)) { DEBUG(1, ("bogus eid %d: off: %" PRIu32 ", len: %" PRIu32 "\n", eid, off, len)); return false; } /* * That would be obviously broken */ if (off > filesize) { DEBUG(1, ("bogus eid %d: off: %" PRIu32 ", len: %" PRIu32 "\n", eid, off, len)); return false; } /* * Check for any entry that has its end beyond the * filesize. */ if (off + len < off) { DEBUG(1, ("offset wrap in eid %d: off: %" PRIu32 ", len: %" PRIu32 "\n", eid, off, len)); return false; } if (off + len > filesize) { /* * If this is the resource fork entry, we fix * up the length, for any other entry we bail * out. */ if (eid != ADEID_RFORK) { DEBUG(1, ("bogus eid %d: off: %" PRIu32 ", len: %" PRIu32 "\n", eid, off, len)); return false; } /* * Fixup the resource fork entry by limiting * the size to entryoffset - filesize. */ len = filesize - off; DEBUG(1, ("Limiting ADEID_RFORK: off: %" PRIu32 ", len: %" PRIu32 "\n", off, len)); } ad->ad_eid[eid].ade_off = off; ad->ad_eid[eid].ade_len = len; } if (ad->ad_type == ADOUBLE_RSRC) { ok = ad_unpack_xattrs(ad); if (!ok) { return false; } } return true; }
1
416,178
oparray_cleanup(i_ctx_t *i_ctx_p) { /* esp points just below the cleanup procedure. */ es_ptr ep = esp; uint ocount_old = (uint) ep[3].value.intval; uint dcount_old = (uint) ep[4].value.intval; uint ocount = ref_stack_count(&o_stack); uint dcount = ref_stack_count(&d_stack); if (ocount > ocount_old) ref_stack_pop(&o_stack, ocount - ocount_old); if (dcount > dcount_old) { ref_stack_pop(&d_stack, dcount - dcount_old); dict_set_top(); } return 0; }
0
15,133
TEST_F ( WebFrameSimTest , FindInPageSelectNextMatch ) { WebView ( ) . Resize ( WebSize ( 500 , 300 ) ) ; WebView ( ) . GetPage ( ) -> GetSettings ( ) . SetTextAutosizingEnabled ( false ) ; SimRequest request ( "https://example.com/test.html" , "text/html" ) ; LoadURL ( "https://example.com/test.html" ) ; request . Complete ( R "HTML( < ! DOCTYPE html > < style > body , html { width : 4000px ; height : 4000px ; margin : 0 ; } # box1 { position : absolute ; left : 800px ; top : 2000px ; } # box2 { position : absolute ; left : 1000px ; top : 3000px ; }
0
178,853
GLES2DecoderWithShaderTest() : GLES2DecoderWithShaderTestBase() { }
0
202,422
static int create_system_filter(struct trace_subsystem_dir *dir, struct trace_array *tr, char *filter_str, struct event_filter **filterp) { struct filter_parse_error *pe = NULL; int err; err = create_filter_start(filter_str, true, &pe, filterp); if (!err) { err = process_system_preds(dir, tr, pe, filter_str); if (!err) { /* System filters just show a default message */ kfree((*filterp)->filter_string); (*filterp)->filter_string = NULL; } else { append_filter_err(pe, *filterp); } } create_filter_finish(pe); return err; }
0
441,816
static int post_copy_siginfo_from_user(kernel_siginfo_t *info, const siginfo_t __user *from) { if (unlikely(!known_siginfo_layout(info->si_signo, info->si_code))) { char __user *expansion = si_expansion(from); char buf[SI_EXPANSION_SIZE]; int i; /* * An unknown si_code might need more than * sizeof(struct kernel_siginfo) bytes. Verify all of the * extra bytes are 0. This guarantees copy_siginfo_to_user * will return this data to userspace exactly. */ if (copy_from_user(&buf, expansion, SI_EXPANSION_SIZE)) return -EFAULT; for (i = 0; i < SI_EXPANSION_SIZE; i++) { if (buf[i] != 0) return -E2BIG; } } return 0; }
0
288,775
EC_GROUP * ec_asn1_pkparameters2group ( const ECPKPARAMETERS * params ) { EC_GROUP * ret = NULL ; int tmp = 0 ; if ( params == NULL ) { ECerr ( EC_F_EC_ASN1_PKPARAMETERS2GROUP , EC_R_MISSING_PARAMETERS ) ; return NULL ; } if ( params -> type == 0 ) { tmp = OBJ_obj2nid ( params -> value . named_curve ) ; if ( ( ret = EC_GROUP_new_by_curve_name ( tmp ) ) == NULL ) { ECerr ( EC_F_EC_ASN1_PKPARAMETERS2GROUP , EC_R_EC_GROUP_NEW_BY_NAME_FAILURE ) ; return NULL ; } EC_GROUP_set_asn1_flag ( ret , OPENSSL_EC_NAMED_CURVE ) ; } else if ( params -> type == 1 ) { ret = ec_asn1_parameters2group ( params -> value . parameters ) ; if ( ! ret ) { ECerr ( EC_F_EC_ASN1_PKPARAMETERS2GROUP , ERR_R_EC_LIB ) ; return NULL ; } EC_GROUP_set_asn1_flag ( ret , 0x0 ) ; } else if ( params -> type == 2 ) { return NULL ; } else { ECerr ( EC_F_EC_ASN1_PKPARAMETERS2GROUP , EC_R_ASN1_ERROR ) ; return NULL ; } return ret ; }
0
249,558
void DiscardableSharedMemoryManager::SetMemoryLimit(size_t limit) { base::AutoLock lock(lock_); memory_limit_ = limit; ReduceMemoryUsageUntilWithinMemoryLimit(); }
0
309,936
void FolderHeaderView::SetFolderItem(AppListFolderItem* folder_item) { if (folder_item_) folder_item_->RemoveObserver(this); folder_item_ = folder_item; if (!folder_item_) return; folder_item_->AddObserver(this); folder_name_view_->SetEnabled(folder_item_->folder_type() != AppListFolderItem::FOLDER_TYPE_OEM); Update(); }
0
317,343
png_crc_error(png_structp png_ptr) { png_byte crc_bytes[4]; png_uint_32 crc; int need_crc = 1; if (png_ptr->chunk_name[0] & 0x20) /* ancillary */ { if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) == (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN)) need_crc = 0; } else /* critical */ { if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) need_crc = 0; } png_read_data(png_ptr, crc_bytes, 4); if (need_crc) { crc = png_get_uint_32(crc_bytes); return ((int)(crc != png_ptr->crc)); } else return (0); }
0
197,754
MATCHER_P(Message, type, "") { return arg.type() == static_cast<uint32>(type); }
0
332,607
static void adpcm_compress_trellis(AVCodecContext *avctx, const int16_t *samples, uint8_t *dst, ADPCMChannelStatus *c, int n, int stride) { //FIXME 6% faster if frontier is a compile-time constant ADPCMEncodeContext *s = avctx->priv_data; const int frontier = 1 << avctx->trellis; const int version = avctx->codec->id; TrellisPath *paths = s->paths, *p; TrellisNode *node_buf = s->node_buf; TrellisNode **nodep_buf = s->nodep_buf; TrellisNode **nodes = nodep_buf; // nodes[] is always sorted by .ssd TrellisNode **nodes_next = nodep_buf + frontier; int pathn = 0, froze = -1, i, j, k, generation = 0; uint8_t *hash = s->trellis_hash; memset(hash, 0xff, 65536 * sizeof(*hash)); memset(nodep_buf, 0, 2 * frontier * sizeof(*nodep_buf)); nodes[0] = node_buf + frontier; nodes[0]->ssd = 0; nodes[0]->path = 0; nodes[0]->step = c->step_index; nodes[0]->sample1 = c->sample1; nodes[0]->sample2 = c->sample2; if (version == AV_CODEC_ID_ADPCM_IMA_WAV || version == AV_CODEC_ID_ADPCM_IMA_QT || version == AV_CODEC_ID_ADPCM_SWF) nodes[0]->sample1 = c->prev_sample; if (version == AV_CODEC_ID_ADPCM_MS) nodes[0]->step = c->idelta; if (version == AV_CODEC_ID_ADPCM_YAMAHA) { if (c->step == 0) { nodes[0]->step = 127; nodes[0]->sample1 = 0; } else { nodes[0]->step = c->step; nodes[0]->sample1 = c->predictor; } } for (i = 0; i < n; i++) { TrellisNode *t = node_buf + frontier*(i&1); TrellisNode **u; int sample = samples[i * stride]; int heap_pos = 0; memset(nodes_next, 0, frontier * sizeof(TrellisNode*)); for (j = 0; j < frontier && nodes[j]; j++) { // higher j have higher ssd already, so they're likely // to yield a suboptimal next sample too const int range = (j < frontier / 2) ? 1 : 0; const int step = nodes[j]->step; int nidx; if (version == AV_CODEC_ID_ADPCM_MS) { const int predictor = ((nodes[j]->sample1 * c->coeff1) + (nodes[j]->sample2 * c->coeff2)) / 64; const int div = (sample - predictor) / step; const int nmin = av_clip(div-range, -8, 6); const int nmax = av_clip(div+range, -7, 7); for (nidx = nmin; nidx <= nmax; nidx++) { const int nibble = nidx & 0xf; int dec_sample = predictor + nidx * step; #define STORE_NODE(NAME, STEP_INDEX)\ int d;\ uint32_t ssd;\ int pos;\ TrellisNode *u;\ uint8_t *h;\ dec_sample = av_clip_int16(dec_sample);\ d = sample - dec_sample;\ ssd = nodes[j]->ssd + d*d;\ /* Check for wraparound, skip such samples completely. \ * Note, changing ssd to a 64 bit variable would be \ * simpler, avoiding this check, but it's slower on \ * x86 32 bit at the moment. */\ if (ssd < nodes[j]->ssd)\ goto next_##NAME;\ /* Collapse any two states with the same previous sample value. \ * One could also distinguish states by step and by 2nd to last * sample, but the effects of that are negligible. * Since nodes in the previous generation are iterated * through a heap, they're roughly ordered from better to * worse, but not strictly ordered. Therefore, an earlier * node with the same sample value is better in most cases * (and thus the current is skipped), but not strictly * in all cases. Only skipping samples where ssd >= * ssd of the earlier node with the same sample gives * slightly worse quality, though, for some reason. */ \ h = &hash[(uint16_t) dec_sample];\ if (*h == generation)\ goto next_##NAME;\ if (heap_pos < frontier) {\ pos = heap_pos++;\ } else {\ /* Try to replace one of the leaf nodes with the new \ * one, but try a different slot each time. */\ pos = (frontier >> 1) +\ (heap_pos & ((frontier >> 1) - 1));\ if (ssd > nodes_next[pos]->ssd)\ goto next_##NAME;\ heap_pos++;\ }\ *h = generation;\ u = nodes_next[pos];\ if (!u) {\ av_assert1(pathn < FREEZE_INTERVAL << avctx->trellis);\ u = t++;\ nodes_next[pos] = u;\ u->path = pathn++;\ }\ u->ssd = ssd;\ u->step = STEP_INDEX;\ u->sample2 = nodes[j]->sample1;\ u->sample1 = dec_sample;\ paths[u->path].nibble = nibble;\ paths[u->path].prev = nodes[j]->path;\ /* Sift the newly inserted node up in the heap to \ * restore the heap property. */\ while (pos > 0) {\ int parent = (pos - 1) >> 1;\ if (nodes_next[parent]->ssd <= ssd)\ break;\ FFSWAP(TrellisNode*, nodes_next[parent], nodes_next[pos]);\ pos = parent;\ }\ next_##NAME:; STORE_NODE(ms, FFMAX(16, (ff_adpcm_AdaptationTable[nibble] * step) >> 8)); } } else if (version == AV_CODEC_ID_ADPCM_IMA_WAV || version == AV_CODEC_ID_ADPCM_IMA_QT || version == AV_CODEC_ID_ADPCM_SWF) { #define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)\ const int predictor = nodes[j]->sample1;\ const int div = (sample - predictor) * 4 / STEP_TABLE;\ int nmin = av_clip(div - range, -7, 6);\ int nmax = av_clip(div + range, -6, 7);\ if (nmin <= 0)\ nmin--; /* distinguish -0 from +0 */\ if (nmax < 0)\ nmax--;\ for (nidx = nmin; nidx <= nmax; nidx++) {\ const int nibble = nidx < 0 ? 7 - nidx : nidx;\ int dec_sample = predictor +\ (STEP_TABLE *\ ff_adpcm_yamaha_difflookup[nibble]) / 8;\ STORE_NODE(NAME, STEP_INDEX);\ } LOOP_NODES(ima, ff_adpcm_step_table[step], av_clip(step + ff_adpcm_index_table[nibble], 0, 88)); } else { //AV_CODEC_ID_ADPCM_YAMAHA LOOP_NODES(yamaha, step, av_clip((step * ff_adpcm_yamaha_indexscale[nibble]) >> 8, 127, 24567)); #undef LOOP_NODES #undef STORE_NODE } } u = nodes; nodes = nodes_next; nodes_next = u; generation++; if (generation == 255) { memset(hash, 0xff, 65536 * sizeof(*hash)); generation = 0; } // prevent overflow if (nodes[0]->ssd > (1 << 28)) { for (j = 1; j < frontier && nodes[j]; j++) nodes[j]->ssd -= nodes[0]->ssd; nodes[0]->ssd = 0; } // merge old paths to save memory if (i == froze + FREEZE_INTERVAL) { p = &paths[nodes[0]->path]; for (k = i; k > froze; k--) { dst[k] = p->nibble; p = &paths[p->prev]; } froze = i; pathn = 0; // other nodes might use paths that don't coincide with the frozen one. // checking which nodes do so is too slow, so just kill them all. // this also slightly improves quality, but I don't know why. memset(nodes + 1, 0, (frontier - 1) * sizeof(TrellisNode*)); } } p = &paths[nodes[0]->path]; for (i = n - 1; i > froze; i--) { dst[i] = p->nibble; p = &paths[p->prev]; } c->predictor = nodes[0]->sample1; c->sample1 = nodes[0]->sample1; c->sample2 = nodes[0]->sample2; c->step_index = nodes[0]->step; c->step = nodes[0]->step; c->idelta = nodes[0]->step; }
1
388,434
static bool encode_flag_request(void *mem_ctx, void *in, DATA_BLOB *out) { if (in) { return false; } *out = data_blob(NULL, 0); return true; }
0
132,101
void visit(CaptureScope &ope) override { ope.ope_->accept(*this); found_ope = csc(found_ope); }
0
482,180
ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* method_holder) { // For the case of <array>.clone(), the method holder can be a ciArrayKlass // instead of a ciInstanceKlass. For that case simply pretend that the // declared holder is Object.clone since that's where the call will bottom out. // A more correct fix would trickle out through many interfaces in CI, // requiring ciInstanceKlass* to become ciKlass* and many more places would // require checks to make sure the expected type was found. Given that this // only occurs for clone() the more extensive fix seems like overkill so // instead we simply smear the array type into Object. guarantee(method_holder != NULL, "no method holder"); if (method_holder->is_instance_klass()) { return method_holder->as_instance_klass(); } else if (method_holder->is_array_klass()) { return current()->Object_klass(); } else { ShouldNotReachHere(); } return NULL; }
0
97,166
static void xen_free_ldt(struct desc_struct *ldt, unsigned entries) { const unsigned entries_per_page = PAGE_SIZE / LDT_ENTRY_SIZE; int i; for (i = 0; i < entries; i += entries_per_page) set_aliased_prot(ldt + i, PAGE_KERNEL); }
0
472,996
datetime_to_date(VALUE self) { get_d1a(self); if (simple_dat_p(adat)) { VALUE new = d_lite_s_alloc_simple(cDate); { get_d1b(new); bdat->s = adat->s; bdat->s.jd = m_local_jd(adat); return new; } } else { VALUE new = d_lite_s_alloc_simple(cDate); { get_d1b(new); copy_complex_to_simple(new, &bdat->s, &adat->c); bdat->s.jd = m_local_jd(adat); bdat->s.flags &= ~(HAVE_DF | HAVE_TIME | COMPLEX_DAT); return new; } } }
0
100,404
static void clear_ftrace_pid_task(struct pid *pid) { if (pid == ftrace_swapper_pid) clear_ftrace_swapper(); else clear_ftrace_pid(pid); }
0
85,433
std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group, bool clashR, extra_settings &ext) { YAML::Node yamlnode; try { yamlnode = YAML::Load(base_conf); } catch (std::exception &e) { writeLog(0, std::string("Clash base loader failed with error: ") + e.what(), LOG_LEVEL_ERROR); return std::string(); } proxyToClash(nodes, yamlnode, extra_proxy_group, clashR, ext); if(ext.nodelist) return YAML::Dump(yamlnode); /* if(ext.enable_rule_generator) rulesetToClash(yamlnode, ruleset_content_array, ext.overwrite_original_rules, ext.clash_new_field_name); return YAML::Dump(yamlnode); */ if(!ext.enable_rule_generator) return YAML::Dump(yamlnode); if(!ext.managed_config_prefix.empty() || ext.clash_script) { if(yamlnode["mode"].IsDefined()) { if(ext.clash_new_field_name) yamlnode["mode"] = ext.clash_script ? "script" : "rule"; else yamlnode["mode"] = ext.clash_script ? "Script" : "Rule"; } renderClashScript(yamlnode, ruleset_content_array, ext.managed_config_prefix, ext.clash_script, ext.overwrite_original_rules, ext.clash_classical_ruleset); return YAML::Dump(yamlnode); } std::string output_content = rulesetToClashStr(yamlnode, ruleset_content_array, ext.overwrite_original_rules, ext.clash_new_field_name); output_content.insert(0, YAML::Dump(yamlnode)); return output_content; }
0
226,643
CurrentHistoryCleaner::~CurrentHistoryCleaner() { }
0
6,114
static x86newTokenType getToken(const char *str, size_t *begin, size_t *end) { // Skip whitespace while (begin && isspace ((ut8)str[*begin])) { ++(*begin); } if (!str[*begin]) { // null byte *end = *begin; return TT_EOF; } else if (isalpha ((ut8)str[*begin])) { // word token *end = *begin; while (end && isalnum ((ut8)str[*end])) { ++(*end); } return TT_WORD; } else if (isdigit ((ut8)str[*begin])) { // number token *end = *begin; while (end && isalnum ((ut8)str[*end])) { // accept alphanumeric characters, because hex. ++(*end); } return TT_NUMBER; } else { // special character: [, ], +, *, ... *end = *begin + 1; return TT_SPECIAL; } }
1
483,692
void pm_qos_sysfs_remove_flags(struct device *dev) { sysfs_unmerge_group(&dev->kobj, &pm_qos_flags_attr_group); }
0
389,335
static XMLRPC_VECTOR_TYPE determine_vector_type (HashTable *ht) { int bArray = 0, bStruct = 0, bMixed = 0; zend_ulong num_index, last_num = 0; zend_string* my_key; ZEND_HASH_FOREACH_KEY(ht, num_index, my_key) { if (my_key == NULL) { if (bStruct) { bMixed = 1; break; } else if (last_num > 0 && last_num != num_index-1) { bStruct = 1; break; } bArray = 1; last_num = num_index; } else { if (bArray) { bMixed = 1; break; } bStruct = 1; } } ZEND_HASH_FOREACH_END(); return bMixed ? xmlrpc_vector_mixed : (bStruct ? xmlrpc_vector_struct : xmlrpc_vector_array); }
0
166,672
void Transpose(LocalFrame& frame) { Editor& editor = frame.GetEditor(); if (!editor.CanEdit()) return; Document* const document = frame.GetDocument(); document->UpdateStyleAndLayoutIgnorePendingStylesheets(); const EphemeralRange& range = ComputeRangeForTranspose(frame); if (range.IsNull()) return; const String& text = PlainText(range); if (text.length() != 2) return; const String& transposed = text.Right(1) + text.Left(1); if (DispatchBeforeInputInsertText( EventTargetNodeForDocument(document), transposed, InputEvent::InputType::kInsertTranspose, new StaticRangeVector(1, StaticRange::Create(range))) != DispatchEventResult::kNotCanceled) return; if (frame.GetDocument() != document) return; document->UpdateStyleAndLayoutIgnorePendingStylesheets(); const EphemeralRange& new_range = ComputeRangeForTranspose(frame); if (new_range.IsNull()) return; const String& new_text = PlainText(new_range); if (new_text.length() != 2) return; const String& new_transposed = new_text.Right(1) + new_text.Left(1); const SelectionInDOMTree& new_selection = SelectionInDOMTree::Builder().SetBaseAndExtent(new_range).Build(); if (CreateVisibleSelection(new_selection) != frame.Selection().ComputeVisibleSelectionInDOMTree()) frame.Selection().SetSelection(new_selection); editor.ReplaceSelectionWithText(new_transposed, false, false, InputEvent::InputType::kInsertTranspose); }
0
121,886
Magick::EndianType Magick::Image::endian(void) const { return(constImage()->endian); }
0
230,366
PrintingContext::Result PrintingContextCairo::NewPage() { if (abort_printing_) return CANCEL; DCHECK(in_print_job_); return OK; }
0
6,493
iasecc_select_file(struct sc_card *card, const struct sc_path *path, struct sc_file **file_out) { struct sc_context *ctx = card->ctx; struct sc_path lpath; int cache_valid = card->cache.valid, df_from_cache = 0; int rv, ii; LOG_FUNC_CALLED(ctx); memcpy(&lpath, path, sizeof(struct sc_path)); if (file_out) *file_out = NULL; sc_log(ctx, "iasecc_select_file(card:%p) path.len %"SC_FORMAT_LEN_SIZE_T"u; path.type %i; aid_len %"SC_FORMAT_LEN_SIZE_T"u", card, path->len, path->type, path->aid.len); sc_log(ctx, "iasecc_select_file() path:%s", sc_print_path(path)); sc_print_cache(card); if (lpath.len >= 2 && lpath.value[0] == 0x3F && lpath.value[1] == 0x00) { sc_log(ctx, "EF.ATR(aid:'%s')", card->ef_atr ? sc_dump_hex(card->ef_atr->aid.value, card->ef_atr->aid.len) : ""); rv = iasecc_select_mf(card, file_out); LOG_TEST_RET(ctx, rv, "MF selection error"); if (lpath.len >= 2 && lpath.value[0] == 0x3F && lpath.value[1] == 0x00) { memmove(&lpath.value[0], &lpath.value[2], lpath.len - 2); lpath.len -= 2; } } if (lpath.aid.len) { struct sc_file *file = NULL; struct sc_path ppath; sc_log(ctx, "iasecc_select_file() select parent AID:%p/%"SC_FORMAT_LEN_SIZE_T"u", lpath.aid.value, lpath.aid.len); sc_log(ctx, "iasecc_select_file() select parent AID:%s", sc_dump_hex(lpath.aid.value, lpath.aid.len)); memset(&ppath, 0, sizeof(ppath)); memcpy(ppath.value, lpath.aid.value, lpath.aid.len); ppath.len = lpath.aid.len; ppath.type = SC_PATH_TYPE_DF_NAME; if (card->cache.valid && card->cache.current_df && card->cache.current_df->path.len == lpath.aid.len && !memcmp(card->cache.current_df->path.value, lpath.aid.value, lpath.aid.len)) df_from_cache = 1; rv = iasecc_select_file(card, &ppath, &file); LOG_TEST_RET(ctx, rv, "select AID path failed"); if (file_out) *file_out = file; else sc_file_free(file); if (lpath.type == SC_PATH_TYPE_DF_NAME) lpath.type = SC_PATH_TYPE_FROM_CURRENT; } if (lpath.type == SC_PATH_TYPE_PATH) lpath.type = SC_PATH_TYPE_FROM_CURRENT; if (!lpath.len) LOG_FUNC_RETURN(ctx, SC_SUCCESS); sc_print_cache(card); if (card->cache.valid && card->cache.current_df && lpath.type == SC_PATH_TYPE_DF_NAME && card->cache.current_df->path.len == lpath.len && !memcmp(card->cache.current_df->path.value, lpath.value, lpath.len)) { sc_log(ctx, "returns current DF path %s", sc_print_path(&card->cache.current_df->path)); if (file_out) { sc_file_free(*file_out); sc_file_dup(file_out, card->cache.current_df); } sc_print_cache(card); LOG_FUNC_RETURN(ctx, SC_SUCCESS); } do { struct sc_apdu apdu; struct sc_file *file = NULL; unsigned char rbuf[SC_MAX_APDU_BUFFER_SIZE]; int pathlen = lpath.len; sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0x00, 0x00); if (card->type != SC_CARD_TYPE_IASECC_GEMALTO && card->type != SC_CARD_TYPE_IASECC_OBERTHUR && card->type != SC_CARD_TYPE_IASECC_SAGEM && card->type != SC_CARD_TYPE_IASECC_AMOS && card->type != SC_CARD_TYPE_IASECC_MI && card->type != SC_CARD_TYPE_IASECC_MI2) LOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, "Unsupported card"); if (lpath.type == SC_PATH_TYPE_FILE_ID) { apdu.p1 = 0x02; if (card->type == SC_CARD_TYPE_IASECC_OBERTHUR) { apdu.p1 = 0x01; apdu.p2 = 0x04; } if (card->type == SC_CARD_TYPE_IASECC_AMOS) apdu.p2 = 0x04; if (card->type == SC_CARD_TYPE_IASECC_MI) apdu.p2 = 0x04; if (card->type == SC_CARD_TYPE_IASECC_MI2) apdu.p2 = 0x04; } else if (lpath.type == SC_PATH_TYPE_FROM_CURRENT) { apdu.p1 = 0x09; if (card->type == SC_CARD_TYPE_IASECC_OBERTHUR) apdu.p2 = 0x04; if (card->type == SC_CARD_TYPE_IASECC_AMOS) apdu.p2 = 0x04; if (card->type == SC_CARD_TYPE_IASECC_MI) apdu.p2 = 0x04; if (card->type == SC_CARD_TYPE_IASECC_MI2) apdu.p2 = 0x04; } else if (lpath.type == SC_PATH_TYPE_PARENT) { apdu.p1 = 0x03; pathlen = 0; apdu.cse = SC_APDU_CASE_2_SHORT; } else if (lpath.type == SC_PATH_TYPE_DF_NAME) { apdu.p1 = 0x04; if (card->type == SC_CARD_TYPE_IASECC_AMOS) apdu.p2 = 0x04; if (card->type == SC_CARD_TYPE_IASECC_MI2) apdu.p2 = 0x04; } else { sc_log(ctx, "Invalid PATH type: 0x%X", lpath.type); LOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, "iasecc_select_file() invalid PATH type"); } for (ii=0; ii<2; ii++) { apdu.lc = pathlen; apdu.data = lpath.value; apdu.datalen = pathlen; apdu.resp = rbuf; apdu.resplen = sizeof(rbuf); apdu.le = 256; rv = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, rv, "APDU transmit failed"); rv = sc_check_sw(card, apdu.sw1, apdu.sw2); if (rv == SC_ERROR_INCORRECT_PARAMETERS && lpath.type == SC_PATH_TYPE_DF_NAME && apdu.p2 == 0x00) { apdu.p2 = 0x0C; continue; } if (ii) { /* 'SELECT AID' do not returned FCP. Try to emulate. */ apdu.resplen = sizeof(rbuf); rv = iasecc_emulate_fcp(ctx, &apdu); LOG_TEST_RET(ctx, rv, "Failed to emulate DF FCP"); } break; } /* * Using of the cached DF and EF can cause problems in the multi-thread environment. * FIXME: introduce config. option that invalidates this cache outside the locked card session, * (or invent something else) */ if (rv == SC_ERROR_FILE_NOT_FOUND && cache_valid && df_from_cache) { sc_invalidate_cache(card); sc_log(ctx, "iasecc_select_file() file not found, retry without cached DF"); if (file_out) { sc_file_free(*file_out); *file_out = NULL; } rv = iasecc_select_file(card, path, file_out); LOG_FUNC_RETURN(ctx, rv); } LOG_TEST_RET(ctx, rv, "iasecc_select_file() check SW failed"); sc_log(ctx, "iasecc_select_file() apdu.resp %"SC_FORMAT_LEN_SIZE_T"u", apdu.resplen); if (apdu.resplen) { sc_log(ctx, "apdu.resp %02X:%02X:%02X...", apdu.resp[0], apdu.resp[1], apdu.resp[2]); switch (apdu.resp[0]) { case 0x62: case 0x6F: file = sc_file_new(); if (file == NULL) LOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY); file->path = lpath; rv = iasecc_process_fci(card, file, apdu.resp, apdu.resplen); if (rv) LOG_FUNC_RETURN(ctx, rv); break; default: LOG_FUNC_RETURN(ctx, SC_ERROR_UNKNOWN_DATA_RECEIVED); } sc_log(ctx, "FileType %i", file->type); if (file->type == SC_FILE_TYPE_DF) { if (card->cache.valid) sc_file_free(card->cache.current_df); card->cache.current_df = NULL; if (card->cache.valid) sc_file_free(card->cache.current_ef); card->cache.current_ef = NULL; sc_file_dup(&card->cache.current_df, file); card->cache.valid = 1; } else { if (card->cache.valid) sc_file_free(card->cache.current_ef); card->cache.current_ef = NULL; sc_file_dup(&card->cache.current_ef, file); } if (file_out) { sc_file_free(*file_out); *file_out = file; } else { sc_file_free(file); } } else if (lpath.type == SC_PATH_TYPE_DF_NAME) { sc_file_free(card->cache.current_df); card->cache.current_df = NULL; sc_file_free(card->cache.current_ef); card->cache.current_ef = NULL; card->cache.valid = 1; } } while(0); sc_print_cache(card); LOG_FUNC_RETURN(ctx, SC_SUCCESS); }
1
138,065
int get_user_pages_fast(unsigned long start, int nr_pages, int write, struct page **pages) { unsigned long addr, len, end; int nr = 0, ret = 0; start &= PAGE_MASK; addr = start; len = (unsigned long) nr_pages << PAGE_SHIFT; end = start + len; if (nr_pages <= 0) return 0; if (unlikely(!access_ok((void __user *)start, len))) return -EFAULT; if (gup_fast_permitted(start, nr_pages, write)) { local_irq_disable(); gup_pgd_range(addr, end, write, pages, &nr); local_irq_enable(); ret = nr; } if (nr < nr_pages) { /* Try to get the remaining pages with get_user_pages */ start += nr << PAGE_SHIFT; pages += nr; ret = get_user_pages_unlocked(start, nr_pages - nr, pages, write ? FOLL_WRITE : 0); /* Have to be a bit careful with return values */ if (nr > 0) { if (ret < 0) ret = nr; else ret += nr; } } return ret; }
0
68,729
GF_Err afra_box_read(GF_Box *s, GF_BitStream *bs) { unsigned int i; GF_AdobeFragRandomAccessBox *ptr = (GF_AdobeFragRandomAccessBox *)s; ISOM_DECREASE_SIZE(ptr, 9) ptr->long_ids = gf_bs_read_int(bs, 1); ptr->long_offsets = gf_bs_read_int(bs, 1); ptr->global_entries = gf_bs_read_int(bs, 1); ptr->reserved = gf_bs_read_int(bs, 5); ptr->time_scale = gf_bs_read_u32(bs); ptr->entry_count = gf_bs_read_u32(bs); if (ptr->size / ( (ptr->long_offsets ? 16 : 12) ) < ptr->entry_count) return GF_ISOM_INVALID_FILE; for (i=0; i<ptr->entry_count; i++) { GF_AfraEntry *ae = gf_malloc(sizeof(GF_AfraEntry)); if (!ae) return GF_OUT_OF_MEM; gf_list_insert(ptr->local_access_entries, ae, i); ISOM_DECREASE_SIZE(ptr, 8) ae->time = gf_bs_read_u64(bs); if (ptr->long_offsets) { ISOM_DECREASE_SIZE(ptr, 8) ae->offset = gf_bs_read_u64(bs); } else { ISOM_DECREASE_SIZE(ptr, 4) ae->offset = gf_bs_read_u32(bs); } } if (ptr->global_entries) { ISOM_DECREASE_SIZE(ptr, 4) ptr->global_entry_count = gf_bs_read_u32(bs); for (i=0; i<ptr->global_entry_count; i++) { GF_GlobalAfraEntry *ae = gf_malloc(sizeof(GF_GlobalAfraEntry)); if (!ae) return GF_OUT_OF_MEM; gf_list_insert(ptr->global_access_entries, ae, i); ISOM_DECREASE_SIZE(ptr, 8) ae->time = gf_bs_read_u64(bs); if (ptr->long_ids) { ISOM_DECREASE_SIZE(ptr, 8) ae->segment = gf_bs_read_u32(bs); ae->fragment = gf_bs_read_u32(bs); } else { ISOM_DECREASE_SIZE(ptr, 4) ae->segment = gf_bs_read_u16(bs); ae->fragment = gf_bs_read_u16(bs); } if (ptr->long_offsets) { ISOM_DECREASE_SIZE(ptr, 16) ae->afra_offset = gf_bs_read_u64(bs); ae->offset_from_afra = gf_bs_read_u64(bs); } else { ISOM_DECREASE_SIZE(ptr, 8) ae->afra_offset = gf_bs_read_u32(bs); ae->offset_from_afra = gf_bs_read_u32(bs); } } } return GF_OK; }
0
48,741
int config_error_nonbool(const char *var) { return error("Missing value for '%s'", var); }
0
385,685
ftp_rename(ftpbuf_t *ftp, const char *src, const char *dest) { if (ftp == NULL) { return 0; } if (!ftp_putcmd(ftp, "RNFR", src)) { return 0; } if (!ftp_getresp(ftp) || ftp->resp != 350) { return 0; } if (!ftp_putcmd(ftp, "RNTO", dest)) { return 0; } if (!ftp_getresp(ftp) || ftp->resp != 250) { return 0; } return 1; }
0
257,456
virLogPriority virLogGetDefaultPriority ( void ) { return virLogDefaultPriority ; }
0
49,916
search_param(char *name) { size_t b, e, i; int cmp; int len = strlen(name); for (b = 0, e = RC_table_size - 1; b <= e;) { i = (b + e) / 2; cmp = strncmp(name, RC_search_table[i].param->name, len); if (!cmp) { if (len >= RC_search_table[i].uniq_pos) { return RC_search_table[i].param; } else { while ((cmp = strcmp(name, RC_search_table[i].param->name)) <= 0) if (!cmp) return RC_search_table[i].param; else if (i == 0) return NULL; else i--; /* ambiguous */ return NULL; } } else if (cmp < 0) { if (i == 0) return NULL; e = i - 1; } else b = i + 1; } return NULL; }
0
206,032
void GDataFileSystem::TransferFileForResourceId( const FilePath& local_file_path, const FilePath& remote_dest_file_path, const FileOperationCallback& callback, std::string* resource_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(resource_id); DCHECK(!callback.is_null()); if (resource_id->empty()) { TransferRegularFile(local_file_path, remote_dest_file_path, callback); return; } CopyDocumentToDirectory( remote_dest_file_path.DirName(), *resource_id, remote_dest_file_path.BaseName().RemoveExtension().value(), callback); }
0
357,146
struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl) { struct scm_fp_list *new_fpl; int i; if (!fpl) return NULL; new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL); if (new_fpl) { INIT_LIST_HEAD(&new_fpl->list); for (i=fpl->count-1; i>=0; i--) get_file(fpl->fp[i]); memcpy(new_fpl, fpl, sizeof(*fpl)); } return new_fpl; }
0
159,323
static void testUmask077(CuTest *tc) { testUmask(tc, 0077, 0600); }
0
338,605
const char *avutil_configuration(void) { return FFMPEG_CONFIGURATION; }
0
472,156
STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp) { unsigned char *result; stbi__context s; stbi__start_mem(&s,buffer,len); result = (unsigned char*) stbi__load_gif_main(&s, delays, x, y, z, comp, req_comp); if (stbi__vertically_flip_on_load) { stbi__vertical_flip_slices( result, *x, *y, *z, *comp ); } return result; }
0
213,268
MagickExport void GetQuantizeInfo(QuantizeInfo *quantize_info) { (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); assert(quantize_info != (QuantizeInfo *) NULL); (void) ResetMagickMemory(quantize_info,0,sizeof(*quantize_info)); quantize_info->number_colors=256; quantize_info->dither=MagickTrue; quantize_info->dither_method=RiemersmaDitherMethod; quantize_info->colorspace=UndefinedColorspace; quantize_info->measure_error=MagickFalse; quantize_info->signature=MagickSignature; }
0
140,566
MagickExport Image *AddNoiseImage(const Image *image,const NoiseType noise_type, const double attenuate,ExceptionInfo *exception) { #define AddNoiseImageTag "AddNoise/Image" CacheView *image_view, *noise_view; Image *noise_image; MagickBooleanType status; MagickOffsetType progress; RandomInfo **magick_restrict random_info; ssize_t y; #if defined(MAGICKCORE_OPENMP_SUPPORT) unsigned long key; #endif /* Initialize noise image attributes. */ assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); #if defined(MAGICKCORE_OPENCL_SUPPORT) noise_image=AccelerateAddNoiseImage(image,noise_type,exception); if (noise_image != (Image *) NULL) return(noise_image); #endif noise_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception); if (noise_image == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(noise_image,DirectClass,exception) == MagickFalse) { noise_image=DestroyImage(noise_image); return((Image *) NULL); } /* Add noise in each row. */ status=MagickTrue; progress=0; random_info=AcquireRandomInfoThreadSet(); image_view=AcquireVirtualCacheView(image,exception); noise_view=AcquireAuthenticCacheView(noise_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) key=GetRandomSecretKey(random_info[0]); #pragma omp parallel for schedule(static,4) shared(progress,status) \ magick_threads(image,noise_image,image->rows,key == ~0UL) #endif for (y=0; y < (ssize_t) image->rows; y++) { const int id = GetOpenMPThreadId(); MagickBooleanType sync; register const Quantum *magick_restrict p; register ssize_t x; register Quantum *magick_restrict q; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); q=QueueCacheViewAuthenticPixels(noise_view,0,y,noise_image->columns,1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { register ssize_t i; for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel=GetPixelChannelChannel(image,i); PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait noise_traits=GetPixelChannelTraits(noise_image,channel); if ((traits == UndefinedPixelTrait) || (noise_traits == UndefinedPixelTrait)) continue; if (((noise_traits & CopyPixelTrait) != 0) || (GetPixelReadMask(image,p) == 0)) { SetPixelChannel(noise_image,channel,p[i],q); continue; } SetPixelChannel(noise_image,channel,ClampToQuantum( GenerateDifferentialNoise(random_info[id],p[i],noise_type,attenuate)), q); } p+=GetPixelChannels(image); q+=GetPixelChannels(noise_image); } sync=SyncCacheViewAuthenticPixels(noise_view,exception); if (sync == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_AddNoiseImage) #endif proceed=SetImageProgress(image,AddNoiseImageTag,progress++, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } noise_view=DestroyCacheView(noise_view); image_view=DestroyCacheView(image_view); random_info=DestroyRandomInfoThreadSet(random_info); if (status == MagickFalse) noise_image=DestroyImage(noise_image); return(noise_image); }
0
54,671
void rpc_put_task(struct rpc_task *task) { rpc_do_put_task(task, NULL); }
0
499,541
const char *RtmpProtocol::onSearchPacketTail(const char *data,size_t len){ //移动拷贝提高性能 auto next_step_func(std::move(_next_step_func)); //执行下一步 auto ret = next_step_func(data, len); if (!_next_step_func) { //为设置下一步,恢复之 next_step_func.swap(_next_step_func); } return ret; }
0
15,765
PyObject * PyString_AsDecodedString ( PyObject * str , const char * encoding , const char * errors ) { PyObject * v ; v = PyString_AsDecodedObject ( str , encoding , errors ) ; if ( v == NULL ) goto onError ; # ifdef Py_USING_UNICODE 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 , "decoder did not return a string object (type=%.400s)" , Py_TYPE ( v ) -> tp_name ) ; Py_DECREF ( v ) ; goto onError ; } return v ; onError : return NULL ; }
0
177,865
int PreProcessingLib_GetDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor) { if (pDescriptor == NULL || uuid == NULL){ return -EINVAL; } const effect_descriptor_t *desc = PreProc_GetDescriptor(uuid); if (desc == NULL) { ALOGV("PreProcessingLib_GetDescriptor() not found"); return -EINVAL; } ALOGV("PreProcessingLib_GetDescriptor() got fx %s", desc->name); *pDescriptor = *desc; return 0; }
0
306,914
PasswordStoreLoginsChangedObserver::PasswordStoreLoginsChangedObserver( AutomationProvider* automation, IPC::Message* reply_message, PasswordStoreChange::Type expected_type, const std::string& result_key) : automation_(automation->AsWeakPtr()), reply_message_(reply_message), expected_type_(expected_type), result_key_(result_key), done_event_(false, false) { AddRef(); }
0
299,567
static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf) { struct i40e_hw *hw = &pf->hw; u8 filter_index, type; u16 port; int i; if (!test_and_clear_bit(__I40E_UDP_FILTER_SYNC_PENDING, pf->state)) return; /* acquire RTNL to maintain state of flags and port requests */ rtnl_lock(); for (i = 0; i < I40E_MAX_PF_UDP_OFFLOAD_PORTS; i++) { if (pf->pending_udp_bitmap & BIT_ULL(i)) { struct i40e_udp_port_config *udp_port; i40e_status ret = 0; udp_port = &pf->udp_ports[i]; pf->pending_udp_bitmap &= ~BIT_ULL(i); port = READ_ONCE(udp_port->port); type = READ_ONCE(udp_port->type); filter_index = READ_ONCE(udp_port->filter_index); /* release RTNL while we wait on AQ command */ rtnl_unlock(); if (port) ret = i40e_aq_add_udp_tunnel(hw, port, type, &filter_index, NULL); else if (filter_index != I40E_UDP_PORT_INDEX_UNUSED) ret = i40e_aq_del_udp_tunnel(hw, filter_index, NULL); /* reacquire RTNL so we can update filter_index */ rtnl_lock(); if (ret) { dev_info(&pf->pdev->dev, "%s %s port %d, index %d failed, err %s aq_err %s\n", i40e_tunnel_name(type), port ? "add" : "delete", port, filter_index, i40e_stat_str(&pf->hw, ret), i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); if (port) { /* failed to add, just reset port, * drop pending bit for any deletion */ udp_port->port = 0; pf->pending_udp_bitmap &= ~BIT_ULL(i); } } else if (port) { /* record filter index on success */ udp_port->filter_index = filter_index; } } } rtnl_unlock(); }
0
38,459
static struct sk_filter *__sk_migrate_realloc(struct sk_filter *fp, struct sock *sk, unsigned int len) { struct sk_filter *fp_new; if (sk == NULL) return krealloc(fp, len, GFP_KERNEL); fp_new = sock_kmalloc(sk, len, GFP_KERNEL); if (fp_new) { memcpy(fp_new, fp, sizeof(struct sk_filter)); /* As we're kepping orig_prog in fp_new along, * we need to make sure we're not evicting it * from the old fp. */ fp->orig_prog = NULL; sk_filter_uncharge(sk, fp); } return fp_new; }
0
242,892
static req_table_t* req_subprocess_env(request_rec *r) { req_table_t* t = apr_palloc(r->pool, sizeof(req_table_t)); t->r = r; t->t = r->subprocess_env; t->n = "subprocess_env"; return t; }
0
489,360
GF_Err def_parent_full_box_dump(GF_Box *a, FILE *trace) { char *name = "GenericFullBox"; switch (a->type) { case GF_ISOM_BOX_TYPE_MVCI: name = "MultiviewInformationBox"; break; } gf_isom_box_dump_start(a, name, trace); gf_fprintf(trace, ">\n"); gf_isom_box_dump_done(name, a, trace); return GF_OK; }
0
195,917
bool StartupBrowserCreator::LaunchBrowser( const base::CommandLine& command_line, Profile* profile, const base::FilePath& cur_dir, chrome::startup::IsProcessStartup process_startup, chrome::startup::IsFirstRun is_first_run) { DCHECK(profile); in_synchronous_profile_launch_ = process_startup == chrome::startup::IS_PROCESS_STARTUP; if (IncognitoModePrefs::ShouldLaunchIncognito(command_line, profile->GetPrefs())) { profile = profile->GetOffTheRecordProfile(); } else if (command_line.HasSwitch(switches::kIncognito)) { LOG(WARNING) << "Incognito mode disabled by policy, launching a normal " << "browser session."; } if (IsGuestModeEnforced(command_line, /* show_warning= */ true)) { profile = g_browser_process->profile_manager() ->GetProfile(ProfileManager::GetGuestProfilePath()) ->GetOffTheRecordProfile(); } #if defined(OS_WIN) if (command_line.HasSwitch(credential_provider::kGcpwSigninSwitch)) profile = profile->GetOffTheRecordProfile(); #endif if (!IsSilentLaunchEnabled(command_line, profile)) { StartupBrowserCreatorImpl lwp(cur_dir, command_line, this, is_first_run); const std::vector<GURL> urls_to_launch = GetURLsFromCommandLine(command_line, cur_dir, profile); const bool launched = lwp.Launch(profile, urls_to_launch, in_synchronous_profile_launch_); in_synchronous_profile_launch_ = false; if (!launched) { LOG(ERROR) << "launch error"; return false; } } else { in_synchronous_profile_launch_ = false; } profile_launch_observer.Get().AddLaunched(profile); return true; }
0
13,521
status_t OMXNodeInstance::updateNativeHandleInMeta( OMX_U32 portIndex, const sp<NativeHandle>& nativeHandle, OMX::buffer_id buffer) { Mutex::Autolock autoLock(mLock); OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer, portIndex); if (header == NULL) { ALOGE("b/25884056"); return BAD_VALUE; } if (portIndex != kPortIndexInput && portIndex != kPortIndexOutput) { return BAD_VALUE; } BufferMeta *bufferMeta = (BufferMeta *)(header->pAppPrivate); sp<ABuffer> data = bufferMeta->getBuffer( header, false /* backup */, false /* limit */); bufferMeta->setNativeHandle(nativeHandle); if (mMetadataType[portIndex] == kMetadataBufferTypeNativeHandleSource && data->capacity() >= sizeof(VideoNativeHandleMetadata)) { VideoNativeHandleMetadata &metadata = *(VideoNativeHandleMetadata *)(data->data()); metadata.eType = mMetadataType[portIndex]; metadata.pHandle = nativeHandle == NULL ? NULL : const_cast<native_handle*>(nativeHandle->handle()); } else { CLOG_ERROR(updateNativeHandleInMeta, BAD_VALUE, "%s:%u, %#x bad type (%d) or size (%zu)", portString(portIndex), portIndex, buffer, mMetadataType[portIndex], data->capacity()); return BAD_VALUE; } CLOG_BUFFER(updateNativeHandleInMeta, "%s:%u, %#x := %p", portString(portIndex), portIndex, buffer, nativeHandle == NULL ? NULL : nativeHandle->handle()); return OK; }
1
419,808
static int setup_raw_socket(RemoteServer *s, const char *address) { int fd; fd = make_socket_fd(LOG_INFO, address, SOCK_STREAM, SOCK_CLOEXEC); if (fd < 0) return fd; return journal_remote_add_raw_socket(s, fd); }
0
22,249
int i2d_ECPrivateKey ( EC_KEY * a , unsigned char * * out ) { int ret = 0 , ok = 0 ; unsigned char * buffer = NULL ; size_t buf_len = 0 , tmp_len ; EC_PRIVATEKEY * priv_key = NULL ; if ( a == NULL || a -> group == NULL || a -> priv_key == NULL ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_PASSED_NULL_PARAMETER ) ; goto err ; } if ( ( priv_key = EC_PRIVATEKEY_new ( ) ) == NULL ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_MALLOC_FAILURE ) ; goto err ; } priv_key -> version = a -> version ; buf_len = ( size_t ) BN_num_bytes ( a -> priv_key ) ; buffer = OPENSSL_malloc ( buf_len ) ; if ( buffer == NULL ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_MALLOC_FAILURE ) ; goto err ; } if ( ! BN_bn2bin ( a -> priv_key , buffer ) ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_BN_LIB ) ; goto err ; } if ( ! M_ASN1_OCTET_STRING_set ( priv_key -> privateKey , buffer , buf_len ) ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_ASN1_LIB ) ; goto err ; } if ( ! ( a -> enc_flag & EC_PKEY_NO_PARAMETERS ) ) { if ( ( priv_key -> parameters = ec_asn1_group2pkparameters ( a -> group , priv_key -> parameters ) ) == NULL ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_EC_LIB ) ; goto err ; } } if ( ! ( a -> enc_flag & EC_PKEY_NO_PUBKEY ) ) { priv_key -> publicKey = M_ASN1_BIT_STRING_new ( ) ; if ( priv_key -> publicKey == NULL ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_MALLOC_FAILURE ) ; goto err ; } tmp_len = EC_POINT_point2oct ( a -> group , a -> pub_key , a -> conv_form , NULL , 0 , NULL ) ; if ( tmp_len > buf_len ) { unsigned char * tmp_buffer = OPENSSL_realloc ( buffer , tmp_len ) ; if ( ! tmp_buffer ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_MALLOC_FAILURE ) ; goto err ; } buffer = tmp_buffer ; buf_len = tmp_len ; } if ( ! EC_POINT_point2oct ( a -> group , a -> pub_key , a -> conv_form , buffer , buf_len , NULL ) ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_EC_LIB ) ; goto err ; } priv_key -> publicKey -> flags &= ~ ( ASN1_STRING_FLAG_BITS_LEFT | 0x07 ) ; priv_key -> publicKey -> flags |= ASN1_STRING_FLAG_BITS_LEFT ; if ( ! M_ASN1_BIT_STRING_set ( priv_key -> publicKey , buffer , buf_len ) ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_ASN1_LIB ) ; goto err ; } } if ( ( ret = i2d_EC_PRIVATEKEY ( priv_key , out ) ) == 0 ) { ECerr ( EC_F_I2D_ECPRIVATEKEY , ERR_R_EC_LIB ) ; goto err ; } ok = 1 ; err : if ( buffer ) OPENSSL_free ( buffer ) ; if ( priv_key ) EC_PRIVATEKEY_free ( priv_key ) ; return ( ok ? ret : 0 ) ; }
0
127,225
auth_check2( httpd_conn* hc, char* dirname ) { static char* authpath; static size_t maxauthpath = 0; struct stat sb; char authinfo[500]; char* authpass; char* colon; int l; FILE* fp; char line[500]; char* cryp; static char* prevauthpath; static size_t maxprevauthpath = 0; static time_t prevmtime; static char* prevuser; static size_t maxprevuser = 0; static char* prevcryp; static size_t maxprevcryp = 0; char *crypt_result; /* Construct auth filename. */ httpd_realloc_str( &authpath, &maxauthpath, strlen( dirname ) + 1 + sizeof(AUTH_FILE) ); (void) my_snprintf( authpath, maxauthpath, "%s/%s", dirname, AUTH_FILE ); /* Does this directory have an auth file? */ if ( stat( authpath, &sb ) < 0 ) /* Nope, let the request go through. */ return 0; /* Does this request contain basic authorization info? */ if ( hc->authorization[0] == '\0' || strncmp( hc->authorization, "Basic ", 6 ) != 0 ) { /* Nope, return a 401 Unauthorized. */ send_authenticate( hc, dirname ); return -1; } /* Decode it. */ l = b64_decode( &(hc->authorization[6]), (unsigned char*) authinfo, sizeof(authinfo) - 1 ); authinfo[l] = '\0'; /* Split into user and password. */ authpass = strchr( authinfo, ':' ); if ( authpass == (char*) 0 ) { /* No colon? Bogus auth info. */ send_authenticate( hc, dirname ); return -1; } *authpass++ = '\0'; /* If there are more fields, cut them off. */ colon = strchr( authpass, ':' ); if ( colon != (char*) 0 ) *colon = '\0'; /* See if we have a cached entry and can use it. */ if ( maxprevauthpath != 0 && strcmp( authpath, prevauthpath ) == 0 && sb.st_mtime == prevmtime && strcmp( authinfo, prevuser ) == 0 ) { /* Yes. Check against the cached encrypted password. */ crypt_result = crypt( authpass, prevcryp ); if ( ! crypt_result ) return -1; if ( strcmp( crypt_result, prevcryp ) == 0 ) { /* Ok! */ httpd_realloc_str( &hc->remoteuser, &hc->maxremoteuser, strlen( authinfo ) ); (void) strcpy( hc->remoteuser, authinfo ); return 1; } else { /* No. */ send_authenticate( hc, dirname ); return -1; } } /* Open the password file. */ fp = fopen( authpath, "r" ); if ( fp == (FILE*) 0 ) { /* The file exists but we can't open it? Disallow access. */ syslog( LOG_ERR, "%.80s auth file %.80s could not be opened - %m", httpd_ntoa( &hc->client_addr ), authpath ); httpd_send_err( hc, 403, err403title, "", ERROR_FORM( err403form, "The requested URL '%.80s' is protected by an authentication file, but the authentication file cannot be opened.\n" ), hc->encodedurl ); return -1; } /* Read it. */ while ( fgets( line, sizeof(line), fp ) != (char*) 0 ) { /* Nuke newline. */ l = strlen( line ); if ( line[l - 1] == '\n' ) line[l - 1] = '\0'; /* Split into user and encrypted password. */ cryp = strchr( line, ':' ); if ( cryp == (char*) 0 ) continue; *cryp++ = '\0'; /* Is this the right user? */ if ( strcmp( line, authinfo ) == 0 ) { /* Yes. */ (void) fclose( fp ); /* So is the password right? */ crypt_result = crypt( authpass, cryp ); if ( ! crypt_result ) return -1; if ( strcmp( crypt_result, cryp ) == 0 ) { /* Ok! */ httpd_realloc_str( &hc->remoteuser, &hc->maxremoteuser, strlen( line ) ); (void) strcpy( hc->remoteuser, line ); /* And cache this user's info for next time. */ httpd_realloc_str( &prevauthpath, &maxprevauthpath, strlen( authpath ) ); (void) strcpy( prevauthpath, authpath ); prevmtime = sb.st_mtime; httpd_realloc_str( &prevuser, &maxprevuser, strlen( authinfo ) ); (void) strcpy( prevuser, authinfo ); httpd_realloc_str( &prevcryp, &maxprevcryp, strlen( cryp ) ); (void) strcpy( prevcryp, cryp ); return 1; } else { /* No. */ send_authenticate( hc, dirname ); return -1; } } } /* Didn't find that user. Access denied. */ (void) fclose( fp ); send_authenticate( hc, dirname ); return -1; }
0
72,058
service_info *FindServiceControlURLPath( service_table *table, const char *controlURLPath) { service_info *finger = NULL; uri_type parsed_url; uri_type parsed_url_in; if (!table || !controlURLPath) { return NULL; } if (parse_uri(controlURLPath, strlen(controlURLPath), &parsed_url_in) == HTTP_SUCCESS) { finger = table->serviceList; while (finger) { if (finger->controlURL) { if (parse_uri(finger->controlURL, strlen(finger->controlURL), &parsed_url) == HTTP_SUCCESS) { if (!token_cmp(&parsed_url.pathquery, &parsed_url_in.pathquery)) { return finger; } } } finger = finger->next; } } return NULL; }
0
249,740
void WebContentsImpl::OnUpdateZoomLimits(RenderViewHostImpl* source, int minimum_percent, int maximum_percent) { minimum_zoom_percent_ = minimum_percent; maximum_zoom_percent_ = maximum_percent; }
0
215,931
xmlBufDetach(xmlBufPtr buf) { xmlChar *ret; if (buf == NULL) return(NULL); if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(NULL); if (buf->buffer != NULL) return(NULL); if (buf->error) return(NULL); ret = buf->content; buf->content = NULL; buf->size = 0; buf->use = 0; buf->compat_use = 0; buf->compat_size = 0; return ret; }
0
132,972
static void FVSelectColor(FontView *fv, uint32 col, int merge) { int i, doit; uint32 sccol; SplineChar **glyphs = fv->b.sf->glyphs; for ( i=0; i<fv->b.map->enccount; ++i ) { int gid = fv->b.map->map[i]; sccol = ( gid==-1 || glyphs[gid]==NULL ) ? COLOR_DEFAULT : glyphs[gid]->color; doit = sccol==col; fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; } GDrawRequestExpose(fv->v,NULL,false); }
0
153,426
filter_result_disconnect(uint64_t reqid, const char *message) { m_create(p_pony, IMSG_FILTER_SMTP_PROTOCOL, 0, 0, -1); m_add_id(p_pony, reqid); m_add_int(p_pony, FILTER_DISCONNECT); m_add_string(p_pony, message); m_close(p_pony); }
0
87,596
static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt, u16 tss_selector, int idt_index, int reason, bool has_error_code, u32 error_code) { const struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct curr_tss_desc, next_tss_desc; int ret; u16 old_tss_sel = get_segment_selector(ctxt, VCPU_SREG_TR); ulong old_tss_base = ops->get_cached_segment_base(ctxt, VCPU_SREG_TR); u32 desc_limit; ulong desc_addr, dr7; /* FIXME: old_tss_base == ~0 ? */ ret = read_segment_descriptor(ctxt, tss_selector, &next_tss_desc, &desc_addr); if (ret != X86EMUL_CONTINUE) return ret; ret = read_segment_descriptor(ctxt, old_tss_sel, &curr_tss_desc, &desc_addr); if (ret != X86EMUL_CONTINUE) return ret; /* FIXME: check that next_tss_desc is tss */ /* * Check privileges. The three cases are task switch caused by... * * 1. jmp/call/int to task gate: Check against DPL of the task gate * 2. Exception/IRQ/iret: No check is performed * 3. jmp/call to TSS/task-gate: No check is performed since the * hardware checks it before exiting. */ if (reason == TASK_SWITCH_GATE) { if (idt_index != -1) { /* Software interrupts */ struct desc_struct task_gate_desc; int dpl; ret = read_interrupt_descriptor(ctxt, idt_index, &task_gate_desc); if (ret != X86EMUL_CONTINUE) return ret; dpl = task_gate_desc.dpl; if ((tss_selector & 3) > dpl || ops->cpl(ctxt) > dpl) return emulate_gp(ctxt, (idt_index << 3) | 0x2); } } desc_limit = desc_limit_scaled(&next_tss_desc); if (!next_tss_desc.p || ((desc_limit < 0x67 && (next_tss_desc.type & 8)) || desc_limit < 0x2b)) { return emulate_ts(ctxt, tss_selector & 0xfffc); } if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { curr_tss_desc.type &= ~(1 << 1); /* clear busy flag */ write_segment_descriptor(ctxt, old_tss_sel, &curr_tss_desc); } if (reason == TASK_SWITCH_IRET) ctxt->eflags = ctxt->eflags & ~X86_EFLAGS_NT; /* set back link to prev task only if NT bit is set in eflags note that old_tss_sel is not used after this point */ if (reason != TASK_SWITCH_CALL && reason != TASK_SWITCH_GATE) old_tss_sel = 0xffff; if (next_tss_desc.type & 8) ret = task_switch_32(ctxt, tss_selector, old_tss_sel, old_tss_base, &next_tss_desc); else ret = task_switch_16(ctxt, tss_selector, old_tss_sel, old_tss_base, &next_tss_desc); if (ret != X86EMUL_CONTINUE) return ret; if (reason == TASK_SWITCH_CALL || reason == TASK_SWITCH_GATE) ctxt->eflags = ctxt->eflags | X86_EFLAGS_NT; if (reason != TASK_SWITCH_IRET) { next_tss_desc.type |= (1 << 1); /* set busy flag */ write_segment_descriptor(ctxt, tss_selector, &next_tss_desc); } ops->set_cr(ctxt, 0, ops->get_cr(ctxt, 0) | X86_CR0_TS); ops->set_segment(ctxt, tss_selector, &next_tss_desc, 0, VCPU_SREG_TR); if (has_error_code) { ctxt->op_bytes = ctxt->ad_bytes = (next_tss_desc.type & 8) ? 4 : 2; ctxt->lock_prefix = 0; ctxt->src.val = (unsigned long) error_code; ret = em_push(ctxt); } ops->get_dr(ctxt, 7, &dr7); ops->set_dr(ctxt, 7, dr7 & ~(DR_LOCAL_ENABLE_MASK | DR_LOCAL_SLOWDOWN)); return ret; }
0
120,802
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { // Just copy input to output. const TfLiteTensor* input; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInput, &input)); TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &output)); const TfLiteTensor* axis; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kAxis, &axis)); if (IsDynamicTensor(output)) { int axis_value; TF_LITE_ENSURE_OK(context, GetAxisValueFromTensor(context, *axis, &axis_value)); TF_LITE_ENSURE_OK(context, ExpandTensorDim(context, *input, axis_value, output)); } if (output->type == kTfLiteString) { TfLiteTensorRealloc(input->bytes, output); } memcpy(output->data.raw, input->data.raw, input->bytes); return kTfLiteOk; }
0
339,981
void load_seg(int seg_reg, int selector) { SegmentCache *sc; SegmentDescriptorTable *dt; int index; uint32_t e1, e2; uint8_t *ptr; env->segs[seg_reg] = selector; sc = &env->seg_cache[seg_reg]; if (env->eflags & VM_MASK) { sc->base = (void *)(selector << 4); sc->limit = 0xffff; sc->seg_32bit = 0; } else { if (selector & 0x4) dt = &env->ldt; else dt = &env->gdt; index = selector & ~7; if ((index + 7) > dt->limit) raise_exception_err(EXCP0D_GPF, selector); ptr = dt->base + index; e1 = ldl(ptr); e2 = ldl(ptr + 4); sc->base = (void *)((e1 >> 16) | ((e2 & 0xff) << 16) | (e2 & 0xff000000)); sc->limit = (e1 & 0xffff) | (e2 & 0x000f0000); if (e2 & (1 << 23)) sc->limit = (sc->limit << 12) | 0xfff; sc->seg_32bit = (e2 >> 22) & 1; #if 0 fprintf(logfile, "load_seg: sel=0x%04x base=0x%08lx limit=0x%08lx seg_32bit=%d\n", selector, (unsigned long)sc->base, sc->limit, sc->seg_32bit); #endif } }
0
348,619
static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr, char *buf, unsigned int bug) { if (!boot_cpu_has_bug(bug)) return sprintf(buf, "Not affected\n"); switch (bug) { case X86_BUG_CPU_MELTDOWN: if (boot_cpu_has(X86_FEATURE_PTI)) return sprintf(buf, "Mitigation: PTI\n"); if (hypervisor_is_type(X86_HYPER_XEN_PV)) return sprintf(buf, "Unknown (XEN PV detected, hypervisor mitigation required)\n"); break; case X86_BUG_SPECTRE_V1: return sprintf(buf, "Mitigation: __user pointer sanitization\n"); case X86_BUG_SPECTRE_V2: return sprintf(buf, "%s%s%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled], ibpb_state(), boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", IBRS_FW" : "", stibp_state(), boot_cpu_has(X86_FEATURE_RSB_CTXSW) ? ", RSB filling" : "", spectre_v2_module_string()); case X86_BUG_SPEC_STORE_BYPASS: return sprintf(buf, "%s\n", ssb_strings[ssb_mode]); case X86_BUG_L1TF: if (boot_cpu_has(X86_FEATURE_L1TF_PTEINV)) return l1tf_show_state(buf); break; case X86_BUG_MDS: return mds_show_state(buf); default: break; } return sprintf(buf, "Vulnerable\n"); }
1
481,345
findCharacterClass(const CharsString *name, const TranslationTableHeader *table) { /* Find a character class, whether predefined or user-defined */ const CharacterClass *class = table->characterClasses; while (class) { if ((name->length == class->length) && (memcmp(&name->chars[0], class->name, CHARSIZE * name->length) == 0)) return class; class = class->next; } return NULL; }
0
195,682
transform_info_imp(transform_display *dp, png_structp pp, png_infop pi) { /* Reuse the standard stuff as appropriate. */ standard_info_part1(&dp->this, pp, pi); /* Now set the list of transforms. */ dp->transform_list->set(dp->transform_list, dp, pp, pi); /* Update the info structure for these transforms: */ { int i = dp->this.use_update_info; /* Always do one call, even if use_update_info is 0. */ do png_read_update_info(pp, pi); while (--i > 0); } /* And get the output information into the standard_display */ standard_info_part2(&dp->this, pp, pi, 1/*images*/); /* Plus the extra stuff we need for the transform tests: */ dp->output_colour_type = png_get_color_type(pp, pi); dp->output_bit_depth = png_get_bit_depth(pp, pi); /* If png_set_filler is in action then fake the output color type to include * an alpha channel where appropriate. */ if (dp->output_bit_depth >= 8 && (dp->output_colour_type == PNG_COLOR_TYPE_RGB || dp->output_colour_type == PNG_COLOR_TYPE_GRAY) && dp->this.filler) dp->output_colour_type |= 4; /* Validate the combination of colour type and bit depth that we are getting * out of libpng; the semantics of something not in the PNG spec are, at * best, unclear. */ switch (dp->output_colour_type) { case PNG_COLOR_TYPE_PALETTE: if (dp->output_bit_depth > 8) goto error; /*FALL THROUGH*/ case PNG_COLOR_TYPE_GRAY: if (dp->output_bit_depth == 1 || dp->output_bit_depth == 2 || dp->output_bit_depth == 4) break; /*FALL THROUGH*/ default: if (dp->output_bit_depth == 8 || dp->output_bit_depth == 16) break; /*FALL THROUGH*/ error: { char message[128]; size_t pos; pos = safecat(message, sizeof message, 0, "invalid final bit depth: colour type("); pos = safecatn(message, sizeof message, pos, dp->output_colour_type); pos = safecat(message, sizeof message, pos, ") with bit depth: "); pos = safecatn(message, sizeof message, pos, dp->output_bit_depth); png_error(pp, message); } } /* Use a test pixel to check that the output agrees with what we expect - * this avoids running the whole test if the output is unexpected. This also * checks for internal errors. */ { image_pixel test_pixel; memset(&test_pixel, 0, sizeof test_pixel); test_pixel.colour_type = dp->this.colour_type; /* input */ test_pixel.bit_depth = dp->this.bit_depth; if (test_pixel.colour_type == PNG_COLOR_TYPE_PALETTE) test_pixel.sample_depth = 8; else test_pixel.sample_depth = test_pixel.bit_depth; /* Don't need sBIT here, but it must be set to non-zero to avoid * arithmetic overflows. */ test_pixel.have_tRNS = dp->this.is_transparent != 0; test_pixel.red_sBIT = test_pixel.green_sBIT = test_pixel.blue_sBIT = test_pixel.alpha_sBIT = test_pixel.sample_depth; dp->transform_list->mod(dp->transform_list, &test_pixel, pp, dp); if (test_pixel.colour_type != dp->output_colour_type) { char message[128]; size_t pos = safecat(message, sizeof message, 0, "colour type "); pos = safecatn(message, sizeof message, pos, dp->output_colour_type); pos = safecat(message, sizeof message, pos, " expected "); pos = safecatn(message, sizeof message, pos, test_pixel.colour_type); png_error(pp, message); } if (test_pixel.bit_depth != dp->output_bit_depth) { char message[128]; size_t pos = safecat(message, sizeof message, 0, "bit depth "); pos = safecatn(message, sizeof message, pos, dp->output_bit_depth); pos = safecat(message, sizeof message, pos, " expected "); pos = safecatn(message, sizeof message, pos, test_pixel.bit_depth); png_error(pp, message); } /* If both bit depth and colour type are correct check the sample depth. */ if (test_pixel.colour_type == PNG_COLOR_TYPE_PALETTE && test_pixel.sample_depth != 8) /* oops - internal error! */ png_error(pp, "pngvalid: internal: palette sample depth not 8"); else if (dp->unpacked && test_pixel.bit_depth != 8) png_error(pp, "pngvalid: internal: bad unpacked pixel depth"); else if (!dp->unpacked && test_pixel.colour_type != PNG_COLOR_TYPE_PALETTE && test_pixel.bit_depth != test_pixel.sample_depth) { char message[128]; size_t pos = safecat(message, sizeof message, 0, "internal: sample depth "); /* Because unless something has set 'unpacked' or the image is palette * mapped we expect the transform to keep sample depth and bit depth * the same. */ pos = safecatn(message, sizeof message, pos, test_pixel.sample_depth); pos = safecat(message, sizeof message, pos, " expected "); pos = safecatn(message, sizeof message, pos, test_pixel.bit_depth); png_error(pp, message); } else if (test_pixel.bit_depth != dp->output_bit_depth) { /* This could be a libpng error too; libpng has not produced what we * expect for the output bit depth. */ char message[128]; size_t pos = safecat(message, sizeof message, 0, "internal: bit depth "); pos = safecatn(message, sizeof message, pos, dp->output_bit_depth); pos = safecat(message, sizeof message, pos, " expected "); pos = safecatn(message, sizeof message, pos, test_pixel.bit_depth); png_error(pp, message); } } }
0
286,230
void AudioFlinger::EffectChain::process_l() { sp<ThreadBase> thread = mThread.promote(); if (thread == 0) { ALOGW("process_l(): cannot promote mixer thread"); return; } bool isGlobalSession = (mSessionId == AUDIO_SESSION_OUTPUT_MIX) || (mSessionId == AUDIO_SESSION_OUTPUT_STAGE); bool doProcess = (thread->type() != ThreadBase::OFFLOAD); if (!isGlobalSession) { bool tracksOnSession = (trackCnt() != 0); if (!tracksOnSession && mTailBufferCount == 0) { doProcess = false; } if (activeTrackCnt() == 0) { if (tracksOnSession || mTailBufferCount > 0) { clearInputBuffer_l(thread); if (mTailBufferCount > 0) { mTailBufferCount--; } } } } size_t size = mEffects.size(); if (doProcess) { for (size_t i = 0; i < size; i++) { mEffects[i]->process(); } } for (size_t i = 0; i < size; i++) { mEffects[i]->updateState(); } }
0
67,884
int64 KaxInternalBlock::GetFrameSize(size_t FrameNumber) { int64 _Result = -1; if (/*bValueIsSet &&*/ FrameNumber < SizeList.size()) { _Result = SizeList[FrameNumber]; } return _Result; }
0
270,125
static void crypto_exit_shash_ops_compat(struct crypto_tfm *tfm) { struct shash_desc **descp = crypto_tfm_ctx(tfm); struct shash_desc *desc = *descp; crypto_free_shash(desc->tfm); kzfree(desc); }
0
322,327
static void text_console_resize(QemuConsole *s) { TextCell *cells, *c, *c1; int w1, x, y, last_width; last_width = s->width; s->width = surface_width(s->surface) / FONT_WIDTH; s->height = surface_height(s->surface) / FONT_HEIGHT; w1 = last_width; if (s->width < w1) w1 = s->width; cells = g_malloc(s->width * s->total_height * sizeof(TextCell)); for(y = 0; y < s->total_height; y++) { c = &cells[y * s->width]; if (w1 > 0) { c1 = &s->cells[y * last_width]; for(x = 0; x < w1; x++) { *c++ = *c1++; } } for(x = w1; x < s->width; x++) { c->ch = ' '; c->t_attrib = s->t_attrib_default; c++; } } g_free(s->cells); s->cells = cells; }
1
520,707
virtual bool with_subquery() const { return (*ref)->with_subquery(); }
0
42,680
UnicodeStringTest::TestSpacePadding() { UnicodeString test1("hello"); UnicodeString test2(" there"); UnicodeString test3("Hi! How ya doin'? Beautiful day, isn't it?"); UnicodeString test4; UBool returnVal; UnicodeString expectedValue; returnVal = test1.padLeading(15); expectedValue = " hello"; if (returnVal == FALSE || test1 != expectedValue) errln("padLeading() failed: expected \"" + expectedValue + "\", got \"" + test1 + "\"."); returnVal = test2.padTrailing(15); expectedValue = " there "; if (returnVal == FALSE || test2 != expectedValue) errln("padTrailing() failed: expected \"" + expectedValue + "\", got \"" + test2 + "\"."); expectedValue = test3; returnVal = test3.padTrailing(15); if (returnVal == TRUE || test3 != expectedValue) errln("padTrailing() failed: expected \"" + expectedValue + "\", got \"" + test3 + "\"."); expectedValue = "hello"; test4.setTo(test1).trim(); if (test4 != expectedValue || test1 == expectedValue || test4 != expectedValue) errln("trim(UnicodeString&) failed"); test1.trim(); if (test1 != expectedValue) errln("trim() failed: expected \"" + expectedValue + "\", got \"" + test1 + "\"."); test2.trim(); expectedValue = "there"; if (test2 != expectedValue) errln("trim() failed: expected \"" + expectedValue + "\", got \"" + test2 + "\"."); test3.trim(); expectedValue = "Hi! How ya doin'? Beautiful day, isn't it?"; if (test3 != expectedValue) errln("trim() failed: expected \"" + expectedValue + "\", got \"" + test3 + "\"."); returnVal = test1.truncate(15); expectedValue = "hello"; if (returnVal == TRUE || test1 != expectedValue) errln("truncate() failed: expected \"" + expectedValue + "\", got \"" + test1 + "\"."); returnVal = test2.truncate(15); expectedValue = "there"; if (returnVal == TRUE || test2 != expectedValue) errln("truncate() failed: expected \"" + expectedValue + "\", got \"" + test2 + "\"."); returnVal = test3.truncate(15); expectedValue = "Hi! How ya doi"; if (returnVal == FALSE || test3 != expectedValue) errln("truncate() failed: expected \"" + expectedValue + "\", got \"" + test3 + "\"."); }
0
470,671
static struct htab_elem *prealloc_lru_pop(struct bpf_htab *htab, void *key, u32 hash) { struct bpf_lru_node *node = bpf_lru_pop_free(&htab->lru, hash); struct htab_elem *l; if (node) { l = container_of(node, struct htab_elem, lru_node); memcpy(l->key, key, htab->map.key_size); return l; } return NULL; }
0
473,343
static void bpf_prog_put_deferred(struct work_struct *work) { struct bpf_prog_aux *aux; struct bpf_prog *prog; aux = container_of(work, struct bpf_prog_aux, work); prog = aux->prog; perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_UNLOAD, 0); bpf_audit_prog(prog, BPF_AUDIT_UNLOAD); __bpf_prog_put_noref(prog, true); }
0
32,740
max3421_set_speed(struct usb_hcd *hcd, struct usb_device *dev) { struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); u8 mode_lowspeed, mode_hubpre, mode = max3421_hcd->mode; mode_lowspeed = BIT(MAX3421_MODE_LOWSPEED_BIT); mode_hubpre = BIT(MAX3421_MODE_HUBPRE_BIT); if (max3421_hcd->port_status & USB_PORT_STAT_LOW_SPEED) { mode |= mode_lowspeed; mode &= ~mode_hubpre; } else if (dev->speed == USB_SPEED_LOW) { mode |= mode_lowspeed | mode_hubpre; } else { mode &= ~(mode_lowspeed | mode_hubpre); } if (mode != max3421_hcd->mode) { max3421_hcd->mode = mode; spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode); } }
0
333,313
int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { AVProbeData pd = { filename ? filename : "", NULL, -offset }; unsigned char *buf = NULL; int ret = 0, probe_size; if (!max_probe_size) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size > PROBE_BUF_MAX) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size < PROBE_BUF_MIN) { return AVERROR(EINVAL); } if (offset >= max_probe_size) { return AVERROR(EINVAL); } for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt; probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) { int score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0; int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1; void *buftmp; if (probe_size < offset) { continue; } /* read probe data */ buftmp = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE); if(!buftmp){ av_free(buf); return AVERROR(ENOMEM); } buf=buftmp; if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) { /* fail if error was not end of file, otherwise, lower score */ if (ret != AVERROR_EOF) { av_free(buf); return ret; } score = 0; ret = 0; /* error was end of file, nothing read */ } pd.buf_size += ret; pd.buf = &buf[offset]; memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE); /* guess file format */ *fmt = av_probe_input_format2(&pd, 1, &score); if(*fmt){ if(score <= AVPROBE_SCORE_RETRY){ //this can only be true in the last iteration av_log(logctx, AV_LOG_WARNING, "Format %s detected only with low score of %d, misdetection possible!\n", (*fmt)->name, score); }else av_log(logctx, AV_LOG_DEBUG, "Format %s probed with size=%d and score=%d\n", (*fmt)->name, probe_size, score); } } if (!*fmt) { av_free(buf); return AVERROR_INVALIDDATA; } /* rewind. reuse probe buffer to avoid seeking */ if ((ret = ffio_rewind_with_probe_data(pb, buf, pd.buf_size)) < 0) av_free(buf); return ret; }
1
474,820
static void __exit af_unix_exit(void) { sock_unregister(PF_UNIX); proto_unregister(&unix_dgram_proto); proto_unregister(&unix_stream_proto); unregister_pernet_subsys(&unix_net_ops); }
0
35,823
int main(int argc, const char **argv) { DCRaw *d = new DCRaw; return d->main(argc, argv); }
0
245,252
void AddSearchEnginesStrings(content::WebUIDataSource* html_source) { LocalizedString localized_strings[] = { {"searchEnginesPageTitle", IDS_SETTINGS_SEARCH_ENGINES}, {"searchEnginesAddSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_ADD_SEARCH_ENGINE}, {"searchEnginesEditSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_EDIT_SEARCH_ENGINE}, {"searchEngines", IDS_SETTINGS_SEARCH_ENGINES}, {"searchEnginesDefault", IDS_SETTINGS_SEARCH_ENGINES_DEFAULT_ENGINES}, {"searchEnginesOther", IDS_SETTINGS_SEARCH_ENGINES_OTHER_ENGINES}, {"searchEnginesNoOtherEngines", IDS_SETTINGS_SEARCH_ENGINES_NO_OTHER_ENGINES}, {"searchEnginesExtension", IDS_SETTINGS_SEARCH_ENGINES_EXTENSION_ENGINES}, {"searchEnginesSearch", IDS_SETTINGS_SEARCH_ENGINES_SEARCH}, {"searchEnginesSearchEngine", IDS_SETTINGS_SEARCH_ENGINES_SEARCH_ENGINE}, {"searchEnginesKeyword", IDS_SETTINGS_SEARCH_ENGINES_KEYWORD}, {"searchEnginesQueryURL", IDS_SETTINGS_SEARCH_ENGINES_QUERY_URL}, {"searchEnginesQueryURLExplanation", IDS_SETTINGS_SEARCH_ENGINES_QUERY_URL_EXPLANATION}, {"searchEnginesMakeDefault", IDS_SETTINGS_SEARCH_ENGINES_MAKE_DEFAULT}, {"searchEnginesRemoveFromList", IDS_SETTINGS_SEARCH_ENGINES_REMOVE_FROM_LIST}, {"searchEnginesManageExtension", IDS_SETTINGS_SEARCH_ENGINES_MANAGE_EXTENSION}, }; AddLocalizedStringsBulk(html_source, localized_strings, arraysize(localized_strings)); }
0
376,161
static int nf_ct_net_init(struct net *net) { net->nf_frag.frags.high_thresh = IPV6_FRAG_HIGH_THRESH; net->nf_frag.frags.low_thresh = IPV6_FRAG_LOW_THRESH; net->nf_frag.frags.timeout = IPV6_FRAG_TIMEOUT; inet_frags_init_net(&net->nf_frag.frags); return nf_ct_frag6_sysctl_register(net); }
0
393,677
PHP_FUNCTION(odbc_result) { char *field; int field_ind; SQLSMALLINT sql_c_type = SQL_C_CHAR; odbc_result *result; int i = 0; RETCODE rc; SQLLEN fieldsize; zval *pv_res, **pv_field; #ifdef HAVE_SQL_EXTENDED_FETCH SQLULEN crow; SQLUSMALLINT RowStatus[1]; #endif field_ind = -1; field = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZ", &pv_res, &pv_field) == FAILURE) { return; } if (Z_TYPE_PP(pv_field) == IS_STRING) { field = Z_STRVAL_PP(pv_field); } else { convert_to_long_ex(pv_field); field_ind = Z_LVAL_PP(pv_field) - 1; } ZEND_FETCH_RESOURCE(result, odbc_result *, &pv_res, -1, "ODBC result", le_result); if ((result->numcols == 0)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No tuples available at this result index"); RETURN_FALSE; } /* get field index if the field parameter was a string */ if (field != NULL) { if (result->values == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Result set contains no data"); RETURN_FALSE; } for(i = 0; i < result->numcols; i++) { if (!strcasecmp(result->values[i].name, field)) { field_ind = i; break; } } if (field_ind < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %s not found", field); RETURN_FALSE; } } else { /* check for limits of field_ind if the field parameter was an int */ if (field_ind >= result->numcols || field_ind < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field index is larger than the number of fields"); RETURN_FALSE; } } if (result->fetched == 0) { /* User forgot to call odbc_fetch_row(), or wants to reload the results, do it now */ #ifdef HAVE_SQL_EXTENDED_FETCH if (result->fetch_abs) rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus); else #endif rc = SQLFetch(result->stmt); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { RETURN_FALSE; } result->fetched++; } switch(result->values[field_ind].coltype) { case SQL_BINARY: case SQL_VARBINARY: case SQL_LONGVARBINARY: if (result->binmode <= 1) { sql_c_type = SQL_C_BINARY; } if (result->binmode <= 0) { break; } case SQL_LONGVARCHAR: #if defined(ODBCVER) && (ODBCVER >= 0x0300) case SQL_WLONGVARCHAR: #endif if (IS_SQL_LONG(result->values[field_ind].coltype)) { if (result->longreadlen <= 0) { break; } else { fieldsize = result->longreadlen; } } else { PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), (SQLUSMALLINT)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH : SQL_COLUMN_DISPLAY_SIZE), NULL, 0, NULL, &fieldsize); } /* For char data, the length of the returned string will be longreadlen - 1 */ fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen; field = emalloc(fieldsize); /* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0. * For binary data it is truncated to fieldsize bytes. */ rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1), sql_c_type, field, fieldsize, &result->values[field_ind].vallen); if (rc == SQL_ERROR) { odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); efree(field); RETURN_FALSE; } if (result->values[field_ind].vallen == SQL_NULL_DATA) { efree(field); RETURN_NULL(); } else if (rc == SQL_NO_DATA_FOUND) { efree(field); RETURN_FALSE; } /* Reduce fieldlen by 1 if we have char data. One day we might have binary strings... */ if ((result->values[field_ind].coltype == SQL_LONGVARCHAR) #if defined(ODBCVER) && (ODBCVER >= 0x0300) || (result->values[field_ind].coltype == SQL_WLONGVARCHAR) #endif ) { fieldsize -= 1; } /* Don't duplicate result, saves one emalloc. For SQL_SUCCESS, the length is in vallen. */ RETURN_STRINGL(field, (rc == SQL_SUCCESS_WITH_INFO) ? fieldsize : result->values[field_ind].vallen, 0); break; default: if (result->values[field_ind].vallen == SQL_NULL_DATA) { RETURN_NULL(); } else { RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen, 1); } break; } /* If we come here, output unbound LONG and/or BINARY column data to the client */ /* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */ fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095; field = emalloc(fieldsize); /* Call SQLGetData() until SQL_SUCCESS is returned */ while(1) { rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1),sql_c_type, field, fieldsize, &result->values[field_ind].vallen); if (rc == SQL_ERROR) { odbc_sql_error(result->conn_ptr, result->stmt, "SQLGetData"); efree(field); RETURN_FALSE; } if (result->values[field_ind].vallen == SQL_NULL_DATA) { efree(field); RETURN_NULL(); } /* chop the trailing \0 by outputing only 4095 bytes */ PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 : result->values[field_ind].vallen); if (rc == SQL_SUCCESS) { /* no more data avail */ efree(field); RETURN_TRUE; } } RETURN_TRUE; }
0
174,955
bool ExtensionPrefs::IsOrphanedExtensionAcknowledged( const std::string& extension_id) { return ReadExtensionPrefBoolean(extension_id, kPrefOrphanAcknowledged); }
0
208,234
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len, unsigned int idx) { unsigned int offset; int i; trace_virtqueue_fill(vq, elem, len, idx); offset = 0; for (i = 0; i < elem->in_num; i++) { size_t size = MIN(len - offset, elem->in_sg[i].iov_len); cpu_physical_memory_unmap(elem->in_sg[i].iov_base, elem->in_sg[i].iov_len, 1, size); offset += size; } for (i = 0; i < elem->out_num; i++) cpu_physical_memory_unmap(elem->out_sg[i].iov_base, elem->out_sg[i].iov_len, 0, elem->out_sg[i].iov_len); idx = (idx + vring_used_idx(vq)) % vq->vring.num; /* Get a pointer to the next entry in the used ring. */ vring_used_ring_id(vq, idx, elem->index); vring_used_ring_len(vq, idx, len); }
0
510,426
void Item_name_const::print(String *str, enum_query_type query_type) { str->append(STRING_WITH_LEN("NAME_CONST(")); name_item->print(str, query_type); str->append(','); value_item->print(str, query_type); str->append(')'); }
0
113,956
void AddToFusedNodes(const string& name) { fused_nodes_.insert(name); }
0
148,849
f_matcharg(typval_T *argvars UNUSED, typval_T *rettv) { if (rettv_list_alloc(rettv) == OK) { #ifdef FEAT_SEARCH_EXTRA int id = (int)tv_get_number(&argvars[0]); matchitem_T *m; if (id >= 1 && id <= 3) { if ((m = (matchitem_T *)get_match(curwin, id)) != NULL) { list_append_string(rettv->vval.v_list, syn_id2name(m->hlg_id), -1); list_append_string(rettv->vval.v_list, m->pattern, -1); } else { list_append_string(rettv->vval.v_list, NULL, -1); list_append_string(rettv->vval.v_list, NULL, -1); } } #endif } }
0
462,959
TEST(BitTestMatchExpression, MatchBinaryWithLongBitMask) { long long bitMask = 54; BSONObj match = fromjson("{a: {$binary: 'NgAAAAAAAAAAAAAAAAAAAAAAAAAA', $type: '00'}}"); BitsAllSetMatchExpression balls; BitsAllClearMatchExpression ballc; BitsAnySetMatchExpression banys; BitsAnyClearMatchExpression banyc; ASSERT_OK(balls.init("a", bitMask)); ASSERT_OK(ballc.init("a", bitMask)); ASSERT_OK(banys.init("a", bitMask)); ASSERT_OK(banyc.init("a", bitMask)); std::vector<uint32_t> bitPositions = balls.getBitPositions(); ASSERT(balls.matchesSingleElement(match["a"])); ASSERT(!ballc.matchesSingleElement(match["a"])); ASSERT(banys.matchesSingleElement(match["a"])); ASSERT(!banyc.matchesSingleElement(match["a"])); }
0
123,876
static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir, struct dma_attrs *attrs) { struct scatterlist *sg; int i, ret; ret = swiotlb_map_sg_attrs(dev, sgl, nelems, dir, attrs); if (!is_device_dma_coherent(dev)) for_each_sg(sgl, sg, ret, i) __dma_map_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)), sg->length, dir); return ret; }
0
404,669
int handler_init(void) { return tcmur_register_handler(&qcow_handler); }
0
476,264
void InstanceKlass::store_fingerprint(uint64_t fingerprint) { address adr = adr_fingerprint(); if (adr != NULL) { Bytes::put_native_u8(adr, (u8)fingerprint); // adr may not be 64-bit aligned ResourceMark rm; log_trace(class, fingerprint)("stored as " PTR64_FORMAT " for class %s", fingerprint, external_name()); } }
0
237,079
void WebGL2RenderingContextBase::endTransformFeedback() { if (isContextLost()) return; ContextGL()->EndTransformFeedback(); if (current_program_) current_program_->DecreaseActiveTransformFeedbackCount(); }
0
197,758
unsigned lodepng_encode32(unsigned char** out, size_t* outsize, const unsigned char* image, unsigned w, unsigned h) { return lodepng_encode_memory(out, outsize, image, w, h, LCT_RGBA, 8); }
0
232,839
static void reply_sesssetup_blob(struct smb_request *req, DATA_BLOB blob, NTSTATUS nt_status) { if (!NT_STATUS_IS_OK(nt_status) && !NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { reply_nterror(req, nt_status_squash(nt_status)); return; } nt_status = nt_status_squash(nt_status); SIVAL(req->outbuf, smb_rcls, NT_STATUS_V(nt_status)); SSVAL(req->outbuf, smb_vwv0, 0xFF); /* no chaining possible */ SSVAL(req->outbuf, smb_vwv3, blob.length); if ((message_push_blob(&req->outbuf, blob) == -1) || (push_signature(&req->outbuf) == -1)) { reply_nterror(req, NT_STATUS_NO_MEMORY); } }
0
221,585
void DocumentLoader::responseReceived(CachedResource* resource, const ResourceResponse& response) { ASSERT_UNUSED(resource, m_mainResource == resource); RefPtr<DocumentLoader> protect(this); bool willLoadFallback = m_applicationCacheHost->maybeLoadFallbackForMainResponse(request(), response); bool shouldRemoveResourceFromCache = willLoadFallback; #if PLATFORM(CHROMIUM) if (response.appCacheID()) shouldRemoveResourceFromCache = true; #endif if (shouldRemoveResourceFromCache) memoryCache()->remove(m_mainResource.get()); if (willLoadFallback) return; DEFINE_STATIC_LOCAL(AtomicString, xFrameOptionHeader, ("x-frame-options", AtomicString::ConstructFromLiteral)); HTTPHeaderMap::const_iterator it = response.httpHeaderFields().find(xFrameOptionHeader); if (it != response.httpHeaderFields().end()) { String content = it->value; ASSERT(m_mainResource); unsigned long identifier = m_identifierForLoadWithoutResourceLoader ? m_identifierForLoadWithoutResourceLoader : m_mainResource->identifier(); ASSERT(identifier); if (frameLoader()->shouldInterruptLoadForXFrameOptions(content, response.url(), identifier)) { InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame, this, identifier, response); String message = "Refused to display '" + response.url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; frame()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, identifier); if (HTMLFrameOwnerElement* ownerElement = frame()->ownerElement()) ownerElement->dispatchEvent(Event::create(eventNames().loadEvent, false, false)); cancelMainResourceLoad(frameLoader()->cancelledError(m_request)); return; } } #if !USE(CF) ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); #endif if (m_isLoadingMultipartContent) { setupForReplace(); m_mainResource->clear(); } else if (response.isMultipart()) { FeatureObserver::observe(m_frame->document(), FeatureObserver::MultipartMainResource); m_isLoadingMultipartContent = true; } m_response = response; if (m_identifierForLoadWithoutResourceLoader) frameLoader()->notifier()->dispatchDidReceiveResponse(this, m_identifierForLoadWithoutResourceLoader, m_response, 0); ASSERT(!m_waitingForContentPolicy); m_waitingForContentPolicy = true; if (m_substituteData.isValid()) { continueAfterContentPolicy(PolicyUse); return; } #if ENABLE(FTPDIR) Settings* settings = m_frame->settings(); if (settings && settings->forceFTPDirectoryListings() && m_response.mimeType() == "application/x-ftp-directory") { continueAfterContentPolicy(PolicyUse); return; } #endif #if USE(CONTENT_FILTERING) if (response.url().protocolIs("https") && ContentFilter::isEnabled()) m_contentFilter = ContentFilter::create(response); #endif frameLoader()->policyChecker()->checkContentPolicy(m_response, callContinueAfterContentPolicy, this); }
0
225,294
static bool LayerNodeMayNeedCompositedScrolling(const PaintLayer* layer) { if (Node* node = layer->GetLayoutObject().GetNode()) { if (IsHTMLSelectElement(node)) return false; if (TextControlElement* text_control = EnclosingTextControl(node)) { if (IsHTMLInputElement(text_control)) { return false; } } } return true; }
0
264,450
f_visualmode(typval_T *argvars, typval_T *rettv) { char_u str[2]; rettv->v_type = VAR_STRING; str[0] = curbuf->b_visual_mode_eval; str[1] = NUL; rettv->vval.v_string = vim_strsave(str); /* A non-zero number or non-empty string argument: reset mode. */ if (non_zero_arg(&argvars[0])) curbuf->b_visual_mode_eval = NUL; }
0
163,756
static const char* GetNavigationType(WebNavigationType nav_type) { switch (nav_type) { case blink::WebNavigationTypeLinkClicked: return "LinkClicked"; case blink::WebNavigationTypeFormSubmitted: return "FormSubmitted"; case blink::WebNavigationTypeBackForward: return "BackForward"; case blink::WebNavigationTypeReload: return "Reload"; case blink::WebNavigationTypeFormResubmitted: return "Resubmitted"; case blink::WebNavigationTypeOther: return "Other"; } return ""; }
0
493,943
CURLcode Curl_http(struct Curl_easy *data, bool *done) { struct connectdata *conn = data->conn; CURLcode result = CURLE_OK; struct HTTP *http; Curl_HttpReq httpreq; const char *te = ""; /* transfer-encoding */ const char *request; const char *httpstring; struct dynbuf req; char *altused = NULL; const char *p_accept; /* Accept: string */ /* Always consider the DO phase done after this function call, even if there may be parts of the request that are not yet sent, since we can deal with the rest of the request in the PERFORM phase. */ *done = TRUE; if(conn->transport != TRNSPRT_QUIC) { if(conn->httpversion < 20) { /* unless the connection is re-used and already http2 */ switch(conn->negnpn) { case CURL_HTTP_VERSION_2: conn->httpversion = 20; /* we know we're on HTTP/2 now */ result = Curl_http2_switched(data, NULL, 0); if(result) return result; break; case CURL_HTTP_VERSION_1_1: /* continue with HTTP/1.1 when explicitly requested */ break; default: /* Check if user wants to use HTTP/2 with clear TCP*/ #ifdef USE_NGHTTP2 if(data->state.httpwant == CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) { #ifndef CURL_DISABLE_PROXY if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) { /* We don't support HTTP/2 proxies yet. Also it's debatable whether or not this setting should apply to HTTP/2 proxies. */ infof(data, "Ignoring HTTP/2 prior knowledge due to proxy"); break; } #endif DEBUGF(infof(data, "HTTP/2 over clean TCP")); conn->httpversion = 20; result = Curl_http2_switched(data, NULL, 0); if(result) return result; } #endif break; } } else { /* prepare for a http2 request */ result = Curl_http2_setup(data, conn); if(result) return result; } } http = data->req.p.http; DEBUGASSERT(http); result = Curl_http_host(data, conn); if(result) return result; result = Curl_http_useragent(data); if(result) return result; Curl_http_method(data, conn, &request, &httpreq); /* setup the authentication headers */ { char *pq = NULL; if(data->state.up.query) { pq = aprintf("%s?%s", data->state.up.path, data->state.up.query); if(!pq) return CURLE_OUT_OF_MEMORY; } result = Curl_http_output_auth(data, conn, request, httpreq, (pq ? pq : data->state.up.path), FALSE); free(pq); if(result) return result; } Curl_safefree(data->state.aptr.ref); if(data->state.referer && !Curl_checkheaders(data, STRCONST("Referer"))) { data->state.aptr.ref = aprintf("Referer: %s\r\n", data->state.referer); if(!data->state.aptr.ref) return CURLE_OUT_OF_MEMORY; } if(!Curl_checkheaders(data, STRCONST("Accept-Encoding")) && data->set.str[STRING_ENCODING]) { Curl_safefree(data->state.aptr.accept_encoding); data->state.aptr.accept_encoding = aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]); if(!data->state.aptr.accept_encoding) return CURLE_OUT_OF_MEMORY; } else Curl_safefree(data->state.aptr.accept_encoding); #ifdef HAVE_LIBZ /* we only consider transfer-encoding magic if libz support is built-in */ result = Curl_transferencode(data); if(result) return result; #endif result = Curl_http_body(data, conn, httpreq, &te); if(result) return result; p_accept = Curl_checkheaders(data, STRCONST("Accept"))?NULL:"Accept: */*\r\n"; result = Curl_http_resume(data, conn, httpreq); if(result) return result; result = Curl_http_range(data, httpreq); if(result) return result; httpstring = get_http_string(data, conn); /* initialize a dynamic send-buffer */ Curl_dyn_init(&req, DYN_HTTP_REQUEST); /* make sure the header buffer is reset - if there are leftovers from a previous transfer */ Curl_dyn_reset(&data->state.headerb); /* add the main request stuff */ /* GET/HEAD/POST/PUT */ result = Curl_dyn_addf(&req, "%s ", request); if(!result) result = Curl_http_target(data, conn, &req); if(result) { Curl_dyn_free(&req); return result; } #ifndef CURL_DISABLE_ALTSVC if(conn->bits.altused && !Curl_checkheaders(data, STRCONST("Alt-Used"))) { altused = aprintf("Alt-Used: %s:%d\r\n", conn->conn_to_host.name, conn->conn_to_port); if(!altused) { Curl_dyn_free(&req); return CURLE_OUT_OF_MEMORY; } } #endif result = Curl_dyn_addf(&req, " HTTP/%s\r\n" /* HTTP version */ "%s" /* host */ "%s" /* proxyuserpwd */ "%s" /* userpwd */ "%s" /* range */ "%s" /* user agent */ "%s" /* accept */ "%s" /* TE: */ "%s" /* accept-encoding */ "%s" /* referer */ "%s" /* Proxy-Connection */ "%s" /* transfer-encoding */ "%s",/* Alt-Used */ httpstring, (data->state.aptr.host?data->state.aptr.host:""), data->state.aptr.proxyuserpwd? data->state.aptr.proxyuserpwd:"", data->state.aptr.userpwd?data->state.aptr.userpwd:"", (data->state.use_range && data->state.aptr.rangeline)? data->state.aptr.rangeline:"", (data->set.str[STRING_USERAGENT] && *data->set.str[STRING_USERAGENT] && data->state.aptr.uagent)? data->state.aptr.uagent:"", p_accept?p_accept:"", data->state.aptr.te?data->state.aptr.te:"", (data->set.str[STRING_ENCODING] && *data->set.str[STRING_ENCODING] && data->state.aptr.accept_encoding)? data->state.aptr.accept_encoding:"", (data->state.referer && data->state.aptr.ref)? data->state.aptr.ref:"" /* Referer: <data> */, #ifndef CURL_DISABLE_PROXY (conn->bits.httpproxy && !conn->bits.tunnel_proxy && !Curl_checkheaders(data, STRCONST("Proxy-Connection")) && !Curl_checkProxyheaders(data, conn, STRCONST("Proxy-Connection")))? "Proxy-Connection: Keep-Alive\r\n":"", #else "", #endif te, altused ? altused : "" ); /* clear userpwd and proxyuserpwd to avoid re-using old credentials * from re-used connections */ Curl_safefree(data->state.aptr.userpwd); Curl_safefree(data->state.aptr.proxyuserpwd); free(altused); if(result) { Curl_dyn_free(&req); return result; } if(!(conn->handler->flags&PROTOPT_SSL) && conn->httpversion != 20 && (data->state.httpwant == CURL_HTTP_VERSION_2)) { /* append HTTP2 upgrade magic stuff to the HTTP request if it isn't done over SSL */ result = Curl_http2_request_upgrade(&req, data); if(result) { Curl_dyn_free(&req); return result; } } result = Curl_http_cookies(data, conn, &req); if(!result) result = Curl_add_timecondition(data, &req); if(!result) result = Curl_add_custom_headers(data, FALSE, &req); if(!result) { http->postdata = NULL; /* nothing to post at this point */ if((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) Curl_pgrsSetUploadSize(data, 0); /* nothing */ /* bodysend takes ownership of the 'req' memory on success */ result = Curl_http_bodysend(data, conn, &req, httpreq); } if(result) { Curl_dyn_free(&req); return result; } if((http->postsize > -1) && (http->postsize <= data->req.writebytecount) && (http->sending != HTTPSEND_REQUEST)) data->req.upload_done = TRUE; if(data->req.writebytecount) { /* if a request-body has been sent off, we make sure this progress is noted properly */ Curl_pgrsSetUploadCounter(data, data->req.writebytecount); if(Curl_pgrsUpdate(data)) result = CURLE_ABORTED_BY_CALLBACK; if(!http->postsize) { /* already sent the entire request body, mark the "upload" as complete */ infof(data, "upload completely sent off: %" CURL_FORMAT_CURL_OFF_T " out of %" CURL_FORMAT_CURL_OFF_T " bytes", data->req.writebytecount, http->postsize); data->req.upload_done = TRUE; data->req.keepon &= ~KEEP_SEND; /* we're done writing */ data->req.exp100 = EXP100_SEND_DATA; /* already sent */ Curl_expire_done(data, EXPIRE_100_TIMEOUT); } } if((conn->httpversion == 20) && data->req.upload_chunky) /* upload_chunky was set above to set up the request in a chunky fashion, but is disabled here again to avoid that the chunked encoded version is actually used when sending the request body over h2 */ data->req.upload_chunky = FALSE; return result; }
0