unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
49,242 | 0 | int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
int family, const u8 *newkey, u8 newkeylen, gfp_t gfp)
{
/* Add Key to the list */
struct tcp_md5sig_key *key;
struct tcp_sock *tp = tcp_sk(sk);
struct tcp_md5sig_info *md5sig;
key = tcp_md5_do_lookup(sk, addr, family);
if (key) {
/* Pre-existing entry - just update that one. */
memcpy(key->key, newkey, newkeylen);
key->keylen = newkeylen;
return 0;
}
md5sig = rcu_dereference_protected(tp->md5sig_info,
lockdep_sock_is_held(sk));
if (!md5sig) {
md5sig = kmalloc(sizeof(*md5sig), gfp);
if (!md5sig)
return -ENOMEM;
sk_nocaps_add(sk, NETIF_F_GSO_MASK);
INIT_HLIST_HEAD(&md5sig->head);
rcu_assign_pointer(tp->md5sig_info, md5sig);
}
key = sock_kmalloc(sk, sizeof(*key), gfp);
if (!key)
return -ENOMEM;
if (!tcp_alloc_md5sig_pool()) {
sock_kfree_s(sk, key, sizeof(*key));
return -ENOMEM;
}
memcpy(key->key, newkey, newkeylen);
key->keylen = newkeylen;
key->family = family;
memcpy(&key->addr, addr,
(family == AF_INET6) ? sizeof(struct in6_addr) :
sizeof(struct in_addr));
hlist_add_head_rcu(&key->node, &md5sig->head);
return 0;
}
| 7,400 |
110,168 | 0 | static void SetupSettingsAutofillPageTest(Profile* profile,
const char* first_name,
const char* middle_name,
const char* last_name,
const char* email,
const char* company,
const char* address1,
const char* address2,
const char* city,
const char* state,
const char* zipcode,
const char* country,
const char* phone) {
autofill_test::DisableSystemServices(profile);
AutofillProfile autofill_profile;
autofill_test::SetProfileInfo(&autofill_profile,
first_name,
middle_name,
last_name,
email,
company,
address1,
address2,
city,
state,
zipcode,
country,
phone);
PersonalDataManager* personal_data_manager =
PersonalDataManagerFactory::GetForProfile(profile);
ASSERT_TRUE(personal_data_manager);
personal_data_manager->AddProfile(autofill_profile);
}
| 7,401 |
112,629 | 0 | DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& substituteData)
: m_deferMainResourceDataLoad(true)
, m_frame(0)
, m_cachedResourceLoader(CachedResourceLoader::create(this))
, m_writer(m_frame)
, m_originalRequest(req)
, m_substituteData(substituteData)
, m_originalRequestCopy(req)
, m_request(req)
, m_originalSubstituteDataWasValid(substituteData.isValid())
, m_committed(false)
, m_isStopping(false)
, m_gotFirstByte(false)
, m_isClientRedirect(false)
, m_isLoadingMultipartContent(false)
, m_wasOnloadHandled(false)
, m_stopRecordingResponses(false)
, m_substituteResourceDeliveryTimer(this, &DocumentLoader::substituteResourceDeliveryTimerFired)
, m_didCreateGlobalHistoryEntry(false)
, m_loadingMainResource(false)
, m_timeOfLastDataReceived(0.0)
, m_identifierForLoadWithoutResourceLoader(0)
, m_dataLoadTimer(this, &DocumentLoader::handleSubstituteDataLoadNow)
, m_waitingForContentPolicy(false)
, m_applicationCacheHost(adoptPtr(new ApplicationCacheHost(this)))
{
}
| 7,402 |
30,316 | 0 | static bool __vsock_in_bound_table(struct vsock_sock *vsk)
{
return !list_empty(&vsk->bound_table);
}
| 7,403 |
121,535 | 0 | void GetFileContentByPath(
const DriveFileStreamReader::DriveFileSystemGetter& file_system_getter,
const base::FilePath& drive_file_path,
const GetFileContentInitializedCallback& initialized_callback,
const google_apis::GetContentCallback& get_content_callback,
const FileOperationCallback& completion_callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&GetFileContentByPathOnUIThread,
file_system_getter,
drive_file_path,
google_apis::CreateRelayCallback(initialized_callback),
google_apis::CreateRelayCallback(get_content_callback),
google_apis::CreateRelayCallback(completion_callback)));
}
| 7,404 |
112,858 | 0 | void GDataCache::AssertOnSequencedWorkerPool() {
DCHECK(!pool_ || pool_->IsRunningSequenceOnCurrentThread(sequence_token_));
}
| 7,405 |
138,334 | 0 | bool roleAllowsOrientation(AccessibilityRole role) {
return role == ScrollBarRole || role == SplitterRole || role == SliderRole;
}
| 7,406 |
156,531 | 0 | bool ChildProcessSecurityPolicyImpl::CanRequestURL(
int child_id, const GURL& url) {
if (!url.is_valid())
return false; // Can't request invalid URLs.
const std::string& scheme = url.scheme();
if (IsPseudoScheme(scheme))
return url.IsAboutBlank() || url == kAboutSrcDocURL;
if (url.SchemeIsBlob() || url.SchemeIsFileSystem()) {
if (IsMalformedBlobUrl(url))
return false;
url::Origin origin = url::Origin::Create(url);
return origin.unique() || CanRequestURL(child_id, GURL(origin.Serialize()));
}
if (IsWebSafeScheme(scheme))
return true;
{
base::AutoLock lock(lock_);
SecurityStateMap::iterator state = security_state_.find(child_id);
if (state == security_state_.end())
return false;
if (state->second->CanRequestURL(url))
return true;
}
return !GetContentClient()->browser()->IsHandledURL(url) &&
!net::URLRequest::IsHandledURL(url);
}
| 7,407 |
17,603 | 0 | ProcRenderTriangles(ClientPtr client)
{
int rc, ntris;
PicturePtr pSrc, pDst;
PictFormatPtr pFormat;
REQUEST(xRenderTrianglesReq);
REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq);
if (!PictOpValid(stuff->op)) {
client->errorValue = stuff->op;
return BadValue;
}
VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess);
VERIFY_PICTURE(pDst, stuff->dst, client, DixWriteAccess);
if (!pDst->pDrawable)
return BadDrawable;
if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
return BadMatch;
if (stuff->maskFormat) {
rc = dixLookupResourceByType((void **) &pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return rc;
}
else
pFormat = 0;
ntris = (client->req_len << 2) - sizeof(xRenderTrianglesReq);
if (ntris % sizeof(xTriangle))
return BadLength;
ntris /= sizeof(xTriangle);
if (ntris)
CompositeTriangles(stuff->op, pSrc, pDst, pFormat,
stuff->xSrc, stuff->ySrc,
ntris, (xTriangle *) &stuff[1]);
return Success;
}
| 7,408 |
167,920 | 0 | void LocalFrame::DidResume() {
DCHECK(RuntimeEnabledFeatures::PageLifecycleEnabled());
if (GetDocument()) {
const TimeTicks resume_event_start = CurrentTimeTicks();
GetDocument()->DispatchEvent(Event::Create(EventTypeNames::resume));
const TimeTicks resume_event_end = CurrentTimeTicks();
DEFINE_STATIC_LOCAL(
CustomCountHistogram, resume_histogram,
("DocumentEventTiming.ResumeDuration", 0, 10000000, 50));
resume_histogram.Count(
(resume_event_end - resume_event_start).InMicroseconds());
if (auto* frame_resource_coordinator = GetFrameResourceCoordinator()) {
frame_resource_coordinator->SetLifecycleState(
resource_coordinator::mojom::LifecycleState::kRunning);
}
}
}
| 7,409 |
147,116 | 0 | bool DocumentLoader::CheckOriginIsHttpOrHttps(const SecurityOrigin* origin) {
return origin &&
(origin->Protocol() == "http" || origin->Protocol() == "https");
}
| 7,410 |
73,167 | 0 | fetch_from_buf_http(buf_t *buf,
char **headers_out, size_t max_headerlen,
char **body_out, size_t *body_used, size_t max_bodylen,
int force_complete)
{
char *headers, *p;
size_t headerlen, bodylen, contentlen;
int crlf_offset;
check();
if (!buf->head)
return 0;
crlf_offset = buf_find_string_offset(buf, "\r\n\r\n", 4);
if (crlf_offset > (int)max_headerlen ||
(crlf_offset < 0 && buf->datalen > max_headerlen)) {
log_debug(LD_HTTP,"headers too long.");
return -1;
} else if (crlf_offset < 0) {
log_debug(LD_HTTP,"headers not all here yet.");
return 0;
}
/* Okay, we have a full header. Make sure it all appears in the first
* chunk. */
if ((int)buf->head->datalen < crlf_offset + 4)
buf_pullup(buf, crlf_offset+4, 0);
headerlen = crlf_offset + 4;
headers = buf->head->data;
bodylen = buf->datalen - headerlen;
log_debug(LD_HTTP,"headerlen %d, bodylen %d.", (int)headerlen, (int)bodylen);
if (max_headerlen <= headerlen) {
log_warn(LD_HTTP,"headerlen %d larger than %d. Failing.",
(int)headerlen, (int)max_headerlen-1);
return -1;
}
if (max_bodylen <= bodylen) {
log_warn(LD_HTTP,"bodylen %d larger than %d. Failing.",
(int)bodylen, (int)max_bodylen-1);
return -1;
}
#define CONTENT_LENGTH "\r\nContent-Length: "
p = (char*) tor_memstr(headers, headerlen, CONTENT_LENGTH);
if (p) {
int i;
i = atoi(p+strlen(CONTENT_LENGTH));
if (i < 0) {
log_warn(LD_PROTOCOL, "Content-Length is less than zero; it looks like "
"someone is trying to crash us.");
return -1;
}
contentlen = i;
/* if content-length is malformed, then our body length is 0. fine. */
log_debug(LD_HTTP,"Got a contentlen of %d.",(int)contentlen);
if (bodylen < contentlen) {
if (!force_complete) {
log_debug(LD_HTTP,"body not all here yet.");
return 0; /* not all there yet */
}
}
if (bodylen > contentlen) {
bodylen = contentlen;
log_debug(LD_HTTP,"bodylen reduced to %d.",(int)bodylen);
}
}
/* all happy. copy into the appropriate places, and return 1 */
if (headers_out) {
*headers_out = tor_malloc(headerlen+1);
fetch_from_buf(*headers_out, headerlen, buf);
(*headers_out)[headerlen] = 0; /* NUL terminate it */
}
if (body_out) {
tor_assert(body_used);
*body_used = bodylen;
*body_out = tor_malloc(bodylen+1);
fetch_from_buf(*body_out, bodylen, buf);
(*body_out)[bodylen] = 0; /* NUL terminate it */
}
check();
return 1;
}
| 7,411 |
81,385 | 0 | void trace_default_header(struct seq_file *m)
{
struct trace_iterator *iter = m->private;
struct trace_array *tr = iter->tr;
unsigned long trace_flags = tr->trace_flags;
if (!(trace_flags & TRACE_ITER_CONTEXT_INFO))
return;
if (iter->iter_flags & TRACE_FILE_LAT_FMT) {
/* print nothing if the buffers are empty */
if (trace_empty(iter))
return;
print_trace_header(m, iter);
if (!(trace_flags & TRACE_ITER_VERBOSE))
print_lat_help_header(m);
} else {
if (!(trace_flags & TRACE_ITER_VERBOSE)) {
if (trace_flags & TRACE_ITER_IRQ_INFO)
print_func_help_header_irq(iter->trace_buffer,
m, trace_flags);
else
print_func_help_header(iter->trace_buffer, m,
trace_flags);
}
}
}
| 7,412 |
92,579 | 0 | static inline unsigned long group_weight(struct task_struct *p, int nid,
int dist)
{
unsigned long faults, total_faults;
if (!p->numa_group)
return 0;
total_faults = p->numa_group->total_faults;
if (!total_faults)
return 0;
faults = group_faults(p, nid);
faults += score_nearby_nodes(p, nid, dist, false);
return 1000 * faults / total_faults;
}
| 7,413 |
73,852 | 0 | static void rwpng_free_chunks(struct rwpng_chunk *chunk) {
if (!chunk) return;
rwpng_free_chunks(chunk->next);
free(chunk->data);
free(chunk);
}
| 7,414 |
184,482 | 1 | void WebProcessProxy::addExistingWebPage(WebPageProxy* webPage, uint64_t pageID)
{
m_pageMap.set(pageID, webPage);
globalPageMap().set(pageID, webPage);
#if PLATFORM(MAC)
if (pageIsProcessSuppressible(webPage));
m_processSuppressiblePages.add(pageID);
updateProcessSuppressionState();
#endif
}
| 7,415 |
113,883 | 0 | void HTMLDocumentParser::endIfDelayed()
{
if (isDetached())
return;
if (!m_endWasDelayed || shouldDelayEnd())
return;
m_endWasDelayed = false;
prepareToStopParsing();
}
| 7,416 |
91,203 | 0 | static int __get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc)
{
int rv;
bmc->dyn_id_set = 2;
intf->null_user_handler = bmc_device_id_handler;
rv = send_get_device_id_cmd(intf);
if (rv)
return rv;
wait_event(intf->waitq, bmc->dyn_id_set != 2);
if (!bmc->dyn_id_set)
rv = -EIO; /* Something went wrong in the fetch. */
/* dyn_id_set makes the id data available. */
smp_rmb();
intf->null_user_handler = NULL;
return rv;
}
| 7,417 |
73,045 | 0 | BGD_DECLARE(int) gdImageColorExact (gdImagePtr im, int r, int g, int b)
{
return gdImageColorExactAlpha (im, r, g, b, gdAlphaOpaque);
}
| 7,418 |
174,469 | 0 | void readVector(Parcel &reply, Vector<uint8_t> &vector) const {
uint32_t size = reply.readInt32();
vector.insertAt((size_t)0, size);
reply.read(vector.editArray(), size);
}
| 7,419 |
80,396 | 0 | GF_Box *segr_New()
{
ISOM_DECL_BOX_ALLOC(FDSessionGroupBox, GF_ISOM_BOX_TYPE_SEGR);
return (GF_Box *)tmp;
}
| 7,420 |
173,825 | 0 | OMX_ERRORTYPE omx_vdec::empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_BUFFERHEADERTYPE* buffer)
{
OMX_ERRORTYPE ret1 = OMX_ErrorNone;
unsigned int nBufferIndex = drv_ctx.ip_buf.actualcount;
if (m_state == OMX_StateInvalid) {
DEBUG_PRINT_ERROR("Empty this buffer in Invalid State");
return OMX_ErrorInvalidState;
}
if (buffer == NULL) {
DEBUG_PRINT_ERROR("ERROR:ETB Buffer is NULL");
return OMX_ErrorBadParameter;
}
if (!m_inp_bEnabled) {
DEBUG_PRINT_ERROR("ERROR:ETB incorrect state operation, input port is disabled.");
return OMX_ErrorIncorrectStateOperation;
}
if (buffer->nInputPortIndex != OMX_CORE_INPUT_PORT_INDEX) {
DEBUG_PRINT_ERROR("ERROR:ETB invalid port in header %u", (unsigned int)buffer->nInputPortIndex);
return OMX_ErrorBadPortIndex;
}
#ifdef _ANDROID_
if (iDivXDrmDecrypt) {
OMX_ERRORTYPE drmErr = iDivXDrmDecrypt->Decrypt(buffer);
if (drmErr != OMX_ErrorNone) {
DEBUG_PRINT_LOW("ERROR:iDivXDrmDecrypt->Decrypt %d", drmErr);
}
}
#endif //_ANDROID_
if (perf_flag) {
if (!latency) {
dec_time.stop();
latency = dec_time.processing_time_us();
dec_time.start();
}
}
if (arbitrary_bytes) {
nBufferIndex = buffer - m_inp_heap_ptr;
} else {
if (input_use_buffer == true) {
nBufferIndex = buffer - m_inp_heap_ptr;
m_inp_mem_ptr[nBufferIndex].nFilledLen = m_inp_heap_ptr[nBufferIndex].nFilledLen;
m_inp_mem_ptr[nBufferIndex].nTimeStamp = m_inp_heap_ptr[nBufferIndex].nTimeStamp;
m_inp_mem_ptr[nBufferIndex].nFlags = m_inp_heap_ptr[nBufferIndex].nFlags;
buffer = &m_inp_mem_ptr[nBufferIndex];
DEBUG_PRINT_LOW("Non-Arbitrary mode - buffer address is: malloc %p, pmem%p in Index %d, buffer %p of size %u",
&m_inp_heap_ptr[nBufferIndex], &m_inp_mem_ptr[nBufferIndex],nBufferIndex, buffer, (unsigned int)buffer->nFilledLen);
} else {
nBufferIndex = buffer - m_inp_mem_ptr;
}
}
if (nBufferIndex > drv_ctx.ip_buf.actualcount ) {
DEBUG_PRINT_ERROR("ERROR:ETB nBufferIndex is invalid");
return OMX_ErrorBadParameter;
}
if (buffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
codec_config_flag = true;
DEBUG_PRINT_LOW("%s: codec_config buffer", __FUNCTION__);
}
DEBUG_PRINT_LOW("[ETB] BHdr(%p) pBuf(%p) nTS(%lld) nFL(%u)",
buffer, buffer->pBuffer, buffer->nTimeStamp, (unsigned int)buffer->nFilledLen);
if (arbitrary_bytes) {
post_event ((unsigned long)hComp,(unsigned long)buffer,
OMX_COMPONENT_GENERATE_ETB_ARBITRARY);
} else {
post_event ((unsigned long)hComp,(unsigned long)buffer,OMX_COMPONENT_GENERATE_ETB);
}
time_stamp_dts.insert_timestamp(buffer);
return OMX_ErrorNone;
}
| 7,421 |
186,278 | 1 | void BrowserPpapiHostImpl::DeleteInstance(PP_Instance instance) {
auto it = instance_map_.find(instance);
DCHECK(it != instance_map_.end());
// We need to tell the observers for that instance that we are destroyed
// because we won't have the opportunity to once we remove them from the
// |instance_map_|. If the instance was deleted, observers for those instances
// should never call back into the host anyway, so it is safe to tell them
// that the host is destroyed.
for (auto& observer : it->second->observer_list)
observer.OnHostDestroyed();
instance_map_.erase(it);
}
| 7,422 |
83,734 | 0 | static int index_entry_reuc_init(git_index_reuc_entry **reuc_out,
const char *path,
int ancestor_mode, const git_oid *ancestor_oid,
int our_mode, const git_oid *our_oid,
int their_mode, const git_oid *their_oid)
{
git_index_reuc_entry *reuc = NULL;
assert(reuc_out && path);
*reuc_out = reuc = reuc_entry_alloc(path);
GITERR_CHECK_ALLOC(reuc);
if ((reuc->mode[0] = ancestor_mode) > 0) {
assert(ancestor_oid);
git_oid_cpy(&reuc->oid[0], ancestor_oid);
}
if ((reuc->mode[1] = our_mode) > 0) {
assert(our_oid);
git_oid_cpy(&reuc->oid[1], our_oid);
}
if ((reuc->mode[2] = their_mode) > 0) {
assert(their_oid);
git_oid_cpy(&reuc->oid[2], their_oid);
}
return 0;
}
| 7,423 |
130,023 | 0 | void VariationsSeedStore::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterStringPref(prefs::kVariationsCompressedSeed, std::string());
registry->RegisterStringPref(prefs::kVariationsSeed, std::string());
registry->RegisterInt64Pref(prefs::kVariationsSeedDate,
base::Time().ToInternalValue());
registry->RegisterStringPref(prefs::kVariationsSeedSignature, std::string());
registry->RegisterStringPref(prefs::kVariationsCountry, std::string());
}
| 7,424 |
123,692 | 0 | static bool MakeDecoderContextCurrent(
const base::WeakPtr<GpuCommandBufferStub> stub) {
if (!stub) {
DLOG(ERROR) << "Stub is gone; won't MakeCurrent().";
return false;
}
if (!stub->decoder()->MakeCurrent()) {
DLOG(ERROR) << "Failed to MakeCurrent()";
return false;
}
return true;
}
| 7,425 |
184,124 | 1 | void Browser::FindInPage(bool find_next, bool forward_direction) {
ShowFindBar();
if (find_next) {
string16 find_text;
#if defined(OS_MACOSX)
// We always want to search for the contents of the find pasteboard on OS X.
find_text = GetFindPboardText();
#endif
GetSelectedTabContentsWrapper()->
GetFindManager()->StartFinding(find_text,
forward_direction,
false); // Not case sensitive.
}
}
| 7,426 |
173,276 | 0 | int main(int argc, char *argv[])
{
FILE *fp_rd = stdin;
FILE *fp_al = NULL;
FILE *fp_wr = stdout;
BOOL interlace = FALSE;
BOOL alpha = FALSE;
int argi;
for (argi = 1; argi < argc; argi++)
{
if (argv[argi][0] == '-')
{
switch (argv[argi][1])
{
case 'i':
interlace = TRUE;
break;
case 'a':
alpha = TRUE;
argi++;
if ((fp_al = fopen (argv[argi], "rb")) == NULL)
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: alpha-channel file %s does not exist\n",
argv[argi]);
exit (1);
}
break;
case 'h':
case '?':
usage();
exit(0);
break;
default:
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
usage();
exit(1);
break;
} /* end switch */
}
else if (fp_rd == stdin)
{
if ((fp_rd = fopen (argv[argi], "rb")) == NULL)
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: file %s does not exist\n", argv[argi]);
exit (1);
}
}
else if (fp_wr == stdout)
{
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: can not create PNG-file %s\n", argv[argi]);
exit (1);
}
}
else
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: too many parameters\n");
usage();
exit (1);
}
} /* end for */
#ifdef __TURBOC__
/* set stdin/stdout to binary, we're reading the PNM always! in binary format */
if (fp_rd == stdin)
{
setmode (STDIN, O_BINARY);
}
if (fp_wr == stdout)
{
setmode (STDOUT, O_BINARY);
}
#endif
/* call the conversion program itself */
if (pnm2png (fp_rd, fp_wr, fp_al, interlace, alpha) == FALSE)
{
fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: unsuccessful converting to PNG-image\n");
exit (1);
}
/* close input file */
fclose (fp_rd);
/* close output file */
fclose (fp_wr);
/* close alpha file */
if (alpha)
fclose (fp_al);
return 0;
}
| 7,427 |
34,446 | 0 | static int check_defrag_in_cache(struct inode *inode, u64 offset, int thresh)
{
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
struct extent_map *em = NULL;
struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
u64 end;
read_lock(&em_tree->lock);
em = lookup_extent_mapping(em_tree, offset, PAGE_CACHE_SIZE);
read_unlock(&em_tree->lock);
if (em) {
end = extent_map_end(em);
free_extent_map(em);
if (end - offset > thresh)
return 0;
}
/* if we already have a nice delalloc here, just stop */
thresh /= 2;
end = count_range_bits(io_tree, &offset, offset + thresh,
thresh, EXTENT_DELALLOC, 1);
if (end >= thresh)
return 0;
return 1;
}
| 7,428 |
166,013 | 0 | void RTCPeerConnectionHandler::OnWebRtcEventLogWrite(
const std::string& output) {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
if (peer_connection_tracker_) {
peer_connection_tracker_->TrackRtcEventLogWrite(this, output);
}
}
| 7,429 |
53,478 | 0 | lzss_mask(struct lzss *lzss)
{
return lzss->mask;
}
| 7,430 |
47,416 | 0 | static int zlib_decompress_final(struct crypto_pcomp *tfm,
struct comp_request *req)
{
int ret;
struct zlib_ctx *dctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm));
struct z_stream_s *stream = &dctx->decomp_stream;
pr_debug("avail_in %u, avail_out %u\n", req->avail_in, req->avail_out);
stream->next_in = req->next_in;
stream->avail_in = req->avail_in;
stream->next_out = req->next_out;
stream->avail_out = req->avail_out;
if (dctx->decomp_windowBits < 0) {
ret = zlib_inflate(stream, Z_SYNC_FLUSH);
/*
* Work around a bug in zlib, which sometimes wants to taste an
* extra byte when being used in the (undocumented) raw deflate
* mode. (From USAGI).
*/
if (ret == Z_OK && !stream->avail_in && stream->avail_out) {
const void *saved_next_in = stream->next_in;
u8 zerostuff = 0;
stream->next_in = &zerostuff;
stream->avail_in = 1;
ret = zlib_inflate(stream, Z_FINISH);
stream->next_in = saved_next_in;
stream->avail_in = 0;
}
} else
ret = zlib_inflate(stream, Z_FINISH);
if (ret != Z_STREAM_END) {
pr_debug("zlib_inflate failed %d\n", ret);
return -EINVAL;
}
ret = req->avail_out - stream->avail_out;
pr_debug("avail_in %lu, avail_out %lu (consumed %lu, produced %u)\n",
stream->avail_in, stream->avail_out,
req->avail_in - stream->avail_in, ret);
req->next_in = stream->next_in;
req->avail_in = stream->avail_in;
req->next_out = stream->next_out;
req->avail_out = stream->avail_out;
return ret;
}
| 7,431 |
72,148 | 0 | _signal_jobstep(uint32_t jobid, uint32_t stepid, uid_t req_uid,
uint32_t signal)
{
int fd, rc = SLURM_SUCCESS;
uid_t uid;
uint16_t protocol_version;
/* There will be no stepd if the prolog is still running
* Return failure so caller can retry.
*/
if (_prolog_is_running (jobid)) {
info ("signal %d req for %u.%u while prolog is running."
" Returning failure.", signal, jobid, stepid);
return SLURM_FAILURE;
}
fd = stepd_connect(conf->spooldir, conf->node_name, jobid, stepid,
&protocol_version);
if (fd == -1) {
debug("signal for nonexistent %u.%u stepd_connect failed: %m",
jobid, stepid);
return ESLURM_INVALID_JOB_ID;
}
if ((int)(uid = stepd_get_uid(fd, protocol_version)) < 0) {
debug("_signal_jobstep: couldn't read from the step %u.%u: %m",
jobid, stepid);
rc = ESLURM_INVALID_JOB_ID;
goto done2;
}
if ((req_uid != uid) && (!_slurm_authorized_user(req_uid))) {
debug("kill req from uid %ld for job %u.%u owned by uid %ld",
(long) req_uid, jobid, stepid, (long) uid);
rc = ESLURM_USER_ID_MISSING; /* or bad in this case */
goto done2;
}
#ifdef HAVE_AIX
# ifdef SIGMIGRATE
# ifdef SIGSOUND
/* SIGMIGRATE and SIGSOUND are used to initiate job checkpoint on AIX.
* These signals are not sent to the entire process group, but just a
* single process, namely the PMD. */
if (signal == SIGMIGRATE || signal == SIGSOUND) {
rc = stepd_signal_task_local(fd, protocol_version,
signal, 0);
goto done2;
}
# endif
# endif
#endif
rc = stepd_signal_container(fd, protocol_version, signal);
if (rc == -1)
rc = ESLURMD_JOB_NOTRUNNING;
done2:
close(fd);
return rc;
}
| 7,432 |
87,651 | 0 | LIBOPENMPT_MODPLUG_API void ModPlug_UnloadMixerCallback(ModPlugFile* file)
{
if(!file) return;
file->mixerproc = NULL;
if(file->mixerbuf){
free(file->mixerbuf);
file->mixerbuf = NULL;
}
}
| 7,433 |
30,021 | 0 | static void br_multicast_querier_expired(unsigned long data)
{
struct net_bridge *br = (void *)data;
spin_lock(&br->multicast_lock);
if (!netif_running(br->dev) || br->multicast_disabled)
goto out;
br_multicast_start_querier(br);
out:
spin_unlock(&br->multicast_lock);
}
| 7,434 |
35,399 | 0 | analyze_stack(int cpu, struct task_struct *task, unsigned long *stack,
unsigned long **stack_end, unsigned long *irq_stack,
unsigned *used, char **id)
{
unsigned long addr;
addr = ((unsigned long)stack & (~(THREAD_SIZE - 1)));
if ((unsigned long)task_stack_page(task) == addr)
return STACK_IS_NORMAL;
*stack_end = in_exception_stack(cpu, (unsigned long)stack,
used, id);
if (*stack_end)
return STACK_IS_EXCEPTION;
if (!irq_stack)
return STACK_IS_NORMAL;
*stack_end = irq_stack;
irq_stack = irq_stack - irq_stack_size;
if (in_irq_stack(stack, irq_stack, *stack_end))
return STACK_IS_IRQ;
return STACK_IS_UNKNOWN;
}
| 7,435 |
64,448 | 0 | mrb_obj_alloc(mrb_state *mrb, enum mrb_vtype ttype, struct RClass *cls)
{
struct RBasic *p;
static const RVALUE RVALUE_zero = { { { MRB_TT_FALSE } } };
mrb_gc *gc = &mrb->gc;
if (cls) {
enum mrb_vtype tt;
switch (cls->tt) {
case MRB_TT_CLASS:
case MRB_TT_SCLASS:
case MRB_TT_MODULE:
case MRB_TT_ENV:
break;
default:
mrb_raise(mrb, E_TYPE_ERROR, "allocation failure");
}
tt = MRB_INSTANCE_TT(cls);
if (tt != MRB_TT_FALSE &&
ttype != MRB_TT_SCLASS &&
ttype != MRB_TT_ICLASS &&
ttype != MRB_TT_ENV &&
ttype != tt) {
mrb_raisef(mrb, E_TYPE_ERROR, "allocation failure of %S", mrb_obj_value(cls));
}
}
#ifdef MRB_GC_STRESS
mrb_full_gc(mrb);
#endif
if (gc->threshold < gc->live) {
mrb_incremental_gc(mrb);
}
if (gc->free_heaps == NULL) {
add_heap(mrb, gc);
}
p = gc->free_heaps->freelist;
gc->free_heaps->freelist = ((struct free_obj*)p)->next;
if (gc->free_heaps->freelist == NULL) {
unlink_free_heap_page(gc, gc->free_heaps);
}
gc->live++;
gc_protect(mrb, gc, p);
*(RVALUE *)p = RVALUE_zero;
p->tt = ttype;
p->c = cls;
paint_partial_white(gc, p);
return p;
}
| 7,436 |
32,816 | 0 | static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd,
struct i2c_smbus_ioctl_data32 __user *udata)
{
struct i2c_smbus_ioctl_data __user *tdata;
compat_caddr_t datap;
tdata = compat_alloc_user_space(sizeof(*tdata));
if (tdata == NULL)
return -ENOMEM;
if (!access_ok(VERIFY_WRITE, tdata, sizeof(*tdata)))
return -EFAULT;
if (!access_ok(VERIFY_READ, udata, sizeof(*udata)))
return -EFAULT;
if (__copy_in_user(&tdata->read_write, &udata->read_write, 2 * sizeof(u8)))
return -EFAULT;
if (__copy_in_user(&tdata->size, &udata->size, 2 * sizeof(u32)))
return -EFAULT;
if (__get_user(datap, &udata->data) ||
__put_user(compat_ptr(datap), &tdata->data))
return -EFAULT;
return sys_ioctl(fd, cmd, (unsigned long)tdata);
}
| 7,437 |
122,377 | 0 | void HTMLInputElement::updateFocusAppearance(bool restorePreviousSelection)
{
if (isTextField()) {
if (!restorePreviousSelection || !hasCachedSelection())
select();
else
restoreCachedSelection();
if (document().frame())
document().frame()->selection().revealSelection();
} else
HTMLTextFormControlElement::updateFocusAppearance(restorePreviousSelection);
}
| 7,438 |
41,690 | 0 | static int btrfs_truncate(struct inode *inode)
{
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_block_rsv *rsv;
int ret = 0;
int err = 0;
struct btrfs_trans_handle *trans;
u64 mask = root->sectorsize - 1;
u64 min_size = btrfs_calc_trunc_metadata_size(root, 1);
ret = btrfs_wait_ordered_range(inode, inode->i_size & (~mask),
(u64)-1);
if (ret)
return ret;
/*
* Yes ladies and gentelment, this is indeed ugly. The fact is we have
* 3 things going on here
*
* 1) We need to reserve space for our orphan item and the space to
* delete our orphan item. Lord knows we don't want to have a dangling
* orphan item because we didn't reserve space to remove it.
*
* 2) We need to reserve space to update our inode.
*
* 3) We need to have something to cache all the space that is going to
* be free'd up by the truncate operation, but also have some slack
* space reserved in case it uses space during the truncate (thank you
* very much snapshotting).
*
* And we need these to all be seperate. The fact is we can use alot of
* space doing the truncate, and we have no earthly idea how much space
* we will use, so we need the truncate reservation to be seperate so it
* doesn't end up using space reserved for updating the inode or
* removing the orphan item. We also need to be able to stop the
* transaction and start a new one, which means we need to be able to
* update the inode several times, and we have no idea of knowing how
* many times that will be, so we can't just reserve 1 item for the
* entirety of the opration, so that has to be done seperately as well.
* Then there is the orphan item, which does indeed need to be held on
* to for the whole operation, and we need nobody to touch this reserved
* space except the orphan code.
*
* So that leaves us with
*
* 1) root->orphan_block_rsv - for the orphan deletion.
* 2) rsv - for the truncate reservation, which we will steal from the
* transaction reservation.
* 3) fs_info->trans_block_rsv - this will have 1 items worth left for
* updating the inode.
*/
rsv = btrfs_alloc_block_rsv(root, BTRFS_BLOCK_RSV_TEMP);
if (!rsv)
return -ENOMEM;
rsv->size = min_size;
rsv->failfast = 1;
/*
* 1 for the truncate slack space
* 1 for updating the inode.
*/
trans = btrfs_start_transaction(root, 2);
if (IS_ERR(trans)) {
err = PTR_ERR(trans);
goto out;
}
/* Migrate the slack space for the truncate to our reserve */
ret = btrfs_block_rsv_migrate(&root->fs_info->trans_block_rsv, rsv,
min_size);
BUG_ON(ret);
/*
* So if we truncate and then write and fsync we normally would just
* write the extents that changed, which is a problem if we need to
* first truncate that entire inode. So set this flag so we write out
* all of the extents in the inode to the sync log so we're completely
* safe.
*/
set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &BTRFS_I(inode)->runtime_flags);
trans->block_rsv = rsv;
while (1) {
ret = btrfs_truncate_inode_items(trans, root, inode,
inode->i_size,
BTRFS_EXTENT_DATA_KEY);
if (ret != -ENOSPC && ret != -EAGAIN) {
err = ret;
break;
}
trans->block_rsv = &root->fs_info->trans_block_rsv;
ret = btrfs_update_inode(trans, root, inode);
if (ret) {
err = ret;
break;
}
btrfs_end_transaction(trans, root);
btrfs_btree_balance_dirty(root);
trans = btrfs_start_transaction(root, 2);
if (IS_ERR(trans)) {
ret = err = PTR_ERR(trans);
trans = NULL;
break;
}
ret = btrfs_block_rsv_migrate(&root->fs_info->trans_block_rsv,
rsv, min_size);
BUG_ON(ret); /* shouldn't happen */
trans->block_rsv = rsv;
}
if (ret == 0 && inode->i_nlink > 0) {
trans->block_rsv = root->orphan_block_rsv;
ret = btrfs_orphan_del(trans, inode);
if (ret)
err = ret;
}
if (trans) {
trans->block_rsv = &root->fs_info->trans_block_rsv;
ret = btrfs_update_inode(trans, root, inode);
if (ret && !err)
err = ret;
ret = btrfs_end_transaction(trans, root);
btrfs_btree_balance_dirty(root);
}
out:
btrfs_free_block_rsv(root, rsv);
if (ret && !err)
err = ret;
return err;
}
| 7,439 |
111,826 | 0 | void SyncBackendHost::Core::OnPassphraseAccepted() {
if (!sync_loop_)
return;
DCHECK_EQ(MessageLoop::current(), sync_loop_);
host_.Call(
FROM_HERE,
&SyncBackendHost::NotifyPassphraseAccepted);
}
| 7,440 |
106,798 | 0 | void AddGoogleUpdateWorkItems(const InstallationState& original_state,
const InstallerState& installer_state,
WorkItemList* install_list) {
if (installer_state.operation() != InstallerState::MULTI_INSTALL &&
installer_state.operation() != InstallerState::MULTI_UPDATE) {
VLOG(1) << "AddGoogleUpdateWorkItems noop: " << installer_state.operation();
return;
}
if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) {
std::wstring multi_key(
installer_state.multi_package_binaries_distribution()->GetStateKey());
const ProductState* chrome_product_state =
original_state.GetNonVersionedProductState(
installer_state.system_install(),
BrowserDistribution::CHROME_BROWSER);
const std::wstring& brand(chrome_product_state->brand());
if (!brand.empty()) {
install_list->AddCreateRegKeyWorkItem(installer_state.root_key(),
multi_key);
install_list->AddSetRegValueWorkItem(installer_state.root_key(),
multi_key,
google_update::kRegBrandField,
brand,
false);
}
}
AddUsageStatsWorkItems(original_state, installer_state, install_list);
}
| 7,441 |
165,136 | 0 | Element* HTMLFormElement::ElementFromPastNamesMap(
const AtomicString& past_name) {
if (past_name.IsEmpty() || !past_names_map_)
return nullptr;
Element* element = past_names_map_->at(past_name);
#if DCHECK_IS_ON()
if (!element)
return nullptr;
SECURITY_DCHECK(ToHTMLElement(element)->formOwner() == this);
if (IsHTMLImageElement(*element)) {
SECURITY_DCHECK(ImageElements().Find(element) != kNotFound);
} else if (IsHTMLObjectElement(*element)) {
SECURITY_DCHECK(ListedElements().Find(ToHTMLObjectElement(element)) !=
kNotFound);
} else {
SECURITY_DCHECK(ListedElements().Find(ToHTMLFormControlElement(element)) !=
kNotFound);
}
#endif
return element;
}
| 7,442 |
142,572 | 0 | void ShelfWidget::ShowIfHidden() {
if (!IsVisible())
Show();
}
| 7,443 |
20,846 | 0 | static int kvm_vm_ioctl_get_pit(struct kvm *kvm, struct kvm_pit_state *ps)
{
int r = 0;
mutex_lock(&kvm->arch.vpit->pit_state.lock);
memcpy(ps, &kvm->arch.vpit->pit_state, sizeof(struct kvm_pit_state));
mutex_unlock(&kvm->arch.vpit->pit_state.lock);
return r;
}
| 7,444 |
109,934 | 0 | void GpuVideoDecodeAccelerator::NotifyResetDone() {
if (!Send(new AcceleratedVideoDecoderHostMsg_ResetDone(host_route_id_)))
DLOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_ResetDone) failed";
}
| 7,445 |
63,175 | 0 | void MSG_WriteLong( msg_t *sb, int c ) {
MSG_WriteBits( sb, c, 32 );
}
| 7,446 |
143,446 | 0 | void TokenPreloadScanner::rewindTo(TokenPreloadScannerCheckpoint checkpointIndex)
{
ASSERT(checkpointIndex < m_checkpoints.size()); // If this ASSERT fires, checkpointIndex is invalid.
const Checkpoint& checkpoint = m_checkpoints[checkpointIndex];
m_predictedBaseElementURL = checkpoint.predictedBaseElementURL;
m_inStyle = checkpoint.inStyle;
m_isAppCacheEnabled = checkpoint.isAppCacheEnabled;
m_isCSPEnabled = checkpoint.isCSPEnabled;
m_templateCount = checkpoint.templateCount;
m_didRewind = true;
m_inScript = checkpoint.inScript;
m_cssScanner.reset();
m_checkpoints.clear();
}
| 7,447 |
141,736 | 0 | void V8Debugger::disable()
{
if (--m_enableCount)
return;
DCHECK(enabled());
clearBreakpoints();
m_debuggerScript.Reset();
m_debuggerContext.Reset();
allAsyncTasksCanceled();
v8::Debug::SetDebugEventListener(m_isolate, nullptr);
}
| 7,448 |
119,181 | 0 | static bool isSetCookieHeader(const AtomicString& name)
{
return equalIgnoringCase(name, "set-cookie") || equalIgnoringCase(name, "set-cookie2");
}
| 7,449 |
103,245 | 0 | void WebSocketJob::DetachDelegate() {
state_ = CLOSED;
WebSocketThrottle::GetInstance()->RemoveFromQueue(this);
WebSocketThrottle::GetInstance()->WakeupSocketIfNecessary();
scoped_refptr<WebSocketJob> protect(this);
delegate_ = NULL;
if (socket_)
socket_->DetachDelegate();
socket_ = NULL;
if (callback_) {
waiting_ = false;
callback_ = NULL;
Release(); // Balanced with OnStartOpenConnection().
}
}
| 7,450 |
76,507 | 0 | static inline void put_tty_queue(unsigned char c, struct n_tty_data *ldata)
{
*read_buf_addr(ldata, ldata->read_head) = c;
ldata->read_head++;
}
| 7,451 |
121,754 | 0 | int UDPSocketLibevent::GetLocalAddress(IPEndPoint* address) const {
DCHECK(CalledOnValidThread());
DCHECK(address);
if (!is_connected())
return ERR_SOCKET_NOT_CONNECTED;
if (!local_address_.get()) {
SockaddrStorage storage;
if (getsockname(socket_, storage.addr, &storage.addr_len))
return MapSystemError(errno);
scoped_ptr<IPEndPoint> address(new IPEndPoint());
if (!address->FromSockAddr(storage.addr, storage.addr_len))
return ERR_FAILED;
local_address_.reset(address.release());
net_log_.AddEvent(NetLog::TYPE_UDP_LOCAL_ADDRESS,
CreateNetLogUDPConnectCallback(local_address_.get()));
}
*address = *local_address_;
return OK;
}
| 7,452 |
80,680 | 0 | GF_Err afra_dump(GF_Box *a, FILE * trace)
{
u32 i;
GF_AdobeFragRandomAccessBox *p = (GF_AdobeFragRandomAccessBox*)a;
gf_isom_box_dump_start(a, "AdobeFragmentRandomAccessBox", trace);
fprintf(trace, "LongIDs=\"%u\" LongOffsets=\"%u\" TimeScale=\"%u\">\n", p->long_ids, p->long_offsets, p->time_scale);
for (i=0; i<p->entry_count; i++) {
GF_AfraEntry *ae = (GF_AfraEntry *)gf_list_get(p->local_access_entries, i);
fprintf(trace, "<LocalAccessEntry Time=\""LLU"\" Offset=\""LLU"\"/>\n", ae->time, ae->offset);
}
for (i=0; i<p->global_entry_count; i++) {
GF_GlobalAfraEntry *gae = (GF_GlobalAfraEntry *)gf_list_get(p->global_access_entries, i);
fprintf(trace, "<GlobalAccessEntry Time=\""LLU"\" Segment=\"%u\" Fragment=\"%u\" AfraOffset=\""LLU"\" OffsetFromAfra=\""LLU"\"/>\n",
gae->time, gae->segment, gae->fragment, gae->afra_offset, gae->offset_from_afra);
}
gf_isom_box_dump_done("AdobeFragmentRandomAccessBox", a, trace);
return GF_OK;
}
| 7,453 |
112,766 | 0 | PrintPreviewHandler::PrintPreviewHandler()
: print_backend_(printing::PrintBackend::CreateInstance(NULL)),
regenerate_preview_request_count_(0),
manage_printers_dialog_request_count_(0),
manage_cloud_printers_dialog_request_count_(0),
reported_failed_preview_(false),
has_logged_printers_count_(false) {
ReportUserActionHistogram(PREVIEW_STARTED);
}
| 7,454 |
173,750 | 0 | static int handle_releasedir(struct fuse* fuse, struct fuse_handler* handler,
const struct fuse_in_header* hdr, const struct fuse_release_in* req)
{
struct dirhandle *h = id_to_ptr(req->fh);
TRACE("[%d] RELEASEDIR %p\n", handler->token, h);
closedir(h->d);
free(h);
return 0;
}
| 7,455 |
28,447 | 0 | static int aac_eh_abort(struct scsi_cmnd* cmd)
{
struct scsi_device * dev = cmd->device;
struct Scsi_Host * host = dev->host;
struct aac_dev * aac = (struct aac_dev *)host->hostdata;
int count;
int ret = FAILED;
printk(KERN_ERR "%s: Host adapter abort request (%d,%d,%d,%d)\n",
AAC_DRIVERNAME,
host->host_no, sdev_channel(dev), sdev_id(dev), dev->lun);
switch (cmd->cmnd[0]) {
case SERVICE_ACTION_IN:
if (!(aac->raw_io_interface) ||
!(aac->raw_io_64) ||
((cmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
break;
case INQUIRY:
case READ_CAPACITY:
/* Mark associated FIB to not complete, eh handler does this */
for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) {
struct fib * fib = &aac->fibs[count];
if (fib->hw_fib_va->header.XferState &&
(fib->flags & FIB_CONTEXT_FLAG) &&
(fib->callback_data == cmd)) {
fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
ret = SUCCESS;
}
}
break;
case TEST_UNIT_READY:
/* Mark associated FIB to not complete, eh handler does this */
for (count = 0; count < (host->can_queue + AAC_NUM_MGT_FIB); ++count) {
struct scsi_cmnd * command;
struct fib * fib = &aac->fibs[count];
if ((fib->hw_fib_va->header.XferState & cpu_to_le32(Async | NoResponseExpected)) &&
(fib->flags & FIB_CONTEXT_FLAG) &&
((command = fib->callback_data)) &&
(command->device == cmd->device)) {
fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
command->SCp.phase = AAC_OWNER_ERROR_HANDLER;
if (command == cmd)
ret = SUCCESS;
}
}
}
return ret;
}
| 7,456 |
145,291 | 0 | void ObjectBackedNativeHandler::DeletePrivate(v8::Local<v8::Context> context,
v8::Local<v8::Object> obj,
const char* key) {
obj->DeletePrivate(context,
v8::Private::ForApi(
context->GetIsolate(),
v8::String::NewFromUtf8(context->GetIsolate(), key)))
.FromJust();
}
| 7,457 |
43,655 | 0 | static void follow_mount(struct path *path)
{
while (d_mountpoint(path->dentry)) {
struct vfsmount *mounted = lookup_mnt(path);
if (!mounted)
break;
dput(path->dentry);
mntput(path->mnt);
path->mnt = mounted;
path->dentry = dget(mounted->mnt_root);
}
}
| 7,458 |
119,393 | 0 | base::MessageLoop* RenderThreadImpl::GetMainLoop() {
return message_loop();
}
| 7,459 |
83,384 | 0 | AddDNS(short family, wchar_t *if_name, wchar_t *addr)
{
wchar_t *proto = (family == AF_INET6) ? L"ipv6" : L"ip";
return netsh_dns_cmd(L"add", proto, if_name, addr);
}
| 7,460 |
162,086 | 0 | base::SequencedTaskRunner& RenderProcessHostImpl::GetAecDumpFileTaskRunner() {
if (!audio_debug_recordings_file_task_runner_) {
audio_debug_recordings_file_task_runner_ =
base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN,
base::TaskPriority::USER_BLOCKING});
}
return *audio_debug_recordings_file_task_runner_;
}
| 7,461 |
108,729 | 0 | void ChromotingInstance::UnregisterLoggingInstance() {
base::AutoLock lock(g_logging_lock.Get());
if (this != g_logging_instance.Get().get())
return;
g_has_logging_instance = false;
g_logging_instance.Get().reset();
g_logging_task_runner.Get() = NULL;
VLOG(1) << "Unregistering global log handler";
}
| 7,462 |
7,779 | 0 | static int h2_send_empty_data_es(struct h2s *h2s)
{
struct h2c *h2c = h2s->h2c;
struct buffer *res;
char str[9];
int ret;
if (h2s->st == H2_SS_HLOC || h2s->st == H2_SS_ERROR || h2s->st == H2_SS_CLOSED)
return 1;
if (h2c_mux_busy(h2c, h2s)) {
h2s->flags |= H2_SF_BLK_MBUSY;
return 0;
}
res = h2_get_buf(h2c, &h2c->mbuf);
if (!res) {
h2c->flags |= H2_CF_MUX_MALLOC;
h2s->flags |= H2_SF_BLK_MROOM;
return 0;
}
/* len: 0x000000, type: 0(DATA), flags: ES=1 */
memcpy(str, "\x00\x00\x00\x00\x01", 5);
write_n32(str + 5, h2s->id);
ret = bo_istput(res, ist2(str, 9));
if (likely(ret > 0)) {
h2s->flags |= H2_SF_ES_SENT;
}
else if (!ret) {
h2c->flags |= H2_CF_MUX_MFULL;
h2s->flags |= H2_SF_BLK_MROOM;
return 0;
}
else {
h2c_error(h2c, H2_ERR_INTERNAL_ERROR);
return 0;
}
return ret;
}
| 7,463 |
2,058 | 0 | static SpiceWatch *dummy_watch_add(int fd, int event_mask, SpiceWatchFunc func, void *opaque)
{
return NULL; // apparently allowed?
}
| 7,464 |
21,156 | 0 | static int mem_control_numa_stat_open(struct inode *unused, struct file *file)
{
struct cgroup *cont = file->f_dentry->d_parent->d_fsdata;
file->f_op = &mem_control_numa_stat_file_operations;
return single_open(file, mem_control_numa_stat_show, cont);
}
| 7,465 |
86,813 | 0 | _tiffUnmapProc(thandle_t fd, void* base, toff_t size)
{
(void) fd;
(void) size;
UnmapViewOfFile(base);
}
| 7,466 |
118,594 | 0 | void AppLauncherHandler::HandleSaveAppPageName(const base::ListValue* args) {
base::string16 name;
CHECK(args->GetString(0, &name));
double page_index;
CHECK(args->GetDouble(1, &page_index));
base::AutoReset<bool> auto_reset(&ignore_changes_, true);
PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
ListPrefUpdate update(prefs, prefs::kNtpAppPageNames);
base::ListValue* list = update.Get();
list->Set(static_cast<size_t>(page_index), new base::StringValue(name));
}
| 7,467 |
13,090 | 0 | cf2_getStdVW( CFF_Decoder* decoder )
{
FT_ASSERT( decoder && decoder->current_subfont );
return cf2_intToFixed(
decoder->current_subfont->private_dict.standard_height );
}
| 7,468 |
155,505 | 0 | bool DataReductionProxySettings::IsConfiguredDataReductionProxy(
const net::ProxyServer& proxy_server) const {
if (proxy_server.is_direct() || !proxy_server.is_valid())
return false;
for (const auto& drp_proxy : configured_proxies_.GetAll()) {
if (drp_proxy.host_port_pair().Equals(proxy_server.host_port_pair()))
return true;
}
return false;
}
| 7,469 |
74,443 | 0 | VerifyTcpChecksum(
tCompletePhysicalAddress *pDataPages,
ULONG ulDataLength,
ULONG ulStartOffset,
tTcpIpPacketParsingResult known,
ULONG whatToFix)
{
USHORT phcs;
tTcpIpPacketParsingResult res = known;
IPHeader *pIpHeader = (IPHeader *)RtlOffsetToPointer(pDataPages[0].Virtual, ulStartOffset);
TCPHeader *pTcpHeader = (TCPHeader *)RtlOffsetToPointer(pIpHeader, res.ipHeaderSize);
USHORT saved = pTcpHeader->tcp_xsum;
USHORT xxpHeaderAndPayloadLen = GetXxpHeaderAndPayloadLen(pIpHeader, res);
if (ulDataLength >= res.ipHeaderSize)
{
phcs = CalculateIpPseudoHeaderChecksum(pIpHeader, res, xxpHeaderAndPayloadLen);
res.xxpCheckSum = CompareNetCheckSumOnEndSystem(phcs, saved) ? ppresPCSOK : ppresCSBad;
if (res.xxpCheckSum != ppresPCSOK || whatToFix)
{
if (whatToFix & pcrFixPHChecksum)
{
if (ulDataLength >= (ULONG)(res.ipHeaderSize + sizeof(*pTcpHeader)))
{
pTcpHeader->tcp_xsum = phcs;
res.fixedXxpCS = res.xxpCheckSum != ppresPCSOK;
}
else
res.xxpStatus = ppresXxpIncomplete;
}
else if (res.xxpFull)
{
pTcpHeader->tcp_xsum = phcs;
CalculateTcpChecksumGivenPseudoCS(pTcpHeader, pDataPages, ulStartOffset + res.ipHeaderSize, xxpHeaderAndPayloadLen);
if (CompareNetCheckSumOnEndSystem(pTcpHeader->tcp_xsum, saved))
res.xxpCheckSum = ppresCSOK;
if (!(whatToFix & pcrFixXxpChecksum))
pTcpHeader->tcp_xsum = saved;
else
res.fixedXxpCS =
res.xxpCheckSum == ppresCSBad || res.xxpCheckSum == ppresPCSOK;
}
else if (whatToFix)
{
res.xxpStatus = ppresXxpIncomplete;
}
}
else if (res.xxpFull)
{
CalculateTcpChecksumGivenPseudoCS(pTcpHeader, pDataPages, ulStartOffset + res.ipHeaderSize, xxpHeaderAndPayloadLen);
if (CompareNetCheckSumOnEndSystem(pTcpHeader->tcp_xsum, saved))
res.xxpCheckSum = ppresCSOK;
pTcpHeader->tcp_xsum = saved;
}
}
else
res.ipCheckSum = ppresIPTooShort;
return res;
}
| 7,470 |
166,566 | 0 | void BrowserCommandController::UpdateCommandsForHostedAppAvailability() {
bool has_toolbar =
browser_->is_type_tabbed() ||
extensions::HostedAppBrowserController::IsForExperimentalHostedAppBrowser(
browser_);
if (window() && window()->ShouldHideUIForFullscreen())
has_toolbar = false;
command_updater_.UpdateCommandEnabled(IDC_FOCUS_TOOLBAR, has_toolbar);
command_updater_.UpdateCommandEnabled(IDC_FOCUS_NEXT_PANE, has_toolbar);
command_updater_.UpdateCommandEnabled(IDC_FOCUS_PREVIOUS_PANE, has_toolbar);
command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, has_toolbar);
}
| 7,471 |
51,576 | 0 | static inline bool tcp_packet_delayed(const struct tcp_sock *tp)
{
return !tp->retrans_stamp ||
tcp_tsopt_ecr_before(tp, tp->retrans_stamp);
}
| 7,472 |
85,281 | 0 | int need_dentry_mark(struct f2fs_sb_info *sbi, nid_t nid)
{
struct f2fs_nm_info *nm_i = NM_I(sbi);
struct nat_entry *e;
bool need = false;
down_read(&nm_i->nat_tree_lock);
e = __lookup_nat_cache(nm_i, nid);
if (e) {
if (!get_nat_flag(e, IS_CHECKPOINTED) &&
!get_nat_flag(e, HAS_FSYNCED_INODE))
need = true;
}
up_read(&nm_i->nat_tree_lock);
return need;
}
| 7,473 |
57,068 | 0 | static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode)
{
if (delegation == NULL)
return 0;
if ((delegation->type & fmode) != fmode)
return 0;
if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags))
return 0;
nfs_mark_delegation_referenced(delegation);
return 1;
}
| 7,474 |
151,769 | 0 | void Browser::WindowFullscreenStateChanged() {
exclusive_access_manager_->fullscreen_controller()
->WindowFullscreenStateChanged();
command_controller_->FullscreenStateChanged();
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN);
}
| 7,475 |
71,338 | 0 | static int on_headers_complete(http_parser *parser)
{
parser_context *ctx = (parser_context *) parser->data;
http_subtransport *t = ctx->t;
http_stream *s = ctx->s;
git_buf buf = GIT_BUF_INIT;
int error = 0, no_callback = 0, allowed_auth_types = 0;
/* Both parse_header_name and parse_header_value are populated
* and ready for consumption. */
if (VALUE == t->last_cb)
if (on_header_ready(t) < 0)
return t->parse_error = PARSE_ERROR_GENERIC;
/* Capture authentication headers which may be a 401 (authentication
* is not complete) or a 200 (simply informing us that auth *is*
* complete.)
*/
if (parse_authenticate_response(&t->www_authenticate, t,
&allowed_auth_types) < 0)
return t->parse_error = PARSE_ERROR_GENERIC;
/* Check for an authentication failure. */
if (parser->status_code == 401 && get_verb == s->verb) {
if (!t->owner->cred_acquire_cb) {
no_callback = 1;
} else {
if (allowed_auth_types) {
if (t->cred) {
t->cred->free(t->cred);
t->cred = NULL;
}
error = t->owner->cred_acquire_cb(&t->cred,
t->owner->url,
t->connection_data.user,
allowed_auth_types,
t->owner->cred_acquire_payload);
if (error == GIT_PASSTHROUGH) {
no_callback = 1;
} else if (error < 0) {
t->error = error;
return t->parse_error = PARSE_ERROR_EXT;
} else {
assert(t->cred);
if (!(t->cred->credtype & allowed_auth_types)) {
giterr_set(GITERR_NET, "credentials callback returned an invalid cred type");
return t->parse_error = PARSE_ERROR_GENERIC;
}
/* Successfully acquired a credential. */
t->parse_error = PARSE_ERROR_REPLAY;
return 0;
}
}
}
if (no_callback) {
giterr_set(GITERR_NET, "authentication required but no callback set");
return t->parse_error = PARSE_ERROR_GENERIC;
}
}
/* Check for a redirect.
* Right now we only permit a redirect to the same hostname. */
if ((parser->status_code == 301 ||
parser->status_code == 302 ||
(parser->status_code == 303 && get_verb == s->verb) ||
parser->status_code == 307) &&
t->location) {
if (s->redirect_count >= 7) {
giterr_set(GITERR_NET, "Too many redirects");
return t->parse_error = PARSE_ERROR_GENERIC;
}
if (gitno_connection_data_from_url(&t->connection_data, t->location, s->service_url) < 0)
return t->parse_error = PARSE_ERROR_GENERIC;
/* Set the redirect URL on the stream. This is a transfer of
* ownership of the memory. */
if (s->redirect_url)
git__free(s->redirect_url);
s->redirect_url = t->location;
t->location = NULL;
t->connected = 0;
s->redirect_count++;
t->parse_error = PARSE_ERROR_REPLAY;
return 0;
}
/* Check for a 200 HTTP status code. */
if (parser->status_code != 200) {
giterr_set(GITERR_NET,
"Unexpected HTTP status code: %d",
parser->status_code);
return t->parse_error = PARSE_ERROR_GENERIC;
}
/* The response must contain a Content-Type header. */
if (!t->content_type) {
giterr_set(GITERR_NET, "No Content-Type header in response");
return t->parse_error = PARSE_ERROR_GENERIC;
}
/* The Content-Type header must match our expectation. */
if (get_verb == s->verb)
git_buf_printf(&buf,
"application/x-git-%s-advertisement",
ctx->s->service);
else
git_buf_printf(&buf,
"application/x-git-%s-result",
ctx->s->service);
if (git_buf_oom(&buf))
return t->parse_error = PARSE_ERROR_GENERIC;
if (strcmp(t->content_type, git_buf_cstr(&buf))) {
git_buf_free(&buf);
giterr_set(GITERR_NET,
"Invalid Content-Type: %s",
t->content_type);
return t->parse_error = PARSE_ERROR_GENERIC;
}
git_buf_free(&buf);
return 0;
}
| 7,476 |
84,081 | 0 | static unsigned int rds_pages_in_vec(struct rds_iovec *vec)
{
if ((vec->addr + vec->bytes <= vec->addr) ||
(vec->bytes > (u64)UINT_MAX))
return 0;
return ((vec->addr + vec->bytes + PAGE_SIZE - 1) >> PAGE_SHIFT) -
(vec->addr >> PAGE_SHIFT);
}
| 7,477 |
10,412 | 0 | static int megasas_build_sense(MegasasCmd *cmd, uint8_t *sense_ptr,
uint8_t sense_len)
{
PCIDevice *pcid = PCI_DEVICE(cmd->state);
uint32_t pa_hi = 0, pa_lo;
hwaddr pa;
if (sense_len > cmd->frame->header.sense_len) {
sense_len = cmd->frame->header.sense_len;
}
if (sense_len) {
pa_lo = le32_to_cpu(cmd->frame->pass.sense_addr_lo);
if (megasas_frame_is_sense64(cmd)) {
pa_hi = le32_to_cpu(cmd->frame->pass.sense_addr_hi);
}
pa = ((uint64_t) pa_hi << 32) | pa_lo;
pci_dma_write(pcid, pa, sense_ptr, sense_len);
cmd->frame->header.sense_len = sense_len;
}
return sense_len;
}
| 7,478 |
57,776 | 0 | static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu)
{
return kvm_arch_interrupt_allowed(vcpu) &&
!kvm_cpu_has_interrupt(vcpu) &&
!kvm_event_needs_reinjection(vcpu) &&
kvm_cpu_accept_dm_intr(vcpu);
}
| 7,479 |
65,086 | 0 | static MagickBooleanType WriteARTImage(const ImageInfo *image_info,Image *image)
{
MagickBooleanType
status;
QuantumInfo
*quantum_info;
register const PixelPacket
*p;
size_t
length;
ssize_t
count,
y;
unsigned char
*pixels;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
if ((image->columns > 65535UL) || (image->rows > 65535UL))
ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
image->endian=MSBEndian;
image->depth=1;
(void) WriteBlobLSBShort(image,0);
(void) WriteBlobLSBShort(image,(unsigned short) image->columns);
(void) WriteBlobLSBShort(image,0);
(void) WriteBlobLSBShort(image,(unsigned short) image->rows);
(void) TransformImageColorspace(image,sRGBColorspace);
length=(image->columns+7)/8;
pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
/*
Convert image to a bi-level image.
*/
(void) SetImageType(image,BilevelType);
quantum_info=AcquireQuantumInfo(image_info,image);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
(void) ExportQuantumPixels(image,(const CacheView *) NULL,quantum_info,
GrayQuantum,pixels,&image->exception);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)
ThrowWriterException(CorruptImageError,"UnableToWriteImageData");
(void) WriteBlob(image,(size_t) (-(ssize_t) length) & 0x01,pixels);
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
quantum_info=DestroyQuantumInfo(quantum_info);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
(void) CloseBlob(image);
return(MagickTrue);
}
| 7,480 |
25,233 | 0 | static int ev67_check_constraints(struct perf_event **event,
unsigned long *evtype, int n_ev)
{
int idx0;
unsigned long config;
idx0 = ev67_mapping[evtype[0]-1].idx;
config = ev67_mapping[evtype[0]-1].config;
if (n_ev == 1)
goto success;
BUG_ON(n_ev != 2);
if (evtype[0] == EV67_MBOXREPLAY || evtype[1] == EV67_MBOXREPLAY) {
/* MBOX replay traps must be on PMC 1 */
idx0 = (evtype[0] == EV67_MBOXREPLAY) ? 1 : 0;
/* Only cycles can accompany MBOX replay traps */
if (evtype[idx0] == EV67_CYCLES) {
config = EV67_PCTR_CYCLES_MBOX;
goto success;
}
}
if (evtype[0] == EV67_BCACHEMISS || evtype[1] == EV67_BCACHEMISS) {
/* Bcache misses must be on PMC 1 */
idx0 = (evtype[0] == EV67_BCACHEMISS) ? 1 : 0;
/* Only instructions can accompany Bcache misses */
if (evtype[idx0] == EV67_INSTRUCTIONS) {
config = EV67_PCTR_INSTR_BCACHEMISS;
goto success;
}
}
if (evtype[0] == EV67_INSTRUCTIONS || evtype[1] == EV67_INSTRUCTIONS) {
/* Instructions must be on PMC 0 */
idx0 = (evtype[0] == EV67_INSTRUCTIONS) ? 0 : 1;
/* By this point only cycles can accompany instructions */
if (evtype[idx0^1] == EV67_CYCLES) {
config = EV67_PCTR_INSTR_CYCLES;
goto success;
}
}
/* Otherwise, darn it, there is a conflict. */
return -1;
success:
event[0]->hw.idx = idx0;
event[0]->hw.config_base = config;
if (n_ev == 2) {
event[1]->hw.idx = idx0 ^ 1;
event[1]->hw.config_base = config;
}
return 0;
}
| 7,481 |
159,602 | 0 | Node* Document::adoptNode(Node* source, ExceptionState& exception_state) {
EventQueueScope scope;
switch (source->getNodeType()) {
case kDocumentNode:
exception_state.ThrowDOMException(kNotSupportedError,
"The node provided is of type '" +
source->nodeName() +
"', which may not be adopted.");
return nullptr;
case kAttributeNode: {
Attr* attr = ToAttr(source);
if (Element* owner_element = attr->ownerElement())
owner_element->removeAttributeNode(attr, exception_state);
break;
}
default:
if (source->IsShadowRoot()) {
exception_state.ThrowDOMException(
kHierarchyRequestError,
"The node provided is a shadow root, which may not be adopted.");
return nullptr;
}
if (source->IsFrameOwnerElement()) {
HTMLFrameOwnerElement* frame_owner_element =
ToHTMLFrameOwnerElement(source);
if (GetFrame() && GetFrame()->Tree().IsDescendantOf(
frame_owner_element->ContentFrame())) {
exception_state.ThrowDOMException(
kHierarchyRequestError,
"The node provided is a frame which contains this document.");
return nullptr;
}
}
if (source->parentNode()) {
source->parentNode()->RemoveChild(source, exception_state);
if (exception_state.HadException())
return nullptr;
if (source->parentNode()) {
AddConsoleMessage(ConsoleMessage::Create(
kJSMessageSource, kWarningMessageLevel,
ExceptionMessages::FailedToExecute("adoptNode", "Document",
"Unable to remove the "
"specified node from the "
"original parent.")));
return nullptr;
}
}
}
AdoptIfNeeded(*source);
return source;
}
| 7,482 |
19,118 | 0 | static int tcp6_gro_complete(struct sk_buff *skb)
{
const struct ipv6hdr *iph = ipv6_hdr(skb);
struct tcphdr *th = tcp_hdr(skb);
th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb),
&iph->saddr, &iph->daddr, 0);
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
return tcp_gro_complete(skb);
}
| 7,483 |
148,799 | 0 | void InterstitialPageImpl::OnNavigatingAwayOrTabClosing() {
if (action_taken_ == NO_ACTION) {
DontProceed();
} else {
Hide();
}
}
| 7,484 |
8,263 | 0 | XRecordFreeState(XRecordState *state)
{
int i;
for(i=0; i<state->nclients; i++) {
if (state->client_info[i]->ranges) {
if (state->client_info[i]->ranges[0])
Xfree(state->client_info[i]->ranges[0]);
Xfree(state->client_info[i]->ranges);
}
}
if (state->client_info) {
if (state->client_info[0])
Xfree(state->client_info[0]);
Xfree(state->client_info);
}
Xfree(state);
}
| 7,485 |
152,085 | 0 | void RenderFrameHostImpl::SetCommitCallbackInterceptorForTesting(
CommitCallbackInterceptor* interceptor) {
DCHECK(!commit_callback_interceptor_ || !interceptor);
commit_callback_interceptor_ = interceptor;
}
| 7,486 |
139,670 | 0 | void AudioContext::notifyNodeFinishedProcessing(AudioNode* node)
{
ASSERT(isAudioThread());
m_finishedNodes.append(node);
}
| 7,487 |
8,725 | 0 | static int check_cert(X509_STORE_CTX *ctx)
{
X509_CRL *crl = NULL, *dcrl = NULL;
X509 *x;
int ok, cnum;
unsigned int last_reasons;
cnum = ctx->error_depth;
x = sk_X509_value(ctx->chain, cnum);
ctx->current_cert = x;
ctx->current_issuer = NULL;
ctx->current_crl_score = 0;
ctx->current_reasons = 0;
if (x->ex_flags & EXFLAG_PROXY)
return 1;
while (ctx->current_reasons != CRLDP_ALL_REASONS) {
last_reasons = ctx->current_reasons;
/* Try to retrieve relevant CRL */
if (ctx->get_crl)
ok = ctx->get_crl(ctx, &crl, x);
else
ok = get_crl_delta(ctx, &crl, &dcrl, x);
/*
* If error looking up CRL, nothing we can do except notify callback
*/
if (!ok) {
ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL;
ok = ctx->verify_cb(0, ctx);
goto err;
}
ctx->current_crl = crl;
ok = ctx->check_crl(ctx, crl);
if (!ok)
goto err;
if (dcrl) {
ok = ctx->check_crl(ctx, dcrl);
if (!ok)
goto err;
ok = ctx->cert_crl(ctx, dcrl, x);
if (!ok)
goto err;
} else
ok = 1;
/* Don't look in full CRL if delta reason is removefromCRL */
if (ok != 2) {
ok = ctx->cert_crl(ctx, crl, x);
if (!ok)
goto err;
}
X509_CRL_free(crl);
X509_CRL_free(dcrl);
crl = NULL;
dcrl = NULL;
/*
* If reasons not updated we wont get anywhere by another iteration,
* so exit loop.
*/
if (last_reasons == ctx->current_reasons) {
ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL;
ok = ctx->verify_cb(0, ctx);
goto err;
}
}
err:
X509_CRL_free(crl);
X509_CRL_free(dcrl);
ctx->current_crl = NULL;
return ok;
}
| 7,488 |
14,397 | 0 | launch_login(struct passwd *pw, const char *hostname)
{
/* Launch login(1). */
execl(LOGIN_PROGRAM, "login", "-h", hostname,
#ifdef xxxLOGIN_NEEDS_TERM
(s->term ? s->term : "unknown"),
#endif /* LOGIN_NEEDS_TERM */
#ifdef LOGIN_NO_ENDOPT
"-p", "-f", pw->pw_name, (char *)NULL);
#else
"-p", "-f", "--", pw->pw_name, (char *)NULL);
#endif
/* Login couldn't be executed, die. */
perror("login");
exit(1);
}
| 7,489 |
113,591 | 0 | bool AccessibilityUIElement::isFocused() const
{
return checkElementState(m_element, ATK_STATE_FOCUSED);
}
| 7,490 |
168,493 | 0 | String FileReaderLoader::ConvertToDataURL() {
StringBuilder builder;
builder.Append("data:");
if (!bytes_loaded_)
return builder.ToString();
builder.Append(data_type_);
builder.Append(";base64,");
Vector<char> out;
Base64Encode(static_cast<const char*>(raw_data_->Data()),
raw_data_->ByteLength(), out);
out.push_back('\0');
builder.Append(out.data());
return builder.ToString();
}
| 7,491 |
39,048 | 0 | buf_finalize(StringInfo buf)
{
TxidSnapshot *snap = (TxidSnapshot *) buf->data;
SET_VARSIZE(snap, buf->len);
/* buf is not needed anymore */
buf->data = NULL;
pfree(buf);
return snap;
}
| 7,492 |
22,096 | 0 | static void __unhash_process(struct task_struct *p)
{
nr_threads--;
detach_pid(p, PIDTYPE_PID);
if (thread_group_leader(p)) {
detach_pid(p, PIDTYPE_PGID);
detach_pid(p, PIDTYPE_SID);
list_del_rcu(&p->tasks);
__get_cpu_var(process_counts)--;
}
list_del_rcu(&p->thread_group);
list_del_init(&p->sibling);
}
| 7,493 |
93,074 | 0 | rdpsnd_queue_write(STREAM s, uint16 tick, uint8 index)
{
struct audio_packet *packet = &packet_queue[queue_hi];
unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE;
if (next_hi == queue_pending)
{
logger(Sound, Error, "rdpsnd_queue_write(), no space to queue audio packet");
return;
}
queue_hi = next_hi;
packet->s = *s;
packet->tick = tick;
packet->index = index;
gettimeofday(&packet->arrive_tv, NULL);
}
| 7,494 |
150,556 | 0 | DataReductionProxyConfig::GetProxyConnectionToProbe() const {
DCHECK(thread_checker_.CalledOnValidThread());
const std::vector<DataReductionProxyServer>& proxies =
DataReductionProxyConfig::GetProxiesForHttp();
for (const DataReductionProxyServer& proxy_server : proxies) {
bool is_secure_proxy = proxy_server.IsSecureProxy();
bool is_core_proxy = proxy_server.IsCoreProxy();
if (!network_properties_manager_->HasWarmupURLProbeFailed(is_secure_proxy,
is_core_proxy) &&
network_properties_manager_->ShouldFetchWarmupProbeURL(is_secure_proxy,
is_core_proxy)) {
return proxy_server;
}
}
for (const DataReductionProxyServer& proxy_server : proxies) {
bool is_secure_proxy = proxy_server.IsSecureProxy();
bool is_core_proxy = proxy_server.IsCoreProxy();
if (network_properties_manager_->ShouldFetchWarmupProbeURL(is_secure_proxy,
is_core_proxy)) {
return proxy_server;
}
}
return base::nullopt;
}
| 7,495 |
143,570 | 0 | void OomInterventionTabHelper::OnHighMemoryUsage() {
auto* config = OomInterventionConfig::GetInstance();
if (config->is_renderer_pause_enabled() ||
config->is_navigate_ads_enabled()) {
NearOomReductionInfoBar::Show(web_contents(), this);
intervention_state_ = InterventionState::UI_SHOWN;
if (!last_navigation_timestamp_.is_null()) {
base::TimeDelta time_since_last_navigation =
base::TimeTicks::Now() - last_navigation_timestamp_;
UMA_HISTOGRAM_COUNTS_1M(
"Memory.Experimental.OomIntervention."
"RendererTimeSinceLastNavigationAtIntervention",
time_since_last_navigation.InSeconds());
}
}
near_oom_detected_time_ = base::TimeTicks::Now();
renderer_detection_timer_.AbandonAndStop();
}
| 7,496 |
11,610 | 0 | device_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
Device *device;
DeviceClass *klass;
klass = DEVICE_CLASS (g_type_class_peek (TYPE_DEVICE));
device = DEVICE (G_OBJECT_CLASS (device_parent_class)->constructor (type,
n_construct_properties,
construct_properties));
return G_OBJECT (device);
}
| 7,497 |
93,366 | 0 | static int dev_alloc_name_ns(struct net *net,
struct net_device *dev,
const char *name)
{
char buf[IFNAMSIZ];
int ret;
ret = __dev_alloc_name(net, name, buf);
if (ret >= 0)
strlcpy(dev->name, buf, IFNAMSIZ);
return ret;
}
| 7,498 |
160,633 | 0 | void RenderFrameImpl::LoadDataURL(
const CommonNavigationParams& params,
const RequestNavigationParams& request_params,
WebLocalFrame* frame,
blink::WebFrameLoadType load_type,
blink::WebHistoryItem item_for_history_navigation,
blink::WebHistoryLoadType history_load_type,
bool is_client_redirect) {
GURL data_url = params.url;
#if defined(OS_ANDROID)
if (!request_params.data_url_as_string.empty()) {
#if DCHECK_IS_ON()
{
std::string mime_type, charset, data;
DCHECK(net::DataURL::Parse(data_url, &mime_type, &charset, &data));
DCHECK(data.empty());
}
#endif
data_url = GURL(request_params.data_url_as_string);
if (!data_url.is_valid() || !data_url.SchemeIs(url::kDataScheme)) {
data_url = params.url;
}
}
#endif
std::string mime_type, charset, data;
if (net::DataURL::Parse(data_url, &mime_type, &charset, &data)) {
const GURL base_url = params.base_url_for_data_url.is_empty() ?
params.url : params.base_url_for_data_url;
bool replace = load_type == WebFrameLoadType::kReloadBypassingCache ||
load_type == WebFrameLoadType::kReload;
frame->LoadData(
WebData(data.c_str(), data.length()), WebString::FromUTF8(mime_type),
WebString::FromUTF8(charset), base_url,
params.history_url_for_data_url, replace, load_type,
item_for_history_navigation, history_load_type, is_client_redirect);
} else {
CHECK(false) << "Invalid URL passed: "
<< params.url.possibly_invalid_spec();
}
}
| 7,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.