unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
52,372
0
static void trace_packet(struct net *net, const struct sk_buff *skb, unsigned int hook, const struct net_device *in, const struct net_device *out, const char *tablename, const struct xt_table_info *private, const struct ip6t_entry *e) { const struct ip6t_entry *root; const char *hookname, *chainname, *comment; const struct ip6t_entry *iter; unsigned int rulenum = 0; root = get_entry(private->entries, private->hook_entry[hook]); hookname = chainname = hooknames[hook]; comment = comments[NF_IP6_TRACE_COMMENT_RULE]; xt_entry_foreach(iter, root, private->size - private->hook_entry[hook]) if (get_chainname_rulenum(iter, e, hookname, &chainname, &comment, &rulenum) != 0) break; nf_log_trace(net, AF_INET6, hook, skb, in, out, &trace_loginfo, "TRACE: %s:%s:%s:%u ", tablename, chainname, comment, rulenum); }
2,300
102,781
0
virtual void drawLayers() { CCLayerTreeHostImpl::drawLayers(); m_testHooks->drawLayersOnCCThread(this); }
2,301
116,853
0
WebKit::WebPlugin* RenderViewImpl::CreatePlugin( WebKit::WebFrame* frame, const webkit::WebPluginInfo& info, const WebKit::WebPluginParams& params) { bool pepper_plugin_was_registered = false; scoped_refptr<webkit::ppapi::PluginModule> pepper_module( pepper_delegate_.CreatePepperPluginModule(info, &pepper_plugin_was_registered)); if (pepper_plugin_was_registered) { if (!pepper_module) return NULL; return new webkit::ppapi::WebPluginImpl( pepper_module.get(), params, pepper_delegate_.AsWeakPtr()); } #if defined(USE_AURA) return NULL; #else return new webkit::npapi::WebPluginImpl( frame, params, info.path, AsWeakPtr()); #endif }
2,302
139,045
0
scoped_refptr<UsbDeviceHandle> WaitForResult() { run_loop_.Run(); return device_handle_; }
2,303
82,240
0
int __sys_listen(int fd, int backlog) { struct socket *sock; int err, fput_needed; int somaxconn; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (sock) { somaxconn = sock_net(sock->sk)->core.sysctl_somaxconn; if ((unsigned int)backlog > somaxconn) backlog = somaxconn; err = security_socket_listen(sock, backlog); if (!err) err = sock->ops->listen(sock, backlog); fput_light(sock->file, fput_needed); } return err; }
2,304
113,151
0
internal::FocusCycler* Launcher::GetFocusCycler() { return delegate_view_->focus_cycler(); }
2,305
53,785
0
static void __init e820_add_kernel_range(void) { u64 start = __pa_symbol(_text); u64 size = __pa_symbol(_end) - start; /* * Complain if .text .data and .bss are not marked as E820_RAM and * attempt to fix it by adding the range. We may have a confused BIOS, * or the user may have used memmap=exactmap or memmap=xxM$yyM to * exclude kernel range. If we really are running on top non-RAM, * we will crash later anyways. */ if (e820_all_mapped(start, start + size, E820_RAM)) return; pr_warn(".text .data .bss are not marked as E820_RAM!\n"); e820_remove_range(start, size, E820_RAM, 0); e820_add_region(start, size, E820_RAM); }
2,306
142,924
0
bool HTMLMediaElement::SupportsSave() const { if (GetDocument().GetSettings() && GetDocument().GetSettings()->GetHideDownloadUI()) { return false; } if (current_src_.IsNull() || current_src_.IsEmpty()) return false; if (network_state_ == kNetworkEmpty || network_state_ == kNetworkNoSource) return false; if (current_src_.IsLocalFile()) return false; if (GetLoadType() == WebMediaPlayer::kLoadTypeMediaStream) return false; if (HasMediaSource()) return false; if (IsHLSURL(current_src_)) return false; if (duration() == std::numeric_limits<double>::infinity()) return false; return true; }
2,307
61,062
0
file_deleted_callback (GFile *file, GError *error, gpointer callback_data) { DeleteData *data = callback_data; CommonJob *job; SourceInfo *source_info; TransferInfo *transfer_info; GFileType file_type; char *primary; char *secondary; char *details = NULL; int response; job = data->job; source_info = data->source_info; transfer_info = data->transfer_info; data->transfer_info->num_files++; if (error == NULL) { nautilus_file_changes_queue_file_removed (file); report_delete_progress (data->job, data->source_info, data->transfer_info); return; } if (job_aborted (job) || job->skip_all_error || should_skip_file (job, file) || should_skip_readdir_error (job, file)) { return; } primary = f (_("Error while deleting.")); file_type = g_file_query_file_type (file, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, job->cancellable); if (file_type == G_FILE_TYPE_DIRECTORY) { secondary = IS_IO_ERROR (error, PERMISSION_DENIED) ? f (_("There was an error deleting the folder “%B”."), file) : f (_("You do not have sufficient permissions to delete the folder “%B”."), file); } else { secondary = IS_IO_ERROR (error, PERMISSION_DENIED) ? f (_("There was an error deleting the file “%B”."), file) : f (_("You do not have sufficient permissions to delete the file “%B”."), file); } details = error->message; response = run_cancel_or_skip_warning (job, primary, secondary, details, source_info->num_files, source_info->num_files - transfer_info->num_files); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (job); } else if (response == 1) { /* skip all */ job->skip_all_error = TRUE; } }
2,308
99,510
0
static void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) { notImplemented(); }
2,309
185,778
1
bool isUserInteractionEventForSlider(Event* event, LayoutObject* layoutObject) { // It is unclear if this can be converted to isUserInteractionEvent(), since // mouse* events seem to be eaten during a drag anyway. crbug.com/516416 . if (isUserInteractionEvent(event)) return true; // Some events are only captured during a slider drag. LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject)); if (!slider.isNull() && !slider.inDragMode()) return false; const AtomicString& type = event->type(); return type == EventTypeNames::mouseover || type == EventTypeNames::mouseout || type == EventTypeNames::mousemove; }
2,310
64,631
0
static unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst) { unsigned int mtu; struct inet6_dev *idev; if (dst_metric_locked(dst, RTAX_MTU)) { mtu = dst_metric_raw(dst, RTAX_MTU); if (mtu) return mtu; } mtu = IPV6_MIN_MTU; rcu_read_lock(); idev = __in6_dev_get(dst->dev); if (idev) mtu = idev->cnf.mtu6; rcu_read_unlock(); return mtu; }
2,311
72,793
0
int jas_stream_display(jas_stream_t *stream, FILE *fp, int n) { unsigned char buf[16]; int i; int j; int m; int c; int display; int cnt; cnt = n - (n % 16); display = 1; for (i = 0; i < n; i += 16) { if (n > 16 && i > 0) { display = (i >= cnt) ? 1 : 0; } if (display) { fprintf(fp, "%08x:", i); } m = JAS_MIN(n - i, 16); for (j = 0; j < m; ++j) { if ((c = jas_stream_getc(stream)) == EOF) { abort(); return -1; } buf[j] = c; } if (display) { for (j = 0; j < m; ++j) { fprintf(fp, " %02x", buf[j]); } fputc(' ', fp); for (; j < 16; ++j) { fprintf(fp, " "); } for (j = 0; j < m; ++j) { if (isprint(buf[j])) { fputc(buf[j], fp); } else { fputc(' ', fp); } } fprintf(fp, "\n"); } } return 0; }
2,312
170,228
0
bool HasMediaRouterActionAtInit() const { const std::set<std::string>& component_ids = ToolbarActionsModel::Get(browser()->profile()) ->component_actions_factory() ->GetInitialComponentIds(); return base::ContainsKey( component_ids, ComponentToolbarActionsFactory::kMediaRouterActionId); }
2,313
163,806
0
bool ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess( content::BrowserContext* browser_context, const GURL& effective_site_url) { const Extension* extension = ExtensionRegistry::Get(browser_context) ->enabled_extensions() .GetExtensionOrAppByURL(effective_site_url); if (!extension) return false; if (extension->id() == kWebStoreAppId) return true; if (extension->is_hosted_app()) return false; return true; }
2,314
141,702
0
void V8Console::tableCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { ConsoleHelper(info).reportCall(ConsoleAPIType::kTable); }
2,315
518
0
static void pdf_run_dquote(fz_context *ctx, pdf_processor *proc, float aw, float ac, char *string, int string_len) { pdf_run_processor *pr = (pdf_run_processor *)proc; pdf_gstate *gstate = pr->gstate + pr->gtop; gstate->text.word_space = aw; gstate->text.char_space = ac; pdf_tos_newline(&pr->tos, gstate->text.leading); pdf_show_string(ctx, pr, (unsigned char*)string, string_len); }
2,316
50,276
0
int sock_sendmsg(struct socket *sock, struct msghdr *msg) { int err = security_socket_sendmsg(sock, msg, msg_data_left(msg)); return err ?: sock_sendmsg_nosec(sock, msg); }
2,317
69,128
0
ZEND_API int ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx) { register const char *tmp = key; const char *end = key + length; if (*tmp == '-') { tmp++; } if ((*tmp == '0' && length > 1) /* numbers with leading zeros */ || (end - tmp > MAX_LENGTH_OF_LONG - 1) /* number too long */ || (SIZEOF_ZEND_LONG == 4 && end - tmp == MAX_LENGTH_OF_LONG - 1 && *tmp > '2')) { /* overflow */ return 0; } *idx = (*tmp - '0'); while (1) { ++tmp; if (tmp == end) { if (*key == '-') { if (*idx-1 > ZEND_LONG_MAX) { /* overflow */ return 0; } *idx = 0 - *idx; } else if (*idx > ZEND_LONG_MAX) { /* overflow */ return 0; } return 1; } if (*tmp <= '9' && *tmp >= '0') { *idx = (*idx * 10) + (*tmp - '0'); } else { return 0; } } }
2,318
20,371
0
static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn, struct mm_struct *mm, unsigned long start, unsigned long end) { struct kvm *kvm = mmu_notifier_to_kvm(mn); spin_lock(&kvm->mmu_lock); /* * This sequence increase will notify the kvm page fault that * the page that is going to be mapped in the spte could have * been freed. */ kvm->mmu_notifier_seq++; /* * The above sequence increase must be visible before the * below count decrease but both values are read by the kvm * page fault under mmu_lock spinlock so we don't need to add * a smb_wmb() here in between the two. */ kvm->mmu_notifier_count--; spin_unlock(&kvm->mmu_lock); BUG_ON(kvm->mmu_notifier_count < 0); }
2,319
9,707
0
FT_Stream_ReadFields( FT_Stream stream, const FT_Frame_Field* fields, void* structure ) { FT_Error error; FT_Bool frame_accessed = 0; FT_Byte* cursor; if ( !fields || !stream ) return FT_Err_Invalid_Argument; cursor = stream->cursor; error = FT_Err_Ok; do { FT_ULong value; FT_Int sign_shift; FT_Byte* p; switch ( fields->value ) { case ft_frame_start: /* access a new frame */ error = FT_Stream_EnterFrame( stream, fields->offset ); if ( error ) goto Exit; frame_accessed = 1; cursor = stream->cursor; fields++; continue; /* loop! */ case ft_frame_bytes: /* read a byte sequence */ case ft_frame_skip: /* skip some bytes */ { FT_UInt len = fields->size; if ( cursor + len > stream->limit ) { error = FT_Err_Invalid_Stream_Operation; goto Exit; } if ( fields->value == ft_frame_bytes ) { p = (FT_Byte*)structure + fields->offset; FT_MEM_COPY( p, cursor, len ); } cursor += len; fields++; continue; } case ft_frame_byte: case ft_frame_schar: /* read a single byte */ value = FT_NEXT_BYTE(cursor); sign_shift = 24; break; case ft_frame_short_be: case ft_frame_ushort_be: /* read a 2-byte big-endian short */ value = FT_NEXT_USHORT(cursor); sign_shift = 16; break; case ft_frame_short_le: case ft_frame_ushort_le: /* read a 2-byte little-endian short */ value = FT_NEXT_USHORT_LE(cursor); sign_shift = 16; break; case ft_frame_long_be: case ft_frame_ulong_be: /* read a 4-byte big-endian long */ value = FT_NEXT_ULONG(cursor); sign_shift = 0; break; case ft_frame_long_le: case ft_frame_ulong_le: /* read a 4-byte little-endian long */ value = FT_NEXT_ULONG_LE(cursor); sign_shift = 0; break; case ft_frame_off3_be: case ft_frame_uoff3_be: /* read a 3-byte big-endian long */ value = FT_NEXT_UOFF3(cursor); sign_shift = 8; break; case ft_frame_off3_le: case ft_frame_uoff3_le: /* read a 3-byte little-endian long */ value = FT_NEXT_UOFF3_LE(cursor); sign_shift = 8; break; default: /* otherwise, exit the loop */ stream->cursor = cursor; goto Exit; } /* now, compute the signed value is necessary */ if ( fields->value & FT_FRAME_OP_SIGNED ) value = (FT_ULong)( (FT_Int32)( value << sign_shift ) >> sign_shift ); /* finally, store the value in the object */ p = (FT_Byte*)structure + fields->offset; switch ( fields->size ) { case (8 / FT_CHAR_BIT): *(FT_Byte*)p = (FT_Byte)value; break; case (16 / FT_CHAR_BIT): *(FT_UShort*)p = (FT_UShort)value; break; case (32 / FT_CHAR_BIT): *(FT_UInt32*)p = (FT_UInt32)value; break; default: /* for 64-bit systems */ *(FT_ULong*)p = (FT_ULong)value; } /* go to next field */ fields++; } while ( 1 ); Exit: /* close the frame if it was opened by this read */ if ( frame_accessed ) FT_Stream_ExitFrame( stream ); return error; }
2,320
123,458
0
ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, HTMLCanvasElement* canvas, ExceptionState& exceptionState) { return createImageBitmap(eventTarget, canvas, 0, 0, canvas->width(), canvas->height(), exceptionState); }
2,321
109,429
0
BlobRegistryContext(const KURL& url, PassRefPtr<RawData> streamData) : url(url.copy()) , streamData(streamData) { }
2,322
187,918
1
static bool getCoverageFormat4(vector<uint32_t>& coverage, const uint8_t* data, size_t size) { const size_t kSegCountOffset = 6; const size_t kEndCountOffset = 14; const size_t kHeaderSize = 16; const size_t kSegmentSize = 8; // total size of array elements for one segment if (kEndCountOffset > size) { return false; } size_t segCount = readU16(data, kSegCountOffset) >> 1; if (kHeaderSize + segCount * kSegmentSize > size) { return false; } for (size_t i = 0; i < segCount; i++) { uint32_t end = readU16(data, kEndCountOffset + 2 * i); uint32_t start = readU16(data, kHeaderSize + 2 * (segCount + i)); if (end < start) { return false; } uint32_t rangeOffset = readU16(data, kHeaderSize + 2 * (3 * segCount + i)); if (rangeOffset == 0) { uint32_t delta = readU16(data, kHeaderSize + 2 * (2 * segCount + i)); if (((end + delta) & 0xffff) > end - start) { addRange(coverage, start, end + 1); } else { for (uint32_t j = start; j < end + 1; j++) { if (((j + delta) & 0xffff) != 0) { addRange(coverage, j, j + 1); } } } } else { for (uint32_t j = start; j < end + 1; j++) { uint32_t actualRangeOffset = kHeaderSize + 6 * segCount + rangeOffset + (i + j - start) * 2; if (actualRangeOffset + 2 > size) { continue; } uint32_t glyphId = readU16(data, actualRangeOffset); if (glyphId != 0) { addRange(coverage, j, j + 1); } } } } return true; }
2,323
81,834
0
static int ecc_check_pubkey_order(ecc_key* key, ecc_point* pubkey, mp_int* a, mp_int* prime, mp_int* order) { ecc_point* inf = NULL; int err; if (key == NULL) return BAD_FUNC_ARG; inf = wc_ecc_new_point_h(key->heap); if (inf == NULL) err = MEMORY_E; else { #ifdef WOLFSSL_HAVE_SP_ECC #ifndef WOLFSSL_SP_NO_256 if (key->idx != ECC_CUSTOM_IDX && ecc_sets[key->idx].id == ECC_SECP256R1) { err = sp_ecc_mulmod_256(order, pubkey, inf, 1, key->heap); } else #endif #endif #ifndef WOLFSSL_SP_MATH err = wc_ecc_mulmod_ex(order, pubkey, inf, a, prime, 1, key->heap); if (err == MP_OKAY && !wc_ecc_point_is_at_infinity(inf)) err = ECC_INF_E; #else (void)a; (void)prime; err = WC_KEY_SIZE_E; #endif } wc_ecc_del_point_h(inf, key->heap); return err; }
2,324
149,837
0
void LayerTreeHost::SetElementIdsForTesting() { LayerTreeHostCommon::CallFunctionForEveryLayer(this, SetElementIdForTesting); }
2,325
115,824
0
SafeBrowsingBlockingPage* GetSafeBrowsingBlockingPage() { InterstitialPage* interstitial = InterstitialPage::GetInterstitialPage(contents()); if (!interstitial) return NULL; return static_cast<SafeBrowsingBlockingPage*>(interstitial); }
2,326
103,252
0
void WebSocketJob::OnConnected( SocketStream* socket, int max_pending_send_allowed) { if (state_ == CLOSED) return; DCHECK_EQ(CONNECTING, state_); if (delegate_) delegate_->OnConnected(socket, max_pending_send_allowed); }
2,327
10,769
0
int SSL_clear(SSL *s) { if (s->method == NULL) { SSLerr(SSL_F_SSL_CLEAR,SSL_R_NO_METHOD_SPECIFIED); return(0); } if (ssl_clear_bad_session(s)) { SSL_SESSION_free(s->session); s->session=NULL; } s->error=0; s->hit=0; s->shutdown=0; #if 0 /* Disabled since version 1.10 of this file (early return not * needed because SSL_clear is not called when doing renegotiation) */ /* This is set if we are doing dynamic renegotiation so keep * the old cipher. It is sort of a SSL_clear_lite :-) */ if (s->renegotiate) return(1); #else if (s->renegotiate) { SSLerr(SSL_F_SSL_CLEAR,ERR_R_INTERNAL_ERROR); return 0; } #endif s->type=0; s->state=SSL_ST_BEFORE|((s->server)?SSL_ST_ACCEPT:SSL_ST_CONNECT); s->version=s->method->version; s->client_version=s->version; s->rwstate=SSL_NOTHING; s->rstate=SSL_ST_READ_HEADER; #if 0 s->read_ahead=s->ctx->read_ahead; #endif if (s->init_buf != NULL) { BUF_MEM_free(s->init_buf); s->init_buf=NULL; } ssl_clear_cipher_ctx(s); ssl_clear_hash_ctx(&s->read_hash); ssl_clear_hash_ctx(&s->write_hash); s->first_packet=0; #if 1 /* Check to see if we were changed into a different method, if * so, revert back if we are not doing session-id reuse. */ if (!s->in_handshake && (s->session == NULL) && (s->method != s->ctx->method)) { s->method->ssl_free(s); s->method=s->ctx->method; if (!s->method->ssl_new(s)) return(0); } else #endif s->method->ssl_clear(s); return(1); }
2,328
34,505
0
static void bm_evict_inode(struct inode *inode) { clear_inode(inode); kfree(inode->i_private); }
2,329
166,980
0
void CSSStyleSheet::SetLoadCompleted(bool completed) { if (completed == load_completed_) return; load_completed_ = completed; if (completed) contents_->ClientLoadCompleted(this); else contents_->ClientLoadStarted(this); }
2,330
87,644
0
LIBOPENMPT_MODPLUG_API unsigned int ModPlug_NumSamples(ModPlugFile* file) { if(!file) return 0; return openmpt_module_get_num_samples(file->mod); }
2,331
99,975
0
bool WebPluginDelegateImpl::Initialize( const GURL& url, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, WebPlugin* plugin, bool load_manually) { plugin_ = plugin; instance_->set_web_plugin(plugin_); if (quirks_ & PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES) { NPAPI::PluginLib* plugin_lib = instance()->plugin_lib(); if (plugin_lib->instance_count() > 1) { return false; } } if (quirks_ & PLUGIN_QUIRK_DIE_AFTER_UNLOAD) webkit_glue::SetForcefullyTerminatePluginProcess(true); int argc = 0; scoped_array<char*> argn(new char*[arg_names.size()]); scoped_array<char*> argv(new char*[arg_names.size()]); for (size_t i = 0; i < arg_names.size(); ++i) { if (quirks_ & PLUGIN_QUIRK_NO_WINDOWLESS && LowerCaseEqualsASCII(arg_names[i], "windowlessvideo")) { continue; } argn[argc] = const_cast<char*>(arg_names[i].c_str()); argv[argc] = const_cast<char*>(arg_values[i].c_str()); argc++; } bool start_result = instance_->Start( url, argn.get(), argv.get(), argc, load_manually); if (!start_result) return false; windowless_ = instance_->windowless(); if (!windowless_) { if (!WindowedCreatePlugin()) return false; } else { instance_->set_window_handle(parent_); } PlatformInitialize(); plugin_url_ = url.spec(); return true; }
2,332
61,139
0
set_permissions_file (SetPermissionsJob *job, GFile *file, GFileInfo *info) { CommonJob *common; GFileInfo *child_info; gboolean free_info; guint32 current; guint32 value; guint32 mask; GFileEnumerator *enumerator; GFile *child; common = (CommonJob *) job; nautilus_progress_info_pulse_progress (common->progress); free_info = FALSE; if (info == NULL) { free_info = TRUE; info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_UNIX_MODE, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, common->cancellable, NULL); /* Ignore errors */ if (info == NULL) { return; } } if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) { value = job->dir_permissions; mask = job->dir_mask; } else { value = job->file_permissions; mask = job->file_mask; } if (!job_aborted (common) && g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE)) { current = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE); if (common->undo_info != NULL) { nautilus_file_undo_info_rec_permissions_add_file (NAUTILUS_FILE_UNDO_INFO_REC_PERMISSIONS (common->undo_info), file, current); } current = (current & ~mask) | value; g_file_set_attribute_uint32 (file, G_FILE_ATTRIBUTE_UNIX_MODE, current, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, common->cancellable, NULL); } if (!job_aborted (common) && g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) { enumerator = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_UNIX_MODE, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, common->cancellable, NULL); if (enumerator) { while (!job_aborted (common) && (child_info = g_file_enumerator_next_file (enumerator, common->cancellable, NULL)) != NULL) { child = g_file_get_child (file, g_file_info_get_name (child_info)); set_permissions_file (job, child, child_info); g_object_unref (child); g_object_unref (child_info); } g_file_enumerator_close (enumerator, common->cancellable, NULL); g_object_unref (enumerator); } } if (free_info) { g_object_unref (info); } }
2,333
25,088
0
static struct inet_peer *lookup_rcu(const struct inetpeer_addr *daddr, struct inet_peer_base *base) { struct inet_peer *u = rcu_dereference(base->root); int count = 0; while (u != peer_avl_empty) { int cmp = addr_compare(daddr, &u->daddr); if (cmp == 0) { /* Before taking a reference, check if this entry was * deleted (refcnt=-1) */ if (!atomic_add_unless(&u->refcnt, 1, -1)) u = NULL; return u; } if (cmp == -1) u = rcu_dereference(u->avl_left); else u = rcu_dereference(u->avl_right); if (unlikely(++count == PEER_MAXDEPTH)) break; } return NULL; }
2,334
77,090
0
parse_pop_vlan(struct ofpbuf *ofpacts) { ofpact_put_STRIP_VLAN(ofpacts)->ofpact.raw = OFPAT_RAW11_POP_VLAN; return NULL; }
2,335
168,321
0
void BrowserView::NativeThemeUpdated(const ui::NativeTheme* theme) { if (!initialized_) return; if (!handling_theme_changed_) UserChangedTheme(); MaybeShowInvertBubbleView(this); }
2,336
45,929
0
static int encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct priv *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk w; blkcipher_walk_init(&w, dst, src, nbytes); return crypt(desc, &w, ctx, crypto_cipher_alg(ctx->tweak)->cia_encrypt, crypto_cipher_alg(ctx->child)->cia_encrypt); }
2,337
144,500
0
RenderFrameHostImpl* WebContentsImpl::FindFrameByFrameTreeNodeId( int frame_tree_node_id) { FrameTreeNode* frame = frame_tree_.FindByID(frame_tree_node_id); return frame ? frame->current_frame_host() : nullptr; }
2,338
182,771
1
MagickExport Image *ComplexImages(const Image *images,const ComplexOperator op, ExceptionInfo *exception) { #define ComplexImageTag "Complex/Image" CacheView *Ai_view, *Ar_view, *Bi_view, *Br_view, *Ci_view, *Cr_view; const char *artifact; const Image *Ai_image, *Ar_image, *Bi_image, *Br_image; double snr; Image *Ci_image, *complex_images, *Cr_image, *image; MagickBooleanType status; MagickOffsetType progress; ssize_t y; assert(images != (Image *) NULL); assert(images->signature == MagickCoreSignature); if (images->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); if (images->next == (Image *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(),ImageError, "ImageSequenceRequired","`%s'",images->filename); return((Image *) NULL); } image=CloneImage(images,0,0,MagickTrue,exception); if (image == (Image *) NULL) return((Image *) NULL); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) { image=DestroyImageList(image); return(image); } image->depth=32UL; complex_images=NewImageList(); AppendImageToList(&complex_images,image); image=CloneImage(images,0,0,MagickTrue,exception); if (image == (Image *) NULL) { complex_images=DestroyImageList(complex_images); return(complex_images); } AppendImageToList(&complex_images,image); /* Apply complex mathematics to image pixels. */ artifact=GetImageArtifact(image,"complex:snr"); snr=0.0; if (artifact != (const char *) NULL) snr=StringToDouble(artifact,(char **) NULL); Ar_image=images; Ai_image=images->next; Br_image=images; Bi_image=images->next; if ((images->next->next != (Image *) NULL) && (images->next->next->next != (Image *) NULL)) { Br_image=images->next->next; Bi_image=images->next->next->next; } Cr_image=complex_images; Ci_image=complex_images->next; Ar_view=AcquireVirtualCacheView(Ar_image,exception); Ai_view=AcquireVirtualCacheView(Ai_image,exception); Br_view=AcquireVirtualCacheView(Br_image,exception); Bi_view=AcquireVirtualCacheView(Bi_image,exception); Cr_view=AcquireAuthenticCacheView(Cr_image,exception); Ci_view=AcquireAuthenticCacheView(Ci_image,exception); status=MagickTrue; progress=0; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_threads(Cr_image,complex_images,Cr_image->rows,1L) #endif for (y=0; y < (ssize_t) Cr_image->rows; y++) { register const Quantum *magick_restrict Ai, *magick_restrict Ar, *magick_restrict Bi, *magick_restrict Br; register Quantum *magick_restrict Ci, *magick_restrict Cr; register ssize_t x; if (status == MagickFalse) continue; Ar=GetCacheViewVirtualPixels(Ar_view,0,y,Cr_image->columns,1,exception); Ai=GetCacheViewVirtualPixels(Ai_view,0,y,Cr_image->columns,1,exception); Br=GetCacheViewVirtualPixels(Br_view,0,y,Cr_image->columns,1,exception); Bi=GetCacheViewVirtualPixels(Bi_view,0,y,Cr_image->columns,1,exception); Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception); Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception); if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) || (Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) || (Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) Cr_image->columns; x++) { register ssize_t i; for (i=0; i < (ssize_t) GetPixelChannels(Cr_image); i++) { switch (op) { case AddComplexOperator: { Cr[i]=Ar[i]+Br[i]; Ci[i]=Ai[i]+Bi[i]; break; } case ConjugateComplexOperator: default: { Cr[i]=Ar[i]; Ci[i]=(-Bi[i]); break; } case DivideComplexOperator: { double gamma; gamma=PerceptibleReciprocal((double) Br[i]*Br[i]+Bi[i]*Bi[i]+snr); Cr[i]=gamma*((double) Ar[i]*Br[i]+(double) Ai[i]*Bi[i]); Ci[i]=gamma*((double) Ai[i]*Br[i]-(double) Ar[i]*Bi[i]); break; } case MagnitudePhaseComplexOperator: { Cr[i]=sqrt((double) Ar[i]*Ar[i]+(double) Ai[i]*Ai[i]); Ci[i]=atan2((double) Ai[i],(double) Ar[i])/(2.0*MagickPI)+0.5; break; } case MultiplyComplexOperator: { Cr[i]=QuantumScale*((double) Ar[i]*Br[i]-(double) Ai[i]*Bi[i]); Ci[i]=QuantumScale*((double) Ai[i]*Br[i]+(double) Ar[i]*Bi[i]); break; } case RealImaginaryComplexOperator: { Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5)); Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5)); break; } case SubtractComplexOperator: { Cr[i]=Ar[i]-Br[i]; Ci[i]=Ai[i]-Bi[i]; break; } } } Ar+=GetPixelChannels(Ar_image); Ai+=GetPixelChannels(Ai_image); Br+=GetPixelChannels(Br_image); Bi+=GetPixelChannels(Bi_image); Cr+=GetPixelChannels(Cr_image); Ci+=GetPixelChannels(Ci_image); } if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse) status=MagickFalse; if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse) status=MagickFalse; if (images->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows); if (proceed == MagickFalse) status=MagickFalse; } } Cr_view=DestroyCacheView(Cr_view); Ci_view=DestroyCacheView(Ci_view); Br_view=DestroyCacheView(Br_view); Bi_view=DestroyCacheView(Bi_view); Ar_view=DestroyCacheView(Ar_view); Ai_view=DestroyCacheView(Ai_view); if (status == MagickFalse) complex_images=DestroyImageList(complex_images); return(complex_images); }
2,339
33,433
0
static inline int can_use_console(unsigned int cpu) { return cpu_online(cpu) || have_callable_console(); }
2,340
16,484
0
check_domain_attributes() { /* Make sure the FILESYSTEM_DOMAIN and UID_DOMAIN attributes are set to something reasonable. If they're not already defined, we default to our own full hostname. Moved this to its own function so we're sure we have our full hostname by the time we call this. -Derek Wright 10/20/98 */ char *uid_domain, *filesys_domain; filesys_domain = param("FILESYSTEM_DOMAIN"); if( !filesys_domain ) { insert( "FILESYSTEM_DOMAIN", get_local_fqdn().Value(), ConfigTab, TABLESIZE ); extra_info->AddInternalParam("FILESYSTEM_DOMAIN"); } else { free( filesys_domain ); } uid_domain = param("UID_DOMAIN"); if( !uid_domain ) { insert( "UID_DOMAIN", get_local_fqdn().Value(), ConfigTab, TABLESIZE ); extra_info->AddInternalParam("UID_DOMAIN"); } else { free( uid_domain ); } }
2,341
183,206
1
print_decnet_ctlmsg(netdissect_options *ndo, register const union routehdr *rhp, u_int length, u_int caplen) { int mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags); register const union controlmsg *cmp = (const union controlmsg *)rhp; int src, dst, info, blksize, eco, ueco, hello, other, vers; etheraddr srcea, rtea; int priority; const char *rhpx = (const char *)rhp; int ret; switch (mflags & RMF_CTLMASK) { case RMF_INIT: ND_PRINT((ndo, "init ")); if (length < sizeof(struct initmsg)) goto trunc; ND_TCHECK(cmp->cm_init); src = EXTRACT_LE_16BITS(cmp->cm_init.in_src); info = EXTRACT_LE_8BITS(cmp->cm_init.in_info); blksize = EXTRACT_LE_16BITS(cmp->cm_init.in_blksize); vers = EXTRACT_LE_8BITS(cmp->cm_init.in_vers); eco = EXTRACT_LE_8BITS(cmp->cm_init.in_eco); ueco = EXTRACT_LE_8BITS(cmp->cm_init.in_ueco); hello = EXTRACT_LE_16BITS(cmp->cm_init.in_hello); print_t_info(ndo, info); ND_PRINT((ndo, "src %sblksize %d vers %d eco %d ueco %d hello %d", dnaddr_string(ndo, src), blksize, vers, eco, ueco, hello)); ret = 1; break; case RMF_VER: ND_PRINT((ndo, "verification ")); if (length < sizeof(struct verifmsg)) goto trunc; ND_TCHECK(cmp->cm_ver); src = EXTRACT_LE_16BITS(cmp->cm_ver.ve_src); other = EXTRACT_LE_8BITS(cmp->cm_ver.ve_fcnval); ND_PRINT((ndo, "src %s fcnval %o", dnaddr_string(ndo, src), other)); ret = 1; break; case RMF_TEST: ND_PRINT((ndo, "test ")); if (length < sizeof(struct testmsg)) goto trunc; ND_TCHECK(cmp->cm_test); src = EXTRACT_LE_16BITS(cmp->cm_test.te_src); other = EXTRACT_LE_8BITS(cmp->cm_test.te_data); ND_PRINT((ndo, "src %s data %o", dnaddr_string(ndo, src), other)); ret = 1; break; case RMF_L1ROUT: ND_PRINT((ndo, "lev-1-routing ")); if (length < sizeof(struct l1rout)) goto trunc; ND_TCHECK(cmp->cm_l1rou); src = EXTRACT_LE_16BITS(cmp->cm_l1rou.r1_src); ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src))); ret = print_l1_routes(ndo, &(rhpx[sizeof(struct l1rout)]), length - sizeof(struct l1rout)); break; case RMF_L2ROUT: ND_PRINT((ndo, "lev-2-routing ")); if (length < sizeof(struct l2rout)) goto trunc; ND_TCHECK(cmp->cm_l2rout); src = EXTRACT_LE_16BITS(cmp->cm_l2rout.r2_src); ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src))); ret = print_l2_routes(ndo, &(rhpx[sizeof(struct l2rout)]), length - sizeof(struct l2rout)); break; case RMF_RHELLO: ND_PRINT((ndo, "router-hello ")); if (length < sizeof(struct rhellomsg)) goto trunc; ND_TCHECK(cmp->cm_rhello); vers = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_vers); eco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_eco); ueco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_ueco); memcpy((char *)&srcea, (const char *)&(cmp->cm_rhello.rh_src), sizeof(srcea)); src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr); info = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_info); blksize = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_blksize); priority = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_priority); hello = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_hello); print_i_info(ndo, info); ND_PRINT((ndo, "vers %d eco %d ueco %d src %s blksize %d pri %d hello %d", vers, eco, ueco, dnaddr_string(ndo, src), blksize, priority, hello)); ret = print_elist(&(rhpx[sizeof(struct rhellomsg)]), length - sizeof(struct rhellomsg)); break; case RMF_EHELLO: ND_PRINT((ndo, "endnode-hello ")); if (length < sizeof(struct ehellomsg)) goto trunc; ND_TCHECK(cmp->cm_ehello); vers = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_vers); eco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_eco); ueco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_ueco); memcpy((char *)&srcea, (const char *)&(cmp->cm_ehello.eh_src), sizeof(srcea)); src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr); info = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_info); blksize = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_blksize); /*seed*/ memcpy((char *)&rtea, (const char *)&(cmp->cm_ehello.eh_router), sizeof(rtea)); dst = EXTRACT_LE_16BITS(rtea.dne_remote.dne_nodeaddr); hello = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_hello); other = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_data); print_i_info(ndo, info); ND_PRINT((ndo, "vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o", vers, eco, ueco, dnaddr_string(ndo, src), blksize, dnaddr_string(ndo, dst), hello, other)); ret = 1; break; default: ND_PRINT((ndo, "unknown control message")); ND_DEFAULTPRINT((const u_char *)rhp, min(length, caplen)); ret = 1; break; } return (ret); trunc: return (0); }
2,342
131,607
0
static void promiseAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(ScriptPromise, cppValue, ScriptPromise(jsValue, info.GetIsolate())); imp->setPromiseAttribute(cppValue); }
2,343
57,820
0
static int attach_recursive_mnt(struct mount *source_mnt, struct mount *dest_mnt, struct mountpoint *dest_mp, struct path *parent_path) { HLIST_HEAD(tree_list); struct mount *child, *p; struct hlist_node *n; int err; if (IS_MNT_SHARED(dest_mnt)) { err = invent_group_ids(source_mnt, true); if (err) goto out; err = propagate_mnt(dest_mnt, dest_mp, source_mnt, &tree_list); lock_mount_hash(); if (err) goto out_cleanup_ids; for (p = source_mnt; p; p = next_mnt(p, source_mnt)) set_mnt_shared(p); } else { lock_mount_hash(); } if (parent_path) { detach_mnt(source_mnt, parent_path); attach_mnt(source_mnt, dest_mnt, dest_mp); touch_mnt_namespace(source_mnt->mnt_ns); } else { mnt_set_mountpoint(dest_mnt, dest_mp, source_mnt); commit_tree(source_mnt, NULL); } hlist_for_each_entry_safe(child, n, &tree_list, mnt_hash) { struct mount *q; hlist_del_init(&child->mnt_hash); q = __lookup_mnt_last(&child->mnt_parent->mnt, child->mnt_mountpoint); commit_tree(child, q); } unlock_mount_hash(); return 0; out_cleanup_ids: while (!hlist_empty(&tree_list)) { child = hlist_entry(tree_list.first, struct mount, mnt_hash); umount_tree(child, UMOUNT_SYNC); } unlock_mount_hash(); cleanup_group_ids(source_mnt, NULL); out: return err; }
2,344
35,328
0
static struct ip_tunnel *ipgre_tunnel_find(struct net *net, struct ip_tunnel_parm *parms, int type) { __be32 remote = parms->iph.daddr; __be32 local = parms->iph.saddr; __be32 key = parms->i_key; int link = parms->link; struct ip_tunnel *t; struct ip_tunnel __rcu **tp; struct ipgre_net *ign = net_generic(net, ipgre_net_id); for (tp = __ipgre_bucket(ign, parms); (t = rtnl_dereference(*tp)) != NULL; tp = &t->next) if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr && key == t->parms.i_key && link == t->parms.link && type == t->dev->type) break; return t; }
2,345
107,314
0
TabContents* Browser::OpenApplication( Profile* profile, const Extension* extension, extension_misc::LaunchContainer container, TabContents* existing_tab) { TabContents* tab = NULL; UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); switch (container) { case extension_misc::LAUNCH_WINDOW: case extension_misc::LAUNCH_PANEL: tab = Browser::OpenApplicationWindow(profile, extension, container, GURL(), NULL); break; case extension_misc::LAUNCH_TAB: { tab = Browser::OpenApplicationTab(profile, extension, existing_tab); break; } default: NOTREACHED(); break; } return tab; }
2,346
5,221
0
static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int where_cond, const char *pad, int pad_len, zend_ulong opt) /* {{{ */ { char *tmp; char buf[256]; zend_ulong num_idx; zend_string *fld; zval *val; ZEND_HASH_FOREACH_KEY_VAL(ht, num_idx, fld, val) { if (fld == NULL) { php_error_docref(NULL, E_NOTICE, "Expects associative array for values to be inserted"); return -1; } if (opt & PGSQL_DML_ESCAPE) { tmp = PGSQLescapeIdentifier(pg_link, fld->val, fld->len + 1); smart_str_appends(querystr, tmp); PGSQLfree(tmp); } else { smart_str_appendl(querystr, fld->val, fld->len); } if (where_cond && (Z_TYPE_P(val) == IS_TRUE || Z_TYPE_P(val) == IS_FALSE || (Z_TYPE_P(val) == IS_STRING && !strcmp(Z_STRVAL_P(val), "NULL")))) { smart_str_appends(querystr, " IS "); } else { smart_str_appendc(querystr, '='); } switch (Z_TYPE_P(val)) { case IS_STRING: if (opt & PGSQL_DML_ESCAPE) { size_t new_len; tmp = (char *)safe_emalloc(Z_STRLEN_P(val), 2, 1); new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL); smart_str_appendc(querystr, '\''); smart_str_appendl(querystr, tmp, new_len); smart_str_appendc(querystr, '\''); efree(tmp); } else { smart_str_appendl(querystr, Z_STRVAL_P(val), Z_STRLEN_P(val)); } break; case IS_LONG: smart_str_append_long(querystr, Z_LVAL_P(val)); break; case IS_DOUBLE: smart_str_appendl(querystr, buf, MIN(snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val)), sizeof(buf)-1)); break; case IS_NULL: smart_str_appendl(querystr, "NULL", sizeof("NULL")-1); break; default: php_error_docref(NULL, E_WARNING, "Expects scaler values. type=%d", Z_TYPE_P(val)); return -1; } smart_str_appendl(querystr, pad, pad_len); } ZEND_HASH_FOREACH_END(); if (querystr->s) { querystr->s->len -= pad_len; } return 0; } /* }}} */
2,347
107,596
0
void ewk_view_restore_state(Evas_Object* ewkView, Evas_Object* frame) { evas_object_smart_callback_call(ewkView, "restore", frame); }
2,348
75,976
0
garp_group_interface_handler(vector_t *strvec) { interface_t *ifp = if_get_by_ifname(strvec_slot(strvec, 1), IF_CREATE_IF_DYNAMIC); if (!ifp) { report_config_error(CONFIG_GENERAL_ERROR, "WARNING - interface %s specified for garp_group doesn't exist", FMT_STR_VSLOT(strvec, 1)); return; } if (ifp->garp_delay) { report_config_error(CONFIG_GENERAL_ERROR, "garp_group already specified for %s - ignoring", FMT_STR_VSLOT(strvec, 1)); return; } #ifdef _HAVE_VRRP_VMAC_ /* We cannot have a group on a vmac interface */ if (ifp->vmac_type) { report_config_error(CONFIG_GENERAL_ERROR, "Cannot specify garp_delay on a vmac (%s) - ignoring", ifp->ifname); return; } #endif ifp->garp_delay = LIST_TAIL_DATA(garp_delay); }
2,349
135,323
0
void Document::platformColorsChanged() { if (!isActive()) return; styleEngine().platformColorsChanged(); }
2,350
49,073
0
void brcmf_free_vif(struct brcmf_cfg80211_vif *vif) { list_del(&vif->list); kfree(vif); }
2,351
42,974
0
static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq, void *buf, unsigned int len) { struct net_device *dev = vi->dev; struct virtnet_stats *stats = this_cpu_ptr(vi->stats); struct sk_buff *skb; struct virtio_net_hdr_mrg_rxbuf *hdr; if (unlikely(len < vi->hdr_len + ETH_HLEN)) { pr_debug("%s: short packet %i\n", dev->name, len); dev->stats.rx_length_errors++; if (vi->mergeable_rx_bufs) { unsigned long ctx = (unsigned long)buf; void *base = mergeable_ctx_to_buf_address(ctx); put_page(virt_to_head_page(base)); } else if (vi->big_packets) { give_pages(rq, buf); } else { dev_kfree_skb(buf); } return; } if (vi->mergeable_rx_bufs) skb = receive_mergeable(dev, vi, rq, (unsigned long)buf, len); else if (vi->big_packets) skb = receive_big(dev, vi, rq, buf, len); else skb = receive_small(vi, buf, len); if (unlikely(!skb)) return; hdr = skb_vnet_hdr(skb); u64_stats_update_begin(&stats->rx_syncp); stats->rx_bytes += skb->len; stats->rx_packets++; u64_stats_update_end(&stats->rx_syncp); if (hdr->hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { pr_debug("Needs csum!\n"); if (!skb_partial_csum_set(skb, virtio16_to_cpu(vi->vdev, hdr->hdr.csum_start), virtio16_to_cpu(vi->vdev, hdr->hdr.csum_offset))) goto frame_err; } else if (hdr->hdr.flags & VIRTIO_NET_HDR_F_DATA_VALID) { skb->ip_summed = CHECKSUM_UNNECESSARY; } skb->protocol = eth_type_trans(skb, dev); pr_debug("Receiving skb proto 0x%04x len %i type %i\n", ntohs(skb->protocol), skb->len, skb->pkt_type); if (hdr->hdr.gso_type != VIRTIO_NET_HDR_GSO_NONE) { pr_debug("GSO!\n"); switch (hdr->hdr.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { case VIRTIO_NET_HDR_GSO_TCPV4: skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; break; case VIRTIO_NET_HDR_GSO_UDP: skb_shinfo(skb)->gso_type = SKB_GSO_UDP; break; case VIRTIO_NET_HDR_GSO_TCPV6: skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; break; default: net_warn_ratelimited("%s: bad gso type %u.\n", dev->name, hdr->hdr.gso_type); goto frame_err; } if (hdr->hdr.gso_type & VIRTIO_NET_HDR_GSO_ECN) skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; skb_shinfo(skb)->gso_size = virtio16_to_cpu(vi->vdev, hdr->hdr.gso_size); if (skb_shinfo(skb)->gso_size == 0) { net_warn_ratelimited("%s: zero gso size.\n", dev->name); goto frame_err; } /* Header must be checked, and gso_segs computed. */ skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; skb_shinfo(skb)->gso_segs = 0; } skb_mark_napi_id(skb, &rq->napi); netif_receive_skb(skb); return; frame_err: dev->stats.rx_frame_errors++; dev_kfree_skb(skb); }
2,352
149,480
0
void ContentSecurityPolicy::setupSelf(const SecurityOrigin& securityOrigin) { m_selfProtocol = securityOrigin.protocol(); m_selfSource = new CSPSource(this, m_selfProtocol, securityOrigin.host(), securityOrigin.port(), String(), CSPSource::NoWildcard, CSPSource::NoWildcard); }
2,353
9,949
0
void Part::updateQuickExtractMenu(QAction *extractAction) { if (!extractAction) { return; } QMenu *menu = extractAction->menu(); if (!menu) { menu = new QMenu(); extractAction->setMenu(menu); connect(menu, &QMenu::triggered, this, &Part::slotQuickExtractFiles); QAction *extractTo = menu->addAction(i18n("Extract To...")); extractTo->setIcon(extractAction->icon()); extractTo->setToolTip(extractAction->toolTip()); if (extractAction == m_extractArchiveAction) { connect(extractTo, &QAction::triggered, this, &Part::slotExtractArchive); } else { connect(extractTo, &QAction::triggered, this, &Part::slotShowExtractionDialog); } menu->addSeparator(); QAction *header = menu->addAction(i18n("Quick Extract To...")); header->setEnabled(false); header->setIcon(QIcon::fromTheme(QStringLiteral("archive-extract"))); } while (menu->actions().size() > 3) { menu->removeAction(menu->actions().last()); } const KConfigGroup conf(KSharedConfig::openConfig(), "ExtractDialog"); const QStringList dirHistory = conf.readPathEntry("DirHistory", QStringList()); for (int i = 0; i < qMin(10, dirHistory.size()); ++i) { const QString dir = QUrl(dirHistory.value(i)).toString(QUrl::RemoveScheme | QUrl::NormalizePathSegments | QUrl::PreferLocalFile); if (QDir(dir).exists()) { QAction *newAction = menu->addAction(dir); newAction->setData(dir); } } }
2,354
58,567
0
BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking) { BOOL status; status = TRUE; transport->blocking = blocking; if (transport->SplitInputOutput) { status &= tcp_set_blocking_mode(transport->TcpIn, blocking); status &= tcp_set_blocking_mode(transport->TcpOut, blocking); } else { status &= tcp_set_blocking_mode(transport->TcpIn, blocking); } if (transport->layer == TRANSPORT_LAYER_TSG) { tsg_set_blocking_mode(transport->tsg, blocking); } return status; }
2,355
17,984
0
ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p) { struct session_state *state = ssh->state; u_int reason, seqnr; int r; u_char *msg; for (;;) { msg = NULL; if (compat20) { r = ssh_packet_read_poll2(ssh, typep, seqnr_p); if (r != 0) return r; if (*typep) { state->keep_alive_timeouts = 0; DBG(debug("received packet type %d", *typep)); } switch (*typep) { case SSH2_MSG_IGNORE: debug3("Received SSH2_MSG_IGNORE"); break; case SSH2_MSG_DEBUG: if ((r = sshpkt_get_u8(ssh, NULL)) != 0 || (r = sshpkt_get_string(ssh, &msg, NULL)) != 0 || (r = sshpkt_get_string(ssh, NULL, NULL)) != 0) { free(msg); return r; } debug("Remote: %.900s", msg); free(msg); break; case SSH2_MSG_DISCONNECT: if ((r = sshpkt_get_u32(ssh, &reason)) != 0 || (r = sshpkt_get_string(ssh, &msg, NULL)) != 0) return r; /* Ignore normal client exit notifications */ do_log2(ssh->state->server_side && reason == SSH2_DISCONNECT_BY_APPLICATION ? SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_ERROR, "Received disconnect from %s port %d:" "%u: %.400s", ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), reason, msg); free(msg); return SSH_ERR_DISCONNECTED; case SSH2_MSG_UNIMPLEMENTED: if ((r = sshpkt_get_u32(ssh, &seqnr)) != 0) return r; debug("Received SSH2_MSG_UNIMPLEMENTED for %u", seqnr); break; default: return 0; } } else { r = ssh_packet_read_poll1(ssh, typep); switch (*typep) { case SSH_MSG_NONE: return SSH_MSG_NONE; case SSH_MSG_IGNORE: break; case SSH_MSG_DEBUG: if ((r = sshpkt_get_string(ssh, &msg, NULL)) != 0) return r; debug("Remote: %.900s", msg); free(msg); break; case SSH_MSG_DISCONNECT: if ((r = sshpkt_get_string(ssh, &msg, NULL)) != 0) return r; error("Received disconnect from %s port %d: " "%.400s", ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), msg); free(msg); return SSH_ERR_DISCONNECTED; default: DBG(debug("received packet type %d", *typep)); return 0; } } } }
2,356
10,742
0
static int xhci_epmask_to_eps_with_streams(XHCIState *xhci, unsigned int slotid, uint32_t epmask, XHCIEPContext **epctxs, USBEndpoint **eps) { XHCISlot *slot; XHCIEPContext *epctx; USBEndpoint *ep; int i, j; assert(slotid >= 1 && slotid <= xhci->numslots); slot = &xhci->slots[slotid - 1]; for (i = 2, j = 0; i <= 31; i++) { if (!(epmask & (1 << i))) { continue; } epctx = slot->eps[i - 1]; ep = xhci_epid_to_usbep(xhci, slotid, i); if (!epctx || !epctx->nr_pstreams || !ep) { continue; } if (epctxs) { epctxs[j] = epctx; } eps[j++] = ep; } return j; }
2,357
114,804
0
__xmlMemStrdup(void){ if (IS_MAIN_THREAD) return (&xmlMemStrdup); else return (&xmlGetGlobalState()->xmlMemStrdup); }
2,358
147,393
0
void V8TestObject::Float32ArrayAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_float32ArrayAttribute_Getter"); test_object_v8_internal::Float32ArrayAttributeAttributeGetter(info); }
2,359
49,226
0
static int hash_sendmsg(struct socket *sock, struct msghdr *msg, size_t ignored) { int limit = ALG_MAX_PAGES * PAGE_SIZE; struct sock *sk = sock->sk; struct alg_sock *ask = alg_sk(sk); struct hash_ctx *ctx = ask->private; long copied = 0; int err; if (limit > sk->sk_sndbuf) limit = sk->sk_sndbuf; lock_sock(sk); if (!ctx->more) { err = crypto_ahash_init(&ctx->req); if (err) goto unlock; } ctx->more = 0; while (msg_data_left(msg)) { int len = msg_data_left(msg); if (len > limit) len = limit; len = af_alg_make_sg(&ctx->sgl, &msg->msg_iter, len); if (len < 0) { err = copied ? 0 : len; goto unlock; } ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, len); err = af_alg_wait_for_completion(crypto_ahash_update(&ctx->req), &ctx->completion); af_alg_free_sg(&ctx->sgl); if (err) goto unlock; copied += len; iov_iter_advance(&msg->msg_iter, len); } err = 0; ctx->more = msg->msg_flags & MSG_MORE; if (!ctx->more) { ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0); err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req), &ctx->completion); } unlock: release_sock(sk); return err ?: copied; }
2,360
107,428
0
bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { if (propertyName == exec->propertyNames().length) { descriptor.setDescriptor(jsNumber(length()), DontDelete | DontEnum); return true; } ArrayStorage* storage = m_storage; bool isArrayIndex; unsigned i = propertyName.toArrayIndex(isArrayIndex); if (isArrayIndex) { if (i >= storage->m_length) return false; if (i < m_vectorLength) { WriteBarrier<Unknown>& value = storage->m_vector[i]; if (value) { descriptor.setDescriptor(value.get(), 0); return true; } } else if (SparseArrayValueMap* map = storage->m_sparseValueMap) { if (i >= MIN_SPARSE_ARRAY_INDEX) { SparseArrayValueMap::iterator it = map->find(i); if (it != map->end()) { descriptor.setDescriptor(it->second.get(), 0); return true; } } } } return JSObject::getOwnPropertyDescriptor(exec, propertyName, descriptor); }
2,361
163,211
0
void NavigationControllerImpl::SetPendingEntry( std::unique_ptr<NavigationEntryImpl> entry) { DiscardNonCommittedEntriesInternal(); pending_entry_ = entry.release(); DCHECK_EQ(-1, pending_entry_index_); NotificationService::current()->Notify( NOTIFICATION_NAV_ENTRY_PENDING, Source<NavigationController>(this), Details<NavigationEntry>(pending_entry_)); }
2,362
111,206
0
void WebPage::loadString(const BlackBerry::Platform::String& string, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& mimeType, const BlackBerry::Platform::String& failingURL) { d->loadString(string, baseURL, mimeType, failingURL); }
2,363
49,044
0
s32 brcmf_cfg80211_up(struct net_device *ndev) { struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_cfg80211_info *cfg = ifp->drvr->config; s32 err = 0; mutex_lock(&cfg->usr_sync); err = __brcmf_cfg80211_up(ifp); mutex_unlock(&cfg->usr_sync); return err; }
2,364
35,919
0
static struct syscall_metadata *syscall_nr_to_meta(int nr) { if (!syscalls_metadata || nr >= NR_syscalls || nr < 0) return NULL; return syscalls_metadata[nr]; }
2,365
117,154
0
static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation); WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); if (!gtk_widget_get_mapped(GTK_WIDGET(webViewBase)) && !webViewBase->priv->pageProxy->drawingArea()->size().isEmpty()) { webViewBase->priv->needsResizeOnMap = true; return; } resizeWebKitWebViewBaseFromAllocation(webViewBase, allocation); }
2,366
65,106
0
static MagickBooleanType ReadUncompressedRGB(Image *image, DDSInfo *dds_info, ExceptionInfo *exception) { PixelPacket *q; ssize_t x, y; unsigned short color; if (dds_info->pixelformat.rgb_bitcount == 8) (void) SetImageType(image,GrayscaleType); else if (dds_info->pixelformat.rgb_bitcount == 16 && !IsBitMask( dds_info->pixelformat,0xf800,0x07e0,0x001f,0x0000)) ThrowBinaryException(CorruptImageError,"ImageTypeNotSupported", image->filename); for (y = 0; y < (ssize_t) dds_info->height; y++) { q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception); if (q == (PixelPacket *) NULL) return MagickFalse; for (x = 0; x < (ssize_t) dds_info->width; x++) { if (dds_info->pixelformat.rgb_bitcount == 8) SetPixelGray(q,ScaleCharToQuantum(ReadBlobByte(image))); else if (dds_info->pixelformat.rgb_bitcount == 16) { color=ReadBlobShort(image); SetPixelRed(q,ScaleCharToQuantum((unsigned char) (((color >> 11)/31.0)*255))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 5) >> 10)/63.0)*255))); SetPixelBlue(q,ScaleCharToQuantum((unsigned char) ((((unsigned short)(color << 11) >> 11)/31.0)*255))); } else { SetPixelBlue(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); SetPixelGreen(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); SetPixelRed(q,ScaleCharToQuantum((unsigned char) ReadBlobByte(image))); if (dds_info->pixelformat.rgb_bitcount == 32) (void) ReadBlobByte(image); } SetPixelAlpha(q,QuantumRange); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) return MagickFalse; } return(SkipRGBMipmaps(image,dds_info,3,exception)); }
2,367
114,731
0
void SetupBlacklist(const std::string& json_blacklist) { GpuBlacklist* blacklist = GpuBlacklist::GetInstance(); ASSERT_TRUE(blacklist->LoadGpuBlacklist( "1.0", json_blacklist, GpuBlacklist::kAllOs)); blacklist->UpdateGpuDataManager(); }
2,368
154,622
0
error::Error GLES2DecoderPassthroughImpl::DoDeleteSamplers( GLsizei n, const volatile GLuint* samplers) { if (n < 0) { InsertError(GL_INVALID_VALUE, "n cannot be negative."); return error::kNoError; } return DeleteHelper(n, samplers, &resources_->sampler_id_map, [this](GLsizei n, GLuint* samplers) { api()->glDeleteSamplersFn(n, samplers); }); }
2,369
177,812
1
void sum_update(const char *p, int32 len) { switch (cursum_type) { case CSUM_MD5: md5_update(&md, (uchar *)p, len); break; case CSUM_MD4: case CSUM_MD4_OLD: case CSUM_MD4_BUSTED: if (len + sumresidue < CSUM_CHUNK) { memcpy(md.buffer + sumresidue, p, len); sumresidue += len; } if (sumresidue) { int32 i = CSUM_CHUNK - sumresidue; memcpy(md.buffer + sumresidue, p, i); mdfour_update(&md, (uchar *)md.buffer, CSUM_CHUNK); len -= i; p += i; } while (len >= CSUM_CHUNK) { mdfour_update(&md, (uchar *)p, CSUM_CHUNK); len -= CSUM_CHUNK; p += CSUM_CHUNK; } sumresidue = len; if (sumresidue) memcpy(md.buffer, p, sumresidue); break; case CSUM_NONE: break; } }
2,370
71,758
0
static void TIFFIgnoreTags(TIFF *tiff) { char *q; const char *p, *tags; Image *image; register ssize_t i; size_t count; TIFFFieldInfo *ignore; if (TIFFGetReadProc(tiff) != TIFFReadBlob) return; image=(Image *)TIFFClientdata(tiff); tags=GetImageArtifact(image,"tiff:ignore-tags"); if (tags == (const char *) NULL) return; count=0; p=tags; while (*p != '\0') { while ((isspace((int) ((unsigned char) *p)) != 0)) p++; (void) strtol(p,&q,10); if (p == q) return; p=q; count++; while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ',')) p++; } if (count == 0) return; i=0; p=tags; ignore=(TIFFFieldInfo *) AcquireQuantumMemory(count,sizeof(*ignore)); ResetMagickMemory(ignore,0,count*sizeof(*ignore)); while (*p != '\0') { while ((isspace((int) ((unsigned char) *p)) != 0)) p++; ignore[i].field_tag=(ttag_t) strtol(p,&q,10); p=q; i++; while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ',')) p++; } (void) TIFFMergeFieldInfo(tiff,ignore,(uint32) count); ignore=(TIFFFieldInfo *) RelinquishMagickMemory(ignore); }
2,371
17,615
0
SProcRenderCreateGlyphSet(ClientPtr client) { REQUEST(xRenderCreateGlyphSetReq); REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); swaps(&stuff->length); swapl(&stuff->gsid); swapl(&stuff->format); return (*ProcRenderVector[stuff->renderReqType]) (client); }
2,372
122,345
0
void HTMLInputElement::setDefaultValue(const AtomicString& value) { setAttribute(valueAttr, value); }
2,373
187,880
1
long Cluster::ParseSimpleBlock(long long block_size, long long& pos, long& len) { const long long block_start = pos; const long long block_stop = pos + block_size; IMkvReader* const pReader = m_pSegment->m_pReader; long long total, avail; long status = pReader->Length(&total, &avail); if (status < 0) // error return status; assert((total < 0) || (avail <= total)); // parse track number if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } long long result = GetUIntLength(pReader, pos, len); if (result < 0) // error return static_cast<long>(result); if (result > 0) // weird return E_BUFFER_NOT_FULL; if ((pos + len) > block_stop) return E_FILE_FORMAT_INVALID; if ((pos + len) > avail) return E_BUFFER_NOT_FULL; const long long track = ReadUInt(pReader, pos, len); if (track < 0) // error return static_cast<long>(track); if (track == 0) return E_FILE_FORMAT_INVALID; #if 0 //TODO(matthewjheaney) //This turned out to be too conservative. The problem is that //if we see a track header in the tracks element with an unsupported //track type, we throw that track header away, so it is not present //in the track map. But even though we don't understand the track //header, there are still blocks in the cluster with that track //number. It was our decision to ignore that track header, so it's //up to us to deal with blocks associated with that track -- we //cannot simply report an error since technically there's nothing //wrong with the file. //For now we go ahead and finish the parse, creating a block entry //for this block. This is somewhat wasteful, because without a //track header there's nothing you can do with the block. What //we really need here is a special return value that indicates to //the caller that he should ignore this particular block, and //continue parsing. const Tracks* const pTracks = m_pSegment->GetTracks(); assert(pTracks); const long tn = static_cast<long>(track); const Track* const pTrack = pTracks->GetTrackByNumber(tn); if (pTrack == NULL) return E_FILE_FORMAT_INVALID; #endif pos += len; // consume track number if ((pos + 2) > block_stop) return E_FILE_FORMAT_INVALID; if ((pos + 2) > avail) { len = 2; return E_BUFFER_NOT_FULL; } pos += 2; // consume timecode if ((pos + 1) > block_stop) return E_FILE_FORMAT_INVALID; if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } unsigned char flags; status = pReader->Read(pos, 1, &flags); if (status < 0) { // error or underflow len = 1; return status; } ++pos; // consume flags byte assert(pos <= avail); if (pos >= block_stop) return E_FILE_FORMAT_INVALID; const int lacing = int(flags & 0x06) >> 1; if ((lacing != 0) && (block_stop > avail)) { len = static_cast<long>(block_stop - pos); return E_BUFFER_NOT_FULL; } status = CreateBlock(0x23, // simple block id block_start, block_size, 0); // DiscardPadding if (status != 0) return status; m_pos = block_stop; return 0; // success }
2,374
128,912
0
PassRefPtr<SerializedScriptValue> SerializedScriptValue::createFromWire(const String& data) { return adoptRef(new SerializedScriptValue(data)); }
2,375
106,145
0
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOrange(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); impl->banana(); return JSValue::encode(jsUndefined()); }
2,376
92,816
0
u32 get_sys_col(int idx) { u32 res; DWORD val = GetSysColor(idx); res = (val)&0xFF; res<<=8; res |= (val>>8)&0xFF; res<<=8; res |= (val>>16)&0xFF; return res; }
2,377
2,353
0
bool ldb_dn_has_extended(struct ldb_dn *dn) { if ( ! dn || dn->invalid) return false; if (dn->ext_linearized && (dn->ext_linearized[0] == '<')) return true; return dn->ext_comp_num != 0; }
2,378
128,143
0
void CastCastView::UpdateLabel() { if (cast_config_delegate_ == nullptr || cast_config_delegate_->HasCastExtension() == false) return; cast_config_delegate_->GetReceiversAndActivities( base::Bind(&CastCastView::UpdateLabelCallback, base::Unretained(this))); }
2,379
69,228
0
get_oldroot_path (const char *path) { while (*path == '/') path++; return strconcat ("/oldroot/", path); }
2,380
81,737
0
int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type) { AVBufferRef *ref = av_buffer_ref(p->qscale_table_buf); int offset = 2*s->mb_stride + 1; if(!ref) return AVERROR(ENOMEM); av_assert0(ref->size >= offset + s->mb_stride * ((f->height+15)/16)); ref->size -= offset; ref->data += offset; return av_frame_set_qp_table(f, ref, s->mb_stride, qp_type); }
2,381
46,854
0
static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { return glue_ecb_crypt_128bit(&camellia_enc, desc, dst, src, nbytes); }
2,382
132,184
0
void RenderFrameImpl::CreateFrame( int routing_id, int parent_routing_id, int previous_sibling_routing_id, int proxy_routing_id, const FrameReplicationState& replicated_state, CompositorDependencies* compositor_deps, const FrameMsg_NewFrame_WidgetParams& widget_params) { blink::WebLocalFrame* web_frame; RenderFrameImpl* render_frame; if (proxy_routing_id == MSG_ROUTING_NONE) { RenderFrameProxy* parent_proxy = RenderFrameProxy::FromRoutingID(parent_routing_id); CHECK(parent_proxy); blink::WebRemoteFrame* parent_web_frame = parent_proxy->web_frame(); blink::WebFrame* previous_sibling_web_frame = nullptr; RenderFrameProxy* previous_sibling_proxy = RenderFrameProxy::FromRoutingID(previous_sibling_routing_id); if (previous_sibling_proxy) previous_sibling_web_frame = previous_sibling_proxy->web_frame(); render_frame = RenderFrameImpl::Create(parent_proxy->render_view(), routing_id); web_frame = parent_web_frame->createLocalChild( replicated_state.scope, WebString::fromUTF8(replicated_state.name), replicated_state.sandbox_flags, render_frame, previous_sibling_web_frame); } else { RenderFrameProxy* proxy = RenderFrameProxy::FromRoutingID(proxy_routing_id); CHECK(proxy); render_frame = RenderFrameImpl::Create(proxy->render_view(), routing_id); web_frame = blink::WebLocalFrame::create(replicated_state.scope, render_frame); render_frame->proxy_routing_id_ = proxy_routing_id; web_frame->initializeToReplaceRemoteFrame( proxy->web_frame(), WebString::fromUTF8(replicated_state.name), replicated_state.sandbox_flags); } render_frame->SetWebFrame(web_frame); CHECK_IMPLIES(parent_routing_id == MSG_ROUTING_NONE, !web_frame->parent()); if (widget_params.routing_id != MSG_ROUTING_NONE) { CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); render_frame->render_widget_ = RenderWidget::CreateForFrame( widget_params.routing_id, widget_params.surface_id, widget_params.hidden, render_frame->render_view_->screen_info(), compositor_deps, web_frame); render_frame->render_widget_->RegisterRenderFrame(render_frame); } render_frame->Initialize(); }
2,383
148,263
0
void PrintJobWorker::GetSettingsDone(PrintingContext::Result result) { owner_->PostTask(FROM_HERE, base::Bind(&PrintJobWorkerOwner::GetSettingsDone, make_scoped_refptr(owner_), printing_context_->settings(), result)); }
2,384
12,943
0
compress_buffer(struct ssh *ssh, struct sshbuf *in, struct sshbuf *out) { u_char buf[4096]; int r, status; if (ssh->state->compression_out_started != 1) return SSH_ERR_INTERNAL_ERROR; /* This case is not handled below. */ if (sshbuf_len(in) == 0) return 0; /* Input is the contents of the input buffer. */ if ((ssh->state->compression_out_stream.next_in = sshbuf_mutable_ptr(in)) == NULL) return SSH_ERR_INTERNAL_ERROR; ssh->state->compression_out_stream.avail_in = sshbuf_len(in); /* Loop compressing until deflate() returns with avail_out != 0. */ do { /* Set up fixed-size output buffer. */ ssh->state->compression_out_stream.next_out = buf; ssh->state->compression_out_stream.avail_out = sizeof(buf); /* Compress as much data into the buffer as possible. */ status = deflate(&ssh->state->compression_out_stream, Z_PARTIAL_FLUSH); switch (status) { case Z_MEM_ERROR: return SSH_ERR_ALLOC_FAIL; case Z_OK: /* Append compressed data to output_buffer. */ if ((r = sshbuf_put(out, buf, sizeof(buf) - ssh->state->compression_out_stream.avail_out)) != 0) return r; break; case Z_STREAM_ERROR: default: ssh->state->compression_out_failures++; return SSH_ERR_INVALID_FORMAT; } } while (ssh->state->compression_out_stream.avail_out == 0); return 0; }
2,385
103,622
0
void InitRenderViewHostForExtensions(RenderViewHost* render_view_host) { SiteInstance* site_instance = render_view_host->site_instance(); const GURL& site = site_instance->site(); if (!site.SchemeIs(chrome::kExtensionScheme)) return; Profile* profile = site_instance->browsing_instance()->profile(); ExtensionService* service = profile->GetExtensionService(); if (!service) return; ExtensionProcessManager* process_manager = profile->GetExtensionProcessManager(); CHECK(process_manager); const Extension* extension = service->GetExtensionByURL(site); if (!extension) return; site_instance->GetProcess()->mark_is_extension_process(); process_manager->RegisterExtensionSiteInstance(site_instance->id(), extension->id()); RenderProcessHost* process = render_view_host->process(); if (extension->is_app()) { render_view_host->Send( new ExtensionMsg_ActivateApplication(extension->id())); service->SetInstalledAppForRenderer(process->id(), extension); } Extension::Type type = extension->GetType(); if (type == Extension::TYPE_EXTENSION || type == Extension::TYPE_PACKAGED_APP) { ChildProcessSecurityPolicy::GetInstance()->GrantScheme( process->id(), chrome::kChromeUIScheme); } if (type == Extension::TYPE_EXTENSION || type == Extension::TYPE_USER_SCRIPT || type == Extension::TYPE_PACKAGED_APP || (type == Extension::TYPE_HOSTED_APP && extension->location() == Extension::COMPONENT)) { render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id())); render_view_host->AllowBindings(BindingsPolicy::EXTENSION); } }
2,386
187,625
1
static double abserr(PNG_CONST png_modifier *pm, int in_depth, int out_depth) { /* Absolute error permitted in linear values - affected by the bit depth of * the calculations. */ if (pm->assume_16_bit_calculations || (pm->calculations_use_input_precision ? in_depth : out_depth) == 16) return pm->maxabs16; else return pm->maxabs8; }
2,387
28,903
0
void kvm_vcpu_reset(struct kvm_vcpu *vcpu) { atomic_set(&vcpu->arch.nmi_queued, 0); vcpu->arch.nmi_pending = 0; vcpu->arch.nmi_injected = false; memset(vcpu->arch.db, 0, sizeof(vcpu->arch.db)); vcpu->arch.dr6 = DR6_FIXED_1; vcpu->arch.dr7 = DR7_FIXED_1; kvm_update_dr7(vcpu); kvm_make_request(KVM_REQ_EVENT, vcpu); vcpu->arch.apf.msr_val = 0; vcpu->arch.st.msr_val = 0; kvmclock_reset(vcpu); kvm_clear_async_pf_completion_queue(vcpu); kvm_async_pf_hash_reset(vcpu); vcpu->arch.apf.halted = false; kvm_pmu_reset(vcpu); memset(vcpu->arch.regs, 0, sizeof(vcpu->arch.regs)); vcpu->arch.regs_avail = ~0; vcpu->arch.regs_dirty = ~0; kvm_x86_ops->vcpu_reset(vcpu); }
2,388
140,361
0
void Editor::respondToChangedSelection( const Position& oldSelectionStart, FrameSelection::SetSelectionOptions options) { spellChecker().respondToChangedSelection(oldSelectionStart, options); client().respondToChangedSelection(&frame(), frame() .selection() .selectionInDOMTree() .selectionTypeWithLegacyGranularity()); setStartNewKillRingSequence(true); }
2,389
49,858
0
SPL_METHOD(Array, seek) { long opos, position; zval *object = getThis(); spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); int result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &position) == FAILURE) { return; } if (!aht) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Array was modified outside object and is no longer an array"); return; } opos = position; if (position >= 0) { /* negative values are not supported */ spl_array_rewind(intern TSRMLS_CC); result = SUCCESS; while (position-- > 0 && (result = spl_array_next(intern TSRMLS_CC)) == SUCCESS); if (result == SUCCESS && zend_hash_has_more_elements_ex(aht, &intern->pos) == SUCCESS) { return; /* ok */ } } zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0 TSRMLS_CC, "Seek position %ld is out of range", opos); } /* }}} */ int static spl_array_object_count_elements_helper(spl_array_object *intern, long *count TSRMLS_DC) /* {{{ */
2,390
71,599
0
static void PushRunlengthPacket(Image *image,const unsigned char *pixels, size_t *length,PixelPacket *pixel,IndexPacket *index) { const unsigned char *p; p=pixels; if (image->storage_class == PseudoClass) { *index=(IndexPacket) 0; switch (image->depth) { case 32: { *index=ConstrainColormapIndex(image,((size_t) *p << 24) | ((size_t) *(p+1) << 16) | ((size_t) *(p+2) << 8) | (size_t) *(p+3)); p+=4; break; } case 16: { *index=ConstrainColormapIndex(image,(*p << 8) | *(p+1)); p+=2; break; } case 8: { *index=ConstrainColormapIndex(image,*p); p++; break; } default: (void) ThrowMagickException(&image->exception,GetMagickModule(), CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename); } *pixel=image->colormap[(ssize_t) *index]; switch (image->depth) { case 8: { unsigned char quantum; if (image->matte != MagickFalse) { p=PushCharPixel(p,&quantum); pixel->opacity=ScaleCharToQuantum(quantum); } break; } case 16: { unsigned short quantum; if (image->matte != MagickFalse) { p=PushShortPixel(MSBEndian,p,&quantum); pixel->opacity=(Quantum) (quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } break; } case 32: { unsigned int quantum; if (image->matte != MagickFalse) { p=PushLongPixel(MSBEndian,p,&quantum); pixel->opacity=(Quantum) (quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } break; } default: (void) ThrowMagickException(&image->exception,GetMagickModule(), CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename); } *length=(size_t) (*p++)+1; return; } switch (image->depth) { case 8: { unsigned char quantum; p=PushCharPixel(p,&quantum); SetPixelRed(pixel,ScaleCharToQuantum(quantum)); SetPixelGreen(pixel,ScaleCharToQuantum(quantum)); SetPixelBlue(pixel,ScaleCharToQuantum(quantum)); if (IsGrayColorspace(image->colorspace) == MagickFalse) { p=PushCharPixel(p,&quantum); SetPixelGreen(pixel,ScaleCharToQuantum(quantum)); p=PushCharPixel(p,&quantum); SetPixelBlue(pixel,ScaleCharToQuantum(quantum)); } if (image->colorspace == CMYKColorspace) { p=PushCharPixel(p,&quantum); SetPixelBlack(index,ScaleCharToQuantum(quantum)); } if (image->matte != MagickFalse) { p=PushCharPixel(p,&quantum); SetPixelOpacity(pixel,ScaleCharToQuantum(quantum)); } break; } case 16: { unsigned short quantum; p=PushShortPixel(MSBEndian,p,&quantum); SetPixelRed(pixel,quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH)); SetPixelGreen(pixel,ScaleCharToQuantum(quantum)); SetPixelBlue(pixel,ScaleCharToQuantum(quantum)); if (IsGrayColorspace(image->colorspace) == MagickFalse) { p=PushShortPixel(MSBEndian,p,&quantum); SetPixelGreen(pixel,quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); p=PushShortPixel(MSBEndian,p,&quantum); SetPixelBlue(pixel,quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } if (image->colorspace == CMYKColorspace) { p=PushShortPixel(MSBEndian,p,&quantum); SetPixelBlack(index,quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } if (image->matte != MagickFalse) { p=PushShortPixel(MSBEndian,p,&quantum); SetPixelOpacity(pixel,quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } break; } case 32: { unsigned int quantum; p=PushLongPixel(MSBEndian,p,&quantum); SetPixelRed(pixel,quantum >> (image->depth-MAGICKCORE_QUANTUM_DEPTH)); SetPixelGreen(pixel,ScaleCharToQuantum(quantum)); SetPixelBlue(pixel,ScaleCharToQuantum(quantum)); if (IsGrayColorspace(image->colorspace) == MagickFalse) { p=PushLongPixel(MSBEndian,p,&quantum); SetPixelGreen(pixel,quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); p=PushLongPixel(MSBEndian,p,&quantum); SetPixelBlue(pixel,quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } if (image->colorspace == CMYKColorspace) { p=PushLongPixel(MSBEndian,p,&quantum); SetPixelIndex(index,quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } if (image->matte != MagickFalse) { p=PushLongPixel(MSBEndian,p,&quantum); SetPixelOpacity(pixel,quantum >> (image->depth- MAGICKCORE_QUANTUM_DEPTH)); } break; } default: (void) ThrowMagickException(&image->exception,GetMagickModule(), CorruptImageError,"ImageDepthNotSupported","`%s'",image->filename); } *length=(size_t) (*p++)+1; }
2,391
61,253
0
static int mboxlist_create_partition(const char *mboxname, const char *part, char **out) { mbentry_t *parent = NULL; if (!part) { int r = mboxlist_findparent(mboxname, &parent); if (!r) part = parent->partition; } /* use defaultpartition if specified */ if (!part && config_defpartition) part = config_defpartition; /* look for most fitting partition */ if (!part) part = partlist_local_select(); /* Configuration error */ if (!part || (strlen(part) > MAX_PARTITION_LEN)) goto err; if (!config_partitiondir(part)) goto err; *out = xstrdupnull(part); mboxlist_entry_free(&parent); return 0; err: mboxlist_entry_free(&parent); return IMAP_PARTITION_UNKNOWN; }
2,392
139,071
0
void SyncWithAllThreads() { for (int i = 0; i < 20; ++i) { base::RunLoop().RunUntilIdle(); SyncWith(BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); SyncWith(audio_manager_->GetWorkerTaskRunner()); } }
2,393
60,014
0
static void usb_mixer_selector_elem_free(struct snd_kcontrol *kctl) { int i, num_ins = 0; if (kctl->private_data) { struct usb_mixer_elem_info *cval = kctl->private_data; num_ins = cval->max; kfree(cval); kctl->private_data = NULL; } if (kctl->private_value) { char **itemlist = (char **)kctl->private_value; for (i = 0; i < num_ins; i++) kfree(itemlist[i]); kfree(itemlist); kctl->private_value = 0; } }
2,394
36,887
0
struct inode *new_inode_pseudo(struct super_block *sb) { struct inode *inode = alloc_inode(sb); if (inode) { spin_lock(&inode->i_lock); inode->i_state = 0; spin_unlock(&inode->i_lock); INIT_LIST_HEAD(&inode->i_sb_list); } return inode; }
2,395
40,571
0
static inline int nl_portid_hash_dilute(struct nl_portid_hash *hash, int len) { int avg = hash->entries >> hash->shift; if (unlikely(avg > 1) && nl_portid_hash_rehash(hash, 1)) return 1; if (unlikely(len > avg) && time_after(jiffies, hash->rehash_time)) { nl_portid_hash_rehash(hash, 0); return 1; } return 0; }
2,396
70,921
0
BGD_DECLARE(int) gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id) { if (im == NULL || (uintmax_t)id > GD_METHOD_COUNT) { return 0; } switch (id) { case GD_NEAREST_NEIGHBOUR: case GD_WEIGHTED4: im->interpolation = NULL; break; /* generic versions*/ /* GD_BILINEAR_FIXED and GD_BICUBIC_FIXED are kept for BC reasons */ case GD_BILINEAR_FIXED: case GD_LINEAR: im->interpolation = filter_linear; break; case GD_BELL: im->interpolation = filter_bell; break; case GD_BESSEL: im->interpolation = filter_bessel; break; case GD_BICUBIC_FIXED: case GD_BICUBIC: im->interpolation = filter_bicubic; break; case GD_BLACKMAN: im->interpolation = filter_blackman; break; case GD_BOX: im->interpolation = filter_box; break; case GD_BSPLINE: im->interpolation = filter_bspline; break; case GD_CATMULLROM: im->interpolation = filter_catmullrom; break; case GD_GAUSSIAN: im->interpolation = filter_gaussian; break; case GD_GENERALIZED_CUBIC: im->interpolation = filter_generalized_cubic; break; case GD_HERMITE: im->interpolation = filter_hermite; break; case GD_HAMMING: im->interpolation = filter_hamming; break; case GD_HANNING: im->interpolation = filter_hanning; break; case GD_MITCHELL: im->interpolation = filter_mitchell; break; case GD_POWER: im->interpolation = filter_power; break; case GD_QUADRATIC: im->interpolation = filter_quadratic; break; case GD_SINC: im->interpolation = filter_sinc; break; case GD_TRIANGLE: im->interpolation = filter_triangle; break; case GD_DEFAULT: id = GD_LINEAR; im->interpolation = filter_linear; default: return 0; break; } im->interpolation_id = id; return 1; }
2,397
39,969
0
cifs_find_fid_lock_conflict(struct cifs_fid_locks *fdlocks, __u64 offset, __u64 length, __u8 type, struct cifsFileInfo *cfile, struct cifsLockInfo **conf_lock, int rw_check) { struct cifsLockInfo *li; struct cifsFileInfo *cur_cfile = fdlocks->cfile; struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; list_for_each_entry(li, &fdlocks->locks, llist) { if (offset + length <= li->offset || offset >= li->offset + li->length) continue; if (rw_check != CIFS_LOCK_OP && current->tgid == li->pid && server->ops->compare_fids(cfile, cur_cfile)) { /* shared lock prevents write op through the same fid */ if (!(li->type & server->vals->shared_lock_type) || rw_check != CIFS_WRITE_OP) continue; } if ((type & server->vals->shared_lock_type) && ((server->ops->compare_fids(cfile, cur_cfile) && current->tgid == li->pid) || type == li->type)) continue; if (conf_lock) *conf_lock = li; return true; } return false; }
2,398
53,935
0
uint32_t ndp_msg_opt_route_lifetime(struct ndp_msg *msg, int offset) { struct __nd_opt_route_info *ri = ndp_msg_payload_opts_offset(msg, offset); return ntohl(ri->nd_opt_ri_lifetime); }
2,399