unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
59,105 | 0 | static int check_call(struct bpf_verifier_env *env, int func_id, int insn_idx)
{
const struct bpf_func_proto *fn = NULL;
struct bpf_reg_state *regs;
struct bpf_call_arg_meta meta;
bool changes_data;
int i, err;
/* find function prototype */
if (func_id < 0 || func_id >= __BPF_FUNC_MAX_ID) {
verbose(env, "invalid func %s#%d\n", func_id_name(func_id),
func_id);
return -EINVAL;
}
if (env->ops->get_func_proto)
fn = env->ops->get_func_proto(func_id);
if (!fn) {
verbose(env, "unknown func %s#%d\n", func_id_name(func_id),
func_id);
return -EINVAL;
}
/* eBPF programs must be GPL compatible to use GPL-ed functions */
if (!env->prog->gpl_compatible && fn->gpl_only) {
verbose(env, "cannot call GPL only function from proprietary program\n");
return -EINVAL;
}
changes_data = bpf_helper_changes_pkt_data(fn->func);
memset(&meta, 0, sizeof(meta));
meta.pkt_access = fn->pkt_access;
/* We only support one arg being in raw mode at the moment, which
* is sufficient for the helper functions we have right now.
*/
err = check_raw_mode(fn);
if (err) {
verbose(env, "kernel subsystem misconfigured func %s#%d\n",
func_id_name(func_id), func_id);
return err;
}
/* check args */
err = check_func_arg(env, BPF_REG_1, fn->arg1_type, &meta);
if (err)
return err;
err = check_func_arg(env, BPF_REG_2, fn->arg2_type, &meta);
if (err)
return err;
err = check_func_arg(env, BPF_REG_3, fn->arg3_type, &meta);
if (err)
return err;
err = check_func_arg(env, BPF_REG_4, fn->arg4_type, &meta);
if (err)
return err;
err = check_func_arg(env, BPF_REG_5, fn->arg5_type, &meta);
if (err)
return err;
/* Mark slots with STACK_MISC in case of raw mode, stack offset
* is inferred from register state.
*/
for (i = 0; i < meta.access_size; i++) {
err = check_mem_access(env, insn_idx, meta.regno, i, BPF_B, BPF_WRITE, -1);
if (err)
return err;
}
regs = cur_regs(env);
/* reset caller saved regs */
for (i = 0; i < CALLER_SAVED_REGS; i++) {
mark_reg_not_init(env, regs, caller_saved[i]);
check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK);
}
/* update return register (already marked as written above) */
if (fn->ret_type == RET_INTEGER) {
/* sets type to SCALAR_VALUE */
mark_reg_unknown(env, regs, BPF_REG_0);
} else if (fn->ret_type == RET_VOID) {
regs[BPF_REG_0].type = NOT_INIT;
} else if (fn->ret_type == RET_PTR_TO_MAP_VALUE_OR_NULL) {
struct bpf_insn_aux_data *insn_aux;
regs[BPF_REG_0].type = PTR_TO_MAP_VALUE_OR_NULL;
/* There is no offset yet applied, variable or fixed */
mark_reg_known_zero(env, regs, BPF_REG_0);
regs[BPF_REG_0].off = 0;
/* remember map_ptr, so that check_map_access()
* can check 'value_size' boundary of memory access
* to map element returned from bpf_map_lookup_elem()
*/
if (meta.map_ptr == NULL) {
verbose(env,
"kernel subsystem misconfigured verifier\n");
return -EINVAL;
}
regs[BPF_REG_0].map_ptr = meta.map_ptr;
regs[BPF_REG_0].id = ++env->id_gen;
insn_aux = &env->insn_aux_data[insn_idx];
if (!insn_aux->map_ptr)
insn_aux->map_ptr = meta.map_ptr;
else if (insn_aux->map_ptr != meta.map_ptr)
insn_aux->map_ptr = BPF_MAP_PTR_POISON;
} else {
verbose(env, "unknown return type %d of func %s#%d\n",
fn->ret_type, func_id_name(func_id), func_id);
return -EINVAL;
}
err = check_map_func_compatibility(env, meta.map_ptr, func_id);
if (err)
return err;
if (changes_data)
clear_all_pkt_pointers(env);
return 0;
}
| 15,400 |
56,820 | 0 | int usb_new_device(struct usb_device *udev)
{
int err;
if (udev->parent) {
/* Initialize non-root-hub device wakeup to disabled;
* device (un)configuration controls wakeup capable
* sysfs power/wakeup controls wakeup enabled/disabled
*/
device_init_wakeup(&udev->dev, 0);
}
/* Tell the runtime-PM framework the device is active */
pm_runtime_set_active(&udev->dev);
pm_runtime_get_noresume(&udev->dev);
pm_runtime_use_autosuspend(&udev->dev);
pm_runtime_enable(&udev->dev);
/* By default, forbid autosuspend for all devices. It will be
* allowed for hubs during binding.
*/
usb_disable_autosuspend(udev);
err = usb_enumerate_device(udev); /* Read descriptors */
if (err < 0)
goto fail;
dev_dbg(&udev->dev, "udev %d, busnum %d, minor = %d\n",
udev->devnum, udev->bus->busnum,
(((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
/* export the usbdev device-node for libusb */
udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
(((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
/* Tell the world! */
announce_device(udev);
if (udev->serial)
add_device_randomness(udev->serial, strlen(udev->serial));
if (udev->product)
add_device_randomness(udev->product, strlen(udev->product));
if (udev->manufacturer)
add_device_randomness(udev->manufacturer,
strlen(udev->manufacturer));
device_enable_async_suspend(&udev->dev);
/* check whether the hub or firmware marks this port as non-removable */
if (udev->parent)
set_usb_port_removable(udev);
/* Register the device. The device driver is responsible
* for configuring the device and invoking the add-device
* notifier chain (used by usbfs and possibly others).
*/
err = device_add(&udev->dev);
if (err) {
dev_err(&udev->dev, "can't device_add, error %d\n", err);
goto fail;
}
/* Create link files between child device and usb port device. */
if (udev->parent) {
struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent);
int port1 = udev->portnum;
struct usb_port *port_dev = hub->ports[port1 - 1];
err = sysfs_create_link(&udev->dev.kobj,
&port_dev->dev.kobj, "port");
if (err)
goto fail;
err = sysfs_create_link(&port_dev->dev.kobj,
&udev->dev.kobj, "device");
if (err) {
sysfs_remove_link(&udev->dev.kobj, "port");
goto fail;
}
if (!test_and_set_bit(port1, hub->child_usage_bits))
pm_runtime_get_sync(&port_dev->dev);
}
(void) usb_create_ep_devs(&udev->dev, &udev->ep0, udev);
usb_mark_last_busy(udev);
pm_runtime_put_sync_autosuspend(&udev->dev);
return err;
fail:
usb_set_device_state(udev, USB_STATE_NOTATTACHED);
pm_runtime_disable(&udev->dev);
pm_runtime_set_suspended(&udev->dev);
return err;
}
| 15,401 |
149,889 | 0 | void LayerTreeHostImpl::AnimatePendingTreeAfterCommit() {
AnimateInternal(false);
}
| 15,402 |
65,298 | 0 | nfs3svc_release_fhandle2(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_fhandle_pair *resp)
{
fh_put(&resp->fh1);
fh_put(&resp->fh2);
return 1;
}
| 15,403 |
57,239 | 0 | static inline int nfs4_server_supports_acls(struct nfs_server *server)
{
return server->caps & NFS_CAP_ACLS;
}
| 15,404 |
144,887 | 0 | void RenderWidgetHostViewAura::CopyFromSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
const ReadbackRequestCallback& callback,
const SkColorType preferred_color_type) {
if (!IsSurfaceAvailableForCopy()) {
callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
return;
}
delegated_frame_host_->CopyFromCompositingSurface(
src_subrect, dst_size, callback, preferred_color_type);
}
| 15,405 |
121,806 | 0 | int UDPSocketWin::SendToOrWrite(IOBuffer* buf,
int buf_len,
const IPEndPoint* address,
const CompletionCallback& callback) {
DCHECK(CalledOnValidThread());
DCHECK_NE(INVALID_SOCKET, socket_);
DCHECK(write_callback_.is_null());
DCHECK(!callback.is_null()); // Synchronous operation not supported.
DCHECK_GT(buf_len, 0);
DCHECK(!send_to_address_.get());
int nwrite = InternalSendTo(buf, buf_len, address);
if (nwrite != ERR_IO_PENDING)
return nwrite;
if (address)
send_to_address_.reset(new IPEndPoint(*address));
write_callback_ = callback;
return ERR_IO_PENDING;
}
| 15,406 |
160,368 | 0 | void LargeObjectArena::freeLargeObjectPage(LargeObjectPage* object) {
ASAN_UNPOISON_MEMORY_REGION(object->payload(), object->payloadSize());
object->heapObjectHeader()->finalize(object->payload(),
object->payloadSize());
getThreadState()->heap().heapStats().decreaseAllocatedSpace(object->size());
ASAN_UNPOISON_MEMORY_REGION(object->heapObjectHeader(),
sizeof(HeapObjectHeader));
ASAN_UNPOISON_MEMORY_REGION(object->getAddress() + object->size(),
allocationGranularity);
PageMemory* memory = object->storage();
object->~LargeObjectPage();
delete memory;
}
| 15,407 |
157,347 | 0 | blink::WebSize WebMediaPlayerImpl::VisibleRect() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
if (!video_frame)
return blink::WebSize();
const gfx::Rect& visible_rect = video_frame->visible_rect();
return blink::WebSize(visible_rect.width(), visible_rect.height());
}
| 15,408 |
24,505 | 0 | cleanup_volume_info(struct smb_vol **pvolume_info)
{
struct smb_vol *volume_info;
if (!pvolume_info || !*pvolume_info)
return;
volume_info = *pvolume_info;
kzfree(volume_info->password);
kfree(volume_info->UNC);
kfree(volume_info->prepath);
kfree(volume_info);
*pvolume_info = NULL;
return;
}
| 15,409 |
43,052 | 0 | void luaD_reallocCI (lua_State *L, int newsize) {
CallInfo *oldci = L->base_ci;
luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo);
L->size_ci = newsize;
L->ci = (L->ci - oldci) + L->base_ci;
L->end_ci = L->base_ci + L->size_ci - 1;
}
| 15,410 |
59,106 | 0 | static int check_cfg(struct bpf_verifier_env *env)
{
struct bpf_insn *insns = env->prog->insnsi;
int insn_cnt = env->prog->len;
int ret = 0;
int i, t;
insn_state = kcalloc(insn_cnt, sizeof(int), GFP_KERNEL);
if (!insn_state)
return -ENOMEM;
insn_stack = kcalloc(insn_cnt, sizeof(int), GFP_KERNEL);
if (!insn_stack) {
kfree(insn_state);
return -ENOMEM;
}
insn_state[0] = DISCOVERED; /* mark 1st insn as discovered */
insn_stack[0] = 0; /* 0 is the first instruction */
cur_stack = 1;
peek_stack:
if (cur_stack == 0)
goto check_state;
t = insn_stack[cur_stack - 1];
if (BPF_CLASS(insns[t].code) == BPF_JMP) {
u8 opcode = BPF_OP(insns[t].code);
if (opcode == BPF_EXIT) {
goto mark_explored;
} else if (opcode == BPF_CALL) {
ret = push_insn(t, t + 1, FALLTHROUGH, env);
if (ret == 1)
goto peek_stack;
else if (ret < 0)
goto err_free;
if (t + 1 < insn_cnt)
env->explored_states[t + 1] = STATE_LIST_MARK;
} else if (opcode == BPF_JA) {
if (BPF_SRC(insns[t].code) != BPF_K) {
ret = -EINVAL;
goto err_free;
}
/* unconditional jump with single edge */
ret = push_insn(t, t + insns[t].off + 1,
FALLTHROUGH, env);
if (ret == 1)
goto peek_stack;
else if (ret < 0)
goto err_free;
/* tell verifier to check for equivalent states
* after every call and jump
*/
if (t + 1 < insn_cnt)
env->explored_states[t + 1] = STATE_LIST_MARK;
} else {
/* conditional jump with two edges */
env->explored_states[t] = STATE_LIST_MARK;
ret = push_insn(t, t + 1, FALLTHROUGH, env);
if (ret == 1)
goto peek_stack;
else if (ret < 0)
goto err_free;
ret = push_insn(t, t + insns[t].off + 1, BRANCH, env);
if (ret == 1)
goto peek_stack;
else if (ret < 0)
goto err_free;
}
} else {
/* all other non-branch instructions with single
* fall-through edge
*/
ret = push_insn(t, t + 1, FALLTHROUGH, env);
if (ret == 1)
goto peek_stack;
else if (ret < 0)
goto err_free;
}
mark_explored:
insn_state[t] = EXPLORED;
if (cur_stack-- <= 0) {
verbose(env, "pop stack internal bug\n");
ret = -EFAULT;
goto err_free;
}
goto peek_stack;
check_state:
for (i = 0; i < insn_cnt; i++) {
if (insn_state[i] != EXPLORED) {
verbose(env, "unreachable insn %d\n", i);
ret = -EINVAL;
goto err_free;
}
}
ret = 0; /* cfg looks good */
err_free:
kfree(insn_state);
kfree(insn_stack);
return ret;
}
| 15,411 |
141,320 | 0 | Range* Document::createRange() {
return Range::Create(*this);
}
| 15,412 |
2,045 | 0 | parse_options(const char *data, struct parsed_mount_info *parsed_info)
{
char *value = NULL;
char *equals = NULL;
char *next_keyword = NULL;
char *out = parsed_info->options;
unsigned long *filesys_flags = &parsed_info->flags;
int out_len = 0;
int word_len;
int rc = 0;
int got_uid = 0;
int got_cruid = 0;
int got_gid = 0;
uid_t uid, cruid = 0;
gid_t gid;
char *ep;
struct passwd *pw;
struct group *gr;
/*
* max 32-bit uint in decimal is 4294967295 which is 10 chars wide
* +1 for NULL, and +1 for good measure
*/
char txtbuf[12];
/* make sure we're starting from beginning */
out[0] = '\0';
/* BB fixme check for separator override BB */
uid = getuid();
if (uid != 0)
got_uid = 1;
gid = getgid();
if (gid != 0)
got_gid = 1;
if (!data)
return EX_USAGE;
/*
* format is keyword,keyword2=value2,keyword3=value3...
* data = next keyword
* value = next value ie stuff after equal sign
*/
while (data && *data) {
next_keyword = strchr(data, ','); /* BB handle sep= */
/* temporarily null terminate end of keyword=value pair */
if (next_keyword)
*next_keyword++ = 0;
/* temporarily null terminate keyword if there's a value */
value = NULL;
if ((equals = strchr(data, '=')) != NULL) {
*equals = '\0';
value = equals + 1;
}
switch(parse_opt_token(data)) {
case OPT_USERS:
if (!value || !*value) {
*filesys_flags |= MS_USERS;
goto nocopy;
}
break;
case OPT_USER:
if (!value || !*value) {
if (data[4] == '\0') {
*filesys_flags |= MS_USER;
goto nocopy;
} else {
fprintf(stderr,
"username specified with no parameter\n");
return EX_USAGE;
}
} else {
/* domain/username%password */
const int max = MAX_DOMAIN_SIZE +
MAX_USERNAME_SIZE +
MOUNT_PASSWD_SIZE + 2;
if (strnlen(value, max + 1) >= max + 1) {
fprintf(stderr, "username too long\n");
return EX_USAGE;
}
rc = parse_username(value, parsed_info);
if (rc) {
fprintf(stderr,
"problem parsing username\n");
return rc;
}
goto nocopy;
}
case OPT_PASS:
if (parsed_info->got_password) {
fprintf(stderr,
"password specified twice, ignoring second\n");
goto nocopy;
}
if (!value || !*value) {
parsed_info->got_password = 1;
goto nocopy;
}
rc = set_password(parsed_info, value);
if (rc)
return rc;
goto nocopy;
case OPT_SEC:
if (value) {
if (!strncmp(value, "none", 4) ||
!strncmp(value, "krb5", 4))
parsed_info->got_password = 1;
}
break;
case OPT_IP:
if (!value || !*value) {
fprintf(stderr,
"target ip address argument missing\n");
} else if (strnlen(value, MAX_ADDRESS_LEN) <=
MAX_ADDRESS_LEN) {
strcpy(parsed_info->addrlist, value);
if (parsed_info->verboseflag)
fprintf(stderr,
"ip address %s override specified\n",
value);
goto nocopy;
} else {
fprintf(stderr, "ip address too long\n");
return EX_USAGE;
}
break;
/* unc || target || path */
case OPT_UNC:
if (!value || !*value) {
fprintf(stderr,
"invalid path to network resource\n");
return EX_USAGE;
}
rc = parse_unc(value, parsed_info);
if (rc)
return rc;
break;
/* dom || workgroup */
case OPT_DOM:
if (!value || !*value) {
fprintf(stderr, "CIFS: invalid domain name\n");
return EX_USAGE;
}
if (strnlen(value, sizeof(parsed_info->domain)) >=
sizeof(parsed_info->domain)) {
fprintf(stderr, "domain name too long\n");
return EX_USAGE;
}
strlcpy(parsed_info->domain, value,
sizeof(parsed_info->domain));
goto nocopy;
case OPT_CRED:
if (!value || !*value) {
fprintf(stderr,
"invalid credential file name specified\n");
return EX_USAGE;
}
rc = open_cred_file(value, parsed_info);
if (rc) {
fprintf(stderr,
"error %d (%s) opening credential file %s\n",
rc, strerror(rc), value);
return rc;
}
break;
case OPT_UID:
if (!value || !*value)
goto nocopy;
got_uid = 1;
errno = 0;
uid = strtoul(value, &ep, 10);
if (errno == 0)
goto nocopy;
pw = getpwnam(value);
if (pw == NULL) {
fprintf(stderr, "bad user name \"%s\"\n", value);
return EX_USAGE;
}
uid = pw->pw_uid;
goto nocopy;
case OPT_CRUID:
if (!value || !*value)
goto nocopy;
got_cruid = 1;
errno = 0;
cruid = strtoul(value, &ep, 10);
if (errno == 0)
goto nocopy;
pw = getpwnam(value);
if (pw == NULL) {
fprintf(stderr, "bad user name \"%s\"\n", value);
return EX_USAGE;
}
cruid = pw->pw_uid;
goto nocopy;
case OPT_GID:
if (!value || !*value)
goto nocopy;
got_gid = 1;
errno = 0;
gid = strtoul(value, &ep, 10);
if (errno == 0)
goto nocopy;
gr = getgrnam(value);
if (gr == NULL) {
fprintf(stderr, "bad group name \"%s\"\n", value);
return EX_USAGE;
}
gid = gr->gr_gid;
goto nocopy;
/* fmask fall through to file_mode */
case OPT_FMASK:
fprintf(stderr,
"WARNING: CIFS mount option 'fmask' is\
deprecated. Use 'file_mode' instead.\n");
data = "file_mode"; /* BB fix this */
case OPT_FILE_MODE:
if (!value || !*value) {
fprintf(stderr,
"Option '%s' requires a numerical argument\n",
data);
return EX_USAGE;
}
if (value[0] != '0')
fprintf(stderr,
"WARNING: '%s' not expressed in octal.\n",
data);
break;
/* dmask falls through to dir_mode */
case OPT_DMASK:
fprintf(stderr,
"WARNING: CIFS mount option 'dmask' is\
deprecated. Use 'dir_mode' instead.\n");
data = "dir_mode";
case OPT_DIR_MODE:
if (!value || !*value) {
fprintf(stderr,
"Option '%s' requires a numerical argument\n",
data);
return EX_USAGE;
}
if (value[0] != '0')
fprintf(stderr,
"WARNING: '%s' not expressed in octal.\n",
data);
break;
/* the following mount options should be
stripped out from what is passed into the kernel
since these options are best passed as the
mount flags rather than redundantly to the kernel
and could generate spurious warnings depending on the
level of the corresponding cifs vfs kernel code */
case OPT_NO_SUID:
*filesys_flags |= MS_NOSUID;
break;
case OPT_SUID:
*filesys_flags &= ~MS_NOSUID;
break;
case OPT_NO_DEV:
*filesys_flags |= MS_NODEV;
break;
/* nolock || nobrl */
case OPT_NO_LOCK:
*filesys_flags &= ~MS_MANDLOCK;
break;
case OPT_MAND:
*filesys_flags |= MS_MANDLOCK;
goto nocopy;
case OPT_NOMAND:
*filesys_flags &= ~MS_MANDLOCK;
goto nocopy;
case OPT_DEV:
*filesys_flags &= ~MS_NODEV;
break;
case OPT_NO_EXEC:
*filesys_flags |= MS_NOEXEC;
break;
case OPT_EXEC:
*filesys_flags &= ~MS_NOEXEC;
break;
case OPT_GUEST:
parsed_info->got_user = 1;
parsed_info->got_password = 1;
break;
case OPT_RO:
*filesys_flags |= MS_RDONLY;
goto nocopy;
case OPT_RW:
*filesys_flags &= ~MS_RDONLY;
goto nocopy;
case OPT_REMOUNT:
*filesys_flags |= MS_REMOUNT;
break;
case OPT_IGNORE:
goto nocopy;
}
/* check size before copying option to buffer */
word_len = strlen(data);
if (value)
word_len += 1 + strlen(value);
/* need 2 extra bytes for comma and null byte */
if (out_len + word_len + 2 > MAX_OPTIONS_LEN) {
fprintf(stderr, "Options string too long\n");
return EX_USAGE;
}
/* put back equals sign, if any */
if (equals)
*equals = '=';
/* go ahead and copy */
if (out_len)
strlcat(out, ",", MAX_OPTIONS_LEN);
strlcat(out, data, MAX_OPTIONS_LEN);
out_len = strlen(out);
nocopy:
data = next_keyword;
}
/* special-case the uid and gid */
if (got_uid) {
word_len = snprintf(txtbuf, sizeof(txtbuf), "%u", uid);
/* comma + "uid=" + terminating NULL == 6 */
if (out_len + word_len + 6 > MAX_OPTIONS_LEN) {
fprintf(stderr, "Options string too long\n");
return EX_USAGE;
}
if (out_len) {
strlcat(out, ",", MAX_OPTIONS_LEN);
out_len++;
}
snprintf(out + out_len, word_len + 5, "uid=%s", txtbuf);
out_len = strlen(out);
}
if (got_cruid) {
word_len = snprintf(txtbuf, sizeof(txtbuf), "%u", cruid);
/* comma + "cruid=" + terminating NULL == 6 */
if (out_len + word_len + 8 > MAX_OPTIONS_LEN) {
fprintf(stderr, "Options string too long\n");
return EX_USAGE;
}
if (out_len) {
strlcat(out, ",", MAX_OPTIONS_LEN);
out_len++;
}
snprintf(out + out_len, word_len + 7, "cruid=%s", txtbuf);
out_len = strlen(out);
}
if (got_gid) {
word_len = snprintf(txtbuf, sizeof(txtbuf), "%u", gid);
/* comma + "gid=" + terminating NULL == 6 */
if (out_len + word_len + 6 > MAX_OPTIONS_LEN) {
fprintf(stderr, "Options string too long\n");
return EX_USAGE;
}
if (out_len) {
strlcat(out, ",", MAX_OPTIONS_LEN);
out_len++;
}
snprintf(out + out_len, word_len + 5, "gid=%s", txtbuf);
}
return 0;
}
| 15,413 |
173,814 | 0 | void SoftGSM::initPorts() {
OMX_PARAM_PORTDEFINITIONTYPE def;
InitOMXParams(&def);
def.nPortIndex = 0;
def.eDir = OMX_DirInput;
def.nBufferCountMin = kNumBuffers;
def.nBufferCountActual = def.nBufferCountMin;
def.nBufferSize = 1024 / kMSGSMFrameSize * kMSGSMFrameSize;
def.bEnabled = OMX_TRUE;
def.bPopulated = OMX_FALSE;
def.eDomain = OMX_PortDomainAudio;
def.bBuffersContiguous = OMX_FALSE;
def.nBufferAlignment = 1;
def.format.audio.cMIMEType =
const_cast<char *>(MEDIA_MIMETYPE_AUDIO_MSGSM);
def.format.audio.pNativeRender = NULL;
def.format.audio.bFlagErrorConcealment = OMX_FALSE;
def.format.audio.eEncoding = OMX_AUDIO_CodingGSMFR;
addPort(def);
def.nPortIndex = 1;
def.eDir = OMX_DirOutput;
def.nBufferCountMin = kNumBuffers;
def.nBufferCountActual = def.nBufferCountMin;
def.nBufferSize = kMaxNumSamplesPerFrame * sizeof(int16_t);
def.bEnabled = OMX_TRUE;
def.bPopulated = OMX_FALSE;
def.eDomain = OMX_PortDomainAudio;
def.bBuffersContiguous = OMX_FALSE;
def.nBufferAlignment = 2;
def.format.audio.cMIMEType = const_cast<char *>("audio/raw");
def.format.audio.pNativeRender = NULL;
def.format.audio.bFlagErrorConcealment = OMX_FALSE;
def.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
addPort(def);
}
| 15,414 |
157,782 | 0 | const std::string& WebContentsImpl::GetMediaDeviceGroupIDSaltBase() const {
return media_device_group_id_salt_base_;
}
| 15,415 |
47,432 | 0 | static inline u8 *cbc_crypt(const u8 *in, u8 *out, u32 *key,
u8 *iv, struct cword *cword, int count)
{
/* Padlock in CBC mode fetches at least cbc_fetch_bytes of data. */
if (unlikely(((unsigned long)in & ~PAGE_MASK) + cbc_fetch_bytes > PAGE_SIZE))
return cbc_crypt_copy(in, out, key, iv, cword, count);
return rep_xcrypt_cbc(in, out, key, iv, cword, count);
}
| 15,416 |
46,044 | 0 | xdr_chrand_arg(XDR *xdrs, chrand_arg *objp)
{
if (!xdr_ui_4(xdrs, &objp->api_version)) {
return (FALSE);
}
if (!xdr_krb5_principal(xdrs, &objp->princ)) {
return (FALSE);
}
return (TRUE);
}
| 15,417 |
57,332 | 0 | ZEND_API zend_bool zend_is_executing(void) /* {{{ */
{
return EG(current_execute_data) != 0;
}
/* }}} */
| 15,418 |
14,968 | 0 | ProcCreateWindow(ClientPtr client)
{
WindowPtr pParent, pWin;
REQUEST(xCreateWindowReq);
int len, rc;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
LEGAL_NEW_RESOURCE(stuff->wid, client);
rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess);
if (rc != Success)
return rc;
len = client->req_len - bytes_to_int32(sizeof(xCreateWindowReq));
if (Ones(stuff->mask) != len)
return BadLength;
if (!stuff->width || !stuff->height) {
client->errorValue = 0;
return BadValue;
}
pWin = CreateWindow(stuff->wid, pParent, stuff->x,
stuff->y, stuff->width, stuff->height,
stuff->borderWidth, stuff->class,
stuff->mask, (XID *) &stuff[1],
(int) stuff->depth, client, stuff->visual, &rc);
if (pWin) {
Mask mask = pWin->eventMask;
pWin->eventMask = 0; /* subterfuge in case AddResource fails */
if (!AddResource(stuff->wid, RT_WINDOW, (void *) pWin))
return BadAlloc;
pWin->eventMask = mask;
}
return rc;
}
| 15,419 |
181,389 | 1 | static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data)
{
int ret;
ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0),
PEGASUS_REQ_SET_REG, PEGASUS_REQT_WRITE, data,
indx, &data, 1, 1000);
if (ret < 0)
netif_dbg(pegasus, drv, pegasus->net,
"%s returned %d\n", __func__, ret);
return ret;
}
| 15,420 |
126,716 | 0 | void BrowserView::BookmarkBarStateChanged(
BookmarkBar::AnimateChangeType change_type) {
if (bookmark_bar_view_.get()) {
bookmark_bar_view_->SetBookmarkBarState(
browser_->bookmark_bar_state(), change_type,
browser_->search_model()->mode());
}
if (MaybeShowBookmarkBar(GetActiveTabContents()))
Layout();
}
| 15,421 |
181,299 | 1 | static struct sock *dccp_v6_request_recv_sock(const struct sock *sk,
struct sk_buff *skb,
struct request_sock *req,
struct dst_entry *dst,
struct request_sock *req_unhash,
bool *own_req)
{
struct inet_request_sock *ireq = inet_rsk(req);
struct ipv6_pinfo *newnp;
const struct ipv6_pinfo *np = inet6_sk(sk);
struct ipv6_txoptions *opt;
struct inet_sock *newinet;
struct dccp6_sock *newdp6;
struct sock *newsk;
if (skb->protocol == htons(ETH_P_IP)) {
/*
* v6 mapped
*/
newsk = dccp_v4_request_recv_sock(sk, skb, req, dst,
req_unhash, own_req);
if (newsk == NULL)
return NULL;
newdp6 = (struct dccp6_sock *)newsk;
newinet = inet_sk(newsk);
newinet->pinet6 = &newdp6->inet6;
newnp = inet6_sk(newsk);
memcpy(newnp, np, sizeof(struct ipv6_pinfo));
newnp->saddr = newsk->sk_v6_rcv_saddr;
inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped;
newsk->sk_backlog_rcv = dccp_v4_do_rcv;
newnp->pktoptions = NULL;
newnp->opt = NULL;
newnp->mcast_oif = inet6_iif(skb);
newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
/*
* No need to charge this sock to the relevant IPv6 refcnt debug socks count
* here, dccp_create_openreq_child now does this for us, see the comment in
* that function for the gory details. -acme
*/
/* It is tricky place. Until this moment IPv4 tcp
worked with IPv6 icsk.icsk_af_ops.
Sync it now.
*/
dccp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie);
return newsk;
}
if (sk_acceptq_is_full(sk))
goto out_overflow;
if (!dst) {
struct flowi6 fl6;
dst = inet6_csk_route_req(sk, &fl6, req, IPPROTO_DCCP);
if (!dst)
goto out;
}
newsk = dccp_create_openreq_child(sk, req, skb);
if (newsk == NULL)
goto out_nonewsk;
/*
* No need to charge this sock to the relevant IPv6 refcnt debug socks
* count here, dccp_create_openreq_child now does this for us, see the
* comment in that function for the gory details. -acme
*/
ip6_dst_store(newsk, dst, NULL, NULL);
newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM |
NETIF_F_TSO);
newdp6 = (struct dccp6_sock *)newsk;
newinet = inet_sk(newsk);
newinet->pinet6 = &newdp6->inet6;
newnp = inet6_sk(newsk);
memcpy(newnp, np, sizeof(struct ipv6_pinfo));
newsk->sk_v6_daddr = ireq->ir_v6_rmt_addr;
newnp->saddr = ireq->ir_v6_loc_addr;
newsk->sk_v6_rcv_saddr = ireq->ir_v6_loc_addr;
newsk->sk_bound_dev_if = ireq->ir_iif;
/* Now IPv6 options...
First: no IPv4 options.
*/
newinet->inet_opt = NULL;
/* Clone RX bits */
newnp->rxopt.all = np->rxopt.all;
newnp->pktoptions = NULL;
newnp->opt = NULL;
newnp->mcast_oif = inet6_iif(skb);
newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
/*
* Clone native IPv6 options from listening socket (if any)
*
* Yes, keeping reference count would be much more clever, but we make
* one more one thing there: reattach optmem to newsk.
*/
opt = ireq->ipv6_opt;
if (!opt)
opt = rcu_dereference(np->opt);
if (opt) {
opt = ipv6_dup_options(newsk, opt);
RCU_INIT_POINTER(newnp->opt, opt);
}
inet_csk(newsk)->icsk_ext_hdr_len = 0;
if (opt)
inet_csk(newsk)->icsk_ext_hdr_len = opt->opt_nflen +
opt->opt_flen;
dccp_sync_mss(newsk, dst_mtu(dst));
newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6;
newinet->inet_rcv_saddr = LOOPBACK4_IPV6;
if (__inet_inherit_port(sk, newsk) < 0) {
inet_csk_prepare_forced_close(newsk);
dccp_done(newsk);
goto out;
}
*own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash));
/* Clone pktoptions received with SYN, if we own the req */
if (*own_req && ireq->pktopts) {
newnp->pktoptions = skb_clone(ireq->pktopts, GFP_ATOMIC);
consume_skb(ireq->pktopts);
ireq->pktopts = NULL;
if (newnp->pktoptions)
skb_set_owner_r(newnp->pktoptions, newsk);
}
return newsk;
out_overflow:
__NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS);
out_nonewsk:
dst_release(dst);
out:
__NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENDROPS);
return NULL;
}
| 15,422 |
68,589 | 0 | SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
{
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
unsigned long addr = (unsigned long)shmaddr;
int retval = -EINVAL;
#ifdef CONFIG_MMU
loff_t size = 0;
struct file *file;
struct vm_area_struct *next;
#endif
if (addr & ~PAGE_MASK)
return retval;
if (down_write_killable(&mm->mmap_sem))
return -EINTR;
/*
* This function tries to be smart and unmap shm segments that
* were modified by partial mlock or munmap calls:
* - It first determines the size of the shm segment that should be
* unmapped: It searches for a vma that is backed by shm and that
* started at address shmaddr. It records it's size and then unmaps
* it.
* - Then it unmaps all shm vmas that started at shmaddr and that
* are within the initially determined size and that are from the
* same shm segment from which we determined the size.
* Errors from do_munmap are ignored: the function only fails if
* it's called with invalid parameters or if it's called to unmap
* a part of a vma. Both calls in this function are for full vmas,
* the parameters are directly copied from the vma itself and always
* valid - therefore do_munmap cannot fail. (famous last words?)
*/
/*
* If it had been mremap()'d, the starting address would not
* match the usual checks anyway. So assume all vma's are
* above the starting address given.
*/
vma = find_vma(mm, addr);
#ifdef CONFIG_MMU
while (vma) {
next = vma->vm_next;
/*
* Check if the starting address would match, i.e. it's
* a fragment created by mprotect() and/or munmap(), or it
* otherwise it starts at this address with no hassles.
*/
if ((vma->vm_ops == &shm_vm_ops) &&
(vma->vm_start - addr)/PAGE_SIZE == vma->vm_pgoff) {
/*
* Record the file of the shm segment being
* unmapped. With mremap(), someone could place
* page from another segment but with equal offsets
* in the range we are unmapping.
*/
file = vma->vm_file;
size = i_size_read(file_inode(vma->vm_file));
do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start, NULL);
/*
* We discovered the size of the shm segment, so
* break out of here and fall through to the next
* loop that uses the size information to stop
* searching for matching vma's.
*/
retval = 0;
vma = next;
break;
}
vma = next;
}
/*
* We need look no further than the maximum address a fragment
* could possibly have landed at. Also cast things to loff_t to
* prevent overflows and make comparisons vs. equal-width types.
*/
size = PAGE_ALIGN(size);
while (vma && (loff_t)(vma->vm_end - addr) <= size) {
next = vma->vm_next;
/* finding a matching vma now does not alter retval */
if ((vma->vm_ops == &shm_vm_ops) &&
((vma->vm_start - addr)/PAGE_SIZE == vma->vm_pgoff) &&
(vma->vm_file == file))
do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start, NULL);
vma = next;
}
#else /* CONFIG_MMU */
/* under NOMMU conditions, the exact address to be destroyed must be
* given
*/
if (vma && vma->vm_start == addr && vma->vm_ops == &shm_vm_ops) {
do_munmap(mm, vma->vm_start, vma->vm_end - vma->vm_start, NULL);
retval = 0;
}
#endif
up_write(&mm->mmap_sem);
return retval;
}
| 15,423 |
135,203 | 0 | void Document::didInsertText(Node* text, unsigned offset, unsigned length)
{
for (Range* range : m_ranges)
range->didInsertText(text, offset, length);
m_markers->shiftMarkers(text, offset, length);
}
| 15,424 |
31,053 | 0 | static size_t rtnl_link_get_size(const struct net_device *dev)
{
const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
size_t size;
if (!ops)
return 0;
size = nla_total_size(sizeof(struct nlattr)) + /* IFLA_LINKINFO */
nla_total_size(strlen(ops->kind) + 1); /* IFLA_INFO_KIND */
if (ops->get_size)
/* IFLA_INFO_DATA + nested data */
size += nla_total_size(sizeof(struct nlattr)) +
ops->get_size(dev);
if (ops->get_xstats_size)
/* IFLA_INFO_XSTATS */
size += nla_total_size(ops->get_xstats_size(dev));
return size;
}
| 15,425 |
75,929 | 0 | data_cmd(thread_t * thread)
{
smtp_t *smtp = THREAD_ARG(thread);
if (send(thread->u.fd, SMTP_DATA_CMD, strlen(SMTP_DATA_CMD), 0) == -1)
smtp->stage = ERROR;
return 0;
}
| 15,426 |
14,382 | 0 | do_authenticated(Authctxt *authctxt)
{
setproctitle("%s", authctxt->pw->pw_name);
/* setup the channel layer */
/* XXX - streamlocal? */
if (no_port_forwarding_flag ||
(options.allow_tcp_forwarding & FORWARD_LOCAL) == 0)
channel_disable_adm_local_opens();
else
channel_permit_all_opens();
auth_debug_send();
if (compat20)
do_authenticated2(authctxt);
else
do_authenticated1(authctxt);
do_cleanup(authctxt);
}
| 15,427 |
137,740 | 0 | void HeadlessWebContentsImpl::Close() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
browser_context()->DestroyWebContents(this);
}
| 15,428 |
180,577 | 1 | static int snd_timer_user_open(struct inode *inode, struct file *file)
{
struct snd_timer_user *tu;
int err;
err = nonseekable_open(inode, file);
if (err < 0)
return err;
tu = kzalloc(sizeof(*tu), GFP_KERNEL);
if (tu == NULL)
return -ENOMEM;
spin_lock_init(&tu->qlock);
init_waitqueue_head(&tu->qchange_sleep);
mutex_init(&tu->tread_sem);
tu->ticks = 1;
tu->queue_size = 128;
tu->queue = kmalloc(tu->queue_size * sizeof(struct snd_timer_read),
GFP_KERNEL);
if (tu->queue == NULL) {
kfree(tu);
return -ENOMEM;
}
file->private_data = tu;
return 0;
}
| 15,429 |
49,215 | 0 | static void prb_setup_retire_blk_timer(struct packet_sock *po)
{
struct tpacket_kbdq_core *pkc;
pkc = GET_PBDQC_FROM_RB(&po->rx_ring);
prb_init_blk_timer(po, pkc, prb_retire_rx_blk_timer_expired);
}
| 15,430 |
163,686 | 0 | xmlBufShrink(xmlBufPtr buf, size_t len) {
if ((buf == NULL) || (buf->error != 0)) return(0);
CHECK_COMPAT(buf)
if (len == 0) return(0);
if (len > buf->use) return(0);
buf->use -= len;
if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) {
/*
* we just move the content pointer, but also make sure
* the perceived buffer size has shrinked accordingly
*/
buf->content += len;
buf->size -= len;
/*
* sometimes though it maybe be better to really shrink
* on IO buffers
*/
if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
size_t start_buf = buf->content - buf->contentIO;
if (start_buf >= buf->size) {
memmove(buf->contentIO, &buf->content[0], buf->use);
buf->content = buf->contentIO;
buf->content[buf->use] = 0;
buf->size += start_buf;
}
}
} else {
memmove(buf->content, &buf->content[len], buf->use);
buf->content[buf->use] = 0;
}
UPDATE_COMPAT(buf)
return(len);
}
| 15,431 |
20,970 | 0 | static inline void set_IF(struct kernel_vm86_regs *regs)
{
VEFLAGS |= X86_EFLAGS_VIF;
if (VEFLAGS & X86_EFLAGS_VIP)
return_to_32bit(regs, VM86_STI);
}
| 15,432 |
32,369 | 0 | static int m_show(struct seq_file *m, void *v)
{
struct proc_mounts *p = proc_mounts(m);
struct mount *r = list_entry(v, struct mount, mnt_list);
return p->show(m, &r->mnt);
}
| 15,433 |
164,930 | 0 | ResourceDispatcherHostImpl::GetInterestingPerFrameLoadInfos() {
auto infos = std::make_unique<LoadInfoList>();
std::map<GlobalFrameRoutingId, LoadInfo> frame_infos;
for (const auto& loader : pending_loaders_) {
net::URLRequest* request = loader.second->request();
net::UploadProgress upload_progress = request->GetUploadProgress();
LoadInfo load_info;
load_info.host = request->url().host();
load_info.load_state = request->GetLoadState();
load_info.upload_size = upload_progress.size();
load_info.upload_position = upload_progress.position();
ResourceRequestInfoImpl* request_info = loader.second->GetRequestInfo();
load_info.web_contents_getter =
request_info->GetWebContentsGetterForRequest();
if (request_info->frame_tree_node_id() != -1) {
infos->push_back(load_info);
} else {
GlobalFrameRoutingId id(request_info->GetChildID(),
request_info->GetRenderFrameID());
auto existing = frame_infos.find(id);
if (existing == frame_infos.end() ||
LoadInfoIsMoreInteresting(load_info, existing->second)) {
frame_infos[id] = std::move(load_info);
}
}
}
for (auto it : frame_infos) {
infos->push_back(std::move(it.second));
}
return infos;
}
| 15,434 |
110,214 | 0 | void NaClProcessHost::OnAttachDebugExceptionHandler(const std::string& info,
IPC::Message* reply_msg) {
if (!AttachDebugExceptionHandler(info, reply_msg)) {
NaClProcessMsg_AttachDebugExceptionHandler::WriteReplyParams(reply_msg,
false);
Send(reply_msg);
}
}
| 15,435 |
164,259 | 0 | void AppCacheUpdateJob::OnDestructionImminent(AppCacheHost* host) {
auto found = pending_master_entries_.find(host->pending_master_entry_url());
CHECK(found != pending_master_entries_.end());
PendingHosts& hosts = found->second;
auto it = std::find(hosts.begin(), hosts.end(), host);
CHECK(it != hosts.end());
hosts.erase(it);
}
| 15,436 |
86,898 | 0 | static TEE_Result tee_svc_obj_generate_key_rsa(
struct tee_obj *o, const struct tee_cryp_obj_type_props *type_props,
uint32_t key_size,
const TEE_Attribute *params, uint32_t param_count)
{
TEE_Result res;
struct rsa_keypair *key = o->attr;
uint32_t e = TEE_U32_TO_BIG_ENDIAN(65537);
/* Copy the present attributes into the obj before starting */
res = tee_svc_cryp_obj_populate_type(o, type_props, params,
param_count);
if (res != TEE_SUCCESS)
return res;
if (!get_attribute(o, type_props, TEE_ATTR_RSA_PUBLIC_EXPONENT))
crypto_bignum_bin2bn((const uint8_t *)&e, sizeof(e), key->e);
res = crypto_acipher_gen_rsa_key(key, key_size);
if (res != TEE_SUCCESS)
return res;
/* Set bits for all known attributes for this object type */
o->have_attrs = (1 << type_props->num_type_attrs) - 1;
return TEE_SUCCESS;
}
| 15,437 |
34,432 | 0 | long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
{
struct btrfs_ioctl_space_args space_args;
struct btrfs_ioctl_space_info space;
struct btrfs_ioctl_space_info *dest;
struct btrfs_ioctl_space_info *dest_orig;
struct btrfs_ioctl_space_info __user *user_dest;
struct btrfs_space_info *info;
u64 types[] = {BTRFS_BLOCK_GROUP_DATA,
BTRFS_BLOCK_GROUP_SYSTEM,
BTRFS_BLOCK_GROUP_METADATA,
BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_METADATA};
int num_types = 4;
int alloc_size;
int ret = 0;
u64 slot_count = 0;
int i, c;
if (copy_from_user(&space_args,
(struct btrfs_ioctl_space_args __user *)arg,
sizeof(space_args)))
return -EFAULT;
for (i = 0; i < num_types; i++) {
struct btrfs_space_info *tmp;
info = NULL;
rcu_read_lock();
list_for_each_entry_rcu(tmp, &root->fs_info->space_info,
list) {
if (tmp->flags == types[i]) {
info = tmp;
break;
}
}
rcu_read_unlock();
if (!info)
continue;
down_read(&info->groups_sem);
for (c = 0; c < BTRFS_NR_RAID_TYPES; c++) {
if (!list_empty(&info->block_groups[c]))
slot_count++;
}
up_read(&info->groups_sem);
}
/* space_slots == 0 means they are asking for a count */
if (space_args.space_slots == 0) {
space_args.total_spaces = slot_count;
goto out;
}
slot_count = min_t(u64, space_args.space_slots, slot_count);
alloc_size = sizeof(*dest) * slot_count;
/* we generally have at most 6 or so space infos, one for each raid
* level. So, a whole page should be more than enough for everyone
*/
if (alloc_size > PAGE_CACHE_SIZE)
return -ENOMEM;
space_args.total_spaces = 0;
dest = kmalloc(alloc_size, GFP_NOFS);
if (!dest)
return -ENOMEM;
dest_orig = dest;
/* now we have a buffer to copy into */
for (i = 0; i < num_types; i++) {
struct btrfs_space_info *tmp;
if (!slot_count)
break;
info = NULL;
rcu_read_lock();
list_for_each_entry_rcu(tmp, &root->fs_info->space_info,
list) {
if (tmp->flags == types[i]) {
info = tmp;
break;
}
}
rcu_read_unlock();
if (!info)
continue;
down_read(&info->groups_sem);
for (c = 0; c < BTRFS_NR_RAID_TYPES; c++) {
if (!list_empty(&info->block_groups[c])) {
btrfs_get_block_group_info(
&info->block_groups[c], &space);
memcpy(dest, &space, sizeof(space));
dest++;
space_args.total_spaces++;
slot_count--;
}
if (!slot_count)
break;
}
up_read(&info->groups_sem);
}
user_dest = (struct btrfs_ioctl_space_info __user *)
(arg + sizeof(struct btrfs_ioctl_space_args));
if (copy_to_user(user_dest, dest_orig, alloc_size))
ret = -EFAULT;
kfree(dest_orig);
out:
if (ret == 0 && copy_to_user(arg, &space_args, sizeof(space_args)))
ret = -EFAULT;
return ret;
}
| 15,438 |
144,602 | 0 | void WebContentsImpl::OnEndColorChooser(int color_chooser_id) {
if (color_chooser_info_ &&
color_chooser_id == color_chooser_info_->identifier)
color_chooser_info_->chooser->End();
}
| 15,439 |
85,792 | 0 | int ocfs2_change_file_space(struct file *file, unsigned int cmd,
struct ocfs2_space_resv *sr)
{
struct inode *inode = file_inode(file);
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
int ret;
if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) &&
!ocfs2_writes_unwritten_extents(osb))
return -ENOTTY;
else if ((cmd == OCFS2_IOC_UNRESVSP || cmd == OCFS2_IOC_UNRESVSP64) &&
!ocfs2_sparse_alloc(osb))
return -ENOTTY;
if (!S_ISREG(inode->i_mode))
return -EINVAL;
if (!(file->f_mode & FMODE_WRITE))
return -EBADF;
ret = mnt_want_write_file(file);
if (ret)
return ret;
ret = __ocfs2_change_file_space(file, inode, file->f_pos, cmd, sr, 0);
mnt_drop_write_file(file);
return ret;
}
| 15,440 |
64,353 | 0 | static int cmd_resize(void *data, const char *input) {
RCore *core = (RCore *)data;
ut64 oldsize, newsize = 0;
st64 delta = 0;
int grow, ret;
if (core->file && core->file->desc)
oldsize = r_io_desc_size (core->io, core->file->desc);
else oldsize = 0;
switch (*input) {
case '2':
r_sys_cmdf ("radare%s", input);
return true;
case 'm':
if (input[1] == ' ')
r_file_rm (input + 2);
else eprintf ("Usage: rm [file] # removes a file\n");
return true;
case '\0':
if (core->file && core->file->desc) {
if (oldsize != -1) {
r_cons_printf ("%"PFMT64d"\n", oldsize);
}
}
return true;
case '+':
case '-':
delta = (st64)r_num_math (core->num, input);
newsize = oldsize + delta;
break;
case ' ':
newsize = r_num_math (core->num, input + 1);
if (newsize == 0) {
if (input[1] == '0')
eprintf ("Invalid size\n");
return false;
}
break;
default:
case '?':{
const char* help_msg[] = {
"Usage:", "r[+-][ size]", "Resize file",
"r", "", "display file size",
"r", " size", "expand or truncate file to given size",
"r-", "num", "remove num bytes, move following data down",
"r+", "num", "insert num bytes, move following data up",
"rm" ," [file]", "remove file",
"r2" ," [file]", "launch r2",
NULL};
r_core_cmd_help (core, help_msg);
}
return true;
}
grow = (newsize > oldsize);
if (grow) {
ret = r_io_resize (core->io, newsize);
if (ret < 1)
eprintf ("r_io_resize: cannot resize\n");
}
if (delta && core->offset < newsize)
r_io_shift (core->io, core->offset, grow?newsize:oldsize, delta);
if (!grow) {
ret = r_io_resize (core->io, newsize);
if (ret < 1)
eprintf ("r_io_resize: cannot resize\n");
}
if (newsize < core->offset+core->blocksize ||
oldsize < core->offset + core->blocksize) {
r_core_block_read (core);
}
return true;
}
| 15,441 |
23,762 | 0 | static inline int bond_slave_override(struct bonding *bond,
struct sk_buff *skb)
{
int i, res = 1;
struct slave *slave = NULL;
struct slave *check_slave;
if (!skb->queue_mapping)
return 1;
/* Find out if any slaves have the same mapping as this skb. */
bond_for_each_slave(bond, check_slave, i) {
if (check_slave->queue_id == skb->queue_mapping) {
slave = check_slave;
break;
}
}
/* If the slave isn't UP, use default transmit policy. */
if (slave && slave->queue_id && IS_UP(slave->dev) &&
(slave->link == BOND_LINK_UP)) {
res = bond_dev_queue_xmit(bond, skb, slave->dev);
}
return res;
}
| 15,442 |
119,012 | 0 | void WebContentsImpl::RenderViewForInterstitialPageCreated(
RenderViewHost* render_view_host) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
RenderViewForInterstitialPageCreated(render_view_host));
}
| 15,443 |
17,259 | 0 | CatalogueUnrefFPEs (FontPathElementPtr fpe)
{
CataloguePtr cat = fpe->private;
FontPathElementPtr subfpe;
int i;
for (i = 0; i < cat->fpeCount; i++)
{
subfpe = cat->fpeList[i];
subfpe->refcount--;
if (subfpe->refcount == 0)
{
FontFileFreeFPE (subfpe);
xfree(subfpe->name);
xfree(subfpe);
}
}
cat->fpeCount = 0;
}
| 15,444 |
44,415 | 0 | static int lxcfs_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
if (strncmp(path, "/cgroup", 7) == 0)
return cg_read(path, buf, size, offset, fi);
if (strncmp(path, "/proc", 5) == 0)
return proc_read(path, buf, size, offset, fi);
return -EINVAL;
}
| 15,445 |
88,559 | 0 | MagickExport MagickBooleanType SetBlobExtent(Image *image,
const MagickSizeType extent)
{
BlobInfo
*magick_restrict blob_info;
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->type != UndefinedStream);
blob_info=image->blob;
switch (blob_info->type)
{
case UndefinedStream:
break;
case StandardStream:
return(MagickFalse);
case FileStream:
{
MagickOffsetType
offset;
ssize_t
count;
if (extent != (MagickSizeType) ((off_t) extent))
return(MagickFalse);
offset=SeekBlob(image,0,SEEK_END);
if (offset < 0)
return(MagickFalse);
if ((MagickSizeType) offset >= extent)
break;
offset=SeekBlob(image,(MagickOffsetType) extent-1,SEEK_SET);
if (offset < 0)
break;
count=(ssize_t) fwrite((const unsigned char *) "",1,1,
blob_info->file_info.file);
#if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)
if (blob_info->synchronize != MagickFalse)
{
int
file;
file=fileno(blob_info->file_info.file);
if ((file == -1) || (offset < 0))
return(MagickFalse);
(void) posix_fallocate(file,offset,extent-offset);
}
#endif
offset=SeekBlob(image,offset,SEEK_SET);
if (count != 1)
return(MagickFalse);
break;
}
case PipeStream:
case ZipStream:
return(MagickFalse);
case BZipStream:
return(MagickFalse);
case FifoStream:
return(MagickFalse);
case BlobStream:
{
if (extent != (MagickSizeType) ((size_t) extent))
return(MagickFalse);
if (blob_info->mapped != MagickFalse)
{
MagickOffsetType
offset;
ssize_t
count;
(void) UnmapBlob(blob_info->data,blob_info->length);
RelinquishMagickResource(MapResource,blob_info->length);
if (extent != (MagickSizeType) ((off_t) extent))
return(MagickFalse);
offset=SeekBlob(image,0,SEEK_END);
if (offset < 0)
return(MagickFalse);
if ((MagickSizeType) offset >= extent)
break;
offset=SeekBlob(image,(MagickOffsetType) extent-1,SEEK_SET);
count=(ssize_t) fwrite((const unsigned char *) "",1,1,
blob_info->file_info.file);
#if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)
if (blob_info->synchronize != MagickFalse)
{
int
file;
file=fileno(blob_info->file_info.file);
if ((file == -1) || (offset < 0))
return(MagickFalse);
(void) posix_fallocate(file,offset,extent-offset);
}
#endif
offset=SeekBlob(image,offset,SEEK_SET);
if (count != 1)
return(MagickFalse);
(void) AcquireMagickResource(MapResource,extent);
blob_info->data=(unsigned char*) MapBlob(fileno(
blob_info->file_info.file),WriteMode,0,(size_t) extent);
blob_info->extent=(size_t) extent;
blob_info->length=(size_t) extent;
(void) SyncBlob(image);
break;
}
blob_info->extent=(size_t) extent;
blob_info->data=(unsigned char *) ResizeQuantumMemory(blob_info->data,
blob_info->extent+1,sizeof(*blob_info->data));
(void) SyncBlob(image);
if (blob_info->data == (unsigned char *) NULL)
{
(void) DetachBlob(blob_info);
return(MagickFalse);
}
break;
}
}
return(MagickTrue);
}
| 15,446 |
27,807 | 0 | void br_multicast_add_port(struct net_bridge_port *port)
{
port->multicast_router = 1;
setup_timer(&port->multicast_router_timer, br_multicast_router_expired,
(unsigned long)port);
setup_timer(&port->multicast_query_timer,
br_multicast_port_query_expired, (unsigned long)port);
}
| 15,447 |
18,612 | 0 | SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
{
struct socket *sock;
struct sockaddr_storage address;
int err, fput_needed;
sock = sockfd_lookup_light(fd, &err, &fput_needed);
if (sock) {
err = move_addr_to_kernel(umyaddr, addrlen, &address);
if (err >= 0) {
err = security_socket_bind(sock,
(struct sockaddr *)&address,
addrlen);
if (!err)
err = sock->ops->bind(sock,
(struct sockaddr *)
&address, addrlen);
}
fput_light(sock->file, fput_needed);
}
return err;
}
| 15,448 |
117,320 | 0 | xmlXPtrLocationSetMerge(xmlLocationSetPtr val1, xmlLocationSetPtr val2) {
int i;
if (val1 == NULL) return(NULL);
if (val2 == NULL) return(val1);
/*
* !!!!! this can be optimized a lot, knowing that both
* val1 and val2 already have unicity of their values.
*/
for (i = 0;i < val2->locNr;i++)
xmlXPtrLocationSetAdd(val1, val2->locTab[i]);
return(val1);
}
| 15,449 |
25,246 | 0 | armv6pmu_disable_event(struct hw_perf_event *hwc,
int idx)
{
unsigned long val, mask, evt, flags;
if (ARMV6_CYCLE_COUNTER == idx) {
mask = ARMV6_PMCR_CCOUNT_IEN;
evt = 0;
} else if (ARMV6_COUNTER0 == idx) {
mask = ARMV6_PMCR_COUNT0_IEN | ARMV6_PMCR_EVT_COUNT0_MASK;
evt = ARMV6_PERFCTR_NOP << ARMV6_PMCR_EVT_COUNT0_SHIFT;
} else if (ARMV6_COUNTER1 == idx) {
mask = ARMV6_PMCR_COUNT1_IEN | ARMV6_PMCR_EVT_COUNT1_MASK;
evt = ARMV6_PERFCTR_NOP << ARMV6_PMCR_EVT_COUNT1_SHIFT;
} else {
WARN_ONCE(1, "invalid counter number (%d)\n", idx);
return;
}
/*
* Mask out the current event and set the counter to count the number
* of ETM bus signal assertion cycles. The external reporting should
* be disabled and so this should never increment.
*/
raw_spin_lock_irqsave(&pmu_lock, flags);
val = armv6_pmcr_read();
val &= ~mask;
val |= evt;
armv6_pmcr_write(val);
raw_spin_unlock_irqrestore(&pmu_lock, flags);
}
| 15,450 |
171,354 | 0 | void OMXCodec::on_message(const omx_message &msg) {
if (mState == ERROR) {
/*
* only drop EVENT messages, EBD and FBD are still
* processed for bookkeeping purposes
*/
if (msg.type == omx_message::EVENT) {
ALOGW("Dropping OMX EVENT message - we're in ERROR state.");
return;
}
}
switch (msg.type) {
case omx_message::EVENT:
{
onEvent(
msg.u.event_data.event, msg.u.event_data.data1,
msg.u.event_data.data2);
break;
}
case omx_message::EMPTY_BUFFER_DONE:
{
IOMX::buffer_id buffer = msg.u.extended_buffer_data.buffer;
CODEC_LOGV("EMPTY_BUFFER_DONE(buffer: %u)", buffer);
Vector<BufferInfo> *buffers = &mPortBuffers[kPortIndexInput];
size_t i = 0;
while (i < buffers->size() && (*buffers)[i].mBuffer != buffer) {
++i;
}
CHECK(i < buffers->size());
if ((*buffers)[i].mStatus != OWNED_BY_COMPONENT) {
ALOGW("We already own input buffer %u, yet received "
"an EMPTY_BUFFER_DONE.", buffer);
}
BufferInfo* info = &buffers->editItemAt(i);
info->mStatus = OWNED_BY_US;
if (info->mMediaBuffer != NULL) {
info->mMediaBuffer->release();
info->mMediaBuffer = NULL;
}
if (mPortStatus[kPortIndexInput] == DISABLING) {
CODEC_LOGV("Port is disabled, freeing buffer %u", buffer);
status_t err = freeBuffer(kPortIndexInput, i);
CHECK_EQ(err, (status_t)OK);
} else if (mState != ERROR
&& mPortStatus[kPortIndexInput] != SHUTTING_DOWN) {
CHECK_EQ((int)mPortStatus[kPortIndexInput], (int)ENABLED);
if (mFlags & kUseSecureInputBuffers) {
drainAnyInputBuffer();
} else {
drainInputBuffer(&buffers->editItemAt(i));
}
}
break;
}
case omx_message::FILL_BUFFER_DONE:
{
IOMX::buffer_id buffer = msg.u.extended_buffer_data.buffer;
OMX_U32 flags = msg.u.extended_buffer_data.flags;
CODEC_LOGV("FILL_BUFFER_DONE(buffer: %u, size: %u, flags: 0x%08x, timestamp: %lld us (%.2f secs))",
buffer,
msg.u.extended_buffer_data.range_length,
flags,
msg.u.extended_buffer_data.timestamp,
msg.u.extended_buffer_data.timestamp / 1E6);
Vector<BufferInfo> *buffers = &mPortBuffers[kPortIndexOutput];
size_t i = 0;
while (i < buffers->size() && (*buffers)[i].mBuffer != buffer) {
++i;
}
CHECK(i < buffers->size());
BufferInfo *info = &buffers->editItemAt(i);
if (info->mStatus != OWNED_BY_COMPONENT) {
ALOGW("We already own output buffer %u, yet received "
"a FILL_BUFFER_DONE.", buffer);
}
info->mStatus = OWNED_BY_US;
if (mPortStatus[kPortIndexOutput] == DISABLING) {
CODEC_LOGV("Port is disabled, freeing buffer %u", buffer);
status_t err = freeBuffer(kPortIndexOutput, i);
CHECK_EQ(err, (status_t)OK);
#if 0
} else if (mPortStatus[kPortIndexOutput] == ENABLED
&& (flags & OMX_BUFFERFLAG_EOS)) {
CODEC_LOGV("No more output data.");
mNoMoreOutputData = true;
mBufferFilled.signal();
#endif
} else if (mPortStatus[kPortIndexOutput] != SHUTTING_DOWN) {
CHECK_EQ((int)mPortStatus[kPortIndexOutput], (int)ENABLED);
MediaBuffer *buffer = info->mMediaBuffer;
bool isGraphicBuffer = buffer->graphicBuffer() != NULL;
if (!isGraphicBuffer
&& msg.u.extended_buffer_data.range_offset
+ msg.u.extended_buffer_data.range_length
> buffer->size()) {
CODEC_LOGE(
"Codec lied about its buffer size requirements, "
"sending a buffer larger than the originally "
"advertised size in FILL_BUFFER_DONE!");
}
buffer->set_range(
msg.u.extended_buffer_data.range_offset,
msg.u.extended_buffer_data.range_length);
buffer->meta_data()->clear();
buffer->meta_data()->setInt64(
kKeyTime, msg.u.extended_buffer_data.timestamp);
if (msg.u.extended_buffer_data.flags & OMX_BUFFERFLAG_SYNCFRAME) {
buffer->meta_data()->setInt32(kKeyIsSyncFrame, true);
}
bool isCodecSpecific = false;
if (msg.u.extended_buffer_data.flags & OMX_BUFFERFLAG_CODECCONFIG) {
buffer->meta_data()->setInt32(kKeyIsCodecConfig, true);
isCodecSpecific = true;
}
if (isGraphicBuffer || mQuirks & kOutputBuffersAreUnreadable) {
buffer->meta_data()->setInt32(kKeyIsUnreadable, true);
}
buffer->meta_data()->setInt32(
kKeyBufferID,
msg.u.extended_buffer_data.buffer);
if (msg.u.extended_buffer_data.flags & OMX_BUFFERFLAG_EOS) {
CODEC_LOGV("No more output data.");
mNoMoreOutputData = true;
}
if (mIsEncoder && mIsVideo) {
int64_t decodingTimeUs = isCodecSpecific? 0: getDecodingTimeUs();
buffer->meta_data()->setInt64(kKeyDecodingTime, decodingTimeUs);
}
if (mTargetTimeUs >= 0) {
CHECK(msg.u.extended_buffer_data.timestamp <= mTargetTimeUs);
if (msg.u.extended_buffer_data.timestamp < mTargetTimeUs) {
CODEC_LOGV(
"skipping output buffer at timestamp %lld us",
msg.u.extended_buffer_data.timestamp);
fillOutputBuffer(info);
break;
}
CODEC_LOGV(
"returning output buffer at target timestamp "
"%lld us",
msg.u.extended_buffer_data.timestamp);
mTargetTimeUs = -1;
}
mFilledBuffers.push_back(i);
mBufferFilled.signal();
if (mIsEncoder) {
sched_yield();
}
}
break;
}
default:
{
CHECK(!"should not be here.");
break;
}
}
}
| 15,451 |
164,557 | 0 | static void countInverse(sqlite3_context *ctx, int argc, sqlite3_value **argv){
CountCtx *p;
p = sqlite3_aggregate_context(ctx, sizeof(*p));
/* p is always non-NULL since countStep() will have been called first */
if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && ALWAYS(p) ){
p->n--;
#ifdef SQLITE_DEBUG
p->bInverse = 1;
#endif
}
}
| 15,452 |
165,227 | 0 | void ArcVoiceInteractionFrameworkService::OnConnectionReady() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (is_request_pending_) {
is_request_pending_ = false;
if (is_pending_request_toggle_) {
mojom::VoiceInteractionFrameworkInstance* framework_instance =
ARC_GET_INSTANCE_FOR_METHOD(
arc_bridge_service_->voice_interaction_framework(),
ToggleVoiceInteractionSession);
DCHECK(framework_instance);
framework_instance->ToggleVoiceInteractionSession(IsHomescreenActive());
} else {
mojom::VoiceInteractionFrameworkInstance* framework_instance =
ARC_GET_INSTANCE_FOR_METHOD(
arc_bridge_service_->voice_interaction_framework(),
StartVoiceInteractionSession);
DCHECK(framework_instance);
framework_instance->StartVoiceInteractionSession(IsHomescreenActive());
}
}
highlighter_client_->Attach();
}
| 15,453 |
110,524 | 0 | void GLES2DecoderImpl::DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) {
VertexAttribManager::VertexAttribInfo* info =
vertex_attrib_manager_->GetVertexAttribInfo(index);
if (!info) {
SetGLError(GL_INVALID_VALUE, "glVertexAttrib2f", "index out of range");
return;
}
VertexAttribManager::VertexAttribInfo::Vec4 value;
value.v[0] = v0;
value.v[1] = v1;
value.v[2] = 0.0f;
value.v[3] = 1.0f;
info->set_value(value);
glVertexAttrib2f(index, v0, v1);
}
| 15,454 |
142,298 | 0 | bool ChromePasswordManagerClient::IsFillingEnabled(const GURL& url) const {
const bool ssl_errors = net::IsCertStatusError(GetMainFrameCertStatus());
if (log_manager_->IsLoggingActive()) {
password_manager::BrowserSavePasswordProgressLogger logger(
log_manager_.get());
logger.LogBoolean(Logger::STRING_SSL_ERRORS_PRESENT, ssl_errors);
}
return !ssl_errors && IsPasswordManagementEnabledForCurrentPage(url);
}
| 15,455 |
141,127 | 0 | bool Document::IsDelayingLoadEvent() {
if (ThreadState::Current()->SweepForbidden()) {
if (!load_event_delay_count_)
CheckLoadEventSoon();
return true;
}
return load_event_delay_count_;
}
| 15,456 |
147,846 | 0 | static void ShortAttributeAttributeSetter(
v8::Local<v8::Value> v8_value, const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
ALLOW_UNUSED_LOCAL(isolate);
v8::Local<v8::Object> holder = info.Holder();
ALLOW_UNUSED_LOCAL(holder);
TestObject* impl = V8TestObject::ToImpl(holder);
ExceptionState exception_state(isolate, ExceptionState::kSetterContext, "TestObject", "shortAttribute");
int16_t cpp_value = NativeValueTraits<IDLShort>::NativeValue(info.GetIsolate(), v8_value, exception_state);
if (exception_state.HadException())
return;
impl->setShortAttribute(cpp_value);
}
| 15,457 |
29,919 | 0 | static int uid_m_show(struct seq_file *seq, void *v)
{
struct user_namespace *ns = seq->private;
struct uid_gid_extent *extent = v;
struct user_namespace *lower_ns;
uid_t lower;
lower_ns = seq_user_ns(seq);
if ((lower_ns == ns) && lower_ns->parent)
lower_ns = lower_ns->parent;
lower = from_kuid(lower_ns, KUIDT_INIT(extent->lower_first));
seq_printf(seq, "%10u %10u %10u\n",
extent->first,
lower,
extent->count);
return 0;
}
| 15,458 |
147,743 | 0 | void V8TestObject::ReadonlyDOMTimeStampMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_readonlyDOMTimeStampMethod");
test_object_v8_internal::ReadonlyDOMTimeStampMethodMethod(info);
}
| 15,459 |
87,856 | 0 | callout_tag_table_new(CalloutTagTable** rt)
{
CalloutTagTable* t;
*rt = 0;
t = onig_st_init_strend_table_with_size(INIT_TAG_NAMES_ALLOC_NUM);
CHECK_NULL_RETURN_MEMERR(t);
*rt = t;
return ONIG_NORMAL;
}
| 15,460 |
10,999 | 0 | inline static char xml_decode_iso_8859_1(unsigned short c)
{
return (char)(c > 0xff ? '?' : c);
}
| 15,461 |
134,513 | 0 | void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) {
if (drag_dest_delegate_)
drag_dest_delegate_->DragInitialize(web_contents_);
current_drop_data_.reset(new DropData());
PrepareDropData(current_drop_data_.get(), event.data());
blink::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
gfx::Point screen_pt =
gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint();
current_rvh_for_drag_ = web_contents_->GetRenderViewHost();
web_contents_->GetRenderViewHost()->DragTargetDragEnter(
*current_drop_data_.get(), event.location(), screen_pt, op,
ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
if (drag_dest_delegate_) {
drag_dest_delegate_->OnReceiveDragData(event.data());
drag_dest_delegate_->OnDragEnter();
}
}
| 15,462 |
64,731 | 0 | int dns_packet_append_rr(DnsPacket *p, const DnsResourceRecord *rr, const DnsAnswerFlags flags, size_t *start, size_t *rdata_start) {
size_t saved_size, rdlength_offset, end, rdlength, rds;
uint32_t ttl;
int r;
assert(p);
assert(rr);
saved_size = p->size;
r = dns_packet_append_key(p, rr->key, flags, NULL);
if (r < 0)
goto fail;
ttl = flags & DNS_ANSWER_GOODBYE ? 0 : rr->ttl;
r = dns_packet_append_uint32(p, ttl, NULL);
if (r < 0)
goto fail;
/* Initially we write 0 here */
r = dns_packet_append_uint16(p, 0, &rdlength_offset);
if (r < 0)
goto fail;
rds = p->size - saved_size;
switch (rr->unparseable ? _DNS_TYPE_INVALID : rr->key->type) {
case DNS_TYPE_SRV:
r = dns_packet_append_uint16(p, rr->srv.priority, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint16(p, rr->srv.weight, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint16(p, rr->srv.port, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_name(p, rr->srv.name, true, false, NULL);
break;
case DNS_TYPE_PTR:
case DNS_TYPE_NS:
case DNS_TYPE_CNAME:
case DNS_TYPE_DNAME:
r = dns_packet_append_name(p, rr->ptr.name, true, false, NULL);
break;
case DNS_TYPE_HINFO:
r = dns_packet_append_string(p, rr->hinfo.cpu, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_string(p, rr->hinfo.os, NULL);
break;
case DNS_TYPE_SPF: /* exactly the same as TXT */
case DNS_TYPE_TXT:
if (!rr->txt.items) {
/* RFC 6763, section 6.1 suggests to generate
* single empty string for an empty array. */
r = dns_packet_append_raw_string(p, NULL, 0, NULL);
if (r < 0)
goto fail;
} else {
DnsTxtItem *i;
LIST_FOREACH(items, i, rr->txt.items) {
r = dns_packet_append_raw_string(p, i->data, i->length, NULL);
if (r < 0)
goto fail;
}
}
r = 0;
break;
case DNS_TYPE_A:
r = dns_packet_append_blob(p, &rr->a.in_addr, sizeof(struct in_addr), NULL);
break;
case DNS_TYPE_AAAA:
r = dns_packet_append_blob(p, &rr->aaaa.in6_addr, sizeof(struct in6_addr), NULL);
break;
case DNS_TYPE_SOA:
r = dns_packet_append_name(p, rr->soa.mname, true, false, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_name(p, rr->soa.rname, true, false, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->soa.serial, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->soa.refresh, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->soa.retry, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->soa.expire, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->soa.minimum, NULL);
break;
case DNS_TYPE_MX:
r = dns_packet_append_uint16(p, rr->mx.priority, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_name(p, rr->mx.exchange, true, false, NULL);
break;
case DNS_TYPE_LOC:
r = dns_packet_append_uint8(p, rr->loc.version, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->loc.size, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->loc.horiz_pre, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->loc.vert_pre, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->loc.latitude, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->loc.longitude, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->loc.altitude, NULL);
break;
case DNS_TYPE_DS:
r = dns_packet_append_uint16(p, rr->ds.key_tag, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->ds.algorithm, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->ds.digest_type, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_blob(p, rr->ds.digest, rr->ds.digest_size, NULL);
break;
case DNS_TYPE_SSHFP:
r = dns_packet_append_uint8(p, rr->sshfp.algorithm, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->sshfp.fptype, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_blob(p, rr->sshfp.fingerprint, rr->sshfp.fingerprint_size, NULL);
break;
case DNS_TYPE_DNSKEY:
r = dns_packet_append_uint16(p, rr->dnskey.flags, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->dnskey.protocol, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->dnskey.algorithm, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_blob(p, rr->dnskey.key, rr->dnskey.key_size, NULL);
break;
case DNS_TYPE_RRSIG:
r = dns_packet_append_uint16(p, rr->rrsig.type_covered, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->rrsig.algorithm, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->rrsig.labels, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->rrsig.original_ttl, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->rrsig.expiration, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint32(p, rr->rrsig.inception, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint16(p, rr->rrsig.key_tag, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_name(p, rr->rrsig.signer, false, true, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_blob(p, rr->rrsig.signature, rr->rrsig.signature_size, NULL);
break;
case DNS_TYPE_NSEC:
r = dns_packet_append_name(p, rr->nsec.next_domain_name, false, false, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_types(p, rr->nsec.types, NULL);
if (r < 0)
goto fail;
break;
case DNS_TYPE_NSEC3:
r = dns_packet_append_uint8(p, rr->nsec3.algorithm, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->nsec3.flags, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint16(p, rr->nsec3.iterations, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->nsec3.salt_size, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_blob(p, rr->nsec3.salt, rr->nsec3.salt_size, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->nsec3.next_hashed_name_size, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_blob(p, rr->nsec3.next_hashed_name, rr->nsec3.next_hashed_name_size, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_types(p, rr->nsec3.types, NULL);
if (r < 0)
goto fail;
break;
case DNS_TYPE_TLSA:
r = dns_packet_append_uint8(p, rr->tlsa.cert_usage, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->tlsa.selector, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_uint8(p, rr->tlsa.matching_type, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_blob(p, rr->tlsa.data, rr->tlsa.data_size, NULL);
break;
case DNS_TYPE_CAA:
r = dns_packet_append_uint8(p, rr->caa.flags, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_string(p, rr->caa.tag, NULL);
if (r < 0)
goto fail;
r = dns_packet_append_blob(p, rr->caa.value, rr->caa.value_size, NULL);
break;
case DNS_TYPE_OPT:
case DNS_TYPE_OPENPGPKEY:
case _DNS_TYPE_INVALID: /* unparseable */
default:
r = dns_packet_append_blob(p, rr->generic.data, rr->generic.data_size, NULL);
break;
}
if (r < 0)
goto fail;
/* Let's calculate the actual data size and update the field */
rdlength = p->size - rdlength_offset - sizeof(uint16_t);
if (rdlength > 0xFFFF) {
r = -ENOSPC;
goto fail;
}
end = p->size;
p->size = rdlength_offset;
r = dns_packet_append_uint16(p, rdlength, NULL);
if (r < 0)
goto fail;
p->size = end;
if (start)
*start = saved_size;
if (rdata_start)
*rdata_start = rds;
return 0;
fail:
dns_packet_truncate(p, saved_size);
return r;
}
| 15,463 |
72,068 | 0 | static void _fb_wrunlock(void)
{
slurm_mutex_lock(&file_bcast_mutex);
fb_write_lock--;
pthread_cond_broadcast(&file_bcast_cond);
slurm_mutex_unlock(&file_bcast_mutex);
}
| 15,464 |
9,829 | 0 | struct http_res_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy)
{
struct http_res_rule *rule;
struct http_res_action_kw *custom = NULL;
int cur_arg;
char *error;
rule = calloc(1, sizeof(*rule));
if (!rule) {
Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out_err;
}
if (!strcmp(args[0], "allow")) {
rule->action = HTTP_RES_ACT_ALLOW;
cur_arg = 1;
} else if (!strcmp(args[0], "deny")) {
rule->action = HTTP_RES_ACT_DENY;
cur_arg = 1;
} else if (!strcmp(args[0], "set-nice")) {
rule->action = HTTP_RES_ACT_SET_NICE;
cur_arg = 1;
if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer value).\n",
file, linenum, args[0]);
goto out_err;
}
rule->arg.nice = atoi(args[cur_arg]);
if (rule->arg.nice < -1024)
rule->arg.nice = -1024;
else if (rule->arg.nice > 1024)
rule->arg.nice = 1024;
cur_arg++;
} else if (!strcmp(args[0], "set-tos")) {
#ifdef IP_TOS
char *err;
rule->action = HTTP_RES_ACT_SET_TOS;
cur_arg = 1;
if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer/hex value).\n",
file, linenum, args[0]);
goto out_err;
}
rule->arg.tos = strtol(args[cur_arg], &err, 0);
if (err && *err != '\0') {
Alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-response %s' (integer/hex value expected).\n",
file, linenum, err, args[0]);
goto out_err;
}
cur_arg++;
#else
Alert("parsing [%s:%d]: 'http-response %s' is not supported on this platform (IP_TOS undefined).\n", file, linenum, args[0]);
goto out_err;
#endif
} else if (!strcmp(args[0], "set-mark")) {
#ifdef SO_MARK
char *err;
rule->action = HTTP_RES_ACT_SET_MARK;
cur_arg = 1;
if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (integer/hex value).\n",
file, linenum, args[0]);
goto out_err;
}
rule->arg.mark = strtoul(args[cur_arg], &err, 0);
if (err && *err != '\0') {
Alert("parsing [%s:%d]: invalid character starting at '%s' in 'http-response %s' (integer/hex value expected).\n",
file, linenum, err, args[0]);
goto out_err;
}
cur_arg++;
global.last_checks |= LSTCHK_NETADM;
#else
Alert("parsing [%s:%d]: 'http-response %s' is not supported on this platform (SO_MARK undefined).\n", file, linenum, args[0]);
goto out_err;
#endif
} else if (!strcmp(args[0], "set-log-level")) {
rule->action = HTTP_RES_ACT_SET_LOGL;
cur_arg = 1;
if (!*args[cur_arg] ||
(*args[cur_arg + 1] && strcmp(args[cur_arg + 1], "if") != 0 && strcmp(args[cur_arg + 1], "unless") != 0)) {
bad_log_level:
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument (log level name or 'silent').\n",
file, linenum, args[0]);
goto out_err;
}
if (strcmp(args[cur_arg], "silent") == 0)
rule->arg.loglevel = -1;
else if ((rule->arg.loglevel = get_log_level(args[cur_arg] + 1)) == 0)
goto bad_log_level;
cur_arg++;
} else if (strcmp(args[0], "add-header") == 0 || strcmp(args[0], "set-header") == 0) {
rule->action = *args[0] == 'a' ? HTTP_RES_ACT_ADD_HDR : HTTP_RES_ACT_SET_HDR;
cur_arg = 1;
if (!*args[cur_arg] || !*args[cur_arg+1] ||
(*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 2 arguments.\n",
file, linenum, args[0]);
goto out_err;
}
rule->arg.hdr_add.name = strdup(args[cur_arg]);
rule->arg.hdr_add.name_len = strlen(rule->arg.hdr_add.name);
LIST_INIT(&rule->arg.hdr_add.fmt);
proxy->conf.args.ctx = ARGC_HRS;
parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
file, linenum);
free(proxy->conf.lfs_file);
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
proxy->conf.lfs_line = proxy->conf.args.line;
cur_arg += 2;
} else if (strcmp(args[0], "replace-header") == 0 || strcmp(args[0], "replace-value") == 0) {
rule->action = args[0][8] == 'h' ? HTTP_RES_ACT_REPLACE_HDR : HTTP_RES_ACT_REPLACE_VAL;
cur_arg = 1;
if (!*args[cur_arg] || !*args[cur_arg+1] || !*args[cur_arg+2] ||
(*args[cur_arg+3] && strcmp(args[cur_arg+3], "if") != 0 && strcmp(args[cur_arg+3], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 3 arguments.\n",
file, linenum, args[0]);
goto out_err;
}
rule->arg.hdr_add.name = strdup(args[cur_arg]);
rule->arg.hdr_add.name_len = strlen(rule->arg.hdr_add.name);
LIST_INIT(&rule->arg.hdr_add.fmt);
error = NULL;
if (!regex_comp(args[cur_arg + 1], &rule->arg.hdr_add.re, 1, 1, &error)) {
Alert("parsing [%s:%d] : '%s' : %s.\n", file, linenum,
args[cur_arg + 1], error);
free(error);
goto out_err;
}
proxy->conf.args.ctx = ARGC_HRQ;
parse_logformat_string(args[cur_arg + 2], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
file, linenum);
free(proxy->conf.lfs_file);
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
proxy->conf.lfs_line = proxy->conf.args.line;
cur_arg += 3;
} else if (strcmp(args[0], "del-header") == 0) {
rule->action = HTTP_RES_ACT_DEL_HDR;
cur_arg = 1;
if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n",
file, linenum, args[0]);
goto out_err;
}
rule->arg.hdr_add.name = strdup(args[cur_arg]);
rule->arg.hdr_add.name_len = strlen(rule->arg.hdr_add.name);
proxy->conf.args.ctx = ARGC_HRS;
free(proxy->conf.lfs_file);
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
proxy->conf.lfs_line = proxy->conf.args.line;
cur_arg += 1;
} else if (strncmp(args[0], "add-acl", 7) == 0) {
/* http-request add-acl(<reference (acl name)>) <key pattern> */
rule->action = HTTP_RES_ACT_ADD_ACL;
/*
* '+ 8' for 'add-acl('
* '- 9' for 'add-acl(' + trailing ')'
*/
rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9);
cur_arg = 1;
if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n",
file, linenum, args[0]);
goto out_err;
}
LIST_INIT(&rule->arg.map.key);
proxy->conf.args.ctx = ARGC_HRS;
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
file, linenum);
free(proxy->conf.lfs_file);
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
proxy->conf.lfs_line = proxy->conf.args.line;
cur_arg += 1;
} else if (strncmp(args[0], "del-acl", 7) == 0) {
/* http-response del-acl(<reference (acl name)>) <key pattern> */
rule->action = HTTP_RES_ACT_DEL_ACL;
/*
* '+ 8' for 'del-acl('
* '- 9' for 'del-acl(' + trailing ')'
*/
rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9);
cur_arg = 1;
if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n",
file, linenum, args[0]);
goto out_err;
}
LIST_INIT(&rule->arg.map.key);
proxy->conf.args.ctx = ARGC_HRS;
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
file, linenum);
free(proxy->conf.lfs_file);
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
proxy->conf.lfs_line = proxy->conf.args.line;
cur_arg += 1;
} else if (strncmp(args[0], "del-map", 7) == 0) {
/* http-response del-map(<reference (map name)>) <key pattern> */
rule->action = HTTP_RES_ACT_DEL_MAP;
/*
* '+ 8' for 'del-map('
* '- 9' for 'del-map(' + trailing ')'
*/
rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9);
cur_arg = 1;
if (!*args[cur_arg] ||
(*args[cur_arg+1] && strcmp(args[cur_arg+1], "if") != 0 && strcmp(args[cur_arg+1], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 1 argument.\n",
file, linenum, args[0]);
goto out_err;
}
LIST_INIT(&rule->arg.map.key);
proxy->conf.args.ctx = ARGC_HRS;
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
file, linenum);
free(proxy->conf.lfs_file);
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
proxy->conf.lfs_line = proxy->conf.args.line;
cur_arg += 1;
} else if (strncmp(args[0], "set-map", 7) == 0) {
/* http-response set-map(<reference (map name)>) <key pattern> <value pattern> */
rule->action = HTTP_RES_ACT_SET_MAP;
/*
* '+ 8' for 'set-map('
* '- 9' for 'set-map(' + trailing ')'
*/
rule->arg.map.ref = my_strndup(args[0] + 8, strlen(args[0]) - 9);
cur_arg = 1;
if (!*args[cur_arg] || !*args[cur_arg+1] ||
(*args[cur_arg+2] && strcmp(args[cur_arg+2], "if") != 0 && strcmp(args[cur_arg+2], "unless") != 0)) {
Alert("parsing [%s:%d]: 'http-response %s' expects exactly 2 arguments.\n",
file, linenum, args[0]);
goto out_err;
}
LIST_INIT(&rule->arg.map.key);
LIST_INIT(&rule->arg.map.value);
proxy->conf.args.ctx = ARGC_HRS;
/* key pattern */
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
file, linenum);
/* value pattern */
parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.map.value, LOG_OPT_HTTP,
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
file, linenum);
free(proxy->conf.lfs_file);
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
proxy->conf.lfs_line = proxy->conf.args.line;
cur_arg += 2;
} else if (((custom = action_http_res_custom(args[0])) != NULL)) {
char *errmsg = NULL;
cur_arg = 1;
/* try in the module list */
if (custom->parse(args, &cur_arg, proxy, rule, &errmsg) < 0) {
Alert("parsing [%s:%d] : error detected in %s '%s' while parsing 'http-response %s' rule : %s.\n",
file, linenum, proxy_type_str(proxy), proxy->id, args[0], errmsg);
free(errmsg);
goto out_err;
}
} else {
Alert("parsing [%s:%d]: 'http-response' expects 'allow', 'deny', 'redirect', 'add-header', 'del-header', 'set-header', 'replace-header', 'replace-value', 'set-nice', 'set-tos', 'set-mark', 'set-log-level', 'del-acl', 'add-acl', 'del-map', 'set-map', but got '%s'%s.\n",
file, linenum, args[0], *args[0] ? "" : " (missing argument)");
goto out_err;
}
if (strcmp(args[cur_arg], "if") == 0 || strcmp(args[cur_arg], "unless") == 0) {
struct acl_cond *cond;
char *errmsg = NULL;
if ((cond = build_acl_cond(file, linenum, proxy, args+cur_arg, &errmsg)) == NULL) {
Alert("parsing [%s:%d] : error detected while parsing an 'http-response %s' condition : %s.\n",
file, linenum, args[0], errmsg);
free(errmsg);
goto out_err;
}
rule->cond = cond;
}
else if (*args[cur_arg]) {
Alert("parsing [%s:%d]: 'http-response %s' expects"
" either 'if' or 'unless' followed by a condition but found '%s'.\n",
file, linenum, args[0], args[cur_arg]);
goto out_err;
}
return rule;
out_err:
free(rule);
return NULL;
}
| 15,465 |
114,474 | 0 | void EglRenderingVDAClient::NotifyInitializeDone() {
SetState(CS_INITIALIZED);
initialize_done_ticks_ = base::TimeTicks::Now();
for (int i = 0; i < num_in_flight_decodes_; ++i)
DecodeNextNALUs();
}
| 15,466 |
64,775 | 0 | int crypto_register_skciphers(struct skcipher_alg *algs, int count)
{
int i, ret;
for (i = 0; i < count; i++) {
ret = crypto_register_skcipher(&algs[i]);
if (ret)
goto err;
}
return 0;
err:
for (--i; i >= 0; --i)
crypto_unregister_skcipher(&algs[i]);
return ret;
}
| 15,467 |
47,477 | 0 | static int __init adf_register_ctl_device_driver(void)
{
mutex_init(&adf_ctl_lock);
if (qat_algs_init())
goto err_algs_init;
if (adf_chr_drv_create())
goto err_chr_dev;
if (adf_init_aer())
goto err_aer;
if (qat_crypto_register())
goto err_crypto_register;
return 0;
err_crypto_register:
adf_exit_aer();
err_aer:
adf_chr_drv_destroy();
err_chr_dev:
qat_algs_exit();
err_algs_init:
mutex_destroy(&adf_ctl_lock);
return -EFAULT;
}
| 15,468 |
19,298 | 0 | static struct sock *unix_from_bucket(struct seq_file *seq, loff_t *pos)
{
unsigned long offset = get_offset(*pos);
unsigned long bucket = get_bucket(*pos);
struct sock *sk;
unsigned long count = 0;
for (sk = sk_head(&unix_socket_table[bucket]); sk; sk = sk_next(sk)) {
if (sock_net(sk) != seq_file_net(seq))
continue;
if (++count == offset)
break;
}
return sk;
}
| 15,469 |
31,934 | 0 | perf_event_alloc(struct perf_event_attr *attr, int cpu,
struct task_struct *task,
struct perf_event *group_leader,
struct perf_event *parent_event,
perf_overflow_handler_t overflow_handler,
void *context)
{
struct pmu *pmu;
struct perf_event *event;
struct hw_perf_event *hwc;
long err;
if ((unsigned)cpu >= nr_cpu_ids) {
if (!task || cpu != -1)
return ERR_PTR(-EINVAL);
}
event = kzalloc(sizeof(*event), GFP_KERNEL);
if (!event)
return ERR_PTR(-ENOMEM);
/*
* Single events are their own group leaders, with an
* empty sibling list:
*/
if (!group_leader)
group_leader = event;
mutex_init(&event->child_mutex);
INIT_LIST_HEAD(&event->child_list);
INIT_LIST_HEAD(&event->group_entry);
INIT_LIST_HEAD(&event->event_entry);
INIT_LIST_HEAD(&event->sibling_list);
INIT_LIST_HEAD(&event->rb_entry);
init_waitqueue_head(&event->waitq);
init_irq_work(&event->pending, perf_pending_event);
mutex_init(&event->mmap_mutex);
atomic_long_set(&event->refcount, 1);
event->cpu = cpu;
event->attr = *attr;
event->group_leader = group_leader;
event->pmu = NULL;
event->oncpu = -1;
event->parent = parent_event;
event->ns = get_pid_ns(task_active_pid_ns(current));
event->id = atomic64_inc_return(&perf_event_id);
event->state = PERF_EVENT_STATE_INACTIVE;
if (task) {
event->attach_state = PERF_ATTACH_TASK;
if (attr->type == PERF_TYPE_TRACEPOINT)
event->hw.tp_target = task;
#ifdef CONFIG_HAVE_HW_BREAKPOINT
/*
* hw_breakpoint is a bit difficult here..
*/
else if (attr->type == PERF_TYPE_BREAKPOINT)
event->hw.bp_target = task;
#endif
}
if (!overflow_handler && parent_event) {
overflow_handler = parent_event->overflow_handler;
context = parent_event->overflow_handler_context;
}
event->overflow_handler = overflow_handler;
event->overflow_handler_context = context;
perf_event__state_init(event);
pmu = NULL;
hwc = &event->hw;
hwc->sample_period = attr->sample_period;
if (attr->freq && attr->sample_freq)
hwc->sample_period = 1;
hwc->last_period = hwc->sample_period;
local64_set(&hwc->period_left, hwc->sample_period);
/*
* we currently do not support PERF_FORMAT_GROUP on inherited events
*/
if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP))
goto done;
pmu = perf_init_event(event);
done:
err = 0;
if (!pmu)
err = -EINVAL;
else if (IS_ERR(pmu))
err = PTR_ERR(pmu);
if (err) {
if (event->ns)
put_pid_ns(event->ns);
kfree(event);
return ERR_PTR(err);
}
if (!event->parent) {
if (event->attach_state & PERF_ATTACH_TASK)
static_key_slow_inc(&perf_sched_events.key);
if (event->attr.mmap || event->attr.mmap_data)
atomic_inc(&nr_mmap_events);
if (event->attr.comm)
atomic_inc(&nr_comm_events);
if (event->attr.task)
atomic_inc(&nr_task_events);
if (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) {
err = get_callchain_buffers();
if (err) {
free_event(event);
return ERR_PTR(err);
}
}
if (has_branch_stack(event)) {
static_key_slow_inc(&perf_sched_events.key);
if (!(event->attach_state & PERF_ATTACH_TASK))
atomic_inc(&per_cpu(perf_branch_stack_events,
event->cpu));
}
}
return event;
}
| 15,470 |
37,771 | 0 | static inline void mark_all_clean(struct vmcb *vmcb)
{
vmcb->control.clean = ((1 << VMCB_DIRTY_MAX) - 1)
& ~VMCB_ALWAYS_DIRTY_MASK;
}
| 15,471 |
162,082 | 0 | void FindRenderProcessesForSite(
const GURL& site_url,
std::set<RenderProcessHost*>* foreground_processes,
std::set<RenderProcessHost*>* background_processes) {
auto result = map_.find(site_url);
if (result == map_.end())
return;
std::map<ProcessID, Count>& counts_per_process = result->second;
for (auto iter : counts_per_process) {
RenderProcessHost* host = RenderProcessHost::FromID(iter.first);
if (!host) {
NOTREACHED();
continue;
}
if (!host->MayReuseHost() ||
!RenderProcessHostImpl::IsSuitableHost(
host, host->GetBrowserContext(), site_url))
continue;
if (host->VisibleWidgetCount())
foreground_processes->insert(host);
else
background_processes->insert(host);
}
}
| 15,472 |
80,403 | 0 | GF_Err sgpd_Write(GF_Box *s, GF_BitStream *bs)
{
u32 i;
GF_SampleGroupDescriptionBox *p = (GF_SampleGroupDescriptionBox *)s;
GF_Err e;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u32(bs, p->grouping_type);
if (p->version>=1) gf_bs_write_u32(bs, p->default_length);
if (p->version>=2) gf_bs_write_u32(bs, p->default_description_index);
gf_bs_write_u32(bs, gf_list_count(p->group_descriptions) );
for (i=0; i<gf_list_count(p->group_descriptions); i++) {
void *ptr = gf_list_get(p->group_descriptions, i);
if ((p->version >= 1) && !p->default_length) {
u32 size = sgpd_size_entry(p->grouping_type, ptr);
gf_bs_write_u32(bs, size);
}
sgpd_write_entry(p->grouping_type, ptr, bs);
}
return GF_OK;
}
| 15,473 |
65,593 | 0 | nfsd4_get_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close)
{
get_stateid(cstate, &close->cl_stateid);
}
| 15,474 |
131,653 | 0 | static void reflectBooleanAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
TestObjectPythonV8Internal::reflectBooleanAttributeAttributeSetter(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 15,475 |
108,184 | 0 | void GLES2DecoderTestBase::DoDeleteBuffer(
GLuint client_id, GLuint service_id) {
EXPECT_CALL(*gl_, DeleteBuffersARB(1, Pointee(service_id)))
.Times(1)
.RetiresOnSaturation();
DeleteBuffers cmd;
cmd.Init(1, shared_memory_id_, shared_memory_offset_);
memcpy(shared_memory_address_, &client_id, sizeof(client_id));
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
}
| 15,476 |
116,646 | 0 | void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length,
int32 minimum_page_id) {
DCHECK(history_length >= 0);
DCHECK(history_list_offset_ == history_list_length_ - 1);
DCHECK(minimum_page_id >= -1);
std::vector<int32> new_history_page_ids(history_length, -1);
for (size_t i = 0; i < history_page_ids_.size(); ++i) {
if (minimum_page_id >= 0 && history_page_ids_[i] < minimum_page_id)
continue;
new_history_page_ids.push_back(history_page_ids_[i]);
}
new_history_page_ids.swap(history_page_ids_);
history_list_length_ = history_page_ids_.size();
history_list_offset_ = history_list_length_ - 1;
}
| 15,477 |
181,907 | 1 | static void calcstepsizes(uint_fast16_t refstepsize, int numrlvls,
uint_fast16_t *stepsizes)
{
int bandno;
int numbands;
uint_fast16_t expn;
uint_fast16_t mant;
expn = JPC_QCX_GETEXPN(refstepsize);
mant = JPC_QCX_GETMANT(refstepsize);
numbands = 3 * numrlvls - 2;
for (bandno = 0; bandno < numbands; ++bandno) {
////jas_eprintf("DEBUG %d %d %d %d %d\n", bandno, expn, numrlvls, bandno, ((numrlvls - 1) - (numrlvls - 1 - ((bandno > 0) ? ((bandno + 2) / 3) : (0)))));
stepsizes[bandno] = JPC_QCX_MANT(mant) | JPC_QCX_EXPN(expn +
(numrlvls - 1) - (numrlvls - 1 - ((bandno > 0) ? ((bandno + 2) / 3) : (0))));
}
}
| 15,478 |
104,685 | 0 | static v8::Handle<v8::Value> GetExtensionViews(const v8::Arguments& args) {
if (args.Length() != 2)
return v8::Undefined();
if (!args[0]->IsInt32() || !args[1]->IsString())
return v8::Undefined();
int browser_window_id = args[0]->Int32Value();
std::string view_type_string = *v8::String::Utf8Value(args[1]->ToString());
StringToUpperASCII(&view_type_string);
ViewType::Type view_type = ViewType::INVALID;
if (view_type_string == ViewType::kBackgroundPage) {
view_type = ViewType::EXTENSION_BACKGROUND_PAGE;
} else if (view_type_string == ViewType::kInfobar) {
view_type = ViewType::EXTENSION_INFOBAR;
} else if (view_type_string == ViewType::kNotification) {
view_type = ViewType::NOTIFICATION;
} else if (view_type_string == ViewType::kTabContents) {
view_type = ViewType::TAB_CONTENTS;
} else if (view_type_string == ViewType::kPopup) {
view_type = ViewType::EXTENSION_POPUP;
} else if (view_type_string == ViewType::kExtensionDialog) {
view_type = ViewType::EXTENSION_DIALOG;
} else if (view_type_string != ViewType::kAll) {
return v8::Undefined();
}
ExtensionImpl* v8_extension = GetFromArguments<ExtensionImpl>(args);
const ::Extension* extension =
v8_extension->GetExtensionForCurrentContext();
if (!extension)
return v8::Undefined();
ExtensionViewAccumulator accumulator(extension->id(), browser_window_id,
view_type);
RenderView::ForEach(&accumulator);
return accumulator.views();
}
| 15,479 |
148,409 | 0 | double WebContentsImpl::GetPendingPageZoomLevel() {
NavigationEntry* pending_entry = GetController().GetPendingEntry();
if (!pending_entry)
return HostZoomMap::GetZoomLevel(this);
GURL url = pending_entry->GetURL();
return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme(
url.scheme(), net::GetHostOrSpecFromURL(url));
}
| 15,480 |
40,647 | 0 | static void *prb_dispatch_next_block(struct tpacket_kbdq_core *pkc,
struct packet_sock *po)
{
struct tpacket_block_desc *pbd;
smp_rmb();
/* 1. Get current block num */
pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc);
/* 2. If this block is currently in_use then freeze the queue */
if (TP_STATUS_USER & BLOCK_STATUS(pbd)) {
prb_freeze_queue(pkc, po);
return NULL;
}
/*
* 3.
* open this block and return the offset where the first packet
* needs to get stored.
*/
prb_open_block(pkc, pbd);
return (void *)pkc->nxt_offset;
}
| 15,481 |
75,540 | 0 | static int usb_bus_notify(struct notifier_block *nb, unsigned long action,
void *data)
{
struct device *dev = data;
switch (action) {
case BUS_NOTIFY_ADD_DEVICE:
if (dev->type == &usb_device_type)
(void) usb_create_sysfs_dev_files(to_usb_device(dev));
else if (dev->type == &usb_if_device_type)
usb_create_sysfs_intf_files(to_usb_interface(dev));
break;
case BUS_NOTIFY_DEL_DEVICE:
if (dev->type == &usb_device_type)
usb_remove_sysfs_dev_files(to_usb_device(dev));
else if (dev->type == &usb_if_device_type)
usb_remove_sysfs_intf_files(to_usb_interface(dev));
break;
}
return 0;
}
| 15,482 |
175,018 | 0 | void impeg2d_format_convert(dec_state_t *ps_dec,
pic_buf_t *ps_src_pic,
iv_yuv_buf_t *ps_disp_frm_buf,
UWORD32 u4_start_row, UWORD32 u4_num_rows)
{
UWORD8 *pu1_src_y,*pu1_src_u,*pu1_src_v;
UWORD8 *pu1_dst_y,*pu1_dst_u,*pu1_dst_v;
if((NULL == ps_src_pic) || (NULL == ps_src_pic->pu1_y) || (0 == u4_num_rows))
return;
pu1_src_y = ps_src_pic->pu1_y + (u4_start_row * ps_dec->u2_frame_width);
pu1_src_u = ps_src_pic->pu1_u + ((u4_start_row >> 1) * (ps_dec->u2_frame_width >> 1));
pu1_src_v = ps_src_pic->pu1_v + ((u4_start_row >> 1) *(ps_dec->u2_frame_width >> 1));
pu1_dst_y = (UWORD8 *)ps_disp_frm_buf->pv_y_buf + (u4_start_row * ps_dec->u4_frm_buf_stride);
pu1_dst_u = (UWORD8 *)ps_disp_frm_buf->pv_u_buf +((u4_start_row >> 1)*(ps_dec->u4_frm_buf_stride >> 1));
pu1_dst_v = (UWORD8 *)ps_disp_frm_buf->pv_v_buf +((u4_start_row >> 1)*(ps_dec->u4_frm_buf_stride >> 1));
if (IV_YUV_420P == ps_dec->i4_chromaFormat)
{
ps_dec->pf_copy_yuv420p_buf(pu1_src_y, pu1_src_u, pu1_src_v, pu1_dst_y,
pu1_dst_u, pu1_dst_v,
ps_dec->u2_frame_width,
u4_num_rows,
ps_dec->u4_frm_buf_stride,
(ps_dec->u4_frm_buf_stride >> 1),
(ps_dec->u4_frm_buf_stride >> 1),
ps_dec->u2_frame_width,
(ps_dec->u2_frame_width >> 1),
(ps_dec->u2_frame_width >> 1));
}
else if (IV_YUV_422ILE == ps_dec->i4_chromaFormat)
{
void *pv_yuv422i;
UWORD32 u2_height,u2_width,u2_stride_y,u2_stride_u,u2_stride_v;
UWORD32 u2_stride_yuv422i;
pv_yuv422i = (UWORD8 *)ps_disp_frm_buf->pv_y_buf + ((ps_dec->u2_vertical_size)*(ps_dec->u4_frm_buf_stride));
u2_height = u4_num_rows;
u2_width = ps_dec->u2_horizontal_size;
u2_stride_y = ps_dec->u2_frame_width;
u2_stride_u = u2_stride_y >> 1;
u2_stride_v = u2_stride_u;
u2_stride_yuv422i = (0 == ps_dec->u4_frm_buf_stride) ? ps_dec->u2_horizontal_size : ps_dec->u4_frm_buf_stride;
ps_dec->pf_fmt_conv_yuv420p_to_yuv422ile(pu1_src_y,
pu1_src_u,
pu1_src_v,
pv_yuv422i,
u2_width,
u2_height,
u2_stride_y,
u2_stride_u,
u2_stride_v,
u2_stride_yuv422i);
}
else if((ps_dec->i4_chromaFormat == IV_YUV_420SP_UV) ||
(ps_dec->i4_chromaFormat == IV_YUV_420SP_VU))
{
UWORD32 dest_inc_Y=0,dest_inc_UV=0;
WORD32 convert_uv_only;
pu1_dst_u = (UWORD8 *)ps_disp_frm_buf->pv_u_buf +((u4_start_row >> 1)*(ps_dec->u4_frm_buf_stride));
dest_inc_Y = ps_dec->u4_frm_buf_stride;
dest_inc_UV = ((ps_dec->u4_frm_buf_stride + 1) >> 1) << 1;
convert_uv_only = 0;
if(1 == ps_dec->u4_share_disp_buf)
convert_uv_only = 1;
if(ps_dec->i4_chromaFormat == IV_YUV_420SP_UV)
{
ps_dec->pf_fmt_conv_yuv420p_to_yuv420sp_uv(pu1_src_y,
pu1_src_u,
pu1_src_v,
pu1_dst_y,
pu1_dst_u,
u4_num_rows,
ps_dec->u2_horizontal_size,
ps_dec->u2_frame_width,
ps_dec->u2_frame_width >> 1,
ps_dec->u2_frame_width >> 1,
dest_inc_Y,
dest_inc_UV,
convert_uv_only);
}
else
{
ps_dec->pf_fmt_conv_yuv420p_to_yuv420sp_vu(pu1_src_y,
pu1_src_u,
pu1_src_v,
pu1_dst_y,
pu1_dst_u,
u4_num_rows,
ps_dec->u2_horizontal_size,
ps_dec->u2_frame_width,
ps_dec->u2_frame_width >> 1,
ps_dec->u2_frame_width >> 1,
dest_inc_Y,
dest_inc_UV,
convert_uv_only);
}
}
}
| 15,483 |
36,914 | 0 | xfs_handlereq_to_dentry(
struct file *parfilp,
xfs_fsop_handlereq_t *hreq)
{
return xfs_handle_to_dentry(parfilp, hreq->ihandle, hreq->ihandlen);
}
| 15,484 |
135,470 | 0 | base::string16 GetUsernameFromSuggestion(const base::string16& suggestion) {
return suggestion ==
l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EMPTY_LOGIN)
? base::string16()
: suggestion;
}
| 15,485 |
153,616 | 0 | void GLES2Implementation::DeleteSamplersStub(GLsizei n,
const GLuint* samplers) {
helper_->DeleteSamplersImmediate(n, samplers);
}
| 15,486 |
169,855 | 0 | xsltExtStyleInitTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED,
const xmlChar * URI)
{
if (testStyleData != NULL) {
xsltTransformError(NULL, NULL, NULL,
"xsltExtInitTest: already initialized\n");
return (NULL);
}
testStyleData = (void *) "test data";
xsltGenericDebug(xsltGenericDebugContext,
"Registered test module : %s\n", URI);
return (testStyleData);
}
| 15,487 |
124,464 | 0 | bool WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled()
{
return RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled();
}
| 15,488 |
55,856 | 0 | void deinitialize_tty_struct(struct tty_struct *tty)
{
tty_ldisc_deinit(tty);
}
| 15,489 |
67,765 | 0 | static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage,
unsigned long **bit, int *max)
{
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
if (!(quirks & CP_2WHEEL_MOUSE_HACK))
return 0;
if (usage->type == EV_REL && usage->code == REL_WHEEL)
set_bit(REL_HWHEEL, *bit);
if (usage->hid == 0x00090005)
return -1;
return 0;
}
| 15,490 |
160,621 | 0 | blink::WebPlugin* RenderFrameImpl::GetWebPluginForFind() {
if (frame_->GetDocument().IsPluginDocument())
return frame_->GetDocument().To<WebPluginDocument>().Plugin();
#if BUILDFLAG(ENABLE_PLUGINS)
if (plugin_find_handler_)
return plugin_find_handler_->container()->Plugin();
#endif
return nullptr;
}
| 15,491 |
51,777 | 0 | parse_single_hex_dump_line(char* rec, guint8 *buf, guint byte_offset) {
int pos, i;
char *s;
unsigned long value;
guint16 word_value;
/* Get the byte_offset directly from the record */
rec[4] = '\0';
s = rec;
value = strtoul(s, NULL, 16);
if (value != byte_offset) {
return FALSE;
}
/* Go through the substring representing the values and:
* 1. Replace any spaces with '0's
* 2. Place \0's every 5 bytes (to terminate the string)
*
* Then read the eight sets of hex bytes
*/
for (pos = START_POS; pos < START_POS + HEX_LENGTH; pos++) {
if (rec[pos] == ' ') {
rec[pos] = '0';
}
}
pos = START_POS;
for (i = 0; i < 8; i++) {
rec[pos+4] = '\0';
word_value = (guint16) strtoul(&rec[pos], NULL, 16);
buf[byte_offset + i * 2 + 0] = (guint8) (word_value >> 8);
buf[byte_offset + i * 2 + 1] = (guint8) (word_value & 0x00ff);
pos += 5;
}
return TRUE;
}
| 15,492 |
151,087 | 0 | void DevToolsWindow::OnLoadCompleted() {
WebContents* inspected_web_contents = GetInspectedWebContents();
if (inspected_web_contents) {
SessionTabHelper* session_tab_helper =
SessionTabHelper::FromWebContents(inspected_web_contents);
if (session_tab_helper) {
base::FundamentalValue tabId(session_tab_helper->session_id().id());
bindings_->CallClientFunction("DevToolsAPI.setInspectedTabId",
&tabId, NULL, NULL);
}
}
if (life_stage_ == kClosing)
return;
if (life_stage_ != kLoadCompleted) {
life_stage_ = life_stage_ == kIsDockedSet ? kLoadCompleted : kOnLoadFired;
}
if (life_stage_ == kLoadCompleted)
LoadCompleted();
}
| 15,493 |
178,465 | 1 | PHP_METHOD(Phar, getSupportedCompression)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
phar_request_initialize(TSRMLS_C);
if (PHAR_G(has_zlib)) {
add_next_index_stringl(return_value, "GZ", 2, 1);
}
if (PHAR_G(has_bz2)) {
add_next_index_stringl(return_value, "BZIP2", 5, 1);
}
}
| 15,494 |
58,419 | 0 | cmsPipeline* BlackPreservingKOnlyIntents(cmsContext ContextID,
cmsUInt32Number nProfiles,
cmsUInt32Number TheIntents[],
cmsHPROFILE hProfiles[],
cmsBool BPC[],
cmsFloat64Number AdaptationStates[],
cmsUInt32Number dwFlags)
{
GrayOnlyParams bp;
cmsPipeline* Result;
cmsUInt32Number ICCIntents[256];
cmsStage* CLUT;
cmsUInt32Number i, nGridPoints;
if (nProfiles < 1 || nProfiles > 255) return NULL;
for (i=0; i < nProfiles; i++)
ICCIntents[i] = TranslateNonICCIntents(TheIntents[i]);
if (cmsGetColorSpace(hProfiles[0]) != cmsSigCmykData ||
cmsGetColorSpace(hProfiles[nProfiles-1]) != cmsSigCmykData)
return DefaultICCintents(ContextID, nProfiles, ICCIntents, hProfiles, BPC, AdaptationStates, dwFlags);
memset(&bp, 0, sizeof(bp));
Result = cmsPipelineAlloc(ContextID, 4, 4);
if (Result == NULL) return NULL;
bp.cmyk2cmyk = DefaultICCintents(ContextID,
nProfiles,
ICCIntents,
hProfiles,
BPC,
AdaptationStates,
dwFlags);
if (bp.cmyk2cmyk == NULL) goto Error;
bp.KTone = _cmsBuildKToneCurve(ContextID,
4096,
nProfiles,
ICCIntents,
hProfiles,
BPC,
AdaptationStates,
dwFlags);
if (bp.KTone == NULL) goto Error;
nGridPoints = _cmsReasonableGridpointsByColorspace(cmsSigCmykData, dwFlags);
CLUT = cmsStageAllocCLut16bit(ContextID, nGridPoints, 4, 4, NULL);
if (CLUT == NULL) goto Error;
if (!cmsPipelineInsertStage(Result, cmsAT_BEGIN, CLUT))
goto Error;
if (!cmsStageSampleCLut16bit(CLUT, BlackPreservingGrayOnlySampler, (void*) &bp, 0))
goto Error;
cmsPipelineFree(bp.cmyk2cmyk);
cmsFreeToneCurve(bp.KTone);
return Result;
Error:
if (bp.cmyk2cmyk != NULL) cmsPipelineFree(bp.cmyk2cmyk);
if (bp.KTone != NULL) cmsFreeToneCurve(bp.KTone);
if (Result != NULL) cmsPipelineFree(Result);
return NULL;
}
| 15,495 |
80,966 | 0 | static inline bool is_gp_fault(u32 intr_info)
{
return is_exception_n(intr_info, GP_VECTOR);
}
| 15,496 |
153,071 | 0 | void PDFiumEngine::OnDocumentComplete() {
if (!doc_ || !form_) {
file_access_.m_FileLen = doc_loader_.document_size();
if (!fpdf_availability_) {
fpdf_availability_ = FPDFAvail_Create(&file_availability_, &file_access_);
DCHECK(fpdf_availability_);
}
LoadDocument();
return;
}
FinishLoadingDocument();
}
| 15,497 |
37,199 | 0 | static inline bool vmcs12_read_any(struct kvm_vcpu *vcpu,
unsigned long field, u64 *ret)
{
short offset = vmcs_field_to_offset(field);
char *p;
if (offset < 0)
return 0;
p = ((char *)(get_vmcs12(vcpu))) + offset;
switch (vmcs_field_type(field)) {
case VMCS_FIELD_TYPE_NATURAL_WIDTH:
*ret = *((natural_width *)p);
return 1;
case VMCS_FIELD_TYPE_U16:
*ret = *((u16 *)p);
return 1;
case VMCS_FIELD_TYPE_U32:
*ret = *((u32 *)p);
return 1;
case VMCS_FIELD_TYPE_U64:
*ret = *((u64 *)p);
return 1;
default:
return 0; /* can never happen. */
}
}
| 15,498 |
55,963 | 0 | static int skcipher_alloc_sgl(struct sock *sk)
{
struct alg_sock *ask = alg_sk(sk);
struct skcipher_ctx *ctx = ask->private;
struct skcipher_sg_list *sgl;
struct scatterlist *sg = NULL;
sgl = list_entry(ctx->tsgl.prev, struct skcipher_sg_list, list);
if (!list_empty(&ctx->tsgl))
sg = sgl->sg;
if (!sg || sgl->cur >= MAX_SGL_ENTS) {
sgl = sock_kmalloc(sk, sizeof(*sgl) +
sizeof(sgl->sg[0]) * (MAX_SGL_ENTS + 1),
GFP_KERNEL);
if (!sgl)
return -ENOMEM;
sg_init_table(sgl->sg, MAX_SGL_ENTS + 1);
sgl->cur = 0;
if (sg)
sg_chain(sg, MAX_SGL_ENTS + 1, sgl->sg);
list_add_tail(&sgl->list, &ctx->tsgl);
}
return 0;
}
| 15,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.