unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
16,912 | 0 | int path_is_absolute(const char *path)
{
#ifdef _WIN32
/* specific case for names like: "\\.\d:" */
if (is_windows_drive(path) || is_windows_drive_prefix(path)) {
return 1;
}
return (*path == '/' || *path == '\\');
#else
return (*path == '/');
#endif
}
| 9,000 |
157,698 | 0 | bool is_main_frame() { return is_main_frame_; }
| 9,001 |
111,345 | 0 | void WebPage::setDocumentScrollPosition(const Platform::IntPoint& documentScrollPosition)
{
WebCore::IntPoint scrollPosition = documentScrollPosition;
if (scrollPosition == d->scrollPosition())
return;
if (currentTime() - d->m_lastUserEventTimestamp < manualScrollInterval)
d->m_userPerformedManualScroll = true;
d->m_backingStoreClient->setIsClientGeneratedScroll(true);
bool constrainsScrollingToContentEdge = d->m_mainFrame->view()->constrainsScrollingToContentEdge();
d->m_mainFrame->view()->setConstrainsScrollingToContentEdge(false);
d->setScrollPosition(scrollPosition);
d->m_mainFrame->view()->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdge);
d->m_backingStoreClient->setIsClientGeneratedScroll(false);
}
| 9,002 |
48,201 | 0 | DECLAREcpFunc(cpSeparateTiles2SeparateStrips)
{
return cpImage(in, out,
readSeparateTilesIntoBuffer,
writeBufferToSeparateStrips,
imagelength, imagewidth, spp);
}
| 9,003 |
16,197 | 0 | GahpClient::globus_gram_client_ping(const char * resource_contact)
{
static const char* command = "GRAM_PING";
if (server->m_commands_supported->contains_anycase(command)==FALSE) {
return GAHPCLIENT_COMMAND_NOT_SUPPORTED;
}
if (!resource_contact) resource_contact=NULLSTRING;
std::string reqline;
int x = sprintf(reqline,"%s",escapeGahpString(resource_contact));
ASSERT( x > 0 );
const char *buf = reqline.c_str();
if ( !is_pending(command,buf) ) {
if ( m_mode == results_only ) {
return GAHPCLIENT_COMMAND_NOT_SUBMITTED;
}
now_pending(command,buf,normal_proxy);
}
Gahp_Args* result = get_pending_result(command,buf);
if ( result ) {
if (result->argc != 2) {
EXCEPT("Bad %s Result",command);
}
int rc = atoi(result->argv[1]);
delete result;
return rc;
}
if ( check_pending_timeout(command,buf) ) {
sprintf( error_string, "%s timed out", command );
return GAHPCLIENT_COMMAND_TIMED_OUT;
}
return GAHPCLIENT_COMMAND_PENDING;
}
| 9,004 |
49,551 | 0 | static int xc2028_get_reg(struct xc2028_data *priv, u16 reg, u16 *val)
{
unsigned char buf[2];
unsigned char ibuf[2];
tuner_dbg("%s %04x called\n", __func__, reg);
buf[0] = reg >> 8;
buf[1] = (unsigned char) reg;
if (i2c_send_recv(priv, buf, 2, ibuf, 2) != 2)
return -EIO;
*val = (ibuf[1]) | (ibuf[0] << 8);
return 0;
}
| 9,005 |
16,794 | 0 | static void bochs_close(BlockDriverState *bs)
{
BDRVBochsState *s = bs->opaque;
g_free(s->catalog_bitmap);
}
| 9,006 |
123,447 | 0 | void ChromeDownloadManagerDelegate::ShowDownloadInShell(
DownloadItem* download) {
platform_util::ShowItemInFolder(download->GetFullPath());
}
| 9,007 |
152,415 | 0 | void RenderFrameImpl::OnAddMessageToConsole(
blink::mojom::ConsoleMessageLevel level,
const std::string& message) {
AddMessageToConsole(level, message);
}
| 9,008 |
110,184 | 0 | bool DateTimeFieldElement::isReadOnly() const
{
return fastHasAttribute(readonlyAttr);
}
| 9,009 |
154,286 | 0 | error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size,
const volatile void* cmd_data) {
const char* func_name = "glTexImage2D";
const volatile gles2::cmds::TexImage2D& c =
*static_cast<const volatile gles2::cmds::TexImage2D*>(cmd_data);
TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D",
"width", c.width, "height", c.height);
texture_state_.tex_image_failed = true;
GLenum target = static_cast<GLenum>(c.target);
GLint level = static_cast<GLint>(c.level);
GLint internal_format = static_cast<GLint>(c.internalformat);
GLsizei width = static_cast<GLsizei>(c.width);
GLsizei height = static_cast<GLsizei>(c.height);
GLint border = static_cast<GLint>(c.border);
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
uint32_t pixels_shm_id = static_cast<uint32_t>(c.pixels_shm_id);
uint32_t pixels_shm_offset = static_cast<uint32_t>(c.pixels_shm_offset);
if (width < 0 || height < 0) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "dimensions < 0");
return error::kNoError;
}
PixelStoreParams params;
Buffer* buffer = state_.bound_pixel_unpack_buffer.get();
if (buffer) {
if (pixels_shm_id)
return error::kInvalidArguments;
if (buffer->GetMappedRange()) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"pixel unpack buffer should not be mapped to client memory");
return error::kNoError;
}
params = state_.GetUnpackParams(ContextState::k2D);
} else {
if (!pixels_shm_id && pixels_shm_offset)
return error::kInvalidArguments;
params.alignment = state_.unpack_alignment;
}
uint32_t pixels_size;
uint32_t skip_size;
uint32_t padding;
if (!GLES2Util::ComputeImageDataSizesES3(width, height, 1,
format, type,
params,
&pixels_size,
nullptr,
nullptr,
&skip_size,
&padding)) {
return error::kOutOfBounds;
}
DCHECK_EQ(0u, skip_size);
const void* pixels;
if (pixels_shm_id) {
pixels = GetSharedMemoryAs<const void*>(
pixels_shm_id, pixels_shm_offset, pixels_size);
if (!pixels)
return error::kOutOfBounds;
} else {
pixels = reinterpret_cast<const void*>(pixels_shm_offset);
}
uint32_t num_pixels;
if (workarounds().simulate_out_of_memory_on_large_textures &&
(!base::CheckMul(width, height).AssignIfValid(&num_pixels) ||
(num_pixels >= 4096 * 4096))) {
LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, func_name, "synthetic out of memory");
return error::kNoError;
}
TextureManager::DoTexImageArguments args = {
target, level, internal_format, width, height, 1, border, format, type,
pixels, pixels_size, padding,
TextureManager::DoTexImageArguments::kTexImage2D };
texture_manager()->ValidateAndDoTexImage(
&texture_state_, &state_, error_state_.get(), &framebuffer_state_,
func_name, args);
ExitCommandProcessingEarly();
return error::kNoError;
}
| 9,010 |
156,428 | 0 | void RenderFrameDevToolsAgentHost::AddAllAgentHosts(
DevToolsAgentHost::List* result) {
for (WebContentsImpl* wc : WebContentsImpl::GetAllWebContents()) {
for (FrameTreeNode* node : wc->GetFrameTree()->Nodes()) {
if (!node->current_frame_host() || !ShouldCreateDevToolsForNode(node))
continue;
if (!node->current_frame_host()->IsRenderFrameLive())
continue;
result->push_back(RenderFrameDevToolsAgentHost::GetOrCreateFor(node));
}
}
}
| 9,011 |
73,716 | 0 | static const char *encode_puid(aClient *client)
{
static char buf[HOSTLEN + 20];
/* create a cookie if necessary (and in case getrandom16 returns 0, then run again) */
while (!client->local->sasl_cookie)
client->local->sasl_cookie = getrandom16();
snprintf(buf, sizeof buf, "%s!0.%d", me.name, client->local->sasl_cookie);
return buf;
}
| 9,012 |
57,304 | 0 | int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], int no_separation, zend_array *symbol_table) /* {{{ */
{
zend_fcall_info fci;
fci.size = sizeof(fci);
fci.function_table = function_table;
fci.object = object ? Z_OBJ_P(object) : NULL;
ZVAL_COPY_VALUE(&fci.function_name, function_name);
fci.retval = retval_ptr;
fci.param_count = param_count;
fci.params = params;
fci.no_separation = (zend_bool) no_separation;
fci.symbol_table = symbol_table;
return zend_call_function(&fci, NULL);
}
/* }}} */
| 9,013 |
125,212 | 0 | void RenderMessageFilter::OnGetProcessMemorySizes(
size_t* private_bytes, size_t* shared_bytes) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
using base::ProcessMetrics;
#if !defined(OS_MACOSX) || defined(OS_IOS)
scoped_ptr<ProcessMetrics> metrics(
ProcessMetrics::CreateProcessMetrics(peer_handle()));
#else
scoped_ptr<ProcessMetrics> metrics(
ProcessMetrics::CreateProcessMetrics(peer_handle(), NULL));
#endif
metrics->GetMemoryBytes(private_bytes, shared_bytes);
}
| 9,014 |
163,574 | 0 | htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) {
const xmlChar *encoding;
if (!attvalue)
return;
encoding = xmlStrcasestr(attvalue, BAD_CAST"charset");
if (encoding != NULL) {
encoding += 7;
}
/*
* skip blank
*/
if (encoding && IS_BLANK_CH(*encoding))
encoding = xmlStrcasestr(attvalue, BAD_CAST"=");
if (encoding && *encoding == '=') {
encoding ++;
htmlCheckEncodingDirect(ctxt, encoding);
}
}
| 9,015 |
179,421 | 1 | doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
size_t size, off_t fsize, int *flags, int mach, int strtab)
{
Elf32_Shdr sh32;
Elf64_Shdr sh64;
int stripped = 1;
void *nbuf;
off_t noff, coff, name_off;
uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */
uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilites */
char name[50];
if (size != xsh_sizeof) {
if (file_printf(ms, ", corrupted section header size") == -1)
return -1;
return 0;
}
/* Read offset of name section to be able to read section names later */
if (pread(fd, xsh_addr, xsh_sizeof, off + size * strtab) == -1) {
file_badread(ms);
return -1;
}
name_off = xsh_offset;
for ( ; num; num--) {
/* Read the name of this section. */
if (pread(fd, name, sizeof(name), name_off + xsh_name) == -1) {
file_badread(ms);
return -1;
}
name[sizeof(name) - 1] = '\0';
if (strcmp(name, ".debug_info") == 0)
stripped = 0;
if (pread(fd, xsh_addr, xsh_sizeof, off) == -1) {
file_badread(ms);
return -1;
}
off += size;
/* Things we can determine before we seek */
switch (xsh_type) {
case SHT_SYMTAB:
#if 0
case SHT_DYNSYM:
#endif
stripped = 0;
break;
default:
if (xsh_offset > fsize) {
/* Perhaps warn here */
continue;
}
break;
}
/* Things we can determine when we seek */
switch (xsh_type) {
case SHT_NOTE:
if ((nbuf = malloc(xsh_size)) == NULL) {
file_error(ms, errno, "Cannot allocate memory"
" for note");
return -1;
}
if (pread(fd, nbuf, xsh_size, xsh_offset) == -1) {
file_badread(ms);
free(nbuf);
return -1;
}
noff = 0;
for (;;) {
if (noff >= (off_t)xsh_size)
break;
noff = donote(ms, nbuf, (size_t)noff,
xsh_size, clazz, swap, 4, flags);
if (noff == 0)
break;
}
free(nbuf);
break;
case SHT_SUNW_cap:
switch (mach) {
case EM_SPARC:
case EM_SPARCV9:
case EM_IA_64:
case EM_386:
case EM_AMD64:
break;
default:
goto skip;
}
if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) {
file_badseek(ms);
return -1;
}
coff = 0;
for (;;) {
Elf32_Cap cap32;
Elf64_Cap cap64;
char cbuf[/*CONSTCOND*/
MAX(sizeof cap32, sizeof cap64)];
if ((coff += xcap_sizeof) > (off_t)xsh_size)
break;
if (read(fd, cbuf, (size_t)xcap_sizeof) !=
(ssize_t)xcap_sizeof) {
file_badread(ms);
return -1;
}
if (cbuf[0] == 'A') {
#ifdef notyet
char *p = cbuf + 1;
uint32_t len, tag;
memcpy(&len, p, sizeof(len));
p += 4;
len = getu32(swap, len);
if (memcmp("gnu", p, 3) != 0) {
if (file_printf(ms,
", unknown capability %.3s", p)
== -1)
return -1;
break;
}
p += strlen(p) + 1;
tag = *p++;
memcpy(&len, p, sizeof(len));
p += 4;
len = getu32(swap, len);
if (tag != 1) {
if (file_printf(ms, ", unknown gnu"
" capability tag %d", tag)
== -1)
return -1;
break;
}
#endif
break;
}
(void)memcpy(xcap_addr, cbuf, xcap_sizeof);
switch (xcap_tag) {
case CA_SUNW_NULL:
break;
case CA_SUNW_HW_1:
cap_hw1 |= xcap_val;
break;
case CA_SUNW_SF_1:
cap_sf1 |= xcap_val;
break;
default:
if (file_printf(ms,
", with unknown capability "
"0x%" INT64_T_FORMAT "x = 0x%"
INT64_T_FORMAT "x",
(unsigned long long)xcap_tag,
(unsigned long long)xcap_val) == -1)
return -1;
break;
}
}
/*FALLTHROUGH*/
skip:
default:
break;
}
}
if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
return -1;
if (cap_hw1) {
const cap_desc_t *cdp;
switch (mach) {
case EM_SPARC:
case EM_SPARC32PLUS:
case EM_SPARCV9:
cdp = cap_desc_sparc;
break;
case EM_386:
case EM_IA_64:
case EM_AMD64:
cdp = cap_desc_386;
break;
default:
cdp = NULL;
break;
}
if (file_printf(ms, ", uses") == -1)
return -1;
if (cdp) {
while (cdp->cd_name) {
if (cap_hw1 & cdp->cd_mask) {
if (file_printf(ms,
" %s", cdp->cd_name) == -1)
return -1;
cap_hw1 &= ~cdp->cd_mask;
}
++cdp;
}
if (cap_hw1)
if (file_printf(ms,
" unknown hardware capability 0x%"
INT64_T_FORMAT "x",
(unsigned long long)cap_hw1) == -1)
return -1;
} else {
if (file_printf(ms,
" hardware capability 0x%" INT64_T_FORMAT "x",
(unsigned long long)cap_hw1) == -1)
return -1;
}
}
if (cap_sf1) {
if (cap_sf1 & SF1_SUNW_FPUSED) {
if (file_printf(ms,
(cap_sf1 & SF1_SUNW_FPKNWN)
? ", uses frame pointer"
: ", not known to use frame pointer") == -1)
return -1;
}
cap_sf1 &= ~SF1_SUNW_MASK;
if (cap_sf1)
if (file_printf(ms,
", with unknown software capability 0x%"
INT64_T_FORMAT "x",
(unsigned long long)cap_sf1) == -1)
return -1;
}
return 0;
}
| 9,016 |
119,586 | 0 | RootInlineBox* RenderBlock::constructLine(BidiRunList<BidiRun>& bidiRuns, const LineInfo& lineInfo)
{
ASSERT(bidiRuns.firstRun());
bool rootHasSelectedChildren = false;
InlineFlowBox* parentBox = 0;
int runCount = bidiRuns.runCount() - lineInfo.runsFromLeadingWhitespace();
for (BidiRun* r = bidiRuns.firstRun(); r; r = r->next()) {
bool isOnlyRun = (runCount == 1);
if (runCount == 2 && !r->m_object->isListMarker())
isOnlyRun = (!style()->isLeftToRightDirection() ? bidiRuns.lastRun() : bidiRuns.firstRun())->m_object->isListMarker();
if (lineInfo.isEmpty())
continue;
InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun);
r->m_box = box;
ASSERT(box);
if (!box)
continue;
if (!rootHasSelectedChildren && box->renderer()->selectionState() != RenderObject::SelectionNone)
rootHasSelectedChildren = true;
bool runStartsSegment = r->m_startsSegment;
if (!parentBox || parentBox->renderer() != r->m_object->parent() || runStartsSegment)
parentBox = createLineBoxes(r->m_object->parent(), lineInfo, box, runStartsSegment);
else {
parentBox->addToLine(box);
}
bool visuallyOrdered = r->m_object->style()->rtlOrdering() == VisualOrder;
box->setBidiLevel(r->level());
if (box->isInlineTextBox()) {
InlineTextBox* text = toInlineTextBox(box);
text->setStart(r->m_start);
text->setLen(r->m_stop - r->m_start);
text->setDirOverride(r->dirOverride(visuallyOrdered));
if (r->m_hasHyphen)
text->setHasHyphen(true);
}
}
ASSERT(lastLineBox() && !lastLineBox()->isConstructed());
if (rootHasSelectedChildren)
lastLineBox()->root()->setHasSelectedChildren(true);
bool isLogicallyLastRunWrapped = bidiRuns.logicallyLastRun()->m_object && bidiRuns.logicallyLastRun()->m_object->isText() ? !reachedEndOfTextRenderer(bidiRuns) : true;
lastLineBox()->determineSpacingForFlowBoxes(lineInfo.isLastLine(), isLogicallyLastRunWrapped, bidiRuns.logicallyLastRun()->m_object);
lastLineBox()->setConstructed();
return lastRootBox();
}
| 9,017 |
6,929 | 0 | smp_fetch_url_param(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_msg *msg;
char delim = '?';
const char *name;
int name_len;
if (!args ||
(args[0].type && args[0].type != ARGT_STR) ||
(args[1].type && args[1].type != ARGT_STR))
return 0;
name = "";
name_len = 0;
if (args->type == ARGT_STR) {
name = args->data.str.str;
name_len = args->data.str.len;
}
if (args[1].type)
delim = *args[1].data.str.str;
if (!smp->ctx.a[0]) { // first call, find the query string
CHECK_HTTP_MESSAGE_FIRST();
msg = &smp->strm->txn->req;
smp->ctx.a[0] = find_param_list(msg->chn->buf->p + msg->sl.rq.u,
msg->sl.rq.u_l, delim);
if (!smp->ctx.a[0])
return 0;
smp->ctx.a[1] = msg->chn->buf->p + msg->sl.rq.u + msg->sl.rq.u_l;
/* Assume that the context is filled with NULL pointer
* before the first call.
* smp->ctx.a[2] = NULL;
* smp->ctx.a[3] = NULL;
*/
}
return smp_fetch_param(delim, name, name_len, args, smp, kw, private);
}
| 9,018 |
53,676 | 0 | static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)
{
struct ipv6_destopt_hao *hao;
struct inet6_skb_parm *opt = IP6CB(skb);
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
struct in6_addr tmp_addr;
int ret;
if (opt->dsthao) {
net_dbg_ratelimited("hao duplicated\n");
goto discard;
}
opt->dsthao = opt->dst1;
opt->dst1 = 0;
hao = (struct ipv6_destopt_hao *)(skb_network_header(skb) + optoff);
if (hao->length != 16) {
net_dbg_ratelimited("hao invalid option length = %d\n",
hao->length);
goto discard;
}
if (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) {
net_dbg_ratelimited("hao is not an unicast addr: %pI6\n",
&hao->addr);
goto discard;
}
ret = xfrm6_input_addr(skb, (xfrm_address_t *)&ipv6h->daddr,
(xfrm_address_t *)&hao->addr, IPPROTO_DSTOPTS);
if (unlikely(ret < 0))
goto discard;
if (skb_cloned(skb)) {
if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
goto discard;
/* update all variable using below by copied skbuff */
hao = (struct ipv6_destopt_hao *)(skb_network_header(skb) +
optoff);
ipv6h = ipv6_hdr(skb);
}
if (skb->ip_summed == CHECKSUM_COMPLETE)
skb->ip_summed = CHECKSUM_NONE;
tmp_addr = ipv6h->saddr;
ipv6h->saddr = hao->addr;
hao->addr = tmp_addr;
if (skb->tstamp.tv64 == 0)
__net_timestamp(skb);
return true;
discard:
kfree_skb(skb);
return false;
}
| 9,019 |
177,478 | 0 | Tags::SimpleTag::SimpleTag() {}
| 9,020 |
179,323 | 1 | cib_remote_dispatch(gpointer user_data)
{
cib_t *cib = user_data;
cib_remote_opaque_t *private = cib->variant_opaque;
xmlNode *msg = NULL;
const char *type = NULL;
crm_info("Message on callback channel");
msg = crm_recv_remote_msg(private->callback.session, private->callback.encrypted);
type = crm_element_value(msg, F_TYPE);
crm_trace("Activating %s callbacks...", type);
if (safe_str_eq(type, T_CIB)) {
cib_native_callback(cib, msg, 0, 0);
} else if (safe_str_eq(type, T_CIB_NOTIFY)) {
g_list_foreach(cib->notify_list, cib_native_notify, msg);
} else {
crm_err("Unknown message type: %s", type);
}
if (msg != NULL) {
free_xml(msg);
return 0;
}
return -1;
}
| 9,021 |
20,746 | 0 | int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu)
{
atomic_set(&vcpu->arch.nmi_queued, 0);
vcpu->arch.nmi_pending = 0;
vcpu->arch.nmi_injected = false;
vcpu->arch.switch_db_regs = 0;
memset(vcpu->arch.db, 0, sizeof(vcpu->arch.db));
vcpu->arch.dr6 = DR6_FIXED_1;
vcpu->arch.dr7 = DR7_FIXED_1;
kvm_make_request(KVM_REQ_EVENT, vcpu);
vcpu->arch.apf.msr_val = 0;
vcpu->arch.st.msr_val = 0;
kvmclock_reset(vcpu);
kvm_clear_async_pf_completion_queue(vcpu);
kvm_async_pf_hash_reset(vcpu);
vcpu->arch.apf.halted = false;
kvm_pmu_reset(vcpu);
return kvm_x86_ops->vcpu_reset(vcpu);
}
| 9,022 |
148,573 | 0 | void WebContentsImpl::ShowCreatedWidget(int process_id,
int route_id,
const gfx::Rect& initial_rect) {
ShowCreatedWidget(process_id, route_id, false, initial_rect);
}
| 9,023 |
76,773 | 0 | resolveEmphasisPassages(EmphasisInfo *buffer, const EmphRuleNumber emphRule,
const EmphasisClass class, const TranslationTableHeader *table,
const InString *input, unsigned int *wordBuffer) {
unsigned int word_cnt = 0;
int pass_start = -1, pass_end = -1, word_start = -1, in_word = 0, in_pass = 0;
int i;
for (i = 0; i < input->length; i++) {
/* check if at beginning of word */
if (!in_word)
if (wordBuffer[i] & WORD_CHAR) {
in_word = 1;
if (wordBuffer[i] & WORD_WHOLE) {
if (!in_pass) {
in_pass = 1;
pass_start = i;
pass_end = -1;
word_cnt = 1;
} else
word_cnt++;
word_start = i;
continue;
} else if (in_pass) {
if (word_cnt >= table->emphRules[emphRule][lenPhraseOffset])
if (pass_end >= 0) {
convertToPassage(pass_start, pass_end, word_start, buffer,
emphRule, class, table, wordBuffer);
}
in_pass = 0;
}
}
/* check if at end of word */
if (in_word)
if (!(wordBuffer[i] & WORD_CHAR)) {
in_word = 0;
if (in_pass) pass_end = i;
}
if (in_pass)
if ((buffer[i].begin | buffer[i].end | buffer[i].word | buffer[i].symbol) &
class) {
if (word_cnt >= table->emphRules[emphRule][lenPhraseOffset])
if (pass_end >= 0) {
convertToPassage(pass_start, pass_end, word_start, buffer,
emphRule, class, table, wordBuffer);
}
in_pass = 0;
}
}
if (in_pass) {
if (word_cnt >= table->emphRules[emphRule][lenPhraseOffset]) {
if (pass_end >= 0) {
if (in_word) {
convertToPassage(pass_start, i, word_start, buffer, emphRule, class,
table, wordBuffer);
} else {
convertToPassage(pass_start, pass_end, word_start, buffer, emphRule,
class, table, wordBuffer);
}
}
}
}
}
| 9,024 |
41,849 | 0 | static inline size_t inet6_prefix_nlmsg_size(void)
{
return NLMSG_ALIGN(sizeof(struct prefixmsg))
+ nla_total_size(sizeof(struct in6_addr))
+ nla_total_size(sizeof(struct prefix_cacheinfo));
}
| 9,025 |
158,124 | 0 | bool LocalFrameClientImpl::ShouldBlockWebGL() {
DCHECK(web_frame_->Client());
return web_frame_->Client()->ShouldBlockWebGL();
}
| 9,026 |
163,032 | 0 | ProfilingClientBinder()
: memlog_client_(), request_(mojo::MakeRequest(&memlog_client_)) {}
| 9,027 |
65,311 | 0 | static __be32 nfs41_check_op_ordering(struct nfsd4_compoundargs *args)
{
struct nfsd4_op *op = &args->ops[0];
/* These ordering requirements don't apply to NFSv4.0: */
if (args->minorversion == 0)
return nfs_ok;
/* This is weird, but OK, not our problem: */
if (args->opcnt == 0)
return nfs_ok;
if (op->status == nfserr_op_illegal)
return nfs_ok;
if (!(nfsd4_ops[op->opnum].op_flags & ALLOWED_AS_FIRST_OP))
return nfserr_op_not_in_session;
if (op->opnum == OP_SEQUENCE)
return nfs_ok;
if (args->opcnt != 1)
return nfserr_not_only_op;
return nfs_ok;
}
| 9,028 |
55,552 | 0 | static void __init init_schedstats(void)
{
set_schedstats(__sched_schedstats);
}
| 9,029 |
112,454 | 0 | String Document::encoding() const
{
if (TextResourceDecoder* d = decoder())
return d->encoding().domName();
return String();
}
| 9,030 |
72,321 | 0 | notify_setup(void)
{
if (pipe(notify_pipe) < 0) {
error("pipe(notify_pipe) failed %s", strerror(errno));
} else if ((fcntl(notify_pipe[0], F_SETFD, FD_CLOEXEC) == -1) ||
(fcntl(notify_pipe[1], F_SETFD, FD_CLOEXEC) == -1)) {
error("fcntl(notify_pipe, F_SETFD) failed %s", strerror(errno));
close(notify_pipe[0]);
close(notify_pipe[1]);
} else {
set_nonblock(notify_pipe[0]);
set_nonblock(notify_pipe[1]);
return;
}
notify_pipe[0] = -1; /* read end */
notify_pipe[1] = -1; /* write end */
}
| 9,031 |
644 | 0 | static bool decode_verify_name_request(void *mem_ctx, DATA_BLOB in, void *_out)
{
void **out = (void **)_out;
DATA_BLOB name;
struct asn1_data *data = asn1_init(mem_ctx);
struct ldb_verify_name_control *lvnc;
int len;
if (!data) return false;
if (!asn1_load(data, in)) {
return false;
}
lvnc = talloc(mem_ctx, struct ldb_verify_name_control);
if (!lvnc) {
return false;
}
if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
return false;
}
if (!asn1_read_Integer(data, &(lvnc->flags))) {
return false;
}
if (!asn1_read_OctetString(data, mem_ctx, &name)) {
return false;
}
if (name.length) {
len = utf16_len_n(name.data, name.length);
convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
name.data, len,
(void **)&lvnc->gc, &lvnc->gc_len);
if (!(lvnc->gc)) {
return false;
}
} else {
lvnc->gc_len = 0;
lvnc->gc = NULL;
}
if (!asn1_end_tag(data)) {
return false;
}
*out = lvnc;
return true;
}
| 9,032 |
161,468 | 0 | void TargetHandler::DevToolsAgentHostCreated(DevToolsAgentHost* host) {
if (reported_hosts_.find(host) != reported_hosts_.end())
return;
frontend_->TargetCreated(CreateInfo(host));
reported_hosts_.insert(host);
}
| 9,033 |
61,333 | 0 | static const char *flat_escape_value_str(AVBPrint *dst, const char *src)
{
const char *p;
for (p = src; *p; p++) {
switch (*p) {
case '\n': av_bprintf(dst, "%s", "\\n"); break;
case '\r': av_bprintf(dst, "%s", "\\r"); break;
case '\\': av_bprintf(dst, "%s", "\\\\"); break;
case '"': av_bprintf(dst, "%s", "\\\""); break;
case '`': av_bprintf(dst, "%s", "\\`"); break;
case '$': av_bprintf(dst, "%s", "\\$"); break;
default: av_bprint_chars(dst, *p, 1); break;
}
}
return dst->str;
}
| 9,034 |
122,681 | 0 | bool Extension::LoadExtent(const char* key,
URLPatternSet* extent,
const char* list_error,
const char* value_error,
string16* error) {
Value* temp_pattern_value = NULL;
if (!manifest_->Get(key, &temp_pattern_value))
return true;
if (temp_pattern_value->GetType() != Value::TYPE_LIST) {
*error = ASCIIToUTF16(list_error);
return false;
}
ListValue* pattern_list = static_cast<ListValue*>(temp_pattern_value);
for (size_t i = 0; i < pattern_list->GetSize(); ++i) {
std::string pattern_string;
if (!pattern_list->GetString(i, &pattern_string)) {
*error = ErrorUtils::FormatErrorMessageUTF16(value_error,
base::UintToString(i),
errors::kExpectString);
return false;
}
URLPattern pattern(kValidWebExtentSchemes);
URLPattern::ParseResult parse_result = pattern.Parse(pattern_string);
if (parse_result == URLPattern::PARSE_ERROR_EMPTY_PATH) {
pattern_string += "/";
parse_result = pattern.Parse(pattern_string);
}
if (parse_result != URLPattern::PARSE_SUCCESS) {
*error = ErrorUtils::FormatErrorMessageUTF16(
value_error,
base::UintToString(i),
URLPattern::GetParseResultString(parse_result));
return false;
}
if (pattern.match_all_urls()) {
*error = ErrorUtils::FormatErrorMessageUTF16(
value_error,
base::UintToString(i),
errors::kCannotClaimAllURLsInExtent);
return false;
}
if (pattern.host().empty()) {
*error = ErrorUtils::FormatErrorMessageUTF16(
value_error,
base::UintToString(i),
errors::kCannotClaimAllHostsInExtent);
return false;
}
if (pattern.path().find('*') != std::string::npos) {
*error = ErrorUtils::FormatErrorMessageUTF16(
value_error,
base::UintToString(i),
errors::kNoWildCardsInPaths);
return false;
}
pattern.SetPath(pattern.path() + '*');
extent->AddPattern(pattern);
}
return true;
}
| 9,035 |
117,289 | 0 | void GLES2DecoderImpl::SetGLError(GLenum error, const char* msg) {
if (msg) {
last_error_ = msg;
if (log_synthesized_gl_errors()) {
LOG(ERROR) << last_error_;
}
if (!msg_callback_.is_null()) {
msg_callback_.Run(0, GLES2Util::GetStringEnum(error) + " : " + msg);
}
}
error_bits_ |= GLES2Util::GLErrorToErrorBit(error);
}
| 9,036 |
46,804 | 0 | static int sha256_sparc64_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct sha256_state *sctx = shash_desc_ctx(desc);
unsigned int partial = sctx->count % SHA256_BLOCK_SIZE;
/* Handle the fast case right here */
if (partial + len < SHA256_BLOCK_SIZE) {
sctx->count += len;
memcpy(sctx->buf + partial, data, len);
} else
__sha256_sparc64_update(sctx, data, len, partial);
return 0;
}
| 9,037 |
98,177 | 0 | void AutoFillManager::UploadFormData() {
if (!disable_download_manager_requests_ && upload_form_structure_.get()) {
bool was_autofilled = false;
std::list<std::string>::iterator it;
int total_form_checked = 0;
for (it = autofilled_forms_signatures_.begin();
it != autofilled_forms_signatures_.end() && total_form_checked < 3;
++it, ++total_form_checked) {
if (*it == upload_form_structure_->FormSignature())
was_autofilled = true;
}
if (total_form_checked == 3 && it != autofilled_forms_signatures_.end()) {
autofilled_forms_signatures_.erase(it,
autofilled_forms_signatures_.end());
}
download_manager_.StartUploadRequest(*(upload_form_structure_.get()),
was_autofilled);
}
}
| 9,038 |
67,910 | 0 | jas_stream_t *jas_stream_fdopen(int fd, const char *mode)
{
jas_stream_t *stream;
jas_stream_fileobj_t *obj;
JAS_DBGLOG(100, ("jas_stream_fdopen(%d, \"%s\")\n", fd, mode));
/* Allocate a stream object. */
if (!(stream = jas_stream_create())) {
return 0;
}
/* Parse the mode string. */
stream->openmode_ = jas_strtoopenmode(mode);
#if defined(WIN32)
/* Argh!!! Someone ought to banish text mode (i.e., O_TEXT) to the
greatest depths of purgatory! */
/* Ensure that the file descriptor is in binary mode, if the caller
has specified the binary mode flag. Arguably, the caller ought to
take care of this, but text mode is a ugly wart anyways, so we save
the caller some grief by handling this within the stream library. */
/* This ugliness is mainly for the benefit of those who run the
JasPer software under Windows from shells that insist on opening
files in text mode. For example, in the Cygwin environment,
shells often open files in text mode when I/O redirection is
used. Grr... */
if (stream->openmode_ & JAS_STREAM_BINARY) {
setmode(fd, O_BINARY);
}
#endif
/* Allocate space for the underlying file stream object. */
if (!(obj = jas_malloc(sizeof(jas_stream_fileobj_t)))) {
jas_stream_destroy(stream);
return 0;
}
obj->fd = fd;
obj->flags = 0;
obj->pathname[0] = '\0';
stream->obj_ = (void *) obj;
/* Do not close the underlying file descriptor when the stream is
closed. */
obj->flags |= JAS_STREAM_FILEOBJ_NOCLOSE;
/* By default, use full buffering for this type of stream. */
jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0);
/* Select the operations for a file stream object. */
stream->ops_ = &jas_stream_fileops;
return stream;
}
| 9,039 |
96,381 | 0 | static void die_if_data_is_missing(GHashTable *problem_info)
{
gboolean missing_data = FALSE;
gchar **pstring;
static const gchar *const needed[] = {
FILENAME_TYPE,
FILENAME_REASON,
/* FILENAME_BACKTRACE, - ECC errors have no such elements */
/* FILENAME_EXECUTABLE, */
NULL
};
for (pstring = (gchar**) needed; *pstring; pstring++)
{
if (!g_hash_table_lookup(problem_info, *pstring))
{
error_msg("Element '%s' is missing", *pstring);
missing_data = TRUE;
}
}
if (missing_data)
error_msg_and_die("Some data is missing, aborting");
}
| 9,040 |
52,648 | 0 | ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
{
u32 mask, seq;
struct channel *ch;
int mphdrlen = (ppp->flags & SC_MP_SHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
if (!pskb_may_pull(skb, mphdrlen + 1) || ppp->mrru == 0)
goto err; /* no good, throw it away */
/* Decode sequence number and begin/end bits */
if (ppp->flags & SC_MP_SHORTSEQ) {
seq = ((skb->data[2] & 0x0f) << 8) | skb->data[3];
mask = 0xfff;
} else {
seq = (skb->data[3] << 16) | (skb->data[4] << 8)| skb->data[5];
mask = 0xffffff;
}
PPP_MP_CB(skb)->BEbits = skb->data[2];
skb_pull(skb, mphdrlen); /* pull off PPP and MP headers */
/*
* Do protocol ID decompression on the first fragment of each packet.
*/
if ((PPP_MP_CB(skb)->BEbits & B) && (skb->data[0] & 1))
*skb_push(skb, 1) = 0;
/*
* Expand sequence number to 32 bits, making it as close
* as possible to ppp->minseq.
*/
seq |= ppp->minseq & ~mask;
if ((int)(ppp->minseq - seq) > (int)(mask >> 1))
seq += mask + 1;
else if ((int)(seq - ppp->minseq) > (int)(mask >> 1))
seq -= mask + 1; /* should never happen */
PPP_MP_CB(skb)->sequence = seq;
pch->lastseq = seq;
/*
* If this packet comes before the next one we were expecting,
* drop it.
*/
if (seq_before(seq, ppp->nextseq)) {
kfree_skb(skb);
++ppp->dev->stats.rx_dropped;
ppp_receive_error(ppp);
return;
}
/*
* Reevaluate minseq, the minimum over all channels of the
* last sequence number received on each channel. Because of
* the increasing sequence number rule, we know that any fragment
* before `minseq' which hasn't arrived is never going to arrive.
* The list of channels can't change because we have the receive
* side of the ppp unit locked.
*/
list_for_each_entry(ch, &ppp->channels, clist) {
if (seq_before(ch->lastseq, seq))
seq = ch->lastseq;
}
if (seq_before(ppp->minseq, seq))
ppp->minseq = seq;
/* Put the fragment on the reconstruction queue */
ppp_mp_insert(ppp, skb);
/* If the queue is getting long, don't wait any longer for packets
before the start of the queue. */
if (skb_queue_len(&ppp->mrq) >= PPP_MP_MAX_QLEN) {
struct sk_buff *mskb = skb_peek(&ppp->mrq);
if (seq_before(ppp->minseq, PPP_MP_CB(mskb)->sequence))
ppp->minseq = PPP_MP_CB(mskb)->sequence;
}
/* Pull completed packets off the queue and receive them. */
while ((skb = ppp_mp_reconstruct(ppp))) {
if (pskb_may_pull(skb, 2))
ppp_receive_nonmp_frame(ppp, skb);
else {
++ppp->dev->stats.rx_length_errors;
kfree_skb(skb);
ppp_receive_error(ppp);
}
}
return;
err:
kfree_skb(skb);
ppp_receive_error(ppp);
}
| 9,041 |
117,736 | 0 | v8::Handle<v8::Object> V8TestEventConstructor::wrapSlow(PassRefPtr<TestEventConstructor> impl, v8::Isolate* isolate)
{
v8::Handle<v8::Object> wrapper;
V8Proxy* proxy = 0;
wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl.get());
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
if (!hasDependentLifetime)
wrapperHandle.MarkIndependent();
V8DOMWrapper::setJSWrapperForDOMObject(impl, wrapperHandle, isolate);
return wrapper;
}
| 9,042 |
24,114 | 0 | void hostap_set_multicast_list_queue(struct work_struct *work)
{
local_info_t *local =
container_of(work, local_info_t, set_multicast_list_queue);
struct net_device *dev = local->dev;
if (hostap_set_word(dev, HFA384X_RID_PROMISCUOUSMODE,
local->is_promisc)) {
printk(KERN_INFO "%s: %sabling promiscuous mode failed\n",
dev->name, local->is_promisc ? "en" : "dis");
}
}
| 9,043 |
113,286 | 0 | void PanelBrowserView::Deactivate() {
if (!IsActive())
return;
#if defined(OS_WIN) && !defined(USE_AURA)
gfx::NativeWindow native_window = NULL;
BrowserWindow* browser_window =
panel_->manager()->GetNextBrowserWindowToActivate(GetPanelBrowser());
if (browser_window)
native_window = browser_window->GetNativeHandle();
else
native_window = ::GetDesktopWindow();
if (native_window)
::SetForegroundWindow(native_window);
else
::SetFocus(NULL);
#else
NOTIMPLEMENTED();
BrowserView::Deactivate();
#endif
}
| 9,044 |
155,390 | 0 | void ChromeContentBrowserClient::HandleServiceRequest(
const std::string& service_name,
service_manager::mojom::ServiceRequest request) {
if (service_name == prefs::mojom::kLocalStateServiceName) {
if (!g_browser_process || !g_browser_process->pref_service_factory())
return;
service_manager::Service::RunAsyncUntilTermination(
g_browser_process->pref_service_factory()->CreatePrefService(
std::move(request)));
}
#if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
if (service_name == media::mojom::kMediaServiceName) {
service_manager::Service::RunAsyncUntilTermination(
media::CreateMediaService(std::move(request)));
}
#endif
#if BUILDFLAG(ENABLE_SIMPLE_BROWSER_SERVICE_IN_PROCESS)
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kLaunchInProcessSimpleBrowserSwitch) &&
service_name == simple_browser::mojom::kServiceName) {
service_manager::Service::RunAsyncUntilTermination(
std::make_unique<simple_browser::SimpleBrowserService>(
std::move(request), simple_browser::SimpleBrowserService::
UIInitializationMode::kUseEnvironmentUI));
}
#endif
#if defined(OS_CHROMEOS)
if (service_name == chromeos::secure_channel::mojom::kServiceName) {
service_manager::Service::RunAsyncUntilTermination(
std::make_unique<chromeos::secure_channel::SecureChannelService>(
std::move(request)));
}
auto service = ash_service_registry::HandleServiceRequest(service_name,
std::move(request));
if (service)
service_manager::Service::RunAsyncUntilTermination(std::move(service));
#endif
}
| 9,045 |
155,043 | 0 | ScriptValue WebGLRenderingContextBase::getShaderParameter(
ScriptState* script_state,
WebGLShader* shader,
GLenum pname) {
if (!ValidateWebGLProgramOrShader("getShaderParameter", shader)) {
return ScriptValue::CreateNull(script_state);
}
GLint value = 0;
switch (pname) {
case GL_DELETE_STATUS:
return WebGLAny(script_state, shader->MarkedForDeletion());
case GL_COMPILE_STATUS:
ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value);
return WebGLAny(script_state, static_cast<bool>(value));
case GL_COMPLETION_STATUS_KHR:
if (!ExtensionEnabled(kKHRParallelShaderCompileName)) {
SynthesizeGLError(GL_INVALID_ENUM, "getShaderParameter",
"invalid parameter name");
return ScriptValue::CreateNull(script_state);
}
ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value);
return WebGLAny(script_state, static_cast<bool>(value));
case GL_SHADER_TYPE:
ContextGL()->GetShaderiv(ObjectOrZero(shader), pname, &value);
return WebGLAny(script_state, static_cast<unsigned>(value));
default:
SynthesizeGLError(GL_INVALID_ENUM, "getShaderParameter",
"invalid parameter name");
return ScriptValue::CreateNull(script_state);
}
}
| 9,046 |
25,116 | 0 | static void __net_exit ip_rt_do_proc_exit(struct net *net)
{
remove_proc_entry("rt_cache", net->proc_net_stat);
remove_proc_entry("rt_cache", net->proc_net);
#ifdef CONFIG_IP_ROUTE_CLASSID
remove_proc_entry("rt_acct", net->proc_net);
#endif
}
| 9,047 |
87,635 | 0 | LIBOPENMPT_MODPLUG_API int ModPlug_GetModuleType(ModPlugFile* file)
{
const char* type;
int retval;
if(!file) return 0;
type = openmpt_module_get_metadata(file->mod,"type");
retval = MOD_TYPE_NONE;
if(!type){
return retval;
}
if(!strcmp(type,"mod")){
retval = MOD_TYPE_MOD;
}else if(!strcmp(type,"s3m")){
retval = MOD_TYPE_S3M;
}else if(!strcmp(type,"xm")){
retval = MOD_TYPE_XM;
}else if(!strcmp(type,"med")){
retval = MOD_TYPE_MED;
}else if(!strcmp(type,"mtm")){
retval = MOD_TYPE_MTM;
}else if(!strcmp(type,"it")){
retval = MOD_TYPE_IT;
}else if(!strcmp(type,"669")){
retval = MOD_TYPE_669;
}else if(!strcmp(type,"ult")){
retval = MOD_TYPE_ULT;
}else if(!strcmp(type,"stm")){
retval = MOD_TYPE_STM;
}else if(!strcmp(type,"far")){
retval = MOD_TYPE_FAR;
}else if(!strcmp(type,"s3m")){
retval = MOD_TYPE_WAV;
}else if(!strcmp(type,"amf")){
retval = MOD_TYPE_AMF;
}else if(!strcmp(type,"ams")){
retval = MOD_TYPE_AMS;
}else if(!strcmp(type,"dsm")){
retval = MOD_TYPE_DSM;
}else if(!strcmp(type,"mdl")){
retval = MOD_TYPE_MDL;
}else if(!strcmp(type,"okt")){
retval = MOD_TYPE_OKT;
}else if(!strcmp(type,"mid")){
retval = MOD_TYPE_MID;
}else if(!strcmp(type,"dmf")){
retval = MOD_TYPE_DMF;
}else if(!strcmp(type,"ptm")){
retval = MOD_TYPE_PTM;
}else if(!strcmp(type,"dbm")){
retval = MOD_TYPE_DBM;
}else if(!strcmp(type,"mt2")){
retval = MOD_TYPE_MT2;
}else if(!strcmp(type,"amf0")){
retval = MOD_TYPE_AMF0;
}else if(!strcmp(type,"psm")){
retval = MOD_TYPE_PSM;
}else if(!strcmp(type,"j2b")){
retval = MOD_TYPE_J2B;
}else if(!strcmp(type,"abc")){
retval = MOD_TYPE_ABC;
}else if(!strcmp(type,"pat")){
retval = MOD_TYPE_PAT;
}else if(!strcmp(type,"umx")){
retval = MOD_TYPE_UMX;
}else{
retval = MOD_TYPE_IT; /* fallback, most complex type */
}
openmpt_free_string(type);
return retval;
}
| 9,048 |
141,343 | 0 | static WeakDocumentSet& liveDocumentSet() {
DEFINE_STATIC_LOCAL(blink::Persistent<WeakDocumentSet>, set,
(blink::MakeGarbageCollected<WeakDocumentSet>()));
return *set;
}
| 9,049 |
124,053 | 0 | bool BookmarksCreateFunction::RunImpl() {
if (!EditBookmarksEnabled())
return false;
scoped_ptr<bookmarks::Create::Params> params(
bookmarks::Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
int64 parentId;
if (!params->bookmark.parent_id.get()) {
parentId = model->other_node()->id();
} else {
if (!GetBookmarkIdAsInt64(*params->bookmark.parent_id, &parentId))
return false;
}
const BookmarkNode* parent = model->GetNodeByID(parentId);
if (!parent) {
error_ = keys::kNoParentError;
return false;
}
if (parent->is_root()) { // Can't create children of the root.
error_ = keys::kModifySpecialError;
return false;
}
int index;
if (!params->bookmark.index.get()) { // Optional (defaults to end).
index = parent->child_count();
} else {
index = *params->bookmark.index;
if (index > parent->child_count() || index < 0) {
error_ = keys::kInvalidIndexError;
return false;
}
}
string16 title; // Optional.
if (params->bookmark.title.get())
title = UTF8ToUTF16(*params->bookmark.title.get());
std::string url_string; // Optional.
if (params->bookmark.url.get())
url_string = *params->bookmark.url.get();
GURL url(url_string);
if (!url_string.empty() && !url.is_valid()) {
error_ = keys::kInvalidUrlError;
return false;
}
const BookmarkNode* node;
if (url_string.length())
node = model->AddURL(parent, index, title, url);
else
node = model->AddFolder(parent, index, title);
DCHECK(node);
if (!node) {
error_ = keys::kNoNodeError;
return false;
}
scoped_ptr<BookmarkTreeNode> ret(
bookmark_api_helpers::GetBookmarkTreeNode(node, false, false));
results_ = bookmarks::Create::Results::Create(*ret);
return true;
}
| 9,050 |
141,564 | 0 | void TracingControllerImpl::OnTraceLogEnabled() {
if (start_tracing_done_)
std::move(start_tracing_done_).Run();
}
| 9,051 |
127,171 | 0 | FullscreenTestBrowserWindow() : fullscreen_(false) {}
| 9,052 |
80,491 | 0 | GF_Box *stsz_New()
{
ISOM_DECL_BOX_ALLOC(GF_SampleSizeBox, 0);
return (GF_Box *)tmp;
}
| 9,053 |
123,799 | 0 | void DOMFileSystemSync::reportError(PassOwnPtr<ErrorCallback> errorCallback, PassRefPtrWillBeRawPtr<FileError> fileError)
{
errorCallback->handleEvent(fileError.get());
}
| 9,054 |
126,095 | 0 | InitialLoadObserver::~InitialLoadObserver() {
}
| 9,055 |
157,985 | 0 | void RenderViewImpl::SetFocus(bool enable) {
GetWidget()->SetFocus(enable);
}
| 9,056 |
74,357 | 0 | CCHAR GetReceiveQueueForCurrentCPU(PARANDIS_ADAPTER *pContext)
{
#if PARANDIS_SUPPORT_RSS
return ParaNdis6_RSSGetCurrentCpuReceiveQueue(&pContext->RSSParameters);
#else
UNREFERENCED_PARAMETER(pContext);
return PARANDIS_RECEIVE_QUEUE_UNCLASSIFIED;
#endif
}
| 9,057 |
7,101 | 0 | tt_cmap14_char_var_index( TT_CMap cmap,
TT_CMap ucmap,
FT_UInt32 charcode,
FT_UInt32 variantSelector )
{
FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
FT_ULong defOff;
FT_ULong nondefOff;
if ( !p )
return 0;
defOff = TT_NEXT_ULONG( p );
nondefOff = TT_PEEK_ULONG( p );
if ( defOff != 0 &&
tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )
{
/* This is the default variant of this charcode. GID not stored */
/* here; stored in the normal Unicode charmap instead. */
return ucmap->cmap.clazz->char_index( &ucmap->cmap, charcode );
}
if ( nondefOff != 0 )
return tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
charcode );
return 0;
}
| 9,058 |
161,194 | 0 | void JSEval(const std::string& script) {
EXPECT_TRUE(content::ExecuteScript(
browser()->tab_strip_model()->GetActiveWebContents(), script));
}
| 9,059 |
57,276 | 0 | static void renew_lease(const struct nfs_server *server, unsigned long timestamp)
{
struct nfs_client *clp = server->nfs_client;
if (!nfs4_has_session(clp))
do_renew_lease(clp, timestamp);
}
| 9,060 |
48,820 | 0 | static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
{
#ifdef CONFIG_XPS
struct xps_dev_maps *dev_maps;
struct xps_map *map;
int queue_index = -1;
rcu_read_lock();
dev_maps = rcu_dereference(dev->xps_maps);
if (dev_maps) {
map = rcu_dereference(
dev_maps->cpu_map[skb->sender_cpu - 1]);
if (map) {
if (map->len == 1)
queue_index = map->queues[0];
else
queue_index = map->queues[reciprocal_scale(skb_get_hash(skb),
map->len)];
if (unlikely(queue_index >= dev->real_num_tx_queues))
queue_index = -1;
}
}
rcu_read_unlock();
return queue_index;
#else
return -1;
#endif
}
| 9,061 |
9,176 | 0 | static bool virtio_64bit_features_needed(void *opaque)
{
VirtIODevice *vdev = opaque;
return (vdev->host_features >> 32) != 0;
}
| 9,062 |
172,081 | 0 | static void init_poll(int h)
{
int i;
ts[h].poll_count = 0;
ts[h].thread_id = -1;
ts[h].callback = NULL;
ts[h].cmd_callback = NULL;
for(i = 0; i < MAX_POLL; i++)
{
ts[h].ps[i].pfd.fd = -1;
ts[h].psi[i] = -1;
}
init_cmd_fd(h);
}
| 9,063 |
143,467 | 0 | void test(TestCase testCase)
{
MockHTMLResourcePreloader preloader;
KURL baseURL(ParsedURLString, testCase.baseURL);
m_scanner->appendToEnd(String(testCase.inputHTML));
m_scanner->scanAndPreload(&preloader, baseURL, nullptr);
preloader.preloadRequestVerification(testCase.type, testCase.preloadedURL, testCase.outputBaseURL, testCase.resourceWidth, testCase.preferences);
}
| 9,064 |
103,409 | 0 | String DocumentWriter::deprecatedFrameEncoding() const
{
return m_frame->document()->url().isEmpty() ? m_encoding : encoding();
}
| 9,065 |
92,405 | 0 | int release_terminal(void) {
static const struct sigaction sa_new = {
.sa_handler = SIG_IGN,
.sa_flags = SA_RESTART,
};
_cleanup_close_ int fd = -1;
struct sigaction sa_old;
int r;
fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
if (fd < 0)
return -errno;
/* Temporarily ignore SIGHUP, so that we don't get SIGHUP'ed
* by our own TIOCNOTTY */
assert_se(sigaction(SIGHUP, &sa_new, &sa_old) == 0);
r = ioctl(fd, TIOCNOTTY) < 0 ? -errno : 0;
assert_se(sigaction(SIGHUP, &sa_old, NULL) == 0);
return r;
}
| 9,066 |
71,798 | 0 | static MagickBooleanType WriteWEBPImage(const ImageInfo *image_info,
Image *image)
{
const char
*value;
int
webp_status;
MagickBooleanType
status;
MemoryInfo
*pixel_info;
register uint32_t
*restrict q;
ssize_t
y;
WebPConfig
configure;
WebPPicture
picture;
WebPAuxStats
statistics;
/*
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);
if ((image->columns > 16383UL) || (image->rows > 16383UL))
ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
if ((WebPPictureInit(&picture) == 0) || (WebPConfigInit(&configure) == 0))
ThrowWriterException(ResourceLimitError,"UnableToEncodeImageFile");
picture.writer=WebPEncodeWriter;
picture.custom_ptr=(void *) image;
#if WEBP_DECODER_ABI_VERSION >= 0x0100
picture.progress_hook=WebPEncodeProgress;
#endif
picture.stats=(&statistics);
picture.width=(int) image->columns;
picture.height=(int) image->rows;
picture.argb_stride=(int) image->columns;
picture.use_argb=1;
if (image->quality != UndefinedCompressionQuality)
configure.quality=(float) image->quality;
if (image->quality >= 100)
configure.lossless=1;
value=GetImageOption(image_info,"webp:lossless");
if (value != (char *) NULL)
configure.lossless=(int) ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
value=GetImageOption(image_info,"webp:method");
if (value != (char *) NULL)
configure.method=StringToInteger(value);
value=GetImageOption(image_info,"webp:image-hint");
if (value != (char *) NULL)
{
if (LocaleCompare(value,"default") == 0)
configure.image_hint=WEBP_HINT_DEFAULT;
if (LocaleCompare(value,"photo") == 0)
configure.image_hint=WEBP_HINT_PHOTO;
if (LocaleCompare(value,"picture") == 0)
configure.image_hint=WEBP_HINT_PICTURE;
#if WEBP_DECODER_ABI_VERSION >= 0x0200
if (LocaleCompare(value,"graph") == 0)
configure.image_hint=WEBP_HINT_GRAPH;
#endif
}
value=GetImageOption(image_info,"webp:target-size");
if (value != (char *) NULL)
configure.target_size=StringToInteger(value);
value=GetImageOption(image_info,"webp:target-psnr");
if (value != (char *) NULL)
configure.target_PSNR=(float) StringToDouble(value,(char **) NULL);
value=GetImageOption(image_info,"webp:segments");
if (value != (char *) NULL)
configure.segments=StringToInteger(value);
value=GetImageOption(image_info,"webp:sns-strength");
if (value != (char *) NULL)
configure.sns_strength=StringToInteger(value);
value=GetImageOption(image_info,"webp:filter-strength");
if (value != (char *) NULL)
configure.filter_strength=StringToInteger(value);
value=GetImageOption(image_info,"webp:filter-sharpness");
if (value != (char *) NULL)
configure.filter_sharpness=StringToInteger(value);
value=GetImageOption(image_info,"webp:filter-type");
if (value != (char *) NULL)
configure.filter_type=StringToInteger(value);
value=GetImageOption(image_info,"webp:auto-filter");
if (value != (char *) NULL)
configure.autofilter=(int) ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
value=GetImageOption(image_info,"webp:alpha-compression");
if (value != (char *) NULL)
configure.alpha_compression=StringToInteger(value);
value=GetImageOption(image_info,"webp:alpha-filtering");
if (value != (char *) NULL)
configure.alpha_filtering=StringToInteger(value);
value=GetImageOption(image_info,"webp:alpha-quality");
if (value != (char *) NULL)
configure.alpha_quality=StringToInteger(value);
value=GetImageOption(image_info,"webp:pass");
if (value != (char *) NULL)
configure.pass=StringToInteger(value);
value=GetImageOption(image_info,"webp:show-compressed");
if (value != (char *) NULL)
configure.show_compressed=StringToInteger(value);
value=GetImageOption(image_info,"webp:preprocessing");
if (value != (char *) NULL)
configure.preprocessing=StringToInteger(value);
value=GetImageOption(image_info,"webp:partitions");
if (value != (char *) NULL)
configure.partitions=StringToInteger(value);
value=GetImageOption(image_info,"webp:partition-limit");
if (value != (char *) NULL)
configure.partition_limit=StringToInteger(value);
#if WEBP_DECODER_ABI_VERSION >= 0x0201
value=GetImageOption(image_info,"webp:emulate-jpeg-size");
if (value != (char *) NULL)
configure.emulate_jpeg_size=(int) ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
value=GetImageOption(image_info,"webp:low-memory");
if (value != (char *) NULL)
configure.low_memory=(int) ParseCommandOption(MagickBooleanOptions,
MagickFalse,value);
value=GetImageOption(image_info,"webp:thread-level");
if (value != (char *) NULL)
configure.thread_level=StringToInteger(value);
#endif
if (WebPValidateConfig(&configure) == 0)
ThrowWriterException(ResourceLimitError,"UnableToEncodeImageFile");
/*
Allocate memory for pixels.
*/
(void) TransformImageColorspace(image,sRGBColorspace);
pixel_info=AcquireVirtualMemory(image->columns,image->rows*
sizeof(*picture.argb));
if (pixel_info == (MemoryInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
picture.argb=(uint32_t *) GetVirtualMemoryBlob(pixel_info);
/*
Convert image to WebP raster pixels.
*/
q=picture.argb;
for (y=0; y < (ssize_t) image->rows; y++)
{
register const PixelPacket
*restrict p;
register ssize_t
x;
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
*q++=(uint32_t) (image->matte != MagickFalse ?
ScaleQuantumToChar(GetPixelAlpha(p)) << 24 : 0xff000000u) |
(ScaleQuantumToChar(GetPixelRed(p)) << 16) |
(ScaleQuantumToChar(GetPixelGreen(p)) << 8) |
(ScaleQuantumToChar(GetPixelBlue(p)));
p++;
}
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
webp_status=WebPEncode(&configure,&picture);
if (webp_status == 0)
{
const char
*message;
switch (picture.error_code)
{
case VP8_ENC_ERROR_OUT_OF_MEMORY:
{
message="out of memory";
break;
}
case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY:
{
message="bitstream out of memory";
break;
}
case VP8_ENC_ERROR_NULL_PARAMETER:
{
message="NULL parameter";
break;
}
case VP8_ENC_ERROR_INVALID_CONFIGURATION:
{
message="invalid configuration";
break;
}
case VP8_ENC_ERROR_BAD_DIMENSION:
{
message="bad dimension";
break;
}
case VP8_ENC_ERROR_PARTITION0_OVERFLOW:
{
message="partition 0 overflow (> 512K)";
break;
}
case VP8_ENC_ERROR_PARTITION_OVERFLOW:
{
message="partition overflow (> 16M)";
break;
}
case VP8_ENC_ERROR_BAD_WRITE:
{
message="bad write";
break;
}
case VP8_ENC_ERROR_FILE_TOO_BIG:
{
message="file too big (> 4GB)";
break;
}
#if WEBP_DECODER_ABI_VERSION >= 0x0100
case VP8_ENC_ERROR_USER_ABORT:
{
message="user abort";
break;
}
#endif
default:
{
message="unknown exception";
break;
}
}
(void) ThrowMagickException(&image->exception,GetMagickModule(),
CorruptImageError,(char *) message,"`%s'",image->filename);
}
picture.argb=(uint32_t *) NULL;
WebPPictureFree(&picture);
pixel_info=RelinquishVirtualMemory(pixel_info);
(void) CloseBlob(image);
return(webp_status == 0 ? MagickFalse : MagickTrue);
}
| 9,067 |
106,508 | 0 | void WebPageProxy::didStartProgress()
{
m_estimatedProgress = initialProgressValue;
m_loaderClient.didStartProgress(this);
}
| 9,068 |
164,498 | 0 | static int btreeInitPage(MemPage *pPage){
int pc; /* Address of a freeblock within pPage->aData[] */
u8 hdr; /* Offset to beginning of page header */
u8 *data; /* Equal to pPage->aData */
BtShared *pBt; /* The main btree structure */
int usableSize; /* Amount of usable space on each page */
u16 cellOffset; /* Offset from start of page to first cell pointer */
int nFree; /* Number of unused bytes on the page */
int top; /* First byte of the cell content area */
int iCellFirst; /* First allowable cell or freeblock offset */
int iCellLast; /* Last possible cell or freeblock offset */
assert( pPage->pBt!=0 );
assert( pPage->pBt->db!=0 );
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
assert( pPage->isInit==0 );
pBt = pPage->pBt;
hdr = pPage->hdrOffset;
data = pPage->aData;
/* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
** the b-tree page type. */
if( decodeFlags(pPage, data[hdr]) ){
return SQLITE_CORRUPT_PAGE(pPage);
}
assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
pPage->maskPage = (u16)(pBt->pageSize - 1);
pPage->nOverflow = 0;
usableSize = pBt->usableSize;
pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
pPage->aDataEnd = &data[usableSize];
pPage->aCellIdx = &data[cellOffset];
pPage->aDataOfst = &data[pPage->childPtrSize];
/* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
** the start of the cell content area. A zero value for this integer is
** interpreted as 65536. */
top = get2byteNotZero(&data[hdr+5]);
/* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
** number of cells on the page. */
pPage->nCell = get2byte(&data[hdr+3]);
if( pPage->nCell>MX_CELL(pBt) ){
/* To many cells for a single page. The page must be corrupt */
return SQLITE_CORRUPT_PAGE(pPage);
}
testcase( pPage->nCell==MX_CELL(pBt) );
/* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
** possible for a root page of a table that contains no rows) then the
** offset to the cell content area will equal the page size minus the
** bytes of reserved space. */
assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );
/* A malformed database page might cause us to read past the end
** of page when parsing a cell.
**
** The following block of code checks early to see if a cell extends
** past the end of a page boundary and causes SQLITE_CORRUPT to be
** returned if it does.
*/
iCellFirst = cellOffset + 2*pPage->nCell;
iCellLast = usableSize - 4;
if( pBt->db->flags & SQLITE_CellSizeCk ){
int i; /* Index into the cell pointer array */
int sz; /* Size of a cell */
if( !pPage->leaf ) iCellLast--;
for(i=0; i<pPage->nCell; i++){
pc = get2byteAligned(&data[cellOffset+i*2]);
testcase( pc==iCellFirst );
testcase( pc==iCellLast );
if( pc<iCellFirst || pc>iCellLast ){
return SQLITE_CORRUPT_PAGE(pPage);
}
sz = pPage->xCellSize(pPage, &data[pc]);
testcase( pc+sz==usableSize );
if( pc+sz>usableSize ){
return SQLITE_CORRUPT_PAGE(pPage);
}
}
if( !pPage->leaf ) iCellLast++;
}
/* Compute the total free space on the page
** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
** start of the first freeblock on the page, or is zero if there are no
** freeblocks. */
pc = get2byte(&data[hdr+1]);
nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
if( pc>0 ){
u32 next, size;
if( pc<iCellFirst ){
/* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will
** always be at least one cell before the first freeblock.
*/
return SQLITE_CORRUPT_PAGE(pPage);
}
while( 1 ){
if( pc>iCellLast ){
/* Freeblock off the end of the page */
return SQLITE_CORRUPT_PAGE(pPage);
}
next = get2byte(&data[pc]);
size = get2byte(&data[pc+2]);
nFree = nFree + size;
if( next<=pc+size+3 ) break;
pc = next;
}
if( next>0 ){
/* Freeblock not in ascending order */
return SQLITE_CORRUPT_PAGE(pPage);
}
if( pc+size>(unsigned int)usableSize ){
/* Last freeblock extends past page end */
return SQLITE_CORRUPT_PAGE(pPage);
}
}
/* At this point, nFree contains the sum of the offset to the start
** of the cell-content area plus the number of free bytes within
** the cell-content area. If this is greater than the usable-size
** of the page, then the page must be corrupted. This check also
** serves to verify that the offset to the start of the cell-content
** area, according to the page header, lies within the page.
*/
if( nFree>usableSize ){
return SQLITE_CORRUPT_PAGE(pPage);
}
pPage->nFree = (u16)(nFree - iCellFirst);
pPage->isInit = 1;
return SQLITE_OK;
}
| 9,069 |
42,864 | 0 | static void save_edited_one_liner(GtkCellRendererText *renderer,
gchar *tree_path,
gchar *new_text,
gpointer user_data)
{
GtkTreeIter iter;
if (!gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(g_ls_details), &iter, tree_path))
return;
gchar *item_name = NULL;
gtk_tree_model_get(GTK_TREE_MODEL(g_ls_details), &iter,
DETAIL_COLUMN_NAME, &item_name,
-1);
if (!item_name) /* paranoia, should never happen */
return;
struct problem_item *item = problem_data_get_item_or_NULL(g_cd, item_name);
if (item && (item->flags & CD_FLAG_ISEDITABLE))
{
struct dump_dir *dd = wizard_open_directory_for_writing(g_dump_dir_name);
if (dd)
{
dd_save_text(dd, item_name, new_text);
free(item->content);
item->content = xstrdup(new_text);
gtk_list_store_set(g_ls_details, &iter,
DETAIL_COLUMN_VALUE, new_text,
-1);
}
dd_close(dd);
}
}
| 9,070 |
109,005 | 0 | void RenderViewImpl::OnZoomFactor(content::PageZoom zoom,
int zoom_center_x, int zoom_center_y) {
ZoomFactorHelper(zoom, zoom_center_x, zoom_center_y,
kScalingIncrementForGesture);
}
| 9,071 |
30,602 | 0 | static void iucv_callback_txdone(struct iucv_path *path,
struct iucv_message *msg)
{
struct sock *sk = path->private;
struct sk_buff *this = NULL;
struct sk_buff_head *list = &iucv_sk(sk)->send_skb_q;
struct sk_buff *list_skb = list->next;
unsigned long flags;
bh_lock_sock(sk);
if (!skb_queue_empty(list)) {
spin_lock_irqsave(&list->lock, flags);
while (list_skb != (struct sk_buff *)list) {
if (!memcmp(&msg->tag, CB_TAG(list_skb), CB_TAG_LEN)) {
this = list_skb;
break;
}
list_skb = list_skb->next;
}
if (this)
__skb_unlink(this, list);
spin_unlock_irqrestore(&list->lock, flags);
if (this) {
kfree_skb(this);
/* wake up any process waiting for sending */
iucv_sock_wake_msglim(sk);
}
}
if (sk->sk_state == IUCV_CLOSING) {
if (skb_queue_empty(&iucv_sk(sk)->send_skb_q)) {
sk->sk_state = IUCV_CLOSED;
sk->sk_state_change(sk);
}
}
bh_unlock_sock(sk);
}
| 9,072 |
151,356 | 0 | void InspectorTraceEvents::Init(CoreProbeSink* instrumenting_agents,
protocol::UberDispatcher*,
protocol::DictionaryValue*) {
instrumenting_agents_ = instrumenting_agents;
instrumenting_agents_->addInspectorTraceEvents(this);
}
| 9,073 |
92,600 | 0 | static inline void list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
{
}
| 9,074 |
139,002 | 0 | rescaled_small_exists() const {
return rescaled_small_exists_;
}
| 9,075 |
52,030 | 0 | dissect_notify_field(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep, guint16 type,
guint16 *data)
{
guint16 field;
const char *str;
offset = dissect_ndr_uint16(
tvb, offset, pinfo, NULL, di, drep,
hf_notify_field, &field);
switch(type) {
case PRINTER_NOTIFY_TYPE:
str = val_to_str_ext_const(field, &printer_notify_option_data_vals_ext,
"Unknown");
break;
case JOB_NOTIFY_TYPE:
str = val_to_str_ext_const(field, &job_notify_option_data_vals_ext,
"Unknown");
break;
default:
str = "Unknown notify type";
break;
}
proto_tree_add_uint_format_value(tree, hf_notify_field, tvb, offset - 2, 2, field, "%s (%d)", str, field);
if (data)
*data = field;
return offset;
}
| 9,076 |
45,430 | 0 | ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
char *cipher_name, size_t *key_size)
{
char dummy_key[ECRYPTFS_MAX_KEY_BYTES];
char *full_alg_name = NULL;
int rc;
*key_tfm = NULL;
if (*key_size > ECRYPTFS_MAX_KEY_BYTES) {
rc = -EINVAL;
printk(KERN_ERR "Requested key size is [%zd] bytes; maximum "
"allowable is [%d]\n", *key_size, ECRYPTFS_MAX_KEY_BYTES);
goto out;
}
rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name, cipher_name,
"ecb");
if (rc)
goto out;
*key_tfm = crypto_alloc_blkcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(*key_tfm)) {
rc = PTR_ERR(*key_tfm);
printk(KERN_ERR "Unable to allocate crypto cipher with name "
"[%s]; rc = [%d]\n", full_alg_name, rc);
goto out;
}
crypto_blkcipher_set_flags(*key_tfm, CRYPTO_TFM_REQ_WEAK_KEY);
if (*key_size == 0) {
struct blkcipher_alg *alg = crypto_blkcipher_alg(*key_tfm);
*key_size = alg->max_keysize;
}
get_random_bytes(dummy_key, *key_size);
rc = crypto_blkcipher_setkey(*key_tfm, dummy_key, *key_size);
if (rc) {
printk(KERN_ERR "Error attempting to set key of size [%zd] for "
"cipher [%s]; rc = [%d]\n", *key_size, full_alg_name,
rc);
rc = -EINVAL;
goto out;
}
out:
kfree(full_alg_name);
return rc;
}
| 9,077 |
99,946 | 0 | NPError PluginInstance::NPP_DestroyStream(NPStream *stream, NPReason reason) {
DCHECK(npp_functions_ != 0);
DCHECK(npp_functions_->destroystream != 0);
if (stream == NULL || !IsValidStream(stream) || (stream->ndata == NULL))
return NPERR_INVALID_INSTANCE_ERROR;
if (npp_functions_->destroystream != 0) {
NPError result = npp_functions_->destroystream(npp_, stream, reason);
stream->ndata = NULL;
return result;
}
return NPERR_INVALID_FUNCTABLE_ERROR;
}
| 9,078 |
155,979 | 0 | void DiceTurnSyncOnHelper::SyncStartupCompleted() {
DCHECK(sync_startup_tracker_);
sync_startup_tracker_.reset();
ShowSyncConfirmationUI();
}
| 9,079 |
169,206 | 0 | DOMMessageQueue::DOMMessageQueue(WebContents* web_contents)
: WebContentsObserver(web_contents) {
registrar_.Add(this, NOTIFICATION_DOM_OPERATION_RESPONSE,
Source<WebContents>(web_contents));
}
| 9,080 |
179,550 | 1 | static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
struct dj_report *dj_report)
{
/* Called in delayed work context */
struct hid_device *djrcv_hdev = djrcv_dev->hdev;
struct usb_interface *intf = to_usb_interface(djrcv_hdev->dev.parent);
struct usb_device *usbdev = interface_to_usbdev(intf);
struct hid_device *dj_hiddev;
struct dj_device *dj_dev;
/* Device index goes from 1 to 6, we need 3 bytes to store the
* semicolon, the index, and a null terminator
*/
unsigned char tmpstr[3];
if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] &
SPFUNCTION_DEVICE_LIST_EMPTY) {
dbg_hid("%s: device list is empty\n", __func__);
djrcv_dev->querying_devices = false;
return;
}
if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
(dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
dev_err(&djrcv_hdev->dev, "%s: invalid device index:%d\n",
__func__, dj_report->device_index);
return;
}
if (djrcv_dev->paired_dj_devices[dj_report->device_index]) {
/* The device is already known. No need to reallocate it. */
dbg_hid("%s: device is already known\n", __func__);
return;
}
dj_hiddev = hid_allocate_device();
if (IS_ERR(dj_hiddev)) {
dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n",
__func__);
return;
}
dj_hiddev->ll_driver = &logi_dj_ll_driver;
dj_hiddev->dev.parent = &djrcv_hdev->dev;
dj_hiddev->bus = BUS_USB;
dj_hiddev->vendor = le16_to_cpu(usbdev->descriptor.idVendor);
dj_hiddev->product = le16_to_cpu(usbdev->descriptor.idProduct);
snprintf(dj_hiddev->name, sizeof(dj_hiddev->name),
"Logitech Unifying Device. Wireless PID:%02x%02x",
dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB],
dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_LSB]);
usb_make_path(usbdev, dj_hiddev->phys, sizeof(dj_hiddev->phys));
snprintf(tmpstr, sizeof(tmpstr), ":%d", dj_report->device_index);
strlcat(dj_hiddev->phys, tmpstr, sizeof(dj_hiddev->phys));
dj_dev = kzalloc(sizeof(struct dj_device), GFP_KERNEL);
if (!dj_dev) {
dev_err(&djrcv_hdev->dev, "%s: failed allocating dj_device\n",
__func__);
goto dj_device_allocate_fail;
}
dj_dev->reports_supported = get_unaligned_le32(
dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE);
dj_dev->hdev = dj_hiddev;
dj_dev->dj_receiver_dev = djrcv_dev;
dj_dev->device_index = dj_report->device_index;
dj_hiddev->driver_data = dj_dev;
djrcv_dev->paired_dj_devices[dj_report->device_index] = dj_dev;
if (hid_add_device(dj_hiddev)) {
dev_err(&djrcv_hdev->dev, "%s: failed adding dj_device\n",
__func__);
goto hid_add_device_fail;
}
return;
hid_add_device_fail:
djrcv_dev->paired_dj_devices[dj_report->device_index] = NULL;
kfree(dj_dev);
dj_device_allocate_fail:
hid_destroy_device(dj_hiddev);
}
| 9,081 |
84,734 | 0 | loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
const struct loop_info64 *i)
{
int err = 0;
if (xfer) {
struct module *owner = xfer->owner;
if (!try_module_get(owner))
return -EINVAL;
if (xfer->init)
err = xfer->init(lo, i);
if (err)
module_put(owner);
else
lo->lo_encryption = xfer;
}
return err;
}
| 9,082 |
75,723 | 0 | bool testAddBaseHelper(const wchar_t * base, const wchar_t * rel, const wchar_t * expectedResult, bool backward_compatibility = false) {
UriParserStateW stateW;
UriUriW baseUri;
stateW.uri = &baseUri;
int res = uriParseUriW(&stateW, base);
if (res != 0) {
uriFreeUriMembersW(&baseUri);
return false;
}
UriUriW relUri;
stateW.uri = &relUri;
res = uriParseUriW(&stateW, rel);
if (res != 0) {
uriFreeUriMembersW(&baseUri);
uriFreeUriMembersW(&relUri);
return false;
}
UriUriW expectedUri;
stateW.uri = &expectedUri;
res = uriParseUriW(&stateW, expectedResult);
if (res != 0) {
uriFreeUriMembersW(&baseUri);
uriFreeUriMembersW(&relUri);
uriFreeUriMembersW(&expectedUri);
return false;
}
UriUriW transformedUri;
if (backward_compatibility) {
res = uriAddBaseUriExW(&transformedUri, &relUri, &baseUri, URI_RESOLVE_IDENTICAL_SCHEME_COMPAT);
} else {
res = uriAddBaseUriW(&transformedUri, &relUri, &baseUri);
}
if (res != 0) {
uriFreeUriMembersW(&baseUri);
uriFreeUriMembersW(&relUri);
uriFreeUriMembersW(&expectedUri);
uriFreeUriMembersW(&transformedUri);
return false;
}
const bool equal = (URI_TRUE == uriEqualsUriW(&transformedUri, &expectedUri));
if (!equal) {
wchar_t transformedUriText[1024 * 8];
wchar_t expectedUriText[1024 * 8];
uriToStringW(transformedUriText, &transformedUri, 1024 * 8, NULL);
uriToStringW(expectedUriText, &expectedUri, 1024 * 8, NULL);
#ifdef HAVE_WPRINTF
wprintf(L"\n\n\nExpected: \"%s\"\nReceived: \"%s\"\n\n\n", expectedUriText, transformedUriText);
#endif
}
uriFreeUriMembersW(&baseUri);
uriFreeUriMembersW(&relUri);
uriFreeUriMembersW(&expectedUri);
uriFreeUriMembersW(&transformedUri);
return equal;
}
| 9,083 |
9,607 | 0 | static PHP_RINIT_FUNCTION(session) /* {{{ */
{
return php_rinit_session(PS(auto_start) TSRMLS_CC);
}
/* }}} */
| 9,084 |
55,373 | 0 | static void evm_reset_status(struct inode *inode)
{
struct integrity_iint_cache *iint;
iint = integrity_iint_find(inode);
if (iint)
iint->evm_status = INTEGRITY_UNKNOWN;
}
| 9,085 |
95,176 | 0 | static void cmd_thread(char *tag, int usinguid)
{
static struct buf arg;
int c;
int alg;
struct searchargs *searchargs;
clock_t start = clock();
char mytime[100];
int n;
if (backend_current) {
/* remote mailbox */
const char *cmd = usinguid ? "UID Thread" : "Thread";
prot_printf(backend_current->out, "%s %s ", tag, cmd);
if (!pipe_command(backend_current, 65536)) {
pipe_including_tag(backend_current, tag, 0);
}
return;
}
/* local mailbox */
/* get algorithm */
c = getword(imapd_in, &arg);
if (c != ' ') {
prot_printf(imapd_out, "%s BAD Missing algorithm in Thread\r\n", tag);
eatline(imapd_in, c);
return;
}
if ((alg = find_thread_algorithm(arg.s)) == -1) {
prot_printf(imapd_out, "%s BAD Invalid Thread algorithm %s\r\n",
tag, arg.s);
eatline(imapd_in, c);
return;
}
searchargs = new_searchargs(tag, GETSEARCH_CHARSET_FIRST,
&imapd_namespace, imapd_userid, imapd_authstate,
imapd_userisadmin || imapd_userisproxyadmin);
c = get_search_program(imapd_in, imapd_out, searchargs);
if (c == EOF) {
eatline(imapd_in, ' ');
freesearchargs(searchargs);
return;
}
if (c == '\r') c = prot_getc(imapd_in);
if (c != '\n') {
prot_printf(imapd_out,
"%s BAD Unexpected extra arguments to Thread\r\n", tag);
eatline(imapd_in, c);
freesearchargs(searchargs);
return;
}
n = index_thread(imapd_index, alg, searchargs, usinguid);
snprintf(mytime, sizeof(mytime), "%2.3f",
(clock() - start) / (double) CLOCKS_PER_SEC);
prot_printf(imapd_out, "%s OK %s (%d msgs in %s secs)\r\n", tag,
error_message(IMAP_OK_COMPLETED), n, mytime);
freesearchargs(searchargs);
return;
}
| 9,086 |
155,455 | 0 | bool ChromeContentBrowserClient::ShouldTerminateOnServiceQuit(
const service_manager::Identity& id) {
#if defined(OS_CHROMEOS)
return ash_service_registry::ShouldTerminateOnServiceQuit(id.name());
#endif
return false;
}
| 9,087 |
134,799 | 0 | TabletEventConverterEvdev::TabletEventConverterEvdev(
int fd,
base::FilePath path,
int id,
InputDeviceType type,
CursorDelegateEvdev* cursor,
const EventDeviceInfo& info,
DeviceEventDispatcherEvdev* dispatcher)
: EventConverterEvdev(fd,
path,
id,
type,
info.name(),
info.vendor_id(),
info.product_id()),
cursor_(cursor),
dispatcher_(dispatcher),
stylus_(0),
abs_value_dirty_(false) {
x_abs_min_ = info.GetAbsMinimum(ABS_X);
x_abs_range_ = info.GetAbsMaximum(ABS_X) - x_abs_min_ + 1;
y_abs_min_ = info.GetAbsMinimum(ABS_Y);
y_abs_range_ = info.GetAbsMaximum(ABS_Y) - y_abs_min_ + 1;
}
| 9,088 |
55,982 | 0 | __tty_ldisc_lock_nested(struct tty_struct *tty, unsigned long timeout)
{
return ldsem_down_write_nested(&tty->ldisc_sem,
LDISC_SEM_OTHER, timeout);
}
| 9,089 |
37,709 | 0 | static inline struct kvm_pit *dev_to_pit(struct kvm_io_device *dev)
{
return container_of(dev, struct kvm_pit, dev);
}
| 9,090 |
175,653 | 0 | void SoftMPEG4Encoder::initPorts() {
OMX_PARAM_PORTDEFINITIONTYPE def;
InitOMXParams(&def);
const size_t kInputBufferSize = (mVideoWidth * mVideoHeight * 3) >> 1;
const size_t kOutputBufferSize =
(kInputBufferSize > 256 * 1024)
? kInputBufferSize: 256 * 1024;
def.nPortIndex = 0;
def.eDir = OMX_DirInput;
def.nBufferCountMin = kNumBuffers;
def.nBufferCountActual = def.nBufferCountMin;
def.nBufferSize = kInputBufferSize;
def.bEnabled = OMX_TRUE;
def.bPopulated = OMX_FALSE;
def.eDomain = OMX_PortDomainVideo;
def.bBuffersContiguous = OMX_FALSE;
def.nBufferAlignment = 1;
def.format.video.cMIMEType = const_cast<char *>("video/raw");
def.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
def.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
def.format.video.xFramerate = (mVideoFrameRate << 16); // Q16 format
def.format.video.nBitrate = mVideoBitRate;
def.format.video.nFrameWidth = mVideoWidth;
def.format.video.nFrameHeight = mVideoHeight;
def.format.video.nStride = mVideoWidth;
def.format.video.nSliceHeight = mVideoHeight;
addPort(def);
def.nPortIndex = 1;
def.eDir = OMX_DirOutput;
def.nBufferCountMin = kNumBuffers;
def.nBufferCountActual = def.nBufferCountMin;
def.nBufferSize = kOutputBufferSize;
def.bEnabled = OMX_TRUE;
def.bPopulated = OMX_FALSE;
def.eDomain = OMX_PortDomainVideo;
def.bBuffersContiguous = OMX_FALSE;
def.nBufferAlignment = 2;
def.format.video.cMIMEType =
(mEncodeMode == COMBINE_MODE_WITH_ERR_RES)
? const_cast<char *>(MEDIA_MIMETYPE_VIDEO_MPEG4)
: const_cast<char *>(MEDIA_MIMETYPE_VIDEO_H263);
def.format.video.eCompressionFormat =
(mEncodeMode == COMBINE_MODE_WITH_ERR_RES)
? OMX_VIDEO_CodingMPEG4
: OMX_VIDEO_CodingH263;
def.format.video.eColorFormat = OMX_COLOR_FormatUnused;
def.format.video.xFramerate = (0 << 16); // Q16 format
def.format.video.nBitrate = mVideoBitRate;
def.format.video.nFrameWidth = mVideoWidth;
def.format.video.nFrameHeight = mVideoHeight;
def.format.video.nStride = mVideoWidth;
def.format.video.nSliceHeight = mVideoHeight;
addPort(def);
}
| 9,091 |
153,158 | 0 | bool Compositor::HasObserver(const CompositorObserver* observer) const {
return observer_list_.HasObserver(observer);
}
| 9,092 |
106,144 | 0 | EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestObj::s_info))
return throwVMTypeError(exec);
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->objMethod()));
return JSValue::encode(result);
}
| 9,093 |
17,661 | 0 | SProcXFixesChangeCursorByName(ClientPtr client)
{
REQUEST(xXFixesChangeCursorByNameReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesChangeCursorByNameReq);
swapl(&stuff->source);
swaps(&stuff->nbytes);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
| 9,094 |
46,516 | 0 | int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a,*b,*c,*d,*e;
int i;
a=BN_new();
b=BN_new();
c=BN_new();
d=BN_new();
e=BN_new();
BN_bntest_rand(c,30,0,1); /* must be odd for montgomery */
for (i=0; i<num2; i++)
{
BN_bntest_rand(a,20+i*5,0,0); /**/
BN_bntest_rand(b,2+i,0,0); /**/
if (!BN_mod_exp_mont_consttime(d,a,b,c,ctx,NULL))
return(00);
if (bp != NULL)
{
if (!results)
{
BN_print(bp,a);
BIO_puts(bp," ^ ");
BN_print(bp,b);
BIO_puts(bp," % ");
BN_print(bp,c);
BIO_puts(bp," - ");
}
BN_print(bp,d);
BIO_puts(bp,"\n");
}
BN_exp(e,a,b,ctx);
BN_sub(e,e,d);
BN_div(a,b,e,c,ctx);
if(!BN_is_zero(b))
{
fprintf(stderr,"Modulo exponentiation test failed!\n");
return 0;
}
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
return(1);
}
| 9,095 |
155,610 | 0 | base::string16 AuthenticatorTimeoutErrorModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_GENERIC_TITLE);
}
| 9,096 |
116,162 | 0 | void ResourceDispatcherHostImpl::RemovePendingRequest(
const PendingRequestList::iterator& iter) {
ResourceRequestInfoImpl* info =
ResourceRequestInfoImpl::ForRequest(iter->second);
IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost(),
info->GetChildID());
if (info->login_delegate())
info->login_delegate()->OnRequestCancelled();
if (info->ssl_client_auth_handler())
info->ssl_client_auth_handler()->OnRequestCancelled();
transferred_navigations_.erase(
GlobalRequestID(info->GetChildID(), info->GetRequestID()));
delete iter->second;
pending_requests_.erase(iter);
if (pending_requests_.empty() && update_load_states_timer_.get())
update_load_states_timer_->Stop();
}
| 9,097 |
119,370 | 0 | void RenderThreadImpl::AddFilter(IPC::MessageFilter* filter) {
channel()->AddFilter(filter);
}
| 9,098 |
47,224 | 0 | static void deflate_decomp_exit(struct deflate_ctx *ctx)
{
zlib_inflateEnd(&ctx->decomp_stream);
vfree(ctx->decomp_stream.workspace);
}
| 9,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.