unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
174,074
0
virtual status_t acquireBuffer(BufferItem *buffer, nsecs_t presentWhen, uint64_t maxFrameNumber) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); data.writeInt64(presentWhen); data.writeUint64(maxFrameNumber); status_t result = remote()->transact(ACQUIRE_BUFFER, data, &reply); if (result != NO_ERROR) { return result; } result = reply.read(*buffer); if (result != NO_ERROR) { return result; } return reply.readInt32(); }
13,700
78,133
0
static void sc_asn1_print_generalizedtime(const u8 * buf, size_t buflen) { if (buflen < 8) { printf("Error in decoding.\n"); return; } print_ascii(buf, 2); sc_asn1_print_utctime(buf + 2, buflen - 2); }
13,701
155,077
0
SendTabToSelfInfoBar::SendTabToSelfInfoBar( std::unique_ptr<SendTabToSelfInfoBarDelegate> delegate) : InfoBarAndroid(std::move(delegate)) {}
13,702
35,697
0
static int lua_map_handler(request_rec *r) { int rc, n = 0; apr_pool_t *pool; lua_State *L; const char *filename, *function_name; const char *values[10]; ap_lua_vm_spec *spec; ap_regmatch_t match[10]; ap_lua_server_cfg *server_cfg = ap_get_module_config(r->server->module_config, &lua_module); const ap_lua_dir_cfg *cfg = ap_get_module_config(r->per_dir_config, &lua_module); for (n = 0; n < cfg->mapped_handlers->nelts; n++) { ap_lua_mapped_handler_spec *hook_spec = ((ap_lua_mapped_handler_spec **) cfg->mapped_handlers->elts)[n]; if (hook_spec == NULL) { continue; } if (!ap_regexec(hook_spec->uri_pattern, r->uri, 10, match, 0)) { int i; for (i=0 ; i < 10; i++) { if (match[i].rm_eo >= 0) { values[i] = apr_pstrndup(r->pool, r->uri+match[i].rm_so, match[i].rm_eo - match[i].rm_so); } else values[i] = ""; } filename = ap_lua_interpolate_string(r->pool, hook_spec->file_name, values); function_name = ap_lua_interpolate_string(r->pool, hook_spec->function_name, values); spec = create_vm_spec(&pool, r, cfg, server_cfg, filename, hook_spec->bytecode, hook_spec->bytecode_len, function_name, "mapped handler"); L = ap_lua_get_lua_state(pool, spec, r); if (!L) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, APLOGNO(02330) "lua: Failed to obtain Lua interpreter for entry function '%s' in %s", function_name, filename); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } if (function_name != NULL) { lua_getglobal(L, function_name); if (!lua_isfunction(L, -1)) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, APLOGNO(02331) "lua: Unable to find entry function '%s' in %s (not a valid function)", function_name, filename); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } ap_lua_run_lua_request(L, r); } else { int t; ap_lua_run_lua_request(L, r); t = lua_gettop(L); lua_setglobal(L, "r"); lua_settop(L, t); } if (lua_pcall(L, 1, 1, 0)) { report_lua_error(L, r); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } rc = DECLINED; if (lua_isnumber(L, -1)) { rc = lua_tointeger(L, -1); } else { ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02483) "lua: Lua handler %s in %s did not return a value, assuming apache2.OK", function_name, filename); rc = OK; } ap_lua_release_state(L, spec, r); if (rc != DECLINED) { return rc; } } } return DECLINED; }
13,703
168,228
0
~ScopedBrowserShower() { if (params_->window_action == NavigateParams::SHOW_WINDOW_INACTIVE) { params_->browser->window()->ShowInactive(); } else if (params_->window_action == NavigateParams::SHOW_WINDOW) { BrowserWindow* window = params_->browser->window(); window->Show(); if (params_->user_gesture && params_->disposition == WindowOpenDisposition::NEW_POPUP && *contents_) { (*contents_)->Focus(); window->Activate(); } } }
13,704
92,261
0
XML_ParserCreate(const XML_Char *encodingName) { return XML_ParserCreate_MM(encodingName, NULL, NULL); }
13,705
155,952
0
void PeopleHandler::OnUnifiedConsentToggleChanged(const base::ListValue* args) { bool is_toggle_checked = args->GetList()[0].GetBool(); if (!is_toggle_checked) { unified_consent::metrics::RecordUnifiedConsentRevoked( unified_consent::metrics::UnifiedConsentRevokeReason:: kUserDisabledSettingsToggle); } }
13,706
180,375
1
static int getStrrtokenPos(char* str, int savedPos) { int result =-1; int i; for(i=savedPos-1; i>=0; i--) { if(isIDSeparator(*(str+i)) ){ /* delimiter found; check for singleton */ if(i>=2 && isIDSeparator(*(str+i-2)) ){ /* a singleton; so send the position of token before the singleton */ result = i-2; } else { result = i; } break; } } if(result < 1){ /* Just in case inavlid locale e.g. '-x-xyz' or '-sl_Latn' */ result =-1; } return result; }
13,707
35,981
0
SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, int index, struct cifs_search_info *srch_inf) { struct smb2_query_directory_req *req; struct smb2_query_directory_rsp *rsp = NULL; struct kvec iov[2]; int rc = 0; int len; int resp_buftype; unsigned char *bufptr; struct TCP_Server_Info *server; struct cifs_ses *ses = tcon->ses; __le16 asteriks = cpu_to_le16('*'); char *end_of_smb; unsigned int output_size = CIFSMaxBufSize; size_t info_buf_size; if (ses && (ses->server)) server = ses->server; else return -EIO; rc = small_smb2_init(SMB2_QUERY_DIRECTORY, tcon, (void **) &req); if (rc) return rc; switch (srch_inf->info_level) { case SMB_FIND_FILE_DIRECTORY_INFO: req->FileInformationClass = FILE_DIRECTORY_INFORMATION; info_buf_size = sizeof(FILE_DIRECTORY_INFO) - 1; break; case SMB_FIND_FILE_ID_FULL_DIR_INFO: req->FileInformationClass = FILEID_FULL_DIRECTORY_INFORMATION; info_buf_size = sizeof(SEARCH_ID_FULL_DIR_INFO) - 1; break; default: cifs_dbg(VFS, "info level %u isn't supported\n", srch_inf->info_level); rc = -EINVAL; goto qdir_exit; } req->FileIndex = cpu_to_le32(index); req->PersistentFileId = persistent_fid; req->VolatileFileId = volatile_fid; len = 0x2; bufptr = req->Buffer; memcpy(bufptr, &asteriks, len); req->FileNameOffset = cpu_to_le16(sizeof(struct smb2_query_directory_req) - 1 - 4); req->FileNameLength = cpu_to_le16(len); /* * BB could be 30 bytes or so longer if we used SMB2 specific * buffer lengths, but this is safe and close enough. */ output_size = min_t(unsigned int, output_size, server->maxBuf); output_size = min_t(unsigned int, output_size, 2 << 15); req->OutputBufferLength = cpu_to_le32(output_size); iov[0].iov_base = (char *)req; /* 4 for RFC1001 length and 1 for Buffer */ iov[0].iov_len = get_rfc1002_length(req) + 4 - 1; iov[1].iov_base = (char *)(req->Buffer); iov[1].iov_len = len; inc_rfc1001_len(req, len - 1 /* Buffer */); rc = SendReceive2(xid, ses, iov, 2, &resp_buftype, 0); rsp = (struct smb2_query_directory_rsp *)iov[0].iov_base; if (rc) { cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); goto qdir_exit; } rc = validate_buf(le16_to_cpu(rsp->OutputBufferOffset), le32_to_cpu(rsp->OutputBufferLength), &rsp->hdr, info_buf_size); if (rc) goto qdir_exit; srch_inf->unicode = true; if (srch_inf->ntwrk_buf_start) { if (srch_inf->smallBuf) cifs_small_buf_release(srch_inf->ntwrk_buf_start); else cifs_buf_release(srch_inf->ntwrk_buf_start); } srch_inf->ntwrk_buf_start = (char *)rsp; srch_inf->srch_entries_start = srch_inf->last_entry = 4 /* rfclen */ + (char *)&rsp->hdr + le16_to_cpu(rsp->OutputBufferOffset); /* 4 for rfc1002 length field */ end_of_smb = get_rfc1002_length(rsp) + 4 + (char *)&rsp->hdr; srch_inf->entries_in_buffer = num_entries(srch_inf->srch_entries_start, end_of_smb, &srch_inf->last_entry, info_buf_size); srch_inf->index_of_last_entry += srch_inf->entries_in_buffer; cifs_dbg(FYI, "num entries %d last_index %lld srch start %p srch end %p\n", srch_inf->entries_in_buffer, srch_inf->index_of_last_entry, srch_inf->srch_entries_start, srch_inf->last_entry); if (resp_buftype == CIFS_LARGE_BUFFER) srch_inf->smallBuf = false; else if (resp_buftype == CIFS_SMALL_BUFFER) srch_inf->smallBuf = true; else cifs_dbg(VFS, "illegal search buffer type\n"); if (rsp->hdr.Status == STATUS_NO_MORE_FILES) srch_inf->endOfSearch = 1; else srch_inf->endOfSearch = 0; return rc; qdir_exit: free_rsp_buf(resp_buftype, rsp); return rc; }
13,708
144,899
0
explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva) : rwhva_(rwhva) { DCHECK(rwhva_); aura::Env::GetInstance()->AddPreTargetHandler(this); }
13,709
153,446
0
bool TabStrip::OnMousePressed(const ui::MouseEvent& event) { UpdateStackedLayoutFromMouseEvent(this, event); return false; }
13,710
104,986
0
void GraphicsContext::setPlatformShadow(FloatSize const&, float, Color const&, ColorSpace) { notImplemented(); }
13,711
131,354
0
static void documentFragmentAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueFast(info, WTF::getPtr(imp->documentFragmentAttribute()), imp); }
13,712
35,154
0
ipv6_connect(struct TCP_Server_Info *server) { int rc = 0; int val; bool connected = false; __be16 orig_port = 0; struct socket *socket = server->ssocket; if (socket == NULL) { rc = sock_create_kern(PF_INET6, SOCK_STREAM, IPPROTO_TCP, &socket); if (rc < 0) { cERROR(1, "Error %d creating ipv6 socket", rc); socket = NULL; return rc; } /* BB other socket options to set KEEPALIVE, NODELAY? */ cFYI(1, "ipv6 Socket created"); server->ssocket = socket; socket->sk->sk_allocation = GFP_NOFS; cifs_reclassify_socket6(socket); } /* user overrode default port */ if (server->addr.sockAddr6.sin6_port) { rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr6, sizeof(struct sockaddr_in6), 0); if (rc >= 0) connected = true; } if (!connected) { /* save original port so we can retry user specified port later if fall back ports fail this time */ orig_port = server->addr.sockAddr6.sin6_port; /* do not retry on the same port we just failed on */ if (server->addr.sockAddr6.sin6_port != htons(CIFS_PORT)) { server->addr.sockAddr6.sin6_port = htons(CIFS_PORT); rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr6, sizeof(struct sockaddr_in6), 0); if (rc >= 0) connected = true; } } if (!connected) { server->addr.sockAddr6.sin6_port = htons(RFC1001_PORT); rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr6, sizeof(struct sockaddr_in6), 0); if (rc >= 0) connected = true; } /* give up here - unless we want to retry on different protocol families some day */ if (!connected) { if (orig_port) server->addr.sockAddr6.sin6_port = orig_port; cFYI(1, "Error %d connecting to server via ipv6", rc); sock_release(socket); server->ssocket = NULL; return rc; } /* * Eventually check for other socket options to change from * the default. sock_setsockopt not used because it expects * user space buffer */ socket->sk->sk_rcvtimeo = 7 * HZ; socket->sk->sk_sndtimeo = 5 * HZ; if (server->tcp_nodelay) { val = 1; rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); if (rc) cFYI(1, "set TCP_NODELAY socket option error %d", rc); } server->ssocket = socket; return rc; }
13,713
19,613
0
static void release_tgcred(struct cred *cred) { #ifdef CONFIG_KEYS struct thread_group_cred *tgcred = cred->tgcred; if (atomic_dec_and_test(&tgcred->usage)) call_rcu(&tgcred->rcu, release_tgcred_rcu); #endif }
13,714
108,799
0
bool ChildProcessSecurityPolicyImpl::IsWebSafeScheme( const std::string& scheme) { base::AutoLock lock(lock_); return (web_safe_schemes_.find(scheme) != web_safe_schemes_.end()); }
13,715
20,962
0
static inline unsigned long get_vflags(struct kernel_vm86_regs *regs) { unsigned long flags = regs->pt.flags & RETURN_MASK; if (VEFLAGS & X86_EFLAGS_VIF) flags |= X86_EFLAGS_IF; flags |= X86_EFLAGS_IOPL; return flags | (VEFLAGS & current->thread.v86mask); }
13,716
181,132
1
lookup_bytestring(netdissect_options *ndo, register const u_char *bs, const unsigned int nlen) { struct enamemem *tp; register u_int i, j, k; if (nlen >= 6) { k = (bs[0] << 8) | bs[1]; j = (bs[2] << 8) | bs[3]; i = (bs[4] << 8) | bs[5]; } else if (nlen >= 4) { k = (bs[0] << 8) | bs[1]; j = (bs[2] << 8) | bs[3]; i = 0; } else i = j = k = 0; tp = &bytestringtable[(i ^ j) & (HASHNAMESIZE-1)]; while (tp->e_nxt) if (tp->e_addr0 == i && tp->e_addr1 == j && tp->e_addr2 == k && memcmp((const char *)bs, (const char *)(tp->e_bs), nlen) == 0) return tp; else tp = tp->e_nxt; tp->e_addr0 = i; tp->e_addr1 = j; tp->e_addr2 = k; tp->e_bs = (u_char *) calloc(1, nlen + 1); if (tp->e_bs == NULL) (*ndo->ndo_error)(ndo, "lookup_bytestring: calloc"); memcpy(tp->e_bs, bs, nlen); tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp)); if (tp->e_nxt == NULL) (*ndo->ndo_error)(ndo, "lookup_bytestring: calloc"); return tp; }
13,717
70,885
0
static void bs_open_read (Bitstream *bs, void *buffer_start, void *buffer_end) { bs->error = bs->sr = bs->bc = 0; bs->ptr = (bs->buf = buffer_start) - 1; bs->end = buffer_end; bs->wrap = bs_read; }
13,718
154,376
0
void GLES2DecoderImpl::UnbindTexture(TextureRef* texture_ref, bool supports_separate_framebuffer_binds) { Texture* texture = texture_ref->texture(); if (texture->IsAttachedToFramebuffer()) { framebuffer_state_.clear_state_dirty = true; } state_.UnbindTexture(texture_ref); if (supports_separate_framebuffer_binds) { if (framebuffer_state_.bound_read_framebuffer.get()) { framebuffer_state_.bound_read_framebuffer->UnbindTexture( GL_READ_FRAMEBUFFER_EXT, texture_ref); } if (framebuffer_state_.bound_draw_framebuffer.get()) { framebuffer_state_.bound_draw_framebuffer->UnbindTexture( GL_DRAW_FRAMEBUFFER_EXT, texture_ref); } } else { if (framebuffer_state_.bound_draw_framebuffer.get()) { framebuffer_state_.bound_draw_framebuffer->UnbindTexture(GL_FRAMEBUFFER, texture_ref); } } }
13,719
148,098
0
static void VoidMethodEventTargetArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("voidMethodEventTargetArg", "TestObject", ExceptionMessages::NotEnoughArguments(1, info.Length()))); return; } EventTarget* event_target_arg; event_target_arg = V8EventTarget::ToImplWithTypeCheck(info.GetIsolate(), info[0]); if (!event_target_arg) { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute("voidMethodEventTargetArg", "TestObject", ExceptionMessages::ArgumentNotOfType(0, "EventTarget"))); return; } impl->voidMethodEventTargetArg(event_target_arg); }
13,720
123,843
0
scoped_ptr<cc::OutputSurface> RenderViewImpl::CreateOutputSurface() { WebKit::WebGraphicsContext3D::Attributes attributes; attributes.antialias = false; attributes.shareResources = true; attributes.noAutomaticFlushes = true; WebGraphicsContext3D* context = CreateGraphicsContext3D(attributes); if (!context) return scoped_ptr<cc::OutputSurface>(); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kEnableSoftwareCompositingGLAdapter)) { return scoped_ptr<cc::OutputSurface>( new CompositorOutputSurface(routing_id(), NULL, new CompositorSoftwareOutputDeviceGLAdapter(context))); } else { bool composite_to_mailbox = command_line.HasSwitch(cc::switches::kCompositeToMailbox); DCHECK(!composite_to_mailbox || command_line.HasSwitch( cc::switches::kEnableCompositorFrameMessage)); DCHECK(!composite_to_mailbox || is_threaded_compositing_enabled_); return scoped_ptr<cc::OutputSurface>(composite_to_mailbox ? new MailboxOutputSurface(routing_id(), context, NULL) : new CompositorOutputSurface(routing_id(), context, NULL)); } }
13,721
12,047
0
int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) { if (*key >= OPENSSL_CRYPTO_THREAD_LOCAL_KEY_MAX) return 0; thread_local_storage[*key] = val; return 1; }
13,722
76,399
0
static int fixup_call_args(struct bpf_verifier_env *env) { #ifndef CONFIG_BPF_JIT_ALWAYS_ON struct bpf_prog *prog = env->prog; struct bpf_insn *insn = prog->insnsi; int i, depth; #endif int err; err = 0; if (env->prog->jit_requested) { err = jit_subprogs(env); if (err == 0) return 0; if (err == -EFAULT) return err; } #ifndef CONFIG_BPF_JIT_ALWAYS_ON for (i = 0; i < prog->len; i++, insn++) { if (insn->code != (BPF_JMP | BPF_CALL) || insn->src_reg != BPF_PSEUDO_CALL) continue; depth = get_callee_stack_depth(env, insn, i); if (depth < 0) return depth; bpf_patch_call_args(insn, depth); } err = 0; #endif return err; }
13,723
105,412
0
static void webkit_web_view_dispose(GObject* object) { WebKitWebView* webView = WEBKIT_WEB_VIEW(object); WebKitWebViewPrivate* priv = webView->priv; priv->disposing = TRUE; priv->backForwardList.clear(); if (priv->corePage) { webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object)); core(priv->mainFrame)->loader()->detachFromParent(); delete priv->corePage; priv->corePage = 0; } if (priv->webSettings) { g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView); priv->webSettings.clear(); } if (priv->currentMenu) { gtk_widget_destroy(GTK_WIDGET(priv->currentMenu)); priv->currentMenu = 0; } priv->webInspector.clear(); priv->viewportAttributes.clear(); priv->webWindowFeatures.clear(); priv->mainResource.clear(); priv->subResources.clear(); HashMap<GdkDragContext*, DroppingContext*>::iterator endDroppingContexts = priv->droppingContexts.end(); for (HashMap<GdkDragContext*, DroppingContext*>::iterator iter = priv->droppingContexts.begin(); iter != endDroppingContexts; ++iter) delete (iter->second); priv->droppingContexts.clear(); G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object); }
13,724
68,615
0
static gboolean purple_transfer_request_cb(gpointer data, gint fd, b_input_condition cond) { file_transfer_t *ft = data; struct prpl_xfer_data *px = ft->data; px->timeout = 0; if (ft->write == NULL) { ft->write = prpl_xfer_write; imcb_file_recv_start(px->ic, ft); } ft->write_request(ft); return FALSE; }
13,725
20,974
0
int sys_vm86old(struct vm86_struct __user *v86, struct pt_regs *regs) { struct kernel_vm86_struct info; /* declare this _on top_, * this avoids wasting of stack space. * This remains on the stack until we * return to 32 bit user space. */ struct task_struct *tsk; int tmp, ret = -EPERM; tsk = current; if (tsk->thread.saved_sp0) goto out; tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs, offsetof(struct kernel_vm86_struct, vm86plus) - sizeof(info.regs)); ret = -EFAULT; if (tmp) goto out; memset(&info.vm86plus, 0, (int)&info.regs32 - (int)&info.vm86plus); info.regs32 = regs; tsk->thread.vm86_info = v86; do_sys_vm86(&info, tsk); ret = 0; /* we never return here */ out: return ret; }
13,726
30,638
0
static void irda_connect_response(struct irda_sock *self) { struct sk_buff *skb; IRDA_DEBUG(2, "%s()\n", __func__); skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, GFP_ATOMIC); if (skb == NULL) { IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n", __func__); return; } /* Reserve space for MUX_CONTROL and LAP header */ skb_reserve(skb, IRDA_MAX_HEADER); irttp_connect_response(self->tsap, self->max_sdu_size_rx, skb); }
13,727
31,530
0
rad_config(struct rad_handle *h, const char *path) { FILE *fp; char buf[MAXCONFLINE]; int linenum; int retval; if (path == NULL) path = PATH_RADIUS_CONF; if ((fp = fopen(path, "r")) == NULL) { generr(h, "Cannot open \"%s\": %s", path, strerror(errno)); return -1; } retval = 0; linenum = 0; while (fgets(buf, sizeof buf, fp) != NULL) { int len; char *fields[5]; int nfields; char msg[ERRSIZE]; char *type; char *host, *res; char *port_str; char *secret; char *timeout_str; char *maxtries_str; char *end; char *wanttype; unsigned long timeout; unsigned long maxtries; int port; int i; linenum++; len = strlen(buf); /* We know len > 0, else fgets would have returned NULL. */ if (buf[len - 1] != '\n' && !(buf[len - 2] != '\r' && buf[len - 1] != '\n')) { if (len == sizeof buf - 1) generr(h, "%s:%d: line too long", path, linenum); else generr(h, "%s:%d: missing newline", path, linenum); retval = -1; break; } buf[len - 1] = '\0'; /* Extract the fields from the line. */ nfields = split(buf, fields, 5, msg, sizeof msg); if (nfields == -1) { generr(h, "%s:%d: %s", path, linenum, msg); retval = -1; break; } if (nfields == 0) continue; /* * The first field should contain "auth" or "acct" for * authentication or accounting, respectively. But older * versions of the file didn't have that field. Default * it to "auth" for backward compatibility. */ if (strcmp(fields[0], "auth") != 0 && strcmp(fields[0], "acct") != 0) { if (nfields >= 5) { generr(h, "%s:%d: invalid service type", path, linenum); retval = -1; break; } nfields++; for (i = nfields; --i > 0; ) fields[i] = fields[i - 1]; fields[0] = "auth"; } if (nfields < 3) { generr(h, "%s:%d: missing shared secret", path, linenum); retval = -1; break; } type = fields[0]; host = fields[1]; secret = fields[2]; timeout_str = fields[3]; maxtries_str = fields[4]; /* Ignore the line if it is for the wrong service type. */ wanttype = h->type == RADIUS_AUTH ? "auth" : "acct"; if (strcmp(type, wanttype) != 0) continue; /* Parse and validate the fields. */ res = host; host = strsep(&res, ":"); port_str = strsep(&res, ":"); if (port_str != NULL) { port = strtoul(port_str, &end, 10); if (*end != '\0') { generr(h, "%s:%d: invalid port", path, linenum); retval = -1; break; } } else port = 0; if (timeout_str != NULL) { timeout = strtoul(timeout_str, &end, 10); if (*end != '\0') { generr(h, "%s:%d: invalid timeout", path, linenum); retval = -1; break; } } else timeout = TIMEOUT; if (maxtries_str != NULL) { maxtries = strtoul(maxtries_str, &end, 10); if (*end != '\0') { generr(h, "%s:%d: invalid maxtries", path, linenum); retval = -1; break; } } else maxtries = MAXTRIES; if (rad_add_server(h, host, port, secret, timeout, maxtries) == -1) { strcpy(msg, h->errmsg); generr(h, "%s:%d: %s", path, linenum, msg); retval = -1; break; } } /* Clear out the buffer to wipe a possible copy of a shared secret */ memset(buf, 0, sizeof buf); fclose(fp); return retval; }
13,728
182,594
1
static int i8042_start(struct serio *serio) { struct i8042_port *port = serio->port_data; port->exists = true; mb(); return 0; }
13,729
66,881
0
static int mmap_zero(struct file *file, struct vm_area_struct *vma) { #ifndef CONFIG_MMU return -ENOSYS; #endif if (vma->vm_flags & VM_SHARED) return shmem_zero_setup(vma); return 0; }
13,730
149,172
0
void LockScreenMediaControlsView::MediaControllerImageChanged( media_session::mojom::MediaSessionImageType type, const SkBitmap& bitmap) { if (hide_controls_timer_->IsRunning()) return; SkBitmap converted_bitmap; if (bitmap.colorType() == kN32_SkColorType) { converted_bitmap = bitmap; } else { SkImageInfo info = bitmap.info().makeColorType(kN32_SkColorType); if (converted_bitmap.tryAllocPixels(info)) { bitmap.readPixels(info, converted_bitmap.getPixels(), converted_bitmap.rowBytes(), 0, 0); } } switch (type) { case media_session::mojom::MediaSessionImageType::kArtwork: { base::Optional<gfx::ImageSkia> session_artwork = gfx::ImageSkia::CreateFrom1xBitmap(converted_bitmap); SetArtwork(session_artwork); break; } case media_session::mojom::MediaSessionImageType::kSourceIcon: { gfx::ImageSkia session_icon = gfx::ImageSkia::CreateFrom1xBitmap(converted_bitmap); if (session_icon.isNull()) { session_icon = gfx::CreateVectorIcon(message_center::kProductIcon, kIconSize, gfx::kChromeIconGrey); } header_row_->SetAppIcon(session_icon); } } }
13,731
4,278
0
PHP_FUNCTION(highlight_string) { zval **expr; zend_syntax_highlighter_ini syntax_highlighter_ini; char *hicompiled_string_description; zend_bool i = 0; int old_error_reporting = EG(error_reporting); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|b", &expr, &i) == FAILURE) { RETURN_FALSE; } convert_to_string_ex(expr); if (i) { php_output_start_default(TSRMLS_C); } EG(error_reporting) = E_ERROR; php_get_highlight_struct(&syntax_highlighter_ini); hicompiled_string_description = zend_make_compiled_string_description("highlighted code" TSRMLS_CC); if (highlight_string(*expr, &syntax_highlighter_ini, hicompiled_string_description TSRMLS_CC) == FAILURE) { efree(hicompiled_string_description); EG(error_reporting) = old_error_reporting; if (i) { php_output_end(TSRMLS_C); } RETURN_FALSE; } efree(hicompiled_string_description); EG(error_reporting) = old_error_reporting; if (i) { php_output_get_contents(return_value TSRMLS_CC); php_output_discard(TSRMLS_C); } else { RETURN_TRUE; } }
13,732
134,160
0
InputMethodTSF::InputMethodTSF(internal::InputMethodDelegate* delegate, HWND toplevel_window_handle) : InputMethodWin(delegate, toplevel_window_handle), tsf_event_observer_(new TSFEventObserver()), tsf_event_router_(new TSFEventRouter(tsf_event_observer_.get())) { InputMethodWin::OnFocus(); }
13,733
303
0
static void cmyk_to_rgb(fz_context *ctx, const fz_colorspace *cs, const float *cmyk, float *rgb) { #ifdef SLOWCMYK /* from poppler */ float c = cmyk[0], m = cmyk[1], y = cmyk[2], k = cmyk[3]; float r, g, b, x; float cm = c * m; float c1m = m - cm; float cm1 = c - cm; float c1m1 = 1 - m - cm1; float c1m1y = c1m1 * y; float c1m1y1 = c1m1 - c1m1y; float c1my = c1m * y; float c1my1 = c1m - c1my; float cm1y = cm1 * y; float cm1y1 = cm1 - cm1y; float cmy = cm * y; float cmy1 = cm - cmy; /* this is a matrix multiplication, unrolled for performance */ x = c1m1y1 * k; /* 0 0 0 1 */ r = g = b = c1m1y1 - x; /* 0 0 0 0 */ r += 0.1373f * x; g += 0.1216f * x; b += 0.1255f * x; x = c1m1y * k; /* 0 0 1 1 */ r += 0.1098f * x; g += 0.1020f * x; x = c1m1y - x; /* 0 0 1 0 */ r += x; g += 0.9490f * x; x = c1my1 * k; /* 0 1 0 1 */ r += 0.1412f * x; x = c1my1 - x; /* 0 1 0 0 */ r += 0.9255f * x; b += 0.5490f * x; x = c1my * k; /* 0 1 1 1 */ r += 0.1333f * x; x = c1my - x; /* 0 1 1 0 */ r += 0.9294f * x; g += 0.1098f * x; b += 0.1412f * x; x = cm1y1 * k; /* 1 0 0 1 */ g += 0.0588f * x; b += 0.1412f * x; x = cm1y1 - x; /* 1 0 0 0 */ g += 0.6784f * x; b += 0.9373f * x; x = cm1y * k; /* 1 0 1 1 */ g += 0.0745f * x; x = cm1y - x; /* 1 0 1 0 */ g += 0.6510f * x; b += 0.3137f * x; x = cmy1 * k; /* 1 1 0 1 */ b += 0.0078f * x; x = cmy1 - x; /* 1 1 0 0 */ r += 0.1804f * x; g += 0.1922f * x; b += 0.5725f * x; x = cmy * (1-k); /* 1 1 1 0 */ r += 0.2118f * x; g += 0.2119f * x; b += 0.2235f * x; rgb[0] = fz_clamp(r, 0, 1); rgb[1] = fz_clamp(g, 0, 1); rgb[2] = fz_clamp(b, 0, 1); #else rgb[0] = 1 - fz_min(1, cmyk[0] + cmyk[3]); rgb[1] = 1 - fz_min(1, cmyk[1] + cmyk[3]); rgb[2] = 1 - fz_min(1, cmyk[2] + cmyk[3]); #endif }
13,734
149,366
0
void BinaryUploadService::Request::set_fcm_token(const std::string& token) { deep_scanning_request_.set_fcm_notification_token(token); }
13,735
38,242
0
static inline void *load_pointer(const struct sk_buff *skb, int k, unsigned int size, void *buffer) { if (k >= 0) return skb_header_pointer(skb, k, size, buffer); return bpf_internal_load_pointer_neg_helper(skb, k, size); }
13,736
136,894
0
const AtomicString& HTMLInputElement::FormControlType() const { return input_type_->FormControlType(); }
13,737
22,038
0
raptor_rss_end_element_handler(void *user_data, raptor_xml_element* xml_element) { raptor_parser* rdf_parser; raptor_rss_parser* rss_parser; #ifdef RAPTOR_DEBUG const unsigned char* name = raptor_xml_element_get_name(xml_element)->local_name; #endif raptor_rss_element* rss_element; size_t cdata_len = 0; unsigned char* cdata = NULL; rss_element = (raptor_rss_element*)xml_element->user_data; rdf_parser = (raptor_parser*)user_data; rss_parser = (raptor_rss_parser*)rdf_parser->context; if(rss_element->xml_writer) { if(rss_element->type != RAPTOR_RSS_CONTENT_TYPE_XML) { raptor_xml_writer_end_element(rss_element->xml_writer, xml_element); goto tidy_end_element; } /* otherwise we are done making XML */ raptor_free_iostream(rss_element->iostream); rss_element->iostream = NULL; cdata = (unsigned char*)rss_element->xml_content; cdata_len = rss_element->xml_content_length; } if(rss_element->sb) { cdata_len = raptor_stringbuffer_length(rss_element->sb); cdata = raptor_stringbuffer_as_string(rss_element->sb); } if(cdata) { raptor_uri* base_uri = NULL; base_uri = raptor_sax2_inscope_base_uri(rss_parser->sax2); if(rss_parser->current_block) { const raptor_rss_block_field_info *bfi; int handled = 0; /* in a block, maybe store the CDATA there */ for(bfi = &raptor_rss_block_fields_info[0]; bfi->type != RAPTOR_RSS_NONE; bfi++) { if(bfi->type != rss_parser->current_block->rss_type || bfi->attribute != NULL) continue; /* Set author name from element */ if(raptor_rss_block_set_field(rdf_parser->world, base_uri, rss_parser->current_block, bfi, (const char*)cdata)) { rdf_parser->failed = 1; return; } handled = 1; break; } #ifdef RAPTOR_DEBUG if(!handled) { raptor_rss_type block_type = rss_parser->current_block->rss_type; RAPTOR_DEBUG3("Ignoring cdata for block %d - %s\n", block_type, raptor_rss_items_info[block_type].name); } #endif rss_parser->current_block = NULL; goto do_end_element; } if(rss_parser->current_type == RAPTOR_RSS_NONE || (rss_parser->current_field == RAPTOR_RSS_FIELD_NONE || rss_parser->current_field == RAPTOR_RSS_FIELD_UNKNOWN)) { unsigned char *p = cdata; size_t i; for(i = cdata_len; i > 0 && *p; i--) { if(!isspace(*p)) break; p++; } if(i > 0 && *p) { RAPTOR_DEBUG4("IGNORING non-whitespace text '%s' inside type %s, field %s\n", cdata, raptor_rss_items_info[rss_parser->current_type].name, raptor_rss_fields_info[rss_parser->current_field].name); } goto do_end_element; } if(rss_parser->current_type >= RAPTOR_RSS_COMMON_IGNORED) { /* skipHours, skipDays common but IGNORED */ RAPTOR_DEBUG2("Ignoring fields for type %s\n", raptor_rss_items_info[rss_parser->current_type].name); } else { raptor_rss_item* update_item = raptor_rss_get_current_item(rss_parser); raptor_rss_field* field = raptor_rss_new_field(rdf_parser->world); /* if value is always an uri, make it so */ if(raptor_rss_fields_info[rss_parser->current_field].flags & RAPTOR_RSS_INFO_FLAG_URI_VALUE) { RAPTOR_DEBUG4("Added URI %s to field %s of type %s\n", cdata, raptor_rss_fields_info[rss_parser->current_field].name, raptor_rss_items_info[rss_parser->current_type].name); field->uri = raptor_new_uri_relative_to_base(rdf_parser->world, base_uri, cdata); } else { RAPTOR_DEBUG4("Added text '%s' to field %s of type %s\n", cdata, raptor_rss_fields_info[rss_parser->current_field].name, raptor_rss_items_info[rss_parser->current_type].name); field->uri = NULL; field->value = RAPTOR_MALLOC(unsigned char*, cdata_len + 1); if(!field->value) { rdf_parser->failed = 1; return; } memcpy(field->value, cdata, cdata_len); field->value[cdata_len] = '\0'; } RAPTOR_DEBUG1("fa3 - "); raptor_rss_item_add_field(update_item, rss_parser->current_field, field); } } /* end if contained cdata */ if(raptor_xml_element_is_empty(xml_element)) { /* Empty element, so consider adding one of the attributes as * literal or URI content */ if(rss_parser->current_type >= RAPTOR_RSS_COMMON_IGNORED) { /* skipHours, skipDays common but IGNORED */ RAPTOR_DEBUG3("Ignoring empty element %s for type %s\n", name, raptor_rss_items_info[rss_parser->current_type].name); } else if(rss_element->uri) { raptor_rss_item* update_item = raptor_rss_get_current_item(rss_parser); raptor_rss_field* field = raptor_rss_new_field(rdf_parser->world); if(rss_parser->current_field == RAPTOR_RSS_FIELD_UNKNOWN) { RAPTOR_DEBUG2("Cannot add URI from alternate attribute to type %s unknown field\n", raptor_rss_items_info[rss_parser->current_type].name); raptor_rss_field_free(field); } else { RAPTOR_DEBUG3("Added URI to field %s of type %s\n", raptor_rss_fields_info[rss_parser->current_field].name, raptor_rss_items_info[rss_parser->current_type].name); field->uri = rss_element->uri; rss_element->uri = NULL; RAPTOR_DEBUG1("fa2 - "); raptor_rss_item_add_field(update_item, rss_parser->current_field, field); } } } do_end_element: if(rss_parser->current_type != RAPTOR_RSS_NONE) { if(rss_parser->current_field != RAPTOR_RSS_FIELD_NONE) { RAPTOR_DEBUG3("Ending element %s field %s\n", name, raptor_rss_fields_info[rss_parser->current_field].name); rss_parser->current_field = RAPTOR_RSS_FIELD_NONE; } else { RAPTOR_DEBUG3("Ending element %s type %s\n", name, raptor_rss_items_info[rss_parser->current_type].name); if(rss_parser->prev_type != RAPTOR_RSS_NONE) { rss_parser->current_type = rss_parser->prev_type; rss_parser->prev_type = RAPTOR_RSS_NONE; RAPTOR_DEBUG3("Returning to type %d - %s\n", rss_parser->current_type, raptor_rss_items_info[rss_parser->current_type].name); } else rss_parser->current_type = RAPTOR_RSS_NONE; } } if(rss_parser->current_block) { #ifdef RAPTOR_DEBUG raptor_rss_type block_type = rss_parser->current_block->rss_type; RAPTOR_DEBUG3("Ending current block %d - %s\n", block_type, raptor_rss_items_info[block_type].name); #endif rss_parser->current_block = NULL; } tidy_end_element: if(rss_element) raptor_free_rss_element(rss_element); }
13,738
181,701
1
static int parse_report(transport_smart *transport, git_push *push) { git_pkt *pkt = NULL; const char *line_end = NULL; gitno_buffer *buf = &transport->buffer; int error, recvd; git_buf data_pkt_buf = GIT_BUF_INIT; for (;;) { if (buf->offset > 0) error = git_pkt_parse_line(&pkt, buf->data, &line_end, buf->offset); else error = GIT_EBUFS; if (error < 0 && error != GIT_EBUFS) { error = -1; goto done; } if (error == GIT_EBUFS) { if ((recvd = gitno_recv(buf)) < 0) { error = recvd; goto done; } if (recvd == 0) { giterr_set(GITERR_NET, "early EOF"); error = GIT_EEOF; goto done; } continue; } gitno_consume(buf, line_end); error = 0; if (pkt == NULL) continue; switch (pkt->type) { case GIT_PKT_DATA: /* This is a sideband packet which contains other packets */ error = add_push_report_sideband_pkt(push, (git_pkt_data *)pkt, &data_pkt_buf); break; case GIT_PKT_ERR: giterr_set(GITERR_NET, "report-status: Error reported: %s", ((git_pkt_err *)pkt)->error); error = -1; break; case GIT_PKT_PROGRESS: if (transport->progress_cb) { git_pkt_progress *p = (git_pkt_progress *) pkt; error = transport->progress_cb(p->data, p->len, transport->message_cb_payload); } break; default: error = add_push_report_pkt(push, pkt); break; } git_pkt_free(pkt); /* add_push_report_pkt returns GIT_ITEROVER when it receives a flush */ if (error == GIT_ITEROVER) { error = 0; if (data_pkt_buf.size > 0) { /* If there was data remaining in the pack data buffer, * then the server sent a partial pkt-line */ giterr_set(GITERR_NET, "Incomplete pack data pkt-line"); error = GIT_ERROR; } goto done; } if (error < 0) { goto done; } } done: git_buf_free(&data_pkt_buf); return error; }
13,739
180,636
1
sg_common_write(Sg_fd * sfp, Sg_request * srp, unsigned char *cmnd, int timeout, int blocking) { int k, at_head; Sg_device *sdp = sfp->parentdp; sg_io_hdr_t *hp = &srp->header; srp->data.cmd_opcode = cmnd[0]; /* hold opcode of command */ hp->status = 0; hp->masked_status = 0; hp->msg_status = 0; hp->info = 0; hp->host_status = 0; hp->driver_status = 0; hp->resid = 0; SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp, "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n", (int) cmnd[0], (int) hp->cmd_len)); k = sg_start_req(srp, cmnd); if (k) { SCSI_LOG_TIMEOUT(1, sg_printk(KERN_INFO, sfp->parentdp, "sg_common_write: start_req err=%d\n", k)); sg_finish_rem_req(srp); return k; /* probably out of space --> ENOMEM */ } if (atomic_read(&sdp->detaching)) { if (srp->bio) blk_end_request_all(srp->rq, -EIO); sg_finish_rem_req(srp); return -ENODEV; } hp->duration = jiffies_to_msecs(jiffies); if (hp->interface_id != '\0' && /* v3 (or later) interface */ (SG_FLAG_Q_AT_TAIL & hp->flags)) at_head = 0; else at_head = 1; srp->rq->timeout = timeout; kref_get(&sfp->f_ref); /* sg_rq_end_io() does kref_put(). */ blk_execute_rq_nowait(sdp->device->request_queue, sdp->disk, srp->rq, at_head, sg_rq_end_io); return 0; }
13,740
33,504
0
static void *shmem_follow_link(struct dentry *dentry, struct nameidata *nd) { struct page *page = NULL; int error = shmem_getpage(dentry->d_inode, 0, &page, SGP_READ, NULL); nd_set_link(nd, error ? ERR_PTR(error) : kmap(page)); if (page) unlock_page(page); return page; }
13,741
153,768
0
void* GLES2Implementation::MapBufferSubDataCHROMIUM(GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMapBufferSubDataCHROMIUM(" << target << ", " << offset << ", " << size << ", " << GLES2Util::GetStringEnum(access) << ")"); if (access != GL_WRITE_ONLY) { SetGLErrorInvalidEnum("glMapBufferSubDataCHROMIUM", access, "access"); return nullptr; } if (!ValidateSize("glMapBufferSubDataCHROMIUM", size) || !ValidateOffset("glMapBufferSubDataCHROMIUM", offset)) { return nullptr; } int32_t shm_id; unsigned int shm_offset; void* mem = mapped_memory_->Alloc(size, &shm_id, &shm_offset); if (!mem) { SetGLError(GL_OUT_OF_MEMORY, "glMapBufferSubDataCHROMIUM", "out of memory"); return nullptr; } std::pair<MappedBufferMap::iterator, bool> result = mapped_buffers_.insert( std::make_pair(mem, MappedBuffer(access, shm_id, mem, shm_offset, target, offset, size))); DCHECK(result.second); GPU_CLIENT_LOG(" returned " << mem); return mem; }
13,742
59,942
0
static int print_dev_info(struct device *dev, void *data) { struct snd_seq_device *sdev = to_seq_dev(dev); struct snd_info_buffer *buffer = data; snd_iprintf(buffer, "snd-%s,%s,%d\n", sdev->id, dev->driver ? "loaded" : "empty", dev->driver ? 1 : 0); return 0; }
13,743
150,266
0
InputEngineContext::InputEngineContext(const std::string& ime) : ime_spec(ime) { std::string id = GetIdFromImeSpec(ime_spec); if (rulebased::Engine::IsImeSupported(id)) { engine = std::make_unique<rulebased::Engine>(); engine->Activate(id); } }
13,744
138,947
0
CheckCustomizedWallpaperFilesExist() { downloaded_exists_ = base::PathExists(path_downloaded_); rescaled_small_exists_ = base::PathExists(path_rescaled_small_); rescaled_large_exists_ = base::PathExists(path_rescaled_large_); }
13,745
88,682
0
static int dwc3_gadget_set_xfer_resource(struct dwc3 *dwc, struct dwc3_ep *dep) { struct dwc3_gadget_ep_cmd_params params; memset(&params, 0x00, sizeof(params)); params.param0 = DWC3_DEPXFERCFG_NUM_XFER_RES(1); return dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_SETTRANSFRESOURCE, &params); }
13,746
29,408
0
static const char *mp_type(struct sb_uart_port *port) { const char *str = NULL; if (port->ops->type) str = port->ops->type(port); if (!str) str = "unknown"; return str; }
13,747
96,724
0
MagickExport MagickBooleanType GetImageEntropy(const Image *image, double *entropy,ExceptionInfo *exception) { ChannelStatistics *channel_statistics; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); channel_statistics=GetImageStatistics(image,exception); if (channel_statistics == (ChannelStatistics *) NULL) return(MagickFalse); *entropy=channel_statistics[CompositePixelChannel].entropy; channel_statistics=(ChannelStatistics *) RelinquishMagickMemory( channel_statistics); return(MagickTrue); }
13,748
65,678
0
opaque_hashval(const void *ptr, int nbytes) { unsigned char *cptr = (unsigned char *) ptr; u32 x = 0; while (nbytes--) { x *= 37; x += *cptr++; } return x; }
13,749
179,737
1
static int inet6_create(struct net *net, struct socket *sock, int protocol, int kern) { struct inet_sock *inet; struct ipv6_pinfo *np; struct sock *sk; struct inet_protosw *answer; struct proto *answer_prot; unsigned char answer_flags; int try_loading_module = 0; int err; /* Look for the requested type/protocol pair. */ lookup_protocol: err = -ESOCKTNOSUPPORT; rcu_read_lock(); list_for_each_entry_rcu(answer, &inetsw6[sock->type], list) { err = 0; /* Check the non-wild match. */ if (protocol == answer->protocol) { if (protocol != IPPROTO_IP) break; } else { /* Check for the two wild cases. */ if (IPPROTO_IP == protocol) { protocol = answer->protocol; break; } if (IPPROTO_IP == answer->protocol) break; } err = -EPROTONOSUPPORT; } if (err) { if (try_loading_module < 2) { rcu_read_unlock(); /* * Be more specific, e.g. net-pf-10-proto-132-type-1 * (net-pf-PF_INET6-proto-IPPROTO_SCTP-type-SOCK_STREAM) */ if (++try_loading_module == 1) request_module("net-pf-%d-proto-%d-type-%d", PF_INET6, protocol, sock->type); /* * Fall back to generic, e.g. net-pf-10-proto-132 * (net-pf-PF_INET6-proto-IPPROTO_SCTP) */ else request_module("net-pf-%d-proto-%d", PF_INET6, protocol); goto lookup_protocol; } else goto out_rcu_unlock; } err = -EPERM; if (sock->type == SOCK_RAW && !kern && !ns_capable(net->user_ns, CAP_NET_RAW)) goto out_rcu_unlock; sock->ops = answer->ops; answer_prot = answer->prot; answer_flags = answer->flags; rcu_read_unlock(); WARN_ON(!answer_prot->slab); err = -ENOBUFS; sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot, kern); if (!sk) goto out; sock_init_data(sock, sk); err = 0; if (INET_PROTOSW_REUSE & answer_flags) sk->sk_reuse = SK_CAN_REUSE; inet = inet_sk(sk); inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; if (SOCK_RAW == sock->type) { inet->inet_num = protocol; if (IPPROTO_RAW == protocol) inet->hdrincl = 1; } sk->sk_destruct = inet_sock_destruct; sk->sk_family = PF_INET6; sk->sk_protocol = protocol; sk->sk_backlog_rcv = answer->prot->backlog_rcv; inet_sk(sk)->pinet6 = np = inet6_sk_generic(sk); np->hop_limit = -1; np->mcast_hops = IPV6_DEFAULT_MCASTHOPS; np->mc_loop = 1; np->pmtudisc = IPV6_PMTUDISC_WANT; np->autoflowlabel = ip6_default_np_autolabel(sock_net(sk)); sk->sk_ipv6only = net->ipv6.sysctl.bindv6only; /* Init the ipv4 part of the socket since we can have sockets * using v6 API for ipv4. */ inet->uc_ttl = -1; inet->mc_loop = 1; inet->mc_ttl = 1; inet->mc_index = 0; inet->mc_list = NULL; inet->rcv_tos = 0; if (net->ipv4.sysctl_ip_no_pmtu_disc) inet->pmtudisc = IP_PMTUDISC_DONT; else inet->pmtudisc = IP_PMTUDISC_WANT; /* * Increment only the relevant sk_prot->socks debug field, this changes * the previous behaviour of incrementing both the equivalent to * answer->prot->socks (inet6_sock_nr) and inet_sock_nr. * * This allows better debug granularity as we'll know exactly how many * UDPv6, TCPv6, etc socks were allocated, not the sum of all IPv6 * transport protocol socks. -acme */ sk_refcnt_debug_inc(sk); if (inet->inet_num) { /* It assumes that any protocol which allows * the user to assign a number at socket * creation time automatically shares. */ inet->inet_sport = htons(inet->inet_num); sk->sk_prot->hash(sk); } if (sk->sk_prot->init) { err = sk->sk_prot->init(sk); if (err) { sk_common_release(sk); goto out; } } out: return err; out_rcu_unlock: rcu_read_unlock(); goto out; }
13,750
152,201
0
void RenderFrameImpl::BindNavigationClient( mojom::NavigationClientAssociatedRequest request) { navigation_client_impl_ = std::make_unique<NavigationClient>(this); navigation_client_impl_->Bind(std::move(request)); }
13,751
157,073
0
MockMultibufferDataSource( const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, scoped_refptr<UrlData> url_data, BufferedDataSourceHost* host) : MultibufferDataSource( task_runner, std::move(url_data), &media_log_, host, base::Bind(&MockMultibufferDataSource::set_downloading, base::Unretained(this))), downloading_(false) {}
13,752
4,360
0
PHP_METHOD(Phar, canCompress) { long method = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &method) == FAILURE) { return; } phar_request_initialize(TSRMLS_C); switch (method) { case PHAR_ENT_COMPRESSED_GZ: if (PHAR_G(has_zlib)) { RETURN_TRUE; } else { RETURN_FALSE; } case PHAR_ENT_COMPRESSED_BZ2: if (PHAR_G(has_bz2)) { RETURN_TRUE; } else { RETURN_FALSE; } default: if (PHAR_G(has_zlib) || PHAR_G(has_bz2)) { RETURN_TRUE; } else { RETURN_FALSE; } } }
13,753
100,628
0
void CSSStyleSheet::addSubresourceStyleURLs(ListHashSet<KURL>& urls) { Deque<CSSStyleSheet*> styleSheetQueue; styleSheetQueue.append(this); while (!styleSheetQueue.isEmpty()) { CSSStyleSheet* styleSheet = styleSheetQueue.takeFirst(); for (unsigned i = 0; i < styleSheet->length(); ++i) { StyleBase* styleBase = styleSheet->item(i); if (!styleBase->isRule()) continue; CSSRule* rule = static_cast<CSSRule*>(styleBase); if (rule->isImportRule()) { if (CSSStyleSheet* ruleStyleSheet = static_cast<CSSImportRule*>(rule)->styleSheet()) styleSheetQueue.append(ruleStyleSheet); } rule->addSubresourceStyleURLs(urls); } } }
13,754
33,660
0
pkinit_decode_dh_params(DH ** a, unsigned char **pp, unsigned int len) { ASN1_INTEGER ai, *aip = NULL; long length = (long) len; M_ASN1_D2I_vars(a, DH *, DH_new); M_ASN1_D2I_Init(); M_ASN1_D2I_start_sequence(); aip = &ai; ai.data = NULL; ai.length = 0; M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER); if (aip == NULL) return NULL; else { (*a)->p = ASN1_INTEGER_to_BN(aip, NULL); if ((*a)->p == NULL) return NULL; if (ai.data != NULL) { OPENSSL_free(ai.data); ai.data = NULL; ai.length = 0; } } M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER); if (aip == NULL) return NULL; else { (*a)->g = ASN1_INTEGER_to_BN(aip, NULL); if ((*a)->g == NULL) return NULL; if (ai.data != NULL) { OPENSSL_free(ai.data); ai.data = NULL; ai.length = 0; } } M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER); if (aip == NULL) return NULL; else { (*a)->q = ASN1_INTEGER_to_BN(aip, NULL); if ((*a)->q == NULL) return NULL; if (ai.data != NULL) { OPENSSL_free(ai.data); ai.data = NULL; ai.length = 0; } } M_ASN1_D2I_end_sequence(); M_ASN1_D2I_Finish(a, DH_free, 0); }
13,755
179,536
1
cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h, uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount) { const cdf_section_header_t *shp; cdf_section_header_t sh; const uint8_t *p, *q, *e; int16_t s16; int32_t s32; uint32_t u32; int64_t s64; uint64_t u64; cdf_timestamp_t tp; size_t i, o, o4, nelements, j; cdf_property_info_t *inp; if (offs > UINT32_MAX / 4) { errno = EFTYPE; goto out; } shp = CAST(const cdf_section_header_t *, (const void *) ((const char *)sst->sst_tab + offs)); if (cdf_check_stream_offset(sst, h, shp, sizeof(*shp), __LINE__) == -1) goto out; sh.sh_len = CDF_TOLE4(shp->sh_len); #define CDF_SHLEN_LIMIT (UINT32_MAX / 8) if (sh.sh_len > CDF_SHLEN_LIMIT) { errno = EFTYPE; goto out; } sh.sh_properties = CDF_TOLE4(shp->sh_properties); #define CDF_PROP_LIMIT (UINT32_MAX / (4 * sizeof(*inp))) if (sh.sh_properties > CDF_PROP_LIMIT) goto out; DPRINTF(("section len: %u properties %u\n", sh.sh_len, sh.sh_properties)); if (*maxcount) { if (*maxcount > CDF_PROP_LIMIT) goto out; *maxcount += sh.sh_properties; inp = CAST(cdf_property_info_t *, realloc(*info, *maxcount * sizeof(*inp))); } else { *maxcount = sh.sh_properties; inp = CAST(cdf_property_info_t *, malloc(*maxcount * sizeof(*inp))); } if (inp == NULL) goto out; *info = inp; inp += *count; *count += sh.sh_properties; p = CAST(const uint8_t *, (const void *) ((const char *)(const void *)sst->sst_tab + offs + sizeof(sh))); e = CAST(const uint8_t *, (const void *) (((const char *)(const void *)shp) + sh.sh_len)); if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1) goto out; for (i = 0; i < sh.sh_properties; i++) { size_t ofs = CDF_GETUINT32(p, (i << 1) + 1); q = (const uint8_t *)(const void *) ((const char *)(const void *)p + ofs - 2 * sizeof(uint32_t)); if (q > e) { DPRINTF(("Ran of the end %p > %p\n", q, e)); goto out; } inp[i].pi_id = CDF_GETUINT32(p, i << 1); inp[i].pi_type = CDF_GETUINT32(q, 0); DPRINTF(("%" SIZE_T_FORMAT "u) id=%x type=%x offs=0x%tx,0x%x\n", i, inp[i].pi_id, inp[i].pi_type, q - p, offs)); if (inp[i].pi_type & CDF_VECTOR) { nelements = CDF_GETUINT32(q, 1); if (nelements == 0) { DPRINTF(("CDF_VECTOR with nelements == 0\n")); goto out; } o = 2; } else { nelements = 1; o = 1; } o4 = o * sizeof(uint32_t); if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED)) goto unknown; switch (inp[i].pi_type & CDF_TYPEMASK) { case CDF_NULL: case CDF_EMPTY: break; case CDF_SIGNED16: if (inp[i].pi_type & CDF_VECTOR) goto unknown; (void)memcpy(&s16, &q[o4], sizeof(s16)); inp[i].pi_s16 = CDF_TOLE2(s16); break; case CDF_SIGNED32: if (inp[i].pi_type & CDF_VECTOR) goto unknown; (void)memcpy(&s32, &q[o4], sizeof(s32)); inp[i].pi_s32 = CDF_TOLE4((uint32_t)s32); break; case CDF_BOOL: case CDF_UNSIGNED32: if (inp[i].pi_type & CDF_VECTOR) goto unknown; (void)memcpy(&u32, &q[o4], sizeof(u32)); inp[i].pi_u32 = CDF_TOLE4(u32); break; case CDF_SIGNED64: if (inp[i].pi_type & CDF_VECTOR) goto unknown; (void)memcpy(&s64, &q[o4], sizeof(s64)); inp[i].pi_s64 = CDF_TOLE8((uint64_t)s64); break; case CDF_UNSIGNED64: if (inp[i].pi_type & CDF_VECTOR) goto unknown; (void)memcpy(&u64, &q[o4], sizeof(u64)); inp[i].pi_u64 = CDF_TOLE8((uint64_t)u64); break; case CDF_FLOAT: if (inp[i].pi_type & CDF_VECTOR) goto unknown; (void)memcpy(&u32, &q[o4], sizeof(u32)); u32 = CDF_TOLE4(u32); memcpy(&inp[i].pi_f, &u32, sizeof(inp[i].pi_f)); break; case CDF_DOUBLE: if (inp[i].pi_type & CDF_VECTOR) goto unknown; (void)memcpy(&u64, &q[o4], sizeof(u64)); u64 = CDF_TOLE8((uint64_t)u64); memcpy(&inp[i].pi_d, &u64, sizeof(inp[i].pi_d)); break; case CDF_LENGTH32_STRING: case CDF_LENGTH32_WSTRING: if (nelements > 1) { size_t nelem = inp - *info; if (*maxcount > CDF_PROP_LIMIT || nelements > CDF_PROP_LIMIT) goto out; *maxcount += nelements; inp = CAST(cdf_property_info_t *, realloc(*info, *maxcount * sizeof(*inp))); if (inp == NULL) goto out; *info = inp; inp = *info + nelem; } DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n", nelements)); for (j = 0; j < nelements && i < sh.sh_properties; j++, i++) { uint32_t l = CDF_GETUINT32(q, o); inp[i].pi_str.s_len = l; inp[i].pi_str.s_buf = (const char *) (const void *)(&q[o4 + sizeof(l)]); DPRINTF(("l = %d, r = %" SIZE_T_FORMAT "u, s = %s\n", l, CDF_ROUND(l, sizeof(l)), inp[i].pi_str.s_buf)); if (l & 1) l++; o += l >> 1; if (q + o >= e) goto out; o4 = o * sizeof(uint32_t); } i--; break; case CDF_FILETIME: if (inp[i].pi_type & CDF_VECTOR) goto unknown; (void)memcpy(&tp, &q[o4], sizeof(tp)); inp[i].pi_tp = CDF_TOLE8((uint64_t)tp); break; case CDF_CLIPBOARD: if (inp[i].pi_type & CDF_VECTOR) goto unknown; break; default: unknown: DPRINTF(("Don't know how to deal with %x\n", inp[i].pi_type)); break; } } return 0; out: free(*info); return -1; }
13,756
91,707
0
char *am_get_assertion_consumer_service_by_binding(LassoProvider *provider, const char *binding) { GList *descriptors; char *url; char *selected_descriptor; char *descriptor; char **tokens; guint n_tokens; GList *i; char *endptr; long descriptor_index, min_index; url = NULL; selected_descriptor = NULL; min_index = LONG_MAX; /* The descriptor list is unordered */ descriptors = lasso_provider_get_metadata_keys_for_role(provider, LASSO_PROVIDER_ROLE_SP); for (i = g_list_first(descriptors), tokens=NULL; i; i = g_list_next(i), g_strfreev(tokens)) { descriptor = i->data; descriptor_index = LONG_MAX; /* * Split the descriptor into tokens, only consider descriptors * which have at least 3 tokens and whose first token is * AssertionConsumerService */ tokens = g_strsplit(descriptor, " ", 0); n_tokens = g_strv_length(tokens); if (n_tokens < 3) continue; if (!g_str_equal(tokens[0], "AssertionConsumerService")) continue; if (!g_str_equal(tokens[1], binding)) continue; descriptor_index = strtol(tokens[2], &endptr, 10); if (tokens[2] == endptr) continue; /* could not parse int */ if (descriptor_index < min_index) { selected_descriptor = descriptor; min_index = descriptor_index; } } if (selected_descriptor) { url = lasso_provider_get_metadata_one_for_role(provider, LASSO_PROVIDER_ROLE_SP, selected_descriptor); } lasso_release_list_of_strings(descriptors); return url; }
13,757
124,262
0
PermissionsRequestFunction::PermissionsRequestFunction() {}
13,758
59,161
0
static void reg_combine_min_max(struct bpf_reg_state *true_src, struct bpf_reg_state *true_dst, struct bpf_reg_state *false_src, struct bpf_reg_state *false_dst, u8 opcode) { switch (opcode) { case BPF_JEQ: __reg_combine_min_max(true_src, true_dst); break; case BPF_JNE: __reg_combine_min_max(false_src, false_dst); break; } }
13,759
161,817
0
void PlatformSensorProviderWin::CreateSensorThread() { if (!sensor_thread_) sensor_thread_ = std::make_unique<SensorThread>(); }
13,760
79,580
0
int imap_buffy_check(int check_stats) { struct ImapData *idata = NULL; struct ImapData *lastdata = NULL; struct Buffy *mailbox = NULL; char name[LONG_STRING]; char command[LONG_STRING]; char munged[LONG_STRING]; int buffies = 0; for (mailbox = Incoming; mailbox; mailbox = mailbox->next) { /* Init newly-added mailboxes */ if (!mailbox->magic) { if (mx_is_imap(mailbox->path)) mailbox->magic = MUTT_IMAP; } if (mailbox->magic != MUTT_IMAP) continue; if (get_mailbox(mailbox->path, &idata, name, sizeof(name)) < 0) { mailbox->new = false; continue; } /* Don't issue STATUS on the selected mailbox, it will be NOOPed or * IDLEd elsewhere. * idata->mailbox may be NULL for connections other than the current * mailbox's, and shouldn't expand to INBOX in that case. #3216. */ if (idata->mailbox && (imap_mxcmp(name, idata->mailbox) == 0)) { mailbox->new = false; continue; } if (!mutt_bit_isset(idata->capabilities, IMAP4REV1) && !mutt_bit_isset(idata->capabilities, STATUS)) { mutt_debug(2, "Server doesn't support STATUS\n"); continue; } if (lastdata && idata != lastdata) { /* Send commands to previous server. Sorting the buffy list * may prevent some infelicitous interleavings */ if (imap_exec(lastdata, NULL, IMAP_CMD_FAIL_OK | IMAP_CMD_POLL) == -1) mutt_debug(1, "#1 Error polling mailboxes\n"); lastdata = NULL; } if (!lastdata) lastdata = idata; imap_munge_mbox_name(idata, munged, sizeof(munged), name); if (check_stats) { snprintf(command, sizeof(command), "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", munged); } else { snprintf(command, sizeof(command), "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", munged); } if (imap_exec(idata, command, IMAP_CMD_QUEUE | IMAP_CMD_POLL) < 0) { mutt_debug(1, "Error queueing command\n"); return 0; } } if (lastdata && (imap_exec(lastdata, NULL, IMAP_CMD_FAIL_OK | IMAP_CMD_POLL) == -1)) { mutt_debug(1, "#2 Error polling mailboxes\n"); return 0; } /* collect results */ for (mailbox = Incoming; mailbox; mailbox = mailbox->next) { if (mailbox->magic == MUTT_IMAP && mailbox->new) buffies++; } return buffies; }
13,761
17,065
0
void OxideQQuickWebView::addMessageHandler( OxideQQuickScriptMessageHandler* handler) { Q_D(OxideQQuickWebView); if (!handler) { qWarning() << "OxideQQuickWebView::addMessageHandler: NULL handler"; return; } OxideQQuickScriptMessageHandlerPrivate* hd = OxideQQuickScriptMessageHandlerPrivate::get(handler); if (hd->isActive() && handler->parent() != this) { qWarning() << "OxideQQuickWebView::addMessageHandler: handler can't be added to " "more than one message target"; return; } if (d->messageHandlers().contains(handler)) { d->messageHandlers().removeOne(handler); } handler->setParent(this); d->messageHandlers().append(handler); emit messageHandlersChanged(); }
13,762
9,668
0
PHP_FUNCTION(get_headers) { char *url; int url_len; php_stream_context *context; php_stream *stream; zval **prev_val, **hdr = NULL, **h; HashPosition pos; HashTable *hashT; long format = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) { return; } context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc(TSRMLS_C)); if (!(stream = php_stream_open_wrapper_ex(url, "r", REPORT_ERRORS | STREAM_USE_URL | STREAM_ONLY_GET_HEADERS, NULL, context))) { RETURN_FALSE; } if (!stream->wrapperdata || Z_TYPE_P(stream->wrapperdata) != IS_ARRAY) { php_stream_close(stream); RETURN_FALSE; } array_init(return_value); /* check for curl-wrappers that provide headers via a special "headers" element */ if (zend_hash_find(HASH_OF(stream->wrapperdata), "headers", sizeof("headers"), (void **)&h) != FAILURE && Z_TYPE_PP(h) == IS_ARRAY) { /* curl-wrappers don't load data until the 1st read */ if (!Z_ARRVAL_PP(h)->nNumOfElements) { php_stream_getc(stream); } zend_hash_find(HASH_OF(stream->wrapperdata), "headers", sizeof("headers"), (void **)&h); hashT = Z_ARRVAL_PP(h); } else { hashT = HASH_OF(stream->wrapperdata); } zend_hash_internal_pointer_reset_ex(hashT, &pos); while (zend_hash_get_current_data_ex(hashT, (void**)&hdr, &pos) != FAILURE) { if (!hdr || Z_TYPE_PP(hdr) != IS_STRING) { zend_hash_move_forward_ex(hashT, &pos); continue; } if (!format) { no_name_header: add_next_index_stringl(return_value, Z_STRVAL_PP(hdr), Z_STRLEN_PP(hdr), 1); } else { char c; char *s, *p; if ((p = strchr(Z_STRVAL_PP(hdr), ':'))) { c = *p; *p = '\0'; s = p + 1; while (isspace((int)*(unsigned char *)s)) { s++; } if (zend_hash_find(HASH_OF(return_value), Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), (void **) &prev_val) == FAILURE) { add_assoc_stringl_ex(return_value, Z_STRVAL_PP(hdr), (p - Z_STRVAL_PP(hdr) + 1), s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); } else { /* some headers may occur more then once, therefor we need to remake the string into an array */ convert_to_array(*prev_val); add_next_index_stringl(*prev_val, s, (Z_STRLEN_PP(hdr) - (s - Z_STRVAL_PP(hdr))), 1); } *p = c; } else { goto no_name_header; } } zend_hash_move_forward_ex(hashT, &pos); } php_stream_close(stream); }
13,763
27,424
0
ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) { struct ip6_tnl *t = netdev_priv(dev); struct net_device_stats *stats = &t->dev->stats; int ret; switch (skb->protocol) { case htons(ETH_P_IP): ret = ip4ip6_tnl_xmit(skb, dev); break; case htons(ETH_P_IPV6): ret = ip6ip6_tnl_xmit(skb, dev); break; default: goto tx_err; } if (ret < 0) goto tx_err; return NETDEV_TX_OK; tx_err: stats->tx_errors++; stats->tx_dropped++; kfree_skb(skb); return NETDEV_TX_OK; }
13,764
72,517
0
static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages) { LIST_HEAD(pages); WARN_ON(!nr_pages); if (__rb_allocate_pages(nr_pages, &pages, cpu_buffer->cpu)) return -ENOMEM; /* * The ring buffer page list is a circular list that does not * start and end with a list head. All page list items point to * other pages. */ cpu_buffer->pages = pages.next; list_del(&pages); cpu_buffer->nr_pages = nr_pages; rb_check_pages(cpu_buffer); return 0; }
13,765
95,329
0
psf_default_seek (SF_PRIVATE *psf, int UNUSED (mode), sf_count_t samples_from_start) { sf_count_t position, retval ; if (! (psf->blockwidth && psf->dataoffset >= 0)) { psf->error = SFE_BAD_SEEK ; return PSF_SEEK_ERROR ; } ; if (! psf->sf.seekable) { psf->error = SFE_NOT_SEEKABLE ; return PSF_SEEK_ERROR ; } ; position = psf->dataoffset + psf->blockwidth * samples_from_start ; if ((retval = psf_fseek (psf, position, SEEK_SET)) != position) { psf->error = SFE_SEEK_FAILED ; return PSF_SEEK_ERROR ; } ; return samples_from_start ; } /* psf_default_seek */
13,766
188,214
1
OMX_ERRORTYPE SoftAMR::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { switch (index) { case OMX_IndexParamAudioAmr: { OMX_AUDIO_PARAM_AMRTYPE *amrParams = (OMX_AUDIO_PARAM_AMRTYPE *)params; if (amrParams->nPortIndex != 0) { return OMX_ErrorUndefined; } amrParams->nChannels = 1; amrParams->eAMRDTXMode = OMX_AUDIO_AMRDTXModeOff; amrParams->eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF; if (!isConfigured()) { amrParams->nBitRate = 0; amrParams->eAMRBandMode = OMX_AUDIO_AMRBandModeUnused; } else { amrParams->nBitRate = 0; amrParams->eAMRBandMode = mMode == MODE_NARROW ? OMX_AUDIO_AMRBandModeNB0 : OMX_AUDIO_AMRBandModeWB0; } return OMX_ErrorNone; } case OMX_IndexParamAudioPcm: { OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams = (OMX_AUDIO_PARAM_PCMMODETYPE *)params; if (pcmParams->nPortIndex != 1) { return OMX_ErrorUndefined; } pcmParams->nChannels = 1; pcmParams->eNumData = OMX_NumericalDataSigned; pcmParams->eEndian = OMX_EndianBig; pcmParams->bInterleaved = OMX_TRUE; pcmParams->nBitPerSample = 16; pcmParams->nSamplingRate = (mMode == MODE_NARROW) ? kSampleRateNB : kSampleRateWB; pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear; pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF; pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF; return OMX_ErrorNone; } default: return SimpleSoftOMXComponent::internalGetParameter(index, params); } }
13,767
92,012
0
int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags) { const bool preempt = flags & BLK_MQ_REQ_PREEMPT; while (true) { bool success = false; rcu_read_lock(); if (percpu_ref_tryget_live(&q->q_usage_counter)) { /* * The code that sets the PREEMPT_ONLY flag is * responsible for ensuring that that flag is globally * visible before the queue is unfrozen. */ if (preempt || !blk_queue_preempt_only(q)) { success = true; } else { percpu_ref_put(&q->q_usage_counter); } } rcu_read_unlock(); if (success) return 0; if (flags & BLK_MQ_REQ_NOWAIT) return -EBUSY; /* * read pair of barrier in blk_freeze_queue_start(), * we need to order reading __PERCPU_REF_DEAD flag of * .q_usage_counter and reading .mq_freeze_depth or * queue dying flag, otherwise the following wait may * never return if the two reads are reordered. */ smp_rmb(); wait_event(q->mq_freeze_wq, (atomic_read(&q->mq_freeze_depth) == 0 && (preempt || !blk_queue_preempt_only(q))) || blk_queue_dying(q)); if (blk_queue_dying(q)) return -ENODEV; } }
13,768
39,229
0
PHP_FUNCTION(imageflip) { zval *IM; long mode; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &IM, &mode) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); switch (mode) { case GD_FLIP_VERTICAL: gdImageFlipVertical(im); break; case GD_FLIP_HORINZONTAL: gdImageFlipHorizontal(im); break; case GD_FLIP_BOTH: gdImageFlipBoth(im); break; default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown flip mode"); RETURN_FALSE; } RETURN_TRUE; }
13,769
73,862
0
static pngquant_error rwpng_write_image_init(rwpng_png_image *mainprog_ptr, png_structpp png_ptr_p, png_infopp info_ptr_p, int fast_compression) { /* could also replace libpng warning-handler (final NULL), but no need: */ *png_ptr_p = png_create_write_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr, rwpng_error_handler, NULL); if (!(*png_ptr_p)) { return LIBPNG_INIT_ERROR; /* out of memory */ } *info_ptr_p = png_create_info_struct(*png_ptr_p); if (!(*info_ptr_p)) { png_destroy_write_struct(png_ptr_p, NULL); return LIBPNG_INIT_ERROR; /* out of memory */ } /* setjmp() must be called in every function that calls a PNG-writing * libpng function, unless an alternate error handler was installed-- * but compatible error handlers must either use longjmp() themselves * (as in this program) or exit immediately, so here we go: */ if (setjmp(mainprog_ptr->jmpbuf)) { png_destroy_write_struct(png_ptr_p, info_ptr_p); return LIBPNG_INIT_ERROR; /* libpng error (via longjmp()) */ } png_set_compression_level(*png_ptr_p, fast_compression ? Z_BEST_SPEED : Z_BEST_COMPRESSION); png_set_compression_mem_level(*png_ptr_p, fast_compression ? 9 : 5); // judging by optipng results, smaller mem makes libpng compress slightly better return SUCCESS; }
13,770
31,427
0
static inline int pfkey_init_proc(struct net *net) { return 0; }
13,771
18,252
0
static int ensure_iov_space(conn *c) { assert(c != NULL); if (c->iovused >= c->iovsize) { int i, iovnum; struct iovec *new_iov = (struct iovec *)realloc(c->iov, (c->iovsize * 2) * sizeof(struct iovec)); if (! new_iov) return -1; c->iov = new_iov; c->iovsize *= 2; /* Point all the msghdr structures at the new list. */ for (i = 0, iovnum = 0; i < c->msgused; i++) { c->msglist[i].msg_iov = &c->iov[iovnum]; iovnum += c->msglist[i].msg_iovlen; } } return 0; }
13,772
50,785
0
calculate_path_table_size(struct vdd *vdd) { int depth, size; struct path_table *pt; pt = vdd->pathtbl; size = 0; for (depth = 0; depth < vdd->max_depth; depth++) { struct isoent **ptbl; int i, cnt; if ((cnt = pt[depth].cnt) == 0) break; ptbl = pt[depth].sorted; for (i = 0; i < cnt; i++) { int len; if (ptbl[i]->identifier == NULL) len = 1; /* root directory */ else len = ptbl[i]->id_len; if (len & 0x01) len++; /* Padding Field */ size += 8 + len; } } vdd->path_table_size = size; vdd->path_table_block = ((size + PATH_TABLE_BLOCK_SIZE -1) / PATH_TABLE_BLOCK_SIZE) * (PATH_TABLE_BLOCK_SIZE / LOGICAL_BLOCK_SIZE); }
13,773
119,964
0
bool IsRelativeURL(const char* base, const url_parse::Parsed& base_parsed, const base::char16* fragment, int fragment_len, bool is_base_hierarchical, bool* is_relative, url_parse::Component* relative_component) { return DoIsRelativeURL<base::char16>( base, base_parsed, fragment, fragment_len, is_base_hierarchical, is_relative, relative_component); }
13,774
185,670
1
void FragmentPaintPropertyTreeBuilder::UpdateClipPathClip( bool spv1_compositing_specific_pass) { // In SPv1*, composited path-based clip-path applies to a mask paint chunk // instead of actual contents. We have to delay until mask clip node has been // created first so we can parent under it. bool is_spv1_composited = object_.HasLayer() && ToLayoutBoxModelObject(object_).Layer()->GetCompositedLayerMapping(); if (is_spv1_composited != spv1_compositing_specific_pass) return; if (NeedsPaintPropertyUpdate()) { if (!NeedsClipPathClip(object_)) { OnClearClip(properties_->ClearClipPathClip()); } else { ClipPaintPropertyNode::State state; state.local_transform_space = context_.current.transform; state.clip_rect = FloatRoundedRect(FloatRect(*fragment_data_.ClipPathBoundingBox())); state.clip_path = fragment_data_.ClipPathPath(); OnUpdateClip(properties_->UpdateClipPathClip(context_.current.clip, std::move(state))); } } if (properties_->ClipPathClip() && !spv1_compositing_specific_pass) { context_.current.clip = context_.absolute_position.clip = context_.fixed_position.clip = properties_->ClipPathClip(); } }
13,775
130,555
0
void drawRect(GraphicsContext& context, const TestDisplayItemClient& client, DisplayItem::Type type, const FloatRect& bounds) { if (DrawingRecorder::useCachedDrawingIfPossible(context, client, type)) return; DrawingRecorder drawingRecorder(context, client, type, bounds); IntRect rect(0, 0, 10, 10); context.drawRect(rect); }
13,776
43,032
0
static bool is_imm8(int value) { return value <= 127 && value >= -128; }
13,777
141,933
0
void AutofillPopupItemView::OnMouseEntered(const ui::MouseEvent& event) { AutofillPopupController* controller = popup_view_->controller(); if (controller) controller->SetSelectedLine(line_number_); }
13,778
133,390
0
ash::NewWindowDelegate* ShellDelegateImpl::CreateNewWindowDelegate() { return new NewWindowDelegateImpl; }
13,779
104,041
0
void GLES2DecoderImpl::DoRenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { if (!bound_renderbuffer_) { SetGLError(GL_INVALID_OPERATION, "glGetRenderbufferStorage: no renderbuffer bound"); return; } GLenum impl_format = internalformat; if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { switch (impl_format) { case GL_DEPTH_COMPONENT16: impl_format = GL_DEPTH_COMPONENT; break; case GL_RGBA4: case GL_RGB5_A1: impl_format = GL_RGBA; break; case GL_RGB565: impl_format = GL_RGB; break; } } CopyRealGLErrorsToWrapper(); glRenderbufferStorageEXT(target, impl_format, width, height); GLenum error = PeekGLError(); if (error == GL_NO_ERROR) { bound_renderbuffer_->SetInfo(0, internalformat, width, height); } }
13,780
41,488
0
static int dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; int err; lock_sock(sk); err = __dn_getsockopt(sock, level, optname, optval, optlen, 0); release_sock(sk); return err; }
13,781
36,752
0
spnego_gss_get_name_attribute(OM_uint32 *minor_status, gss_name_t name, gss_buffer_t attr, int *authenticated, int *complete, gss_buffer_t value, gss_buffer_t display_value, int *more) { OM_uint32 ret; ret = gss_get_name_attribute(minor_status, name, attr, authenticated, complete, value, display_value, more); return (ret); }
13,782
27,112
0
static int handle_NP_GetValue(rpc_connection_t *connection) { D(bug("handle_NP_GetValue\n")); int32_t variable; int error = rpc_method_get_args(connection, RPC_TYPE_INT32, &variable, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NP_GetValue() get args", error); return error; } NPError ret = NPERR_GENERIC_ERROR; int variable_type = rpc_type_of_NPPVariable(variable); switch (variable_type) { case RPC_TYPE_STRING: { char *str = NULL; ret = g_NP_GetValue(variable, (void *)&str); return rpc_method_send_reply(connection, RPC_TYPE_INT32, ret, RPC_TYPE_STRING, str, RPC_TYPE_INVALID); } case RPC_TYPE_INT32: { uint32_t n = 0; ret = g_NP_GetValue(variable, (void *)&n); return rpc_method_send_reply(connection, RPC_TYPE_INT32, ret, RPC_TYPE_INT32, n, RPC_TYPE_INVALID); } case RPC_TYPE_BOOLEAN: { NPBool b = FALSE; ret = g_NP_GetValue(variable, (void *)&b); return rpc_method_send_reply(connection, RPC_TYPE_INT32, ret, RPC_TYPE_BOOLEAN, b, RPC_TYPE_INVALID); } } npw_printf("ERROR: only basic types are supported in NP_GetValue()\n"); abort(); }
13,783
53,504
0
bid_keyword(const char *p, ssize_t len) { static const char *keys_c[] = { "content", "contents", "cksum", NULL }; static const char *keys_df[] = { "device", "flags", NULL }; static const char *keys_g[] = { "gid", "gname", NULL }; static const char *keys_il[] = { "ignore", "inode", "link", NULL }; static const char *keys_m[] = { "md5", "md5digest", "mode", NULL }; static const char *keys_no[] = { "nlink", "nochange", "optional", NULL }; static const char *keys_r[] = { "resdevice", "rmd160", "rmd160digest", NULL }; static const char *keys_s[] = { "sha1", "sha1digest", "sha256", "sha256digest", "sha384", "sha384digest", "sha512", "sha512digest", "size", NULL }; static const char *keys_t[] = { "tags", "time", "type", NULL }; static const char *keys_u[] = { "uid", "uname", NULL }; const char **keys; int i; switch (*p) { case 'c': keys = keys_c; break; case 'd': case 'f': keys = keys_df; break; case 'g': keys = keys_g; break; case 'i': case 'l': keys = keys_il; break; case 'm': keys = keys_m; break; case 'n': case 'o': keys = keys_no; break; case 'r': keys = keys_r; break; case 's': keys = keys_s; break; case 't': keys = keys_t; break; case 'u': keys = keys_u; break; default: return (0);/* Unknown key */ } for (i = 0; keys[i] != NULL; i++) { int l = bid_keycmp(p, keys[i], len); if (l > 0) return (l); } return (0);/* Unknown key */ }
13,784
111,607
0
void TestUnpin( const std::string& resource_id, const std::string& md5, base::PlatformFileError expected_error, int expected_cache_state, GDataRootDirectory::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; expected_cache_state_ = expected_cache_state; expected_sub_dir_type_ = expected_sub_dir_type; file_system_->Unpin(resource_id, md5, base::Bind(&GDataFileSystemTest::VerifyCacheFileState, base::Unretained(this))); RunAllPendingForIO(); }
13,785
59,823
0
struct usb_interface *usbhid_find_interface(int minor) { return usb_find_interface(&hid_driver, minor); }
13,786
15,901
0
bool TradQT_Manager::ImportSimpleXMP ( XMP_Uns32 id, SXMPMeta * xmp, XMP_StringPtr ns, XMP_StringPtr prop ) const { try { InfoMapCPos infoPos = this->parsedBoxes.find ( id ); if ( infoPos == this->parsedBoxes.end() ) return false; if ( infoPos->second.values.empty() ) return false; std::string xmpValue, tempValue; XMP_OptionBits flags; bool xmpExists = xmp->GetProperty ( ns, prop, &xmpValue, &flags ); if ( xmpExists && (! XMP_PropIsSimple ( flags )) ) { XMP_Throw ( "TradQT_Manager::ImportSimpleXMP - XMP property must be simple", kXMPErr_BadParam ); } bool convertOK; const ValueInfo & qtItem = infoPos->second.values[0]; // ! Use the first QT entry. if ( xmpExists ) { convertOK = ConvertToMacLang ( xmpValue, qtItem.macLang, &tempValue ); if ( ! convertOK ) return false; // throw? if ( tempValue == qtItem.macValue ) return false; // QT value matches back converted XMP value. } convertOK = ConvertFromMacLang ( qtItem.macValue, qtItem.macLang, &tempValue ); if ( ! convertOK ) return false; // throw? xmp->SetProperty ( ns, prop, tempValue.c_str() ); return true; } catch ( ... ) { return false; // Don't let one failure abort other imports. } } // TradQT_Manager::ImportSimpleXMP
13,787
48,072
0
static void nested_vmx_abort(struct kvm_vcpu *vcpu, u32 indicator) { /* TODO: not to reset guest simply here. */ kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); pr_debug_ratelimited("kvm: nested vmx abort, indicator %d\n", indicator); }
13,788
140,163
0
void GaiaCookieManagerService::AddAccountToCookie( const std::string& account_id, const std::string& source) { VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id; access_token_ = std::string(); AddAccountToCookieInternal(account_id, source); }
13,789
140,988
0
void Document::CloneDataFromDocument(const Document& other) { SetCompatibilityMode(other.GetCompatibilityMode()); SetEncodingData(other.encoding_data_); SetContextFeatures(other.GetContextFeatures()); SetSecurityOrigin(other.GetSecurityOrigin()->IsolatedCopy()); SetMimeType(other.contentType()); }
13,790
166,191
0
void MediaStreamManager::Aborted(MediaStreamType stream_type, int capture_session_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DVLOG(1) << "Aborted({stream_type = " << stream_type << "} " << "{capture_session_id = " << capture_session_id << "})"; StopDevice(stream_type, capture_session_id); }
13,791
101,512
0
void PrintWebViewHelper::OnInitiatePrintPreview() { DCHECK(is_preview_enabled_); WebFrame* frame; if (GetPrintFrame(&frame)) { print_preview_context_.InitWithFrame(frame); RequestPrintPreview(); } }
13,792
86,710
0
static int blk_mq_hctx_notify(void *data, unsigned long action, unsigned int cpu) { struct blk_mq_hw_ctx *hctx = data; if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) return blk_mq_hctx_cpu_offline(hctx, cpu); /* * In case of CPU online, tags may be reallocated * in blk_mq_map_swqueue() after mapping is updated. */ return NOTIFY_OK; }
13,793
89,570
0
SWFInput_stream_dtor(SWFInput input) { free(input->data); #if TRACK_ALLOCS ming_gc_remove_node(input->gcnode); #endif free(input); }
13,794
85,429
0
static void write_current_sum_page(struct f2fs_sb_info *sbi, int type, block_t blk_addr) { struct curseg_info *curseg = CURSEG_I(sbi, type); struct page *page = grab_meta_page(sbi, blk_addr); struct f2fs_summary_block *src = curseg->sum_blk; struct f2fs_summary_block *dst; dst = (struct f2fs_summary_block *)page_address(page); mutex_lock(&curseg->curseg_mutex); down_read(&curseg->journal_rwsem); memcpy(&dst->journal, curseg->journal, SUM_JOURNAL_SIZE); up_read(&curseg->journal_rwsem); memcpy(dst->entries, src->entries, SUM_ENTRY_SIZE); memcpy(&dst->footer, &src->footer, SUM_FOOTER_SIZE); mutex_unlock(&curseg->curseg_mutex); set_page_dirty(page); f2fs_put_page(page, 1); }
13,795
146,823
0
void Document::SendSensitiveInputVisibility() { if (sensitive_input_visibility_task_.IsActive()) return; sensitive_input_visibility_task_ = TaskRunnerHelper::Get(TaskType::kUnspecedLoading, this) ->PostCancellableTask( BLINK_FROM_HERE, WTF::Bind(&Document::SendSensitiveInputVisibilityInternal, WrapWeakPersistent(this))); }
13,796
133,432
0
bool SVGImage::hasRelativeWidth() const { if (!m_page) return false; LocalFrame* frame = m_page->mainFrame(); SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); if (!rootElement) return false; return rootElement->intrinsicWidth().isPercent(); }
13,797
181,563
1
static int atusb_get_and_show_revision(struct atusb *atusb) { struct usb_device *usb_dev = atusb->usb_dev; unsigned char buffer[3]; int ret; /* Get a couple of the ATMega Firmware values */ ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0), ATUSB_ID, ATUSB_REQ_FROM_DEV, 0, 0, buffer, 3, 1000); if (ret >= 0) { atusb->fw_ver_maj = buffer[0]; atusb->fw_ver_min = buffer[1]; atusb->fw_hw_type = buffer[2]; dev_info(&usb_dev->dev, "Firmware: major: %u, minor: %u, hardware type: %u\n", atusb->fw_ver_maj, atusb->fw_ver_min, atusb->fw_hw_type); } if (atusb->fw_ver_maj == 0 && atusb->fw_ver_min < 2) { dev_info(&usb_dev->dev, "Firmware version (%u.%u) predates our first public release.", atusb->fw_ver_maj, atusb->fw_ver_min); dev_info(&usb_dev->dev, "Please update to version 0.2 or newer"); } return ret; }
13,798
138,268
0
void AXObjectCacheImpl::listboxSelectedChildrenChanged( HTMLSelectElement* select) { postNotification(select, AXSelectedChildrenChanged); }
13,799