unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
158,650 | 0 | void GLES2DecoderImpl::BindTexImage2DCHROMIUMImpl(const char* function_name,
GLenum target,
GLenum internalformat,
GLint image_id) {
if (target == GL_TEXTURE_CUBE_MAP) {
LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, function_name, "invalid target");
return;
}
TextureRef* texture_ref =
texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target);
if (!texture_ref) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "no texture bound");
return;
}
gl::GLImage* image = image_manager()->LookupImage(image_id);
if (!image) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
"no image found with the given ID");
return;
}
Texture::ImageState image_state = Texture::UNBOUND;
{
ScopedGLErrorSuppressor suppressor(
"GLES2DecoderImpl::DoBindTexImage2DCHROMIUM", GetErrorState());
if (internalformat) {
if (image->BindTexImageWithInternalformat(target, internalformat))
image_state = Texture::BOUND;
} else {
if (image->BindTexImage(target))
image_state = Texture::BOUND;
}
}
gfx::Size size = image->GetSize();
GLenum texture_internalformat =
internalformat ? internalformat : image->GetInternalFormat();
texture_manager()->SetLevelInfo(texture_ref, target, 0,
texture_internalformat, size.width(),
size.height(), 1, 0, texture_internalformat,
GL_UNSIGNED_BYTE, gfx::Rect(size));
texture_manager()->SetLevelImage(texture_ref, target, 0, image, image_state);
}
| 17,200 |
52,703 | 0 | int snd_timer_pause(struct snd_timer_instance * timeri)
{
if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE)
return snd_timer_stop_slave(timeri, false);
else
return snd_timer_stop1(timeri, false);
}
| 17,201 |
69,534 | 0 | static struct key *request_master_key(struct encrypted_key_payload *epayload,
u8 **master_key, size_t *master_keylen)
{
struct key *mkey = NULL;
if (!strncmp(epayload->master_desc, KEY_TRUSTED_PREFIX,
KEY_TRUSTED_PREFIX_LEN)) {
mkey = request_trusted_key(epayload->master_desc +
KEY_TRUSTED_PREFIX_LEN,
master_key, master_keylen);
} else if (!strncmp(epayload->master_desc, KEY_USER_PREFIX,
KEY_USER_PREFIX_LEN)) {
mkey = request_user_key(epayload->master_desc +
KEY_USER_PREFIX_LEN,
master_key, master_keylen);
} else
goto out;
if (IS_ERR(mkey)) {
int ret = PTR_ERR(mkey);
if (ret == -ENOTSUPP)
pr_info("encrypted_key: key %s not supported",
epayload->master_desc);
else
pr_info("encrypted_key: key %s not found",
epayload->master_desc);
goto out;
}
dump_master_key(*master_key, *master_keylen);
out:
return mkey;
}
| 17,202 |
33 | 0 | int main(int argc, char *argv[])
{
int opt;
char *line;
progname = basename(argv[0]);
#if POSIXLY_CORRECT
cmd_line_options = POSIXLY_CMD_LINE_OPTIONS;
#else
if (getenv(POSIXLY_CORRECT_STR))
posixly_correct = 1;
if (!posixly_correct)
cmd_line_options = CMD_LINE_OPTIONS;
else
cmd_line_options = POSIXLY_CMD_LINE_OPTIONS;
#endif
setlocale(LC_CTYPE, "");
setlocale(LC_MESSAGES, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
/* Align `#effective:' comments to column 40 for tty's */
if (!posixly_correct && isatty(fileno(stdout)))
print_options |= TEXT_SMART_INDENT;
while ((opt = getopt_long(argc, argv, cmd_line_options,
long_options, NULL)) != -1) {
switch (opt) {
case 'a': /* acl only */
if (posixly_correct)
goto synopsis;
opt_print_acl = 1;
break;
case 'd': /* default acl only */
opt_print_default_acl = 1;
break;
case 'c': /* no comments */
if (posixly_correct)
goto synopsis;
opt_comments = 0;
break;
case 'e': /* all #effective comments */
if (posixly_correct)
goto synopsis;
print_options |= TEXT_ALL_EFFECTIVE;
break;
case 'E': /* no #effective comments */
if (posixly_correct)
goto synopsis;
print_options &= ~(TEXT_SOME_EFFECTIVE |
TEXT_ALL_EFFECTIVE);
break;
case 'R': /* recursive */
if (posixly_correct)
goto synopsis;
walk_flags |= WALK_TREE_RECURSIVE;
break;
case 'L': /* follow all symlinks */
if (posixly_correct)
goto synopsis;
walk_flags |= WALK_TREE_LOGICAL;
walk_flags &= ~WALK_TREE_PHYSICAL;
break;
case 'P': /* skip all symlinks */
if (posixly_correct)
goto synopsis;
walk_flags |= WALK_TREE_PHYSICAL;
walk_flags &= ~WALK_TREE_LOGICAL;
break;
case 's': /* skip files with only base entries */
if (posixly_correct)
goto synopsis;
opt_skip_base = 1;
break;
case 'p':
if (posixly_correct)
goto synopsis;
opt_strip_leading_slash = 0;
break;
case 't':
if (posixly_correct)
goto synopsis;
opt_tabular = 1;
break;
case 'n': /* numeric */
opt_numeric = 1;
print_options |= TEXT_NUMERIC_IDS;
break;
case 'v': /* print version */
printf("%s " VERSION "\n", progname);
return 0;
case 'h': /* help */
help();
return 0;
case ':': /* option missing */
case '?': /* unknown option */
default:
goto synopsis;
}
}
if (!(opt_print_acl || opt_print_default_acl)) {
opt_print_acl = 1;
if (!posixly_correct)
opt_print_default_acl = 1;
}
if ((optind == argc) && !posixly_correct)
goto synopsis;
do {
if (optind == argc ||
strcmp(argv[optind], "-") == 0) {
while ((line = next_line(stdin)) != NULL) {
if (*line == '\0')
continue;
had_errors += walk_tree(line, walk_flags, 0,
do_print, NULL);
}
if (!feof(stdin)) {
fprintf(stderr, _("%s: Standard input: %s\n"),
progname, strerror(errno));
had_errors++;
}
} else
had_errors += walk_tree(argv[optind], walk_flags, 0,
do_print, NULL);
optind++;
} while (optind < argc);
return had_errors ? 1 : 0;
synopsis:
fprintf(stderr, _("Usage: %s [-%s] file ...\n"),
progname, cmd_line_options);
fprintf(stderr, _("Try `%s --help' for more information.\n"),
progname);
return 2;
}
| 17,203 |
126,020 | 0 | void AllViewsStoppedLoadingObserver::OnFirstPendingLoad(
content::WebContents* web_contents) {
pending_tabs_.insert(web_contents);
}
| 17,204 |
28,688 | 0 | static ssize_t lbs_lowrssi_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
return lbs_threshold_read(TLV_TYPE_RSSI_LOW, CMD_SUBSCRIBE_RSSI_LOW,
file, userbuf, count, ppos);
}
| 17,205 |
46,112 | 0 | int dtls1_is_timer_expired(SSL *s)
{
struct timeval timeleft;
/* Get time left until timeout, return false if no timer running */
if (dtls1_get_timeout(s, &timeleft) == NULL)
{
return 0;
}
/* Return false if timer is not expired yet */
if (timeleft.tv_sec > 0 || timeleft.tv_usec > 0)
{
return 0;
}
/* Timer expired, so return true */
return 1;
}
| 17,206 |
124,436 | 0 | void WebRuntimeFeatures::enableNetworkInformation(bool enable)
{
RuntimeEnabledFeatures::setNetworkInformationEnabled(enable);
}
| 17,207 |
159,990 | 0 | void DiskCacheBackendTest::BackendTransaction(const std::string& name,
int num_entries,
bool load) {
success_ = false;
ASSERT_TRUE(CopyTestCache(name));
DisableFirstCleanup();
uint32_t mask;
if (load) {
mask = 0xf;
SetMaxSize(0x100000);
} else {
mask = 0;
SetMaxSize(0);
}
SetMask(mask);
InitCache();
ASSERT_EQ(num_entries + 1, cache_->GetEntryCount());
std::string key("the first key");
disk_cache::Entry* entry1;
ASSERT_NE(net::OK, OpenEntry(key, &entry1));
int actual = cache_->GetEntryCount();
if (num_entries != actual) {
ASSERT_TRUE(load);
ASSERT_EQ(num_entries - 1, actual);
}
cache_.reset();
cache_impl_ = NULL;
ASSERT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, MaxSize(), mask));
success_ = true;
}
| 17,208 |
69,514 | 0 | static int rxrpc_preparse_s(struct key_preparsed_payload *prep)
{
struct crypto_blkcipher *ci;
_enter("%zu", prep->datalen);
if (prep->datalen != 8)
return -EINVAL;
memcpy(&prep->type_data, prep->data, 8);
ci = crypto_alloc_blkcipher("pcbc(des)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(ci)) {
_leave(" = %ld", PTR_ERR(ci));
return PTR_ERR(ci);
}
if (crypto_blkcipher_setkey(ci, prep->data, 8) < 0)
BUG();
prep->payload[0] = ci;
_leave(" = 0");
return 0;
}
| 17,209 |
136,224 | 0 | bool WebPageSerializer::serialize(WebLocalFrame* frame,
WebPageSerializerClient* client,
const WebVector<WebURL>& links,
const WebVector<WebString>& localPaths,
const WebString& localDirectoryName)
{
WebPageSerializerImpl serializerImpl(
frame, client, links, localPaths, localDirectoryName);
return serializerImpl.serialize();
}
| 17,210 |
171,899 | 0 | static void btif_hl_proc_dch_close_cfm(tBTA_HL *p_data)
{
btif_hl_mdl_cb_t *p_dcb;
btif_hl_mcl_cb_t *p_mcb;
UINT8 app_idx, mcl_idx, mdl_idx;
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
if (btif_hl_find_mdl_idx_using_handle(p_data->dch_close_cfm.mdl_handle,
&app_idx, &mcl_idx, &mdl_idx ))
{
p_dcb = BTIF_HL_GET_MDL_CB_PTR(app_idx, mcl_idx, mdl_idx);
btif_hl_release_socket(app_idx,mcl_idx,mdl_idx);
btif_hl_clean_mdl_cb(p_dcb);
p_mcb = BTIF_HL_GET_MCL_CB_PTR(app_idx,mcl_idx);
if (!btif_hl_num_dchs_in_use(p_mcb->mcl_handle))
btif_hl_start_cch_timer(app_idx, mcl_idx);
BTIF_TRACE_DEBUG(" local DCH close success mdl_idx=%d", mdl_idx);
}
}
| 17,211 |
134,465 | 0 | int tab_h_offset() {
static int value = -1;
if (value == -1) {
switch (ui::GetDisplayLayout()) {
case ui::LAYOUT_DESKTOP:
value = -26;
break;
case ui::LAYOUT_TOUCH:
value = -34;
break;
default:
NOTREACHED();
}
}
return value;
}
| 17,212 |
51,776 | 0 | parse_single_hex_dump_line(char* rec, guint8 *buf, guint byte_offset)
{
int num_items_scanned, i;
unsigned int bytes[16];
num_items_scanned = sscanf(rec, "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
&bytes[0], &bytes[1], &bytes[2], &bytes[3],
&bytes[4], &bytes[5], &bytes[6], &bytes[7],
&bytes[8], &bytes[9], &bytes[10], &bytes[11],
&bytes[12], &bytes[13], &bytes[14], &bytes[15]);
if (num_items_scanned == 0)
return -1;
if (num_items_scanned > 16)
num_items_scanned = 16;
for (i=0; i<num_items_scanned; i++) {
buf[byte_offset + i] = (guint8)bytes[i];
}
return num_items_scanned;
}
| 17,213 |
135,511 | 0 | OfflinePageDownloadBridge::~OfflinePageDownloadBridge() {}
| 17,214 |
165,184 | 0 | DragController::DragController(Page* page)
: page_(page),
document_under_mouse_(nullptr),
drag_initiator_(nullptr),
file_input_element_under_mouse_(nullptr),
document_is_handling_drag_(false),
drag_destination_action_(kDragDestinationActionNone),
did_initiate_drag_(false) {}
| 17,215 |
36,714 | 0 | static int gss_spnegomechglue_init(void)
{
struct gss_mech_config mech_spnego;
memset(&mech_spnego, 0, sizeof(mech_spnego));
mech_spnego.mech = &spnego_mechanism;
mech_spnego.mechNameStr = "spnego";
mech_spnego.mech_type = GSS_C_NO_OID;
return gssint_register_mechinfo(&mech_spnego);
}
| 17,216 |
175,100 | 0 | bool SoundPool::unload(int sampleID)
{
ALOGV("unload: sampleID=%d", sampleID);
Mutex::Autolock lock(&mLock);
return mSamples.removeItem(sampleID);
}
| 17,217 |
80,829 | 0 | GF_Err rssr_dump(GF_Box *a, FILE * trace)
{
GF_ReceivedSsrcBox *p = (GF_ReceivedSsrcBox *)a;
gf_isom_box_dump_start(a, "ReceivedSsrcBox", trace);
fprintf(trace, "SSRC=\"%d\">\n", p->ssrc);
gf_isom_box_dump_done("ReceivedSsrcBox", a, trace);
return GF_OK;
}
| 17,218 |
9,807 | 0 | static int http_replace_value(struct my_regex *re, char *dst, uint dst_size, char *val, int len, char delim,
const char *rep_str)
{
char* p = val;
char* dst_end = dst + dst_size;
char* dst_p = dst;
for (;;) {
char *p_delim;
/* look for delim. */
p_delim = p;
while (p_delim < p + len && *p_delim != delim)
p_delim++;
if (regex_exec_match2(re, p, p_delim-p, MAX_MATCH, pmatch)) {
int replace_n = exp_replace(dst_p, dst_end - dst_p, p, rep_str, pmatch);
if (replace_n < 0)
return -1;
dst_p += replace_n;
} else {
uint len = p_delim - p;
if (dst_p + len >= dst_end)
return -1;
memcpy(dst_p, p, len);
dst_p += len;
}
if (dst_p >= dst_end)
return -1;
/* end of the replacements. */
if (p_delim >= p + len)
break;
/* Next part. */
*dst_p++ = delim;
p = p_delim + 1;
}
return dst_p - dst;
}
| 17,219 |
138,065 | 0 | bool AXNodeObject::isHovered() const {
if (Node* node = this->getNode())
return node->isHovered();
return false;
}
| 17,220 |
56,192 | 0 | armpmu_map_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
{
int mapping;
if (config >= PERF_COUNT_HW_MAX)
return -EINVAL;
mapping = (*event_map)[config];
return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
}
| 17,221 |
70,580 | 0 | evdns_base_get_nameserver_addr(struct evdns_base *base, int idx,
struct sockaddr *sa, ev_socklen_t len)
{
int result = -1;
int i;
struct nameserver *server;
EVDNS_LOCK(base);
server = base->server_head;
for (i = 0; i < idx && server; ++i, server = server->next) {
if (server->next == base->server_head)
goto done;
}
if (! server)
goto done;
if (server->addrlen > len) {
result = (int) server->addrlen;
goto done;
}
memcpy(sa, &server->address, server->addrlen);
result = (int) server->addrlen;
done:
EVDNS_UNLOCK(base);
return result;
}
| 17,222 |
136,258 | 0 | void CSPSourceList::parse(const UChar* begin, const UChar* end)
{
if (isSourceListNone(begin, end))
return;
const UChar* position = begin;
while (position < end) {
skipWhile<UChar, isASCIISpace>(position, end);
if (position == end)
return;
const UChar* beginSource = position;
skipWhile<UChar, isSourceCharacter>(position, end);
String scheme, host, path;
int port = 0;
CSPSource::WildcardDisposition hostWildcard = CSPSource::NoWildcard;
CSPSource::WildcardDisposition portWildcard = CSPSource::NoWildcard;
if (parseSource(beginSource, position, scheme, host, port, path, hostWildcard, portWildcard)) {
if (scheme.isEmpty() && host.isEmpty())
continue;
if (m_policy->isDirectiveName(host))
m_policy->reportDirectiveAsSourceExpression(m_directiveName, host);
m_list.append(CSPSource(m_policy, scheme, host, port, path, hostWildcard, portWildcard));
} else {
m_policy->reportInvalidSourceExpression(m_directiveName, String(beginSource, position - beginSource));
}
ASSERT(position == end || isASCIISpace(*position));
}
}
| 17,223 |
138,488 | 0 | HTMLScriptRunner::~HTMLScriptRunner()
{
#if ENABLE(OILPAN)
detach();
#else
ASSERT(!m_document);
#endif
}
| 17,224 |
155,971 | 0 | bool DiceTurnSyncOnHelper::HasCanOfferSigninError() {
std::string error_msg;
bool can_offer =
CanOfferSignin(profile_, CAN_OFFER_SIGNIN_FOR_ALL_ACCOUNTS,
account_info_.gaia, account_info_.email, &error_msg);
if (can_offer)
return false;
delegate_->ShowLoginError(account_info_.email, error_msg);
return true;
}
| 17,225 |
172,897 | 0 | void do_init(char UNUSED *p)
{
bdt_init();
}
| 17,226 |
760 | 0 | poppler_image_mapping_copy (PopplerImageMapping *mapping)
{
PopplerImageMapping *new_mapping;
new_mapping = poppler_image_mapping_new ();
*new_mapping = *mapping;
return new_mapping;
}
| 17,227 |
46,764 | 0 | static int cbc_decrypt(struct blkcipher_desc *desc,
struct scatterlist *dst, struct scatterlist *src,
unsigned int nbytes)
{
struct des_sparc64_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
struct blkcipher_walk walk;
int err;
blkcipher_walk_init(&walk, dst, src, nbytes);
err = blkcipher_walk_virt(desc, &walk);
desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
des_sparc64_load_keys(&ctx->decrypt_expkey[0]);
while ((nbytes = walk.nbytes)) {
unsigned int block_len = nbytes & DES_BLOCK_MASK;
if (likely(block_len)) {
des_sparc64_cbc_decrypt((const u64 *)walk.src.virt.addr,
(u64 *) walk.dst.virt.addr,
block_len, (u64 *) walk.iv);
}
nbytes &= DES_BLOCK_SIZE - 1;
err = blkcipher_walk_done(desc, &walk, nbytes);
}
fprs_write(0);
return err;
}
| 17,228 |
87,816 | 0 | R_API void r_core_cmd_init(RCore *core) {
struct {
const char *cmd;
const char *description;
r_cmd_callback (cb);
void (*descriptor_init)(RCore *core);
} cmds[] = {
{"!", "run system command", cmd_system},
{"_", "print last output", cmd_last},
{"#", "calculate hash", cmd_hash},
{"$", "alias", cmd_alias},
{"%", "short version of 'env' command", cmd_env},
{"&", "tasks", cmd_tasks},
{"(", "macro", cmd_macro, cmd_macro_init},
{"*", "pointer read/write", cmd_pointer},
{"-", "open cfg.editor and run script", cmd_stdin},
{".", "interpret", cmd_interpret},
{"/", "search kw, pattern aes", cmd_search, cmd_search_init},
{"=", "io pipe", cmd_rap},
{"?", "help message", cmd_help, cmd_help_init},
{"\\", "alias for =!", cmd_rap_run},
{"'", "alias for =!", cmd_rap_run},
{"0x", "alias for s 0x", cmd_ox},
{"analysis", "analysis", cmd_anal, cmd_anal_init},
{"bsize", "change block size", cmd_bsize},
{"cmp", "compare memory", cmd_cmp, cmd_cmp_init},
{"Code", "code metadata", cmd_meta, cmd_meta_init},
{"debug", "debugger operations", cmd_debug, cmd_debug_init},
{"eval", "evaluate configuration variable", cmd_eval, cmd_eval_init},
{"flag", "get/set flags", cmd_flag, cmd_flag_init},
{"g", "egg manipulation", cmd_egg, cmd_egg_init},
{"info", "get file info", cmd_info, cmd_info_init},
{"kuery", "perform sdb query", cmd_kuery},
{"l", "list files and directories", cmd_ls},
{"join", "join the contents of the two files", cmd_join},
{"head", "show the top n number of line in file", cmd_head},
{"L", "manage dynamically loaded plugins", cmd_plugins},
{"mount", "mount filesystem", cmd_mount, cmd_mount_init},
{"open", "open or map file", cmd_open, cmd_open_init},
{"print", "print current block", cmd_print, cmd_print_init},
{"Project", "project", cmd_project, cmd_project_init},
{"quit", "exit program session", cmd_quit, cmd_quit_init},
{"Q", "alias for q!", cmd_Quit},
{":", "long commands starting with :", cmd_colon},
{"resize", "change file size", cmd_resize},
{"seek", "seek to an offset", cmd_seek, cmd_seek_init},
{"t", "type information (cparse)", cmd_type, cmd_type_init},
{"Text", "Text log utility", cmd_log, cmd_log_init},
{"u", "uname/undo", cmd_uname},
{"<", "pipe into RCons.readChar", cmd_pipein},
{"Visual", "enter visual mode", cmd_visual},
{"visualPanels", "enter visual mode", cmd_panels},
{"write", "write bytes", cmd_write, cmd_write_init},
{"x", "alias for px", cmd_hexdump},
{"yank", "yank bytes", cmd_yank},
{"zign", "zignatures", cmd_zign, cmd_zign_init},
};
core->rcmd = r_cmd_new ();
core->rcmd->macro.user = core;
core->rcmd->macro.num = core->num;
core->rcmd->macro.cmd = core_cmd0_wrapper;
core->rcmd->nullcallback = r_core_cmd_nullcallback;
core->rcmd->macro.cb_printf = (PrintfCallback)r_cons_printf;
r_cmd_set_data (core->rcmd, core);
core->cmd_descriptors = r_list_newf (free);
int i;
for (i = 0; i < R_ARRAY_SIZE (cmds); i++) {
r_cmd_add (core->rcmd, cmds[i].cmd, cmds[i].description, cmds[i].cb);
if (cmds[i].descriptor_init) {
cmds[i].descriptor_init (core);
}
}
DEFINE_CMD_DESCRIPTOR_SPECIAL (core, $, dollar);
DEFINE_CMD_DESCRIPTOR_SPECIAL (core, %, percent);
DEFINE_CMD_DESCRIPTOR_SPECIAL (core, *, star);
DEFINE_CMD_DESCRIPTOR_SPECIAL (core, ., dot);
DEFINE_CMD_DESCRIPTOR_SPECIAL (core, =, equal);
DEFINE_CMD_DESCRIPTOR (core, b);
DEFINE_CMD_DESCRIPTOR (core, k);
DEFINE_CMD_DESCRIPTOR (core, r);
DEFINE_CMD_DESCRIPTOR (core, u);
DEFINE_CMD_DESCRIPTOR (core, y);
cmd_descriptor_init (core);
}
| 17,229 |
114,290 | 0 | void WebGraphicsContext3DCommandBufferImpl::blitFramebufferCHROMIUM(
WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1,
WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1,
WGC3Dbitfield mask, WGC3Denum filter) {
gl_->BlitFramebufferEXT(
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter);
}
| 17,230 |
21,751 | 0 | static int em_imul_3op(struct x86_emulate_ctxt *ctxt)
{
ctxt->dst.val = ctxt->src2.val;
return em_imul(ctxt);
}
| 17,231 |
139,299 | 0 | static inline void addToHarfBuzzBufferInternal(hb_buffer_t* buffer,
const FontDescription& fontDescription, const UChar* normalizedBuffer,
unsigned startIndex, unsigned numCharacters)
{
if (fontDescription.variant() == FontVariantSmallCaps
&& u_islower(normalizedBuffer[startIndex])) {
String upperText = String(normalizedBuffer + startIndex, numCharacters)
.upper();
ASSERT(!upperText.is8Bit());
hb_buffer_add_utf16(buffer, toUint16(upperText.characters16()),
numCharacters, 0, numCharacters);
} else {
hb_buffer_add_utf16(buffer, toUint16(normalizedBuffer + startIndex),
numCharacters, 0, numCharacters);
}
}
| 17,232 |
133,527 | 0 | void OverscrollControllerAndroid::SetNeedsAnimate() {
compositor_->SetNeedsAnimate();
}
| 17,233 |
85,140 | 0 | static int posix_get_monotonic_coarse(clockid_t which_clock,
struct timespec64 *tp)
{
*tp = get_monotonic_coarse64();
return 0;
}
| 17,234 |
123,275 | 0 | void RenderWidgetHostViewGtk::Blur() {
host_->Blur();
}
| 17,235 |
169,708 | 0 | bool IsNull(base::DictionaryValue* value, const std::string& key) {
base::Value* child = NULL;
if (!value->Get(key, &child)) {
ADD_FAILURE();
return false;
}
return child->GetType() == base::Value::TYPE_NULL;
}
| 17,236 |
52,010 | 0 | dissect_NOTIFY_INFO(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep)
{
guint32 count;
offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
hf_notify_info_version, NULL);
offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
hf_notify_info_flags, NULL);
offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
hf_notify_info_count, &count);
if (!di->conformant_run)
col_append_fstr(
pinfo->cinfo, COL_INFO, ", %d %s", count,
notify_plural(count));
offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, di, drep,
dissect_NOTIFY_INFO_DATA);
return offset;
}
| 17,237 |
135,662 | 0 | Element* FrameSelection::RootEditableElementOrDocumentElement() const {
Element* selection_root =
ComputeVisibleSelectionInDOMTreeDeprecated().RootEditableElement();
return selection_root ? selection_root : GetDocument().documentElement();
}
| 17,238 |
41,230 | 0 | static void tcp_update_cwnd_in_recovery(struct sock *sk, int newly_acked_sacked,
int fast_rexmit, int flag)
{
struct tcp_sock *tp = tcp_sk(sk);
int sndcnt = 0;
int delta = tp->snd_ssthresh - tcp_packets_in_flight(tp);
if (tcp_packets_in_flight(tp) > tp->snd_ssthresh) {
u64 dividend = (u64)tp->snd_ssthresh * tp->prr_delivered +
tp->prior_cwnd - 1;
sndcnt = div_u64(dividend, tp->prior_cwnd) - tp->prr_out;
} else {
sndcnt = min_t(int, delta,
max_t(int, tp->prr_delivered - tp->prr_out,
newly_acked_sacked) + 1);
}
sndcnt = max(sndcnt, (fast_rexmit ? 1 : 0));
tp->snd_cwnd = tcp_packets_in_flight(tp) + sndcnt;
}
| 17,239 |
122,145 | 0 | void finishCurrentOverlapTestingContext()
{
m_overlapStack[m_overlapStack.size() - 2].unite(m_overlapStack.last());
m_overlapStack.removeLast();
}
| 17,240 |
108,155 | 0 | GLsizei gl_stride() const {
return gl_stride_;
}
| 17,241 |
144,411 | 0 | void ExpandableContainerView::ChildPreferredSizeChanged(views::View* child) {
PreferredSizeChanged();
}
| 17,242 |
173,709 | 0 | void AudioSource::waitOutstandingEncodingFrames_l() {
ALOGV("waitOutstandingEncodingFrames_l: %" PRId64, mNumClientOwnedBuffers);
while (mNumClientOwnedBuffers > 0) {
mFrameEncodingCompletionCondition.wait(mLock);
}
}
| 17,243 |
180,885 | 1 | build_config(char *prefix, struct server *server)
{
char *path = NULL;
int path_size = strlen(prefix) + strlen(server->port) + 20;
path = ss_malloc(path_size);
snprintf(path, path_size, "%s/.shadowsocks_%s.conf", prefix, server->port);
FILE *f = fopen(path, "w+");
if (f == NULL) {
if (verbose) {
LOGE("unable to open config file");
}
ss_free(path);
return;
}
fprintf(f, "{\n");
fprintf(f, "\"server_port\":%d,\n", atoi(server->port));
fprintf(f, "\"password\":\"%s\"", server->password);
if (server->fast_open[0]) fprintf(f, ",\n\"fast_open\": %s", server->fast_open);
if (server->mode) fprintf(f, ",\n\"mode\":\"%s\"", server->mode);
if (server->method) fprintf(f, ",\n\"method\":\"%s\"", server->method);
if (server->plugin) fprintf(f, ",\n\"plugin\":\"%s\"", server->plugin);
if (server->plugin_opts) fprintf(f, ",\n\"plugin_opts\":\"%s\"", server->plugin_opts);
fprintf(f, "\n}\n");
fclose(f);
ss_free(path);
}
| 17,244 |
27,032 | 0 | static int do_test(void)
{
if (g_plugin_NP_GetMIMEDescription == NULL)
return 1;
if (g_plugin_NP_Initialize == NULL)
return 2;
if (g_plugin_NP_Shutdown == NULL)
return 3;
if (is_flash_player9_beta1())
return 4;
return 0;
}
| 17,245 |
151,939 | 0 | FileChooserImpl(RenderFrameHostImpl* render_frame_host)
: render_frame_host_(render_frame_host) {
Observe(WebContents::FromRenderFrameHost(render_frame_host));
}
| 17,246 |
161,798 | 0 | void PlatformSensorProviderLinux::FreeResources() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(file_task_runner_);
Shutdown();
file_task_runner_->PostTask(
FROM_HERE, base::Bind(&PlatformSensorProviderLinux::StopPollingThread,
base::Unretained(this)));
}
| 17,247 |
62,107 | 0 | static void JP2WarningHandler(const char *message,void *client_data)
{
ExceptionInfo
*exception;
exception=(ExceptionInfo *) client_data;
(void) ThrowMagickException(exception,GetMagickModule(),CoderWarning,
message,"`%s'","OpenJP2");
}
| 17,248 |
56,280 | 0 | static void sapi_globals_ctor(sapi_globals_struct *sapi_globals TSRMLS_DC)
{
memset(sapi_globals, 0, sizeof(*sapi_globals));
zend_hash_init_ex(&sapi_globals->known_post_content_types, 5, NULL, NULL, 1, 0);
php_setup_sapi_content_types(TSRMLS_C);
}
| 17,249 |
92,981 | 0 | rdp_in_present(STREAM s, uint32 * present, uint8 flags, int size)
{
uint8 bits;
int i;
if (flags & RDP_ORDER_SMALL)
{
size--;
}
if (flags & RDP_ORDER_TINY)
{
if (size < 2)
size = 0;
else
size -= 2;
}
*present = 0;
for (i = 0; i < size; i++)
{
in_uint8(s, bits);
*present |= bits << (i * 8);
}
}
| 17,250 |
108,860 | 0 | void RenderViewImpl::DidStopLoadingForPlugin() {
didStopLoading();
}
| 17,251 |
99,691 | 0 | void VaapiWrapper::DestroyUnownedSurface(VASurfaceID va_surface_id) {
base::AutoLock auto_lock(*va_lock_);
VAStatus va_res = vaDestroySurfaces(va_display_, &va_surface_id, 1);
VA_LOG_ON_ERROR(va_res, "vaDestroySurfaces on surface failed");
}
| 17,252 |
121,044 | 0 | UploadProgress HttpStreamParser::GetUploadProgress() const {
if (!request_->upload_data_stream)
return UploadProgress();
return UploadProgress(request_->upload_data_stream->position(),
request_->upload_data_stream->size());
}
| 17,253 |
95,314 | 0 | PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array)
{
char *p = NULL;
char *ip = NULL; /* index pointer */
char *index;
char *var, *var_orig;
size_t var_len, index_len;
zval gpc_element, *gpc_element_p;
zend_bool is_array = 0;
HashTable *symtable1 = NULL;
ALLOCA_FLAG(use_heap)
assert(var_name != NULL);
if (track_vars_array && Z_TYPE_P(track_vars_array) == IS_ARRAY) {
symtable1 = Z_ARRVAL_P(track_vars_array);
}
if (!symtable1) {
/* Nothing to do */
zval_dtor(val);
return;
}
/* ignore leading spaces in the variable name */
while (*var_name && *var_name==' ') {
var_name++;
}
/*
* Prepare variable name
*/
var_len = strlen(var_name);
var = var_orig = do_alloca(var_len + 1, use_heap);
memcpy(var_orig, var_name, var_len + 1);
/* ensure that we don't have spaces or dots in the variable name (not binary safe) */
for (p = var; *p; p++) {
if (*p == ' ' || *p == '.') {
*p='_';
} else if (*p == '[') {
is_array = 1;
ip = p;
*p = 0;
break;
}
}
var_len = p - var;
if (var_len==0) { /* empty variable name, or variable name with a space in it */
zval_dtor(val);
free_alloca(var_orig, use_heap);
return;
}
/* GLOBALS hijack attempt, reject parameter */
if (symtable1 == &EG(symbol_table) &&
var_len == sizeof("GLOBALS")-1 &&
!memcmp(var, "GLOBALS", sizeof("GLOBALS")-1)) {
zval_dtor(val);
free_alloca(var_orig, use_heap);
return;
}
index = var;
index_len = var_len;
if (is_array) {
int nest_level = 0;
while (1) {
char *index_s;
size_t new_idx_len = 0;
if(++nest_level > PG(max_input_nesting_level)) {
HashTable *ht;
/* too many levels of nesting */
if (track_vars_array) {
ht = Z_ARRVAL_P(track_vars_array);
zend_symtable_str_del(ht, var, var_len);
}
zval_dtor(val);
/* do not output the error message to the screen,
this helps us to to avoid "information disclosure" */
if (!PG(display_errors)) {
php_error_docref(NULL, E_WARNING, "Input variable nesting level exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_nesting_level in php.ini.", PG(max_input_nesting_level));
}
free_alloca(var_orig, use_heap);
return;
}
ip++;
index_s = ip;
if (isspace(*ip)) {
ip++;
}
if (*ip==']') {
index_s = NULL;
} else {
ip = strchr(ip, ']');
if (!ip) {
/* PHP variables cannot contain '[' in their names, so we replace the character with a '_' */
*(index_s - 1) = '_';
index_len = 0;
if (index) {
index_len = strlen(index);
}
goto plain_var;
return;
}
*ip = 0;
new_idx_len = strlen(index_s);
}
if (!index) {
array_init(&gpc_element);
if ((gpc_element_p = zend_hash_next_index_insert(symtable1, &gpc_element)) == NULL) {
zval_ptr_dtor(&gpc_element);
zval_dtor(val);
free_alloca(var_orig, use_heap);
return;
}
} else {
gpc_element_p = zend_symtable_str_find(symtable1, index, index_len);
if (!gpc_element_p) {
zval tmp;
array_init(&tmp);
gpc_element_p = zend_symtable_str_update_ind(symtable1, index, index_len, &tmp);
} else {
if (Z_TYPE_P(gpc_element_p) == IS_INDIRECT) {
gpc_element_p = Z_INDIRECT_P(gpc_element_p);
}
if (Z_TYPE_P(gpc_element_p) != IS_ARRAY) {
zval_ptr_dtor(gpc_element_p);
array_init(gpc_element_p);
}
}
}
symtable1 = Z_ARRVAL_P(gpc_element_p);
/* ip pointed to the '[' character, now obtain the key */
index = index_s;
index_len = new_idx_len;
ip++;
if (*ip == '[') {
is_array = 1;
*ip = 0;
} else {
goto plain_var;
}
}
} else {
plain_var:
ZVAL_COPY_VALUE(&gpc_element, val);
if (!index) {
if ((gpc_element_p = zend_hash_next_index_insert(symtable1, &gpc_element)) == NULL) {
zval_ptr_dtor(&gpc_element);
}
} else {
/*
* According to rfc2965, more specific paths are listed above the less specific ones.
* If we encounter a duplicate cookie name, we should skip it, since it is not possible
* to have the same (plain text) cookie name for the same path and we should not overwrite
* more specific cookies with the less specific ones.
*/
if (Z_TYPE(PG(http_globals)[TRACK_VARS_COOKIE]) != IS_UNDEF &&
symtable1 == Z_ARRVAL(PG(http_globals)[TRACK_VARS_COOKIE]) &&
zend_symtable_str_exists(symtable1, index, index_len)) {
zval_ptr_dtor(&gpc_element);
} else {
gpc_element_p = zend_symtable_str_update_ind(symtable1, index, index_len, &gpc_element);
}
}
}
free_alloca(var_orig, use_heap);
}
| 17,254 |
114,992 | 0 | void TestingAutomationProvider::OnBrowserRemoved(const Browser* browser) {
if (BrowserList::empty() && !CommandLine::ForCurrentProcess()->HasSwitch(
switches::kKeepAliveForTest)) {
MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&TestingAutomationProvider::OnRemoveProvider, this));
}
}
| 17,255 |
40,977 | 0 | cmsBool GrowMLUtable(cmsMLU* mlu)
{
int AllocatedEntries;
_cmsMLUentry *NewPtr;
if (mlu == NULL) return FALSE;
AllocatedEntries = mlu ->AllocatedEntries * 2;
if (AllocatedEntries / 2 != mlu ->AllocatedEntries) return FALSE;
NewPtr = (_cmsMLUentry*)_cmsRealloc(mlu ->ContextID, mlu ->Entries, AllocatedEntries*sizeof(_cmsMLUentry));
if (NewPtr == NULL) return FALSE;
mlu ->Entries = NewPtr;
mlu ->AllocatedEntries = AllocatedEntries;
return TRUE;
}
| 17,256 |
116,140 | 0 | void ResourceDispatcherHostImpl::MarkAsTransferredNavigation(
net::URLRequest* transferred_request) {
ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(transferred_request);
GlobalRequestID transferred_request_id(info->GetChildID(),
info->GetRequestID());
transferred_navigations_[transferred_request_id] = transferred_request;
scoped_refptr<ResourceHandler> transferred_resource_handler(
new DoomedResourceHandler(info->resource_handler()));
info->set_resource_handler(transferred_resource_handler.get());
}
| 17,257 |
59,893 | 0 | static int uas_cmnd_list_empty(struct uas_dev_info *devinfo)
{
unsigned long flags;
int i, r = 1;
spin_lock_irqsave(&devinfo->lock, flags);
for (i = 0; i < devinfo->qdepth; i++) {
if (devinfo->cmnd[i]) {
r = 0; /* Not empty */
break;
}
}
spin_unlock_irqrestore(&devinfo->lock, flags);
return r;
}
| 17,258 |
155,190 | 0 | void NavigatorImpl::DidNavigate(
RenderFrameHostImpl* render_frame_host,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree();
bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible();
bool has_embedded_credentials =
params.url.has_username() || params.url.has_password();
UMA_HISTOGRAM_BOOLEAN("Navigation.FrameHasEmbeddedCredentials",
has_embedded_credentials);
bool is_navigation_within_page = controller_->IsURLInPageNavigation(
params.url, params.origin, params.was_within_same_page,
render_frame_host);
if (is_navigation_within_page &&
render_frame_host !=
render_frame_host->frame_tree_node()
->render_manager()
->current_frame_host()) {
bad_message::ReceivedBadMessage(render_frame_host->GetProcess(),
bad_message::NI_IN_PAGE_NAVIGATION);
is_navigation_within_page = false;
}
if (ui::PageTransitionIsMainFrame(params.transition)) {
if (delegate_) {
if (delegate_->CanOverscrollContent()) {
if (!params.was_within_same_page)
controller_->TakeScreenshot();
}
delegate_->DidNavigateMainFramePreCommit(is_navigation_within_page);
UMA_HISTOGRAM_BOOLEAN("Navigation.MainFrameHasEmbeddedCredentials",
has_embedded_credentials);
}
if (!oopifs_possible)
frame_tree->root()->render_manager()->DidNavigateFrame(
render_frame_host, params.gesture == NavigationGestureUser);
}
render_frame_host->frame_tree_node()->SetCurrentOrigin(
params.origin, params.has_potentially_trustworthy_unique_origin);
render_frame_host->frame_tree_node()->SetInsecureRequestPolicy(
params.insecure_request_policy);
if (!is_navigation_within_page)
render_frame_host->frame_tree_node()->ResetContentSecurityPolicy();
if (oopifs_possible) {
FrameTreeNode* frame = render_frame_host->frame_tree_node();
frame->render_manager()->DidNavigateFrame(
render_frame_host, params.gesture == NavigationGestureUser);
}
SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance();
if (!site_instance->HasSite() &&
ShouldAssignSiteForURL(params.url)) {
site_instance->SetSite(params.url);
}
if (ui::PageTransitionIsMainFrame(params.transition) && delegate_)
delegate_->SetMainFrameMimeType(params.contents_mime_type);
int old_entry_count = controller_->GetEntryCount();
LoadCommittedDetails details;
bool did_navigate = controller_->RendererDidNavigate(
render_frame_host, params, &details, is_navigation_within_page);
if (old_entry_count != controller_->GetEntryCount() ||
details.previous_entry_index !=
controller_->GetLastCommittedEntryIndex()) {
frame_tree->root()->render_manager()->SendPageMessage(
new PageMsg_SetHistoryOffsetAndLength(
MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(),
controller_->GetEntryCount()),
site_instance);
}
render_frame_host->frame_tree_node()->SetCurrentURL(params.url);
if (!params.url_is_unreachable)
render_frame_host->set_last_successful_url(params.url);
if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) {
DCHECK_EQ(!render_frame_host->GetParent(),
did_navigate ? details.is_main_frame : false);
ui::PageTransition transition_type = params.transition;
if (did_navigate &&
(controller_->GetLastCommittedEntry()->GetTransitionType() &
ui::PAGE_TRANSITION_FORWARD_BACK)) {
transition_type = ui::PageTransitionFromInt(
params.transition | ui::PAGE_TRANSITION_FORWARD_BACK);
}
delegate_->DidCommitProvisionalLoad(render_frame_host,
params.url,
transition_type);
render_frame_host->navigation_handle()->DidCommitNavigation(
params, is_navigation_within_page, render_frame_host);
render_frame_host->SetNavigationHandle(nullptr);
}
if (!did_navigate)
return; // No navigation happened.
RecordNavigationMetrics(details, params, site_instance);
if (delegate_) {
if (details.is_main_frame) {
delegate_->DidNavigateMainFramePostCommit(render_frame_host,
details, params);
}
delegate_->DidNavigateAnyFramePostCommit(
render_frame_host, details, params);
}
}
| 17,259 |
11,369 | 0 | fbCombineDisjointInU (CARD32 *dest, const CARD32 *src, int width)
{
fbCombineDisjointGeneralU (dest, src, width, CombineAIn);
}
| 17,260 |
82,203 | 0 | mrb_obj_missing(mrb_state *mrb, mrb_value mod)
{
mrb_sym name;
mrb_value *a;
mrb_int alen;
mrb_get_args(mrb, "n*!", &name, &a, &alen);
mrb_method_missing(mrb, name, mod, mrb_ary_new_from_values(mrb, alen, a));
/* not reached */
return mrb_nil_value();
}
| 17,261 |
175,670 | 0 | FLACExtractor::FLACExtractor(
const sp<DataSource> &dataSource)
: mDataSource(dataSource),
mInitCheck(false)
{
ALOGV("FLACExtractor::FLACExtractor");
mInitCheck = init();
}
| 17,262 |
149,033 | 0 | static void btreeParseCellPtrNoPayload(
MemPage *pPage, /* Page containing the cell */
u8 *pCell, /* Pointer to the cell text. */
CellInfo *pInfo /* Fill in this structure */
){
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
assert( pPage->leaf==0 );
assert( pPage->childPtrSize==4 );
#ifndef SQLITE_DEBUG
UNUSED_PARAMETER(pPage);
#endif
pInfo->nSize = 4 + getVarint(&pCell[4], (u64*)&pInfo->nKey);
pInfo->nPayload = 0;
pInfo->nLocal = 0;
pInfo->pPayload = 0;
return;
}
| 17,263 |
66,008 | 0 | static void svc_rdma_send_wc_common(struct svcxprt_rdma *xprt,
struct ib_wc *wc,
const char *opname)
{
if (wc->status != IB_WC_SUCCESS)
goto err;
out:
atomic_inc(&xprt->sc_sq_avail);
wake_up(&xprt->sc_send_wait);
return;
err:
set_bit(XPT_CLOSE, &xprt->sc_xprt.xpt_flags);
if (wc->status != IB_WC_WR_FLUSH_ERR)
pr_err("svcrdma: %s: %s (%u/0x%x)\n",
opname, ib_wc_status_msg(wc->status),
wc->status, wc->vendor_err);
goto out;
}
| 17,264 |
16,363 | 0 | pseudo_begin_execution()
{
thisRemoteResource->beginExecution();
return 0;
}
| 17,265 |
27,716 | 0 | void __exit bnep_sock_cleanup(void)
{
if (bt_sock_unregister(BTPROTO_BNEP) < 0)
BT_ERR("Can't unregister BNEP socket");
proto_unregister(&bnep_proto);
}
| 17,266 |
104,713 | 0 | virtual void OnDecodeImageSucceeded(const SkBitmap& decoded_image) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
icon_ = decoded_image;
icon_decode_complete_ = true;
ReportResultsIfComplete();
}
| 17,267 |
49,693 | 0 | static void disk_release(struct device *dev)
{
struct gendisk *disk = dev_to_disk(dev);
blk_free_devt(dev->devt);
disk_release_events(disk);
kfree(disk->random);
disk_replace_part_tbl(disk, NULL);
hd_free_part(&disk->part0);
if (disk->queue)
blk_put_queue(disk->queue);
kfree(disk);
}
| 17,268 |
167,537 | 0 | void WebMediaPlayerImpl::Paint(cc::PaintCanvas* canvas,
const blink::WebRect& rect,
cc::PaintFlags& flags,
int already_uploaded_id,
VideoFrameUploadMetadata* out_metadata) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
TRACE_EVENT0("media", "WebMediaPlayerImpl:paint");
if (cdm_context_ref_)
return;
scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
gfx::Rect gfx_rect(rect);
Context3D context_3d;
if (video_frame.get() && video_frame->HasTextures()) {
if (context_provider_) {
context_3d = Context3D(context_provider_->ContextGL(),
context_provider_->GrContext());
}
if (!context_3d.gl)
return; // Unable to get/create a shared main thread context.
if (!context_3d.gr_context)
return; // The context has been lost since and can't setup a GrContext.
}
if (out_metadata && video_frame) {
ComputeFrameUploadMetadata(video_frame.get(), already_uploaded_id,
out_metadata);
if (out_metadata->skipped) {
return;
}
}
video_renderer_.Paint(
video_frame, canvas, gfx::RectF(gfx_rect), flags,
pipeline_metadata_.video_decoder_config.video_rotation(), context_3d);
}
| 17,269 |
147,716 | 0 | void V8TestObject::RaisesExceptionGetterLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_raisesExceptionGetterLongAttribute_Getter");
test_object_v8_internal::RaisesExceptionGetterLongAttributeAttributeGetter(info);
}
| 17,270 |
72,094 | 0 | static bool _launch_job_test(uint32_t job_id)
{
bool found = false;
int j;
slurm_mutex_lock(&job_state_mutex);
for (j = 0; j < JOB_STATE_CNT; j++) {
if (job_id == active_job_id[j]) {
found = true;
break;
}
}
slurm_mutex_unlock(&job_state_mutex);
return found;
}
| 17,271 |
176,482 | 0 | WORD32 ihevcd_get_sei_mastering_params(iv_obj_t *ps_codec_obj,
void *pv_api_ip,
void *pv_api_op)
{
ihevcd_cxa_ctl_get_sei_mastering_params_ip_t *ps_ip;
ihevcd_cxa_ctl_get_sei_mastering_params_op_t *ps_op;
codec_t *ps_codec = (codec_t *)ps_codec_obj->pv_codec_handle;
sei_params_t *ps_sei;
mastering_dis_col_vol_sei_params_t *ps_mastering_dis_col_vol;
WORD32 i;
ps_ip = (ihevcd_cxa_ctl_get_sei_mastering_params_ip_t *)pv_api_ip;
ps_op = (ihevcd_cxa_ctl_get_sei_mastering_params_op_t *)pv_api_op;
UNUSED(ps_ip);
if(NULL == ps_codec->ps_disp_buf)
{
ps_op->u4_error_code = IHEVCD_SEI_MASTERING_PARAMS_NOT_FOUND;
return IV_FAIL;
}
ps_sei = &ps_codec->ps_disp_buf->s_sei_params;
if((0 == ps_sei->i4_sei_mastering_disp_colour_vol_params_present_flags)
|| (0 == ps_sei->i1_sei_parameters_present_flag))
{
ps_op->u4_error_code = IHEVCD_SEI_MASTERING_PARAMS_NOT_FOUND;
return IV_FAIL;
}
ps_mastering_dis_col_vol = &ps_sei->s_mastering_dis_col_vol_sei_params;
for(i = 0; i < 3; i++)
{
ps_op->au2_display_primaries_x[i] =
ps_mastering_dis_col_vol->au2_display_primaries_x[i];
ps_op->au2_display_primaries_y[i] =
ps_mastering_dis_col_vol->au2_display_primaries_y[i];
}
ps_op->u2_white_point_x = ps_mastering_dis_col_vol->u2_white_point_x;
ps_op->u2_white_point_y = ps_mastering_dis_col_vol->u2_white_point_y;
ps_op->u4_max_display_mastering_luminance =
ps_mastering_dis_col_vol->u4_max_display_mastering_luminance;
ps_op->u4_min_display_mastering_luminance =
ps_mastering_dis_col_vol->u4_min_display_mastering_luminance;
return IV_SUCCESS;
}
| 17,272 |
167,170 | 0 | void HTMLMediaElement::RejectPlayPromisesInternal(ExceptionCode code,
const String& message) {
DCHECK(code == kAbortError || code == kNotSupportedError);
for (auto& resolver : play_promise_reject_list_)
resolver->Reject(DOMException::Create(code, message));
play_promise_reject_list_.clear();
}
| 17,273 |
176,645 | 0 | xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt,
xmlSAXHandlerPtr sax,
void *user_data, int depth, const xmlChar *URL,
const xmlChar *ID, xmlNodePtr *list) {
xmlParserCtxtPtr ctxt;
xmlDocPtr newDoc;
xmlNodePtr newRoot;
xmlSAXHandlerPtr oldsax = NULL;
xmlParserErrors ret = XML_ERR_OK;
xmlChar start[4];
xmlCharEncoding enc;
if (((depth > 40) &&
((oldctxt == NULL) || (oldctxt->options & XML_PARSE_HUGE) == 0)) ||
(depth > 1024)) {
return(XML_ERR_ENTITY_LOOP);
}
if (list != NULL)
*list = NULL;
if ((URL == NULL) && (ID == NULL))
return(XML_ERR_INTERNAL_ERROR);
if (doc == NULL)
return(XML_ERR_INTERNAL_ERROR);
ctxt = xmlCreateEntityParserCtxtInternal(URL, ID, NULL, oldctxt);
if (ctxt == NULL) return(XML_WAR_UNDECLARED_ENTITY);
ctxt->userData = ctxt;
if (oldctxt != NULL) {
ctxt->_private = oldctxt->_private;
ctxt->loadsubset = oldctxt->loadsubset;
ctxt->validate = oldctxt->validate;
ctxt->external = oldctxt->external;
ctxt->record_info = oldctxt->record_info;
ctxt->node_seq.maximum = oldctxt->node_seq.maximum;
ctxt->node_seq.length = oldctxt->node_seq.length;
ctxt->node_seq.buffer = oldctxt->node_seq.buffer;
} else {
/*
* Doing validity checking on chunk without context
* doesn't make sense
*/
ctxt->_private = NULL;
ctxt->validate = 0;
ctxt->external = 2;
ctxt->loadsubset = 0;
}
if (sax != NULL) {
oldsax = ctxt->sax;
ctxt->sax = sax;
if (user_data != NULL)
ctxt->userData = user_data;
}
xmlDetectSAX2(ctxt);
newDoc = xmlNewDoc(BAD_CAST "1.0");
if (newDoc == NULL) {
ctxt->node_seq.maximum = 0;
ctxt->node_seq.length = 0;
ctxt->node_seq.buffer = NULL;
xmlFreeParserCtxt(ctxt);
return(XML_ERR_INTERNAL_ERROR);
}
newDoc->properties = XML_DOC_INTERNAL;
newDoc->intSubset = doc->intSubset;
newDoc->extSubset = doc->extSubset;
newDoc->dict = doc->dict;
xmlDictReference(newDoc->dict);
if (doc->URL != NULL) {
newDoc->URL = xmlStrdup(doc->URL);
}
newRoot = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL);
if (newRoot == NULL) {
if (sax != NULL)
ctxt->sax = oldsax;
ctxt->node_seq.maximum = 0;
ctxt->node_seq.length = 0;
ctxt->node_seq.buffer = NULL;
xmlFreeParserCtxt(ctxt);
newDoc->intSubset = NULL;
newDoc->extSubset = NULL;
xmlFreeDoc(newDoc);
return(XML_ERR_INTERNAL_ERROR);
}
xmlAddChild((xmlNodePtr) newDoc, newRoot);
nodePush(ctxt, newDoc->children);
ctxt->myDoc = doc;
newRoot->doc = doc;
/*
* Get the 4 first bytes and decode the charset
* if enc != XML_CHAR_ENCODING_NONE
* plug some encoding conversion routines.
*/
GROW;
if ((ctxt->input->end - ctxt->input->cur) >= 4) {
start[0] = RAW;
start[1] = NXT(1);
start[2] = NXT(2);
start[3] = NXT(3);
enc = xmlDetectCharEncoding(start, 4);
if (enc != XML_CHAR_ENCODING_NONE) {
xmlSwitchEncoding(ctxt, enc);
}
}
/*
* Parse a possible text declaration first
*/
if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) {
xmlParseTextDecl(ctxt);
}
ctxt->instate = XML_PARSER_CONTENT;
ctxt->depth = depth;
xmlParseContent(ctxt);
if ((RAW == '<') && (NXT(1) == '/')) {
xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL);
} else if (RAW != 0) {
xmlFatalErr(ctxt, XML_ERR_EXTRA_CONTENT, NULL);
}
if (ctxt->node != newDoc->children) {
xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL);
}
if (!ctxt->wellFormed) {
if (ctxt->errNo == 0)
ret = XML_ERR_INTERNAL_ERROR;
else
ret = (xmlParserErrors)ctxt->errNo;
} else {
if (list != NULL) {
xmlNodePtr cur;
/*
* Return the newly created nodeset after unlinking it from
* they pseudo parent.
*/
cur = newDoc->children->children;
*list = cur;
while (cur != NULL) {
cur->parent = NULL;
cur = cur->next;
}
newDoc->children->children = NULL;
}
ret = XML_ERR_OK;
}
/*
* Record in the parent context the number of entities replacement
* done when parsing that reference.
*/
if (oldctxt != NULL)
oldctxt->nbentities += ctxt->nbentities;
/*
* Also record the size of the entity parsed
*/
if (ctxt->input != NULL && oldctxt != NULL) {
oldctxt->sizeentities += ctxt->input->consumed;
oldctxt->sizeentities += (ctxt->input->cur - ctxt->input->base);
}
/*
* And record the last error if any
*/
if (ctxt->lastError.code != XML_ERR_OK)
xmlCopyError(&ctxt->lastError, &oldctxt->lastError);
if (sax != NULL)
ctxt->sax = oldsax;
if (oldctxt != NULL) {
oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
oldctxt->node_seq.length = ctxt->node_seq.length;
oldctxt->node_seq.buffer = ctxt->node_seq.buffer;
}
ctxt->node_seq.maximum = 0;
ctxt->node_seq.length = 0;
ctxt->node_seq.buffer = NULL;
xmlFreeParserCtxt(ctxt);
newDoc->intSubset = NULL;
newDoc->extSubset = NULL;
xmlFreeDoc(newDoc);
return(ret);
}
| 17,274 |
39,789 | 0 | static void echo_set_canon_col(struct n_tty_data *ldata)
{
add_echo_byte(ECHO_OP_START, ldata);
add_echo_byte(ECHO_OP_SET_CANON_COL, ldata);
}
| 17,275 |
4,612 | 0 | PHP_FUNCTION(openssl_encrypt)
{
zend_long options = 0, tag_len = 16;
char *data, *method, *password, *iv = "", *aad = "";
size_t data_len, method_len, password_len, iv_len = 0, aad_len = 0;
zval *tag = NULL;
const EVP_CIPHER *cipher_type;
EVP_CIPHER_CTX *cipher_ctx;
struct php_openssl_cipher_mode mode;
int i=0, outlen;
zend_string *outbuf;
zend_bool free_iv = 0, free_password = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|lsz/sl", &data, &data_len, &method, &method_len,
&password, &password_len, &options, &iv, &iv_len, &tag, &aad, &aad_len, &tag_len) == FAILURE) {
return;
}
PHP_OPENSSL_CHECK_SIZE_T_TO_INT(data_len, data);
PHP_OPENSSL_CHECK_SIZE_T_TO_INT(password_len, password);
PHP_OPENSSL_CHECK_SIZE_T_TO_INT(aad_len, aad);
PHP_OPENSSL_CHECK_LONG_TO_INT(tag_len, tag_len);
cipher_type = EVP_get_cipherbyname(method);
if (!cipher_type) {
php_error_docref(NULL, E_WARNING, "Unknown cipher algorithm");
RETURN_FALSE;
}
cipher_ctx = EVP_CIPHER_CTX_new();
if (!cipher_ctx) {
php_error_docref(NULL, E_WARNING, "Failed to create cipher context");
RETURN_FALSE;
}
php_openssl_load_cipher_mode(&mode, cipher_type);
if (php_openssl_cipher_init(cipher_type, cipher_ctx, &mode,
&password, &password_len, &free_password,
&iv, &iv_len, &free_iv, NULL, tag_len, options, 1) == FAILURE ||
php_openssl_cipher_update(cipher_type, cipher_ctx, &mode, &outbuf, &outlen,
data, data_len, aad, aad_len, 1) == FAILURE) {
RETVAL_FALSE;
} else if (EVP_EncryptFinal(cipher_ctx, (unsigned char *)ZSTR_VAL(outbuf) + outlen, &i)) {
outlen += i;
if (options & OPENSSL_RAW_DATA) {
ZSTR_VAL(outbuf)[outlen] = '\0';
ZSTR_LEN(outbuf) = outlen;
RETVAL_STR(outbuf);
} else {
zend_string *base64_str;
base64_str = php_base64_encode((unsigned char*)ZSTR_VAL(outbuf), outlen);
zend_string_release(outbuf);
outbuf = base64_str;
RETVAL_STR(base64_str);
}
if (mode.is_aead && tag) {
zend_string *tag_str = zend_string_alloc(tag_len, 0);
if (EVP_CIPHER_CTX_ctrl(cipher_ctx, mode.aead_get_tag_flag, tag_len, ZSTR_VAL(tag_str)) == 1) {
zval_dtor(tag);
ZSTR_VAL(tag_str)[tag_len] = '\0';
ZSTR_LEN(tag_str) = tag_len;
ZVAL_NEW_STR(tag, tag_str);
} else {
php_error_docref(NULL, E_WARNING, "Retrieving verification tag failed");
zend_string_release(tag_str);
zend_string_release(outbuf);
RETVAL_FALSE;
}
} else if (tag) {
zval_dtor(tag);
ZVAL_NULL(tag);
php_error_docref(NULL, E_WARNING,
"The authenticated tag cannot be provided for cipher that doesn not support AEAD");
} else if (mode.is_aead) {
php_error_docref(NULL, E_WARNING, "A tag should be provided when using AEAD mode");
zend_string_release(outbuf);
RETVAL_FALSE;
}
} else {
php_openssl_store_errors();
zend_string_release(outbuf);
RETVAL_FALSE;
}
if (free_password) {
efree(password);
}
if (free_iv) {
efree(iv);
}
EVP_CIPHER_CTX_cleanup(cipher_ctx);
EVP_CIPHER_CTX_free(cipher_ctx);
}
| 17,276 |
25,858 | 0 | static void p4_pmu_disable_pebs(void)
{
/*
* FIXME
*
* It's still allowed that two threads setup same cache
* events so we can't simply clear metrics until we knew
* no one is depending on us, so we need kind of counter
* for "ReplayEvent" users.
*
* What is more complex -- RAW events, if user (for some
* reason) will pass some cache event metric with improper
* event opcode -- it's fine from hardware point of view
* but completely nonsense from "meaning" of such action.
*
* So at moment let leave metrics turned on forever -- it's
* ok for now but need to be revisited!
*
* (void)checking_wrmsrl(MSR_IA32_PEBS_ENABLE, (u64)0);
* (void)checking_wrmsrl(MSR_P4_PEBS_MATRIX_VERT, (u64)0);
*/
}
| 17,277 |
86,244 | 0 | static void i8042_unregister_ports(void)
{
int i;
for (i = 0; i < I8042_NUM_PORTS; i++) {
if (i8042_ports[i].serio) {
serio_unregister_port(i8042_ports[i].serio);
i8042_ports[i].serio = NULL;
}
}
}
| 17,278 |
123,322 | 0 | static gboolean OnCrossingEvent(GtkWidget* widget,
GdkEventCrossing* event,
RenderWidgetHostViewGtk* host_view) {
TRACE_EVENT0("browser",
"RenderWidgetHostViewGtkWidget::OnCrossingEvent");
const int any_button_mask =
GDK_BUTTON1_MASK |
GDK_BUTTON2_MASK |
GDK_BUTTON3_MASK |
GDK_BUTTON4_MASK |
GDK_BUTTON5_MASK;
if (!(event->state & any_button_mask)) {
WebKit::WebMouseEvent mouse_event =
WebInputEventFactory::mouseEvent(event);
host_view->ModifyEventMovementAndCoords(&mouse_event);
mouse_event.movementX = 0;
mouse_event.movementY = 0;
RenderWidgetHostImpl::From(
host_view->GetRenderWidgetHost())->ForwardMouseEvent(mouse_event);
}
return FALSE;
}
| 17,279 |
60,815 | 0 | void ff_h264_parse_framesize(AVCodecParameters *par, const char *p)
{
char buf1[50];
char *dst = buf1;
while (*p && *p == ' ')
p++; // strip spaces.
while (*p && *p != ' ')
p++; // eat protocol identifier
while (*p && *p == ' ')
p++; // strip trailing spaces.
while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1)
*dst++ = *p++;
*dst = '\0';
par->width = atoi(buf1);
par->height = atoi(p + 1); // skip the -
}
| 17,280 |
2,603 | 0 | json_each_text(PG_FUNCTION_ARGS)
{
return each_worker(fcinfo, true);
}
| 17,281 |
46,538 | 0 | static inline bool unix_secdata_eq(struct scm_cookie *scm, struct sk_buff *skb)
{
return true;
}
| 17,282 |
64,718 | 0 | fetch_name_with_level(OnigCodePoint start_code, UChar** src, UChar* end,
UChar** rname_end, ScanEnv* env,
int* rback_num, int* rlevel)
{
int r, sign, is_num, exist_level;
OnigCodePoint end_code;
OnigCodePoint c = 0;
OnigEncoding enc = env->enc;
UChar *name_end;
UChar *pnum_head;
UChar *p = *src;
PFETCH_READY;
*rback_num = 0;
is_num = exist_level = 0;
sign = 1;
pnum_head = *src;
end_code = get_name_end_code_point(start_code);
name_end = end;
r = 0;
if (PEND) {
return ONIGERR_EMPTY_GROUP_NAME;
}
else {
PFETCH(c);
if (c == end_code)
return ONIGERR_EMPTY_GROUP_NAME;
if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
is_num = 1;
}
else if (c == '-') {
is_num = 2;
sign = -1;
pnum_head = p;
}
else if (!ONIGENC_IS_CODE_WORD(enc, c)) {
r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME;
}
}
while (!PEND) {
name_end = p;
PFETCH(c);
if (c == end_code || c == ')' || c == '+' || c == '-') {
if (is_num == 2) r = ONIGERR_INVALID_GROUP_NAME;
break;
}
if (is_num != 0) {
if (ONIGENC_IS_CODE_DIGIT(enc, c)) {
is_num = 1;
}
else {
r = ONIGERR_INVALID_GROUP_NAME;
is_num = 0;
}
}
else if (!ONIGENC_IS_CODE_WORD(enc, c)) {
r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME;
}
}
if (r == 0 && c != end_code) {
if (c == '+' || c == '-') {
int level;
int flag = (c == '-' ? -1 : 1);
if (PEND) {
r = ONIGERR_INVALID_CHAR_IN_GROUP_NAME;
goto end;
}
PFETCH(c);
if (! ONIGENC_IS_CODE_DIGIT(enc, c)) goto err;
PUNFETCH;
level = onig_scan_unsigned_number(&p, end, enc);
if (level < 0) return ONIGERR_TOO_BIG_NUMBER;
*rlevel = (level * flag);
exist_level = 1;
if (!PEND) {
PFETCH(c);
if (c == end_code)
goto end;
}
}
err:
r = ONIGERR_INVALID_GROUP_NAME;
name_end = end;
}
end:
if (r == 0) {
if (is_num != 0) {
*rback_num = onig_scan_unsigned_number(&pnum_head, name_end, enc);
if (*rback_num < 0) return ONIGERR_TOO_BIG_NUMBER;
else if (*rback_num == 0) goto err;
*rback_num *= sign;
}
*rname_end = name_end;
*src = p;
return (exist_level ? 1 : 0);
}
else {
onig_scan_env_set_error_string(env, r, *src, name_end);
return r;
}
}
| 17,283 |
90,024 | 0 | size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input)
{
/* check conditions */
if (output->pos > output->size) return ERROR(GENERIC);
if (input->pos > input->size) return ERROR(GENERIC);
return ZSTD_compressStream_generic(zcs, output, input, ZSTD_e_continue);
}
| 17,284 |
155,097 | 0 | base::string16 SendTabToSelfInfoBarDelegate::GetInfobarMessage() const {
NOTIMPLEMENTED();
return base::UTF8ToUTF16("Open");
}
| 17,285 |
163,044 | 0 | void ProfilingProcessHost::StartProfilingNonRendererChild(
int child_process_id,
base::ProcessId proc_id,
profiling::mojom::ProcessType process_type) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
content::BrowserChildProcessHost* host =
content::BrowserChildProcessHost::FromID(child_process_id);
if (!host)
return;
ProfilingClientBinder client(host);
AddClientToProfilingService(client.take(), proc_id, process_type);
}
| 17,286 |
92,607 | 0 | static inline int migrate_degrades_locality(struct task_struct *p,
struct lb_env *env)
{
return -1;
}
| 17,287 |
90,825 | 0 | char gf_prompt_get_char()
{
return getchar();
}
| 17,288 |
10,017 | 0 | ft_bitmap_draw( FT_Bitmap* bitmap,
int x,
int y,
FTDemo_Display* display,
grColor color)
{
grBitmap gbit;
gbit.width = bitmap->width;
gbit.rows = bitmap->rows;
gbit.pitch = bitmap->pitch;
gbit.buffer = bitmap->buffer;
switch ( bitmap->pixel_mode)
{
case FT_PIXEL_MODE_GRAY:
gbit.mode = gr_pixel_mode_gray;
gbit.grays = 256;
break;
case FT_PIXEL_MODE_MONO:
gbit.mode = gr_pixel_mode_mono;
gbit.grays = 2;
break;
case FT_PIXEL_MODE_LCD:
gbit.mode = gr_pixel_mode_lcd;
gbit.grays = 256;
break;
case FT_PIXEL_MODE_LCD_V:
gbit.mode = gr_pixel_mode_lcdv;
gbit.grays = 256;
break;
default:
return;
}
grBlitGlyphToBitmap( display->bitmap, &gbit, x, y, color );
}
| 17,289 |
180,450 | 1 | cJSON *cJSON_CreateString( const char *string )
{
cJSON *item = cJSON_New_Item();
if ( item ) {
item->type = cJSON_String;
item->valuestring = cJSON_strdup( string );
}
return item;
}
| 17,290 |
72,730 | 0 | static int jas_iccputxyz(jas_stream_t *out, jas_iccxyz_t *xyz)
{
jas_iccputuint32(out, xyz->x);
jas_iccputuint32(out, xyz->y);
jas_iccputuint32(out, xyz->z);
return 0;
}
| 17,291 |
49,724 | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpPtr (int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
if (!in)
return 0;
im = gdImageCreateFromWebpCtx(in);
in->gd_free(in);
return im;
}
| 17,292 |
53,098 | 0 | static void convert_pseudo_ld_imm64(struct verifier_env *env)
{
struct bpf_insn *insn = env->prog->insnsi;
int insn_cnt = env->prog->len;
int i;
for (i = 0; i < insn_cnt; i++, insn++)
if (insn->code == (BPF_LD | BPF_IMM | BPF_DW))
insn->src_reg = 0;
}
| 17,293 |
117,016 | 0 | void OmniboxPopupViewGtk::AcceptLine(size_t line,
WindowOpenDisposition disposition) {
AutocompleteMatch match = model_->result().match_at(line);
omnibox_view_->OpenMatch(match, disposition, GURL(), line);
}
| 17,294 |
146,449 | 0 | void WebGLRenderingContextBase::blendEquationSeparate(GLenum mode_rgb,
GLenum mode_alpha) {
if (isContextLost() ||
!ValidateBlendEquation("blendEquationSeparate", mode_rgb) ||
!ValidateBlendEquation("blendEquationSeparate", mode_alpha))
return;
ContextGL()->BlendEquationSeparate(mode_rgb, mode_alpha);
}
| 17,295 |
116,064 | 0 | void ExtensionSettingsHandler::HandleEnableMessage(const ListValue* args) {
CHECK_EQ(2U, args->GetSize());
std::string extension_id, enable_str;
CHECK(args->GetString(0, &extension_id));
CHECK(args->GetString(1, &enable_str));
const Extension* extension =
extension_service_->GetExtensionById(extension_id, true);
if (!Extension::UserMayDisable(extension->location())) {
LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was"
<< "made. Extension id: " << extension->id();
return;
}
if (enable_str == "true") {
ExtensionPrefs* prefs = extension_service_->extension_prefs();
if (prefs->DidExtensionEscalatePermissions(extension_id)) {
ShowExtensionDisabledDialog(extension_service_,
Profile::FromWebUI(web_ui()), extension);
} else {
extension_service_->EnableExtension(extension_id);
}
} else {
extension_service_->DisableExtension(extension_id);
}
}
| 17,296 |
11,634 | 0 | device_filesystem_list_open_files_authorized_cb (Daemon *daemon,
Device *device,
DBusGMethodInvocation *context,
const gchar *action_id,
guint num_user_data,
gpointer *user_data_elements)
{
int n;
char *argv[16];
GError *error;
if (!device->priv->device_is_mounted || device->priv->device_mount_paths->len == 0)
{
throw_error (context, ERROR_FAILED, "Device is not mounted");
goto out;
}
n = 0;
argv[n++] = "lsof";
argv[n++] = "-t";
argv[n++] = ((gchar **) device->priv->device_mount_paths->pdata)[0];
argv[n++] = NULL;
error = NULL;
if (!job_new (context, NULL, /* don't run this as a job */
FALSE, device, argv, NULL, filesystem_list_open_files_completed_cb, FALSE, NULL, NULL))
{
goto out;
}
out:
;
}
| 17,297 |
4,872 | 0 | ProcAllowEvents(ClientPtr client)
{
TimeStamp time;
DeviceIntPtr mouse = NULL;
DeviceIntPtr keybd = NULL;
REQUEST(xAllowEventsReq);
REQUEST_SIZE_MATCH(xAllowEventsReq);
UpdateCurrentTime();
time = ClientTimeToServerTime(stuff->time);
mouse = PickPointer(client);
keybd = PickKeyboard(client);
switch (stuff->mode) {
case ReplayPointer:
AllowSome(client, time, mouse, NOT_GRABBED);
break;
case SyncPointer:
AllowSome(client, time, mouse, FREEZE_NEXT_EVENT);
break;
case AsyncPointer:
AllowSome(client, time, mouse, THAWED);
break;
case ReplayKeyboard:
AllowSome(client, time, keybd, NOT_GRABBED);
break;
case SyncKeyboard:
AllowSome(client, time, keybd, FREEZE_NEXT_EVENT);
break;
case AsyncKeyboard:
AllowSome(client, time, keybd, THAWED);
break;
case SyncBoth:
AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT);
break;
case AsyncBoth:
AllowSome(client, time, keybd, THAWED_BOTH);
break;
default:
client->errorValue = stuff->mode;
return BadValue;
}
return Success;
}
| 17,298 |
56,128 | 0 | int perf_pmu_register(struct pmu *pmu, const char *name, int type)
{
int cpu, ret;
mutex_lock(&pmus_lock);
ret = -ENOMEM;
pmu->pmu_disable_count = alloc_percpu(int);
if (!pmu->pmu_disable_count)
goto unlock;
pmu->type = -1;
if (!name)
goto skip_type;
pmu->name = name;
if (type < 0) {
type = idr_alloc(&pmu_idr, pmu, PERF_TYPE_MAX, 0, GFP_KERNEL);
if (type < 0) {
ret = type;
goto free_pdc;
}
}
pmu->type = type;
if (pmu_bus_running) {
ret = pmu_dev_alloc(pmu);
if (ret)
goto free_idr;
}
skip_type:
pmu->pmu_cpu_context = find_pmu_context(pmu->task_ctx_nr);
if (pmu->pmu_cpu_context)
goto got_cpu_context;
ret = -ENOMEM;
pmu->pmu_cpu_context = alloc_percpu(struct perf_cpu_context);
if (!pmu->pmu_cpu_context)
goto free_dev;
for_each_possible_cpu(cpu) {
struct perf_cpu_context *cpuctx;
cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
__perf_event_init_context(&cpuctx->ctx);
lockdep_set_class(&cpuctx->ctx.mutex, &cpuctx_mutex);
lockdep_set_class(&cpuctx->ctx.lock, &cpuctx_lock);
cpuctx->ctx.pmu = pmu;
__perf_mux_hrtimer_init(cpuctx, cpu);
cpuctx->unique_pmu = pmu;
}
got_cpu_context:
if (!pmu->start_txn) {
if (pmu->pmu_enable) {
/*
* If we have pmu_enable/pmu_disable calls, install
* transaction stubs that use that to try and batch
* hardware accesses.
*/
pmu->start_txn = perf_pmu_start_txn;
pmu->commit_txn = perf_pmu_commit_txn;
pmu->cancel_txn = perf_pmu_cancel_txn;
} else {
pmu->start_txn = perf_pmu_nop_txn;
pmu->commit_txn = perf_pmu_nop_int;
pmu->cancel_txn = perf_pmu_nop_void;
}
}
if (!pmu->pmu_enable) {
pmu->pmu_enable = perf_pmu_nop_void;
pmu->pmu_disable = perf_pmu_nop_void;
}
if (!pmu->event_idx)
pmu->event_idx = perf_event_idx_default;
list_add_rcu(&pmu->entry, &pmus);
atomic_set(&pmu->exclusive_cnt, 0);
ret = 0;
unlock:
mutex_unlock(&pmus_lock);
return ret;
free_dev:
device_del(pmu->dev);
put_device(pmu->dev);
free_idr:
if (pmu->type >= PERF_TYPE_MAX)
idr_remove(&pmu_idr, pmu->type);
free_pdc:
free_percpu(pmu->pmu_disable_count);
goto unlock;
}
| 17,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.