unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
134,796 | 0 | void TabletEventConverterEvdev::DispatchMouseButton(const input_event& input) {
if (!cursor_)
return;
unsigned int button;
if (input.code == BTN_TOUCH)
button = BTN_LEFT;
else if (input.code == BTN_STYLUS2)
button = BTN_RIGHT;
else if (input.code == BTN_STYLUS)
button = BTN_MIDDLE;
else
return;
if (abs_value_dirty_) {
UpdateCursor();
abs_value_dirty_ = false;
}
bool down = input.value;
dispatcher_->DispatchMouseButtonEvent(MouseButtonEventParams(
input_device_.id, cursor_->GetLocation(), button, down,
false /* allow_remap */, TimeDeltaFromInputEvent(input)));
}
| 16,700 |
44,928 | 0 | xfs_attr3_leaf_create(
struct xfs_da_args *args,
xfs_dablk_t blkno,
struct xfs_buf **bpp)
{
struct xfs_attr_leafblock *leaf;
struct xfs_attr3_icleaf_hdr ichdr;
struct xfs_inode *dp = args->dp;
struct xfs_mount *mp = dp->i_mount;
struct xfs_buf *bp;
int error;
trace_xfs_attr_leaf_create(args);
error = xfs_da_get_buf(args->trans, args->dp, blkno, -1, &bp,
XFS_ATTR_FORK);
if (error)
return error;
bp->b_ops = &xfs_attr3_leaf_buf_ops;
xfs_trans_buf_set_type(args->trans, bp, XFS_BLFT_ATTR_LEAF_BUF);
leaf = bp->b_addr;
memset(leaf, 0, XFS_LBSIZE(mp));
memset(&ichdr, 0, sizeof(ichdr));
ichdr.firstused = XFS_LBSIZE(mp);
if (xfs_sb_version_hascrc(&mp->m_sb)) {
struct xfs_da3_blkinfo *hdr3 = bp->b_addr;
ichdr.magic = XFS_ATTR3_LEAF_MAGIC;
hdr3->blkno = cpu_to_be64(bp->b_bn);
hdr3->owner = cpu_to_be64(dp->i_ino);
uuid_copy(&hdr3->uuid, &mp->m_sb.sb_uuid);
ichdr.freemap[0].base = sizeof(struct xfs_attr3_leaf_hdr);
} else {
ichdr.magic = XFS_ATTR_LEAF_MAGIC;
ichdr.freemap[0].base = sizeof(struct xfs_attr_leaf_hdr);
}
ichdr.freemap[0].size = ichdr.firstused - ichdr.freemap[0].base;
xfs_attr3_leaf_hdr_to_disk(leaf, &ichdr);
xfs_trans_log_buf(args->trans, bp, 0, XFS_LBSIZE(mp) - 1);
*bpp = bp;
return 0;
}
| 16,701 |
97,722 | 0 | xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL) {
if (ctxt->context->node == NULL)
return(NULL);
if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) ||
(ctxt->context->node->type == XML_NAMESPACE_DECL))
return(NULL);
if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc)
return(ctxt->context->doc->children);
return(ctxt->context->node->children);
}
if (cur->children != NULL) {
/*
* Do not descend on entities declarations
*/
if (cur->children->type != XML_ENTITY_DECL) {
cur = cur->children;
/*
* Skip DTDs
*/
if (cur->type != XML_DTD_NODE)
return(cur);
}
}
if (cur == ctxt->context->node) return(NULL);
while (cur->next != NULL) {
cur = cur->next;
if ((cur->type != XML_ENTITY_DECL) &&
(cur->type != XML_DTD_NODE))
return(cur);
}
do {
cur = cur->parent;
if (cur == NULL) break;
if (cur == ctxt->context->node) return(NULL);
if (cur->next != NULL) {
cur = cur->next;
return(cur);
}
} while (cur != NULL);
return(cur);
}
| 16,702 |
171,818 | 0 | static void cleanup( void )
{
BTIF_TRACE_EVENT("%s", __FUNCTION__);
btif_hh_device_t *p_dev;
int i;
if (btif_hh_cb.status == BTIF_HH_DISABLED) {
BTIF_TRACE_WARNING("%s: HH disabling or disabled already, status = %d", __FUNCTION__, btif_hh_cb.status);
return;
}
btif_hh_cb.status = BTIF_HH_DISABLING;
for (i = 0; i < BTIF_HH_MAX_HID; i++) {
p_dev = &btif_hh_cb.devices[i];
if (p_dev->dev_status != BTHH_CONN_STATE_UNKNOWN && p_dev->fd >= 0) {
BTIF_TRACE_DEBUG("%s: Closing uhid fd = %d", __FUNCTION__, p_dev->fd);
if (p_dev->fd >= 0) {
bta_hh_co_destroy(p_dev->fd);
p_dev->fd = -1;
}
p_dev->hh_keep_polling = 0;
p_dev->hh_poll_thread_id = -1;
}
}
if (bt_hh_callbacks)
{
btif_disable_service(BTA_HID_SERVICE_ID);
bt_hh_callbacks = NULL;
}
}
| 16,703 |
58,043 | 0 | void nft_unregister_expr(struct nft_expr_type *type)
{
nfnl_lock(NFNL_SUBSYS_NFTABLES);
list_del_rcu(&type->list);
nfnl_unlock(NFNL_SUBSYS_NFTABLES);
}
| 16,704 |
172,790 | 0 | status_t MetadataRetrieverClient::setDataSource(
const sp<IMediaHTTPService> &httpService,
const char *url,
const KeyedVector<String8, String8> *headers)
{
ALOGV("setDataSource(%s)", url);
Mutex::Autolock lock(mLock);
if (url == NULL) {
return UNKNOWN_ERROR;
}
player_type playerType =
MediaPlayerFactory::getPlayerType(NULL /* client */, url);
ALOGV("player type = %d", playerType);
sp<MediaMetadataRetrieverBase> p = createRetriever(playerType);
if (p == NULL) return NO_INIT;
status_t ret = p->setDataSource(httpService, url, headers);
if (ret == NO_ERROR) mRetriever = p;
return ret;
}
| 16,705 |
97,365 | 0 | void FrameLoader::checkIfRunInsecureContent(SecurityOrigin* context, const KURL& url)
{
if (!isMixedContent(context, url))
return;
String message = String::format("The page at %s ran insecure content from %s.\n",
m_URL.string().utf8().data(), url.string().utf8().data());
m_frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message, 1, String());
m_client->didRunInsecureContent(context);
}
| 16,706 |
173,132 | 0 | find_by_flag(png_uint_32 flag)
{
int i = NINFO;
while (--i >= 0) if (chunk_info[i].flag == flag) return i;
fprintf(stderr, "pngunknown: internal error\n");
exit(4);
}
| 16,707 |
106,314 | 0 | void SyncBackendHost::EncryptDataTypes(
const syncable::ModelTypeSet& encrypted_types) {
core_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(),
&SyncBackendHost::Core::DoEncryptDataTypes,
encrypted_types));
}
| 16,708 |
148,594 | 0 | void WebContentsImpl::WasOccluded() {
if (capturer_count_ > 0)
return;
for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree())
view->WasOccluded();
}
| 16,709 |
144,975 | 0 | void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) {
if (insets != insets_) {
insets_ = insets;
host_->WasResized();
}
}
| 16,710 |
49,708 | 0 | int invalidate_partition(struct gendisk *disk, int partno)
{
int res = 0;
struct block_device *bdev = bdget_disk(disk, partno);
if (bdev) {
fsync_bdev(bdev);
res = __invalidate_device(bdev, true);
bdput(bdev);
}
return res;
}
| 16,711 |
126,214 | 0 | content::ColorChooser* Browser::OpenColorChooser(WebContents* web_contents,
int color_chooser_id,
SkColor color) {
#if defined(OS_WIN)
if (!color_chooser_.get())
color_chooser_.reset(content::ColorChooser::Create(color_chooser_id,
web_contents,
color));
#else
if (color_chooser_.get())
color_chooser_->End();
color_chooser_.reset(content::ColorChooser::Create(color_chooser_id,
web_contents,
color));
#endif
return color_chooser_.get();
}
| 16,712 |
145,243 | 0 | void Dispatcher::OnShouldSuspend(const std::string& extension_id,
uint64_t sequence_id) {
RenderThread::Get()->Send(
new ExtensionHostMsg_ShouldSuspendAck(extension_id, sequence_id));
}
| 16,713 |
57,699 | 0 | void kvm_arch_memslots_updated(struct kvm *kvm, struct kvm_memslots *slots)
{
/*
* memslots->generation has been incremented.
* mmio generation may have reached its maximum value.
*/
kvm_mmu_invalidate_mmio_sptes(kvm, slots);
}
| 16,714 |
64,191 | 0 | AP_DECLARE(int) ap_exists_config_define(const char *name)
{
return ap_array_str_contains(ap_server_config_defines, name);
}
| 16,715 |
165,282 | 0 | void ChromeContentBrowserClient::AdjustUtilityServiceProcessCommandLine(
const service_manager::Identity& identity,
base::CommandLine* command_line) {
#if defined(OS_CHROMEOS)
bool copy_switches = false;
if (identity.name() == ash::mojom::kServiceName) {
copy_switches = true;
command_line->AppendSwitch(switches::kMessageLoopTypeUi);
}
if (ash_service_registry::IsAshRelatedServiceName(identity.name())) {
copy_switches = true;
command_line->AppendSwitchASCII(switches::kMashServiceName,
identity.name());
}
if (identity.name() == viz::mojom::kVizServiceName)
content::GpuDataManager::GetInstance()->AppendGpuCommandLine(command_line);
if (copy_switches) {
for (const auto& sw : base::CommandLine::ForCurrentProcess()->GetSwitches())
command_line->AppendSwitchNative(sw.first, sw.second);
}
#endif
#if defined(OS_MACOSX)
if (identity.name() == video_capture::mojom::kServiceName ||
identity.name() == audio::mojom::kServiceName)
command_line->AppendSwitch(switches::kMessageLoopTypeUi);
#endif
}
| 16,716 |
172,688 | 0 | status_t MediaPlayer::setRetransmitEndpoint(const char* addrString,
uint16_t port) {
ALOGV("MediaPlayer::setRetransmitEndpoint(%s:%hu)",
addrString ? addrString : "(null)", port);
Mutex::Autolock _l(mLock);
if ((mPlayer != NULL) || (mCurrentState != MEDIA_PLAYER_IDLE))
return INVALID_OPERATION;
if (NULL == addrString) {
mRetransmitEndpointValid = false;
return OK;
}
struct in_addr saddr;
if(!inet_aton(addrString, &saddr)) {
return BAD_VALUE;
}
memset(&mRetransmitEndpoint, 0, sizeof(mRetransmitEndpoint));
mRetransmitEndpoint.sin_family = AF_INET;
mRetransmitEndpoint.sin_addr = saddr;
mRetransmitEndpoint.sin_port = htons(port);
mRetransmitEndpointValid = true;
return OK;
}
| 16,717 |
22,757 | 0 | int udp6_seq_show(struct seq_file *seq, void *v)
{
if (v == SEQ_START_TOKEN)
seq_printf(seq,
" sl "
"local_address "
"remote_address "
"st tx_queue rx_queue tr tm->when retrnsmt"
" uid timeout inode ref pointer drops\n");
else
udp6_sock_seq_show(seq, v, ((struct udp_iter_state *)seq->private)->bucket);
return 0;
}
| 16,718 |
119,287 | 0 | double ConvolverNode::tailTime() const
{
MutexTryLocker tryLocker(m_processLock);
if (tryLocker.locked())
return m_reverb ? m_reverb->impulseResponseLength() / static_cast<double>(sampleRate()) : 0;
return std::numeric_limits<double>::infinity();
}
| 16,719 |
103,825 | 0 | void RenderView::OnRedo() {
if (!webview())
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Redo"));
}
| 16,720 |
159,360 | 0 | ChromeExtensionsAPIClient::GetNonNativeFileSystemDelegate() {
if (!non_native_file_system_delegate_) {
non_native_file_system_delegate_ =
base::MakeUnique<NonNativeFileSystemDelegateChromeOS>();
}
return non_native_file_system_delegate_.get();
}
| 16,721 |
160,928 | 0 | void ChromeClientImpl::AttachRootGraphicsLayer(GraphicsLayer* root_layer,
LocalFrame* local_frame) {
DCHECK(!RuntimeEnabledFeatures::SlimmingPaintV2Enabled());
WebLocalFrameImpl* web_frame =
WebLocalFrameImpl::FromFrame(local_frame)->LocalRoot();
DCHECK(web_frame->FrameWidget() || !root_layer);
if (web_frame->FrameWidget())
web_frame->FrameWidget()->SetRootGraphicsLayer(root_layer);
}
| 16,722 |
4,670 | 0 | PHP_FUNCTION(openssl_open)
{
zval **privkey, *opendata;
EVP_PKEY *pkey;
int len1, len2;
unsigned char *buf;
long keyresource = -1;
EVP_CIPHER_CTX ctx;
char * data; int data_len;
char * ekey; int ekey_len;
char *method =NULL;
int method_len = 0;
const EVP_CIPHER *cipher;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szsZ|s", &data, &data_len, &opendata, &ekey, &ekey_len, &privkey, &method, &method_len) == FAILURE) {
return;
}
pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, &keyresource TSRMLS_CC);
if (pkey == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to coerce parameter 4 into a private key");
RETURN_FALSE;
}
if (method) {
cipher = EVP_get_cipherbyname(method);
if (!cipher) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown signature algorithm.");
RETURN_FALSE;
}
} else {
cipher = EVP_rc4();
}
buf = emalloc(data_len + 1);
if (EVP_OpenInit(&ctx, cipher, (unsigned char *)ekey, ekey_len, NULL, pkey) && EVP_OpenUpdate(&ctx, buf, &len1, (unsigned char *)data, data_len)) {
if (!EVP_OpenFinal(&ctx, buf + len1, &len2) || (len1 + len2 == 0)) {
efree(buf);
RETVAL_FALSE;
} else {
zval_dtor(opendata);
buf[len1 + len2] = '\0';
ZVAL_STRINGL(opendata, erealloc(buf, len1 + len2 + 1), len1 + len2, 0);
RETVAL_TRUE;
}
} else {
efree(buf);
RETVAL_FALSE;
}
if (keyresource == -1) {
EVP_PKEY_free(pkey);
}
EVP_CIPHER_CTX_cleanup(&ctx);
}
| 16,723 |
55,621 | 0 | static int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
{
/* Don't accept realtime tasks when there is no way for them to run */
if (rt_task(tsk) && tg->rt_bandwidth.rt_runtime == 0)
return 0;
return 1;
}
| 16,724 |
2,604 | 0 | json_extract_path(PG_FUNCTION_ARGS)
{
return get_path_all(fcinfo, false);
}
| 16,725 |
124,121 | 0 | void ChromeContentBrowserClient::RegisterUserPrefs(
PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kDisable3DAPIs,
false,
PrefRegistrySyncable::UNSYNCABLE_PREF);
registry->RegisterBooleanPref(prefs::kEnableHyperlinkAuditing,
true,
PrefRegistrySyncable::UNSYNCABLE_PREF);
registry->RegisterBooleanPref(prefs::kEnableMemoryInfo,
false,
PrefRegistrySyncable::UNSYNCABLE_PREF);
}
| 16,726 |
1,836 | 0 | static void insert_stat_node(StatNodeRef parent, StatNodeRef ref)
{
SpiceStatNode *node = &reds->stat->nodes[ref];
uint32_t pos = INVALID_STAT_REF;
uint32_t node_index;
uint32_t *head;
SpiceStatNode *n;
node->first_child_index = INVALID_STAT_REF;
head = (parent == INVALID_STAT_REF ? &reds->stat->root_index :
&reds->stat->nodes[parent].first_child_index);
node_index = *head;
while (node_index != INVALID_STAT_REF && (n = &reds->stat->nodes[node_index]) &&
strcmp(node->name, n->name) > 0) {
pos = node_index;
node_index = n->next_sibling_index;
}
if (pos == INVALID_STAT_REF) {
node->next_sibling_index = *head;
*head = ref;
} else {
n = &reds->stat->nodes[pos];
node->next_sibling_index = n->next_sibling_index;
n->next_sibling_index = ref;
}
}
| 16,727 |
139,998 | 0 | bool HTMLMediaElement::hasSelectedVideoTrack() {
DCHECK(RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled());
return m_videoTracks && m_videoTracks->selectedIndex() != -1;
}
| 16,728 |
120,113 | 0 | int Layer::IndexOfChild(const Layer* reference) {
for (size_t i = 0; i < children_.size(); ++i) {
if (children_[i].get() == reference)
return i;
}
return -1;
}
| 16,729 |
160,596 | 0 | void RenderFrameImpl::DidStartProvisionalLoad(
blink::WebDocumentLoader* document_loader,
blink::WebURLRequest& request) {
if (!document_loader)
return;
TRACE_EVENT2("navigation,benchmark,rail",
"RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
"url", document_loader->GetRequest().Url().GetString().Utf8());
if (pending_navigation_info_.get()) {
NavigationPolicyInfo info(request);
info.navigation_type = pending_navigation_info_->navigation_type;
info.default_policy = pending_navigation_info_->policy;
info.replaces_current_history_item =
pending_navigation_info_->replaces_current_history_item;
info.is_history_navigation_in_new_child_frame =
pending_navigation_info_->history_navigation_in_new_child_frame;
info.is_client_redirect = pending_navigation_info_->client_redirect;
info.triggering_event_info =
pending_navigation_info_->triggering_event_info;
info.form = pending_navigation_info_->form;
info.source_location = pending_navigation_info_->source_location;
pending_navigation_info_.reset(nullptr);
BeginNavigation(info);
}
DocumentState* document_state =
DocumentState::FromDocumentLoader(document_loader);
NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>(
document_state->navigation_state());
bool is_top_most = !frame_->Parent();
if (is_top_most) {
auto navigation_gesture =
WebUserGestureIndicator::IsProcessingUserGesture(frame_)
? NavigationGestureUser
: NavigationGestureAuto;
render_view_->set_navigation_gesture(navigation_gesture);
} else if (document_loader->ReplacesCurrentHistoryItem()) {
navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME);
}
base::TimeTicks navigation_start =
navigation_state->common_params().navigation_start;
DCHECK(!navigation_start.is_null());
{
SCOPED_UMA_HISTOGRAM_TIMER("RenderFrameObservers.DidStartProvisionalLoad");
for (auto& observer : observers_)
observer.DidStartProvisionalLoad(document_loader);
}
std::vector<GURL> redirect_chain;
GetRedirectChain(document_loader, &redirect_chain);
if (ConsumeGestureOnNavigation())
WebUserGestureIndicator::ConsumeUserGesture(frame_);
Send(new FrameHostMsg_DidStartProvisionalLoad(
routing_id_, document_loader->GetRequest().Url(), redirect_chain,
navigation_start));
}
| 16,730 |
19,497 | 0 | efx_tsoh_heap_free(struct efx_tx_queue *tx_queue, struct efx_tso_header *tsoh)
{
pci_unmap_single(tx_queue->efx->pci_dev,
tsoh->dma_addr, tsoh->unmap_len,
PCI_DMA_TODEVICE);
kfree(tsoh);
}
| 16,731 |
90,732 | 0 | static void emitjumpto(JF, int opcode, int dest)
{
emit(J, F, opcode);
if (dest != (js_Instruction)dest)
js_syntaxerror(J, "jump address integer overflow");
emitarg(J, F, dest);
}
| 16,732 |
94,563 | 0 | static void scsi_cancel_io(SCSIRequest *req)
{
SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
DPRINTF("Cancel tag=0x%x\n", req->tag);
if (r->req.aiocb) {
bdrv_aio_cancel(r->req.aiocb);
}
r->req.aiocb = NULL;
}
| 16,733 |
150,988 | 0 | void DevToolsUIBindings::FileSystemAdded(
const DevToolsFileHelper::FileSystem& file_system) {
std::unique_ptr<base::DictionaryValue> file_system_value(
CreateFileSystemValue(file_system));
CallClientFunction("DevToolsAPI.fileSystemAdded",
file_system_value.get(), NULL, NULL);
}
| 16,734 |
87,614 | 0 | static unsigned unfilter(unsigned char* out, const unsigned char* in, unsigned w, unsigned h, unsigned bpp)
{
/*
For PNG filter method 0
this function unfilters a single image (e.g. without interlacing this is called once, with Adam7 seven times)
out must have enough bytes allocated already, in must have the scanlines + 1 filtertype byte per scanline
w and h are image dimensions or dimensions of reduced image, bpp is bits per pixel
in and out are allowed to be the same memory address (but aren't the same size since in has the extra filter bytes)
*/
unsigned y;
unsigned char* prevline = 0;
/*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/
size_t bytewidth = (bpp + 7) / 8;
size_t linebytes = (w * bpp + 7) / 8;
for(y = 0; y < h; y++)
{
size_t outindex = linebytes * y;
size_t inindex = (1 + linebytes) * y; /*the extra filterbyte added to each row*/
unsigned char filterType = in[inindex];
CERROR_TRY_RETURN(unfilterScanline(&out[outindex], &in[inindex + 1], prevline, bytewidth, filterType, linebytes));
prevline = &out[outindex];
}
return 0;
}
| 16,735 |
54,969 | 0 | static void add_pending_object_with_mode(struct rev_info *revs,
struct object *obj,
const char *name, unsigned mode)
{
add_pending_object_with_path(revs, obj, name, mode, NULL);
}
| 16,736 |
4,943 | 0 | gst_qtdemux_get_type (void)
{
static GType qtdemux_type = 0;
if (!qtdemux_type) {
static const GTypeInfo qtdemux_info = {
sizeof (GstQTDemuxClass),
(GBaseInitFunc) gst_qtdemux_base_init, NULL,
(GClassInitFunc) gst_qtdemux_class_init,
NULL, NULL, sizeof (GstQTDemux), 0,
(GInstanceInitFunc) gst_qtdemux_init,
};
qtdemux_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstQTDemux", &qtdemux_info,
0);
}
return qtdemux_type;
}
| 16,737 |
148,675 | 0 | SkiaOutputSurfaceImpl::SkiaOutputSurfaceImpl(
util::PassKey<SkiaOutputSurfaceImpl> /* pass_key */,
std::unique_ptr<SkiaOutputSurfaceDependency> deps,
const RendererSettings& renderer_settings)
: dependency_(std::move(deps)),
is_using_vulkan_(dependency_->IsUsingVulkan()),
renderer_settings_(renderer_settings) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}
| 16,738 |
129,131 | 0 | bool AllowedScript(const Extension* extension, const GURL& url,
const GURL& top_url) {
return AllowedScript(extension, url, top_url, -1);
}
| 16,739 |
180,752 | 1 | long arch_ptrace(struct task_struct *child, long request,
unsigned long addr, unsigned long data)
{
int ret;
unsigned long __user *datap = (unsigned long __user *) data;
switch (request) {
case PTRACE_PEEKUSR:
ret = ptrace_read_user(child, addr, datap);
break;
case PTRACE_POKEUSR:
ret = ptrace_write_user(child, addr, data);
break;
case PTRACE_GETREGS:
ret = copy_regset_to_user(child,
&user_arm_view, REGSET_GPR,
0, sizeof(struct pt_regs),
datap);
break;
case PTRACE_SETREGS:
ret = copy_regset_from_user(child,
&user_arm_view, REGSET_GPR,
0, sizeof(struct pt_regs),
datap);
break;
case PTRACE_GETFPREGS:
ret = copy_regset_to_user(child,
&user_arm_view, REGSET_FPR,
0, sizeof(union fp_state),
datap);
break;
case PTRACE_SETFPREGS:
ret = copy_regset_from_user(child,
&user_arm_view, REGSET_FPR,
0, sizeof(union fp_state),
datap);
break;
#ifdef CONFIG_IWMMXT
case PTRACE_GETWMMXREGS:
ret = ptrace_getwmmxregs(child, datap);
break;
case PTRACE_SETWMMXREGS:
ret = ptrace_setwmmxregs(child, datap);
break;
#endif
case PTRACE_GET_THREAD_AREA:
ret = put_user(task_thread_info(child)->tp_value,
datap);
break;
case PTRACE_SET_SYSCALL:
task_thread_info(child)->syscall = data;
ret = 0;
break;
#ifdef CONFIG_CRUNCH
case PTRACE_GETCRUNCHREGS:
ret = ptrace_getcrunchregs(child, datap);
break;
case PTRACE_SETCRUNCHREGS:
ret = ptrace_setcrunchregs(child, datap);
break;
#endif
#ifdef CONFIG_VFP
case PTRACE_GETVFPREGS:
ret = copy_regset_to_user(child,
&user_arm_view, REGSET_VFP,
0, ARM_VFPREGS_SIZE,
datap);
break;
case PTRACE_SETVFPREGS:
ret = copy_regset_from_user(child,
&user_arm_view, REGSET_VFP,
0, ARM_VFPREGS_SIZE,
datap);
break;
#endif
#ifdef CONFIG_HAVE_HW_BREAKPOINT
case PTRACE_GETHBPREGS:
if (ptrace_get_breakpoints(child) < 0)
return -ESRCH;
ret = ptrace_gethbpregs(child, addr,
(unsigned long __user *)data);
ptrace_put_breakpoints(child);
break;
case PTRACE_SETHBPREGS:
if (ptrace_get_breakpoints(child) < 0)
return -ESRCH;
ret = ptrace_sethbpregs(child, addr,
(unsigned long __user *)data);
ptrace_put_breakpoints(child);
break;
#endif
default:
ret = ptrace_request(child, request, addr, data);
break;
}
return ret;
}
| 16,740 |
83,780 | 0 | static void hw_scan_work(struct work_struct *work)
{
struct mac80211_hwsim_data *hwsim =
container_of(work, struct mac80211_hwsim_data, hw_scan.work);
struct cfg80211_scan_request *req = hwsim->hw_scan_request;
int dwell, i;
mutex_lock(&hwsim->mutex);
if (hwsim->scan_chan_idx >= req->n_channels) {
struct cfg80211_scan_info info = {
.aborted = false,
};
wiphy_dbg(hwsim->hw->wiphy, "hw scan complete\n");
ieee80211_scan_completed(hwsim->hw, &info);
hwsim->hw_scan_request = NULL;
hwsim->hw_scan_vif = NULL;
hwsim->tmp_chan = NULL;
mutex_unlock(&hwsim->mutex);
return;
}
wiphy_dbg(hwsim->hw->wiphy, "hw scan %d MHz\n",
req->channels[hwsim->scan_chan_idx]->center_freq);
hwsim->tmp_chan = req->channels[hwsim->scan_chan_idx];
if (hwsim->tmp_chan->flags & (IEEE80211_CHAN_NO_IR |
IEEE80211_CHAN_RADAR) ||
!req->n_ssids) {
dwell = 120;
} else {
dwell = 30;
/* send probes */
for (i = 0; i < req->n_ssids; i++) {
struct sk_buff *probe;
struct ieee80211_mgmt *mgmt;
probe = ieee80211_probereq_get(hwsim->hw,
hwsim->scan_addr,
req->ssids[i].ssid,
req->ssids[i].ssid_len,
req->ie_len);
if (!probe)
continue;
mgmt = (struct ieee80211_mgmt *) probe->data;
memcpy(mgmt->da, req->bssid, ETH_ALEN);
memcpy(mgmt->bssid, req->bssid, ETH_ALEN);
if (req->ie_len)
skb_put_data(probe, req->ie, req->ie_len);
local_bh_disable();
mac80211_hwsim_tx_frame(hwsim->hw, probe,
hwsim->tmp_chan);
local_bh_enable();
}
}
ieee80211_queue_delayed_work(hwsim->hw, &hwsim->hw_scan,
msecs_to_jiffies(dwell));
hwsim->survey_data[hwsim->scan_chan_idx].channel = hwsim->tmp_chan;
hwsim->survey_data[hwsim->scan_chan_idx].start = jiffies;
hwsim->survey_data[hwsim->scan_chan_idx].end =
jiffies + msecs_to_jiffies(dwell);
hwsim->scan_chan_idx++;
mutex_unlock(&hwsim->mutex);
}
| 16,741 |
187,094 | 1 | void SpeechRecognitionManagerImpl::RecognitionAllowedCallback(int session_id,
bool ask_user,
bool is_allowed) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
auto iter = sessions_.find(session_id);
if (iter == sessions_.end())
return;
Session* session = iter->second.get();
if (session->abort_requested)
return;
if (ask_user) {
SpeechRecognitionSessionContext& context = session->context;
context.label = media_stream_manager_->MakeMediaAccessRequest(
context.render_process_id, context.render_frame_id, session_id,
StreamControls(true, false), context.security_origin,
base::BindOnce(
&SpeechRecognitionManagerImpl::MediaRequestPermissionCallback,
weak_factory_.GetWeakPtr(), session_id));
return;
}
if (is_allowed) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&SpeechRecognitionManagerImpl::DispatchEvent,
weak_factory_.GetWeakPtr(), session_id, EVENT_START));
} else {
OnRecognitionError(
session_id, blink::mojom::SpeechRecognitionError(
blink::mojom::SpeechRecognitionErrorCode::kNotAllowed,
blink::mojom::SpeechAudioErrorDetails::kNone));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&SpeechRecognitionManagerImpl::DispatchEvent,
weak_factory_.GetWeakPtr(), session_id, EVENT_ABORT));
}
}
| 16,742 |
50,822 | 0 | isoent_cmp_joliet_identifier(const struct isoent *p1, const struct isoent *p2)
{
const unsigned char *s1, *s2;
int cmp;
int l;
s1 = (const unsigned char *)p1->identifier;
s2 = (const unsigned char *)p2->identifier;
/* Compare File Name */
l = p1->ext_off;
if (l > p2->ext_off)
l = p2->ext_off;
cmp = memcmp(s1, s2, l);
if (cmp != 0)
return (cmp);
if (p1->ext_off < p2->ext_off) {
s2 += l;
l = p2->ext_off - p1->ext_off;
while (l--)
if (0 != *s2++)
return (- *(const unsigned char *)(s2 - 1));
} else if (p1->ext_off > p2->ext_off) {
s1 += l;
l = p1->ext_off - p2->ext_off;
while (l--)
if (0 != *s1++)
return (*(const unsigned char *)(s1 - 1));
}
/* Compare File Name Extension */
if (p1->ext_len == 0 && p2->ext_len == 0)
return (0);
if (p1->ext_len == 2 && p2->ext_len == 2)
return (0);
if (p1->ext_len <= 2)
return (-1);
if (p2->ext_len <= 2)
return (1);
l = p1->ext_len;
if (l > p2->ext_len)
l = p2->ext_len;
s1 = (unsigned char *)(p1->identifier + p1->ext_off);
s2 = (unsigned char *)(p2->identifier + p2->ext_off);
if (l > 1) {
cmp = memcmp(s1, s2, l);
if (cmp != 0)
return (cmp);
}
if (p1->ext_len < p2->ext_len) {
s2 += l;
l = p2->ext_len - p1->ext_len;
while (l--)
if (0 != *s2++)
return (- *(const unsigned char *)(s2 - 1));
} else if (p1->ext_len > p2->ext_len) {
s1 += l;
l = p1->ext_len - p2->ext_len;
while (l--)
if (0 != *s1++)
return (*(const unsigned char *)(s1 - 1));
}
/* Compare File Version Number */
/* No operation. The File Version Number is always one. */
return (cmp);
}
| 16,743 |
65,880 | 0 | nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *supported)
{
struct accessmap *map;
struct svc_export *export;
struct dentry *dentry;
u32 query, result = 0, sresult = 0;
__be32 error;
error = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP);
if (error)
goto out;
export = fhp->fh_export;
dentry = fhp->fh_dentry;
if (d_is_reg(dentry))
map = nfs3_regaccess;
else if (d_is_dir(dentry))
map = nfs3_diraccess;
else
map = nfs3_anyaccess;
query = *access;
for (; map->access; map++) {
if (map->access & query) {
__be32 err2;
sresult |= map->access;
err2 = nfsd_permission(rqstp, export, dentry, map->how);
switch (err2) {
case nfs_ok:
result |= map->access;
break;
/* the following error codes just mean the access was not allowed,
* rather than an error occurred */
case nfserr_rofs:
case nfserr_acces:
case nfserr_perm:
/* simply don't "or" in the access bit. */
break;
default:
error = err2;
goto out;
}
}
}
*access = result;
if (supported)
*supported = sresult;
out:
return error;
}
| 16,744 |
30,686 | 0 | static void set_rx_flow_off(struct caifsock *cf_sk)
{
clear_bit(RX_FLOW_ON_BIT,
(void *) &cf_sk->flow_state);
}
| 16,745 |
83,711 | 0 | int git_index_write_tree(git_oid *oid, git_index *index)
{
git_repository *repo;
assert(oid && index);
repo = INDEX_OWNER(index);
if (repo == NULL)
return create_index_error(-1, "Failed to write tree. "
"the index file is not backed up by an existing repository");
return git_tree__write_index(oid, index, repo);
}
| 16,746 |
90,741 | 0 | static void Np_valueOf(js_State *J)
{
js_Object *self = js_toobject(J, 0);
if (self->type != JS_CNUMBER) js_typeerror(J, "not a number");
js_pushnumber(J, self->u.number);
}
| 16,747 |
153,466 | 0 | void TabStrip::SetDropArrow(
const base::Optional<BrowserRootView::DropIndex>& index) {
if (!index) {
controller_->OnDropIndexUpdate(-1, false);
drop_arrow_.reset();
return;
}
controller_->OnDropIndexUpdate(index->value, index->drop_before);
if (drop_arrow_ && (index == drop_arrow_->index))
return;
bool is_beneath;
gfx::Rect drop_bounds =
GetDropBounds(index->value, index->drop_before, &is_beneath);
if (!drop_arrow_) {
drop_arrow_ = std::make_unique<DropArrow>(*index, !is_beneath, GetWidget());
} else {
drop_arrow_->index = *index;
if (is_beneath == drop_arrow_->point_down) {
drop_arrow_->point_down = !is_beneath;
drop_arrow_->arrow_view->SetImage(
GetDropArrowImage(drop_arrow_->point_down));
}
}
drop_arrow_->arrow_window->SetBounds(drop_bounds);
drop_arrow_->arrow_window->Show();
}
| 16,748 |
157,231 | 0 | bool IsNetworkStateError(blink::WebMediaPlayer::NetworkState state) {
bool result = state == blink::WebMediaPlayer::kNetworkStateFormatError ||
state == blink::WebMediaPlayer::kNetworkStateNetworkError ||
state == blink::WebMediaPlayer::kNetworkStateDecodeError;
DCHECK_EQ(state > blink::WebMediaPlayer::kNetworkStateLoaded, result);
return result;
}
| 16,749 |
67,057 | 0 | static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
{
switch(id){
default : return id;
}
}
| 16,750 |
71,451 | 0 | ModuleExport void UnregisterBGRImage(void)
{
(void) UnregisterMagickInfo("BGRA");
(void) UnregisterMagickInfo("BGR");
}
| 16,751 |
148,760 | 0 | void InterstitialPageImpl::CreateNewWidget(int32_t render_process_id,
int32_t route_id,
blink::WebPopupType popup_type) {
NOTREACHED() << "InterstitialPage does not support showing drop-downs.";
}
| 16,752 |
81,101 | 0 | static int cpu_clock_sample(const clockid_t which_clock,
struct task_struct *p, u64 *sample)
{
switch (CPUCLOCK_WHICH(which_clock)) {
default:
return -EINVAL;
case CPUCLOCK_PROF:
*sample = prof_ticks(p);
break;
case CPUCLOCK_VIRT:
*sample = virt_ticks(p);
break;
case CPUCLOCK_SCHED:
*sample = task_sched_runtime(p);
break;
}
return 0;
}
| 16,753 |
26,261 | 0 | calc_delta_mine(unsigned long delta_exec, unsigned long weight,
struct load_weight *lw)
{
u64 tmp;
/*
* weight can be less than 2^SCHED_LOAD_RESOLUTION for task group sched
* entities since MIN_SHARES = 2. Treat weight as 1 if less than
* 2^SCHED_LOAD_RESOLUTION.
*/
if (likely(weight > (1UL << SCHED_LOAD_RESOLUTION)))
tmp = (u64)delta_exec * scale_load_down(weight);
else
tmp = (u64)delta_exec;
if (!lw->inv_weight) {
unsigned long w = scale_load_down(lw->weight);
if (BITS_PER_LONG > 32 && unlikely(w >= WMULT_CONST))
lw->inv_weight = 1;
else if (unlikely(!w))
lw->inv_weight = WMULT_CONST;
else
lw->inv_weight = WMULT_CONST / w;
}
/*
* Check whether we'd overflow the 64-bit multiplication:
*/
if (unlikely(tmp > WMULT_CONST))
tmp = SRR(SRR(tmp, WMULT_SHIFT/2) * lw->inv_weight,
WMULT_SHIFT/2);
else
tmp = SRR(tmp * lw->inv_weight, WMULT_SHIFT);
return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX);
}
| 16,754 |
80,701 | 0 | GF_Err cslg_dump(GF_Box *a, FILE * trace)
{
GF_CompositionToDecodeBox *p;
p = (GF_CompositionToDecodeBox *)a;
gf_isom_box_dump_start(a, "CompositionToDecodeBox", trace);
fprintf(trace, "compositionToDTSShift=\"%d\" leastDecodeToDisplayDelta=\"%d\" compositionStartTime=\"%d\" compositionEndTime=\"%d\">\n", p->leastDecodeToDisplayDelta, p->greatestDecodeToDisplayDelta, p->compositionStartTime, p->compositionEndTime);
gf_isom_box_dump_done("CompositionToDecodeBox", a, trace);
return GF_OK;
}
| 16,755 |
85,877 | 0 | static size_t dm_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff,
void *addr, size_t bytes, struct iov_iter *i)
{
struct mapped_device *md = dax_get_private(dax_dev);
sector_t sector = pgoff * PAGE_SECTORS;
struct dm_target *ti;
long ret = 0;
int srcu_idx;
ti = dm_dax_get_live_target(md, sector, &srcu_idx);
if (!ti)
goto out;
if (!ti->type->dax_copy_from_iter) {
ret = copy_from_iter(addr, bytes, i);
goto out;
}
ret = ti->type->dax_copy_from_iter(ti, pgoff, addr, bytes, i);
out:
dm_put_live_table(md, srcu_idx);
return ret;
}
| 16,756 |
107,207 | 0 | TestAutoFillManager(TabContents* tab_contents,
TestPersonalDataManager* personal_manager)
: AutoFillManager(tab_contents, personal_manager),
autofill_enabled_(true) {
set_metric_logger(new MockAutoFillMetrics);
}
| 16,757 |
17,941 | 0 | choose_comp(struct sshcomp *comp, char *client, char *server)
{
char *name = match_list(client, server, NULL);
if (name == NULL)
return SSH_ERR_NO_COMPRESS_ALG_MATCH;
if (strcmp(name, "[email protected]") == 0) {
comp->type = COMP_DELAYED;
} else if (strcmp(name, "zlib") == 0) {
comp->type = COMP_ZLIB;
} else if (strcmp(name, "none") == 0) {
comp->type = COMP_NONE;
} else {
return SSH_ERR_INTERNAL_ERROR;
}
comp->name = name;
return 0;
}
| 16,758 |
140,621 | 0 | pp::Instance* OutOfProcessInstance::GetPluginInstance() {
return this;
}
| 16,759 |
121,232 | 0 | void HTMLInputElement::resetListAttributeTargetObserver()
{
if (inDocument())
m_listAttributeTargetObserver = ListAttributeTargetObserver::create(fastGetAttribute(listAttr), this);
else
m_listAttributeTargetObserver = nullptr;
}
| 16,760 |
162,632 | 0 | HeadlessDevToolsManagerDelegate::NetworkDisable(
content::DevToolsAgentHost* agent_host,
int session_id,
int command_id,
const base::DictionaryValue* params) {
std::vector<HeadlessBrowserContext*> browser_contexts =
browser_->GetAllBrowserContexts();
if (browser_contexts.empty())
return CreateSuccessResponse(command_id, nullptr);
SetNetworkConditions(browser_contexts, HeadlessNetworkConditions());
return CreateSuccessResponse(command_id, nullptr);
}
| 16,761 |
162,067 | 0 | RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost(
BrowserContext* browser_context,
StoragePartitionImpl* storage_partition_impl,
SiteInstance* site_instance,
bool is_for_guests_only) {
if (g_render_process_host_factory_) {
return g_render_process_host_factory_->CreateRenderProcessHost(
browser_context, site_instance);
}
if (!storage_partition_impl) {
storage_partition_impl = static_cast<StoragePartitionImpl*>(
BrowserContext::GetStoragePartition(browser_context, site_instance));
}
if (is_for_guests_only && site_instance &&
storage_partition_impl->site_for_service_worker().is_empty()) {
storage_partition_impl->set_site_for_service_worker(
site_instance->GetSiteURL());
}
return new RenderProcessHostImpl(browser_context, storage_partition_impl,
is_for_guests_only);
}
| 16,762 |
107,033 | 0 | QWebNavigationHistory* QQuickWebViewExperimental::navigationHistory() const
{
return d_ptr->navigationHistory.get();
}
| 16,763 |
91,727 | 0 | const char *am_strip_cr(request_rec *r, const char *str)
{
char *output;
const char *cp;
apr_size_t i;
output = apr_palloc(r->pool, strlen(str) + 1);
i = 0;
for (cp = str; *cp; cp++) {
if ((*cp == '\r') && (*(cp + 1) == '\n'))
continue;
output[i++] = *cp;
}
output[i++] = '\0';
return (const char *)output;
}
| 16,764 |
154,493 | 0 | void GLES2DecoderPassthroughImpl::ProcessPendingQueries(bool did_finish) {
ProcessQueries(did_finish);
}
| 16,765 |
73,732 | 0 | static void readTiffBw (const unsigned char *src,
gdImagePtr im,
uint16 photometric,
int startx,
int starty,
int width,
int height,
char has_alpha,
int extra,
int align)
{
int x = startx, y = starty;
(void)has_alpha;
(void)extra;
(void)align;
for (y = starty; y < starty + height; y++) {
for (x = startx; x < startx + width; x++) {
register unsigned char curr = *src++;
register unsigned char mask;
if (photometric == PHOTOMETRIC_MINISWHITE) {
curr = ~curr;
}
for (mask = 0x80; mask != 0 && x < startx + width; mask >>= 1) {
gdImageSetPixel(im, x, y, ((curr & mask) != 0)?0:1);
}
}
}
}
| 16,766 |
158,066 | 0 | void LocalFrameClientImpl::DispatchDidChangeManifest() {
if (web_frame_->Client())
web_frame_->Client()->DidChangeManifest();
}
| 16,767 |
91,274 | 0 | int ipmi_get_my_LUN(struct ipmi_user *user,
unsigned int channel,
unsigned char *address)
{
int index, rv = 0;
user = acquire_ipmi_user(user, &index);
if (!user)
return -ENODEV;
if (channel >= IPMI_MAX_CHANNELS) {
rv = -EINVAL;
} else {
channel = array_index_nospec(channel, IPMI_MAX_CHANNELS);
*address = user->intf->addrinfo[channel].lun;
}
release_ipmi_user(user, index);
return rv;
}
| 16,768 |
141,840 | 0 | void OnUpdated(const JavaRef<jobject>& java_callback,
WebApkInstallResult result,
bool relax_updates,
const std::string& webapk_package) {
JNIEnv* env = base::android::AttachCurrentThread();
Java_WebApkUpdateCallback_onResultFromNative(
env, java_callback, static_cast<int>(result), relax_updates);
}
| 16,769 |
173,459 | 0 | OMX_ERRORTYPE omx_vdec::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_INDEXTYPE paramIndex,
OMX_INOUT OMX_PTR paramData)
{
(void) hComp;
OMX_ERRORTYPE eRet = OMX_ErrorNone;
DEBUG_PRINT_LOW("get_parameter:");
if (m_state == OMX_StateInvalid) {
DEBUG_PRINT_ERROR("Get Param in Invalid State");
return OMX_ErrorInvalidState;
}
if (paramData == NULL) {
DEBUG_PRINT_LOW("Get Param in Invalid paramData");
return OMX_ErrorBadParameter;
}
switch ((unsigned long)paramIndex) {
case OMX_IndexParamPortDefinition: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_PARAM_PORTDEFINITIONTYPE);
OMX_PARAM_PORTDEFINITIONTYPE *portDefn =
(OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamPortDefinition");
eRet = update_portdef(portDefn);
if (eRet == OMX_ErrorNone)
m_port_def = *portDefn;
break;
}
case OMX_IndexParamVideoInit: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_PORT_PARAM_TYPE);
OMX_PORT_PARAM_TYPE *portParamType =
(OMX_PORT_PARAM_TYPE *) paramData;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoInit");
portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
portParamType->nSize = sizeof(OMX_PORT_PARAM_TYPE);
portParamType->nPorts = 2;
portParamType->nStartPortNumber = 0;
break;
}
case OMX_IndexParamVideoPortFormat: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_VIDEO_PARAM_PORTFORMATTYPE);
OMX_VIDEO_PARAM_PORTFORMATTYPE *portFmt =
(OMX_VIDEO_PARAM_PORTFORMATTYPE *)paramData;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoPortFormat");
portFmt->nVersion.nVersion = OMX_SPEC_VERSION;
portFmt->nSize = sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE);
if (0 == portFmt->nPortIndex) {
if (0 == portFmt->nIndex) {
portFmt->eColorFormat = OMX_COLOR_FormatUnused;
portFmt->eCompressionFormat = eCompressionFormat;
} else {
DEBUG_PRINT_ERROR("get_parameter: OMX_IndexParamVideoPortFormat:"\
" NoMore compression formats");
eRet = OMX_ErrorNoMore;
}
} else if (1 == portFmt->nPortIndex) {
portFmt->eCompressionFormat = OMX_VIDEO_CodingUnused;
bool useNonSurfaceMode = false;
#if defined(_ANDROID_) && !defined(FLEXYUV_SUPPORTED)
useNonSurfaceMode = (m_enable_android_native_buffers == OMX_FALSE);
#endif
portFmt->eColorFormat = useNonSurfaceMode ?
getPreferredColorFormatNonSurfaceMode(portFmt->nIndex) :
getPreferredColorFormatDefaultMode(portFmt->nIndex);
if (portFmt->eColorFormat == OMX_COLOR_FormatMax ) {
eRet = OMX_ErrorNoMore;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoPortFormat:"\
" NoMore Color formats");
}
DEBUG_PRINT_HIGH("returning color-format: 0x%x", portFmt->eColorFormat);
} else {
DEBUG_PRINT_ERROR("get_parameter: Bad port index %d",
(int)portFmt->nPortIndex);
eRet = OMX_ErrorBadPortIndex;
}
break;
}
/*Component should support this port definition*/
case OMX_IndexParamAudioInit: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_PORT_PARAM_TYPE);
OMX_PORT_PARAM_TYPE *audioPortParamType =
(OMX_PORT_PARAM_TYPE *) paramData;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamAudioInit");
audioPortParamType->nVersion.nVersion = OMX_SPEC_VERSION;
audioPortParamType->nSize = sizeof(OMX_PORT_PARAM_TYPE);
audioPortParamType->nPorts = 0;
audioPortParamType->nStartPortNumber = 0;
break;
}
/*Component should support this port definition*/
case OMX_IndexParamImageInit: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_PORT_PARAM_TYPE);
OMX_PORT_PARAM_TYPE *imagePortParamType =
(OMX_PORT_PARAM_TYPE *) paramData;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamImageInit");
imagePortParamType->nVersion.nVersion = OMX_SPEC_VERSION;
imagePortParamType->nSize = sizeof(OMX_PORT_PARAM_TYPE);
imagePortParamType->nPorts = 0;
imagePortParamType->nStartPortNumber = 0;
break;
}
/*Component should support this port definition*/
case OMX_IndexParamOtherInit: {
DEBUG_PRINT_ERROR("get_parameter: OMX_IndexParamOtherInit %08x",
paramIndex);
eRet =OMX_ErrorUnsupportedIndex;
break;
}
case OMX_IndexParamStandardComponentRole: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_PARAM_COMPONENTROLETYPE);
OMX_PARAM_COMPONENTROLETYPE *comp_role;
comp_role = (OMX_PARAM_COMPONENTROLETYPE *) paramData;
comp_role->nVersion.nVersion = OMX_SPEC_VERSION;
comp_role->nSize = sizeof(*comp_role);
DEBUG_PRINT_LOW("Getparameter: OMX_IndexParamStandardComponentRole %d",
paramIndex);
strlcpy((char*)comp_role->cRole,(const char*)m_cRole,
OMX_MAX_STRINGNAME_SIZE);
break;
}
/* Added for parameter test */
case OMX_IndexParamPriorityMgmt: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_PRIORITYMGMTTYPE);
OMX_PRIORITYMGMTTYPE *priorityMgmType =
(OMX_PRIORITYMGMTTYPE *) paramData;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamPriorityMgmt");
priorityMgmType->nVersion.nVersion = OMX_SPEC_VERSION;
priorityMgmType->nSize = sizeof(OMX_PRIORITYMGMTTYPE);
break;
}
/* Added for parameter test */
case OMX_IndexParamCompBufferSupplier: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_PARAM_BUFFERSUPPLIERTYPE);
OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplierType =
(OMX_PARAM_BUFFERSUPPLIERTYPE*) paramData;
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamCompBufferSupplier");
bufferSupplierType->nSize = sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE);
bufferSupplierType->nVersion.nVersion = OMX_SPEC_VERSION;
if (0 == bufferSupplierType->nPortIndex)
bufferSupplierType->nPortIndex = OMX_BufferSupplyUnspecified;
else if (1 == bufferSupplierType->nPortIndex)
bufferSupplierType->nPortIndex = OMX_BufferSupplyUnspecified;
else
eRet = OMX_ErrorBadPortIndex;
break;
}
case OMX_IndexParamVideoAvc: {
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoAvc %08x",
paramIndex);
break;
}
case (OMX_INDEXTYPE)QOMX_IndexParamVideoMvc: {
DEBUG_PRINT_LOW("get_parameter: QOMX_IndexParamVideoMvc %08x",
paramIndex);
break;
}
case OMX_IndexParamVideoH263: {
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoH263 %08x",
paramIndex);
break;
}
case OMX_IndexParamVideoMpeg4: {
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoMpeg4 %08x",
paramIndex);
break;
}
case OMX_IndexParamVideoMpeg2: {
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoMpeg2 %08x",
paramIndex);
break;
}
case OMX_IndexParamVideoProfileLevelQuerySupported: {
VALIDATE_OMX_PARAM_DATA(paramData, OMX_VIDEO_PARAM_PROFILELEVELTYPE);
DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoProfileLevelQuerySupported %08x", paramIndex);
OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevelType =
(OMX_VIDEO_PARAM_PROFILELEVELTYPE *)paramData;
eRet = get_supported_profile_level_for_1080p(profileLevelType);
break;
}
#if defined (_ANDROID_HONEYCOMB_) || defined (_ANDROID_ICS_)
case OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage: {
VALIDATE_OMX_PARAM_DATA(paramData, GetAndroidNativeBufferUsageParams);
DEBUG_PRINT_LOW("get_parameter: OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage");
GetAndroidNativeBufferUsageParams* nativeBuffersUsage = (GetAndroidNativeBufferUsageParams *) paramData;
if (nativeBuffersUsage->nPortIndex == OMX_CORE_OUTPUT_PORT_INDEX) {
if (secure_mode && !secure_scaling_to_non_secure_opb) {
nativeBuffersUsage->nUsage = (GRALLOC_USAGE_PRIVATE_MM_HEAP | GRALLOC_USAGE_PROTECTED |
GRALLOC_USAGE_PRIVATE_UNCACHED);
} else {
nativeBuffersUsage->nUsage =
(GRALLOC_USAGE_PRIVATE_IOMMU_HEAP |
GRALLOC_USAGE_PRIVATE_UNCACHED);
}
} else {
DEBUG_PRINT_HIGH("get_parameter: OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage failed!");
eRet = OMX_ErrorBadParameter;
}
}
break;
#endif
#ifdef FLEXYUV_SUPPORTED
case OMX_QcomIndexFlexibleYUVDescription: {
DEBUG_PRINT_LOW("get_parameter: describeColorFormat");
VALIDATE_OMX_PARAM_DATA(paramData, DescribeColorFormatParams);
eRet = describeColorFormat(paramData);
break;
}
#endif
default: {
DEBUG_PRINT_ERROR("get_parameter: unknown param %08x", paramIndex);
eRet =OMX_ErrorUnsupportedIndex;
}
}
DEBUG_PRINT_LOW("get_parameter returning WxH(%d x %d) SxSH(%d x %d)",
drv_ctx.video_resolution.frame_width,
drv_ctx.video_resolution.frame_height,
drv_ctx.video_resolution.stride,
drv_ctx.video_resolution.scan_lines);
return eRet;
}
| 16,770 |
183,088 | 1 | static inline void jmp_rel(struct x86_emulate_ctxt *ctxt, int rel)
{
assign_eip_near(ctxt, ctxt->_eip + rel);
}
| 16,771 |
73,598 | 0 | static MagickBooleanType WritePSDImage(const ImageInfo *image_info,
Image *image,ExceptionInfo *exception)
{
const char
*property;
const StringInfo
*icc_profile;
Image
*base_image,
*next_image;
MagickBooleanType
status;
PSDInfo
psd_info;
register ssize_t
i;
size_t
channel_size,
channelLength,
layer_count,
layer_info_size,
length,
num_channels,
packet_size,
rounded_layer_info_size;
StringInfo
*bim_profile;
/*
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
packet_size=(size_t) (image->depth > 8 ? 6 : 3);
if (image->alpha_trait != UndefinedPixelTrait)
packet_size+=image->depth > 8 ? 2 : 1;
psd_info.version=1;
if ((LocaleCompare(image_info->magick,"PSB") == 0) ||
(image->columns > 30000) || (image->rows > 30000))
psd_info.version=2;
(void) WriteBlob(image,4,(const unsigned char *) "8BPS");
(void) WriteBlobMSBShort(image,psd_info.version); /* version */
for (i=1; i <= 6; i++)
(void) WriteBlobByte(image, 0); /* 6 bytes of reserved */
if (SetImageGray(image,exception) != MagickFalse)
num_channels=(image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL);
else
if ((image_info->type != TrueColorType) && (image_info->type !=
TrueColorAlphaType) && (image->storage_class == PseudoClass))
num_channels=(image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL);
else
{
if (image->storage_class == PseudoClass)
(void) SetImageStorageClass(image,DirectClass,exception);
if (image->colorspace != CMYKColorspace)
num_channels=(image->alpha_trait != UndefinedPixelTrait ? 4UL : 3UL);
else
num_channels=(image->alpha_trait != UndefinedPixelTrait ? 5UL : 4UL);
}
(void) WriteBlobMSBShort(image,(unsigned short) num_channels);
(void) WriteBlobMSBLong(image,(unsigned int) image->rows);
(void) WriteBlobMSBLong(image,(unsigned int) image->columns);
if (IsImageGray(image) != MagickFalse)
{
MagickBooleanType
monochrome;
/*
Write depth & mode.
*/
monochrome=IsImageMonochrome(image) && (image->depth == 1) ?
MagickTrue : MagickFalse;
(void) WriteBlobMSBShort(image,(unsigned short)
(monochrome != MagickFalse ? 1 : image->depth > 8 ? 16 : 8));
(void) WriteBlobMSBShort(image,(unsigned short)
(monochrome != MagickFalse ? BitmapMode : GrayscaleMode));
}
else
{
(void) WriteBlobMSBShort(image,(unsigned short) (image->storage_class ==
PseudoClass ? 8 : image->depth > 8 ? 16 : 8));
if (((image_info->colorspace != UndefinedColorspace) ||
(image->colorspace != CMYKColorspace)) &&
(image_info->colorspace != CMYKColorspace))
{
(void) TransformImageColorspace(image,sRGBColorspace,exception);
(void) WriteBlobMSBShort(image,(unsigned short)
(image->storage_class == PseudoClass ? IndexedMode : RGBMode));
}
else
{
if (image->colorspace != CMYKColorspace)
(void) TransformImageColorspace(image,CMYKColorspace,exception);
(void) WriteBlobMSBShort(image,CMYKMode);
}
}
if ((IsImageGray(image) != MagickFalse) ||
(image->storage_class == DirectClass) || (image->colors > 256))
(void) WriteBlobMSBLong(image,0);
else
{
/*
Write PSD raster colormap.
*/
(void) WriteBlobMSBLong(image,768);
for (i=0; i < (ssize_t) image->colors; i++)
(void) WriteBlobByte(image,ScaleQuantumToChar(image->colormap[i].red));
for ( ; i < 256; i++)
(void) WriteBlobByte(image,0);
for (i=0; i < (ssize_t) image->colors; i++)
(void) WriteBlobByte(image,ScaleQuantumToChar(
image->colormap[i].green));
for ( ; i < 256; i++)
(void) WriteBlobByte(image,0);
for (i=0; i < (ssize_t) image->colors; i++)
(void) WriteBlobByte(image,ScaleQuantumToChar(image->colormap[i].blue));
for ( ; i < 256; i++)
(void) WriteBlobByte(image,0);
}
/*
Image resource block.
*/
length=28; /* 0x03EB */
bim_profile=(StringInfo *) GetImageProfile(image,"8bim");
icc_profile=GetImageProfile(image,"icc");
if (bim_profile != (StringInfo *) NULL)
{
bim_profile=CloneStringInfo(bim_profile);
if (icc_profile != (StringInfo *) NULL)
RemoveICCProfileFromResourceBlock(bim_profile);
RemoveResolutionFromResourceBlock(bim_profile);
length+=PSDQuantum(GetStringInfoLength(bim_profile));
}
if (icc_profile != (const StringInfo *) NULL)
length+=PSDQuantum(GetStringInfoLength(icc_profile))+12;
(void) WriteBlobMSBLong(image,(unsigned int) length);
WriteResolutionResourceBlock(image);
if (bim_profile != (StringInfo *) NULL)
{
(void) WriteBlob(image,GetStringInfoLength(bim_profile),
GetStringInfoDatum(bim_profile));
bim_profile=DestroyStringInfo(bim_profile);
}
if (icc_profile != (StringInfo *) NULL)
{
(void) WriteBlob(image,4,(const unsigned char *) "8BIM");
(void) WriteBlobMSBShort(image,0x0000040F);
(void) WriteBlobMSBShort(image,0);
(void) WriteBlobMSBLong(image,(unsigned int) GetStringInfoLength(
icc_profile));
(void) WriteBlob(image,GetStringInfoLength(icc_profile),
GetStringInfoDatum(icc_profile));
if ((MagickOffsetType) GetStringInfoLength(icc_profile) !=
PSDQuantum(GetStringInfoLength(icc_profile)))
(void) WriteBlobByte(image,0);
}
layer_count=0;
layer_info_size=2;
base_image=GetNextImageInList(image);
if ((image->alpha_trait != UndefinedPixelTrait) && (base_image == (Image *) NULL))
base_image=image;
next_image=base_image;
while ( next_image != NULL )
{
packet_size=next_image->depth > 8 ? 2UL : 1UL;
if (IsImageGray(next_image) != MagickFalse)
num_channels=next_image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL;
else
if (next_image->storage_class == PseudoClass)
num_channels=next_image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL;
else
if (next_image->colorspace != CMYKColorspace)
num_channels=next_image->alpha_trait != UndefinedPixelTrait ? 4UL : 3UL;
else
num_channels=next_image->alpha_trait != UndefinedPixelTrait ? 5UL : 4UL;
channelLength=(size_t) (next_image->columns*next_image->rows*packet_size+2);
layer_info_size+=(size_t) (4*4+2+num_channels*6+(psd_info.version == 1 ? 8 :
16)+4*1+4+num_channels*channelLength);
property=(const char *) GetImageProperty(next_image,"label",exception);
if (property == (const char *) NULL)
layer_info_size+=16;
else
{
size_t
layer_length;
layer_length=strlen(property);
layer_info_size+=8+layer_length+(4-(layer_length % 4));
}
layer_count++;
next_image=GetNextImageInList(next_image);
}
if (layer_count == 0)
(void) SetPSDSize(&psd_info,image,0);
else
{
CompressionType
compression;
(void) SetPSDSize(&psd_info,image,layer_info_size+
(psd_info.version == 1 ? 8 : 16));
if ((layer_info_size/2) != ((layer_info_size+1)/2))
rounded_layer_info_size=layer_info_size+1;
else
rounded_layer_info_size=layer_info_size;
(void) SetPSDSize(&psd_info,image,rounded_layer_info_size);
if (image->alpha_trait != UndefinedPixelTrait)
(void) WriteBlobMSBShort(image,-(unsigned short) layer_count);
else
(void) WriteBlobMSBShort(image,(unsigned short) layer_count);
layer_count=1;
compression=base_image->compression;
for (next_image=base_image; next_image != NULL; )
{
next_image->compression=NoCompression;
(void) WriteBlobMSBLong(image,(unsigned int) next_image->page.y);
(void) WriteBlobMSBLong(image,(unsigned int) next_image->page.x);
(void) WriteBlobMSBLong(image,(unsigned int) (next_image->page.y+
next_image->rows));
(void) WriteBlobMSBLong(image,(unsigned int) (next_image->page.x+
next_image->columns));
packet_size=next_image->depth > 8 ? 2UL : 1UL;
channel_size=(unsigned int) ((packet_size*next_image->rows*
next_image->columns)+2);
if ((IsImageGray(next_image) != MagickFalse) ||
(next_image->storage_class == PseudoClass))
{
(void) WriteBlobMSBShort(image,(unsigned short)
(next_image->alpha_trait != UndefinedPixelTrait ? 2 : 1));
(void) WriteBlobMSBShort(image,0);
(void) SetPSDSize(&psd_info,image,channel_size);
if (next_image->alpha_trait != UndefinedPixelTrait)
{
(void) WriteBlobMSBShort(image,(unsigned short) -1);
(void) SetPSDSize(&psd_info,image,channel_size);
}
}
else
if (next_image->colorspace != CMYKColorspace)
{
(void) WriteBlobMSBShort(image,(unsigned short)
(next_image->alpha_trait != UndefinedPixelTrait ? 4 : 3));
(void) WriteBlobMSBShort(image,0);
(void) SetPSDSize(&psd_info,image,channel_size);
(void) WriteBlobMSBShort(image,1);
(void) SetPSDSize(&psd_info,image,channel_size);
(void) WriteBlobMSBShort(image,2);
(void) SetPSDSize(&psd_info,image,channel_size);
if (next_image->alpha_trait != UndefinedPixelTrait)
{
(void) WriteBlobMSBShort(image,(unsigned short) -1);
(void) SetPSDSize(&psd_info,image,channel_size);
}
}
else
{
(void) WriteBlobMSBShort(image,(unsigned short)
(next_image->alpha_trait ? 5 : 4));
(void) WriteBlobMSBShort(image,0);
(void) SetPSDSize(&psd_info,image,channel_size);
(void) WriteBlobMSBShort(image,1);
(void) SetPSDSize(&psd_info,image,channel_size);
(void) WriteBlobMSBShort(image,2);
(void) SetPSDSize(&psd_info,image,channel_size);
(void) WriteBlobMSBShort(image,3);
(void) SetPSDSize(&psd_info,image,channel_size);
if (next_image->alpha_trait)
{
(void) WriteBlobMSBShort(image,(unsigned short) -1);
(void) SetPSDSize(&psd_info,image,channel_size);
}
}
(void) WriteBlob(image,4,(const unsigned char *) "8BIM");
(void) WriteBlob(image,4,(const unsigned char *)
CompositeOperatorToPSDBlendMode(next_image->compose));
(void) WriteBlobByte(image,255); /* layer opacity */
(void) WriteBlobByte(image,0);
(void) WriteBlobByte(image,next_image->compose==NoCompositeOp ?
1 << 0x02 : 1); /* layer properties - visible, etc. */
(void) WriteBlobByte(image,0);
property=(const char *) GetImageProperty(next_image,"label",exception);
if (property == (const char *) NULL)
{
char
layer_name[MagickPathExtent];
(void) WriteBlobMSBLong(image,16);
(void) WriteBlobMSBLong(image,0);
(void) WriteBlobMSBLong(image,0);
(void) FormatLocaleString(layer_name,MagickPathExtent,"L%04ld",(long)
layer_count++);
WritePascalString(image,layer_name,4);
}
else
{
size_t
label_length;
label_length=strlen(property);
(void) WriteBlobMSBLong(image,(unsigned int) (label_length+(4-
(label_length % 4))+8));
(void) WriteBlobMSBLong(image,0);
(void) WriteBlobMSBLong(image,0);
WritePascalString(image,property,4);
}
next_image=GetNextImageInList(next_image);
}
/*
Now the image data!
*/
next_image=base_image;
while (next_image != NULL)
{
status=WriteImageChannels(&psd_info,image_info,image,next_image,
MagickTrue,exception);
next_image=GetNextImageInList(next_image);
}
(void) WriteBlobMSBLong(image,0); /* user mask data */
base_image->compression=compression;
}
/*
Write composite image.
*/
if (status != MagickFalse)
status=WriteImageChannels(&psd_info,image_info,image,image,MagickFalse,
exception);
(void) CloseBlob(image);
return(status);
}
| 16,772 |
15,113 | 0 | PHP_FUNCTION(imagecreatefromjpeg)
{
_php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG, "JPEG", gdImageCreateFromJpeg, gdImageCreateFromJpegCtx);
}
| 16,773 |
100,524 | 0 | ChildProcessSecurityPolicy* ChildProcessSecurityPolicy::GetInstance() {
return Singleton<ChildProcessSecurityPolicy>::get();
}
| 16,774 |
84,891 | 0 | sess_auth_kerberos(struct sess_data *sess_data)
{
int rc = 0;
struct smb_hdr *smb_buf;
SESSION_SETUP_ANDX *pSMB;
char *bcc_ptr;
struct cifs_ses *ses = sess_data->ses;
__u32 capabilities;
__u16 bytes_remaining;
struct key *spnego_key = NULL;
struct cifs_spnego_msg *msg;
u16 blob_len;
/* extended security */
/* wct = 12 */
rc = sess_alloc_buffer(sess_data, 12);
if (rc)
goto out;
pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base;
bcc_ptr = sess_data->iov[2].iov_base;
capabilities = cifs_ssetup_hdr(ses, pSMB);
spnego_key = cifs_get_spnego_key(ses);
if (IS_ERR(spnego_key)) {
rc = PTR_ERR(spnego_key);
spnego_key = NULL;
goto out;
}
msg = spnego_key->payload.data[0];
/*
* check version field to make sure that cifs.upcall is
* sending us a response in an expected form
*/
if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) {
cifs_dbg(VFS,
"incorrect version of cifs.upcall (expected %d but got %d)",
CIFS_SPNEGO_UPCALL_VERSION, msg->version);
rc = -EKEYREJECTED;
goto out_put_spnego_key;
}
ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len,
GFP_KERNEL);
if (!ses->auth_key.response) {
cifs_dbg(VFS, "Kerberos can't allocate (%u bytes) memory",
msg->sesskey_len);
rc = -ENOMEM;
goto out_put_spnego_key;
}
ses->auth_key.len = msg->sesskey_len;
pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
capabilities |= CAP_EXTENDED_SECURITY;
pSMB->req.Capabilities = cpu_to_le32(capabilities);
sess_data->iov[1].iov_base = msg->data + msg->sesskey_len;
sess_data->iov[1].iov_len = msg->secblob_len;
pSMB->req.SecurityBlobLength = cpu_to_le16(sess_data->iov[1].iov_len);
if (ses->capabilities & CAP_UNICODE) {
/* unicode strings must be word aligned */
if ((sess_data->iov[0].iov_len
+ sess_data->iov[1].iov_len) % 2) {
*bcc_ptr = 0;
bcc_ptr++;
}
unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp);
unicode_domain_string(&bcc_ptr, ses, sess_data->nls_cp);
} else {
/* BB: is this right? */
ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp);
}
sess_data->iov[2].iov_len = (long) bcc_ptr -
(long) sess_data->iov[2].iov_base;
rc = sess_sendreceive(sess_data);
if (rc)
goto out_put_spnego_key;
pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base;
smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base;
if (smb_buf->WordCount != 4) {
rc = -EIO;
cifs_dbg(VFS, "bad word count %d\n", smb_buf->WordCount);
goto out_put_spnego_key;
}
if (le16_to_cpu(pSMB->resp.Action) & GUEST_LOGIN)
cifs_dbg(FYI, "Guest login\n"); /* BB mark SesInfo struct? */
ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */
cifs_dbg(FYI, "UID = %llu\n", ses->Suid);
bytes_remaining = get_bcc(smb_buf);
bcc_ptr = pByteArea(smb_buf);
blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength);
if (blob_len > bytes_remaining) {
cifs_dbg(VFS, "bad security blob length %d\n",
blob_len);
rc = -EINVAL;
goto out_put_spnego_key;
}
bcc_ptr += blob_len;
bytes_remaining -= blob_len;
/* BB check if Unicode and decode strings */
if (bytes_remaining == 0) {
/* no string area to decode, do nothing */
} else if (smb_buf->Flags2 & SMBFLG2_UNICODE) {
/* unicode string area must be word-aligned */
if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) {
++bcc_ptr;
--bytes_remaining;
}
decode_unicode_ssetup(&bcc_ptr, bytes_remaining, ses,
sess_data->nls_cp);
} else {
decode_ascii_ssetup(&bcc_ptr, bytes_remaining, ses,
sess_data->nls_cp);
}
rc = sess_establish_session(sess_data);
out_put_spnego_key:
key_invalidate(spnego_key);
key_put(spnego_key);
out:
sess_data->result = rc;
sess_data->func = NULL;
sess_free_buffer(sess_data);
kfree(ses->auth_key.response);
ses->auth_key.response = NULL;
}
| 16,775 |
141,349 | 0 | DOMWindow* Document::open(v8::Isolate* isolate,
const USVStringOrTrustedURL& string_or_url,
const AtomicString& name,
const AtomicString& features,
ExceptionState& exception_state) {
if (!domWindow()) {
exception_state.ThrowDOMException(DOMExceptionCode::kInvalidAccessError,
"The document has no window associated.");
return nullptr;
}
return domWindow()->open(isolate, string_or_url, name, features,
exception_state);
}
| 16,776 |
31,938 | 0 | perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
struct task_struct *task,
perf_overflow_handler_t overflow_handler,
void *context)
{
struct perf_event_context *ctx;
struct perf_event *event;
int err;
/*
* Get the target context (task or percpu):
*/
event = perf_event_alloc(attr, cpu, task, NULL, NULL,
overflow_handler, context);
if (IS_ERR(event)) {
err = PTR_ERR(event);
goto err;
}
ctx = find_get_context(event->pmu, task, cpu);
if (IS_ERR(ctx)) {
err = PTR_ERR(ctx);
goto err_free;
}
WARN_ON_ONCE(ctx->parent_ctx);
mutex_lock(&ctx->mutex);
perf_install_in_context(ctx, event, cpu);
++ctx->generation;
perf_unpin_context(ctx);
mutex_unlock(&ctx->mutex);
return event;
err_free:
free_event(event);
err:
return ERR_PTR(err);
}
| 16,777 |
99,963 | 0 | bool PluginInstance::Start(const GURL& url,
char** const param_names,
char** const param_values,
int param_count,
bool load_manually) {
load_manually_ = load_manually;
unsigned short mode = load_manually_ ? NP_FULL : NP_EMBED;
npp_->ndata = this;
NPError err = NPP_New(mode, param_count,
const_cast<char **>(param_names), const_cast<char **>(param_values));
return err == NPERR_NO_ERROR;
}
| 16,778 |
150,413 | 0 | void ClientControlledShellSurface::UpdateFrame() {
if (!widget_)
return;
gfx::Rect work_area =
display::Screen::GetScreen()
->GetDisplayNearestWindow(widget_->GetNativeWindow())
.work_area();
ash::wm::WindowState* window_state = GetWindowState();
bool enable_wide_frame = GetFrameView()->GetVisible() &&
window_state->IsMaximizedOrFullscreenOrPinned() &&
work_area.width() != geometry().width();
if (enable_wide_frame) {
if (!wide_frame_) {
wide_frame_ = std::make_unique<ash::WideFrameView>(widget_);
ash::ImmersiveFullscreenController::EnableForWidget(widget_, false);
wide_frame_->Init(immersive_fullscreen_controller_.get());
wide_frame_->header_view()->GetFrameHeader()->SetFrameTextOverride(
GetFrameView()
->GetHeaderView()
->GetFrameHeader()
->frame_text_override());
wide_frame_->GetWidget()->Show();
InstallCustomWindowTargeter();
UpdateCaptionButtonModel();
}
} else {
if (wide_frame_) {
ash::ImmersiveFullscreenController::EnableForWidget(widget_, false);
wide_frame_.reset();
GetFrameView()->InitImmersiveFullscreenControllerForView(
immersive_fullscreen_controller_.get());
InstallCustomWindowTargeter();
UpdateCaptionButtonModel();
}
UpdateFrameWidth();
}
UpdateAutoHideFrame();
}
| 16,779 |
99,608 | 0 | void InterstitialPage::SetSize(const gfx::Size& size) {
#if defined(OS_WIN) || defined(OS_LINUX)
if (render_view_host_->view())
render_view_host_->view()->SetSize(size);
#else
NOTIMPLEMENTED();
#endif
}
| 16,780 |
8,139 | 0 | void Gfx::opSetCharWidth(Object args[], int numArgs) {
out->type3D0(state, args[0].getNum(), args[1].getNum());
}
| 16,781 |
148,899 | 0 | void RenderFrameHostManager::OnDidStartLoading() {
for (const auto& pair : proxy_hosts_) {
pair.second->Send(
new FrameMsg_DidStartLoading(pair.second->GetRoutingID()));
}
}
| 16,782 |
46,222 | 0 | static bool generic_pkt_to_tuple(const struct sk_buff *skb,
unsigned int dataoff,
struct nf_conntrack_tuple *tuple)
{
tuple->src.u.all = 0;
tuple->dst.u.all = 0;
return true;
}
| 16,783 |
92,514 | 0 | void cpu_load_update_nohz_start(void)
{
struct rq *this_rq = this_rq();
/*
* This is all lockless but should be fine. If weighted_cpuload changes
* concurrently we'll exit nohz. And cpu_load write can race with
* cpu_load_update_idle() but both updater would be writing the same.
*/
this_rq->cpu_load[0] = weighted_cpuload(this_rq);
}
| 16,784 |
138,686 | 0 | GlobalFrameRoutingId RenderFrameHostImpl::GetGlobalFrameRoutingId() {
return GlobalFrameRoutingId(GetProcess()->GetID(), GetRoutingID());
}
| 16,785 |
127,543 | 0 | void LayerWebKitThread::updateTextureContents(double scale)
{
if (m_contentsScale != scale) {
m_contentsScale = scale;
if (drawsContent())
setNeedsDisplay();
}
updateTextureContentsIfNeeded();
if (includeVisibility()) {
RenderLayer* renderLayer(static_cast<RenderLayerBacking*>(m_owner->client())->owningLayer());
bool isVisible(renderLayer->hasVisibleContent() || renderLayer->hasVisibleDescendant());
if (m_isVisible != isVisible) {
m_isVisible = isVisible;
setNeedsCommit();
}
}
size_t listSize = m_sublayers.size();
for (size_t i = 0; i < listSize; ++i)
m_sublayers[i]->updateTextureContents(scale);
listSize = m_overlays.size();
for (size_t i = 0; i < listSize; ++i)
m_overlays[i]->updateTextureContents(scale);
if (maskLayer())
maskLayer()->updateTextureContents(scale);
if (replicaLayer())
replicaLayer()->updateTextureContents(scale);
}
| 16,786 |
17,358 | 0 | seedrand ()
{
struct timeval tv;
gettimeofday (&tv, NULL);
sbrand (tv.tv_sec ^ tv.tv_usec ^ getpid ());
}
| 16,787 |
136,398 | 0 | PaintArtifactCompositor::ScrollHitTestLayerForPendingLayer(
const PaintArtifact& paint_artifact,
const PendingLayer& pending_layer,
gfx::Vector2dF& layer_offset) {
const auto* scroll_offset_node =
ScrollTranslationForScrollHitTestLayer(paint_artifact, pending_layer);
if (!scroll_offset_node)
return nullptr;
const auto& scroll_node = *scroll_offset_node->ScrollNode();
auto scroll_element_id = scroll_node.GetCompositorElementId();
scoped_refptr<cc::Layer> scroll_layer;
for (auto& existing_layer : scroll_hit_test_layers_) {
if (existing_layer && existing_layer->element_id() == scroll_element_id)
scroll_layer = existing_layer;
}
if (!scroll_layer) {
scroll_layer = cc::Layer::Create();
scroll_layer->SetElementId(scroll_element_id);
}
auto offset = scroll_node.ContainerRect().Location();
layer_offset = gfx::Vector2dF(offset.X(), offset.Y());
auto bounds = scroll_node.ContainerRect().Size();
scroll_layer->SetScrollable(static_cast<gfx::Size>(bounds));
scroll_layer->SetBounds(static_cast<gfx::Size>(bounds));
scroll_layer->set_did_scroll_callback(scroll_callback_);
return scroll_layer;
}
| 16,788 |
131,197 | 0 | static void activityLoggingGetterPerWorldBindingsLongAttributeAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->GetCurrentContext());
if (contextData && contextData->activityLogger())
contextData->activityLogger()->log("TestObjectPython.activityLoggingGetterPerWorldBindingsLongAttribute", 0, 0, "Getter");
TestObjectPythonV8Internal::activityLoggingGetterPerWorldBindingsLongAttributeAttributeGetterForMainWorld(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 16,789 |
152,974 | 0 | void PDFiumEngine::Form_Beep(IPDF_JSPLATFORM* param, int type) {
}
| 16,790 |
21,059 | 0 | static int mem_cgroup_force_empty_list(struct mem_cgroup *memcg,
int node, int zid, enum lru_list lru)
{
struct mem_cgroup_per_zone *mz;
unsigned long flags, loop;
struct list_head *list;
struct page *busy;
struct zone *zone;
int ret = 0;
zone = &NODE_DATA(node)->node_zones[zid];
mz = mem_cgroup_zoneinfo(memcg, node, zid);
list = &mz->lruvec.lists[lru];
loop = MEM_CGROUP_ZSTAT(mz, lru);
/* give some margin against EBUSY etc...*/
loop += 256;
busy = NULL;
while (loop--) {
struct page_cgroup *pc;
struct page *page;
ret = 0;
spin_lock_irqsave(&zone->lru_lock, flags);
if (list_empty(list)) {
spin_unlock_irqrestore(&zone->lru_lock, flags);
break;
}
page = list_entry(list->prev, struct page, lru);
if (busy == page) {
list_move(&page->lru, list);
busy = NULL;
spin_unlock_irqrestore(&zone->lru_lock, flags);
continue;
}
spin_unlock_irqrestore(&zone->lru_lock, flags);
pc = lookup_page_cgroup(page);
ret = mem_cgroup_move_parent(page, pc, memcg, GFP_KERNEL);
if (ret == -ENOMEM || ret == -EINTR)
break;
if (ret == -EBUSY || ret == -EINVAL) {
/* found lock contention or "pc" is obsolete. */
busy = page;
cond_resched();
} else
busy = NULL;
}
if (!ret && !list_empty(list))
return -EBUSY;
return ret;
}
| 16,791 |
38,225 | 0 | static int refill_pi_state_cache(void)
{
struct futex_pi_state *pi_state;
if (likely(current->pi_state_cache))
return 0;
pi_state = kzalloc(sizeof(*pi_state), GFP_KERNEL);
if (!pi_state)
return -ENOMEM;
INIT_LIST_HEAD(&pi_state->list);
/* pi_mutex gets initialized later */
pi_state->owner = NULL;
atomic_set(&pi_state->refcount, 1);
pi_state->key = FUTEX_KEY_INIT;
current->pi_state_cache = pi_state;
return 0;
}
| 16,792 |
48,579 | 0 | static pci_ers_result_t vfio_pci_aer_err_detected(struct pci_dev *pdev,
pci_channel_state_t state)
{
struct vfio_pci_device *vdev;
struct vfio_device *device;
device = vfio_device_get_from_dev(&pdev->dev);
if (device == NULL)
return PCI_ERS_RESULT_DISCONNECT;
vdev = vfio_device_data(device);
if (vdev == NULL) {
vfio_device_put(device);
return PCI_ERS_RESULT_DISCONNECT;
}
mutex_lock(&vdev->igate);
if (vdev->err_trigger)
eventfd_signal(vdev->err_trigger, 1);
mutex_unlock(&vdev->igate);
vfio_device_put(device);
return PCI_ERS_RESULT_CAN_RECOVER;
}
| 16,793 |
34,293 | 0 | int btrfs_dirty_inode(struct inode *inode)
{
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans;
int ret;
if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags))
return 0;
trans = btrfs_join_transaction(root);
if (IS_ERR(trans))
return PTR_ERR(trans);
ret = btrfs_update_inode(trans, root, inode);
if (ret && ret == -ENOSPC) {
/* whoops, lets try again with the full transaction */
btrfs_end_transaction(trans, root);
trans = btrfs_start_transaction(root, 1);
if (IS_ERR(trans))
return PTR_ERR(trans);
ret = btrfs_update_inode(trans, root, inode);
}
btrfs_end_transaction(trans, root);
if (BTRFS_I(inode)->delayed_node)
btrfs_balance_delayed_items(root);
return ret;
}
| 16,794 |
59,916 | 0 | static int uas_suspend(struct usb_interface *intf, pm_message_t message)
{
struct Scsi_Host *shost = usb_get_intfdata(intf);
struct uas_dev_info *devinfo = (struct uas_dev_info *)shost->hostdata;
if (uas_wait_for_pending_cmnds(devinfo) != 0) {
shost_printk(KERN_ERR, shost, "%s: timed out\n", __func__);
return -ETIME;
}
return 0;
}
| 16,795 |
169,061 | 0 | void OfflinePageModelImpl::GetPagesByURL(
const GURL& url,
URLSearchMode url_search_mode,
const MultipleOfflinePageItemCallback& callback) {
OfflinePageModelQueryBuilder builder;
builder.SetUrls(OfflinePageModelQuery::Requirement::INCLUDE_MATCHING,
std::vector<GURL>({url}), url_search_mode,
true /* strip_fragment */);
RunWhenLoaded(
base::Bind(&OfflinePageModelImpl::GetPagesMatchingQueryWhenLoadDone,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(builder.Build(GetPolicyController())), callback));
}
| 16,796 |
106,745 | 0 | LRESULT WebView::onWindowPositionChangedEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled)
{
if (reinterpret_cast<WINDOWPOS*>(lParam)->flags & SWP_SHOWWINDOW)
updateActiveStateSoon();
handled = false;
return 0;
}
| 16,797 |
90,246 | 0 | static void set_maintenance_mode(void *send_info, bool enable)
{
struct smi_info *smi_info = send_info;
if (!enable)
atomic_set(&smi_info->req_events, 0);
}
| 16,798 |
178,879 | 1 | static void update_open_stateflags(struct nfs4_state *state, mode_t open_flags)
{
switch (open_flags) {
case FMODE_WRITE:
state->n_wronly++;
break;
case FMODE_READ:
state->n_rdonly++;
break;
case FMODE_READ|FMODE_WRITE:
state->n_rdwr++;
}
nfs4_state_set_mode_locked(state, state->state | open_flags);
}
| 16,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.