unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
86,116 | 0 | int mbedtls_ssl_set_client_transport_id( mbedtls_ssl_context *ssl,
const unsigned char *info,
size_t ilen )
{
if( ssl->conf->endpoint != MBEDTLS_SSL_IS_SERVER )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
mbedtls_free( ssl->cli_id );
if( ( ssl->cli_id = mbedtls_calloc( 1, ilen ) ) == NULL )
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
memcpy( ssl->cli_id, info, ilen );
ssl->cli_id_len = ilen;
return( 0 );
}
| 9,300 |
142,703 | 0 | ResourceRequest FrameLoader::resourceRequestForReload(FrameLoadType frameLoadType,
const KURL& overrideURL, ClientRedirectPolicy clientRedirectPolicy)
{
ASSERT(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadMainResource || frameLoadType == FrameLoadTypeReloadBypassingCache);
WebCachePolicy cachePolicy = frameLoadType == FrameLoadTypeReloadBypassingCache ? WebCachePolicy::BypassingCache : WebCachePolicy::ValidatingCacheData;
if (!m_currentItem)
return ResourceRequest();
ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get(), cachePolicy);
if (clientRedirectPolicy == ClientRedirectPolicy::ClientRedirect) {
request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer(),
m_frame->document()->getReferrerPolicy()));
}
if (!overrideURL.isEmpty()) {
request.setURL(overrideURL);
request.clearHTTPReferrer();
}
request.setSkipServiceWorker(frameLoadType == FrameLoadTypeReloadBypassingCache);
return request;
}
| 9,301 |
38,491 | 0 | static void cma_leave_mc_groups(struct rdma_id_private *id_priv)
{
struct cma_multicast *mc;
while (!list_empty(&id_priv->mc_list)) {
mc = container_of(id_priv->mc_list.next,
struct cma_multicast, list);
list_del(&mc->list);
switch (rdma_port_get_link_layer(id_priv->cma_dev->device, id_priv->id.port_num)) {
case IB_LINK_LAYER_INFINIBAND:
ib_sa_free_multicast(mc->multicast.ib);
kfree(mc);
break;
case IB_LINK_LAYER_ETHERNET:
kref_put(&mc->mcref, release_mc);
break;
default:
break;
}
}
}
| 9,302 |
132,659 | 0 | void BlinkTestRunner::PrintMessage(const std::string& message) {
Send(new ShellViewHostMsg_PrintMessage(routing_id(), message));
}
| 9,303 |
58,707 | 0 | static void aio_free_ring(struct kioctx *ctx)
{
struct aio_ring_info *info = &ctx->ring_info;
long i;
for (i=0; i<info->nr_pages; i++)
put_page(info->ring_pages[i]);
if (info->mmap_size) {
BUG_ON(ctx->mm != current->mm);
vm_munmap(info->mmap_base, info->mmap_size);
}
if (info->ring_pages && info->ring_pages != info->internal_pages)
kfree(info->ring_pages);
info->ring_pages = NULL;
info->nr = 0;
}
| 9,304 |
40,356 | 0 | static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
int addr_len)
{
struct sockaddr_hci haddr;
struct sock *sk = sock->sk;
struct hci_dev *hdev = NULL;
int len, err = 0;
BT_DBG("sock %p sk %p", sock, sk);
if (!addr)
return -EINVAL;
memset(&haddr, 0, sizeof(haddr));
len = min_t(unsigned int, sizeof(haddr), addr_len);
memcpy(&haddr, addr, len);
if (haddr.hci_family != AF_BLUETOOTH)
return -EINVAL;
lock_sock(sk);
if (sk->sk_state == BT_BOUND) {
err = -EALREADY;
goto done;
}
switch (haddr.hci_channel) {
case HCI_CHANNEL_RAW:
if (hci_pi(sk)->hdev) {
err = -EALREADY;
goto done;
}
if (haddr.hci_dev != HCI_DEV_NONE) {
hdev = hci_dev_get(haddr.hci_dev);
if (!hdev) {
err = -ENODEV;
goto done;
}
atomic_inc(&hdev->promisc);
}
hci_pi(sk)->hdev = hdev;
break;
case HCI_CHANNEL_USER:
if (hci_pi(sk)->hdev) {
err = -EALREADY;
goto done;
}
if (haddr.hci_dev == HCI_DEV_NONE) {
err = -EINVAL;
goto done;
}
if (!capable(CAP_NET_ADMIN)) {
err = -EPERM;
goto done;
}
hdev = hci_dev_get(haddr.hci_dev);
if (!hdev) {
err = -ENODEV;
goto done;
}
if (test_bit(HCI_UP, &hdev->flags) ||
test_bit(HCI_INIT, &hdev->flags) ||
test_bit(HCI_SETUP, &hdev->dev_flags)) {
err = -EBUSY;
hci_dev_put(hdev);
goto done;
}
if (test_and_set_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) {
err = -EUSERS;
hci_dev_put(hdev);
goto done;
}
mgmt_index_removed(hdev);
err = hci_dev_open(hdev->id);
if (err) {
clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags);
hci_dev_put(hdev);
goto done;
}
atomic_inc(&hdev->promisc);
hci_pi(sk)->hdev = hdev;
break;
case HCI_CHANNEL_CONTROL:
if (haddr.hci_dev != HCI_DEV_NONE) {
err = -EINVAL;
goto done;
}
if (!capable(CAP_NET_ADMIN)) {
err = -EPERM;
goto done;
}
break;
case HCI_CHANNEL_MONITOR:
if (haddr.hci_dev != HCI_DEV_NONE) {
err = -EINVAL;
goto done;
}
if (!capable(CAP_NET_RAW)) {
err = -EPERM;
goto done;
}
send_monitor_replay(sk);
atomic_inc(&monitor_promisc);
break;
default:
err = -EINVAL;
goto done;
}
hci_pi(sk)->channel = haddr.hci_channel;
sk->sk_state = BT_BOUND;
done:
release_sock(sk);
return err;
}
| 9,305 |
171,313 | 0 | status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
OMX_PARAM_PORTDEFINITIONTYPE def;
InitOMXParams(&def);
def.nPortIndex = kPortIndexOutput;
status_t err = mOMX->getParameter(
mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
if (err != OK) {
CODEC_LOGE("getParameter failed: %d", err);
return err;
}
sp<MetaData> meta = mSource->getFormat();
int32_t rotationDegrees;
if (!meta->findInt32(kKeyRotation, &rotationDegrees)) {
rotationDegrees = 0;
}
OMX_U32 usage = 0;
err = mOMX->getGraphicBufferUsage(mNode, kPortIndexOutput, &usage);
if (err != 0) {
ALOGW("querying usage flags from OMX IL component failed: %d", err);
usage = 0;
}
if (mFlags & kEnableGrallocUsageProtected) {
usage |= GRALLOC_USAGE_PROTECTED;
}
err = setNativeWindowSizeFormatAndUsage(
mNativeWindow.get(),
def.format.video.nFrameWidth,
def.format.video.nFrameHeight,
def.format.video.eColorFormat,
rotationDegrees,
usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
if (err != 0) {
return err;
}
int minUndequeuedBufs = 0;
err = mNativeWindow->query(mNativeWindow.get(),
NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minUndequeuedBufs);
if (err != 0) {
ALOGE("NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS query failed: %s (%d)",
strerror(-err), -err);
return err;
}
CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d+1",
def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs);
for (OMX_U32 extraBuffers = 2 + 1; /* condition inside loop */; extraBuffers--) {
OMX_U32 newBufferCount =
def.nBufferCountMin + minUndequeuedBufs + extraBuffers;
def.nBufferCountActual = newBufferCount;
err = mOMX->setParameter(
mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
if (err == OK) {
minUndequeuedBufs += extraBuffers;
break;
}
CODEC_LOGW("setting nBufferCountActual to %u failed: %d",
newBufferCount, err);
/* exit condition */
if (extraBuffers == 0) {
return err;
}
}
CODEC_LOGI("OMX-buffers: min=%u actual=%u undeq=%d+1",
def.nBufferCountMin, def.nBufferCountActual, minUndequeuedBufs);
err = native_window_set_buffer_count(
mNativeWindow.get(), def.nBufferCountActual);
if (err != 0) {
ALOGE("native_window_set_buffer_count failed: %s (%d)", strerror(-err),
-err);
return err;
}
CODEC_LOGV("allocating %u buffers from a native window of size %u on "
"output port", def.nBufferCountActual, def.nBufferSize);
for (OMX_U32 i = 0; i < def.nBufferCountActual; i++) {
ANativeWindowBuffer* buf;
err = native_window_dequeue_buffer_and_wait(mNativeWindow.get(), &buf);
if (err != 0) {
ALOGE("dequeueBuffer failed: %s (%d)", strerror(-err), -err);
break;
}
sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(buf, false));
BufferInfo info;
info.mData = NULL;
info.mSize = def.nBufferSize;
info.mStatus = OWNED_BY_US;
info.mMem = NULL;
info.mMediaBuffer = new MediaBuffer(graphicBuffer);
info.mMediaBuffer->setObserver(this);
mPortBuffers[kPortIndexOutput].push(info);
IOMX::buffer_id bufferId;
err = mOMX->useGraphicBuffer(mNode, kPortIndexOutput, graphicBuffer,
&bufferId);
if (err != 0) {
CODEC_LOGE("registering GraphicBuffer with OMX IL component "
"failed: %d", err);
break;
}
mPortBuffers[kPortIndexOutput].editItemAt(i).mBuffer = bufferId;
CODEC_LOGV("registered graphic buffer with ID %u (pointer = %p)",
bufferId, graphicBuffer.get());
}
OMX_U32 cancelStart;
OMX_U32 cancelEnd;
if (err != 0) {
cancelStart = 0;
cancelEnd = mPortBuffers[kPortIndexOutput].size();
} else {
cancelStart = def.nBufferCountActual - minUndequeuedBufs;
cancelEnd = def.nBufferCountActual;
}
for (OMX_U32 i = cancelStart; i < cancelEnd; i++) {
BufferInfo *info = &mPortBuffers[kPortIndexOutput].editItemAt(i);
cancelBufferToNativeWindow(info);
}
return err;
}
| 9,306 |
146,566 | 0 | void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
const FlexibleInt32ArrayView& v) {
if (isContextLost() || !ValidateUniformParameters<WTF::Int32Array>(
"uniform2iv", location, v, 2, 0, v.length()))
return;
ContextGL()->Uniform2iv(location->Location(), v.length() >> 1,
v.DataMaybeOnStack());
}
| 9,307 |
108,714 | 0 | void ChromotingInstance::PauseAudio(bool pause) {
if (!IsConnected()) {
return;
}
protocol::AudioControl audio_control;
audio_control.set_enable(!pause);
host_connection_->host_stub()->ControlAudio(audio_control);
}
| 9,308 |
102,663 | 0 | void DeviceTokenFetcher::FetchTokenInternal() {
DCHECK(state_ != STATE_TOKEN_AVAILABLE);
if (!data_store_->has_auth_token() || data_store_->device_id().empty()) {
return;
}
backend_.reset(service_->CreateBackend());
em::DeviceRegisterRequest request;
request.set_type(data_store_->policy_register_type());
if (!data_store_->machine_id().empty())
request.set_machine_id(data_store_->machine_id());
if (!data_store_->machine_model().empty())
request.set_machine_model(data_store_->machine_model());
backend_->ProcessRegisterRequest(data_store_->gaia_token(),
data_store_->oauth_token(),
data_store_->device_id(),
request, this);
}
| 9,309 |
88,435 | 0 | GPMF_ERR GPMF_FindNext(GPMF_stream *ms, uint32_t fourcc, GPMF_LEVELS recurse)
{
GPMF_stream prevstate;
if (ms)
{
memcpy(&prevstate, ms, sizeof(GPMF_stream));
if (ms->pos < ms->buffer_size_longs)
{
while (0 == GPMF_Next(ms, recurse))
{
if (ms->buffer[ms->pos] == fourcc)
{
return GPMF_OK; //found match
}
}
memcpy(ms, &prevstate, sizeof(GPMF_stream));
return GPMF_ERROR_FIND;
}
}
return GPMF_ERROR_FIND;
}
| 9,310 |
143,957 | 0 | png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
return info_ptr->filter_type;
return (0);
}
| 9,311 |
154,779 | 0 | error::Error GLES2DecoderPassthroughImpl::DoResizeCHROMIUM(GLuint width,
GLuint height,
GLfloat scale_factor,
GLenum color_space,
GLboolean alpha) {
static_assert(sizeof(GLuint) >= sizeof(int), "Unexpected GLuint size.");
static const GLuint kMaxDimension =
static_cast<GLuint>(std::numeric_limits<int>::max());
gfx::Size safe_size(std::min(std::max(1U, width), kMaxDimension),
std::min(std::max(1U, height), kMaxDimension));
if (offscreen_) {
if (!ResizeOffscreenFramebuffer(safe_size)) {
LOG(ERROR) << "GLES2DecoderPassthroughImpl: Context lost because "
<< "ResizeOffscreenFramebuffer failed.";
return error::kLostContext;
}
} else {
gl::GLSurface::ColorSpace surface_color_space =
gl::GLSurface::ColorSpace::UNSPECIFIED;
switch (color_space) {
case GL_COLOR_SPACE_UNSPECIFIED_CHROMIUM:
surface_color_space = gl::GLSurface::ColorSpace::UNSPECIFIED;
break;
case GL_COLOR_SPACE_SCRGB_LINEAR_CHROMIUM:
surface_color_space = gl::GLSurface::ColorSpace::SCRGB_LINEAR;
break;
case GL_COLOR_SPACE_HDR10_CHROMIUM:
surface_color_space = gl::GLSurface::ColorSpace::HDR10;
break;
case GL_COLOR_SPACE_SRGB_CHROMIUM:
surface_color_space = gl::GLSurface::ColorSpace::SRGB;
break;
case GL_COLOR_SPACE_DISPLAY_P3_CHROMIUM:
surface_color_space = gl::GLSurface::ColorSpace::DISPLAY_P3;
break;
default:
LOG(ERROR) << "GLES2DecoderPassthroughImpl: Context lost because "
"specified color space was invalid.";
return error::kLostContext;
}
if (!surface_->Resize(safe_size, scale_factor, surface_color_space,
!!alpha)) {
LOG(ERROR)
<< "GLES2DecoderPassthroughImpl: Context lost because resize failed.";
return error::kLostContext;
}
DCHECK(context_->IsCurrent(surface_.get()));
if (!context_->IsCurrent(surface_.get())) {
LOG(ERROR) << "GLES2DecoderPassthroughImpl: Context lost because context "
"no longer current after resize callback.";
return error::kLostContext;
}
}
return error::kNoError;
}
| 9,312 |
64,237 | 0 | static int default_handler(request_rec *r)
{
conn_rec *c = r->connection;
apr_bucket_brigade *bb;
apr_bucket *e;
core_dir_config *d;
int errstatus;
apr_file_t *fd = NULL;
apr_status_t status;
/* XXX if/when somebody writes a content-md5 filter we either need to
* remove this support or coordinate when to use the filter vs.
* when to use this code
* The current choice of when to compute the md5 here matches the 1.3
* support fairly closely (unlike 1.3, we don't handle computing md5
* when the charset is translated).
*/
int bld_content_md5;
d = (core_dir_config *)ap_get_core_module_config(r->per_dir_config);
bld_content_md5 = (d->content_md5 == AP_CONTENT_MD5_ON)
&& r->output_filters->frec->ftype != AP_FTYPE_RESOURCE;
ap_allow_standard_methods(r, MERGE_ALLOW, M_GET, M_OPTIONS, M_POST, -1);
/* If filters intend to consume the request body, they must
* register an InputFilter to slurp the contents of the POST
* data from the POST input stream. It no longer exists when
* the output filters are invoked by the default handler.
*/
if ((errstatus = ap_discard_request_body(r)) != OK) {
return errstatus;
}
if (r->method_number == M_GET || r->method_number == M_POST) {
if (r->finfo.filetype == APR_NOFILE) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00128)
"File does not exist: %s",
apr_pstrcat(r->pool, r->filename, r->path_info, NULL));
return HTTP_NOT_FOUND;
}
/* Don't try to serve a dir. Some OSs do weird things with
* raw I/O on a dir.
*/
if (r->finfo.filetype == APR_DIR) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00129)
"Attempt to serve directory: %s", r->filename);
return HTTP_NOT_FOUND;
}
if ((r->used_path_info != AP_REQ_ACCEPT_PATH_INFO) &&
r->path_info && *r->path_info)
{
/* default to reject */
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00130)
"File does not exist: %s",
apr_pstrcat(r->pool, r->filename, r->path_info, NULL));
return HTTP_NOT_FOUND;
}
/* We understood the (non-GET) method, but it might not be legal for
this particular resource. Check to see if the 'deliver_script'
flag is set. If so, then we go ahead and deliver the file since
it isn't really content (only GET normally returns content).
Note: based on logic further above, the only possible non-GET
method at this point is POST. In the future, we should enable
script delivery for all methods. */
if (r->method_number != M_GET) {
core_request_config *req_cfg;
req_cfg = ap_get_core_module_config(r->request_config);
if (!req_cfg->deliver_script) {
/* The flag hasn't been set for this request. Punt. */
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00131)
"This resource does not accept the %s method.",
r->method);
return HTTP_METHOD_NOT_ALLOWED;
}
}
if ((status = apr_file_open(&fd, r->filename, APR_READ | APR_BINARY
#if APR_HAS_SENDFILE
| AP_SENDFILE_ENABLED(d->enable_sendfile)
#endif
, 0, r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00132)
"file permissions deny server access: %s", r->filename);
return HTTP_FORBIDDEN;
}
ap_update_mtime(r, r->finfo.mtime);
ap_set_last_modified(r);
ap_set_etag(r);
ap_set_accept_ranges(r);
ap_set_content_length(r, r->finfo.size);
if (bld_content_md5) {
apr_table_setn(r->headers_out, "Content-MD5",
ap_md5digest(r->pool, fd));
}
bb = apr_brigade_create(r->pool, c->bucket_alloc);
if ((errstatus = ap_meets_conditions(r)) != OK) {
apr_file_close(fd);
r->status = errstatus;
}
else {
e = apr_brigade_insert_file(bb, fd, 0, r->finfo.size, r->pool);
#if APR_HAS_MMAP
if (d->enable_mmap == ENABLE_MMAP_OFF) {
(void)apr_bucket_file_enable_mmap(e, 0);
}
#endif
}
e = apr_bucket_eos_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, e);
status = ap_pass_brigade(r->output_filters, bb);
apr_brigade_cleanup(bb);
if (status == APR_SUCCESS
|| r->status != HTTP_OK
|| c->aborted) {
return OK;
}
else {
/* no way to know what type of error occurred */
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, status, r, APLOGNO(00133)
"default_handler: ap_pass_brigade returned %i",
status);
return AP_FILTER_ERROR;
}
}
else { /* unusual method (not GET or POST) */
if (r->method_number == M_INVALID) {
/* See if this looks like an undecrypted SSL handshake attempt.
* It's safe to look a couple bytes into the_request if it exists, as it's
* always allocated at least MIN_LINE_ALLOC (80) bytes.
*/
if (r->the_request
&& r->the_request[0] == 0x16
&& (r->the_request[1] == 0x2 || r->the_request[1] == 0x3)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00134)
"Invalid method in request %s - possible attempt to establish SSL connection on non-SSL port", r->the_request);
} else {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00135)
"Invalid method in request %s", r->the_request);
}
return HTTP_NOT_IMPLEMENTED;
}
if (r->method_number == M_OPTIONS) {
return ap_send_http_options(r);
}
return HTTP_METHOD_NOT_ALLOWED;
}
}
| 9,313 |
97,363 | 0 | void FrameLoader::checkDidPerformFirstNavigation()
{
Page* page = m_frame->page();
if (!page)
return;
if (!m_didPerformFirstNavigation && page->backForwardList()->entries().size() == 1) {
m_didPerformFirstNavigation = true;
m_client->didPerformFirstNavigation();
}
}
| 9,314 |
46,367 | 0 | long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
loff_t *opos, size_t len, unsigned int flags)
{
struct splice_desc sd = {
.len = len,
.total_len = len,
.flags = flags,
.pos = *ppos,
.u.file = out,
.opos = opos,
};
long ret;
if (unlikely(!(out->f_mode & FMODE_WRITE)))
return -EBADF;
if (unlikely(out->f_flags & O_APPEND))
return -EINVAL;
ret = rw_verify_area(WRITE, out, opos, len);
if (unlikely(ret < 0))
return ret;
ret = splice_direct_to_actor(in, &sd, direct_splice_actor);
if (ret > 0)
*ppos = sd.pos;
return ret;
}
| 9,315 |
26,440 | 0 | static void __exit pmcraid_exit(void)
{
pmcraid_netlink_release();
unregister_chrdev_region(MKDEV(pmcraid_major, 0),
PMCRAID_MAX_ADAPTERS);
pci_unregister_driver(&pmcraid_driver);
class_destroy(pmcraid_class);
}
| 9,316 |
95,295 | 0 | AcpiNsPrintNodePathname (
ACPI_NAMESPACE_NODE *Node,
const char *Message)
{
ACPI_BUFFER Buffer;
ACPI_STATUS Status;
if (!Node)
{
AcpiOsPrintf ("[NULL NAME]");
return;
}
/* Convert handle to full pathname and print it (with supplied message) */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiNsHandleToPathname (Node, &Buffer, TRUE);
if (ACPI_SUCCESS (Status))
{
if (Message)
{
AcpiOsPrintf ("%s ", Message);
}
AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer.Pointer, Node);
ACPI_FREE (Buffer.Pointer);
}
}
| 9,317 |
151,949 | 0 | RenderFrameHostImpl* RenderFrameHostImpl::FromID(int process_id,
int routing_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
RoutingIDFrameMap* frames = g_routing_id_frame_map.Pointer();
auto it = frames->find(RenderFrameHostID(process_id, routing_id));
return it == frames->end() ? NULL : it->second;
}
| 9,318 |
181,263 | 1 | static grub_err_t read_foo (struct grub_disk *disk, grub_disk_addr_t sector, grub_size_t size, char *buf) {
if (disk != NULL) {
const int blocksize = 512; // unhardcode 512
int ret;
RIOBind *iob = disk->data;
if (bio) iob = bio;
//printf ("io %p\n", file->root->iob.io);
ret = iob->read_at (iob->io, delta+(blocksize*sector),
(ut8*)buf, size*blocksize);
if (ret == -1)
return 1;
//printf ("DISK PTR = %p\n", disk->data);
//printf ("\nBUF: %x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
} else eprintf ("oops. no disk\n");
return 0; // 0 is ok
}
| 9,319 |
163,980 | 0 | void PaymentRequestState::OnSWPaymentInstrumentValidated(
ServiceWorkerPaymentInstrument* instrument,
bool result) {
if (!result) {
for (size_t i = 0; i < available_instruments_.size(); i++) {
if (available_instruments_[i].get() == instrument) {
available_instruments_.erase(available_instruments_.begin() + i);
break;
}
}
}
if (--number_of_pending_sw_payment_instruments_ > 0)
return;
FinishedGetAllSWPaymentInstruments();
}
| 9,320 |
116,096 | 0 | bool SyncManager::SyncInternal::OpenDirectory() {
DCHECK(!initialized_) << "Should only happen once";
change_observer_ =
browser_sync::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr());
bool share_opened =
dir_manager()->Open(
username_for_share(),
this,
unrecoverable_error_handler_,
browser_sync::MakeWeakHandle(
js_mutation_event_observer_.AsWeakPtr()));
if (!share_opened) {
LOG(ERROR) << "Could not open share for:" << username_for_share();
return false;
}
syncable::ScopedDirLookup lookup(dir_manager(), username_for_share());
if (!lookup.good()) {
NOTREACHED();
return false;
}
connection_manager()->set_client_id(lookup->cache_guid());
return true;
}
| 9,321 |
108,647 | 0 | URLRequestTestFTP()
: test_server_(TestServer::TYPE_FTP, TestServer::kLocalhost, FilePath()) {
}
| 9,322 |
30,496 | 0 | void nfc_llcp_sock_free(struct nfc_llcp_sock *sock)
{
kfree(sock->service_name);
skb_queue_purge(&sock->tx_queue);
skb_queue_purge(&sock->tx_pending_queue);
list_del_init(&sock->accept_queue);
sock->parent = NULL;
nfc_llcp_local_put(sock->local);
}
| 9,323 |
52,799 | 0 | static ssize_t ib_ucm_listen(struct ib_ucm_file *file,
const char __user *inbuf,
int in_len, int out_len)
{
struct ib_ucm_listen cmd;
struct ib_ucm_context *ctx;
int result;
if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
return -EFAULT;
ctx = ib_ucm_ctx_get(file, cmd.id);
if (IS_ERR(ctx))
return PTR_ERR(ctx);
result = ucm_validate_listen(cmd.service_id, cmd.service_mask);
if (result)
goto out;
result = ib_cm_listen(ctx->cm_id, cmd.service_id, cmd.service_mask);
out:
ib_ucm_ctx_put(ctx);
return result;
}
| 9,324 |
49,645 | 0 | SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
{
struct task_struct *g, *p;
struct user_struct *user;
struct pid *pgrp;
kuid_t uid;
int ret = -ESRCH;
int tmpio;
rcu_read_lock();
switch (which) {
case IOPRIO_WHO_PROCESS:
if (!who)
p = current;
else
p = find_task_by_vpid(who);
if (p)
ret = get_task_ioprio(p);
break;
case IOPRIO_WHO_PGRP:
if (!who)
pgrp = task_pgrp(current);
else
pgrp = find_vpid(who);
do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
tmpio = get_task_ioprio(p);
if (tmpio < 0)
continue;
if (ret == -ESRCH)
ret = tmpio;
else
ret = ioprio_best(ret, tmpio);
} while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
break;
case IOPRIO_WHO_USER:
uid = make_kuid(current_user_ns(), who);
if (!who)
user = current_user();
else
user = find_user(uid);
if (!user)
break;
do_each_thread(g, p) {
if (!uid_eq(task_uid(p), user->uid) ||
!task_pid_vnr(p))
continue;
tmpio = get_task_ioprio(p);
if (tmpio < 0)
continue;
if (ret == -ESRCH)
ret = tmpio;
else
ret = ioprio_best(ret, tmpio);
} while_each_thread(g, p);
if (who)
free_uid(user);
break;
default:
ret = -EINVAL;
}
rcu_read_unlock();
return ret;
}
| 9,325 |
161,999 | 0 | ClientSharedBitmapManager::GetBitmapForSharedMemory(base::SharedMemory* mem) {
SharedBitmapId id = SharedBitmap::GenerateId();
uint32_t sequence_number = NotifyAllocatedSharedBitmap(mem, id);
return std::make_unique<ClientSharedBitmap>(
shared_bitmap_allocation_notifier_, mem, id, sequence_number);
}
| 9,326 |
188,326 | 1 | const Chapters::Display* Chapters::Atom::GetDisplay(int index) const
{
if (index < 0)
return NULL;
if (index >= m_displays_count)
return NULL;
return m_displays + index;
}
| 9,327 |
162,869 | 0 | void GLManager::SetCommandsPaused(bool paused) {
command_buffer_->SetCommandsPaused(paused);
}
| 9,328 |
92,157 | 0 | static void mlx5_ib_qp_event(struct mlx5_core_qp *qp, int type)
{
struct ib_qp *ibqp = &to_mibqp(qp)->ibqp;
struct ib_event event;
if (type == MLX5_EVENT_TYPE_PATH_MIG) {
/* This event is only valid for trans_qps */
to_mibqp(qp)->port = to_mibqp(qp)->trans_qp.alt_port;
}
if (ibqp->event_handler) {
event.device = ibqp->device;
event.element.qp = ibqp;
switch (type) {
case MLX5_EVENT_TYPE_PATH_MIG:
event.event = IB_EVENT_PATH_MIG;
break;
case MLX5_EVENT_TYPE_COMM_EST:
event.event = IB_EVENT_COMM_EST;
break;
case MLX5_EVENT_TYPE_SQ_DRAINED:
event.event = IB_EVENT_SQ_DRAINED;
break;
case MLX5_EVENT_TYPE_SRQ_LAST_WQE:
event.event = IB_EVENT_QP_LAST_WQE_REACHED;
break;
case MLX5_EVENT_TYPE_WQ_CATAS_ERROR:
event.event = IB_EVENT_QP_FATAL;
break;
case MLX5_EVENT_TYPE_PATH_MIG_FAILED:
event.event = IB_EVENT_PATH_MIG_ERR;
break;
case MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR:
event.event = IB_EVENT_QP_REQ_ERR;
break;
case MLX5_EVENT_TYPE_WQ_ACCESS_ERROR:
event.event = IB_EVENT_QP_ACCESS_ERR;
break;
default:
pr_warn("mlx5_ib: Unexpected event type %d on QP %06x\n", type, qp->qpn);
return;
}
ibqp->event_handler(&event, ibqp->qp_context);
}
}
| 9,329 |
56,667 | 0 | static journal_t *ext4_get_journal(struct super_block *sb,
unsigned int journal_inum)
{
struct inode *journal_inode;
journal_t *journal;
BUG_ON(!ext4_has_feature_journal(sb));
/* First, test for the existence of a valid inode on disk. Bad
* things happen if we iget() an unused inode, as the subsequent
* iput() will try to delete it. */
journal_inode = ext4_iget(sb, journal_inum);
if (IS_ERR(journal_inode)) {
ext4_msg(sb, KERN_ERR, "no journal found");
return NULL;
}
if (!journal_inode->i_nlink) {
make_bad_inode(journal_inode);
iput(journal_inode);
ext4_msg(sb, KERN_ERR, "journal inode is deleted");
return NULL;
}
jbd_debug(2, "Journal inode found at %p: %lld bytes\n",
journal_inode, journal_inode->i_size);
if (!S_ISREG(journal_inode->i_mode)) {
ext4_msg(sb, KERN_ERR, "invalid journal inode");
iput(journal_inode);
return NULL;
}
journal = jbd2_journal_init_inode(journal_inode);
if (!journal) {
ext4_msg(sb, KERN_ERR, "Could not load journal inode");
iput(journal_inode);
return NULL;
}
journal->j_private = sb;
ext4_init_journal_params(sb, journal);
return journal;
}
| 9,330 |
46,616 | 0 | static int sha384_neon_final(struct shash_desc *desc, u8 *hash)
{
u8 D[SHA512_DIGEST_SIZE];
sha512_neon_final(desc, D);
memcpy(hash, D, SHA384_DIGEST_SIZE);
memset(D, 0, SHA512_DIGEST_SIZE);
return 0;
}
| 9,331 |
123,858 | 0 | webkit::ppapi::PluginInstance* RenderViewImpl::GetBitmapForOptimizedPluginPaint(
const gfx::Rect& paint_bounds,
TransportDIB** dib,
gfx::Rect* location,
gfx::Rect* clip,
float* scale_factor) {
return pepper_helper_->GetBitmapForOptimizedPluginPaint(
paint_bounds, dib, location, clip, scale_factor);
}
| 9,332 |
99,202 | 0 | void V8DOMWrapper::setJSWrapperForDOMNode(Node* node, v8::Persistent<v8::Object> wrapper)
{
ASSERT(V8DOMWrapper::maybeDOMWrapper(wrapper));
getDOMNodeMap().set(node, wrapper);
}
| 9,333 |
161,177 | 0 | AudioInputDeviceManager* MediaStreamManager::audio_input_device_manager() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(audio_input_device_manager_.get());
return audio_input_device_manager_.get();
}
| 9,334 |
165,784 | 0 | MutableCSSPropertyValueSet* SVGElement::EnsureAnimatedSMILStyleProperties() {
return EnsureSVGRareData()->EnsureAnimatedSMILStyleProperties();
}
| 9,335 |
59,286 | 0 | struct mm_struct *get_task_mm(struct task_struct *task)
{
struct mm_struct *mm;
task_lock(task);
mm = task->mm;
if (mm) {
if (task->flags & PF_KTHREAD)
mm = NULL;
else
mmget(mm);
}
task_unlock(task);
return mm;
}
| 9,336 |
67,511 | 0 | static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
get_block_t *get_block)
{
unsigned from = pos & (PAGE_SIZE - 1);
unsigned to = from + len;
struct inode *inode = page->mapping->host;
unsigned block_start, block_end;
sector_t block;
int err = 0;
unsigned blocksize = inode->i_sb->s_blocksize;
unsigned bbits;
struct buffer_head *bh, *head, *wait[2], **wait_bh = wait;
bool decrypt = false;
BUG_ON(!PageLocked(page));
BUG_ON(from > PAGE_SIZE);
BUG_ON(to > PAGE_SIZE);
BUG_ON(from > to);
if (!page_has_buffers(page))
create_empty_buffers(page, blocksize, 0);
head = page_buffers(page);
bbits = ilog2(blocksize);
block = (sector_t)page->index << (PAGE_SHIFT - bbits);
for (bh = head, block_start = 0; bh != head || !block_start;
block++, block_start = block_end, bh = bh->b_this_page) {
block_end = block_start + blocksize;
if (block_end <= from || block_start >= to) {
if (PageUptodate(page)) {
if (!buffer_uptodate(bh))
set_buffer_uptodate(bh);
}
continue;
}
if (buffer_new(bh))
clear_buffer_new(bh);
if (!buffer_mapped(bh)) {
WARN_ON(bh->b_size != blocksize);
err = get_block(inode, block, bh, 1);
if (err)
break;
if (buffer_new(bh)) {
unmap_underlying_metadata(bh->b_bdev,
bh->b_blocknr);
if (PageUptodate(page)) {
clear_buffer_new(bh);
set_buffer_uptodate(bh);
mark_buffer_dirty(bh);
continue;
}
if (block_end > to || block_start < from)
zero_user_segments(page, to, block_end,
block_start, from);
continue;
}
}
if (PageUptodate(page)) {
if (!buffer_uptodate(bh))
set_buffer_uptodate(bh);
continue;
}
if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
!buffer_unwritten(bh) &&
(block_start < from || block_end > to)) {
ll_rw_block(READ, 1, &bh);
*wait_bh++ = bh;
decrypt = ext4_encrypted_inode(inode) &&
S_ISREG(inode->i_mode);
}
}
/*
* If we issued read requests, let them complete.
*/
while (wait_bh > wait) {
wait_on_buffer(*--wait_bh);
if (!buffer_uptodate(*wait_bh))
err = -EIO;
}
if (unlikely(err))
page_zero_new_buffers(page, from, to);
else if (decrypt)
err = ext4_decrypt(page);
return err;
}
| 9,337 |
28,637 | 0 | static void qeth_set_single_write_queues(struct qeth_card *card)
{
if ((atomic_read(&card->qdio.state) != QETH_QDIO_UNINITIALIZED) &&
(card->qdio.no_out_queues == 4))
qeth_free_qdio_buffers(card);
card->qdio.no_out_queues = 1;
if (card->qdio.default_out_queue != 0)
dev_info(&card->gdev->dev, "Priority Queueing not supported\n");
card->qdio.default_out_queue = 0;
}
| 9,338 |
5,614 | 0 | void change_file_owner_to_parent(connection_struct *conn,
const char *inherit_from_dir,
files_struct *fsp)
{
struct smb_filename *smb_fname_parent;
int ret;
smb_fname_parent = synthetic_smb_fname(talloc_tos(),
inherit_from_dir,
NULL,
NULL,
0);
if (smb_fname_parent == NULL) {
return;
}
ret = SMB_VFS_STAT(conn, smb_fname_parent);
if (ret == -1) {
DEBUG(0,("change_file_owner_to_parent: failed to stat parent "
"directory %s. Error was %s\n",
smb_fname_str_dbg(smb_fname_parent),
strerror(errno)));
TALLOC_FREE(smb_fname_parent);
return;
}
if (smb_fname_parent->st.st_ex_uid == fsp->fsp_name->st.st_ex_uid) {
/* Already this uid - no need to change. */
DEBUG(10,("change_file_owner_to_parent: file %s "
"is already owned by uid %d\n",
fsp_str_dbg(fsp),
(int)fsp->fsp_name->st.st_ex_uid ));
TALLOC_FREE(smb_fname_parent);
return;
}
become_root();
ret = SMB_VFS_FCHOWN(fsp, smb_fname_parent->st.st_ex_uid, (gid_t)-1);
unbecome_root();
if (ret == -1) {
DEBUG(0,("change_file_owner_to_parent: failed to fchown "
"file %s to parent directory uid %u. Error "
"was %s\n", fsp_str_dbg(fsp),
(unsigned int)smb_fname_parent->st.st_ex_uid,
strerror(errno) ));
} else {
DEBUG(10,("change_file_owner_to_parent: changed new file %s to "
"parent directory uid %u.\n", fsp_str_dbg(fsp),
(unsigned int)smb_fname_parent->st.st_ex_uid));
/* Ensure the uid entry is updated. */
fsp->fsp_name->st.st_ex_uid = smb_fname_parent->st.st_ex_uid;
}
TALLOC_FREE(smb_fname_parent);
}
| 9,339 |
129,216 | 0 | bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
return framebuffer->HasDepthAttachment();
}
if (offscreen_target_frame_buffer_.get()) {
return offscreen_target_depth_format_ != 0;
}
return back_buffer_has_depth_;
}
| 9,340 |
141,119 | 0 | void Document::IncrementNumberOfCanvases() {
num_canvases_++;
}
| 9,341 |
16,840 | 0 | int bdrv_change_backing_file(BlockDriverState *bs,
const char *backing_file, const char *backing_fmt)
{
BlockDriver *drv = bs->drv;
int ret;
/* Backing file format doesn't make sense without a backing file */
if (backing_fmt && !backing_file) {
return -EINVAL;
}
if (drv->bdrv_change_backing_file != NULL) {
ret = drv->bdrv_change_backing_file(bs, backing_file, backing_fmt);
} else {
ret = -ENOTSUP;
}
if (ret == 0) {
pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: "");
pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: "");
}
return ret;
}
| 9,342 |
47,763 | 0 | static void netlink_remove(struct sock *sk)
{
struct netlink_table *table;
table = &nl_table[sk->sk_protocol];
if (!rhashtable_remove_fast(&table->hash, &nlk_sk(sk)->node,
netlink_rhashtable_params)) {
WARN_ON(atomic_read(&sk->sk_refcnt) == 1);
__sock_put(sk);
}
netlink_table_grab();
if (nlk_sk(sk)->subscriptions) {
__sk_del_bind_node(sk);
netlink_update_listeners(sk);
}
if (sk->sk_protocol == NETLINK_GENERIC)
atomic_inc(&genl_sk_destructing_cnt);
netlink_table_ungrab();
}
| 9,343 |
142,639 | 0 | void WebstoreStandaloneInstaller::AbortInstall() {
callback_.Reset();
if (webstore_data_fetcher_) {
webstore_data_fetcher_.reset();
scoped_active_install_.reset();
Release(); // Matches the AddRef in BeginInstall.
}
}
| 9,344 |
78,746 | 0 | static int muscle_card_extract_key(sc_card_t *card, sc_cardctl_muscle_key_info_t *info)
{
/* CURRENTLY DONT SUPPORT EXTRACTING PRIVATE KEYS... */
switch(info->keyType) {
case 1: /* RSA */
return msc_extract_rsa_public_key(card,
info->keyLocation,
&info->modLength,
&info->modValue,
&info->expLength,
&info->expValue);
default:
return SC_ERROR_NOT_SUPPORTED;
}
}
| 9,345 |
8,613 | 0 | static void vmsvga_index_write(void *opaque, uint32_t address, uint32_t index)
{
struct vmsvga_state_s *s = opaque;
s->index = index;
}
| 9,346 |
99,176 | 0 | v8::Handle<v8::Value> V8DOMWrapper::convertCSSValueToV8Object(CSSValue* value)
{
if (!value)
return v8::Null();
v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(value);
if (!wrapper.IsEmpty())
return wrapper;
V8ClassIndex::V8WrapperType type;
if (value->isWebKitCSSTransformValue())
type = V8ClassIndex::WEBKITCSSTRANSFORMVALUE;
else if (value->isValueList())
type = V8ClassIndex::CSSVALUELIST;
else if (value->isPrimitiveValue())
type = V8ClassIndex::CSSPRIMITIVEVALUE;
#if ENABLE(SVG)
else if (value->isSVGPaint())
type = V8ClassIndex::SVGPAINT;
else if (value->isSVGColor())
type = V8ClassIndex::SVGCOLOR;
#endif
else
type = V8ClassIndex::CSSVALUE;
v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::CSSVALUE, value);
if (!result.IsEmpty()) {
value->ref();
setJSWrapperForDOMObject(value, v8::Persistent<v8::Object>::New(result));
}
return result;
}
| 9,347 |
76,908 | 0 | encode_UNROLL_XLATE(const struct ofpact_unroll_xlate *unroll OVS_UNUSED,
enum ofp_version ofp_version OVS_UNUSED,
struct ofpbuf *out OVS_UNUSED)
{
OVS_NOT_REACHED();
}
| 9,348 |
4,134 | 0 | void Splash::scaleImageYdXd(SplashImageSource src, void *srcData,
SplashColorMode srcMode, int nComps,
GBool srcAlpha, int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf, *alphaLineBuf;
Guint *pixBuf, *alphaPixBuf;
Guint pix0, pix1, pix2;
#if SPLASH_CMYK
Guint pix3;
Guint pix[SPOT_NCOMPS+4], cp;
#endif
Guint alpha;
Guchar *destPtr, *destAlphaPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, xx, xxa, d, d0, d1;
int i, j;
yp = srcHeight / scaledHeight;
yq = srcHeight % scaledHeight;
xp = srcWidth / scaledWidth;
xq = srcWidth % scaledWidth;
lineBuf = (Guchar *)gmallocn(srcWidth, nComps);
pixBuf = (Guint *)gmallocn(srcWidth, nComps * sizeof(int));
if (srcAlpha) {
alphaLineBuf = (Guchar *)gmalloc(srcWidth);
alphaPixBuf = (Guint *)gmallocn(srcWidth, sizeof(int));
} else {
alphaLineBuf = NULL;
alphaPixBuf = NULL;
}
yt = 0;
destPtr = dest->data;
destAlphaPtr = dest->alpha;
for (y = 0; y < scaledHeight; ++y) {
if ((yt += yq) >= scaledHeight) {
yt -= scaledHeight;
yStep = yp + 1;
} else {
yStep = yp;
}
memset(pixBuf, 0, srcWidth * nComps * sizeof(int));
if (srcAlpha) {
memset(alphaPixBuf, 0, srcWidth * sizeof(int));
}
for (i = 0; i < yStep; ++i) {
(*src)(srcData, lineBuf, alphaLineBuf);
for (j = 0; j < srcWidth * nComps; ++j) {
pixBuf[j] += lineBuf[j];
}
if (srcAlpha) {
for (j = 0; j < srcWidth; ++j) {
alphaPixBuf[j] += alphaLineBuf[j];
}
}
}
xt = 0;
d0 = (1 << 23) / (yStep * xp);
d1 = (1 << 23) / (yStep * (xp + 1));
xx = xxa = 0;
for (x = 0; x < scaledWidth; ++x) {
if ((xt += xq) >= scaledWidth) {
xt -= scaledWidth;
xStep = xp + 1;
d = d1;
} else {
xStep = xp;
d = d0;
}
switch (srcMode) {
case splashModeMono8:
pix0 = 0;
for (i = 0; i < xStep; ++i) {
pix0 += pixBuf[xx++];
}
pix0 = (pix0 * d) >> 23;
*destPtr++ = (Guchar)pix0;
break;
case splashModeRGB8:
pix0 = pix1 = pix2 = 0;
for (i = 0; i < xStep; ++i) {
pix0 += pixBuf[xx];
pix1 += pixBuf[xx+1];
pix2 += pixBuf[xx+2];
xx += 3;
}
pix0 = (pix0 * d) >> 23;
pix1 = (pix1 * d) >> 23;
pix2 = (pix2 * d) >> 23;
*destPtr++ = (Guchar)pix0;
*destPtr++ = (Guchar)pix1;
*destPtr++ = (Guchar)pix2;
break;
case splashModeXBGR8:
pix0 = pix1 = pix2 = 0;
for (i = 0; i < xStep; ++i) {
pix0 += pixBuf[xx];
pix1 += pixBuf[xx+1];
pix2 += pixBuf[xx+2];
xx += 4;
}
pix0 = (pix0 * d) >> 23;
pix1 = (pix1 * d) >> 23;
pix2 = (pix2 * d) >> 23;
*destPtr++ = (Guchar)pix2;
*destPtr++ = (Guchar)pix1;
*destPtr++ = (Guchar)pix0;
*destPtr++ = (Guchar)255;
break;
case splashModeBGR8:
pix0 = pix1 = pix2 = 0;
for (i = 0; i < xStep; ++i) {
pix0 += pixBuf[xx];
pix1 += pixBuf[xx+1];
pix2 += pixBuf[xx+2];
xx += 3;
}
pix0 = (pix0 * d) >> 23;
pix1 = (pix1 * d) >> 23;
pix2 = (pix2 * d) >> 23;
*destPtr++ = (Guchar)pix2;
*destPtr++ = (Guchar)pix1;
*destPtr++ = (Guchar)pix0;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
pix0 = pix1 = pix2 = pix3 = 0;
for (i = 0; i < xStep; ++i) {
pix0 += pixBuf[xx];
pix1 += pixBuf[xx+1];
pix2 += pixBuf[xx+2];
pix3 += pixBuf[xx+3];
xx += 4;
}
pix0 = (pix0 * d) >> 23;
pix1 = (pix1 * d) >> 23;
pix2 = (pix2 * d) >> 23;
pix3 = (pix3 * d) >> 23;
*destPtr++ = (Guchar)pix0;
*destPtr++ = (Guchar)pix1;
*destPtr++ = (Guchar)pix2;
*destPtr++ = (Guchar)pix3;
break;
case splashModeDeviceN8:
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
pix[cp] = 0;
for (i = 0; i < xStep; ++i) {
for (cp = 0; cp < SPOT_NCOMPS+4; cp++) {
pix[cp] += pixBuf[xx + cp];
}
xx += (SPOT_NCOMPS+4);
}
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
pix[cp] = (pix[cp] * d) >> 23;
for (cp = 0; cp < SPOT_NCOMPS+4; cp++)
*destPtr++ = (Guchar)pix[cp];
break;
#endif
case splashModeMono1: // mono1 is not allowed
default:
break;
}
if (srcAlpha) {
alpha = 0;
for (i = 0; i < xStep; ++i, ++xxa) {
alpha += alphaPixBuf[xxa];
}
alpha = (alpha * d) >> 23;
*destAlphaPtr++ = (Guchar)alpha;
}
}
}
gfree(alphaPixBuf);
gfree(alphaLineBuf);
gfree(pixBuf);
gfree(lineBuf);
}
| 9,349 |
15,596 | 0 | static void vmxnet3_pci_uninit(PCIDevice *pci_dev)
{
DeviceState *dev = DEVICE(pci_dev);
VMXNET3State *s = VMXNET3(pci_dev);
VMW_CBPRN("Starting uninit...");
unregister_savevm(dev, "vmxnet3-msix", s);
vmxnet3_net_uninit(s);
vmxnet3_cleanup_msix(s);
vmxnet3_cleanup_msi(s);
memory_region_destroy(&s->bar0);
memory_region_destroy(&s->bar1);
memory_region_destroy(&s->msix_bar);
}
| 9,350 |
103,022 | 0 | void ClearStates() {
STLDeleteContainerPointers(states_.begin(), states_.end());
states_.clear();
}
| 9,351 |
77,466 | 0 | ofputil_append_meter_stats(struct ovs_list *replies,
const struct ofputil_meter_stats *ms)
{
struct ofp13_meter_stats *reply;
uint16_t n = 0;
uint16_t len;
len = sizeof *reply + ms->n_bands * sizeof(struct ofp13_meter_band_stats);
reply = ofpmp_append(replies, len);
reply->meter_id = htonl(ms->meter_id);
reply->len = htons(len);
memset(reply->pad, 0, sizeof reply->pad);
reply->flow_count = htonl(ms->flow_count);
reply->packet_in_count = htonll(ms->packet_in_count);
reply->byte_in_count = htonll(ms->byte_in_count);
reply->duration_sec = htonl(ms->duration_sec);
reply->duration_nsec = htonl(ms->duration_nsec);
for (n = 0; n < ms->n_bands; ++n) {
const struct ofputil_meter_band_stats *src = &ms->bands[n];
struct ofp13_meter_band_stats *dst = &reply->band_stats[n];
dst->packet_band_count = htonll(src->packet_count);
dst->byte_band_count = htonll(src->byte_count);
}
}
| 9,352 |
52,685 | 0 | int snd_timer_close(struct snd_timer_instance *timeri)
{
struct snd_timer *timer = NULL;
struct snd_timer_instance *slave, *tmp;
if (snd_BUG_ON(!timeri))
return -ENXIO;
mutex_lock(®ister_mutex);
list_del(&timeri->open_list);
/* force to stop the timer */
snd_timer_stop(timeri);
timer = timeri->timer;
if (timer) {
/* wait, until the active callback is finished */
spin_lock_irq(&timer->lock);
while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
spin_unlock_irq(&timer->lock);
udelay(10);
spin_lock_irq(&timer->lock);
}
spin_unlock_irq(&timer->lock);
/* remove slave links */
spin_lock_irq(&slave_active_lock);
spin_lock(&timer->lock);
list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,
open_list) {
list_move_tail(&slave->open_list, &snd_timer_slave_list);
slave->master = NULL;
slave->timer = NULL;
list_del_init(&slave->ack_list);
list_del_init(&slave->active_list);
}
spin_unlock(&timer->lock);
spin_unlock_irq(&slave_active_lock);
/* slave doesn't need to release timer resources below */
if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE)
timer = NULL;
}
if (timeri->private_free)
timeri->private_free(timeri);
kfree(timeri->owner);
kfree(timeri);
if (timer) {
if (list_empty(&timer->open_list_head) && timer->hw.close)
timer->hw.close(timer);
/* release a card refcount for safe disconnection */
if (timer->card)
put_device(&timer->card->card_dev);
module_put(timer->module);
}
mutex_unlock(®ister_mutex);
return 0;
}
| 9,353 |
38,124 | 0 | static int __init logi_dj_init(void)
{
int retval;
dbg_hid("Logitech-DJ:%s\n", __func__);
retval = hid_register_driver(&logi_djreceiver_driver);
if (retval)
return retval;
retval = hid_register_driver(&logi_djdevice_driver);
if (retval)
hid_unregister_driver(&logi_djreceiver_driver);
return retval;
}
| 9,354 |
161,581 | 0 | void AddLocalizedStrings(content::WebUIDataSource* html_source,
Profile* profile) {
AddA11yStrings(html_source);
AddAboutStrings(html_source);
AddAppearanceStrings(html_source, profile);
#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
AddChromeCleanupStrings(html_source);
AddIncompatibleApplicationsStrings(html_source);
#endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD)
AddChangePasswordStrings(html_source);
AddClearBrowsingDataStrings(html_source, profile);
AddCommonStrings(html_source, profile);
AddDownloadsStrings(html_source);
AddLanguagesStrings(html_source);
AddOnStartupStrings(html_source);
AddPasswordsAndFormsStrings(html_source);
AddPeopleStrings(html_source, profile);
AddPrintingStrings(html_source);
AddPrivacyStrings(html_source, profile);
AddResetStrings(html_source);
AddSearchEnginesStrings(html_source);
#if defined(OS_CHROMEOS)
AddGoogleAssistantStrings(html_source);
#endif
AddSearchInSettingsStrings(html_source);
AddSearchStrings(html_source, profile);
AddSiteSettingsStrings(html_source, profile);
AddWebContentStrings(html_source);
#if defined(OS_CHROMEOS)
AddAndroidAppStrings(html_source);
AddBluetoothStrings(html_source);
AddChromeOSUserStrings(html_source, profile);
AddDateTimeStrings(html_source);
AddDeviceStrings(html_source);
AddEasyUnlockStrings(html_source);
AddInternetStrings(html_source);
AddMultideviceStrings(html_source);
AddUsersStrings(html_source);
#else
AddDefaultBrowserStrings(html_source);
AddImportDataStrings(html_source);
AddSystemStrings(html_source);
#endif
#if defined(USE_NSS_CERTS)
certificate_manager::AddLocalizedStrings(html_source);
#endif
#if defined(OS_CHROMEOS)
chromeos::network_element::AddLocalizedStrings(html_source);
chromeos::network_element::AddOncLocalizedStrings(html_source);
chromeos::network_element::AddDetailsLocalizedStrings(html_source);
chromeos::network_element::AddConfigLocalizedStrings(html_source);
chromeos::network_element::AddErrorLocalizedStrings(html_source);
#endif
policy_indicator::AddLocalizedStrings(html_source);
html_source->SetJsonPath(kLocalizedStringsFile);
}
| 9,355 |
141,134 | 0 | bool Document::IsPageVisible() const {
if (!frame_ || !frame_->GetPage())
return false;
if (load_event_progress_ >= kUnloadVisibilityChangeInProgress)
return false;
return frame_->GetPage()->IsPageVisible();
}
| 9,356 |
74,416 | 0 | BOOLEAN AnalyzeIP6RoutingExtension(
PIP6_TYPE2_ROUTING_HEADER routingHdr,
ULONG dataLength,
IPV6_ADDRESS **destAddr)
{
if(dataLength < sizeof(*routingHdr))
return FALSE;
if(routingHdr->RoutingType == 2)
{
if((dataLength != sizeof(*routingHdr)) || (routingHdr->SegmentsLeft != 1))
return FALSE;
*destAddr = &routingHdr->Address;
}
else *destAddr = NULL;
return TRUE;
}
| 9,357 |
28,407 | 0 | static int fib6_dump_node(struct fib6_walker_t *w)
{
int res;
struct rt6_info *rt;
for (rt = w->leaf; rt; rt = rt->dst.rt6_next) {
res = rt6_dump_route(rt, w->args);
if (res < 0) {
/* Frame is full, suspend walking */
w->leaf = rt;
return 1;
}
WARN_ON(res == 0);
}
w->leaf = NULL;
return 0;
}
| 9,358 |
106,981 | 0 | void QQuickWebViewPrivate::didChangeLoadingState(QWebLoadRequest* loadRequest)
{
Q_Q(QQuickWebView);
ASSERT(q->loading() == (loadRequest->status() == QQuickWebView::LoadStartedStatus));
emit q->loadingChanged(loadRequest);
m_loadStartedSignalSent = loadRequest->status() == QQuickWebView::LoadStartedStatus;
}
| 9,359 |
38,259 | 0 | SYSCALL_DEFINE0(munlockall)
{
int ret;
down_write(¤t->mm->mmap_sem);
ret = do_mlockall(0);
up_write(¤t->mm->mmap_sem);
return ret;
}
| 9,360 |
14,784 | 0 | ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
{
char buffer[64];
if (ftp == NULL || size <= 0) {
return 0;
}
snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
return 0;
}
if (!ftp_getresp(ftp)) {
return 0;
}
if (response) {
*response = estrdup(ftp->inbuf);
}
if (ftp->resp < 200 || ftp->resp >= 300) {
return 0;
}
return 1;
}
| 9,361 |
58,212 | 0 | static void sched_ttwu_pending(void)
{
struct rq *rq = this_rq();
struct llist_node *llist = llist_del_all(&rq->wake_list);
struct task_struct *p;
raw_spin_lock(&rq->lock);
while (llist) {
p = llist_entry(llist, struct task_struct, wake_entry);
llist = llist_next(llist);
ttwu_do_activate(rq, p, 0);
}
raw_spin_unlock(&rq->lock);
}
| 9,362 |
58,363 | 0 | void __readwrite_bug(const char *fn)
{
printk("%s called, but not implemented\n", fn);
BUG();
}
| 9,363 |
9,259 | 0 | static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx)
{
uint16_t num_heads = vring_avail_idx(vq) - idx;
/* Check it isn't doing very strange things with descriptor numbers. */
if (num_heads > vq->vring.num) {
error_report("Guest moved used index from %u to %u",
idx, vq->shadow_avail_idx);
exit(1);
}
/* On success, callers read a descriptor at vq->last_avail_idx.
* Make sure descriptor read does not bypass avail index read. */
if (num_heads) {
smp_rmb();
}
return num_heads;
}
| 9,364 |
22,201 | 0 | static int rose_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
struct full_sockaddr_rose *srose = (struct full_sockaddr_rose *)uaddr;
struct sock *sk = sock->sk;
struct rose_sock *rose = rose_sk(sk);
int n;
memset(srose, 0, sizeof(*srose));
if (peer != 0) {
if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTCONN;
srose->srose_family = AF_ROSE;
srose->srose_addr = rose->dest_addr;
srose->srose_call = rose->dest_call;
srose->srose_ndigis = rose->dest_ndigis;
for (n = 0; n < rose->dest_ndigis; n++)
srose->srose_digis[n] = rose->dest_digis[n];
} else {
srose->srose_family = AF_ROSE;
srose->srose_addr = rose->source_addr;
srose->srose_call = rose->source_call;
srose->srose_ndigis = rose->source_ndigis;
for (n = 0; n < rose->source_ndigis; n++)
srose->srose_digis[n] = rose->source_digis[n];
}
*uaddr_len = sizeof(struct full_sockaddr_rose);
return 0;
}
| 9,365 |
175,608 | 0 | OSCL_EXPORT_REF Bool PVCleanUpVideoDecoder(VideoDecControls *decCtrl)
{
int idx;
VideoDecData *video = (VideoDecData *) decCtrl->videoDecoderData;
#ifdef DEC_INTERNAL_MEMORY_OPT
if (video)
{
#ifdef PV_POSTPROC_ON
video->pstprcTypCur = NULL;
video->pstprcTypPrv = NULL;
#endif
video->acPredFlag = NULL;
video->sliceNo = NULL;
video->motX = NULL;
video->motY = NULL;
video->mblock = NULL;
video->QPMB = NULL;
video->predDC = NULL;
video->predDCAC_row = NULL;
video->predDCAC_col = NULL;
video->headerInfo.Mode = NULL;
video->headerInfo.CBP = NULL;
if (video->numberOfLayers > 1)
{
if (video->prevEnhcVop)
{
video->prevEnhcVop->uChan = NULL;
video->prevEnhcVop->vChan = NULL;
if (video->prevEnhcVop->yChan) oscl_free(video->prevEnhcVop->yChan);
oscl_free(video->prevEnhcVop);
}
}
if (video->currVop)
{
video->currVop->uChan = NULL;
video->currVop->vChan = NULL;
if (video->currVop->yChan)
video->currVop->yChan = NULL;
video->currVop = NULL;
}
if (video->prevVop)
{
video->prevVop->uChan = NULL;
video->prevVop->vChan = NULL;
if (video->prevVop->yChan)
video->prevVop->yChan = NULL;
video->prevVop = NULL;
}
if (video->vol)
{
for (idx = 0; idx < video->numberOfLayers; idx++)
{
if (video->vol[idx])
{
BitstreamClose(video->vol[idx]->bitstream);
video->vol[idx]->bitstream = NULL;
video->vol[idx] = NULL;
}
video->vopHeader[idx] = NULL;
}
video->vol = NULL;
video->vopHeader = NULL;
}
video = NULL;
decCtrl->videoDecoderData = NULL;
}
#else
if (video)
{
#ifdef PV_POSTPROC_ON
if (video->pstprcTypCur) oscl_free(video->pstprcTypCur);
if (video->pstprcTypPrv) oscl_free(video->pstprcTypPrv);
#endif
if (video->predDC) oscl_free(video->predDC);
video->predDCAC_row = NULL;
if (video->predDCAC_col) oscl_free(video->predDCAC_col);
if (video->motX) oscl_free(video->motX);
if (video->motY) oscl_free(video->motY);
if (video->mblock) oscl_free(video->mblock);
if (video->QPMB) oscl_free(video->QPMB);
if (video->headerInfo.Mode) oscl_free(video->headerInfo.Mode);
if (video->headerInfo.CBP) oscl_free(video->headerInfo.CBP);
if (video->sliceNo) oscl_free(video->sliceNo);
if (video->acPredFlag) oscl_free(video->acPredFlag);
if (video->numberOfLayers > 1)
{
if (video->prevEnhcVop)
{
video->prevEnhcVop->uChan = NULL;
video->prevEnhcVop->vChan = NULL;
if (video->prevEnhcVop->yChan) oscl_free(video->prevEnhcVop->yChan);
oscl_free(video->prevEnhcVop);
}
}
if (video->currVop)
{
#ifndef PV_MEMORY_POOL
video->currVop->uChan = NULL;
video->currVop->vChan = NULL;
if (video->currVop->yChan)
oscl_free(video->currVop->yChan);
#endif
oscl_free(video->currVop);
}
if (video->prevVop)
{
#ifndef PV_MEMORY_POOL
video->prevVop->uChan = NULL;
video->prevVop->vChan = NULL;
if (video->prevVop->yChan)
oscl_free(video->prevVop->yChan);
#endif
oscl_free(video->prevVop);
}
if (video->vol)
{
for (idx = 0; idx < video->numberOfLayers; idx++)
{
if (video->vol[idx])
{
if (video->vol[idx]->bitstream)
{
BitstreamClose(video->vol[idx]->bitstream);
oscl_free(video->vol[idx]->bitstream);
}
oscl_free(video->vol[idx]);
}
}
oscl_free(video->vol);
}
for (idx = 0; idx < video->numberOfLayers; idx++)
{
if (video->vopHeader[idx]) oscl_free(video->vopHeader[idx]);
}
if (video->vopHeader) oscl_free(video->vopHeader);
oscl_free(video);
decCtrl->videoDecoderData = NULL;
}
#endif
return PV_TRUE;
}
| 9,366 |
126,448 | 0 | void BrowserWindowGtk::UpdateFullscreenExitBubbleContent(
const GURL& url,
FullscreenExitBubbleType bubble_type) {
if (bubble_type == FEB_TYPE_NONE) {
fullscreen_exit_bubble_.reset();
} else if (fullscreen_exit_bubble_.get()) {
fullscreen_exit_bubble_->UpdateContent(url, bubble_type);
} else {
fullscreen_exit_bubble_.reset(new FullscreenExitBubbleGtk(
GTK_FLOATING_CONTAINER(render_area_floating_container_),
browser(),
url,
bubble_type));
}
}
| 9,367 |
104,694 | 0 | bool OnMatchedView(const v8::Local<v8::Value>& view_window) {
views_->Set(v8::Integer::New(index_), view_window);
index_++;
if (view_type_ == ViewType::EXTENSION_BACKGROUND_PAGE)
return false; // There can be only one...
return true;
}
| 9,368 |
84,044 | 0 | GF_Err m4ds_Write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
char *enc_ods;
u32 enc_od_size;
GF_MPEG4ExtensionDescriptorsBox *ptr = (GF_MPEG4ExtensionDescriptorsBox *) s;
if (!s) return GF_BAD_PARAM;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
enc_ods = NULL;
enc_od_size = 0;
e = gf_odf_desc_list_write(ptr->descriptors, &enc_ods, &enc_od_size);
if (e) return e;
if (enc_od_size) {
gf_bs_write_data(bs, enc_ods, enc_od_size);
gf_free(enc_ods);
}
return GF_OK;
}
| 9,369 |
73,814 | 0 | int web_server_set_alias(const char *alias_name,
const char *alias_content, size_t alias_content_length,
time_t last_modified)
{
int ret_code;
struct xml_alias_t alias;
alias_release(&gAliasDoc);
if (alias_name == NULL) {
/* don't serve aliased doc anymore */
return 0;
}
assert(alias_content != NULL);
membuffer_init(&alias.doc);
membuffer_init(&alias.name);
alias.ct = NULL;
do {
/* insert leading /, if missing */
if (*alias_name != '/')
if (membuffer_assign_str(&alias.name, "/") != 0)
break; /* error; out of mem */
ret_code = membuffer_append_str(&alias.name, alias_name);
if (ret_code != 0)
break; /* error */
if ((alias.ct = (int *)malloc(sizeof(int))) == NULL)
break; /* error */
*alias.ct = 1;
membuffer_attach(&alias.doc, (char *)alias_content,
alias_content_length);
alias.last_modified = last_modified;
/* save in module var */
ithread_mutex_lock(&gWebMutex);
gAliasDoc = alias;
ithread_mutex_unlock(&gWebMutex);
return 0;
} while (FALSE);
/* error handler */
/* free temp alias */
membuffer_destroy(&alias.name);
membuffer_destroy(&alias.doc);
free(alias.ct);
return UPNP_E_OUTOF_MEMORY;
}
| 9,370 |
125,951 | 0 | void AutomationProviderImportSettingsObserver::ImportEnded() {
if (provider_)
AutomationJSONReply(provider_, reply_message_.release()).SendSuccess(NULL);
delete this;
}
| 9,371 |
95,011 | 0 | ext4_xattr_set(struct inode *inode, int name_index, const char *name,
const void *value, size_t value_len, int flags)
{
handle_t *handle;
int error, retries = 0;
int credits = ext4_jbd2_credits_xattr(inode);
retry:
handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits);
if (IS_ERR(handle)) {
error = PTR_ERR(handle);
} else {
int error2;
error = ext4_xattr_set_handle(handle, inode, name_index, name,
value, value_len, flags);
error2 = ext4_journal_stop(handle);
if (error == -ENOSPC &&
ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry;
if (error == 0)
error = error2;
}
return error;
}
| 9,372 |
128,111 | 0 | void SynchronousCompositorOutputSurface::SetSyncClient(
SynchronousCompositorOutputSurfaceClient* compositor) {
DCHECK(CalledOnValidThread());
sync_client_ = compositor;
}
| 9,373 |
170,872 | 0 | void SampleIterator::reset() {
mSampleToChunkIndex = 0;
mFirstChunk = 0;
mFirstChunkSampleIndex = 0;
mStopChunk = 0;
mStopChunkSampleIndex = 0;
mSamplesPerChunk = 0;
mChunkDesc = 0;
}
| 9,374 |
112,432 | 0 | bool Document::cssStickyPositionEnabled() const
{
return settings() && settings()->cssStickyPositionEnabled();
}
| 9,375 |
177,399 | 0 | long Track::GetFirst(const BlockEntry*& pBlockEntry) const {
const Cluster* pCluster = m_pSegment->GetFirst();
for (int i = 0;;) {
if (pCluster == NULL) {
pBlockEntry = GetEOS();
return 1;
}
if (pCluster->EOS()) {
if (m_pSegment->DoneParsing()) {
pBlockEntry = GetEOS();
return 1;
}
pBlockEntry = 0;
return E_BUFFER_NOT_FULL;
}
long status = pCluster->GetFirst(pBlockEntry);
if (status < 0) // error
return status;
if (pBlockEntry == 0) { // empty cluster
pCluster = m_pSegment->GetNext(pCluster);
continue;
}
for (;;) {
const Block* const pBlock = pBlockEntry->GetBlock();
assert(pBlock);
const long long tn = pBlock->GetTrackNumber();
if ((tn == m_info.number) && VetEntry(pBlockEntry))
return 0;
const BlockEntry* pNextEntry;
status = pCluster->GetNext(pBlockEntry, pNextEntry);
if (status < 0) // error
return status;
if (pNextEntry == 0)
break;
pBlockEntry = pNextEntry;
}
++i;
if (i >= 100)
break;
pCluster = m_pSegment->GetNext(pCluster);
}
pBlockEntry = GetEOS(); // so we can return a non-NULL value
return 1;
}
| 9,376 |
35,421 | 0 | static siginfo_t *fill_trap_info(struct pt_regs *regs, int signr, int trapnr,
siginfo_t *info)
{
unsigned long siaddr;
int sicode;
switch (trapnr) {
default:
return SEND_SIG_PRIV;
case X86_TRAP_DE:
sicode = FPE_INTDIV;
siaddr = uprobe_get_trap_addr(regs);
break;
case X86_TRAP_UD:
sicode = ILL_ILLOPN;
siaddr = uprobe_get_trap_addr(regs);
break;
case X86_TRAP_AC:
sicode = BUS_ADRALN;
siaddr = 0;
break;
}
info->si_signo = signr;
info->si_errno = 0;
info->si_code = sicode;
info->si_addr = (void __user *)siaddr;
return info;
}
| 9,377 |
60,475 | 0 | R_API RFlagItem *r_flag_get_i2(RFlag *f, ut64 off) {
RFlagItem *oitem = NULL, *item = NULL;
RListIter *iter;
const RList *list = r_flag_get_list (f, off);
if (!list) {
return NULL;
}
r_list_foreach (list, iter, item) {
if (!item->name) {
continue;
}
/* catch sym. first */
if (!strncmp (item->name, "loc.", 4)) {
continue;
}
if (!strncmp (item->name, "fcn.", 4)) {
continue;
}
if (!strncmp (item->name, "section.", 8)) {
continue;
}
if (!strncmp (item->name, "section_end.", 12)) {
continue;
}
if (r_str_nlen (item->name, 5) > 4 &&
item->name[3] == '.') {
oitem = item;
break;
}
oitem = item;
if (strlen (item->name) < 5 || item->name[3]!='.') continue;
oitem = item;
}
return evalFlag (f, oitem);
}
| 9,378 |
34,110 | 0 | void __exit rfcomm_cleanup_sockets(void)
{
debugfs_remove(rfcomm_sock_debugfs);
if (bt_sock_unregister(BTPROTO_RFCOMM) < 0)
BT_ERR("RFCOMM socket layer unregistration failed");
proto_unregister(&rfcomm_proto);
}
| 9,379 |
153,083 | 0 | PDFiumEngine::PDFiumEngine(PDFEngine::Client* client)
: client_(client),
current_zoom_(1.0),
current_rotation_(0),
doc_loader_(this),
password_tries_remaining_(0),
doc_(nullptr),
form_(nullptr),
defer_page_unload_(false),
selecting_(false),
mouse_down_state_(PDFiumPage::NONSELECTABLE_AREA,
PDFiumPage::LinkTarget()),
next_page_to_search_(-1),
last_page_to_search_(-1),
last_character_index_to_search_(-1),
permissions_(0),
permissions_handler_revision_(-1),
fpdf_availability_(nullptr),
next_timer_id_(0),
last_page_mouse_down_(-1),
most_visible_page_(-1),
called_do_document_action_(false),
render_grayscale_(false),
render_annots_(true),
progressive_paint_timeout_(0),
getting_password_(false) {
find_factory_.Initialize(this);
password_factory_.Initialize(this);
file_access_.m_FileLen = 0;
file_access_.m_GetBlock = &GetBlock;
file_access_.m_Param = &doc_loader_;
file_availability_.version = 1;
file_availability_.IsDataAvail = &IsDataAvail;
file_availability_.loader = &doc_loader_;
download_hints_.version = 1;
download_hints_.AddSegment = &AddSegment;
download_hints_.loader = &doc_loader_;
FPDF_FORMFILLINFO::version = 1;
FPDF_FORMFILLINFO::m_pJsPlatform = this;
FPDF_FORMFILLINFO::Release = nullptr;
FPDF_FORMFILLINFO::FFI_Invalidate = Form_Invalidate;
FPDF_FORMFILLINFO::FFI_OutputSelectedRect = Form_OutputSelectedRect;
FPDF_FORMFILLINFO::FFI_SetCursor = Form_SetCursor;
FPDF_FORMFILLINFO::FFI_SetTimer = Form_SetTimer;
FPDF_FORMFILLINFO::FFI_KillTimer = Form_KillTimer;
FPDF_FORMFILLINFO::FFI_GetLocalTime = Form_GetLocalTime;
FPDF_FORMFILLINFO::FFI_OnChange = Form_OnChange;
FPDF_FORMFILLINFO::FFI_GetPage = Form_GetPage;
FPDF_FORMFILLINFO::FFI_GetCurrentPage = Form_GetCurrentPage;
FPDF_FORMFILLINFO::FFI_GetRotation = Form_GetRotation;
FPDF_FORMFILLINFO::FFI_ExecuteNamedAction = Form_ExecuteNamedAction;
FPDF_FORMFILLINFO::FFI_SetTextFieldFocus = Form_SetTextFieldFocus;
FPDF_FORMFILLINFO::FFI_DoURIAction = Form_DoURIAction;
FPDF_FORMFILLINFO::FFI_DoGoToAction = Form_DoGoToAction;
#if defined(PDF_ENABLE_XFA)
FPDF_FORMFILLINFO::version = 2;
FPDF_FORMFILLINFO::FFI_EmailTo = Form_EmailTo;
FPDF_FORMFILLINFO::FFI_DisplayCaret = Form_DisplayCaret;
FPDF_FORMFILLINFO::FFI_SetCurrentPage = Form_SetCurrentPage;
FPDF_FORMFILLINFO::FFI_GetCurrentPageIndex = Form_GetCurrentPageIndex;
FPDF_FORMFILLINFO::FFI_GetPageViewRect = Form_GetPageViewRect;
FPDF_FORMFILLINFO::FFI_GetPlatform = Form_GetPlatform;
FPDF_FORMFILLINFO::FFI_PageEvent = nullptr;
FPDF_FORMFILLINFO::FFI_PopupMenu = Form_PopupMenu;
FPDF_FORMFILLINFO::FFI_PostRequestURL = Form_PostRequestURL;
FPDF_FORMFILLINFO::FFI_PutRequestURL = Form_PutRequestURL;
FPDF_FORMFILLINFO::FFI_UploadTo = Form_UploadTo;
FPDF_FORMFILLINFO::FFI_DownloadFromURL = Form_DownloadFromURL;
FPDF_FORMFILLINFO::FFI_OpenFile = Form_OpenFile;
FPDF_FORMFILLINFO::FFI_GotoURL = Form_GotoURL;
FPDF_FORMFILLINFO::FFI_GetLanguage = Form_GetLanguage;
#endif // defined(PDF_ENABLE_XFA)
IPDF_JSPLATFORM::version = 3;
IPDF_JSPLATFORM::app_alert = Form_Alert;
IPDF_JSPLATFORM::app_beep = Form_Beep;
IPDF_JSPLATFORM::app_response = Form_Response;
IPDF_JSPLATFORM::Doc_getFilePath = Form_GetFilePath;
IPDF_JSPLATFORM::Doc_mail = Form_Mail;
IPDF_JSPLATFORM::Doc_print = Form_Print;
IPDF_JSPLATFORM::Doc_submitForm = Form_SubmitForm;
IPDF_JSPLATFORM::Doc_gotoPage = Form_GotoPage;
IPDF_JSPLATFORM::Field_browse = Form_Browse;
IFSDK_PAUSE::version = 1;
IFSDK_PAUSE::user = nullptr;
IFSDK_PAUSE::NeedToPauseNow = Pause_NeedToPauseNow;
#if defined(OS_LINUX)
pp::Instance* instance = client_->GetPluginInstance();
if (instance)
g_last_instance_id = instance->pp_instance();
#endif
}
| 9,380 |
67,668 | 0 | struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len,
gfp_t gfp_mask)
{
struct page_frag_cache *nc;
unsigned long flags;
struct sk_buff *skb;
bool pfmemalloc;
void *data;
len += NET_SKB_PAD;
if ((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) ||
(gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) {
skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE);
if (!skb)
goto skb_fail;
goto skb_success;
}
len += SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
len = SKB_DATA_ALIGN(len);
if (sk_memalloc_socks())
gfp_mask |= __GFP_MEMALLOC;
local_irq_save(flags);
nc = this_cpu_ptr(&netdev_alloc_cache);
data = page_frag_alloc(nc, len, gfp_mask);
pfmemalloc = nc->pfmemalloc;
local_irq_restore(flags);
if (unlikely(!data))
return NULL;
skb = __build_skb(data, len);
if (unlikely(!skb)) {
skb_free_frag(data);
return NULL;
}
/* use OR instead of assignment to avoid clearing of bits in mask */
if (pfmemalloc)
skb->pfmemalloc = 1;
skb->head_frag = 1;
skb_success:
skb_reserve(skb, NET_SKB_PAD);
skb->dev = dev;
skb_fail:
return skb;
}
| 9,381 |
184,162 | 1 | inline void PulseAudioMixer::MainloopLock() const {
pa_threaded_mainloop_lock(pa_mainloop_);
++mainloop_lock_count_;
}
| 9,382 |
106,768 | 0 | void WebView::startTrackingMouseLeave()
{
if (m_trackingMouseLeave)
return;
m_trackingMouseLeave = true;
TRACKMOUSEEVENT trackMouseEvent;
trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
trackMouseEvent.dwFlags = TME_LEAVE;
trackMouseEvent.hwndTrack = m_window;
::TrackMouseEvent(&trackMouseEvent);
}
| 9,383 |
90,873 | 0 | int main (void) {
test_burl_normalize();
return 0;
}
| 9,384 |
40,296 | 0 | static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb)
{
struct sock *sk = (struct sock *)chan->private;
return __pppoe_xmit(sk, skb);
}
| 9,385 |
180,942 | 1 | SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
const void __user * __user *, pages,
const int __user *, nodes,
int __user *, status, int, flags)
{
const struct cred *cred = current_cred(), *tcred;
struct task_struct *task;
struct mm_struct *mm;
int err;
nodemask_t task_nodes;
/* Check flags */
if (flags & ~(MPOL_MF_MOVE|MPOL_MF_MOVE_ALL))
return -EINVAL;
if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_NICE))
return -EPERM;
/* Find the mm_struct */
rcu_read_lock();
task = pid ? find_task_by_vpid(pid) : current;
if (!task) {
rcu_read_unlock();
return -ESRCH;
}
get_task_struct(task);
/*
* Check if this process has the right to modify the specified
* process. The right exists if the process has administrative
* capabilities, superuser privileges or the same
* userid as the target process.
*/
tcred = __task_cred(task);
if (!uid_eq(cred->euid, tcred->suid) && !uid_eq(cred->euid, tcred->uid) &&
!uid_eq(cred->uid, tcred->suid) && !uid_eq(cred->uid, tcred->uid) &&
!capable(CAP_SYS_NICE)) {
rcu_read_unlock();
err = -EPERM;
goto out;
}
rcu_read_unlock();
err = security_task_movememory(task);
if (err)
goto out;
task_nodes = cpuset_mems_allowed(task);
mm = get_task_mm(task);
put_task_struct(task);
if (!mm)
return -EINVAL;
if (nodes)
err = do_pages_move(mm, task_nodes, nr_pages, pages,
nodes, status, flags);
else
err = do_pages_stat(mm, nr_pages, pages, status);
mmput(mm);
return err;
out:
put_task_struct(task);
return err;
}
| 9,386 |
24,434 | 0 | int proc_doulongvec_minmax(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
return -ENOSYS;
}
| 9,387 |
22,542 | 0 | static int sched_feat_show(struct seq_file *m, void *v)
{
int i;
for (i = 0; sched_feat_names[i]; i++) {
if (!(sysctl_sched_features & (1UL << i)))
seq_puts(m, "NO_");
seq_printf(m, "%s ", sched_feat_names[i]);
}
seq_puts(m, "\n");
return 0;
}
| 9,388 |
184,881 | 1 | void WebContentsImpl::DidFailProvisionalLoadWithError(
RenderViewHost* render_view_host,
const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {
VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
<< ", error_code: " << params.error_code
<< ", error_description: " << params.error_description
<< ", is_main_frame: " << params.is_main_frame
<< ", showing_repost_interstitial: " <<
params.showing_repost_interstitial
<< ", frame_id: " << params.frame_id;
GURL validated_url(params.url);
RenderProcessHost* render_process_host =
render_view_host->GetProcess();
RenderViewHost::FilterURL(render_process_host, false, &validated_url);
if (net::ERR_ABORTED == params.error_code) {
if (ShowingInterstitialPage()) {
LOG(WARNING) << "Discarding message during interstitial.";
return;
}
render_manager_.RendererAbortedProvisionalLoad(render_view_host);
}
FOR_EACH_OBSERVER(WebContentsObserver,
observers_,
DidFailProvisionalLoad(params.frame_id,
params.is_main_frame,
validated_url,
params.error_code,
params.error_description,
render_view_host));
}
| 9,389 |
154,707 | 0 | error::Error GLES2DecoderPassthroughImpl::DoGetShaderiv(GLuint shader,
GLenum pname,
GLsizei bufsize,
GLsizei* length,
GLint* params) {
api()->glGetShaderivRobustANGLEFn(GetShaderServiceID(shader, resources_),
pname, bufsize, length, params);
return error::kNoError;
}
| 9,390 |
13,887 | 0 | pdf_dict_geta(fz_context *ctx, pdf_obj *obj, pdf_obj *key, pdf_obj *abbrev)
{
pdf_obj *v;
v = pdf_dict_get(ctx, obj, key);
if (v)
return v;
return pdf_dict_get(ctx, obj, abbrev);
}
| 9,391 |
833 | 0 | void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
Stream *str, int width, int height,
GfxImageColorMap *colorMap,
Stream *maskStr, int maskWidth,
int maskHeight, GBool maskInvert) {
GfxImageColorMap *maskColorMap;
Object maskDecode, decodeLow, decodeHigh;
double *ctm;
SplashCoord mat[6];
SplashOutMaskedImageData imgData;
SplashOutImageMaskData imgMaskData;
SplashColorMode srcMode;
SplashBitmap *maskBitmap;
Splash *maskSplash;
SplashColor maskColor;
GfxGray gray;
GfxRGB rgb;
#if SPLASH_CMYK
GfxCMYK cmyk;
#endif
Guchar pix;
int n, i;
if (maskWidth > width || maskHeight > height) {
decodeLow.initInt(maskInvert ? 0 : 1);
decodeHigh.initInt(maskInvert ? 1 : 0);
maskDecode.initArray(xref);
maskDecode.arrayAdd(&decodeLow);
maskDecode.arrayAdd(&decodeHigh);
maskColorMap = new GfxImageColorMap(1, &maskDecode,
new GfxDeviceGrayColorSpace());
maskDecode.free();
drawSoftMaskedImage(state, ref, str, width, height, colorMap,
maskStr, maskWidth, maskHeight, maskColorMap);
delete maskColorMap;
} else {
mat[0] = (SplashCoord)width;
mat[1] = 0;
mat[2] = 0;
mat[3] = (SplashCoord)height;
mat[4] = 0;
mat[5] = 0;
imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, 1, 1);
imgMaskData.imgStr->reset();
imgMaskData.invert = maskInvert ? 0 : 1;
imgMaskData.width = maskWidth;
imgMaskData.height = maskHeight;
imgMaskData.y = 0;
maskBitmap = new SplashBitmap(width, height, 1, splashModeMono1, gFalse);
maskSplash = new Splash(maskBitmap, gFalse);
maskColor[0] = 0;
maskSplash->clear(maskColor);
maskColor[0] = 0xff;
maskSplash->setFillPattern(new SplashSolidColor(maskColor));
maskSplash->fillImageMask(&imageMaskSrc, &imgMaskData,
maskWidth, maskHeight, mat, gFalse);
delete imgMaskData.imgStr;
maskStr->close();
delete maskSplash;
ctm = state->getCTM();
mat[0] = ctm[0];
mat[1] = ctm[1];
mat[2] = -ctm[2];
mat[3] = -ctm[3];
mat[4] = ctm[2] + ctm[4];
mat[5] = ctm[3] + ctm[5];
imgData.imgStr = new ImageStream(str, width,
colorMap->getNumPixelComps(),
colorMap->getBits());
imgData.imgStr->reset();
imgData.colorMap = colorMap;
imgData.mask = maskBitmap;
imgData.colorMode = colorMode;
imgData.width = width;
imgData.height = height;
imgData.y = 0;
imgData.lookup = NULL;
if (colorMap->getNumPixelComps() == 1) {
n = 1 << colorMap->getBits();
switch (colorMode) {
case splashModeMono1:
case splashModeMono8:
imgData.lookup = (SplashColorPtr)gmalloc(n);
for (i = 0; i < n; ++i) {
pix = (Guchar)i;
colorMap->getGray(&pix, &gray);
imgData.lookup[i] = colToByte(gray);
}
break;
case splashModeRGB8:
case splashModeBGR8:
imgData.lookup = (SplashColorPtr)gmallocn(n, 3);
for (i = 0; i < n; ++i) {
pix = (Guchar)i;
colorMap->getRGB(&pix, &rgb);
imgData.lookup[3*i] = colToByte(rgb.r);
imgData.lookup[3*i+1] = colToByte(rgb.g);
imgData.lookup[3*i+2] = colToByte(rgb.b);
}
break;
case splashModeXBGR8:
imgData.lookup = (SplashColorPtr)gmallocn(n, 4);
for (i = 0; i < n; ++i) {
pix = (Guchar)i;
colorMap->getRGB(&pix, &rgb);
imgData.lookup[4*i] = colToByte(rgb.r);
imgData.lookup[4*i+1] = colToByte(rgb.g);
imgData.lookup[4*i+2] = colToByte(rgb.b);
imgData.lookup[4*i+3] = 255;
}
break;
#if SPLASH_CMYK
case splashModeCMYK8:
imgData.lookup = (SplashColorPtr)gmallocn(n, 4);
for (i = 0; i < n; ++i) {
pix = (Guchar)i;
colorMap->getCMYK(&pix, &cmyk);
imgData.lookup[4*i] = colToByte(cmyk.c);
imgData.lookup[4*i+1] = colToByte(cmyk.m);
imgData.lookup[4*i+2] = colToByte(cmyk.y);
imgData.lookup[4*i+3] = colToByte(cmyk.k);
}
break;
#endif
}
}
if (colorMode == splashModeMono1) {
srcMode = splashModeMono8;
} else {
srcMode = colorMode;
}
splash->drawImage(&maskedImageSrc, &imgData, srcMode, gTrue,
width, height, mat);
delete maskBitmap;
gfree(imgData.lookup);
delete imgData.imgStr;
str->close();
}
}
| 9,392 |
171,044 | 0 | bool RilSapSocket::SocketExists(const char *socketName) {
RilSapSocketList* current = head;
while(NULL != current) {
if(strcmp(current->socket->name, socketName) == 0) {
return true;
}
current = current->next;
}
return false;
}
| 9,393 |
18,932 | 0 | int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc)
{
int err;
struct cmsghdr *cmsg;
for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
if (!CMSG_OK(msg, cmsg))
return -EINVAL;
if (cmsg->cmsg_level != SOL_IP)
continue;
switch (cmsg->cmsg_type) {
case IP_RETOPTS:
err = cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr));
err = ip_options_get(net, &ipc->opt, CMSG_DATA(cmsg),
err < 40 ? err : 40);
if (err)
return err;
break;
case IP_PKTINFO:
{
struct in_pktinfo *info;
if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct in_pktinfo)))
return -EINVAL;
info = (struct in_pktinfo *)CMSG_DATA(cmsg);
ipc->oif = info->ipi_ifindex;
ipc->addr = info->ipi_spec_dst.s_addr;
break;
}
default:
return -EINVAL;
}
}
return 0;
}
| 9,394 |
58,040 | 0 | static int nft_trans_table_add(struct nft_ctx *ctx, int msg_type)
{
struct nft_trans *trans;
trans = nft_trans_alloc(ctx, msg_type, sizeof(struct nft_trans_table));
if (trans == NULL)
return -ENOMEM;
if (msg_type == NFT_MSG_NEWTABLE)
ctx->table->flags |= NFT_TABLE_INACTIVE;
list_add_tail(&trans->list, &ctx->net->nft.commit_list);
return 0;
}
| 9,395 |
53,349 | 0 | static void lex_save_cached(lex_t *lex)
{
while(lex->stream.buffer[lex->stream.buffer_pos] != '\0')
{
lex_save(lex, lex->stream.buffer[lex->stream.buffer_pos]);
lex->stream.buffer_pos++;
lex->stream.position++;
}
}
| 9,396 |
123,939 | 0 | void RenderViewImpl::SetFocusAndActivateForTesting(bool enable) {
if (enable) {
if (has_focus())
return;
OnSetActive(true);
OnSetFocus(true);
} else {
if (!has_focus())
return;
OnSetFocus(false);
OnSetActive(false);
}
}
| 9,397 |
77,457 | 0 | netdev_port_features_to_ofp10(enum netdev_features features)
{
return htonl((features & 0x7f) | ((features & 0xf800) >> 4));
}
| 9,398 |
13,545 | 0 | static void Free_PosClassRule( HB_PosClassRule* pcr )
{
FREE( pcr->PosLookupRecord );
FREE( pcr->Class );
}
| 9,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.