unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
173,150 | 0 | fix(double d)
{
d = floor(d * PNG_FP_1 + .5);
return (png_fixed_point)d;
}
| 8,900 |
62,061 | 0 | void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
{
__be32 src;
if (rt_is_output_route(rt))
src = ip_hdr(skb)->saddr;
else {
struct fib_result res;
struct flowi4 fl4;
struct iphdr *iph;
iph = ip_hdr(skb);
memset(&fl4, 0, sizeof(fl4));
fl4.daddr = iph->daddr;
fl4.saddr = iph->saddr;
fl4.flowi4_tos = RT_TOS(iph->tos);
fl4.flowi4_oif = rt->dst.dev->ifindex;
fl4.flowi4_iif = skb->dev->ifindex;
fl4.flowi4_mark = skb->mark;
rcu_read_lock();
if (fib_lookup(dev_net(rt->dst.dev), &fl4, &res, 0) == 0)
src = FIB_RES_PREFSRC(dev_net(rt->dst.dev), res);
else
src = inet_select_addr(rt->dst.dev,
rt_nexthop(rt, iph->daddr),
RT_SCOPE_UNIVERSE);
rcu_read_unlock();
}
memcpy(addr, &src, 4);
}
| 8,901 |
16,565 | 0 | FileTransfer::Continue()
{
int result = TRUE; // return TRUE if there currently is no thread
if (ActiveTransferTid != -1 ) {
ASSERT( daemonCore );
result = daemonCore->Continue_Thread(ActiveTransferTid);
}
return result;
}
| 8,902 |
103,032 | 0 | PropertyAccessor<int>* GetIDAccessor() {
static PropertyAccessor<int> accessor;
return &accessor;
}
| 8,903 |
157,113 | 0 | int64_t ResourceMultiBufferDataProvider::AvailableBytes() const {
int64_t bytes = 0;
for (const auto i : fifo_) {
if (i->end_of_stream())
break;
bytes += i->data_size();
}
return bytes;
}
| 8,904 |
135,842 | 0 | static Position UpdatePostionAfterAdoptingTextNodesMerged(
const Position& position,
const Text& merged_node,
const NodeWithIndex& node_to_be_removed_with_index,
unsigned old_length) {
Node* const anchor_node = position.AnchorNode();
const Node& node_to_be_removed = node_to_be_removed_with_index.GetNode();
switch (position.AnchorType()) {
case PositionAnchorType::kBeforeChildren:
case PositionAnchorType::kAfterChildren:
return position;
case PositionAnchorType::kBeforeAnchor:
if (anchor_node == node_to_be_removed)
return Position(merged_node, merged_node.length());
return position;
case PositionAnchorType::kAfterAnchor:
if (anchor_node == node_to_be_removed)
return Position(merged_node, merged_node.length());
if (anchor_node == merged_node)
return Position(merged_node, old_length);
return position;
case PositionAnchorType::kOffsetInAnchor: {
const int offset = position.OffsetInContainerNode();
if (anchor_node == node_to_be_removed)
return Position(merged_node, old_length + offset);
if (anchor_node == node_to_be_removed.parentNode() &&
offset == node_to_be_removed_with_index.Index()) {
return Position(merged_node, old_length);
}
return position;
}
}
NOTREACHED() << position;
return position;
}
| 8,905 |
49,789 | 0 | static void arcmsr_hbaC_postqueue_isr(struct AdapterControlBlock *acb)
{
struct MessageUnit_C __iomem *phbcmu;
struct ARCMSR_CDB *arcmsr_cdb;
struct CommandControlBlock *ccb;
uint32_t flag_ccb, ccb_cdb_phy, throttling = 0;
int error;
phbcmu = acb->pmuC;
/* areca cdb command done */
/* Use correct offset and size for syncing */
while ((flag_ccb = readl(&phbcmu->outbound_queueport_low)) !=
0xFFFFFFFF) {
ccb_cdb_phy = (flag_ccb & 0xFFFFFFF0);
arcmsr_cdb = (struct ARCMSR_CDB *)(acb->vir2phy_offset
+ ccb_cdb_phy);
ccb = container_of(arcmsr_cdb, struct CommandControlBlock,
arcmsr_cdb);
error = (flag_ccb & ARCMSR_CCBREPLY_FLAG_ERROR_MODE1)
? true : false;
/* check if command done with no error */
arcmsr_drain_donequeue(acb, ccb, error);
throttling++;
if (throttling == ARCMSR_HBC_ISR_THROTTLING_LEVEL) {
writel(ARCMSR_HBCMU_DRV2IOP_POSTQUEUE_THROTTLING,
&phbcmu->inbound_doorbell);
throttling = 0;
}
}
}
| 8,906 |
63,243 | 0 | void _WM_do_meta_endoftrack(struct _mdi *mdi, struct _event_data *data) {
/* placeholder function so we can record eot in the event stream
* for conversion function _WM_Event2Midi */
#ifdef DEBUG_MIDI
uint8_t ch = data->channel;
MIDI_EVENT_DEBUG(__FUNCTION__, ch, data->data.value);
#else
UNUSED(data);
#endif
_WM_Release_Allowance(mdi);
return;
}
| 8,907 |
142,412 | 0 | void NotifySessionStateChanged(session_manager::SessionState state) {
GetSessionControllerClient()->SetSessionState(state);
}
| 8,908 |
176,305 | 0 | static bool HasEntryImpl(Isolate* isolate, FixedArrayBase* store,
uint32_t entry) {
DisallowHeapAllocation no_gc;
SeededNumberDictionary* dict = SeededNumberDictionary::cast(store);
Object* index = dict->KeyAt(entry);
return !index->IsTheHole(isolate);
}
| 8,909 |
156,982 | 0 | void WebMediaPlayerMS::OnRotationChanged(media::VideoRotation video_rotation,
bool is_opaque) {
DVLOG(1) << __func__;
DCHECK(thread_checker_.CalledOnValidThread());
video_rotation_ = video_rotation;
opaque_ = is_opaque;
if (!bridge_) {
auto new_video_layer =
cc::VideoLayer::Create(compositor_.get(), video_rotation);
new_video_layer->SetContentsOpaque(is_opaque);
get_client()->SetCcLayer(new_video_layer.get());
video_layer_ = std::move(new_video_layer);
} else {
compositor_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&WebMediaPlayerMSCompositor::UpdateRotation,
compositor_, video_rotation));
}
}
| 8,910 |
58,305 | 0 | void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t handle, struct dma_attrs *attrs)
{
struct page **pages;
size = PAGE_ALIGN(size);
if (__in_atomic_pool(cpu_addr, size)) {
__iommu_free_atomic(dev, cpu_addr, handle, size);
return;
}
pages = __iommu_get_pages(cpu_addr, attrs);
if (!pages) {
WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr);
return;
}
if (!dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs)) {
unmap_kernel_range((unsigned long)cpu_addr, size);
vunmap(cpu_addr);
}
__iommu_remove_mapping(dev, handle, size);
__iommu_free_buffer(dev, pages, size, attrs);
}
| 8,911 |
24,001 | 0 | static int airo_set_scan(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *dwrq,
char *extra)
{
struct airo_info *ai = dev->ml_priv;
Cmd cmd;
Resp rsp;
int wake = 0;
/* Note : you may have realised that, as this is a SET operation,
* this is privileged and therefore a normal user can't
* perform scanning.
* This is not an error, while the device perform scanning,
* traffic doesn't flow, so it's a perfect DoS...
* Jean II */
if (ai->flags & FLAG_RADIO_MASK) return -ENETDOWN;
if (down_interruptible(&ai->sem))
return -ERESTARTSYS;
/* If there's already a scan in progress, don't
* trigger another one. */
if (ai->scan_timeout > 0)
goto out;
/* Initiate a scan command */
ai->scan_timeout = RUN_AT(3*HZ);
memset(&cmd, 0, sizeof(cmd));
cmd.cmd=CMD_LISTBSS;
issuecommand(ai, &cmd, &rsp);
wake = 1;
out:
up(&ai->sem);
if (wake)
wake_up_interruptible(&ai->thr_wait);
return 0;
}
| 8,912 |
387 | 0 | fz_keep_link_key(fz_context *ctx, void *key_)
{
fz_link_key *key = (fz_link_key *)key_;
return fz_keep_imp(ctx, key, &key->refs);
}
| 8,913 |
157,344 | 0 | void WebMediaPlayerImpl::UpdateRemotePlaybackCompatibility(bool is_compatible) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
client_->RemotePlaybackCompatibilityChanged(loaded_url_, is_compatible);
}
| 8,914 |
122,212 | 0 | void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer)
{
ASSERT(!parentLayer || childLayer->ancestorCompositingLayer() == parentLayer);
ASSERT(childLayer->hasCompositedLayerMapping());
if (!parentLayer || !parentLayer->hasCompositedLayerMapping())
return;
if (parentLayer) {
GraphicsLayer* hostingLayer = parentLayer->compositedLayerMapping()->parentForSublayers();
GraphicsLayer* hostedLayer = childLayer->compositedLayerMapping()->childForSuperlayers();
hostingLayer->addChild(hostedLayer);
} else {
childLayer->compositedLayerMapping()->childForSuperlayers()->removeFromParent();
}
}
| 8,915 |
79,604 | 0 | int imap_search(struct Context *ctx, const struct Pattern *pat)
{
struct Buffer buf;
struct ImapData *idata = ctx->data;
for (int i = 0; i < ctx->msgcount; i++)
ctx->hdrs[i]->matched = false;
if (do_search(pat, 1) == 0)
return 0;
mutt_buffer_init(&buf);
mutt_buffer_addstr(&buf, "UID SEARCH ");
if (compile_search(ctx, pat, &buf) < 0)
{
FREE(&buf.data);
return -1;
}
if (imap_exec(idata, buf.data, 0) < 0)
{
FREE(&buf.data);
return -1;
}
FREE(&buf.data);
return 0;
}
| 8,916 |
117,011 | 0 | bool GestureSequence::ScrollUpdate(const TouchEvent& event,
const GesturePoint& point, Gestures* gestures) {
DCHECK(state_ == GS_SCROLL);
if (!point.DidScroll(event, 0))
return false;
AppendScrollGestureUpdate(point, point.last_touch_position(), gestures);
return true;
}
| 8,917 |
27,093 | 0 | g_NP_GetValue(NPPVariable variable, void *value)
{
if (g_plugin_NP_GetValue == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
D(bugiI("NP_GetValue variable=%d [%s]\n", variable, string_of_NPPVariable(variable)));
NPError ret = g_plugin_NP_GetValue(NULL, variable, value);
D(bugiD("NP_GetValue return: %d\n", ret));
return ret;
}
| 8,918 |
59,260 | 0 | long _do_fork(unsigned long clone_flags,
unsigned long stack_start,
unsigned long stack_size,
int __user *parent_tidptr,
int __user *child_tidptr,
unsigned long tls)
{
struct task_struct *p;
int trace = 0;
long nr;
/*
* Determine whether and which event to report to ptracer. When
* called from kernel_thread or CLONE_UNTRACED is explicitly
* requested, no event is reported; otherwise, report if the event
* for the type of forking is enabled.
*/
if (!(clone_flags & CLONE_UNTRACED)) {
if (clone_flags & CLONE_VFORK)
trace = PTRACE_EVENT_VFORK;
else if ((clone_flags & CSIGNAL) != SIGCHLD)
trace = PTRACE_EVENT_CLONE;
else
trace = PTRACE_EVENT_FORK;
if (likely(!ptrace_event_enabled(current, trace)))
trace = 0;
}
p = copy_process(clone_flags, stack_start, stack_size,
child_tidptr, NULL, trace, tls, NUMA_NO_NODE);
add_latent_entropy();
/*
* Do this prior waking up the new thread - the thread pointer
* might get invalid after that point, if the thread exits quickly.
*/
if (!IS_ERR(p)) {
struct completion vfork;
struct pid *pid;
trace_sched_process_fork(current, p);
pid = get_task_pid(p, PIDTYPE_PID);
nr = pid_vnr(pid);
if (clone_flags & CLONE_PARENT_SETTID)
put_user(nr, parent_tidptr);
if (clone_flags & CLONE_VFORK) {
p->vfork_done = &vfork;
init_completion(&vfork);
get_task_struct(p);
}
wake_up_new_task(p);
/* forking complete and child started to run, tell ptracer */
if (unlikely(trace))
ptrace_event_pid(trace, pid);
if (clone_flags & CLONE_VFORK) {
if (!wait_for_vfork_done(p, &vfork))
ptrace_event_pid(PTRACE_EVENT_VFORK_DONE, pid);
}
put_pid(pid);
} else {
nr = PTR_ERR(p);
}
return nr;
}
| 8,919 |
175,421 | 0 | static int adev_init_check(const struct audio_hw_device *dev)
{
(void)dev;
return 0;
}
| 8,920 |
157,460 | 0 | void ChromeHttpAuthHandler::SetAuth(JNIEnv* env,
const JavaParamRef<jobject>&,
const JavaParamRef<jstring>& username,
const JavaParamRef<jstring>& password) {
if (observer_) {
base::string16 username16 = ConvertJavaStringToUTF16(env, username);
base::string16 password16 = ConvertJavaStringToUTF16(env, password);
observer_->SetAuth(username16, password16);
}
}
| 8,921 |
155,825 | 0 | std::string SupervisedUserService::GetCustodianName() const {
std::string name = profile_->GetPrefs()->GetString(
prefs::kSupervisedUserCustodianName);
#if defined(OS_CHROMEOS)
if (name.empty() && !!user_manager::UserManager::Get()->GetActiveUser()) {
name = base::UTF16ToUTF8(
chromeos::ChromeUserManager::Get()
->GetSupervisedUserManager()
->GetManagerDisplayName(user_manager::UserManager::Get()
->GetActiveUser()
->GetAccountId()
.GetUserEmail()));
}
#endif
return name.empty() ? GetCustodianEmailAddress() : name;
}
| 8,922 |
169,627 | 0 | std::string TestURLLoader::TestEmptyDataPOST() {
pp::URLRequestInfo request(instance_);
request.SetURL("/echo");
request.SetMethod("POST");
request.AppendDataToBody("", 0);
return LoadAndCompareBody(request, std::string());
}
| 8,923 |
129,386 | 0 | bool GLES2DecoderImpl::GetUniformSetup(
GLuint program_id, GLint fake_location,
uint32 shm_id, uint32 shm_offset,
error::Error* error, GLint* real_location,
GLuint* service_id, void** result_pointer, GLenum* result_type) {
DCHECK(error);
DCHECK(service_id);
DCHECK(result_pointer);
DCHECK(result_type);
DCHECK(real_location);
*error = error::kNoError;
SizedResult<GLint>* result;
result = GetSharedMemoryAs<SizedResult<GLint>*>(
shm_id, shm_offset, SizedResult<GLint>::ComputeSize(0));
if (!result) {
*error = error::kOutOfBounds;
return false;
}
*result_pointer = result;
result->SetNumResults(0);
Program* program = GetProgramInfoNotShader(program_id, "glGetUniform");
if (!program) {
return false;
}
if (!program->IsValid()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, "glGetUniform", "program not linked");
return false;
}
*service_id = program->service_id();
GLint array_index = -1;
const Program::UniformInfo* uniform_info =
program->GetUniformInfoByFakeLocation(
fake_location, real_location, &array_index);
if (!uniform_info) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION, "glGetUniform", "unknown location");
return false;
}
GLenum type = uniform_info->type;
GLsizei size = GLES2Util::GetGLDataTypeSizeForUniforms(type);
if (size == 0) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetUniform", "unknown type");
return false;
}
result = GetSharedMemoryAs<SizedResult<GLint>*>(
shm_id, shm_offset, SizedResult<GLint>::ComputeSizeFromBytes(size));
if (!result) {
*error = error::kOutOfBounds;
return false;
}
result->size = size;
*result_type = type;
return true;
}
| 8,924 |
71,480 | 0 | static inline size_t Max(size_t one, size_t two)
{
if (one > two)
return one;
return two;
}
| 8,925 |
103,321 | 0 | ui::Clipboard* ClipboardMessageFilter::GetClipboard() {
static ui::Clipboard* clipboard = new ui::Clipboard;
return clipboard;
}
| 8,926 |
107,940 | 0 | int ConfirmInfoBar::GetAvailableWidth() const {
return ok_button_->x() - kEndOfLabelSpacing;
}
| 8,927 |
65,839 | 0 | nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, __be32 nfserr,
struct nfsd4_test_stateid *test_stateid)
{
struct xdr_stream *xdr = &resp->xdr;
struct nfsd4_test_stateid_id *stateid, *next;
__be32 *p;
if (nfserr)
return nfserr;
p = xdr_reserve_space(xdr, 4 + (4 * test_stateid->ts_num_ids));
if (!p)
return nfserr_resource;
*p++ = htonl(test_stateid->ts_num_ids);
list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) {
*p++ = stateid->ts_id_status;
}
return nfserr;
}
| 8,928 |
135,099 | 0 | void AppCacheUpdateJob::URLFetcher::OnReceivedRedirect(
net::URLRequest* request,
const net::RedirectInfo& redirect_info,
bool* defer_redirect) {
DCHECK(request_ == request);
job_->MadeProgress();
redirect_response_code_ = request->GetResponseCode();
request->Cancel();
result_ = REDIRECT_ERROR;
OnResponseCompleted();
}
| 8,929 |
155,368 | 0 | base::FilePath ChromeContentBrowserClient::GetShaderDiskCacheDirectory() {
base::FilePath user_data_dir;
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
DCHECK(!user_data_dir.empty());
return user_data_dir.Append(FILE_PATH_LITERAL("ShaderCache"));
}
| 8,930 |
26,917 | 0 | static int cmd_attr_tgid(struct genl_info *info)
{
struct taskstats *stats;
struct sk_buff *rep_skb;
size_t size;
u32 tgid;
int rc;
size = taskstats_packet_size();
rc = prepare_reply(info, TASKSTATS_CMD_NEW, &rep_skb, size);
if (rc < 0)
return rc;
rc = -EINVAL;
tgid = nla_get_u32(info->attrs[TASKSTATS_CMD_ATTR_TGID]);
stats = mk_reply(rep_skb, TASKSTATS_TYPE_TGID, tgid);
if (!stats)
goto err;
rc = fill_stats_for_tgid(tgid, stats);
if (rc < 0)
goto err;
return send_reply(rep_skb, info);
err:
nlmsg_free(rep_skb);
return rc;
}
| 8,931 |
147,498 | 0 | static void LocationWithCallWithAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> holder = info.Holder();
TestObject* impl = V8TestObject::ToImpl(holder);
V8SetReturnValueFast(info, WTF::GetPtr(impl->locationWithCallWith()), impl);
}
| 8,932 |
185,844 | 1 | void WallpaperManager::DoSetDefaultWallpaper(
const AccountId& account_id,
MovableOnDestroyCallbackHolder on_finish) {
// There is no visible wallpaper in kiosk mode.
if (user_manager::UserManager::Get()->IsLoggedInAsKioskApp())
return;
wallpaper_cache_.erase(account_id);
WallpaperResolution resolution = GetAppropriateResolution();
const bool use_small = (resolution == WALLPAPER_RESOLUTION_SMALL);
const base::FilePath* file = NULL;
const user_manager::User* user =
user_manager::UserManager::Get()->FindUser(account_id);
if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) {
file =
use_small ? &guest_small_wallpaper_file_ : &guest_large_wallpaper_file_;
} else if (user && user->GetType() == user_manager::USER_TYPE_CHILD) {
file =
use_small ? &child_small_wallpaper_file_ : &child_large_wallpaper_file_;
} else {
file = use_small ? &default_small_wallpaper_file_
: &default_large_wallpaper_file_;
}
wallpaper::WallpaperLayout layout =
use_small ? wallpaper::WALLPAPER_LAYOUT_CENTER
: wallpaper::WALLPAPER_LAYOUT_CENTER_CROPPED;
DCHECK(file);
if (!default_wallpaper_image_.get() ||
default_wallpaper_image_->file_path() != *file) {
default_wallpaper_image_.reset();
if (!file->empty()) {
loaded_wallpapers_for_test_++;
StartLoadAndSetDefaultWallpaper(*file, layout, std::move(on_finish),
&default_wallpaper_image_);
return;
}
CreateSolidDefaultWallpaper();
}
// 1x1 wallpaper is actually solid color, so it should be stretched.
if (default_wallpaper_image_->image().width() == 1 &&
default_wallpaper_image_->image().height() == 1)
layout = wallpaper::WALLPAPER_LAYOUT_STRETCH;
WallpaperInfo info(default_wallpaper_image_->file_path().value(), layout,
wallpaper::DEFAULT, base::Time::Now().LocalMidnight());
SetWallpaper(default_wallpaper_image_->image(), info);
}
| 8,933 |
158,747 | 0 | ScopedTextureBinder::ScopedTextureBinder(ContextState* state,
GLuint id,
GLenum target)
: state_(state),
target_(target) {
ScopedGLErrorSuppressor suppressor(
"ScopedTextureBinder::ctor", state_->GetErrorState());
auto* api = state->api();
api->glActiveTextureFn(GL_TEXTURE0);
api->glBindTextureFn(target, id);
}
| 8,934 |
163,342 | 0 | cc::TaskGraphRunner* RenderThreadImpl::GetTaskGraphRunner() {
return categorized_worker_pool_->GetTaskGraphRunner();
}
| 8,935 |
77,955 | 0 | static int read_user_chunk_callback(png_struct *ping, png_unknown_chunkp chunk)
{
Image
*image;
/* The unknown chunk structure contains the chunk data:
png_byte name[5];
png_byte *data;
png_size_t size;
Note that libpng has already taken care of the CRC handling.
*/
LogMagickEvent(CoderEvent,GetMagickModule(),
" read_user_chunk: found %c%c%c%c chunk",
chunk->name[0],chunk->name[1],chunk->name[2],chunk->name[3]);
if (chunk->name[0] == 101 &&
(chunk->name[1] == 88 || chunk->name[1] == 120 ) &&
chunk->name[2] == 73 &&
chunk-> name[3] == 102)
{
/* process eXIf or exIf chunk */
PNGErrorInfo
*error_info;
StringInfo
*profile;
unsigned char
*p;
png_byte
*s;
int
i;
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" recognized eXIf chunk");
image=(Image *) png_get_user_chunk_ptr(ping);
error_info=(PNGErrorInfo *) png_get_error_ptr(ping);
profile=BlobToStringInfo((const void *) NULL,chunk->size+6);
if (profile == (StringInfo *) NULL)
{
(void) ThrowMagickException(error_info->exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
return(-1);
}
p=GetStringInfoDatum(profile);
/* Initialize profile with "Exif\0\0" */
*p++ ='E';
*p++ ='x';
*p++ ='i';
*p++ ='f';
*p++ ='\0';
*p++ ='\0';
s=chunk->data;
i=0;
if (chunk->size > 6)
{
/* Skip first 6 bytes if "Exif\0\0" is
already present by accident
*/
if (s[0] == 'E' && s[1] == 'x' && s[2] == 'i' &&
s[3] == 'f' && s[4] == '\0' && s[5] == '\0')
{
s+=6;
i=6;
SetStringInfoLength(profile,chunk->size);
p=GetStringInfoDatum(profile);
}
}
/* copy chunk->data to profile */
for (; i<chunk->size; i++)
*p++ = *s++;
(void) SetImageProfile(image,"exif",profile);
return(1);
}
/* vpAg (deprecated, replaced by caNv) */
if (chunk->name[0] == 118 &&
chunk->name[1] == 112 &&
chunk->name[2] == 65 &&
chunk->name[3] == 103)
{
/* recognized vpAg */
if (chunk->size != 9)
return(-1); /* Error return */
if (chunk->data[8] != 0)
return(0); /* ImageMagick requires pixel units */
image=(Image *) png_get_user_chunk_ptr(ping);
image->page.width=(size_t)mng_get_long(chunk->data);
image->page.height=(size_t)mng_get_long(&chunk->data[4]);
return(1);
}
/* caNv */
if (chunk->name[0] == 99 &&
chunk->name[1] == 97 &&
chunk->name[2] == 78 &&
chunk->name[3] == 118)
{
/* recognized caNv */
if (chunk->size != 16)
return(-1); /* Error return */
image=(Image *) png_get_user_chunk_ptr(ping);
image->page.width=(size_t)mng_get_long(chunk->data);
image->page.height=(size_t)mng_get_long(&chunk->data[4]);
image->page.x=(size_t)mng_get_long(&chunk->data[8]);
image->page.y=(size_t)mng_get_long(&chunk->data[12]);
/* Return one of the following: */
/* return(-n); chunk had an error */
/* return(0); did not recognize */
/* return(n); success */
return(1);
}
return(0); /* Did not recognize */
}
| 8,936 |
180,806 | 1 | on_unregister_handler(TCMUService1HandlerManager1 *interface,
GDBusMethodInvocation *invocation,
gchar *subtype,
gpointer user_data)
{
struct tcmur_handler *handler = find_handler_by_subtype(subtype);
struct dbus_info *info = handler ? handler->opaque : NULL;
if (!handler) {
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(bs)", FALSE,
"unknown subtype"));
return TRUE;
}
dbus_unexport_handler(handler);
tcmur_unregister_handler(handler);
g_bus_unwatch_name(info->watcher_id);
g_free(info);
g_free(handler);
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(bs)", TRUE, "succeeded"));
return TRUE;
}
| 8,937 |
30,023 | 0 | static void br_multicast_send_query(struct net_bridge *br,
struct net_bridge_port *port, u32 sent)
{
unsigned long time;
struct br_ip br_group;
if (!netif_running(br->dev) || br->multicast_disabled ||
!br->multicast_querier ||
timer_pending(&br->multicast_querier_timer))
return;
memset(&br_group.u, 0, sizeof(br_group.u));
br_group.proto = htons(ETH_P_IP);
__br_multicast_send_query(br, port, &br_group);
#if IS_ENABLED(CONFIG_IPV6)
br_group.proto = htons(ETH_P_IPV6);
__br_multicast_send_query(br, port, &br_group);
#endif
time = jiffies;
time += sent < br->multicast_startup_query_count ?
br->multicast_startup_query_interval :
br->multicast_query_interval;
mod_timer(port ? &port->multicast_query_timer :
&br->multicast_query_timer, time);
}
| 8,938 |
166,515 | 0 | void ChromeContentBrowserClient::OverrideWebkitPrefs(
RenderViewHost* rvh, WebPreferences* web_prefs) {
Profile* profile = Profile::FromBrowserContext(
rvh->GetProcess()->GetBrowserContext());
PrefService* prefs = profile->GetPrefs();
#if !defined(OS_ANDROID)
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitStandardFontFamilyMap,
&web_prefs->standard_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitFixedFontFamilyMap,
&web_prefs->fixed_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitSerifFontFamilyMap,
&web_prefs->serif_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitSansSerifFontFamilyMap,
&web_prefs->sans_serif_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitCursiveFontFamilyMap,
&web_prefs->cursive_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitFantasyFontFamilyMap,
&web_prefs->fantasy_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitPictographFontFamilyMap,
&web_prefs->pictograph_font_family_map);
web_prefs->default_font_size =
prefs->GetInteger(prefs::kWebKitDefaultFontSize);
web_prefs->default_fixed_font_size =
prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize);
web_prefs->minimum_font_size =
prefs->GetInteger(prefs::kWebKitMinimumFontSize);
web_prefs->minimum_logical_font_size =
prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize);
#endif
web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset);
web_prefs->dom_paste_enabled =
prefs->GetBoolean(prefs::kWebKitDomPasteEnabled);
web_prefs->javascript_can_access_clipboard =
prefs->GetBoolean(prefs::kWebKitJavascriptCanAccessClipboard);
web_prefs->tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks);
if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled))
web_prefs->javascript_enabled = false;
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled)) {
web_prefs->web_security_enabled = false;
} else if (!web_prefs->web_security_enabled &&
command_line->HasSwitch(switches::kDisableWebSecurity) &&
!command_line->HasSwitch(switches::kUserDataDir)) {
LOG(ERROR) << "Web security may only be disabled if '--user-data-dir' is "
"also specified.";
web_prefs->web_security_enabled = true;
}
if (!prefs->GetBoolean(prefs::kWebKitPluginsEnabled))
web_prefs->plugins_enabled = false;
web_prefs->loads_images_automatically =
prefs->GetBoolean(prefs::kWebKitLoadsImagesAutomatically);
if (prefs->GetBoolean(prefs::kDisable3DAPIs)) {
web_prefs->webgl1_enabled = false;
web_prefs->webgl2_enabled = false;
}
web_prefs->allow_running_insecure_content =
prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent);
#if defined(OS_ANDROID)
web_prefs->font_scale_factor =
static_cast<float>(prefs->GetDouble(prefs::kWebKitFontScaleFactor));
web_prefs->device_scale_adjustment = GetDeviceScaleAdjustment();
web_prefs->force_enable_zoom =
prefs->GetBoolean(prefs::kWebKitForceEnableZoom);
#endif
#if defined(OS_ANDROID)
web_prefs->password_echo_enabled =
prefs->GetBoolean(prefs::kWebKitPasswordEchoEnabled);
#else
web_prefs->password_echo_enabled = browser_defaults::kPasswordEchoEnabled;
#endif
web_prefs->text_areas_are_resizable =
prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable);
web_prefs->hyperlink_auditing_enabled =
prefs->GetBoolean(prefs::kEnableHyperlinkAuditing);
#if BUILDFLAG(ENABLE_EXTENSIONS)
std::string image_animation_policy =
prefs->GetString(prefs::kAnimationPolicy);
if (image_animation_policy == kAnimationPolicyOnce)
web_prefs->animation_policy =
content::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE;
else if (image_animation_policy == kAnimationPolicyNone)
web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_NO_ANIMATION;
else
web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_ALLOWED;
#endif
web_prefs->default_encoding =
base::GetCanonicalEncodingNameByAliasName(web_prefs->default_encoding);
if (web_prefs->default_encoding.empty()) {
prefs->ClearPref(prefs::kDefaultCharset);
web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset);
}
DCHECK(!web_prefs->default_encoding.empty());
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePotentiallyAnnoyingSecurityFeatures)) {
web_prefs->disable_reading_from_canvas = true;
web_prefs->strict_mixed_content_checking = true;
web_prefs->strict_powerful_feature_restrictions = true;
}
web_prefs->data_saver_enabled = GetDataSaverEnabledPref(prefs);
web_prefs->data_saver_holdback_web_api_enabled =
base::GetFieldTrialParamByFeatureAsBool(features::kDataSaverHoldback,
"holdback_web", false);
web_prefs->data_saver_holdback_media_api_enabled =
base::GetFieldTrialParamByFeatureAsBool(features::kDataSaverHoldback,
"holdback_media", true);
content::WebContents* contents =
content::WebContents::FromRenderViewHost(rvh);
if (contents) {
#if defined(OS_ANDROID)
TabAndroid* tab_android = TabAndroid::FromWebContents(contents);
if (tab_android) {
web_prefs->embedded_media_experience_enabled =
tab_android->ShouldEnableEmbeddedMediaExperience();
if (base::FeatureList::IsEnabled(
features::kAllowAutoplayUnmutedInWebappManifestScope)) {
web_prefs->media_playback_gesture_whitelist_scope =
tab_android->GetWebappManifestScope();
}
web_prefs->picture_in_picture_enabled =
tab_android->IsPictureInPictureEnabled();
}
#endif // defined(OS_ANDROID)
#if BUILDFLAG(ENABLE_EXTENSIONS)
Browser* browser = chrome::FindBrowserWithWebContents(contents);
if (browser && browser->hosted_app_controller() &&
browser->hosted_app_controller()->created_for_installed_pwa()) {
web_prefs->strict_mixed_content_checking = true;
}
#endif
web_prefs->immersive_mode_enabled = vr::VrTabHelper::IsInVr(contents);
}
#if defined(OS_ANDROID)
web_prefs->video_fullscreen_detection_enabled = true;
web_prefs->enable_media_download_in_product_help =
base::FeatureList::IsEnabled(
feature_engagement::kIPHMediaDownloadFeature);
#endif // defined(OS_ANDROID)
if (base::FeatureList::IsEnabled(features::kLowPriorityIframes)) {
std::string effective_connection_type_param =
base::GetFieldTrialParamValueByFeature(
features::kLowPriorityIframes,
"max_effective_connection_type_threshold");
base::Optional<net::EffectiveConnectionType> effective_connection_type =
net::GetEffectiveConnectionTypeForName(effective_connection_type_param);
if (effective_connection_type) {
web_prefs->low_priority_iframes_threshold =
effective_connection_type.value();
}
}
if (base::FeatureList::IsEnabled(features::kLazyFrameLoading)) {
const char* param_name =
web_prefs->data_saver_enabled
? "lazy_frame_loading_distance_thresholds_px_by_ect"
: "lazy_frame_loading_distance_thresholds_px_by_ect_with_data_"
"saver_enabled";
base::StringPairs pairs;
base::SplitStringIntoKeyValuePairs(
base::GetFieldTrialParamValueByFeature(features::kLazyFrameLoading,
param_name),
':', ',', &pairs);
for (const auto& pair : pairs) {
base::Optional<net::EffectiveConnectionType> effective_connection_type =
net::GetEffectiveConnectionTypeForName(pair.first);
int value = 0;
if (effective_connection_type && base::StringToInt(pair.second, &value)) {
web_prefs->lazy_frame_loading_distance_thresholds_px
[effective_connection_type.value()] = value;
}
}
}
if (base::FeatureList::IsEnabled(features::kLazyImageLoading)) {
const char* param_name =
web_prefs->data_saver_enabled
? "lazy_image_loading_distance_thresholds_px_by_ect"
: "lazy_image_loading_distance_thresholds_px_by_ect_with_data_"
"saver_enabled";
base::StringPairs pairs;
base::SplitStringIntoKeyValuePairs(
base::GetFieldTrialParamValueByFeature(features::kLazyImageLoading,
param_name),
':', ',', &pairs);
for (const auto& pair : pairs) {
base::Optional<net::EffectiveConnectionType> effective_connection_type =
net::GetEffectiveConnectionTypeForName(pair.first);
int value = 0;
if (effective_connection_type && base::StringToInt(pair.second, &value)) {
web_prefs->lazy_image_loading_distance_thresholds_px
[effective_connection_type.value()] = value;
}
}
}
if (base::FeatureList::IsEnabled(
features::kNetworkQualityEstimatorWebHoldback)) {
std::string effective_connection_type_param =
base::GetFieldTrialParamValueByFeature(
features::kNetworkQualityEstimatorWebHoldback,
"web_effective_connection_type_override");
base::Optional<net::EffectiveConnectionType> effective_connection_type =
net::GetEffectiveConnectionTypeForName(effective_connection_type_param);
DCHECK(effective_connection_type_param.empty() ||
effective_connection_type);
if (effective_connection_type) {
DCHECK_NE(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN,
effective_connection_type.value());
web_prefs->network_quality_estimator_web_holdback =
effective_connection_type.value();
}
}
#if !defined(OS_ANDROID)
if (IsAutoplayAllowedByPolicy(contents, prefs)) {
web_prefs->autoplay_policy =
content::AutoplayPolicy::kNoUserGestureRequired;
} else if (base::FeatureList::IsEnabled(media::kAutoplayDisableSettings) &&
web_prefs->autoplay_policy ==
content::AutoplayPolicy::kDocumentUserActivationRequired) {
web_prefs->autoplay_policy =
UnifiedAutoplayConfig::ShouldBlockAutoplay(profile)
? content::AutoplayPolicy::kDocumentUserActivationRequired
: content::AutoplayPolicy::kNoUserGestureRequired;
}
#endif // !defined(OS_ANDROID)
web_prefs->translate_service_available = TranslateService::IsAvailable(prefs);
for (size_t i = 0; i < extra_parts_.size(); ++i)
extra_parts_[i]->OverrideWebkitPrefs(rvh, web_prefs);
}
| 8,939 |
74,074 | 0 | static int commit_super_block(const struct exfat* ef)
{
if (exfat_pwrite(ef->dev, ef->sb, sizeof(struct exfat_super_block), 0) < 0)
{
exfat_error("failed to write super block");
return 1;
}
return exfat_fsync(ef->dev);
}
| 8,940 |
145,267 | 0 | int32_t GetCallbackId() {
static int32_t sCallId = 0;
return ++sCallId;
}
| 8,941 |
163,528 | 0 | bool PushMessagingServiceImpl::SupportNonVisibleMessages() {
return false;
}
| 8,942 |
103,696 | 0 | void DevToolsAgent::OnDispatchOnInspectorBackend(const std::string& message) {
WebDevToolsAgent* web_agent = GetWebAgent();
if (web_agent)
web_agent->dispatchOnInspectorBackend(WebString::fromUTF8(message));
}
| 8,943 |
176,598 | 0 | xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error,
const char *msg,
const xmlChar * info1, const xmlChar * info2,
const xmlChar * info3)
{
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
(ctxt->instate == XML_PARSER_EOF))
return;
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
XML_ERR_ERROR, NULL, 0, (const char *) info1,
(const char *) info2, (const char *) info3, 0, 0, msg,
info1, info2, info3);
if (ctxt != NULL)
ctxt->nsWellFormed = 0;
}
| 8,944 |
2,076 | 0 | void red_channel_apply_clients(RedChannel *channel, channel_client_callback cb)
{
RingItem *link;
RingItem *next;
RedChannelClient *rcc;
RING_FOREACH_SAFE(link, next, &channel->clients) {
rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
cb(rcc);
}
}
| 8,945 |
5,637 | 0 | copy_attr_error (struct error_context *ctx, char const *fmt, ...)
{
int err = errno;
va_list ap;
/* use verror module to print error message */
va_start (ap, fmt);
verror (0, err, fmt, ap);
va_end (ap);
}
| 8,946 |
59,495 | 0 | xmlParseGetLasts(xmlParserCtxtPtr ctxt, const xmlChar **lastlt,
const xmlChar **lastgt) {
const xmlChar *tmp;
if ((ctxt == NULL) || (lastlt == NULL) || (lastgt == NULL)) {
xmlGenericError(xmlGenericErrorContext,
"Internal error: xmlParseGetLasts\n");
return;
}
if ((ctxt->progressive != 0) && (ctxt->inputNr == 1)) {
tmp = ctxt->input->end;
tmp--;
while ((tmp >= ctxt->input->base) && (*tmp != '<')) tmp--;
if (tmp < ctxt->input->base) {
*lastlt = NULL;
*lastgt = NULL;
} else {
*lastlt = tmp;
tmp++;
while ((tmp < ctxt->input->end) && (*tmp != '>')) {
if (*tmp == '\'') {
tmp++;
while ((tmp < ctxt->input->end) && (*tmp != '\'')) tmp++;
if (tmp < ctxt->input->end) tmp++;
} else if (*tmp == '"') {
tmp++;
while ((tmp < ctxt->input->end) && (*tmp != '"')) tmp++;
if (tmp < ctxt->input->end) tmp++;
} else
tmp++;
}
if (tmp < ctxt->input->end)
*lastgt = tmp;
else {
tmp = *lastlt;
tmp--;
while ((tmp >= ctxt->input->base) && (*tmp != '>')) tmp--;
if (tmp >= ctxt->input->base)
*lastgt = tmp;
else
*lastgt = NULL;
}
}
} else {
*lastlt = NULL;
*lastgt = NULL;
}
}
| 8,947 |
21,019 | 0 | static void drain_all_stock(struct mem_cgroup *root_memcg, bool sync)
{
int cpu, curcpu;
/* Notify other cpus that system-wide "drain" is running */
get_online_cpus();
curcpu = get_cpu();
for_each_online_cpu(cpu) {
struct memcg_stock_pcp *stock = &per_cpu(memcg_stock, cpu);
struct mem_cgroup *memcg;
memcg = stock->cached;
if (!memcg || !stock->nr_pages)
continue;
if (!mem_cgroup_same_or_subtree(root_memcg, memcg))
continue;
if (!test_and_set_bit(FLUSHING_CACHED_CHARGE, &stock->flags)) {
if (cpu == curcpu)
drain_local_stock(&stock->work);
else
schedule_work_on(cpu, &stock->work);
}
}
put_cpu();
if (!sync)
goto out;
for_each_online_cpu(cpu) {
struct memcg_stock_pcp *stock = &per_cpu(memcg_stock, cpu);
if (test_bit(FLUSHING_CACHED_CHARGE, &stock->flags))
flush_work(&stock->work);
}
out:
put_online_cpus();
}
| 8,948 |
136,255 | 0 | uint8_t CSPSourceList::hashAlgorithmsUsed() const
{
return m_hashAlgorithmsUsed;
}
| 8,949 |
71,852 | 0 | static unsigned LoadWPG2Flags(Image *image,char Precision,float *Angle,tCTM *CTM)
{
const unsigned char TPR=1,TRN=2,SKW=4,SCL=8,ROT=0x10,OID=0x20,LCK=0x80;
ssize_t x;
unsigned DenX;
unsigned Flags;
(void) memset(*CTM,0,sizeof(*CTM)); /*CTM.erase();CTM.resize(3,3);*/
(*CTM)[0][0]=1;
(*CTM)[1][1]=1;
(*CTM)[2][2]=1;
Flags=ReadBlobLSBShort(image);
if(Flags & LCK) x=ReadBlobLSBLong(image); /*Edit lock*/
if(Flags & OID)
{
if(Precision==0)
{x=ReadBlobLSBShort(image);} /*ObjectID*/
else
{x=ReadBlobLSBLong(image);} /*ObjectID (Double precision)*/
}
if(Flags & ROT)
{
x=ReadBlobLSBLong(image); /*Rot Angle*/
if(Angle) *Angle=x/65536.0;
}
if(Flags & (ROT|SCL))
{
x=ReadBlobLSBLong(image); /*Sx*cos()*/
(*CTM)[0][0] = (float)x/0x10000;
x=ReadBlobLSBLong(image); /*Sy*cos()*/
(*CTM)[1][1] = (float)x/0x10000;
}
if(Flags & (ROT|SKW))
{
x=ReadBlobLSBLong(image); /*Kx*sin()*/
(*CTM)[1][0] = (float)x/0x10000;
x=ReadBlobLSBLong(image); /*Ky*sin()*/
(*CTM)[0][1] = (float)x/0x10000;
}
if(Flags & TRN)
{
x=ReadBlobLSBLong(image); DenX=ReadBlobLSBShort(image); /*Tx*/
if(x>=0) (*CTM)[0][2] = (float)x+(float)DenX/0x10000;
else (*CTM)[0][2] = (float)x-(float)DenX/0x10000;
x=ReadBlobLSBLong(image); DenX=ReadBlobLSBShort(image); /*Ty*/
(*CTM)[1][2]=(float)x + ((x>=0)?1:-1)*(float)DenX/0x10000;
if(x>=0) (*CTM)[1][2] = (float)x+(float)DenX/0x10000;
else (*CTM)[1][2] = (float)x-(float)DenX/0x10000;
}
if(Flags & TPR)
{
x=ReadBlobLSBShort(image); DenX=ReadBlobLSBShort(image); /*Px*/
(*CTM)[2][0] = x + (float)DenX/0x10000;;
x=ReadBlobLSBShort(image); DenX=ReadBlobLSBShort(image); /*Py*/
(*CTM)[2][1] = x + (float)DenX/0x10000;
}
return(Flags);
}
| 8,950 |
41,532 | 0 | static int __init inet_init(void)
{
struct inet_protosw *q;
struct list_head *r;
int rc = -EINVAL;
sock_skb_cb_check_size(sizeof(struct inet_skb_parm));
rc = proto_register(&tcp_prot, 1);
if (rc)
goto out;
rc = proto_register(&udp_prot, 1);
if (rc)
goto out_unregister_tcp_proto;
rc = proto_register(&raw_prot, 1);
if (rc)
goto out_unregister_udp_proto;
rc = proto_register(&ping_prot, 1);
if (rc)
goto out_unregister_raw_proto;
/*
* Tell SOCKET that we are alive...
*/
(void)sock_register(&inet_family_ops);
#ifdef CONFIG_SYSCTL
ip_static_sysctl_init();
#endif
/*
* Add all the base protocols.
*/
if (inet_add_protocol(&icmp_protocol, IPPROTO_ICMP) < 0)
pr_crit("%s: Cannot add ICMP protocol\n", __func__);
if (inet_add_protocol(&udp_protocol, IPPROTO_UDP) < 0)
pr_crit("%s: Cannot add UDP protocol\n", __func__);
if (inet_add_protocol(&tcp_protocol, IPPROTO_TCP) < 0)
pr_crit("%s: Cannot add TCP protocol\n", __func__);
#ifdef CONFIG_IP_MULTICAST
if (inet_add_protocol(&igmp_protocol, IPPROTO_IGMP) < 0)
pr_crit("%s: Cannot add IGMP protocol\n", __func__);
#endif
/* Register the socket-side information for inet_create. */
for (r = &inetsw[0]; r < &inetsw[SOCK_MAX]; ++r)
INIT_LIST_HEAD(r);
for (q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q)
inet_register_protosw(q);
/*
* Set the ARP module up
*/
arp_init();
/*
* Set the IP module up
*/
ip_init();
tcp_v4_init();
/* Setup TCP slab cache for open requests. */
tcp_init();
/* Setup UDP memory threshold */
udp_init();
/* Add UDP-Lite (RFC 3828) */
udplite4_register();
ping_init();
/*
* Set the ICMP layer up
*/
if (icmp_init() < 0)
panic("Failed to create the ICMP control socket.\n");
/*
* Initialise the multicast router
*/
#if defined(CONFIG_IP_MROUTE)
if (ip_mr_init())
pr_crit("%s: Cannot init ipv4 mroute\n", __func__);
#endif
if (init_inet_pernet_ops())
pr_crit("%s: Cannot init ipv4 inet pernet ops\n", __func__);
/*
* Initialise per-cpu ipv4 mibs
*/
if (init_ipv4_mibs())
pr_crit("%s: Cannot init ipv4 mibs\n", __func__);
ipv4_proc_init();
ipfrag_init();
dev_add_pack(&ip_packet_type);
ip_tunnel_core_init();
rc = 0;
out:
return rc;
out_unregister_raw_proto:
proto_unregister(&raw_prot);
out_unregister_udp_proto:
proto_unregister(&udp_prot);
out_unregister_tcp_proto:
proto_unregister(&tcp_prot);
goto out;
}
| 8,951 |
52,061 | 0 | static int __tipc_add_link_prop(struct sk_buff *skb,
struct tipc_nl_compat_msg *msg,
struct tipc_link_config *lc)
{
switch (msg->cmd) {
case TIPC_CMD_SET_LINK_PRI:
return nla_put_u32(skb, TIPC_NLA_PROP_PRIO, ntohl(lc->value));
case TIPC_CMD_SET_LINK_TOL:
return nla_put_u32(skb, TIPC_NLA_PROP_TOL, ntohl(lc->value));
case TIPC_CMD_SET_LINK_WINDOW:
return nla_put_u32(skb, TIPC_NLA_PROP_WIN, ntohl(lc->value));
}
return -EINVAL;
}
| 8,952 |
169,381 | 0 | bool TestNavigationManager::WaitForRequestStart() {
DCHECK(desired_state_ == NavigationState::STARTED);
return WaitForDesiredState();
}
| 8,953 |
7,609 | 0 | static void cirrus_vga_write_cr(CirrusVGAState * s, int reg_value)
{
switch (s->vga.cr_index) {
case 0x00: // Standard VGA
case 0x01: // Standard VGA
case 0x02: // Standard VGA
case 0x03: // Standard VGA
case 0x04: // Standard VGA
case 0x05: // Standard VGA
case 0x06: // Standard VGA
case 0x07: // Standard VGA
case 0x08: // Standard VGA
case 0x09: // Standard VGA
case 0x0a: // Standard VGA
case 0x0b: // Standard VGA
case 0x0c: // Standard VGA
case 0x0d: // Standard VGA
case 0x0e: // Standard VGA
case 0x0f: // Standard VGA
case 0x10: // Standard VGA
case 0x11: // Standard VGA
case 0x12: // Standard VGA
case 0x13: // Standard VGA
case 0x14: // Standard VGA
case 0x15: // Standard VGA
case 0x16: // Standard VGA
case 0x17: // Standard VGA
case 0x18: // Standard VGA
/* handle CR0-7 protection */
if ((s->vga.cr[0x11] & 0x80) && s->vga.cr_index <= 7) {
/* can always write bit 4 of CR7 */
if (s->vga.cr_index == 7)
s->vga.cr[7] = (s->vga.cr[7] & ~0x10) | (reg_value & 0x10);
return;
}
s->vga.cr[s->vga.cr_index] = reg_value;
switch(s->vga.cr_index) {
case 0x00:
case 0x04:
case 0x05:
case 0x06:
case 0x07:
case 0x11:
case 0x17:
s->vga.update_retrace_info(&s->vga);
break;
}
break;
case 0x19: // Interlace End
case 0x1a: // Miscellaneous Control
case 0x1b: // Extended Display Control
case 0x1c: // Sync Adjust and Genlock
case 0x1d: // Overlay Extended Control
s->vga.cr[s->vga.cr_index] = reg_value;
#ifdef DEBUG_CIRRUS
printf("cirrus: handled outport cr_index %02x, cr_value %02x\n",
s->vga.cr_index, reg_value);
#endif
break;
case 0x22: // Graphics Data Latches Readback (R)
case 0x24: // Attribute Controller Toggle Readback (R)
case 0x26: // Attribute Controller Index Readback (R)
case 0x27: // Part ID (R)
break;
case 0x25: // Part Status
default:
#ifdef DEBUG_CIRRUS
printf("cirrus: outport cr_index %02x, cr_value %02x\n",
s->vga.cr_index, reg_value);
#endif
break;
}
}
| 8,954 |
77,375 | 0 | ofproto_set_aa(struct ofproto *ofproto, void *aux OVS_UNUSED,
const struct aa_settings *s)
{
if (!ofproto->ofproto_class->set_aa) {
return EOPNOTSUPP;
}
ofproto->ofproto_class->set_aa(ofproto, s);
return 0;
}
| 8,955 |
135,506 | 0 | void JNI_OfflinePageDownloadBridge_StartDownload(
JNIEnv* env,
const JavaParamRef<jclass>& clazz,
const JavaParamRef<jobject>& j_tab,
const JavaParamRef<jstring>& j_origin) {
TabAndroid* tab = TabAndroid::GetNativeTab(env, j_tab);
if (!tab)
return;
content::WebContents* web_contents = tab->web_contents();
if (!web_contents)
return;
std::string origin = ConvertJavaStringToUTF8(env, j_origin);
ScopedJavaGlobalRef<jobject> j_tab_ref(env, j_tab);
content::ResourceRequestInfo::WebContentsGetter web_contents_getter =
GetWebContentsGetter(web_contents);
DownloadControllerBase::Get()->AcquireFileAccessPermission(
web_contents_getter,
base::Bind(&OnOfflinePageAcquireFileAccessPermissionDone,
web_contents_getter, j_tab_ref, origin));
}
| 8,956 |
86,232 | 0 | static int i8042_pm_thaw(struct device *dev)
{
i8042_interrupt(0, NULL);
return 0;
}
| 8,957 |
118,580 | 0 | AppLauncherHandler::AppLauncherHandler(ExtensionService* extension_service)
: extension_service_(extension_service),
ignore_changes_(false),
attempted_bookmark_app_install_(false),
has_loaded_apps_(false) {
if (IsAppLauncherEnabled())
RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_ALREADY_INSTALLED);
else if (ShouldShowAppLauncherPromo())
RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_SHOWN);
}
| 8,958 |
151,036 | 0 | void DevToolsUIBindings::SetIsDocked(const DispatchCallback& callback,
bool dock_requested) {
delegate_->SetIsDocked(dock_requested);
callback.Run(nullptr);
}
| 8,959 |
180,508 | 1 | static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, unsigned int optlen)
{
struct ipv6_pinfo *np = inet6_sk(sk);
struct net *net = sock_net(sk);
int val, valbool;
int retv = -ENOPROTOOPT;
bool needs_rtnl = setsockopt_needs_rtnl(optname);
if (!optval)
val = 0;
else {
if (optlen >= sizeof(int)) {
if (get_user(val, (int __user *) optval))
return -EFAULT;
} else
val = 0;
}
valbool = (val != 0);
if (ip6_mroute_opt(optname))
return ip6_mroute_setsockopt(sk, optname, optval, optlen);
if (needs_rtnl)
rtnl_lock();
lock_sock(sk);
switch (optname) {
case IPV6_ADDRFORM:
if (optlen < sizeof(int))
goto e_inval;
if (val == PF_INET) {
struct ipv6_txoptions *opt;
struct sk_buff *pktopt;
if (sk->sk_type == SOCK_RAW)
break;
if (sk->sk_protocol == IPPROTO_UDP ||
sk->sk_protocol == IPPROTO_UDPLITE) {
struct udp_sock *up = udp_sk(sk);
if (up->pending == AF_INET6) {
retv = -EBUSY;
break;
}
} else if (sk->sk_protocol != IPPROTO_TCP)
break;
if (sk->sk_state != TCP_ESTABLISHED) {
retv = -ENOTCONN;
break;
}
if (ipv6_only_sock(sk) ||
!ipv6_addr_v4mapped(&sk->sk_v6_daddr)) {
retv = -EADDRNOTAVAIL;
break;
}
fl6_free_socklist(sk);
ipv6_sock_mc_close(sk);
/*
* Sock is moving from IPv6 to IPv4 (sk_prot), so
* remove it from the refcnt debug socks count in the
* original family...
*/
sk_refcnt_debug_dec(sk);
if (sk->sk_protocol == IPPROTO_TCP) {
struct inet_connection_sock *icsk = inet_csk(sk);
local_bh_disable();
sock_prot_inuse_add(net, sk->sk_prot, -1);
sock_prot_inuse_add(net, &tcp_prot, 1);
local_bh_enable();
sk->sk_prot = &tcp_prot;
icsk->icsk_af_ops = &ipv4_specific;
sk->sk_socket->ops = &inet_stream_ops;
sk->sk_family = PF_INET;
tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
} else {
struct proto *prot = &udp_prot;
if (sk->sk_protocol == IPPROTO_UDPLITE)
prot = &udplite_prot;
local_bh_disable();
sock_prot_inuse_add(net, sk->sk_prot, -1);
sock_prot_inuse_add(net, prot, 1);
local_bh_enable();
sk->sk_prot = prot;
sk->sk_socket->ops = &inet_dgram_ops;
sk->sk_family = PF_INET;
}
opt = xchg(&np->opt, NULL);
if (opt)
sock_kfree_s(sk, opt, opt->tot_len);
pktopt = xchg(&np->pktoptions, NULL);
kfree_skb(pktopt);
sk->sk_destruct = inet_sock_destruct;
/*
* ... and add it to the refcnt debug socks count
* in the new family. -acme
*/
sk_refcnt_debug_inc(sk);
module_put(THIS_MODULE);
retv = 0;
break;
}
goto e_inval;
case IPV6_V6ONLY:
if (optlen < sizeof(int) ||
inet_sk(sk)->inet_num)
goto e_inval;
sk->sk_ipv6only = valbool;
retv = 0;
break;
case IPV6_RECVPKTINFO:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.rxinfo = valbool;
retv = 0;
break;
case IPV6_2292PKTINFO:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.rxoinfo = valbool;
retv = 0;
break;
case IPV6_RECVHOPLIMIT:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.rxhlim = valbool;
retv = 0;
break;
case IPV6_2292HOPLIMIT:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.rxohlim = valbool;
retv = 0;
break;
case IPV6_RECVRTHDR:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.srcrt = valbool;
retv = 0;
break;
case IPV6_2292RTHDR:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.osrcrt = valbool;
retv = 0;
break;
case IPV6_RECVHOPOPTS:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.hopopts = valbool;
retv = 0;
break;
case IPV6_2292HOPOPTS:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.ohopopts = valbool;
retv = 0;
break;
case IPV6_RECVDSTOPTS:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.dstopts = valbool;
retv = 0;
break;
case IPV6_2292DSTOPTS:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.odstopts = valbool;
retv = 0;
break;
case IPV6_TCLASS:
if (optlen < sizeof(int))
goto e_inval;
if (val < -1 || val > 0xff)
goto e_inval;
/* RFC 3542, 6.5: default traffic class of 0x0 */
if (val == -1)
val = 0;
np->tclass = val;
retv = 0;
break;
case IPV6_RECVTCLASS:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.rxtclass = valbool;
retv = 0;
break;
case IPV6_FLOWINFO:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.rxflow = valbool;
retv = 0;
break;
case IPV6_RECVPATHMTU:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.rxpmtu = valbool;
retv = 0;
break;
case IPV6_TRANSPARENT:
if (valbool && !ns_capable(net->user_ns, CAP_NET_ADMIN) &&
!ns_capable(net->user_ns, CAP_NET_RAW)) {
retv = -EPERM;
break;
}
if (optlen < sizeof(int))
goto e_inval;
/* we don't have a separate transparent bit for IPV6 we use the one in the IPv4 socket */
inet_sk(sk)->transparent = valbool;
retv = 0;
break;
case IPV6_RECVORIGDSTADDR:
if (optlen < sizeof(int))
goto e_inval;
np->rxopt.bits.rxorigdstaddr = valbool;
retv = 0;
break;
case IPV6_HOPOPTS:
case IPV6_RTHDRDSTOPTS:
case IPV6_RTHDR:
case IPV6_DSTOPTS:
{
struct ipv6_txoptions *opt;
/* remove any sticky options header with a zero option
* length, per RFC3542.
*/
if (optlen == 0)
optval = NULL;
else if (!optval)
goto e_inval;
else if (optlen < sizeof(struct ipv6_opt_hdr) ||
optlen & 0x7 || optlen > 8 * 255)
goto e_inval;
/* hop-by-hop / destination options are privileged option */
retv = -EPERM;
if (optname != IPV6_RTHDR && !ns_capable(net->user_ns, CAP_NET_RAW))
break;
opt = ipv6_renew_options(sk, np->opt, optname,
(struct ipv6_opt_hdr __user *)optval,
optlen);
if (IS_ERR(opt)) {
retv = PTR_ERR(opt);
break;
}
/* routing header option needs extra check */
retv = -EINVAL;
if (optname == IPV6_RTHDR && opt && opt->srcrt) {
struct ipv6_rt_hdr *rthdr = opt->srcrt;
switch (rthdr->type) {
#if IS_ENABLED(CONFIG_IPV6_MIP6)
case IPV6_SRCRT_TYPE_2:
if (rthdr->hdrlen != 2 ||
rthdr->segments_left != 1)
goto sticky_done;
break;
#endif
default:
goto sticky_done;
}
}
retv = 0;
opt = ipv6_update_options(sk, opt);
sticky_done:
if (opt)
sock_kfree_s(sk, opt, opt->tot_len);
break;
}
case IPV6_PKTINFO:
{
struct in6_pktinfo pkt;
if (optlen == 0)
goto e_inval;
else if (optlen < sizeof(struct in6_pktinfo) || !optval)
goto e_inval;
if (copy_from_user(&pkt, optval, sizeof(struct in6_pktinfo))) {
retv = -EFAULT;
break;
}
if (sk->sk_bound_dev_if && pkt.ipi6_ifindex != sk->sk_bound_dev_if)
goto e_inval;
np->sticky_pktinfo.ipi6_ifindex = pkt.ipi6_ifindex;
np->sticky_pktinfo.ipi6_addr = pkt.ipi6_addr;
retv = 0;
break;
}
case IPV6_2292PKTOPTIONS:
{
struct ipv6_txoptions *opt = NULL;
struct msghdr msg;
struct flowi6 fl6;
int junk;
memset(&fl6, 0, sizeof(fl6));
fl6.flowi6_oif = sk->sk_bound_dev_if;
fl6.flowi6_mark = sk->sk_mark;
if (optlen == 0)
goto update;
/* 1K is probably excessive
* 1K is surely not enough, 2K per standard header is 16K.
*/
retv = -EINVAL;
if (optlen > 64*1024)
break;
opt = sock_kmalloc(sk, sizeof(*opt) + optlen, GFP_KERNEL);
retv = -ENOBUFS;
if (!opt)
break;
memset(opt, 0, sizeof(*opt));
opt->tot_len = sizeof(*opt) + optlen;
retv = -EFAULT;
if (copy_from_user(opt+1, optval, optlen))
goto done;
msg.msg_controllen = optlen;
msg.msg_control = (void *)(opt+1);
retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk,
&junk, &junk);
if (retv)
goto done;
update:
retv = 0;
opt = ipv6_update_options(sk, opt);
done:
if (opt)
sock_kfree_s(sk, opt, opt->tot_len);
break;
}
case IPV6_UNICAST_HOPS:
if (optlen < sizeof(int))
goto e_inval;
if (val > 255 || val < -1)
goto e_inval;
np->hop_limit = val;
retv = 0;
break;
case IPV6_MULTICAST_HOPS:
if (sk->sk_type == SOCK_STREAM)
break;
if (optlen < sizeof(int))
goto e_inval;
if (val > 255 || val < -1)
goto e_inval;
np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val);
retv = 0;
break;
case IPV6_MULTICAST_LOOP:
if (optlen < sizeof(int))
goto e_inval;
if (val != valbool)
goto e_inval;
np->mc_loop = valbool;
retv = 0;
break;
case IPV6_UNICAST_IF:
{
struct net_device *dev = NULL;
int ifindex;
if (optlen != sizeof(int))
goto e_inval;
ifindex = (__force int)ntohl((__force __be32)val);
if (ifindex == 0) {
np->ucast_oif = 0;
retv = 0;
break;
}
dev = dev_get_by_index(net, ifindex);
retv = -EADDRNOTAVAIL;
if (!dev)
break;
dev_put(dev);
retv = -EINVAL;
if (sk->sk_bound_dev_if)
break;
np->ucast_oif = ifindex;
retv = 0;
break;
}
case IPV6_MULTICAST_IF:
if (sk->sk_type == SOCK_STREAM)
break;
if (optlen < sizeof(int))
goto e_inval;
if (val) {
struct net_device *dev;
if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != val)
goto e_inval;
dev = dev_get_by_index(net, val);
if (!dev) {
retv = -ENODEV;
break;
}
dev_put(dev);
}
np->mcast_oif = val;
retv = 0;
break;
case IPV6_ADD_MEMBERSHIP:
case IPV6_DROP_MEMBERSHIP:
{
struct ipv6_mreq mreq;
if (optlen < sizeof(struct ipv6_mreq))
goto e_inval;
retv = -EPROTO;
if (inet_sk(sk)->is_icsk)
break;
retv = -EFAULT;
if (copy_from_user(&mreq, optval, sizeof(struct ipv6_mreq)))
break;
if (optname == IPV6_ADD_MEMBERSHIP)
retv = ipv6_sock_mc_join(sk, mreq.ipv6mr_ifindex, &mreq.ipv6mr_multiaddr);
else
retv = ipv6_sock_mc_drop(sk, mreq.ipv6mr_ifindex, &mreq.ipv6mr_multiaddr);
break;
}
case IPV6_JOIN_ANYCAST:
case IPV6_LEAVE_ANYCAST:
{
struct ipv6_mreq mreq;
if (optlen < sizeof(struct ipv6_mreq))
goto e_inval;
retv = -EFAULT;
if (copy_from_user(&mreq, optval, sizeof(struct ipv6_mreq)))
break;
if (optname == IPV6_JOIN_ANYCAST)
retv = ipv6_sock_ac_join(sk, mreq.ipv6mr_ifindex, &mreq.ipv6mr_acaddr);
else
retv = ipv6_sock_ac_drop(sk, mreq.ipv6mr_ifindex, &mreq.ipv6mr_acaddr);
break;
}
case MCAST_JOIN_GROUP:
case MCAST_LEAVE_GROUP:
{
struct group_req greq;
struct sockaddr_in6 *psin6;
if (optlen < sizeof(struct group_req))
goto e_inval;
retv = -EFAULT;
if (copy_from_user(&greq, optval, sizeof(struct group_req)))
break;
if (greq.gr_group.ss_family != AF_INET6) {
retv = -EADDRNOTAVAIL;
break;
}
psin6 = (struct sockaddr_in6 *)&greq.gr_group;
if (optname == MCAST_JOIN_GROUP)
retv = ipv6_sock_mc_join(sk, greq.gr_interface,
&psin6->sin6_addr);
else
retv = ipv6_sock_mc_drop(sk, greq.gr_interface,
&psin6->sin6_addr);
break;
}
case MCAST_JOIN_SOURCE_GROUP:
case MCAST_LEAVE_SOURCE_GROUP:
case MCAST_BLOCK_SOURCE:
case MCAST_UNBLOCK_SOURCE:
{
struct group_source_req greqs;
int omode, add;
if (optlen < sizeof(struct group_source_req))
goto e_inval;
if (copy_from_user(&greqs, optval, sizeof(greqs))) {
retv = -EFAULT;
break;
}
if (greqs.gsr_group.ss_family != AF_INET6 ||
greqs.gsr_source.ss_family != AF_INET6) {
retv = -EADDRNOTAVAIL;
break;
}
if (optname == MCAST_BLOCK_SOURCE) {
omode = MCAST_EXCLUDE;
add = 1;
} else if (optname == MCAST_UNBLOCK_SOURCE) {
omode = MCAST_EXCLUDE;
add = 0;
} else if (optname == MCAST_JOIN_SOURCE_GROUP) {
struct sockaddr_in6 *psin6;
psin6 = (struct sockaddr_in6 *)&greqs.gsr_group;
retv = ipv6_sock_mc_join(sk, greqs.gsr_interface,
&psin6->sin6_addr);
/* prior join w/ different source is ok */
if (retv && retv != -EADDRINUSE)
break;
omode = MCAST_INCLUDE;
add = 1;
} else /* MCAST_LEAVE_SOURCE_GROUP */ {
omode = MCAST_INCLUDE;
add = 0;
}
retv = ip6_mc_source(add, omode, sk, &greqs);
break;
}
case MCAST_MSFILTER:
{
struct group_filter *gsf;
if (optlen < GROUP_FILTER_SIZE(0))
goto e_inval;
if (optlen > sysctl_optmem_max) {
retv = -ENOBUFS;
break;
}
gsf = kmalloc(optlen, GFP_KERNEL);
if (!gsf) {
retv = -ENOBUFS;
break;
}
retv = -EFAULT;
if (copy_from_user(gsf, optval, optlen)) {
kfree(gsf);
break;
}
/* numsrc >= (4G-140)/128 overflow in 32 bits */
if (gsf->gf_numsrc >= 0x1ffffffU ||
gsf->gf_numsrc > sysctl_mld_max_msf) {
kfree(gsf);
retv = -ENOBUFS;
break;
}
if (GROUP_FILTER_SIZE(gsf->gf_numsrc) > optlen) {
kfree(gsf);
retv = -EINVAL;
break;
}
retv = ip6_mc_msfilter(sk, gsf);
kfree(gsf);
break;
}
case IPV6_ROUTER_ALERT:
if (optlen < sizeof(int))
goto e_inval;
retv = ip6_ra_control(sk, val);
break;
case IPV6_MTU_DISCOVER:
if (optlen < sizeof(int))
goto e_inval;
if (val < IPV6_PMTUDISC_DONT || val > IPV6_PMTUDISC_OMIT)
goto e_inval;
np->pmtudisc = val;
retv = 0;
break;
case IPV6_MTU:
if (optlen < sizeof(int))
goto e_inval;
if (val && val < IPV6_MIN_MTU)
goto e_inval;
np->frag_size = val;
retv = 0;
break;
case IPV6_RECVERR:
if (optlen < sizeof(int))
goto e_inval;
np->recverr = valbool;
if (!val)
skb_queue_purge(&sk->sk_error_queue);
retv = 0;
break;
case IPV6_FLOWINFO_SEND:
if (optlen < sizeof(int))
goto e_inval;
np->sndflow = valbool;
retv = 0;
break;
case IPV6_FLOWLABEL_MGR:
retv = ipv6_flowlabel_opt(sk, optval, optlen);
break;
case IPV6_IPSEC_POLICY:
case IPV6_XFRM_POLICY:
retv = -EPERM;
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
break;
retv = xfrm_user_policy(sk, optname, optval, optlen);
break;
case IPV6_ADDR_PREFERENCES:
{
unsigned int pref = 0;
unsigned int prefmask = ~0;
if (optlen < sizeof(int))
goto e_inval;
retv = -EINVAL;
/* check PUBLIC/TMP/PUBTMP_DEFAULT conflicts */
switch (val & (IPV6_PREFER_SRC_PUBLIC|
IPV6_PREFER_SRC_TMP|
IPV6_PREFER_SRC_PUBTMP_DEFAULT)) {
case IPV6_PREFER_SRC_PUBLIC:
pref |= IPV6_PREFER_SRC_PUBLIC;
break;
case IPV6_PREFER_SRC_TMP:
pref |= IPV6_PREFER_SRC_TMP;
break;
case IPV6_PREFER_SRC_PUBTMP_DEFAULT:
break;
case 0:
goto pref_skip_pubtmp;
default:
goto e_inval;
}
prefmask &= ~(IPV6_PREFER_SRC_PUBLIC|
IPV6_PREFER_SRC_TMP);
pref_skip_pubtmp:
/* check HOME/COA conflicts */
switch (val & (IPV6_PREFER_SRC_HOME|IPV6_PREFER_SRC_COA)) {
case IPV6_PREFER_SRC_HOME:
break;
case IPV6_PREFER_SRC_COA:
pref |= IPV6_PREFER_SRC_COA;
case 0:
goto pref_skip_coa;
default:
goto e_inval;
}
prefmask &= ~IPV6_PREFER_SRC_COA;
pref_skip_coa:
/* check CGA/NONCGA conflicts */
switch (val & (IPV6_PREFER_SRC_CGA|IPV6_PREFER_SRC_NONCGA)) {
case IPV6_PREFER_SRC_CGA:
case IPV6_PREFER_SRC_NONCGA:
case 0:
break;
default:
goto e_inval;
}
np->srcprefs = (np->srcprefs & prefmask) | pref;
retv = 0;
break;
}
case IPV6_MINHOPCOUNT:
if (optlen < sizeof(int))
goto e_inval;
if (val < 0 || val > 255)
goto e_inval;
np->min_hopcount = val;
retv = 0;
break;
case IPV6_DONTFRAG:
np->dontfrag = valbool;
retv = 0;
break;
case IPV6_AUTOFLOWLABEL:
np->autoflowlabel = valbool;
retv = 0;
break;
}
release_sock(sk);
if (needs_rtnl)
rtnl_unlock();
return retv;
e_inval:
release_sock(sk);
if (needs_rtnl)
rtnl_unlock();
return -EINVAL;
}
| 8,960 |
134,253 | 0 | base::string16 OmniboxViewViews::GetGrayTextAutocompletion() const {
#if defined(OS_WIN) || defined(USE_AURA)
return location_bar_view_->GetGrayTextAutocompletion();
#else
return base::string16();
#endif
}
| 8,961 |
87,771 | 0 | int mbedtls_ecdsa_write_signature_det( mbedtls_ecdsa_context *ctx,
const unsigned char *hash, size_t hlen,
unsigned char *sig, size_t *slen,
mbedtls_md_type_t md_alg )
{
ECDSA_VALIDATE_RET( ctx != NULL );
ECDSA_VALIDATE_RET( hash != NULL );
ECDSA_VALIDATE_RET( sig != NULL );
ECDSA_VALIDATE_RET( slen != NULL );
return( mbedtls_ecdsa_write_signature( ctx, md_alg, hash, hlen, sig, slen,
NULL, NULL ) );
}
| 8,962 |
146,259 | 0 | IntSize WebGLRenderingContextBase::ClampedCanvasSize() const {
int width = host()->Size().Width();
int height = host()->Size().Height();
return IntSize(Clamp(width, 1, max_viewport_dims_[0]),
Clamp(height, 1, max_viewport_dims_[1]));
}
| 8,963 |
161,418 | 0 | void PushDeliveryNoOp(mojom::PushDeliveryStatus status) {}
| 8,964 |
54,671 | 0 | static int deliver_to_subscribers(struct snd_seq_client *client,
struct snd_seq_event *event,
int atomic, int hop)
{
struct snd_seq_subscribers *subs;
int err, result = 0, num_ev = 0;
struct snd_seq_event event_saved;
struct snd_seq_client_port *src_port;
struct snd_seq_port_subs_info *grp;
src_port = snd_seq_port_use_ptr(client, event->source.port);
if (src_port == NULL)
return -EINVAL; /* invalid source port */
/* save original event record */
event_saved = *event;
grp = &src_port->c_src;
/* lock list */
if (atomic)
read_lock(&grp->list_lock);
else
down_read(&grp->list_mutex);
list_for_each_entry(subs, &grp->list_head, src_list) {
event->dest = subs->info.dest;
if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP)
/* convert time according to flag with subscription */
update_timestamp_of_queue(event, subs->info.queue,
subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIME_REAL);
err = snd_seq_deliver_single_event(client, event,
0, atomic, hop);
if (err < 0) {
/* save first error that occurs and continue */
if (!result)
result = err;
continue;
}
num_ev++;
/* restore original event record */
*event = event_saved;
}
if (atomic)
read_unlock(&grp->list_lock);
else
up_read(&grp->list_mutex);
*event = event_saved; /* restore */
snd_seq_port_unlock(src_port);
return (result < 0) ? result : num_ev;
}
| 8,965 |
46,559 | 0 | void destroy_pid_t(gpointer data) {
g_free(data);
}
| 8,966 |
169,099 | 0 | void OfflinePageModelImpl::SavePage(
const SavePageParams& save_page_params,
std::unique_ptr<OfflinePageArchiver> archiver,
const SavePageCallback& callback) {
DCHECK(is_loaded_);
if (!OfflinePageModel::CanSaveURL(save_page_params.url)) {
InformSavePageDone(callback, SavePageResult::SKIPPED,
save_page_params.client_id, kInvalidOfflineId);
return;
}
if (!archiver.get()) {
InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE,
save_page_params.client_id, kInvalidOfflineId);
return;
}
int64_t offline_id = save_page_params.proposed_offline_id;
if (offline_id == kInvalidOfflineId)
offline_id = GenerateOfflineId();
OfflinePageArchiver::CreateArchiveParams create_archive_params;
create_archive_params.remove_popup_overlay = save_page_params.is_background;
create_archive_params.use_page_problem_detectors =
save_page_params.use_page_problem_detectors;
archiver->CreateArchive(
GetArchiveDirectory(save_page_params.client_id.name_space),
create_archive_params,
base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone,
weak_ptr_factory_.GetWeakPtr(), save_page_params, offline_id,
GetCurrentTime(), callback));
pending_archivers_.push_back(std::move(archiver));
}
| 8,967 |
153,056 | 0 | size_t PDFiumEngine::FindTextIndex::IncrementIndex() {
DCHECK(valid_);
return ++index_;
}
| 8,968 |
108,377 | 0 | void AudioRendererHost::OnNotifyPacketReady(
const IPC::Message& msg, int stream_id, uint32 packet_size) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
AudioEntry* entry = LookupById(msg.routing_id(), stream_id);
if (!entry) {
SendErrorMessage(msg.routing_id(), stream_id);
return;
}
DCHECK(!entry->controller->LowLatencyMode());
CHECK(packet_size <= entry->shared_memory.created_size());
if (!entry->pending_buffer_request) {
NOTREACHED() << "Buffer received but no such pending request";
}
entry->pending_buffer_request = false;
entry->controller->EnqueueData(
reinterpret_cast<uint8*>(entry->shared_memory.memory()),
packet_size);
}
| 8,969 |
166,368 | 0 | bool GLES2Util::ComputeImageDataSizesES3(
int width, int height, int depth, int format, int type,
const PixelStoreParams& params,
uint32_t* size, uint32_t* opt_unpadded_row_size,
uint32_t* opt_padded_row_size, uint32_t* opt_skip_size,
uint32_t* opt_padding) {
DCHECK(width >= 0 && height >= 0 && depth >= 0);
uint32_t bytes_per_group = ComputeImageGroupSize(format, type);
uint32_t unpadded_row_size;
uint32_t padded_row_size;
if (!ComputeImageRowSizeHelper(width, bytes_per_group, params.alignment,
&unpadded_row_size, &padded_row_size,
opt_padding)) {
return false;
}
if (params.row_length > 0 &&
!ComputeImageRowSizeHelper(params.row_length, bytes_per_group,
params.alignment, nullptr, &padded_row_size,
opt_padding)) {
return false;
}
int image_height = params.image_height > 0 ? params.image_height : height;
uint32_t num_of_rows;
if (depth > 0) {
if (!SafeMultiplyUint32(image_height, depth - 1, &num_of_rows) ||
!SafeAddUint32(num_of_rows, height, &num_of_rows)) {
return false;
}
} else {
num_of_rows = 0;
}
if (num_of_rows > 0) {
uint32_t size_of_all_but_last_row;
if (!SafeMultiplyUint32((num_of_rows - 1), padded_row_size,
&size_of_all_but_last_row)) {
return false;
}
if (!SafeAddUint32(size_of_all_but_last_row, unpadded_row_size, size)) {
return false;
}
} else {
*size = 0;
}
uint32_t skip_size = 0;
if (params.skip_images > 0) {
uint32_t image_size;
if (!SafeMultiplyUint32(image_height, padded_row_size, &image_size))
return false;
if (!SafeMultiplyUint32(image_size, params.skip_images, &skip_size))
return false;
}
if (params.skip_rows > 0) {
uint32_t temp;
if (!SafeMultiplyUint32(padded_row_size, params.skip_rows, &temp))
return false;
if (!SafeAddUint32(skip_size, temp, &skip_size))
return false;
}
if (params.skip_pixels > 0) {
uint32_t temp;
if (!SafeMultiplyUint32(bytes_per_group, params.skip_pixels, &temp))
return false;
if (!SafeAddUint32(skip_size, temp, &skip_size))
return false;
}
uint32_t total_size;
if (!SafeAddUint32(*size, skip_size, &total_size))
return false;
if (opt_padded_row_size) {
*opt_padded_row_size = padded_row_size;
}
if (opt_unpadded_row_size) {
*opt_unpadded_row_size = unpadded_row_size;
}
if (opt_skip_size)
*opt_skip_size = skip_size;
return true;
}
| 8,970 |
162,357 | 0 | void MojoAudioOutputStream::Play() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
delegate_->OnPlayStream();
}
| 8,971 |
76,237 | 0 | static int cdrom_ioctl_media_changed(struct cdrom_device_info *cdi,
unsigned long arg)
{
struct cdrom_changer_info *info;
int ret;
cd_dbg(CD_DO_IOCTL, "entering CDROM_MEDIA_CHANGED\n");
if (!CDROM_CAN(CDC_MEDIA_CHANGED))
return -ENOSYS;
/* cannot select disc or select current disc */
if (!CDROM_CAN(CDC_SELECT_DISC) || arg == CDSL_CURRENT)
return media_changed(cdi, 1);
if (arg >= cdi->capacity)
return -EINVAL;
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
ret = cdrom_read_mech_status(cdi, info);
if (!ret)
ret = info->slots[arg].change;
kfree(info);
return ret;
}
| 8,972 |
102,772 | 0 | static PassOwnPtr<CompositorMockWebGraphicsContext3D> create()
{
return adoptPtr(new CompositorMockWebGraphicsContext3D());
}
| 8,973 |
11,785 | 0 | mkfse_data_unref (MkfsLuksData *data)
{
data->refcount--;
if (data->refcount == 0)
{
if (data->passphrase != NULL)
{
memset (data->passphrase, '\0', strlen (data->passphrase));
g_free (data->passphrase);
}
if (data->device != NULL)
g_object_unref (data->device);
g_strfreev (data->options);
g_free (data->fstype);
g_free (data);
}
}
| 8,974 |
60,089 | 0 | static ut64 binobj_get_baddr(RBinObject *o) {
return o? o->baddr + o->baddr_shift: UT64_MAX;
}
| 8,975 |
122,139 | 0 | CompositingReasons RenderLayerCompositor::directReasonsForCompositing(const RenderLayer* layer) const
{
RenderObject* renderer = layer->renderer();
CompositingReasons directReasons = CompositingReasonNone;
if (requiresCompositingForTransform(renderer))
directReasons |= CompositingReason3DTransform;
if (requiresCompositingForVideo(renderer))
directReasons |= CompositingReasonVideo;
else if (requiresCompositingForCanvas(renderer))
directReasons |= CompositingReasonCanvas;
else if (requiresCompositingForPlugin(renderer))
directReasons |= CompositingReasonPlugin;
else if (requiresCompositingForFrame(renderer))
directReasons |= CompositingReasonIFrame;
if (requiresCompositingForBackfaceVisibilityHidden(renderer))
directReasons |= CompositingReasonBackfaceVisibilityHidden;
if (requiresCompositingForAnimation(renderer))
directReasons |= CompositingReasonAnimation;
if (requiresCompositingForTransition(renderer))
directReasons |= CompositingReasonAnimation;
if (requiresCompositingForFilters(renderer))
directReasons |= CompositingReasonFilters;
if (requiresCompositingForPosition(renderer, layer))
directReasons |= renderer->style()->position() == FixedPosition ? CompositingReasonPositionFixed : CompositingReasonPositionSticky;
if (requiresCompositingForOverflowScrolling(layer))
directReasons |= CompositingReasonOverflowScrollingTouch;
if (requiresCompositingForOverflowScrollingParent(layer))
directReasons |= CompositingReasonOverflowScrollingParent;
if (requiresCompositingForOutOfFlowClipping(layer))
directReasons |= CompositingReasonOutOfFlowClipping;
return directReasons;
}
| 8,976 |
54,716 | 0 | static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client,
void __user *arg)
{
struct snd_seq_client_port *port;
struct snd_seq_port_info info;
if (copy_from_user(&info, arg, sizeof(info)))
return -EFAULT;
if (info.addr.client != client->number) /* only set our own ports ! */
return -EPERM;
port = snd_seq_port_use_ptr(client, info.addr.port);
if (port) {
snd_seq_set_port_info(port, &info);
snd_seq_port_unlock(port);
}
return 0;
}
| 8,977 |
111,861 | 0 | void ProfileSyncService::ChangePreferredDataTypes(
syncable::ModelTypeSet preferred_types) {
DVLOG(1) << "ChangePreferredDataTypes invoked";
const syncable::ModelTypeSet registered_types = GetRegisteredDataTypes();
const syncable::ModelTypeSet registered_preferred_types =
Intersection(registered_types, preferred_types);
sync_prefs_.SetPreferredDataTypes(registered_types,
registered_preferred_types);
ReconfigureDatatypeManager();
}
| 8,978 |
158,755 | 0 | bool GLES2DecoderImpl::ValidateUniformBlockBackings(const char* func_name) {
DCHECK(feature_info_->IsWebGL2OrES3Context());
if (!state_.current_program.get())
return true;
int32_t max_index = -1;
for (auto info : state_.current_program->uniform_block_size_info()) {
int32_t index = static_cast<int32_t>(info.binding);
if (index > max_index)
max_index = index;
}
if (max_index < 0)
return true;
std::vector<GLsizeiptr> uniform_block_sizes(max_index + 1);
for (int32_t ii = 0; ii <= max_index; ++ii)
uniform_block_sizes[ii] = 0;
for (auto info : state_.current_program->uniform_block_size_info()) {
uint32_t index = info.binding;
uniform_block_sizes[index] = static_cast<GLsizeiptr>(info.data_size);
}
return buffer_manager()->RequestBuffersAccess(
state_.GetErrorState(), state_.indexed_uniform_buffer_bindings.get(),
uniform_block_sizes, 1, func_name, "uniform buffers");
}
| 8,979 |
145,759 | 0 | ModuleSystem::NativesEnabledScope::~NativesEnabledScope() {
module_system_->natives_enabled_--;
CHECK_GE(module_system_->natives_enabled_, 0);
}
| 8,980 |
8,420 | 0 | pvscsi_msg_ring_put(PVSCSIState *s, struct PVSCSIRingMsgDesc *msg_desc)
{
hwaddr msg_descr_pa;
msg_descr_pa = pvscsi_ring_pop_msg_descr(&s->rings);
trace_pvscsi_msg_ring_put(msg_descr_pa);
cpu_physical_memory_write(msg_descr_pa, (void *)msg_desc,
sizeof(*msg_desc));
}
| 8,981 |
105,640 | 0 | void TreeView::CommitEdit() {
DCHECK(tree_view_);
TreeView_EndEditLabelNow(tree_view_, FALSE);
}
| 8,982 |
35,403 | 0 | int is_valid_bugaddr(unsigned long ip)
{
unsigned short ud2;
if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2)))
return 0;
return ud2 == 0x0b0f;
}
| 8,983 |
129,772 | 0 | void ChildThread::OnGetChildProfilerData(int sequence_number) {
tracked_objects::ProcessDataSnapshot process_data;
ThreadData::Snapshot(false, &process_data);
Send(new ChildProcessHostMsg_ChildProfilerData(sequence_number,
process_data));
}
| 8,984 |
61,125 | 0 | report_delete_progress (CommonJob *job,
SourceInfo *source_info,
TransferInfo *transfer_info)
{
int files_left;
double elapsed, transfer_rate;
int remaining_time;
gint64 now;
char *details;
char *status;
DeleteJob *delete_job;
delete_job = (DeleteJob *) job;
now = g_get_monotonic_time ();
files_left = source_info->num_files - transfer_info->num_files;
/* Races and whatnot could cause this to be negative... */
if (files_left < 0)
{
files_left = 0;
}
/* If the number of files left is 0, we want to update the status without
* considering this time, since we want to change the status to completed
* and probably we won't get more calls to this function */
if (transfer_info->last_report_time != 0 &&
ABS ((gint64) (transfer_info->last_report_time - now)) < 100 * NSEC_PER_MICROSEC &&
files_left > 0)
{
return;
}
transfer_info->last_report_time = now;
if (source_info->num_files == 1)
{
if (files_left == 0)
{
status = _("Deleted “%B”");
}
else
{
status = _("Deleting “%B”");
}
nautilus_progress_info_take_status (job->progress,
f (status,
(GFile *) delete_job->files->data));
}
else
{
if (files_left == 0)
{
status = ngettext ("Deleted %'d file",
"Deleted %'d files",
source_info->num_files);
}
else
{
status = ngettext ("Deleting %'d file",
"Deleting %'d files",
source_info->num_files);
}
nautilus_progress_info_take_status (job->progress,
f (status,
source_info->num_files));
}
elapsed = g_timer_elapsed (job->time, NULL);
transfer_rate = 0;
remaining_time = INT_MAX;
if (elapsed > 0)
{
transfer_rate = transfer_info->num_files / elapsed;
if (transfer_rate > 0)
{
remaining_time = (source_info->num_files - transfer_info->num_files) / transfer_rate;
}
}
if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE)
{
if (files_left > 0)
{
/* To translators: %'d is the number of files completed for the operation,
* so it will be something like 2/14. */
details = f (_("%'d / %'d"),
transfer_info->num_files + 1,
source_info->num_files);
}
else
{
/* To translators: %'d is the number of files completed for the operation,
* so it will be something like 2/14. */
details = f (_("%'d / %'d"),
transfer_info->num_files,
source_info->num_files);
}
}
else
{
if (files_left > 0)
{
gchar *time_left_message;
gchar *files_per_second_message;
gchar *concat_detail;
/* To translators: %T will expand to a time duration like "2 minutes".
* So the whole thing will be something like "1 / 5 -- 2 hours left (4 files/sec)"
*
* The singular/plural form will be used depending on the remaining time (i.e. the %T argument).
*/
time_left_message = ngettext ("%'d / %'d \xE2\x80\x94 %T left",
"%'d / %'d \xE2\x80\x94 %T left",
seconds_count_format_time_units (remaining_time));
transfer_rate += 0.5;
files_per_second_message = ngettext ("(%d file/sec)",
"(%d files/sec)",
(int) transfer_rate);
concat_detail = g_strconcat (time_left_message, " ", files_per_second_message, NULL);
details = f (concat_detail,
transfer_info->num_files + 1, source_info->num_files,
remaining_time,
(int) transfer_rate);
g_free (concat_detail);
}
else
{
/* To translators: %'d is the number of files completed for the operation,
* so it will be something like 2/14. */
details = f (_("%'d / %'d"),
transfer_info->num_files,
source_info->num_files);
}
}
nautilus_progress_info_take_details (job->progress, details);
if (elapsed > SECONDS_NEEDED_FOR_APROXIMATE_TRANSFER_RATE)
{
nautilus_progress_info_set_remaining_time (job->progress,
remaining_time);
nautilus_progress_info_set_elapsed_time (job->progress,
elapsed);
}
if (source_info->num_files != 0)
{
nautilus_progress_info_set_progress (job->progress, transfer_info->num_files, source_info->num_files);
}
}
| 8,985 |
161,135 | 0 | bool HasUIRequest() const { return ui_request_.get() != nullptr; }
| 8,986 |
4,030 | 0 | void FileStream::reset() {
#if HAVE_FSEEKO
savePos = (Guint)ftello(f);
fseeko(f, start, SEEK_SET);
#elif HAVE_FSEEK64
savePos = (Guint)ftell64(f);
fseek64(f, start, SEEK_SET);
#else
savePos = (Guint)ftell(f);
fseek(f, start, SEEK_SET);
#endif
saved = gTrue;
bufPtr = bufEnd = buf;
bufPos = start;
}
| 8,987 |
137,133 | 0 | String InputType::ValueMissingText() const {
return GetLocale().QueryString(WebLocalizedString::kValidationValueMissing);
}
| 8,988 |
170,435 | 0 | status_t Parcel::finishWrite(size_t len)
{
mDataPos += len;
ALOGV("finishWrite Setting data pos of %p to %zu", this, mDataPos);
if (mDataPos > mDataSize) {
mDataSize = mDataPos;
ALOGV("finishWrite Setting data size of %p to %zu", this, mDataSize);
}
return NO_ERROR;
}
| 8,989 |
49,812 | 0 | static void arcmsr_iop_message_read(struct AdapterControlBlock *acb)
{
switch (acb->adapter_type) {
case ACB_ADAPTER_TYPE_A: {
struct MessageUnit_A __iomem *reg = acb->pmuA;
writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, ®->inbound_doorbell);
}
break;
case ACB_ADAPTER_TYPE_B: {
struct MessageUnit_B *reg = acb->pmuB;
writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell);
}
break;
case ACB_ADAPTER_TYPE_C: {
struct MessageUnit_C __iomem *reg = acb->pmuC;
writel(ARCMSR_HBCMU_DRV2IOP_DATA_READ_OK, ®->inbound_doorbell);
}
break;
case ACB_ADAPTER_TYPE_D: {
struct MessageUnit_D *reg = acb->pmuD;
writel(ARCMSR_ARC1214_DRV2IOP_DATA_OUT_READ,
reg->inbound_doorbell);
}
break;
}
}
| 8,990 |
85,976 | 0 | static void dump_tasks(struct mem_cgroup *memcg, const nodemask_t *nodemask)
{
struct task_struct *p;
struct task_struct *task;
pr_info("[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name\n");
rcu_read_lock();
for_each_process(p) {
if (oom_unkillable_task(p, memcg, nodemask))
continue;
task = find_lock_task_mm(p);
if (!task) {
/*
* This is a kthread or all of p's threads have already
* detached their mm's. There's no need to report
* them; they can't be oom killed anyway.
*/
continue;
}
pr_info("[%5d] %5d %5d %8lu %8lu %8ld %8lu %5hd %s\n",
task->pid, from_kuid(&init_user_ns, task_uid(task)),
task->tgid, task->mm->total_vm, get_mm_rss(task->mm),
mm_pgtables_bytes(task->mm),
get_mm_counter(task->mm, MM_SWAPENTS),
task->signal->oom_score_adj, task->comm);
task_unlock(task);
}
rcu_read_unlock();
}
| 8,991 |
187,312 | 1 | _exsltDateTruncateDate (exsltDateValPtr dt, exsltDateType type)
{
if (dt == NULL)
return 1;
if ((type & XS_TIME) != XS_TIME) {
dt->value.date.hour = 0;
dt->value.date.min = 0;
dt->value.date.sec = 0.0;
}
if ((type & XS_GDAY) != XS_GDAY)
dt->value.date.day = 0;
if ((type & XS_GMONTH) != XS_GMONTH)
dt->value.date.mon = 0;
if ((type & XS_GYEAR) != XS_GYEAR)
dt->value.date.year = 0;
dt->type = type;
return 0;
}
| 8,992 |
88,391 | 0 | void raw_data_block(NeAACDecStruct *hDecoder, NeAACDecFrameInfo *hInfo,
bitfile *ld, program_config *pce, drc_info *drc)
{
uint8_t id_syn_ele;
uint8_t ele_this_frame = 0;
hDecoder->fr_channels = 0;
hDecoder->fr_ch_ele = 0;
hDecoder->first_syn_ele = 25;
hDecoder->has_lfe = 0;
#ifdef ERROR_RESILIENCE
if (hDecoder->object_type < ER_OBJECT_START)
{
#endif
/* Table 4.4.3: raw_data_block() */
while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID
DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END)
{
switch (id_syn_ele) {
case ID_SCE:
ele_this_frame++;
if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele);
if (hInfo->error > 0)
return;
break;
case ID_CPE:
ele_this_frame++;
if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
decode_cpe(hDecoder, hInfo, ld, id_syn_ele);
if (hInfo->error > 0)
return;
break;
case ID_LFE:
#ifdef DRM
hInfo->error = 32;
#else
ele_this_frame++;
hDecoder->has_lfe++;
decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele);
#endif
if (hInfo->error > 0)
return;
break;
case ID_CCE: /* not implemented yet, but skip the bits */
#ifdef DRM
hInfo->error = 32;
#else
ele_this_frame++;
#ifdef COUPLING_DEC
hInfo->error = coupling_channel_element(hDecoder, ld);
#else
hInfo->error = 6;
#endif
#endif
if (hInfo->error > 0)
return;
break;
case ID_DSE:
ele_this_frame++;
data_stream_element(hDecoder, ld);
break;
case ID_PCE:
if (ele_this_frame != 0)
{
hInfo->error = 31;
return;
}
ele_this_frame++;
/* 14496-4: 5.6.4.1.2.1.3: */
/* program_configuration_element()'s in access units shall be ignored */
program_config_element(pce, ld);
break;
case ID_FIL:
ele_this_frame++;
/* one sbr_info describes a channel_element not a channel! */
/* if we encounter SBR data here: error */
/* SBR data will be read directly in the SCE/LFE/CPE element */
if ((hInfo->error = fill_element(hDecoder, ld, drc
#ifdef SBR_DEC
, INVALID_SBR_ELEMENT
#endif
)) > 0)
return;
break;
}
}
#ifdef ERROR_RESILIENCE
} else {
/* Table 262: er_raw_data_block() */
switch (hDecoder->channelConfiguration)
{
case 1:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
if (hInfo->error > 0)
return;
break;
case 2:
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
if (hInfo->error > 0)
return;
break;
case 3:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
if (hInfo->error > 0)
return;
break;
case 4:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
if (hInfo->error > 0)
return;
break;
case 5:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
if (hInfo->error > 0)
return;
break;
case 6:
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE);
if (hInfo->error > 0)
return;
break;
case 7: /* 8 channels */
decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_cpe(hDecoder, hInfo, ld, ID_CPE);
decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE);
if (hInfo->error > 0)
return;
break;
default:
hInfo->error = 7;
return;
}
#if 0
cnt = bits_to_decode() / 8;
while (cnt >= 1)
{
cnt -= extension_payload(cnt);
}
#endif
}
#endif
/* new in corrigendum 14496-3:2002 */
#ifdef DRM
if (hDecoder->object_type != DRM_ER_LC
#if 0
&& !hDecoder->latm_header_present
#endif
)
#endif
{
faad_byte_align(ld);
}
return;
}
| 8,993 |
43,511 | 0 | int pit_has_pending_timer(struct kvm_vcpu *vcpu)
{
struct kvm_pit *pit = vcpu->kvm->arch.vpit;
if (pit && kvm_vcpu_is_bsp(vcpu) && pit->pit_state.irq_ack)
return atomic_read(&pit->pit_state.pit_timer.pending);
return 0;
}
| 8,994 |
134,932 | 0 | bool IsInstantTetheringBackgroundAdvertisingSupported() {
return base::FeatureList::IsEnabled(
kInstantTetheringBackgroundAdvertisementSupport);
}
| 8,995 |
34,812 | 0 | static int common_perm_mnt_dentry(int op, struct vfsmount *mnt,
struct dentry *dentry, u32 mask)
{
struct path path = { mnt, dentry };
struct path_cond cond = { dentry->d_inode->i_uid,
dentry->d_inode->i_mode
};
return common_perm(op, &path, mask, &cond);
}
| 8,996 |
175,735 | 0 | UWORD32 ihevcd_cabac_decode_bypass_bins_egk(cab_ctxt_t *ps_cabac,
bitstrm_t *ps_bitstrm,
WORD32 k)
{
UWORD32 u4_sym;
WORD32 numones;
WORD32 bin;
/* Sanity checks */
ASSERT((k >= 0));
numones = k;
bin = 1;
u4_sym = 0;
while(bin && (numones <= 16))
{
IHEVCD_CABAC_DECODE_BYPASS_BIN(bin, ps_cabac, ps_bitstrm);
u4_sym += bin << numones++;
}
numones -= 1;
if(numones)
{
UWORD32 u4_suffix;
IHEVCD_CABAC_DECODE_BYPASS_BINS(u4_suffix, ps_cabac, ps_bitstrm, numones);
u4_sym += u4_suffix;
}
return (u4_sym);
}
| 8,997 |
185,836 | 1 | void RunCallbacksWithDisabled(LogoCallbacks callbacks) {
if (callbacks.on_cached_encoded_logo_available) {
std::move(callbacks.on_cached_encoded_logo_available)
.Run(LogoCallbackReason::DISABLED, base::nullopt);
}
if (callbacks.on_cached_decoded_logo_available) {
std::move(callbacks.on_cached_decoded_logo_available)
.Run(LogoCallbackReason::DISABLED, base::nullopt);
}
if (callbacks.on_fresh_encoded_logo_available) {
std::move(callbacks.on_fresh_encoded_logo_available)
.Run(LogoCallbackReason::DISABLED, base::nullopt);
}
if (callbacks.on_fresh_decoded_logo_available) {
std::move(callbacks.on_fresh_decoded_logo_available)
.Run(LogoCallbackReason::DISABLED, base::nullopt);
}
}
| 8,998 |
48,812 | 0 | bool dev_valid_name(const char *name)
{
if (*name == '\0')
return false;
if (strlen(name) >= IFNAMSIZ)
return false;
if (!strcmp(name, ".") || !strcmp(name, ".."))
return false;
while (*name) {
if (*name == '/' || *name == ':' || isspace(*name))
return false;
name++;
}
return true;
}
| 8,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.