unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
3,857 | 0 | xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, char *attr_ns)
{
xmlAttrPtr attr;
while (node != NULL) {
if (name != NULL) {
node = get_node_ex(node, name, name_ns);
if (node==NULL) {
return NULL;
}
}
attr = get_attribute_ex(node->properties, attribute, attr_ns);
if (attr != NULL && strcmp((char*)attr->children->content, value) == 0) {
return node;
}
node = node->next;
}
return NULL;
}
| 15,700 |
70,139 | 0 | static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong8(int64 value)
{
if ((value<0)||(value>0xFF))
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);
}
| 15,701 |
68,732 | 0 | int import_iovec(int type, const struct iovec __user * uvector,
unsigned nr_segs, unsigned fast_segs,
struct iovec **iov, struct iov_iter *i)
{
ssize_t n;
struct iovec *p;
n = rw_copy_check_uvector(type, uvector, nr_segs, fast_segs,
*iov, &p);
if (n < 0) {
if (p != *iov)
kfree(p);
*iov = NULL;
return n;
}
iov_iter_init(i, type, p, nr_segs, n);
*iov = p == *iov ? NULL : p;
return 0;
}
| 15,702 |
145,259 | 0 | void Dispatcher::UpdateBindingsForContext(ScriptContext* context) {
v8::HandleScope handle_scope(context->isolate());
v8::Context::Scope context_scope(context->v8_context());
switch (context->context_type()) {
case Feature::UNSPECIFIED_CONTEXT:
case Feature::WEB_PAGE_CONTEXT:
case Feature::BLESSED_WEB_PAGE_CONTEXT:
if (context->GetAvailability("app").is_available())
RegisterBinding("app", context);
if (context->GetAvailability("webstore").is_available())
RegisterBinding("webstore", context);
if (context->GetAvailability("dashboardPrivate").is_available())
RegisterBinding("dashboardPrivate", context);
if (IsRuntimeAvailableToContext(context))
RegisterBinding("runtime", context);
UpdateContentCapabilities(context);
break;
case Feature::BLESSED_EXTENSION_CONTEXT:
case Feature::UNBLESSED_EXTENSION_CONTEXT:
case Feature::CONTENT_SCRIPT_CONTEXT:
case Feature::WEBUI_CONTEXT: {
const FeatureProvider* api_feature_provider =
FeatureProvider::GetAPIFeatures();
for (const auto& map_entry : api_feature_provider->GetAllFeatures()) {
if (map_entry.second->IsInternal())
continue;
if (api_feature_provider->GetParent(map_entry.second.get()) != nullptr)
continue;
if (map_entry.first == "test" &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kTestType)) {
continue;
}
if (context->IsAnyFeatureAvailableToContext(*map_entry.second.get()))
RegisterBinding(map_entry.first, context);
}
break;
}
case Feature::SERVICE_WORKER_CONTEXT:
NOTREACHED();
break;
}
}
| 15,703 |
55,983 | 0 | static struct tty_ldisc_ops *get_ldops(int disc)
{
unsigned long flags;
struct tty_ldisc_ops *ldops, *ret;
raw_spin_lock_irqsave(&tty_ldiscs_lock, flags);
ret = ERR_PTR(-EINVAL);
ldops = tty_ldiscs[disc];
if (ldops) {
ret = ERR_PTR(-EAGAIN);
if (try_module_get(ldops->owner)) {
ldops->refcount++;
ret = ldops;
}
}
raw_spin_unlock_irqrestore(&tty_ldiscs_lock, flags);
return ret;
}
| 15,704 |
104,347 | 0 | static PassRefPtr<CSSValueList> getBorderRadiusCornerValues(LengthSize radius, const RenderStyle* style, RenderView* renderView)
{
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (radius.width().type() == Percent)
list->append(cssValuePool().createValue(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
else
list->append(zoomAdjustedPixelValue(valueForLength(radius.width(), 0, renderView), style));
if (radius.height().type() == Percent)
list->append(cssValuePool().createValue(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
else
list->append(zoomAdjustedPixelValue(valueForLength(radius.height(), 0, renderView), style));
return list.release();
}
| 15,705 |
74,572 | 0 | static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options,
uid_t *check_ruid)
{
char *p;
int rc = 0;
int sig_set = 0;
int cipher_name_set = 0;
int fn_cipher_name_set = 0;
int cipher_key_bytes;
int cipher_key_bytes_set = 0;
int fn_cipher_key_bytes;
int fn_cipher_key_bytes_set = 0;
struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
&sbi->mount_crypt_stat;
substring_t args[MAX_OPT_ARGS];
int token;
char *sig_src;
char *cipher_name_dst;
char *cipher_name_src;
char *fn_cipher_name_dst;
char *fn_cipher_name_src;
char *fnek_dst;
char *fnek_src;
char *cipher_key_bytes_src;
char *fn_cipher_key_bytes_src;
u8 cipher_code;
*check_ruid = 0;
if (!options) {
rc = -EINVAL;
goto out;
}
ecryptfs_init_mount_crypt_stat(mount_crypt_stat);
while ((p = strsep(&options, ",")) != NULL) {
if (!*p)
continue;
token = match_token(p, tokens, args);
switch (token) {
case ecryptfs_opt_sig:
case ecryptfs_opt_ecryptfs_sig:
sig_src = args[0].from;
rc = ecryptfs_add_global_auth_tok(mount_crypt_stat,
sig_src, 0);
if (rc) {
printk(KERN_ERR "Error attempting to register "
"global sig; rc = [%d]\n", rc);
goto out;
}
sig_set = 1;
break;
case ecryptfs_opt_cipher:
case ecryptfs_opt_ecryptfs_cipher:
cipher_name_src = args[0].from;
cipher_name_dst =
mount_crypt_stat->
global_default_cipher_name;
strncpy(cipher_name_dst, cipher_name_src,
ECRYPTFS_MAX_CIPHER_NAME_SIZE);
cipher_name_dst[ECRYPTFS_MAX_CIPHER_NAME_SIZE] = '\0';
cipher_name_set = 1;
break;
case ecryptfs_opt_ecryptfs_key_bytes:
cipher_key_bytes_src = args[0].from;
cipher_key_bytes =
(int)simple_strtol(cipher_key_bytes_src,
&cipher_key_bytes_src, 0);
mount_crypt_stat->global_default_cipher_key_size =
cipher_key_bytes;
cipher_key_bytes_set = 1;
break;
case ecryptfs_opt_passthrough:
mount_crypt_stat->flags |=
ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED;
break;
case ecryptfs_opt_xattr_metadata:
mount_crypt_stat->flags |=
ECRYPTFS_XATTR_METADATA_ENABLED;
break;
case ecryptfs_opt_encrypted_view:
mount_crypt_stat->flags |=
ECRYPTFS_XATTR_METADATA_ENABLED;
mount_crypt_stat->flags |=
ECRYPTFS_ENCRYPTED_VIEW_ENABLED;
break;
case ecryptfs_opt_fnek_sig:
fnek_src = args[0].from;
fnek_dst =
mount_crypt_stat->global_default_fnek_sig;
strncpy(fnek_dst, fnek_src, ECRYPTFS_SIG_SIZE_HEX);
mount_crypt_stat->global_default_fnek_sig[
ECRYPTFS_SIG_SIZE_HEX] = '\0';
rc = ecryptfs_add_global_auth_tok(
mount_crypt_stat,
mount_crypt_stat->global_default_fnek_sig,
ECRYPTFS_AUTH_TOK_FNEK);
if (rc) {
printk(KERN_ERR "Error attempting to register "
"global fnek sig [%s]; rc = [%d]\n",
mount_crypt_stat->global_default_fnek_sig,
rc);
goto out;
}
mount_crypt_stat->flags |=
(ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES
| ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK);
break;
case ecryptfs_opt_fn_cipher:
fn_cipher_name_src = args[0].from;
fn_cipher_name_dst =
mount_crypt_stat->global_default_fn_cipher_name;
strncpy(fn_cipher_name_dst, fn_cipher_name_src,
ECRYPTFS_MAX_CIPHER_NAME_SIZE);
mount_crypt_stat->global_default_fn_cipher_name[
ECRYPTFS_MAX_CIPHER_NAME_SIZE] = '\0';
fn_cipher_name_set = 1;
break;
case ecryptfs_opt_fn_cipher_key_bytes:
fn_cipher_key_bytes_src = args[0].from;
fn_cipher_key_bytes =
(int)simple_strtol(fn_cipher_key_bytes_src,
&fn_cipher_key_bytes_src, 0);
mount_crypt_stat->global_default_fn_cipher_key_bytes =
fn_cipher_key_bytes;
fn_cipher_key_bytes_set = 1;
break;
case ecryptfs_opt_unlink_sigs:
mount_crypt_stat->flags |= ECRYPTFS_UNLINK_SIGS;
break;
case ecryptfs_opt_mount_auth_tok_only:
mount_crypt_stat->flags |=
ECRYPTFS_GLOBAL_MOUNT_AUTH_TOK_ONLY;
break;
case ecryptfs_opt_check_dev_ruid:
*check_ruid = 1;
break;
case ecryptfs_opt_err:
default:
printk(KERN_WARNING
"%s: eCryptfs: unrecognized option [%s]\n",
__func__, p);
}
}
if (!sig_set) {
rc = -EINVAL;
ecryptfs_printk(KERN_ERR, "You must supply at least one valid "
"auth tok signature as a mount "
"parameter; see the eCryptfs README\n");
goto out;
}
if (!cipher_name_set) {
int cipher_name_len = strlen(ECRYPTFS_DEFAULT_CIPHER);
BUG_ON(cipher_name_len >= ECRYPTFS_MAX_CIPHER_NAME_SIZE);
strcpy(mount_crypt_stat->global_default_cipher_name,
ECRYPTFS_DEFAULT_CIPHER);
}
if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES)
&& !fn_cipher_name_set)
strcpy(mount_crypt_stat->global_default_fn_cipher_name,
mount_crypt_stat->global_default_cipher_name);
if (!cipher_key_bytes_set)
mount_crypt_stat->global_default_cipher_key_size = 0;
if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES)
&& !fn_cipher_key_bytes_set)
mount_crypt_stat->global_default_fn_cipher_key_bytes =
mount_crypt_stat->global_default_cipher_key_size;
cipher_code = ecryptfs_code_for_cipher_string(
mount_crypt_stat->global_default_cipher_name,
mount_crypt_stat->global_default_cipher_key_size);
if (!cipher_code) {
ecryptfs_printk(KERN_ERR,
"eCryptfs doesn't support cipher: %s",
mount_crypt_stat->global_default_cipher_name);
rc = -EINVAL;
goto out;
}
mutex_lock(&key_tfm_list_mutex);
if (!ecryptfs_tfm_exists(mount_crypt_stat->global_default_cipher_name,
NULL)) {
rc = ecryptfs_add_new_key_tfm(
NULL, mount_crypt_stat->global_default_cipher_name,
mount_crypt_stat->global_default_cipher_key_size);
if (rc) {
printk(KERN_ERR "Error attempting to initialize "
"cipher with name = [%s] and key size = [%td]; "
"rc = [%d]\n",
mount_crypt_stat->global_default_cipher_name,
mount_crypt_stat->global_default_cipher_key_size,
rc);
rc = -EINVAL;
mutex_unlock(&key_tfm_list_mutex);
goto out;
}
}
if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES)
&& !ecryptfs_tfm_exists(
mount_crypt_stat->global_default_fn_cipher_name, NULL)) {
rc = ecryptfs_add_new_key_tfm(
NULL, mount_crypt_stat->global_default_fn_cipher_name,
mount_crypt_stat->global_default_fn_cipher_key_bytes);
if (rc) {
printk(KERN_ERR "Error attempting to initialize "
"cipher with name = [%s] and key size = [%td]; "
"rc = [%d]\n",
mount_crypt_stat->global_default_fn_cipher_name,
mount_crypt_stat->global_default_fn_cipher_key_bytes,
rc);
rc = -EINVAL;
mutex_unlock(&key_tfm_list_mutex);
goto out;
}
}
mutex_unlock(&key_tfm_list_mutex);
rc = ecryptfs_init_global_auth_toks(mount_crypt_stat);
if (rc)
printk(KERN_WARNING "One or more global auth toks could not "
"properly register; rc = [%d]\n", rc);
out:
return rc;
}
| 15,706 |
144,611 | 0 | void WebContentsImpl::OnPepperInstanceCreated() {
FOR_EACH_OBSERVER(WebContentsObserver, observers_, PepperInstanceCreated());
}
| 15,707 |
75,345 | 0 | int format_date_time(struct timeval *when, char *buf, size_t len)
{
struct tm *tm;
char tmp[64];
assert(len);
tm = localtime(&when->tv_sec);
if (!tm)
return -1;
strftime(tmp, sizeof tmp, "%Y-%m-%d %H:%M:%S.%%06u", tm);
return snprintf(buf, len, tmp, when->tv_usec);
}
| 15,708 |
127,293 | 0 | PassRefPtr<SharedBuffer> readFile(const char* fileName)
{
String filePath = m_filePath + fileName;
return Platform::current()->unitTestSupport()->readFromFile(filePath);
}
| 15,709 |
73,414 | 0 | ossl_cipher_is_authenticated(VALUE self)
{
EVP_CIPHER_CTX *ctx;
GetCipher(self, ctx);
return (EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_FLAG_AEAD_CIPHER) ? Qtrue : Qfalse;
}
| 15,710 |
146,027 | 0 | bool WebGL2RenderingContextBase::ValidateBufferTargetCompatibility(
const char* function_name,
GLenum target,
WebGLBuffer* buffer) {
DCHECK(buffer);
switch (buffer->GetInitialTarget()) {
case GL_ELEMENT_ARRAY_BUFFER:
switch (target) {
case GL_ARRAY_BUFFER:
case GL_PIXEL_PACK_BUFFER:
case GL_PIXEL_UNPACK_BUFFER:
case GL_TRANSFORM_FEEDBACK_BUFFER:
case GL_UNIFORM_BUFFER:
SynthesizeGLError(
GL_INVALID_OPERATION, function_name,
"element array buffers can not be bound to a different target");
return false;
default:
break;
}
break;
case GL_ARRAY_BUFFER:
case GL_COPY_READ_BUFFER:
case GL_COPY_WRITE_BUFFER:
case GL_PIXEL_PACK_BUFFER:
case GL_PIXEL_UNPACK_BUFFER:
case GL_UNIFORM_BUFFER:
case GL_TRANSFORM_FEEDBACK_BUFFER:
if (target == GL_ELEMENT_ARRAY_BUFFER) {
SynthesizeGLError(GL_INVALID_OPERATION, function_name,
"buffers bound to non ELEMENT_ARRAY_BUFFER targets "
"can not be bound to ELEMENT_ARRAY_BUFFER target");
return false;
}
break;
default:
break;
}
if (target == GL_TRANSFORM_FEEDBACK_BUFFER) {
if (IsBufferBoundToNonTransformFeedback(buffer)) {
SynthesizeGLError(GL_INVALID_OPERATION, function_name,
"a buffer bound to TRANSFORM_FEEDBACK_BUFFER can not "
"be bound to any other targets");
return false;
}
} else if (IsBufferBoundToTransformFeedback(buffer)) {
SynthesizeGLError(GL_INVALID_OPERATION, function_name,
"a buffer bound to TRANSFORM_FEEDBACK_BUFFER can not be "
"bound to any other targets");
return false;
}
return true;
}
| 15,711 |
101,611 | 0 | Browser* Browser::Create(Profile* profile) {
Browser* browser = new Browser(TYPE_TABBED, profile);
browser->InitBrowserWindow();
return browser;
}
| 15,712 |
185,114 | 1 | ~CreateFileResult()
{
}
| 15,713 |
35,881 | 0 | static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const struct sctp_chunk *init_chunk,
int *cookie_len,
const __u8 *raw_addrs, int addrs_len)
{
sctp_cookie_param_t *retval;
struct sctp_signed_cookie *cookie;
struct scatterlist sg;
int headersize, bodysize;
/* Header size is static data prior to the actual cookie, including
* any padding.
*/
headersize = sizeof(sctp_paramhdr_t) +
(sizeof(struct sctp_signed_cookie) -
sizeof(struct sctp_cookie));
bodysize = sizeof(struct sctp_cookie)
+ ntohs(init_chunk->chunk_hdr->length) + addrs_len;
/* Pad out the cookie to a multiple to make the signature
* functions simpler to write.
*/
if (bodysize % SCTP_COOKIE_MULTIPLE)
bodysize += SCTP_COOKIE_MULTIPLE
- (bodysize % SCTP_COOKIE_MULTIPLE);
*cookie_len = headersize + bodysize;
/* Clear this memory since we are sending this data structure
* out on the network.
*/
retval = kzalloc(*cookie_len, GFP_ATOMIC);
if (!retval)
goto nodata;
cookie = (struct sctp_signed_cookie *) retval->body;
/* Set up the parameter header. */
retval->p.type = SCTP_PARAM_STATE_COOKIE;
retval->p.length = htons(*cookie_len);
/* Copy the cookie part of the association itself. */
cookie->c = asoc->c;
/* Save the raw address list length in the cookie. */
cookie->c.raw_addr_list_len = addrs_len;
/* Remember PR-SCTP capability. */
cookie->c.prsctp_capable = asoc->peer.prsctp_capable;
/* Save adaptation indication in the cookie. */
cookie->c.adaptation_ind = asoc->peer.adaptation_ind;
/* Set an expiration time for the cookie. */
cookie->c.expiration = ktime_add(asoc->cookie_life,
ktime_get());
/* Copy the peer's init packet. */
memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr,
ntohs(init_chunk->chunk_hdr->length));
/* Copy the raw local address list of the association. */
memcpy((__u8 *)&cookie->c.peer_init[0] +
ntohs(init_chunk->chunk_hdr->length), raw_addrs, addrs_len);
if (sctp_sk(ep->base.sk)->hmac) {
struct hash_desc desc;
/* Sign the message. */
sg_init_one(&sg, &cookie->c, bodysize);
desc.tfm = sctp_sk(ep->base.sk)->hmac;
desc.flags = 0;
if (crypto_hash_setkey(desc.tfm, ep->secret_key,
sizeof(ep->secret_key)) ||
crypto_hash_digest(&desc, &sg, bodysize, cookie->signature))
goto free_cookie;
}
return retval;
free_cookie:
kfree(retval);
nodata:
*cookie_len = 0;
return NULL;
}
| 15,714 |
157,673 | 0 | void ImeObserver::OnReset(const std::string& component_id) {
if (extension_id_.empty() || !HasListener(input_ime::OnReset::kEventName))
return;
std::unique_ptr<base::ListValue> args(
input_ime::OnReset::Create(component_id));
DispatchEventToExtension(extensions::events::INPUT_IME_ON_RESET,
input_ime::OnReset::kEventName, std::move(args));
}
| 15,715 |
58,649 | 0 | void rdp_write_security_header(STREAM* s, UINT16 flags)
{
/* Basic Security Header */
stream_write_UINT16(s, flags); /* flags */
stream_write_UINT16(s, 0); /* flagsHi (unused) */
}
| 15,716 |
176,605 | 0 | xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) {
const xmlChar *elemName;
const xmlChar *attrName;
xmlEnumerationPtr tree;
if (CMP9(CUR_PTR, '<', '!', 'A', 'T', 'T', 'L', 'I', 'S', 'T')) {
xmlParserInputPtr input = ctxt->input;
SKIP(9);
if (!IS_BLANK_CH(CUR)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after '<!ATTLIST'\n");
}
SKIP_BLANKS;
elemName = xmlParseName(ctxt);
if (elemName == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"ATTLIST: no name for Element\n");
return;
}
SKIP_BLANKS;
GROW;
while ((RAW != '>') && (ctxt->instate != XML_PARSER_EOF)) {
const xmlChar *check = CUR_PTR;
int type;
int def;
xmlChar *defaultValue = NULL;
GROW;
tree = NULL;
attrName = xmlParseName(ctxt);
if (attrName == NULL) {
xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
"ATTLIST: no name for Attribute\n");
break;
}
GROW;
if (!IS_BLANK_CH(CUR)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the attribute name\n");
break;
}
SKIP_BLANKS;
type = xmlParseAttributeType(ctxt, &tree);
if (type <= 0) {
break;
}
GROW;
if (!IS_BLANK_CH(CUR)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the attribute type\n");
if (tree != NULL)
xmlFreeEnumeration(tree);
break;
}
SKIP_BLANKS;
def = xmlParseDefaultDecl(ctxt, &defaultValue);
if (def <= 0) {
if (defaultValue != NULL)
xmlFree(defaultValue);
if (tree != NULL)
xmlFreeEnumeration(tree);
break;
}
if ((type != XML_ATTRIBUTE_CDATA) && (defaultValue != NULL))
xmlAttrNormalizeSpace(defaultValue, defaultValue);
GROW;
if (RAW != '>') {
if (!IS_BLANK_CH(CUR)) {
xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
"Space required after the attribute default value\n");
if (defaultValue != NULL)
xmlFree(defaultValue);
if (tree != NULL)
xmlFreeEnumeration(tree);
break;
}
SKIP_BLANKS;
}
if (check == CUR_PTR) {
xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR,
"in xmlParseAttributeListDecl\n");
if (defaultValue != NULL)
xmlFree(defaultValue);
if (tree != NULL)
xmlFreeEnumeration(tree);
break;
}
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
(ctxt->sax->attributeDecl != NULL))
ctxt->sax->attributeDecl(ctxt->userData, elemName, attrName,
type, def, defaultValue, tree);
else if (tree != NULL)
xmlFreeEnumeration(tree);
if ((ctxt->sax2) && (defaultValue != NULL) &&
(def != XML_ATTRIBUTE_IMPLIED) &&
(def != XML_ATTRIBUTE_REQUIRED)) {
xmlAddDefAttrs(ctxt, elemName, attrName, defaultValue);
}
if (ctxt->sax2) {
xmlAddSpecialAttr(ctxt, elemName, attrName, type);
}
if (defaultValue != NULL)
xmlFree(defaultValue);
GROW;
}
if (RAW == '>') {
if (input != ctxt->input) {
xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
"Attribute list declaration doesn't start and stop in the same entity\n",
NULL, NULL);
}
NEXT;
}
}
}
| 15,717 |
97,033 | 0 | static struct rtable *__mkroute_output(const struct fib_result *res,
const struct flowi4 *fl4, int orig_oif,
struct net_device *dev_out,
unsigned int flags)
{
struct fib_info *fi = res->fi;
struct fib_nh_exception *fnhe;
struct in_device *in_dev;
u16 type = res->type;
struct rtable *rth;
bool do_cache;
in_dev = __in_dev_get_rcu(dev_out);
if (!in_dev)
return ERR_PTR(-EINVAL);
if (likely(!IN_DEV_ROUTE_LOCALNET(in_dev)))
if (ipv4_is_loopback(fl4->saddr) && !(dev_out->flags & IFF_LOOPBACK))
return ERR_PTR(-EINVAL);
if (ipv4_is_lbcast(fl4->daddr))
type = RTN_BROADCAST;
else if (ipv4_is_multicast(fl4->daddr))
type = RTN_MULTICAST;
else if (ipv4_is_zeronet(fl4->daddr))
return ERR_PTR(-EINVAL);
if (dev_out->flags & IFF_LOOPBACK)
flags |= RTCF_LOCAL;
do_cache = true;
if (type == RTN_BROADCAST) {
flags |= RTCF_BROADCAST | RTCF_LOCAL;
fi = NULL;
} else if (type == RTN_MULTICAST) {
flags |= RTCF_MULTICAST | RTCF_LOCAL;
if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr,
fl4->flowi4_proto))
flags &= ~RTCF_LOCAL;
else
do_cache = false;
/* If multicast route do not exist use
* default one, but do not gateway in this case.
* Yes, it is hack.
*/
if (fi && res->prefixlen < 4)
fi = NULL;
} else if ((type == RTN_LOCAL) && (orig_oif != 0) &&
(orig_oif != dev_out->ifindex)) {
/* For local routes that require a particular output interface
* we do not want to cache the result. Caching the result
* causes incorrect behaviour when there are multiple source
* addresses on the interface, the end result being that if the
* intended recipient is waiting on that interface for the
* packet he won't receive it because it will be delivered on
* the loopback interface and the IP_PKTINFO ipi_ifindex will
* be set to the loopback interface as well.
*/
fi = NULL;
}
fnhe = NULL;
do_cache &= fi != NULL;
if (do_cache) {
struct rtable __rcu **prth;
struct fib_nh *nh = &FIB_RES_NH(*res);
fnhe = find_exception(nh, fl4->daddr);
if (fnhe)
prth = &fnhe->fnhe_rth_output;
else {
if (unlikely(fl4->flowi4_flags &
FLOWI_FLAG_KNOWN_NH &&
!(nh->nh_gw &&
nh->nh_scope == RT_SCOPE_LINK))) {
do_cache = false;
goto add;
}
prth = raw_cpu_ptr(nh->nh_pcpu_rth_output);
}
rth = rcu_dereference(*prth);
if (rt_cache_valid(rth)) {
dst_hold(&rth->dst);
return rth;
}
}
add:
rth = rt_dst_alloc(dev_out,
IN_DEV_CONF_GET(in_dev, NOPOLICY),
IN_DEV_CONF_GET(in_dev, NOXFRM),
do_cache);
if (!rth)
return ERR_PTR(-ENOBUFS);
rth->dst.output = ip_output;
rth->rt_genid = rt_genid_ipv4(dev_net(dev_out));
rth->rt_flags = flags;
rth->rt_type = type;
rth->rt_is_input = 0;
rth->rt_iif = orig_oif ? : 0;
rth->rt_pmtu = 0;
rth->rt_gateway = 0;
rth->rt_uses_gateway = 0;
INIT_LIST_HEAD(&rth->rt_uncached);
RT_CACHE_STAT_INC(out_slow_tot);
if (flags & RTCF_LOCAL)
rth->dst.input = ip_local_deliver;
if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) {
if (flags & RTCF_LOCAL &&
!(dev_out->flags & IFF_LOOPBACK)) {
rth->dst.output = ip_mc_output;
RT_CACHE_STAT_INC(out_slow_mc);
}
#ifdef CONFIG_IP_MROUTE
if (type == RTN_MULTICAST) {
if (IN_DEV_MFORWARD(in_dev) &&
!ipv4_is_local_multicast(fl4->daddr)) {
rth->dst.input = ip_mr_input;
rth->dst.output = ip_mc_output;
}
}
#endif
}
rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0);
return rth;
}
| 15,718 |
185,674 | 1 | void FragmentPaintPropertyTreeBuilder::UpdateFragmentClip() {
DCHECK(properties_);
if (NeedsPaintPropertyUpdate()) {
if (context_.fragment_clip) {
OnUpdateClip(properties_->UpdateFragmentClip(
context_.current.clip,
ClipPaintPropertyNode::State{context_.current.transform,
ToClipRect(*context_.fragment_clip)}));
} else {
OnClearClip(properties_->ClearFragmentClip());
}
}
if (properties_->FragmentClip())
context_.current.clip = properties_->FragmentClip();
}
| 15,719 |
94,024 | 0 | bool X86_insn_reg_intel2(unsigned int id, x86_reg *reg1, enum cs_ac_type *access1, x86_reg *reg2, enum cs_ac_type *access2)
{
unsigned int i;
for (i = 0; i < ARR_SIZE(insn_regs_intel2); i++) {
if (insn_regs_intel2[i].insn == id) {
*reg1 = insn_regs_intel2[i].reg1;
*reg2 = insn_regs_intel2[i].reg2;
if (access1)
*access1 = insn_regs_intel2[i].access1;
if (access2)
*access2 = insn_regs_intel2[i].access2;
return true;
}
}
return false;
}
| 15,720 |
122,436 | 0 | bool HTMLTextAreaElement::isValidValue(const String& candidate) const
{
return !valueMissing(candidate) && !tooLong(candidate, IgnoreDirtyFlag);
}
| 15,721 |
43,393 | 0 | static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk,
struct sockaddr *uaddr, int addr_len) {
struct net *net = sock_net(sk);
if (sk->sk_family == AF_INET) {
struct sockaddr_in *addr = (struct sockaddr_in *) uaddr;
int chk_addr_ret;
if (addr_len < sizeof(*addr))
return -EINVAL;
if (addr->sin_family != AF_INET &&
!(addr->sin_family == AF_UNSPEC &&
addr->sin_addr.s_addr == htonl(INADDR_ANY)))
return -EAFNOSUPPORT;
pr_debug("ping_check_bind_addr(sk=%p,addr=%pI4,port=%d)\n",
sk, &addr->sin_addr.s_addr, ntohs(addr->sin_port));
chk_addr_ret = inet_addr_type(net, addr->sin_addr.s_addr);
if (addr->sin_addr.s_addr == htonl(INADDR_ANY))
chk_addr_ret = RTN_LOCAL;
if ((net->ipv4.sysctl_ip_nonlocal_bind == 0 &&
isk->freebind == 0 && isk->transparent == 0 &&
chk_addr_ret != RTN_LOCAL) ||
chk_addr_ret == RTN_MULTICAST ||
chk_addr_ret == RTN_BROADCAST)
return -EADDRNOTAVAIL;
#if IS_ENABLED(CONFIG_IPV6)
} else if (sk->sk_family == AF_INET6) {
struct sockaddr_in6 *addr = (struct sockaddr_in6 *) uaddr;
int addr_type, scoped, has_addr;
struct net_device *dev = NULL;
if (addr_len < sizeof(*addr))
return -EINVAL;
if (addr->sin6_family != AF_INET6)
return -EAFNOSUPPORT;
pr_debug("ping_check_bind_addr(sk=%p,addr=%pI6c,port=%d)\n",
sk, addr->sin6_addr.s6_addr, ntohs(addr->sin6_port));
addr_type = ipv6_addr_type(&addr->sin6_addr);
scoped = __ipv6_addr_needs_scope_id(addr_type);
if ((addr_type != IPV6_ADDR_ANY &&
!(addr_type & IPV6_ADDR_UNICAST)) ||
(scoped && !addr->sin6_scope_id))
return -EINVAL;
rcu_read_lock();
if (addr->sin6_scope_id) {
dev = dev_get_by_index_rcu(net, addr->sin6_scope_id);
if (!dev) {
rcu_read_unlock();
return -ENODEV;
}
}
has_addr = pingv6_ops.ipv6_chk_addr(net, &addr->sin6_addr, dev,
scoped);
rcu_read_unlock();
if (!(isk->freebind || isk->transparent || has_addr ||
addr_type == IPV6_ADDR_ANY))
return -EADDRNOTAVAIL;
if (scoped)
sk->sk_bound_dev_if = addr->sin6_scope_id;
#endif
} else {
return -EAFNOSUPPORT;
}
return 0;
}
| 15,722 |
153,938 | 0 | void BackRenderbuffer::Destroy() {
if (id_ != 0) {
ScopedGLErrorSuppressor suppressor("BackRenderbuffer::Destroy",
decoder_->error_state_.get());
api()->glDeleteRenderbuffersEXTFn(1, &id_);
id_ = 0;
}
memory_tracker_.TrackMemFree(bytes_allocated_);
bytes_allocated_ = 0;
}
| 15,723 |
94,598 | 0 | int d_set_mounted(struct dentry *dentry)
{
struct dentry *p;
int ret = -ENOENT;
write_seqlock(&rename_lock);
for (p = dentry->d_parent; !IS_ROOT(p); p = p->d_parent) {
/* Need exclusion wrt. d_invalidate() */
spin_lock(&p->d_lock);
if (unlikely(d_unhashed(p))) {
spin_unlock(&p->d_lock);
goto out;
}
spin_unlock(&p->d_lock);
}
spin_lock(&dentry->d_lock);
if (!d_unlinked(dentry)) {
dentry->d_flags |= DCACHE_MOUNTED;
ret = 0;
}
spin_unlock(&dentry->d_lock);
out:
write_sequnlock(&rename_lock);
return ret;
}
| 15,724 |
80,125 | 0 | GF_Box *fpar_New()
{
ISOM_DECL_BOX_ALLOC(FilePartitionBox, GF_ISOM_BOX_TYPE_FPAR);
return (GF_Box *)tmp;
}
| 15,725 |
133,864 | 0 | bool HFSBTreeIterator::IsKeyUnexported(const base::string16& key) {
return key == kHFSDirMetadataFolder ||
key == kHFSMetadataFolder;
}
| 15,726 |
117,641 | 0 | bool BrowserInit::LaunchWithProfile::IsAppLaunch(std::string* app_url,
std::string* app_id) {
if (command_line_.HasSwitch(switches::kApp)) {
if (app_url)
*app_url = command_line_.GetSwitchValueASCII(switches::kApp);
return true;
}
if (command_line_.HasSwitch(switches::kAppId)) {
if (app_id)
*app_id = command_line_.GetSwitchValueASCII(switches::kAppId);
return true;
}
return false;
}
| 15,727 |
136,797 | 0 | CustomElementRegistry* LocalDOMWindow::customElements(
ScriptState* script_state) const {
if (!script_state->World().IsMainWorld())
return nullptr;
return customElements();
}
| 15,728 |
11,862 | 0 | static void daemon_usage(enum logcode F)
{
print_rsync_version(F);
rprintf(F,"\n");
rprintf(F,"Usage: rsync --daemon [OPTION]...\n");
rprintf(F," --address=ADDRESS bind to the specified address\n");
rprintf(F," --bwlimit=RATE limit socket I/O bandwidth\n");
rprintf(F," --config=FILE specify alternate rsyncd.conf file\n");
rprintf(F," -M, --dparam=OVERRIDE override global daemon config parameter\n");
rprintf(F," --no-detach do not detach from the parent\n");
rprintf(F," --port=PORT listen on alternate port number\n");
rprintf(F," --log-file=FILE override the \"log file\" setting\n");
rprintf(F," --log-file-format=FMT override the \"log format\" setting\n");
rprintf(F," --sockopts=OPTIONS specify custom TCP options\n");
rprintf(F," -v, --verbose increase verbosity\n");
rprintf(F," -4, --ipv4 prefer IPv4\n");
rprintf(F," -6, --ipv6 prefer IPv6\n");
rprintf(F," --help show this help screen\n");
rprintf(F,"\n");
rprintf(F,"If you were not trying to invoke rsync as a daemon, avoid using any of the\n");
rprintf(F,"daemon-specific rsync options. See also the rsyncd.conf(5) man page.\n");
}
| 15,729 |
47,452 | 0 | static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in,
unsigned int count, u8 *out)
{
/* We can't store directly to *out as it may be unaligned. */
/* BTW Don't reduce the buffer size below 128 Bytes!
* PadLock microcode needs it that big. */
char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__
((aligned(STACK_ALIGN)));
char *result = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT);
struct padlock_sha_desc *dctx = shash_desc_ctx(desc);
struct sha1_state state;
unsigned int space;
unsigned int leftover;
int ts_state;
int err;
dctx->fallback.flags = desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_shash_export(&dctx->fallback, &state);
if (err)
goto out;
if (state.count + count > ULONG_MAX)
return crypto_shash_finup(&dctx->fallback, in, count, out);
leftover = ((state.count - 1) & (SHA1_BLOCK_SIZE - 1)) + 1;
space = SHA1_BLOCK_SIZE - leftover;
if (space) {
if (count > space) {
err = crypto_shash_update(&dctx->fallback, in, space) ?:
crypto_shash_export(&dctx->fallback, &state);
if (err)
goto out;
count -= space;
in += space;
} else {
memcpy(state.buffer + leftover, in, count);
in = state.buffer;
count += leftover;
state.count &= ~(SHA1_BLOCK_SIZE - 1);
}
}
memcpy(result, &state.state, SHA1_DIGEST_SIZE);
/* prevent taking the spurious DNA fault with padlock. */
ts_state = irq_ts_save();
asm volatile (".byte 0xf3,0x0f,0xa6,0xc8" /* rep xsha1 */
: \
: "c"((unsigned long)state.count + count), \
"a"((unsigned long)state.count), \
"S"(in), "D"(result));
irq_ts_restore(ts_state);
padlock_output_block((uint32_t *)result, (uint32_t *)out, 5);
out:
return err;
}
| 15,730 |
92,523 | 0 | dequeue_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) { }
| 15,731 |
87,393 | 0 | static void release_memory_resource(struct resource *resource)
{
if (!resource)
return;
/*
* No need to reset region to identity mapped since we now
* know that no I/O can be in this region
*/
release_resource(resource);
kfree(resource);
}
| 15,732 |
39,621 | 0 | ssize_t wait_on_sync_kiocb(struct kiocb *req)
{
while (!req->ki_ctx) {
set_current_state(TASK_UNINTERRUPTIBLE);
if (req->ki_ctx)
break;
io_schedule();
}
__set_current_state(TASK_RUNNING);
return req->ki_user_data;
}
| 15,733 |
3,137 | 0 | static int setciedefgspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int CIESubst)
{
int code = 0;
ref CIEDict, *nocie;
ulong dictkey;
gs_md5_state_t md5;
byte key[16];
if (i_ctx_p->language_level < 3)
return_error(gs_error_undefined);
code = dict_find_string(systemdict, "NOCIE", &nocie);
if (code > 0) {
if (!r_has_type(nocie, t_boolean))
return_error(gs_error_typecheck);
if (nocie->value.boolval)
return setcmykspace(i_ctx_p, r, stage, cont, 1);
}
*cont = 0;
code = array_get(imemory, r, 1, &CIEDict);
if (code < 0)
return code;
if ((*stage) > 0) {
gs_client_color cc;
int i;
cc.pattern = 0x00;
for (i=0;i<4;i++)
cc.paint.values[i] = 0;
code = gs_setcolor(igs, &cc);
*stage = 0;
return code;
}
gs_md5_init(&md5);
/* If the hash (dictkey) is 0, we don't check for an existing
* ICC profile dor this space. So if we get an error hashing
* the space, we construct a new profile.
*/
dictkey = 0;
if (hashciedefgspace(i_ctx_p, r, &md5)) {
/* Ideally we would use the whole md5 hash, but the ICC code only
* expects a long. I'm 'slightly' concerned about collisions here
* but I think its unlikely really. If it ever becomes a problem
* we could add the hash bytes up, or modify the ICC cache to store
* the full 16 byte hashs.
*/
gs_md5_finish(&md5, key);
dictkey = *(ulong *)&key[sizeof(key) - sizeof(ulong)];
} else {
gs_md5_finish(&md5, key);
}
code = ciedefgspace(i_ctx_p, &CIEDict,dictkey);
*cont = 1;
(*stage)++;
return code;
}
| 15,734 |
108,613 | 0 | scoped_refptr<UploadData> CreateSimpleUploadData(const char* data) {
scoped_refptr<UploadData> upload(new UploadData);
upload->AppendBytes(data, strlen(data));
return upload;
}
| 15,735 |
82,694 | 0 | static int movw_pcdisp_reg(RAnal* anal, RAnalOp* op, ut16 code){
op->type = R_ANAL_OP_TYPE_LOAD;
op->dst = anal_fill_ai_rg (anal, GET_TARGET_REG(code));
op->src[0] = anal_pcrel_disp_mov (anal, op, code&0xFF, WORD_SIZE);
return op->size;
}
| 15,736 |
115,483 | 0 | void InjectedBundlePage::willRunJavaScriptConfirm(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo)
{
return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptConfirm(message, frame);
}
| 15,737 |
174,352 | 0 | Backtrace::~Backtrace() {
if (map_ && !map_shared_) {
delete map_;
map_ = nullptr;
}
}
| 15,738 |
154,563 | 0 | error::Error GLES2DecoderPassthroughImpl::DoBindFragDataLocationIndexedEXT(
GLuint program,
GLuint colorNumber,
GLuint index,
const char* name) {
api()->glBindFragDataLocationIndexedFn(
GetProgramServiceID(program, resources_), colorNumber, index, name);
return error::kNoError;
}
| 15,739 |
20,975 | 0 | static int add_to_pagemap(unsigned long addr, u64 pfn,
struct pagemapread *pm)
{
pm->buffer[pm->pos++] = pfn;
if (pm->pos >= pm->len)
return PM_END_OF_BUFFER;
return 0;
}
| 15,740 |
141,423 | 0 | bool PaintLayerScrollableArea::HasVerticalOverflow() const {
LayoutUnit client_height =
LayoutContentRect(kIncludeScrollbars).Height() -
HorizontalScrollbarHeight(kIgnorePlatformAndCSSOverlayScrollbarSize);
LayoutUnit scroll_height(ScrollHeight());
LayoutUnit box_y = GetLayoutBox()->Location().Y();
return SnapSizeToPixel(scroll_height, box_y) >
SnapSizeToPixel(client_height, box_y);
}
| 15,741 |
138,770 | 0 | void RenderFrameHostImpl::OnSwapOutACK() {
OnSwappedOut();
}
| 15,742 |
151,472 | 0 | FixedPolicySubresourceFilter(LoadPolicy policy, int* filtered_load_counter)
: policy_(policy), filtered_load_counter_(filtered_load_counter) {}
| 15,743 |
139,671 | 0 | void AudioContext::notifyNodeStartedProcessing(AudioNode* node)
{
refNode(node);
}
| 15,744 |
71,774 | 0 | static MagickBooleanType WriteTXTImage(const ImageInfo *image_info,Image *image)
{
char
buffer[MaxTextExtent],
colorspace[MaxTextExtent],
tuple[MaxTextExtent];
MagickBooleanType
status;
MagickOffsetType
scene;
MagickPixelPacket
pixel;
register const IndexPacket
*indexes;
register const PixelPacket
*p;
register ssize_t
x;
ssize_t
y;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
status=OpenBlob(image_info,image,WriteBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
scene=0;
do
{
ComplianceType
compliance;
(void) CopyMagickString(colorspace,CommandOptionToMnemonic(
MagickColorspaceOptions,(ssize_t) image->colorspace),MaxTextExtent);
LocaleLower(colorspace);
image->depth=GetImageQuantumDepth(image,MagickTrue);
if (image->matte != MagickFalse)
(void) ConcatenateMagickString(colorspace,"a",MaxTextExtent);
compliance=NoCompliance;
if (LocaleCompare(image_info->magick,"SPARSE-COLOR") != 0)
{
(void) FormatLocaleString(buffer,MaxTextExtent,
"# ImageMagick pixel enumeration: %.20g,%.20g,%.20g,%s\n",(double)
image->columns,(double) image->rows,(double) ((MagickOffsetType)
GetQuantumRange(image->depth)),colorspace);
(void) WriteBlobString(image,buffer);
compliance=SVGCompliance;
}
GetMagickPixelPacket(image,&pixel);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetMagickPixelPacket(image,p,indexes+x,&pixel);
if (pixel.colorspace == LabColorspace)
{
pixel.green-=(QuantumRange+1)/2.0;
pixel.blue-=(QuantumRange+1)/2.0;
}
if (LocaleCompare(image_info->magick,"SPARSE-COLOR") == 0)
{
/*
Sparse-color format.
*/
if (GetPixelOpacity(p) == (Quantum) OpaqueOpacity)
{
GetColorTuple(&pixel,MagickFalse,tuple);
(void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple,
&image->exception);
(void) FormatLocaleString(buffer,MaxTextExtent,"%.20g,%.20g,",
(double) x,(double) y);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image,tuple);
(void) WriteBlobString(image," ");
}
p++;
continue;
}
(void) FormatLocaleString(buffer,MaxTextExtent,"%.20g,%.20g: ",(double)
x,(double) y);
(void) WriteBlobString(image,buffer);
(void) CopyMagickString(tuple,"(",MaxTextExtent);
ConcatenateColorComponent(&pixel,RedChannel,compliance,tuple);
(void) ConcatenateMagickString(tuple,",",MaxTextExtent);
ConcatenateColorComponent(&pixel,GreenChannel,compliance,tuple);
(void) ConcatenateMagickString(tuple,",",MaxTextExtent);
ConcatenateColorComponent(&pixel,BlueChannel,compliance,tuple);
if (pixel.colorspace == CMYKColorspace)
{
(void) ConcatenateMagickString(tuple,",",MaxTextExtent);
ConcatenateColorComponent(&pixel,IndexChannel,compliance,tuple);
}
if (pixel.matte != MagickFalse)
{
(void) ConcatenateMagickString(tuple,",",MaxTextExtent);
ConcatenateColorComponent(&pixel,AlphaChannel,compliance,tuple);
}
(void) ConcatenateMagickString(tuple,")",MaxTextExtent);
(void) WriteBlobString(image,tuple);
(void) WriteBlobString(image," ");
GetColorTuple(&pixel,MagickTrue,tuple);
(void) FormatLocaleString(buffer,MaxTextExtent,"%s",tuple);
(void) WriteBlobString(image,buffer);
(void) WriteBlobString(image," ");
(void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple,
&image->exception);
(void) WriteBlobString(image,tuple);
(void) WriteBlobString(image,"\n");
p++;
}
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
if (GetNextImageInList(image) == (Image *) NULL)
break;
image=SyncNextImageInList(image);
status=SetImageProgress(image,SaveImagesTag,scene++,
GetImageListLength(image));
if (status == MagickFalse)
break;
} while (image_info->adjoin != MagickFalse);
(void) CloseBlob(image);
return(MagickTrue);
}
| 15,745 |
2,362 | 0 | int ldb_dn_set_extended_component(struct ldb_dn *dn,
const char *name, const struct ldb_val *val)
{
struct ldb_dn_ext_component *p;
unsigned int i;
struct ldb_val v2;
if ( ! ldb_dn_validate(dn)) {
return LDB_ERR_OTHER;
}
if (!ldb_dn_extended_syntax_by_name(dn->ldb, name)) {
/* We don't know how to handle this type of thing */
return LDB_ERR_INVALID_DN_SYNTAX;
}
for (i=0; i < dn->ext_comp_num; i++) {
if (ldb_attr_cmp(dn->ext_components[i].name, name) == 0) {
if (val) {
dn->ext_components[i].value =
ldb_val_dup(dn->ext_components, val);
dn->ext_components[i].name =
talloc_strdup(dn->ext_components, name);
if (!dn->ext_components[i].name ||
!dn->ext_components[i].value.data) {
ldb_dn_mark_invalid(dn);
return LDB_ERR_OPERATIONS_ERROR;
}
} else {
if (i != (dn->ext_comp_num - 1)) {
memmove(&dn->ext_components[i],
&dn->ext_components[i+1],
((dn->ext_comp_num-1) - i) *
sizeof(*dn->ext_components));
}
dn->ext_comp_num--;
dn->ext_components = talloc_realloc(dn,
dn->ext_components,
struct ldb_dn_ext_component,
dn->ext_comp_num);
if (!dn->ext_components) {
ldb_dn_mark_invalid(dn);
return LDB_ERR_OPERATIONS_ERROR;
}
}
LDB_FREE(dn->ext_linearized);
return LDB_SUCCESS;
}
}
if (val == NULL) {
/* removing a value that doesn't exist is not an error */
return LDB_SUCCESS;
}
v2 = *val;
p = dn->ext_components
= talloc_realloc(dn,
dn->ext_components,
struct ldb_dn_ext_component,
dn->ext_comp_num + 1);
if (!dn->ext_components) {
ldb_dn_mark_invalid(dn);
return LDB_ERR_OPERATIONS_ERROR;
}
p[dn->ext_comp_num].value = ldb_val_dup(dn->ext_components, &v2);
p[dn->ext_comp_num].name = talloc_strdup(p, name);
if (!dn->ext_components[i].name || !dn->ext_components[i].value.data) {
ldb_dn_mark_invalid(dn);
return LDB_ERR_OPERATIONS_ERROR;
}
dn->ext_components = p;
dn->ext_comp_num++;
LDB_FREE(dn->ext_linearized);
return LDB_SUCCESS;
}
| 15,746 |
99,260 | 0 | bool ResourceMessageFilter::CheckBenchmarkingEnabled() {
static bool checked = false;
static bool result = false;
if (!checked) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
result = command_line.HasSwitch(switches::kEnableBenchmarking);
checked = true;
}
return result;
}
| 15,747 |
89,885 | 0 | static void upnp_event_recv(struct upnp_event_notify * obj)
{
int n;
n = recv(obj->s, obj->buffer, obj->buffersize, 0);
if(n<0) {
if(errno != EAGAIN &&
errno != EWOULDBLOCK &&
errno != EINTR) {
syslog(LOG_ERR, "%s: recv(): %m", "upnp_event_recv");
obj->state = EError;
}
return;
}
syslog(LOG_DEBUG, "%s: (%dbytes) %.*s", "upnp_event_recv",
n, n, obj->buffer);
/* TODO : do something with the data recevied ?
* right now, n (number of bytes received) is ignored
* We may need to recv() more bytes. */
obj->state = EFinished;
if(obj->sub)
obj->sub->seq++;
}
| 15,748 |
141,157 | 0 | Document& Document::MasterDocument() const {
if (!imports_controller_)
return *const_cast<Document*>(this);
Document* master = imports_controller_->Master();
DCHECK(master);
return *master;
}
| 15,749 |
69,437 | 0 | static int set_chmod_dacl(struct cifs_acl *pndacl, struct cifs_sid *pownersid,
struct cifs_sid *pgrpsid, __u64 nmode)
{
u16 size = 0;
struct cifs_acl *pnndacl;
pnndacl = (struct cifs_acl *)((char *)pndacl + sizeof(struct cifs_acl));
size += fill_ace_for_sid((struct cifs_ace *) ((char *)pnndacl + size),
pownersid, nmode, S_IRWXU);
size += fill_ace_for_sid((struct cifs_ace *)((char *)pnndacl + size),
pgrpsid, nmode, S_IRWXG);
size += fill_ace_for_sid((struct cifs_ace *)((char *)pnndacl + size),
&sid_everyone, nmode, S_IRWXO);
pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl));
pndacl->num_aces = cpu_to_le32(3);
return 0;
}
| 15,750 |
148,655 | 0 | void PostAsyncTask(SkiaOutputSurfaceDependency* dependency,
const base::RepeatingCallback<void(Args...)>& callback,
Args... args) {
dependency->PostTaskToClientThread(base::BindOnce(callback, args...));
}
| 15,751 |
103,179 | 0 | void Browser::SavePage() {
UserMetrics::RecordAction(UserMetricsAction("SavePage"), profile_);
TabContents* current_tab = GetSelectedTabContents();
if (current_tab && current_tab->contents_mime_type() == "application/pdf")
UserMetrics::RecordAction(UserMetricsAction("PDF.SavePage"), profile_);
GetSelectedTabContentsWrapper()->download_tab_helper()->OnSavePage();
}
| 15,752 |
113,369 | 0 | void WebProcessProxy::addMessageReceiver(CoreIPC::StringReference messageReceiverName, uint64_t destinationID, CoreIPC::MessageReceiver* messageReceiver)
{
m_messageReceiverMap.addMessageReceiver(messageReceiverName, destinationID, messageReceiver);
}
| 15,753 |
28,306 | 0 | void uio_event_notify(struct uio_info *info)
{
struct uio_device *idev = info->uio_dev;
atomic_inc(&idev->event);
wake_up_interruptible(&idev->wait);
kill_fasync(&idev->async_queue, SIGIO, POLL_IN);
}
| 15,754 |
15,468 | 0 | basic_authentication_encode (const char *user, const char *passwd)
{
char *t1, *t2;
int len1 = strlen (user) + 1 + strlen (passwd);
t1 = (char *)alloca (len1 + 1);
sprintf (t1, "%s:%s", user, passwd);
t2 = (char *)alloca (BASE64_LENGTH (len1) + 1);
wget_base64_encode (t1, len1, t2);
return concat_strings ("Basic ", t2, (char *) 0);
}
| 15,755 |
93,854 | 0 | virDomainMigrateConfirm3(virDomainPtr domain,
const char *cookiein,
int cookieinlen,
unsigned long flags,
int cancelled)
{
virConnectPtr conn;
VIR_DOMAIN_DEBUG(domain,
"cookiein=%p, cookieinlen=%d, flags=%lx, cancelled=%d",
cookiein, cookieinlen, flags, cancelled);
virResetLastError();
virCheckDomainReturn(domain, -1);
conn = domain->conn;
virCheckReadOnlyGoto(conn->flags, error);
if (conn->driver->domainMigrateConfirm3) {
int ret;
ret = conn->driver->domainMigrateConfirm3(domain,
cookiein, cookieinlen,
flags, cancelled);
if (ret < 0)
goto error;
return ret;
}
virReportUnsupportedError();
error:
virDispatchError(domain->conn);
return -1;
}
| 15,756 |
129,140 | 0 | scoped_refptr<const Extension> GetExtensionWithHostPermission(
const std::string& id,
const std::string& host_permissions,
Manifest::Location location) {
ListBuilder permissions;
if (!host_permissions.empty())
permissions.Append(host_permissions);
return ExtensionBuilder()
.SetManifest(
DictionaryBuilder()
.Set("name", id)
.Set("description", "an extension")
.Set("manifest_version", 2)
.Set("version", "1.0.0")
.Set("permissions", permissions.Pass())
.Build())
.SetLocation(location)
.SetID(id)
.Build();
}
| 15,757 |
66,724 | 0 | static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
{
dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61,
NULL, DVB_PLL_THOMSON_DTT7579);
return 0;
}
| 15,758 |
170,436 | 0 | inline static status_t finish_flatten_binder(
const sp<IBinder>& /*binder*/, const flat_binder_object& flat, Parcel* out)
{
return out->writeObject(flat, false);
}
| 15,759 |
170,691 | 0 | static EAS_RESULT Parse_fmt (SDLS_SYNTHESIZER_DATA *pDLSData, EAS_I32 pos, S_WSMP_DATA *p)
{
EAS_RESULT result;
EAS_U16 wtemp;
EAS_U32 ltemp;
/* seek to start of chunk */
if ((result = EAS_HWFileSeek(pDLSData->hwInstData, pDLSData->fileHandle, pos)) != EAS_SUCCESS)
return result;
/* get format tag */
if ((result = EAS_HWGetWord(pDLSData->hwInstData, pDLSData->fileHandle, &wtemp, EAS_FALSE)) != EAS_SUCCESS)
return result;
if (wtemp != WAVE_FORMAT_PCM)
{
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Unsupported DLS sample format %04x\n", wtemp); */ }
return EAS_ERROR_UNRECOGNIZED_FORMAT;
}
/* get number of channels */
if ((result = EAS_HWGetWord(pDLSData->hwInstData, pDLSData->fileHandle, &wtemp, EAS_FALSE)) != EAS_SUCCESS)
return result;
if (wtemp != 1)
{
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "No support for DLS multi-channel samples\n"); */ }
return EAS_ERROR_UNRECOGNIZED_FORMAT;
}
/* get sample rate */
if ((result = EAS_HWGetDWord(pDLSData->hwInstData, pDLSData->fileHandle, &p->sampleRate, EAS_FALSE)) != EAS_SUCCESS)
return result;
/* bytes/sec */
if ((result = EAS_HWGetDWord(pDLSData->hwInstData, pDLSData->fileHandle, <emp, EAS_FALSE)) != EAS_SUCCESS)
return result;
/* block align */
if ((result = EAS_HWGetWord(pDLSData->hwInstData, pDLSData->fileHandle, &wtemp, EAS_FALSE)) != EAS_SUCCESS)
return result;
/* bits/sample */
if ((result = EAS_HWGetWord(pDLSData->hwInstData, pDLSData->fileHandle, &p->bitsPerSample, EAS_FALSE)) != EAS_SUCCESS)
return result;
if ((p->bitsPerSample != 8) && (p->bitsPerSample != 16))
{
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "Unsupported DLS bits-per-sample %d\n", p->bitsPerSample); */ }
return EAS_ERROR_UNRECOGNIZED_FORMAT;
}
return EAS_SUCCESS;
}
| 15,760 |
180,140 | 1 | int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{
int ret = 0, size = 0;
const char *name = NULL;
char *value = NULL;
struct iattr newattrs;
umode_t new_mode = inode->i_mode, old_mode = inode->i_mode;
switch (type) {
case ACL_TYPE_ACCESS:
name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
ret = posix_acl_equiv_mode(acl, &new_mode);
if (ret < 0)
goto out;
if (ret == 0)
acl = NULL;
}
break;
case ACL_TYPE_DEFAULT:
if (!S_ISDIR(inode->i_mode)) {
ret = acl ? -EINVAL : 0;
goto out;
}
name = XATTR_NAME_POSIX_ACL_DEFAULT;
break;
default:
ret = -EINVAL;
goto out;
}
if (acl) {
size = posix_acl_xattr_size(acl->a_count);
value = kmalloc(size, GFP_NOFS);
if (!value) {
ret = -ENOMEM;
goto out;
}
ret = posix_acl_to_xattr(&init_user_ns, acl, value, size);
if (ret < 0)
goto out_free;
}
if (new_mode != old_mode) {
newattrs.ia_mode = new_mode;
newattrs.ia_valid = ATTR_MODE;
ret = __ceph_setattr(inode, &newattrs);
if (ret)
goto out_free;
}
ret = __ceph_setxattr(inode, name, value, size, 0);
if (ret) {
if (new_mode != old_mode) {
newattrs.ia_mode = old_mode;
newattrs.ia_valid = ATTR_MODE;
__ceph_setattr(inode, &newattrs);
}
goto out_free;
}
ceph_set_cached_acl(inode, type, acl);
out_free:
kfree(value);
out:
return ret;
}
| 15,761 |
112,346 | 0 | void NotifyOnUI(int type, int render_process_id, int render_view_id,
scoped_ptr<T> detail) {
RenderViewHostImpl* host =
RenderViewHostImpl::FromID(render_process_id, render_view_id);
if (host) {
RenderViewHostDelegate* delegate = host->GetDelegate();
NotificationService::current()->Notify(
type, Source<WebContents>(delegate->GetAsWebContents()),
Details<T>(detail.get()));
}
}
| 15,762 |
148,557 | 0 | void WebContentsImpl::WebContentsTreeNode::SetFocusedWebContents(
WebContentsImpl* web_contents) {
DCHECK(!outer_web_contents())
<< "Only the outermost WebContents tracks focus.";
focused_web_contents_ = web_contents;
}
| 15,763 |
62,514 | 0 | resp_print(netdissect_options *ndo, const u_char *bp, u_int length)
{
int ret_len = 0, length_cur = length;
if(!bp || length <= 0)
return;
ND_PRINT((ndo, ": RESP"));
while (length_cur > 0) {
/*
* This block supports redis pipelining.
* For example, multiple operations can be pipelined within the same string:
* "*2\r\n\$4\r\nINCR\r\n\$1\r\nz\r\n*2\r\n\$4\r\nINCR\r\n\$1\r\nz\r\n*2\r\n\$4\r\nINCR\r\n\$1\r\nz\r\n"
* or
* "PING\r\nPING\r\nPING\r\n"
* In order to handle this case, we must try and parse 'bp' until
* 'length' bytes have been processed or we reach a trunc condition.
*/
ret_len = resp_parse(ndo, bp, length_cur);
TEST_RET_LEN_NORETURN(ret_len);
bp += ret_len;
length_cur -= ret_len;
}
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
}
| 15,764 |
19,909 | 0 | static void nfs4_free_reclaim_complete_data(void *data)
{
struct nfs4_reclaim_complete_data *calldata = data;
kfree(calldata);
}
| 15,765 |
2,465 | 0 | const char *smbXcli_conn_remote_name(struct smbXcli_conn *conn)
{
return conn->remote_name;
}
| 15,766 |
129,845 | 0 | void TraceEventTestFixture::DropTracedMetadataRecords() {
scoped_ptr<ListValue> old_trace_parsed(trace_parsed_.DeepCopy());
size_t old_trace_parsed_size = old_trace_parsed->GetSize();
trace_parsed_.Clear();
for (size_t i = 0; i < old_trace_parsed_size; i++) {
Value* value = NULL;
old_trace_parsed->Get(i, &value);
if (!value || value->GetType() != Value::TYPE_DICTIONARY) {
trace_parsed_.Append(value->DeepCopy());
continue;
}
DictionaryValue* dict = static_cast<DictionaryValue*>(value);
std::string tmp;
if (dict->GetString("ph", &tmp) && tmp == "M")
continue;
trace_parsed_.Append(value->DeepCopy());
}
}
| 15,767 |
185,424 | 1 | void CachingPermutedEntropyProvider::RegisterPrefs(
PrefRegistrySimple* registry) {
registry->RegisterStringPref(prefs::kVariationsPermutedEntropyCache,
std::string());
}
| 15,768 |
169,387 | 0 | SynchronizeVisualPropertiesMessageFilter::WaitForSurfaceId() {
surface_id_run_loop_.reset(new base::RunLoop);
surface_id_run_loop_->Run();
return last_surface_id_;
}
| 15,769 |
113,354 | 0 | void VideoRendererBase::Initialize(const scoped_refptr<VideoDecoder>& decoder,
const PipelineStatusCB& status_cb,
const StatisticsCB& statistics_cb,
const TimeCB& time_cb) {
base::AutoLock auto_lock(lock_);
DCHECK(decoder);
DCHECK(!status_cb.is_null());
DCHECK(!statistics_cb.is_null());
DCHECK(!time_cb.is_null());
DCHECK_EQ(kUninitialized, state_);
decoder_ = decoder;
statistics_cb_ = statistics_cb;
time_cb_ = time_cb;
host()->SetNaturalVideoSize(decoder_->natural_size());
state_ = kFlushed;
set_opaque_cb_.Run(!decoder->HasAlpha());
set_opaque_cb_.Reset();
if (!base::PlatformThread::Create(0, this, &thread_)) {
NOTREACHED() << "Video thread creation failed";
state_ = kError;
status_cb.Run(PIPELINE_ERROR_INITIALIZATION_FAILED);
return;
}
#if defined(OS_WIN)
::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL);
#endif // defined(OS_WIN)
status_cb.Run(PIPELINE_OK);
}
| 15,770 |
11,741 | 0 | linux_lvm2_vg_start_completed_cb (DBusGMethodInvocation *context,
Device *device,
gboolean job_was_cancelled,
int status,
const char *stderr,
const char *stdout,
gpointer user_data)
{
if (WEXITSTATUS (status) == 0 && !job_was_cancelled)
{
dbus_g_method_return (context);
}
else
{
if (job_was_cancelled)
{
throw_error (context, ERROR_CANCELLED, "Job was cancelled");
}
else
{
throw_error (context,
ERROR_FAILED,
"Error starting LVM2 Volume Group: vgchange exited with exit code %d: %s",
WEXITSTATUS (status),
stderr);
}
}
}
| 15,771 |
16,706 | 0 | pdf_keep_document(fz_context *ctx, pdf_document *doc)
{
return (pdf_document *)fz_keep_document(ctx, &doc->super);
}
| 15,772 |
151,311 | 0 | std::unique_ptr<TracedValue> InspectorLayerInvalidationTrackingEvent::Data(
const PaintLayer* layer,
const char* reason) {
const LayoutObject& paint_invalidation_container =
layer->GetLayoutObject().ContainerForPaintInvalidation();
std::unique_ptr<TracedValue> value = TracedValue::Create();
value->SetString("frame",
ToHexString(paint_invalidation_container.GetFrame()));
SetGeneratingNodeInfo(value.get(), &paint_invalidation_container, "paintId");
value->SetString("reason", reason);
return value;
}
| 15,773 |
59,413 | 0 | xmlCreateDocParserCtxt(const xmlChar *cur) {
int len;
if (cur == NULL)
return(NULL);
len = xmlStrlen(cur);
return(xmlCreateMemoryParserCtxt((const char *)cur, len));
}
| 15,774 |
95,115 | 0 | static int annot_store_cb(annotate_state_t *astate, void *rock)
{
struct annot_store_rock *arock = rock;
return annotate_state_store(astate, arock->entryatts);
}
| 15,775 |
182,393 | 1 | static int sh_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {
ut8 op_MSB,op_LSB;
int ret;
if (!data)
return 0;
memset (op, '\0', sizeof (RAnalOp));
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
op->jump = op->fail = -1;
op->ptr = op->val = -1;
op->size = 2;
op_MSB = anal->big_endian? data[0]: data[1];
op_LSB = anal->big_endian? data[1]: data[0];
ret = first_nibble_decode[(op_MSB>>4) & 0x0F](anal, op, (ut16)(op_MSB<<8 | op_LSB));
return ret;
}
| 15,776 |
3,552 | 0 | gs_malloc_init(void)
{
gs_malloc_memory_t *malloc_memory_default = gs_malloc_memory_init();
gs_memory_t *memory_t_default;
if (malloc_memory_default == NULL)
return NULL;
if (gs_lib_ctx_init((gs_memory_t *)malloc_memory_default) != 0)
return NULL;
#if defined(USE_RETRY_MEMORY_WRAPPER)
gs_malloc_wrap(&memory_t_default, malloc_memory_default);
#else
memory_t_default = (gs_memory_t *)malloc_memory_default;
#endif
memory_t_default->stable_memory = memory_t_default;
return memory_t_default;
}
| 15,777 |
184,265 | 1 | static void unregisterBlobURLTask(void* context)
{
OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobRegistryContext*>(context));
blobRegistry().unregisterBlobURL(blobRegistryContext->url);
}
| 15,778 |
123,258 | 0 | void RenderWidgetHostViewAura::UnlockMouse() {
aura::RootWindow* root_window = window_->GetRootWindow();
if (!mouse_locked_ || !root_window)
return;
mouse_locked_ = false;
window_->ReleaseCapture();
window_->MoveCursorTo(unlocked_mouse_position_);
aura::client::CursorClient* cursor_client =
aura::client::GetCursorClient(root_window);
if (cursor_client)
cursor_client->ShowCursor(true);
if (aura::client::GetTooltipClient(root_window))
aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true);
host_->LostMouseLock();
}
| 15,779 |
86,618 | 0 | static struct fpm_child_s *fpm_resources_prepare(struct fpm_worker_pool_s *wp) /* {{{ */
{
struct fpm_child_s *c;
c = fpm_child_alloc();
if (!c) {
zlog(ZLOG_ERROR, "[pool %s] unable to malloc new child", wp->config->name);
return 0;
}
c->wp = wp;
c->fd_stdout = -1; c->fd_stderr = -1;
if (0 > fpm_stdio_prepare_pipes(c)) {
fpm_child_free(c);
return 0;
}
if (0 > fpm_scoreboard_proc_alloc(wp->scoreboard, &c->scoreboard_i)) {
fpm_stdio_discard_pipes(c);
fpm_child_free(c);
return 0;
}
return c;
}
/* }}} */
| 15,780 |
30,397 | 0 | vmci_transport_packet_get_addresses(struct vmci_transport_packet *pkt,
struct sockaddr_vm *local,
struct sockaddr_vm *remote)
{
vsock_addr_init(local, pkt->dg.dst.context, pkt->dst_port);
vsock_addr_init(remote, pkt->dg.src.context, pkt->src_port);
}
| 15,781 |
73,027 | 0 | static int colorCmp (const void *x, const void *y)
{
int a = *(int const *)x;
int b = *(int const *)y;
return (a > b) - (a < b);
}
| 15,782 |
78,918 | 0 | AddLedMap(CompatInfo *info, LedInfo *new, bool same_file)
{
enum led_field collide;
const int verbosity = xkb_context_get_log_verbosity(info->ctx);
const bool report = (same_file && verbosity > 0) || verbosity > 9;
for (xkb_led_index_t i = 0; i < info->num_leds; i++) {
LedInfo *old = &info->leds[i];
if (old->led.name != new->led.name)
continue;
if (old->led.mods.mods == new->led.mods.mods &&
old->led.groups == new->led.groups &&
old->led.ctrls == new->led.ctrls &&
old->led.which_mods == new->led.which_mods &&
old->led.which_groups == new->led.which_groups) {
old->defined |= new->defined;
return true;
}
if (new->merge == MERGE_REPLACE) {
if (report)
log_warn(info->ctx,
"Map for indicator %s redefined; "
"Earlier definition ignored\n",
xkb_atom_text(info->ctx, old->led.name));
*old = *new;
return true;
}
collide = 0;
if (UseNewLEDField(LED_FIELD_MODS, old, new, report, &collide)) {
old->led.which_mods = new->led.which_mods;
old->led.mods = new->led.mods;
old->defined |= LED_FIELD_MODS;
}
if (UseNewLEDField(LED_FIELD_GROUPS, old, new, report, &collide)) {
old->led.which_groups = new->led.which_groups;
old->led.groups = new->led.groups;
old->defined |= LED_FIELD_GROUPS;
}
if (UseNewLEDField(LED_FIELD_CTRLS, old, new, report, &collide)) {
old->led.ctrls = new->led.ctrls;
old->defined |= LED_FIELD_CTRLS;
}
if (collide) {
log_warn(info->ctx,
"Map for indicator %s redefined; "
"Using %s definition for duplicate fields\n",
xkb_atom_text(info->ctx, old->led.name),
(new->merge == MERGE_AUGMENT ? "first" : "last"));
}
return true;
}
if (info->num_leds >= XKB_MAX_LEDS) {
log_err(info->ctx,
"Too many LEDs defined (maximum %d)\n",
XKB_MAX_LEDS);
return false;
}
info->leds[info->num_leds++] = *new;
return true;
}
| 15,783 |
121,311 | 0 | net::RequestPriority ConvertWebKitPriorityToNetPriority(
const WebURLRequest::Priority& priority) {
switch (priority) {
case WebURLRequest::PriorityVeryHigh:
return net::HIGHEST;
case WebURLRequest::PriorityHigh:
return net::MEDIUM;
case WebURLRequest::PriorityMedium:
return net::LOW;
case WebURLRequest::PriorityLow:
return net::LOWEST;
case WebURLRequest::PriorityVeryLow:
return net::IDLE;
case WebURLRequest::PriorityUnresolved:
default:
NOTREACHED();
return net::LOW;
}
}
| 15,784 |
103,026 | 0 | TabContentsWrapper* CreateTabContents() {
return Browser::TabContentsFactory(profile(), NULL, 0, NULL, NULL);
}
| 15,785 |
168,911 | 0 | DevToolsAgentHostImpl::DevToolsAgentHostImpl(const std::string& id) : id_(id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
| 15,786 |
73,888 | 0 | static int error_inject_set(void *data, u64 val)
{
if (!error_type)
return -EINVAL;
return einj_error_inject(error_type, error_flags, error_param1, error_param2,
error_param3, error_param4);
}
| 15,787 |
176,904 | 0 | void InputDispatcher::KeyEntry::appendDescription(String8& msg) const {
msg.appendFormat("KeyEvent(deviceId=%d, source=0x%08x, action=%d, "
"flags=0x%08x, keyCode=%d, scanCode=%d, metaState=0x%08x, "
"repeatCount=%d), policyFlags=0x%08x",
deviceId, source, action, flags, keyCode, scanCode, metaState,
repeatCount, policyFlags);
}
| 15,788 |
34,043 | 0 | static void xen_netbk_tx_submit(struct xen_netbk *netbk)
{
struct gnttab_copy *gop = netbk->tx_copy_ops;
struct sk_buff *skb;
while ((skb = __skb_dequeue(&netbk->tx_queue)) != NULL) {
struct xen_netif_tx_request *txp;
struct xenvif *vif;
u16 pending_idx;
unsigned data_len;
pending_idx = *((u16 *)skb->data);
vif = netbk->pending_tx_info[pending_idx].vif;
txp = &netbk->pending_tx_info[pending_idx].req;
/* Check the remap error code. */
if (unlikely(xen_netbk_tx_check_gop(netbk, skb, &gop))) {
netdev_dbg(vif->dev, "netback grant failed.\n");
skb_shinfo(skb)->nr_frags = 0;
kfree_skb(skb);
continue;
}
data_len = skb->len;
memcpy(skb->data,
(void *)(idx_to_kaddr(netbk, pending_idx)|txp->offset),
data_len);
if (data_len < txp->size) {
/* Append the packet payload as a fragment. */
txp->offset += data_len;
txp->size -= data_len;
} else {
/* Schedule a response immediately. */
xen_netbk_idx_release(netbk, pending_idx);
}
if (txp->flags & XEN_NETTXF_csum_blank)
skb->ip_summed = CHECKSUM_PARTIAL;
else if (txp->flags & XEN_NETTXF_data_validated)
skb->ip_summed = CHECKSUM_UNNECESSARY;
xen_netbk_fill_frags(netbk, skb);
/*
* If the initial fragment was < PKT_PROT_LEN then
* pull through some bytes from the other fragments to
* increase the linear region to PKT_PROT_LEN bytes.
*/
if (skb_headlen(skb) < PKT_PROT_LEN && skb_is_nonlinear(skb)) {
int target = min_t(int, skb->len, PKT_PROT_LEN);
__pskb_pull_tail(skb, target - skb_headlen(skb));
}
skb->dev = vif->dev;
skb->protocol = eth_type_trans(skb, skb->dev);
if (checksum_setup(vif, skb)) {
netdev_dbg(vif->dev,
"Can't setup checksum in net_tx_action\n");
kfree_skb(skb);
continue;
}
vif->dev->stats.rx_bytes += skb->len;
vif->dev->stats.rx_packets++;
xenvif_receive_skb(vif, skb);
}
}
| 15,789 |
138,246 | 0 | void AXObjectCacheImpl::handleAriaSelectedChanged(Node* node) {
AXObject* obj = get(node);
if (!obj)
return;
postNotification(obj, AXCheckedStateChanged);
AXObject* listbox = obj->parentObjectUnignored();
if (listbox && listbox->roleValue() == ListBoxRole)
postNotification(listbox, AXSelectedChildrenChanged);
}
| 15,790 |
106,842 | 0 | static void computeLogicalLeftPositionedOffset(int& logicalLeftPos, const RenderBox* child, int logicalWidthValue, const RenderBoxModelObject* containerBlock, int containerLogicalWidth)
{
if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingMode() && containerBlock->style()->isFlippedBlocksWritingMode()) {
logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeftPos;
logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderRight() : containerBlock->borderBottom());
} else
logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderLeft() : containerBlock->borderTop());
}
| 15,791 |
93,249 | 0 | fs_print(netdissect_options *ndo,
register const u_char *bp, int length)
{
int fs_op;
unsigned long i;
if (length <= (int)sizeof(struct rx_header))
return;
if (ndo->ndo_snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) {
goto trunc;
}
/*
* Print out the afs call we're invoking. The table used here was
* gleaned from fsint/afsint.xg
*/
fs_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " fs call %s", tok2str(fs_req, "op#%d", fs_op)));
/*
* Print out arguments to some of the AFS calls. This stuff is
* all from afsint.xg
*/
bp += sizeof(struct rx_header) + 4;
/*
* Sigh. This is gross. Ritchie forgive me.
*/
switch (fs_op) {
case 130: /* Fetch data */
FIDOUT();
ND_PRINT((ndo, " offset"));
UINTOUT();
ND_PRINT((ndo, " length"));
UINTOUT();
break;
case 131: /* Fetch ACL */
case 132: /* Fetch Status */
case 143: /* Old set lock */
case 144: /* Old extend lock */
case 145: /* Old release lock */
case 156: /* Set lock */
case 157: /* Extend lock */
case 158: /* Release lock */
FIDOUT();
break;
case 135: /* Store status */
FIDOUT();
STOREATTROUT();
break;
case 133: /* Store data */
FIDOUT();
STOREATTROUT();
ND_PRINT((ndo, " offset"));
UINTOUT();
ND_PRINT((ndo, " length"));
UINTOUT();
ND_PRINT((ndo, " flen"));
UINTOUT();
break;
case 134: /* Store ACL */
{
char a[AFSOPAQUEMAX+1];
FIDOUT();
ND_TCHECK2(bp[0], 4);
i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
ND_TCHECK2(bp[0], i);
i = min(AFSOPAQUEMAX, i);
strncpy(a, (const char *) bp, i);
a[i] = '\0';
acl_print(ndo, (u_char *) a, sizeof(a), (u_char *) a + i);
break;
}
case 137: /* Create file */
case 141: /* MakeDir */
FIDOUT();
STROUT(AFSNAMEMAX);
STOREATTROUT();
break;
case 136: /* Remove file */
case 142: /* Remove directory */
FIDOUT();
STROUT(AFSNAMEMAX);
break;
case 138: /* Rename file */
ND_PRINT((ndo, " old"));
FIDOUT();
STROUT(AFSNAMEMAX);
ND_PRINT((ndo, " new"));
FIDOUT();
STROUT(AFSNAMEMAX);
break;
case 139: /* Symlink */
FIDOUT();
STROUT(AFSNAMEMAX);
ND_PRINT((ndo, " link to"));
STROUT(AFSNAMEMAX);
break;
case 140: /* Link */
FIDOUT();
STROUT(AFSNAMEMAX);
ND_PRINT((ndo, " link to"));
FIDOUT();
break;
case 148: /* Get volume info */
STROUT(AFSNAMEMAX);
break;
case 149: /* Get volume stats */
case 150: /* Set volume stats */
ND_PRINT((ndo, " volid"));
UINTOUT();
break;
case 154: /* New get volume info */
ND_PRINT((ndo, " volname"));
STROUT(AFSNAMEMAX);
break;
case 155: /* Bulk stat */
case 65536: /* Inline bulk stat */
{
unsigned long j;
ND_TCHECK2(bp[0], 4);
j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
FIDOUT();
if (i != j - 1)
ND_PRINT((ndo, ","));
}
if (j == 0)
ND_PRINT((ndo, " <none!>"));
break;
}
case 65537: /* Fetch data 64 */
FIDOUT();
ND_PRINT((ndo, " offset"));
UINT64OUT();
ND_PRINT((ndo, " length"));
UINT64OUT();
break;
case 65538: /* Store data 64 */
FIDOUT();
STOREATTROUT();
ND_PRINT((ndo, " offset"));
UINT64OUT();
ND_PRINT((ndo, " length"));
UINT64OUT();
ND_PRINT((ndo, " flen"));
UINT64OUT();
break;
case 65541: /* CallBack rx conn address */
ND_PRINT((ndo, " addr"));
UINTOUT();
default:
;
}
return;
trunc:
ND_PRINT((ndo, " [|fs]"));
}
| 15,792 |
79,654 | 0 | char *M_fs_path_user_confdir(M_fs_system_t sys_type)
{
char *out;
M_fs_error_t res;
#ifdef _WIN32
res = M_fs_path_norm(&out, "%APPDATA%", M_FS_PATH_NORM_NONE, sys_type);
#elif defined(__APPLE__)
res = M_fs_path_norm(&out, "~/Library/Application Support/", M_FS_PATH_NORM_HOME, sys_type);
#else
res = M_fs_path_norm(&out, "~/.config", M_FS_PATH_NORM_HOME, sys_type);
#endif
if (res != M_FS_ERROR_SUCCESS)
return NULL;
return out;
}
| 15,793 |
170,652 | 0 | int PreProcessingFx_GetDescriptor(effect_handle_t self,
effect_descriptor_t *pDescriptor)
{
preproc_effect_t * effect = (preproc_effect_t *) self;
if (effect == NULL || pDescriptor == NULL) {
return -EINVAL;
}
*pDescriptor = *sDescriptors[effect->procId];
return 0;
}
| 15,794 |
64,089 | 0 | static int decode_dsw1(GetByteContext *gb, uint8_t *frame, int width, int height)
{
const uint8_t *frame_start = frame;
const uint8_t *frame_end = frame + width * height;
int mask = 0x10000, bitbuf = 0;
int v, offset, count, segments;
segments = bytestream2_get_le16(gb);
while (segments--) {
if (bytestream2_get_bytes_left(gb) < 2)
return AVERROR_INVALIDDATA;
if (mask == 0x10000) {
bitbuf = bytestream2_get_le16u(gb);
mask = 1;
}
if (frame_end - frame < 2)
return AVERROR_INVALIDDATA;
if (bitbuf & mask) {
v = bytestream2_get_le16(gb);
offset = (v & 0x1FFF) << 1;
count = ((v >> 13) + 2) << 1;
if (frame - frame_start < offset || frame_end - frame < count)
return AVERROR_INVALIDDATA;
av_memcpy_backptr(frame, offset, count);
frame += count;
} else if (bitbuf & (mask << 1)) {
frame += bytestream2_get_le16(gb);
} else {
*frame++ = bytestream2_get_byte(gb);
*frame++ = bytestream2_get_byte(gb);
}
mask <<= 2;
}
return 0;
}
| 15,795 |
101,047 | 0 | void QuotaManagerProxy::NotifyStorageModified(
QuotaClient::ID client_id,
const GURL& origin,
StorageType type,
int64 delta) {
if (!io_thread_->BelongsToCurrentThread()) {
io_thread_->PostTask(FROM_HERE, NewRunnableMethod(
this, &QuotaManagerProxy::NotifyStorageModified,
client_id, origin, type, delta));
return;
}
if (manager_)
manager_->NotifyStorageModified(client_id, origin, type, delta);
}
| 15,796 |
16,456 | 0 | sysapi_uname_opsys(void)
{
return sysapi_opsys();
}
| 15,797 |
106,259 | 0 | void JSTestSerializedScriptValueInterface::finishCreation(JSGlobalData& globalData)
{
Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
}
| 15,798 |
124,172 | 0 | RenderViewHostImpl* RenderViewHostManager::pending_render_view_host() const {
return pending_render_view_host_;
}
| 15,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.