unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
92,214
| 0
|
static u8 wq_sig(void *wqe)
{
return calc_sig(wqe, (*((u8 *)wqe + 8) & 0x3f) << 4);
}
| 11,300
|
12,160
| 0
|
const char* XMLRPC_GetVersionString() {
return XMLRPC_VERSION_STR;
}
| 11,301
|
28,985
| 0
|
void ssl_calc_verify_ssl( ssl_context *ssl, unsigned char hash[36] )
{
md5_context md5;
sha1_context sha1;
unsigned char pad_1[48];
unsigned char pad_2[48];
SSL_DEBUG_MSG( 2, ( "=> calc verify ssl" ) );
memcpy( &md5 , &ssl->handshake->fin_md5 , sizeof(md5_context) );
memcpy( &sha1, &ssl->handshake->fin_sha1, sizeof(sha1_context) );
memset( pad_1, 0x36, 48 );
memset( pad_2, 0x5C, 48 );
md5_update( &md5, ssl->session_negotiate->master, 48 );
md5_update( &md5, pad_1, 48 );
md5_finish( &md5, hash );
md5_starts( &md5 );
md5_update( &md5, ssl->session_negotiate->master, 48 );
md5_update( &md5, pad_2, 48 );
md5_update( &md5, hash, 16 );
md5_finish( &md5, hash );
sha1_update( &sha1, ssl->session_negotiate->master, 48 );
sha1_update( &sha1, pad_1, 40 );
sha1_finish( &sha1, hash + 16 );
sha1_starts( &sha1 );
sha1_update( &sha1, ssl->session_negotiate->master, 48 );
sha1_update( &sha1, pad_2, 40 );
sha1_update( &sha1, hash + 16, 20 );
sha1_finish( &sha1, hash + 16 );
SSL_DEBUG_BUF( 3, "calculated verify result", hash, 36 );
SSL_DEBUG_MSG( 2, ( "<= calc verify" ) );
return;
}
| 11,302
|
113,764
| 0
|
void PrintPreviewDataSource::StartDataRequest(const std::string& path,
bool is_incognito,
int request_id) {
if (!EndsWith(path, "/print.pdf", true)) {
ChromeWebUIDataSource::StartDataRequest(path, is_incognito, request_id);
return;
}
scoped_refptr<base::RefCountedBytes> data;
std::vector<std::string> url_substr;
base::SplitString(path, '/', &url_substr);
int page_index = 0;
if (url_substr.size() == 3 && base::StringToInt(url_substr[1], &page_index)) {
PrintPreviewDataService::GetInstance()->GetDataEntry(
url_substr[0], page_index, &data);
}
if (data.get()) {
SendResponse(request_id, data);
return;
}
scoped_refptr<base::RefCountedBytes> empty_bytes(new base::RefCountedBytes);
SendResponse(request_id, empty_bytes);
}
| 11,303
|
144,434
| 0
|
void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) {
SetAccessibilityMode(AddAccessibilityModeTo(accessibility_mode_, mode));
}
| 11,304
|
123,368
| 0
|
gfx::GLSurfaceHandle RenderWidgetHostViewGuest::GetCompositingSurface() {
return gfx::GLSurfaceHandle();
}
| 11,305
|
60,222
| 0
|
static int valid_master_desc(const char *new_desc, const char *orig_desc)
{
int prefix_len;
if (!strncmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN))
prefix_len = KEY_TRUSTED_PREFIX_LEN;
else if (!strncmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN))
prefix_len = KEY_USER_PREFIX_LEN;
else
return -EINVAL;
if (!new_desc[prefix_len])
return -EINVAL;
if (orig_desc && strncmp(new_desc, orig_desc, prefix_len))
return -EINVAL;
return 0;
}
| 11,306
|
90,650
| 0
|
void jsB_initregexp(js_State *J)
{
js_pushobject(J, J->RegExp_prototype);
{
jsB_propf(J, "RegExp.prototype.toString", Rp_toString, 0);
jsB_propf(J, "RegExp.prototype.test", Rp_test, 0);
jsB_propf(J, "RegExp.prototype.exec", Rp_exec, 0);
}
js_newcconstructor(J, jsB_RegExp, jsB_new_RegExp, "RegExp", 1);
js_defglobal(J, "RegExp", JS_DONTENUM);
}
| 11,307
|
97,515
| 0
|
bool FrameLoader::subframeIsLoading() const
{
for (Frame* child = m_frame->tree()->lastChild(); child; child = child->tree()->previousSibling()) {
FrameLoader* childLoader = child->loader();
DocumentLoader* documentLoader = childLoader->documentLoader();
if (documentLoader && documentLoader->isLoadingInAPISense())
return true;
documentLoader = childLoader->provisionalDocumentLoader();
if (documentLoader && documentLoader->isLoadingInAPISense())
return true;
}
return false;
}
| 11,308
|
5,313
| 0
|
star_fixup_header (struct tar_sparse_file *file)
{
/* NOTE! st_size was initialized from the header
which actually contains archived size. The following fixes it */
off_t realsize = OFF_FROM_HEADER (current_header->star_in_header.realsize);
file->stat_info->archive_file_size = file->stat_info->stat.st_size;
file->stat_info->stat.st_size = max (0, realsize);
return 0 <= realsize;
}
| 11,309
|
125,179
| 0
|
virtual ~MockCanceledPluginServiceClient() {}
| 11,310
|
68,179
| 0
|
void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
{
struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);
bool prepare = (inet_sk(sk)->cmsg_flags & IP_CMSG_PKTINFO) ||
ipv6_sk_rxinfo(sk);
if (prepare && skb_rtable(skb)) {
/* skb->cb is overloaded: prior to this point it is IP{6}CB
* which has interface index (iif) as the first member of the
* underlying inet{6}_skb_parm struct. This code then overlays
* PKTINFO_SKB_CB and in_pktinfo also has iif as the first
* element so the iif is picked up from the prior IPCB. If iif
* is the loopback interface, then return the sending interface
* (e.g., process binds socket to eth0 for Tx which is
* redirected to loopback in the rtable/dst).
*/
if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)
pktinfo->ipi_ifindex = inet_iif(skb);
pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);
} else {
pktinfo->ipi_ifindex = 0;
pktinfo->ipi_spec_dst.s_addr = 0;
}
/* We need to keep the dst for __ip_options_echo()
* We could restrict the test to opt.ts_needtime || opt.srr,
* but the following is good enough as IP options are not often used.
*/
if (unlikely(IPCB(skb)->opt.optlen))
skb_dst_force(skb);
else
skb_dst_drop(skb);
}
| 11,311
|
140,221
| 0
|
void BluetoothRemoteGATTCharacteristic::contextDestroyed(ExecutionContext*) {
notifyCharacteristicObjectRemoved();
}
| 11,312
|
83,434
| 0
|
get_user_challenge_file(YK_KEY *yk, const char *chalresp_path, const struct passwd *user, char **fn, FILE *debug_file)
{
/* Getting file from user home directory, i.e. ~/.yubico/challenge, or
* from a system wide directory.
*/
/* The challenge to use is located in a file in the user's home directory,
* which therefor can't be encrypted. If an encrypted home directory is used,
* the option chalresp_path can be used to point to a system-wide directory.
*/
const char *filename = NULL; /* not including directory */
char *ptr = NULL;
unsigned int serial = 0;
int ret;
if (! yk_get_serial(yk, 0, 0, &serial)) {
D (debug_file, "Failed to read serial number (serial-api-visible disabled?).");
if (! chalresp_path)
filename = "challenge";
else
filename = user->pw_name;
} else {
/* We have serial number */
/* 0xffffffff == 4294967295 == 10 digits */
size_t len = strlen(chalresp_path == NULL ? "challenge" : user->pw_name) + 1 + 10 + 1;
if ((ptr = malloc(len)) != NULL) {
int res = snprintf(ptr, len, "%s-%u", chalresp_path == NULL ? "challenge" : user->pw_name, serial);
filename = ptr;
if (res < 0 || (unsigned long)res > len) {
/* Not enough space, strangely enough. */
free(ptr);
filename = NULL;
}
}
}
if (filename == NULL)
return 0;
ret = get_user_cfgfile_path (chalresp_path, filename, user, fn);
if(ptr) {
free(ptr);
}
return ret;
}
| 11,313
|
111,484
| 0
|
void InputHandler::nodeTextChanged(const Node* node)
{
if (processingChange() || !node || node != m_currentFocusElement || m_receivedBackspaceKeyDown)
return;
InputLog(LogLevelInfo, "InputHandler::nodeTextChanged");
m_webPage->m_client->inputTextChanged();
removeAttributedTextMarker();
}
| 11,314
|
156,263
| 0
|
void RendererSchedulerImpl::SetRendererProcessType(RendererProcessType type) {
main_thread_only().process_type = type;
}
| 11,315
|
92,960
| 0
|
process_bmpcache2(STREAM s, uint16 flags, RD_BOOL compressed)
{
RD_HBITMAP bitmap;
int y;
uint8 cache_id, cache_idx_low, width, height, Bpp;
uint16 cache_idx, bufsize;
uint8 *data, *bmpdata, *bitmap_id;
bitmap_id = NULL; /* prevent compiler warning */
cache_id = flags & ID_MASK;
Bpp = ((flags & MODE_MASK) >> MODE_SHIFT) - 2;
if (flags & PERSIST)
{
in_uint8p(s, bitmap_id, 8);
}
if (flags & SQUARE)
{
in_uint8(s, width);
height = width;
}
else
{
in_uint8(s, width);
in_uint8(s, height);
}
in_uint16_be(s, bufsize);
bufsize &= BUFSIZE_MASK;
in_uint8(s, cache_idx);
if (cache_idx & LONG_FORMAT)
{
in_uint8(s, cache_idx_low);
cache_idx = ((cache_idx ^ LONG_FORMAT) << 8) + cache_idx_low;
}
in_uint8p(s, data, bufsize);
logger(Graphics, Debug,
"process_bmpcache2(), compr=%d, flags=%x, cx=%d, cy=%d, id=%d, idx=%d, Bpp=%d, bs=%d",
compressed, flags, width, height, cache_id, cache_idx, Bpp, bufsize);
bmpdata = (uint8 *) xmalloc(width * height * Bpp);
if (compressed)
{
if (!bitmap_decompress(bmpdata, width, height, data, bufsize, Bpp))
{
logger(Graphics, Error,
"process_bmpcache2(), failed to decompress bitmap data");
xfree(bmpdata);
return;
}
}
else
{
for (y = 0; y < height; y++)
memcpy(&bmpdata[(height - y - 1) * (width * Bpp)],
&data[y * (width * Bpp)], width * Bpp);
}
bitmap = ui_create_bitmap(width, height, bmpdata);
if (bitmap)
{
cache_put_bitmap(cache_id, cache_idx, bitmap);
if (flags & PERSIST)
pstcache_save_bitmap(cache_id, cache_idx, bitmap_id, width, height,
width * height * Bpp, bmpdata);
}
else
{
logger(Graphics, Error, "process_bmpcache2(), ui_create_bitmap(), failed");
}
xfree(bmpdata);
}
| 11,316
|
3,190
| 0
|
zsetstrokecolor(i_ctx_t * i_ctx_p)
{
int code;
code = zswapcolors(i_ctx_p);
if (code < 0)
return code;
/* Set up for the continuation procedure which will finish by restoring the fill colour space */
/* Make sure the exec stack has enough space */
check_estack(1);
/* Now, the actual continuation routine */
push_op_estack(setstrokecolor_cont);
code = zsetcolor(i_ctx_p);
if (code >= 0)
return o_push_estack;
return code;
}
| 11,317
|
96,755
| 0
|
_gcry_aes_cfb_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
size_t nblocks)
{
RIJNDAEL_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
const unsigned char *inbuf = inbuf_arg;
unsigned int burn_depth = 0;
if (0)
;
#ifdef USE_AESNI
else if (ctx->use_aesni)
{
_gcry_aes_aesni_cfb_dec (ctx, iv, outbuf, inbuf, nblocks);
return;
}
#endif /*USE_AESNI*/
#ifdef USE_SSSE3
else if (ctx->use_ssse3)
{
_gcry_aes_ssse3_cfb_dec (ctx, iv, outbuf, inbuf, nblocks);
return;
}
#endif /*USE_SSSE3*/
#ifdef USE_ARM_CE
else if (ctx->use_arm_ce)
{
_gcry_aes_armv8_ce_cfb_dec (ctx, iv, outbuf, inbuf, nblocks);
return;
}
#endif /*USE_ARM_CE*/
else
{
rijndael_cryptfn_t encrypt_fn = ctx->encrypt_fn;
if (ctx->prefetch_enc_fn)
ctx->prefetch_enc_fn();
for ( ;nblocks; nblocks-- )
{
burn_depth = encrypt_fn (ctx, iv, iv);
cipher_block_xor_n_copy(outbuf, iv, inbuf, BLOCKSIZE);
outbuf += BLOCKSIZE;
inbuf += BLOCKSIZE;
}
}
if (burn_depth)
_gcry_burn_stack (burn_depth + 4 * sizeof(void *));
}
| 11,318
|
159,155
| 0
|
void DownloadItemImpl::InterruptAndDiscardPartialState(
DownloadInterruptReason reason) {
InterruptWithPartialState(0, std::unique_ptr<crypto::SecureHash>(), reason);
}
| 11,319
|
153,066
| 0
|
bool PDFiumEngine::MouseDownState::Matches(
const PDFiumPage::Area& area,
const PDFiumPage::LinkTarget& target) const {
if (area_ != area)
return false;
if (area == PDFiumPage::WEBLINK_AREA)
return target_.url == target.url;
if (area == PDFiumPage::DOCLINK_AREA)
return target_.page == target.page;
return true;
}
| 11,320
|
5,974
| 0
|
e1000e_get_reg_index_with_offset(const uint16_t *mac_reg_access, hwaddr addr)
{
uint16_t index = (addr & 0x1ffff) >> 2;
return index + (mac_reg_access[index] & 0xfffe);
}
| 11,321
|
165,276
| 0
|
void NavigationRequest::OnResponseStarted(
const scoped_refptr<network::ResourceResponse>& response,
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
std::unique_ptr<NavigationData> navigation_data,
const GlobalRequestID& request_id,
bool is_download,
NavigationDownloadPolicy download_policy,
bool is_stream,
base::Optional<SubresourceLoaderParams> subresource_loader_params) {
is_download_ = is_download && IsNavigationDownloadAllowed(download_policy);
is_stream_ = is_stream;
request_id_ = request_id;
if (is_download &&
download_policy == NavigationDownloadPolicy::kDisallowOpenerCrossOrigin) {
content::RenderFrameHost* rfh = frame_tree_node_->current_frame_host();
rfh->AddMessageToConsole(
CONSOLE_MESSAGE_LEVEL_ERROR,
base::StringPrintf(
"Navigating a cross-origin opener to a download (%s) is "
"deprecated, see "
"https://www.chromestatus.com/feature/5742188281462784.",
navigation_handle_->GetURL().spec().c_str()));
GetContentClient()->browser()->LogWebFeatureForCurrentPage(
rfh, blink::mojom::WebFeature::kOpenerNavigationDownloadCrossOrigin);
}
if (state_ != STARTED) {
DEBUG_ALIAS_FOR_GURL(url, navigation_handle_->GetURL());
base::debug::DumpWithoutCrashing();
}
DCHECK_EQ(state_, STARTED);
DCHECK(response);
TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationRequest", this,
"OnResponseStarted");
state_ = RESPONSE_STARTED;
response_should_be_rendered_ =
!is_download_ && (!response->head.headers.get() ||
(response->head.headers->response_code() != 204 &&
response->head.headers->response_code() != 205));
if (!response_should_be_rendered_) {
navigation_handle_->set_net_error_code(net::ERR_ABORTED);
net_error_ = net::ERR_ABORTED;
}
commit_params_.service_worker_provider_id =
navigation_handle_->service_worker_handle()
? navigation_handle_->service_worker_handle()
->service_worker_provider_host_id()
: kInvalidServiceWorkerProviderId;
commit_params_.appcache_host_id =
navigation_handle_->appcache_handle()
? navigation_handle_->appcache_handle()->appcache_host_id()
: blink::mojom::kAppCacheNoHostId;
commit_params_.navigation_timing.fetch_start =
std::max(commit_params_.navigation_timing.fetch_start,
response->head.service_worker_ready_time);
if (commit_params_.was_activated == WasActivatedOption::kUnknown) {
commit_params_.was_activated = WasActivatedOption::kNo;
if (navigation_handle_->IsRendererInitiated() &&
(frame_tree_node_->has_received_user_gesture() ||
frame_tree_node_->has_received_user_gesture_before_nav()) &&
ShouldPropagateUserActivation(
frame_tree_node_->current_origin(),
url::Origin::Create(navigation_handle_->GetURL()))) {
commit_params_.was_activated = WasActivatedOption::kYes;
} else if (((navigation_handle_->HasUserGesture() &&
navigation_handle_->IsRendererInitiated()) ||
navigation_handle_->WasStartedFromContextMenu()) &&
ShouldPropagateUserActivation(
url::Origin::Create(navigation_handle_->GetReferrer().url),
url::Origin::Create(navigation_handle_->GetURL()))) {
commit_params_.was_activated = WasActivatedOption::kYes;
}
}
if (response_should_be_rendered_) {
render_frame_host_ =
frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this);
NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(
render_frame_host_, common_params_.url);
} else {
render_frame_host_ = nullptr;
}
DCHECK(render_frame_host_ || !response_should_be_rendered_);
if (!browser_initiated_ && render_frame_host_ &&
render_frame_host_ != frame_tree_node_->current_frame_host()) {
common_params_.source_location.reset();
if (!frame_tree_node_->navigator()->GetDelegate()->ShouldTransferNavigation(
frame_tree_node_->IsMainFrame())) {
navigation_handle_->set_net_error_code(net::ERR_ABORTED);
frame_tree_node_->ResetNavigationRequest(false, true);
return;
}
}
if (navigation_data)
navigation_handle_->set_navigation_data(std::move(navigation_data));
navigation_handle_->set_proxy_server(response->head.proxy_server);
common_params_.previews_state =
GetContentClient()->browser()->DetermineCommittedPreviews(
common_params_.previews_state, navigation_handle_.get(),
response->head.headers.get());
response_ = response;
url_loader_client_endpoints_ = std::move(url_loader_client_endpoints);
ssl_info_ = response->head.ssl_info;
subresource_loader_params_ = std::move(subresource_loader_params);
if (render_frame_host_ &&
SiteInstanceImpl::ShouldAssignSiteForURL(common_params_.url)) {
render_frame_host_->GetProcess()->SetIsUsed();
SiteInstanceImpl* instance = render_frame_host_->GetSiteInstance();
if (!instance->HasSite() &&
SiteInstanceImpl::DoesSiteRequireDedicatedProcess(
instance->GetBrowserContext(), instance->GetIsolationContext(),
common_params_.url)) {
instance->SetSite(common_params_.url);
}
}
devtools_instrumentation::OnNavigationResponseReceived(*this, *response);
if (is_download_ && (response->head.headers.get() &&
(response->head.headers->response_code() / 100 != 2))) {
OnRequestFailedInternal(
network::URLLoaderCompletionStatus(net::ERR_INVALID_RESPONSE),
false /* skip_throttles */, base::nullopt /* error_page_content */,
false /* collapse_frame */);
return;
}
net::Error net_error = CheckContentSecurityPolicy(
navigation_handle_->WasServerRedirect() /* has_followed_redirect */,
false /* url_upgraded_after_redirect */, true /* is_response_check */);
if (net_error != net::OK) {
OnRequestFailedInternal(network::URLLoaderCompletionStatus(net_error),
false /* skip_throttles */,
base::nullopt /* error_page_content */,
false /* collapse_frame */);
return;
}
navigation_handle_->WillProcessResponse(
base::Bind(&NavigationRequest::OnWillProcessResponseChecksComplete,
base::Unretained(this)));
}
| 11,322
|
100,312
| 0
|
static std::string WrapWithTD(std::string text) {
return "<td>" + text + "</td>";
}
| 11,323
|
77,919
| 0
|
test_bson_iter_init_from_data_at_offset (void)
{
bson_t *bson = bson_with_all_types ();
/* zero out iter, since bson_iter_init doesn't zero out iter->value. */
bson_iter_t iter = {0};
BSON_ASSERT (bson_iter_init (&iter, bson));
ASSERT_CMPINT (bson_iter_offset (&iter), ==, 0);
while (bson_iter_next (&iter)) {
const uint8_t *data = bson_get_data (bson);
int keylen = bson_iter_key_len (&iter);
uint32_t offset = bson_iter_offset (&iter);
bson_iter_t recreated = {0};
BSON_ASSERT (bson_iter_init_from_data_at_offset (
&recreated, data, bson->len, offset, keylen));
if (memcmp ((void *) &iter, (void *) &recreated, sizeof (bson_iter_t)) !=
0) {
int i;
bson_iter_t *iters[] = {&iter, &recreated};
fprintf (stderr,
"recreated iterator does not match initial iterator:\n");
for (i = 0; i < 2; i++) {
fprintf (stderr, "iter %d: ", i);
fprintf (stderr,
"len=%d, off=%d, type=%d, key=%d, d1=%d, d2=%d, "
"d3=%d, d4=%d, next_off=%d, err_off=%d\n",
iters[i]->len,
iters[i]->off,
iters[i]->type,
iters[i]->key,
iters[i]->d1,
iters[i]->d2,
iters[i]->d3,
iters[i]->d4,
iters[i]->next_off,
iters[i]->err_off);
}
ASSERT (false);
}
}
}
| 11,324
|
73,731
| 0
|
static void readTiff8bit (const unsigned char *src,
gdImagePtr im,
uint16 photometric,
int startx,
int starty,
int width,
int height,
char has_alpha,
int extra,
int align)
{
int red, green, blue, alpha;
int x, y;
(void)extra;
(void)align;
switch (photometric) {
case PHOTOMETRIC_PALETTE:
/* Palette has no alpha (see TIFF specs for more details */
for (y = starty; y < starty + height; y++) {
for (x = startx; x < startx + width; x++) {
gdImageSetPixel(im, x, y,*(src++));
}
}
break;
case PHOTOMETRIC_RGB:
if (has_alpha) {
gdImageAlphaBlending(im, 0);
gdImageSaveAlpha(im, 1);
for (y = starty; y < starty + height; y++) {
for (x = startx; x < startx + width; x++) {
red = *src++;
green = *src++;
blue = *src++;
alpha = *src++;
red = MIN (red, alpha);
blue = MIN (blue, alpha);
green = MIN (green, alpha);
if (alpha) {
gdImageSetPixel(im, x, y, gdTrueColorAlpha(red * 255 / alpha, green * 255 / alpha, blue * 255 /alpha, gdAlphaMax - (alpha >> 1)));
} else {
gdImageSetPixel(im, x, y, gdTrueColorAlpha(red, green, blue, gdAlphaMax - (alpha >> 1)));
}
}
}
} else {
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
register unsigned char r = *src++;
register unsigned char g = *src++;
register unsigned char b = *src++;
gdImageSetPixel(im, x, y, gdTrueColor(r, g, b));
}
}
}
break;
case PHOTOMETRIC_MINISWHITE:
if (has_alpha) {
/* We don't process the extra yet */
} else {
for (y = starty; y < starty + height; y++) {
for (x = startx; x < startx + width; x++) {
gdImageSetPixel(im, x, y, ~(*src++));
}
}
}
break;
case PHOTOMETRIC_MINISBLACK:
if (has_alpha) {
/* We don't process the extra yet */
} else {
for (y = starty; y < height; y++) {
for (x = 0; x < width; x++) {
gdImageSetPixel(im, x, y, *src++);
}
}
}
break;
}
}
| 11,325
|
8,635
| 0
|
static void xilinx_ethlite_reset(DeviceState *dev)
{
struct xlx_ethlite *s = XILINX_ETHLITE(dev);
s->rxbuf = 0;
}
| 11,326
|
102,965
| 0
|
int TabStripModel::GetIndexOfTabContents(
const TabContentsWrapper* contents) const {
int index = 0;
TabContentsDataVector::const_iterator iter = contents_data_.begin();
for (; iter != contents_data_.end(); ++iter, ++index) {
if ((*iter)->contents == contents)
return index;
}
return kNoTab;
}
| 11,327
|
146,278
| 0
|
bool WebGLRenderingContextBase::DrawingBufferClientIsBoundForDraw() {
return !framebuffer_binding_;
}
| 11,328
|
30,575
| 0
|
static int afiucv_hs_callback_rx(struct sock *sk, struct sk_buff *skb)
{
struct iucv_sock *iucv = iucv_sk(sk);
if (!iucv) {
kfree_skb(skb);
return NET_RX_SUCCESS;
}
if (sk->sk_state != IUCV_CONNECTED) {
kfree_skb(skb);
return NET_RX_SUCCESS;
}
if (sk->sk_shutdown & RCV_SHUTDOWN) {
kfree_skb(skb);
return NET_RX_SUCCESS;
}
/* write stuff from iucv_msg to skb cb */
if (skb->len < sizeof(struct af_iucv_trans_hdr)) {
kfree_skb(skb);
return NET_RX_SUCCESS;
}
skb_pull(skb, sizeof(struct af_iucv_trans_hdr));
skb_reset_transport_header(skb);
skb_reset_network_header(skb);
spin_lock(&iucv->message_q.lock);
if (skb_queue_empty(&iucv->backlog_skb_q)) {
if (sock_queue_rcv_skb(sk, skb)) {
/* handle rcv queue full */
skb_queue_tail(&iucv->backlog_skb_q, skb);
}
} else
skb_queue_tail(&iucv_sk(sk)->backlog_skb_q, skb);
spin_unlock(&iucv->message_q.lock);
return NET_RX_SUCCESS;
}
| 11,329
|
85,384
| 0
|
void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need)
{
#ifdef CONFIG_F2FS_FAULT_INJECTION
if (time_to_inject(sbi, FAULT_CHECKPOINT)) {
f2fs_show_injection_info(FAULT_CHECKPOINT);
f2fs_stop_checkpoint(sbi, false);
}
#endif
/* balance_fs_bg is able to be pending */
if (need && excess_cached_nats(sbi))
f2fs_balance_fs_bg(sbi);
/*
* We should do GC or end up with checkpoint, if there are so many dirty
* dir/node pages without enough free segments.
*/
if (has_not_enough_free_secs(sbi, 0, 0)) {
mutex_lock(&sbi->gc_mutex);
f2fs_gc(sbi, false, false, NULL_SEGNO);
}
}
| 11,330
|
148,611
| 0
|
TestJavaScriptDialogManager() : message_loop_runner_(new MessageLoopRunner) {}
| 11,331
|
2,129
| 0
|
static inline void red_channel_client_release_sent_item(RedChannelClient *rcc)
{
if (rcc->send_data.item) {
red_channel_client_release_item(rcc,
rcc->send_data.item, TRUE);
rcc->send_data.item = NULL;
}
}
| 11,332
|
43,170
| 0
|
static void oz_free_urb_link(struct oz_urb_link *urbl)
{
if (!urbl)
return;
kmem_cache_free(oz_urb_link_cache, urbl);
}
| 11,333
|
172,104
| 0
|
static void safe_close_(int *fd) {
assert(fd != NULL);
if (*fd != -1) {
close(*fd);
*fd = -1;
}
}
| 11,334
|
159,908
| 0
|
TopSitesImpl::TopSitesImpl(PrefService* pref_service,
HistoryService* history_service,
std::unique_ptr<TopSitesProvider> provider,
const PrepopulatedPageList& prepopulated_pages,
const CanAddURLToHistoryFn& can_add_url_to_history)
: backend_(nullptr),
cache_(base::MakeUnique<TopSitesCache>()),
thread_safe_cache_(base::MakeUnique<TopSitesCache>()),
prepopulated_pages_(prepopulated_pages),
pref_service_(pref_service),
history_service_(history_service),
provider_(std::move(provider)),
can_add_url_to_history_(can_add_url_to_history),
loaded_(false),
history_service_observer_(this) {
DCHECK(pref_service_);
DCHECK(!can_add_url_to_history_.is_null());
DCHECK(provider_);
}
| 11,335
|
186,115
| 1
|
RenderFrameObserverNatives::RenderFrameObserverNatives(ScriptContext* context)
: ObjectBackedNativeHandler(context) {
RouteFunction(
"OnDocumentElementCreated",
base::Bind(&RenderFrameObserverNatives::OnDocumentElementCreated,
base::Unretained(this)));
}
| 11,336
|
59,371
| 0
|
static inline size_t xfrm_migrate_msgsize(int num_migrate, int with_kma,
int with_encp)
{
return NLMSG_ALIGN(sizeof(struct xfrm_userpolicy_id))
+ (with_kma ? nla_total_size(sizeof(struct xfrm_kmaddress)) : 0)
+ (with_encp ? nla_total_size(sizeof(struct xfrm_encap_tmpl)) : 0)
+ nla_total_size(sizeof(struct xfrm_user_migrate) * num_migrate)
+ userpolicy_type_attrsize();
}
| 11,337
|
143,594
| 0
|
void SetMetrics(OomInterventionMetrics metrics) {
metrics_ = std::make_unique<OomInterventionMetrics>();
*metrics_ = metrics;
}
| 11,338
|
144,226
| 0
|
void LockContentsView::UpdateAuthForAuthUser(LoginAuthUserView* opt_to_update,
LoginAuthUserView* opt_to_hide,
bool animate) {
if (animate) {
if (opt_to_update)
opt_to_update->CaptureStateForAnimationPreLayout();
if (opt_to_hide)
opt_to_hide->CaptureStateForAnimationPreLayout();
}
if (opt_to_update) {
UserState* state = FindStateForUser(
opt_to_update->current_user()->basic_user_info->account_id);
uint32_t to_update_auth;
if (state->force_online_sign_in) {
to_update_auth = LoginAuthUserView::AUTH_ONLINE_SIGN_IN;
} else if (state->disable_auth) {
to_update_auth = LoginAuthUserView::AUTH_DISABLED;
} else {
to_update_auth = LoginAuthUserView::AUTH_PASSWORD;
keyboard::KeyboardController* keyboard_controller =
GetKeyboardController();
const bool keyboard_visible =
keyboard_controller ? keyboard_controller->keyboard_visible() : false;
if (state->show_pin && !keyboard_visible &&
state->fingerprint_state ==
mojom::FingerprintUnlockState::UNAVAILABLE) {
to_update_auth |= LoginAuthUserView::AUTH_PIN;
}
if (state->enable_tap_auth)
to_update_auth |= LoginAuthUserView::AUTH_TAP;
if (state->fingerprint_state !=
mojom::FingerprintUnlockState::UNAVAILABLE) {
to_update_auth |= LoginAuthUserView::AUTH_FINGERPRINT;
}
}
opt_to_update->SetAuthMethods(to_update_auth);
}
if (opt_to_hide)
opt_to_hide->SetAuthMethods(LoginAuthUserView::AUTH_NONE);
Layout();
if (animate) {
if (opt_to_update)
opt_to_update->ApplyAnimationPostLayout();
if (opt_to_hide)
opt_to_hide->ApplyAnimationPostLayout();
}
}
| 11,339
|
168,977
| 0
|
GURL CredentialManagerImpl::GetLastCommittedURL() const {
return client_->GetLastCommittedEntryURL();
}
| 11,340
|
115,408
| 0
|
void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef frame)
{
if (!InjectedBundle::shared().isTestRunning())
return;
if (!InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
return;
dumpLoadEvent(frame, "didReceiveServerRedirectForProvisionalLoadForFrame");
}
| 11,341
|
132,264
| 0
|
void RenderFrameImpl::RegisterMojoServices() {
if (!frame_->parent()) {
GetServiceRegistry()->AddService<image_downloader::ImageDownloader>(
base::Bind(&ImageDownloaderImpl::CreateMojoService,
base::Unretained(this)));
}
}
| 11,342
|
44,118
| 0
|
xml_patch_version_check(xmlNode *xml, xmlNode *patchset, int format)
{
int lpc = 0;
bool changed = FALSE;
int this[] = { 0, 0, 0 };
int add[] = { 0, 0, 0 };
int del[] = { 0, 0, 0 };
const char *vfields[] = {
XML_ATTR_GENERATION_ADMIN,
XML_ATTR_GENERATION,
XML_ATTR_NUMUPDATES,
};
for(lpc = 0; lpc < DIMOF(vfields); lpc++) {
crm_element_value_int(xml, vfields[lpc], &(this[lpc]));
crm_trace("Got %d for this[%s]", this[lpc], vfields[lpc]);
if (this[lpc] < 0) {
this[lpc] = 0;
}
}
/* Set some defaults in case nothing is present */
add[0] = this[0];
add[1] = this[1];
add[2] = this[2] + 1;
for(lpc = 0; lpc < DIMOF(vfields); lpc++) {
del[lpc] = this[lpc];
}
xml_patch_versions(patchset, add, del);
for(lpc = 0; lpc < DIMOF(vfields); lpc++) {
if(this[lpc] < del[lpc]) {
crm_debug("Current %s is too low (%d < %d)", vfields[lpc], this[lpc], del[lpc]);
return -pcmk_err_diff_resync;
} else if(this[lpc] > del[lpc]) {
crm_info("Current %s is too high (%d > %d)", vfields[lpc], this[lpc], del[lpc]);
return -pcmk_err_old_data;
}
}
for(lpc = 0; lpc < DIMOF(vfields); lpc++) {
if(add[lpc] > del[lpc]) {
changed = TRUE;
}
}
if(changed == FALSE) {
crm_notice("Versions did not change in patch %d.%d.%d", add[0], add[1], add[2]);
return -pcmk_err_old_data;
}
crm_debug("Can apply patch %d.%d.%d to %d.%d.%d",
add[0], add[1], add[2], this[0], this[1], this[2]);
return pcmk_ok;
}
| 11,343
|
23,121
| 0
|
static int nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, __be32 *p, void *dummy)
{
struct xdr_stream xdr;
struct compound_hdr hdr;
int status;
xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p);
status = decode_compound_hdr(&xdr, &hdr);
if (!status)
status = decode_renew(&xdr);
return status;
}
| 11,344
|
47,995
| 0
|
static int nf_ct_net_init(struct net *net)
{
int res;
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;
res = inet_frags_init_net(&net->nf_frag.frags);
if (res)
return res;
res = nf_ct_frag6_sysctl_register(net);
if (res)
inet_frags_uninit_net(&net->nf_frag.frags);
return res;
}
| 11,345
|
60,758
| 0
|
sg_add_sfp(Sg_device * sdp)
{
Sg_fd *sfp;
unsigned long iflags;
int bufflen;
sfp = kzalloc(sizeof(*sfp), GFP_ATOMIC | __GFP_NOWARN);
if (!sfp)
return ERR_PTR(-ENOMEM);
init_waitqueue_head(&sfp->read_wait);
rwlock_init(&sfp->rq_list_lock);
INIT_LIST_HEAD(&sfp->rq_list);
kref_init(&sfp->f_ref);
mutex_init(&sfp->f_mutex);
sfp->timeout = SG_DEFAULT_TIMEOUT;
sfp->timeout_user = SG_DEFAULT_TIMEOUT_USER;
sfp->force_packid = SG_DEF_FORCE_PACK_ID;
sfp->cmd_q = SG_DEF_COMMAND_Q;
sfp->keep_orphan = SG_DEF_KEEP_ORPHAN;
sfp->parentdp = sdp;
write_lock_irqsave(&sdp->sfd_lock, iflags);
if (atomic_read(&sdp->detaching)) {
write_unlock_irqrestore(&sdp->sfd_lock, iflags);
return ERR_PTR(-ENODEV);
}
list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
write_unlock_irqrestore(&sdp->sfd_lock, iflags);
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
"sg_add_sfp: sfp=0x%p\n", sfp));
if (unlikely(sg_big_buff != def_reserved_size))
sg_big_buff = def_reserved_size;
bufflen = min_t(int, sg_big_buff,
max_sectors_bytes(sdp->device->request_queue));
sg_build_reserve(sfp, bufflen);
SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
"sg_add_sfp: bufflen=%d, k_use_sg=%d\n",
sfp->reserve.bufflen,
sfp->reserve.k_use_sg));
kref_get(&sdp->d_ref);
__module_get(THIS_MODULE);
return sfp;
}
| 11,346
|
87,050
| 0
|
static apr_byte_t oidc_authorization_response_match_state(request_rec *r,
oidc_cfg *c, const char *state, struct oidc_provider_t **provider,
oidc_proto_state_t **proto_state) {
oidc_debug(r, "enter (state=%s)", state);
if ((state == NULL) || (apr_strnatcmp(state, "") == 0)) {
oidc_error(r, "state parameter is not set");
return FALSE;
}
/* check the state parameter against what we stored in a cookie */
if (oidc_restore_proto_state(r, c, state, proto_state) == FALSE) {
oidc_error(r, "unable to restore state");
return FALSE;
}
*provider = oidc_get_provider_for_issuer(r, c,
oidc_proto_state_get_issuer(*proto_state), FALSE);
return (*provider != NULL);
}
| 11,347
|
110,894
| 0
|
void RootWindow::OnLayerAnimationScheduled(
ui::LayerAnimationSequence* animation) {
}
| 11,348
|
27,175
| 0
|
static void thread_check_init(void)
{
g_main_thread = pthread_self();
}
| 11,349
|
91,363
| 0
|
static inline size_t GetPSDPacketSize(const Image *image)
{
if (image->storage_class == PseudoClass)
{
if (image->colors > 256)
return(2);
}
if (image->depth > 16)
return(4);
if (image->depth > 8)
return(2);
return(1);
}
| 11,350
|
59,194
| 0
|
static int construct_alloc_key(struct keyring_search_context *ctx,
struct key *dest_keyring,
unsigned long flags,
struct key_user *user,
struct key **_key)
{
struct assoc_array_edit *edit;
struct key *key;
key_perm_t perm;
key_ref_t key_ref;
int ret;
kenter("%s,%s,,,",
ctx->index_key.type->name, ctx->index_key.description);
*_key = NULL;
mutex_lock(&user->cons_lock);
perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK | KEY_POS_SETATTR;
perm |= KEY_USR_VIEW;
if (ctx->index_key.type->read)
perm |= KEY_POS_READ;
if (ctx->index_key.type == &key_type_keyring ||
ctx->index_key.type->update)
perm |= KEY_POS_WRITE;
key = key_alloc(ctx->index_key.type, ctx->index_key.description,
ctx->cred->fsuid, ctx->cred->fsgid, ctx->cred,
perm, flags, NULL);
if (IS_ERR(key))
goto alloc_failed;
set_bit(KEY_FLAG_USER_CONSTRUCT, &key->flags);
if (dest_keyring) {
ret = __key_link_begin(dest_keyring, &ctx->index_key, &edit);
if (ret < 0)
goto link_prealloc_failed;
}
/* attach the key to the destination keyring under lock, but we do need
* to do another check just in case someone beat us to it whilst we
* waited for locks */
mutex_lock(&key_construction_mutex);
key_ref = search_process_keyrings(ctx);
if (!IS_ERR(key_ref))
goto key_already_present;
if (dest_keyring)
__key_link(key, &edit);
mutex_unlock(&key_construction_mutex);
if (dest_keyring)
__key_link_end(dest_keyring, &ctx->index_key, edit);
mutex_unlock(&user->cons_lock);
*_key = key;
kleave(" = 0 [%d]", key_serial(key));
return 0;
/* the key is now present - we tell the caller that we found it by
* returning -EINPROGRESS */
key_already_present:
key_put(key);
mutex_unlock(&key_construction_mutex);
key = key_ref_to_ptr(key_ref);
if (dest_keyring) {
ret = __key_link_check_live_key(dest_keyring, key);
if (ret == 0)
__key_link(key, &edit);
__key_link_end(dest_keyring, &ctx->index_key, edit);
if (ret < 0)
goto link_check_failed;
}
mutex_unlock(&user->cons_lock);
*_key = key;
kleave(" = -EINPROGRESS [%d]", key_serial(key));
return -EINPROGRESS;
link_check_failed:
mutex_unlock(&user->cons_lock);
key_put(key);
kleave(" = %d [linkcheck]", ret);
return ret;
link_prealloc_failed:
mutex_unlock(&user->cons_lock);
key_put(key);
kleave(" = %d [prelink]", ret);
return ret;
alloc_failed:
mutex_unlock(&user->cons_lock);
kleave(" = %ld", PTR_ERR(key));
return PTR_ERR(key);
}
| 11,351
|
143,935
| 0
|
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
| 11,352
|
178,458
| 1
|
ssize_t pcnet_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
{
PCNetState *s = qemu_get_nic_opaque(nc);
int is_padr = 0, is_bcast = 0, is_ladr = 0;
uint8_t buf1[60];
int remaining;
int crc_err = 0;
int size = size_;
if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size ||
(CSR_LOOP(s) && !s->looptest)) {
return -1;
}
#ifdef PCNET_DEBUG
printf("pcnet_receive size=%d\n", size);
#endif
/* if too small buffer, then expand it */
if (size < MIN_BUF_SIZE) {
memcpy(buf1, buf, size);
memset(buf1 + size, 0, MIN_BUF_SIZE - size);
buf = buf1;
size = MIN_BUF_SIZE;
}
if (CSR_PROM(s)
|| (is_padr=padr_match(s, buf, size))
|| (is_bcast=padr_bcast(s, buf, size))
|| (is_ladr=ladr_match(s, buf, size))) {
pcnet_rdte_poll(s);
if (!(CSR_CRST(s) & 0x8000) && s->rdra) {
struct pcnet_RMD rmd;
int rcvrc = CSR_RCVRC(s)-1,i;
hwaddr nrda;
for (i = CSR_RCVRL(s)-1; i > 0; i--, rcvrc--) {
if (rcvrc <= 1)
rcvrc = CSR_RCVRL(s);
nrda = s->rdra +
(CSR_RCVRL(s) - rcvrc) *
(BCR_SWSTYLE(s) ? 16 : 8 );
RMDLOAD(&rmd, nrda);
if (GET_FIELD(rmd.status, RMDS, OWN)) {
#ifdef PCNET_DEBUG_RMD
printf("pcnet - scan buffer: RCVRC=%d PREV_RCVRC=%d\n",
rcvrc, CSR_RCVRC(s));
#endif
CSR_RCVRC(s) = rcvrc;
pcnet_rdte_poll(s);
break;
}
}
}
if (!(CSR_CRST(s) & 0x8000)) {
#ifdef PCNET_DEBUG_RMD
printf("pcnet - no buffer: RCVRC=%d\n", CSR_RCVRC(s));
#endif
s->csr[0] |= 0x1000; /* Set MISS flag */
CSR_MISSC(s)++;
} else {
uint8_t *src = s->buffer;
hwaddr crda = CSR_CRDA(s);
struct pcnet_RMD rmd;
int pktcount = 0;
if (!s->looptest) {
memcpy(src, buf, size);
/* no need to compute the CRC */
src[size] = 0;
uint32_t fcs = ~0;
uint8_t *p = src;
while (p != &src[size])
CRC(fcs, *p++);
*(uint32_t *)p = htonl(fcs);
size += 4;
} else {
uint32_t fcs = ~0;
uint8_t *p = src;
while (p != &src[size])
CRC(fcs, *p++);
crc_err = (*(uint32_t *)p != htonl(fcs));
}
#ifdef PCNET_DEBUG_MATCH
PRINT_PKTHDR(buf);
#endif
RMDLOAD(&rmd, PHYSADDR(s,crda));
/*if (!CSR_LAPPEN(s))*/
SET_FIELD(&rmd.status, RMDS, STP, 1);
#define PCNET_RECV_STORE() do { \
int count = MIN(4096 - GET_FIELD(rmd.buf_length, RMDL, BCNT),remaining); \
hwaddr rbadr = PHYSADDR(s, rmd.rbadr); \
s->phys_mem_write(s->dma_opaque, rbadr, src, count, CSR_BSWP(s)); \
src += count; remaining -= count; \
SET_FIELD(&rmd.status, RMDS, OWN, 0); \
RMDSTORE(&rmd, PHYSADDR(s,crda)); \
pktcount++; \
} while (0)
remaining = size;
PCNET_RECV_STORE();
if ((remaining > 0) && CSR_NRDA(s)) {
hwaddr nrda = CSR_NRDA(s);
#ifdef PCNET_DEBUG_RMD
PRINT_RMD(&rmd);
#endif
RMDLOAD(&rmd, PHYSADDR(s,nrda));
if (GET_FIELD(rmd.status, RMDS, OWN)) {
crda = nrda;
PCNET_RECV_STORE();
#ifdef PCNET_DEBUG_RMD
PRINT_RMD(&rmd);
#endif
if ((remaining > 0) && (nrda=CSR_NNRD(s))) {
RMDLOAD(&rmd, PHYSADDR(s,nrda));
if (GET_FIELD(rmd.status, RMDS, OWN)) {
crda = nrda;
PCNET_RECV_STORE();
}
}
}
}
#undef PCNET_RECV_STORE
RMDLOAD(&rmd, PHYSADDR(s,crda));
if (remaining == 0) {
SET_FIELD(&rmd.msg_length, RMDM, MCNT, size);
SET_FIELD(&rmd.status, RMDS, ENP, 1);
SET_FIELD(&rmd.status, RMDS, PAM, !CSR_PROM(s) && is_padr);
SET_FIELD(&rmd.status, RMDS, LFAM, !CSR_PROM(s) && is_ladr);
SET_FIELD(&rmd.status, RMDS, BAM, !CSR_PROM(s) && is_bcast);
if (crc_err) {
SET_FIELD(&rmd.status, RMDS, CRC, 1);
SET_FIELD(&rmd.status, RMDS, ERR, 1);
}
} else {
SET_FIELD(&rmd.status, RMDS, OFLO, 1);
SET_FIELD(&rmd.status, RMDS, BUFF, 1);
SET_FIELD(&rmd.status, RMDS, ERR, 1);
}
RMDSTORE(&rmd, PHYSADDR(s,crda));
s->csr[0] |= 0x0400;
#ifdef PCNET_DEBUG
printf("RCVRC=%d CRDA=0x%08x BLKS=%d\n",
CSR_RCVRC(s), PHYSADDR(s,CSR_CRDA(s)), pktcount);
#endif
#ifdef PCNET_DEBUG_RMD
PRINT_RMD(&rmd);
#endif
while (pktcount--) {
if (CSR_RCVRC(s) <= 1)
CSR_RCVRC(s) = CSR_RCVRL(s);
else
CSR_RCVRC(s)--;
}
pcnet_rdte_poll(s);
}
}
pcnet_poll(s);
pcnet_update_irq(s);
return size_;
}
| 11,353
|
127,150
| 0
|
void TryBasicFormFill() {
FocusFirstNameField();
LOG(WARNING) << "Typing 'M' to bring up the Autofill popup.";
SendKeyToPageAndWait(ui::VKEY_M);
LOG(WARNING) << "Simulating down arrow press to initiate Autofill preview.";
SendKeyToPopupAndWait(ui::VKEY_DOWN);
ExpectFieldValue("firstname", "M");
ExpectFieldValue("lastname", "");
ExpectFieldValue("address1", "");
ExpectFieldValue("address2", "");
ExpectFieldValue("city", "");
ExpectFieldValue("state", "");
ExpectFieldValue("zip", "");
ExpectFieldValue("country", "");
ExpectFieldValue("phone", "");
LOG(WARNING) << "Simulating Return press to fill the form.";
SendKeyToPopupAndWait(ui::VKEY_RETURN);
ExpectFilledTestForm();
}
| 11,354
|
62,086
| 0
|
static void InsertComplexDoubleRow(double *p, int y, Image * image, double MinVal,
double MaxVal)
{
ExceptionInfo
*exception;
double f;
int x;
register PixelPacket *q;
if (MinVal == 0)
MinVal = -1;
if (MaxVal == 0)
MaxVal = 1;
exception=(&image->exception);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
return;
for (x = 0; x < (ssize_t) image->columns; x++)
{
if (*p > 0)
{
f = (*p / MaxVal) * (QuantumRange - GetPixelRed(q));
if (f + GetPixelRed(q) > QuantumRange)
SetPixelRed(q,QuantumRange);
else
SetPixelRed(q,GetPixelRed(q)+(int) f);
if ((int) f / 2.0 > GetPixelGreen(q))
{
SetPixelGreen(q,0);
SetPixelBlue(q,0);
}
else
{
SetPixelBlue(q,GetPixelBlue(q)-(int) (f/2.0));
SetPixelGreen(q,GetPixelBlue(q));
}
}
if (*p < 0)
{
f = (*p / MaxVal) * (QuantumRange - GetPixelBlue(q));
if (f + GetPixelBlue(q) > QuantumRange)
SetPixelBlue(q,QuantumRange);
else
SetPixelBlue(q,GetPixelBlue(q)+(int) f);
if ((int) f / 2.0 > q->green)
{
SetPixelRed(q,0);
SetPixelGreen(q,0);
}
else
{
SetPixelRed(q,GetPixelRed(q)-(int) (f/2.0));
SetPixelGreen(q,GetPixelRed(q));
}
}
p++;
q++;
}
if (!SyncAuthenticPixels(image,exception))
return;
return;
}
| 11,355
|
149,855
| 0
|
void LayerTreeHost::SetPageScaleFactorAndLimits(float page_scale_factor,
float min_page_scale_factor,
float max_page_scale_factor) {
if (page_scale_factor_ == page_scale_factor &&
min_page_scale_factor_ == min_page_scale_factor &&
max_page_scale_factor_ == max_page_scale_factor)
return;
page_scale_factor_ = page_scale_factor;
min_page_scale_factor_ = min_page_scale_factor;
max_page_scale_factor_ = max_page_scale_factor;
SetPropertyTreesNeedRebuild();
SetNeedsCommit();
}
| 11,356
|
98,299
| 0
|
void FrameLoaderClient::dispatchDidChangeLocationWithinPage()
{
WebKitWebFramePrivate* priv = m_frame->priv;
g_free(priv->uri);
priv->uri = g_strdup(core(m_frame)->loader()->url().prettyURL().utf8().data());
g_object_notify(G_OBJECT(m_frame), "uri");
WebKitWebView* webView = getViewFromFrame(m_frame);
if (m_frame == webkit_web_view_get_main_frame(webView))
g_object_notify(G_OBJECT(webView), "uri");
}
| 11,357
|
33,167
| 0
|
static struct sk_buff *xfrm_policy_netlink(struct sk_buff *in_skb,
struct xfrm_policy *xp,
int dir, u32 seq)
{
struct xfrm_dump_info info;
struct sk_buff *skb;
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
if (!skb)
return ERR_PTR(-ENOMEM);
info.in_skb = in_skb;
info.out_skb = skb;
info.nlmsg_seq = seq;
info.nlmsg_flags = 0;
if (dump_one_policy(xp, dir, 0, &info) < 0) {
kfree_skb(skb);
return NULL;
}
return skb;
}
| 11,358
|
118,178
| 0
|
bool ValidityMessages::HasErrors() const {
for (MessageMap::const_iterator iter = messages_.begin();
iter != messages_.end(); ++iter) {
if (!iter->second.text.empty())
return true;
}
return false;
}
| 11,359
|
150,492
| 0
|
void NavigationControllerImpl::SetTransientEntry(
std::unique_ptr<NavigationEntry> entry) {
int index = 0;
if (last_committed_entry_index_ != -1)
index = last_committed_entry_index_ + 1;
DiscardTransientEntry();
entries_.insert(entries_.begin() + index,
NavigationEntryImpl::FromNavigationEntry(std::move(entry)));
transient_entry_index_ = index;
delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_ALL);
}
| 11,360
|
6,836
| 0
|
http_msg_forward_chunked_body(struct stream *s, struct http_msg *msg)
{
struct channel *chn = msg->chn;
unsigned int chunk;
int ret;
/* Here we have the guarantee to be in one of the following state:
* HTTP_MSG_DATA, HTTP_MSG_CHUNK_SIZE, HTTP_MSG_CHUNK_CRLF,
* HTTP_MSG_TRAILERS or HTTP_MSG_ENDING. */
switch_states:
switch (msg->msg_state) {
case HTTP_MSG_DATA:
ret = FLT_STRM_DATA_CB(s, chn, flt_http_data(s, msg),
/* default_ret */ MIN(msg->chunk_len, chn->buf->i - msg->next),
/* on_error */ goto error);
msg->next += ret;
msg->chunk_len -= ret;
if (msg->chunk_len) {
/* input empty or output full */
if (chn->buf->i > msg->next)
chn->flags |= CF_WAKE_WRITE;
goto missing_data_or_waiting;
}
/* nothing left to forward for this chunk*/
msg->msg_state = HTTP_MSG_CHUNK_CRLF;
/* fall through for HTTP_MSG_CHUNK_CRLF */
case HTTP_MSG_CHUNK_CRLF:
/* we want the CRLF after the data */
ret = h1_skip_chunk_crlf(chn->buf, msg->next, chn->buf->i);
if (ret == 0)
goto missing_data_or_waiting;
if (ret < 0) {
msg->err_pos = chn->buf->i + ret;
if (msg->err_pos < 0)
msg->err_pos += chn->buf->size;
goto chunk_parsing_error;
}
msg->next += ret;
msg->msg_state = HTTP_MSG_CHUNK_SIZE;
/* fall through for HTTP_MSG_CHUNK_SIZE */
case HTTP_MSG_CHUNK_SIZE:
/* read the chunk size and assign it to ->chunk_len,
* then set ->next to point to the body and switch to
* DATA or TRAILERS state.
*/
ret = h1_parse_chunk_size(chn->buf, msg->next, chn->buf->i, &chunk);
if (ret == 0)
goto missing_data_or_waiting;
if (ret < 0) {
msg->err_pos = chn->buf->i + ret;
if (msg->err_pos < 0)
msg->err_pos += chn->buf->size;
goto chunk_parsing_error;
}
msg->sol = ret;
msg->next += ret;
msg->chunk_len = chunk;
msg->body_len += chunk;
if (msg->chunk_len) {
msg->msg_state = HTTP_MSG_DATA;
goto switch_states;
}
msg->msg_state = HTTP_MSG_TRAILERS;
/* fall through for HTTP_MSG_TRAILERS */
case HTTP_MSG_TRAILERS:
ret = http_forward_trailers(msg);
if (ret < 0)
goto chunk_parsing_error;
FLT_STRM_DATA_CB(s, chn, flt_http_chunk_trailers(s, msg),
/* default_ret */ 1,
/* on_error */ goto error);
msg->next += msg->sol;
if (!ret)
goto missing_data_or_waiting;
break;
case HTTP_MSG_ENDING:
goto ending;
default:
/* This should no happen in this function */
goto error;
}
msg->msg_state = HTTP_MSG_ENDING;
ending:
/* we may have some pending data starting at res->buf->p such as a last
* chunk of data or trailers. */
ret = FLT_STRM_DATA_CB(s, chn, flt_http_forward_data(s, msg, msg->next),
/* default_ret */ msg->next,
/* on_error */ goto error);
b_adv(chn->buf, ret);
msg->next -= ret;
if (unlikely(!(chn->flags & CF_WROTE_DATA) || msg->sov > 0))
msg->sov -= ret;
if (msg->next)
goto waiting;
FLT_STRM_DATA_CB(s, chn, flt_http_end(s, msg),
/* default_ret */ 1,
/* on_error */ goto error,
/* on_wait */ goto waiting);
msg->msg_state = HTTP_MSG_DONE;
return 1;
missing_data_or_waiting:
/* we may have some pending data starting at chn->buf->p */
ret = FLT_STRM_DATA_CB(s, chn, flt_http_forward_data(s, msg, msg->next),
/* default_ret */ msg->next,
/* on_error */ goto error);
b_adv(chn->buf, ret);
msg->next -= ret;
if (!(chn->flags & CF_WROTE_DATA) || msg->sov > 0)
msg->sov -= ret;
if (!HAS_DATA_FILTERS(s, chn))
msg->chunk_len -= channel_forward(chn, msg->chunk_len);
waiting:
return 0;
chunk_parsing_error:
if (msg->err_pos >= 0) {
if (chn->flags & CF_ISRESP)
http_capture_bad_message(s->be, &s->be->invalid_rep, s, msg,
msg->msg_state, strm_fe(s));
else
http_capture_bad_message(strm_fe(s), &strm_fe(s)->invalid_req, s,
msg, msg->msg_state, s->be);
}
error:
return -1;
}
| 11,361
|
104,180
| 0
|
void GLES2DecoderImpl::RestoreCurrentRenderbufferBindings() {
glBindRenderbufferEXT(
GL_RENDERBUFFER,
bound_renderbuffer_ ? bound_renderbuffer_->service_id() : 0);
}
| 11,362
|
144,383
| 0
|
void ExtensionInstallPrompt::LoadImageIfNeeded() {
if (!icon_.empty() || !profile_) {
ShowConfirmation();
return;
}
extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource(
extension_,
extension_misc::EXTENSION_ICON_LARGE,
ExtensionIconSet::MATCH_BIGGER);
extensions::ImageLoader* loader = extensions::ImageLoader::Get(profile_);
std::vector<extensions::ImageLoader::ImageRepresentation> images_list;
images_list.push_back(extensions::ImageLoader::ImageRepresentation(
image,
extensions::ImageLoader::ImageRepresentation::NEVER_RESIZE,
gfx::Size(),
ui::SCALE_FACTOR_100P));
loader->LoadImagesAsync(
extension_,
images_list,
base::Bind(&ExtensionInstallPrompt::OnImageLoaded, AsWeakPtr()));
}
| 11,363
|
3,433
| 0
|
hook_process_run (struct t_hook *hook_process)
{
int pipe_stdout[2], pipe_stderr[2], timeout, max_calls;
long interval;
pid_t pid;
/* create pipe for child process (stdout) */
if (pipe (pipe_stdout) < 0)
{
(void) (HOOK_PROCESS(hook_process, callback))
(hook_process->callback_data,
HOOK_PROCESS(hook_process, command),
WEECHAT_HOOK_PROCESS_ERROR,
NULL, NULL);
unhook (hook_process);
return;
}
if (pipe (pipe_stderr) < 0)
{
close (pipe_stdout[0]);
close (pipe_stdout[1]);
(void) (HOOK_PROCESS(hook_process, callback))
(hook_process->callback_data,
HOOK_PROCESS(hook_process, command),
WEECHAT_HOOK_PROCESS_ERROR,
NULL, NULL);
unhook (hook_process);
return;
}
HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDOUT]) = pipe_stdout[0];
HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDOUT]) = pipe_stdout[1];
HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDERR]) = pipe_stderr[0];
HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDERR]) = pipe_stderr[1];
switch (pid = fork ())
{
/* fork failed */
case -1:
(void) (HOOK_PROCESS(hook_process, callback))
(hook_process->callback_data,
HOOK_PROCESS(hook_process, command),
WEECHAT_HOOK_PROCESS_ERROR,
NULL, NULL);
unhook (hook_process);
return;
/* child process */
case 0:
setuid (getuid ());
hook_process_child (hook_process);
/* never executed */
_exit (EXIT_SUCCESS);
break;
}
/* parent process */
HOOK_PROCESS(hook_process, child_pid) = pid;
close (HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDOUT]));
HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDOUT]) = -1;
close (HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDERR]));
HOOK_PROCESS(hook_process, child_write[HOOK_PROCESS_STDERR]) = -1;
HOOK_PROCESS(hook_process, hook_fd[HOOK_PROCESS_STDOUT]) =
hook_fd (hook_process->plugin,
HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDOUT]),
1, 0, 0,
&hook_process_child_read_stdout_cb,
hook_process);
HOOK_PROCESS(hook_process, hook_fd[HOOK_PROCESS_STDERR]) =
hook_fd (hook_process->plugin,
HOOK_PROCESS(hook_process, child_read[HOOK_PROCESS_STDERR]),
1, 0, 0,
&hook_process_child_read_stderr_cb,
hook_process);
timeout = HOOK_PROCESS(hook_process, timeout);
interval = 100;
max_calls = 0;
if (timeout > 0)
{
if (timeout <= 100)
{
interval = timeout;
max_calls = 1;
}
else
{
interval = 100;
max_calls = timeout / 100;
if (timeout % 100 == 0)
max_calls++;
}
}
HOOK_PROCESS(hook_process, hook_timer) = hook_timer (hook_process->plugin,
interval, 0, max_calls,
&hook_process_timer_cb,
hook_process);
}
| 11,364
|
108,800
| 0
|
void LockToOrigin(const GURL& gurl) {
origin_lock_ = gurl;
}
| 11,365
|
35,125
| 0
|
static ssize_t pages_to_scan_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
int err;
unsigned long pages;
err = strict_strtoul(buf, 10, &pages);
if (err || !pages || pages > UINT_MAX)
return -EINVAL;
khugepaged_pages_to_scan = pages;
return count;
}
| 11,366
|
133,597
| 0
|
void WebContentsImpl::OnDidRunInsecureContent(
const std::string& security_origin, const GURL& target_url) {
LOG(WARNING) << security_origin << " ran insecure content from "
<< target_url.possibly_invalid_spec();
RecordAction(base::UserMetricsAction("SSL.RanInsecureContent"));
if (EndsWith(security_origin, kDotGoogleDotCom, false))
RecordAction(base::UserMetricsAction("SSL.RanInsecureContentGoogle"));
controller_.ssl_manager()->DidRunInsecureContent(security_origin);
displayed_insecure_content_ = true;
SSLManager::NotifySSLInternalStateChanged(
GetController().GetBrowserContext());
}
| 11,367
|
140,054
| 0
|
String HTMLMediaElement::preload() const {
return preloadTypeToString(preloadType());
}
| 11,368
|
93,974
| 0
|
xfs_vm_set_page_dirty(
struct page *page)
{
struct address_space *mapping = page->mapping;
struct inode *inode = mapping->host;
loff_t end_offset;
loff_t offset;
int newly_dirty;
if (unlikely(!mapping))
return !TestSetPageDirty(page);
end_offset = i_size_read(inode);
offset = page_offset(page);
spin_lock(&mapping->private_lock);
if (page_has_buffers(page)) {
struct buffer_head *head = page_buffers(page);
struct buffer_head *bh = head;
do {
if (offset < end_offset)
set_buffer_dirty(bh);
bh = bh->b_this_page;
offset += 1 << inode->i_blkbits;
} while (bh != head);
}
/*
* Lock out page->mem_cgroup migration to keep PageDirty
* synchronized with per-memcg dirty page counters.
*/
lock_page_memcg(page);
newly_dirty = !TestSetPageDirty(page);
spin_unlock(&mapping->private_lock);
if (newly_dirty) {
/* sigh - __set_page_dirty() is static, so copy it here, too */
unsigned long flags;
spin_lock_irqsave(&mapping->tree_lock, flags);
if (page->mapping) { /* Race with truncate? */
WARN_ON_ONCE(!PageUptodate(page));
account_page_dirtied(page, mapping);
radix_tree_tag_set(&mapping->page_tree,
page_index(page), PAGECACHE_TAG_DIRTY);
}
spin_unlock_irqrestore(&mapping->tree_lock, flags);
}
unlock_page_memcg(page);
if (newly_dirty)
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
return newly_dirty;
}
| 11,369
|
44,228
| 0
|
static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid)
{
int idx;
X509_ATTRIBUTE *xa;
idx = X509at_get_attr_by_NID(sk, nid, -1);
xa = X509at_get_attr(sk, idx);
return X509_ATTRIBUTE_get0_type(xa, 0);
}
| 11,370
|
28,950
| 0
|
void kvm_arch_free_memslot(struct kvm_memory_slot *free,
struct kvm_memory_slot *dont)
{
}
| 11,371
|
166,432
| 0
|
void RecordDownloadCountWithSource(DownloadCountTypes type,
DownloadSource download_source) {
RecordDownloadCount(type);
std::string name =
CreateHistogramNameWithSuffix("Download.Counts", download_source);
base::UmaHistogramEnumeration(name, type, DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
}
| 11,372
|
115,128
| 0
|
void Clipboard::WriteObjects(const ObjectMap& objects) {
clipboard_data_ = new TargetMap();
for (ObjectMap::const_iterator iter = objects.begin();
iter != objects.end(); ++iter) {
DispatchObject(static_cast<ObjectType>(iter->first), iter->second);
}
SetGtkClipboard();
}
| 11,373
|
169,256
| 0
|
bool HasValidProcessForProcessGroup(const std::string& process_group_name) {
return ServiceManagerContext::HasValidProcessForProcessGroup(
process_group_name);
}
| 11,374
|
80,203
| 0
|
void lsrc_del(GF_Box *s)
{
GF_LASERConfigurationBox *ptr = (GF_LASERConfigurationBox *)s;
if (ptr == NULL) return;
if (ptr->hdr) gf_free(ptr->hdr);
gf_free(ptr);
}
| 11,375
|
103,701
| 0
|
void DevToolsAgent::clearBrowserCache() {
Send(new DevToolsHostMsg_ClearBrowserCache(routing_id()));
}
| 11,376
|
29,952
| 0
|
static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4)
{
struct sock *sk = skb->sk;
struct inet_sock *inet = inet_sk(sk);
struct udphdr *uh;
int err = 0;
int is_udplite = IS_UDPLITE(sk);
int offset = skb_transport_offset(skb);
int len = skb->len - offset;
__wsum csum = 0;
/*
* Create a UDP header
*/
uh = udp_hdr(skb);
uh->source = inet->inet_sport;
uh->dest = fl4->fl4_dport;
uh->len = htons(len);
uh->check = 0;
if (is_udplite) /* UDP-Lite */
csum = udplite_csum(skb);
else if (sk->sk_no_check == UDP_CSUM_NOXMIT) { /* UDP csum disabled */
skb->ip_summed = CHECKSUM_NONE;
goto send;
} else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */
udp4_hwcsum(skb, fl4->saddr, fl4->daddr);
goto send;
} else
csum = udp_csum(skb);
/* add protocol-dependent pseudo-header */
uh->check = csum_tcpudp_magic(fl4->saddr, fl4->daddr, len,
sk->sk_protocol, csum);
if (uh->check == 0)
uh->check = CSUM_MANGLED_0;
send:
err = ip_send_skb(sock_net(sk), skb);
if (err) {
if (err == -ENOBUFS && !inet->recverr) {
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_SNDBUFERRORS, is_udplite);
err = 0;
}
} else
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_OUTDATAGRAMS, is_udplite);
return err;
}
| 11,377
|
170,502
| 0
|
status_t Parcel::write(const void* data, size_t len)
{
void* const d = writeInplace(len);
if (d) {
memcpy(d, data, len);
return NO_ERROR;
}
return mError;
}
| 11,378
|
118,700
| 0
|
explicit DialogHandler(v8::Handle<v8::Value> dialogArguments)
: m_dialogArguments(dialogArguments)
{
}
| 11,379
|
177,815
| 1
|
void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
{
struct map_struct *buf;
OFF_T i, len = st_p->st_size;
md_context m;
int32 remainder;
int fd;
memset(sum, 0, MAX_DIGEST_LEN);
fd = do_open(fname, O_RDONLY, 0);
if (fd == -1)
return;
buf = map_file(fd, len, MAX_MAP_SIZE, CSUM_CHUNK);
switch (checksum_type) {
case CSUM_MD5:
md5_begin(&m);
for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
md5_update(&m, (uchar *)map_ptr(buf, i, CSUM_CHUNK),
CSUM_CHUNK);
}
remainder = (int32)(len - i);
if (remainder > 0)
md5_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
md5_result(&m, (uchar *)sum);
break;
case CSUM_MD4:
case CSUM_MD4:
case CSUM_MD4_OLD:
case CSUM_MD4_BUSTED:
mdfour_begin(&m);
for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
}
/* Prior to version 27 an incorrect MD4 checksum was computed
* by failing to call mdfour_tail() for block sizes that
* are multiples of 64. This is fixed by calling mdfour_update()
* even when there are no more bytes. */
* are multiples of 64. This is fixed by calling mdfour_update()
* even when there are no more bytes. */
remainder = (int32)(len - i);
if (remainder > 0 || checksum_type != CSUM_MD4_BUSTED)
mdfour_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
mdfour_result(&m, (uchar *)sum);
rprintf(FERROR, "invalid checksum-choice for the --checksum option (%d)\n", checksum_type);
exit_cleanup(RERR_UNSUPPORTED);
}
close(fd);
unmap_file(buf);
}
| 11,380
|
128,485
| 0
|
gfx::Rect ShellSurface::GetVisibleBounds() const {
return geometry_.IsEmpty() ? gfx::Rect(surface_->window()->layer()->size())
: geometry_;
}
| 11,381
|
67,476
| 0
|
static TPM_RC AddSession( SESSION_LIST_ENTRY **sessionEntry )
{
SESSION_LIST_ENTRY **newEntry;
for( newEntry = &local_sessions_list; *newEntry != 0; *newEntry = ( (SESSION_LIST_ENTRY *)*newEntry)->nextEntry )
;
*newEntry = malloc( sizeof( SESSION_LIST_ENTRY ) );
if( *newEntry != 0 )
{
*sessionEntry = *newEntry;
(*sessionEntry)->nextEntry = 0;
local_session_entries_used++;
return TPM_RC_SUCCESS;
}
else
{
return TSS2_APP_RC_SESSION_SLOT_NOT_FOUND;
}
}
| 11,382
|
117,520
| 0
|
void AudioMixerAlsa::GetVolumeLimits(double* min_volume_db,
double* max_volume_db) {
base::AutoLock lock(lock_);
if (min_volume_db)
*min_volume_db = min_volume_db_;
if (max_volume_db)
*max_volume_db = max_volume_db_;
}
| 11,383
|
171,294
| 0
|
int main()
{
struct binder_state *bs;
bs = binder_open(128*1024);
if (!bs) {
ALOGE("failed to open binder driver\n");
return -1;
}
if (binder_become_context_manager(bs)) {
ALOGE("cannot become context manager (%s)\n", strerror(errno));
return -1;
}
selinux_enabled = is_selinux_enabled();
sehandle = selinux_android_service_context_handle();
selinux_status_open(true);
if (selinux_enabled > 0) {
if (sehandle == NULL) {
ALOGE("SELinux: Failed to acquire sehandle. Aborting.\n");
abort();
}
if (getcon(&service_manager_context) != 0) {
ALOGE("SELinux: Failed to acquire service_manager context. Aborting.\n");
abort();
}
}
union selinux_callback cb;
cb.func_audit = audit_callback;
selinux_set_callback(SELINUX_CB_AUDIT, cb);
cb.func_log = selinux_log_callback;
selinux_set_callback(SELINUX_CB_LOG, cb);
binder_loop(bs, svcmgr_handler);
return 0;
}
| 11,384
|
68,214
| 0
|
void llc_sk_reset(struct sock *sk)
{
struct llc_sock *llc = llc_sk(sk);
llc_conn_ac_stop_all_timers(sk, NULL);
skb_queue_purge(&sk->sk_write_queue);
skb_queue_purge(&llc->pdu_unack_q);
llc->remote_busy_flag = 0;
llc->cause_flag = 0;
llc->retry_count = 0;
llc_conn_set_p_flag(sk, 0);
llc->f_flag = 0;
llc->s_flag = 0;
llc->ack_pf = 0;
llc->first_pdu_Ns = 0;
llc->ack_must_be_send = 0;
llc->dec_step = 1;
llc->inc_cntr = 2;
llc->dec_cntr = 2;
llc->X = 0;
llc->failed_data_req = 0 ;
llc->last_nr = 0;
}
| 11,385
|
66,110
| 0
|
static int write_boot_mem(struct edgeport_serial *serial,
int start_address, int length, __u8 *buffer)
{
int status = 0;
int i;
u8 *temp;
/* Must do a read before write */
if (!serial->TiReadI2C) {
temp = kmalloc(1, GFP_KERNEL);
if (!temp)
return -ENOMEM;
status = read_boot_mem(serial, 0, 1, temp);
kfree(temp);
if (status)
return status;
}
for (i = 0; i < length; ++i) {
status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE,
buffer[i], (u16)(i + start_address), NULL,
0, TI_VSEND_TIMEOUT_DEFAULT);
if (status)
return status;
}
dev_dbg(&serial->serial->dev->dev, "%s - start_sddr = %x, length = %d\n", __func__, start_address, length);
usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer);
return status;
}
| 11,386
|
76,756
| 0
|
lou_translatePrehyphenated(const char *tableList, const widechar *inbufx, int *inlen,
widechar *outbuf, int *outlen, formtype *typeform, char *spacing, int *outputPos,
int *inputPos, int *cursorPos, char *inputHyphens, char *outputHyphens,
int mode) {
int rv = 1;
int *alloc_inputPos = NULL;
if (inputHyphens != NULL) {
if (outputHyphens == NULL) return 0;
if (inputPos == NULL) {
if ((alloc_inputPos = malloc(*outlen * sizeof(int))) == NULL)
_lou_outOfMemory();
inputPos = alloc_inputPos;
}
}
if (lou_translate(tableList, inbufx, inlen, outbuf, outlen, typeform, spacing,
outputPos, inputPos, cursorPos, mode)) {
if (inputHyphens != NULL) {
int inpos = 0;
int outpos;
for (outpos = 0; outpos < *outlen; outpos++) {
int new_inpos = inputPos[outpos];
if (new_inpos < inpos) {
rv = 0;
break;
}
if (new_inpos > inpos)
outputHyphens[outpos] = inputHyphens[new_inpos];
else
outputHyphens[outpos] = '0';
inpos = new_inpos;
}
}
}
if (alloc_inputPos != NULL) free(alloc_inputPos);
return rv;
}
| 11,387
|
32,458
| 0
|
static int kvm_create_dirty_bitmap(struct kvm_memory_slot *memslot)
{
unsigned long dirty_bytes = 2 * kvm_dirty_bitmap_bytes(memslot);
if (dirty_bytes > PAGE_SIZE)
memslot->dirty_bitmap = vzalloc(dirty_bytes);
else
memslot->dirty_bitmap = kzalloc(dirty_bytes, GFP_KERNEL);
if (!memslot->dirty_bitmap)
return -ENOMEM;
memslot->dirty_bitmap_head = memslot->dirty_bitmap;
return 0;
}
| 11,388
|
30,624
| 0
|
unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
poll_table *wait)
{
struct sock *sk = sock->sk;
unsigned int mask = 0;
sock_poll_wait(file, sk_sleep(sk), wait);
if (sk->sk_state == IUCV_LISTEN)
return iucv_accept_poll(sk);
if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue))
mask |= POLLERR;
if (sk->sk_shutdown & RCV_SHUTDOWN)
mask |= POLLRDHUP;
if (sk->sk_shutdown == SHUTDOWN_MASK)
mask |= POLLHUP;
if (!skb_queue_empty(&sk->sk_receive_queue) ||
(sk->sk_shutdown & RCV_SHUTDOWN))
mask |= POLLIN | POLLRDNORM;
if (sk->sk_state == IUCV_CLOSED)
mask |= POLLHUP;
if (sk->sk_state == IUCV_DISCONN)
mask |= POLLIN;
if (sock_writeable(sk) && iucv_below_msglim(sk))
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
else
set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
return mask;
}
| 11,389
|
45,637
| 0
|
static void *cryptd_alloc_instance(struct crypto_alg *alg, unsigned int head,
unsigned int tail)
{
char *p;
struct crypto_instance *inst;
int err;
p = kzalloc(head + sizeof(*inst) + tail, GFP_KERNEL);
if (!p)
return ERR_PTR(-ENOMEM);
inst = (void *)(p + head);
err = -ENAMETOOLONG;
if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME,
"cryptd(%s)", alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME)
goto out_free_inst;
memcpy(inst->alg.cra_name, alg->cra_name, CRYPTO_MAX_ALG_NAME);
inst->alg.cra_priority = alg->cra_priority + 50;
inst->alg.cra_blocksize = alg->cra_blocksize;
inst->alg.cra_alignmask = alg->cra_alignmask;
out:
return p;
out_free_inst:
kfree(p);
p = ERR_PTR(err);
goto out;
}
| 11,390
|
38,469
| 0
|
static int cma_connect_iw(struct rdma_id_private *id_priv,
struct rdma_conn_param *conn_param)
{
struct iw_cm_id *cm_id;
int ret;
struct iw_cm_conn_param iw_param;
cm_id = iw_create_cm_id(id_priv->id.device, cma_iw_handler, id_priv);
if (IS_ERR(cm_id))
return PTR_ERR(cm_id);
id_priv->cm_id.iw = cm_id;
memcpy(&cm_id->local_addr, cma_src_addr(id_priv),
rdma_addr_size(cma_src_addr(id_priv)));
memcpy(&cm_id->remote_addr, cma_dst_addr(id_priv),
rdma_addr_size(cma_dst_addr(id_priv)));
ret = cma_modify_qp_rtr(id_priv, conn_param);
if (ret)
goto out;
if (conn_param) {
iw_param.ord = conn_param->initiator_depth;
iw_param.ird = conn_param->responder_resources;
iw_param.private_data = conn_param->private_data;
iw_param.private_data_len = conn_param->private_data_len;
iw_param.qpn = id_priv->id.qp ? id_priv->qp_num : conn_param->qp_num;
} else {
memset(&iw_param, 0, sizeof iw_param);
iw_param.qpn = id_priv->qp_num;
}
ret = iw_cm_connect(cm_id, &iw_param);
out:
if (ret) {
iw_destroy_cm_id(cm_id);
id_priv->cm_id.iw = NULL;
}
return ret;
}
| 11,391
|
153,240
| 0
|
bool DesktopWindowTreeHostX11::HasCapture() const {
return g_current_capture == this;
}
| 11,392
|
62,673
| 0
|
static MagickBooleanType IsDCX(const unsigned char *magick,const size_t length)
{
if (length < 4)
return(MagickFalse);
if (memcmp(magick,"\261\150\336\72",4) == 0)
return(MagickTrue);
return(MagickFalse);
}
| 11,393
|
36,335
| 0
|
static int link_path_walk(const char *name, struct nameidata *nd)
{
struct path next;
int err;
while (*name=='/')
name++;
if (!*name)
return 0;
/* At this point we know we have a real path component. */
for(;;) {
struct qstr this;
long len;
int type;
err = may_lookup(nd);
if (err)
break;
len = hash_name(name, &this.hash);
this.name = name;
this.len = len;
type = LAST_NORM;
if (name[0] == '.') switch (len) {
case 2:
if (name[1] == '.') {
type = LAST_DOTDOT;
nd->flags |= LOOKUP_JUMPED;
}
break;
case 1:
type = LAST_DOT;
}
if (likely(type == LAST_NORM)) {
struct dentry *parent = nd->path.dentry;
nd->flags &= ~LOOKUP_JUMPED;
if (unlikely(parent->d_flags & DCACHE_OP_HASH)) {
err = parent->d_op->d_hash(parent, &this);
if (err < 0)
break;
}
}
nd->last = this;
nd->last_type = type;
if (!name[len])
return 0;
/*
* If it wasn't NUL, we know it was '/'. Skip that
* slash, and continue until no more slashes.
*/
do {
len++;
} while (unlikely(name[len] == '/'));
if (!name[len])
return 0;
name += len;
err = walk_component(nd, &next, LOOKUP_FOLLOW);
if (err < 0)
return err;
if (err) {
err = nested_symlink(&next, nd);
if (err)
return err;
}
if (!d_can_lookup(nd->path.dentry)) {
err = -ENOTDIR;
break;
}
}
terminate_walk(nd);
return err;
}
| 11,394
|
49,340
| 0
|
static struct fwnet_partial_datagram *fwnet_pd_find(struct fwnet_peer *peer,
u16 datagram_label)
{
struct fwnet_partial_datagram *pd;
list_for_each_entry(pd, &peer->pd_list, pd_link)
if (pd->datagram_label == datagram_label)
return pd;
return NULL;
}
| 11,395
|
141,515
| 0
|
void PaintLayerScrollableArea::UpdateScrollDimensions() {
LayoutRect new_overflow_rect = GetLayoutBox()->LayoutOverflowRect();
GetLayoutBox()->FlipForWritingMode(new_overflow_rect);
new_overflow_rect.Unite(
LayoutRect(new_overflow_rect.Location(),
LayoutContentRect(kExcludeScrollbars).Size()));
if (overflow_rect_.Size() != new_overflow_rect.Size())
ContentsResized();
overflow_rect_ = new_overflow_rect;
UpdateScrollOrigin();
}
| 11,396
|
58,432
| 0
|
cmsUInt32Number CMSEXPORT cmsGetSupportedIntents(cmsUInt32Number nMax, cmsUInt32Number* Codes, char** Descriptions)
{
cmsIntentsList* pt;
cmsUInt32Number nIntents;
for (nIntents=0, pt = Intents; pt != NULL; pt = pt -> Next)
{
if (nIntents < nMax) {
if (Codes != NULL)
Codes[nIntents] = pt ->Intent;
if (Descriptions != NULL)
Descriptions[nIntents] = pt ->Description;
}
nIntents++;
}
return nIntents;
}
| 11,397
|
155,303
| 0
|
void ChromeContentBrowserClient::CreateMediaRemoter(
content::RenderFrameHost* render_frame_host,
media::mojom::RemotingSourcePtr source,
media::mojom::RemoterRequest request) {
CastRemotingConnector::CreateMediaRemoter(
render_frame_host, std::move(source), std::move(request));
}
| 11,398
|
44,537
| 0
|
static inline void cleanup_cgroups(char *path)
{
int i;
char **slist = subsystems;
if (cgm_supports_multiple_controllers)
slist = subsystems_inone;
for (i = 0; slist[i]; i++)
cgm_remove_cgroup(slist[i], path);
}
| 11,399
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.