unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
33,561 | 0 | static int shmem_unuse_inode(struct shmem_inode_info *info,
swp_entry_t swap, struct page **pagep)
{
struct address_space *mapping = info->vfs_inode.i_mapping;
void *radswap;
pgoff_t index;
gfp_t gfp;
int error = 0;
radswap = swp_to_radix_entry(swap);
index = radix_tree_locate_item(&mapping->page_tree, radswap);
if (index == -1)
return 0;
/*
* Move _head_ to start search for next from here.
* But be careful: shmem_evict_inode checks list_empty without taking
* mutex, and there's an instant in list_move_tail when info->swaplist
* would appear empty, if it were the only one on shmem_swaplist.
*/
if (shmem_swaplist.next != &info->swaplist)
list_move_tail(&shmem_swaplist, &info->swaplist);
gfp = mapping_gfp_mask(mapping);
if (shmem_should_replace_page(*pagep, gfp)) {
mutex_unlock(&shmem_swaplist_mutex);
error = shmem_replace_page(pagep, gfp, info, index);
mutex_lock(&shmem_swaplist_mutex);
/*
* We needed to drop mutex to make that restrictive page
* allocation, but the inode might have been freed while we
* dropped it: although a racing shmem_evict_inode() cannot
* complete without emptying the radix_tree, our page lock
* on this swapcache page is not enough to prevent that -
* free_swap_and_cache() of our swap entry will only
* trylock_page(), removing swap from radix_tree whatever.
*
* We must not proceed to shmem_add_to_page_cache() if the
* inode has been freed, but of course we cannot rely on
* inode or mapping or info to check that. However, we can
* safely check if our swap entry is still in use (and here
* it can't have got reused for another page): if it's still
* in use, then the inode cannot have been freed yet, and we
* can safely proceed (if it's no longer in use, that tells
* nothing about the inode, but we don't need to unuse swap).
*/
if (!page_swapcount(*pagep))
error = -ENOENT;
}
/*
* We rely on shmem_swaplist_mutex, not only to protect the swaplist,
* but also to hold up shmem_evict_inode(): so inode cannot be freed
* beneath us (pagelock doesn't help until the page is in pagecache).
*/
if (!error)
error = shmem_add_to_page_cache(*pagep, mapping, index,
GFP_NOWAIT, radswap);
if (error != -ENOMEM) {
/*
* Truncation and eviction use free_swap_and_cache(), which
* only does trylock page: if we raced, best clean up here.
*/
delete_from_swap_cache(*pagep);
set_page_dirty(*pagep);
if (!error) {
spin_lock(&info->lock);
info->swapped--;
spin_unlock(&info->lock);
swap_free(swap);
}
error = 1; /* not an error, but entry was found */
}
return error;
}
| 15,300 |
82,668 | 0 | int sr_tray_move(struct cdrom_device_info *cdi, int pos)
{
Scsi_CD *cd = cdi->handle;
struct packet_command cgc;
memset(&cgc, 0, sizeof(struct packet_command));
cgc.cmd[0] = GPCMD_START_STOP_UNIT;
cgc.cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ;
cgc.data_direction = DMA_NONE;
cgc.timeout = IOCTL_TIMEOUT;
return sr_do_ioctl(cd, &cgc);
}
| 15,301 |
5,635 | 0 | ask (char const *format, ...)
{
static int ttyfd = -2;
ssize_t r;
va_list args;
va_start (args, format);
vfprintf (stdout, format, args);
va_end (args);
fflush (stdout);
if (ttyfd == -2)
{
/* If standard output is not a tty, don't bother opening /dev/tty,
since it's unlikely that stdout will be seen by the tty user.
The isatty test also works around a bug in GNU Emacs 19.34 under Linux
which makes a call-process `patch' hang when it reads from /dev/tty.
POSIX.1-2001 XCU line 26599 requires that we read /dev/tty,
though. */
ttyfd = (posixly_correct || isatty (STDOUT_FILENO)
? open (TTY_DEVICE, O_RDONLY)
: -1);
}
if (ttyfd < 0)
{
/* No terminal at all -- default it. */
printf ("\n");
buf[0] = '\n';
buf[1] = '\0';
}
else
{
size_t s = 0;
while ((r = read (ttyfd, buf + s, bufsize - 1 - s)) == bufsize - 1 - s
&& buf[bufsize - 2] != '\n')
{
s = bufsize - 1;
bufsize *= 2;
buf = realloc (buf, bufsize);
if (!buf)
xalloc_die ();
}
if (r == 0)
printf ("EOF\n");
else if (r < 0)
{
perror ("tty read");
fflush (stderr);
close (ttyfd);
ttyfd = -1;
r = 0;
}
buf[s + r] = '\0';
}
}
| 15,302 |
10,065 | 0 | event_render_mode_change( int delta )
{
if ( delta )
{
status.render_mode = ( status.render_mode + delta ) % N_RENDER_MODES;
if ( status.render_mode < 0 )
status.render_mode += N_RENDER_MODES;
}
switch ( status.render_mode )
{
case RENDER_MODE_ALL:
status.header = (char *)"rendering all glyphs in font";
break;
case RENDER_MODE_EMBOLDEN:
status.header = (char *)"rendering emboldened text";
break;
case RENDER_MODE_SLANTED:
status.header = (char *)"rendering slanted text";
break;
case RENDER_MODE_STROKE:
status.header = (char *)"rendering stroked text";
break;
case RENDER_MODE_TEXT:
status.header = (char *)"rendering test text string";
break;
case RENDER_MODE_WATERFALL:
status.header = (char *)"rendering glyph waterfall";
break;
}
}
| 15,303 |
85,152 | 0 | static inline bool __force_buffered_io(struct inode *inode, int rw)
{
return ((f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode)) ||
(rw == WRITE && test_opt(F2FS_I_SB(inode), LFS)) ||
F2FS_I_SB(inode)->s_ndevs);
}
| 15,304 |
148,196 | 0 | void V8TestObject::VoidMethodXPathNSResolverArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_voidMethodXPathNSResolverArg");
test_object_v8_internal::VoidMethodXPathNSResolverArgMethod(info);
}
| 15,305 |
7,773 | 0 | static int h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, int count)
{
struct h2s *h2s = cs->ctx;
struct h2c *h2c = h2s->h2c;
int ret = 0;
if (h2c->st0 != H2_CS_FRAME_P)
return 0; // no pre-parsed frame yet
if (h2c->dsi != h2s->id)
return 0; // not for us
if (!h2c->dbuf->size)
return 0; // empty buffer
switch (h2c->dft) {
case H2_FT_HEADERS:
ret = h2_frt_decode_headers(h2s, buf, count);
break;
case H2_FT_DATA:
ret = h2_frt_transfer_data(h2s, buf, count);
break;
default:
ret = 0;
}
return ret;
}
| 15,306 |
113,957 | 0 | FakeInvalidationClient() {}
| 15,307 |
118,481 | 0 | blink::WebPlugin* RenderFrameImpl::createPlugin(
blink::WebLocalFrame* frame,
const blink::WebPluginParams& params) {
DCHECK_EQ(frame_, frame);
blink::WebPlugin* plugin = NULL;
if (GetContentClient()->renderer()->OverrideCreatePlugin(
this, frame, params, &plugin)) {
return plugin;
}
if (base::UTF16ToASCII(params.mimeType) == kBrowserPluginMimeType) {
return render_view_->GetBrowserPluginManager()->CreateBrowserPlugin(
render_view_.get(), frame, false);
}
#if defined(ENABLE_PLUGINS)
WebPluginInfo info;
std::string mime_type;
bool found = false;
Send(new FrameHostMsg_GetPluginInfo(
routing_id_, params.url, frame->top()->document().url(),
params.mimeType.utf8(), &found, &info, &mime_type));
if (!found)
return NULL;
if (info.type == content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) {
return render_view_->GetBrowserPluginManager()->CreateBrowserPlugin(
render_view_.get(), frame, true);
}
WebPluginParams params_to_use = params;
params_to_use.mimeType = WebString::fromUTF8(mime_type);
return CreatePlugin(frame, info, params_to_use);
#else
return NULL;
#endif // defined(ENABLE_PLUGINS)
}
| 15,308 |
82,224 | 0 | SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
int __user *, upeer_addrlen, int, flags)
{
return __sys_accept4(fd, upeer_sockaddr, upeer_addrlen, flags);
}
| 15,309 |
15,863 | 0 | static void virtio_net_tx_complete(NetClientState *nc, ssize_t len)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
virtqueue_push(q->tx_vq, &q->async_tx.elem, 0);
virtio_notify(vdev, q->tx_vq);
q->async_tx.elem.out_num = q->async_tx.len = 0;
virtio_queue_set_notification(q->tx_vq, 1);
virtio_net_flush_tx(q);
}
| 15,310 |
34,025 | 0 | static netdev_features_t xenvif_fix_features(struct net_device *dev,
netdev_features_t features)
{
struct xenvif *vif = netdev_priv(dev);
if (!vif->can_sg)
features &= ~NETIF_F_SG;
if (!vif->gso && !vif->gso_prefix)
features &= ~NETIF_F_TSO;
if (!vif->csum)
features &= ~NETIF_F_IP_CSUM;
return features;
}
| 15,311 |
92,071 | 0 | blk_qc_t submit_bio(struct bio *bio)
{
/*
* If it's a regular read/write or a barrier with data attached,
* go through the normal accounting stuff before submission.
*/
if (bio_has_data(bio)) {
unsigned int count;
if (unlikely(bio_op(bio) == REQ_OP_WRITE_SAME))
count = queue_logical_block_size(bio->bi_disk->queue) >> 9;
else
count = bio_sectors(bio);
if (op_is_write(bio_op(bio))) {
count_vm_events(PGPGOUT, count);
} else {
task_io_account_read(bio->bi_iter.bi_size);
count_vm_events(PGPGIN, count);
}
if (unlikely(block_dump)) {
char b[BDEVNAME_SIZE];
printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n",
current->comm, task_pid_nr(current),
op_is_write(bio_op(bio)) ? "WRITE" : "READ",
(unsigned long long)bio->bi_iter.bi_sector,
bio_devname(bio, b), count);
}
}
return generic_make_request(bio);
}
| 15,312 |
72,009 | 0 | static void LogPrimitiveInfo(const PrimitiveInfo *primitive_info)
{
const char
*methods[] =
{
"point",
"replace",
"floodfill",
"filltoborder",
"reset",
"?"
};
PointInfo
p,
q,
point;
register ssize_t
i,
x;
ssize_t
coordinates,
y;
x=(ssize_t) ceil(primitive_info->point.x-0.5);
y=(ssize_t) ceil(primitive_info->point.y-0.5);
switch (primitive_info->primitive)
{
case PointPrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
"PointPrimitive %.20g,%.20g %s",(double) x,(double) y,
methods[primitive_info->method]);
return;
}
case ColorPrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
"ColorPrimitive %.20g,%.20g %s",(double) x,(double) y,
methods[primitive_info->method]);
return;
}
case MattePrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
"MattePrimitive %.20g,%.20g %s",(double) x,(double) y,
methods[primitive_info->method]);
return;
}
case TextPrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
"TextPrimitive %.20g,%.20g",(double) x,(double) y);
return;
}
case ImagePrimitive:
{
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
"ImagePrimitive %.20g,%.20g",(double) x,(double) y);
return;
}
default:
break;
}
coordinates=0;
p=primitive_info[0].point;
q.x=(-1.0);
q.y=(-1.0);
for (i=0; primitive_info[i].primitive != UndefinedPrimitive; i++)
{
point=primitive_info[i].point;
if (coordinates <= 0)
{
coordinates=(ssize_t) primitive_info[i].coordinates;
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
" begin open (%.20g)",(double) coordinates);
p=point;
}
point=primitive_info[i].point;
if ((fabs(q.x-point.x) >= DrawEpsilon) ||
(fabs(q.y-point.y) >= DrawEpsilon))
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
" %.20g: %.18g,%.18g",(double) coordinates,point.x,point.y);
else
(void) LogMagickEvent(DrawEvent,GetMagickModule(),
" %.20g: %g %g (duplicate)",(double) coordinates,point.x,point.y);
q=point;
coordinates--;
if (coordinates > 0)
continue;
if ((fabs(p.x-point.x) >= DrawEpsilon) ||
(fabs(p.y-point.y) >= DrawEpsilon))
(void) LogMagickEvent(DrawEvent,GetMagickModule()," end last (%.20g)",
(double) coordinates);
else
(void) LogMagickEvent(DrawEvent,GetMagickModule()," end open (%.20g)",
(double) coordinates);
}
}
| 15,313 |
67,466 | 0 | int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, struct inode **delegated_inode)
{
struct inode *inode = old_dentry->d_inode;
unsigned max_links = dir->i_sb->s_max_links;
int error;
if (!inode)
return -ENOENT;
error = may_create(dir, new_dentry);
if (error)
return error;
if (dir->i_sb != inode->i_sb)
return -EXDEV;
/*
* A link to an append-only or immutable file cannot be created.
*/
if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
return -EPERM;
/*
* Updating the link count will likely cause i_uid and i_gid to
* be writen back improperly if their true value is unknown to
* the vfs.
*/
if (HAS_UNMAPPED_ID(inode))
return -EPERM;
if (!dir->i_op->link)
return -EPERM;
if (S_ISDIR(inode->i_mode))
return -EPERM;
error = security_inode_link(old_dentry, dir, new_dentry);
if (error)
return error;
inode_lock(inode);
/* Make sure we don't allow creating hardlink to an unlinked file */
if (inode->i_nlink == 0 && !(inode->i_state & I_LINKABLE))
error = -ENOENT;
else if (max_links && inode->i_nlink >= max_links)
error = -EMLINK;
else {
error = try_break_deleg(inode, delegated_inode);
if (!error)
error = dir->i_op->link(old_dentry, dir, new_dentry);
}
if (!error && (inode->i_state & I_LINKABLE)) {
spin_lock(&inode->i_lock);
inode->i_state &= ~I_LINKABLE;
spin_unlock(&inode->i_lock);
}
inode_unlock(inode);
if (!error)
fsnotify_link(dir, inode, new_dentry);
return error;
}
| 15,314 |
61,477 | 0 | static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
char tmp_key[5];
char key2[32], language[4] = {0};
char *str = NULL;
const char *key = NULL;
uint16_t langcode = 0;
uint32_t data_type = 0, str_size, str_size_alloc;
int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL;
int raw = 0;
int num = 0;
switch (atom.type) {
case MKTAG( '@','P','R','M'): key = "premiere_version"; raw = 1; break;
case MKTAG( '@','P','R','Q'): key = "quicktime_version"; raw = 1; break;
case MKTAG( 'X','M','P','_'):
if (c->export_xmp) { key = "xmp"; raw = 1; } break;
case MKTAG( 'a','A','R','T'): key = "album_artist"; break;
case MKTAG( 'a','k','I','D'): key = "account_type";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'a','p','I','D'): key = "account_id"; break;
case MKTAG( 'c','a','t','g'): key = "category"; break;
case MKTAG( 'c','p','i','l'): key = "compilation";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'c','p','r','t'): key = "copyright"; break;
case MKTAG( 'd','e','s','c'): key = "description"; break;
case MKTAG( 'd','i','s','k'): key = "disc";
parse = mov_metadata_track_or_disc_number; break;
case MKTAG( 'e','g','i','d'): key = "episode_uid";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'F','I','R','M'): key = "firmware"; raw = 1; break;
case MKTAG( 'g','n','r','e'): key = "genre";
parse = mov_metadata_gnre; break;
case MKTAG( 'h','d','v','d'): key = "hd_video";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'H','M','M','T'):
return mov_metadata_hmmt(c, pb, atom.size);
case MKTAG( 'k','e','y','w'): key = "keywords"; break;
case MKTAG( 'l','d','e','s'): key = "synopsis"; break;
case MKTAG( 'l','o','c','i'):
return mov_metadata_loci(c, pb, atom.size);
case MKTAG( 'p','c','s','t'): key = "podcast";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'p','g','a','p'): key = "gapless_playback";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'p','u','r','d'): key = "purchase_date"; break;
case MKTAG( 'r','t','n','g'): key = "rating";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 's','o','a','a'): key = "sort_album_artist"; break;
case MKTAG( 's','o','a','l'): key = "sort_album"; break;
case MKTAG( 's','o','a','r'): key = "sort_artist"; break;
case MKTAG( 's','o','c','o'): key = "sort_composer"; break;
case MKTAG( 's','o','n','m'): key = "sort_name"; break;
case MKTAG( 's','o','s','n'): key = "sort_show"; break;
case MKTAG( 's','t','i','k'): key = "media_type";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 't','r','k','n'): key = "track";
parse = mov_metadata_track_or_disc_number; break;
case MKTAG( 't','v','e','n'): key = "episode_id"; break;
case MKTAG( 't','v','e','s'): key = "episode_sort";
parse = mov_metadata_int8_bypass_padding; break;
case MKTAG( 't','v','n','n'): key = "network"; break;
case MKTAG( 't','v','s','h'): key = "show"; break;
case MKTAG( 't','v','s','n'): key = "season_number";
parse = mov_metadata_int8_bypass_padding; break;
case MKTAG(0xa9,'A','R','T'): key = "artist"; break;
case MKTAG(0xa9,'P','R','D'): key = "producer"; break;
case MKTAG(0xa9,'a','l','b'): key = "album"; break;
case MKTAG(0xa9,'a','u','t'): key = "artist"; break;
case MKTAG(0xa9,'c','h','p'): key = "chapter"; break;
case MKTAG(0xa9,'c','m','t'): key = "comment"; break;
case MKTAG(0xa9,'c','o','m'): key = "composer"; break;
case MKTAG(0xa9,'c','p','y'): key = "copyright"; break;
case MKTAG(0xa9,'d','a','y'): key = "date"; break;
case MKTAG(0xa9,'d','i','r'): key = "director"; break;
case MKTAG(0xa9,'d','i','s'): key = "disclaimer"; break;
case MKTAG(0xa9,'e','d','1'): key = "edit_date"; break;
case MKTAG(0xa9,'e','n','c'): key = "encoder"; break;
case MKTAG(0xa9,'f','m','t'): key = "original_format"; break;
case MKTAG(0xa9,'g','e','n'): key = "genre"; break;
case MKTAG(0xa9,'g','r','p'): key = "grouping"; break;
case MKTAG(0xa9,'h','s','t'): key = "host_computer"; break;
case MKTAG(0xa9,'i','n','f'): key = "comment"; break;
case MKTAG(0xa9,'l','y','r'): key = "lyrics"; break;
case MKTAG(0xa9,'m','a','k'): key = "make"; break;
case MKTAG(0xa9,'m','o','d'): key = "model"; break;
case MKTAG(0xa9,'n','a','m'): key = "title"; break;
case MKTAG(0xa9,'o','p','e'): key = "original_artist"; break;
case MKTAG(0xa9,'p','r','d'): key = "producer"; break;
case MKTAG(0xa9,'p','r','f'): key = "performers"; break;
case MKTAG(0xa9,'r','e','q'): key = "playback_requirements"; break;
case MKTAG(0xa9,'s','r','c'): key = "original_source"; break;
case MKTAG(0xa9,'s','t','3'): key = "subtitle"; break;
case MKTAG(0xa9,'s','w','r'): key = "encoder"; break;
case MKTAG(0xa9,'t','o','o'): key = "encoder"; break;
case MKTAG(0xa9,'t','r','k'): key = "track"; break;
case MKTAG(0xa9,'u','r','l'): key = "URL"; break;
case MKTAG(0xa9,'w','r','n'): key = "warning"; break;
case MKTAG(0xa9,'w','r','t'): key = "composer"; break;
case MKTAG(0xa9,'x','y','z'): key = "location"; break;
}
retry:
if (c->itunes_metadata && atom.size > 8) {
int data_size = avio_rb32(pb);
int tag = avio_rl32(pb);
if (tag == MKTAG('d','a','t','a') && data_size <= atom.size) {
data_type = avio_rb32(pb); // type
avio_rb32(pb); // unknown
str_size = data_size - 16;
atom.size -= 16;
if (atom.type == MKTAG('c', 'o', 'v', 'r')) {
int ret = mov_read_covr(c, pb, data_type, str_size);
if (ret < 0) {
av_log(c->fc, AV_LOG_ERROR, "Error parsing cover art.\n");
}
return ret;
} else if (!key && c->found_hdlr_mdta && c->meta_keys) {
uint32_t index = AV_RB32(&atom.type);
if (index < c->meta_keys_count && index > 0) {
key = c->meta_keys[index];
} else {
av_log(c->fc, AV_LOG_WARNING,
"The index of 'data' is out of range: %"PRId32" < 1 or >= %d.\n",
index, c->meta_keys_count);
}
}
} else return 0;
} else if (atom.size > 4 && key && !c->itunes_metadata && !raw) {
str_size = avio_rb16(pb); // string length
if (str_size > atom.size) {
raw = 1;
avio_seek(pb, -2, SEEK_CUR);
av_log(c->fc, AV_LOG_WARNING, "UDTA parsing failed retrying raw\n");
goto retry;
}
langcode = avio_rb16(pb);
ff_mov_lang_to_iso639(langcode, language);
atom.size -= 4;
} else
str_size = atom.size;
if (c->export_all && !key) {
snprintf(tmp_key, 5, "%.4s", (char*)&atom.type);
key = tmp_key;
}
if (!key)
return 0;
if (atom.size < 0 || str_size >= INT_MAX/2)
return AVERROR_INVALIDDATA;
num = (data_type >= 21 && data_type <= 23);
str_size_alloc = (num ? 512 : (raw ? str_size : str_size * 2)) + 1;
str = av_mallocz(str_size_alloc);
if (!str)
return AVERROR(ENOMEM);
if (parse)
parse(c, pb, str_size, key);
else {
if (!raw && (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff)))) { // MAC Encoded
mov_read_mac_string(c, pb, str_size, str, str_size_alloc);
} else if (data_type == 21) { // BE signed integer, variable size
int val = 0;
if (str_size == 1)
val = (int8_t)avio_r8(pb);
else if (str_size == 2)
val = (int16_t)avio_rb16(pb);
else if (str_size == 3)
val = ((int32_t)(avio_rb24(pb)<<8))>>8;
else if (str_size == 4)
val = (int32_t)avio_rb32(pb);
if (snprintf(str, str_size_alloc, "%d", val) >= str_size_alloc) {
av_log(c->fc, AV_LOG_ERROR,
"Failed to store the number (%d) in string.\n", val);
av_free(str);
return AVERROR_INVALIDDATA;
}
} else if (data_type == 22) { // BE unsigned integer, variable size
unsigned int val = 0;
if (str_size == 1)
val = avio_r8(pb);
else if (str_size == 2)
val = avio_rb16(pb);
else if (str_size == 3)
val = avio_rb24(pb);
else if (str_size == 4)
val = avio_rb32(pb);
if (snprintf(str, str_size_alloc, "%u", val) >= str_size_alloc) {
av_log(c->fc, AV_LOG_ERROR,
"Failed to store the number (%u) in string.\n", val);
av_free(str);
return AVERROR_INVALIDDATA;
}
} else if (data_type == 23 && str_size >= 4) { // BE float32
float val = av_int2float(avio_rb32(pb));
if (snprintf(str, str_size_alloc, "%f", val) >= str_size_alloc) {
av_log(c->fc, AV_LOG_ERROR,
"Failed to store the float32 number (%f) in string.\n", val);
av_free(str);
return AVERROR_INVALIDDATA;
}
} else {
int ret = ffio_read_size(pb, str, str_size);
if (ret < 0) {
av_free(str);
return ret;
}
str[str_size] = 0;
}
c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
av_dict_set(&c->fc->metadata, key, str, 0);
if (*language && strcmp(language, "und")) {
snprintf(key2, sizeof(key2), "%s-%s", key, language);
av_dict_set(&c->fc->metadata, key2, str, 0);
}
if (!strcmp(key, "encoder")) {
int major, minor, micro;
if (sscanf(str, "HandBrake %d.%d.%d", &major, &minor, µ) == 3) {
c->handbrake_version = 1000000*major + 1000*minor + micro;
}
}
}
av_freep(&str);
return 0;
}
| 15,315 |
10,185 | 0 | Ins_SVTCA( INS_ARG )
{
DO_SVTCA
}
| 15,316 |
51,880 | 0 | dissect_rach_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset, struct fp_info *p_fp_info, void *data)
{
gboolean is_control_frame;
guint16 header_crc = 0;
proto_item * header_crc_pi = NULL;
guint header_length = 0;
/* Header CRC */
header_crc = tvb_get_bits8(tvb, 0, 7);
header_crc_pi = proto_tree_add_item(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN);
/* Frame Type */
is_control_frame = tvb_get_guint8(tvb, offset) & 0x01;
proto_tree_add_item(tree, hf_fp_ft, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
col_append_str(pinfo->cinfo, COL_INFO, is_control_frame ? " [Control] " : " [Data] ");
if (is_control_frame) {
dissect_common_control(tvb, pinfo, tree, offset, p_fp_info);
/* For control frame the header CRC is actually frame CRC covering all
* bytes except the first */
if (preferences_header_checksum) {
verify_control_frame_crc(tvb, pinfo, header_crc_pi, header_crc);
}
}
else {
guint8 cfn;
guint32 propagation_delay = 0;
proto_item *propagation_delay_ti = NULL;
guint32 received_sync_ul_timing_deviation = 0;
proto_item *received_sync_ul_timing_deviation_ti = NULL;
proto_item *rx_timing_deviation_ti = NULL;
guint16 rx_timing_deviation = 0;
/* DATA */
/* CFN */
cfn = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_fp_cfn, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
col_append_fstr(pinfo->cinfo, COL_INFO, "CFN=%03u ", cfn);
/* TFI */
proto_tree_add_item(tree, hf_fp_tfi, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
if (p_fp_info->channel == CHANNEL_RACH_FDD) {
/* Propagation delay */
propagation_delay = tvb_get_guint8(tvb, offset);
propagation_delay_ti = proto_tree_add_uint(tree, hf_fp_propagation_delay, tvb, offset, 1,
propagation_delay*3);
offset++;
}
/* Should be TDD 3.84 or 7.68 */
if (p_fp_info->channel == CHANNEL_RACH_TDD) {
/* Rx Timing Deviation */
rx_timing_deviation = tvb_get_guint8(tvb, offset);
rx_timing_deviation_ti = proto_tree_add_item(tree, hf_fp_rx_timing_deviation, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
}
if (p_fp_info->channel == CHANNEL_RACH_TDD_128) {
/* Received SYNC UL Timing Deviation */
received_sync_ul_timing_deviation = tvb_get_guint8(tvb, offset);
received_sync_ul_timing_deviation_ti =
proto_tree_add_item(tree, hf_fp_received_sync_ul_timing_deviation, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
}
header_length = offset;
/* TB data */
offset = dissect_tb_data(tvb, pinfo, tree, offset, p_fp_info, &mac_fdd_rach_handle, data);
/* CRCIs */
offset = dissect_crci_bits(tvb, pinfo, tree, p_fp_info, offset);
/* Info introduced in R6 */
/* only check if it looks as if they are present */
if (((p_fp_info->release == 6) || (p_fp_info->release == 7)) &&
(tvb_reported_length_remaining(tvb, offset) > 2))
{
int n;
guint8 flags;
/* guint8 flag_bytes = 0; */
gboolean cell_portion_id_present = FALSE;
gboolean ext_propagation_delay_present = FALSE;
gboolean angle_of_arrival_present = FALSE;
gboolean ext_rx_sync_ul_timing_deviation_present = FALSE;
gboolean ext_rx_timing_deviation_present = FALSE;
/* New IE flags (assume mandatory for now) */
do {
proto_item *new_ie_flags_ti;
proto_tree *new_ie_flags_tree;
guint ies_found = 0;
/* Add new IE flags subtree */
new_ie_flags_ti = proto_tree_add_string_format(tree, hf_fp_rach_new_ie_flags, tvb, offset, 1,
"", "New IE flags");
new_ie_flags_tree = proto_item_add_subtree(new_ie_flags_ti, ett_fp_rach_new_ie_flags);
/* Read next byte */
flags = tvb_get_guint8(tvb, offset);
/* flag_bytes++ */
/* Dissect individual bits */
for (n=0; n < 8; n++) {
switch (n) {
case 6:
switch (p_fp_info->division) {
case Division_FDD:
/* Ext propagation delay */
ext_propagation_delay_present = TRUE;
proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_ext_propagation_delay_present,
tvb, offset, 1, ENC_BIG_ENDIAN);
break;
case Division_TDD_128:
/* Ext Rx Sync UL Timing */
ext_rx_sync_ul_timing_deviation_present = TRUE;
proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_ext_rx_sync_ul_timing_deviation_present,
tvb, offset, 1, ENC_BIG_ENDIAN);
break;
default:
/* Not defined */
proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_new_ie_flag_unused[6],
tvb, offset, 1, ENC_BIG_ENDIAN);
break;
}
break;
case 7:
switch (p_fp_info->division) {
case Division_FDD:
/* Cell Portion ID */
cell_portion_id_present = TRUE;
proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_cell_portion_id_present,
tvb, offset, 1, ENC_BIG_ENDIAN);
break;
case Division_TDD_128:
/* AOA */
angle_of_arrival_present = TRUE;
proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_angle_of_arrival_present,
tvb, offset, 1, ENC_BIG_ENDIAN);
break;
case Division_TDD_384:
case Division_TDD_768:
/* Extended Rx Timing Deviation */
ext_rx_timing_deviation_present = TRUE;
proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_ext_rx_timing_deviation_present,
tvb, offset, 1, ENC_BIG_ENDIAN);
break;
}
break;
default:
/* No defined meanings */
/* Visual Studio Code Analyzer wrongly thinks n can be 7 here. It can't */
proto_tree_add_item(new_ie_flags_tree, hf_fp_rach_new_ie_flag_unused[n],
tvb, offset, 1, ENC_BIG_ENDIAN);
break;
}
if ((flags >> (7-n)) & 0x01) {
ies_found++;
}
}
offset++;
proto_item_append_text(new_ie_flags_ti, " (%u IEs found)", ies_found);
/* Last bit set will indicate another flags byte follows... */
} while (0); /*((flags & 0x01) && (flag_bytes < 31));*/
/* Cell Portion ID */
if (cell_portion_id_present) {
proto_tree_add_item(tree, hf_fp_cell_portion_id, tvb, offset, 1, ENC_BIG_ENDIAN);
offset++;
}
/* Ext Rx Timing Deviation */
if (ext_rx_timing_deviation_present) {
guint8 extra_bits;
guint bits_to_extend;
switch (p_fp_info->division) {
case Division_TDD_384:
bits_to_extend = 1;
break;
case Division_TDD_768:
bits_to_extend = 2;
break;
default:
/* TODO: report unexpected division type */
bits_to_extend = 1;
break;
}
extra_bits = tvb_get_guint8(tvb, offset) &
((bits_to_extend == 1) ? 0x01 : 0x03);
rx_timing_deviation = (extra_bits << 8) | (rx_timing_deviation);
proto_item_append_text(rx_timing_deviation_ti,
" (extended to 0x%x)",
rx_timing_deviation);
proto_tree_add_bits_item(tree, hf_fp_extended_bits, tvb,
offset*8 + (8-bits_to_extend), bits_to_extend, ENC_BIG_ENDIAN);
offset++;
}
/* Ext propagation delay. */
if (ext_propagation_delay_present) {
guint16 extra_bits = tvb_get_ntohs(tvb, offset) & 0x03ff;
proto_tree_add_item(tree, hf_fp_ext_propagation_delay, tvb, offset, 2, ENC_BIG_ENDIAN);
/* Adding 10 bits to original 8 */
proto_item_append_text(propagation_delay_ti, " (extended to %u)",
((extra_bits << 8) | propagation_delay) * 3);
offset += 2;
}
/* Angle of Arrival (AOA) */
if (angle_of_arrival_present) {
proto_tree_add_item(tree, hf_fp_angle_of_arrival, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
}
/* Ext. Rx Sync UL Timing Deviation */
if (ext_rx_sync_ul_timing_deviation_present) {
guint16 extra_bits;
/* Ext received Sync UL Timing Deviation */
extra_bits = tvb_get_ntohs(tvb, offset) & 0x1fff;
proto_tree_add_item(tree, hf_fp_ext_received_sync_ul_timing_deviation, tvb, offset, 2, ENC_BIG_ENDIAN);
/* Adding 13 bits to original 8 */
proto_item_append_text(received_sync_ul_timing_deviation_ti, " (extended to %u)",
(extra_bits << 8) | received_sync_ul_timing_deviation);
offset += 2;
}
}
if (preferences_header_checksum) {
verify_header_crc(tvb, pinfo, header_crc_pi, header_crc, header_length);
}
/* Spare Extension and Payload CRC */
dissect_spare_extension_and_crc(tvb, pinfo, tree, 1, offset, header_length);
}
}
| 15,317 |
183,386 | 1 | static void prefetch_enc(void)
{
prefetch_table((const void *)encT, sizeof(encT));
}
| 15,318 |
137,212 | 0 | SkColor Textfield::GetSelectionTextColor() const {
return use_default_selection_text_color_
? GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_TextfieldSelectionColor)
: selection_text_color_;
}
| 15,319 |
121,699 | 0 | MediaStreamDevicesController::GetDevicePolicy(
const char* policy_name,
const char* whitelist_policy_name) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
PrefService* prefs = profile_->GetPrefs();
if (IsInKioskMode()) {
const base::ListValue* list = prefs->GetList(whitelist_policy_name);
std::string value;
for (size_t i = 0; i < list->GetSize(); ++i) {
if (list->GetString(i, &value)) {
ContentSettingsPattern pattern =
ContentSettingsPattern::FromString(value);
if (pattern == ContentSettingsPattern::Wildcard()) {
DLOG(WARNING) << "Ignoring wildcard URL pattern: " << value;
continue;
}
DLOG_IF(ERROR, !pattern.IsValid()) << "Invalid URL pattern: " << value;
if (pattern.IsValid() && pattern.Matches(request_.security_origin))
return ALWAYS_ALLOW;
}
}
}
if (!prefs->GetBoolean(policy_name))
return ALWAYS_DENY;
return POLICY_NOT_SET;
}
| 15,320 |
23,906 | 0 | static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci)
{
pvc_device *pvc = state(hdlc)->first_pvc;
while (pvc) {
if (pvc->dlci == dlci)
return pvc;
if (pvc->dlci > dlci)
return NULL; /* the list is sorted */
pvc = pvc->next;
}
return NULL;
}
| 15,321 |
64,373 | 0 | static int dnxhd_get_hr_frame_size(int cid, int w, int h)
{
int result, i = ff_dnxhd_get_cid_table(cid);
if (i < 0)
return i;
result = ((h + 15) / 16) * ((w + 15) / 16) * ff_dnxhd_cid_table[i].packet_scale.num / ff_dnxhd_cid_table[i].packet_scale.den;
result = (result + 2048) / 4096 * 4096;
return FFMAX(result, 8192);
}
| 15,322 |
6,577 | 0 | bool Smb4KGlobal::removeWorkgroup( Smb4KWorkgroup *workgroup )
{
Q_ASSERT( workgroup );
bool removed = false;
mutex.lock();
int index = p->workgroupsList.indexOf( workgroup );
if ( index != -1 )
{
delete p->workgroupsList.takeAt( index );
removed = true;
}
else
{
Smb4KWorkgroup *wg = findWorkgroup( workgroup->workgroupName() );
if ( wg )
{
index = p->workgroupsList.indexOf( wg );
if ( index != -1 )
{
delete p->workgroupsList.takeAt( index );
removed = true;
}
else
{
}
}
else
{
}
delete workgroup;
}
mutex.unlock();
return removed;
}
| 15,323 |
175,628 | 0 | void m4vdec_dprintf(char *format, ...)
{
FILE *log_fp;
va_list args;
va_start(args, format);
/* open the log file */
log_fp = fopen("\\mp4dec_log.txt", "a+");
if (log_fp == NULL) return;
/* output the message */
vfprintf(log_fp, format, args);
fclose(log_fp);
va_end(args);
}
| 15,324 |
141,550 | 0 | void TracingControllerImpl::DisconnectFromService() {
coordinator_ = nullptr;
}
| 15,325 |
19,538 | 0 | static int udf_parse_options(char *options, struct udf_options *uopt,
bool remount)
{
char *p;
int option;
uopt->novrs = 0;
uopt->partition = 0xFFFF;
uopt->session = 0xFFFFFFFF;
uopt->lastblock = 0;
uopt->anchor = 0;
uopt->volume = 0xFFFFFFFF;
uopt->rootdir = 0xFFFFFFFF;
uopt->fileset = 0xFFFFFFFF;
uopt->nls_map = NULL;
if (!options)
return 1;
while ((p = strsep(&options, ",")) != NULL) {
substring_t args[MAX_OPT_ARGS];
int token;
if (!*p)
continue;
token = match_token(p, tokens, args);
switch (token) {
case Opt_novrs:
uopt->novrs = 1;
break;
case Opt_bs:
if (match_int(&args[0], &option))
return 0;
uopt->blocksize = option;
uopt->flags |= (1 << UDF_FLAG_BLOCKSIZE_SET);
break;
case Opt_unhide:
uopt->flags |= (1 << UDF_FLAG_UNHIDE);
break;
case Opt_undelete:
uopt->flags |= (1 << UDF_FLAG_UNDELETE);
break;
case Opt_noadinicb:
uopt->flags &= ~(1 << UDF_FLAG_USE_AD_IN_ICB);
break;
case Opt_adinicb:
uopt->flags |= (1 << UDF_FLAG_USE_AD_IN_ICB);
break;
case Opt_shortad:
uopt->flags |= (1 << UDF_FLAG_USE_SHORT_AD);
break;
case Opt_longad:
uopt->flags &= ~(1 << UDF_FLAG_USE_SHORT_AD);
break;
case Opt_gid:
if (match_int(args, &option))
return 0;
uopt->gid = option;
uopt->flags |= (1 << UDF_FLAG_GID_SET);
break;
case Opt_uid:
if (match_int(args, &option))
return 0;
uopt->uid = option;
uopt->flags |= (1 << UDF_FLAG_UID_SET);
break;
case Opt_umask:
if (match_octal(args, &option))
return 0;
uopt->umask = option;
break;
case Opt_nostrict:
uopt->flags &= ~(1 << UDF_FLAG_STRICT);
break;
case Opt_session:
if (match_int(args, &option))
return 0;
uopt->session = option;
if (!remount)
uopt->flags |= (1 << UDF_FLAG_SESSION_SET);
break;
case Opt_lastblock:
if (match_int(args, &option))
return 0;
uopt->lastblock = option;
if (!remount)
uopt->flags |= (1 << UDF_FLAG_LASTBLOCK_SET);
break;
case Opt_anchor:
if (match_int(args, &option))
return 0;
uopt->anchor = option;
break;
case Opt_volume:
if (match_int(args, &option))
return 0;
uopt->volume = option;
break;
case Opt_partition:
if (match_int(args, &option))
return 0;
uopt->partition = option;
break;
case Opt_fileset:
if (match_int(args, &option))
return 0;
uopt->fileset = option;
break;
case Opt_rootdir:
if (match_int(args, &option))
return 0;
uopt->rootdir = option;
break;
case Opt_utf8:
uopt->flags |= (1 << UDF_FLAG_UTF8);
break;
#ifdef CONFIG_UDF_NLS
case Opt_iocharset:
uopt->nls_map = load_nls(args[0].from);
uopt->flags |= (1 << UDF_FLAG_NLS_MAP);
break;
#endif
case Opt_uignore:
uopt->flags |= (1 << UDF_FLAG_UID_IGNORE);
break;
case Opt_uforget:
uopt->flags |= (1 << UDF_FLAG_UID_FORGET);
break;
case Opt_gignore:
uopt->flags |= (1 << UDF_FLAG_GID_IGNORE);
break;
case Opt_gforget:
uopt->flags |= (1 << UDF_FLAG_GID_FORGET);
break;
case Opt_fmode:
if (match_octal(args, &option))
return 0;
uopt->fmode = option & 0777;
break;
case Opt_dmode:
if (match_octal(args, &option))
return 0;
uopt->dmode = option & 0777;
break;
default:
pr_err("bad mount option \"%s\" or missing value\n", p);
return 0;
}
}
return 1;
}
| 15,326 |
95,740 | 0 | void CL_UpdateServerInfo( int n ) {
if ( !cl_pinglist[n].adr.port ) {
return;
}
CL_SetServerInfoByAddress( cl_pinglist[n].adr, cl_pinglist[n].info, cl_pinglist[n].time );
}
| 15,327 |
5,604 | 0 | _gcry_ecc_eddsa_ensure_compact (gcry_mpi_t value, unsigned int nbits)
{
gpg_err_code_t rc;
const unsigned char *buf;
unsigned int rawmpilen;
gcry_mpi_t x, y;
unsigned char *enc;
unsigned int enclen;
if (!mpi_is_opaque (value))
return GPG_ERR_INV_OBJ;
buf = mpi_get_opaque (value, &rawmpilen);
if (!buf)
return GPG_ERR_INV_OBJ;
rawmpilen = (rawmpilen + 7)/8;
if (rawmpilen > 1 && (rawmpilen%2))
{
if (buf[0] == 0x04)
{
/* Buffer is in SEC1 uncompressed format. Extract y and
compress. */
rc = _gcry_mpi_scan (&x, GCRYMPI_FMT_STD,
buf+1, (rawmpilen-1)/2, NULL);
if (rc)
return rc;
rc = _gcry_mpi_scan (&y, GCRYMPI_FMT_STD,
buf+1+(rawmpilen-1)/2, (rawmpilen-1)/2, NULL);
if (rc)
{
mpi_free (x);
return rc;
}
rc = eddsa_encode_x_y (x, y, nbits/8, 0, &enc, &enclen);
mpi_free (x);
mpi_free (y);
if (rc)
return rc;
mpi_set_opaque (value, enc, 8*enclen);
}
else if (buf[0] == 0x40)
{
/* Buffer is compressed but with our SEC1 alike compression
indicator. Remove that byte. FIXME: We should write and
use a function to manipulate an opaque MPI in place. */
if (!_gcry_mpi_set_opaque_copy (value, buf + 1, (rawmpilen - 1)*8))
return gpg_err_code_from_syserror ();
}
}
return 0;
}
| 15,328 |
113,387 | 0 | void WebProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection* connection, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName)
{
WTFLogAlways("Received an invalid message \"%s.%s\" from the web process.\n", messageReceiverName.toString().data(), messageName.toString().data());
terminate();
didClose(connection);
}
| 15,329 |
118,880 | 0 | const std::string& WebContentsImpl::GetContentsMimeType() const {
return contents_mime_type_;
}
| 15,330 |
35,986 | 0 | SMB2_set_compression(const unsigned int xid, struct cifs_tcon *tcon,
u64 persistent_fid, u64 volatile_fid)
{
int rc;
struct compress_ioctl fsctl_input;
char *ret_data = NULL;
fsctl_input.CompressionState =
__constant_cpu_to_le16(COMPRESSION_FORMAT_DEFAULT);
rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid,
FSCTL_SET_COMPRESSION, true /* is_fsctl */,
(char *)&fsctl_input /* data input */,
2 /* in data len */, &ret_data /* out data */, NULL);
cifs_dbg(FYI, "set compression rc %d\n", rc);
return rc;
}
| 15,331 |
143,587 | 0 | void OomInterventionImpl::ReportMemoryStats(
OomInterventionMetrics& current_memory) {
UMA_HISTOGRAM_MEMORY_MB(
"Memory.Experimental.OomIntervention.RendererBlinkUsage",
current_memory.current_blink_usage_kb / 1024);
UMA_HISTOGRAM_MEMORY_LARGE_MB(
"Memory.Experimental.OomIntervention."
"RendererPrivateMemoryFootprint",
current_memory.current_private_footprint_kb / 1024);
UMA_HISTOGRAM_MEMORY_MB(
"Memory.Experimental.OomIntervention.RendererSwapFootprint",
current_memory.current_swap_kb / 1024);
UMA_HISTOGRAM_MEMORY_LARGE_MB(
"Memory.Experimental.OomIntervention.RendererVmSize",
current_memory.current_vm_size_kb / 1024);
CrashMemoryMetricsReporterImpl::Instance().WriteIntoSharedMemory(
current_memory);
}
| 15,332 |
76,660 | 0 | static void t1_puts(const char *s)
{
if (s != t1_line_array)
strcpy(t1_line_array, s);
t1_line_ptr = strend(t1_line_array);
t1_putline();
}
| 15,333 |
4,721 | 0 | user_change_location_authorized_cb (Daemon *daemon,
User *user,
GDBusMethodInvocation *context,
gpointer data)
{
gchar *location = data;
if (g_strcmp0 (accounts_user_get_location (ACCOUNTS_USER (user)), location) != 0) {
accounts_user_set_location (ACCOUNTS_USER (user), location);
save_extra_data (user);
}
accounts_user_complete_set_location (ACCOUNTS_USER (user), context);
}
| 15,334 |
56,453 | 0 | void show_stack(struct task_struct *tsk, unsigned long *stack)
{
unsigned long sp, ip, lr, newsp;
int count = 0;
int firstframe = 1;
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
int curr_frame = current->curr_ret_stack;
extern void return_to_handler(void);
unsigned long rth = (unsigned long)return_to_handler;
#endif
sp = (unsigned long) stack;
if (tsk == NULL)
tsk = current;
if (sp == 0) {
if (tsk == current)
sp = current_stack_pointer();
else
sp = tsk->thread.ksp;
}
lr = 0;
printk("Call Trace:\n");
do {
if (!validate_sp(sp, tsk, STACK_FRAME_OVERHEAD))
return;
stack = (unsigned long *) sp;
newsp = stack[0];
ip = stack[STACK_FRAME_LR_SAVE];
if (!firstframe || ip != lr) {
printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
if ((ip == rth) && curr_frame >= 0) {
printk(" (%pS)",
(void *)current->ret_stack[curr_frame].ret);
curr_frame--;
}
#endif
if (firstframe)
printk(" (unreliable)");
printk("\n");
}
firstframe = 0;
/*
* See if this is an exception frame.
* We look for the "regshere" marker in the current frame.
*/
if (validate_sp(sp, tsk, STACK_INT_FRAME_SIZE)
&& stack[STACK_FRAME_MARKER] == STACK_FRAME_REGS_MARKER) {
struct pt_regs *regs = (struct pt_regs *)
(sp + STACK_FRAME_OVERHEAD);
lr = regs->link;
printk("--- interrupt: %lx at %pS\n LR = %pS\n",
regs->trap, (void *)regs->nip, (void *)lr);
firstframe = 1;
}
sp = newsp;
} while (count++ < kstack_depth_to_print);
}
| 15,335 |
15,122 | 0 | PHP_FUNCTION(imagegif)
{
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGifCtx);
}
| 15,336 |
131,012 | 0 | static void reflectedTreatNullAsNullStringCustomURLAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectV8Internal::reflectedTreatNullAsNullStringCustomURLAttrAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 15,337 |
81,593 | 0 | static void parse_error(struct filter_parse_error *pe, int err, int pos)
{
pe->lasterr = err;
pe->lasterr_pos = pos;
}
| 15,338 |
163,067 | 0 | void CloseFds(const std::vector<int>& fds) {
for (const auto& it : fds) {
PCHECK(0 == IGNORE_EINTR(close(it)));
}
}
| 15,339 |
182,458 | 1 | static BOOL nsc_context_initialize_encode(NSC_CONTEXT* context)
{
int i;
UINT32 length;
UINT32 tempWidth;
UINT32 tempHeight;
tempWidth = ROUND_UP_TO(context->width, 8);
tempHeight = ROUND_UP_TO(context->height, 2);
/* The maximum length a decoded plane can reach in all cases */
length = tempWidth * tempHeight + 16;
if (length > context->priv->PlaneBuffersLength)
{
for (i = 0; i < 5; i++)
{
BYTE* tmp = (BYTE*) realloc(context->priv->PlaneBuffers[i], length);
if (!tmp)
goto fail;
context->priv->PlaneBuffers[i] = tmp;
}
context->priv->PlaneBuffersLength = length;
}
if (context->ChromaSubsamplingLevel)
{
context->OrgByteCount[0] = tempWidth * context->height;
context->OrgByteCount[1] = tempWidth * tempHeight / 4;
context->OrgByteCount[2] = tempWidth * tempHeight / 4;
context->OrgByteCount[3] = context->width * context->height;
}
else
{
context->OrgByteCount[0] = context->width * context->height;
context->OrgByteCount[1] = context->width * context->height;
context->OrgByteCount[2] = context->width * context->height;
context->OrgByteCount[3] = context->width * context->height;
}
return TRUE;
fail:
if (length > context->priv->PlaneBuffersLength)
{
for (i = 0; i < 5; i++)
free(context->priv->PlaneBuffers[i]);
}
return FALSE;
}
| 15,340 |
81,831 | 0 | int do_mp_jacobi(mp_int* a, mp_int* n, int* c)
{
int k, s, res;
int r = 0; /* initialize to help static analysis out */
mp_digit residue;
/* if a < 0 return MP_VAL */
if (mp_isneg(a) == MP_YES) {
return MP_VAL;
}
/* if n <= 0 return MP_VAL */
if (mp_cmp_d(n, 0) != MP_GT) {
return MP_VAL;
}
/* step 1. handle case of a == 0 */
if (mp_iszero (a) == MP_YES) {
/* special case of a == 0 and n == 1 */
if (mp_cmp_d (n, 1) == MP_EQ) {
*c = 1;
} else {
*c = 0;
}
return MP_OKAY;
}
/* step 2. if a == 1, return 1 */
if (mp_cmp_d (a, 1) == MP_EQ) {
*c = 1;
return MP_OKAY;
}
/* default */
s = 0;
/* divide out larger power of two */
k = mp_cnt_lsb(a);
res = mp_div_2d(a, k, a, NULL);
if (res == MP_OKAY) {
/* step 4. if e is even set s=1 */
if ((k & 1) == 0) {
s = 1;
} else {
/* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */
residue = n->dp[0] & 7;
if (residue == 1 || residue == 7) {
s = 1;
} else if (residue == 3 || residue == 5) {
s = -1;
}
}
/* step 5. if p == 3 (mod 4) *and* a == 3 (mod 4) then s = -s */
if ( ((n->dp[0] & 3) == 3) && ((a->dp[0] & 3) == 3)) {
s = -s;
}
}
if (res == MP_OKAY) {
/* if a == 1 we're done */
if (mp_cmp_d(a, 1) == MP_EQ) {
*c = s;
} else {
/* n1 = n mod a */
res = mp_mod (n, a, n);
if (res == MP_OKAY)
res = do_mp_jacobi(n, a, &r);
if (res == MP_OKAY)
*c = s * r;
}
}
return res;
}
| 15,341 |
169,257 | 0 | void InjectRawKeyEvent(WebContents* web_contents,
blink::WebInputEvent::Type type,
ui::DomKey key,
ui::DomCode code,
ui::KeyboardCode key_code,
int modifiers) {
NativeWebKeyboardEvent event(type, modifiers, base::TimeTicks::Now());
BuildSimpleWebKeyEvent(type, key, code, key_code, &event);
WebContentsImpl* web_contents_impl =
static_cast<WebContentsImpl*>(web_contents);
RenderWidgetHostImpl* main_frame_rwh =
web_contents_impl->GetMainFrame()->GetRenderWidgetHost();
web_contents_impl->GetFocusedRenderWidgetHost(main_frame_rwh)
->ForwardKeyboardEvent(event);
}
| 15,342 |
71,743 | 0 | static void StripStyleTokens(char *message)
{
register char
*p,
*q;
size_t
length;
assert(message != (char *) NULL);
if (*message == '\0')
return;
length=strlen(message);
p=message;
while (isspace((int) ((unsigned char) *p)) != 0)
p++;
q=message+length-1;
while ((isspace((int) ((unsigned char) *q)) != 0) && (q > p))
q--;
(void) CopyMagickMemory(message,p,(size_t) (q-p+1));
message[q-p+1]='\0';
StripString(message);
}
| 15,343 |
62,327 | 0 | handle_ppp(netdissect_options *ndo,
u_int proto, const u_char *p, int length)
{
if ((proto & 0xff00) == 0x7e00) { /* is this an escape code ? */
ppp_hdlc(ndo, p - 1, length);
return;
}
switch (proto) {
case PPP_LCP: /* fall through */
case PPP_IPCP:
case PPP_OSICP:
case PPP_MPLSCP:
case PPP_IPV6CP:
case PPP_CCP:
case PPP_BACP:
handle_ctrl_proto(ndo, proto, p, length);
break;
case PPP_ML:
handle_mlppp(ndo, p, length);
break;
case PPP_CHAP:
handle_chap(ndo, p, length);
break;
case PPP_PAP:
handle_pap(ndo, p, length);
break;
case PPP_BAP: /* XXX: not yet completed */
handle_bap(ndo, p, length);
break;
case ETHERTYPE_IP: /*XXX*/
case PPP_VJNC:
case PPP_IP:
ip_print(ndo, p, length);
break;
case ETHERTYPE_IPV6: /*XXX*/
case PPP_IPV6:
ip6_print(ndo, p, length);
break;
case ETHERTYPE_IPX: /*XXX*/
case PPP_IPX:
ipx_print(ndo, p, length);
break;
case PPP_OSI:
isoclns_print(ndo, p, length);
break;
case PPP_MPLS_UCAST:
case PPP_MPLS_MCAST:
mpls_print(ndo, p, length);
break;
case PPP_COMP:
ND_PRINT((ndo, "compressed PPP data"));
break;
default:
ND_PRINT((ndo, "%s ", tok2str(ppptype2str, "unknown PPP protocol (0x%04x)", proto)));
print_unknown_data(ndo, p, "\n\t", length);
break;
}
}
| 15,344 |
75,544 | 0 | static int usb_dev_freeze(struct device *dev)
{
return usb_suspend(dev, PMSG_FREEZE);
}
| 15,345 |
183,663 | 1 | void CheckNodeValue(const BaseNode& node, const DictionaryValue& value,
bool is_detailed) {
ExpectInt64Value(node.GetId(), value, "id");
{
bool is_folder = false;
EXPECT_TRUE(value.GetBoolean("isFolder", &is_folder));
EXPECT_EQ(node.GetIsFolder(), is_folder);
}
ExpectDictStringValue(node.GetTitle(), value, "title");
{
ModelType expected_model_type = node.GetModelType();
std::string type_str;
EXPECT_TRUE(value.GetString("type", &type_str));
if (expected_model_type >= syncable::FIRST_REAL_MODEL_TYPE) {
ModelType model_type =
syncable::ModelTypeFromString(type_str);
EXPECT_EQ(expected_model_type, model_type);
} else if (expected_model_type == syncable::TOP_LEVEL_FOLDER) {
EXPECT_EQ("Top-level folder", type_str);
} else if (expected_model_type == syncable::UNSPECIFIED) {
EXPECT_EQ("Unspecified", type_str);
} else {
ADD_FAILURE();
}
}
if (is_detailed) {
ExpectInt64Value(node.GetParentId(), value, "parentId");
ExpectTimeValue(node.GetModificationTime(), value, "modificationTime");
ExpectInt64Value(node.GetExternalId(), value, "externalId");
ExpectInt64Value(node.GetPredecessorId(), value, "predecessorId");
ExpectInt64Value(node.GetSuccessorId(), value, "successorId");
ExpectInt64Value(node.GetFirstChildId(), value, "firstChildId");
{
scoped_ptr<DictionaryValue> expected_entry(node.GetEntry()->ToValue());
Value* entry = NULL;
EXPECT_TRUE(value.Get("entry", &entry));
EXPECT_TRUE(Value::Equals(entry, expected_entry.get()));
}
EXPECT_EQ(11u, value.size());
} else {
EXPECT_EQ(4u, value.size());
}
}
| 15,346 |
35,241 | 0 | int dev_change_name(struct net_device *dev, const char *newname)
{
char oldname[IFNAMSIZ];
int err = 0;
int ret;
struct net *net;
ASSERT_RTNL();
BUG_ON(!dev_net(dev));
net = dev_net(dev);
if (dev->flags & IFF_UP)
return -EBUSY;
if (strncmp(newname, dev->name, IFNAMSIZ) == 0)
return 0;
memcpy(oldname, dev->name, IFNAMSIZ);
err = dev_get_valid_name(dev, newname, 1);
if (err < 0)
return err;
rollback:
ret = device_rename(&dev->dev, dev->name);
if (ret) {
memcpy(dev->name, oldname, IFNAMSIZ);
return ret;
}
write_lock_bh(&dev_base_lock);
hlist_del(&dev->name_hlist);
write_unlock_bh(&dev_base_lock);
synchronize_rcu();
write_lock_bh(&dev_base_lock);
hlist_add_head_rcu(&dev->name_hlist, dev_name_hash(net, dev->name));
write_unlock_bh(&dev_base_lock);
ret = call_netdevice_notifiers(NETDEV_CHANGENAME, dev);
ret = notifier_to_errno(ret);
if (ret) {
/* err >= 0 after dev_alloc_name() or stores the first errno */
if (err >= 0) {
err = ret;
memcpy(dev->name, oldname, IFNAMSIZ);
goto rollback;
} else {
printk(KERN_ERR
"%s: name change rollback failed: %d.\n",
dev->name, ret);
}
}
return err;
}
| 15,347 |
137,869 | 0 | bool MediaControlVolumeSliderElement::keepEventInNode(Event* event) {
return isUserInteractionEventForSlider(event, layoutObject());
}
| 15,348 |
99,265 | 0 | GetRawCookiesCompletion(const GURL& url, IPC::Message* reply_msg,
ResourceMessageFilter* filter,
URLRequestContext* context)
: url_(url),
reply_msg_(reply_msg),
filter_(filter),
context_(context) {
}
| 15,349 |
2,968 | 0 | pdf14_push_text_group(gx_device *dev, gs_gstate *pgs, gx_path *path,
const gx_clip_path *pcpath, gs_blend_mode_t blend_mode, float opacity,
bool is_clist)
{
int code;
gs_transparency_group_params_t params = { 0 };
gs_rect bbox = { 0 }; /* Bounding box is set by parent */
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
/* Push a non-isolated knock-out group making sure the opacity and blend
mode are correct */
params.Isolated = false;
params.Knockout = true;
params.text_group = PDF14_TEXTGROUP_BT_PUSHED;
gs_setopacityalpha(pgs, 1.0);
gs_setblendmode(pgs, BLEND_MODE_Normal);
if (is_clist) {
code = pdf14_clist_update_params(pdev, pgs, false, NULL);
if (code < 0)
return code;
}
code = gs_begin_transparency_group(pgs, ¶ms, &bbox);
if (code < 0)
return code;
gs_setopacityalpha(pgs, opacity);
gs_setblendmode(pgs, blend_mode);
if (is_clist)
code = pdf14_clist_update_params(pdev, pgs, false, NULL);
return code;
}
| 15,350 |
550 | 0 | pdf_run_xobject(fz_context *ctx, pdf_run_processor *proc, pdf_xobject *xobj, pdf_obj *page_resources, const fz_matrix *transform, int is_smask)
{
pdf_run_processor *pr = (pdf_run_processor *)proc;
pdf_gstate *gstate = NULL;
int oldtop = 0;
int oldbot = -1;
fz_matrix local_transform = *transform;
softmask_save softmask = { NULL };
int gparent_save;
fz_matrix gparent_save_ctm;
int cleanup_state = 0;
char errmess[256] = "";
pdf_obj *resources;
fz_rect xobj_bbox;
fz_matrix xobj_matrix;
int transparency = 0;
pdf_document *doc;
fz_colorspace *cs = NULL;
fz_default_colorspaces *saved_def_cs = NULL;
/* Avoid infinite recursion */
if (xobj == NULL || pdf_mark_obj(ctx, xobj->obj))
return;
fz_var(cleanup_state);
fz_var(gstate);
fz_var(oldtop);
fz_var(oldbot);
fz_var(cs);
fz_var(saved_def_cs);
gparent_save = pr->gparent;
pr->gparent = pr->gtop;
oldtop = pr->gtop;
fz_try(ctx)
{
pdf_gsave(ctx, pr);
gstate = pr->gstate + pr->gtop;
pdf_xobject_bbox(ctx, xobj, &xobj_bbox);
pdf_xobject_matrix(ctx, xobj, &xobj_matrix);
transparency = pdf_xobject_transparency(ctx, xobj);
/* apply xobject's transform matrix */
fz_concat(&local_transform, &xobj_matrix, &local_transform);
fz_concat(&gstate->ctm, &local_transform, &gstate->ctm);
/* The gparent is updated with the modified ctm */
gparent_save_ctm = pr->gstate[pr->gparent].ctm;
pr->gstate[pr->gparent].ctm = gstate->ctm;
/* apply soft mask, create transparency group and reset state */
if (transparency)
{
fz_rect bbox;
int isolated = pdf_xobject_isolated(ctx, xobj);
bbox = xobj_bbox;
fz_transform_rect(&bbox, &gstate->ctm);
/* Remember that we tried to call begin_softmask. Even
* if it throws an error, we must call end_softmask. */
cleanup_state = 1;
gstate = begin_softmask(ctx, pr, &softmask);
/* Remember that we tried to call fz_begin_group. Even
* if it throws an error, we must call fz_end_group. */
cleanup_state = 2;
if (isolated)
cs = pdf_xobject_colorspace(ctx, xobj);
fz_begin_group(ctx, pr->dev, &bbox,
cs,
(is_smask ? 1 : isolated),
pdf_xobject_knockout(ctx, xobj),
gstate->blendmode, gstate->fill.alpha);
gstate->blendmode = 0;
gstate->stroke.alpha = 1;
gstate->fill.alpha = 1;
}
/* Remember that we tried to save for the clippath. Even if it
* throws an error, we must pop it. */
cleanup_state = 3;
pdf_gsave(ctx, pr); /* Save here so the clippath doesn't persist */
/* clip to the bounds */
fz_moveto(ctx, pr->path, xobj_bbox.x0, xobj_bbox.y0);
fz_lineto(ctx, pr->path, xobj_bbox.x1, xobj_bbox.y0);
fz_lineto(ctx, pr->path, xobj_bbox.x1, xobj_bbox.y1);
fz_lineto(ctx, pr->path, xobj_bbox.x0, xobj_bbox.y1);
fz_closepath(ctx, pr->path);
pr->clip = 1;
pdf_show_path(ctx, pr, 0, 0, 0, 0);
/* run contents */
resources = pdf_xobject_resources(ctx, xobj);
if (!resources)
resources = page_resources;
saved_def_cs = pr->default_cs;
pr->default_cs = NULL;
pr->default_cs = pdf_update_default_colorspaces(ctx, saved_def_cs, resources);
if (pr->default_cs != saved_def_cs)
fz_set_default_colorspaces(ctx, pr->dev, pr->default_cs);
doc = pdf_get_bound_document(ctx, xobj->obj);
oldbot = pr->gbot;
pr->gbot = pr->gtop;
pdf_process_contents(ctx, (pdf_processor*)pr, doc, resources, xobj->obj, NULL);
}
fz_always(ctx)
{
fz_drop_colorspace(ctx, cs);
if (saved_def_cs)
{
fz_drop_default_colorspaces(ctx, pr->default_cs);
pr->default_cs = saved_def_cs;
fz_try(ctx)
{
fz_set_default_colorspaces(ctx, pr->dev, pr->default_cs);
}
fz_catch(ctx)
{
/* Postpone the problem */
strcpy(errmess, fz_caught_message(ctx));
}
}
/* Undo any gstate mismatches due to the pdf_process_contents call */
if (oldbot != -1)
{
while (pr->gtop > pr->gbot)
{
pdf_grestore(ctx, pr);
}
pr->gbot = oldbot;
}
if (cleanup_state >= 3)
pdf_grestore(ctx, pr); /* Remove the state we pushed for the clippath */
/* wrap up transparency stacks */
if (transparency)
{
if (cleanup_state >= 2)
{
fz_try(ctx)
{
fz_end_group(ctx, pr->dev);
}
fz_catch(ctx)
{
/* Postpone the problem */
if (errmess[0])
fz_warn(ctx, "%s", errmess);
strcpy(errmess, fz_caught_message(ctx));
}
}
if (cleanup_state >= 1)
{
fz_try(ctx)
{
end_softmask(ctx, pr, &softmask);
}
fz_catch(ctx)
{
/* Postpone the problem */
if (errmess[0])
fz_warn(ctx, "%s", errmess);
strcpy(errmess, fz_caught_message(ctx));
}
}
}
pr->gstate[pr->gparent].ctm = gparent_save_ctm;
pr->gparent = gparent_save;
while (oldtop < pr->gtop)
pdf_grestore(ctx, pr);
pdf_unmark_obj(ctx, xobj->obj);
}
fz_catch(ctx)
{
fz_rethrow(ctx);
}
/* Rethrow postponed errors */
if (errmess[0])
fz_throw(ctx, FZ_ERROR_GENERIC, "%s", errmess);
}
| 15,351 |
52,333 | 0 | compat_copy_entry_to_user(struct ip6t_entry *e, void __user **dstptr,
unsigned int *size, struct xt_counters *counters,
unsigned int i)
{
struct xt_entry_target *t;
struct compat_ip6t_entry __user *ce;
u_int16_t target_offset, next_offset;
compat_uint_t origsize;
const struct xt_entry_match *ematch;
int ret = 0;
origsize = *size;
ce = (struct compat_ip6t_entry __user *)*dstptr;
if (copy_to_user(ce, e, sizeof(struct ip6t_entry)) != 0 ||
copy_to_user(&ce->counters, &counters[i],
sizeof(counters[i])) != 0)
return -EFAULT;
*dstptr += sizeof(struct compat_ip6t_entry);
*size -= sizeof(struct ip6t_entry) - sizeof(struct compat_ip6t_entry);
xt_ematch_foreach(ematch, e) {
ret = xt_compat_match_to_user(ematch, dstptr, size);
if (ret != 0)
return ret;
}
target_offset = e->target_offset - (origsize - *size);
t = ip6t_get_target(e);
ret = xt_compat_target_to_user(t, dstptr, size);
if (ret)
return ret;
next_offset = e->next_offset - (origsize - *size);
if (put_user(target_offset, &ce->target_offset) != 0 ||
put_user(next_offset, &ce->next_offset) != 0)
return -EFAULT;
return 0;
}
| 15,352 |
180,071 | 1 | static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct ion_client *client = filp->private_data;
struct ion_device *dev = client->dev;
struct ion_handle *cleanup_handle = NULL;
int ret = 0;
unsigned int dir;
union {
struct ion_fd_data fd;
struct ion_allocation_data allocation;
struct ion_handle_data handle;
struct ion_custom_data custom;
} data;
dir = ion_ioctl_dir(cmd);
if (_IOC_SIZE(cmd) > sizeof(data))
return -EINVAL;
if (dir & _IOC_WRITE)
if (copy_from_user(&data, (void __user *)arg, _IOC_SIZE(cmd)))
return -EFAULT;
switch (cmd) {
case ION_IOC_ALLOC:
{
struct ion_handle *handle;
handle = ion_alloc(client, data.allocation.len,
data.allocation.align,
data.allocation.heap_id_mask,
data.allocation.flags);
if (IS_ERR(handle))
return PTR_ERR(handle);
data.allocation.handle = handle->id;
cleanup_handle = handle;
break;
}
case ION_IOC_FREE:
{
struct ion_handle *handle;
handle = ion_handle_get_by_id(client, data.handle.handle);
if (IS_ERR(handle))
return PTR_ERR(handle);
ion_free(client, handle);
ion_handle_put(handle);
break;
}
case ION_IOC_SHARE:
case ION_IOC_MAP:
{
struct ion_handle *handle;
handle = ion_handle_get_by_id(client, data.handle.handle);
if (IS_ERR(handle))
return PTR_ERR(handle);
data.fd.fd = ion_share_dma_buf_fd(client, handle);
ion_handle_put(handle);
if (data.fd.fd < 0)
ret = data.fd.fd;
break;
}
case ION_IOC_IMPORT:
{
struct ion_handle *handle;
handle = ion_import_dma_buf_fd(client, data.fd.fd);
if (IS_ERR(handle))
ret = PTR_ERR(handle);
else
data.handle.handle = handle->id;
break;
}
case ION_IOC_SYNC:
{
ret = ion_sync_for_device(client, data.fd.fd);
break;
}
case ION_IOC_CUSTOM:
{
if (!dev->custom_ioctl)
return -ENOTTY;
ret = dev->custom_ioctl(client, data.custom.cmd,
data.custom.arg);
break;
}
default:
return -ENOTTY;
}
if (dir & _IOC_READ) {
if (copy_to_user((void __user *)arg, &data, _IOC_SIZE(cmd))) {
if (cleanup_handle)
ion_free(client, cleanup_handle);
return -EFAULT;
}
}
return ret;
}
| 15,353 |
32,151 | 0 | static void dev_unicast_init(struct net_device *dev)
{
__hw_addr_init(&dev->uc);
}
| 15,354 |
170,857 | 0 | status_t GraphicBuffer::lockAsync(uint32_t usage, void** vaddr, int fenceFd)
{
const Rect lockBounds(width, height);
status_t res = lockAsync(usage, lockBounds, vaddr, fenceFd);
return res;
}
| 15,355 |
109,844 | 0 | void Document::styleResolverChanged(RecalcStyleTime updateTime, StyleResolverUpdateMode updateMode)
{
if (!confusingAndOftenMisusedAttached() || (!m_didCalculateStyleResolver && !haveStylesheetsLoaded())) {
m_styleResolver.clear();
return;
}
m_didCalculateStyleResolver = true;
bool needsRecalc = m_styleEngine->updateActiveStyleSheets(updateMode);
if (didLayoutWithPendingStylesheets() && !m_styleEngine->hasPendingSheets()) {
m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
renderView()->repaintViewAndCompositedLayers();
}
if (!needsRecalc)
return;
m_evaluateMediaQueriesOnStyleRecalc = true;
setNeedsStyleRecalc();
if (updateTime == RecalcStyleImmediately)
updateStyleIfNeeded();
}
| 15,356 |
169,702 | 0 | V8ValueConverter* V8ValueConverter::create() {
return new V8ValueConverterImpl();
}
| 15,357 |
78,476 | 0 | iasecc_chv_verify(struct sc_card *card, struct sc_pin_cmd_data *pin_cmd,
int *tries_left)
{
struct sc_context *ctx = card->ctx;
struct sc_acl_entry acl = pin_cmd->pin1.acls[IASECC_ACLS_CHV_VERIFY];
struct sc_apdu apdu;
int rv;
LOG_FUNC_CALLED(ctx);
sc_log(ctx, "Verify CHV PIN(ref:%i,len:%i,acl:%X:%X)", pin_cmd->pin_reference, pin_cmd->pin1.len,
acl.method, acl.key_ref);
if (acl.method & IASECC_SCB_METHOD_SM) {
rv = iasecc_sm_pin_verify(card, acl.key_ref, pin_cmd, tries_left);
LOG_FUNC_RETURN(ctx, rv);
}
if (pin_cmd->pin1.data && !pin_cmd->pin1.len) {
sc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0x20, 0, pin_cmd->pin_reference);
}
else if (pin_cmd->pin1.data && pin_cmd->pin1.len) {
sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x20, 0, pin_cmd->pin_reference);
apdu.data = pin_cmd->pin1.data;
apdu.datalen = pin_cmd->pin1.len;
apdu.lc = pin_cmd->pin1.len;
}
else if ((card->reader->capabilities & SC_READER_CAP_PIN_PAD) && !pin_cmd->pin1.data && !pin_cmd->pin1.len) {
rv = iasecc_chv_verify_pinpad(card, pin_cmd, tries_left);
sc_log(ctx, "Result of verifying CHV with PIN pad %i", rv);
LOG_FUNC_RETURN(ctx, rv);
}
else {
LOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED);
}
rv = sc_transmit_apdu(card, &apdu);
LOG_TEST_RET(ctx, rv, "APDU transmit failed");
if (tries_left && apdu.sw1 == 0x63 && (apdu.sw2 & 0xF0) == 0xC0)
*tries_left = apdu.sw2 & 0x0F;
rv = sc_check_sw(card, apdu.sw1, apdu.sw2);
LOG_FUNC_RETURN(ctx, rv);
}
| 15,358 |
22,938 | 0 | static struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp)
{
struct rpc_cred *cred = NULL;
if (clp->cl_machine_cred != NULL)
cred = get_rpccred(clp->cl_machine_cred);
return cred;
}
| 15,359 |
142,977 | 0 | uint64_t HTMLMediaElement::webkitVideoDecodedByteCount() const {
if (!GetWebMediaPlayer())
return 0;
return GetWebMediaPlayer()->VideoDecodedByteCount();
}
| 15,360 |
15,467 | 0 | Tar::Tar(wxString& szFile) : DFile(szFile)
{
bCanCompress = false;
}
| 15,361 |
184,097 | 1 | ScreenLockLibrary* CrosLibrary::GetScreenLockLibrary() {
return screen_lock_lib_.GetDefaultImpl(use_stub_impl_);
}
| 15,362 |
93,206 | 0 | warning(const char *fmt, ...)
{
va_list ap;
(void)fprintf(stderr, "%s: WARNING: ", program_name);
va_start(ap, fmt);
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
if (*fmt) {
fmt += strlen(fmt);
if (fmt[-1] != '\n')
(void)fputc('\n', stderr);
}
}
| 15,363 |
56,333 | 0 | static double filter_power(const double x)
{
const double a = 2.0f;
if (fabs(x)>1) return 0.0f;
return (1.0f - (double)fabs(pow(x,a)));
}
| 15,364 |
122,148 | 0 | void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset)
{
if (m_overflowControlsHostLayer)
m_overflowControlsHostLayer->setPosition(contentsOffset);
}
| 15,365 |
793 | 0 | poppler_page_get_thumbnail_pixbuf (PopplerPage *page)
{
unsigned char *data;
int width, height, rowstride;
g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE);
if (!page->page->loadThumb (&data, &width, &height, &rowstride))
return NULL;
return gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB,
FALSE, 8, width, height, rowstride,
(GdkPixbufDestroyNotify)gfree, NULL);
}
| 15,366 |
42,494 | 0 | void mddev_unlock(struct mddev *mddev)
{
if (mddev->to_remove) {
/* These cannot be removed under reconfig_mutex as
* an access to the files will try to take reconfig_mutex
* while holding the file unremovable, which leads to
* a deadlock.
* So hold set sysfs_active while the remove in happeing,
* and anything else which might set ->to_remove or my
* otherwise change the sysfs namespace will fail with
* -EBUSY if sysfs_active is still set.
* We set sysfs_active under reconfig_mutex and elsewhere
* test it under the same mutex to ensure its correct value
* is seen.
*/
struct attribute_group *to_remove = mddev->to_remove;
mddev->to_remove = NULL;
mddev->sysfs_active = 1;
mutex_unlock(&mddev->reconfig_mutex);
if (mddev->kobj.sd) {
if (to_remove != &md_redundancy_group)
sysfs_remove_group(&mddev->kobj, to_remove);
if (mddev->pers == NULL ||
mddev->pers->sync_request == NULL) {
sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
if (mddev->sysfs_action)
sysfs_put(mddev->sysfs_action);
mddev->sysfs_action = NULL;
}
}
mddev->sysfs_active = 0;
} else
mutex_unlock(&mddev->reconfig_mutex);
/* As we've dropped the mutex we need a spinlock to
* make sure the thread doesn't disappear
*/
spin_lock(&pers_lock);
md_wakeup_thread(mddev->thread);
spin_unlock(&pers_lock);
}
| 15,367 |
68,849 | 0 | static void cache_init_objs(struct kmem_cache *cachep,
struct page *page)
{
int i;
void *objp;
bool shuffled;
cache_init_objs_debug(cachep, page);
/* Try to randomize the freelist if enabled */
shuffled = shuffle_freelist(cachep, page);
if (!shuffled && OBJFREELIST_SLAB(cachep)) {
page->freelist = index_to_obj(cachep, page, cachep->num - 1) +
obj_offset(cachep);
}
for (i = 0; i < cachep->num; i++) {
objp = index_to_obj(cachep, page, i);
kasan_init_slab_obj(cachep, objp);
/* constructor could break poison info */
if (DEBUG == 0 && cachep->ctor) {
kasan_unpoison_object_data(cachep, objp);
cachep->ctor(objp);
kasan_poison_object_data(cachep, objp);
}
if (!shuffled)
set_free_obj(page, i, i);
}
}
| 15,368 |
138,954 | 0 | void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list) {
for (std::vector<base::FilePath>::const_iterator it = file_list.begin();
it != file_list.end(); ++it) {
base::FilePath path = *it;
if (!base::DeleteFile(path, true) &&
!base::DeleteFile(path.AddExtension(".png"), false)) {
LOG(ERROR) << "Failed to remove user wallpaper at " << path.value();
}
}
}
| 15,369 |
148,383 | 0 | WebContentsImpl* WebContentsImpl::GetCreatedWindow(
int process_id,
int main_frame_widget_route_id) {
auto key = std::make_pair(process_id, main_frame_widget_route_id);
auto iter = pending_contents_.find(key);
if (iter == pending_contents_.end())
return nullptr;
WebContentsImpl* new_contents = iter->second;
pending_contents_.erase(key);
RemoveDestructionObserver(new_contents);
if (BrowserPluginGuest::IsGuest(new_contents))
return new_contents;
if (!new_contents->GetMainFrame()->GetProcess()->HasConnection() ||
!new_contents->GetMainFrame()->GetView()) {
return nullptr;
}
return new_contents;
}
| 15,370 |
38,147 | 0 | static int magicmouse_firm_touch(struct magicmouse_sc *msc)
{
int touch = -1;
int ii;
/* If there is only one "firm" touch, set touch to its
* tracking ID.
*/
for (ii = 0; ii < msc->ntouches; ii++) {
int idx = msc->tracking_ids[ii];
if (msc->touches[idx].size < 8) {
/* Ignore this touch. */
} else if (touch >= 0) {
touch = -1;
break;
} else {
touch = idx;
}
}
return touch;
}
| 15,371 |
21,229 | 0 | void free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor, unsigned long ceiling)
{
pgd_t *pgd;
unsigned long next;
/*
* The next few lines have given us lots of grief...
*
* Why are we testing PMD* at this top level? Because often
* there will be no work to do at all, and we'd prefer not to
* go all the way down to the bottom just to discover that.
*
* Why all these "- 1"s? Because 0 represents both the bottom
* of the address space and the top of it (using -1 for the
* top wouldn't help much: the masks would do the wrong thing).
* The rule is that addr 0 and floor 0 refer to the bottom of
* the address space, but end 0 and ceiling 0 refer to the top
* Comparisons need to use "end - 1" and "ceiling - 1" (though
* that end 0 case should be mythical).
*
* Wherever addr is brought up or ceiling brought down, we must
* be careful to reject "the opposite 0" before it confuses the
* subsequent tests. But what about where end is brought down
* by PMD_SIZE below? no, end can't go down to 0 there.
*
* Whereas we round start (addr) and ceiling down, by different
* masks at different levels, in order to test whether a table
* now has no other vmas using it, so can be freed, we don't
* bother to round floor or end up - the tests don't need that.
*/
addr &= PMD_MASK;
if (addr < floor) {
addr += PMD_SIZE;
if (!addr)
return;
}
if (ceiling) {
ceiling &= PMD_MASK;
if (!ceiling)
return;
}
if (end - 1 > ceiling - 1)
end -= PMD_SIZE;
if (addr > end - 1)
return;
pgd = pgd_offset(tlb->mm, addr);
do {
next = pgd_addr_end(addr, end);
if (pgd_none_or_clear_bad(pgd))
continue;
free_pud_range(tlb, pgd, addr, next, floor, ceiling);
} while (pgd++, addr = next, addr != end);
}
| 15,372 |
112,565 | 0 | void Document::setReadyState(ReadyState readyState)
{
if (readyState == m_readyState)
return;
switch (readyState) {
case Loading:
if (!m_documentTiming.domLoading)
m_documentTiming.domLoading = monotonicallyIncreasingTime();
break;
case Interactive:
if (!m_documentTiming.domInteractive)
m_documentTiming.domInteractive = monotonicallyIncreasingTime();
break;
case Complete:
if (!m_documentTiming.domComplete)
m_documentTiming.domComplete = monotonicallyIncreasingTime();
break;
}
m_readyState = readyState;
dispatchEvent(Event::create(eventNames().readystatechangeEvent, false, false));
if (settings() && settings()->suppressesIncrementalRendering())
setVisualUpdatesAllowed(readyState);
}
| 15,373 |
47,938 | 0 | static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt,
struct segmented_address addr,
unsigned *max_size, unsigned size,
bool write, bool fetch,
enum x86emul_mode mode, ulong *linear)
{
struct desc_struct desc;
bool usable;
ulong la;
u32 lim;
u16 sel;
la = seg_base(ctxt, addr.seg) + addr.ea;
*max_size = 0;
switch (mode) {
case X86EMUL_MODE_PROT64:
*linear = la;
if (is_noncanonical_address(la))
goto bad;
*max_size = min_t(u64, ~0u, (1ull << 48) - la);
if (size > *max_size)
goto bad;
break;
default:
*linear = la = (u32)la;
usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL,
addr.seg);
if (!usable)
goto bad;
/* code segment in protected mode or read-only data segment */
if ((((ctxt->mode != X86EMUL_MODE_REAL) && (desc.type & 8))
|| !(desc.type & 2)) && write)
goto bad;
/* unreadable code segment */
if (!fetch && (desc.type & 8) && !(desc.type & 2))
goto bad;
lim = desc_limit_scaled(&desc);
if (!(desc.type & 8) && (desc.type & 4)) {
/* expand-down segment */
if (addr.ea <= lim)
goto bad;
lim = desc.d ? 0xffffffff : 0xffff;
}
if (addr.ea > lim)
goto bad;
if (lim == 0xffffffff)
*max_size = ~0u;
else {
*max_size = (u64)lim + 1 - addr.ea;
if (size > *max_size)
goto bad;
}
break;
}
if (insn_aligned(ctxt, size) && ((la & (size - 1)) != 0))
return emulate_gp(ctxt, 0);
return X86EMUL_CONTINUE;
bad:
if (addr.seg == VCPU_SREG_SS)
return emulate_ss(ctxt, 0);
else
return emulate_gp(ctxt, 0);
}
| 15,374 |
85,159 | 0 | int do_write_data_page(struct f2fs_io_info *fio)
{
struct page *page = fio->page;
struct inode *inode = page->mapping->host;
struct dnode_of_data dn;
int err = 0;
set_new_dnode(&dn, inode, NULL, NULL, 0);
err = get_dnode_of_data(&dn, page->index, LOOKUP_NODE);
if (err)
return err;
fio->old_blkaddr = dn.data_blkaddr;
/* This page is already truncated */
if (fio->old_blkaddr == NULL_ADDR) {
ClearPageUptodate(page);
goto out_writepage;
}
if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode)) {
gfp_t gfp_flags = GFP_NOFS;
/* wait for GCed encrypted page writeback */
f2fs_wait_on_encrypted_page_writeback(F2FS_I_SB(inode),
fio->old_blkaddr);
retry_encrypt:
fio->encrypted_page = fscrypt_encrypt_page(inode, fio->page,
PAGE_SIZE, 0,
fio->page->index,
gfp_flags);
if (IS_ERR(fio->encrypted_page)) {
err = PTR_ERR(fio->encrypted_page);
if (err == -ENOMEM) {
/* flush pending ios and wait for a while */
f2fs_flush_merged_bios(F2FS_I_SB(inode));
congestion_wait(BLK_RW_ASYNC, HZ/50);
gfp_flags |= __GFP_NOFAIL;
err = 0;
goto retry_encrypt;
}
goto out_writepage;
}
}
set_page_writeback(page);
/*
* If current allocation needs SSR,
* it had better in-place writes for updated data.
*/
if (unlikely(fio->old_blkaddr != NEW_ADDR &&
!is_cold_data(page) &&
!IS_ATOMIC_WRITTEN_PAGE(page) &&
need_inplace_update(inode))) {
rewrite_data_page(fio);
set_inode_flag(inode, FI_UPDATE_WRITE);
trace_f2fs_do_write_data_page(page, IPU);
} else {
write_data_page(&dn, fio);
trace_f2fs_do_write_data_page(page, OPU);
set_inode_flag(inode, FI_APPEND_WRITE);
if (page->index == 0)
set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
}
out_writepage:
f2fs_put_dnode(&dn);
return err;
}
| 15,375 |
54,429 | 0 | static int php_zip_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
zval tmp_member;
zip_prop_handler *hnd = NULL;
zend_object_handlers *std_hnd;
int retval = 0;
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_COPY(&tmp_member, member);
convert_to_string(&tmp_member);
member = &tmp_member;
cache_slot = NULL;
}
obj = Z_ZIP_P(object);
if (obj->prop_handler != NULL) {
hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
}
if (hnd != NULL) {
zval tmp, *prop;
if (type == 2) {
retval = 1;
} else if ((prop = php_zip_property_reader(obj, hnd, &tmp)) != NULL) {
if (type == 1) {
retval = zend_is_true(&tmp);
} else if (type == 0) {
retval = (Z_TYPE(tmp) != IS_NULL);
}
}
zval_ptr_dtor(&tmp);
} else {
std_hnd = zend_get_std_object_handlers();
retval = std_hnd->has_property(object, member, type, cache_slot);
}
if (member == &tmp_member) {
zval_dtor(member);
}
return retval;
}
/* }}} */
| 15,376 |
47,786 | 0 | static inline unsigned int muldiv32(unsigned int a, unsigned int b,
unsigned int c, unsigned int *r)
{
u_int64_t n = (u_int64_t) a * b;
if (c == 0) {
snd_BUG_ON(!n);
*r = 0;
return UINT_MAX;
}
n = div_u64_rem(n, c, r);
if (n >= UINT_MAX) {
*r = 0;
return UINT_MAX;
}
return n;
}
| 15,377 |
106,927 | 0 | int RenderBox::scrollTop() const
{
return hasOverflowClip() ? layer()->scrollYOffset() : 0;
}
| 15,378 |
94,585 | 0 | static enum d_walk_ret check_mount(void *data, struct dentry *dentry)
{
int *ret = data;
if (d_mountpoint(dentry)) {
*ret = 1;
return D_WALK_QUIT;
}
return D_WALK_CONTINUE;
}
| 15,379 |
172,016 | 0 | bt_status_t btsock_l2cap_connect(const bt_bdaddr_t *bd_addr, int channel, int* sock_fd, int flags)
{
return btsock_l2cap_listen_or_connect(NULL, bd_addr, channel, sock_fd, flags, 0);
}
| 15,380 |
22,917 | 0 | static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct inode *inode = data->inode;
if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state) == -EAGAIN) {
rpc_restart_call(task);
return -EAGAIN;
}
if (task->tk_status >= 0) {
renew_lease(NFS_SERVER(inode), data->timestamp);
nfs_post_op_update_inode_force_wcc(inode, data->res.fattr);
}
return 0;
}
| 15,381 |
40,252 | 0 | static int data_sock_getsockopt(struct socket *sock, int level, int optname,
char __user *optval, int __user *optlen)
{
struct sock *sk = sock->sk;
int len, opt;
if (get_user(len, optlen))
return -EFAULT;
if (len != sizeof(char))
return -EINVAL;
switch (optname) {
case MISDN_TIME_STAMP:
if (_pms(sk)->cmask & MISDN_TIME_STAMP)
opt = 1;
else
opt = 0;
if (put_user(opt, optval))
return -EFAULT;
break;
default:
return -ENOPROTOOPT;
}
return 0;
}
| 15,382 |
28,265 | 0 | static inline int pic_is_unused(H264Context *h, Picture *pic)
{
if (pic->f.data[0] == NULL)
return 1;
if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF))
return 1;
return 0;
}
| 15,383 |
8,915 | 0 | void vrend_renderer_resource_destroy(struct vrend_resource *res, bool remove)
{
if (res->readback_fb_id)
glDeleteFramebuffers(1, &res->readback_fb_id);
if (res->ptr)
free(res->ptr);
if (res->id) {
if (res->target == GL_ELEMENT_ARRAY_BUFFER_ARB ||
res->target == GL_ARRAY_BUFFER_ARB ||
res->target == GL_UNIFORM_BUFFER||
res->target == GL_TEXTURE_BUFFER||
res->target == GL_TRANSFORM_FEEDBACK_BUFFER) {
glDeleteBuffers(1, &res->id);
if (res->target == GL_TEXTURE_BUFFER)
glDeleteTextures(1, &res->tbo_tex_id);
} else
glDeleteTextures(1, &res->id);
}
if (res->handle && remove)
vrend_resource_remove(res->handle);
free(res);
}
| 15,384 |
166,721 | 0 | void NormalPageArena::AllocatePage() {
GetThreadState()->Heap().address_cache()->MarkDirty();
PageMemory* page_memory =
GetThreadState()->Heap().GetFreePagePool()->Take(ArenaIndex());
if (!page_memory) {
PageMemoryRegion* region = PageMemoryRegion::AllocateNormalPages(
GetThreadState()->Heap().GetRegionTree());
for (size_t i = 0; i < kBlinkPagesPerRegion; ++i) {
PageMemory* memory = PageMemory::SetupPageMemoryInRegion(
region, i * kBlinkPageSize, BlinkPagePayloadSize());
if (!page_memory) {
bool result = memory->Commit();
CHECK(result);
page_memory = memory;
} else {
GetThreadState()->Heap().GetFreePagePool()->Add(ArenaIndex(), memory);
}
}
}
NormalPage* page =
new (page_memory->WritableStart()) NormalPage(page_memory, this);
page->Link(&first_page_);
GetThreadState()->Heap().HeapStats().IncreaseAllocatedSpace(page->size());
#if DCHECK_IS_ON() || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER)
ASAN_UNPOISON_MEMORY_REGION(page->Payload(), page->PayloadSize());
Address address = page->Payload();
for (size_t i = 0; i < page->PayloadSize(); i++)
address[i] = kReuseAllowedZapValue;
ASAN_POISON_MEMORY_REGION(page->Payload(), page->PayloadSize());
#endif
AddToFreeList(page->Payload(), page->PayloadSize());
}
| 15,385 |
66,747 | 0 | static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
{
u8 b = 0;
if (onoff)
return cxusb_ctrl_msg(d, CMD_POWER_ON, &b, 1, NULL, 0);
else
return cxusb_ctrl_msg(d, CMD_POWER_OFF, &b, 1, NULL, 0);
}
| 15,386 |
164,894 | 0 | DownloadResourceHandler::DownloadResourceHandler(
net::URLRequest* request,
const std::string& request_origin,
download::DownloadSource download_source,
bool follow_cross_origin_redirects)
: ResourceHandler(request),
tab_info_(new DownloadTabInfo()),
follow_cross_origin_redirects_(follow_cross_origin_redirects),
first_origin_(url::Origin::Create(request->url())),
core_(request, this, false, request_origin, download_source) {
const ResourceRequestInfoImpl* request_info = GetRequestInfo();
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::UI},
base::BindOnce(
&InitializeDownloadTabInfoOnUIThread,
DownloadRequestHandle(AsWeakPtr(),
request_info->GetWebContentsGetterForRequest()),
tab_info_.get()));
}
| 15,387 |
138,724 | 0 | void NotifyRenderFrameDetachedOnIO(int render_process_id, int render_frame_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
SharedWorkerServiceImpl::GetInstance()->RenderFrameDetached(render_process_id,
render_frame_id);
}
| 15,388 |
61,720 | 0 | _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error)
{
zip_cdir_t *cd;
zip_uint16_t comment_len;
zip_uint64_t i, left;
zip_uint64_t eocd_offset = _zip_buffer_offset(buffer);
zip_buffer_t *cd_buffer;
if (_zip_buffer_left(buffer) < EOCDLEN) {
/* not enough bytes left for comment */
zip_error_set(error, ZIP_ER_NOZIP, 0);
return NULL;
}
/* check for end-of-central-dir magic */
if (memcmp(_zip_buffer_get(buffer, 4), EOCD_MAGIC, 4) != 0) {
zip_error_set(error, ZIP_ER_NOZIP, 0);
return NULL;
}
if (eocd_offset >= EOCD64LOCLEN && memcmp(_zip_buffer_data(buffer) + eocd_offset - EOCD64LOCLEN, EOCD64LOC_MAGIC, 4) == 0) {
_zip_buffer_set_offset(buffer, eocd_offset - EOCD64LOCLEN);
cd = _zip_read_eocd64(za->src, buffer, buf_offset, za->flags, error);
}
else {
_zip_buffer_set_offset(buffer, eocd_offset);
cd = _zip_read_eocd(buffer, buf_offset, za->flags, error);
}
if (cd == NULL)
return NULL;
_zip_buffer_set_offset(buffer, eocd_offset + 20);
comment_len = _zip_buffer_get_16(buffer);
if (cd->offset + cd->size > buf_offset + eocd_offset) {
/* cdir spans past EOCD record */
zip_error_set(error, ZIP_ER_INCONS, 0);
_zip_cdir_free(cd);
return NULL;
}
if (comment_len || (za->open_flags & ZIP_CHECKCONS)) {
zip_uint64_t tail_len;
_zip_buffer_set_offset(buffer, eocd_offset + EOCDLEN);
tail_len = _zip_buffer_left(buffer);
if (tail_len < comment_len || ((za->open_flags & ZIP_CHECKCONS) && tail_len != comment_len)) {
zip_error_set(error, ZIP_ER_INCONS, 0);
_zip_cdir_free(cd);
return NULL;
}
if (comment_len) {
if ((cd->comment=_zip_string_new(_zip_buffer_get(buffer, comment_len), comment_len, ZIP_FL_ENC_GUESS, error)) == NULL) {
_zip_cdir_free(cd);
return NULL;
}
}
}
if (cd->offset >= buf_offset) {
zip_uint8_t *data;
/* if buffer already read in, use it */
_zip_buffer_set_offset(buffer, cd->offset - buf_offset);
if ((data = _zip_buffer_get(buffer, cd->size)) == NULL) {
zip_error_set(error, ZIP_ER_INCONS, 0);
_zip_cdir_free(cd);
return NULL;
}
if ((cd_buffer = _zip_buffer_new(data, cd->size)) == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
_zip_cdir_free(cd);
return NULL;
}
}
else {
cd_buffer = NULL;
if (zip_source_seek(za->src, (zip_int64_t)cd->offset, SEEK_SET) < 0) {
_zip_error_set_from_source(error, za->src);
_zip_cdir_free(cd);
return NULL;
}
/* possible consistency check: cd->offset = len-(cd->size+cd->comment_len+EOCDLEN) ? */
if (zip_source_tell(za->src) != (zip_int64_t)cd->offset) {
zip_error_set(error, ZIP_ER_NOZIP, 0);
_zip_cdir_free(cd);
return NULL;
}
}
left = (zip_uint64_t)cd->size;
i=0;
while (left > 0) {
bool grown = false;
zip_int64_t entry_size;
if (i == cd->nentry) {
/* InfoZIP has a hack to avoid using Zip64: it stores nentries % 0x10000 */
/* This hack isn't applicable if we're using Zip64, or if there is no central directory entry following. */
if (cd->is_zip64 || left < CDENTRYSIZE) {
break;
}
if (!_zip_cdir_grow(cd, 0x10000, error)) {
_zip_cdir_free(cd);
_zip_buffer_free(cd_buffer);
return NULL;
}
grown = true;
}
if ((cd->entry[i].orig=_zip_dirent_new()) == NULL || (entry_size = _zip_dirent_read(cd->entry[i].orig, za->src, cd_buffer, false, error)) < 0) {
if (grown && zip_error_code_zip(error) == ZIP_ER_NOZIP) {
zip_error_set(error, ZIP_ER_INCONS, 0);
}
_zip_cdir_free(cd);
_zip_buffer_free(cd_buffer);
return NULL;
}
i++;
left -= (zip_uint64_t)entry_size;
}
if (i != cd->nentry || left > 0) {
zip_error_set(error, ZIP_ER_INCONS, 0);
_zip_buffer_free(cd_buffer);
_zip_cdir_free(cd);
return NULL;
}
if (za->open_flags & ZIP_CHECKCONS) {
bool ok;
if (cd_buffer) {
ok = _zip_buffer_eof(cd_buffer);
}
else {
zip_int64_t offset = zip_source_tell(za->src);
if (offset < 0) {
_zip_error_set_from_source(error, za->src);
_zip_cdir_free(cd);
return NULL;
}
ok = ((zip_uint64_t)offset == cd->offset + cd->size);
}
if (!ok) {
zip_error_set(error, ZIP_ER_INCONS, 0);
_zip_buffer_free(cd_buffer);
_zip_cdir_free(cd);
return NULL;
}
}
_zip_buffer_free(cd_buffer);
return cd;
}
| 15,389 |
65,177 | 0 | static int __init ipv6_offload_init(void)
{
if (tcpv6_offload_init() < 0)
pr_crit("%s: Cannot add TCP protocol offload\n", __func__);
if (ipv6_exthdrs_offload_init() < 0)
pr_crit("%s: Cannot add EXTHDRS protocol offload\n", __func__);
dev_add_offload(&ipv6_packet_offload);
inet_add_offload(&sit_offload, IPPROTO_IPV6);
inet6_add_offload(&ip6ip6_offload, IPPROTO_IPV6);
inet6_add_offload(&ip4ip6_offload, IPPROTO_IPIP);
return 0;
}
| 15,390 |
164,199 | 0 | static void SignalEvent(base::WaitableEvent* event) { event->Signal(); }
| 15,391 |
4,957 | 0 | gst_qtdemux_push_pending_newsegment (GstQTDemux * qtdemux)
{
if (qtdemux->pending_newsegment) {
gst_qtdemux_push_event (qtdemux, qtdemux->pending_newsegment);
qtdemux->pending_newsegment = NULL;
}
}
| 15,392 |
124,736 | 0 | LayoutUnit RenderBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatType) const
{
if (!m_floatingObjects)
return 0;
return m_floatingObjects->lowestFloatLogicalBottom(floatType);
}
| 15,393 |
26,908 | 0 | static int sched_show(struct seq_file *m, void *v)
{
struct inode *inode = m->private;
struct task_struct *p;
p = get_proc_task(inode);
if (!p)
return -ESRCH;
proc_sched_show_task(p, m);
put_task_struct(p);
return 0;
}
| 15,394 |
183,616 | 1 | void UpdateNetworkManagerStatus() {
// Make sure we run on UI thread.
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this,
&NetworkLibraryImpl::UpdateNetworkManagerStatus));
return;
}
SystemInfo* system = GetSystemInfo();
if (!system)
return;
std::string prev_cellular_service_path = cellular_ ?
cellular_->service_path() : std::string();
ClearNetworks();
ParseSystem(system, ðernet_, &wifi_networks_, &cellular_networks_,
&remembered_wifi_networks_);
wifi_ = NULL;
for (size_t i = 0; i < wifi_networks_.size(); i++) {
if (wifi_networks_[i]->connecting_or_connected()) {
wifi_ = wifi_networks_[i];
break; // There is only one connected or connecting wifi network.
}
}
cellular_ = NULL;
for (size_t i = 0; i < cellular_networks_.size(); i++) {
if (cellular_networks_[i]->connecting_or_connected()) {
cellular_ = cellular_networks_[i];
// If new cellular, then update data plan list.
if (cellular_networks_[i]->service_path() !=
prev_cellular_service_path) {
CellularDataPlanList* list = RetrieveCellularDataPlans(
cellular_->service_path().c_str());
UpdateCellularDataPlan(list);
FreeCellularDataPlanList(list);
}
break; // There is only one connected or connecting cellular network.
}
}
available_devices_ = system->available_technologies;
enabled_devices_ = system->enabled_technologies;
connected_devices_ = system->connected_technologies;
offline_mode_ = system->offline_mode;
NotifyNetworkManagerChanged();
FreeSystemInfo(system);
}
| 15,395 |
47,161 | 0 | static void __exit camellia_fini(void)
{
crypto_unregister_alg(&camellia_alg);
}
| 15,396 |
74,802 | 0 | void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n, int dir)
{
int i;
int16_t *ac_val, *ac_val1;
int8_t *const qscale_table = s->current_picture.qscale_table;
/* find prediction */
ac_val = &s->ac_val[0][0][0] + s->block_index[n] * 16;
ac_val1 = ac_val;
if (s->ac_pred) {
if (dir == 0) {
const int xy = s->mb_x - 1 + s->mb_y * s->mb_stride;
/* left prediction */
ac_val -= 16;
if (s->mb_x == 0 || s->qscale == qscale_table[xy] ||
n == 1 || n == 3) {
/* same qscale */
for (i = 1; i < 8; i++)
block[s->idsp.idct_permutation[i << 3]] += ac_val[i];
} else {
/* different qscale, we must rescale */
for (i = 1; i < 8; i++)
block[s->idsp.idct_permutation[i << 3]] += ROUNDED_DIV(ac_val[i] * qscale_table[xy], s->qscale);
}
} else {
const int xy = s->mb_x + s->mb_y * s->mb_stride - s->mb_stride;
/* top prediction */
ac_val -= 16 * s->block_wrap[n];
if (s->mb_y == 0 || s->qscale == qscale_table[xy] ||
n == 2 || n == 3) {
/* same qscale */
for (i = 1; i < 8; i++)
block[s->idsp.idct_permutation[i]] += ac_val[i + 8];
} else {
/* different qscale, we must rescale */
for (i = 1; i < 8; i++)
block[s->idsp.idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8] * qscale_table[xy], s->qscale);
}
}
}
/* left copy */
for (i = 1; i < 8; i++)
ac_val1[i] = block[s->idsp.idct_permutation[i << 3]];
/* top copy */
for (i = 1; i < 8; i++)
ac_val1[8 + i] = block[s->idsp.idct_permutation[i]];
}
| 15,397 |
144,512 | 0 | std::vector<RenderFrameHost*> WebContentsImpl::GetAllFrames() {
std::vector<RenderFrameHost*> frame_hosts;
for (FrameTreeNode* node : frame_tree_.Nodes())
frame_hosts.push_back(node->current_frame_host());
return frame_hosts;
}
| 15,398 |
102,677 | 0 | TextureManager* CCLayerTreeHost::contentsTextureManager() const
{
return m_contentsTextureManager.get();
}
| 15,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.