unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
111,962 | 0 | syncable::ModelTypeSet MakeSet(syncable::ModelType type1,
syncable::ModelType type2) {
return syncable::ModelTypeSet(type1, type2);
}
| 14,900 |
7,953 | 0 | static int buffer_empty(Buffer *buffer)
{
return buffer->offset == 0;
}
| 14,901 |
164,056 | 0 | void DownloadManagerImpl::OpenDownload(download::DownloadItemImpl* download) {
int num_unopened = 0;
for (const auto& it : downloads_) {
download::DownloadItemImpl* item = it.second.get();
if ((item->GetState() == download::DownloadItem::COMPLETE) &&
!item->GetOpened())
++num_unopened;
}
download::RecordOpensOutstanding(num_unopened);
if (delegate_)
delegate_->OpenDownload(download);
}
| 14,902 |
132,340 | 0 | void RenderFrameImpl::showContextMenu(const blink::WebContextMenuData& data) {
ContextMenuParams params = ContextMenuParamsBuilder::Build(data);
params.source_type = GetRenderWidget()->context_menu_source_type();
GetRenderWidget()->OnShowHostContextMenu(¶ms);
if (GetRenderWidget()->has_host_context_menu_location()) {
params.x = GetRenderWidget()->host_context_menu_location().x();
params.y = GetRenderWidget()->host_context_menu_location().y();
}
if (params.src_url.spec().size() > GetMaxURLChars())
params.src_url = GURL();
context_menu_node_ = data.node;
#if defined(OS_ANDROID)
gfx::Rect start_rect;
gfx::Rect end_rect;
GetRenderWidget()->GetSelectionBounds(&start_rect, &end_rect);
params.selection_start = gfx::Point(start_rect.x(), start_rect.bottom());
params.selection_end = gfx::Point(end_rect.right(), end_rect.bottom());
#endif
Send(new FrameHostMsg_ContextMenu(routing_id_, params));
}
| 14,903 |
140,689 | 0 | ScreenLayoutObserverTest::GetDisplayNotification() const {
const message_center::NotificationList::Notifications notifications =
message_center::MessageCenter::Get()->GetVisibleNotifications();
for (const auto* notification : notifications) {
if (notification->id() == ScreenLayoutObserver::kNotificationId)
return notification;
}
return nullptr;
}
| 14,904 |
110,532 | 0 | static GLenum ExtractTypeFromStorageFormat(GLenum internalformat) {
switch (internalformat) {
case GL_RGB565:
return GL_UNSIGNED_SHORT_5_6_5;
case GL_RGBA4:
return GL_UNSIGNED_SHORT_4_4_4_4;
case GL_RGB5_A1:
return GL_UNSIGNED_SHORT_5_5_5_1;
case GL_RGB8_OES:
return GL_UNSIGNED_BYTE;
case GL_RGBA8_OES:
return GL_UNSIGNED_BYTE;
case GL_LUMINANCE8_ALPHA8_EXT:
return GL_UNSIGNED_BYTE;
case GL_LUMINANCE8_EXT:
return GL_UNSIGNED_BYTE;
case GL_ALPHA8_EXT:
return GL_UNSIGNED_BYTE;
case GL_RGBA32F_EXT:
return GL_FLOAT;
case GL_RGB32F_EXT:
return GL_FLOAT;
case GL_ALPHA32F_EXT:
return GL_FLOAT;
case GL_LUMINANCE32F_EXT:
return GL_FLOAT;
case GL_LUMINANCE_ALPHA32F_EXT:
return GL_FLOAT;
case GL_RGBA16F_EXT:
return GL_HALF_FLOAT_OES;
case GL_RGB16F_EXT:
return GL_HALF_FLOAT_OES;
case GL_ALPHA16F_EXT:
return GL_HALF_FLOAT_OES;
case GL_LUMINANCE16F_EXT:
return GL_HALF_FLOAT_OES;
case GL_LUMINANCE_ALPHA16F_EXT:
return GL_HALF_FLOAT_OES;
case GL_BGRA8_EXT:
return GL_UNSIGNED_BYTE;
default:
return GL_NONE;
}
}
| 14,905 |
124,584 | 0 | LayoutRect RenderBlock::logicalLeftSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
RenderObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo* paintInfo)
{
LayoutUnit rootBlockLogicalTop = rootBlock->blockDirectionOffset(offsetFromRootBlock) + logicalTop;
LayoutUnit rootBlockLogicalLeft = max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight));
LayoutUnit rootBlockLogicalRight = min(rootBlock->inlineDirectionOffset(offsetFromRootBlock) + floorToInt(logicalLeft), min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight)));
LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
if (rootBlockLogicalWidth <= 0)
return LayoutRect();
LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
if (paintInfo)
paintInfo->context->fillRect(pixelSnappedIntRect(gapRect), selObj->selectionBackgroundColor());
return gapRect;
}
| 14,906 |
117,710 | 0 | v8::Persistent<v8::FunctionTemplate> V8Float64Array::GetTemplate()
{
V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
if (result != data->templateMap().end())
return result->second;
v8::HandleScope handleScope;
v8::Persistent<v8::FunctionTemplate> templ =
ConfigureV8Float64ArrayTemplate(GetRawTemplate());
data->templateMap().add(&info, templ);
return templ;
}
| 14,907 |
179,281 | 1 | static struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb)
{
struct block_device *bdev;
char b[BDEVNAME_SIZE];
bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb);
if (IS_ERR(bdev))
goto fail;
return bdev;
fail:
ext3_msg(sb, "error: failed to open journal device %s: %ld",
__bdevname(dev, b), PTR_ERR(bdev));
return NULL;
}
| 14,908 |
14,128 | 0 | static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
GLXContextTag tag)
{
__GLXcontext **table = cl->currentContexts;
table[tag-1] = glxc;
}
| 14,909 |
143,239 | 0 | void Document::popCurrentScript()
{
DCHECK(!m_currentScriptStack.isEmpty());
m_currentScriptStack.removeLast();
}
| 14,910 |
77,430 | 0 | send_table_status(struct ofproto *ofproto, uint8_t table_id)
{
struct oftable *t = &ofproto->tables[table_id];
if (!t->vacancy_event) {
return;
}
uint8_t vacancy = oftable_vacancy(t);
enum ofp14_table_reason event;
if (vacancy < t->vacancy_down) {
event = OFPTR_VACANCY_DOWN;
} else if (vacancy > t->vacancy_up) {
event = OFPTR_VACANCY_UP;
} else {
return;
}
if (event == t->vacancy_event) {
struct ofputil_table_desc td;
query_table_desc__(&td, ofproto, table_id);
connmgr_send_table_status(ofproto->connmgr, &td, event);
t->vacancy_event = (event == OFPTR_VACANCY_DOWN
? OFPTR_VACANCY_UP
: OFPTR_VACANCY_DOWN);
}
}
| 14,911 |
185,116 | 1 | FileEntrySync* DirectoryEntrySync::getFile(const String& path, const Dictionary& options, ExceptionState& exceptionState)
{
FileSystemFlags flags(options);
RefPtr<EntrySyncCallbackHelper> helper = EntrySyncCallbackHelper::create();
m_fileSystem->getFile(this, path, flags, helper->successCallback(), helper->errorCallback(), DOMFileSystemBase::Synchronous);
return static_cast<FileEntrySync*>(helper->getResult(exceptionState));
}
| 14,912 |
44,598 | 0 | void lxc_delete_tty(struct lxc_tty_info *tty_info)
{
int i;
for (i = 0; i < tty_info->nbtty; i++) {
struct lxc_pty_info *pty_info = &tty_info->pty_info[i];
close(pty_info->master);
close(pty_info->slave);
}
free(tty_info->pty_info);
tty_info->nbtty = 0;
}
| 14,913 |
176,112 | 0 | IMPEG2D_ERROR_CODES_T impeg2d_dec_pic_coding_ext(dec_state_t *ps_dec)
{
stream_t *ps_stream;
IMPEG2D_ERROR_CODES_T e_error = (IMPEG2D_ERROR_CODES_T) IV_SUCCESS;
ps_stream = &ps_dec->s_bit_stream;
impeg2d_bit_stream_flush(ps_stream,START_CODE_LEN);
/* extension code identifier */
impeg2d_bit_stream_get(ps_stream,4);
ps_dec->au2_f_code[0][0] = impeg2d_bit_stream_get(ps_stream,4);
ps_dec->au2_f_code[0][1] = impeg2d_bit_stream_get(ps_stream,4);
ps_dec->au2_f_code[1][0] = impeg2d_bit_stream_get(ps_stream,4);
ps_dec->au2_f_code[1][1] = impeg2d_bit_stream_get(ps_stream,4);
ps_dec->u2_intra_dc_precision = impeg2d_bit_stream_get(ps_stream,2);
ps_dec->u2_picture_structure = impeg2d_bit_stream_get(ps_stream,2);
if (ps_dec->u2_picture_structure < TOP_FIELD ||
ps_dec->u2_picture_structure > FRAME_PICTURE)
{
return IMPEG2D_FRM_HDR_DECODE_ERR;
}
ps_dec->u2_top_field_first = impeg2d_bit_stream_get_bit(ps_stream);
ps_dec->u2_frame_pred_frame_dct = impeg2d_bit_stream_get_bit(ps_stream);
ps_dec->u2_concealment_motion_vectors = impeg2d_bit_stream_get_bit(ps_stream);
ps_dec->u2_q_scale_type = impeg2d_bit_stream_get_bit(ps_stream);
ps_dec->u2_intra_vlc_format = impeg2d_bit_stream_get_bit(ps_stream);
ps_dec->u2_alternate_scan = impeg2d_bit_stream_get_bit(ps_stream);
ps_dec->u2_repeat_first_field = impeg2d_bit_stream_get_bit(ps_stream);
/* Flush chroma_420_type */
impeg2d_bit_stream_get_bit(ps_stream);
ps_dec->u2_progressive_frame = impeg2d_bit_stream_get_bit(ps_stream);
if (impeg2d_bit_stream_get_bit(ps_stream))
{
/* Flush v_axis, field_sequence, burst_amplitude, sub_carrier_phase */
impeg2d_bit_stream_flush(ps_stream,20);
}
impeg2d_next_start_code(ps_dec);
if(VERTICAL_SCAN == ps_dec->u2_alternate_scan)
{
ps_dec->pu1_inv_scan_matrix = (UWORD8 *)gau1_impeg2_inv_scan_vertical;
}
else
{
ps_dec->pu1_inv_scan_matrix = (UWORD8 *)gau1_impeg2_inv_scan_zig_zag;
}
return e_error;
}
| 14,914 |
90,042 | 0 | ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem)
{
ZSTD_STATIC_ASSERT(zcss_init==0);
ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN==(0ULL - 1));
if (!customMem.customAlloc ^ !customMem.customFree) return NULL;
{ ZSTD_CCtx* const cctx = (ZSTD_CCtx*)ZSTD_malloc(sizeof(ZSTD_CCtx), customMem);
if (!cctx) return NULL;
ZSTD_initCCtx(cctx, customMem);
return cctx;
}
}
| 14,915 |
30,019 | 0 | struct net_bridge_port_group *br_multicast_new_port_group(
struct net_bridge_port *port,
struct br_ip *group,
struct net_bridge_port_group __rcu *next,
unsigned char state)
{
struct net_bridge_port_group *p;
p = kzalloc(sizeof(*p), GFP_ATOMIC);
if (unlikely(!p))
return NULL;
p->addr = *group;
p->port = port;
p->state = state;
rcu_assign_pointer(p->next, next);
hlist_add_head(&p->mglist, &port->mglist);
setup_timer(&p->timer, br_multicast_port_group_expired,
(unsigned long)p);
return p;
}
| 14,916 |
185,544 | 1 | void SendRequest() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// This is our last chance to check whether the request has been canceled
// before sending it.
if (!service_)
return;
bool is_extended_reporting = false;
if (item_->GetBrowserContext()) {
Profile* profile =
Profile::FromBrowserContext(item_->GetBrowserContext());
is_extended_reporting = profile &&
profile->GetPrefs()->GetBoolean(
prefs::kSafeBrowsingExtendedReportingEnabled);
}
ClientDownloadRequest request;
if (is_extended_reporting) {
request.mutable_population()->set_user_population(
ChromeUserPopulation::EXTENDED_REPORTING);
} else {
request.mutable_population()->set_user_population(
ChromeUserPopulation::SAFE_BROWSING);
}
request.set_url(SanitizeUrl(item_->GetUrlChain().back()));
request.mutable_digests()->set_sha256(item_->GetHash());
request.set_length(item_->GetReceivedBytes());
for (size_t i = 0; i < item_->GetUrlChain().size(); ++i) {
ClientDownloadRequest::Resource* resource = request.add_resources();
resource->set_url(SanitizeUrl(item_->GetUrlChain()[i]));
if (i == item_->GetUrlChain().size() - 1) {
// The last URL in the chain is the download URL.
resource->set_type(ClientDownloadRequest::DOWNLOAD_URL);
resource->set_referrer(SanitizeUrl(item_->GetReferrerUrl()));
DVLOG(2) << "dl url " << resource->url();
if (!item_->GetRemoteAddress().empty()) {
resource->set_remote_ip(item_->GetRemoteAddress());
DVLOG(2) << " dl url remote addr: " << resource->remote_ip();
}
DVLOG(2) << "dl referrer " << resource->referrer();
} else {
DVLOG(2) << "dl redirect " << i << " " << resource->url();
resource->set_type(ClientDownloadRequest::DOWNLOAD_REDIRECT);
}
// TODO(noelutz): fill out the remote IP addresses.
}
// TODO(mattm): fill out the remote IP addresses for tab resources.
for (size_t i = 0; i < tab_redirects_.size(); ++i) {
ClientDownloadRequest::Resource* resource = request.add_resources();
DVLOG(2) << "tab redirect " << i << " " << tab_redirects_[i].spec();
resource->set_url(SanitizeUrl(tab_redirects_[i]));
resource->set_type(ClientDownloadRequest::TAB_REDIRECT);
}
if (tab_url_.is_valid()) {
ClientDownloadRequest::Resource* resource = request.add_resources();
resource->set_url(SanitizeUrl(tab_url_));
DVLOG(2) << "tab url " << resource->url();
resource->set_type(ClientDownloadRequest::TAB_URL);
if (tab_referrer_url_.is_valid()) {
resource->set_referrer(SanitizeUrl(tab_referrer_url_));
DVLOG(2) << "tab referrer " << resource->referrer();
}
}
request.set_user_initiated(item_->HasUserGesture());
request.set_file_basename(
item_->GetTargetFilePath().BaseName().AsUTF8Unsafe());
request.set_download_type(type_);
request.mutable_signature()->CopyFrom(signature_info_);
if (image_headers_)
request.set_allocated_image_headers(image_headers_.release());
if (zipped_executable_)
request.mutable_archived_binary()->Swap(&archived_binary_);
if (!request.SerializeToString(&client_download_request_data_)) {
FinishRequest(UNKNOWN, REASON_INVALID_REQUEST_PROTO);
return;
}
service_->client_download_request_callbacks_.Notify(item_, &request);
DVLOG(2) << "Sending a request for URL: "
<< item_->GetUrlChain().back();
fetcher_ = net::URLFetcher::Create(0 /* ID used for testing */,
GetDownloadRequestUrl(),
net::URLFetcher::POST, this);
fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
fetcher_->SetAutomaticallyRetryOn5xx(false); // Don't retry on error.
fetcher_->SetRequestContext(service_->request_context_getter_.get());
fetcher_->SetUploadData("application/octet-stream",
client_download_request_data_);
request_start_time_ = base::TimeTicks::Now();
UMA_HISTOGRAM_COUNTS("SBClientDownload.DownloadRequestPayloadSize",
client_download_request_data_.size());
fetcher_->Start();
}
| 14,917 |
175,263 | 0 | dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI) {
RIL_CDMA_SMS_Ack rcsa;
int32_t t;
status_t status;
int32_t digitCount;
RLOGD("dispatchCdmaSmsAck");
memset(&rcsa, 0, sizeof(rcsa));
status = p.readInt32(&t);
rcsa.uErrorClass = (RIL_CDMA_SMS_ErrorClass) t;
status = p.readInt32(&t);
rcsa.uSMSCauseCode = (int) t;
if (status != NO_ERROR) {
goto invalid;
}
startRequest;
appendPrintBuf("%suErrorClass=%d, uTLStatus=%d, ",
printBuf, rcsa.uErrorClass, rcsa.uSMSCauseCode);
closeRequest;
printRequest(pRI->token, pRI->pCI->requestNumber);
CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsa, sizeof(rcsa),pRI, pRI->socket_id);
#ifdef MEMSET_FREED
memset(&rcsa, 0, sizeof(rcsa));
#endif
return;
invalid:
invalidCommandBlock(pRI);
return;
}
| 14,918 |
13,015 | 0 | sshpkt_get_u64(struct ssh *ssh, u_int64_t *valp)
{
return sshbuf_get_u64(ssh->state->incoming_packet, valp);
}
| 14,919 |
140,382 | 0 | TypingCommand::TypingCommand(Document& document,
ETypingCommand commandType,
const String& textToInsert,
Options options,
TextGranularity granularity,
TextCompositionType compositionType)
: CompositeEditCommand(document),
m_commandType(commandType),
m_textToInsert(textToInsert),
m_openForMoreTyping(true),
m_selectInsertedText(options & SelectInsertedText),
m_smartDelete(options & SmartDelete),
m_granularity(granularity),
m_compositionType(compositionType),
m_killRing(options & KillRing),
m_openedByBackwardDelete(false),
m_shouldRetainAutocorrectionIndicator(options &
RetainAutocorrectionIndicator),
m_shouldPreventSpellChecking(options & PreventSpellChecking) {
updatePreservesTypingStyle(m_commandType);
}
| 14,920 |
56,961 | 0 | static void fuse_register_polled_file(struct fuse_conn *fc,
struct fuse_file *ff)
{
spin_lock(&fc->lock);
if (RB_EMPTY_NODE(&ff->polled_node)) {
struct rb_node **link, *uninitialized_var(parent);
link = fuse_find_polled_node(fc, ff->kh, &parent);
BUG_ON(*link);
rb_link_node(&ff->polled_node, parent, link);
rb_insert_color(&ff->polled_node, &fc->polled_files);
}
spin_unlock(&fc->lock);
}
| 14,921 |
126,604 | 0 | virtual ~InsertTabAnimation() {}
| 14,922 |
133,404 | 0 | bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
return false;
}
| 14,923 |
14,934 | 0 | DetachUnboundGPU(ScreenPtr slave)
{
assert(slave->isGPU);
xorg_list_del(&slave->unattached_head);
slave->current_master = NULL;
}
| 14,924 |
56,531 | 0 | static int __ext4_block_zero_page_range(handle_t *handle,
struct address_space *mapping, loff_t from, loff_t length)
{
ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT;
unsigned offset = from & (PAGE_CACHE_SIZE-1);
unsigned blocksize, pos;
ext4_lblk_t iblock;
struct inode *inode = mapping->host;
struct buffer_head *bh;
struct page *page;
int err = 0;
page = find_or_create_page(mapping, from >> PAGE_CACHE_SHIFT,
mapping_gfp_constraint(mapping, ~__GFP_FS));
if (!page)
return -ENOMEM;
blocksize = inode->i_sb->s_blocksize;
iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
if (!page_has_buffers(page))
create_empty_buffers(page, blocksize, 0);
/* Find the buffer that contains "offset" */
bh = page_buffers(page);
pos = blocksize;
while (offset >= pos) {
bh = bh->b_this_page;
iblock++;
pos += blocksize;
}
if (buffer_freed(bh)) {
BUFFER_TRACE(bh, "freed: skip");
goto unlock;
}
if (!buffer_mapped(bh)) {
BUFFER_TRACE(bh, "unmapped");
ext4_get_block(inode, iblock, bh, 0);
/* unmapped? It's a hole - nothing to do */
if (!buffer_mapped(bh)) {
BUFFER_TRACE(bh, "still unmapped");
goto unlock;
}
}
/* Ok, it's mapped. Make sure it's up-to-date */
if (PageUptodate(page))
set_buffer_uptodate(bh);
if (!buffer_uptodate(bh)) {
err = -EIO;
ll_rw_block(READ, 1, &bh);
wait_on_buffer(bh);
/* Uhhuh. Read error. Complain and punt. */
if (!buffer_uptodate(bh))
goto unlock;
if (S_ISREG(inode->i_mode) &&
ext4_encrypted_inode(inode)) {
/* We expect the key to be set. */
BUG_ON(!ext4_has_encryption_key(inode));
BUG_ON(blocksize != PAGE_CACHE_SIZE);
WARN_ON_ONCE(ext4_decrypt(page));
}
}
if (ext4_should_journal_data(inode)) {
BUFFER_TRACE(bh, "get write access");
err = ext4_journal_get_write_access(handle, bh);
if (err)
goto unlock;
}
zero_user(page, offset, length);
BUFFER_TRACE(bh, "zeroed end of block");
if (ext4_should_journal_data(inode)) {
err = ext4_handle_dirty_metadata(handle, inode, bh);
} else {
err = 0;
mark_buffer_dirty(bh);
if (ext4_test_inode_state(inode, EXT4_STATE_ORDERED_MODE))
err = ext4_jbd2_file_inode(handle, inode);
}
unlock:
unlock_page(page);
page_cache_release(page);
return err;
}
| 14,925 |
118,309 | 0 | void AutofillDialogViews::ShowErrorBubbleForViewIfNecessary(views::View* view) {
if (!view->GetWidget())
return;
if (!delegate_->ShouldShowErrorBubble()) {
DCHECK(!error_bubble_);
return;
}
if (view->GetClassName() == DecoratedTextfield::kViewClassName &&
!static_cast<DecoratedTextfield*>(view)->invalid()) {
return;
}
views::View* input_view = GetAncestralInputView(view);
std::map<views::View*, base::string16>::iterator error_message =
validity_map_.find(input_view);
if (error_message != validity_map_.end()) {
input_view->ScrollRectToVisible(input_view->GetLocalBounds());
if (!error_bubble_ || error_bubble_->anchor() != view) {
HideErrorBubble();
error_bubble_ = new InfoBubble(view, error_message->second);
error_bubble_->set_align_to_anchor_edge(true);
error_bubble_->set_preferred_width(
(kSectionContainerWidth - views::kRelatedControlVerticalSpacing) / 2);
bool show_above = view->GetClassName() == views::Combobox::kViewClassName;
error_bubble_->set_show_above_anchor(show_above);
error_bubble_->Show();
observer_.Add(error_bubble_->GetWidget());
}
}
}
| 14,926 |
32,909 | 0 | static void __exit exit_ext3_fs(void)
{
unregister_filesystem(&ext3_fs_type);
destroy_inodecache();
exit_ext3_xattr();
}
| 14,927 |
116,356 | 0 | explicit DeleteCacheCompletionCallback(MockHttpCache* cache)
: cache_(cache),
ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
base::Bind(&DeleteCacheCompletionCallback::OnComplete,
base::Unretained(this)))) {
}
| 14,928 |
69,050 | 0 | static MagickBooleanType ReadPSDChannelZip(Image *image,const size_t channels,
const ssize_t type,const PSDCompressionType compression,
const size_t compact_size,ExceptionInfo *exception)
{
MagickBooleanType
status;
register unsigned char
*p;
size_t
count,
length,
packet_size,
row_size;
ssize_t
y;
unsigned char
*compact_pixels,
*pixels;
z_stream
stream;
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" layer data is ZIP compressed");
compact_pixels=(unsigned char *) AcquireQuantumMemory(compact_size,
sizeof(*compact_pixels));
if (compact_pixels == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
packet_size=GetPSDPacketSize(image);
row_size=image->columns*packet_size;
count=image->rows*row_size;
pixels=(unsigned char *) AcquireQuantumMemory(count,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
{
compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
}
ResetMagickMemory(&stream,0,sizeof(stream));
stream.data_type=Z_BINARY;
(void) ReadBlob(image,compact_size,compact_pixels);
stream.next_in=(Bytef *)compact_pixels;
stream.avail_in=(uInt) compact_size;
stream.next_out=(Bytef *)pixels;
stream.avail_out=(uInt) count;
if (inflateInit(&stream) == Z_OK)
{
int
ret;
while (stream.avail_out > 0)
{
ret=inflate(&stream,Z_SYNC_FLUSH);
if ((ret != Z_OK) && (ret != Z_STREAM_END))
{
compact_pixels=(unsigned char *) RelinquishMagickMemory(
compact_pixels);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
return(MagickFalse);
}
}
}
if (compression == ZipWithPrediction)
{
p=pixels;
while (count > 0)
{
length=image->columns;
while (--length)
{
if (packet_size == 2)
{
p[2]+=p[0]+((p[1]+p[3]) >> 8);
p[3]+=p[1];
}
else
*(p+1)+=*p;
p+=packet_size;
}
p+=packet_size;
count-=row_size;
}
}
status=MagickTrue;
p=pixels;
for (y=0; y < (ssize_t) image->rows; y++)
{
status=ReadPSDChannelPixels(image,channels,y,type,p,exception);
if (status == MagickFalse)
break;
p+=row_size;
}
compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
return(status);
}
| 14,929 |
12,218 | 0 | static void stroke_memusage(private_stroke_socket_t *this,
stroke_msg_t *msg, FILE *out)
{
if (lib->leak_detective)
{
lib->leak_detective->usage(lib->leak_detective,
(leak_detective_report_cb_t)report_usage,
(leak_detective_summary_cb_t)sum_usage, out);
}
}
| 14,930 |
165,935 | 0 | void RenderFrameImpl::SendFailedProvisionalLoad(
const blink::WebURLRequest& request,
const WebURLError& error,
blink::WebLocalFrame* frame) {
bool show_repost_interstitial =
(error.reason() == net::ERR_CACHE_MISS &&
base::EqualsASCII(request.HttpMethod().Utf16(), "POST"));
FrameHostMsg_DidFailProvisionalLoadWithError_Params params;
params.error_code = error.reason();
GetContentClient()->renderer()->GetErrorDescription(
request, error, ¶ms.error_description);
params.url = error.url(),
params.showing_repost_interstitial = show_repost_interstitial;
Send(new FrameHostMsg_DidFailProvisionalLoadWithError(routing_id_, params));
}
| 14,931 |
115,887 | 0 | Eina_Bool ewk_frame_back(Evas_Object* ewkFrame)
{
return ewk_frame_navigate(ewkFrame, -1);
}
| 14,932 |
111,892 | 0 | void ProfileSyncService::InitSettings() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kSyncServiceURL)) {
std::string value(command_line.GetSwitchValueASCII(
switches::kSyncServiceURL));
if (!value.empty()) {
GURL custom_sync_url(value);
if (custom_sync_url.is_valid()) {
sync_service_url_ = custom_sync_url;
} else {
LOG(WARNING) << "The following sync URL specified at the command-line "
<< "is invalid: " << value;
}
}
}
}
| 14,933 |
98,713 | 0 | void WebPluginDelegatePepper::DidFinishManualLoading() {
instance()->DidFinishManualLoading();
}
| 14,934 |
186,599 | 1 | bool WebMediaPlayerMS::HasSingleSecurityOrigin() const {
DCHECK(thread_checker_.CalledOnValidThread());
return true;
}
| 14,935 |
20,935 | 0 | cdf_read_header(const cdf_info_t *info, cdf_header_t *h)
{
char buf[512];
(void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
if (cdf_read(info, (off_t)0, buf, sizeof(buf)) == -1)
return -1;
cdf_unpack_header(h, buf);
cdf_swap_header(h);
if (h->h_magic != CDF_MAGIC) {
DPRINTF(("Bad magic 0x%" INT64_T_FORMAT "x != 0x%"
INT64_T_FORMAT "x\n",
(unsigned long long)h->h_magic,
(unsigned long long)CDF_MAGIC));
goto out;
}
if (h->h_sec_size_p2 > 20) {
DPRINTF(("Bad sector size 0x%u\n", h->h_sec_size_p2));
goto out;
}
if (h->h_short_sec_size_p2 > 20) {
DPRINTF(("Bad short sector size 0x%u\n",
h->h_short_sec_size_p2));
goto out;
}
return 0;
out:
errno = EFTYPE;
return -1;
}
| 14,936 |
183,876 | 1 | bool ResourceTracker::UnrefResource(PP_Resource res) {
DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE))
<< res << " is not a PP_Resource.";
ResourceMap::iterator i = live_resources_.find(res);
if (i != live_resources_.end()) {
if (!--i->second.second) {
Resource* to_release = i->second.first;
// LastPluginRefWasDeleted will clear the instance pointer, so save it
// first.
PP_Instance instance = to_release->instance()->pp_instance();
to_release->LastPluginRefWasDeleted(false);
instance_map_[instance]->resources.erase(res);
live_resources_.erase(i);
}
return true;
} else {
return false;
}
}
| 14,937 |
38,294 | 0 | int anon_vma_prepare(struct vm_area_struct *vma)
{
struct anon_vma *anon_vma = vma->anon_vma;
struct anon_vma_chain *avc;
might_sleep();
if (unlikely(!anon_vma)) {
struct mm_struct *mm = vma->vm_mm;
struct anon_vma *allocated;
avc = anon_vma_chain_alloc(GFP_KERNEL);
if (!avc)
goto out_enomem;
anon_vma = find_mergeable_anon_vma(vma);
allocated = NULL;
if (!anon_vma) {
anon_vma = anon_vma_alloc();
if (unlikely(!anon_vma))
goto out_enomem_free_avc;
allocated = anon_vma;
}
anon_vma_lock_write(anon_vma);
/* page_table_lock to protect against threads */
spin_lock(&mm->page_table_lock);
if (likely(!vma->anon_vma)) {
vma->anon_vma = anon_vma;
anon_vma_chain_link(vma, avc, anon_vma);
allocated = NULL;
avc = NULL;
}
spin_unlock(&mm->page_table_lock);
anon_vma_unlock_write(anon_vma);
if (unlikely(allocated))
put_anon_vma(allocated);
if (unlikely(avc))
anon_vma_chain_free(avc);
}
return 0;
out_enomem_free_avc:
anon_vma_chain_free(avc);
out_enomem:
return -ENOMEM;
}
| 14,938 |
159,985 | 0 | void DiskCacheBackendTest::BackendSetSize() {
const int cache_size = 0x10000; // 64 kB
SetMaxSize(cache_size);
InitCache();
std::string first("some key");
std::string second("something else");
disk_cache::Entry* entry;
ASSERT_THAT(CreateEntry(first, &entry), IsOk());
scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(cache_size));
memset(buffer->data(), 0, cache_size);
EXPECT_EQ(cache_size / 10,
WriteData(entry, 0, 0, buffer.get(), cache_size / 10, false))
<< "normal file";
EXPECT_EQ(net::ERR_FAILED,
WriteData(entry, 1, 0, buffer.get(), cache_size / 5, false))
<< "file size above the limit";
SetMaxSize(cache_size * 2);
EXPECT_EQ(cache_size / 5,
WriteData(entry, 1, 0, buffer.get(), cache_size / 5, false));
SetMaxSize(cache_size * 10);
EXPECT_EQ(cache_size * 3 / 4,
WriteData(entry, 0, 0, buffer.get(), cache_size * 3 / 4, false));
entry->Close();
FlushQueueForTest();
SetMaxSize(cache_size);
ASSERT_THAT(CreateEntry(second, &entry), IsOk());
EXPECT_EQ(cache_size / 10,
WriteData(entry, 0, 0, buffer.get(), cache_size / 10, false));
disk_cache::Entry* entry2;
ASSERT_THAT(CreateEntry("an extra key", &entry2), IsOk());
EXPECT_EQ(cache_size / 10,
WriteData(entry2, 0, 0, buffer.get(), cache_size / 10, false));
entry2->Close(); // This will trigger the cache trim.
EXPECT_NE(net::OK, OpenEntry(first, &entry2));
FlushQueueForTest(); // Make sure that we are done trimming the cache.
FlushQueueForTest(); // We may have posted two tasks to evict stuff.
entry->Close();
ASSERT_THAT(OpenEntry(second, &entry), IsOk());
EXPECT_EQ(cache_size / 10, entry->GetDataSize(0));
entry->Close();
}
| 14,939 |
92,924 | 0 | cliprdr_send_simple_native_format_announce(uint32 format)
{
uint8 buffer[36];
logger(Clipboard, Debug, "cliprdr_send_simple_native_format_announce() format 0x%x",
format);
buf_out_uint32(buffer, format);
memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */
cliprdr_send_native_format_announce(buffer, sizeof(buffer));
}
| 14,940 |
78,936 | 0 | SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
ExprDef *arrayNdx, ExprDef *value)
{
xkb_mod_index_t ndx;
if (istreq(field, "action")) {
if (arrayNdx)
return ReportSINotArray(info, si, field);
if (!HandleActionDef(info->ctx, info->actions, &info->mods,
value, &si->interp.action))
return false;
si->defined |= SI_FIELD_ACTION;
}
else if (istreq(field, "virtualmodifier") ||
istreq(field, "virtualmod")) {
if (arrayNdx)
return ReportSINotArray(info, si, field);
if (!ExprResolveMod(info->ctx, value, MOD_VIRT, &info->mods, &ndx))
return ReportSIBadType(info, si, field, "virtual modifier");
si->interp.virtual_mod = ndx;
si->defined |= SI_FIELD_VIRTUAL_MOD;
}
else if (istreq(field, "repeat")) {
bool set;
if (arrayNdx)
return ReportSINotArray(info, si, field);
if (!ExprResolveBoolean(info->ctx, value, &set))
return ReportSIBadType(info, si, field, "boolean");
si->interp.repeat = set;
si->defined |= SI_FIELD_AUTO_REPEAT;
}
else if (istreq(field, "locking")) {
log_dbg(info->ctx,
"The \"locking\" field in symbol interpretation is unsupported; "
"Ignored\n");
}
else if (istreq(field, "usemodmap") ||
istreq(field, "usemodmapmods")) {
unsigned int val;
if (arrayNdx)
return ReportSINotArray(info, si, field);
if (!ExprResolveEnum(info->ctx, value, &val, useModMapValueNames))
return ReportSIBadType(info, si, field, "level specification");
si->interp.level_one_only = val;
si->defined |= SI_FIELD_LEVEL_ONE_ONLY;
}
else {
return ReportBadField(info->ctx, "symbol interpretation", field,
siText(si, info));
}
return true;
}
| 14,941 |
23,471 | 0 | static void nfs4_xdr_enc_link(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_link_arg *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_savefh(xdr, &hdr);
encode_putfh(xdr, args->dir_fh, &hdr);
encode_link(xdr, args->name, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_restorefh(xdr, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
}
| 14,942 |
160,567 | 0 | RenderFrameImpl::CreateServiceWorkerProvider() {
DCHECK(frame_->GetDocumentLoader());
if (!ChildThreadImpl::current())
return nullptr; // May be null in some tests.
ServiceWorkerNetworkProvider* provider =
ServiceWorkerNetworkProvider::FromWebServiceWorkerNetworkProvider(
frame_->GetDocumentLoader()->GetServiceWorkerNetworkProvider());
if (!provider->context()) {
return nullptr;
}
return std::make_unique<WebServiceWorkerProviderImpl>(
ChildThreadImpl::current()->thread_safe_sender(), provider->context());
}
| 14,943 |
116,285 | 0 | void QQuickWebViewPrivate::FlickableAxisLocker::reset()
{
m_allowedDirection = QQuickFlickable::AutoFlickDirection;
m_sampleCount = 0;
}
| 14,944 |
71,816 | 0 | static void ipa_bmp_read(wmfAPI * API, wmfBMP_Read_t * bmp_read) {
wmf_magick_t
*ddata = WMF_MAGICK_GetData(API);
ExceptionInfo
*exception;
Image
*image;
ImageInfo
*image_info;
bmp_read->bmp.data = 0;
exception=AcquireExceptionInfo();
image_info=CloneImageInfo((ImageInfo *) 0);
(void) CopyMagickString(image_info->magick,"DIB",MaxTextExtent);
if (bmp_read->width || bmp_read->height)
{
char
size[MaxTextExtent];
(void) FormatLocaleString(size,MaxTextExtent,"%ux%u",bmp_read->width,
bmp_read->height);
CloneString(&image_info->size,size);
}
#if 0
printf("ipa_bmp_read: buffer=0x%lx length=%ld, width=%i, height=%i\n",
(long) bmp_read->buffer, bmp_read->length,
bmp_read->width, bmp_read->height);
#endif
image=BlobToImage(image_info, (const void *) bmp_read->buffer,
bmp_read->length, exception);
image_info=DestroyImageInfo(image_info);
if (image == (Image *) NULL)
{
char
description[MaxTextExtent];
(void) FormatLocaleString(description,MaxTextExtent,
"packed DIB at offset %ld",bmp_read->offset);
(void) ThrowMagickException(&ddata->image->exception,GetMagickModule(),
CorruptImageError,exception->reason,"`%s'",exception->description);
}
else
{
#if 0
printf("ipa_bmp_read: rows=%ld,columns=%ld\n\n", image->rows, image->columns);
#endif
bmp_read->bmp.data = (void*)image;
bmp_read->bmp.width = (U16)image->columns;
bmp_read->bmp.height = (U16)image->rows;
}
(void) DestroyExceptionInfo(exception);
}
| 14,945 |
81,218 | 0 | void __init softirq_init(void)
{
int cpu;
for_each_possible_cpu(cpu) {
per_cpu(tasklet_vec, cpu).tail =
&per_cpu(tasklet_vec, cpu).head;
per_cpu(tasklet_hi_vec, cpu).tail =
&per_cpu(tasklet_hi_vec, cpu).head;
}
open_softirq(TASKLET_SOFTIRQ, tasklet_action);
open_softirq(HI_SOFTIRQ, tasklet_hi_action);
}
| 14,946 |
127,805 | 0 | MediaStreamType PepperMediaDeviceManager::FromPepperDeviceType(
PP_DeviceType_Dev type) {
switch (type) {
case PP_DEVICETYPE_DEV_INVALID:
return MEDIA_NO_SERVICE;
case PP_DEVICETYPE_DEV_AUDIOCAPTURE:
return MEDIA_DEVICE_AUDIO_CAPTURE;
case PP_DEVICETYPE_DEV_VIDEOCAPTURE:
return MEDIA_DEVICE_VIDEO_CAPTURE;
default:
NOTREACHED();
return MEDIA_NO_SERVICE;
}
}
| 14,947 |
119,852 | 0 | void WebContentsImpl::OnDidDownloadImage(
int id,
int http_status_code,
const GURL& image_url,
int requested_size,
const std::vector<SkBitmap>& bitmaps) {
ImageDownloadMap::iterator iter = image_download_map_.find(id);
if (iter == image_download_map_.end()) {
return;
}
if (!iter->second.is_null()) {
iter->second.Run(id, http_status_code, image_url, requested_size, bitmaps);
}
image_download_map_.erase(id);
}
| 14,948 |
83,144 | 0 | mrb_io_flags_to_modenum(mrb_state *mrb, int flags)
{
int modenum = 0;
switch(flags & (FMODE_READABLE|FMODE_WRITABLE|FMODE_READWRITE)) {
case FMODE_READABLE:
modenum = O_RDONLY;
break;
case FMODE_WRITABLE:
modenum = O_WRONLY;
break;
case FMODE_READWRITE:
modenum = O_RDWR;
break;
}
if (flags & FMODE_APPEND) {
modenum |= O_APPEND;
}
if (flags & FMODE_TRUNC) {
modenum |= O_TRUNC;
}
if (flags & FMODE_CREATE) {
modenum |= O_CREAT;
}
#ifdef O_BINARY
if (flags & FMODE_BINMODE) {
modenum |= O_BINARY;
}
#endif
return modenum;
}
| 14,949 |
86,883 | 0 | TEE_Result syscall_obj_generate_key(unsigned long obj, unsigned long key_size,
const struct utee_attribute *usr_params,
unsigned long param_count)
{
TEE_Result res;
struct tee_ta_session *sess;
const struct tee_cryp_obj_type_props *type_props;
struct tee_obj *o;
struct tee_cryp_obj_secret *key;
size_t byte_size;
TEE_Attribute *params = NULL;
res = tee_ta_get_current_session(&sess);
if (res != TEE_SUCCESS)
return res;
res = tee_obj_get(to_user_ta_ctx(sess->ctx),
tee_svc_uref_to_vaddr(obj), &o);
if (res != TEE_SUCCESS)
return res;
/* Must be a transient object */
if ((o->info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0)
return TEE_ERROR_BAD_STATE;
/* Must not be initialized already */
if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0)
return TEE_ERROR_BAD_STATE;
/* Find description of object */
type_props = tee_svc_find_type_props(o->info.objectType);
if (!type_props)
return TEE_ERROR_NOT_SUPPORTED;
/* Check that maxKeySize follows restrictions */
if (key_size % type_props->quanta != 0)
return TEE_ERROR_NOT_SUPPORTED;
if (key_size < type_props->min_size)
return TEE_ERROR_NOT_SUPPORTED;
if (key_size > type_props->max_size)
return TEE_ERROR_NOT_SUPPORTED;
size_t alloc_size = 0;
if (MUL_OVERFLOW(sizeof(TEE_Attribute), param_count, &alloc_size))
return TEE_ERROR_OVERFLOW;
params = malloc(alloc_size);
if (!params)
return TEE_ERROR_OUT_OF_MEMORY;
res = copy_in_attrs(to_user_ta_ctx(sess->ctx), usr_params, param_count,
params);
if (res != TEE_SUCCESS)
goto out;
res = tee_svc_cryp_check_attr(ATTR_USAGE_GENERATE_KEY, type_props,
params, param_count);
if (res != TEE_SUCCESS)
goto out;
switch (o->info.objectType) {
case TEE_TYPE_AES:
case TEE_TYPE_DES:
case TEE_TYPE_DES3:
case TEE_TYPE_HMAC_MD5:
case TEE_TYPE_HMAC_SHA1:
case TEE_TYPE_HMAC_SHA224:
case TEE_TYPE_HMAC_SHA256:
case TEE_TYPE_HMAC_SHA384:
case TEE_TYPE_HMAC_SHA512:
case TEE_TYPE_GENERIC_SECRET:
byte_size = key_size / 8;
/*
* We have to do it like this because the parity bits aren't
* counted when telling the size of the key in bits.
*/
if (o->info.objectType == TEE_TYPE_DES ||
o->info.objectType == TEE_TYPE_DES3) {
byte_size = (key_size + key_size / 7) / 8;
}
key = (struct tee_cryp_obj_secret *)o->attr;
if (byte_size > key->alloc_size) {
res = TEE_ERROR_EXCESS_DATA;
goto out;
}
res = crypto_rng_read((void *)(key + 1), byte_size);
if (res != TEE_SUCCESS)
goto out;
key->key_size = byte_size;
/* Set bits for all known attributes for this object type */
o->have_attrs = (1 << type_props->num_type_attrs) - 1;
break;
case TEE_TYPE_RSA_KEYPAIR:
res = tee_svc_obj_generate_key_rsa(o, type_props, key_size,
params, param_count);
if (res != TEE_SUCCESS)
goto out;
break;
case TEE_TYPE_DSA_KEYPAIR:
res = tee_svc_obj_generate_key_dsa(o, type_props, key_size);
if (res != TEE_SUCCESS)
goto out;
break;
case TEE_TYPE_DH_KEYPAIR:
res = tee_svc_obj_generate_key_dh(o, type_props, key_size,
params, param_count);
if (res != TEE_SUCCESS)
goto out;
break;
case TEE_TYPE_ECDSA_KEYPAIR:
case TEE_TYPE_ECDH_KEYPAIR:
res = tee_svc_obj_generate_key_ecc(o, type_props, key_size,
params, param_count);
if (res != TEE_SUCCESS)
goto out;
break;
default:
res = TEE_ERROR_BAD_FORMAT;
}
out:
free(params);
if (res == TEE_SUCCESS) {
o->info.keySize = key_size;
o->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED;
}
return res;
}
| 14,950 |
164,648 | 0 | void IndexedDBDatabase::RegisterAndScheduleTransaction(
IndexedDBTransaction* transaction) {
IDB_TRACE1("IndexedDBDatabase::RegisterAndScheduleTransaction", "txn.id",
transaction->id());
std::vector<ScopesLockManager::ScopeLockRequest> lock_requests;
lock_requests.reserve(1 + transaction->scope().size());
lock_requests.emplace_back(
kDatabaseRangeLockLevel, GetDatabaseLockRange(id()),
transaction->mode() == blink::mojom::IDBTransactionMode::VersionChange
? ScopesLockManager::LockType::kExclusive
: ScopesLockManager::LockType::kShared);
ScopesLockManager::LockType lock_type =
transaction->mode() == blink::mojom::IDBTransactionMode::ReadOnly
? ScopesLockManager::LockType::kShared
: ScopesLockManager::LockType::kExclusive;
for (int64_t object_store : transaction->scope()) {
lock_requests.emplace_back(kObjectStoreRangeLockLevel,
GetObjectStoreLockRange(id(), object_store),
lock_type);
}
lock_manager_->AcquireLocks(
std::move(lock_requests),
base::BindOnce(&IndexedDBTransaction::Start, transaction->AsWeakPtr()));
}
| 14,951 |
30,642 | 0 | static int irda_discover_daddr_and_lsap_sel(struct irda_sock *self, char *name)
{
discinfo_t *discoveries; /* Copy of the discovery log */
int number; /* Number of nodes in the log */
int i;
int err = -ENETUNREACH;
__u32 daddr = DEV_ADDR_ANY; /* Address we found the service on */
__u8 dtsap_sel = 0x0; /* TSAP associated with it */
IRDA_DEBUG(2, "%s(), name=%s\n", __func__, name);
/* Ask lmp for the current discovery log
* Note : we have to use irlmp_get_discoveries(), as opposed
* to play with the cachelog directly, because while we are
* making our ias query, le log might change... */
discoveries = irlmp_get_discoveries(&number, self->mask.word,
self->nslots);
/* Check if the we got some results */
if (discoveries == NULL)
return -ENETUNREACH; /* No nodes discovered */
/*
* Now, check all discovered devices (if any), and connect
* client only about the services that the client is
* interested in...
*/
for(i = 0; i < number; i++) {
/* Try the address in the log */
self->daddr = discoveries[i].daddr;
self->saddr = 0x0;
IRDA_DEBUG(1, "%s(), trying daddr = %08x\n",
__func__, self->daddr);
/* Query remote LM-IAS for this service */
err = irda_find_lsap_sel(self, name);
switch (err) {
case 0:
/* We found the requested service */
if(daddr != DEV_ADDR_ANY) {
IRDA_DEBUG(1, "%s(), discovered service ''%s'' in two different devices !!!\n",
__func__, name);
self->daddr = DEV_ADDR_ANY;
kfree(discoveries);
return -ENOTUNIQ;
}
/* First time we found that one, save it ! */
daddr = self->daddr;
dtsap_sel = self->dtsap_sel;
break;
case -EADDRNOTAVAIL:
/* Requested service simply doesn't exist on this node */
break;
default:
/* Something bad did happen :-( */
IRDA_DEBUG(0, "%s(), unexpected IAS query failure\n", __func__);
self->daddr = DEV_ADDR_ANY;
kfree(discoveries);
return -EHOSTUNREACH;
break;
}
}
/* Cleanup our copy of the discovery log */
kfree(discoveries);
/* Check out what we found */
if(daddr == DEV_ADDR_ANY) {
IRDA_DEBUG(1, "%s(), cannot discover service ''%s'' in any device !!!\n",
__func__, name);
self->daddr = DEV_ADDR_ANY;
return -EADDRNOTAVAIL;
}
/* Revert back to discovered device & service */
self->daddr = daddr;
self->saddr = 0x0;
self->dtsap_sel = dtsap_sel;
IRDA_DEBUG(1, "%s(), discovered requested service ''%s'' at address %08x\n",
__func__, name, self->daddr);
return 0;
}
| 14,952 |
825 | 0 | void SplashOutputDev::clipToStrokePath(GfxState *state) {
SplashPath *path, *path2;
path = convertPath(state, state->getPath());
path2 = splash->makeStrokePath(path);
delete path;
splash->clipToPath(path2, gFalse);
delete path2;
}
| 14,953 |
94,345 | 0 | static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
{
struct fs_struct *fs = current->fs;
if (clone_flags & CLONE_FS) {
/* tsk->fs is already what we want */
write_lock(&fs->lock);
if (fs->in_exec) {
write_unlock(&fs->lock);
return -EAGAIN;
}
fs->users++;
write_unlock(&fs->lock);
return 0;
}
tsk->fs = copy_fs_struct(fs);
if (!tsk->fs)
return -ENOMEM;
return 0;
}
| 14,954 |
128,763 | 0 | ScriptPromise ReadableStreamReader::cancel(ScriptState* scriptState)
{
return cancel(scriptState, ScriptValue(scriptState, v8::Undefined(scriptState->isolate())));
}
| 14,955 |
173,314 | 0 | reread_4(struct file *file)
/* The same but for a four byte quantity */
{
png_uint_32 result = 0;
int i = 0;
while (++i <= 4)
result = (result << 8) + reread_byte(file);
return result;
}
| 14,956 |
133,239 | 0 | void TaskQueueManager::RemoveTaskObserver(
base::MessageLoop::TaskObserver* task_observer) {
DCHECK(main_thread_checker_.CalledOnValidThread());
main_task_runner_->RemoveTaskObserver(task_observer);
task_observers_.RemoveObserver(task_observer);
}
| 14,957 |
167,191 | 0 | void HTMLMediaElement::setPlaybackRate(double rate,
ExceptionState& exception_state) {
BLINK_MEDIA_LOG << "setPlaybackRate(" << (void*)this << ", " << rate << ")";
if (rate != 0.0 && (rate < kMinRate || rate > kMaxRate)) {
UseCounter::Count(GetDocument(),
WebFeature::kHTMLMediaElementMediaPlaybackRateOutOfRange);
exception_state.ThrowDOMException(
kNotSupportedError, "The provided playback rate (" +
String::Number(rate) + ") is not in the " +
"supported playback range.");
return;
}
if (playback_rate_ != rate) {
playback_rate_ = rate;
ScheduleEvent(EventTypeNames::ratechange);
}
UpdatePlaybackRate();
}
| 14,958 |
69,498 | 0 | static int __init init_dns_resolver(void)
{
struct cred *cred;
struct key *keyring;
int ret;
/* create an override credential set with a special thread keyring in
* which DNS requests are cached
*
* this is used to prevent malicious redirections from being installed
* with add_key().
*/
cred = prepare_kernel_cred(NULL);
if (!cred)
return -ENOMEM;
keyring = keyring_alloc(".dns_resolver",
GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred,
(KEY_POS_ALL & ~KEY_POS_SETATTR) |
KEY_USR_VIEW | KEY_USR_READ,
KEY_ALLOC_NOT_IN_QUOTA, NULL);
if (IS_ERR(keyring)) {
ret = PTR_ERR(keyring);
goto failed_put_cred;
}
ret = register_key_type(&key_type_dns_resolver);
if (ret < 0)
goto failed_put_key;
/* instruct request_key() to use this special keyring as a cache for
* the results it looks up */
set_bit(KEY_FLAG_ROOT_CAN_CLEAR, &keyring->flags);
cred->thread_keyring = keyring;
cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
dns_resolver_cache = cred;
kdebug("DNS resolver keyring: %d\n", key_serial(keyring));
return 0;
failed_put_key:
key_put(keyring);
failed_put_cred:
put_cred(cred);
return ret;
}
| 14,959 |
130,122 | 0 | HTMLBodyElement::HTMLBodyElement(Document& document)
: HTMLElement(bodyTag, document)
{
ScriptWrappable::init(this);
}
| 14,960 |
98,975 | 0 | void WebGraphicsContext3DDefaultImpl::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset,
long x, long y, unsigned long width, unsigned long height)
{
makeContextCurrent();
bool needsResolve = (m_attributes.antialias && m_boundFBO == m_multisampleFBO);
if (needsResolve) {
resolveMultisampledFramebuffer(x, y, width, height);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
}
glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
if (needsResolve)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO);
}
| 14,961 |
59,314 | 0 | static int __walk_page_range(unsigned long start, unsigned long end,
struct mm_walk *walk)
{
int err = 0;
struct vm_area_struct *vma = walk->vma;
if (vma && is_vm_hugetlb_page(vma)) {
if (walk->hugetlb_entry)
err = walk_hugetlb_range(start, end, walk);
} else
err = walk_pgd_range(start, end, walk);
return err;
}
| 14,962 |
12,650 | 0 | eval_op_or(uschar **sptr, BOOL decimal, uschar **error)
{
uschar *s = *sptr;
int_eximarith_t x = eval_op_xor(&s, decimal, error);
if (*error == NULL)
{
while (*s == '|')
{
int_eximarith_t y;
s++;
y = eval_op_xor(&s, decimal, error);
if (*error != NULL) break;
x |= y;
}
}
*sptr = s;
return x;
}
| 14,963 |
115,423 | 0 | static void dumpDescendantFramesText(WKBundleFrameRef frame, StringBuilder& stringBuilder)
{
WKRetainPtr<WKArrayRef> childFrames(AdoptWK, WKBundleFrameCopyChildFrames(frame));
size_t size = WKArrayGetSize(childFrames.get());
for (size_t i = 0; i < size; ++i) {
WKBundleFrameRef subframe = static_cast<WKBundleFrameRef>(WKArrayGetItemAtIndex(childFrames.get(), i));
WKRetainPtr<WKStringRef> subframeName(AdoptWK, WKBundleFrameCopyName(subframe));
stringBuilder.appendLiteral("\n--------\nFrame: '");
stringBuilder.append(toWTFString(subframeName));
stringBuilder.appendLiteral("'\n--------\n");
dumpFrameText(subframe, stringBuilder);
dumpDescendantFramesText(subframe, stringBuilder);
}
}
| 14,964 |
188,576 | 1 | void RunMemCheck() {
ACMRandom rnd(ACMRandom::DeterministicSeed());
const int count_test_block = 5000;
DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs);
DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs);
DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs);
DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs);
for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < kNumCoeffs; ++j) {
input_block[j] = rnd.Rand8() - rnd.Rand8();
input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
}
if (i == 0)
for (int j = 0; j < kNumCoeffs; ++j)
input_extreme_block[j] = 255;
if (i == 1)
for (int j = 0; j < kNumCoeffs; ++j)
input_extreme_block[j] = -255;
fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,
output_block, pitch_));
// The minimum quant value is 4.
for (int j = 0; j < kNumCoeffs; ++j) {
EXPECT_EQ(output_block[j], output_ref_block[j]);
EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j]))
<< "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE";
}
}
}
| 14,965 |
2,767 | 0 | errorexec_cleanup(i_ctx_t *i_ctx_p)
{
return 0;
}
| 14,966 |
27,106 | 0 | static int handle_NPP_SetWindow(rpc_connection_t *connection)
{
D(bug("handle_NPP_SetWindow\n"));
int error;
PluginInstance *plugin;
NPWindow *window;
error = rpc_method_get_args(connection,
RPC_TYPE_NPW_PLUGIN_INSTANCE, &plugin,
RPC_TYPE_NP_WINDOW, &window,
RPC_TYPE_INVALID);
if (error != RPC_ERROR_NO_ERROR) {
npw_perror("NPP_SetWindow() get args", error);
return error;
}
NPError ret = g_NPP_SetWindow(PLUGIN_INSTANCE_NPP(plugin), window);
if (window) {
if (window->ws_info) {
free(window->ws_info);
window->ws_info = NULL;
}
free(window);
}
return rpc_method_send_reply(connection, RPC_TYPE_INT32, ret, RPC_TYPE_INVALID);
}
| 14,967 |
1,246 | 0 | void Splash::fillGlyph(SplashCoord x, SplashCoord y,
SplashGlyphBitmap *glyph) {
SplashCoord xt, yt;
int x0, y0;
transform(state->matrix, x, y, &xt, &yt);
x0 = splashFloor(xt);
y0 = splashFloor(yt);
SplashClipResult clipRes = state->clip->testRect(x0 - glyph->x,
y0 - glyph->y,
x0 - glyph->x + glyph->w - 1,
y0 - glyph->y + glyph->h - 1);
if (clipRes != splashClipAllOutside) {
fillGlyph2(x0, y0, glyph, clipRes == splashClipAllInside);
}
opClipRes = clipRes;
}
| 14,968 |
137,169 | 0 | void Textfield::DestroyTouchSelection() {
touch_selection_controller_.reset();
}
| 14,969 |
5,907 | 0 | static void ohci_bus_stop(OHCIState *ohci)
{
trace_usb_ohci_stop(ohci->name);
timer_del(ohci->eof_timer);
}
| 14,970 |
19,743 | 0 | static void prep_compound_huge_page(struct page *page, int order)
{
if (unlikely(order > (MAX_ORDER - 1)))
prep_compound_gigantic_page(page, order);
else
prep_compound_page(page, order);
}
| 14,971 |
36,433 | 0 | static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
{
static const u8 ppph[2] = { 0xff, 0x03 };
struct sock *sk = (struct sock *) chan->private;
struct sock *sk_tun;
struct l2tp_session *session;
struct l2tp_tunnel *tunnel;
struct pppol2tp_session *ps;
int uhlen, headroom;
if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED))
goto abort;
/* Get session and tunnel contexts from the socket */
session = pppol2tp_sock_to_session(sk);
if (session == NULL)
goto abort;
ps = l2tp_session_priv(session);
sk_tun = ps->tunnel_sock;
if (sk_tun == NULL)
goto abort_put_sess;
tunnel = l2tp_sock_to_tunnel(sk_tun);
if (tunnel == NULL)
goto abort_put_sess;
uhlen = (tunnel->encap == L2TP_ENCAPTYPE_UDP) ? sizeof(struct udphdr) : 0;
headroom = NET_SKB_PAD +
sizeof(struct iphdr) + /* IP header */
uhlen + /* UDP header (if L2TP_ENCAPTYPE_UDP) */
session->hdr_len + /* L2TP header */
sizeof(ppph); /* PPP header */
if (skb_cow_head(skb, headroom))
goto abort_put_sess_tun;
/* Setup PPP header */
__skb_push(skb, sizeof(ppph));
skb->data[0] = ppph[0];
skb->data[1] = ppph[1];
local_bh_disable();
l2tp_xmit_skb(session, skb, session->hdr_len);
local_bh_enable();
sock_put(sk_tun);
sock_put(sk);
return 1;
abort_put_sess_tun:
sock_put(sk_tun);
abort_put_sess:
sock_put(sk);
abort:
/* Free the original skb */
kfree_skb(skb);
return 1;
}
| 14,972 |
141,164 | 0 | bool Document::NeedsLayoutTreeUpdate() const {
if (!IsActive() || !View())
return false;
if (NeedsFullLayoutTreeUpdate())
return true;
if (ChildNeedsStyleRecalc())
return true;
if (ChildNeedsStyleInvalidation())
return true;
if (ChildNeedsReattachLayoutTree()) {
DCHECK(InStyleRecalc());
return true;
}
if (GetLayoutView() && GetLayoutView()->WasNotifiedOfSubtreeChange())
return true;
return false;
}
| 14,973 |
164,907 | 0 | void AbortRequestBeforeItStarts(
IPC::Sender* sender,
int request_id,
network::mojom::URLLoaderClientPtr url_loader_client) {
network::URLLoaderCompletionStatus status;
status.error_code = net::ERR_ABORTED;
status.exists_in_cache = false;
status.completion_time = base::TimeTicks();
status.encoded_data_length = 0;
status.encoded_body_length = 0;
url_loader_client->OnComplete(status);
}
| 14,974 |
121,268 | 0 | void HTMLInputElement::setValueInternal(const String& sanitizedValue, TextFieldEventBehavior eventBehavior)
{
m_valueIfDirty = sanitizedValue;
m_wasModifiedByUser = eventBehavior != DispatchNoEvent;
setNeedsValidityCheck();
}
| 14,975 |
104,418 | 0 | GLenum StubGLCheckFramebufferStatus(GLenum target) {
return glCheckFramebufferStatusEXT(target);
}
| 14,976 |
172,793 | 0 | MetadataRetrieverClient::~MetadataRetrieverClient()
{
ALOGV("MetadataRetrieverClient destructor");
disconnect();
}
| 14,977 |
157,843 | 0 | void WebContentsImpl::ReplaceMisspelling(const base::string16& word) {
RenderFrameHostImpl* focused_frame = GetFocusedFrame();
if (!focused_frame)
return;
focused_frame->GetFrameInputHandler()->ReplaceMisspelling(word);
}
| 14,978 |
175,249 | 0 | extern "C" void RIL_setcallbacks (const RIL_RadioFunctions *callbacks) {
memcpy(&s_callbacks, callbacks, sizeof (RIL_RadioFunctions));
}
| 14,979 |
94,685 | 0 | int i2d_RSAPrivateKey_fp(FILE *fp, RSA *rsa)
{
return ASN1_item_i2d_fp(ASN1_ITEM_rptr(RSAPrivateKey), fp, rsa);
}
| 14,980 |
92,492 | 0 | static inline unsigned long cfs_rq_runnable_load_avg(struct cfs_rq *cfs_rq)
{
return cfs_rq->avg.runnable_load_avg;
}
| 14,981 |
129,202 | 0 | void GLES2DecoderImpl::AddProcessingCommandsTime(base::TimeDelta time) {
total_processing_commands_time_ += time;
}
| 14,982 |
173,502 | 0 | void omx_vdec::allocate_color_convert_buf::set_vdec_client(void *client)
{
omx = reinterpret_cast<omx_vdec*>(client);
}
| 14,983 |
22,723 | 0 | static int bond_ioctl(struct net *net, unsigned int cmd,
struct compat_ifreq __user *ifr32)
{
struct ifreq kifr;
struct ifreq __user *uifr;
mm_segment_t old_fs;
int err;
u32 data;
void __user *datap;
switch (cmd) {
case SIOCBONDENSLAVE:
case SIOCBONDRELEASE:
case SIOCBONDSETHWADDR:
case SIOCBONDCHANGEACTIVE:
if (copy_from_user(&kifr, ifr32, sizeof(struct compat_ifreq)))
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
err = dev_ioctl(net, cmd,
(struct ifreq __user __force *) &kifr);
set_fs(old_fs);
return err;
case SIOCBONDSLAVEINFOQUERY:
case SIOCBONDINFOQUERY:
uifr = compat_alloc_user_space(sizeof(*uifr));
if (copy_in_user(&uifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ))
return -EFAULT;
if (get_user(data, &ifr32->ifr_ifru.ifru_data))
return -EFAULT;
datap = compat_ptr(data);
if (put_user(datap, &uifr->ifr_ifru.ifru_data))
return -EFAULT;
return dev_ioctl(net, cmd, uifr);
default:
return -EINVAL;
}
}
| 14,984 |
153,375 | 0 | void TabStrip::ContinueDrag(views::View* view, const ui::LocatedEvent& event) {
drag_context_->ContinueDrag(view, event);
}
| 14,985 |
165,020 | 0 | void HTMLCanvasElement::NotifyListenersCanvasChanged() {
if (listeners_.size() == 0)
return;
if (!OriginClean()) {
listeners_.clear();
return;
}
bool listener_needs_new_frame_capture = false;
for (const CanvasDrawListener* listener : listeners_) {
if (listener->NeedsNewFrame())
listener_needs_new_frame_capture = true;
}
if (listener_needs_new_frame_capture) {
SourceImageStatus status;
scoped_refptr<Image> source_image =
GetSourceImageForCanvas(&status, kPreferNoAcceleration, FloatSize());
if (status != kNormalSourceImageStatus)
return;
sk_sp<SkImage> image =
source_image->PaintImageForCurrentFrame().GetSkImage();
for (CanvasDrawListener* listener : listeners_) {
if (listener->NeedsNewFrame())
listener->SendNewFrame(image, source_image->ContextProviderWrapper());
}
}
}
| 14,986 |
165,391 | 0 | storage::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() {
return database_tracker_.get();
}
| 14,987 |
142,508 | 0 | ShelfWidget* GetShelfWidget() {
return AshTestBase::GetPrimaryShelf()->shelf_widget();
}
| 14,988 |
155,119 | 0 | void OmniboxViewViews::Init() {
set_controller(this);
SetTextInputType(ui::TEXT_INPUT_TYPE_URL);
GetRenderText()->SetElideBehavior(gfx::ELIDE_TAIL);
GetRenderText()->set_symmetric_selection_visual_bounds(true);
if (popup_window_mode_)
SetReadOnly(true);
if (location_bar_view_) {
InstallPlaceholderText();
scoped_template_url_service_observer_.Add(
model()->client()->GetTemplateURLService());
popup_view_.reset(
new OmniboxPopupContentsView(this, model(), location_bar_view_));
}
constexpr gfx::Insets kTextfieldInsets(3);
SetBorder(views::CreateEmptyBorder(kTextfieldInsets));
#if defined(OS_CHROMEOS)
chromeos::input_method::InputMethodManager::Get()->
AddCandidateWindowObserver(this);
#endif
}
| 14,989 |
100,938 | 0 | ScriptableHandle::ScriptableHandle(DescBasedHandle* desc_handle)
: var_(NULL), num_unref_calls_(0), plugin_(NULL), desc_handle_(desc_handle) {
PLUGIN_PRINTF(("ScriptableHandle::ScriptableHandle (this=%p,"
" desc_handle=%p)\n",
static_cast<void*>(this),
static_cast<void*>(desc_handle)));
RememberValidHandle(this);
PLUGIN_PRINTF(("ScriptableHandle::ScriptableHandle (this=%p)\n",
static_cast<void*>(this)));
}
| 14,990 |
40,255 | 0 | data_sock_release(struct socket *sock)
{
struct sock *sk = sock->sk;
if (*debug & DEBUG_SOCKET)
printk(KERN_DEBUG "%s(%p) sk=%p\n", __func__, sock, sk);
if (!sk)
return 0;
switch (sk->sk_protocol) {
case ISDN_P_TE_S0:
case ISDN_P_NT_S0:
case ISDN_P_TE_E1:
case ISDN_P_NT_E1:
if (sk->sk_state == MISDN_BOUND)
delete_channel(&_pms(sk)->ch);
else
mISDN_sock_unlink(&data_sockets, sk);
break;
case ISDN_P_LAPD_TE:
case ISDN_P_LAPD_NT:
case ISDN_P_B_RAW:
case ISDN_P_B_HDLC:
case ISDN_P_B_X75SLP:
case ISDN_P_B_L2DTMF:
case ISDN_P_B_L2DSP:
case ISDN_P_B_L2DSPHDLC:
delete_channel(&_pms(sk)->ch);
mISDN_sock_unlink(&data_sockets, sk);
break;
}
lock_sock(sk);
sock_orphan(sk);
skb_queue_purge(&sk->sk_receive_queue);
release_sock(sk);
sock_put(sk);
return 0;
}
| 14,991 |
41,932 | 0 | void rds_conn_exit(void)
{
rds_loop_exit();
WARN_ON(!hlist_empty(rds_conn_hash));
kmem_cache_destroy(rds_conn_slab);
rds_info_deregister_func(RDS_INFO_CONNECTIONS, rds_conn_info);
rds_info_deregister_func(RDS_INFO_SEND_MESSAGES,
rds_conn_message_info_send);
rds_info_deregister_func(RDS_INFO_RETRANS_MESSAGES,
rds_conn_message_info_retrans);
}
| 14,992 |
78,265 | 0 | static int cac_set_security_env(sc_card_t *card, const sc_security_env_t *env, int se_num)
{
int r = SC_SUCCESS;
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL,
"flags=%08lx op=%d alg=%d algf=%08x algr=%08x kr0=%02x, krfl=%"SC_FORMAT_LEN_SIZE_T"u\n",
env->flags, env->operation, env->algorithm,
env->algorithm_flags, env->algorithm_ref, env->key_ref[0],
env->key_ref_len);
if (env->algorithm != SC_ALGORITHM_RSA) {
r = SC_ERROR_NO_CARD_SUPPORT;
}
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r);
}
| 14,993 |
100,710 | 0 | xmlParseComment(xmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int size = XML_PARSER_BUFFER_SIZE;
int len = 0;
xmlParserInputState state;
const xmlChar *in;
int nbchar = 0, ccol;
int inputid;
/*
* Check that there is a comment right here.
*/
if ((RAW != '<') || (NXT(1) != '!') ||
(NXT(2) != '-') || (NXT(3) != '-')) return;
state = ctxt->instate;
ctxt->instate = XML_PARSER_COMMENT;
inputid = ctxt->input->id;
SKIP(4);
SHRINK;
GROW;
/*
* Accelerated common case where input don't need to be
* modified before passing it to the handler.
*/
in = ctxt->input->cur;
do {
if (*in == 0xA) {
do {
ctxt->input->line++; ctxt->input->col = 1;
in++;
} while (*in == 0xA);
}
get_more:
ccol = ctxt->input->col;
while (((*in > '-') && (*in <= 0x7F)) ||
((*in >= 0x20) && (*in < '-')) ||
(*in == 0x09)) {
in++;
ccol++;
}
ctxt->input->col = ccol;
if (*in == 0xA) {
do {
ctxt->input->line++; ctxt->input->col = 1;
in++;
} while (*in == 0xA);
goto get_more;
}
nbchar = in - ctxt->input->cur;
/*
* save current set of data
*/
if (nbchar > 0) {
if ((ctxt->sax != NULL) &&
(ctxt->sax->comment != NULL)) {
if (buf == NULL) {
if ((*in == '-') && (in[1] == '-'))
size = nbchar + 1;
else
size = XML_PARSER_BUFFER_SIZE + nbchar;
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
if (buf == NULL) {
xmlErrMemory(ctxt, NULL);
ctxt->instate = state;
return;
}
len = 0;
} else if (len + nbchar + 1 >= size) {
xmlChar *new_buf;
size += len + nbchar + XML_PARSER_BUFFER_SIZE;
new_buf = (xmlChar *) xmlRealloc(buf,
size * sizeof(xmlChar));
if (new_buf == NULL) {
xmlFree (buf);
xmlErrMemory(ctxt, NULL);
ctxt->instate = state;
return;
}
buf = new_buf;
}
memcpy(&buf[len], ctxt->input->cur, nbchar);
len += nbchar;
buf[len] = 0;
}
}
ctxt->input->cur = in;
if (*in == 0xA) {
in++;
ctxt->input->line++; ctxt->input->col = 1;
}
if (*in == 0xD) {
in++;
if (*in == 0xA) {
ctxt->input->cur = in;
in++;
ctxt->input->line++; ctxt->input->col = 1;
continue; /* while */
}
in--;
}
SHRINK;
GROW;
in = ctxt->input->cur;
if (*in == '-') {
if (in[1] == '-') {
if (in[2] == '>') {
if (ctxt->input->id != inputid) {
xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
"comment doesn't start and stop in the same entity\n");
}
SKIP(3);
if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) &&
(!ctxt->disableSAX)) {
if (buf != NULL)
ctxt->sax->comment(ctxt->userData, buf);
else
ctxt->sax->comment(ctxt->userData, BAD_CAST "");
}
if (buf != NULL)
xmlFree(buf);
ctxt->instate = state;
return;
}
if (buf != NULL)
xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
"Comment not terminated \n<!--%.50s\n",
buf);
else
xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED,
"Comment not terminated \n", NULL);
in++;
ctxt->input->col++;
}
in++;
ctxt->input->col++;
goto get_more;
}
} while (((*in >= 0x20) && (*in <= 0x7F)) || (*in == 0x09));
xmlParseCommentComplex(ctxt, buf, len, size);
ctxt->instate = state;
return;
}
| 14,994 |
22,953 | 0 | nfs4_remove_state_owner(struct nfs_client *clp, struct nfs4_state_owner *sp)
{
if (!RB_EMPTY_NODE(&sp->so_client_node))
rb_erase(&sp->so_client_node, &clp->cl_state_owners);
nfs_free_unique_id(&clp->cl_openowner_id, &sp->so_owner_id);
}
| 14,995 |
57,244 | 0 | static void nfs4_set_sequence_privileged(struct nfs4_sequence_args *args)
{
args->sa_privileged = 1;
}
| 14,996 |
129,952 | 0 | bool LeafUnwindBlacklist::IsBlacklisted(const void* module) const {
return ContainsKey(blacklisted_modules_, module);
}
| 14,997 |
51,685 | 0 | bool ikev1_ship_chain(chunk_t *chain, int n, pb_stream *outs,
u_int8_t type,
u_int8_t setnp)
{
int i;
u_int8_t np;
for (i = 0; i < n; i++) {
/* set np for last cert, or another */
np = i == n - 1 ? setnp : ISAKMP_NEXT_CERT;
if (!ikev1_ship_CERT(type, chain[i], outs, np))
return FALSE;
}
return TRUE;
}
| 14,998 |
100,895 | 0 | void ExtensionInstallUI::OnInstallFailure(const string16& error) {
DCHECK(ui_loop_ == MessageLoop::current());
Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
if (disable_failure_ui_for_tests)
return;
browser::ShowErrorBox(
browser ? browser->window()->GetNativeHandle() : NULL,
l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_FAILURE_TITLE),
error);
}
| 14,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.