unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
22,064
0
raptor_turtle_writer_literal(raptor_turtle_writer* turtle_writer, raptor_namespace_stack *nstack, const unsigned char* s, const unsigned char* lang, raptor_uri* datatype) { /* DBL_MAX = 309 decimal digits */ #define INT_MAX_LEN 309 /* DBL_EPSILON = 52 digits */ #define FRAC_MAX_LEN 52 char* endptr = (char *)s; int written = 0; /* typed literal special cases */ if(datatype) { /* integer */ if(raptor_uri_equals(datatype, turtle_writer->xsd_integer_uri)) { /* FIXME. Work around that gcc < 4.5 cannot disable warn_unused_result */ long gcc_is_stupid = strtol((const char*)s, &endptr, 10); if(endptr != (char*)s && !*endptr) { raptor_iostream_string_write(s, turtle_writer->iostr); /* More gcc madness to 'use' the variable I didn't want */ written = 1 + 0 * (int)gcc_is_stupid; } else { raptor_log_error(turtle_writer->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Illegal value for xsd:integer literal."); } /* double, decimal */ } else if(raptor_uri_equals(datatype, turtle_writer->xsd_double_uri) || raptor_uri_equals(datatype, turtle_writer->xsd_decimal_uri)) { /* FIXME. Work around that gcc < 4.5 cannot disable warn_unused_result */ double gcc_is_doubly_stupid = strtod((const char*)s, &endptr); if(endptr != (char*)s && !*endptr) { raptor_iostream_string_write(s, turtle_writer->iostr); /* More gcc madness to 'use' the variable I didn't want */ written = 1 + 0 * (int)gcc_is_doubly_stupid; } else { raptor_log_error(turtle_writer->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Illegal value for xsd:double or xsd:decimal literal."); } /* boolean */ } else if(raptor_uri_equals(datatype, turtle_writer->xsd_boolean_uri)) { if(!strcmp((const char*)s, "0") || !strcmp((const char*)s, "false")) { raptor_iostream_string_write("false", turtle_writer->iostr); written = 1; } else if(!strcmp((const char*)s, "1") || !strcmp((const char*)s, "true")) { raptor_iostream_string_write("true", turtle_writer->iostr); written = 1; } else { raptor_log_error(turtle_writer->world, RAPTOR_LOG_LEVEL_ERROR, NULL, "Illegal value for xsd:boolean literal."); } } } if(written) return 0; if(raptor_turtle_writer_quoted_counted_string(turtle_writer, s, strlen((const char*)s))) return 1; /* typed literal, not a special case */ if(datatype) { raptor_qname* qname; raptor_iostream_string_write("^^", turtle_writer->iostr); qname = raptor_new_qname_from_namespace_uri(nstack, datatype, 10); if(qname) { raptor_turtle_writer_qname(turtle_writer, qname); raptor_free_qname(qname); } else raptor_turtle_writer_reference(turtle_writer, datatype); } else if(lang) { /* literal with language tag */ raptor_iostream_write_byte('@', turtle_writer->iostr); raptor_iostream_string_write(lang, turtle_writer->iostr); } return 0; }
6,500
152,370
0
RenderFrameImpl::GetURLLoaderFactory() { return GetLoaderFactoryBundle(); }
6,501
169,388
0
void SurfaceHitTestReadyNotifier::WaitForSurfaceReady( RenderWidgetHostViewBase* root_view) { viz::SurfaceId root_surface_id = root_view->GetCurrentSurfaceId(); while (!ContainsSurfaceId(root_surface_id)) { base::RunLoop run_loop; base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); run_loop.Run(); } }
6,502
44,276
0
static bool always_dump_vma(struct vm_area_struct *vma) { /* Any vsyscall mappings? */ if (vma == get_gate_vma(vma->vm_mm)) return true; /* * Assume that all vmas with a .name op should always be dumped. * If this changes, a new vm_ops field can easily be added. */ if (vma->vm_ops && vma->vm_ops->name && vma->vm_ops->name(vma)) return true; /* * arch_vma_name() returns non-NULL for special architecture mappings, * such as vDSO sections. */ if (arch_vma_name(vma)) return true; return false; }
6,503
110,648
0
bool GLES2DecoderImpl::ValidateCompressedTexSubDimensions( const char* function_name, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, TextureManager::TextureInfo* texture) { if (xoffset < 0 || yoffset < 0) { SetGLError( GL_INVALID_VALUE, function_name, "xoffset or yoffset < 0"); return false; } switch (format) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: { const int kBlockWidth = 4; const int kBlockHeight = 4; if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) { SetGLError( GL_INVALID_OPERATION, function_name, "xoffset or yoffset not multiple of 4"); return false; } GLsizei tex_width = 0; GLsizei tex_height = 0; if (!texture->GetLevelSize(target, level, &tex_width, &tex_height) || width - xoffset > tex_width || height - yoffset > tex_height) { SetGLError( GL_INVALID_OPERATION, function_name, "dimensions out of range"); return false; } return ValidateCompressedTexDimensions( function_name, level, width, height, format); } default: return false; } }
6,504
58,832
0
struct page *read_cache_page_async(struct address_space *mapping, pgoff_t index, int (*filler)(void *,struct page*), void *data) { struct page *page; int err; retry: page = __read_cache_page(mapping, index, filler, data); if (IS_ERR(page)) return page; if (PageUptodate(page)) goto out; lock_page(page); if (!page->mapping) { unlock_page(page); page_cache_release(page); goto retry; } if (PageUptodate(page)) { unlock_page(page); goto out; } err = filler(data, page); if (err < 0) { page_cache_release(page); return ERR_PTR(err); } out: mark_page_accessed(page); return page; }
6,505
104,961
0
void GraphicsContext::drawRect(const IntRect& rect) { if (paintingDisabled()) return; m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle()))); m_data->context->DrawRectangle(rect.x(), rect.y(), rect.width(), rect.height()); }
6,506
161,694
0
void VaapiVideoDecodeAccelerator::ReturnCurrInputBuffer_Locked() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); lock_.AssertAcquired(); DCHECK(curr_input_buffer_.get()); curr_input_buffer_.reset(); TRACE_COUNTER1("Video Decoder", "Input buffers", input_buffers_.size()); }
6,507
161,739
0
PlatformSensorAccelerometerMac::GetDefaultConfiguration() { return PlatformSensorConfiguration( SensorTraits<SensorType::ACCELEROMETER>::kDefaultFrequency); }
6,508
120,618
0
void Element::scrollByPages(int pages) { scrollByUnits(pages, ScrollByPage); }
6,509
176,270
0
static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) { uint32_t length = static_cast<uint32_t>(GetString(holder)->length()); if (entry < length) { PropertyAttributes attributes = static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); return PropertyDetails(kData, attributes, 0, PropertyCellType::kNoCell); } return BackingStoreAccessor::GetDetailsImpl(holder, entry - length); }
6,510
156,647
0
blink::ParsedFeaturePolicy CreateFPHeaderMatchesAll( blink::mojom::FeaturePolicyFeature feature) { blink::ParsedFeaturePolicy result(1); result[0].feature = feature; result[0].matches_all_origins = true; return result; }
6,511
22,870
0
static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception) { struct nfs_client *clp = server->nfs_client; struct nfs4_state *state = exception->state; int ret = errorcode; exception->retry = 0; switch(errorcode) { case 0: return 0; case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: case -NFS4ERR_OPENMODE: if (state == NULL) break; nfs4_state_mark_reclaim_nograce(clp, state); case -NFS4ERR_STALE_CLIENTID: case -NFS4ERR_STALE_STATEID: case -NFS4ERR_EXPIRED: nfs4_schedule_state_recovery(clp); ret = nfs4_wait_clnt_recover(clp); if (ret == 0) exception->retry = 1; break; case -NFS4ERR_FILE_OPEN: case -NFS4ERR_GRACE: case -NFS4ERR_DELAY: ret = nfs4_delay(server->client, &exception->timeout); if (ret != 0) break; case -NFS4ERR_OLD_STATEID: exception->retry = 1; } /* We failed to handle the error */ return nfs4_map_errors(ret); }
6,512
109,992
0
HTMLSelectElement::HTMLSelectElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser) : HTMLFormControlElementWithState(tagName, document, form) , m_typeAhead(this) , m_size(0) , m_lastOnChangeIndex(-1) , m_activeSelectionAnchorIndex(-1) , m_activeSelectionEndIndex(-1) , m_isProcessingUserDrivenChange(false) , m_multiple(false) , m_activeSelectionState(false) , m_shouldRecalcListItems(false) , m_isParsingInProgress(createdByParser) { ASSERT(hasTagName(selectTag)); ScriptWrappable::init(this); }
6,513
70,156
0
static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSshort(int16 value) { if ((value<-0x80)||(value>0x7F)) return(TIFFReadDirEntryErrRange); else return(TIFFReadDirEntryErrOk); }
6,514
169,318
0
void SendRoutedGestureTapSequence(content::WebContents* web_contents, gfx::Point point) { RenderWidgetHostViewAura* rwhva = static_cast<RenderWidgetHostViewAura*>( web_contents->GetRenderWidgetHostView()); ui::GestureEventDetails gesture_tap_down_details(ui::ET_GESTURE_TAP_DOWN); gesture_tap_down_details.set_device_type( ui::GestureDeviceType::DEVICE_TOUCHSCREEN); ui::GestureEvent gesture_tap_down(point.x(), point.y(), 0, base::TimeTicks::Now(), gesture_tap_down_details); rwhva->OnGestureEvent(&gesture_tap_down); ui::GestureEventDetails gesture_tap_details(ui::ET_GESTURE_TAP); gesture_tap_details.set_device_type( ui::GestureDeviceType::DEVICE_TOUCHSCREEN); gesture_tap_details.set_tap_count(1); ui::GestureEvent gesture_tap(point.x(), point.y(), 0, base::TimeTicks::Now(), gesture_tap_details); rwhva->OnGestureEvent(&gesture_tap); }
6,515
4,570
0
static inline void php_openssl_rand_add_timeval() /* {{{ */ { struct timeval tv; gettimeofday(&tv, NULL); RAND_add(&tv, sizeof(tv), 0.0); } /* }}} */
6,516
99,555
0
BookmarkDrag::~BookmarkDrag() { }
6,517
129,173
0
void Framebuffer::OnTextureRefDetached(TextureRef* texture) { manager_->OnTextureRefDetached(texture); }
6,518
50,875
0
set_num_723(unsigned char *p, uint16_t value) { archive_le16enc(p, value); archive_be16enc(p+2, value); }
6,519
25,440
0
static ieee754sp fpemu_sp_rsqrt(ieee754sp s) { return ieee754sp_div(ieee754sp_one(0), ieee754sp_sqrt(s)); }
6,520
140,634
0
void OutOfProcessInstance::NotifyNumberOfFindResultsChanged(int total, bool final_result) { if (final_result) { NumberOfFindResultsChanged(total, final_result); SetTickmarks(tickmarks_); return; } if (recently_sent_find_update_) return; NumberOfFindResultsChanged(total, final_result); SetTickmarks(tickmarks_); recently_sent_find_update_ = true; pp::CompletionCallback callback = timer_factory_.NewCallback( &OutOfProcessInstance::ResetRecentlySentFindUpdate); pp::Module::Get()->core()->CallOnMainThread(kFindResultCooldownMs, callback, 0); }
6,521
1,407
0
XcursorFileSave (FILE * file, const XcursorComments *comments, const XcursorImages *images) { XcursorFile f; if (!file || !comments || !images) return XcursorFalse; _XcursorStdioFileInitialize (file, &f); return XcursorXcFileSave (&f, comments, images) && fflush (file) != EOF; }
6,522
10,846
0
int MacroExpander::expandEscapedMacro(const QString &str, int pos, QStringList &ret) { ushort option = str[pos+1].unicode(); switch (option) { case 'f': // Filepath case 'F': // case insensitive if (m_device.is<Solid::StorageAccess>()) { ret << m_device.as<Solid::StorageAccess>()->filePath(); } else { qWarning() << "DeviceServiceAction::execute: " << m_device.udi() << " is not a StorageAccess device"; } break; case 'd': // Device node case 'D': // case insensitive if (m_device.is<Solid::Block>()) { ret << m_device.as<Solid::Block>()->device(); } else { qWarning() << "DeviceServiceAction::execute: " << m_device.udi() << " is not a Block device"; } break; case 'i': // UDI case 'I': // case insensitive ret << m_device.udi(); break; case '%': ret = QStringList(QLatin1String("%")); break; default: return -2; // subst with same and skip } return 2; }
6,523
75,629
0
static int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd) { int bytecnt = wpmd->byte_length; char *byteptr = (char *)wpmd->data; if (bytecnt != 4) return FALSE; wps->float_flags = *byteptr++; wps->float_shift = *byteptr++; wps->float_max_exp = *byteptr++; wps->float_norm_exp = *byteptr; return TRUE; }
6,524
22,806
0
int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr) { int status; spin_lock(&inode->i_lock); /* Don't do a WCC update if these attributes are already stale */ if ((fattr->valid & NFS_ATTR_FATTR) == 0 || !nfs_inode_attrs_need_update(inode, fattr)) { fattr->valid &= ~(NFS_ATTR_WCC_V4|NFS_ATTR_WCC); goto out_noforce; } if ((fattr->valid & NFS_ATTR_FATTR_V4) != 0 && (fattr->valid & NFS_ATTR_WCC_V4) == 0) { fattr->pre_change_attr = NFS_I(inode)->change_attr; fattr->valid |= NFS_ATTR_WCC_V4; } if ((fattr->valid & NFS_ATTR_FATTR) != 0 && (fattr->valid & NFS_ATTR_WCC) == 0) { memcpy(&fattr->pre_ctime, &inode->i_ctime, sizeof(fattr->pre_ctime)); memcpy(&fattr->pre_mtime, &inode->i_mtime, sizeof(fattr->pre_mtime)); fattr->pre_size = i_size_read(inode); fattr->valid |= NFS_ATTR_WCC; } out_noforce: status = nfs_post_op_update_inode_locked(inode, fattr); spin_unlock(&inode->i_lock); return status; }
6,525
164,567
0
static int dbpageBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ int i; int iPlan = 0; /* If there is a schema= constraint, it must be honored. Report a ** ridiculously large estimated cost if the schema= constraint is ** unavailable */ for(i=0; i<pIdxInfo->nConstraint; i++){ struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[i]; if( p->iColumn!=DBPAGE_COLUMN_SCHEMA ) continue; if( p->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; if( !p->usable ){ /* No solution. */ return SQLITE_CONSTRAINT; } iPlan = 2; pIdxInfo->aConstraintUsage[i].argvIndex = 1; pIdxInfo->aConstraintUsage[i].omit = 1; break; } /* If we reach this point, it means that either there is no schema= ** constraint (in which case we use the "main" schema) or else the ** schema constraint was accepted. Lower the estimated cost accordingly */ pIdxInfo->estimatedCost = 1.0e6; /* Check for constraints against pgno */ for(i=0; i<pIdxInfo->nConstraint; i++){ struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[i]; if( p->usable && p->iColumn<=0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ pIdxInfo->estimatedRows = 1; pIdxInfo->idxFlags = SQLITE_INDEX_SCAN_UNIQUE; pIdxInfo->estimatedCost = 1.0; pIdxInfo->aConstraintUsage[i].argvIndex = iPlan ? 2 : 1; pIdxInfo->aConstraintUsage[i].omit = 1; iPlan |= 1; break; } } pIdxInfo->idxNum = iPlan; if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn<=0 && pIdxInfo->aOrderBy[0].desc==0 ){ pIdxInfo->orderByConsumed = 1; } return SQLITE_OK; }
6,526
114,580
0
std::string RenderThreadImpl::GetLocale() { const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); const std::string& lang = parsed_command_line.GetSwitchValueASCII(switches::kLang); DCHECK(!lang.empty() || (!parsed_command_line.HasSwitch(switches::kRendererProcess) && !parsed_command_line.HasSwitch(switches::kPluginProcess))); return lang; }
6,527
76,444
0
void mremap_userfaultfd_prep(struct vm_area_struct *vma, struct vm_userfaultfd_ctx *vm_ctx) { struct userfaultfd_ctx *ctx; ctx = vma->vm_userfaultfd_ctx.ctx; if (ctx && (ctx->features & UFFD_FEATURE_EVENT_REMAP)) { vm_ctx->ctx = ctx; userfaultfd_ctx_get(ctx); WRITE_ONCE(ctx->mmap_changing, true); } }
6,528
60,981
0
new_files_state_unref (NewFilesState *state) { state->count--; if (state->count == 0) { if (state->directory) { state->directory->details->new_files_in_progress = g_list_remove (state->directory->details->new_files_in_progress, state); } g_object_unref (state->cancellable); g_free (state); } }
6,529
87,013
0
static DetectTransaction GetDetectTx(const uint8_t ipproto, const AppProto alproto, void *alstate, const uint64_t tx_id, void *tx_ptr, const int tx_end_state, const uint8_t flow_flags) { const uint64_t detect_flags = AppLayerParserGetTxDetectFlags(ipproto, alproto, tx_ptr, flow_flags); if (detect_flags & APP_LAYER_TX_INSPECTED_FLAG) { SCLogDebug("%"PRIu64" tx already fully inspected for %s. Flags %016"PRIx64, tx_id, flow_flags & STREAM_TOSERVER ? "toserver" : "toclient", detect_flags); DetectTransaction no_tx = { NULL, 0, NULL, 0, 0, 0, 0, 0, }; return no_tx; } const int tx_progress = AppLayerParserGetStateProgress(ipproto, alproto, tx_ptr, flow_flags); const int dir_int = (flow_flags & STREAM_TOSERVER) ? 0 : 1; DetectEngineState *tx_de_state = AppLayerParserGetTxDetectState(ipproto, alproto, tx_ptr); DetectEngineStateDirection *tx_dir_state = tx_de_state ? &tx_de_state->dir_state[dir_int] : NULL; uint64_t prefilter_flags = detect_flags & APP_LAYER_TX_PREFILTER_MASK; DetectTransaction tx = { .tx_ptr = tx_ptr, .tx_id = tx_id, .de_state = tx_dir_state, .detect_flags = detect_flags, .prefilter_flags = prefilter_flags, .prefilter_flags_orig = prefilter_flags, .tx_progress = tx_progress, .tx_end_state = tx_end_state, }; return tx; }
6,530
118,663
0
UserCloudPolicyManagerFactoryChromeOS::GetForProfile( Profile* profile) { return GetInstance()->GetManagerForProfile(profile); }
6,531
10,509
0
iscsi_co_writev_flags(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *iov, int flags) { IscsiLun *iscsilun = bs->opaque; struct IscsiTask iTask; uint64_t lba; uint32_t num_sectors; bool fua = flags & BDRV_REQ_FUA; if (fua) { assert(iscsilun->dpofua); } if (!is_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { return -EINVAL; } if (bs->bl.max_transfer_length && nb_sectors > bs->bl.max_transfer_length) { error_report("iSCSI Error: Write of %d sectors exceeds max_xfer_len " "of %d sectors", nb_sectors, bs->bl.max_transfer_length); return -EINVAL; } lba = sector_qemu2lun(sector_num, iscsilun); num_sectors = sector_qemu2lun(nb_sectors, iscsilun); iscsi_co_init_iscsitask(iscsilun, &iTask); retry: if (iscsilun->use_16_for_rw) { iTask.task = iscsi_write16_task(iscsilun->iscsi, iscsilun->lun, lba, NULL, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, fua, 0, 0, iscsi_co_generic_cb, &iTask); } else { iTask.task = iscsi_write10_task(iscsilun->iscsi, iscsilun->lun, lba, NULL, num_sectors * iscsilun->block_size, iscsilun->block_size, 0, 0, fua, 0, 0, iscsi_co_generic_cb, &iTask); } if (iTask.task == NULL) { return -ENOMEM; } scsi_task_set_iov_out(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov); while (!iTask.complete) { iscsi_set_events(iscsilun); qemu_coroutine_yield(); } if (iTask.task != NULL) { scsi_free_scsi_task(iTask.task); iTask.task = NULL; } if (iTask.do_retry) { iTask.complete = 0; goto retry; } if (iTask.status != SCSI_STATUS_GOOD) { return iTask.err_code; } iscsi_allocationmap_set(iscsilun, sector_num, nb_sectors); return 0; }
6,532
91,425
0
static int check_xadd(struct bpf_verifier_env *env, int insn_idx, struct bpf_insn *insn) { int err; if ((BPF_SIZE(insn->code) != BPF_W && BPF_SIZE(insn->code) != BPF_DW) || insn->imm != 0) { verbose(env, "BPF_XADD uses reserved fields\n"); return -EINVAL; } /* check src1 operand */ err = check_reg_arg(env, insn->src_reg, SRC_OP); if (err) return err; /* check src2 operand */ err = check_reg_arg(env, insn->dst_reg, SRC_OP); if (err) return err; if (is_pointer_value(env, insn->src_reg)) { verbose(env, "R%d leaks addr into mem\n", insn->src_reg); return -EACCES; } if (is_ctx_reg(env, insn->dst_reg) || is_pkt_reg(env, insn->dst_reg) || is_flow_key_reg(env, insn->dst_reg)) { verbose(env, "BPF_XADD stores into R%d %s is not allowed\n", insn->dst_reg, reg_type_str[reg_state(env, insn->dst_reg)->type]); return -EACCES; } /* check whether atomic_add can read the memory */ err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off, BPF_SIZE(insn->code), BPF_READ, -1, true); if (err) return err; /* check whether atomic_add can write into the same memory */ return check_mem_access(env, insn_idx, insn->dst_reg, insn->off, BPF_SIZE(insn->code), BPF_WRITE, -1, true); }
6,533
149,061
0
static void checkListProperties(sqlite3 *db){ sqlite3 *p; for(p=sqlite3BlockedList; p; p=p->pNextBlocked){ int seen = 0; sqlite3 *p2; /* Verify property (1) */ assert( p->pUnlockConnection || p->pBlockingConnection ); /* Verify property (2) */ for(p2=sqlite3BlockedList; p2!=p; p2=p2->pNextBlocked){ if( p2->xUnlockNotify==p->xUnlockNotify ) seen = 1; assert( p2->xUnlockNotify==p->xUnlockNotify || !seen ); assert( db==0 || p->pUnlockConnection!=db ); assert( db==0 || p->pBlockingConnection!=db ); } } }
6,534
27,903
0
static size_t fuse_send_write_pages(struct fuse_req *req, struct file *file, struct inode *inode, loff_t pos, size_t count) { size_t res; unsigned offset; unsigned i; for (i = 0; i < req->num_pages; i++) fuse_wait_on_page_writeback(inode, req->pages[i]->index); res = fuse_send_write(req, file, pos, count, NULL); offset = req->page_offset; count = res; for (i = 0; i < req->num_pages; i++) { struct page *page = req->pages[i]; if (!req->out.h.error && !offset && count >= PAGE_CACHE_SIZE) SetPageUptodate(page); if (count > PAGE_CACHE_SIZE - offset) count -= PAGE_CACHE_SIZE - offset; else count = 0; offset = 0; unlock_page(page); page_cache_release(page); } return res; }
6,535
175,484
0
static int out_get_next_write_timestamp(const struct audio_stream_out *stream, int64_t *timestamp) { (void)stream; (void)timestamp; return -EINVAL; }
6,536
169,583
0
void CastStreamingNativeHandler::GetSupportedParamsCastRtpStream( const v8::FunctionCallbackInfo<v8::Value>& args) const { CHECK_EQ(1, args.Length()); CHECK(args[0]->IsInt32()); const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); CastRtpStream* transport = GetRtpStreamOrThrow(transport_id); if (!transport) return; scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); std::vector<CastRtpParams> cast_params = transport->GetSupportedParams(); v8::Local<v8::Array> result = v8::Array::New(args.GetIsolate(), static_cast<int>(cast_params.size())); for (size_t i = 0; i < cast_params.size(); ++i) { RtpParams params; FromCastRtpParams(cast_params[i], &params); scoped_ptr<base::DictionaryValue> params_value = params.ToValue(); result->Set( static_cast<int>(i), converter->ToV8Value(params_value.get(), context()->v8_context())); } args.GetReturnValue().Set(result); }
6,537
125,361
0
void GetDocumentResourceIdOnBlockingPool( const FilePath& local_file_path, std::string* resource_id) { DCHECK(resource_id); if (DocumentEntry::HasHostedDocumentExtension(local_file_path)) { std::string error; DictionaryValue* dict_value = NULL; JSONFileValueSerializer serializer(local_file_path); scoped_ptr<Value> value(serializer.Deserialize(NULL, &error)); if (value.get() && value->GetAsDictionary(&dict_value)) dict_value->GetString("resource_id", resource_id); } }
6,538
21,889
0
int drm_mode_create_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_create_dumb *args = data; if (!dev->driver->dumb_create) return -ENOSYS; return dev->driver->dumb_create(file_priv, dev, args); }
6,539
82,082
0
mrb_define_class_under(mrb_state *mrb, struct RClass *outer, const char *name, struct RClass *super) { mrb_sym id = mrb_intern_cstr(mrb, name); struct RClass * c; #if 0 if (!super) { mrb_warn(mrb, "no super class for '%S::%S', Object assumed", mrb_obj_value(outer), mrb_sym2str(mrb, id)); } #endif c = define_class(mrb, id, super, outer); setup_class(mrb, outer, c, id); return c; }
6,540
162,628
0
HeadlessDevToolsManagerDelegate::GetWindowBounds( content::DevToolsAgentHost* agent_host, int session_id, int command_id, const base::DictionaryValue* params) { HeadlessWebContentsImpl* web_contents; const base::Value* window_id_value = params->FindKey("windowId"); if (!window_id_value || !window_id_value->is_int()) return CreateInvalidParamResponse(command_id, "windowId"); web_contents = browser_->GetWebContentsForWindowId(window_id_value->GetInt()); if (!web_contents) { return CreateErrorResponse(command_id, kErrorServerError, "Browser window not found"); } auto result = std::make_unique<base::DictionaryValue>(); result->Set("bounds", CreateBoundsDict(web_contents)); return CreateSuccessResponse(command_id, std::move(result)); }
6,541
106,921
0
void RenderBox::removeFloatingOrPositionedChildFromBlockLists() { ASSERT(isFloatingOrPositioned()); if (documentBeingDestroyed()) return; if (isFloating()) { RenderBlock* parentBlock = 0; for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) { if (curr->isRenderBlock()) { RenderBlock* currBlock = toRenderBlock(curr); if (!parentBlock || currBlock->containsFloat(this)) parentBlock = currBlock; } } if (parentBlock) { RenderObject* parent = parentBlock->parent(); if (parent && parent->isDeprecatedFlexibleBox()) parentBlock = toRenderBlock(parent); parentBlock->markAllDescendantsWithFloatsForLayout(this, false); } } if (isPositioned()) { for (RenderObject* curr = parent(); curr; curr = curr->parent()) { if (curr->isRenderBlock()) toRenderBlock(curr)->removePositionedObject(this); } } }
6,542
108,969
0
void RenderViewImpl::OnSetActive(bool active) { if (webview()) webview()->setIsActive(active); #if defined(OS_MACOSX) std::set<WebPluginDelegateProxy*>::iterator plugin_it; for (plugin_it = plugin_delegates_.begin(); plugin_it != plugin_delegates_.end(); ++plugin_it) { (*plugin_it)->SetWindowFocus(active); } #endif }
6,543
83,397
0
DeleteRoute(PMIB_IPFORWARD_ROW2 fwd_row) { return DeleteIpForwardEntry2(fwd_row); }
6,544
37,316
0
static void vmx_vcpu_put(struct kvm_vcpu *vcpu) { __vmx_load_host_state(to_vmx(vcpu)); if (!vmm_exclusive) { __loaded_vmcs_clear(to_vmx(vcpu)->loaded_vmcs); vcpu->cpu = -1; kvm_cpu_vmxoff(); } }
6,545
173,834
0
OMX_ERRORTYPE omx_video::free_buffer(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_U32 port, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { (void)hComp; OMX_ERRORTYPE eRet = OMX_ErrorNone; unsigned int nPortIndex; DEBUG_PRINT_LOW("In for encoder free_buffer"); if (m_state == OMX_StateIdle && (BITMASK_PRESENT(&m_flags ,OMX_COMPONENT_LOADING_PENDING))) { DEBUG_PRINT_LOW(" free buffer while Component in Loading pending"); } else if ((m_sInPortDef.bEnabled == OMX_FALSE && port == PORT_INDEX_IN)|| (m_sOutPortDef.bEnabled == OMX_FALSE && port == PORT_INDEX_OUT)) { DEBUG_PRINT_LOW("Free Buffer while port %u disabled", (unsigned int)port); } else if (m_state == OMX_StateExecuting || m_state == OMX_StatePause) { DEBUG_PRINT_ERROR("ERROR: Invalid state to free buffer,ports need to be disabled"); post_event(OMX_EventError, OMX_ErrorPortUnpopulated, OMX_COMPONENT_GENERATE_EVENT); return eRet; } else { DEBUG_PRINT_ERROR("ERROR: Invalid state to free buffer,port lost Buffers"); post_event(OMX_EventError, OMX_ErrorPortUnpopulated, OMX_COMPONENT_GENERATE_EVENT); } if (port == PORT_INDEX_IN) { nPortIndex = buffer - ((!meta_mode_enable)?m_inp_mem_ptr:meta_buffer_hdr); DEBUG_PRINT_LOW("free_buffer on i/p port - Port idx %u, actual cnt %u", nPortIndex, (unsigned int)m_sInPortDef.nBufferCountActual); if (nPortIndex < m_sInPortDef.nBufferCountActual) { BITMASK_CLEAR(&m_inp_bm_count,nPortIndex); free_input_buffer (buffer); m_sInPortDef.bPopulated = OMX_FALSE; /*Free the Buffer Header*/ if (release_input_done() #ifdef _ANDROID_ICS_ && !meta_mode_enable #endif ) { input_use_buffer = false; if (m_inp_mem_ptr) { DEBUG_PRINT_LOW("Freeing m_inp_mem_ptr"); free (m_inp_mem_ptr); m_inp_mem_ptr = NULL; } if (m_pInput_pmem) { DEBUG_PRINT_LOW("Freeing m_pInput_pmem"); free(m_pInput_pmem); m_pInput_pmem = NULL; } #ifdef USE_ION if (m_pInput_ion) { DEBUG_PRINT_LOW("Freeing m_pInput_ion"); free(m_pInput_ion); m_pInput_ion = NULL; } #endif } } else { DEBUG_PRINT_ERROR("ERROR: free_buffer ,Port Index Invalid"); eRet = OMX_ErrorBadPortIndex; } if (BITMASK_PRESENT((&m_flags),OMX_COMPONENT_INPUT_DISABLE_PENDING) && release_input_done()) { DEBUG_PRINT_LOW("MOVING TO DISABLED STATE"); BITMASK_CLEAR((&m_flags),OMX_COMPONENT_INPUT_DISABLE_PENDING); post_event(OMX_CommandPortDisable, PORT_INDEX_IN, OMX_COMPONENT_GENERATE_EVENT); } } else if (port == PORT_INDEX_OUT) { nPortIndex = buffer - (OMX_BUFFERHEADERTYPE*)m_out_mem_ptr; DEBUG_PRINT_LOW("free_buffer on o/p port - Port idx %u, actual cnt %u", nPortIndex, (unsigned int)m_sOutPortDef.nBufferCountActual); if (nPortIndex < m_sOutPortDef.nBufferCountActual) { BITMASK_CLEAR(&m_out_bm_count,nPortIndex); m_sOutPortDef.bPopulated = OMX_FALSE; free_output_buffer (buffer); if (release_output_done()) { output_use_buffer = false; if (m_out_mem_ptr) { DEBUG_PRINT_LOW("Freeing m_out_mem_ptr"); free (m_out_mem_ptr); m_out_mem_ptr = NULL; } if (m_pOutput_pmem) { DEBUG_PRINT_LOW("Freeing m_pOutput_pmem"); free(m_pOutput_pmem); m_pOutput_pmem = NULL; } #ifdef USE_ION if (m_pOutput_ion) { DEBUG_PRINT_LOW("Freeing m_pOutput_ion"); free(m_pOutput_ion); m_pOutput_ion = NULL; } #endif } } else { DEBUG_PRINT_ERROR("ERROR: free_buffer , Port Index Invalid"); eRet = OMX_ErrorBadPortIndex; } if (BITMASK_PRESENT((&m_flags),OMX_COMPONENT_OUTPUT_DISABLE_PENDING) && release_output_done() ) { DEBUG_PRINT_LOW("FreeBuffer : If any Disable event pending,post it"); DEBUG_PRINT_LOW("MOVING TO DISABLED STATE"); BITMASK_CLEAR((&m_flags),OMX_COMPONENT_OUTPUT_DISABLE_PENDING); post_event(OMX_CommandPortDisable, PORT_INDEX_OUT, OMX_COMPONENT_GENERATE_EVENT); } } else { eRet = OMX_ErrorBadPortIndex; } if ((eRet == OMX_ErrorNone) && (BITMASK_PRESENT(&m_flags ,OMX_COMPONENT_LOADING_PENDING))) { if (release_done()) { if (dev_stop() != 0) { DEBUG_PRINT_ERROR("ERROR: dev_stop() FAILED"); eRet = OMX_ErrorHardware; } BITMASK_CLEAR((&m_flags),OMX_COMPONENT_LOADING_PENDING); post_event(OMX_CommandStateSet, OMX_StateLoaded, OMX_COMPONENT_GENERATE_EVENT); } else { DEBUG_PRINT_HIGH("in free buffer, release not done, need to free more buffers input %" PRIx64" output %" PRIx64, m_out_bm_count, m_inp_bm_count); } } return eRet; }
6,546
82,036
0
R_API ut64 r_anal_bb_opaddr_at(RAnalBlock *bb, ut64 off) { ut16 delta, delta_off, last_delta; int i; if (!r_anal_bb_is_in_offset (bb, off)) { return UT64_MAX; } last_delta = 0; delta_off = off - bb->addr; for (i = 0; i < bb->ninstr; i++) { delta = r_anal_bb_offset_inst (bb, i); if (delta > delta_off) { return bb->addr + last_delta; } last_delta = delta; } return UT64_MAX; }
6,547
138,452
0
void Document::setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener) { LocalDOMWindow* domWindow = this->domWindow(); if (!domWindow) return; domWindow->setAttributeEventListener(eventType, listener); }
6,548
151,013
0
void DefaultBindingsDelegate::OpenInNewTab(const std::string& url) { content::OpenURLParams params(GURL(url), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false); Browser* browser = FindBrowser(web_contents_); browser->OpenURL(params); }
6,549
4,557
0
static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req) { char * randfile = NULL; int egdsocket, seeded; EVP_PKEY * return_val = NULL; if (req->priv_key_bits < MIN_KEY_LENGTH) { php_error_docref(NULL, E_WARNING, "private key length is too short; it needs to be at least %d bits, not %d", MIN_KEY_LENGTH, req->priv_key_bits); return NULL; } randfile = CONF_get_string(req->req_config, req->section_name, "RANDFILE"); php_openssl_load_rand_file(randfile, &egdsocket, &seeded); if ((req->priv_key = EVP_PKEY_new()) != NULL) { switch(req->priv_key_type) { case OPENSSL_KEYTYPE_RSA: { RSA* rsaparam; #if OPENSSL_VERSION_NUMBER < 0x10002000L /* OpenSSL 1.0.2 deprecates RSA_generate_key */ PHP_OPENSSL_RAND_ADD_TIME(); rsaparam = (RSA*)RSA_generate_key(req->priv_key_bits, RSA_F4, NULL, NULL); #else { BIGNUM *bne = (BIGNUM *)BN_new(); if (BN_set_word(bne, RSA_F4) != 1) { BN_free(bne); php_error_docref(NULL, E_WARNING, "failed setting exponent"); return NULL; } rsaparam = RSA_new(); PHP_OPENSSL_RAND_ADD_TIME(); RSA_generate_key_ex(rsaparam, req->priv_key_bits, bne, NULL); BN_free(bne); } #endif if (rsaparam && EVP_PKEY_assign_RSA(req->priv_key, rsaparam)) { return_val = req->priv_key; } } break; #if !defined(NO_DSA) case OPENSSL_KEYTYPE_DSA: PHP_OPENSSL_RAND_ADD_TIME(); { DSA *dsaparam = DSA_new(); if (dsaparam && DSA_generate_parameters_ex(dsaparam, req->priv_key_bits, NULL, 0, NULL, NULL, NULL)) { DSA_set_method(dsaparam, DSA_get_default_method()); if (DSA_generate_key(dsaparam)) { if (EVP_PKEY_assign_DSA(req->priv_key, dsaparam)) { return_val = req->priv_key; } } else { DSA_free(dsaparam); } } } break; #endif #if !defined(NO_DH) case OPENSSL_KEYTYPE_DH: PHP_OPENSSL_RAND_ADD_TIME(); { int codes = 0; DH *dhparam = DH_new(); if (dhparam && DH_generate_parameters_ex(dhparam, req->priv_key_bits, 2, NULL)) { DH_set_method(dhparam, DH_get_default_method()); if (DH_check(dhparam, &codes) && codes == 0 && DH_generate_key(dhparam)) { if (EVP_PKEY_assign_DH(req->priv_key, dhparam)) { return_val = req->priv_key; } } else { DH_free(dhparam); } } } break; #endif default: php_error_docref(NULL, E_WARNING, "Unsupported private key type"); } } php_openssl_write_rand_file(randfile, egdsocket, seeded); if (return_val == NULL) { EVP_PKEY_free(req->priv_key); req->priv_key = NULL; return NULL; } return return_val; }
6,550
60,403
0
static int bnep_session(void *arg) { struct bnep_session *s = arg; struct net_device *dev = s->dev; struct sock *sk = s->sock->sk; struct sk_buff *skb; wait_queue_t wait; BT_DBG(""); set_user_nice(current, -15); init_waitqueue_entry(&wait, current); add_wait_queue(sk_sleep(sk), &wait); while (1) { set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(&s->terminate)) break; /* RX */ while ((skb = skb_dequeue(&sk->sk_receive_queue))) { skb_orphan(skb); if (!skb_linearize(skb)) bnep_rx_frame(s, skb); else kfree_skb(skb); } if (sk->sk_state != BT_CONNECTED) break; /* TX */ while ((skb = skb_dequeue(&sk->sk_write_queue))) if (bnep_tx_frame(s, skb)) break; netif_wake_queue(dev); schedule(); } __set_current_state(TASK_RUNNING); remove_wait_queue(sk_sleep(sk), &wait); /* Cleanup session */ down_write(&bnep_session_sem); /* Delete network device */ unregister_netdev(dev); /* Wakeup user-space polling for socket errors */ s->sock->sk->sk_err = EUNATCH; wake_up_interruptible(sk_sleep(s->sock->sk)); /* Release the socket */ fput(s->sock->file); __bnep_unlink_session(s); up_write(&bnep_session_sem); free_netdev(dev); module_put_and_exit(0); return 0; }
6,551
182,588
1
bool f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct extent_tree *et; struct extent_node *en; struct extent_info ei; if (!f2fs_may_extent_tree(inode)) { /* drop largest extent */ if (i_ext && i_ext->len) { i_ext->len = 0; return true; } return false; } et = __grab_extent_tree(inode); if (!i_ext || !i_ext->len) return false; get_extent_info(&ei, i_ext); write_lock(&et->lock); if (atomic_read(&et->node_cnt)) goto out; en = __init_extent_tree(sbi, et, &ei); if (en) { spin_lock(&sbi->extent_lock); list_add_tail(&en->list, &sbi->extent_list); spin_unlock(&sbi->extent_lock); } out: write_unlock(&et->lock); return false; }
6,552
157,204
0
void WebMediaPlayerImpl::ExitPictureInPicture( blink::WebMediaPlayer::PipWindowClosedCallback callback) { delegate_->DidPictureInPictureModeEnd(delegate_id_, std::move(callback)); OnPictureInPictureModeEnded(); }
6,553
138,830
0
MockRenderProcessHost* TestRenderViewHost::GetProcess() const { return static_cast<MockRenderProcessHost*>(RenderViewHostImpl::GetProcess()); }
6,554
187,647
1
image_transform_png_set_background_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) { png_byte colour_type, bit_depth; png_byte random_bytes[8]; /* 8 bytes - 64 bits - the biggest pixel */ int expand; png_color_16 back; /* We need a background colour, because we don't know exactly what transforms * have been set we have to supply the colour in the original file format and * so we need to know what that is! The background colour is stored in the * transform_display. */ RANDOMIZE(random_bytes); /* Read the random value, for colour type 3 the background colour is actually * expressed as a 24bit rgb, not an index. */ colour_type = that->this.colour_type; if (colour_type == 3) { colour_type = PNG_COLOR_TYPE_RGB; bit_depth = 8; expand = 0; /* passing in an RGB not a pixel index */ } else { bit_depth = that->this.bit_depth; expand = 1; } image_pixel_init(&data, random_bytes, colour_type, bit_depth, 0/*x*/, 0/*unused: palette*/); /* Extract the background colour from this image_pixel, but make sure the * unused fields of 'back' are garbage. */ RANDOMIZE(back); if (colour_type & PNG_COLOR_MASK_COLOR) { back.red = (png_uint_16)data.red; back.green = (png_uint_16)data.green; back.blue = (png_uint_16)data.blue; } else back.gray = (png_uint_16)data.red; # ifdef PNG_FLOATING_POINT_SUPPORTED png_set_background(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0); # else png_set_background_fixed(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0); # endif this->next->set(this->next, that, pp, pi); }
6,555
36,424
0
static int pppol2tp_session_ioctl(struct l2tp_session *session, unsigned int cmd, unsigned long arg) { struct ifreq ifr; int err = 0; struct sock *sk; int val = (int) arg; struct pppol2tp_session *ps = l2tp_session_priv(session); struct l2tp_tunnel *tunnel = session->tunnel; struct pppol2tp_ioc_stats stats; l2tp_dbg(session, PPPOL2TP_MSG_CONTROL, "%s: pppol2tp_session_ioctl(cmd=%#x, arg=%#lx)\n", session->name, cmd, arg); sk = ps->sock; sock_hold(sk); switch (cmd) { case SIOCGIFMTU: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; err = -EFAULT; if (copy_from_user(&ifr, (void __user *) arg, sizeof(struct ifreq))) break; ifr.ifr_mtu = session->mtu; if (copy_to_user((void __user *) arg, &ifr, sizeof(struct ifreq))) break; l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get mtu=%d\n", session->name, session->mtu); err = 0; break; case SIOCSIFMTU: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; err = -EFAULT; if (copy_from_user(&ifr, (void __user *) arg, sizeof(struct ifreq))) break; session->mtu = ifr.ifr_mtu; l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: set mtu=%d\n", session->name, session->mtu); err = 0; break; case PPPIOCGMRU: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; err = -EFAULT; if (put_user(session->mru, (int __user *) arg)) break; l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get mru=%d\n", session->name, session->mru); err = 0; break; case PPPIOCSMRU: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; err = -EFAULT; if (get_user(val, (int __user *) arg)) break; session->mru = val; l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: set mru=%d\n", session->name, session->mru); err = 0; break; case PPPIOCGFLAGS: err = -EFAULT; if (put_user(ps->flags, (int __user *) arg)) break; l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get flags=%d\n", session->name, ps->flags); err = 0; break; case PPPIOCSFLAGS: err = -EFAULT; if (get_user(val, (int __user *) arg)) break; ps->flags = val; l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: set flags=%d\n", session->name, ps->flags); err = 0; break; case PPPIOCGL2TPSTATS: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; memset(&stats, 0, sizeof(stats)); stats.tunnel_id = tunnel->tunnel_id; stats.session_id = session->session_id; pppol2tp_copy_stats(&stats, &session->stats); if (copy_to_user((void __user *) arg, &stats, sizeof(stats))) break; l2tp_info(session, PPPOL2TP_MSG_CONTROL, "%s: get L2TP stats\n", session->name); err = 0; break; default: err = -ENOSYS; break; } sock_put(sk); return err; }
6,556
4,602
0
PHP_FUNCTION(openssl_private_encrypt) { zval *key, *crypted; EVP_PKEY *pkey; int cryptedlen; zend_string *cryptedbuf = NULL; int successful = 0; zend_resource *keyresource = NULL; char * data; size_t data_len; zend_long padding = RSA_PKCS1_PADDING; if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz/z|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) { return; } RETVAL_FALSE; pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource); if (pkey == NULL) { php_error_docref(NULL, E_WARNING, "key param is not a valid private key"); RETURN_FALSE; } PHP_OPENSSL_CHECK_SIZE_T_TO_INT(data_len, data); cryptedlen = EVP_PKEY_size(pkey); cryptedbuf = zend_string_alloc(cryptedlen, 0); switch (EVP_PKEY_id(pkey)) { case EVP_PKEY_RSA: case EVP_PKEY_RSA2: successful = (RSA_private_encrypt((int)data_len, (unsigned char *)data, (unsigned char *)ZSTR_VAL(cryptedbuf), EVP_PKEY_get0_RSA(pkey), (int)padding) == cryptedlen); break; default: php_error_docref(NULL, E_WARNING, "key type not supported in this PHP build!"); } if (successful) { zval_dtor(crypted); ZSTR_VAL(cryptedbuf)[cryptedlen] = '\0'; ZVAL_NEW_STR(crypted, cryptedbuf); cryptedbuf = NULL; RETVAL_TRUE; } else { php_openssl_store_errors(); } if (cryptedbuf) { zend_string_release(cryptedbuf); } if (keyresource == NULL) { EVP_PKEY_free(pkey); } }
6,557
123,656
0
gfx::Size GpuCommandBufferStub::GetSurfaceSize() const { if (!surface_) return gfx::Size(); return surface_->GetSize(); }
6,558
41,155
0
static void tcp_fixup_rcvbuf(struct sock *sk) { u32 mss = tcp_sk(sk)->advmss; u32 icwnd = TCP_DEFAULT_INIT_RCVWND; int rcvmem; /* Limit to 10 segments if mss <= 1460, * or 14600/mss segments, with a minimum of two segments. */ if (mss > 1460) icwnd = max_t(u32, (1460 * TCP_DEFAULT_INIT_RCVWND) / mss, 2); rcvmem = SKB_TRUESIZE(mss + MAX_TCP_HEADER); while (tcp_win_from_space(rcvmem) < mss) rcvmem += 128; rcvmem *= icwnd; if (sk->sk_rcvbuf < rcvmem) sk->sk_rcvbuf = min(rcvmem, sysctl_tcp_rmem[2]); }
6,559
100,621
0
VoiceInteractionOverlay::~VoiceInteractionOverlay() {}
6,560
85,914
0
void dm_lock_md_type(struct mapped_device *md) { mutex_lock(&md->type_lock); }
6,561
144,645
0
void WebContentsImpl::Replace(const base::string16& word) { RenderFrameHost* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->Send(new InputMsg_Replace( focused_frame->GetRoutingID(), word)); }
6,562
115,975
0
void ewk_frame_view_create_for_view(Evas_Object* ewkFrame, Evas_Object* view) { DBG("ewkFrame=%p, view=%p", ewkFrame, view); EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData); EINA_SAFETY_ON_NULL_RETURN(smartData->frame); Evas_Coord width, height; evas_object_geometry_get(view, 0, 0, &width, &height); WebCore::IntSize size(width, height); int red, green, blue, alpha; WebCore::Color background; ewk_view_bg_color_get(view, &red, &green, &blue, &alpha); if (!alpha) background = WebCore::Color(0, 0, 0, 0); else if (alpha == 255) background = WebCore::Color(red, green, blue, alpha); else background = WebCore::Color(red * 255 / alpha, green * 255 / alpha, blue * 255 / alpha, alpha); smartData->frame->createView(size, background, !alpha, WebCore::IntSize(), false); if (!smartData->frame->view()) return; const char* theme = ewk_view_theme_get(view); smartData->frame->view()->setEdjeTheme(theme); smartData->frame->view()->setEvasObject(ewkFrame); ewk_frame_mixed_content_displayed_set(ewkFrame, false); ewk_frame_mixed_content_run_set(ewkFrame, false); }
6,563
65,105
0
static MagickBooleanType ReadDXT5(Image *image, DDSInfo *dds_info, ExceptionInfo *exception) { DDSColors colors; ssize_t j, y; MagickSizeType alpha_bits; PixelPacket *q; register ssize_t i, x; unsigned char a0, a1; size_t alpha, bits, code, alpha_code; unsigned short c0, c1; for (y = 0; y < (ssize_t) dds_info->height; y += 4) { for (x = 0; x < (ssize_t) dds_info->width; x += 4) { /* Get 4x4 patch of pixels to write on */ q = QueueAuthenticPixels(image, x, y, MagickMin(4, dds_info->width - x), MagickMin(4, dds_info->height - y),exception); if (q == (PixelPacket *) NULL) return MagickFalse; /* Read alpha values (8 bytes) */ a0 = (unsigned char) ReadBlobByte(image); a1 = (unsigned char) ReadBlobByte(image); alpha_bits = (MagickSizeType)ReadBlobLSBLong(image); alpha_bits = alpha_bits | ((MagickSizeType)ReadBlobLSBShort(image) << 32); /* Read 8 bytes of data from the image */ c0 = ReadBlobLSBShort(image); c1 = ReadBlobLSBShort(image); bits = ReadBlobLSBLong(image); CalculateColors(c0, c1, &colors, MagickTrue); /* Write the pixels */ for (j = 0; j < 4; j++) { for (i = 0; i < 4; i++) { if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height) { code = (bits >> ((4*j+i)*2)) & 0x3; SetPixelRed(q,ScaleCharToQuantum(colors.r[code])); SetPixelGreen(q,ScaleCharToQuantum(colors.g[code])); SetPixelBlue(q,ScaleCharToQuantum(colors.b[code])); /* Extract alpha value */ alpha_code = (size_t) (alpha_bits >> (3*(4*j+i))) & 0x7; if (alpha_code == 0) alpha = a0; else if (alpha_code == 1) alpha = a1; else if (a0 > a1) alpha = ((8-alpha_code) * a0 + (alpha_code-1) * a1) / 7; else if (alpha_code == 6) alpha = 0; else if (alpha_code == 7) alpha = 255; else alpha = (((6-alpha_code) * a0 + (alpha_code-1) * a1) / 5); SetPixelAlpha(q,ScaleCharToQuantum((unsigned char) alpha)); q++; } } } if (SyncAuthenticPixels(image,exception) == MagickFalse) return MagickFalse; } } return(SkipDXTMipmaps(image,dds_info,16,exception)); }
6,564
96,025
0
int FS_FindVM(void **startSearch, char *found, int foundlen, const char *name, int enableDll) { searchpath_t *search, *lastSearch; directory_t *dir; pack_t *pack; char dllName[MAX_OSPATH], qvmName[MAX_OSPATH]; char *netpath; if(!fs_searchpaths) Com_Error(ERR_FATAL, "Filesystem call made without initialization"); if(enableDll) Com_sprintf(dllName, sizeof(dllName), "%s" ARCH_STRING DLL_EXT, name); Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.qvm", name); lastSearch = *startSearch; if(*startSearch == NULL) search = fs_searchpaths; else search = lastSearch->next; while(search) { if(search->dir && !fs_numServerPaks) { dir = search->dir; if(enableDll) { netpath = FS_BuildOSPath(dir->path, dir->gamedir, dllName); if(FS_FileInPathExists(netpath)) { Q_strncpyz(found, netpath, foundlen); *startSearch = search; return VMI_NATIVE; } } if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0) { *startSearch = search; return VMI_COMPILED; } } else if(search->pack) { pack = search->pack; if(lastSearch && lastSearch->pack) { if(!FS_FilenameCompare(lastSearch->pack->pakPathname, pack->pakPathname)) { search = search->next; continue; } } if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0) { *startSearch = search; return VMI_COMPILED; } } search = search->next; } return -1; }
6,565
80,012
0
GF_Err clap_Size(GF_Box *s) { s->size += 32; return GF_OK; }
6,566
79,128
0
static ssize_t ucma_connect(struct ucma_file *file, const char __user *inbuf, int in_len, int out_len) { struct rdma_ucm_connect cmd; struct rdma_conn_param conn_param; struct ucma_context *ctx; int ret; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; if (!cmd.conn_param.valid) return -EINVAL; ctx = ucma_get_ctx_dev(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); ucma_copy_conn_param(ctx->cm_id, &conn_param, &cmd.conn_param); ret = rdma_connect(ctx->cm_id, &conn_param); ucma_put_ctx(ctx); return ret; }
6,567
63,620
0
static inline void php_register_server_variables(TSRMLS_D) { zval *array_ptr = NULL; ALLOC_ZVAL(array_ptr); array_init(array_ptr); INIT_PZVAL(array_ptr); if (PG(http_globals)[TRACK_VARS_SERVER]) { zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]); } PG(http_globals)[TRACK_VARS_SERVER] = array_ptr; /* Server variables */ if (sapi_module.register_server_variables) { sapi_module.register_server_variables(array_ptr TSRMLS_CC); } /* PHP Authentication support */ if (SG(request_info).auth_user) { php_register_variable("PHP_AUTH_USER", SG(request_info).auth_user, array_ptr TSRMLS_CC); } if (SG(request_info).auth_password) { php_register_variable("PHP_AUTH_PW", SG(request_info).auth_password, array_ptr TSRMLS_CC); } if (SG(request_info).auth_digest) { php_register_variable("PHP_AUTH_DIGEST", SG(request_info).auth_digest, array_ptr TSRMLS_CC); } /* store request init time */ { zval request_time_float, request_time_long; Z_TYPE(request_time_float) = IS_DOUBLE; Z_DVAL(request_time_float) = sapi_get_request_time(TSRMLS_C); php_register_variable_ex("REQUEST_TIME_FLOAT", &request_time_float, array_ptr TSRMLS_CC); Z_TYPE(request_time_long) = IS_LONG; Z_LVAL(request_time_long) = zend_dval_to_lval(Z_DVAL(request_time_float)); php_register_variable_ex("REQUEST_TIME", &request_time_long, array_ptr TSRMLS_CC); } }
6,568
18,477
0
static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) { int error = 0; char if_file[128]; FILE *file; char cmd[512]; char *mac_addr; /* * Set the configuration for the specified interface with * the information provided. Since there is no standard * way to configure an interface, we will have an external * script that does the job of configuring the interface and * flushing the configuration. * * The parameters passed to this external script are: * 1. A configuration file that has the specified configuration. * * We will embed the name of the interface in the configuration * file: ifcfg-ethx (where ethx is the interface name). * * The information provided here may be more than what is needed * in a given distro to configure the interface and so are free * ignore information that may not be relevant. * * Here is the format of the ip configuration file: * * HWADDR=macaddr * IF_NAME=interface name * DHCP=yes (This is optional; if yes, DHCP is configured) * * IPADDR=ipaddr1 * IPADDR_1=ipaddr2 * IPADDR_x=ipaddry (where y = x + 1) * * NETMASK=netmask1 * NETMASK_x=netmasky (where y = x + 1) * * GATEWAY=ipaddr1 * GATEWAY_x=ipaddry (where y = x + 1) * * DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc) * * IPV6 addresses will be tagged as IPV6ADDR, IPV6 gateway will be * tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as * IPV6NETMASK. * * The host can specify multiple ipv4 and ipv6 addresses to be * configured for the interface. Furthermore, the configuration * needs to be persistent. A subsequent GET call on the interface * is expected to return the configuration that is set via the SET * call. */ snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC, "hyperv/ifcfg-", if_name); file = fopen(if_file, "w"); if (file == NULL) { syslog(LOG_ERR, "Failed to open config file"); return HV_E_FAIL; } /* * First write out the MAC address. */ mac_addr = kvp_if_name_to_mac(if_name); if (mac_addr == NULL) { error = HV_E_FAIL; goto setval_error; } error = kvp_write_file(file, "HWADDR", "", mac_addr); if (error) goto setval_error; error = kvp_write_file(file, "IF_NAME", "", if_name); if (error) goto setval_error; if (new_val->dhcp_enabled) { error = kvp_write_file(file, "DHCP", "", "yes"); if (error) goto setval_error; /* * We are done!. */ goto setval_done; } /* * Write the configuration for ipaddress, netmask, gateway and * name servers. */ error = process_ip_string(file, (char *)new_val->ip_addr, IPADDR); if (error) goto setval_error; error = process_ip_string(file, (char *)new_val->sub_net, NETMASK); if (error) goto setval_error; error = process_ip_string(file, (char *)new_val->gate_way, GATEWAY); if (error) goto setval_error; error = process_ip_string(file, (char *)new_val->dns_addr, DNS); if (error) goto setval_error; setval_done: free(mac_addr); fclose(file); /* * Now that we have populated the configuration file, * invoke the external script to do its magic. */ snprintf(cmd, sizeof(cmd), "%s %s", "hv_set_ifconfig", if_file); system(cmd); return 0; setval_error: syslog(LOG_ERR, "Failed to write config file"); free(mac_addr); fclose(file); return error; }
6,569
150,939
0
void Bluetooth::ContextDestroyed(ExecutionContext*) { client_bindings_.CloseAllBindings(); }
6,570
92,304
0
copyEntityTable(XML_Parser oldParser, HASH_TABLE *newTable, STRING_POOL *newPool, const HASH_TABLE *oldTable) { HASH_TABLE_ITER iter; const XML_Char *cachedOldBase = NULL; const XML_Char *cachedNewBase = NULL; hashTableIterInit(&iter, oldTable); for (;;) { ENTITY *newE; const XML_Char *name; const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); if (!oldE) break; name = poolCopyString(newPool, oldE->name); if (!name) return 0; newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY)); if (!newE) return 0; if (oldE->systemId) { const XML_Char *tem = poolCopyString(newPool, oldE->systemId); if (!tem) return 0; newE->systemId = tem; if (oldE->base) { if (oldE->base == cachedOldBase) newE->base = cachedNewBase; else { cachedOldBase = oldE->base; tem = poolCopyString(newPool, cachedOldBase); if (!tem) return 0; cachedNewBase = newE->base = tem; } } if (oldE->publicId) { tem = poolCopyString(newPool, oldE->publicId); if (!tem) return 0; newE->publicId = tem; } } else { const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen); if (!tem) return 0; newE->textPtr = tem; newE->textLen = oldE->textLen; } if (oldE->notation) { const XML_Char *tem = poolCopyString(newPool, oldE->notation); if (!tem) return 0; newE->notation = tem; } newE->is_param = oldE->is_param; newE->is_internal = oldE->is_internal; } return 1; }
6,571
167,011
0
FrameMsg_Navigate_Type::Value GetNavigationType( const GURL& old_url, const GURL& new_url, ReloadType reload_type, const NavigationEntryImpl& entry, const FrameNavigationEntry& frame_entry, bool is_same_document_history_load) { switch (reload_type) { case ReloadType::NORMAL: return FrameMsg_Navigate_Type::RELOAD; case ReloadType::BYPASSING_CACHE: case ReloadType::DISABLE_PREVIEWS: return FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE; case ReloadType::ORIGINAL_REQUEST_URL: return FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; case ReloadType::NONE: break; // Fall through to rest of function. } if (entry.restore_type() == RestoreType::LAST_SESSION_EXITED_CLEANLY) { if (entry.GetHasPostData()) return FrameMsg_Navigate_Type::RESTORE_WITH_POST; else return FrameMsg_Navigate_Type::RESTORE; } if (frame_entry.page_state().IsValid()) { if (is_same_document_history_load) return FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT; else return FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT; } DCHECK(!is_same_document_history_load); if (new_url.has_ref() && old_url.EqualsIgnoringRef(new_url) && frame_entry.method() == "GET") { return FrameMsg_Navigate_Type::SAME_DOCUMENT; } else { return FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; } }
6,572
145,795
0
static BROTLI_INLINE void ProcessSingleCodeLength(uint32_t code_len, uint32_t* symbol, uint32_t* repeat, uint32_t* space, uint32_t* prev_code_len, uint16_t* symbol_lists, uint16_t* code_length_histo, int* next_symbol) { *repeat = 0; if (code_len != 0) { /* code_len == 1..15 */ symbol_lists[next_symbol[code_len]] = (uint16_t)(*symbol); next_symbol[code_len] = (int)(*symbol); *prev_code_len = code_len; *space -= 32768U >> code_len; code_length_histo[code_len]++; } (*symbol)++; }
6,573
96,167
0
MagickExport QuantumFormatType GetQuantumFormat(const QuantumInfo *quantum_info) { assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickSignature); return(quantum_info->format); }
6,574
104,138
0
error::Error GLES2DecoderImpl::HandleGetString( uint32 immediate_data_size, const gles2::GetString& c) { GLenum name = static_cast<GLenum>(c.name); if (!validators_->string_type.IsValid(name)) { SetGLError(GL_INVALID_ENUM, "glGetString: name GL_INVALID_ENUM"); return error::kNoError; } const char* gl_str = reinterpret_cast<const char*>(glGetString(name)); const char* str = NULL; switch (name) { case GL_VERSION: str = "OpenGL ES 2.0 Chromium"; break; case GL_SHADING_LANGUAGE_VERSION: str = "OpenGL ES GLSL ES 1.0 Chromium"; break; case GL_EXTENSIONS: str = feature_info_->extensions().c_str(); break; default: str = gl_str; break; } Bucket* bucket = CreateBucket(c.bucket_id); bucket->SetFromString(str); return error::kNoError; }
6,575
163,225
0
void ExpectChildFrameCollapsed(Shell* shell, const std::string& frame_id, bool expect_collapsed) { ExpectChildFrameSetAsCollapsedInFTN(shell, expect_collapsed); ExpectChildFrameCollapsedInLayout(shell, frame_id, expect_collapsed); }
6,576
15,930
0
Container::Container(WEBP_MetaHandler* handler) : Chunk(NULL, handler) { this->needsRewrite = false; XMP_IO* file = handler->parent->ioRef; file->Seek(12, kXMP_SeekFromStart); XMP_Int64 size = handler->initialFileSize; XMP_Uns32 peek = 0; while (file->Offset() < size) { peek = XIO::PeekUns32_LE(file); switch (peek) { case kChunk_XMP_: this->addChunk(new XMPChunk(this, handler)); break; case kChunk_VP8X: this->addChunk(new VP8XChunk(this, handler)); break; default: this->addChunk(new Chunk(this, handler)); break; } } if (this->chunks[WEBP_CHUNK_IMAGE].size() == 0) { XMP_Throw("File has no image bitstream", kXMPErr_BadFileFormat); } if (this->chunks[WEBP_CHUNK_VP8X].size() == 0) { this->needsRewrite = true; this->addChunk(new VP8XChunk(this)); } if (this->chunks[WEBP_CHUNK_XMP].size() == 0) { XMPChunk* xmpChunk = new XMPChunk(this); this->addChunk(xmpChunk); handler->xmpChunk = xmpChunk; this->vp8x->xmp(true); } }
6,577
4,288
0
PHP_FUNCTION(connection_status) { RETURN_LONG(PG(connection_status)); }
6,578
175,129
0
static bool is_wifi_interface(const char *name) { if (strncmp(name, "wlan", 4) != 0 && strncmp(name, "p2p", 3) != 0) { /* not a wifi interface; ignore it */ return false; } else { return true; } }
6,579
152,482
0
void RenderFrameImpl::PostMessageEvent(int32_t source_routing_id, const base::string16& source_origin, const base::string16& target_origin, blink::TransferableMessage message) { message.EnsureDataIsOwned(); WebFrame* source_frame = nullptr; if (source_routing_id != MSG_ROUTING_NONE) { RenderFrameProxy* source_proxy = RenderFrameProxy::FromRoutingID(source_routing_id); if (source_proxy) source_frame = source_proxy->web_frame(); } WebSecurityOrigin target_security_origin; if (!target_origin.empty()) { target_security_origin = WebSecurityOrigin::CreateFromString( WebString::FromUTF16(target_origin)); } WebDOMMessageEvent msg_event(std::move(message), WebString::FromUTF16(source_origin), source_frame, frame_->GetDocument()); frame_->DispatchMessageEventWithOriginCheck(target_security_origin, msg_event, message.has_user_gesture); }
6,580
65,557
0
__be32 nfsd4_bind_conn_to_session(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_bind_conn_to_session *bcts) { __be32 status; struct nfsd4_conn *conn; struct nfsd4_session *session; struct net *net = SVC_NET(rqstp); struct nfsd_net *nn = net_generic(net, nfsd_net_id); if (!nfsd4_last_compound_op(rqstp)) return nfserr_not_only_op; spin_lock(&nn->client_lock); session = find_in_sessionid_hashtbl(&bcts->sessionid, net, &status); spin_unlock(&nn->client_lock); if (!session) goto out_no_session; status = nfserr_wrong_cred; if (!nfsd4_mach_creds_match(session->se_client, rqstp)) goto out; status = nfsd4_map_bcts_dir(&bcts->dir); if (status) goto out; conn = alloc_conn(rqstp, bcts->dir); status = nfserr_jukebox; if (!conn) goto out; nfsd4_init_conn(rqstp, conn, session); status = nfs_ok; out: nfsd4_put_session(session); out_no_session: return status; }
6,581
6,970
0
tt_cmap0_get_info( TT_CMap cmap, TT_CMapInfo *cmap_info ) { FT_Byte* p = cmap->data + 4; cmap_info->format = 0; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); return FT_Err_Ok; }
6,582
119,437
0
void RenderThreadImpl::SetResourceDispatcherDelegate( ResourceDispatcherDelegate* delegate) { resource_dispatcher()->set_delegate(delegate); }
6,583
163,442
0
bool OmniboxViewViews::OnAfterPossibleChange(bool allow_keyword_ui_change) { State new_state; GetState(&new_state); OmniboxView::StateChanges state_changes = GetStateChanges(state_before_change_, new_state); state_changes.text_differs = state_changes.text_differs || (ime_composing_before_change_ != IsIMEComposing()); const bool something_changed = model()->OnAfterPossibleChange( state_changes, allow_keyword_ui_change && !IsIMEComposing()); if (something_changed && (state_changes.text_differs || state_changes.keyword_differs)) TextChanged(); else if (state_changes.selection_differs) EmphasizeURLComponents(); else if (delete_at_end_pressed_) model()->OnChanged(); return something_changed; }
6,584
66,633
0
static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev) { struct gs_device_mode *dm; struct usb_interface *intf = gsdev->iface; int rc; dm = kzalloc(sizeof(*dm), GFP_KERNEL); if (!dm) return -ENOMEM; dm->mode = GS_CAN_MODE_RESET; rc = usb_control_msg(interface_to_usbdev(intf), usb_sndctrlpipe(interface_to_usbdev(intf), 0), GS_USB_BREQ_MODE, USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, gsdev->channel, 0, dm, sizeof(*dm), 1000); return rc; }
6,585
15,858
0
static void virtio_net_set_queues(VirtIONet *n) { int i; int r; for (i = 0; i < n->max_queues; i++) { if (i < n->curr_queues) { r = peer_attach(n, i); assert(!r); } else { r = peer_detach(n, i); assert(!r); } } }
6,586
18,486
0
static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) { struct pglist_data *pgdat = zone->zone_pgdat; int nr_pages = PAGES_PER_SECTION; int nid = pgdat->node_id; int zone_type; unsigned long flags; zone_type = zone - pgdat->node_zones; if (!zone->wait_table) { int ret; ret = init_currently_empty_zone(zone, phys_start_pfn, nr_pages, MEMMAP_HOTPLUG); if (ret) return ret; } pgdat_resize_lock(zone->zone_pgdat, &flags); grow_zone_span(zone, phys_start_pfn, phys_start_pfn + nr_pages); grow_pgdat_span(zone->zone_pgdat, phys_start_pfn, phys_start_pfn + nr_pages); pgdat_resize_unlock(zone->zone_pgdat, &flags); memmap_init_zone(nr_pages, nid, zone_type, phys_start_pfn, MEMMAP_HOTPLUG); return 0; }
6,587
174,141
0
void OMX::CallbackDispatcher::dispatch(std::list<omx_message> &messages) { if (mOwner == NULL) { ALOGV("Would have dispatched a message to a node that's already gone."); return; } mOwner->onMessages(messages); }
6,588
174,988
0
status_t CameraDeviceClient::flush() { ATRACE_CALL(); ALOGV("%s", __FUNCTION__); status_t res = OK; if ( (res = checkPid(__FUNCTION__) ) != OK) return res; Mutex::Autolock icl(mBinderSerializationLock); if (!mDevice.get()) return DEAD_OBJECT; return mDevice->flush(); }
6,589
148,371
0
bool WebContentsImpl::FocusLocationBarByDefault() { NavigationEntryImpl* entry = controller_.GetPendingEntry(); if (controller_.IsInitialNavigation() && entry && !entry->is_renderer_initiated() && entry->GetURL() == url::kAboutBlankURL) { return true; } return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); }
6,590
100,089
0
bool ParseHostAndPort(std::string::const_iterator host_and_port_begin, std::string::const_iterator host_and_port_end, std::string* host, int* port) { if (host_and_port_begin >= host_and_port_end) return false; const char* auth_begin = &(*host_and_port_begin); int auth_len = host_and_port_end - host_and_port_begin; url_parse::Component auth_component(0, auth_len); url_parse::Component username_component; url_parse::Component password_component; url_parse::Component hostname_component; url_parse::Component port_component; url_parse::ParseAuthority(auth_begin, auth_component, &username_component, &password_component, &hostname_component, &port_component); if (username_component.is_valid() || password_component.is_valid()) return false; if (!hostname_component.is_nonempty()) return false; // Failed parsing. int parsed_port_number = -1; if (port_component.is_nonempty()) { parsed_port_number = url_parse::ParsePort(auth_begin, port_component); if (parsed_port_number < 0) return false; // Failed parsing the port number. } if (port_component.len == 0) return false; // Reject inputs like "foo:" host->assign(auth_begin + hostname_component.begin, hostname_component.len); *port = parsed_port_number; return true; // Success. }
6,591
3,592
0
int ssl3_get_cert_verify(SSL *s) { EVP_PKEY *pkey = NULL; unsigned char *p; int al, ok, ret = 0; long n; int type = 0, i, j; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); /* * We should only process a CertificateVerify message if we have received * a Certificate from the client. If so then |s->session->peer| will be non * NULL. In some instances a CertificateVerify message is not required even * if the peer has sent a Certificate (e.g. such as in the case of static * DH). In that case the ClientKeyExchange processing will skip the * CertificateVerify state so we should not arrive here. */ if (s->session->peer == NULL) { ret = 1; goto end; } n = s->method->ssl_get_message(s, SSL3_ST_SR_CERT_VRFY_A, SSL3_ST_SR_CERT_VRFY_B, SSL3_MT_CERTIFICATE_VERIFY, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return ((int)n); peer = s->session->peer; pkey = X509_get_pubkey(peer); type = X509_certificate_type(peer, pkey); if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al = SSL_AD_ILLEGAL_PARAMETER; goto f_err; } /* we now have a signature that we need to verify */ p = (unsigned char *)s->init_msg; /* Check for broken implementations of GOST ciphersuites */ /* * If key is GOST and n is exactly 64, it is bare signature without * length field */ if (n == 64 && (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001)) { i = 64; } else { if (SSL_USE_SIGALGS(s)) { int rv = tls12_check_peer_sigalg(&md, s, p, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif p += 2; n -= 2; } n2s(p, i); n -= 2; if (i > n) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } } j = EVP_PKEY_size(pkey); if ((i > j) || (n > j) || (n <= 0)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE); al = SSL_AD_DECODE_ERROR; goto f_err; } if (SSL_USE_SIGALGS(s)) { long hdatalen = 0; void *hdata; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n", EVP_MD_name(md)); #endif if (!EVP_VerifyInit_ex(&mctx, md, NULL) || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB); al = SSL_AD_INTERNAL_ERROR; goto f_err; } if (EVP_VerifyFinal(&mctx, p, i, pkey) <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_SIGNATURE); goto f_err; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i = RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, p, i, pkey->pkey.rsa); if (i < 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j = DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, p, i, pkey->pkey.dsa); if (j <= 0) { /* bad signature */ al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_ECDSA if (pkey->type == EVP_PKEY_EC) { j = ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, p, i, pkey->pkey.ec); if (j <= 0) { /* bad signature */ al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) { unsigned char signature[64]; int idx; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey, NULL); EVP_PKEY_verify_init(pctx); if (i != 64) { fprintf(stderr, "GOST signature length is %d", i); } for (idx = 0; idx < 64; idx++) { signature[63 - idx] = p[idx]; } j = EVP_PKEY_verify(pctx, signature, 64, s->s3->tmp.cert_verify_md, 32); EVP_PKEY_CTX_free(pctx); if (j <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret = 1; if (0) { f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); s->state = SSL_ST_ERR; } end: if (s->s3->handshake_buffer) { BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE; } EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return (ret); }
6,592
92,218
0
static int serdes_phy_create(struct serdes_ctrl *ctrl, u8 idx, struct phy **phy) { struct serdes_macro *macro; *phy = devm_phy_create(ctrl->dev, NULL, &serdes_ops); if (IS_ERR(*phy)) return PTR_ERR(*phy); macro = devm_kzalloc(ctrl->dev, sizeof(*macro), GFP_KERNEL); if (!macro) return -ENOMEM; macro->idx = idx; macro->ctrl = ctrl; macro->port = -1; phy_set_drvdata(*phy, macro); return 0; }
6,593
48,535
0
static int ion_debug_client_show(struct seq_file *s, void *unused) { struct ion_client *client = s->private; struct rb_node *n; size_t sizes[ION_NUM_HEAP_IDS] = {0}; const char *names[ION_NUM_HEAP_IDS] = {NULL}; int i; mutex_lock(&debugfs_mutex); if (!is_client_alive(client)) { seq_printf(s, "ion_client 0x%p dead, can't dump its buffers\n", client); mutex_unlock(&debugfs_mutex); return 0; } mutex_lock(&client->lock); for (n = rb_first(&client->handles); n; n = rb_next(n)) { struct ion_handle *handle = rb_entry(n, struct ion_handle, node); unsigned int id = handle->buffer->heap->id; if (!names[id]) names[id] = handle->buffer->heap->name; sizes[id] += handle->buffer->size; } mutex_unlock(&client->lock); mutex_unlock(&debugfs_mutex); seq_printf(s, "%16.16s: %16.16s\n", "heap_name", "size_in_bytes"); for (i = 0; i < ION_NUM_HEAP_IDS; i++) { if (!names[i]) continue; seq_printf(s, "%16.16s: %16zu\n", names[i], sizes[i]); } return 0; }
6,594
26,326
0
static void sched_domain_node_span(int node, struct cpumask *span) { nodemask_t used_nodes; int i; cpumask_clear(span); nodes_clear(used_nodes); cpumask_or(span, span, cpumask_of_node(node)); node_set(node, used_nodes); for (i = 1; i < SD_NODES_PER_DOMAIN; i++) { int next_node = find_next_best_node(node, &used_nodes); if (next_node < 0) break; cpumask_or(span, span, cpumask_of_node(next_node)); } }
6,595
151,897
0
void RenderFrameHostImpl::CancelInitialHistoryLoad() { NOTIMPLEMENTED(); }
6,596
21,347
0
static unsigned offset_il_node(struct mempolicy *pol, struct vm_area_struct *vma, unsigned long off) { unsigned nnodes = nodes_weight(pol->v.nodes); unsigned target; int c; int nid = -1; if (!nnodes) return numa_node_id(); target = (unsigned int)off % nnodes; c = 0; do { nid = next_node(nid, pol->v.nodes); c++; } while (c <= target); return nid; }
6,597
181,421
1
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { PicContext *s = avctx->priv_data; AVFrame *frame = data; uint32_t *palette; int bits_per_plane, bpp, etype, esize, npal, pos_after_pal; int i, x, y, plane, tmp, ret, val; bytestream2_init(&s->g, avpkt->data, avpkt->size); if (bytestream2_get_bytes_left(&s->g) < 11) return AVERROR_INVALIDDATA; if (bytestream2_get_le16u(&s->g) != 0x1234) return AVERROR_INVALIDDATA; s->width = bytestream2_get_le16u(&s->g); s->height = bytestream2_get_le16u(&s->g); bytestream2_skip(&s->g, 4); tmp = bytestream2_get_byteu(&s->g); bits_per_plane = tmp & 0xF; s->nb_planes = (tmp >> 4) + 1; bpp = bits_per_plane * s->nb_planes; if (bits_per_plane > 8 || bpp < 1 || bpp > 32) { avpriv_request_sample(avctx, "Unsupported bit depth"); return AVERROR_PATCHWELCOME; } if (bytestream2_peek_byte(&s->g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) { bytestream2_skip(&s->g, 2); etype = bytestream2_get_le16(&s->g); esize = bytestream2_get_le16(&s->g); if (bytestream2_get_bytes_left(&s->g) < esize) return AVERROR_INVALIDDATA; } else { etype = -1; esize = 0; } avctx->pix_fmt = AV_PIX_FMT_PAL8; if (av_image_check_size(s->width, s->height, 0, avctx) < 0) return -1; if (s->width != avctx->width && s->height != avctx->height) { ret = ff_set_dimensions(avctx, s->width, s->height); if (ret < 0) return ret; } if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; memset(frame->data[0], 0, s->height * frame->linesize[0]); frame->pict_type = AV_PICTURE_TYPE_I; frame->palette_has_changed = 1; pos_after_pal = bytestream2_tell(&s->g) + esize; palette = (uint32_t*)frame->data[1]; if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->g) < 6) { int idx = bytestream2_get_byte(&s->g); npal = 4; for (i = 0; i < npal; i++) palette[i] = ff_cga_palette[ cga_mode45_index[idx][i] ]; } else if (etype == 2) { npal = FFMIN(esize, 16); for (i = 0; i < npal; i++) { int pal_idx = bytestream2_get_byte(&s->g); palette[i] = ff_cga_palette[FFMIN(pal_idx, 15)]; } } else if (etype == 3) { npal = FFMIN(esize, 16); for (i = 0; i < npal; i++) { int pal_idx = bytestream2_get_byte(&s->g); palette[i] = ff_ega_palette[FFMIN(pal_idx, 63)]; } } else if (etype == 4 || etype == 5) { npal = FFMIN(esize / 3, 256); for (i = 0; i < npal; i++) { palette[i] = bytestream2_get_be24(&s->g) << 2; palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303; } } else { if (bpp == 1) { npal = 2; palette[0] = 0xFF000000; palette[1] = 0xFFFFFFFF; } else if (bpp == 2) { npal = 4; for (i = 0; i < npal; i++) palette[i] = ff_cga_palette[ cga_mode45_index[0][i] ]; } else { npal = 16; memcpy(palette, ff_cga_palette, npal * 4); } } // fill remaining palette entries memset(palette + npal, 0, AVPALETTE_SIZE - npal * 4); // skip remaining palette bytes bytestream2_seek(&s->g, pos_after_pal, SEEK_SET); val = 0; y = s->height - 1; if (bytestream2_get_le16(&s->g)) { x = 0; plane = 0; while (bytestream2_get_bytes_left(&s->g) >= 6) { int stop_size, marker, t1, t2; t1 = bytestream2_get_bytes_left(&s->g); t2 = bytestream2_get_le16(&s->g); stop_size = t1 - FFMIN(t1, t2); // ignore uncompressed block size bytestream2_skip(&s->g, 2); marker = bytestream2_get_byte(&s->g); while (plane < s->nb_planes && bytestream2_get_bytes_left(&s->g) > stop_size) { int run = 1; val = bytestream2_get_byte(&s->g); if (val == marker) { run = bytestream2_get_byte(&s->g); if (run == 0) run = bytestream2_get_le16(&s->g); val = bytestream2_get_byte(&s->g); } if (!bytestream2_get_bytes_left(&s->g)) break; if (bits_per_plane == 8) { picmemset_8bpp(s, frame, val, run, &x, &y); if (y < 0) goto finish; } else { picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane); } } } if (x < avctx->width) { int run = (y + 1) * avctx->width - x; if (bits_per_plane == 8) picmemset_8bpp(s, frame, val, run, &x, &y); else picmemset(s, frame, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane); } } else { while (y >= 0 && bytestream2_get_bytes_left(&s->g) > 0) { memcpy(frame->data[0] + y * frame->linesize[0], s->g.buffer, FFMIN(avctx->width, bytestream2_get_bytes_left(&s->g))); bytestream2_skip(&s->g, avctx->width); y--; } } finish: *got_frame = 1; return avpkt->size; }
6,598
27,435
0
static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb) { if (INET_ECN_is_ce(iph->tos)) IP6_ECN_set_ce(ipv6_hdr(skb)); }
6,599