unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
185,635 | 1 | void FrameSelection::MoveRangeSelectionExtent(const IntPoint& contents_point) {
if (ComputeVisibleSelectionInDOMTree().IsNone())
return;
SetSelection(
SelectionInDOMTree::Builder(
GetGranularityStrategy()->UpdateExtent(contents_point, frame_))
.SetIsHandleVisible(true)
.Build(),
SetSelectionData::Builder()
.SetShouldCloseTyping(true)
.SetShouldClearTypingStyle(true)
.SetDoNotClearStrategy(true)
.SetSetSelectionBy(SetSelectionBy::kUser)
.Build());
}
| 1,900 |
55,397 | 0 | static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)
{
struct tcp_sock *tp = tcp_sk(sk);
if (before(ack, tp->tlp_high_seq))
return;
if (flag & FLAG_DSACKING_ACK) {
/* This DSACK means original and TLP probe arrived; no loss */
tp->tlp_high_seq = 0;
} else if (after(ack, tp->tlp_high_seq)) {
/* ACK advances: there was a loss, so reduce cwnd. Reset
* tlp_high_seq in tcp_init_cwnd_reduction()
*/
tcp_init_cwnd_reduction(sk);
tcp_set_ca_state(sk, TCP_CA_CWR);
tcp_end_cwnd_reduction(sk);
tcp_try_keep_open(sk);
NET_INC_STATS_BH(sock_net(sk),
LINUX_MIB_TCPLOSSPROBERECOVERY);
} else if (!(flag & (FLAG_SND_UNA_ADVANCED |
FLAG_NOT_DUP | FLAG_DATA_SACKED))) {
/* Pure dupack: original and TLP probe arrived; no loss */
tp->tlp_high_seq = 0;
}
}
| 1,901 |
159,724 | 0 | void WebGLRenderingContextBase::DispatchContextLostEvent(TimerBase*) {
WebGLContextEvent* event = WebGLContextEvent::Create(
EventTypeNames::webglcontextlost, false, true, "");
Host()->HostDispatchEvent(event);
restore_allowed_ = event->defaultPrevented();
if (restore_allowed_ && !is_hidden_) {
if (auto_recovery_method_ == kAuto)
restore_timer_.StartOneShot(TimeDelta(), FROM_HERE);
}
}
| 1,902 |
79,349 | 0 | static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
{
AVCPBProperties *props;
int64_t pos = avio_tell(pb);
int decoder_specific_info_len = track->vos_len ? 5 + track->vos_len : 0;
unsigned avg_bitrate;
avio_wb32(pb, 0); // size
ffio_wfourcc(pb, "esds");
avio_wb32(pb, 0); // Version
put_descr(pb, 0x03, 3 + 5+13 + decoder_specific_info_len + 5+1);
avio_wb16(pb, track->track_id);
avio_w8(pb, 0x00); // flags (= no flags)
put_descr(pb, 0x04, 13 + decoder_specific_info_len);
if ((track->par->codec_id == AV_CODEC_ID_MP2 ||
track->par->codec_id == AV_CODEC_ID_MP3) &&
track->par->sample_rate > 24000)
avio_w8(pb, 0x6B); // 11172-3
else
avio_w8(pb, ff_codec_get_tag(ff_mp4_obj_type, track->par->codec_id));
if (track->par->codec_id == AV_CODEC_ID_DVD_SUBTITLE)
avio_w8(pb, (0x38 << 2) | 1); // flags (= NeroSubpicStream)
else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO)
avio_w8(pb, 0x15); // flags (= Audiostream)
else
avio_w8(pb, 0x11); // flags (= Visualstream)
props = (AVCPBProperties*)av_stream_get_side_data(track->st, AV_PKT_DATA_CPB_PROPERTIES,
NULL);
avio_wb24(pb, props ? props->buffer_size / 8 : 0); // Buffersize DB
avg_bitrate = compute_avg_bitrate(track);
avio_wb32(pb, props ? FFMAX3(props->max_bitrate, props->avg_bitrate, avg_bitrate) : FFMAX(track->par->bit_rate, avg_bitrate)); // maxbitrate (FIXME should be max rate in any 1 sec window)
avio_wb32(pb, avg_bitrate);
if (track->vos_len) {
put_descr(pb, 0x05, track->vos_len);
avio_write(pb, track->vos_data, track->vos_len);
}
put_descr(pb, 0x06, 1);
avio_w8(pb, 0x02);
return update_size(pb, pos);
}
| 1,903 |
36,287 | 0 | SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
int, newdfd, const char __user *, newname, int, flags)
{
struct dentry *new_dentry;
struct path old_path, new_path;
struct inode *delegated_inode = NULL;
int how = 0;
int error;
if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0)
return -EINVAL;
/*
* To use null names we require CAP_DAC_READ_SEARCH
* This ensures that not everyone will be able to create
* handlink using the passed filedescriptor.
*/
if (flags & AT_EMPTY_PATH) {
if (!capable(CAP_DAC_READ_SEARCH))
return -ENOENT;
how = LOOKUP_EMPTY;
}
if (flags & AT_SYMLINK_FOLLOW)
how |= LOOKUP_FOLLOW;
retry:
error = user_path_at(olddfd, oldname, how, &old_path);
if (error)
return error;
new_dentry = user_path_create(newdfd, newname, &new_path,
(how & LOOKUP_REVAL));
error = PTR_ERR(new_dentry);
if (IS_ERR(new_dentry))
goto out;
error = -EXDEV;
if (old_path.mnt != new_path.mnt)
goto out_dput;
error = may_linkat(&old_path);
if (unlikely(error))
goto out_dput;
error = security_path_link(old_path.dentry, &new_path, new_dentry);
if (error)
goto out_dput;
error = vfs_link(old_path.dentry, new_path.dentry->d_inode, new_dentry, &delegated_inode);
out_dput:
done_path_create(&new_path, new_dentry);
if (delegated_inode) {
error = break_deleg_wait(&delegated_inode);
if (!error) {
path_put(&old_path);
goto retry;
}
}
if (retry_estale(error, how)) {
path_put(&old_path);
how |= LOOKUP_REVAL;
goto retry;
}
out:
path_put(&old_path);
return error;
}
| 1,904 |
157,554 | 0 | net::MockClientSocketFactory* mock_socket_factory() {
return &mock_socket_factory_;
}
| 1,905 |
54,267 | 0 | static void mct_u232_set_termios(struct tty_struct *tty,
struct usb_serial_port *port,
struct ktermios *old_termios)
{
struct usb_serial *serial = port->serial;
struct mct_u232_private *priv = usb_get_serial_port_data(port);
struct ktermios *termios = &tty->termios;
unsigned int cflag = termios->c_cflag;
unsigned int old_cflag = old_termios->c_cflag;
unsigned long flags;
unsigned int control_state;
unsigned char last_lcr;
/* get a local copy of the current port settings */
spin_lock_irqsave(&priv->lock, flags);
control_state = priv->control_state;
spin_unlock_irqrestore(&priv->lock, flags);
last_lcr = 0;
/*
* Update baud rate.
* Do not attempt to cache old rates and skip settings,
* disconnects screw such tricks up completely.
* Premature optimization is the root of all evil.
*/
/* reassert DTR and RTS on transition from B0 */
if ((old_cflag & CBAUD) == B0) {
dev_dbg(&port->dev, "%s: baud was B0\n", __func__);
control_state |= TIOCM_DTR | TIOCM_RTS;
mct_u232_set_modem_ctrl(port, control_state);
}
mct_u232_set_baud_rate(tty, serial, port, tty_get_baud_rate(tty));
if ((cflag & CBAUD) == B0) {
dev_dbg(&port->dev, "%s: baud is B0\n", __func__);
/* Drop RTS and DTR */
control_state &= ~(TIOCM_DTR | TIOCM_RTS);
mct_u232_set_modem_ctrl(port, control_state);
}
/*
* Update line control register (LCR)
*/
/* set the parity */
if (cflag & PARENB)
last_lcr |= (cflag & PARODD) ?
MCT_U232_PARITY_ODD : MCT_U232_PARITY_EVEN;
else
last_lcr |= MCT_U232_PARITY_NONE;
/* set the number of data bits */
switch (cflag & CSIZE) {
case CS5:
last_lcr |= MCT_U232_DATA_BITS_5; break;
case CS6:
last_lcr |= MCT_U232_DATA_BITS_6; break;
case CS7:
last_lcr |= MCT_U232_DATA_BITS_7; break;
case CS8:
last_lcr |= MCT_U232_DATA_BITS_8; break;
default:
dev_err(&port->dev,
"CSIZE was not CS5-CS8, using default of 8\n");
last_lcr |= MCT_U232_DATA_BITS_8;
break;
}
termios->c_cflag &= ~CMSPAR;
/* set the number of stop bits */
last_lcr |= (cflag & CSTOPB) ?
MCT_U232_STOP_BITS_2 : MCT_U232_STOP_BITS_1;
mct_u232_set_line_ctrl(port, last_lcr);
/* save off the modified port settings */
spin_lock_irqsave(&priv->lock, flags);
priv->control_state = control_state;
priv->last_lcr = last_lcr;
spin_unlock_irqrestore(&priv->lock, flags);
} /* mct_u232_set_termios */
| 1,906 |
181,777 | 1 | static Image *ReadSTEGANOImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
#define GetBit(alpha,i) MagickMin((((size_t) (alpha) >> (size_t) \
(i)) & 0x01),16)
#define SetBit(indexes,i,set) SetPixelIndex(indexes,((set) != 0 ? \
(size_t) GetPixelIndex(indexes) | (one << (size_t) (i)) : (size_t) \
GetPixelIndex(indexes) & ~(one << (size_t) (i))))
Image
*image,
*watermark;
ImageInfo
*read_info;
int
c;
MagickBooleanType
status;
PixelPacket
pixel;
register IndexPacket
*indexes;
register PixelPacket
*q;
register ssize_t
x;
size_t
depth,
one;
ssize_t
i,
j,
k,
y;
/*
Initialize Image structure.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
one=1;
image=AcquireImage(image_info);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
*read_info->magick='\0';
watermark=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (watermark == (Image *) NULL)
return((Image *) NULL);
watermark->depth=MAGICKCORE_QUANTUM_DEPTH;
if (AcquireImageColormap(image,MaxColormapSize) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
/*
Get hidden watermark from low-order bits of image.
*/
c=0;
i=0;
j=0;
i=(ssize_t) (watermark->depth-1);
depth=watermark->depth;
for (k=image->offset; (i >= 0) && (j < (ssize_t) depth); i--)
{
for (y=0; (y < (ssize_t) image->rows) && (j < (ssize_t) depth); y++)
{
x=0;
for ( ; (x < (ssize_t) image->columns) && (j < (ssize_t) depth); x++)
{
if ((k/(ssize_t) watermark->columns) >= (ssize_t) watermark->rows)
break;
(void) GetOneVirtualPixel(watermark,k % (ssize_t) watermark->columns,
k/(ssize_t) watermark->columns,&pixel,exception);
q=GetAuthenticPixels(image,x,y,1,1,exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
switch (c)
{
case 0:
{
SetBit(indexes,i,GetBit(pixel.red,j));
break;
}
case 1:
{
SetBit(indexes,i,GetBit(pixel.green,j));
break;
}
case 2:
{
SetBit(indexes,i,GetBit(pixel.blue,j));
break;
}
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
c++;
if (c == 3)
c=0;
k++;
if (k == (ssize_t) (watermark->columns*watermark->columns))
k=0;
if (k == image->offset)
j++;
}
}
status=SetImageProgress(image,LoadImagesTag,(MagickOffsetType) i,depth);
if (status == MagickFalse)
break;
}
watermark=DestroyImage(watermark);
(void) SyncImage(image);
return(GetFirstImageInList(image));
}
| 1,907 |
2,020 | 0 | PHP_FUNCTION(openssl_x509_check_private_key)
{
zval ** zcert, **zkey;
X509 * cert = NULL;
EVP_PKEY * key = NULL;
long certresource = -1, keyresource = -1;
RETVAL_FALSE;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZ", &zcert, &zkey) == FAILURE) {
return;
}
cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC);
if (cert == NULL) {
RETURN_FALSE;
}
key = php_openssl_evp_from_zval(zkey, 0, "", 1, &keyresource TSRMLS_CC);
if (key) {
RETVAL_BOOL(X509_check_private_key(cert, key));
}
if (keyresource == -1 && key) {
EVP_PKEY_free(key);
}
if (certresource == -1 && cert) {
X509_free(cert);
}
}
| 1,908 |
8,132 | 0 | void Gfx::opMoveShowText(Object args[], int numArgs) {
double tx, ty;
if (!state->getFont()) {
error(getPos(), "No font in move/show");
return;
}
if (fontChanged) {
out->updateFont(state);
fontChanged = gFalse;
}
tx = state->getLineX();
ty = state->getLineY() - state->getLeading();
state->textMoveTo(tx, ty);
out->updateTextPos(state);
out->beginStringOp(state);
doShowText(args[0].getString());
out->endStringOp(state);
}
| 1,909 |
174,027 | 0 | ContentEncoding::ContentEncryption::~ContentEncryption() {
delete[] key_id;
delete[] signature;
delete[] sig_key_id;
}
| 1,910 |
103,076 | 0 | bool Browser::CanReloadContents(TabContents* source) const {
return type() != TYPE_DEVTOOLS;
}
| 1,911 |
122,550 | 0 | void WebDevToolsAgentImpl::didNavigate()
{
ClientMessageLoopAdapter::didNavigate();
}
| 1,912 |
148,918 | 0 | void RenderFrameHostManager::SwapOutOldFrame(
std::unique_ptr<RenderFrameHostImpl> old_render_frame_host) {
TRACE_EVENT1("navigation", "RenderFrameHostManager::SwapOutOldFrame",
"FrameTreeNode id", frame_tree_node_->frame_tree_node_id());
old_render_frame_host->SuppressFurtherDialogs();
delegate_->CancelModalDialogsForRenderManager();
if (!old_render_frame_host->IsRenderFrameLive())
return;
RenderFrameProxyHost* proxy =
CreateRenderFrameProxyHost(old_render_frame_host->GetSiteInstance(),
old_render_frame_host->render_view_host());
old_render_frame_host->SetNavigationHandle(nullptr);
old_render_frame_host->SwapOut(proxy, true);
proxy->set_render_frame_proxy_created(true);
pending_delete_hosts_.push_back(std::move(old_render_frame_host));
}
| 1,913 |
178,424 | 1 | vmnc_handle_wmvi_rectangle (GstVMncDec * dec, struct RfbRectangle *rect,
const guint8 * data, int len, gboolean decode)
{
GstVideoFormat format;
gint bpp, tc;
guint32 redmask, greenmask, bluemask;
guint32 endianness, dataendianness;
GstVideoCodecState *state;
/* A WMVi rectangle has a 16byte payload */
if (len < 16) {
GST_DEBUG_OBJECT (dec, "Bad WMVi rect: too short");
return ERROR_INSUFFICIENT_DATA;
}
/* We only compare 13 bytes; ignoring the 3 padding bytes at the end */
if (dec->have_format && memcmp (data, dec->format.descriptor, 13) == 0) {
/* Nothing changed, so just exit */
return 16;
}
/* Store the whole block for simple comparison later */
memcpy (dec->format.descriptor, data, 16);
if (rect->x != 0 || rect->y != 0) {
GST_WARNING_OBJECT (dec, "Bad WMVi rect: wrong coordinates");
return ERROR_INVALID;
}
bpp = data[0];
dec->format.depth = data[1];
dec->format.big_endian = data[2];
dataendianness = data[2] ? G_BIG_ENDIAN : G_LITTLE_ENDIAN;
tc = data[3];
if (bpp != 8 && bpp != 16 && bpp != 32) {
GST_WARNING_OBJECT (dec, "Bad bpp value: %d", bpp);
return ERROR_INVALID;
}
if (!tc) {
GST_WARNING_OBJECT (dec, "Paletted video not supported");
return ERROR_INVALID;
}
dec->format.bytes_per_pixel = bpp / 8;
dec->format.width = rect->width;
dec->format.height = rect->height;
redmask = (guint32) (RFB_GET_UINT16 (data + 4)) << data[10];
greenmask = (guint32) (RFB_GET_UINT16 (data + 6)) << data[11];
bluemask = (guint32) (RFB_GET_UINT16 (data + 8)) << data[12];
GST_DEBUG_OBJECT (dec, "Red: mask %d, shift %d",
RFB_GET_UINT16 (data + 4), data[10]);
GST_DEBUG_OBJECT (dec, "Green: mask %d, shift %d",
RFB_GET_UINT16 (data + 6), data[11]);
GST_DEBUG_OBJECT (dec, "Blue: mask %d, shift %d",
RFB_GET_UINT16 (data + 8), data[12]);
GST_DEBUG_OBJECT (dec, "BPP: %d. endianness: %s", bpp,
data[2] ? "big" : "little");
/* GStreamer's RGB caps are a bit weird. */
if (bpp == 8) {
endianness = G_BYTE_ORDER; /* Doesn't matter */
} else if (bpp == 16) {
/* We require host-endian. */
endianness = G_BYTE_ORDER;
} else { /* bpp == 32 */
/* We require big endian */
endianness = G_BIG_ENDIAN;
if (endianness != dataendianness) {
redmask = GUINT32_SWAP_LE_BE (redmask);
greenmask = GUINT32_SWAP_LE_BE (greenmask);
bluemask = GUINT32_SWAP_LE_BE (bluemask);
}
}
format = gst_video_format_from_masks (dec->format.depth, bpp, endianness,
redmask, greenmask, bluemask, 0);
GST_DEBUG_OBJECT (dec, "From depth: %d bpp: %u endianess: %s redmask: %X "
"greenmask: %X bluemask: %X got format %s",
dec->format.depth, bpp, endianness == G_BIG_ENDIAN ? "BE" : "LE",
GUINT32_FROM_BE (redmask), GUINT32_FROM_BE (greenmask),
GUINT32_FROM_BE (bluemask),
format == GST_VIDEO_FORMAT_UNKNOWN ? "UNKOWN" :
gst_video_format_to_string (format));
if (format == GST_VIDEO_FORMAT_UNKNOWN) {
GST_WARNING_OBJECT (dec, "Video format unknown to GStreamer");
return ERROR_INVALID;
}
dec->have_format = TRUE;
if (!decode) {
GST_LOG_OBJECT (dec, "Parsing, not setting caps");
return 16;
}
state = gst_video_decoder_set_output_state (GST_VIDEO_DECODER (dec), format,
rect->width, rect->height, dec->input_state);
gst_video_codec_state_unref (state);
g_free (dec->imagedata);
dec->imagedata = g_malloc (dec->format.width * dec->format.height *
dec->format.bytes_per_pixel);
GST_DEBUG_OBJECT (dec, "Allocated image data at %p", dec->imagedata);
dec->format.stride = dec->format.width * dec->format.bytes_per_pixel;
return 16;
}
| 1,914 |
185,039 | 1 | void PPB_Buffer_Proxy::OnMsgCreate(
PP_Instance instance,
uint32_t size,
HostResource* result_resource,
ppapi::proxy::SerializedHandle* result_shm_handle) {
result_shm_handle->set_null_shmem();
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher)
return;
thunk::EnterResourceCreation enter(instance);
if (enter.failed())
return;
PP_Resource local_buffer_resource = enter.functions()->CreateBuffer(instance,
size);
if (local_buffer_resource == 0)
return;
thunk::EnterResourceNoLock<thunk::PPB_BufferTrusted_API> trusted_buffer(
local_buffer_resource, false);
if (trusted_buffer.failed())
return;
int local_fd;
if (trusted_buffer.object()->GetSharedMemory(&local_fd) != PP_OK)
return;
result_resource->SetHostResource(instance, local_buffer_resource);
base::PlatformFile platform_file =
#if defined(OS_WIN)
reinterpret_cast<HANDLE>(static_cast<intptr_t>(local_fd));
#elif defined(OS_POSIX)
local_fd;
#else
#error Not implemented.
#endif
result_shm_handle->set_shmem(
dispatcher->ShareHandleWithRemote(platform_file, false), size);
}
| 1,915 |
136,349 | 0 | static bool NodeHasAncestor(const TransformPaintPropertyNode* node,
const TransformPaintPropertyNode* ancestor) {
while (node) {
if (node == ancestor)
return true;
node = node->Parent();
}
return false;
}
| 1,916 |
45,229 | 0 | psf_ftruncate (SF_PRIVATE *psf, sf_count_t len)
{ int retval ;
/* Returns 0 on success, non-zero on failure. */
if (len < 0)
return -1 ;
if ((sizeof (off_t) < sizeof (sf_count_t)) && len > 0x7FFFFFFF)
return -1 ;
retval = ftruncate (psf->file.filedes, len) ;
if (retval == -1)
psf_log_syserr (psf, errno) ;
return retval ;
} /* psf_ftruncate */
| 1,917 |
63,907 | 0 | static int do_timerfd_settime(int ufd, int flags,
const struct itimerspec *new,
struct itimerspec *old)
{
struct fd f;
struct timerfd_ctx *ctx;
int ret;
if ((flags & ~TFD_SETTIME_FLAGS) ||
!timespec_valid(&new->it_value) ||
!timespec_valid(&new->it_interval))
return -EINVAL;
ret = timerfd_fget(ufd, &f);
if (ret)
return ret;
ctx = f.file->private_data;
if (!capable(CAP_WAKE_ALARM) && isalarm(ctx)) {
fdput(f);
return -EPERM;
}
timerfd_setup_cancel(ctx, flags);
/*
* We need to stop the existing timer before reprogramming
* it to the new values.
*/
for (;;) {
spin_lock_irq(&ctx->wqh.lock);
if (isalarm(ctx)) {
if (alarm_try_to_cancel(&ctx->t.alarm) >= 0)
break;
} else {
if (hrtimer_try_to_cancel(&ctx->t.tmr) >= 0)
break;
}
spin_unlock_irq(&ctx->wqh.lock);
cpu_relax();
}
/*
* If the timer is expired and it's periodic, we need to advance it
* because the caller may want to know the previous expiration time.
* We do not update "ticks" and "expired" since the timer will be
* re-programmed again in the following timerfd_setup() call.
*/
if (ctx->expired && ctx->tintv) {
if (isalarm(ctx))
alarm_forward_now(&ctx->t.alarm, ctx->tintv);
else
hrtimer_forward_now(&ctx->t.tmr, ctx->tintv);
}
old->it_value = ktime_to_timespec(timerfd_get_remaining(ctx));
old->it_interval = ktime_to_timespec(ctx->tintv);
/*
* Re-program the timer to the new value ...
*/
ret = timerfd_setup(ctx, flags, new);
spin_unlock_irq(&ctx->wqh.lock);
fdput(f);
return ret;
}
| 1,918 |
30,905 | 0 | static void free_arg_pages(struct linux_binprm *bprm)
{
}
| 1,919 |
112,403 | 0 | void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
Element* newDocumentElement = ElementTraversal::firstWithin(this);
if (newDocumentElement == m_documentElement)
return;
m_documentElement = newDocumentElement;
clearStyleResolver();
}
| 1,920 |
182,538 | 1 | void TEMPLATE(process_block_dec)(decoder_info_t *decoder_info,int size,int yposY,int xposY,int sub)
{
int width = decoder_info->width;
int height = decoder_info->height;
stream_t *stream = decoder_info->stream;
frame_type_t frame_type = decoder_info->frame_info.frame_type;
int split_flag = 0;
if (yposY >= height || xposY >= width)
return;
int decode_this_size = (yposY + size <= height) && (xposY + size <= width);
int decode_rectangular_size = !decode_this_size && frame_type != I_FRAME;
int bit_start = stream->bitcnt;
int mode = MODE_SKIP;
block_context_t block_context;
TEMPLATE(find_block_contexts)(yposY, xposY, height, width, size, decoder_info->deblock_data, &block_context, decoder_info->use_block_contexts);
decoder_info->block_context = &block_context;
split_flag = decode_super_mode(decoder_info,size,decode_this_size);
mode = decoder_info->mode;
/* Read delta_qp and set block-level qp */
if (size == (1<<decoder_info->log2_sb_size) && (split_flag || mode != MODE_SKIP) && decoder_info->max_delta_qp > 0) {
/* Read delta_qp */
int delta_qp = read_delta_qp(stream);
int prev_qp;
if (yposY == 0 && xposY == 0)
prev_qp = decoder_info->frame_info.qp;
else
prev_qp = decoder_info->frame_info.qpb;
decoder_info->frame_info.qpb = prev_qp + delta_qp;
}
decoder_info->bit_count.super_mode[decoder_info->bit_count.stat_frame_type] += (stream->bitcnt - bit_start);
if (split_flag){
int new_size = size/2;
TEMPLATE(process_block_dec)(decoder_info,new_size,yposY+0*new_size,xposY+0*new_size,sub);
TEMPLATE(process_block_dec)(decoder_info,new_size,yposY+1*new_size,xposY+0*new_size,sub);
TEMPLATE(process_block_dec)(decoder_info,new_size,yposY+0*new_size,xposY+1*new_size,sub);
TEMPLATE(process_block_dec)(decoder_info,new_size,yposY+1*new_size,xposY+1*new_size,sub);
}
else if (decode_this_size || decode_rectangular_size){
decode_block(decoder_info,size,yposY,xposY,sub);
}
}
| 1,921 |
113,101 | 0 | void DownloadItemImpl::SetIsTemporary(bool temporary) {
is_temporary_ = temporary;
}
| 1,922 |
109,141 | 0 | void RenderViewImpl::numberOfWheelEventHandlersChanged(unsigned num_handlers) {
Send(new ViewHostMsg_DidChangeNumWheelEvents(routing_id_, num_handlers));
}
| 1,923 |
60,653 | 0 | void sctp_data_ready(struct sock *sk)
{
struct socket_wq *wq;
rcu_read_lock();
wq = rcu_dereference(sk->sk_wq);
if (skwq_has_sleeper(wq))
wake_up_interruptible_sync_poll(&wq->wait, POLLIN |
POLLRDNORM | POLLRDBAND);
sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
rcu_read_unlock();
}
| 1,924 |
118,119 | 0 | WebContents* ChromeWebContentsDelegateAndroid::OpenURLFromTab(
WebContents* source,
const content::OpenURLParams& params) {
WindowOpenDisposition disposition = params.disposition;
if (!source || (disposition != CURRENT_TAB &&
disposition != NEW_FOREGROUND_TAB &&
disposition != NEW_BACKGROUND_TAB &&
disposition != OFF_THE_RECORD &&
disposition != NEW_POPUP &&
disposition != NEW_WINDOW)) {
return WebContentsDelegateAndroid::OpenURLFromTab(source, params);
}
Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext());
chrome::NavigateParams nav_params(profile,
params.url,
params.transition);
FillNavigateParamsFromOpenURLParams(&nav_params, params);
nav_params.source_contents = source;
nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW;
nav_params.user_gesture = params.user_gesture;
PopupBlockerTabHelper* popup_blocker_helper =
PopupBlockerTabHelper::FromWebContents(source);
DCHECK(popup_blocker_helper);
if ((params.disposition == NEW_POPUP ||
params.disposition == NEW_FOREGROUND_TAB ||
params.disposition == NEW_BACKGROUND_TAB ||
params.disposition == NEW_WINDOW) &&
!params.user_gesture &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisablePopupBlocking)) {
if (popup_blocker_helper->MaybeBlockPopup(nav_params,
blink::WebWindowFeatures())) {
return NULL;
}
}
if (disposition == CURRENT_TAB) {
nav_params.target_contents = source;
prerender::PrerenderManager* prerender_manager =
prerender::PrerenderManagerFactory::GetForProfile(profile);
if (prerender_manager &&
prerender_manager->MaybeUsePrerenderedPage(params.url, &nav_params)) {
return nav_params.target_contents;
}
}
return WebContentsDelegateAndroid::OpenURLFromTab(source, params);
}
| 1,925 |
90,750 | 0 | static int mpeg4_decode_studio_mb(MpegEncContext *s, int16_t block_[12][64])
{
int i;
s->dpcm_direction = 0;
/* StudioMacroblock */
/* Assumes I-VOP */
s->mb_intra = 1;
if (get_bits1(&s->gb)) { /* compression_mode */
/* DCT */
/* macroblock_type, 1 or 2-bit VLC */
if (!get_bits1(&s->gb)) {
skip_bits1(&s->gb);
s->qscale = mpeg_get_qscale(s);
}
for (i = 0; i < mpeg4_block_count[s->chroma_format]; i++) {
if (mpeg4_decode_studio_block(s, (*s->block32)[i], i) < 0)
return AVERROR_INVALIDDATA;
}
} else {
/* DPCM */
check_marker(s->avctx, &s->gb, "DPCM block start");
s->dpcm_direction = get_bits1(&s->gb) ? -1 : 1;
for (i = 0; i < 3; i++) {
if (mpeg4_decode_dpcm_macroblock(s, (*s->dpcm_macroblock)[i], i) < 0)
return AVERROR_INVALIDDATA;
}
}
if (get_bits_left(&s->gb) >= 24 && show_bits(&s->gb, 23) == 0) {
next_start_code_studio(&s->gb);
return SLICE_END;
}
if (get_bits_left(&s->gb) == 0)
return SLICE_END;
if (get_bits_left(&s->gb) < 8U && show_bits(&s->gb, get_bits_left(&s->gb)) == 0)
return SLICE_END;
return SLICE_OK;
}
| 1,926 |
188,413 | 1 | bool Block::IsInvisible() const
{
return bool(int(m_flags & 0x08) != 0);
}
| 1,927 |
150,168 | 0 | void StartupBrowserCreator::AddFirstRunTab(const GURL& url) {
first_run_tabs_.push_back(url);
}
| 1,928 |
11,653 | 0 | device_linux_md_expand_authorized_cb (Daemon *daemon,
Device *device,
DBusGMethodInvocation *context,
const gchar *action_id,
guint num_user_data,
gpointer *user_data_elements)
{
gchar **components = user_data_elements[0];
/* TODO: use options */
guint n;
GError *error;
GPtrArray *args;
gint new_num_raid_devices;
gchar *backup_filename;
gchar *md_basename;
error = NULL;
args = g_ptr_array_new_with_free_func (g_free);
g_ptr_array_add (args, g_strdup ("udisks-helper-mdadm-expand"));
g_ptr_array_add (args, g_strdup (device->priv->device_file));
new_num_raid_devices = device->priv->linux_md_num_raid_devices + g_strv_length (components);
g_ptr_array_add (args, g_strdup_printf ("%d", new_num_raid_devices));
/* TODO: choose a better name and better location */
md_basename = g_path_get_basename (device->priv->device_file);
backup_filename = g_strdup_printf ("/root/udisks-mdadm-expand-backup-file-%s-at-%" G_GUINT64_FORMAT,
md_basename,
(guint64) time (NULL));
g_free (md_basename);
g_ptr_array_add (args, backup_filename);
for (n = 0; components != NULL && components[n] != NULL; n++)
{
Device *slave;
slave = daemon_local_find_by_object_path (device->priv->daemon, components[n]);
if (slave == NULL)
{
throw_error (context,
ERROR_FAILED,
"Component with object path %s doesn't exist",
components[n]);
goto out;
}
if (device_local_is_busy (slave, TRUE, &error))
{
dbus_g_method_return_error (context, error);
g_error_free (error);
goto out;
}
g_ptr_array_add (args, g_strdup (slave->priv->device_file));
}
g_ptr_array_add (args, NULL);
if (!job_new (context,
"LinuxMdExpand",
TRUE,
device,
(char **) args->pdata,
NULL,
linux_md_expand_completed_cb,
FALSE,
NULL,
NULL))
{
goto out;
}
out:
g_ptr_array_free (args, TRUE);
}
| 1,929 |
58,653 | 0 | static void security_A(BYTE* master_secret, const BYTE* client_random, BYTE* server_random,
BYTE* output)
{
security_premaster_hash("A", 1, master_secret, client_random, server_random, &output[0]);
security_premaster_hash("BB", 2, master_secret, client_random, server_random, &output[16]);
security_premaster_hash("CCC", 3, master_secret, client_random, server_random, &output[32]);
}
| 1,930 |
63,750 | 0 | static void xen_vbd_resize(struct xen_blkif *blkif)
{
struct xen_vbd *vbd = &blkif->vbd;
struct xenbus_transaction xbt;
int err;
struct xenbus_device *dev = xen_blkbk_xenbus(blkif->be);
unsigned long long new_size = vbd_sz(vbd);
pr_info("VBD Resize: Domid: %d, Device: (%d, %d)\n",
blkif->domid, MAJOR(vbd->pdevice), MINOR(vbd->pdevice));
pr_info("VBD Resize: new size %llu\n", new_size);
vbd->size = new_size;
again:
err = xenbus_transaction_start(&xbt);
if (err) {
pr_warn("Error starting transaction\n");
return;
}
err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu",
(unsigned long long)vbd_sz(vbd));
if (err) {
pr_warn("Error writing new size\n");
goto abort;
}
/*
* Write the current state; we will use this to synchronize
* the front-end. If the current state is "connected" the
* front-end will get the new size information online.
*/
err = xenbus_printf(xbt, dev->nodename, "state", "%d", dev->state);
if (err) {
pr_warn("Error writing the state\n");
goto abort;
}
err = xenbus_transaction_end(xbt, 0);
if (err == -EAGAIN)
goto again;
if (err)
pr_warn("Error ending transaction\n");
return;
abort:
xenbus_transaction_end(xbt, 1);
}
| 1,931 |
94,081 | 0 | int iwl_get_free_ucode_key_offset(struct iwl_priv *priv)
{
int i;
for (i = 0; i < priv->sta_key_max_num; i++)
if (!test_and_set_bit(i, &priv->ucode_key_table))
return i;
return WEP_INVALID_OFFSET;
}
| 1,932 |
92,779 | 0 | static void update_task_scan_period(struct task_struct *p,
unsigned long shared, unsigned long private)
{
unsigned int period_slot;
int lr_ratio, ps_ratio;
int diff;
unsigned long remote = p->numa_faults_locality[0];
unsigned long local = p->numa_faults_locality[1];
/*
* If there were no record hinting faults then either the task is
* completely idle or all activity is areas that are not of interest
* to automatic numa balancing. Related to that, if there were failed
* migration then it implies we are migrating too quickly or the local
* node is overloaded. In either case, scan slower
*/
if (local + shared == 0 || p->numa_faults_locality[2]) {
p->numa_scan_period = min(p->numa_scan_period_max,
p->numa_scan_period << 1);
p->mm->numa_next_scan = jiffies +
msecs_to_jiffies(p->numa_scan_period);
return;
}
/*
* Prepare to scale scan period relative to the current period.
* == NUMA_PERIOD_THRESHOLD scan period stays the same
* < NUMA_PERIOD_THRESHOLD scan period decreases (scan faster)
* >= NUMA_PERIOD_THRESHOLD scan period increases (scan slower)
*/
period_slot = DIV_ROUND_UP(p->numa_scan_period, NUMA_PERIOD_SLOTS);
lr_ratio = (local * NUMA_PERIOD_SLOTS) / (local + remote);
ps_ratio = (private * NUMA_PERIOD_SLOTS) / (private + shared);
if (ps_ratio >= NUMA_PERIOD_THRESHOLD) {
/*
* Most memory accesses are local. There is no need to
* do fast NUMA scanning, since memory is already local.
*/
int slot = ps_ratio - NUMA_PERIOD_THRESHOLD;
if (!slot)
slot = 1;
diff = slot * period_slot;
} else if (lr_ratio >= NUMA_PERIOD_THRESHOLD) {
/*
* Most memory accesses are shared with other tasks.
* There is no point in continuing fast NUMA scanning,
* since other tasks may just move the memory elsewhere.
*/
int slot = lr_ratio - NUMA_PERIOD_THRESHOLD;
if (!slot)
slot = 1;
diff = slot * period_slot;
} else {
/*
* Private memory faults exceed (SLOTS-THRESHOLD)/SLOTS,
* yet they are not on the local NUMA node. Speed up
* NUMA scanning to get the memory moved over.
*/
int ratio = max(lr_ratio, ps_ratio);
diff = -(NUMA_PERIOD_THRESHOLD - ratio) * period_slot;
}
p->numa_scan_period = clamp(p->numa_scan_period + diff,
task_scan_min(p), task_scan_max(p));
memset(p->numa_faults_locality, 0, sizeof(p->numa_faults_locality));
}
| 1,933 |
10,338 | 0 | psh_hint_snap_stem_side_delta( FT_Fixed pos,
FT_Fixed len )
{
FT_Fixed delta1 = FT_PIX_ROUND( pos ) - pos;
FT_Fixed delta2 = FT_PIX_ROUND( pos + len ) - pos - len;
if ( FT_ABS( delta1 ) <= FT_ABS( delta2 ) )
return delta1;
else
return delta2;
}
| 1,934 |
110,827 | 0 | void closeFile(PlatformFileHandle& handle)
{
if (isHandleValid(handle)) {
::CloseHandle(handle);
handle = invalidPlatformFileHandle;
}
}
| 1,935 |
408 | 0 | fz_source_colorspace_cm(fz_context *ctx, const fz_colorspace *cs)
{
while (cs)
{
if (fz_colorspace_is_icc(ctx, cs))
return cs;
if (fz_colorspace_is_cal(ctx, cs))
return cs;
cs = fz_colorspace_base(ctx, cs);
}
return NULL;
}
| 1,936 |
165,962 | 0 | void RTCPeerConnectionHandler::CreateOffer(
const blink::WebRTCSessionDescriptionRequest& request,
const blink::WebRTCOfferOptions& options) {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::createOffer");
scoped_refptr<CreateSessionDescriptionRequest> description_request(
new rtc::RefCountedObject<CreateSessionDescriptionRequest>(
task_runner_, request, weak_factory_.GetWeakPtr(),
peer_connection_tracker_,
PeerConnectionTracker::ACTION_CREATE_OFFER));
webrtc::PeerConnectionInterface::RTCOfferAnswerOptions webrtc_options;
ConvertOfferOptionsToWebrtcOfferOptions(options, &webrtc_options);
native_peer_connection_->CreateOffer(description_request.get(),
webrtc_options);
if (peer_connection_tracker_)
peer_connection_tracker_->TrackCreateOffer(this, options);
}
| 1,937 |
162,053 | 0 | void RenderProcessHostImpl::BindSharedBitmapAllocationNotifier(
viz::mojom::SharedBitmapAllocationNotifierRequest request) {
shared_bitmap_allocation_notifier_impl_.Bind(std::move(request));
}
| 1,938 |
85,047 | 0 | static CURLcode smtp_init(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
struct SMTP *smtp;
smtp = data->req.protop = calloc(sizeof(struct SMTP), 1);
if(!smtp)
result = CURLE_OUT_OF_MEMORY;
return result;
}
| 1,939 |
169,683 | 0 | bool V8ValueConverter::Strategy::FromV8Number(v8::Local<v8::Number> value,
base::Value** out) const {
return false;
}
| 1,940 |
187,795 | 1 | status_t SampleTable::setTimeToSampleParams(
off64_t data_offset, size_t data_size) {
if (!mTimeToSample.empty() || data_size < 8) {
return ERROR_MALFORMED;
}
uint8_t header[8];
if (mDataSource->readAt(
data_offset, header, sizeof(header)) < (ssize_t)sizeof(header)) {
return ERROR_IO;
}
if (U32_AT(header) != 0) {
// Expected version = 0, flags = 0.
return ERROR_MALFORMED;
}
mTimeToSampleCount = U32_AT(&header[4]);
if ((uint64_t)mTimeToSampleCount >
(uint64_t)UINT32_MAX / (2 * sizeof(uint32_t))) {
// Choose this bound because
// 1) 2 * sizeof(uint32_t) is the amount of memory needed for one
// time-to-sample entry in the time-to-sample table.
// 2) mTimeToSampleCount is the number of entries of the time-to-sample
// table.
// 3) We hope that the table size does not exceed UINT32_MAX.
ALOGE(" Error: Time-to-sample table size too large.");
return ERROR_OUT_OF_RANGE;
}
// Note: At this point, we know that mTimeToSampleCount * 2 will not
// overflow because of the above condition.
if (!mDataSource->getVector(data_offset + 8, &mTimeToSample,
mTimeToSampleCount * 2)) {
ALOGE(" Error: Incomplete data read for time-to-sample table.");
return ERROR_IO;
}
for (size_t i = 0; i < mTimeToSample.size(); ++i) {
mTimeToSample.editItemAt(i) = ntohl(mTimeToSample[i]);
}
return OK;
}
| 1,941 |
90,233 | 0 | static inline void ipmi_si_set_not_busy(struct timespec64 *ts)
{
ts->tv_nsec = -1;
}
| 1,942 |
111,235 | 0 | bool WebPage::nodeHasHover(const WebDOMNode& node)
{
if (Node* nodeImpl = node.impl()) {
if (RenderStyle* style = nodeImpl->renderStyle())
return style->affectedByHoverRules();
}
return false;
}
| 1,943 |
133,352 | 0 | void WindowTreeHostManager::CreatePrimaryHost(
const AshWindowTreeHostInitParams& init_params) {
const display::Display& primary_candidate =
GetDisplayManager()->GetPrimaryDisplayCandidate();
primary_display_id = primary_candidate.id();
CHECK_NE(display::Display::kInvalidDisplayID, primary_display_id);
AddWindowTreeHostForDisplay(primary_candidate, init_params);
}
| 1,944 |
83,830 | 0 | mac80211_hwsim_beacon(struct hrtimer *timer)
{
struct mac80211_hwsim_data *data =
container_of(timer, struct mac80211_hwsim_data,
beacon_timer.timer);
struct ieee80211_hw *hw = data->hw;
u64 bcn_int = data->beacon_int;
ktime_t next_bcn;
if (!data->started)
goto out;
ieee80211_iterate_active_interfaces_atomic(
hw, IEEE80211_IFACE_ITER_NORMAL,
mac80211_hwsim_beacon_tx, data);
/* beacon at new TBTT + beacon interval */
if (data->bcn_delta) {
bcn_int -= data->bcn_delta;
data->bcn_delta = 0;
}
next_bcn = ktime_add(hrtimer_get_expires(timer),
ns_to_ktime(bcn_int * 1000));
tasklet_hrtimer_start(&data->beacon_timer, next_bcn, HRTIMER_MODE_ABS);
out:
return HRTIMER_NORESTART;
}
| 1,945 |
76,322 | 0 | xfs_attr_node_get(xfs_da_args_t *args)
{
xfs_da_state_t *state;
xfs_da_state_blk_t *blk;
int error, retval;
int i;
trace_xfs_attr_node_get(args);
state = xfs_da_state_alloc();
state->args = args;
state->mp = args->dp->i_mount;
/*
* Search to see if name exists, and get back a pointer to it.
*/
error = xfs_da3_node_lookup_int(state, &retval);
if (error) {
retval = error;
} else if (retval == -EEXIST) {
blk = &state->path.blk[ state->path.active-1 ];
ASSERT(blk->bp != NULL);
ASSERT(blk->magic == XFS_ATTR_LEAF_MAGIC);
/*
* Get the value, local or "remote"
*/
retval = xfs_attr3_leaf_getvalue(blk->bp, args);
if (!retval && (args->rmtblkno > 0)
&& !(args->flags & ATTR_KERNOVAL)) {
retval = xfs_attr_rmtval_get(args);
}
}
/*
* If not in a transaction, we have to release all the buffers.
*/
for (i = 0; i < state->path.active; i++) {
xfs_trans_brelse(args->trans, state->path.blk[i].bp);
state->path.blk[i].bp = NULL;
}
xfs_da_state_free(state);
return retval;
}
| 1,946 |
175,278 | 0 | dispatchSIM_APDU (Parcel &p, RequestInfo *pRI) {
int32_t t;
status_t status;
RIL_SIM_APDU apdu;
#if VDBG
RLOGD("dispatchSIM_APDU");
#endif
memset (&apdu, 0, sizeof(RIL_SIM_APDU));
status = p.readInt32(&t);
apdu.sessionid = (int)t;
status = p.readInt32(&t);
apdu.cla = (int)t;
status = p.readInt32(&t);
apdu.instruction = (int)t;
status = p.readInt32(&t);
apdu.p1 = (int)t;
status = p.readInt32(&t);
apdu.p2 = (int)t;
status = p.readInt32(&t);
apdu.p3 = (int)t;
apdu.data = strdupReadString(p);
startRequest;
appendPrintBuf("%ssessionid=%d,cla=%d,ins=%d,p1=%d,p2=%d,p3=%d,data=%s",
printBuf, apdu.sessionid, apdu.cla, apdu.instruction, apdu.p1, apdu.p2,
apdu.p3, (char*)apdu.data);
closeRequest;
printRequest(pRI->token, pRI->pCI->requestNumber);
if (status != NO_ERROR) {
goto invalid;
}
CALL_ONREQUEST(pRI->pCI->requestNumber, &apdu, sizeof(RIL_SIM_APDU), pRI, pRI->socket_id);
#ifdef MEMSET_FREED
memsetString(apdu.data);
#endif
free(apdu.data);
#ifdef MEMSET_FREED
memset(&apdu, 0, sizeof(RIL_SIM_APDU));
#endif
return;
invalid:
invalidCommandBlock(pRI);
return;
}
| 1,947 |
116,060 | 0 | ExtensionSettingsHandler::GetExtensionUninstallDialog() {
if (!extension_uninstall_dialog_.get()) {
extension_uninstall_dialog_.reset(
ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui()), this));
}
return extension_uninstall_dialog_.get();
}
| 1,948 |
70,150 | 0 | static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteByte(uint8 value)
{
if (value>0x7F)
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);
}
| 1,949 |
49,472 | 0 | int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
const char *mod_name)
{
int ret;
hdrv->driver.name = hdrv->name;
hdrv->driver.bus = &hid_bus_type;
hdrv->driver.owner = owner;
hdrv->driver.mod_name = mod_name;
INIT_LIST_HEAD(&hdrv->dyn_list);
spin_lock_init(&hdrv->dyn_lock);
ret = driver_register(&hdrv->driver);
if (ret)
return ret;
ret = driver_create_file(&hdrv->driver, &driver_attr_new_id);
if (ret)
driver_unregister(&hdrv->driver);
return ret;
}
| 1,950 |
157,838 | 0 | void WebContentsImpl::RenderWidgetGotFocus(
RenderWidgetHostImpl* render_widget_host) {
if (delegate_ && render_widget_host && delegate_->EmbedsFullscreenWidget() &&
render_widget_host->GetView() == GetFullscreenRenderWidgetHostView()) {
NotifyWebContentsFocused(render_widget_host);
}
}
| 1,951 |
117,800 | 0 | void V8TestObj::derefObject(void* object)
{
static_cast<TestObj*>(object)->deref();
}
| 1,952 |
99,759 | 0 | void UpdateProcessTypeToGpuBroker() {
base::CommandLine::StringVector exec =
base::CommandLine::ForCurrentProcess()->GetArgs();
base::CommandLine::Reset();
base::CommandLine::Init(0, NULL);
base::CommandLine::ForCurrentProcess()->InitFromArgv(exec);
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kProcessType, "gpu-broker");
SetProcessTitleFromCommandLine(NULL);
}
| 1,953 |
154,564 | 0 | error::Error GLES2DecoderPassthroughImpl::DoBindFragmentInputLocationCHROMIUM(
GLuint program,
GLint location,
const char* name) {
NOTIMPLEMENTED();
return error::kNoError;
}
| 1,954 |
68,737 | 0 | size_t iov_iter_copy_from_user_atomic(struct page *page,
struct iov_iter *i, unsigned long offset, size_t bytes)
{
char *kaddr = kmap_atomic(page), *p = kaddr + offset;
if (unlikely(i->type & ITER_PIPE)) {
kunmap_atomic(kaddr);
WARN_ON(1);
return 0;
}
iterate_all_kinds(i, bytes, v,
__copy_from_user_inatomic((p += v.iov_len) - v.iov_len,
v.iov_base, v.iov_len),
memcpy_from_page((p += v.bv_len) - v.bv_len, v.bv_page,
v.bv_offset, v.bv_len),
memcpy((p += v.iov_len) - v.iov_len, v.iov_base, v.iov_len)
)
kunmap_atomic(kaddr);
return bytes;
}
| 1,955 |
90,955 | 0 | void btreeFree(struct BTREE *btree) {
free(btree->records);
}
| 1,956 |
75,893 | 0 | free_parent_mallocs_startup(bool am_child)
{
if (am_child) {
#if HAVE_DECL_CLONE_NEWNET
free_dirname();
#endif
#ifndef _MEM_CHECK_LOG_
FREE_PTR(syslog_ident);
#else
free(syslog_ident);
#endif
syslog_ident = NULL;
FREE_PTR(orig_core_dump_pattern);
}
if (free_main_pidfile) {
FREE_PTR(main_pidfile);
free_main_pidfile = false;
}
}
| 1,957 |
81,723 | 0 | static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
int16_t *block, int n, int qscale)
{
int i, level, nCoeffs;
const uint16_t *quant_matrix;
int sum=-1;
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
else qscale <<= 1;
if(s->alternate_scan) nCoeffs= 63;
else nCoeffs= s->block_last_index[n];
quant_matrix = s->inter_matrix;
for(i=0; i<=nCoeffs; i++) {
int j= s->intra_scantable.permutated[i];
level = block[j];
if (level) {
if (level < 0) {
level = -level;
level = (((level << 1) + 1) * qscale *
((int) (quant_matrix[j]))) >> 5;
level = -level;
} else {
level = (((level << 1) + 1) * qscale *
((int) (quant_matrix[j]))) >> 5;
}
block[j] = level;
sum+=level;
}
}
block[63]^=sum&1;
}
| 1,958 |
179,718 | 1 | static int init_nss_hash(struct crypto_instance *instance)
{
PK11SlotInfo* hash_slot = NULL;
SECItem hash_param;
if (!hash_to_nss[instance->crypto_hash_type]) {
return 0;
}
hash_param.type = siBuffer;
hash_param.data = 0;
hash_param.len = 0;
hash_slot = PK11_GetBestSlot(hash_to_nss[instance->crypto_hash_type], NULL);
if (hash_slot == NULL) {
log_printf(instance->log_level_security, "Unable to find security slot (err %d)",
PR_GetError());
return -1;
}
instance->nss_sym_key_sign = PK11_ImportSymKey(hash_slot,
hash_to_nss[instance->crypto_hash_type],
PK11_OriginUnwrap, CKA_SIGN,
&hash_param, NULL);
if (instance->nss_sym_key_sign == NULL) {
log_printf(instance->log_level_security, "Failure to import key into NSS (err %d)",
PR_GetError());
return -1;
}
PK11_FreeSlot(hash_slot);
return 0;
}
| 1,959 |
55,929 | 0 | const char *tty_name(const struct tty_struct *tty)
{
if (!tty) /* Hmm. NULL pointer. That's fun. */
return "NULL tty";
return tty->name;
}
| 1,960 |
151,856 | 0 | BrowserViewHostedAppTest()
: TestWithBrowserView(Browser::TYPE_POPUP,
BrowserWithTestWindowTest::HostedApp()) {}
| 1,961 |
183,820 | 1 | void MockWebRTCPeerConnectionHandler::setRemoteDescription(const WebRTCVoidRequest& request, const WebRTCSessionDescriptionDescriptor& remoteDescription)
{
if (!remoteDescription.isNull() && remoteDescription.type() == "answer") {
m_remoteDescription = remoteDescription;
postTask(new RTCVoidRequestTask(this, request, true));
} else
postTask(new RTCVoidRequestTask(this, request, false));
}
| 1,962 |
15,804 | 0 | int ssl_cert_type(X509 *x, EVP_PKEY *pkey)
{
EVP_PKEY *pk;
int ret= -1,i;
if (pkey == NULL)
pk=X509_get_pubkey(x);
else
pk=pkey;
if (pk == NULL) goto err;
i=pk->type;
if (i == EVP_PKEY_RSA)
{
ret=SSL_PKEY_RSA_ENC;
}
else if (i == EVP_PKEY_DSA)
{
ret=SSL_PKEY_DSA_SIGN;
}
#ifndef OPENSSL_NO_EC
else if (i == EVP_PKEY_EC)
{
ret = SSL_PKEY_ECC;
}
#endif
else if (i == NID_id_GostR3410_94 || i == NID_id_GostR3410_94_cc)
{
ret = SSL_PKEY_GOST94;
}
else if (i == NID_id_GostR3410_2001 || i == NID_id_GostR3410_2001_cc)
{
ret = SSL_PKEY_GOST01;
}
err:
if(!pkey) EVP_PKEY_free(pk);
return(ret);
}
| 1,963 |
162,098 | 0 | SiteProcessMap* GetSiteProcessMapForBrowserContext(BrowserContext* context) {
DCHECK(context);
SiteProcessMap* map = static_cast<SiteProcessMap*>(
context->GetUserData(kSiteProcessMapKeyName));
if (!map) {
map = new SiteProcessMap();
context->SetUserData(kSiteProcessMapKeyName, base::WrapUnique(map));
}
return map;
}
| 1,964 |
133,925 | 0 | void AppListControllerDelegate::OnCloseChildDialog() {
}
| 1,965 |
102,784 | 0 | virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
{
m_numDraws++;
if (!impl->sourceFrameNumber())
endTest();
}
| 1,966 |
52,625 | 0 | ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
{
ppp_recv_lock(ppp);
if (!ppp->closing)
ppp_receive_frame(ppp, skb, pch);
else
kfree_skb(skb);
ppp_recv_unlock(ppp);
}
| 1,967 |
158,990 | 0 | bool PDFiumEngine::OnMouseUp(const pp::MouseInputEvent& event) {
if (event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_LEFT &&
event.GetButton() != PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) {
return false;
}
if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT)
SetMouseLeftButtonDown(false);
int page_index = -1;
int char_index = -1;
int form_type = FPDF_FORMFIELD_UNKNOWN;
PDFiumPage::LinkTarget target;
pp::Point point = event.GetPosition();
PDFiumPage::Area area =
GetCharIndex(point, &page_index, &char_index, &form_type, &target);
if (mouse_down_state_.Matches(area, target)) {
if (area == PDFiumPage::WEBLINK_AREA) {
uint32_t modifiers = event.GetModifiers();
bool middle_button =
!!(modifiers & PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN);
bool alt_key = !!(modifiers & PP_INPUTEVENT_MODIFIER_ALTKEY);
bool ctrl_key = !!(modifiers & PP_INPUTEVENT_MODIFIER_CONTROLKEY);
bool meta_key = !!(modifiers & PP_INPUTEVENT_MODIFIER_METAKEY);
bool shift_key = !!(modifiers & PP_INPUTEVENT_MODIFIER_SHIFTKEY);
WindowOpenDisposition disposition = ui::DispositionFromClick(
middle_button, alt_key, ctrl_key, meta_key, shift_key);
client_->NavigateTo(target.url, disposition);
SetInFormTextArea(false);
return true;
}
if (area == PDFiumPage::DOCLINK_AREA) {
pp::Rect page_rect(GetPageScreenRect(target.page));
int y = position_.y() + page_rect.y();
if (target.y_in_pixels)
y += target.y_in_pixels.value() * current_zoom_;
client_->ScrollToY(y, /*compensate_for_toolbar=*/true);
SetInFormTextArea(false);
return true;
}
}
if (event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE)
return false;
if (page_index != -1) {
double page_x;
double page_y;
DeviceToPage(page_index, point.x(), point.y(), &page_x, &page_y);
FORM_OnLButtonUp(form_, pages_[page_index]->GetPage(), 0, page_x, page_y);
}
if (!selecting_)
return false;
SetSelecting(false);
return true;
}
| 1,968 |
157,025 | 0 | void MultibufferDataSource::CreateResourceLoader(int64_t first_byte_position,
int64_t last_byte_position) {
DCHECK(render_task_runner_->BelongsToCurrentThread());
SetReader(new MultiBufferReader(
url_data()->multibuffer(), first_byte_position, last_byte_position,
base::Bind(&MultibufferDataSource::ProgressCallback, weak_ptr_)));
reader_->SetIsClientAudioElement(is_client_audio_element_);
UpdateBufferSizes();
}
| 1,969 |
142,044 | 0 | CGaiaCredentialBase::CGaiaCredentialBase() {}
| 1,970 |
65,400 | 0 | access_permit_write(struct nfs4_ol_stateid *stp)
{
return test_access(NFS4_SHARE_ACCESS_WRITE, stp) ||
test_access(NFS4_SHARE_ACCESS_BOTH, stp);
}
| 1,971 |
97,768 | 0 | xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs) {
CHECK_ARITY(0);
if (ctxt->context->proximityPosition >= 0) {
valuePush(ctxt,
xmlXPathCacheNewFloat(ctxt->context,
(double) ctxt->context->proximityPosition));
#ifdef DEBUG_EXPR
xmlGenericError(xmlGenericErrorContext, "position() : %d\n",
ctxt->context->proximityPosition);
#endif
} else {
XP_ERROR(XPATH_INVALID_CTXT_POSITION);
}
}
| 1,972 |
151,187 | 0 | void InspectorNetworkAgent::GetResponseBodyBlob(
const String& request_id,
std::unique_ptr<GetResponseBodyCallback> callback) {
NetworkResourcesData::ResourceData const* resource_data =
resources_data_->Data(request_id);
BlobDataHandle* blob = resource_data->DownloadedFileBlob();
InspectorFileReaderLoaderClient* client = new InspectorFileReaderLoaderClient(
blob, resource_data->MimeType(), resource_data->TextEncodingName(),
std::move(callback));
if (worker_global_scope_) {
client->Start(worker_global_scope_);
return;
}
DCHECK(inspected_frames_);
LocalFrame* frame = IdentifiersFactory::FrameById(inspected_frames_,
resource_data->FrameId());
Document* document = frame->GetDocument();
client->Start(document);
}
| 1,973 |
129,393 | 0 | error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket(
uint32 immediate_data_size, const cmds::BindAttribLocationBucket& c) {
GLuint program = static_cast<GLuint>(c.program);
GLuint index = static_cast<GLuint>(c.index);
Bucket* bucket = GetBucket(c.name_bucket_id);
if (!bucket || bucket->size() == 0) {
return error::kInvalidArguments;
}
std::string name_str;
if (!bucket->GetAsString(&name_str)) {
return error::kInvalidArguments;
}
DoBindAttribLocation(program, index, name_str.c_str());
return error::kNoError;
}
| 1,974 |
45,631 | 0 | static void cryptd_aead_exit_tfm(struct crypto_tfm *tfm)
{
struct cryptd_aead_ctx *ctx = crypto_tfm_ctx(tfm);
crypto_free_aead(ctx->child);
}
| 1,975 |
150,995 | 0 | base::string16 DevToolsConfirmInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
IDS_DEV_TOOLS_CONFIRM_ALLOW_BUTTON : IDS_DEV_TOOLS_CONFIRM_DENY_BUTTON);
}
| 1,976 |
165,819 | 0 | void SVGElement::RemovedFrom(ContainerNode& root_parent) {
bool was_in_document = root_parent.isConnected();
if (was_in_document && HasRelativeLengths()) {
if (root_parent.IsSVGElement() && !parentNode()) {
DCHECK(ToSVGElement(root_parent)
.elements_with_relative_lengths_.Contains(this));
ToSVGElement(root_parent).UpdateRelativeLengthsInformation(false, this);
}
elements_with_relative_lengths_.clear();
}
SECURITY_DCHECK(!root_parent.IsSVGElement() ||
!ToSVGElement(root_parent)
.elements_with_relative_lengths_.Contains(this));
Element::RemovedFrom(root_parent);
if (was_in_document) {
RebuildAllIncomingReferences();
RemoveAllIncomingReferences();
}
InvalidateInstances();
}
| 1,977 |
27,324 | 0 | static bool ldm_parse_tocblock (const u8 *data, struct tocblock *toc)
{
BUG_ON (!data || !toc);
if (MAGIC_TOCBLOCK != get_unaligned_be64(data)) {
ldm_crit ("Cannot find TOCBLOCK, database may be corrupt.");
return false;
}
strncpy (toc->bitmap1_name, data + 0x24, sizeof (toc->bitmap1_name));
toc->bitmap1_name[sizeof (toc->bitmap1_name) - 1] = 0;
toc->bitmap1_start = get_unaligned_be64(data + 0x2E);
toc->bitmap1_size = get_unaligned_be64(data + 0x36);
if (strncmp (toc->bitmap1_name, TOC_BITMAP1,
sizeof (toc->bitmap1_name)) != 0) {
ldm_crit ("TOCBLOCK's first bitmap is '%s', should be '%s'.",
TOC_BITMAP1, toc->bitmap1_name);
return false;
}
strncpy (toc->bitmap2_name, data + 0x46, sizeof (toc->bitmap2_name));
toc->bitmap2_name[sizeof (toc->bitmap2_name) - 1] = 0;
toc->bitmap2_start = get_unaligned_be64(data + 0x50);
toc->bitmap2_size = get_unaligned_be64(data + 0x58);
if (strncmp (toc->bitmap2_name, TOC_BITMAP2,
sizeof (toc->bitmap2_name)) != 0) {
ldm_crit ("TOCBLOCK's second bitmap is '%s', should be '%s'.",
TOC_BITMAP2, toc->bitmap2_name);
return false;
}
ldm_debug ("Parsed TOCBLOCK successfully.");
return true;
}
| 1,978 |
47,447 | 0 | static void __exit padlock_fini(void)
{
struct cpuinfo_x86 *c = &cpu_data(0);
if (c->x86_model >= 0x0f) {
crypto_unregister_shash(&sha1_alg_nano);
crypto_unregister_shash(&sha256_alg_nano);
} else {
crypto_unregister_shash(&sha1_alg);
crypto_unregister_shash(&sha256_alg);
}
}
| 1,979 |
33,824 | 0 | static int vq_memory_access_ok(void __user *log_base, struct vhost_memory *mem,
int log_all)
{
int i;
if (!mem)
return 0;
for (i = 0; i < mem->nregions; ++i) {
struct vhost_memory_region *m = mem->regions + i;
unsigned long a = m->userspace_addr;
if (m->memory_size > ULONG_MAX)
return 0;
else if (!access_ok(VERIFY_WRITE, (void __user *)a,
m->memory_size))
return 0;
else if (log_all && !log_access_ok(log_base,
m->guest_phys_addr,
m->memory_size))
return 0;
}
return 1;
}
| 1,980 |
53,448 | 0 | void warning(char *str)
{
fprintf(stderr, "warning: %s\n", str);
}
| 1,981 |
19,272 | 0 | static inline struct netlink_sock *nlk_sk(struct sock *sk)
{
return container_of(sk, struct netlink_sock, sk);
}
| 1,982 |
182,500 | 1 | ptaReadStream(FILE *fp)
{
char typestr[128];
l_int32 i, n, ix, iy, type, version;
l_float32 x, y;
PTA *pta;
PROCNAME("ptaReadStream");
if (!fp)
return (PTA *)ERROR_PTR("stream not defined", procName, NULL);
if (fscanf(fp, "\n Pta Version %d\n", &version) != 1)
return (PTA *)ERROR_PTR("not a pta file", procName, NULL);
if (version != PTA_VERSION_NUMBER)
return (PTA *)ERROR_PTR("invalid pta version", procName, NULL);
if (fscanf(fp, " Number of pts = %d; format = %s\n", &n, typestr) != 2)
return (PTA *)ERROR_PTR("not a pta file", procName, NULL);
if (!strcmp(typestr, "float"))
type = 0;
else /* typestr is "integer" */
type = 1;
if ((pta = ptaCreate(n)) == NULL)
return (PTA *)ERROR_PTR("pta not made", procName, NULL);
for (i = 0; i < n; i++) {
if (type == 0) { /* data is float */
if (fscanf(fp, " (%f, %f)\n", &x, &y) != 2) {
ptaDestroy(&pta);
return (PTA *)ERROR_PTR("error reading floats", procName, NULL);
}
ptaAddPt(pta, x, y);
} else { /* data is integer */
if (fscanf(fp, " (%d, %d)\n", &ix, &iy) != 2) {
ptaDestroy(&pta);
return (PTA *)ERROR_PTR("error reading ints", procName, NULL);
}
ptaAddPt(pta, ix, iy);
}
}
return pta;
}
| 1,983 |
78,272 | 0 | coolkey_attribute_start(const u8 *obj, u8 object_record_type, size_t buf_len)
{
size_t offset = object_record_type == COOLKEY_V1_OBJECT ? sizeof(coolkey_object_header_t) :
sizeof(coolkey_v0_object_header_t);
if ((object_record_type != COOLKEY_V1_OBJECT) && (object_record_type != COOLKEY_V0_OBJECT)) {
return NULL;
}
if (offset > buf_len) {
return NULL;
}
return obj + offset;
}
| 1,984 |
160,451 | 0 | void RenderFrameHostImpl::JavaScriptDialogClosed(
IPC::Message* reply_msg,
bool success,
const base::string16& user_input) {
GetProcess()->SetIgnoreInputEvents(false);
SendJavaScriptDialogReply(reply_msg, success, user_input);
for (RenderFrameHostImpl* frame = this; frame; frame = frame->GetParent()) {
if (frame->is_waiting_for_beforeunload_ack_ &&
frame->beforeunload_timeout_) {
frame->beforeunload_timeout_->Start(
TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
}
}
}
| 1,985 |
61,782 | 0 | static struct segment *current_segment(struct playlist *pls)
{
return pls->segments[pls->cur_seq_no - pls->start_seq_no];
}
| 1,986 |
154,260 | 0 | error::Error GLES2DecoderImpl::HandleMultiDrawElementsInstancedCHROMIUM(
uint32_t immediate_data_size,
const volatile void* cmd_data) {
const volatile gles2::cmds::MultiDrawElementsInstancedCHROMIUM& c =
*static_cast<
const volatile gles2::cmds::MultiDrawElementsInstancedCHROMIUM*>(
cmd_data);
if (!features().webgl_multi_draw_instanced) {
return error::kUnknownCommand;
}
GLenum mode = static_cast<GLenum>(c.mode);
GLenum type = static_cast<GLenum>(c.type);
GLsizei drawcount = static_cast<GLsizei>(c.drawcount);
uint32_t counts_size, offsets_size, instance_counts_size;
base::CheckedNumeric<uint32_t> checked_size(drawcount);
if (!(checked_size * sizeof(GLsizei)).AssignIfValid(&counts_size)) {
return error::kOutOfBounds;
}
if (!(checked_size * sizeof(GLsizei)).AssignIfValid(&offsets_size)) {
return error::kOutOfBounds;
}
if (!(checked_size * sizeof(GLsizei)).AssignIfValid(&instance_counts_size)) {
return error::kOutOfBounds;
}
const GLsizei* counts = GetSharedMemoryAs<const GLsizei*>(
c.counts_shm_id, c.counts_shm_offset, counts_size);
const GLsizei* offsets = GetSharedMemoryAs<const GLsizei*>(
c.offsets_shm_id, c.offsets_shm_offset, offsets_size);
const GLsizei* instance_counts = GetSharedMemoryAs<const GLsizei*>(
c.instance_counts_shm_id, c.instance_counts_shm_offset,
instance_counts_size);
if (counts == nullptr) {
return error::kOutOfBounds;
}
if (offsets == nullptr) {
return error::kOutOfBounds;
}
if (instance_counts == nullptr) {
return error::kOutOfBounds;
}
if (!multi_draw_manager_->MultiDrawElementsInstanced(
mode, counts, type, offsets, instance_counts, drawcount)) {
return error::kInvalidArguments;
}
return error::kNoError;
}
| 1,987 |
16,684 | 0 | static void cirrus_vga_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->realize = pci_cirrus_vga_realize;
k->romfile = VGABIOS_CIRRUS_FILENAME;
k->vendor_id = PCI_VENDOR_ID_CIRRUS;
k->device_id = CIRRUS_ID_CLGD5446;
k->class_id = PCI_CLASS_DISPLAY_VGA;
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->desc = "Cirrus CLGD 54xx VGA";
dc->vmsd = &vmstate_pci_cirrus_vga;
dc->props = pci_vga_cirrus_properties;
dc->hotpluggable = false;
}
| 1,988 |
150,525 | 0 | void ResetMonitoredUrls() {
base::AutoLock lock(lock_);
monitored_urls_.clear();
}
| 1,989 |
107,481 | 0 | static Eina_Bool _ewk_view_smart_enable_render(Ewk_View_Smart_Data* smartData)
{
WRN("not supported by engine. smartData=%p", smartData);
return false;
}
| 1,990 |
45,719 | 0 | static void eseqiv_free(struct crypto_instance *inst)
{
skcipher_geniv_free(inst);
crypto_put_default_rng();
}
| 1,991 |
4,500 | 0 | PHP_FUNCTION(openssl_csr_sign)
{
zval * zcert = NULL, *zcsr, *zpkey, *args = NULL;
zend_long num_days;
zend_long serial = Z_L(0);
X509 * cert = NULL, *new_cert = NULL;
X509_REQ * csr;
EVP_PKEY * key = NULL, *priv_key = NULL;
zend_resource *csr_resource, *certresource = NULL, *keyresource = NULL;
int i;
struct php_x509_request req;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz!zl|a!l", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE)
return;
RETVAL_FALSE;
PHP_SSL_REQ_INIT(&req);
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
if (csr == NULL) {
php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
return;
}
if (zcert) {
cert = php_openssl_x509_from_zval(zcert, 0, &certresource);
if (cert == NULL) {
php_error_docref(NULL, E_WARNING, "cannot get cert from parameter 2");
goto cleanup;
}
}
priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource);
if (priv_key == NULL) {
php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
goto cleanup;
}
if (cert && !X509_check_private_key(cert, priv_key)) {
php_error_docref(NULL, E_WARNING, "private key does not correspond to signing cert");
goto cleanup;
}
if (PHP_SSL_REQ_PARSE(&req, args) == FAILURE) {
goto cleanup;
}
/* Check that the request matches the signature */
key = X509_REQ_get_pubkey(csr);
if (key == NULL) {
php_error_docref(NULL, E_WARNING, "error unpacking public key");
goto cleanup;
}
i = X509_REQ_verify(csr, key);
if (i < 0) {
php_error_docref(NULL, E_WARNING, "Signature verification problems");
goto cleanup;
}
else if (i == 0) {
php_error_docref(NULL, E_WARNING, "Signature did not match the certificate request");
goto cleanup;
}
/* Now we can get on with it */
new_cert = X509_new();
if (new_cert == NULL) {
php_error_docref(NULL, E_WARNING, "No memory");
goto cleanup;
}
/* Version 3 cert */
if (!X509_set_version(new_cert, 2))
goto cleanup;
ASN1_INTEGER_set(X509_get_serialNumber(new_cert), (long)serial);
X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr));
if (cert == NULL) {
cert = new_cert;
}
if (!X509_set_issuer_name(new_cert, X509_get_subject_name(cert))) {
goto cleanup;
}
X509_gmtime_adj(X509_get_notBefore(new_cert), 0);
X509_gmtime_adj(X509_get_notAfter(new_cert), 60*60*24*(long)num_days);
i = X509_set_pubkey(new_cert, key);
if (!i) {
goto cleanup;
}
if (req.extensions_section) {
X509V3_CTX ctx;
X509V3_set_ctx(&ctx, cert, new_cert, csr, NULL, 0);
X509V3_set_conf_lhash(&ctx, req.req_config);
if (!X509V3_EXT_add_conf(req.req_config, &ctx, req.extensions_section, new_cert)) {
goto cleanup;
}
}
/* Now sign it */
if (!X509_sign(new_cert, priv_key, req.digest)) {
php_error_docref(NULL, E_WARNING, "failed to sign it");
goto cleanup;
}
/* Succeeded; lets return the cert */
ZVAL_RES(return_value, zend_register_resource(new_cert, le_x509));
new_cert = NULL;
cleanup:
if (cert == new_cert) {
cert = NULL;
}
PHP_SSL_REQ_DISPOSE(&req);
if (keyresource == NULL && priv_key) {
EVP_PKEY_free(priv_key);
}
if (key) {
EVP_PKEY_free(key);
}
if (csr_resource == NULL && csr) {
X509_REQ_free(csr);
}
if (zcert && certresource == NULL && cert) {
X509_free(cert);
}
if (new_cert) {
X509_free(new_cert);
}
}
| 1,992 |
107,951 | 0 | void ConfirmInfoBar::Layout() {
InfoBar::Layout();
int available_width = AlertInfoBar::GetAvailableWidth();
int ok_button_width = 0;
int cancel_button_width = 0;
gfx::Size ok_ps = ok_button_->GetPreferredSize();
gfx::Size cancel_ps = cancel_button_->GetPreferredSize();
if (GetDelegate()->GetButtons() & ConfirmInfoBarDelegate::BUTTON_OK) {
ok_button_width = ok_ps.width();
} else {
ok_button_->SetVisible(false);
}
if (GetDelegate()->GetButtons() & ConfirmInfoBarDelegate::BUTTON_CANCEL) {
cancel_button_width = cancel_ps.width();
} else {
cancel_button_->SetVisible(false);
}
cancel_button_->SetBounds(available_width - cancel_button_width,
OffsetY(this, cancel_ps), cancel_ps.width(),
cancel_ps.height());
int spacing = cancel_button_width > 0 ? kButtonButtonSpacing : 0;
ok_button_->SetBounds(cancel_button_->x() - spacing - ok_button_width,
OffsetY(this, ok_ps), ok_ps.width(), ok_ps.height());
AlertInfoBar::Layout();
link_->SetVisible(!link_->GetText().empty());
gfx::Size link_ps = link_->GetPreferredSize();
int link_x = label()->bounds().right() + kEndOfLabelSpacing;
int link_w = std::min(GetAvailableWidth() - link_x, link_ps.width());
link_->SetBounds(link_x, OffsetY(this, link_ps), link_w, link_ps.height());
}
| 1,993 |
55,326 | 0 | static s32 atl2_read_mac_addr(struct atl2_hw *hw)
{
if (get_permanent_address(hw)) {
/* for test */
/* FIXME: shouldn't we use eth_random_addr() here? */
hw->perm_mac_addr[0] = 0x00;
hw->perm_mac_addr[1] = 0x13;
hw->perm_mac_addr[2] = 0x74;
hw->perm_mac_addr[3] = 0x00;
hw->perm_mac_addr[4] = 0x5c;
hw->perm_mac_addr[5] = 0x38;
}
memcpy(hw->mac_addr, hw->perm_mac_addr, ETH_ALEN);
return 0;
}
| 1,994 |
173,326 | 0 | type_sep(FILE *out)
{
putc(':', out);
putc(' ', out);
}
| 1,995 |
162,829 | 0 | void ContextState::SetWindowRectangles(GLenum mode,
size_t count,
const volatile GLint* box) {
window_rectangles_mode = mode;
num_window_rectangles = count;
DCHECK_LE(count, GetMaxWindowRectangles());
if (count) {
std::copy(box, &box[count * 4], window_rectangles_.begin());
}
}
| 1,996 |
47,037 | 0 | static int __init sha1_ssse3_mod_init(void)
{
char *algo_name;
/* test for SSSE3 first */
if (cpu_has_ssse3) {
sha1_transform_asm = sha1_transform_ssse3;
algo_name = "SSSE3";
}
#ifdef CONFIG_AS_AVX
/* allow AVX to override SSSE3, it's a little faster */
if (avx_usable()) {
sha1_transform_asm = sha1_transform_avx;
algo_name = "AVX";
#ifdef CONFIG_AS_AVX2
/* allow AVX2 to override AVX, it's a little faster */
if (avx2_usable()) {
sha1_transform_asm = sha1_apply_transform_avx2;
algo_name = "AVX2";
}
#endif
}
#endif
if (sha1_transform_asm) {
pr_info("Using %s optimized SHA-1 implementation\n", algo_name);
return crypto_register_shash(&alg);
}
pr_info("Neither AVX nor AVX2 nor SSSE3 is available/usable.\n");
return -ENODEV;
}
| 1,997 |
115,361 | 0 | WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForNewWindowAction(WKBundlePageRef, WKBundleFrameRef, WKBundleNavigationActionRef, WKURLRequestRef, WKStringRef, WKTypeRef*)
{
return WKBundlePagePolicyActionUse;
}
| 1,998 |
84,328 | 0 | UNCURL_EXPORT void uncurl_free_tls_ctx(struct uncurl_tls_ctx *uc_tls)
{
if (!uc_tls) return;
tlss_free(uc_tls->tlss);
free(uc_tls);
}
| 1,999 |
Subsets and Splits