unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
165,501 | 0 | void ContentSecurityPolicy::BindToExecutionContext(
ExecutionContext* execution_context) {
execution_context_ = execution_context;
ApplyPolicySideEffectsToExecutionContext();
}
| 13,400 |
51,446 | 0 | void gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg)
{
im->saveAlphaFlag = saveAlphaArg;
}
| 13,401 |
135,813 | 0 | void SelectionEditor::AssertSelectionValid() const {
#if DCHECK_IS_ON()
const_cast<SelectionEditor*>(this)->selection_.dom_tree_version_ =
GetDocument().DomTreeVersion();
#endif
selection_.AssertValidFor(GetDocument());
}
| 13,402 |
78,249 | 0 | static int cac_parse_cardurl(sc_card_t *card, cac_private_data_t *priv, cac_card_url_t *val, int len)
{
cac_object_t new_object;
const cac_object_t *obj;
unsigned short object_id;
int r;
r = cac_path_from_cardurl(card, &new_object.path, val, len);
if (r != SC_SUCCESS) {
return r;
}
switch (val->cardApplicationType) {
case CAC_APP_TYPE_PKI:
/* we don't want to overflow the cac_label array. This test could
* go way if we create a label function that will create a unique label
* from a cert index.
*/
if (priv->cert_next >= MAX_CAC_SLOTS)
break; /* don't fail just because we have more certs than we can support */
new_object.name = cac_labels[priv->cert_next];
new_object.fd = priv->cert_next+1;
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE,"CARDURL: pki_object found, cert_next=%d (%s),", priv->cert_next, new_object.name);
cac_add_object_to_list(&priv->pki_list, &new_object);
priv->cert_next++;
break;
case CAC_APP_TYPE_GENERAL:
object_id = bebytes2ushort(val->objectID);
obj = cac_find_obj_by_id(object_id);
if (obj == NULL)
break; /* don't fail just because we don't recognize the object */
new_object.name = obj->name;
new_object.fd = 0;
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE,"CARDURL: gen_object found, objectID=%x (%s),", object_id, new_object.name);
cac_add_object_to_list(&priv->general_list, &new_object);
break;
case CAC_APP_TYPE_SKI:
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE,"CARDURL: ski_object found");
break;
default:
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE,"CARDURL: unknown object_object found (type=0x%02x)", val->cardApplicationType);
/* don't fail just because there is an unknown object in the CCC */
break;
}
return SC_SUCCESS;
}
| 13,403 |
27,442 | 0 | static void ipip6_tunnel_clone_6rd(struct net_device *dev, struct sit_net *sitn)
{
#ifdef CONFIG_IPV6_SIT_6RD
struct ip_tunnel *t = netdev_priv(dev);
if (t->dev == sitn->fb_tunnel_dev) {
ipv6_addr_set(&t->ip6rd.prefix, htonl(0x20020000), 0, 0, 0);
t->ip6rd.relay_prefix = 0;
t->ip6rd.prefixlen = 16;
t->ip6rd.relay_prefixlen = 0;
} else {
struct ip_tunnel *t0 = netdev_priv(sitn->fb_tunnel_dev);
memcpy(&t->ip6rd, &t0->ip6rd, sizeof(t->ip6rd));
}
#endif
}
| 13,404 |
131,435 | 0 | static void limitedWithInvalidMissingDefaultAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
{
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
String resultValue = imp->fastGetAttribute(HTMLNames::limitedwithinvalidmissingdefaultattributeAttr);
if (resultValue.isEmpty()) {
resultValue = "auto";
} else if (equalIgnoringCase(resultValue, "ltr")) {
resultValue = "ltr";
} else if (equalIgnoringCase(resultValue, "rtl")) {
resultValue = "rtl";
} else if (equalIgnoringCase(resultValue, "auto")) {
resultValue = "auto";
} else {
resultValue = "ltr";
}
v8SetReturnValueString(info, resultValue, info.GetIsolate());
}
| 13,405 |
48,284 | 0 | update_output_file (TIFF **tiffout, char *mode, int autoindex,
char *outname, unsigned int *page)
{
static int findex = 0; /* file sequence indicator */
char *sep;
char filenum[16];
char export_ext[16];
char exportname[PATH_MAX];
if (autoindex && (*tiffout != NULL))
{
/* Close any export file that was previously opened */
TIFFClose (*tiffout);
*tiffout = NULL;
}
strcpy (export_ext, ".tiff");
memset (exportname, '\0', PATH_MAX);
/* Leave room for page number portion of the new filename */
strncpy (exportname, outname, PATH_MAX - 16);
if (*tiffout == NULL) /* This is a new export file */
{
if (autoindex)
{ /* create a new filename for each export */
findex++;
if ((sep = strstr(exportname, ".tif")) || (sep = strstr(exportname, ".TIF")))
{
strncpy (export_ext, sep, 5);
*sep = '\0';
}
else
strncpy (export_ext, ".tiff", 5);
export_ext[5] = '\0';
/* MAX_EXPORT_PAGES limited to 6 digits to prevent string overflow of pathname */
if (findex > MAX_EXPORT_PAGES)
{
TIFFError("update_output_file", "Maximum of %d pages per file exceeded", MAX_EXPORT_PAGES);
return 1;
}
snprintf(filenum, sizeof(filenum), "-%03d%s", findex, export_ext);
filenum[14] = '\0';
strncat (exportname, filenum, 15);
}
exportname[PATH_MAX - 1] = '\0';
*tiffout = TIFFOpen(exportname, mode);
if (*tiffout == NULL)
{
TIFFError("update_output_file", "Unable to open output file %s", exportname);
return 1;
}
*page = 0;
return 0;
}
else
(*page)++;
return 0;
} /* end update_output_file */
| 13,406 |
56,252 | 0 | static void __swiotlb_sync_single_for_cpu(struct device *dev,
dma_addr_t dev_addr, size_t size,
enum dma_data_direction dir)
{
if (!is_device_dma_coherent(dev))
__dma_unmap_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
swiotlb_sync_single_for_cpu(dev, dev_addr, size, dir);
}
| 13,407 |
30,649 | 0 | static void irda_getvalue_confirm(int result, __u16 obj_id,
struct ias_value *value, void *priv)
{
struct irda_sock *self;
self = priv;
if (!self) {
IRDA_WARNING("%s: lost myself!\n", __func__);
return;
}
IRDA_DEBUG(2, "%s(%p)\n", __func__, self);
/* We probably don't need to make any more queries */
iriap_close(self->iriap);
self->iriap = NULL;
/* Check if request succeeded */
if (result != IAS_SUCCESS) {
IRDA_DEBUG(1, "%s(), IAS query failed! (%d)\n", __func__,
result);
self->errno = result; /* We really need it later */
/* Wake up any processes waiting for result */
wake_up_interruptible(&self->query_wait);
return;
}
/* Pass the object to the caller (so the caller must delete it) */
self->ias_result = value;
self->errno = 0;
/* Wake up any processes waiting for result */
wake_up_interruptible(&self->query_wait);
}
| 13,408 |
96,199 | 0 | int sm_force_attribute_rewrite(p_fm_config_conx_hdlt hdl, fm_mgr_type_t mgr, int argc, char *argv[]) {
fm_mgr_config_errno_t res;
fm_msg_ret_code_t ret_code;
int attrRewrite = 0;
if (argc > 1) {
printf("Error: only 1 argument expected\n");
return 0;
}
if (argc == 1) {
attrRewrite = atol(argv[0]);
if (attrRewrite < 0 || attrRewrite > 1) {
printf("Error: attrRewrite must be either 0 (disable) or 1 (enable)\n");
return 0;
}
}
if((res = fm_mgr_simple_query(hdl, FM_ACT_GET, FM_DT_SM_FORCE_ATTRIBUTE_REWRITE, mgr, sizeof(attrRewrite), (void*) &attrRewrite, &ret_code)) != FM_CONF_OK)
{
fprintf(stderr, "sm_force_attribute_rewrite: Failed to retrieve data: \n"
"\tError:(%d) %s \n\tRet code:(%d) %s\n",
res, fm_mgr_get_error_str(res),ret_code,
fm_mgr_get_resp_error_str(ret_code));
} else {
printf("Successfully sent set to %d of force attribute rewriting to local SM instance\n", attrRewrite);
}
return 0;
}
| 13,409 |
2,795 | 0 | gs_setdevice_no_erase(gs_gstate * pgs, gx_device * dev)
{
int open_code = 0, code;
gs_lib_ctx_t *libctx = gs_lib_ctx_get_interp_instance(pgs->memory);
/* If the ICC manager is not yet initialized, set it up now. But only
if we have file io capability now */
if (libctx->io_device_table != NULL) {
cmm_dev_profile_t *dev_profile;
if (pgs->icc_manager->lab_profile == NULL) { /* pick one not set externally */
gsicc_init_iccmanager(pgs);
}
/* Also, if the device profile is not yet set then take care of that
before we start filling pages, if we can */
/* Although device methods should not be NULL, they are not completely filled in until
* gx_device_fill_in_procs is called, and its possible for us to get here before this
* happens, so we *must* make sure the method is not NULL before we use it.
*/
if (dev->procs.get_profile != NULL) {
code = dev_proc(dev, get_profile)(dev, &dev_profile);
if (code < 0) {
return(code);
}
if (dev_profile == NULL ||
dev_profile->device_profile[gsDEFAULTPROFILE] == NULL) {
if ((code = gsicc_init_device_profile_struct(dev, NULL,
gsDEFAULTPROFILE)) < 0)
return(code);
/* set the intent too */
if ((code = gsicc_set_device_profile_intent(dev, gsRINOTSPECIFIED,
gsDEFAULTPROFILE)) < 0)
return(code);
}
}
}
/* Initialize the device */
if (!dev->is_open) {
gx_device_fill_in_procs(dev);
/* If we have not yet done so, and if we can, set the device profile
* Doing so *before* the device is opened means that a device which
* opens other devices can pass a profile on - for example, pswrite
* also opens a bbox device
*/
if (libctx->io_device_table != NULL) {
cmm_dev_profile_t *dev_profile;
/* Although device methods should not be NULL, they are not completely filled in until
* gx_device_fill_in_procs is called, and its possible for us to get here before this
* happens, so we *must* make sure the method is not NULL before we use it.
*/
if (dev->procs.get_profile != NULL) {
code = dev_proc(dev, get_profile)(dev, &dev_profile);
if (code < 0) {
return(code);
}
if (dev_profile == NULL ||
dev_profile->device_profile[gsDEFAULTPROFILE] == NULL) {
if ((code = gsicc_init_device_profile_struct(dev, NULL,
gsDEFAULTPROFILE)) < 0)
return(code);
}
}
}
if (gs_device_is_memory(dev)) {
/* Set the target to the current device. */
gx_device *odev = gs_currentdevice_inline(pgs);
while (odev != 0 && gs_device_is_memory(odev))
odev = ((gx_device_memory *)odev)->target;
gx_device_set_target(((gx_device_forward *)dev), odev);
}
code = open_code = gs_opendevice(dev);
if (code < 0)
return code;
}
gs_setdevice_no_init(pgs, dev);
pgs->ctm_default_set = false;
if ((code = gs_initmatrix(pgs)) < 0 ||
(code = gs_initclip(pgs)) < 0
)
return code;
/* If we were in a charpath or a setcachedevice, */
/* we aren't any longer. */
pgs->in_cachedevice = 0;
pgs->in_charpath = (gs_char_path_mode) 0;
return open_code;
}
| 13,410 |
82,252 | 0 | static int compat_ifr_data_ioctl(struct net *net, unsigned int cmd,
struct compat_ifreq __user *u_ifreq32)
{
struct ifreq ifreq;
u32 data32;
if (copy_from_user(ifreq.ifr_name, u_ifreq32->ifr_name, IFNAMSIZ))
return -EFAULT;
if (get_user(data32, &u_ifreq32->ifr_data))
return -EFAULT;
ifreq.ifr_data = compat_ptr(data32);
return dev_ioctl(net, cmd, &ifreq, NULL);
}
| 13,411 |
82,143 | 0 | mrb_vm_define_class(mrb_state *mrb, mrb_value outer, mrb_value super, mrb_sym id)
{
struct RClass *s;
struct RClass *c;
if (!mrb_nil_p(super)) {
if (mrb_type(super) != MRB_TT_CLASS) {
mrb_raisef(mrb, E_TYPE_ERROR, "superclass must be a Class (%S given)",
mrb_inspect(mrb, super));
}
s = mrb_class_ptr(super);
}
else {
s = 0;
}
check_if_class_or_module(mrb, outer);
if (mrb_const_defined_at(mrb, outer, id)) {
mrb_value old = mrb_const_get(mrb, outer, id);
if (mrb_type(old) != MRB_TT_CLASS) {
mrb_raisef(mrb, E_TYPE_ERROR, "%S is not a class", mrb_inspect(mrb, old));
}
c = mrb_class_ptr(old);
if (s) {
/* check super class */
if (mrb_class_real(c->super) != s) {
mrb_raisef(mrb, E_TYPE_ERROR, "superclass mismatch for class %S", old);
}
}
return c;
}
c = define_class(mrb, id, s, mrb_class_ptr(outer));
mrb_class_inherited(mrb, mrb_class_real(c->super), c);
return c;
}
| 13,412 |
178,914 | 1 | static int ghash_final(struct shash_desc *desc, u8 *dst)
{
struct ghash_desc_ctx *dctx = shash_desc_ctx(desc);
struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
u8 *buf = dctx->buffer;
ghash_flush(ctx, dctx);
memcpy(dst, buf, GHASH_BLOCK_SIZE);
return 0;
}
| 13,413 |
102,132 | 0 | SyncManager::SyncInternal* SyncManager::GetImpl() const { return data_; }
| 13,414 |
99,297 | 0 | void ResourceMessageFilter::OnGetCookies(const GURL& url,
const GURL& first_party_for_cookies,
IPC::Message* reply_msg) {
URLRequestContext* context = GetRequestContextForURL(url);
GetCookiesCompletion* callback =
new GetCookiesCompletion(url, reply_msg, this, context);
int policy = net::OK;
if (context->cookie_policy()) {
policy = context->cookie_policy()->CanGetCookies(
url, first_party_for_cookies, callback);
if (policy == net::ERR_IO_PENDING) {
Send(new ViewMsg_SignalCookiePromptEvent());
return;
}
}
callback->Run(policy);
}
| 13,415 |
171,097 | 0 | void dump_indented_camera_metadata(const camera_metadata_t *metadata,
int fd,
int verbosity,
int indentation) {
if (metadata == NULL) {
dprintf(fd, "%*sDumping camera metadata array: Not allocated\n",
indentation, "");
return;
}
unsigned int i;
dprintf(fd,
"%*sDumping camera metadata array: %" PRIu32 " / %" PRIu32 " entries, "
"%" PRIu32 " / %" PRIu32 " bytes of extra data.\n", indentation, "",
metadata->entry_count, metadata->entry_capacity,
metadata->data_count, metadata->data_capacity);
dprintf(fd, "%*sVersion: %d, Flags: %08x\n",
indentation + 2, "",
metadata->version, metadata->flags);
camera_metadata_buffer_entry_t *entry = get_entries(metadata);
for (i=0; i < metadata->entry_count; i++, entry++) {
const char *tag_name, *tag_section;
tag_section = get_camera_metadata_section_name(entry->tag);
if (tag_section == NULL) {
tag_section = "unknownSection";
}
tag_name = get_camera_metadata_tag_name(entry->tag);
if (tag_name == NULL) {
tag_name = "unknownTag";
}
const char *type_name;
if (entry->type >= NUM_TYPES) {
type_name = "unknown";
} else {
type_name = camera_metadata_type_names[entry->type];
}
dprintf(fd, "%*s%s.%s (%05x): %s[%" PRIu32 "]\n",
indentation + 2, "",
tag_section,
tag_name,
entry->tag,
type_name,
entry->count);
if (verbosity < 1) continue;
if (entry->type >= NUM_TYPES) continue;
size_t type_size = camera_metadata_type_size[entry->type];
uint8_t *data_ptr;
if ( type_size * entry->count > 4 ) {
if (entry->data.offset >= metadata->data_count) {
ALOGE("%s: Malformed entry data offset: %" PRIu32 " (max %" PRIu32 ")",
__FUNCTION__,
entry->data.offset,
metadata->data_count);
continue;
}
data_ptr = get_data(metadata) + entry->data.offset;
} else {
data_ptr = entry->data.value;
}
int count = entry->count;
if (verbosity < 2 && count > 16) count = 16;
print_data(fd, data_ptr, entry->tag, entry->type, count, indentation);
}
}
| 13,416 |
166,395 | 0 | std::string GLES2Util::GetQualifiedEnumString(const EnumToString* table,
size_t count,
uint32_t value) {
for (const EnumToString* end = table + count; table < end; ++table) {
if (table->value == value) {
return table->name;
}
}
return GetStringEnum(value);
}
| 13,417 |
17,967 | 0 | kex_send_kexinit(struct ssh *ssh)
{
u_char *cookie;
struct kex *kex = ssh->kex;
int r;
if (kex == NULL)
return SSH_ERR_INTERNAL_ERROR;
if (kex->flags & KEX_INIT_SENT)
return 0;
kex->done = 0;
/* generate a random cookie */
if (sshbuf_len(kex->my) < KEX_COOKIE_LEN)
return SSH_ERR_INVALID_FORMAT;
if ((cookie = sshbuf_mutable_ptr(kex->my)) == NULL)
return SSH_ERR_INTERNAL_ERROR;
arc4random_buf(cookie, KEX_COOKIE_LEN);
if ((r = sshpkt_start(ssh, SSH2_MSG_KEXINIT)) != 0 ||
(r = sshpkt_putb(ssh, kex->my)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
return r;
debug("SSH2_MSG_KEXINIT sent");
kex->flags |= KEX_INIT_SENT;
return 0;
}
| 13,418 |
167,927 | 0 | void LocalFrame::ForceSynchronousDocumentInstall(
const AtomicString& mime_type,
scoped_refptr<SharedBuffer> data) {
CHECK(loader_.StateMachine()->IsDisplayingInitialEmptyDocument());
DCHECK(!Client()->IsLocalFrameClientImpl());
GetDocument()->Shutdown();
DomWindow()->InstallNewDocument(
mime_type, DocumentInit::Create().WithFrame(this), false);
loader_.StateMachine()->AdvanceTo(
FrameLoaderStateMachine::kCommittedFirstRealLoad);
GetDocument()->OpenForNavigation(kForceSynchronousParsing, mime_type,
AtomicString("UTF-8"));
data->ForEachSegment(
[this](const char* segment, size_t segment_size, size_t segment_offset) {
GetDocument()->Parser()->AppendBytes(segment, segment_size);
return true;
});
GetDocument()->Parser()->Finish();
if (GetPage() && GetDocument()->IsSVGDocument())
GetPage()->GetUseCounter().DidCommitLoad(this);
}
| 13,419 |
59,364 | 0 | static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
struct nlattr **attrs)
{
struct net *net = sock_net(skb->sk);
struct km_event c;
struct xfrm_usersa_flush *p = nlmsg_data(nlh);
int err;
err = xfrm_state_flush(net, p->proto, true);
if (err) {
if (err == -ESRCH) /* empty table */
return 0;
return err;
}
c.data.proto = p->proto;
c.event = nlh->nlmsg_type;
c.seq = nlh->nlmsg_seq;
c.portid = nlh->nlmsg_pid;
c.net = net;
km_state_notify(NULL, &c);
return 0;
}
| 13,420 |
60,500 | 0 | int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
unsigned long npages)
{
return kvmppc_core_create_memslot(kvm, slot, npages);
}
| 13,421 |
35,464 | 0 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct ieee80211_local *local = hw_to_local(hw);
struct sk_buff *skb = NULL;
struct ieee80211_tx_data tx;
struct ieee80211_sub_if_data *sdata;
struct ps_data *ps;
struct ieee80211_tx_info *info;
struct ieee80211_chanctx_conf *chanctx_conf;
sdata = vif_to_sdata(vif);
rcu_read_lock();
chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
if (!chanctx_conf)
goto out;
if (sdata->vif.type == NL80211_IFTYPE_AP) {
struct beacon_data *beacon =
rcu_dereference(sdata->u.ap.beacon);
if (!beacon || !beacon->head)
goto out;
ps = &sdata->u.ap.ps;
} else if (ieee80211_vif_is_mesh(&sdata->vif)) {
ps = &sdata->u.mesh.ps;
} else {
goto out;
}
if (ps->dtim_count != 0 || !ps->dtim_bc_mc)
goto out; /* send buffered bc/mc only after DTIM beacon */
while (1) {
skb = skb_dequeue(&ps->bc_buf);
if (!skb)
goto out;
local->total_ps_buffered--;
if (!skb_queue_empty(&ps->bc_buf) && skb->len >= 2) {
struct ieee80211_hdr *hdr =
(struct ieee80211_hdr *) skb->data;
/* more buffered multicast/broadcast frames ==> set
* MoreData flag in IEEE 802.11 header to inform PS
* STAs */
hdr->frame_control |=
cpu_to_le16(IEEE80211_FCTL_MOREDATA);
}
if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
if (!ieee80211_tx_prepare(sdata, &tx, skb))
break;
dev_kfree_skb_any(skb);
}
info = IEEE80211_SKB_CB(skb);
tx.flags |= IEEE80211_TX_PS_BUFFERED;
info->band = chanctx_conf->def.chan->band;
if (invoke_tx_handlers(&tx))
skb = NULL;
out:
rcu_read_unlock();
return skb;
}
| 13,422 |
118,640 | 0 | void UserCloudPolicyManagerChromeOS::Connect(
PrefService* local_state,
DeviceManagementService* device_management_service,
scoped_refptr<net::URLRequestContextGetter> system_request_context,
UserAffiliation user_affiliation) {
DCHECK(device_management_service);
DCHECK(local_state);
local_state_ = local_state;
scoped_refptr<net::URLRequestContextGetter> request_context;
if (system_request_context) {
request_context = new SystemPolicyRequestContext(
system_request_context, GetUserAgent());
}
scoped_ptr<CloudPolicyClient> cloud_policy_client(
new CloudPolicyClient(std::string(), std::string(),
kPolicyVerificationKeyHash, user_affiliation,
NULL, device_management_service,
request_context));
core()->Connect(cloud_policy_client.Pass());
client()->AddObserver(this);
external_data_manager_->Connect(request_context);
CreateComponentCloudPolicyService(component_policy_cache_path_,
request_context);
if (service()->IsInitializationComplete()) {
OnInitializationCompleted(service());
} else {
service()->AddObserver(this);
}
}
| 13,423 |
129,781 | 0 | bool ChildThread::Send(IPC::Message* msg) {
DCHECK(base::MessageLoop::current() == message_loop());
if (!channel_) {
delete msg;
return false;
}
return channel_->Send(msg);
}
| 13,424 |
166,475 | 0 | std::unique_ptr<APIPermission> UnpackPermissionWithArguments(
base::StringPiece permission_name,
base::StringPiece permission_arg,
const std::string& permission_str,
std::string* error) {
std::unique_ptr<base::Value> permission_json =
base::JSONReader::Read(permission_arg);
if (!permission_json.get()) {
*error = ErrorUtils::FormatErrorMessage(kInvalidParameter, permission_str);
return nullptr;
}
std::unique_ptr<APIPermission> permission;
const APIPermissionInfo* usb_device_permission_info =
PermissionsInfo::GetInstance()->GetByID(APIPermission::kUsbDevice);
if (permission_name == usb_device_permission_info->name()) {
permission =
std::make_unique<UsbDevicePermission>(usb_device_permission_info);
} else {
*error = kUnsupportedPermissionId;
return nullptr;
}
CHECK(permission);
if (!permission->FromValue(permission_json.get(), nullptr, nullptr)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidParameter, permission_str);
return nullptr;
}
return permission;
}
| 13,425 |
4,502 | 0 | PHP_FUNCTION(openssl_csr_get_subject)
{
zval * zcsr;
zend_bool use_shortnames = 1;
zend_resource *csr_resource;
X509_NAME * subject;
X509_REQ * csr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &zcsr, &use_shortnames) == FAILURE) {
return;
}
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
if (csr == NULL) {
RETURN_FALSE;
}
subject = X509_REQ_get_subject_name(csr);
array_init(return_value);
add_assoc_name_entry(return_value, NULL, subject, use_shortnames);
return;
}
| 13,426 |
114,031 | 0 | int num_key_events_dispatched() { return num_key_events_dispatched_; }
| 13,427 |
92,316 | 0 | dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms)
{
HASH_TABLE_ITER iter;
hashTableIterInit(&iter, &(p->elementTypes));
for (;;) {
ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
if (!e)
break;
if (e->allocDefaultAtts != 0)
ms->free_fcn(e->defaultAtts);
}
hashTableClear(&(p->generalEntities));
#ifdef XML_DTD
p->paramEntityRead = XML_FALSE;
hashTableClear(&(p->paramEntities));
#endif /* XML_DTD */
hashTableClear(&(p->elementTypes));
hashTableClear(&(p->attributeIds));
hashTableClear(&(p->prefixes));
poolClear(&(p->pool));
poolClear(&(p->entityValuePool));
p->defaultPrefix.name = NULL;
p->defaultPrefix.binding = NULL;
p->in_eldecl = XML_FALSE;
ms->free_fcn(p->scaffIndex);
p->scaffIndex = NULL;
ms->free_fcn(p->scaffold);
p->scaffold = NULL;
p->scaffLevel = 0;
p->scaffSize = 0;
p->scaffCount = 0;
p->contentStringLen = 0;
p->keepProcessing = XML_TRUE;
p->hasParamEntityRefs = XML_FALSE;
p->standalone = XML_FALSE;
}
| 13,428 |
82,347 | 0 | NO_INLINE JsVar *jspeFactorFunctionCall() {
/* The parent if we're executing a method call */
bool isConstructor = false;
if (lex->tk==LEX_R_NEW) {
JSP_ASSERT_MATCH(LEX_R_NEW);
isConstructor = true;
if (lex->tk==LEX_R_NEW) {
jsExceptionHere(JSET_ERROR, "Nesting 'new' operators is unsupported");
jspSetError(false);
return 0;
}
}
JsVar *parent = 0;
#ifndef SAVE_ON_FLASH
bool wasSuper = lex->tk==LEX_R_SUPER;
#endif
JsVar *a = jspeFactorMember(jspeFactor(), &parent);
#ifndef SAVE_ON_FLASH
if (wasSuper) {
/* if this was 'super.something' then we need
* to overwrite the parent, because it'll be
* set to the prototype otherwise.
*/
jsvUnLock(parent);
parent = jsvLockAgainSafe(execInfo.thisVar);
}
#endif
while ((lex->tk=='(' || (isConstructor && JSP_SHOULD_EXECUTE)) && !jspIsInterrupted()) {
JsVar *funcName = a;
JsVar *func = jsvSkipName(funcName);
/* The constructor function doesn't change parsing, so if we're
* not executing, just short-cut it. */
if (isConstructor && JSP_SHOULD_EXECUTE) {
bool parseArgs = lex->tk=='(';
a = jspeConstruct(func, funcName, parseArgs);
isConstructor = false; // don't treat subsequent brackets as constructors
} else
a = jspeFunctionCall(func, funcName, parent, true, 0, 0);
jsvUnLock3(funcName, func, parent);
parent=0;
a = jspeFactorMember(a, &parent);
}
#ifndef SAVE_ON_FLASH
/* If we've got something that we care about the parent of (eg. a getter/setter)
* then we repackage it into a 'NewChild' name that references the parent before
* we leave. Note: You can't do this on everything because normally NewChild
* forces a new child to be blindly created. It works on Getters/Setters because
* we *always* run those rather than adding them.
*/
if (parent && jsvIsName(a) && !jsvIsNewChild(a)) {
JsVar *value = jsvGetValueOfName(a);
if (jsvIsGetterOrSetter(value)) { // no need to do this for functions since we've just executed whatever we needed to
JsVar *nameVar = jsvCopyNameOnly(a,false,true);
JsVar *newChild = jsvCreateNewChild(parent, nameVar, value);
jsvUnLock2(nameVar, a);
a = newChild;
}
jsvUnLock(value);
}
#endif
jsvUnLock(parent);
return a;
}
| 13,429 |
120,874 | 0 | void OneClickSigninSyncStarter::SigninDialogDelegate::OnContinueSignin() {
sync_starter_->LoadPolicyWithCachedClient();
}
| 13,430 |
85,692 | 0 | static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
{
struct hnae_handle *h = priv->ae_handle;
struct hns_nic_ring_data *rd;
bool is_ver1 = AE_IS_VER1(priv->enet_ver);
int i;
if (h->q_num > NIC_MAX_Q_PER_VF) {
netdev_err(priv->netdev, "too much queue (%d)\n", h->q_num);
return -EINVAL;
}
priv->ring_data = kzalloc(h->q_num * sizeof(*priv->ring_data) * 2,
GFP_KERNEL);
if (!priv->ring_data)
return -ENOMEM;
for (i = 0; i < h->q_num; i++) {
rd = &priv->ring_data[i];
rd->queue_index = i;
rd->ring = &h->qs[i]->tx_ring;
rd->poll_one = hns_nic_tx_poll_one;
rd->fini_process = is_ver1 ? hns_nic_tx_fini_pro :
hns_nic_tx_fini_pro_v2;
netif_napi_add(priv->netdev, &rd->napi,
hns_nic_common_poll, NIC_TX_CLEAN_MAX_NUM);
rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED;
}
for (i = h->q_num; i < h->q_num * 2; i++) {
rd = &priv->ring_data[i];
rd->queue_index = i - h->q_num;
rd->ring = &h->qs[i - h->q_num]->rx_ring;
rd->poll_one = hns_nic_rx_poll_one;
rd->ex_process = hns_nic_rx_up_pro;
rd->fini_process = is_ver1 ? hns_nic_rx_fini_pro :
hns_nic_rx_fini_pro_v2;
netif_napi_add(priv->netdev, &rd->napi,
hns_nic_common_poll, NIC_RX_CLEAN_MAX_NUM);
rd->ring->irq_init_flag = RCB_IRQ_NOT_INITED;
}
return 0;
}
| 13,431 |
158,435 | 0 | RenderWidgetHostViewAuraShutdownTest() {}
| 13,432 |
34,596 | 0 | pkinit_server_plugin_init_realm(krb5_context context, const char *realmname,
pkinit_kdc_context *pplgctx)
{
krb5_error_code retval = ENOMEM;
pkinit_kdc_context plgctx = NULL;
*pplgctx = NULL;
plgctx = calloc(1, sizeof(*plgctx));
if (plgctx == NULL)
goto errout;
pkiDebug("%s: initializing context at %p for realm '%s'\n",
__FUNCTION__, plgctx, realmname);
memset(plgctx, 0, sizeof(*plgctx));
plgctx->magic = PKINIT_CTX_MAGIC;
plgctx->realmname = strdup(realmname);
if (plgctx->realmname == NULL)
goto errout;
plgctx->realmname_len = strlen(plgctx->realmname);
retval = pkinit_init_plg_crypto(&plgctx->cryptoctx);
if (retval)
goto errout;
retval = pkinit_init_plg_opts(&plgctx->opts);
if (retval)
goto errout;
retval = pkinit_init_identity_crypto(&plgctx->idctx);
if (retval)
goto errout;
retval = pkinit_init_identity_opts(&plgctx->idopts);
if (retval)
goto errout;
retval = pkinit_init_kdc_profile(context, plgctx);
if (retval)
goto errout;
retval = pkinit_identity_initialize(context, plgctx->cryptoctx, NULL,
plgctx->idopts, plgctx->idctx, 0, NULL);
if (retval)
goto errout;
pkiDebug("%s: returning context at %p for realm '%s'\n",
__FUNCTION__, plgctx, realmname);
*pplgctx = plgctx;
retval = 0;
errout:
if (retval)
pkinit_server_plugin_fini_realm(context, plgctx);
return retval;
}
| 13,433 |
28,135 | 0 | void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
int i;
memset(cmp, 0, sizeof(void*)*6);
for(i=0; i<6; i++){
switch(type&0xFF){
case FF_CMP_SAD:
cmp[i]= c->sad[i];
break;
case FF_CMP_SATD:
cmp[i]= c->hadamard8_diff[i];
break;
case FF_CMP_SSE:
cmp[i]= c->sse[i];
break;
case FF_CMP_DCT:
cmp[i]= c->dct_sad[i];
break;
case FF_CMP_DCT264:
cmp[i]= c->dct264_sad[i];
break;
case FF_CMP_DCTMAX:
cmp[i]= c->dct_max[i];
break;
case FF_CMP_PSNR:
cmp[i]= c->quant_psnr[i];
break;
case FF_CMP_BIT:
cmp[i]= c->bit[i];
break;
case FF_CMP_RD:
cmp[i]= c->rd[i];
break;
case FF_CMP_VSAD:
cmp[i]= c->vsad[i];
break;
case FF_CMP_VSSE:
cmp[i]= c->vsse[i];
break;
case FF_CMP_ZERO:
cmp[i]= zero_cmp;
break;
case FF_CMP_NSSE:
cmp[i]= c->nsse[i];
break;
#if CONFIG_DWT
case FF_CMP_W53:
cmp[i]= c->w53[i];
break;
case FF_CMP_W97:
cmp[i]= c->w97[i];
break;
#endif
default:
av_log(NULL, AV_LOG_ERROR,"internal error in cmp function selection\n");
}
}
}
| 13,434 |
21,276 | 0 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
unsigned long pfn)
{
BUG_ON(!(vma->vm_flags & VM_MIXEDMAP));
if (addr < vma->vm_start || addr >= vma->vm_end)
return -EFAULT;
/*
* If we don't have pte special, then we have to use the pfn_valid()
* based VM_MIXEDMAP scheme (see vm_normal_page), and thus we *must*
* refcount the page if pfn_valid is true (hence insert_page rather
* than insert_pfn). If a zero_pfn were inserted into a VM_MIXEDMAP
* without pte special, it would there be refcounted as a normal page.
*/
if (!HAVE_PTE_SPECIAL && pfn_valid(pfn)) {
struct page *page;
page = pfn_to_page(pfn);
return insert_page(vma, addr, page, vma->vm_page_prot);
}
return insert_pfn(vma, addr, pfn, vma->vm_page_prot);
}
| 13,435 |
104,035 | 0 | bool GLES2DecoderImpl::DoIsRenderbuffer(GLuint client_id) {
const RenderbufferManager::RenderbufferInfo* info =
GetRenderbufferInfo(client_id);
return info && info->IsValid();
}
| 13,436 |
186,924 | 1 | htmlParseElementInternal(htmlParserCtxtPtr ctxt) {
const xmlChar *name;
const htmlElemDesc * info;
htmlParserNodeInfo node_info = { 0, };
int failed;
if ((ctxt == NULL) || (ctxt->input == NULL)) {
htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR,
"htmlParseElementInternal: context error\n", NULL, NULL);
return;
}
if (ctxt->instate == XML_PARSER_EOF)
return;
/* Capture start position */
if (ctxt->record_info) {
node_info.begin_pos = ctxt->input->consumed +
(CUR_PTR - ctxt->input->base);
node_info.begin_line = ctxt->input->line;
}
failed = htmlParseStartTag(ctxt);
name = ctxt->name;
if ((failed == -1) || (name == NULL)) {
if (CUR == '>')
NEXT;
return;
}
/*
* Lookup the info for that element.
*/
info = htmlTagLookup(name);
if (info == NULL) {
htmlParseErr(ctxt, XML_HTML_UNKNOWN_TAG,
"Tag %s invalid\n", name, NULL);
}
/*
* Check for an Empty Element labeled the XML/SGML way
*/
if ((CUR == '/') && (NXT(1) == '>')) {
SKIP(2);
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, name);
htmlnamePop(ctxt);
return;
}
if (CUR == '>') {
NEXT;
} else {
htmlParseErr(ctxt, XML_ERR_GT_REQUIRED,
"Couldn't find end of Start Tag %s\n", name, NULL);
/*
* end of parsing of this node.
*/
if (xmlStrEqual(name, ctxt->name)) {
nodePop(ctxt);
htmlnamePop(ctxt);
}
if (ctxt->record_info)
htmlNodeInfoPush(ctxt, &node_info);
htmlParserFinishElementParsing(ctxt);
return;
}
/*
* Check for an Empty Element from DTD definition
*/
if ((info != NULL) && (info->empty)) {
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, name);
htmlnamePop(ctxt);
return;
}
if (ctxt->record_info)
htmlNodeInfoPush(ctxt, &node_info);
}
| 13,437 |
49,453 | 0 | static int proc_task_readdir(struct file *file, struct dir_context *ctx)
{
struct inode *inode = file_inode(file);
struct task_struct *task;
struct pid_namespace *ns;
int tid;
if (proc_inode_is_dead(inode))
return -ENOENT;
if (!dir_emit_dots(file, ctx))
return 0;
/* f_version caches the tgid value that the last readdir call couldn't
* return. lseek aka telldir automagically resets f_version to 0.
*/
ns = inode->i_sb->s_fs_info;
tid = (int)file->f_version;
file->f_version = 0;
for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns);
task;
task = next_tid(task), ctx->pos++) {
char name[PROC_NUMBUF];
int len;
tid = task_pid_nr_ns(task, ns);
len = snprintf(name, sizeof(name), "%d", tid);
if (!proc_fill_cache(file, ctx, name, len,
proc_task_instantiate, task, NULL)) {
/* returning this tgid failed, save it as the first
* pid for the next readir call */
file->f_version = (u64)tid;
put_task_struct(task);
break;
}
}
return 0;
}
| 13,438 |
89,242 | 0 | unset_addr_list_add(UnsetAddrList* list, int offset, struct _Node* node)
{
UnsetAddr* p;
int size;
if (list->num >= list->alloc) {
size = list->alloc * 2;
p = (UnsetAddr* )xrealloc(list->us, sizeof(UnsetAddr) * size);
CHECK_NULL_RETURN_MEMERR(p);
list->alloc = size;
list->us = p;
}
list->us[list->num].offset = offset;
list->us[list->num].target = node;
list->num++;
return 0;
}
| 13,439 |
83,099 | 0 | COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode, compat_ulong_t __user *, nmask,
compat_ulong_t, maxnode)
{
unsigned long __user *nm = NULL;
unsigned long nr_bits, alloc_size;
DECLARE_BITMAP(bm, MAX_NUMNODES);
nr_bits = min_t(unsigned long, maxnode-1, MAX_NUMNODES);
alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
if (nmask) {
if (compat_get_bitmap(bm, nmask, nr_bits))
return -EFAULT;
nm = compat_alloc_user_space(alloc_size);
if (copy_to_user(nm, bm, alloc_size))
return -EFAULT;
}
return sys_set_mempolicy(mode, nm, nr_bits+1);
}
| 13,440 |
11,391 | 0 | fbCombineOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
CARD32 s = READ(src + i);
CARD32 m = READ(mask + i);
CARD32 a;
fbCombineMaskC (&s, &m);
a = ~m;
if (a != 0xffffffff)
{
if (a)
{
CARD32 d = READ(dest + i);
FbByteMulAddC(d, a, s);
s = d;
}
WRITE(dest + i, s);
}
}
}
| 13,441 |
36,306 | 0 | static int do_tmpfile(int dfd, struct filename *pathname,
struct nameidata *nd, int flags,
const struct open_flags *op,
struct file *file, int *opened)
{
static const struct qstr name = QSTR_INIT("/", 1);
struct dentry *dentry, *child;
struct inode *dir;
int error = path_lookupat(dfd, pathname->name,
flags | LOOKUP_DIRECTORY, nd);
if (unlikely(error))
return error;
error = mnt_want_write(nd->path.mnt);
if (unlikely(error))
goto out;
/* we want directory to be writable */
error = inode_permission(nd->inode, MAY_WRITE | MAY_EXEC);
if (error)
goto out2;
dentry = nd->path.dentry;
dir = dentry->d_inode;
if (!dir->i_op->tmpfile) {
error = -EOPNOTSUPP;
goto out2;
}
child = d_alloc(dentry, &name);
if (unlikely(!child)) {
error = -ENOMEM;
goto out2;
}
nd->flags &= ~LOOKUP_DIRECTORY;
nd->flags |= op->intent;
dput(nd->path.dentry);
nd->path.dentry = child;
error = dir->i_op->tmpfile(dir, nd->path.dentry, op->mode);
if (error)
goto out2;
audit_inode(pathname, nd->path.dentry, 0);
error = may_open(&nd->path, op->acc_mode, op->open_flag);
if (error)
goto out2;
file->f_path.mnt = nd->path.mnt;
error = finish_open(file, nd->path.dentry, NULL, opened);
if (error)
goto out2;
error = open_check_o_direct(file);
if (error) {
fput(file);
} else if (!(op->open_flag & O_EXCL)) {
struct inode *inode = file_inode(file);
spin_lock(&inode->i_lock);
inode->i_state |= I_LINKABLE;
spin_unlock(&inode->i_lock);
}
out2:
mnt_drop_write(nd->path.mnt);
out:
path_put(&nd->path);
return error;
}
| 13,442 |
168,114 | 0 | void CreateTestCreditCardFormData(FormData* form,
bool is_https,
bool use_month_type) {
form->name = ASCIIToUTF16("MyForm");
if (is_https) {
form->origin = GURL("https://myform.com/form.html");
form->action = GURL("https://myform.com/submit.html");
} else {
form->origin = GURL("http://myform.com/form.html");
form->action = GURL("http://myform.com/submit.html");
}
FormFieldData field;
test::CreateTestFormField("Name on Card", "nameoncard", "", "text", &field);
form->fields.push_back(field);
test::CreateTestFormField("Card Number", "cardnumber", "", "text", &field);
form->fields.push_back(field);
if (use_month_type) {
test::CreateTestFormField("Expiration Date", "ccmonth", "", "month",
&field);
form->fields.push_back(field);
} else {
test::CreateTestFormField("Expiration Date", "ccmonth", "", "text",
&field);
form->fields.push_back(field);
test::CreateTestFormField("", "ccyear", "", "text", &field);
form->fields.push_back(field);
}
test::CreateTestFormField("CVC", "cvc", "", "text", &field);
form->fields.push_back(field);
}
| 13,443 |
44,893 | 0 | int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
__u64 start, __u64 len)
{
ext4_lblk_t start_blk;
int error = 0;
if (ext4_has_inline_data(inode)) {
int has_inline = 1;
error = ext4_inline_data_fiemap(inode, fieinfo, &has_inline,
start, len);
if (has_inline)
return error;
}
if (fieinfo->fi_flags & FIEMAP_FLAG_CACHE) {
error = ext4_ext_precache(inode);
if (error)
return error;
}
/* fallback to generic here if not in extents fmt */
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
return generic_block_fiemap(inode, fieinfo, start, len,
ext4_get_block);
if (fiemap_check_flags(fieinfo, EXT4_FIEMAP_FLAGS))
return -EBADR;
if (fieinfo->fi_flags & FIEMAP_FLAG_XATTR) {
error = ext4_xattr_fiemap(inode, fieinfo);
} else {
ext4_lblk_t len_blks;
__u64 last_blk;
start_blk = start >> inode->i_sb->s_blocksize_bits;
last_blk = (start + len - 1) >> inode->i_sb->s_blocksize_bits;
if (last_blk >= EXT_MAX_BLOCKS)
last_blk = EXT_MAX_BLOCKS-1;
len_blks = ((ext4_lblk_t) last_blk) - start_blk + 1;
/*
* Walk the extent tree gathering extent information
* and pushing extents back to the user.
*/
error = ext4_fill_fiemap_extents(inode, start_blk,
len_blks, fieinfo);
}
return error;
}
| 13,444 |
68,871 | 0 | static int __meminit drain_cache_node_node(int node)
{
struct kmem_cache *cachep;
int ret = 0;
list_for_each_entry(cachep, &slab_caches, list) {
struct kmem_cache_node *n;
n = get_node(cachep, node);
if (!n)
continue;
drain_freelist(cachep, n, INT_MAX);
if (!list_empty(&n->slabs_full) ||
!list_empty(&n->slabs_partial)) {
ret = -EBUSY;
break;
}
}
return ret;
}
| 13,445 |
168,205 | 0 | void WebBluetoothServiceImpl::RemoteServerConnect(
const WebBluetoothDeviceId& device_id,
blink::mojom::WebBluetoothServerClientAssociatedPtrInfo client,
RemoteServerConnectCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
const CacheQueryResult query_result = QueryCacheForDevice(device_id);
if (query_result.outcome != CacheQueryOutcome::SUCCESS) {
RecordConnectGATTOutcome(query_result.outcome);
std::move(callback).Run(query_result.GetWebResult());
return;
}
if (connected_devices_->IsConnectedToDeviceWithId(device_id)) {
DVLOG(1) << "Already connected.";
std::move(callback).Run(blink::mojom::WebBluetoothResult::SUCCESS);
return;
}
const base::TimeTicks start_time = base::TimeTicks::Now();
blink::mojom::WebBluetoothServerClientAssociatedPtr
web_bluetooth_server_client;
web_bluetooth_server_client.Bind(std::move(client));
auto copyable_callback = base::AdaptCallbackForRepeating(std::move(callback));
query_result.device->CreateGattConnection(
base::Bind(&WebBluetoothServiceImpl::OnCreateGATTConnectionSuccess,
weak_ptr_factory_.GetWeakPtr(), device_id, start_time,
base::Passed(&web_bluetooth_server_client), copyable_callback),
base::Bind(&WebBluetoothServiceImpl::OnCreateGATTConnectionFailed,
weak_ptr_factory_.GetWeakPtr(), start_time,
copyable_callback));
}
| 13,446 |
88,237 | 0 | XML_SetUserData(XML_Parser parser, void *p) {
if (parser == NULL)
return;
if (parser->m_handlerArg == parser->m_userData)
parser->m_handlerArg = parser->m_userData = p;
else
parser->m_userData = p;
}
| 13,447 |
19,766 | 0 | static inline void unlock_or_release_subpool(struct hugepage_subpool *spool)
{
bool free = (spool->count == 0) && (spool->used_hpages == 0);
spin_unlock(&spool->lock);
/* If no pages are used, and no other handles to the subpool
* remain, free the subpool the subpool remain */
if (free)
kfree(spool);
}
| 13,448 |
186,665 | 1 | void DoTest(ExternalProtocolHandler::BlockState block_state,
shell_integration::DefaultWebClientState os_state,
Action expected_action) {
GURL url("mailto:[email protected]");
EXPECT_FALSE(delegate_.has_prompted());
EXPECT_FALSE(delegate_.has_launched());
EXPECT_FALSE(delegate_.has_blocked());
delegate_.set_block_state(block_state);
delegate_.set_os_state(os_state);
ExternalProtocolHandler::LaunchUrlWithDelegate(
url, 0, 0, ui::PAGE_TRANSITION_LINK, true, &delegate_);
content::RunAllTasksUntilIdle();
EXPECT_EQ(expected_action == Action::PROMPT, delegate_.has_prompted());
EXPECT_EQ(expected_action == Action::LAUNCH, delegate_.has_launched());
EXPECT_EQ(expected_action == Action::BLOCK, delegate_.has_blocked());
}
| 13,449 |
1,038 | 0 | void GfxPatternColorSpace::getDefaultColor(GfxColor *color) {
color->c[0]=0;
}
| 13,450 |
55,579 | 0 | prepare_task_switch(struct rq *rq, struct task_struct *prev,
struct task_struct *next)
{
sched_info_switch(rq, prev, next);
perf_event_task_sched_out(prev, next);
fire_sched_out_preempt_notifiers(prev, next);
prepare_lock_switch(rq, next);
prepare_arch_switch(next);
}
| 13,451 |
3,993 | 0 | int FlateStream::lookChar() {
int c;
if (pred) {
return pred->lookChar();
}
while (remain == 0) {
if (endOfBlock && eof)
return EOF;
readSome();
}
c = buf[index];
return c;
}
| 13,452 |
157,893 | 0 | void RenderViewImpl::ApplyAutoResizeLimitsForWidget(const gfx::Size& min_size,
const gfx::Size& max_size) {
webview()->EnableAutoResizeMode(min_size, max_size);
}
| 13,453 |
124,396 | 0 | ListValue* ExtensionTabUtil::CreateTabList(
const Browser* browser,
const extensions::Extension* extension) {
NOTIMPLEMENTED();
return NULL;
}
| 13,454 |
125,759 | 0 | void TabSpecificContentSettings::OnGeolocationPermissionSet(
const GURL& requesting_origin,
bool allowed) {
geolocation_settings_state_.OnGeolocationPermissionSet(requesting_origin,
allowed);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
content::Source<WebContents>(web_contents()),
content::NotificationService::NoDetails());
}
| 13,455 |
52,546 | 0 | static void execute_or_enqueue_request(h2o_http2_conn_t *conn, h2o_http2_stream_t *stream)
{
assert(stream->state < H2O_HTTP2_STREAM_STATE_REQ_PENDING);
if (stream->_req_body != NULL && stream->_expected_content_length != SIZE_MAX &&
stream->_req_body->size != stream->_expected_content_length) {
send_stream_error(conn, stream->stream_id, H2O_HTTP2_ERROR_PROTOCOL);
h2o_http2_stream_reset(conn, stream);
return;
}
h2o_http2_stream_set_state(conn, stream, H2O_HTTP2_STREAM_STATE_REQ_PENDING);
/* TODO schedule the pending reqs using the scheduler */
h2o_linklist_insert(&conn->_pending_reqs, &stream->_refs.link);
run_pending_requests(conn);
update_idle_timeout(conn);
}
| 13,456 |
12,366 | 0 | static int spl_array_it_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
spl_array_it *iterator = (spl_array_it *)iter;
spl_array_object *object = iterator->object;
HashTable *aht = spl_array_get_hash_table(object, 0 TSRMLS_CC);
if (object->ar_flags & SPL_ARRAY_OVERLOADED_VALID) {
return zend_user_it_valid(iter TSRMLS_CC);
} else {
if (spl_array_object_verify_pos_ex(object, aht, "ArrayIterator::valid(): " TSRMLS_CC) == FAILURE) {
return FAILURE;
}
return zend_hash_has_more_elements_ex(aht, &object->pos);
}
}
/* }}} */
| 13,457 |
158,329 | 0 | void RenderWidgetHostImpl::OnSnapshotFromSurfaceReceived(
int snapshot_id,
int retry_count,
const SkBitmap& bitmap) {
static constexpr int kMaxRetries = 5;
if (bitmap.drawsNothing() && retry_count < kMaxRetries) {
GetView()->CopyFromSurface(
gfx::Rect(), gfx::Size(),
base::BindOnce(&RenderWidgetHostImpl::OnSnapshotFromSurfaceReceived,
weak_factory_.GetWeakPtr(), snapshot_id,
retry_count + 1));
return;
}
gfx::Image image;
if (!bitmap.drawsNothing())
image = gfx::Image::CreateFrom1xBitmap(bitmap);
PendingSnapshotMap::iterator it = pending_surface_browser_snapshots_.begin();
while (it != pending_surface_browser_snapshots_.end()) {
if (it->first <= snapshot_id) {
it->second.Run(image);
pending_surface_browser_snapshots_.erase(it++);
} else {
++it;
}
}
}
| 13,458 |
106,806 | 0 | void AddUsageStatsWorkItems(const InstallationState& original_state,
const InstallerState& installer_state,
WorkItemList* install_list) {
DCHECK(installer_state.operation() == InstallerState::MULTI_INSTALL ||
installer_state.operation() == InstallerState::MULTI_UPDATE);
HKEY root_key = installer_state.root_key();
bool value_found = false;
DWORD usagestats = 0;
const Products& products = installer_state.products();
for (Products::const_iterator scan = products.begin(), end = products.end();
!value_found && scan != end; ++scan) {
BrowserDistribution* dist = (*scan)->distribution();
const ProductState* product_state =
original_state.GetNonVersionedProductState(
installer_state.system_install(), dist->GetType());
value_found = product_state->GetUsageStats(&usagestats);
}
if (value_found) {
std::wstring state_key(
installer_state.multi_package_binaries_distribution()->GetStateKey());
install_list->AddCreateRegKeyWorkItem(root_key, state_key);
install_list->AddSetRegValueWorkItem(root_key, state_key,
google_update::kRegUsageStatsField,
usagestats, false);
for (Products::const_iterator scan = products.begin(), end = products.end();
scan != end; ++scan) {
BrowserDistribution* dist = (*scan)->distribution();
if (installer_state.system_install()) {
install_list->AddDeleteRegValueWorkItem(
root_key, dist->GetStateMediumKey(),
google_update::kRegUsageStatsField);
install_list->AddDeleteRegValueWorkItem(
HKEY_CURRENT_USER, dist->GetStateKey(),
google_update::kRegUsageStatsField);
}
install_list->AddDeleteRegValueWorkItem(root_key, dist->GetStateKey(),
google_update::kRegUsageStatsField);
}
}
}
| 13,459 |
43,507 | 0 | void kvm_free_pit(struct kvm *kvm)
{
struct hrtimer *timer;
if (kvm->arch.vpit) {
kvm_unregister_irq_mask_notifier(kvm, 0,
&kvm->arch.vpit->mask_notifier);
kvm_unregister_irq_ack_notifier(kvm,
&kvm->arch.vpit->pit_state.irq_ack_notifier);
mutex_lock(&kvm->arch.vpit->pit_state.lock);
timer = &kvm->arch.vpit->pit_state.pit_timer.timer;
hrtimer_cancel(timer);
kvm_free_irq_source_id(kvm, kvm->arch.vpit->irq_source_id);
mutex_unlock(&kvm->arch.vpit->pit_state.lock);
kfree(kvm->arch.vpit);
}
}
| 13,460 |
68,769 | 0 | static void atusb_free_urbs(struct atusb *atusb)
{
struct urb *urb;
while (1) {
urb = usb_get_from_anchor(&atusb->idle_urbs);
if (!urb)
break;
kfree_skb(urb->context);
usb_free_urb(urb);
}
}
| 13,461 |
68,594 | 0 | static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
{
key_t key = params->key;
int shmflg = params->flg;
size_t size = params->u.size;
int error;
struct shmid_kernel *shp;
size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
struct file *file;
char name[13];
int id;
vm_flags_t acctflag = 0;
if (size < SHMMIN || size > ns->shm_ctlmax)
return -EINVAL;
if (numpages << PAGE_SHIFT < size)
return -ENOSPC;
if (ns->shm_tot + numpages < ns->shm_tot ||
ns->shm_tot + numpages > ns->shm_ctlall)
return -ENOSPC;
shp = ipc_rcu_alloc(sizeof(*shp));
if (!shp)
return -ENOMEM;
shp->shm_perm.key = key;
shp->shm_perm.mode = (shmflg & S_IRWXUGO);
shp->mlock_user = NULL;
shp->shm_perm.security = NULL;
error = security_shm_alloc(shp);
if (error) {
ipc_rcu_putref(shp, ipc_rcu_free);
return error;
}
sprintf(name, "SYSV%08x", key);
if (shmflg & SHM_HUGETLB) {
struct hstate *hs;
size_t hugesize;
hs = hstate_sizelog((shmflg >> SHM_HUGE_SHIFT) & SHM_HUGE_MASK);
if (!hs) {
error = -EINVAL;
goto no_file;
}
hugesize = ALIGN(size, huge_page_size(hs));
/* hugetlb_file_setup applies strict accounting */
if (shmflg & SHM_NORESERVE)
acctflag = VM_NORESERVE;
file = hugetlb_file_setup(name, hugesize, acctflag,
&shp->mlock_user, HUGETLB_SHMFS_INODE,
(shmflg >> SHM_HUGE_SHIFT) & SHM_HUGE_MASK);
} else {
/*
* Do not allow no accounting for OVERCOMMIT_NEVER, even
* if it's asked for.
*/
if ((shmflg & SHM_NORESERVE) &&
sysctl_overcommit_memory != OVERCOMMIT_NEVER)
acctflag = VM_NORESERVE;
file = shmem_kernel_file_setup(name, size, acctflag);
}
error = PTR_ERR(file);
if (IS_ERR(file))
goto no_file;
shp->shm_cprid = task_tgid_vnr(current);
shp->shm_lprid = 0;
shp->shm_atim = shp->shm_dtim = 0;
shp->shm_ctim = get_seconds();
shp->shm_segsz = size;
shp->shm_nattch = 0;
shp->shm_file = file;
shp->shm_creator = current;
id = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
if (id < 0) {
error = id;
goto no_id;
}
list_add(&shp->shm_clist, ¤t->sysvshm.shm_clist);
/*
* shmid gets reported as "inode#" in /proc/pid/maps.
* proc-ps tools use this. Changing this will break them.
*/
file_inode(file)->i_ino = shp->shm_perm.id;
ns->shm_tot += numpages;
error = shp->shm_perm.id;
ipc_unlock_object(&shp->shm_perm);
rcu_read_unlock();
return error;
no_id:
if (is_file_hugepages(file) && shp->mlock_user)
user_shm_unlock(size, shp->mlock_user);
fput(file);
no_file:
ipc_rcu_putref(shp, shm_rcu_free);
return error;
}
| 13,462 |
58,245 | 0 | void update_rq_clock(struct rq *rq)
{
s64 delta;
if (rq->skip_clock_update > 0)
return;
delta = sched_clock_cpu(cpu_of(rq)) - rq->clock;
rq->clock += delta;
update_rq_clock_task(rq, delta);
}
| 13,463 |
118,008 | 0 | V8Proxy* V8Proxy::retrieve(Frame* frame)
{
return frame ? frame->script()->proxy() : 0;
}
| 13,464 |
42,035 | 0 | static int __init ipc_init(void)
{
sem_init();
msg_init();
shm_init();
return 0;
}
| 13,465 |
105,259 | 0 | void HTMLElement::parseAttribute(const Attribute& attribute)
{
if (isIdAttributeName(attribute.name()) || attribute.name() == classAttr || attribute.name() == styleAttr)
return StyledElement::parseAttribute(attribute);
if (attribute.name() == dirAttr)
dirAttributeChanged(attribute);
else if (attribute.name() == tabindexAttr) {
int tabindex = 0;
if (attribute.isEmpty())
clearTabIndexExplicitly();
else if (parseHTMLInteger(attribute.value(), tabindex)) {
setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max()))));
}
#if ENABLE(MICRODATA)
} else if (attribute.name() == itempropAttr) {
setItemProp(attribute.value());
} else if (attribute.name() == itemrefAttr) {
setItemRef(attribute.value());
} else if (attribute.name() == itemtypeAttr) {
setItemType(attribute.value());
#endif
}
else if (attribute.name() == onclickAttr) {
setAttributeEventListener(eventNames().clickEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == oncontextmenuAttr) {
setAttributeEventListener(eventNames().contextmenuEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ondblclickAttr) {
setAttributeEventListener(eventNames().dblclickEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onmousedownAttr) {
setAttributeEventListener(eventNames().mousedownEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onmousemoveAttr) {
setAttributeEventListener(eventNames().mousemoveEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onmouseoutAttr) {
setAttributeEventListener(eventNames().mouseoutEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onmouseoverAttr) {
setAttributeEventListener(eventNames().mouseoverEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onmouseupAttr) {
setAttributeEventListener(eventNames().mouseupEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onmousewheelAttr) {
setAttributeEventListener(eventNames().mousewheelEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onfocusAttr) {
setAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onfocusinAttr) {
setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onfocusoutAttr) {
setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onblurAttr) {
setAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onkeydownAttr) {
setAttributeEventListener(eventNames().keydownEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onkeypressAttr) {
setAttributeEventListener(eventNames().keypressEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onkeyupAttr) {
setAttributeEventListener(eventNames().keyupEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onscrollAttr) {
setAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onbeforecutAttr) {
setAttributeEventListener(eventNames().beforecutEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == oncutAttr) {
setAttributeEventListener(eventNames().cutEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onbeforecopyAttr) {
setAttributeEventListener(eventNames().beforecopyEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == oncopyAttr) {
setAttributeEventListener(eventNames().copyEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onbeforepasteAttr) {
setAttributeEventListener(eventNames().beforepasteEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onpasteAttr) {
setAttributeEventListener(eventNames().pasteEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ondragenterAttr) {
setAttributeEventListener(eventNames().dragenterEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ondragoverAttr) {
setAttributeEventListener(eventNames().dragoverEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ondragleaveAttr) {
setAttributeEventListener(eventNames().dragleaveEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ondropAttr) {
setAttributeEventListener(eventNames().dropEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ondragstartAttr) {
setAttributeEventListener(eventNames().dragstartEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ondragAttr) {
setAttributeEventListener(eventNames().dragEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ondragendAttr) {
setAttributeEventListener(eventNames().dragendEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onselectstartAttr) {
setAttributeEventListener(eventNames().selectstartEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onsubmitAttr) {
setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onerrorAttr) {
setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onwebkitanimationstartAttr) {
setAttributeEventListener(eventNames().webkitAnimationStartEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onwebkitanimationiterationAttr) {
setAttributeEventListener(eventNames().webkitAnimationIterationEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onwebkitanimationendAttr) {
setAttributeEventListener(eventNames().webkitAnimationEndEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onwebkittransitionendAttr) {
setAttributeEventListener(eventNames().webkitTransitionEndEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == oninputAttr) {
setAttributeEventListener(eventNames().inputEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == oninvalidAttr) {
setAttributeEventListener(eventNames().invalidEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ontouchstartAttr) {
setAttributeEventListener(eventNames().touchstartEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ontouchmoveAttr) {
setAttributeEventListener(eventNames().touchmoveEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ontouchendAttr) {
setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == ontouchcancelAttr) {
setAttributeEventListener(eventNames().touchcancelEvent, createAttributeEventListener(this, attribute));
#if ENABLE(FULLSCREEN_API)
} else if (attribute.name() == onwebkitfullscreenchangeAttr) {
setAttributeEventListener(eventNames().webkitfullscreenchangeEvent, createAttributeEventListener(this, attribute));
} else if (attribute.name() == onwebkitfullscreenerrorAttr) {
setAttributeEventListener(eventNames().webkitfullscreenerrorEvent, createAttributeEventListener(this, attribute));
#endif
}
}
| 13,466 |
172,731 | 0 | WORD32 ih264d_parse_slice_partition(dec_struct_t * ps_dec,
dec_bit_stream_t * ps_bitstrm)
{
H264_DEC_DEBUG_PRINT("\nSlice partition not supported");
UNUSED(ps_dec);
UNUSED(ps_bitstrm);
return (0);
}
| 13,467 |
81,314 | 0 | print_trace_header(struct seq_file *m, struct trace_iterator *iter)
{
unsigned long sym_flags = (global_trace.trace_flags & TRACE_ITER_SYM_MASK);
struct trace_buffer *buf = iter->trace_buffer;
struct trace_array_cpu *data = per_cpu_ptr(buf->data, buf->cpu);
struct tracer *type = iter->trace;
unsigned long entries;
unsigned long total;
const char *name = "preemption";
name = type->name;
get_total_entries(buf, &total, &entries);
seq_printf(m, "# %s latency trace v1.1.5 on %s\n",
name, UTS_RELEASE);
seq_puts(m, "# -----------------------------------"
"---------------------------------\n");
seq_printf(m, "# latency: %lu us, #%lu/%lu, CPU#%d |"
" (M:%s VP:%d, KP:%d, SP:%d HP:%d",
nsecs_to_usecs(data->saved_latency),
entries,
total,
buf->cpu,
#if defined(CONFIG_PREEMPT_NONE)
"server",
#elif defined(CONFIG_PREEMPT_VOLUNTARY)
"desktop",
#elif defined(CONFIG_PREEMPT)
"preempt",
#else
"unknown",
#endif
/* These are reserved for later use */
0, 0, 0, 0);
#ifdef CONFIG_SMP
seq_printf(m, " #P:%d)\n", num_online_cpus());
#else
seq_puts(m, ")\n");
#endif
seq_puts(m, "# -----------------\n");
seq_printf(m, "# | task: %.16s-%d "
"(uid:%d nice:%ld policy:%ld rt_prio:%ld)\n",
data->comm, data->pid,
from_kuid_munged(seq_user_ns(m), data->uid), data->nice,
data->policy, data->rt_priority);
seq_puts(m, "# -----------------\n");
if (data->critical_start) {
seq_puts(m, "# => started at: ");
seq_print_ip_sym(&iter->seq, data->critical_start, sym_flags);
trace_print_seq(m, &iter->seq);
seq_puts(m, "\n# => ended at: ");
seq_print_ip_sym(&iter->seq, data->critical_end, sym_flags);
trace_print_seq(m, &iter->seq);
seq_puts(m, "\n#\n");
}
seq_puts(m, "#\n");
}
| 13,468 |
163,667 | 0 | xmlBufEmpty(xmlBufPtr buf) {
if ((buf == NULL) || (buf->error != 0)) return;
if (buf->content == NULL) return;
CHECK_COMPAT(buf)
buf->use = 0;
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) {
buf->content = BAD_CAST "";
} else if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
(buf->contentIO != NULL)) {
size_t start_buf = buf->content - buf->contentIO;
buf->size += start_buf;
buf->content = buf->contentIO;
buf->content[0] = 0;
} else {
buf->content[0] = 0;
}
UPDATE_COMPAT(buf)
}
| 13,469 |
107,664 | 0 | Eina_Bool ewk_view_text_matches_highlight_set(Evas_Object* ewkView, Eina_Bool highlight)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
return ewk_frame_text_matches_highlight_set(smartData->main_frame, highlight);
}
| 13,470 |
33,044 | 0 | SCTP_STATIC int sctp_setsockopt_connectx(struct sock* sk,
struct sockaddr __user *addrs,
int addrs_size)
{
sctp_assoc_t assoc_id = 0;
int err = 0;
err = __sctp_setsockopt_connectx(sk, addrs, addrs_size, &assoc_id);
if (err)
return err;
else
return assoc_id;
}
| 13,471 |
123,699 | 0 | ScriptLoader::ScriptLoader(Element* element, bool parserInserted, bool alreadyStarted)
: m_element(element)
, m_resource(0)
, m_startLineNumber(WTF::OrdinalNumber::beforeFirst())
, m_parserInserted(parserInserted)
, m_isExternalScript(false)
, m_alreadyStarted(alreadyStarted)
, m_haveFiredLoad(false)
, m_willBeParserExecuted(false)
, m_readyToBeParserExecuted(false)
, m_willExecuteWhenDocumentFinishedParsing(false)
, m_forceAsync(!parserInserted)
, m_willExecuteInOrder(false)
{
ASSERT(m_element);
if (parserInserted && element->document().scriptableDocumentParser() && !element->document().isInDocumentWrite())
m_startLineNumber = element->document().scriptableDocumentParser()->lineNumber();
}
| 13,472 |
74,413 | 0 | void WriteVirtIODeviceWord(ULONG_PTR ulRegister, u16 wValue)
{
#if 1
NdisRawWritePortUshort(ulRegister, wValue);
#else
static int nCounterToFail = 0;
static const int StartFail = 200, StopFail = 600;
BOOLEAN bFail = FALSE;
DPrintf(6, ("%s> R[%x] = %x\n", __FUNCTION__, (ULONG)ulRegister, wValue) );
if ((ulRegister & 0x1F) == 0x10)
{
nCounterToFail++;
bFail = nCounterToFail >= StartFail && nCounterToFail < StopFail;
}
if (!bFail) NdisRawWritePortUshort(ulRegister, wValue);
else
{
DPrintf(0, ("%s> FAILING R[%x] = %x\n", __FUNCTION__, (ULONG)ulRegister, wValue) );
}
#endif
}
| 13,473 |
153,565 | 0 | void GLES2Implementation::BindFragDataLocationEXT(GLuint program,
GLuint colorName,
const char* name) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFragDataLocationEXT("
<< program << ", " << colorName << ", " << name << ")");
SetBucketAsString(kResultBucketId, name);
helper_->BindFragDataLocationEXTBucket(program, colorName, kResultBucketId);
helper_->SetBucketSize(kResultBucketId, 0);
CheckGLError();
}
| 13,474 |
34,844 | 0 | static const char *perf_etc_perfconfig(void)
{
static const char *system_wide;
if (!system_wide)
system_wide = system_path(ETC_PERFCONFIG);
return system_wide;
}
| 13,475 |
67,648 | 0 | static int fname_decrypt(struct inode *inode,
const struct fscrypt_str *iname,
struct fscrypt_str *oname)
{
struct skcipher_request *req = NULL;
DECLARE_FS_COMPLETION_RESULT(ecr);
struct scatterlist src_sg, dst_sg;
struct fscrypt_info *ci = inode->i_crypt_info;
struct crypto_skcipher *tfm = ci->ci_ctfm;
int res = 0;
char iv[FS_CRYPTO_BLOCK_SIZE];
unsigned lim;
lim = inode->i_sb->s_cop->max_namelen(inode);
if (iname->len <= 0 || iname->len > lim)
return -EIO;
/* Allocate request */
req = skcipher_request_alloc(tfm, GFP_NOFS);
if (!req) {
printk_ratelimited(KERN_ERR
"%s: crypto_request_alloc() failed\n", __func__);
return -ENOMEM;
}
skcipher_request_set_callback(req,
CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
fname_crypt_complete, &ecr);
/* Initialize IV */
memset(iv, 0, FS_CRYPTO_BLOCK_SIZE);
/* Create decryption request */
sg_init_one(&src_sg, iname->name, iname->len);
sg_init_one(&dst_sg, oname->name, oname->len);
skcipher_request_set_crypt(req, &src_sg, &dst_sg, iname->len, iv);
res = crypto_skcipher_decrypt(req);
if (res == -EINPROGRESS || res == -EBUSY) {
wait_for_completion(&ecr.completion);
res = ecr.res;
}
skcipher_request_free(req);
if (res < 0) {
printk_ratelimited(KERN_ERR
"%s: Error (error code %d)\n", __func__, res);
return res;
}
oname->len = strnlen(oname->name, iname->len);
return 0;
}
| 13,476 |
16,489 | 0 | condor_net_remap_config( bool force_param )
{
char *str = NULL;
if( ! force_param && getenv("NET_REMAP_ENABLE") ) {
/*
this stuff is already set. unless the caller is forcing
us to call param() again (e.g. the master is trying to
re-bind() if the GCB broker is down and it's got a list
to try) we should return immediately and leave our
environment alone. this way, the master can choose what
GCB broker to use for itself and all its children, even
if there's a list and we're using $RANDOM_CHOICE().
*/
return;
}
/*
this method is only called if we're enabling a network remap
service. if we do, we always need to force condor to bind()
to all interfaces (INADDR_ANY). since we don't want to rely
on users to set this themselves to get GCB working, we'll
set it automatically. the only harm of setting this is that
we need Condor to automatically handle hostallow stuff for
"localhost", or users need to add localhost to their
hostallow settings as appropriate. we can't rely on the
later, and the former only works on some platforms.
luckily, the automatic localhost stuff works on all
platforms where GCB works (linux, and we hope, solaris), so
it's safe to turn this on whenever we're using GCB
*/
insert( "BIND_ALL_INTERFACES", "TRUE", ConfigTab, TABLESIZE );
extra_info->AddInternalParam("BIND_ALL_INTERFACES");
SetEnv( "NET_REMAP_ENABLE", "true");
str = param("NET_REMAP_SERVICE");
if (str) {
if (!strcasecmp(str, "GCB")) {
SetEnv( "GCB_ENABLE", "true" );
free(str);
str = NULL;
if( (str = param("NET_REMAP_INAGENT")) ) {
const char *next_broker;
StringList all_brokers( str );
StringList working_brokers;
all_brokers.rewind();
while ( (next_broker = all_brokers.next()) ) {
int rc = 0;
#if HAVE_EXT_GCB
int num_slots = 0; /* only used w/HAVE_EXT_GCB */
rc = GCB_broker_query( next_broker,
GCB_DATA_QUERY_FREE_SOCKS,
&num_slots );
#endif
if ( rc == 0 ) {
working_brokers.append( next_broker );
}
}
if ( working_brokers.number() > 0 ) {
int rand_entry = (get_random_int() % working_brokers.number()) + 1;
int i = 0;
working_brokers.rewind();
while ( (i < rand_entry) &&
(next_broker=working_brokers.next()) ) {
i++;
}
dprintf( D_FULLDEBUG,"Using GCB broker %s\n",next_broker );
SetEnv( "GCB_INAGENT", next_broker );
} else {
dprintf( D_ALWAYS,"No usable GCB brokers were found. "
"Setting GCB_INAGENT=%s\n",
CONDOR_GCB_INVALID_BROKER );
SetEnv( "GCB_INAGENT", CONDOR_GCB_INVALID_BROKER );
}
free( str );
str = NULL;
}
if( (str = param("NET_REMAP_ROUTE")) ) {
SetEnv( "GCB_ROUTE", str );
free( str );
str = NULL;
}
} else if (!strcasecmp(str, "DPF")) {
SetEnv( "DPF_ENABLE", "true" );
free(str);
str = NULL;
if( (str = param("NET_REMAP_INAGENT")) ) {
SetEnv( "DPF_INAGENT", str );
free(str);
str = NULL;
}
if( (str = param("NET_REMAP_ROUTE")) ) {
SetEnv( "DPF_ROUTE", str );
free(str);
str = NULL;
}
}
}
}
| 13,477 |
98,751 | 0 | void WebPluginDelegatePepper::didChooseFile(
const WebKit::WebVector<WebKit::WebString>& file_names) {
if (file_names.isEmpty()) {
current_choose_file_callback_(NULL, 0, current_choose_file_user_data_);
} else {
std::vector<std::string> file_strings;
file_strings.resize(file_names.size());
for (size_t i = 0; i < file_names.size(); i++)
file_strings[i] = file_names[0].utf8();
std::vector<const char*> pointers_to_strings;
pointers_to_strings.resize(file_strings.size());
for (size_t i = 0; i < file_strings.size(); i++)
pointers_to_strings[i] = file_strings[i].c_str();
current_choose_file_callback_(
&pointers_to_strings[0],
static_cast<int>(pointers_to_strings.size()),
current_choose_file_user_data_);
}
}
| 13,478 |
63,643 | 0 | long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2)
{
long secs, usecs;
secs = tv1->tv_sec - tv2->tv_sec;
usecs = tv1->tv_usec - tv2->tv_usec;
if (usecs < 0) {
usecs += 1000000;
secs--;
}
usecs = usecs/1000 + secs * 1000;
return usecs;
}
| 13,479 |
126,633 | 0 | TabContents* TabStripModel::GetTabContentsAtImpl(int index) const {
CHECK(ContainsIndex(index)) <<
"Failed to find: " << index << " in: " << count() << " entries.";
return TabContents::FromWebContents(contents_data_[index]->contents);
}
| 13,480 |
101,697 | 0 | bool Browser::LargeIconsPermitted() const {
return true;
}
| 13,481 |
94,644 | 0 | PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7)
{
return ASN1_item_d2i_fp(ASN1_ITEM_rptr(PKCS7), fp, p7);
}
| 13,482 |
36,551 | 0 | void _cgsem_post(cgsem_t *cgsem, const char *file, const char *func, const int line)
{
const char buf = 1;
int ret;
retry:
ret = write(cgsem->pipefd[1], &buf, 1);
if (unlikely(ret == 0))
applog(LOG_WARNING, "Failed to write errno=%d" IN_FMT_FFL, errno, file, func, line);
else if (unlikely(ret < 0 && interrupted))
goto retry;
}
| 13,483 |
60,937 | 0 | link_info_stop (NautilusDirectory *directory)
{
NautilusFile *file;
if (directory->details->link_info_read_state != NULL)
{
file = directory->details->link_info_read_state->file;
if (file != NULL)
{
g_assert (NAUTILUS_IS_FILE (file));
g_assert (file->details->directory == directory);
if (is_needy (file,
lacks_link_info,
REQUEST_LINK_INFO))
{
return;
}
}
/* The link info is not wanted, so stop it. */
link_info_cancel (directory);
}
}
| 13,484 |
92,929 | 0 | cssp_encode_tscspdatadetail(unsigned char keyspec, char *card, char *reader, char *container,
char *csp)
{
STREAM out;
STREAM h1, h2;
struct stream tmp = { 0 };
struct stream message = { 0 };
s_realloc(&tmp, 512 * 4);
s_reset(&tmp);
out_uint8(&tmp, keyspec);
s_mark_end(&tmp);
h2 = ber_wrap_hdr_data(BER_TAG_INTEGER, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
if (card)
{
s_reset(&tmp);
out_utf16s(&tmp, card);
s_mark_end(&tmp);
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
}
if (reader)
{
s_reset(&tmp);
out_utf16s(&tmp, reader);
s_mark_end(&tmp);
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 2, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
}
if (container)
{
s_reset(&tmp);
out_utf16s(&tmp, container);
s_mark_end(&tmp);
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 3, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
}
if (csp)
{
s_reset(&tmp);
out_utf16s(&tmp, csp);
s_mark_end(&tmp);
h2 = ber_wrap_hdr_data(BER_TAG_OCTET_STRING, &tmp);
h1 = ber_wrap_hdr_data(BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 4, h2);
s_realloc(&message, s_length(&message) + s_length(h1));
out_uint8p(&message, h1->data, s_length(h1));
s_mark_end(&message);
s_free(h2);
s_free(h1);
}
s_mark_end(&message);
out = ber_wrap_hdr_data(BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED, &message);
free(tmp.data);
free(message.data);
return out;
}
| 13,485 |
160,378 | 0 | Address LargeObjectArena::lazySweepPages(size_t allocationSize,
size_t gcInfoIndex) {
Address result = nullptr;
size_t sweptSize = 0;
while (m_firstUnsweptPage) {
BasePage* page = m_firstUnsweptPage;
if (page->isEmpty()) {
sweptSize += static_cast<LargeObjectPage*>(page)->payloadSize() +
sizeof(HeapObjectHeader);
page->unlink(&m_firstUnsweptPage);
page->removeFromHeap();
if (sweptSize >= allocationSize) {
result = doAllocateLargeObjectPage(allocationSize, gcInfoIndex);
ASSERT(result);
break;
}
} else {
page->sweep();
page->unlink(&m_firstUnsweptPage);
page->link(&m_firstPage);
page->markAsSwept();
}
}
return result;
}
| 13,486 |
105,731 | 0 | void FreeInputMethodNames(GList* engines) {
if (engines) {
for (GList* cursor = engines; cursor; cursor = g_list_next(cursor)) {
g_object_unref(IBUS_ENGINE_DESC(cursor->data));
}
g_list_free(engines);
}
}
| 13,487 |
94,741 | 0 | static int gdGuessBackgroundColorFromCorners(gdImagePtr im, int *color)
{
const int tl = gdImageGetPixel(im, 0, 0);
const int tr = gdImageGetPixel(im, gdImageSX(im) - 1, 0);
const int bl = gdImageGetPixel(im, 0, gdImageSY(im) -1);
const int br = gdImageGetPixel(im, gdImageSX(im) - 1, gdImageSY(im) -1);
if (tr == bl && tr == br) {
*color = tr;
return 3;
} else if (tl == bl && tl == br) {
*color = tl;
return 3;
} else if (tl == tr && tl == br) {
*color = tl;
return 3;
} else if (tl == tr && tl == bl) {
*color = tl;
return 3;
} else if (tl == tr || tl == bl || tl == br) {
*color = tl;
return 2;
} else if (tr == bl) {
*color = tr;
return 2;
} else if (br == bl) {
*color = bl;
return 2;
} else {
register int r,b,g,a;
r = (int)(0.5f + (gdImageRed(im, tl) + gdImageRed(im, tr) + gdImageRed(im, bl) + gdImageRed(im, br)) / 4);
g = (int)(0.5f + (gdImageGreen(im, tl) + gdImageGreen(im, tr) + gdImageGreen(im, bl) + gdImageGreen(im, br)) / 4);
b = (int)(0.5f + (gdImageBlue(im, tl) + gdImageBlue(im, tr) + gdImageBlue(im, bl) + gdImageBlue(im, br)) / 4);
a = (int)(0.5f + (gdImageAlpha(im, tl) + gdImageAlpha(im, tr) + gdImageAlpha(im, bl) + gdImageAlpha(im, br)) / 4);
*color = gdImageColorClosestAlpha(im, r, g, b, a);
return 0;
}
}
| 13,488 |
86,147 | 0 | static int ssl_write_new_session_ticket( mbedtls_ssl_context *ssl )
{
int ret;
size_t tlen;
uint32_t lifetime;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write new session ticket" ) );
ssl->out_msgtype = MBEDTLS_SSL_MSG_HANDSHAKE;
ssl->out_msg[0] = MBEDTLS_SSL_HS_NEW_SESSION_TICKET;
/*
* struct {
* uint32 ticket_lifetime_hint;
* opaque ticket<0..2^16-1>;
* } NewSessionTicket;
*
* 4 . 7 ticket_lifetime_hint (0 = unspecified)
* 8 . 9 ticket_len (n)
* 10 . 9+n ticket content
*/
if( ( ret = ssl->conf->f_ticket_write( ssl->conf->p_ticket,
ssl->session_negotiate,
ssl->out_msg + 10,
ssl->out_msg + MBEDTLS_SSL_MAX_CONTENT_LEN,
&tlen, &lifetime ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_ticket_write", ret );
tlen = 0;
}
ssl->out_msg[4] = ( lifetime >> 24 ) & 0xFF;
ssl->out_msg[5] = ( lifetime >> 16 ) & 0xFF;
ssl->out_msg[6] = ( lifetime >> 8 ) & 0xFF;
ssl->out_msg[7] = ( lifetime ) & 0xFF;
ssl->out_msg[8] = (unsigned char)( ( tlen >> 8 ) & 0xFF );
ssl->out_msg[9] = (unsigned char)( ( tlen ) & 0xFF );
ssl->out_msglen = 10 + tlen;
/*
* Morally equivalent to updating ssl->state, but NewSessionTicket and
* ChangeCipherSpec share the same state.
*/
ssl->handshake->new_session_ticket = 0;
if( ( ret = mbedtls_ssl_write_record( ssl ) ) != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1, "mbedtls_ssl_write_record", ret );
return( ret );
}
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write new session ticket" ) );
return( 0 );
}
| 13,489 |
181,610 | 1 | dns_resolver_match(const struct key *key,
const struct key_match_data *match_data)
{
int slen, dlen, ret = 0;
const char *src = key->description, *dsp = match_data->raw_data;
kenter("%s,%s", src, dsp);
if (!src || !dsp)
goto no_match;
if (strcasecmp(src, dsp) == 0)
goto matched;
slen = strlen(src);
dlen = strlen(dsp);
if (slen <= 0 || dlen <= 0)
goto no_match;
if (src[slen - 1] == '.')
slen--;
if (dsp[dlen - 1] == '.')
dlen--;
if (slen != dlen || strncasecmp(src, dsp, slen) != 0)
goto no_match;
matched:
ret = 1;
no_match:
kleave(" = %d", ret);
return ret;
}
| 13,490 |
124,884 | 0 | void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*)
{
if (!parent())
return;
AllowRepaintScope scoper(frameView());
if ((style()->borderImage().image() && style()->borderImage().image()->data() == image) ||
(style()->maskBoxImage().image() && style()->maskBoxImage().image()->data() == image)) {
repaint();
return;
}
ShapeValue* shapeOutsideValue = style()->shapeOutside();
if (!frameView()->isInPerformLayout() && isFloating() && shapeOutsideValue && shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image) {
ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty();
markShapeOutsideDependentsForLayout();
}
bool didFullRepaint = repaintLayerRectsForImage(image, style()->backgroundLayers(), true);
if (!didFullRepaint)
repaintLayerRectsForImage(image, style()->maskLayers(), false);
if (hasLayer() && layer()->hasCompositedMask() && layersUseImage(image, style()->maskLayers()))
layer()->contentChanged(MaskImageChanged);
}
| 13,491 |
124,850 | 0 | LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred shouldComputePreferred) const
{
LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style()->logicalMinWidth().isPercent()) || style()->logicalMinWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style()->logicalMaxWidth().isPercent()) || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth));
}
| 13,492 |
167,842 | 0 | void SetHostContentSetting(WebContents* contents, ContentSetting setting) {
HostContentSettingsMapFactory::GetForProfile(
Profile::FromBrowserContext(contents->GetBrowserContext()))
->SetContentSettingDefaultScope(
contents->GetURL(), GURL(),
CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, std::string(), setting);
}
| 13,493 |
1,116 | 0 | void GfxState::setLineDash(double *dash, int length, double start) {
if (lineDash)
gfree(lineDash);
lineDash = dash;
lineDashLength = length;
lineDashStart = start;
}
| 13,494 |
32,246 | 0 | static int dx_make_map(struct ext4_dir_entry_2 *de, unsigned blocksize,
struct dx_hash_info *hinfo,
struct dx_map_entry *map_tail)
{
int count = 0;
char *base = (char *) de;
struct dx_hash_info h = *hinfo;
while ((char *) de < base + blocksize) {
if (de->name_len && de->inode) {
ext4fs_dirhash(de->name, de->name_len, &h);
map_tail--;
map_tail->hash = h.hash;
map_tail->offs = ((char *) de - base)>>2;
map_tail->size = le16_to_cpu(de->rec_len);
count++;
cond_resched();
}
/* XXX: do we need to check rec_len == 0 case? -Chris */
de = ext4_next_entry(de, blocksize);
}
return count;
}
| 13,495 |
78,900 | 0 | util_print_usage_and_die(const char *app_name, const struct option options[],
const char *option_help[], const char *args)
{
int i;
int header_shown = 0;
if (args)
printf("Usage: %s [OPTIONS] %s\n", app_name, args);
else
printf("Usage: %s [OPTIONS]\n", app_name);
for (i = 0; options[i].name; i++) {
char buf[40];
const char *arg_str;
/* Skip "hidden" options */
if (option_help[i] == NULL)
continue;
if (!header_shown++)
printf("Options:\n");
switch (options[i].has_arg) {
case 1:
arg_str = " <arg>";
break;
case 2:
arg_str = " [arg]";
break;
default:
arg_str = "";
break;
}
if (isascii(options[i].val) &&
isprint(options[i].val) && !isspace(options[i].val))
sprintf(buf, "-%c, --%s%s", options[i].val, options[i].name, arg_str);
else
sprintf(buf, " --%s%s", options[i].name, arg_str);
/* print the line - wrap if necessary */
if (strlen(buf) > 28) {
printf(" %s\n", buf);
buf[0] = '\0';
}
printf(" %-28s %s\n", buf, option_help[i]);
}
exit(2);
}
| 13,496 |
172,335 | 0 | OMX_ERRORTYPE omx_video::empty_this_buffer_opaque(OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_BUFFERHEADERTYPE* buffer)
{
unsigned nBufIndex = 0;
OMX_ERRORTYPE ret = OMX_ErrorNone;
encoder_media_buffer_type *media_buffer;
private_handle_t *handle = NULL;
DEBUG_PRINT_LOW("ETBProxyOpaque: buffer[%p]", buffer);
if (buffer == NULL) {
DEBUG_PRINT_ERROR("ERROR: ETBProxyA: Invalid buffer[%p]",buffer);
return OMX_ErrorBadParameter;
}
nBufIndex = buffer - meta_buffer_hdr;
if (nBufIndex >= m_sInPortDef.nBufferCountActual) {
DEBUG_PRINT_ERROR("ERROR: ETBProxyA: Invalid bufindex = %u",
nBufIndex);
return OMX_ErrorBadParameter;
}
media_buffer = (encoder_media_buffer_type *)buffer->pBuffer;
if ((!media_buffer || !media_buffer->meta_handle) &&
!(buffer->nFlags & OMX_BUFFERFLAG_EOS)) {
DEBUG_PRINT_ERROR("Incorrect Buffer queued media buffer = %p",
media_buffer);
m_pCallbacks.EmptyBufferDone(hComp, m_app_data, buffer);
return OMX_ErrorBadParameter;
} else if (media_buffer) {
handle = (private_handle_t *)media_buffer->meta_handle;
}
if (buffer->nFilledLen > 0 && handle) {
/*Enable following code once private handle color format is
updated correctly*/
if (handle->format == HAL_PIXEL_FORMAT_RGBA_8888)
mUsesColorConversion = true;
else
mUsesColorConversion = false;
if (c2d_opened && handle->format != c2d_conv.get_src_format()) {
c2d_conv.close();
c2d_opened = false;
}
if (!c2d_opened) {
if (handle->format == HAL_PIXEL_FORMAT_RGBA_8888) {
DEBUG_PRINT_INFO("open Color conv for RGBA888 W: %u, H: %u",
(unsigned int)m_sInPortDef.format.video.nFrameWidth,
(unsigned int)m_sInPortDef.format.video.nFrameHeight);
if (!c2d_conv.open(m_sInPortDef.format.video.nFrameHeight,
m_sInPortDef.format.video.nFrameWidth,
RGBA8888, NV12_128m, handle->width)) {
m_pCallbacks.EmptyBufferDone(hComp,m_app_data,buffer);
DEBUG_PRINT_ERROR("Color conv open failed");
return OMX_ErrorBadParameter;
}
c2d_opened = true;
#ifdef _MSM8974_
if (!dev_set_format(handle->format))
DEBUG_PRINT_ERROR("cannot set color format for RGBA8888");
#endif
} else if (handle->format != HAL_PIXEL_FORMAT_NV12_ENCODEABLE &&
handle->format != QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m &&
handle->format != QOMX_COLOR_FormatYVU420SemiPlanar) {
DEBUG_PRINT_ERROR("Incorrect color format");
m_pCallbacks.EmptyBufferDone(hComp,m_app_data,buffer);
return OMX_ErrorBadParameter;
}
}
}
if (input_flush_progress == true) {
m_pCallbacks.EmptyBufferDone(hComp,m_app_data,buffer);
DEBUG_PRINT_ERROR("ERROR: ETBProxyA: Input flush in progress");
return OMX_ErrorNone;
}
if (!psource_frame) {
psource_frame = buffer;
ret = push_input_buffer(hComp);
} else {
if (!m_opq_meta_q.insert_entry((unsigned long)buffer,0,0)) {
DEBUG_PRINT_ERROR("ERROR: ETBProxy: Queue is full");
m_pCallbacks.EmptyBufferDone(hComp,m_app_data,buffer);
ret = OMX_ErrorBadParameter;
}
}
return ret;
}
| 13,497 |
148,118 | 0 | static void VoidMethodLongLongArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "voidMethodLongLongArg");
TestObject* impl = V8TestObject::ToImpl(info.Holder());
if (UNLIKELY(info.Length() < 1)) {
exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length()));
return;
}
int64_t long_long_arg;
long_long_arg = NativeValueTraits<IDLLongLong>::NativeValue(info.GetIsolate(), info[0], exception_state);
if (exception_state.HadException())
return;
impl->voidMethodLongLongArg(long_long_arg);
}
| 13,498 |
17,787 | 0 | NextAvailableClient(void *ospriv)
{
int i;
ClientPtr client;
xReq data;
i = nextFreeClientID;
if (i == LimitClients)
return (ClientPtr) NULL;
clients[i] = client =
dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
if (!client)
return (ClientPtr) NULL;
InitClient(client, i, ospriv);
if (!InitClientResources(client)) {
dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
return (ClientPtr) NULL;
}
data.reqType = 1;
data.length = bytes_to_int32(sz_xReq + sz_xConnClientPrefix);
if (!InsertFakeRequest(client, (char *) &data, sz_xReq)) {
FreeClientResources(client);
dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
return (ClientPtr) NULL;
}
if (i == currentMaxClients)
currentMaxClients++;
while ((nextFreeClientID < LimitClients) && clients[nextFreeClientID])
nextFreeClientID++;
/* Enable client ID tracking. This must be done before
* ClientStateCallback. */
ReserveClientIds(client);
if (ClientStateCallback) {
NewClientInfoRec clientinfo;
clientinfo.client = client;
clientinfo.prefix = (xConnSetupPrefix *) NULL;
clientinfo.setup = (xConnSetup *) NULL;
CallCallbacks((&ClientStateCallback), (void *) &clientinfo);
}
return client;
}
| 13,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.