unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
29,701 | 0 | void *av_malloc(size_t size)
{
void *ptr = NULL;
#if CONFIG_MEMALIGN_HACK
long diff;
#endif
/* let's disallow possible ambiguous cases */
if (size > (max_alloc_size - 32))
return NULL;
#if CONFIG_MEMALIGN_HACK
ptr = malloc(size + ALIGN);
if (!ptr)
return ptr;
diff = ((~(long)ptr)&(ALIGN - 1)) + 1;
ptr = (char *)ptr + diff;
((char *)ptr)[-1] = diff;
#elif HAVE_POSIX_MEMALIGN
if (size) //OS X on SDK 10.6 has a broken posix_memalign implementation
if (posix_memalign(&ptr, ALIGN, size))
ptr = NULL;
#elif HAVE_ALIGNED_MALLOC
ptr = _aligned_malloc(size, ALIGN);
#elif HAVE_MEMALIGN
#ifndef __DJGPP__
ptr = memalign(ALIGN, size);
#else
ptr = memalign(size, ALIGN);
#endif
/* Why 64?
* Indeed, we should align it:
* on 4 for 386
* on 16 for 486
* on 32 for 586, PPro - K6-III
* on 64 for K7 (maybe for P3 too).
* Because L1 and L2 caches are aligned on those values.
* But I don't want to code such logic here!
*/
/* Why 32?
* For AVX ASM. SSE / NEON needs only 16.
* Why not larger? Because I did not see a difference in benchmarks ...
*/
/* benchmarks with P3
* memalign(64) + 1 3071, 3051, 3032
* memalign(64) + 2 3051, 3032, 3041
* memalign(64) + 4 2911, 2896, 2915
* memalign(64) + 8 2545, 2554, 2550
* memalign(64) + 16 2543, 2572, 2563
* memalign(64) + 32 2546, 2545, 2571
* memalign(64) + 64 2570, 2533, 2558
*
* BTW, malloc seems to do 8-byte alignment by default here.
*/
#else
ptr = malloc(size);
#endif
if(!ptr && !size) {
size = 1;
ptr= av_malloc(1);
}
#if CONFIG_MEMORY_POISONING
if (ptr)
memset(ptr, FF_MEMORY_POISON, size);
#endif
return ptr;
}
| 15,100 |
37,839 | 0 | static void svm_disable_lbrv(struct vcpu_svm *svm)
{
u32 *msrpm = svm->msrpm;
svm->vmcb->control.lbr_ctl = 0;
set_msr_interception(msrpm, MSR_IA32_LASTBRANCHFROMIP, 0, 0);
set_msr_interception(msrpm, MSR_IA32_LASTBRANCHTOIP, 0, 0);
set_msr_interception(msrpm, MSR_IA32_LASTINTFROMIP, 0, 0);
set_msr_interception(msrpm, MSR_IA32_LASTINTTOIP, 0, 0);
}
| 15,101 |
187,747 | 1 | BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha)
{
png_struct *png_ptr = NULL;
png_info *info_ptr = NULL;
png_byte *png_pixels = NULL;
png_byte **row_pointers = NULL;
png_byte *pix_ptr = NULL;
png_uint_32 row_bytes;
char type_token[16];
char width_token[16];
char height_token[16];
char maxval_token[16];
int color_type;
unsigned long ul_width=0, ul_alpha_width=0;
unsigned long ul_height=0, ul_alpha_height=0;
unsigned long ul_maxval=0;
png_uint_32 width, alpha_width;
png_uint_32 height, alpha_height;
png_uint_32 maxval;
int bit_depth = 0;
int channels;
int alpha_depth = 0;
int alpha_present;
int row, col;
BOOL raw, alpha_raw = FALSE;
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
BOOL packed_bitmap = FALSE;
#endif
png_uint_32 tmp16;
int i;
/* read header of PNM file */
get_token(pnm_file, type_token);
if (type_token[0] != 'P')
{
return FALSE;
}
else if ((type_token[1] == '1') || (type_token[1] == '4'))
{
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
raw = (type_token[1] == '4');
color_type = PNG_COLOR_TYPE_GRAY;
get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
bit_depth = 1;
packed_bitmap = TRUE;
#else
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and \n");
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
#endif
}
else if ((type_token[1] == '2') || (type_token[1] == '5'))
{
raw = (type_token[1] == '5');
color_type = PNG_COLOR_TYPE_GRAY;
get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
get_token(pnm_file, maxval_token);
sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1)
bit_depth = 1;
else if (maxval <= 3)
bit_depth = 2;
else if (maxval <= 15)
bit_depth = 4;
else if (maxval <= 255)
bit_depth = 8;
else /* if (maxval <= 65535) */
bit_depth = 16;
}
else if ((type_token[1] == '3') || (type_token[1] == '6'))
{
raw = (type_token[1] == '6');
color_type = PNG_COLOR_TYPE_RGB;
get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
get_token(pnm_file, maxval_token);
sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1)
bit_depth = 1;
else if (maxval <= 3)
bit_depth = 2;
else if (maxval <= 15)
bit_depth = 4;
else if (maxval <= 255)
bit_depth = 8;
else /* if (maxval <= 65535) */
bit_depth = 16;
}
else
{
return FALSE;
}
/* read header of PGM file with alpha channel */
if (alpha)
{
if (color_type == PNG_COLOR_TYPE_GRAY)
color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
if (color_type == PNG_COLOR_TYPE_RGB)
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
get_token(alpha_file, type_token);
if (type_token[0] != 'P')
{
return FALSE;
}
else if ((type_token[1] == '2') || (type_token[1] == '5'))
{
alpha_raw = (type_token[1] == '5');
get_token(alpha_file, width_token);
sscanf (width_token, "%lu", &ul_alpha_width);
alpha_width=(png_uint_32) ul_alpha_width;
if (alpha_width != width)
return FALSE;
get_token(alpha_file, height_token);
sscanf (height_token, "%lu", &ul_alpha_height);
alpha_height = (png_uint_32) ul_alpha_height;
if (alpha_height != height)
return FALSE;
get_token(alpha_file, maxval_token);
sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1)
alpha_depth = 1;
else if (maxval <= 3)
alpha_depth = 2;
else if (maxval <= 15)
alpha_depth = 4;
else if (maxval <= 255)
alpha_depth = 8;
else /* if (maxval <= 65535) */
alpha_depth = 16;
if (alpha_depth != bit_depth)
return FALSE;
}
else
{
return FALSE;
}
} /* end if alpha */
/* calculate the number of channels and store alpha-presence */
if (color_type == PNG_COLOR_TYPE_GRAY)
channels = 1;
else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
channels = 2;
else if (color_type == PNG_COLOR_TYPE_RGB)
channels = 3;
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
channels = 4;
else
channels = 0; /* should not happen *
alpha_present = (channels - 1) % 2;
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap)
/* row data is as many bytes as can fit width x channels x bit_depth */
row_bytes = (width * channels * bit_depth + 7) / 8;
else
#endif
/* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL)
return FALSE;
/* read data from PNM file */
pix_ptr = png_pixels;
for (row = 0; row < height; row++)
{
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap) {
for (i = 0; i < row_bytes; i++)
/* png supports this format natively so no conversion is needed */
*pix_ptr++ = get_data (pnm_file, 8);
} else
#endif
{
for (col = 0; col < width; col++)
{
for (i = 0; i < (channels - alpha_present); i++)
{
if (raw)
*pix_ptr++ = get_data (pnm_file, bit_depth);
else
if (bit_depth <= 8)
*pix_ptr++ = get_value (pnm_file, bit_depth);
else
{
tmp16 = get_value (pnm_file, bit_depth);
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
pix_ptr++;
*pix_ptr = (png_byte) (tmp16 & 0xFF);
pix_ptr++;
}
}
if (alpha) /* read alpha-channel from pgm file */
{
if (alpha_raw)
*pix_ptr++ = get_data (alpha_file, alpha_depth);
else
if (alpha_depth <= 8)
*pix_ptr++ = get_value (alpha_file, bit_depth);
else
{
tmp16 = get_value (alpha_file, bit_depth);
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
}
} /* if alpha */
} /* if packed_bitmap */
} /* end for col */
} /* end for row */
/* prepare the standard PNG structures */
png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr)
{
return FALSE;
}
info_ptr = png_create_info_struct (png_ptr);
if (!info_ptr)
{
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
return FALSE;
}
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap == TRUE)
{
png_set_packing (png_ptr);
png_set_invert_mono (png_ptr);
}
#endif
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
if (setjmp (png_jmpbuf(png_ptr)))
{
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
return FALSE;
}
/* initialize the png structure */
png_init_io (png_ptr, png_file);
/* we're going to write more or less the same PNG as the input file */
png_set_IHDR (png_ptr, info_ptr, width, height, bit_depth, color_type,
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
/* write the file header information */
png_write_info (png_ptr, info_ptr);
/* if needed we will allocate memory for an new array of row-pointers */
if (row_pointers == (unsigned char**) NULL)
{
if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL)
{
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
return FALSE;
}
}
/* set the individual row_pointers to point at the correct offsets */
for (i = 0; i < (height); i++)
row_pointers[i] = png_pixels + i * row_bytes;
/* write out the entire image data in one call */
png_write_image (png_ptr, row_pointers);
/* write the additional chuncks to the PNG file (not really needed) *
png_write_end (png_ptr, info_ptr);
/* clean up after the write, and free any memory allocated */
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
if (row_pointers != (unsigned char**) NULL)
free (row_pointers);
if (png_pixels != (unsigned char*) NULL)
free (png_pixels);
return TRUE;
} /* end of pnm2png */
| 15,102 |
125,563 | 0 | bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
bool* message_was_ok) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(RenderMessageFilter, message, *message_was_ok)
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(ViewHostMsg_PreCacheFontCharacters,
OnPreCacheFontCharacters)
#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_GenerateRoutingID, OnGenerateRoutingID)
IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWindow, OnCreateWindow)
IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnCreateWidget)
IPC_MESSAGE_HANDLER(ViewHostMsg_CreateFullscreenWidget,
OnCreateFullscreenWidget)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCookie, OnSetCookie)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetCookies, OnGetCookies)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetRawCookies, OnGetRawCookies)
IPC_MESSAGE_HANDLER(ViewHostMsg_DeleteCookie, OnDeleteCookie)
IPC_MESSAGE_HANDLER(ViewHostMsg_CookiesEnabled, OnCookiesEnabled)
#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_LoadFont, OnLoadFont)
#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_DownloadUrl, OnDownloadUrl)
#if defined(ENABLE_PLUGINS)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetPlugins, OnGetPlugins)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetPluginInfo, OnGetPluginInfo)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenChannelToPlugin,
OnOpenChannelToPlugin)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_OpenChannelToPepperPlugin,
OnOpenChannelToPepperPlugin)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateOutOfProcessPepperInstance,
OnDidCreateOutOfProcessPepperInstance)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidDeleteOutOfProcessPepperInstance,
OnDidDeleteOutOfProcessPepperInstance)
IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToPpapiBroker,
OnOpenChannelToPpapiBroker)
#endif
IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_UpdateRect,
render_widget_helper_->DidReceiveBackingStoreMsg(message))
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed)
IPC_MESSAGE_HANDLER(DesktopNotificationHostMsg_CheckPermission,
OnCheckNotificationPermission)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory,
OnAllocateSharedMemory)
#if defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, OnAllocTransportDIB)
IPC_MESSAGE_HANDLER(ViewHostMsg_FreeTransportDIB, OnFreeTransportDIB)
#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_DidGenerateCacheableMetadata,
OnCacheableMetadataAvailable)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_Keygen, OnKeygen)
IPC_MESSAGE_HANDLER(ViewHostMsg_AsyncOpenFile, OnAsyncOpenFile)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetCPUUsage, OnGetCPUUsage)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareBufferSize,
OnGetHardwareBufferSize)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputSampleRate,
OnGetHardwareInputSampleRate)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate,
OnGetHardwareSampleRate)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputChannelLayout,
OnGetHardwareInputChannelLayout)
IPC_MESSAGE_HANDLER(ViewHostMsg_GetMonitorColorProfile,
OnGetMonitorColorProfile)
IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvent, OnMediaLogEvent)
IPC_MESSAGE_HANDLER(ViewHostMsg_Are3DAPIsBlocked, OnAre3DAPIsBlocked)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidLose3DContext, OnDidLose3DContext)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
return handled;
}
| 15,103 |
121,183 | 0 | static inline bool isRFC2616TokenCharacter(UChar ch)
{
return isASCII(ch) && ch > ' ' && ch != '"' && ch != '(' && ch != ')' && ch != ',' && ch != '/' && (ch < ':' || ch > '@') && (ch < '[' || ch > ']') && ch != '{' && ch != '}' && ch != 0x7f;
}
| 15,104 |
128,124 | 0 | CastDetailedView::CastDetailedView(SystemTrayItem* owner,
CastConfigDelegate* cast_config_delegate,
user::LoginStatus login)
: TrayDetailsView(owner),
cast_config_delegate_(cast_config_delegate),
login_(login),
options_(nullptr) {
CreateItems();
UpdateReceiverList();
}
| 15,105 |
173,810 | 0 | SoftG711::~SoftG711() {
}
| 15,106 |
23,332 | 0 | static int decode_sessionid(struct xdr_stream *xdr, struct nfs4_sessionid *sid)
{
return decode_opaque_fixed(xdr, sid->data, NFS4_MAX_SESSIONID_LEN);
}
| 15,107 |
179,160 | 1 | static inline int ip6_ufo_append_data(struct sock *sk,
int getfrag(void *from, char *to, int offset, int len,
int odd, struct sk_buff *skb),
void *from, int length, int hh_len, int fragheaderlen,
int transhdrlen, int mtu,unsigned int flags,
struct rt6_info *rt)
{
struct sk_buff *skb;
int err;
/* There is support for UDP large send offload by network
* device, so create one single skb packet containing complete
* udp datagram
*/
if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) {
skb = sock_alloc_send_skb(sk,
hh_len + fragheaderlen + transhdrlen + 20,
(flags & MSG_DONTWAIT), &err);
if (skb == NULL)
return err;
/* reserve space for Hardware header */
skb_reserve(skb, hh_len);
/* create space for UDP/IP header */
skb_put(skb,fragheaderlen + transhdrlen);
/* initialize network header pointer */
skb_reset_network_header(skb);
/* initialize protocol header pointer */
skb->transport_header = skb->network_header + fragheaderlen;
skb->protocol = htons(ETH_P_IPV6);
skb->ip_summed = CHECKSUM_PARTIAL;
skb->csum = 0;
}
err = skb_append_datato_frags(sk,skb, getfrag, from,
(length - transhdrlen));
if (!err) {
struct frag_hdr fhdr;
/* Specify the length of each IPv6 datagram fragment.
* It has to be a multiple of 8.
*/
skb_shinfo(skb)->gso_size = (mtu - fragheaderlen -
sizeof(struct frag_hdr)) & ~7;
skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
ipv6_select_ident(&fhdr, rt);
skb_shinfo(skb)->ip6_frag_id = fhdr.identification;
__skb_queue_tail(&sk->sk_write_queue, skb);
return 0;
}
/* There is not enough support do UPD LSO,
* so follow normal path
*
kfree_skb(skb);
return err;
}
| 15,108 |
129,034 | 0 | void writeNumber(double number)
{
append(NumberTag);
doWriteNumber(number);
}
| 15,109 |
113,325 | 0 | media::StatisticsCB NewStatisticsCB() {
return base::Bind(&media::MockStatisticsCB::OnStatistics,
base::Unretained(&statistics_cb_object_));
}
| 15,110 |
58,660 | 0 | BOOL security_fips_encrypt(BYTE* data, int length, rdpRdp* rdp)
{
crypto_des3_encrypt(rdp->fips_encrypt, length, data, data);
rdp->encrypt_use_count++;
return TRUE;
}
| 15,111 |
58,161 | 0 | void hrtick_start(struct rq *rq, u64 delay)
{
struct hrtimer *timer = &rq->hrtick_timer;
ktime_t time = ktime_add_ns(timer->base->get_time(), delay);
hrtimer_set_expires(timer, time);
if (rq == this_rq()) {
__hrtick_restart(rq);
} else if (!rq->hrtick_csd_pending) {
__smp_call_function_single(cpu_of(rq), &rq->hrtick_csd, 0);
rq->hrtick_csd_pending = 1;
}
}
| 15,112 |
167,523 | 0 | void WebMediaPlayerImpl::MaybeSendOverlayInfoToDecoder() {
if (!provide_overlay_info_cb_)
return;
if (overlay_mode_ == OverlayMode::kUseAndroidOverlay) {
if (overlay_routing_token_is_pending_)
return;
overlay_info_.routing_token = overlay_routing_token_;
}
if (decoder_requires_restart_for_overlay_) {
base::ResetAndReturn(&provide_overlay_info_cb_).Run(overlay_info_);
} else {
provide_overlay_info_cb_.Run(overlay_info_);
}
}
| 15,113 |
55,487 | 0 | static void build_group_mask(struct sched_domain *sd, struct sched_group *sg)
{
const struct cpumask *span = sched_domain_span(sd);
struct sd_data *sdd = sd->private;
struct sched_domain *sibling;
int i;
for_each_cpu(i, span) {
sibling = *per_cpu_ptr(sdd->sd, i);
if (!cpumask_test_cpu(i, sched_domain_span(sibling)))
continue;
cpumask_set_cpu(i, sched_group_mask(sg));
}
}
| 15,114 |
88,895 | 0 | static inline MagickBooleanType IsPathWritable(const char *path)
{
if (IsPathAccessible(path) == MagickFalse)
return(MagickFalse);
if (access_utf8(path,W_OK) != 0)
return(MagickFalse);
return(MagickTrue);
}
| 15,115 |
4,230 | 0 | XFreeFontPath (char **list)
{
if (list != NULL) {
Xfree (list[0]-1);
Xfree (list);
}
return 1;
}
| 15,116 |
7,177 | 0 | static unsigned char constant_time_eq_8(unsigned char a, unsigned char b)
{
unsigned c = a ^ b;
c--;
return DUPLICATE_MSB_TO_ALL_8(c);
}
| 15,117 |
15,868 | 0 | static void work_around_broken_dhclient(struct virtio_net_hdr *hdr,
uint8_t *buf, size_t size)
{
if ((hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && /* missing csum */
(size > 27 && size < 1500) && /* normal sized MTU */
(buf[12] == 0x08 && buf[13] == 0x00) && /* ethertype == IPv4 */
(buf[23] == 17) && /* ip.protocol == UDP */
(buf[34] == 0 && buf[35] == 67)) { /* udp.srcport == bootps */
net_checksum_calculate(buf, size);
hdr->flags &= ~VIRTIO_NET_HDR_F_NEEDS_CSUM;
}
}
| 15,118 |
77,671 | 0 | ofputil_pull_bands(struct ofpbuf *msg, size_t len, uint16_t *n_bands,
struct ofpbuf *bands)
{
const struct ofp13_meter_band_header *ombh;
struct ofputil_meter_band *mb;
uint16_t n = 0;
ombh = ofpbuf_try_pull(msg, len);
if (!ombh) {
return OFPERR_OFPBRC_BAD_LEN;
}
while (len >= sizeof (struct ofp13_meter_band_drop)) {
size_t ombh_len = ntohs(ombh->len);
/* All supported band types have the same length. */
if (ombh_len != sizeof (struct ofp13_meter_band_drop)) {
return OFPERR_OFPBRC_BAD_LEN;
}
mb = ofpbuf_put_uninit(bands, sizeof *mb);
mb->type = ntohs(ombh->type);
if (mb->type != OFPMBT13_DROP && mb->type != OFPMBT13_DSCP_REMARK) {
return OFPERR_OFPMMFC_BAD_BAND;
}
mb->rate = ntohl(ombh->rate);
mb->burst_size = ntohl(ombh->burst_size);
mb->prec_level = (mb->type == OFPMBT13_DSCP_REMARK) ?
((struct ofp13_meter_band_dscp_remark *)ombh)->prec_level : 0;
n++;
len -= ombh_len;
ombh = ALIGNED_CAST(struct ofp13_meter_band_header *,
(char *) ombh + ombh_len);
}
if (len) {
return OFPERR_OFPBRC_BAD_LEN;
}
*n_bands = n;
return 0;
}
| 15,119 |
166,905 | 0 | void Performance::clearMarks(const String& mark_name) {
if (!user_timing_)
user_timing_ = UserTiming::Create(*this);
user_timing_->ClearMarks(mark_name);
}
| 15,120 |
54,009 | 0 | static int ims_pcu_get_info(struct ims_pcu *pcu)
{
int error;
error = ims_pcu_execute_query(pcu, GET_INFO);
if (error) {
dev_err(pcu->dev,
"GET_INFO command failed, error: %d\n", error);
return error;
}
memcpy(pcu->part_number,
&pcu->cmd_buf[IMS_PCU_INFO_PART_OFFSET],
sizeof(pcu->part_number));
memcpy(pcu->date_of_manufacturing,
&pcu->cmd_buf[IMS_PCU_INFO_DOM_OFFSET],
sizeof(pcu->date_of_manufacturing));
memcpy(pcu->serial_number,
&pcu->cmd_buf[IMS_PCU_INFO_SERIAL_OFFSET],
sizeof(pcu->serial_number));
return 0;
}
| 15,121 |
168,798 | 0 | void WebContentsImpl::RendererUnresponsive(
RenderWidgetHostImpl* render_widget_host) {
for (auto& observer : observers_)
observer.OnRendererUnresponsive(render_widget_host->GetProcess());
if (ShouldIgnoreUnresponsiveRenderer())
return;
if (!render_widget_host->renderer_initialized())
return;
if (delegate_)
delegate_->RendererUnresponsive(this, render_widget_host);
}
| 15,122 |
158,565 | 0 | WebString WebLocalFrameImpl::Prompt(const WebString& message,
const WebString& default_value) {
DCHECK(GetFrame());
ScriptState* script_state = ToScriptStateForMainWorld(GetFrame());
DCHECK(script_state);
return GetFrame()->DomWindow()->prompt(script_state, message, default_value);
}
| 15,123 |
143,259 | 0 | void Document::setBody(HTMLElement* prpNewBody, ExceptionState& exceptionState)
{
HTMLElement* newBody = prpNewBody;
if (!newBody) {
exceptionState.throwDOMException(HierarchyRequestError, ExceptionMessages::argumentNullOrIncorrectType(1, "HTMLElement"));
return;
}
if (!documentElement()) {
exceptionState.throwDOMException(HierarchyRequestError, "No document element exists.");
return;
}
if (!isHTMLBodyElement(*newBody) && !isHTMLFrameSetElement(*newBody)) {
exceptionState.throwDOMException(HierarchyRequestError, "The new body element is of type '" + newBody->tagName() + "'. It must be either a 'BODY' or 'FRAMESET' element.");
return;
}
HTMLElement* oldBody = body();
if (oldBody == newBody)
return;
if (oldBody)
documentElement()->replaceChild(newBody, oldBody, exceptionState);
else
documentElement()->appendChild(newBody, exceptionState);
}
| 15,124 |
97,036 | 0 | void ip_rt_send_redirect(struct sk_buff *skb)
{
struct rtable *rt = skb_rtable(skb);
struct in_device *in_dev;
struct inet_peer *peer;
struct net *net;
int log_martians;
rcu_read_lock();
in_dev = __in_dev_get_rcu(rt->dst.dev);
if (!in_dev || !IN_DEV_TX_REDIRECTS(in_dev)) {
rcu_read_unlock();
return;
}
log_martians = IN_DEV_LOG_MARTIANS(in_dev);
rcu_read_unlock();
net = dev_net(rt->dst.dev);
peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, 1);
if (!peer) {
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST,
rt_nexthop(rt, ip_hdr(skb)->daddr));
return;
}
/* No redirected packets during ip_rt_redirect_silence;
* reset the algorithm.
*/
if (time_after(jiffies, peer->rate_last + ip_rt_redirect_silence)) {
peer->rate_tokens = 0;
peer->n_redirects = 0;
}
/* Too many ignored redirects; do not send anything
* set dst.rate_last to the last seen redirected packet.
*/
if (peer->n_redirects >= ip_rt_redirect_number) {
peer->rate_last = jiffies;
goto out_put_peer;
}
/* Check for load limit; set rate_last to the latest sent
* redirect.
*/
if (peer->rate_tokens == 0 ||
time_after(jiffies,
(peer->rate_last +
(ip_rt_redirect_load << peer->rate_tokens)))) {
__be32 gw = rt_nexthop(rt, ip_hdr(skb)->daddr);
icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, gw);
peer->rate_last = jiffies;
++peer->rate_tokens;
++peer->n_redirects;
#ifdef CONFIG_IP_ROUTE_VERBOSE
if (log_martians &&
peer->rate_tokens == ip_rt_redirect_number)
net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
&ip_hdr(skb)->saddr, inet_iif(skb),
&ip_hdr(skb)->daddr, &gw);
#endif
}
out_put_peer:
inet_putpeer(peer);
}
| 15,125 |
118,918 | 0 | gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const {
if (delegate_)
return delegate_->GetRootWindowResizerRect();
return gfx::Rect();
}
| 15,126 |
86,790 | 0 | _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
{
return (0);
}
| 15,127 |
161,428 | 0 | Response ServiceWorkerHandler::Unregister(const std::string& scope_url) {
if (!enabled_)
return CreateDomainNotEnabledErrorResponse();
if (!context_)
return CreateContextErrorResponse();
context_->UnregisterServiceWorker(GURL(scope_url), base::Bind(&ResultNoOp));
return Response::OK();
}
| 15,128 |
179,176 | 1 | static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
AVFilterContext *ctx = inlink->dst;
LutContext *s = ctx->priv;
AVFilterLink *outlink = ctx->outputs[0];
AVFrame *out;
uint8_t *inrow, *outrow, *inrow0, *outrow0;
int i, j, plane, direct = 0;
if (av_frame_is_writable(in)) {
direct = 1;
out = in;
} else {
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
av_frame_free(&in);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out, in);
}
if (s->is_rgb) {
/* packed */
inrow0 = in ->data[0];
outrow0 = out->data[0];
for (i = 0; i < in->height; i ++) {
int w = inlink->w;
const uint8_t (*tab)[256] = (const uint8_t (*)[256])s->lut;
inrow = inrow0;
outrow = outrow0;
for (j = 0; j < w; j++) {
switch (s->step) {
case 4: outrow[3] = tab[3][inrow[3]]; // Fall-through
case 3: outrow[2] = tab[2][inrow[2]]; // Fall-through
case 2: outrow[1] = tab[1][inrow[1]]; // Fall-through
default: outrow[0] = tab[0][inrow[0]];
}
outrow += s->step;
inrow += s->step;
}
inrow0 += in ->linesize[0];
outrow0 += out->linesize[0];
}
} else {
/* planar */
for (plane = 0; plane < 4 && in->data[plane]; plane++) {
int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
int h = FF_CEIL_RSHIFT(inlink->h, vsub);
int w = FF_CEIL_RSHIFT(inlink->w, hsub);
inrow = in ->data[plane];
outrow = out->data[plane];
for (i = 0; i < h; i++) {
const uint8_t *tab = s->lut[plane];
for (j = 0; j < w; j++)
outrow[j] = tab[inrow[j]];
inrow += in ->linesize[plane];
outrow += out->linesize[plane];
}
}
}
if (!direct)
av_frame_free(&in);
return ff_filter_frame(outlink, out);
}
| 15,129 |
185,159 | 1 | void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle& newStyle)
{
RenderStyle* oldStyle = style();
setReplaced(newStyle.isDisplayInlineType());
if (oldStyle && parent() && diff == StyleDifferenceLayout && oldStyle->position() != newStyle.position()) {
if (newStyle.position() == StaticPosition)
// Clear our positioned objects list. Our absolutely positioned descendants will be
// inserted into our containing block's positioned objects list during layout.
removePositionedObjects(0, NewContainingBlock);
else if (oldStyle->position() == StaticPosition) {
// Remove our absolutely positioned descendants from their current containing block.
// They will be inserted into our positioned objects list during layout.
RenderObject* cb = parent();
while (cb && (cb->style()->position() == StaticPosition || (cb->isInline() && !cb->isReplaced())) && !cb->isRenderView()) {
if (cb->style()->position() == RelativePosition && cb->isInline() && !cb->isReplaced()) {
cb = cb->containingBlock();
break;
}
cb = cb->parent();
}
if (cb->isRenderBlock())
toRenderBlock(cb)->removePositionedObjects(this, NewContainingBlock);
}
}
RenderBox::styleWillChange(diff, newStyle);
}
| 15,130 |
45,429 | 0 | static int ecryptfs_process_flags(struct ecryptfs_crypt_stat *crypt_stat,
char *page_virt, int *bytes_read)
{
int rc = 0;
int i;
u32 flags;
flags = get_unaligned_be32(page_virt);
for (i = 0; i < ((sizeof(ecryptfs_flag_map)
/ sizeof(struct ecryptfs_flag_map_elem))); i++)
if (flags & ecryptfs_flag_map[i].file_flag) {
crypt_stat->flags |= ecryptfs_flag_map[i].local_flag;
} else
crypt_stat->flags &= ~(ecryptfs_flag_map[i].local_flag);
/* Version is in top 8 bits of the 32-bit flag vector */
crypt_stat->file_version = ((flags >> 24) & 0xFF);
(*bytes_read) = 4;
return rc;
}
| 15,131 |
22,554 | 0 | static __init int sched_init_debug(void)
{
debugfs_create_file("sched_features", 0644, NULL, NULL,
&sched_feat_fops);
return 0;
}
| 15,132 |
127,272 | 0 | static bool isCharsetSpecifyingNode(Node* node)
{
if (!node->isHTMLElement())
return false;
HTMLElement* element = toHTMLElement(node);
if (!element->hasTagName(HTMLNames::metaTag))
return false;
HTMLMetaCharsetParser::AttributeList attributes;
if (element->hasAttributes()) {
for (unsigned i = 0; i < element->attributeCount(); ++i) {
const Attribute* attribute = element->attributeItem(i);
attributes.append(std::make_pair(attribute->name().toString(), attribute->value().string()));
}
}
WTF::TextEncoding textEncoding = HTMLMetaCharsetParser::encodingFromMetaAttributes(attributes);
return textEncoding.isValid();
}
| 15,133 |
82,872 | 0 | static char *_time_stamp_to_str(ut32 timeStamp) {
#ifdef _MSC_VER
time_t rawtime;
struct tm *tminfo;
rawtime = (time_t)timeStamp;
tminfo = localtime (&rawtime);
return r_str_trim (strdup (asctime (tminfo)));
#else
struct my_timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of DST correction */
} tz;
struct timeval tv;
int gmtoff;
time_t ts = (time_t) timeStamp;
gettimeofday (&tv, (void*) &tz);
gmtoff = (int) (tz.tz_minuteswest * 60); // in seconds
ts += (time_t)gmtoff;
return r_str_trim (strdup (ctime (&ts)));
#endif
}
| 15,134 |
118,672 | 0 | Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) {
Browser* browser = new Browser(
Browser::CreateParams(profile, chrome::GetActiveDesktop()));
AddBlankTabAndShow(browser);
return browser;
}
| 15,135 |
99,199 | 0 | void V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object> object, int type, void* cptr)
{
ASSERT(object->InternalFieldCount() >= 2);
object->SetPointerInInternalField(V8Custom::kDOMWrapperObjectIndex, cptr);
object->SetInternalField(V8Custom::kDOMWrapperTypeIndex, v8::Integer::New(type));
}
| 15,136 |
109,525 | 0 | void PrintWebViewHelper::OnPrintForSystemDialog() {
WebKit::WebFrame* frame = print_preview_context_.frame();
if (!frame) {
NOTREACHED();
return;
}
Print(frame, print_preview_context_.node());
}
| 15,137 |
140,045 | 0 | WebLayer* HTMLMediaElement::platformLayer() const {
return m_webLayer;
}
| 15,138 |
91,972 | 0 | int __init blk_dev_init(void)
{
BUILD_BUG_ON(REQ_OP_LAST >= (1 << REQ_OP_BITS));
BUILD_BUG_ON(REQ_OP_BITS + REQ_FLAG_BITS > 8 *
FIELD_SIZEOF(struct request, cmd_flags));
BUILD_BUG_ON(REQ_OP_BITS + REQ_FLAG_BITS > 8 *
FIELD_SIZEOF(struct bio, bi_opf));
/* used for unplugging and affects IO latency/throughput - HIGHPRI */
kblockd_workqueue = alloc_workqueue("kblockd",
WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
if (!kblockd_workqueue)
panic("Failed to create kblockd\n");
request_cachep = kmem_cache_create("blkdev_requests",
sizeof(struct request), 0, SLAB_PANIC, NULL);
blk_requestq_cachep = kmem_cache_create("request_queue",
sizeof(struct request_queue), 0, SLAB_PANIC, NULL);
#ifdef CONFIG_DEBUG_FS
blk_debugfs_root = debugfs_create_dir("block", NULL);
#endif
return 0;
}
| 15,139 |
104,498 | 0 | CrosMock::CrosMock()
: loader_(NULL),
mock_cryptohome_library_(NULL),
mock_network_library_(NULL),
mock_power_library_(NULL),
mock_screen_lock_library_(NULL),
mock_speech_synthesis_library_(NULL),
mock_touchpad_library_(NULL) {
}
| 15,140 |
63,015 | 0 | static bool page_address_valid(struct kvm_vcpu *vcpu, gpa_t gpa)
{
return PAGE_ALIGNED(gpa) && !(gpa >> cpuid_maxphyaddr(vcpu));
}
| 15,141 |
8,500 | 0 | DWORD CSoundFile::TransposeToFrequency(int transp, int ftune)
{
return (DWORD)(8363*pow(2.0, (transp*128+ftune)/(1536)));
#ifdef MSC_VER
const float _fbase = 8363;
const float _factor = 1.0f/(12.0f*128.0f);
int result;
DWORD freq;
transp = (transp << 7) + ftune;
_asm {
fild transp
fld _factor
fmulp st(1), st(0)
fist result
fisub result
f2xm1
fild result
fld _fbase
fscale
fstp st(1)
fmul st(1), st(0)
faddp st(1), st(0)
fistp freq
}
UINT derr = freq % 11025;
if (derr <= 8) freq -= derr;
if (derr >= 11015) freq += 11025-derr;
derr = freq % 1000;
if (derr <= 5) freq -= derr;
if (derr >= 995) freq += 1000-derr;
return freq;
#endif
}
| 15,142 |
161,100 | 0 | void MediaStreamManager::CancelRequest(int render_process_id,
int render_frame_id,
int page_request_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
for (const LabeledDeviceRequest& labeled_request : requests_) {
DeviceRequest* const request = labeled_request.second;
if (request->requesting_process_id == render_process_id &&
request->requesting_frame_id == render_frame_id &&
request->page_request_id == page_request_id) {
CancelRequest(labeled_request.first);
return;
}
}
NOTREACHED();
}
| 15,143 |
142,380 | 0 | base::FilePath GetDriveDataDirectory() {
return profile()->GetPath().Append("drive/v1");
}
| 15,144 |
15,560 | 0 | check_follow_cname(char **namep, const char *cname)
{
int i;
struct allowed_cname *rule;
if (*cname == '\0' || options.num_permitted_cnames == 0 ||
strcmp(*namep, cname) == 0)
return 0;
if (options.canonicalize_hostname == SSH_CANONICALISE_NO)
return 0;
/*
* Don't attempt to canonicalize names that will be interpreted by
* a proxy unless the user specifically requests so.
*/
if (!option_clear_or_none(options.proxy_command) &&
options.canonicalize_hostname != SSH_CANONICALISE_ALWAYS)
return 0;
debug3("%s: check \"%s\" CNAME \"%s\"", __func__, *namep, cname);
for (i = 0; i < options.num_permitted_cnames; i++) {
rule = options.permitted_cnames + i;
if (match_pattern_list(*namep, rule->source_list, 1) != 1 ||
match_pattern_list(cname, rule->target_list, 1) != 1)
continue;
verbose("Canonicalized DNS aliased hostname "
"\"%s\" => \"%s\"", *namep, cname);
free(*namep);
*namep = xstrdup(cname);
return 1;
}
return 0;
}
| 15,145 |
1,663 | 0 | gs_pattern1_uses_base_space(const gs_pattern_template_t *ptemp)
{
return ((const gs_pattern1_template_t *)ptemp)->PaintType == 2;
}
| 15,146 |
106,360 | 0 | void SyncBackendHost::StartConfiguration(Callback0::Type* callback) {
core_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
core_.get(),&SyncBackendHost::Core::DoStartConfiguration, callback));
}
| 15,147 |
22,303 | 0 | static void __hrtick_start(void *arg)
{
struct rq *rq = arg;
raw_spin_lock(&rq->lock);
hrtimer_restart(&rq->hrtick_timer);
rq->hrtick_csd_pending = 0;
raw_spin_unlock(&rq->lock);
}
| 15,148 |
184,077 | 1 | WebInputEvent* CreateWebInputEvent(const PP_InputEvent& event) {
scoped_ptr<WebInputEvent> web_input_event;
switch (event.type) {
case PP_INPUTEVENT_TYPE_UNDEFINED:
return NULL;
case PP_INPUTEVENT_TYPE_MOUSEDOWN:
case PP_INPUTEVENT_TYPE_MOUSEUP:
case PP_INPUTEVENT_TYPE_MOUSEMOVE:
case PP_INPUTEVENT_TYPE_MOUSEENTER:
case PP_INPUTEVENT_TYPE_MOUSELEAVE:
web_input_event.reset(BuildMouseEvent(event));
break;
case PP_INPUTEVENT_TYPE_MOUSEWHEEL:
web_input_event.reset(BuildMouseWheelEvent(event));
break;
case PP_INPUTEVENT_TYPE_RAWKEYDOWN:
case PP_INPUTEVENT_TYPE_KEYDOWN:
case PP_INPUTEVENT_TYPE_KEYUP:
web_input_event.reset(BuildKeyEvent(event));
break;
case PP_INPUTEVENT_TYPE_CHAR:
web_input_event.reset(BuildCharEvent(event));
break;
}
return web_input_event.release();
}
| 15,149 |
108,430 | 0 | void ChromeRenderMessageFilter::OnFPS(int routing_id, float fps) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(
&ChromeRenderMessageFilter::OnFPS, this,
routing_id, fps));
return;
}
base::ProcessId renderer_id = base::GetProcId(peer_handle());
#if defined(ENABLE_TASK_MANAGER)
TaskManager::GetInstance()->model()->NotifyFPS(
renderer_id, routing_id, fps);
#endif // defined(ENABLE_TASK_MANAGER)
FPSDetails details(routing_id, fps);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_RENDERER_FPS_COMPUTED,
content::Source<const base::ProcessId>(&renderer_id),
content::Details<const FPSDetails>(&details));
}
| 15,150 |
170,932 | 0 | void vp9_free_postproc_buffers(VP9_COMMON *cm) {
#if CONFIG_VP9_POSTPROC
vpx_free_frame_buffer(&cm->post_proc_buffer);
vpx_free_frame_buffer(&cm->post_proc_buffer_int);
#else
(void)cm;
#endif
}
| 15,151 |
118,892 | 0 | RenderWidgetHostView* WebContentsImpl::GetFullscreenRenderWidgetHostView()
const {
RenderWidgetHost* const widget_host =
RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(),
GetFullscreenWidgetRoutingID());
return widget_host ? widget_host->GetView() : NULL;
}
| 15,152 |
57,530 | 0 | int ext4_meta_trans_blocks(struct inode *inode, int nrblocks, int chunk)
{
ext4_group_t groups, ngroups = ext4_get_groups_count(inode->i_sb);
int gdpblocks;
int idxblocks;
int ret = 0;
/*
* How many index blocks need to touch to modify nrblocks?
* The "Chunk" flag indicating whether the nrblocks is
* physically contiguous on disk
*
* For Direct IO and fallocate, they calls get_block to allocate
* one single extent at a time, so they could set the "Chunk" flag
*/
idxblocks = ext4_index_trans_blocks(inode, nrblocks, chunk);
ret = idxblocks;
/*
* Now let's see how many group bitmaps and group descriptors need
* to account
*/
groups = idxblocks;
if (chunk)
groups += 1;
else
groups += nrblocks;
gdpblocks = groups;
if (groups > ngroups)
groups = ngroups;
if (groups > EXT4_SB(inode->i_sb)->s_gdb_count)
gdpblocks = EXT4_SB(inode->i_sb)->s_gdb_count;
/* bitmaps and block group descriptor blocks */
ret += groups + gdpblocks;
/* Blocks for super block, inode, quota and xattr blocks */
ret += EXT4_META_TRANS_BLOCKS(inode->i_sb);
return ret;
}
| 15,153 |
61,554 | 0 | static int nsv_read_header(AVFormatContext *s)
{
NSVContext *nsv = s->priv_data;
int i, err;
nsv->state = NSV_UNSYNC;
nsv->ahead[0].data = nsv->ahead[1].data = NULL;
for (i = 0; i < NSV_MAX_RESYNC_TRIES; i++) {
if (nsv_resync(s) < 0)
return -1;
if (nsv->state == NSV_FOUND_NSVF) {
err = nsv_parse_NSVf_header(s);
if (err < 0)
return err;
}
/* we need the first NSVs also... */
if (nsv->state == NSV_FOUND_NSVS) {
err = nsv_parse_NSVs_header(s);
if (err < 0)
return err;
break; /* we just want the first one */
}
}
if (s->nb_streams < 1) /* no luck so far */
return -1;
/* now read the first chunk, so we can attempt to decode more info */
err = nsv_read_chunk(s, 1);
av_log(s, AV_LOG_TRACE, "parsed header\n");
return err;
}
| 15,154 |
171,998 | 0 | void lbl_destroy()
{
pthread_mutex_destroy(&(device.lbllock));
}
| 15,155 |
20,214 | 0 | hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
unsigned long len, unsigned long pgoff, unsigned long flags)
{
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
unsigned long start_addr;
struct hstate *h = hstate_file(file);
if (len & ~huge_page_mask(h))
return -EINVAL;
if (len > TASK_SIZE)
return -ENOMEM;
if (flags & MAP_FIXED) {
if (prepare_hugepage_range(file, addr, len))
return -EINVAL;
return addr;
}
if (addr) {
addr = ALIGN(addr, huge_page_size(h));
vma = find_vma(mm, addr);
if (TASK_SIZE - len >= addr &&
(!vma || addr + len <= vma->vm_start))
return addr;
}
if (len > mm->cached_hole_size)
start_addr = mm->free_area_cache;
else {
start_addr = TASK_UNMAPPED_BASE;
mm->cached_hole_size = 0;
}
full_search:
addr = ALIGN(start_addr, huge_page_size(h));
for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
/* At this point: (!vma || addr < vma->vm_end). */
if (TASK_SIZE - len < addr) {
/*
* Start a new search - just in case we missed
* some holes.
*/
if (start_addr != TASK_UNMAPPED_BASE) {
start_addr = TASK_UNMAPPED_BASE;
mm->cached_hole_size = 0;
goto full_search;
}
return -ENOMEM;
}
if (!vma || addr + len <= vma->vm_start) {
mm->free_area_cache = addr + len;
return addr;
}
if (addr + mm->cached_hole_size < vma->vm_start)
mm->cached_hole_size = vma->vm_start - addr;
addr = ALIGN(vma->vm_end, huge_page_size(h));
}
}
| 15,156 |
152,405 | 0 | void RenderFrameImpl::MarkInitiatorAsRequiringSeparateURLLoaderFactory(
const url::Origin& initiator_origin,
network::mojom::URLLoaderFactoryPtr url_loader_factory) {
DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService));
GetLoaderFactoryBundle();
auto factory_bundle = std::make_unique<blink::URLLoaderFactoryBundleInfo>();
factory_bundle->initiator_specific_factory_infos()[initiator_origin] =
url_loader_factory.PassInterface();
UpdateSubresourceLoaderFactories(std::move(factory_bundle));
}
| 15,157 |
159,509 | 0 | void Pack<WebGLImageConversion::kDataFormatRGB16F,
WebGLImageConversion::kAlphaDoNothing,
float,
uint16_t>(const float* source,
uint16_t* destination,
unsigned pixels_per_row) {
for (unsigned i = 0; i < pixels_per_row; ++i) {
destination[0] = ConvertFloatToHalfFloat(source[0]);
destination[1] = ConvertFloatToHalfFloat(source[1]);
destination[2] = ConvertFloatToHalfFloat(source[2]);
source += 4;
destination += 3;
}
}
| 15,158 |
78,363 | 0 | static int entersafe_write_rsa_key_factor(sc_card_t *card,
u8 key_id,u8 usage,
u8 factor,
sc_pkcs15_bignum_t data)
{
int r;
sc_apdu_t apdu;
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
{/* MSE */
u8 sbuff[4];
sbuff[0]=0x84;
sbuff[1]=0x02;
sbuff[2]=key_id;
sbuff[3]=usage;
sc_format_apdu(card,&apdu,SC_APDU_CASE_3_SHORT,0x22,0x01,0xB8);
apdu.data=sbuff;
apdu.lc=apdu.datalen=4;
r=entersafe_transmit_apdu(card,&apdu,0,0,0,0);
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, sc_check_sw(card, apdu.sw1, apdu.sw2),"Write prkey factor failed(MSE)");
}
{/* Write 'x'; */
u8 sbuff[SC_MAX_APDU_BUFFER_SIZE];
sc_format_apdu(card,&apdu,SC_APDU_CASE_3_SHORT,0x46,factor,0x00);
memcpy(sbuff,data.data,data.len);
entersafe_reverse_buffer(sbuff,data.len);
/*
* PK01C and PK13C smart card only support 1024 or 2048bit key .
* Size of exponent1 exponent2 coefficient of RSA private key keep the same as size of prime1
* So check factor is padded with zero or not
*/
switch(factor){
case 0x3:
case 0x4:
case 0x5:
{
if( data.len > 32 && data.len < 64 )
{
for(r = data.len ; r < 64 ; r ++)
sbuff[r] = 0;
data.len = 64;
}
else if( data.len > 64 && data.len < 128 )
{
for(r = data.len ; r < 128 ; r ++)
sbuff[r] = 0;
data.len = 128;
}
}
break;
default:
break;
}
apdu.data=sbuff;
apdu.lc=apdu.datalen=data.len;
r = entersafe_transmit_apdu(card,&apdu,0,0,0,0);
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, sc_check_sw(card, apdu.sw1, apdu.sw2),"Write prkey factor failed");
}
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE,SC_SUCCESS);
}
| 15,159 |
53,214 | 0 | static int proc_bulk_compat(struct usb_dev_state *ps,
struct usbdevfs_bulktransfer32 __user *p32)
{
struct usbdevfs_bulktransfer __user *p;
compat_uint_t n;
compat_caddr_t addr;
p = compat_alloc_user_space(sizeof(*p));
if (get_user(n, &p32->ep) || put_user(n, &p->ep) ||
get_user(n, &p32->len) || put_user(n, &p->len) ||
get_user(n, &p32->timeout) || put_user(n, &p->timeout) ||
get_user(addr, &p32->data) || put_user(compat_ptr(addr), &p->data))
return -EFAULT;
return proc_bulk(ps, p);
}
| 15,160 |
87,637 | 0 | LIBOPENMPT_MODPLUG_API ModPlugNote* ModPlug_GetPattern(ModPlugFile* file, int pattern, unsigned int* numrows)
{
int c;
int r;
int numr;
int numc;
ModPlugNote note;
if(!file) return NULL;
if(numrows){
*numrows = openmpt_module_get_pattern_num_rows(file->mod,pattern);
}
if(pattern<0||pattern>=openmpt_module_get_num_patterns(file->mod)){
return NULL;
}
if(!file->patterns){
file->patterns = malloc(sizeof(ModPlugNote*)*openmpt_module_get_pattern_num_rows(file->mod,pattern));
if(!file->patterns) return NULL;
memset(file->patterns,0,sizeof(ModPlugNote*)*openmpt_module_get_pattern_num_rows(file->mod,pattern));
}
if(!file->patterns[pattern]){
file->patterns[pattern] = malloc(sizeof(ModPlugNote)*openmpt_module_get_pattern_num_rows(file->mod,pattern)*openmpt_module_get_num_channels(file->mod));
if(!file->patterns[pattern]) return NULL;
memset(file->patterns[pattern],0,sizeof(ModPlugNote)*openmpt_module_get_pattern_num_rows(file->mod,pattern)*openmpt_module_get_num_channels(file->mod));
}
numr = openmpt_module_get_pattern_num_rows(file->mod,pattern);
numc = openmpt_module_get_num_channels(file->mod);
for(r=0;r<numr;r++){
for(c=0;c<numc;c++){
memset(¬e,0,sizeof(ModPlugNote));
note.Note = openmpt_module_get_pattern_row_channel_command(file->mod,pattern,r,c,OPENMPT_MODULE_COMMAND_NOTE);
note.Instrument = openmpt_module_get_pattern_row_channel_command(file->mod,pattern,r,c,OPENMPT_MODULE_COMMAND_INSTRUMENT);
note.VolumeEffect = openmpt_module_get_pattern_row_channel_command(file->mod,pattern,r,c,OPENMPT_MODULE_COMMAND_VOLUMEEFFECT);
note.Effect = openmpt_module_get_pattern_row_channel_command(file->mod,pattern,r,c,OPENMPT_MODULE_COMMAND_EFFECT);
note.Volume = openmpt_module_get_pattern_row_channel_command(file->mod,pattern,r,c,OPENMPT_MODULE_COMMAND_VOLUME);
note.Parameter = openmpt_module_get_pattern_row_channel_command(file->mod,pattern,r,c,OPENMPT_MODULE_COMMAND_PARAMETER);
memcpy(&file->patterns[pattern][r*numc+c],¬e,sizeof(ModPlugNote));
}
}
return file->patterns[pattern];
}
| 15,161 |
180,601 | 1 | char *path_name(const struct name_path *path, const char *name)
{
const struct name_path *p;
char *n, *m;
int nlen = strlen(name);
int len = nlen + 1;
for (p = path; p; p = p->up) {
if (p->elem_len)
len += p->elem_len + 1;
}
n = xmalloc(len);
m = n + len - (nlen + 1);
strcpy(m, name);
for (p = path; p; p = p->up) {
if (p->elem_len) {
m -= p->elem_len + 1;
memcpy(m, p->elem, p->elem_len);
m[p->elem_len] = '/';
}
}
return n;
}
| 15,162 |
18,668 | 0 | int kernel_sock_shutdown(struct socket *sock, enum sock_shutdown_cmd how)
{
return sock->ops->shutdown(sock, how);
}
| 15,163 |
84,017 | 0 | GF_Err gf_isom_linf_write_entry(void *entry, GF_BitStream *bs)
{
GF_LHVCLayerInformation* ptr = (GF_LHVCLayerInformation *)entry;
u32 i, count;
if (!ptr) return GF_OK;
gf_bs_write_int(bs, 0, 2);
count=gf_list_count(ptr->num_layers_in_track);
gf_bs_write_int(bs, count, 6);
for (i = 0; i < count; i++) {
LHVCLayerInfoItem *li = (LHVCLayerInfoItem *)gf_list_get(ptr->num_layers_in_track, i);
gf_bs_write_int(bs, 0, 4);
gf_bs_write_int(bs, li->layer_id, 6);
gf_bs_write_int(bs, li->min_TemporalId, 3);
gf_bs_write_int(bs, li->max_TemporalId, 3);
gf_bs_write_int(bs, 0, 1);
gf_bs_write_int(bs, li->sub_layer_presence_flags, 7);
}
return GF_OK;
}
| 15,164 |
152,876 | 0 | ImageBitmap::ImageBitmap(HTMLVideoElement* video,
Optional<IntRect> cropRect,
Document* document,
const ImageBitmapOptions& options) {
IntSize playerSize;
if (video->webMediaPlayer())
playerSize = video->webMediaPlayer()->naturalSize();
ParsedOptions parsedOptions =
parseOptions(options, cropRect, video->bitmapSourceSize());
if (dstBufferSizeHasOverflow(parsedOptions))
return;
std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(
IntSize(parsedOptions.resizeWidth, parsedOptions.resizeHeight), NonOpaque,
DoNotInitializeImagePixels);
if (!buffer)
return;
IntPoint dstPoint =
IntPoint(-parsedOptions.cropRect.x(), -parsedOptions.cropRect.y());
if (parsedOptions.flipY) {
buffer->canvas()->translate(0, buffer->size().height());
buffer->canvas()->scale(1, -1);
}
SkPaint paint;
if (parsedOptions.shouldScaleInput) {
float scaleRatioX = static_cast<float>(parsedOptions.resizeWidth) /
parsedOptions.cropRect.width();
float scaleRatioY = static_cast<float>(parsedOptions.resizeHeight) /
parsedOptions.cropRect.height();
buffer->canvas()->scale(scaleRatioX, scaleRatioY);
paint.setFilterQuality(parsedOptions.resizeQuality);
}
buffer->canvas()->translate(dstPoint.x(), dstPoint.y());
video->paintCurrentFrame(
buffer->canvas(),
IntRect(IntPoint(), IntSize(video->videoWidth(), video->videoHeight())),
parsedOptions.shouldScaleInput ? &paint : nullptr);
sk_sp<SkImage> skiaImage =
buffer->newSkImageSnapshot(PreferNoAcceleration, SnapshotReasonUnknown);
if (!parsedOptions.premultiplyAlpha)
skiaImage = premulSkImageToUnPremul(skiaImage.get());
if (!skiaImage)
return;
m_image = StaticBitmapImage::create(std::move(skiaImage));
m_image->setOriginClean(
!video->wouldTaintOrigin(document->getSecurityOrigin()));
m_image->setPremultiplied(parsedOptions.premultiplyAlpha);
}
| 15,165 |
35,673 | 0 | getu64(int swap, uint64_t value)
{
union {
uint64_t ui;
char c[8];
} retval, tmpval;
if (swap) {
tmpval.ui = value;
retval.c[0] = tmpval.c[7];
retval.c[1] = tmpval.c[6];
retval.c[2] = tmpval.c[5];
retval.c[3] = tmpval.c[4];
retval.c[4] = tmpval.c[3];
retval.c[5] = tmpval.c[2];
retval.c[6] = tmpval.c[1];
retval.c[7] = tmpval.c[0];
return retval.ui;
} else
return value;
}
| 15,166 |
64,524 | 0 | MagickExport Image *NewMagickImage(const ImageInfo *image_info,
const size_t width,const size_t height,const MagickPixelPacket *background)
{
CacheView
*image_view;
ExceptionInfo
*exception;
Image
*image;
ssize_t
y;
MagickBooleanType
status;
assert(image_info != (const ImageInfo *) NULL);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image_info->signature == MagickSignature);
assert(background != (const MagickPixelPacket *) NULL);
image=AcquireImage(image_info);
image->columns=width;
image->rows=height;
image->colorspace=background->colorspace;
image->matte=background->matte;
image->fuzz=background->fuzz;
image->depth=background->depth;
status=MagickTrue;
exception=(&image->exception);
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,4) shared(status) \
magick_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
*magick_restrict indexes;
register PixelPacket
*magick_restrict q;
register ssize_t
x;
if (status == MagickFalse)
continue;
q=QueueCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(image_view);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelPacket(image,background,q,indexes+x);
q++;
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
}
image_view=DestroyCacheView(image_view);
if (status == MagickFalse)
image=DestroyImage(image);
return(image);
}
| 15,167 |
38,103 | 0 | static int whiteheat_port_remove(struct usb_serial_port *port)
{
struct whiteheat_private *info;
info = usb_get_serial_port_data(port);
kfree(info);
return 0;
}
| 15,168 |
176,306 | 0 | static bool HasEntryImpl(Isolate* isolate, FixedArrayBase* backing_store,
uint32_t entry) {
return !BackingStore::cast(backing_store)->is_the_hole(isolate, entry);
}
| 15,169 |
2,950 | 0 | pdf14_fill_path(gx_device *dev, const gs_gstate *pgs,
gx_path *ppath, const gx_fill_params *params,
const gx_drawing_color *pdcolor,
const gx_clip_path *pcpath)
{
gs_gstate new_pgs = *pgs;
int code;
gs_pattern2_instance_t *pinst = NULL;
if (pdcolor == NULL)
return_error(gs_error_unknownerror); /* color must be defined */
if (gx_dc_is_pattern1_color(pdcolor)){
if( gx_pattern1_get_transptr(pdcolor) != NULL ||
gx_pattern1_clist_has_trans(pdcolor) ){
/* In this case, we need to push a transparency group
and tile the pattern color, which is stored in
a pdf14 device buffer in the ctile object memember
variable ttrans */
#if RAW_DUMP
/* Since we do not get a put_image to view what
we have do it now */
if (gx_pattern1_get_transptr(pdcolor) != NULL) {
pdf14_device * ppatdev14 =
pdcolor->colors.pattern.p_tile->ttrans->pdev14;
if (ppatdev14 != NULL) { /* can occur during clist reading */
byte *buf_ptr = ppatdev14->ctx->stack->data +
ppatdev14->ctx->stack->rect.p.y *
ppatdev14->ctx->stack->rowstride +
ppatdev14->ctx->stack->rect.p.x;
dump_raw_buffer(ppatdev14->ctx->stack->rect.q.y -
ppatdev14->ctx->stack->rect.p.y,
ppatdev14->ctx->stack->rect.q.x -
ppatdev14->ctx->stack->rect.p.x,
ppatdev14->ctx->stack->n_planes,
ppatdev14->ctx->stack->planestride,
ppatdev14->ctx->stack->rowstride,
"Pattern_Fill",buf_ptr);
global_index++;
} else {
gx_pattern_trans_t *patt_trans =
pdcolor->colors.pattern.p_tile->ttrans;
dump_raw_buffer(patt_trans->rect.q.y-patt_trans->rect.p.y,
patt_trans->rect.q.x-patt_trans->rect.p.x,
patt_trans->n_chan,
patt_trans->planestride, patt_trans->rowstride,
"Pattern_Fill_clist", patt_trans->transbytes +
patt_trans->rect.p.y * patt_trans->rowstride +
patt_trans->rect.p.x);
global_index++;
}
}
#endif
code = pdf14_tile_pattern_fill(dev, &new_pgs, ppath,
params, pdcolor, pcpath);
new_pgs.trans_device = NULL;
new_pgs.has_transparency = false;
return code;
}
}
if (gx_dc_is_pattern2_color(pdcolor)) {
pinst =
(gs_pattern2_instance_t *)pdcolor->ccolor.pattern;
pinst->saved->has_transparency = true;
/* The transparency color space operations are driven
by the pdf14 clist writer device. */
pinst->saved->trans_device = dev;
}
update_lop_for_pdf14(&new_pgs, pdcolor);
pdf14_set_marking_params(dev, pgs);
new_pgs.trans_device = dev;
new_pgs.has_transparency = true;
code = gx_default_fill_path(dev, &new_pgs, ppath, params, pdcolor, pcpath);
new_pgs.trans_device = NULL;
new_pgs.has_transparency = false;
if (pinst != NULL){
pinst->saved->trans_device = NULL;
}
return code;
}
| 15,170 |
150,609 | 0 | void DataReductionProxyIOData::SetInt64Pref(const std::string& pref_path,
int64_t value) {
DCHECK(io_task_runner_->BelongsToCurrentThread());
ui_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&DataReductionProxyService::SetInt64Pref,
service_, pref_path, value));
}
| 15,171 |
19,283 | 0 | static int unix_accept(struct socket *sock, struct socket *newsock, int flags)
{
struct sock *sk = sock->sk;
struct sock *tsk;
struct sk_buff *skb;
int err;
err = -EOPNOTSUPP;
if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
goto out;
err = -EINVAL;
if (sk->sk_state != TCP_LISTEN)
goto out;
/* If socket state is TCP_LISTEN it cannot change (for now...),
* so that no locks are necessary.
*/
skb = skb_recv_datagram(sk, 0, flags&O_NONBLOCK, &err);
if (!skb) {
/* This means receive shutdown. */
if (err == 0)
err = -EINVAL;
goto out;
}
tsk = skb->sk;
skb_free_datagram(sk, skb);
wake_up_interruptible(&unix_sk(sk)->peer_wait);
/* attach accepted sock to socket */
unix_state_lock(tsk);
newsock->state = SS_CONNECTED;
sock_graft(tsk, newsock);
unix_state_unlock(tsk);
return 0;
out:
return err;
}
| 15,172 |
90,310 | 0 | megasas_clear_intr_xscale(struct megasas_instance *instance)
{
u32 status;
u32 mfiStatus = 0;
struct megasas_register_set __iomem *regs;
regs = instance->reg_set;
/*
* Check if it is our interrupt
*/
status = readl(®s->outbound_intr_status);
if (status & MFI_OB_INTR_STATUS_MASK)
mfiStatus = MFI_INTR_FLAG_REPLY_MESSAGE;
if (status & MFI_XSCALE_OMR0_CHANGE_INTERRUPT)
mfiStatus |= MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE;
/*
* Clear the interrupt by writing back the same value
*/
if (mfiStatus)
writel(status, ®s->outbound_intr_status);
/* Dummy readl to force pci flush */
readl(®s->outbound_intr_status);
return mfiStatus;
}
| 15,173 |
170,716 | 0 | OMX_ERRORTYPE OMXNodeInstance::OnFillBufferDone(
OMX_IN OMX_HANDLETYPE /* hComponent */,
OMX_IN OMX_PTR pAppData,
OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) {
OMXNodeInstance *instance = static_cast<OMXNodeInstance *>(pAppData);
if (instance->mDying) {
return OMX_ErrorNone;
}
return instance->owner()->OnFillBufferDone(instance->nodeID(),
instance->findBufferID(pBuffer), pBuffer);
}
| 15,174 |
80,573 | 0 | GF_Err trak_Read(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
u32 i;
GF_TrackBox *ptr = (GF_TrackBox *)s;
e = gf_isom_box_array_read(s, bs, trak_AddBox);
if (e) return e;
gf_isom_check_sample_desc(ptr);
if (!ptr->Header) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Missing TrackHeaderBox\n"));
return GF_ISOM_INVALID_FILE;
}
if (!ptr->Media) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Missing MediaBox\n"));
return GF_ISOM_INVALID_FILE;
}
for (i=0; i<gf_list_count(ptr->Media->information->sampleTable->other_boxes); i++) {
GF_Box *a = gf_list_get(ptr->Media->information->sampleTable->other_boxes, i);
if ((a->type ==GF_ISOM_BOX_TYPE_UUID) && (((GF_UUIDBox *)a)->internal_4cc == GF_ISOM_BOX_UUID_PSEC)) {
ptr->sample_encryption = (struct __sample_encryption_box *) a;
break;
}
else if (a->type == GF_ISOM_BOX_TYPE_SENC) {
ptr->sample_encryption = (struct __sample_encryption_box *)a;
break;
}
}
return e;
}
| 15,175 |
59,490 | 0 | xmlParseExternalEntity(xmlDocPtr doc, xmlSAXHandlerPtr sax, void *user_data,
int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *lst) {
return(xmlParseExternalEntityPrivate(doc, NULL, sax, user_data, depth, URL,
ID, lst));
}
| 15,176 |
103,846 | 0 | void RenderView::OnWasHidden() {
RenderWidget::OnWasHidden();
if (webview()) {
webview()->settings()->setMinimumTimerInterval(
webkit_glue::kBackgroundTabTimerInterval);
webview()->setVisibilityState(visibilityState(), false);
}
#if defined(OS_MACOSX)
std::set<WebPluginDelegateProxy*>::iterator plugin_it;
for (plugin_it = plugin_delegates_.begin();
plugin_it != plugin_delegates_.end(); ++plugin_it) {
(*plugin_it)->SetContainerVisibility(false);
}
#endif // OS_MACOSX
}
| 15,177 |
5,940 | 0 | static void ohci_set_hub_status(OHCIState *ohci, uint32_t val)
{
uint32_t old_state;
old_state = ohci->rhstatus;
/* write 1 to clear OCIC */
if (val & OHCI_RHS_OCIC)
ohci->rhstatus &= ~OHCI_RHS_OCIC;
if (val & OHCI_RHS_LPS) {
int i;
for (i = 0; i < ohci->num_ports; i++)
ohci_port_power(ohci, i, 0);
trace_usb_ohci_hub_power_down();
}
if (val & OHCI_RHS_LPSC) {
int i;
for (i = 0; i < ohci->num_ports; i++)
ohci_port_power(ohci, i, 1);
trace_usb_ohci_hub_power_up();
}
if (val & OHCI_RHS_DRWE)
ohci->rhstatus |= OHCI_RHS_DRWE;
if (val & OHCI_RHS_CRWE)
ohci->rhstatus &= ~OHCI_RHS_DRWE;
if (old_state != ohci->rhstatus)
ohci_set_interrupt(ohci, OHCI_INTR_RHSC);
}
| 15,178 |
19,368 | 0 | static void efx_fini_channels(struct efx_nic *efx)
{
struct efx_channel *channel;
struct efx_tx_queue *tx_queue;
struct efx_rx_queue *rx_queue;
int rc;
EFX_ASSERT_RESET_SERIALISED(efx);
BUG_ON(efx->port_enabled);
rc = efx_nic_flush_queues(efx);
if (rc && EFX_WORKAROUND_7803(efx)) {
/* Schedule a reset to recover from the flush failure. The
* descriptor caches reference memory we're about to free,
* but falcon_reconfigure_mac_wrapper() won't reconnect
* the MACs because of the pending reset. */
netif_err(efx, drv, efx->net_dev,
"Resetting to recover from flush failure\n");
efx_schedule_reset(efx, RESET_TYPE_ALL);
} else if (rc) {
netif_err(efx, drv, efx->net_dev, "failed to flush queues\n");
} else {
netif_dbg(efx, drv, efx->net_dev,
"successfully flushed all queues\n");
}
efx_for_each_channel(channel, efx) {
netif_dbg(channel->efx, drv, channel->efx->net_dev,
"shut down chan %d\n", channel->channel);
efx_for_each_channel_rx_queue(rx_queue, channel)
efx_fini_rx_queue(rx_queue);
efx_for_each_possible_channel_tx_queue(tx_queue, channel)
efx_fini_tx_queue(tx_queue);
efx_fini_eventq(channel);
}
}
| 15,179 |
188,375 | 1 | const SeekHead* Segment::GetSeekHead() const
{
return m_pSeekHead;
}
| 15,180 |
144,230 | 0 | views::View* LockContentsView::TestApi::dev_channel_info() const {
return view_->dev_channel_info_;
}
| 15,181 |
58,036 | 0 | static void nft_trans_destroy(struct nft_trans *trans)
{
list_del(&trans->list);
kfree(trans);
}
| 15,182 |
144,918 | 0 | ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() {
return this;
}
| 15,183 |
93,961 | 0 | xfs_map_trim_size(
struct inode *inode,
sector_t iblock,
struct buffer_head *bh_result,
struct xfs_bmbt_irec *imap,
xfs_off_t offset,
ssize_t size)
{
xfs_off_t mapping_size;
mapping_size = imap->br_startoff + imap->br_blockcount - iblock;
mapping_size <<= inode->i_blkbits;
ASSERT(mapping_size > 0);
if (mapping_size > size)
mapping_size = size;
if (offset < i_size_read(inode) &&
offset + mapping_size >= i_size_read(inode)) {
/* limit mapping to block that spans EOF */
mapping_size = roundup_64(i_size_read(inode) - offset,
1 << inode->i_blkbits);
}
if (mapping_size > LONG_MAX)
mapping_size = LONG_MAX;
bh_result->b_size = mapping_size;
}
| 15,184 |
182,554 | 1 | int create_flush_cmd_control(struct f2fs_sb_info *sbi)
{
dev_t dev = sbi->sb->s_bdev->bd_dev;
struct flush_cmd_control *fcc;
int err = 0;
if (SM_I(sbi)->fcc_info) {
fcc = SM_I(sbi)->fcc_info;
goto init_thread;
}
fcc = kzalloc(sizeof(struct flush_cmd_control), GFP_KERNEL);
if (!fcc)
return -ENOMEM;
atomic_set(&fcc->issued_flush, 0);
atomic_set(&fcc->issing_flush, 0);
init_waitqueue_head(&fcc->flush_wait_queue);
init_llist_head(&fcc->issue_list);
SM_I(sbi)->fcc_info = fcc;
init_thread:
fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,
"f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
if (IS_ERR(fcc->f2fs_issue_flush)) {
err = PTR_ERR(fcc->f2fs_issue_flush);
kfree(fcc);
SM_I(sbi)->fcc_info = NULL;
return err;
}
return err;
}
| 15,185 |
57,037 | 0 | static int _nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state *state)
{
struct nfs_delegation *delegation;
struct nfs4_opendata *opendata;
fmode_t delegation_type = 0;
int status;
opendata = nfs4_open_recoverdata_alloc(ctx, state,
NFS4_OPEN_CLAIM_PREVIOUS);
if (IS_ERR(opendata))
return PTR_ERR(opendata);
rcu_read_lock();
delegation = rcu_dereference(NFS_I(state->inode)->delegation);
if (delegation != NULL && test_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags) != 0)
delegation_type = delegation->type;
rcu_read_unlock();
opendata->o_arg.u.delegation_type = delegation_type;
status = nfs4_open_recover(opendata, state);
nfs4_opendata_put(opendata);
return status;
}
| 15,186 |
137,060 | 0 | FileList* InputType::Files() {
return nullptr;
}
| 15,187 |
19,149 | 0 | static void tcp_v6_reqsk_destructor(struct request_sock *req)
{
kfree_skb(inet6_rsk(req)->pktopts);
}
| 15,188 |
21,990 | 0 | raptor_option_get_count(void)
{
return RAPTOR_OPTION_LAST + 1;
}
| 15,189 |
127,423 | 0 | void FileAPIMessageFilter::DidGetMetadata(
int request_id,
base::PlatformFileError result,
const base::PlatformFileInfo& info,
const FilePath& platform_path) {
if (result == base::PLATFORM_FILE_OK)
Send(new FileSystemMsg_DidReadMetadata(request_id, info, platform_path));
else
Send(new FileSystemMsg_DidFail(request_id, result));
UnregisterOperation(request_id);
}
| 15,190 |
143,176 | 0 | bool Document::dispatchBeforeUnloadEvent(ChromeClient& chromeClient, bool isReload, bool& didAllowNavigation)
{
if (!m_domWindow)
return true;
if (!body())
return true;
if (processingBeforeUnload())
return false;
BeforeUnloadEvent* beforeUnloadEvent = BeforeUnloadEvent::create();
m_loadEventProgress = BeforeUnloadEventInProgress;
m_domWindow->dispatchEvent(beforeUnloadEvent, this);
m_loadEventProgress = BeforeUnloadEventCompleted;
if (!beforeUnloadEvent->defaultPrevented())
defaultEventHandler(beforeUnloadEvent);
if (!frame() || beforeUnloadEvent->returnValue().isNull())
return true;
if (didAllowNavigation) {
addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, "Blocked attempt to show multiple 'beforeunload' confirmation panels for a single navigation."));
return true;
}
String text = beforeUnloadEvent->returnValue();
if (chromeClient.openBeforeUnloadConfirmPanel(text, m_frame, isReload)) {
didAllowNavigation = true;
return true;
}
return false;
}
| 15,191 |
79,362 | 0 | static int mov_write_int8_metadata(AVFormatContext *s, AVIOContext *pb,
const char *name, const char *tag,
int len)
{
AVDictionaryEntry *t = NULL;
uint8_t num;
int size = 24 + len;
if (len != 1 && len != 4)
return -1;
if (!(t = av_dict_get(s->metadata, tag, NULL, 0)))
return 0;
num = atoi(t->value);
avio_wb32(pb, size);
ffio_wfourcc(pb, name);
avio_wb32(pb, size - 8);
ffio_wfourcc(pb, "data");
avio_wb32(pb, 0x15);
avio_wb32(pb, 0);
if (len==4) avio_wb32(pb, num);
else avio_w8 (pb, num);
return size;
}
| 15,192 |
4,161 | 0 | IdentityFunction::IdentityFunction() {
int i;
m = funcMaxInputs;
n = funcMaxOutputs;
for (i = 0; i < funcMaxInputs; ++i) {
domain[i][0] = 0;
domain[i][1] = 1;
}
hasRange = gFalse;
}
| 15,193 |
130,445 | 0 | StartupTimeBomb::~StartupTimeBomb() {
DCHECK(this == g_startup_timebomb_);
DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
if (startup_watchdog_)
Disarm();
g_startup_timebomb_ = nullptr;
}
| 15,194 |
97,245 | 0 | void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks() {
}
| 15,195 |
179,121 | 1 | static int vapic_enter(struct kvm_vcpu *vcpu)
{
struct kvm_lapic *apic = vcpu->arch.apic;
struct page *page;
if (!apic || !apic->vapic_addr)
return 0;
page = gfn_to_page(vcpu->kvm, apic->vapic_addr >> PAGE_SHIFT);
if (is_error_page(page))
return -EFAULT;
vcpu->arch.apic->vapic_page = page;
return 0;
}
| 15,196 |
185,940 | 1 | void TypingCommand::insertText(Document& document,
const String& text,
Options options,
TextCompositionType composition,
const bool isIncrementalInsertion) {
LocalFrame* frame = document.frame();
DCHECK(frame);
if (!text.isEmpty())
document.frame()->spellChecker().updateMarkersForWordsAffectedByEditing(
isSpaceOrNewline(text[0]));
insertText(document, text,
frame->selection().computeVisibleSelectionInDOMTreeDeprecated(),
options, composition, isIncrementalInsertion);
}
| 15,197 |
163,080 | 0 | struct tm* localtime_override(const time_t* timep) {
if (g_am_zygote_or_renderer) {
static struct tm time_struct;
static char timezone_string[64];
ProxyLocaltimeCallToBrowser(*timep, &time_struct, timezone_string,
sizeof(timezone_string));
return &time_struct;
}
CHECK_EQ(0, pthread_once(&g_libc_localtime_funcs_guard,
InitLibcLocaltimeFunctions));
struct tm* res = g_libc_localtime(timep);
#if defined(MEMORY_SANITIZER)
if (res) __msan_unpoison(res, sizeof(*res));
if (res->tm_zone) __msan_unpoison_string(res->tm_zone);
#endif
return res;
}
| 15,198 |
4,855 | 0 | LastEventTimeToggleResetAll(Bool state)
{
DeviceIntPtr dev;
nt_list_for_each_entry(dev, inputInfo.devices, next) {
LastEventTimeToggleResetFlag(dev->id, FALSE);
}
LastEventTimeToggleResetFlag(XIAllDevices, FALSE);
LastEventTimeToggleResetFlag(XIAllMasterDevices, FALSE);
}
| 15,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.