unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
|---|---|---|---|
142,189
| 0
|
base::FilePath GetTeamDrivePath(const std::string& team_drive_name) {
return GetTeamDriveGrandRoot().Append(team_drive_name);
}
| 12,600
|
112,292
| 0
|
bool ShellWindow::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ShellWindow, message)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
| 12,601
|
82,823
| 0
|
struct MACH0_(obj_t)* MACH0_(mach0_new)(const char* file, bool verbose) {
ut8 *buf;
struct MACH0_(obj_t) *bin;
if (!(bin = malloc (sizeof (struct MACH0_(obj_t))))) {
return NULL;
}
memset (bin, 0, sizeof (struct MACH0_(obj_t)));
bin->verbose = verbose;
bin->file = file;
if (!(buf = (ut8*)r_file_slurp (file, &bin->size))) {
return MACH0_(mach0_free)(bin);
}
bin->b = r_buf_new ();
if (!r_buf_set_bytes (bin->b, buf, bin->size)) {
free (buf);
return MACH0_(mach0_free)(bin);
}
free (buf);
bin->dyld_info = NULL;
if (!init (bin)) {
return MACH0_(mach0_free)(bin);
}
bin->imports_by_ord_size = 0;
bin->imports_by_ord = NULL;
return bin;
}
| 12,602
|
36,023
| 0
|
static int ceph_x_encrypt(struct ceph_crypto_key *secret,
void *ibuf, int ilen, void *obuf, size_t olen)
{
struct ceph_x_encrypt_header head = {
.struct_v = 1,
.magic = cpu_to_le64(CEPHX_ENC_MAGIC)
};
size_t len = olen - sizeof(u32);
int ret;
ret = ceph_encrypt2(secret, obuf + sizeof(u32), &len,
&head, sizeof(head), ibuf, ilen);
if (ret)
return ret;
ceph_encode_32(&obuf, len);
return len + sizeof(u32);
}
| 12,603
|
117,003
| 0
|
bool GestureSequence::Click(const TouchEvent& event,
const GesturePoint& point, Gestures* gestures) {
DCHECK(state_ == GS_PENDING_SYNTHETIC_CLICK);
if (point.IsInClickWindow(event)) {
AppendClickGestureEvent(point, gestures);
if (point.IsInDoubleClickWindow(event))
AppendDoubleClickGestureEvent(point, gestures);
return true;
}
return false;
}
| 12,604
|
40,904
| 0
|
static int json_integer_equal(json_t *integer1, json_t *integer2)
{
return json_integer_value(integer1) == json_integer_value(integer2);
}
| 12,605
|
9,619
| 0
|
static zend_bool php_check_cancel_upload(php_session_rfc1867_progress *progress TSRMLS_DC) /* {{{ */
{
zval **progress_ary, **cancel_upload;
if (zend_symtable_find(Z_ARRVAL_P(PS(http_session_vars)), progress->key.c, progress->key.len+1, (void**)&progress_ary) != SUCCESS) {
return 0;
}
if (Z_TYPE_PP(progress_ary) != IS_ARRAY) {
return 0;
}
if (zend_hash_find(Z_ARRVAL_PP(progress_ary), "cancel_upload", sizeof("cancel_upload"), (void**)&cancel_upload) != SUCCESS) {
return 0;
}
return Z_TYPE_PP(cancel_upload) == IS_BOOL && Z_LVAL_PP(cancel_upload);
} /* }}} */
| 12,606
|
48,891
| 0
|
void netdev_rx_csum_fault(struct net_device *dev)
{
if (net_ratelimit()) {
pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
dump_stack();
}
}
| 12,607
|
3,936
| 0
|
GBool CMYKGrayEncoder::fillBuf() {
int c0, c1, c2, c3;
int i;
if (eof) {
return gFalse;
}
c0 = str->getChar();
c1 = str->getChar();
c2 = str->getChar();
c3 = str->getChar();
if (c3 == EOF) {
eof = gTrue;
return gFalse;
}
i = (3 * c0 + 6 * c1 + c2) / 10 + c3;
if (i > 255) i = 255;
bufPtr = bufEnd = buf;
*bufEnd++ = (char) i;
return gTrue;
}
| 12,608
|
42,174
| 0
|
static inline int current_is_64bit(void)
{
/*
* We can't use test_thread_flag() here because we may be on an
* interrupt stack, and the thread flags don't get copied over
* from the thread_info on the main stack to the interrupt stack.
*/
return !test_ti_thread_flag(task_thread_info(current), TIF_32BIT);
}
| 12,609
|
138,820
| 0
|
~ScopedCommitStateResetter() {
if (!disabled_) {
render_frame_host_->set_nav_entry_id(0);
}
}
| 12,610
|
170,644
| 0
|
int Effect_SetState(preproc_effect_t *effect, uint32_t state)
{
int status = 0;
ALOGV("Effect_SetState proc %d, new %d old %d", effect->procId, state, effect->state);
switch(state) {
case PREPROC_EFFECT_STATE_INIT:
switch(effect->state) {
case PREPROC_EFFECT_STATE_ACTIVE:
effect->ops->disable(effect);
Session_SetProcEnabled(effect->session, effect->procId, false);
case PREPROC_EFFECT_STATE_CONFIG:
case PREPROC_EFFECT_STATE_CREATED:
case PREPROC_EFFECT_STATE_INIT:
break;
default:
BAD_STATE_ABORT(effect->state, state);
}
break;
case PREPROC_EFFECT_STATE_CREATED:
switch(effect->state) {
case PREPROC_EFFECT_STATE_INIT:
status = effect->ops->create(effect);
break;
case PREPROC_EFFECT_STATE_CREATED:
case PREPROC_EFFECT_STATE_ACTIVE:
case PREPROC_EFFECT_STATE_CONFIG:
ALOGE("Effect_SetState invalid transition");
status = -ENOSYS;
break;
default:
BAD_STATE_ABORT(effect->state, state);
}
break;
case PREPROC_EFFECT_STATE_CONFIG:
switch(effect->state) {
case PREPROC_EFFECT_STATE_INIT:
ALOGE("Effect_SetState invalid transition");
status = -ENOSYS;
break;
case PREPROC_EFFECT_STATE_ACTIVE:
effect->ops->disable(effect);
Session_SetProcEnabled(effect->session, effect->procId, false);
break;
case PREPROC_EFFECT_STATE_CREATED:
case PREPROC_EFFECT_STATE_CONFIG:
break;
default:
BAD_STATE_ABORT(effect->state, state);
}
break;
case PREPROC_EFFECT_STATE_ACTIVE:
switch(effect->state) {
case PREPROC_EFFECT_STATE_INIT:
case PREPROC_EFFECT_STATE_CREATED:
ALOGE("Effect_SetState invalid transition");
status = -ENOSYS;
break;
case PREPROC_EFFECT_STATE_ACTIVE:
break;
case PREPROC_EFFECT_STATE_CONFIG:
effect->ops->enable(effect);
Session_SetProcEnabled(effect->session, effect->procId, true);
break;
default:
BAD_STATE_ABORT(effect->state, state);
}
break;
default:
BAD_STATE_ABORT(effect->state, state);
}
if (status == 0) {
effect->state = state;
}
return status;
}
| 12,611
|
160,727
| 0
|
void RenderFrameImpl::SetCustomURLLoaderFactory(
network::mojom::URLLoaderFactoryPtr factory) {
GetLoaderFactoryBundle()->SetDefaultFactory(std::move(factory));
}
| 12,612
|
111,314
| 0
|
void WebPagePrivate::resumeRootLayerCommit()
{
if (!m_suspendRootLayerCommit)
return;
m_suspendRootLayerCommit = false;
m_needsCommit = true;
}
| 12,613
|
162,750
| 0
|
void BaseRenderingContext2D::putImageData(ImageData* data,
int dx,
int dy,
int dirty_x,
int dirty_y,
int dirty_width,
int dirty_height,
ExceptionState& exception_state) {
if (!WTF::CheckMul(dirty_width, dirty_height).IsValid<int>()) {
return;
}
usage_counters_.num_put_image_data_calls++;
usage_counters_.area_put_image_data_calls += dirty_width * dirty_height;
if (data->BufferBase()->IsNeutered()) {
exception_state.ThrowDOMException(kInvalidStateError,
"The source data has been neutered.");
return;
}
ImageBuffer* buffer = GetImageBuffer();
if (!buffer)
return;
if (dirty_width < 0) {
dirty_x += dirty_width;
dirty_width = -dirty_width;
}
if (dirty_height < 0) {
dirty_y += dirty_height;
dirty_height = -dirty_height;
}
IntRect dest_rect(dirty_x, dirty_y, dirty_width, dirty_height);
dest_rect.Intersect(IntRect(0, 0, data->width(), data->height()));
IntSize dest_offset(static_cast<int>(dx), static_cast<int>(dy));
dest_rect.Move(dest_offset);
dest_rect.Intersect(IntRect(IntPoint(), buffer->Size()));
if (dest_rect.IsEmpty())
return;
Optional<ScopedUsHistogramTimer> timer;
if (!IsPaint2D()) {
if (GetImageBuffer() && GetImageBuffer()->IsAccelerated()) {
DEFINE_THREAD_SAFE_STATIC_LOCAL(
CustomCountHistogram, scoped_us_counter_gpu,
("Blink.Canvas.PutImageData.GPU", 0, 10000000, 50));
timer.emplace(scoped_us_counter_gpu);
} else {
DEFINE_THREAD_SAFE_STATIC_LOCAL(
CustomCountHistogram, scoped_us_counter_cpu,
("Blink.Canvas.PutImageData.CPU", 0, 10000000, 50));
timer.emplace(scoped_us_counter_cpu);
}
}
IntRect source_rect(dest_rect);
source_rect.Move(-dest_offset);
CheckOverdraw(dest_rect, nullptr, CanvasRenderingContext2DState::kNoImage,
kUntransformedUnclippedFill);
CanvasColorParams data_color_params = data->GetCanvasColorParams();
CanvasColorParams context_color_params =
CanvasColorParams(ColorSpace(), PixelFormat(), kNonOpaque);
if (data_color_params.NeedsColorConversion(context_color_params) ||
PixelFormat() == kF16CanvasPixelFormat) {
unsigned data_length =
data->Size().Area() * context_color_params.BytesPerPixel();
std::unique_ptr<uint8_t[]> converted_pixels(new uint8_t[data_length]);
if (data->ImageDataInCanvasColorSettings(ColorSpace(), PixelFormat(),
converted_pixels.get(),
kRGBAColorType)) {
buffer->PutByteArray(converted_pixels.get(),
IntSize(data->width(), data->height()), source_rect,
IntPoint(dest_offset));
}
} else {
buffer->PutByteArray(data->data()->Data(),
IntSize(data->width(), data->height()), source_rect,
IntPoint(dest_offset));
}
DidDraw(dest_rect);
}
| 12,614
|
3,181
| 0
|
zincludecolorspace(i_ctx_t * i_ctx_p)
{
os_ptr op = osp;
ref nsref;
int code;
check_type(*op, t_name);
name_string_ref(imemory, op, &nsref);
code = gs_includecolorspace(igs, nsref.value.const_bytes, r_size(&nsref));
if (!code)
pop(1);
return code;
}
| 12,615
|
169,420
| 0
|
ResourceRequest CreateXHRRequestWithOrigin(const char* origin) {
ResourceRequest request = CreateXHRRequest("http://bar.com/simple_page.html");
request.site_for_cookies = GURL(origin);
request.headers.SetHeader(net::HttpRequestHeaders::kOrigin, origin);
return request;
}
| 12,616
|
109,801
| 0
|
void Document::setBaseURLOverride(const KURL& url)
{
m_baseURLOverride = url;
updateBaseURL();
}
| 12,617
|
160,150
| 0
|
void BackendIO::OpenEntry(const std::string& key, Entry** entry) {
operation_ = OP_OPEN;
key_ = key;
entry_ptr_ = entry;
}
| 12,618
|
153,577
| 0
|
void GLES2Implementation::BufferDataHelper(GLenum target,
GLsizeiptr size,
const void* data,
GLenum usage) {
if (!ValidateSize("glBufferData", size))
return;
#if defined(MEMORY_SANITIZER) && !defined(OS_NACL)
if (data)
__msan_check_mem_is_initialized(data, size);
#endif
GLuint buffer_id;
if (GetBoundPixelTransferBuffer(target, "glBufferData", &buffer_id)) {
if (!buffer_id) {
return;
}
BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffer_id);
if (buffer)
RemoveTransferBuffer(buffer);
buffer = buffer_tracker_->CreateBuffer(buffer_id, size);
DCHECK(buffer);
if (buffer->address() && data)
memcpy(buffer->address(), data, size);
return;
}
if (IsReadbackUsage(usage)) {
GLuint id = GetBoundBufferHelper(target);
readback_buffer_shadow_tracker_->GetOrCreateBuffer(id, size);
}
RemoveMappedBufferRangeByTarget(target);
if (size == 0 || !data) {
helper_->BufferData(target, size, 0, 0, usage);
return;
}
ScopedTransferBufferPtr buffer(size, helper_, transfer_buffer_);
if (!buffer.valid()) {
return;
}
if (buffer.size() >= static_cast<unsigned int>(size)) {
memcpy(buffer.address(), data, size);
helper_->BufferData(target, size, buffer.shm_id(), buffer.offset(), usage);
return;
}
helper_->BufferData(target, size, 0, 0, usage);
BufferSubDataHelperImpl(target, 0, size, data, &buffer);
CheckGLError();
}
| 12,619
|
41,504
| 0
|
static inline void dn_socket_format_entry(struct seq_file *seq, struct sock *sk)
{
struct dn_scp *scp = DN_SK(sk);
char buf1[DN_ASCBUF_LEN];
char buf2[DN_ASCBUF_LEN];
char local_object[DN_MAXOBJL+3];
char remote_object[DN_MAXOBJL+3];
dn_printable_object(&scp->addr, local_object);
dn_printable_object(&scp->peer, remote_object);
seq_printf(seq,
"%6s/%04X %04d:%04d %04d:%04d %01d %-16s "
"%6s/%04X %04d:%04d %04d:%04d %01d %-16s %4s %s\n",
dn_addr2asc(le16_to_cpu(dn_saddr2dn(&scp->addr)), buf1),
scp->addrloc,
scp->numdat,
scp->numoth,
scp->ackxmt_dat,
scp->ackxmt_oth,
scp->flowloc_sw,
local_object,
dn_addr2asc(le16_to_cpu(dn_saddr2dn(&scp->peer)), buf2),
scp->addrrem,
scp->numdat_rcv,
scp->numoth_rcv,
scp->ackrcv_dat,
scp->ackrcv_oth,
scp->flowrem_sw,
remote_object,
dn_state2asc(scp->state),
((scp->accept_mode == ACC_IMMED) ? "IMMED" : "DEFER"));
}
| 12,620
|
37,788
| 0
|
static int nested_svm_intercept_ioio(struct vcpu_svm *svm)
{
unsigned port, size, iopm_len;
u16 val, mask;
u8 start_bit;
u64 gpa;
if (!(svm->nested.intercept & (1ULL << INTERCEPT_IOIO_PROT)))
return NESTED_EXIT_HOST;
port = svm->vmcb->control.exit_info_1 >> 16;
size = (svm->vmcb->control.exit_info_1 & SVM_IOIO_SIZE_MASK) >>
SVM_IOIO_SIZE_SHIFT;
gpa = svm->nested.vmcb_iopm + (port / 8);
start_bit = port % 8;
iopm_len = (start_bit + size > 8) ? 2 : 1;
mask = (0xf >> (4 - size)) << start_bit;
val = 0;
if (kvm_read_guest(svm->vcpu.kvm, gpa, &val, iopm_len))
return NESTED_EXIT_DONE;
return (val & mask) ? NESTED_EXIT_DONE : NESTED_EXIT_HOST;
}
| 12,621
|
112,633
| 0
|
void DocumentLoader::addResponse(const ResourceResponse& r)
{
if (!m_stopRecordingResponses)
m_responses.append(r);
}
| 12,622
|
187,108
| 1
|
void WebGL2RenderingContextBase::deleteVertexArray(
WebGLVertexArrayObject* vertex_array) {
if (isContextLost() || !vertex_array)
return;
if (!vertex_array->IsDefaultObject() &&
vertex_array == bound_vertex_array_object_)
SetBoundVertexArrayObject(nullptr);
vertex_array->DeleteObject(ContextGL());
}
| 12,623
|
171,400
| 0
|
static void local_socket_destroy(asocket* s) {
apacket *p, *n;
int exit_on_close = s->exit_on_close;
D("LS(%d): destroying fde.fd=%d", s->id, s->fde.fd);
/* IMPORTANT: the remove closes the fd
** that belongs to this socket
*/
fdevent_remove(&s->fde);
/* dispose of any unwritten data */
for (p = s->pkt_first; p; p = n) {
D("LS(%d): discarding %d bytes", s->id, p->len);
n = p->next;
put_apacket(p);
}
remove_socket(s);
free(s);
if (exit_on_close) {
D("local_socket_destroy: exiting");
exit(1);
}
}
| 12,624
|
111,020
| 0
|
void FileSystemOperation::DoWrite(scoped_ptr<net::URLRequest> blob_request) {
int file_flags = base::PLATFORM_FILE_OPEN |
base::PLATFORM_FILE_WRITE |
base::PLATFORM_FILE_ASYNC;
FileSystemOperationContext* write_context = new FileSystemOperationContext(
operation_context_);
FileSystemFileUtilProxy::CreateOrOpen(
write_context, src_util_, src_path_, file_flags,
base::Bind(&FileSystemOperation::OnFileOpenedForWrite,
weak_factory_.GetWeakPtr(),
base::Passed(&blob_request),
base::Owned(write_context)));
}
| 12,625
|
116,245
| 0
|
void QQuickWebViewPrivate::didSameDocumentNavigation()
{
Q_Q(QQuickWebView);
q->emitUrlChangeIfNeeded();
emit q->navigationHistoryChanged();
}
| 12,626
|
38,226
| 0
|
void requeue_futex(struct futex_q *q, struct futex_hash_bucket *hb1,
struct futex_hash_bucket *hb2, union futex_key *key2)
{
/*
* If key1 and key2 hash to the same bucket, no need to
* requeue.
*/
if (likely(&hb1->chain != &hb2->chain)) {
plist_del(&q->list, &hb1->chain);
hb_waiters_dec(hb1);
plist_add(&q->list, &hb2->chain);
hb_waiters_inc(hb2);
q->lock_ptr = &hb2->lock;
}
get_futex_key_refs(key2);
q->key = *key2;
}
| 12,627
|
95,042
| 0
|
http_write(const struct http *hp, int lvl, const char *pfx)
{
int l;
AZ(VSB_finish(hp->vsb));
vtc_dump(hp->vl, lvl, pfx, VSB_data(hp->vsb), VSB_len(hp->vsb));
l = write(hp->fd, VSB_data(hp->vsb), VSB_len(hp->vsb));
if (l != VSB_len(hp->vsb))
vtc_log(hp->vl, hp->fatal, "Write failed: (%d vs %d) %s",
l, VSB_len(hp->vsb), strerror(errno));
}
| 12,628
|
37,218
| 0
|
static void vmx_adjust_tsc_offset(struct kvm_vcpu *vcpu, s64 adjustment, bool host)
{
u64 offset = vmcs_read64(TSC_OFFSET);
vmcs_write64(TSC_OFFSET, offset + adjustment);
if (is_guest_mode(vcpu)) {
/* Even when running L2, the adjustment needs to apply to L1 */
to_vmx(vcpu)->nested.vmcs01_tsc_offset += adjustment;
} else
trace_kvm_write_tsc_offset(vcpu->vcpu_id, offset,
offset + adjustment);
}
| 12,629
|
16,230
| 0
|
GahpServer::uncacheProxy( GahpProxyInfo *gahp_proxy )
{
static const char *command = "UNCACHE_PROXY";
if (m_commands_supported->contains_anycase(command)==FALSE) {
return false;
}
std::string buf;
int x = sprintf(buf,"%s %d",command,gahp_proxy->proxy->id);
ASSERT( x > 0 );
write_line(buf.c_str());
Gahp_Args result;
read_argv(result);
if ( result.argc == 0 || result.argv[0][0] != 'S' ) {
char *reason;
if ( result.argc > 1 ) {
reason = result.argv[1];
} else {
reason = "Unspecified error";
}
dprintf(D_ALWAYS,"GAHP command '%s' failed: %s\n",command,reason);
return false;
}
if ( current_proxy == gahp_proxy ) {
if ( useCachedProxy( master_proxy ) == false ) {
EXCEPT( "useCachedProxy failed in uncacheProxy" );
}
}
return true;
}
| 12,630
|
127,865
| 0
|
static bool CheckMJpeg(const uint8* buffer, int buffer_size) {
RCHECK(buffer_size >= 16);
int offset = 0;
int last_restart = -1;
int num_codes = 0;
while (offset + 5 < buffer_size) {
RCHECK(buffer[offset] == 0xff);
uint8 code = buffer[offset + 1];
RCHECK(code >= 0xc0 || code == 1);
if (code == 0xff) {
++offset;
continue;
}
if (code == 0xd9)
return true;
if (code == 0xd8 || code == 1) {
offset += 2;
} else if (code >= 0xd0 && code <= 0xd7) {
int restart = code & 0x07;
if (last_restart >= 0)
RCHECK(restart == (last_restart + 1) % 8);
last_restart = restart;
offset += 2;
} else {
int length = Read16(buffer + offset + 2) + 2;
if (code == 0xda) {
int number_components = buffer[offset + 4];
RCHECK(length == 8 + 2 * number_components);
offset += length;
while (offset + 2 < buffer_size) {
if (buffer[offset] == 0xff && buffer[offset + 1] != 0)
break;
++offset;
}
} else {
offset += length;
}
}
++num_codes;
}
return (num_codes > 1);
}
| 12,631
|
95,020
| 0
|
cmd_http_expect(CMD_ARGS)
{
struct http *hp;
const char *lhs;
char *cmp;
const char *rhs;
(void)cmd;
(void)vl;
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
assert(!strcmp(av[0], "expect"));
av++;
AN(av[0]);
AN(av[1]);
AN(av[2]);
AZ(av[3]);
lhs = cmd_var_resolve(hp, av[0]);
cmp = av[1];
rhs = cmd_var_resolve(hp, av[2]);
if (!strcmp(cmp, "==")) {
if (strcmp(lhs, rhs))
vtc_log(hp->vl, 0, "EXPECT %s (%s) %s %s (%s) failed",
av[0], lhs, av[1], av[2], rhs);
else
vtc_log(hp->vl, 4, "EXPECT %s (%s) %s %s (%s) match",
av[0], lhs, av[1], av[2], rhs);
} else if (!strcmp(cmp, "!=")) {
if (!strcmp(lhs, rhs))
vtc_log(hp->vl, 0, "EXPECT %s (%s) %s %s (%s) failed",
av[0], lhs, av[1], av[2], rhs);
else
vtc_log(hp->vl, 4, "EXPECT %s (%s) %s %s (%s) match",
av[0], lhs, av[1], av[2], rhs);
} else {
vtc_log(hp->vl, 0,
"EXPECT %s (%s) %s %s (%s) test not implemented",
av[0], lhs, av[1], av[2], rhs);
}
}
| 12,632
|
12,031
| 0
|
size_t rand_acquire_entropy_from_cpu(RAND_POOL *pool)
{
size_t bytes_needed;
unsigned char *buffer;
bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
if (bytes_needed > 0) {
buffer = rand_pool_add_begin(pool, bytes_needed);
if (buffer != NULL) {
/* Whichever comes first, use RDSEED, RDRAND or nothing */
if ((OPENSSL_ia32cap_P[2] & (1 << 18)) != 0) {
if (OPENSSL_ia32_rdseed_bytes(buffer, bytes_needed)
== bytes_needed) {
rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed);
}
} else if ((OPENSSL_ia32cap_P[1] & (1 << (62 - 32))) != 0) {
if (OPENSSL_ia32_rdrand_bytes(buffer, bytes_needed)
== bytes_needed) {
rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed);
}
} else {
rand_pool_add_end(pool, 0, 0);
}
}
}
return rand_pool_entropy_available(pool);
}
| 12,633
|
183,157
| 1
|
init_ext2_xattr(void)
{
ext2_xattr_cache = mb_cache_create("ext2_xattr", 6);
if (!ext2_xattr_cache)
return -ENOMEM;
return 0;
}
| 12,634
|
68,478
| 0
|
void fs_private_homedir(void) {
char *homedir = cfg.homedir;
char *private_homedir = cfg.home_private;
assert(homedir);
assert(private_homedir);
int xflag = store_xauthority();
int aflag = store_asoundrc();
uid_t u = getuid();
gid_t g = getgid();
struct stat s;
if (stat(homedir, &s) == -1) {
fprintf(stderr, "Error: cannot find user home directory\n");
exit(1);
}
if (arg_debug)
printf("Mount-bind %s on top of %s\n", private_homedir, homedir);
if (mount(private_homedir, homedir, NULL, MS_NOSUID | MS_NODEV | MS_BIND | MS_REC, NULL) < 0)
errExit("mount bind");
fs_logger3("mount-bind", private_homedir, cfg.homedir);
fs_logger2("whitelist", cfg.homedir);
if (u != 0) {
if (arg_debug)
printf("Mounting a new /root directory\n");
if (mount("tmpfs", "/root", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_STRICTATIME | MS_REC, "mode=700,gid=0") < 0)
errExit("mounting home directory");
fs_logger("tmpfs /root");
}
else {
if (arg_debug)
printf("Mounting a new /home directory\n");
if (mount("tmpfs", "/home", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_STRICTATIME | MS_REC, "mode=755,gid=0") < 0)
errExit("mounting home directory");
fs_logger("tmpfs /home");
}
skel(homedir, u, g);
if (xflag)
copy_xauthority();
if (aflag)
copy_asoundrc();
}
| 12,635
|
54,292
| 0
|
SPL_METHOD(SplDoublyLinkedList, valid)
{
spl_dllist_object *intern = Z_SPLDLLIST_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_BOOL(intern->traverse_pointer != NULL);
}
| 12,636
|
26,490
| 0
|
static void pmcraid_reinit_cmdblk(struct pmcraid_cmd *cmd)
{
pmcraid_init_cmdblk(cmd, -1);
}
| 12,637
|
8,906
| 0
|
void vrend_renderer_get_rect(int res_handle, struct iovec *iov, unsigned int num_iovs,
uint32_t offset, int x, int y, int width, int height)
{
struct vrend_resource *res = vrend_resource_lookup(res_handle, 0);
struct vrend_transfer_info transfer_info;
struct pipe_box box;
int elsize;
memset(&transfer_info, 0, sizeof(transfer_info));
elsize = util_format_get_blocksize(res->base.format);
box.x = x;
box.y = y;
box.z = 0;
box.width = width;
box.height = height;
box.depth = 1;
transfer_info.box = &box;
transfer_info.stride = util_format_get_nblocksx(res->base.format, res->base.width0) * elsize;
transfer_info.offset = offset;
transfer_info.handle = res->handle;
transfer_info.iovec = iov;
transfer_info.iovec_cnt = num_iovs;
vrend_renderer_transfer_iov(&transfer_info, VREND_TRANSFER_READ);
}
| 12,638
|
23,804
| 0
|
static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo)
{
snprintf(drvinfo->driver, 32, "macvlan");
snprintf(drvinfo->version, 32, "0.1");
}
| 12,639
|
161,004
| 0
|
void ChromeClientImpl::SetNeedsLowLatencyInput(LocalFrame* frame,
bool needs_low_latency) {
DCHECK(frame);
WebLocalFrameImpl* web_frame = WebLocalFrameImpl::FromFrame(frame);
WebFrameWidgetBase* widget = web_frame->LocalRoot()->FrameWidget();
if (!widget)
return;
if (WebWidgetClient* client = widget->Client())
client->SetNeedsLowLatencyInput(needs_low_latency);
}
| 12,640
|
58,573
| 0
|
SECURITY_STATUS SEC_ENTRY ApplyControlToken(PCtxtHandle phContext, PSecBufferDesc pInput)
{
return SEC_E_OK;
}
| 12,641
|
77,833
| 0
|
bson_iter_find_case (bson_iter_t *iter, /* INOUT */
const char *key) /* IN */
{
BSON_ASSERT (iter);
BSON_ASSERT (key);
while (bson_iter_next (iter)) {
if (!bson_strcasecmp (key, bson_iter_key (iter))) {
return true;
}
}
return false;
}
| 12,642
|
28,197
| 0
|
static av_cold int rpza_decode_init(AVCodecContext *avctx)
{
RpzaContext *s = avctx->priv_data;
s->avctx = avctx;
avctx->pix_fmt = AV_PIX_FMT_RGB555;
avcodec_get_frame_defaults(&s->frame);
return 0;
}
| 12,643
|
173,902
| 0
|
const Chapters::Atom* Chapters::Edition::GetAtom(int index) const {
if (index < 0)
return NULL;
if (index >= m_atoms_count)
return NULL;
return m_atoms + index;
}
| 12,644
|
74,064
| 0
|
dwarf_get_elf(Dwarf_Debug dbg, dwarf_elf_handle * elf,
Dwarf_Error * error)
{
struct Dwarf_Obj_Access_Interface_s * obj = 0;
if (dbg == NULL) {
_dwarf_error(NULL, error, DW_DLE_DBG_NULL);
return (DW_DLV_ERROR);
}
obj = dbg->de_obj_file;
if (obj) {
dwarf_elf_object_access_internals_t *internals =
(dwarf_elf_object_access_internals_t*)obj->object;
if (internals->elf == NULL) {
_dwarf_error(dbg, error, DW_DLE_FNO);
return (DW_DLV_ERROR);
}
*elf = internals->elf;
return DW_DLV_OK;
}
_dwarf_error(dbg, error, DW_DLE_FNO);
return DW_DLV_ERROR;
}
| 12,645
|
93,529
| 0
|
static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
struct sk_buff *skb, struct mfc6_cache *c, int vifi)
{
struct ipv6hdr *ipv6h;
struct mif_device *vif = &mrt->vif6_table[vifi];
struct net_device *dev;
struct dst_entry *dst;
struct flowi6 fl6;
if (!vif->dev)
goto out_free;
#ifdef CONFIG_IPV6_PIMSM_V2
if (vif->flags & MIFF_REGISTER) {
vif->pkt_out++;
vif->bytes_out += skb->len;
vif->dev->stats.tx_bytes += skb->len;
vif->dev->stats.tx_packets++;
ip6mr_cache_report(mrt, skb, vifi, MRT6MSG_WHOLEPKT);
goto out_free;
}
#endif
ipv6h = ipv6_hdr(skb);
fl6 = (struct flowi6) {
.flowi6_oif = vif->link,
.daddr = ipv6h->daddr,
};
dst = ip6_route_output(net, NULL, &fl6);
if (dst->error) {
dst_release(dst);
goto out_free;
}
skb_dst_drop(skb);
skb_dst_set(skb, dst);
/*
* RFC1584 teaches, that DVMRP/PIM router must deliver packets locally
* not only before forwarding, but after forwarding on all output
* interfaces. It is clear, if mrouter runs a multicasting
* program, it should receive packets not depending to what interface
* program is joined.
* If we will not make it, the program will have to join on all
* interfaces. On the other hand, multihoming host (or router, but
* not mrouter) cannot join to more than one interface - it will
* result in receiving multiple packets.
*/
dev = vif->dev;
skb->dev = dev;
vif->pkt_out++;
vif->bytes_out += skb->len;
/* We are about to write */
/* XXX: extension headers? */
if (skb_cow(skb, sizeof(*ipv6h) + LL_RESERVED_SPACE(dev)))
goto out_free;
ipv6h = ipv6_hdr(skb);
ipv6h->hop_limit--;
IP6CB(skb)->flags |= IP6SKB_FORWARDED;
return NF_HOOK(NFPROTO_IPV6, NF_INET_FORWARD,
net, NULL, skb, skb->dev, dev,
ip6mr_forward2_finish);
out_free:
kfree_skb(skb);
return 0;
}
| 12,646
|
50,630
| 0
|
static int srpt_ch_qp_rtr(struct srpt_rdma_ch *ch, struct ib_qp *qp)
{
struct ib_qp_attr qp_attr;
int attr_mask;
int ret;
qp_attr.qp_state = IB_QPS_RTR;
ret = ib_cm_init_qp_attr(ch->cm_id, &qp_attr, &attr_mask);
if (ret)
goto out;
qp_attr.max_dest_rd_atomic = 4;
ret = ib_modify_qp(qp, &qp_attr, attr_mask);
out:
return ret;
}
| 12,647
|
36,066
| 0
|
static void udf_update_extents(struct inode *inode,
struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
int startnum, int endnum,
struct extent_position *epos)
{
int start = 0, i;
struct kernel_lb_addr tmploc;
uint32_t tmplen;
if (startnum > endnum) {
for (i = 0; i < (startnum - endnum); i++)
udf_delete_aext(inode, *epos, laarr[i].extLocation,
laarr[i].extLength);
} else if (startnum < endnum) {
for (i = 0; i < (endnum - startnum); i++) {
udf_insert_aext(inode, *epos, laarr[i].extLocation,
laarr[i].extLength);
udf_next_aext(inode, epos, &laarr[i].extLocation,
&laarr[i].extLength, 1);
start++;
}
}
for (i = start; i < endnum; i++) {
udf_next_aext(inode, epos, &tmploc, &tmplen, 0);
udf_write_aext(inode, epos, &laarr[i].extLocation,
laarr[i].extLength, 1);
}
}
| 12,648
|
23,957
| 0
|
static int airo_get_power(struct net_device *dev,
struct iw_request_info *info,
struct iw_param *vwrq,
char *extra)
{
struct airo_info *local = dev->ml_priv;
__le16 mode;
readConfigRid(local, 1);
mode = local->config.powerSaveMode;
if ((vwrq->disabled = (mode == POWERSAVE_CAM)))
return 0;
if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
vwrq->value = le16_to_cpu(local->config.fastListenDelay) * 1024;
vwrq->flags = IW_POWER_TIMEOUT;
} else {
vwrq->value = le16_to_cpu(local->config.fastListenInterval) * 1024;
vwrq->flags = IW_POWER_PERIOD;
}
if ((local->config.rmode & RXMODE_MASK) == RXMODE_ADDR)
vwrq->flags |= IW_POWER_UNICAST_R;
else
vwrq->flags |= IW_POWER_ALL_R;
return 0;
}
| 12,649
|
96,661
| 0
|
MagickExport MagickOffsetType TellBlob(const Image *image)
{
BlobInfo
*magick_restrict blob_info;
MagickOffsetType
offset;
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(image->blob != (BlobInfo *) NULL);
assert(image->blob->type != UndefinedStream);
blob_info=image->blob;
offset=(-1);
switch (blob_info->type)
{
case UndefinedStream:
case StandardStream:
break;
case FileStream:
{
offset=ftell(blob_info->file_info.file);
break;
}
case PipeStream:
break;
case ZipStream:
{
#if defined(MAGICKCORE_ZLIB_DELEGATE)
offset=(MagickOffsetType) gztell(blob_info->file_info.gzfile);
#endif
break;
}
case BZipStream:
break;
case FifoStream:
break;
case BlobStream:
{
offset=blob_info->offset;
break;
}
case CustomStream:
{
if (blob_info->custom_stream->teller != (CustomStreamTeller) NULL)
offset=blob_info->custom_stream->teller(blob_info->custom_stream->data);
break;
}
}
return(offset);
}
| 12,650
|
2,299
| 0
|
_PUBLIC_ void string_replace_m(char *s, char oldc, char newc)
{
struct smb_iconv_handle *ic = get_iconv_handle();
while (s && *s) {
size_t size;
codepoint_t c = next_codepoint_handle(ic, s, &size);
if (c == oldc) {
*s = newc;
}
s += size;
}
}
| 12,651
|
123,674
| 0
|
void GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback(
bool has_callback) {
TRACE_EVENT0(
"gpu",
"GpuCommandBufferStub::OnSetClientHasMemoryAllocationChangedCallback");
if (has_callback) {
GetMemoryManager()->AddClient(
this,
surface_id_ != 0,
true,
base::TimeTicks::Now());
} else {
GetMemoryManager()->RemoveClient(
this);
}
}
| 12,652
|
10,538
| 0
|
retr_rate (wgint bytes, double secs)
{
static char res[20];
static const char *rate_names[] = {"B/s", "KB/s", "MB/s", "GB/s" };
static const char *rate_names_bits[] = {"b/s", "Kb/s", "Mb/s", "Gb/s" };
int units;
double dlrate = calc_rate (bytes, secs, &units);
/* Use more digits for smaller numbers (regardless of unit used),
e.g. "1022", "247", "12.5", "2.38". */
sprintf (res, "%.*f %s",
dlrate >= 99.95 ? 0 : dlrate >= 9.995 ? 1 : 2,
dlrate, !opt.report_bps ? rate_names[units]: rate_names_bits[units]);
return res;
}
| 12,653
|
61,263
| 0
|
EXPORTED void mboxlist_done(void)
{
/* DB->done() handled by cyrus_done() */
}
| 12,654
|
178,500
| 1
|
static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value,
BN_GENCB *cb)
{
BIGNUM *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *tmp;
BIGNUM local_r0, local_d, local_p;
BIGNUM *pr0, *d, *p;
int bitsp, bitsq, ok = -1, n = 0;
BN_CTX *ctx = NULL;
unsigned long error = 0;
/*
* When generating ridiculously small keys, we can get stuck
* continually regenerating the same prime values.
*/
if (bits < 16) {
ok = 0; /* we set our own err */
RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, RSA_R_KEY_SIZE_TOO_SMALL);
goto err;
}
ctx = BN_CTX_new();
if (ctx == NULL)
goto err;
BN_CTX_start(ctx);
r0 = BN_CTX_get(ctx);
r1 = BN_CTX_get(ctx);
r2 = BN_CTX_get(ctx);
r3 = BN_CTX_get(ctx);
if (r3 == NULL)
goto err;
bitsp = (bits + 1) / 2;
bitsq = bits - bitsp;
/* We need the RSA components non-NULL */
if (!rsa->n && ((rsa->n = BN_new()) == NULL))
goto err;
if (!rsa->d && ((rsa->d = BN_new()) == NULL))
goto err;
if (!rsa->e && ((rsa->e = BN_new()) == NULL))
goto err;
if (!rsa->p && ((rsa->p = BN_new()) == NULL))
goto err;
if (!rsa->q && ((rsa->q = BN_new()) == NULL))
goto err;
if (!rsa->dmp1 && ((rsa->dmp1 = BN_new()) == NULL))
goto err;
if (!rsa->dmq1 && ((rsa->dmq1 = BN_new()) == NULL))
goto err;
if (!rsa->iqmp && ((rsa->iqmp = BN_new()) == NULL))
goto err;
if (BN_copy(rsa->e, e_value) == NULL)
goto err;
BN_set_flags(r2, BN_FLG_CONSTTIME);
/* generate p and q */
for (;;) {
if (!BN_sub(r2, rsa->p, BN_value_one()))
goto err;
ERR_set_mark();
if (BN_mod_inverse(r1, r2, rsa->e, ctx) != NULL) {
/* GCD == 1 since inverse exists */
break;
}
error = ERR_peek_last_error();
if (ERR_GET_LIB(error) == ERR_LIB_BN
&& ERR_GET_REASON(error) == BN_R_NO_INVERSE) {
/* GCD != 1 */
ERR_pop_to_mark();
} else {
goto err;
}
if (!BN_GENCB_call(cb, 2, n++))
goto err;
}
if (!BN_GENCB_call(cb, 3, 0))
goto err;
for (;;) {
do {
if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb))
goto err;
} while (BN_cmp(rsa->p, rsa->q) == 0);
if (!BN_sub(r2, rsa->q, BN_value_one()))
goto err;
ERR_set_mark();
if (BN_mod_inverse(r1, r2, rsa->e, ctx) != NULL) {
/* GCD == 1 since inverse exists */
break;
}
error = ERR_peek_last_error();
if (ERR_GET_LIB(error) == ERR_LIB_BN
&& ERR_GET_REASON(error) == BN_R_NO_INVERSE) {
/* GCD != 1 */
ERR_pop_to_mark();
} else {
goto err;
}
if (!BN_GENCB_call(cb, 2, n++))
goto err;
}
if (!BN_GENCB_call(cb, 3, 1))
goto err;
if (BN_cmp(rsa->p, rsa->q) < 0) {
tmp = rsa->p;
rsa->p = rsa->q;
rsa->q = tmp;
}
/* calculate n */
if (!BN_mul(rsa->n, rsa->p, rsa->q, ctx))
goto err;
/* calculate d */
if (!BN_sub(r1, rsa->p, BN_value_one()))
goto err; /* p-1 */
if (!BN_sub(r2, rsa->q, BN_value_one()))
goto err; /* q-1 */
if (!BN_mul(r0, r1, r2, ctx))
goto err; /* (p-1)(q-1) */
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
pr0 = &local_r0;
BN_with_flags(pr0, r0, BN_FLG_CONSTTIME);
} else
pr0 = r0;
if (!BN_mod_inverse(rsa->d, rsa->e, pr0, ctx))
goto err; /* d */
/* set up d for correct BN_FLG_CONSTTIME flag */
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
d = &local_d;
BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);
} else
d = rsa->d;
/* calculate d mod (p-1) */
if (!BN_mod(rsa->dmp1, d, r1, ctx))
goto err;
/* calculate d mod (q-1) */
if (!BN_mod(rsa->dmq1, d, r2, ctx))
goto err;
/* calculate inverse of q mod p */
if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) {
p = &local_p;
BN_with_flags(p, rsa->p, BN_FLG_CONSTTIME);
} else
p = rsa->p;
if (!BN_mod_inverse(rsa->iqmp, rsa->q, p, ctx))
goto err;
ok = 1;
err:
if (ok == -1) {
RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, ERR_LIB_BN);
ok = 0;
}
if (ctx != NULL) {
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
return ok;
}
| 12,655
|
60,000
| 0
|
static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
{
struct mixer_build state;
int err;
const struct usbmix_ctl_map *map;
void *p;
memset(&state, 0, sizeof(state));
state.chip = mixer->chip;
state.mixer = mixer;
state.buffer = mixer->hostif->extra;
state.buflen = mixer->hostif->extralen;
/* check the mapping table */
for (map = usbmix_ctl_maps; map->id; map++) {
if (map->id == state.chip->usb_id) {
state.map = map->map;
state.selector_map = map->selector_map;
mixer->ignore_ctl_error = map->ignore_ctl_error;
break;
}
}
p = NULL;
while ((p = snd_usb_find_csint_desc(mixer->hostif->extra,
mixer->hostif->extralen,
p, UAC_OUTPUT_TERMINAL)) != NULL) {
if (mixer->protocol == UAC_VERSION_1) {
struct uac1_output_terminal_descriptor *desc = p;
if (desc->bLength < sizeof(*desc))
continue; /* invalid descriptor? */
/* mark terminal ID as visited */
set_bit(desc->bTerminalID, state.unitbitmap);
state.oterm.id = desc->bTerminalID;
state.oterm.type = le16_to_cpu(desc->wTerminalType);
state.oterm.name = desc->iTerminal;
err = parse_audio_unit(&state, desc->bSourceID);
if (err < 0 && err != -EINVAL)
return err;
} else { /* UAC_VERSION_2 */
struct uac2_output_terminal_descriptor *desc = p;
if (desc->bLength < sizeof(*desc))
continue; /* invalid descriptor? */
/* mark terminal ID as visited */
set_bit(desc->bTerminalID, state.unitbitmap);
state.oterm.id = desc->bTerminalID;
state.oterm.type = le16_to_cpu(desc->wTerminalType);
state.oterm.name = desc->iTerminal;
err = parse_audio_unit(&state, desc->bSourceID);
if (err < 0 && err != -EINVAL)
return err;
/*
* For UAC2, use the same approach to also add the
* clock selectors
*/
err = parse_audio_unit(&state, desc->bCSourceID);
if (err < 0 && err != -EINVAL)
return err;
}
}
return 0;
}
| 12,656
|
35,349
| 0
|
static void ipip_tunnel_link(struct ipip_net *ipn, struct ip_tunnel *t)
{
struct ip_tunnel __rcu **tp = ipip_bucket(ipn, t);
rcu_assign_pointer(t->next, rtnl_dereference(*tp));
rcu_assign_pointer(*tp, t);
}
| 12,657
|
141,110
| 0
|
bool Document::HasValidNamespaceForElements(const QualifiedName& q_name) {
if (!q_name.Prefix().IsEmpty() && q_name.NamespaceURI().IsNull())
return false;
if (q_name.Prefix() == g_xml_atom &&
q_name.NamespaceURI() != xml_names::kNamespaceURI)
return false;
if (q_name.Prefix() == g_xmlns_atom ||
(q_name.Prefix().IsEmpty() && q_name.LocalName() == g_xmlns_atom))
return q_name.NamespaceURI() == xmlns_names::kNamespaceURI;
return q_name.NamespaceURI() != xmlns_names::kNamespaceURI;
}
| 12,658
|
120,863
| 0
|
void OneClickSigninSyncStarter::ConfirmAndSignin() {
SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
if (confirmation_required_ == CONFIRM_UNTRUSTED_SIGNIN) {
EnsureBrowser();
browser_->window()->ShowOneClickSigninBubble(
BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_SAML_MODAL_DIALOG,
UTF8ToUTF16(signin->GetUsernameForAuthInProgress()),
string16(), // No error message to display.
base::Bind(&OneClickSigninSyncStarter::UntrustedSigninConfirmed,
weak_pointer_factory_.GetWeakPtr()));
} else {
signin->CompletePendingSignin();
}
}
| 12,659
|
178,293
| 1
|
my_object_str_hash_len (MyObject *obj, GHashTable *table, guint *len, GError **error)
{
*len = 0;
g_hash_table_foreach (table, hash_foreach, len);
return TRUE;
}
| 12,660
|
39,496
| 0
|
static int wanxl_puts_command(card_t *card, u32 cmd)
{
unsigned long timeout = jiffies + 5 * HZ;
writel(cmd, card->plx + PLX_MAILBOX_1);
do {
if (readl(card->plx + PLX_MAILBOX_1) == 0)
return 0;
schedule();
}while (time_after(timeout, jiffies));
return -1;
}
| 12,661
|
51,533
| 0
|
static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
{
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *skb1;
u32 seq, end_seq;
tcp_ecn_check_ce(tp, skb);
if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) {
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);
tcp_drop(sk, skb);
return;
}
/* Disable header prediction. */
tp->pred_flags = 0;
inet_csk_schedule_ack(sk);
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOQUEUE);
SOCK_DEBUG(sk, "out of order segment: rcv_next %X seq %X - %X\n",
tp->rcv_nxt, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
skb1 = skb_peek_tail(&tp->out_of_order_queue);
if (!skb1) {
/* Initial out of order segment, build 1 SACK. */
if (tcp_is_sack(tp)) {
tp->rx_opt.num_sacks = 1;
tp->selective_acks[0].start_seq = TCP_SKB_CB(skb)->seq;
tp->selective_acks[0].end_seq =
TCP_SKB_CB(skb)->end_seq;
}
__skb_queue_head(&tp->out_of_order_queue, skb);
goto end;
}
seq = TCP_SKB_CB(skb)->seq;
end_seq = TCP_SKB_CB(skb)->end_seq;
if (seq == TCP_SKB_CB(skb1)->end_seq) {
bool fragstolen;
if (!tcp_try_coalesce(sk, skb1, skb, &fragstolen)) {
__skb_queue_after(&tp->out_of_order_queue, skb1, skb);
} else {
tcp_grow_window(sk, skb);
kfree_skb_partial(skb, fragstolen);
skb = NULL;
}
if (!tp->rx_opt.num_sacks ||
tp->selective_acks[0].end_seq != seq)
goto add_sack;
/* Common case: data arrive in order after hole. */
tp->selective_acks[0].end_seq = end_seq;
goto end;
}
/* Find place to insert this segment. */
while (1) {
if (!after(TCP_SKB_CB(skb1)->seq, seq))
break;
if (skb_queue_is_first(&tp->out_of_order_queue, skb1)) {
skb1 = NULL;
break;
}
skb1 = skb_queue_prev(&tp->out_of_order_queue, skb1);
}
/* Do skb overlap to previous one? */
if (skb1 && before(seq, TCP_SKB_CB(skb1)->end_seq)) {
if (!after(end_seq, TCP_SKB_CB(skb1)->end_seq)) {
/* All the bits are present. Drop. */
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
tcp_drop(sk, skb);
skb = NULL;
tcp_dsack_set(sk, seq, end_seq);
goto add_sack;
}
if (after(seq, TCP_SKB_CB(skb1)->seq)) {
/* Partial overlap. */
tcp_dsack_set(sk, seq,
TCP_SKB_CB(skb1)->end_seq);
} else {
if (skb_queue_is_first(&tp->out_of_order_queue,
skb1))
skb1 = NULL;
else
skb1 = skb_queue_prev(
&tp->out_of_order_queue,
skb1);
}
}
if (!skb1)
__skb_queue_head(&tp->out_of_order_queue, skb);
else
__skb_queue_after(&tp->out_of_order_queue, skb1, skb);
/* And clean segments covered by new one as whole. */
while (!skb_queue_is_last(&tp->out_of_order_queue, skb)) {
skb1 = skb_queue_next(&tp->out_of_order_queue, skb);
if (!after(end_seq, TCP_SKB_CB(skb1)->seq))
break;
if (before(end_seq, TCP_SKB_CB(skb1)->end_seq)) {
tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq,
end_seq);
break;
}
__skb_unlink(skb1, &tp->out_of_order_queue);
tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq,
TCP_SKB_CB(skb1)->end_seq);
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
tcp_drop(sk, skb1);
}
add_sack:
if (tcp_is_sack(tp))
tcp_sack_new_ofo_skb(sk, seq, end_seq);
end:
if (skb) {
tcp_grow_window(sk, skb);
skb_set_owner_r(skb, sk);
}
}
| 12,662
|
1,379
| 0
|
XcursorImageDestroy (XcursorImage *image)
{
free (image);
}
| 12,663
|
62,400
| 0
|
unaligned_memcpy(void *p, const void *q, size_t l)
{
memcpy(p, q, l);
}
| 12,664
|
32,330
| 0
|
static inline int check_mnt(struct mount *mnt)
{
return mnt->mnt_ns == current->nsproxy->mnt_ns;
}
| 12,665
|
156,426
| 0
|
PageHandler::~PageHandler() {
}
| 12,666
|
52,109
| 0
|
long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, unsigned long nr_pages,
int write, int force, struct page **pages,
struct vm_area_struct **vmas)
{
return __get_user_pages_locked(tsk, mm, start, nr_pages, write, force,
pages, vmas, NULL, false,
FOLL_TOUCH | FOLL_REMOTE);
}
| 12,667
|
84,051
| 0
|
static void rewrite_nalus_list(GF_List *nalus, GF_BitStream *bs, Bool rewrite_start_codes, u32 nal_unit_size_field)
{
u32 i, count = gf_list_count(nalus);
for (i=0; i<count; i++) {
GF_AVCConfigSlot *sl = (GF_AVCConfigSlot*)gf_list_get(nalus, i);
if (rewrite_start_codes) gf_bs_write_u32(bs, 1);
else gf_bs_write_int(bs, sl->size, 8*nal_unit_size_field);
gf_bs_write_data(bs, sl->data, sl->size);
}
}
| 12,668
|
72,151
| 0
|
static bool _step_is_starting(uint32_t job_id, uint32_t step_id)
{
starting_step_t starting_step;
starting_step.job_id = job_id;
starting_step.step_id = step_id;
bool ret = false;
slurm_mutex_lock(&conf->starting_steps_lock);
if (list_find_first( conf->starting_steps,
&_compare_starting_steps,
&starting_step )) {
ret = true;
}
slurm_mutex_unlock(&conf->starting_steps_lock);
return ret;
}
| 12,669
|
154,968
| 0
|
void WebGLRenderingContextBase::OnBeforeDrawCall() {
ClearIfComposited();
MarkContextChanged(kCanvasChanged);
}
| 12,670
|
176,318
| 0
|
static Maybe<int64_t> IndexOfValueSlowPath(Isolate* isolate,
Handle<JSObject> receiver,
Handle<Object> value,
uint32_t start_from,
uint32_t length) {
for (uint32_t k = start_from; k < length; ++k) {
LookupIterator it(isolate, receiver, k);
if (!it.IsFound()) {
continue;
}
Handle<Object> element_k;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, element_k, Object::GetProperty(&it), Nothing<int64_t>());
if (value->StrictEquals(*element_k)) return Just<int64_t>(k);
}
return Just<int64_t>(-1);
}
| 12,671
|
57,498
| 0
|
void ext4_da_update_reserve_space(struct inode *inode,
int used, int quota_claim)
{
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
struct ext4_inode_info *ei = EXT4_I(inode);
int mdb_free = 0, allocated_meta_blocks = 0;
spin_lock(&ei->i_block_reservation_lock);
trace_ext4_da_update_reserve_space(inode, used);
if (unlikely(used > ei->i_reserved_data_blocks)) {
ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, used %d "
"with only %d reserved data blocks\n",
__func__, inode->i_ino, used,
ei->i_reserved_data_blocks);
WARN_ON(1);
used = ei->i_reserved_data_blocks;
}
/* Update per-inode reservations */
ei->i_reserved_data_blocks -= used;
used += ei->i_allocated_meta_blocks;
ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
allocated_meta_blocks = ei->i_allocated_meta_blocks;
ei->i_allocated_meta_blocks = 0;
percpu_counter_sub(&sbi->s_dirtyblocks_counter, used);
if (ei->i_reserved_data_blocks == 0) {
/*
* We can release all of the reserved metadata blocks
* only when we have written all of the delayed
* allocation blocks.
*/
mdb_free = ei->i_reserved_meta_blocks;
ei->i_reserved_meta_blocks = 0;
ei->i_da_metadata_calc_len = 0;
percpu_counter_sub(&sbi->s_dirtyblocks_counter, mdb_free);
}
spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
/* Update quota subsystem */
if (quota_claim) {
vfs_dq_claim_block(inode, used);
if (mdb_free)
vfs_dq_release_reservation_block(inode, mdb_free);
} else {
/*
* We did fallocate with an offset that is already delayed
* allocated. So on delayed allocated writeback we should
* not update the quota for allocated blocks. But then
* converting an fallocate region to initialized region would
* have caused a metadata allocation. So claim quota for
* that
*/
if (allocated_meta_blocks)
vfs_dq_claim_block(inode, allocated_meta_blocks);
vfs_dq_release_reservation_block(inode, mdb_free + used);
}
/*
* If we have done all the pending block allocations and if
* there aren't any writers on the inode, we can discard the
* inode's preallocations.
*/
if ((ei->i_reserved_data_blocks == 0) &&
(atomic_read(&inode->i_writecount) == 0))
ext4_discard_preallocations(inode);
}
| 12,672
|
14,015
| 0
|
gs_lib_ctx_t *gs_lib_ctx_get_interp_instance(const gs_memory_t *mem)
{
if (mem == NULL)
return NULL;
return mem->gs_lib_ctx;
}
| 12,673
|
135,120
| 0
|
DEFINE_TRACE(Document)
{
#if ENABLE(OILPAN)
visitor->trace(m_importsController);
visitor->trace(m_docType);
visitor->trace(m_implementation);
visitor->trace(m_autofocusElement);
visitor->trace(m_focusedElement);
visitor->trace(m_hoverNode);
visitor->trace(m_activeHoverElement);
visitor->trace(m_documentElement);
visitor->trace(m_titleElement);
visitor->trace(m_axObjectCache);
visitor->trace(m_markers);
visitor->trace(m_cssTarget);
visitor->trace(m_currentScriptStack);
visitor->trace(m_scriptRunner);
visitor->trace(m_listsInvalidatedAtDocument);
for (int i = 0; i < numNodeListInvalidationTypes; ++i)
visitor->trace(m_nodeLists[i]);
visitor->trace(m_topLayerElements);
visitor->trace(m_elemSheet);
visitor->trace(m_nodeIterators);
visitor->trace(m_ranges);
visitor->trace(m_styleEngine);
visitor->trace(m_formController);
visitor->trace(m_visitedLinkState);
visitor->trace(m_frame);
visitor->trace(m_domWindow);
visitor->trace(m_fetcher);
visitor->trace(m_parser);
visitor->trace(m_contextFeatures);
visitor->trace(m_styleSheetList);
visitor->trace(m_documentTiming);
visitor->trace(m_mediaQueryMatcher);
visitor->trace(m_scriptedAnimationController);
visitor->trace(m_scriptedIdleTaskController);
visitor->trace(m_taskRunner);
visitor->trace(m_textAutosizer);
visitor->trace(m_registrationContext);
visitor->trace(m_customElementMicrotaskRunQueue);
visitor->trace(m_elementDataCache);
visitor->trace(m_associatedFormControls);
visitor->trace(m_useElementsNeedingUpdate);
visitor->trace(m_layerUpdateSVGFilterElements);
visitor->trace(m_timers);
visitor->trace(m_templateDocument);
visitor->trace(m_templateDocumentHost);
visitor->trace(m_visibilityObservers);
visitor->trace(m_userActionElements);
visitor->trace(m_svgExtensions);
visitor->trace(m_timeline);
visitor->trace(m_compositorPendingAnimations);
visitor->trace(m_contextDocument);
visitor->trace(m_canvasFontCache);
visitor->trace(m_intersectionObserverController);
visitor->trace(m_intersectionObserverData);
WillBeHeapSupplementable<Document>::trace(visitor);
#endif
TreeScope::trace(visitor);
ContainerNode::trace(visitor);
ExecutionContext::trace(visitor);
DocumentLifecycleNotifier::trace(visitor);
SecurityContext::trace(visitor);
}
| 12,674
|
66,588
| 0
|
static struct port *find_port_by_vtermno(u32 vtermno)
{
struct port *port;
struct console *cons;
unsigned long flags;
spin_lock_irqsave(&pdrvdata_lock, flags);
list_for_each_entry(cons, &pdrvdata.consoles, list) {
if (cons->vtermno == vtermno) {
port = container_of(cons, struct port, cons);
goto out;
}
}
port = NULL;
out:
spin_unlock_irqrestore(&pdrvdata_lock, flags);
return port;
}
| 12,675
|
72,532
| 0
|
rb_event_is_commit(struct ring_buffer_per_cpu *cpu_buffer,
struct ring_buffer_event *event)
{
unsigned long addr = (unsigned long)event;
unsigned long index;
index = rb_event_index(event);
addr &= PAGE_MASK;
return cpu_buffer->commit_page->page == (void *)addr &&
rb_commit_index(cpu_buffer) == index;
}
| 12,676
|
6,511
| 0
|
_bdf_list_join( _bdf_list_t* list,
int c,
unsigned long *alen )
{
unsigned long i, j;
char *fp, *dp;
*alen = 0;
if ( list == 0 || list->used == 0 )
return 0;
dp = list->field[0];
for ( i = j = 0; i < list->used; i++ )
{
fp = list->field[i];
while ( *fp )
dp[j++] = *fp++;
if ( i + 1 < list->used )
dp[j++] = (char)c;
}
if ( dp != empty )
dp[j] = 0;
*alen = j;
return dp;
}
| 12,677
|
126,726
| 0
|
void BrowserView::ConfirmBrowserCloseWithPendingDownloads() {
DownloadInProgressDialogView::Show(browser_.get(), GetNativeWindow());
}
| 12,678
|
128,178
| 0
|
base::WaitableEvent* event() { return event_.get(); }
| 12,679
|
9,626
| 0
|
static int php_session_decode(const char *val, int vallen TSRMLS_DC) /* {{{ */
{
if (!PS(serializer)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown session.serialize_handler. Failed to decode session object");
return FAILURE;
}
if (PS(serializer)->decode(val, vallen TSRMLS_CC) == FAILURE) {
php_session_destroy(TSRMLS_C);
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to decode session object. Session has been destroyed");
return FAILURE;
}
return SUCCESS;
}
/* }}} */
| 12,680
|
13,861
| 0
|
ZEND_METHOD(CURLFile, getMimeType)
{
curlfile_get_property("mime", INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
| 12,681
|
101,205
| 0
|
void ProcessCommitResponseCommand::ModelChangingExecuteImpl(
SyncSession* session) {
ProcessCommitResponse(session);
ExtensionsActivityMonitor* monitor = session->context()->extensions_monitor();
if (session->status_controller()->HasBookmarkCommitActivity() &&
session->status_controller()->syncer_status()
.num_successful_bookmark_commits == 0) {
monitor->PutRecords(session->extensions_activity());
session->mutable_extensions_activity()->clear();
}
}
| 12,682
|
37,086
| 0
|
static int handle_rmode_exception(struct kvm_vcpu *vcpu,
int vec, u32 err_code)
{
/*
* Instruction with address size override prefix opcode 0x67
* Cause the #SS fault with 0 error code in VM86 mode.
*/
if (((vec == GP_VECTOR) || (vec == SS_VECTOR)) && err_code == 0) {
if (emulate_instruction(vcpu, 0) == EMULATE_DONE) {
if (vcpu->arch.halt_request) {
vcpu->arch.halt_request = 0;
return kvm_emulate_halt(vcpu);
}
return 1;
}
return 0;
}
/*
* Forward all other exceptions that are valid in real mode.
* FIXME: Breaks guest debugging in real mode, needs to be fixed with
* the required debugging infrastructure rework.
*/
kvm_queue_exception(vcpu, vec);
return 1;
}
| 12,683
|
59,204
| 0
|
static int shash_update_unaligned(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct crypto_shash *tfm = desc->tfm;
struct shash_alg *shash = crypto_shash_alg(tfm);
unsigned long alignmask = crypto_shash_alignmask(tfm);
unsigned int unaligned_len = alignmask + 1 -
((unsigned long)data & alignmask);
u8 ubuf[shash_align_buffer_size(unaligned_len, alignmask)]
__aligned_largest;
u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1);
int err;
if (unaligned_len > len)
unaligned_len = len;
memcpy(buf, data, unaligned_len);
err = shash->update(desc, buf, unaligned_len);
memset(buf, 0, unaligned_len);
return err ?:
shash->update(desc, data + unaligned_len, len - unaligned_len);
}
| 12,684
|
119,779
| 0
|
NavigationControllerImpl::GetSessionStorageNamespaceMap() const {
return session_storage_namespace_map_;
}
| 12,685
|
22,563
| 0
|
static void sched_rt_avg_update(struct rq *rq, u64 rt_delta)
{
rq->rt_avg += rt_delta;
sched_avg_update(rq);
}
| 12,686
|
44,173
| 0
|
CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
const unsigned char *key, size_t keylen,
unsigned int flags)
{
CMS_ContentInfo *cms;
if (!cipher)
{
CMSerr(CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT, CMS_R_NO_CIPHER);
return NULL;
}
cms = CMS_ContentInfo_new();
if (!cms)
return NULL;
if (!CMS_EncryptedData_set1_key(cms, cipher, key, keylen))
return NULL;
if(!(flags & CMS_DETACHED))
CMS_set_detached(cms, 0);
if ((flags & (CMS_STREAM|CMS_PARTIAL))
|| CMS_final(cms, in, NULL, flags))
return cms;
CMS_ContentInfo_free(cms);
return NULL;
}
| 12,687
|
45,766
| 0
|
static int crypto_rfc4543_setkey(struct crypto_aead *parent, const u8 *key,
unsigned int keylen)
{
struct crypto_rfc4543_ctx *ctx = crypto_aead_ctx(parent);
struct crypto_aead *child = ctx->child;
int err;
if (keylen < 4)
return -EINVAL;
keylen -= 4;
memcpy(ctx->nonce, key + keylen, 4);
crypto_aead_clear_flags(child, CRYPTO_TFM_REQ_MASK);
crypto_aead_set_flags(child, crypto_aead_get_flags(parent) &
CRYPTO_TFM_REQ_MASK);
err = crypto_aead_setkey(child, key, keylen);
crypto_aead_set_flags(parent, crypto_aead_get_flags(child) &
CRYPTO_TFM_RES_MASK);
return err;
}
| 12,688
|
12,275
| 0
|
gpgsm_keylist (void *engine, const char *pattern, int secret_only,
gpgme_keylist_mode_t mode)
{
engine_gpgsm_t gpgsm = engine;
char *line;
gpgme_error_t err;
int list_mode = 0;
if (mode & GPGME_KEYLIST_MODE_LOCAL)
list_mode |= 1;
if (mode & GPGME_KEYLIST_MODE_EXTERN)
list_mode |= 2;
if (!pattern)
pattern = "";
/* Hack to make sure that the agent is started. Only if the agent
has been started an application may connect to the agent via
GPGME_PROTOCOL_ASSUAN - for example to look for smartcards. We
do this only if a secret key listing has been requested. In
general this is not needed because a secret key listing starts
the agent. However on a fresh installation no public keys are
available and thus there is no need for gpgsm to ask the agent
whether a secret key exists for the public key. */
if (secret_only || (mode & GPGME_KEYLIST_MODE_WITH_SECRET))
gpgsm_assuan_simple_command (gpgsm->assuan_ctx, "GETINFO agent-check",
NULL, NULL);
/* Always send list-mode option because RESET does not reset it. */
if (asprintf (&line, "OPTION list-mode=%d", (list_mode & 3)) < 0)
return gpg_error_from_syserror ();
err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, line, NULL, NULL);
free (line);
if (err)
return err;
/* Always send key validation because RESET does not reset it. */
/* Use the validation mode if requested. We don't check for an error
yet because this is a pretty fresh gpgsm features. */
gpgsm_assuan_simple_command (gpgsm->assuan_ctx,
(mode & GPGME_KEYLIST_MODE_VALIDATE)?
"OPTION with-validation=1":
"OPTION with-validation=0" ,
NULL, NULL);
/* Include the ephemeral keys if requested. We don't check for an error
yet because this is a pretty fresh gpgsm features. */
gpgsm_assuan_simple_command (gpgsm->assuan_ctx,
(mode & GPGME_KEYLIST_MODE_EPHEMERAL)?
"OPTION with-ephemeral-keys=1":
"OPTION with-ephemeral-keys=0" ,
NULL, NULL);
gpgsm_assuan_simple_command (gpgsm->assuan_ctx,
(mode & GPGME_KEYLIST_MODE_WITH_SECRET)?
"OPTION with-secret=1":
"OPTION with-secret=0" ,
NULL, NULL);
/* Length is "LISTSECRETKEYS " + p + '\0'. */
line = malloc (15 + strlen (pattern) + 1);
if (!line)
return gpg_error_from_syserror ();
if (secret_only)
{
strcpy (line, "LISTSECRETKEYS ");
strcpy (&line[15], pattern);
}
else
{
strcpy (line, "LISTKEYS ");
strcpy (&line[9], pattern);
}
gpgsm_clear_fd (gpgsm, INPUT_FD);
gpgsm_clear_fd (gpgsm, OUTPUT_FD);
gpgsm_clear_fd (gpgsm, MESSAGE_FD);
gpgsm->inline_data = NULL;
err = start (gpgsm, line);
free (line);
return err;
}
| 12,689
|
25,340
| 0
|
static int vfp_get(struct task_struct *target,
const struct user_regset *regset,
unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf)
{
int ret;
struct thread_info *thread = task_thread_info(target);
struct vfp_hard_struct const *vfp = &thread->vfpstate.hard;
const size_t user_fpregs_offset = offsetof(struct user_vfp, fpregs);
const size_t user_fpscr_offset = offsetof(struct user_vfp, fpscr);
vfp_sync_hwstate(thread);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
&vfp->fpregs,
user_fpregs_offset,
user_fpregs_offset + sizeof(vfp->fpregs));
if (ret)
return ret;
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
user_fpregs_offset + sizeof(vfp->fpregs),
user_fpscr_offset);
if (ret)
return ret;
return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
&vfp->fpscr,
user_fpscr_offset,
user_fpscr_offset + sizeof(vfp->fpscr));
}
| 12,690
|
48,195
| 0
|
DECLAREcpFunc(cpContigTiles2ContigTiles)
{
return cpImage(in, out,
readContigTilesIntoBuffer,
writeBufferToContigTiles,
imagelength, imagewidth, spp);
}
| 12,691
|
45,737
| 0
|
static void crypto_gcm_free(struct crypto_instance *inst)
{
struct gcm_instance_ctx *ctx = crypto_instance_ctx(inst);
crypto_drop_skcipher(&ctx->ctr);
crypto_drop_ahash(&ctx->ghash);
kfree(inst);
}
| 12,692
|
100,943
| 0
|
ScriptableHandle::~ScriptableHandle() {
PLUGIN_PRINTF(("ScriptableHandle::~ScriptableHandle (this=%p)\n",
static_cast<void*>(this)));
if (NULL == g_ValidHandles) {
return;
}
g_ValidHandles->erase(this);
if (desc_handle_ != NULL) {
PLUGIN_PRINTF(("ScriptableHandle::~ScriptableHandle "
"(this=%p, delete desc_handle=%p)\n",
static_cast<void*>(this), static_cast<void*>(desc_handle_)));
delete desc_handle_;
desc_handle_ = NULL;
}
PLUGIN_PRINTF(("ScriptableHandle::~ScriptableHandle (this=%p, return)\n",
static_cast<void*>(this)));
}
| 12,693
|
6,996
| 0
|
tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder decoder,
FT_Byte* p,
FT_Byte* limit,
FT_Int x_pos,
FT_Int y_pos )
{
FT_Error error = FT_Err_Ok;
FT_Byte* line;
FT_Int bit_height, bit_width, pitch, width, height, line_bits, h, nbits;
FT_Bitmap* bitmap;
FT_UShort rval;
/* check that we can write the glyph into the bitmap */
bitmap = decoder->bitmap;
bit_width = bitmap->width;
bit_height = bitmap->rows;
pitch = bitmap->pitch;
line = bitmap->buffer;
width = decoder->metrics->width;
height = decoder->metrics->height;
line_bits = width * decoder->bit_depth;
if ( x_pos < 0 || x_pos + width > bit_width ||
y_pos < 0 || y_pos + height > bit_height )
{
FT_TRACE1(( "tt_sbit_decoder_load_bit_aligned:"
" invalid bitmap dimensions\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
if ( p + ( ( line_bits * height + 7 ) >> 3 ) > limit )
{
FT_TRACE1(( "tt_sbit_decoder_load_bit_aligned: broken bitmap\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
/* now do the blit */
/* adjust `line' to point to the first byte of the bitmap */
line += y_pos * pitch + ( x_pos >> 3 );
x_pos &= 7;
/* the higher byte of `rval' is used as a buffer */
rval = 0;
nbits = 0;
for ( h = height; h > 0; h--, line += pitch )
{
FT_Byte* pwrite = line;
FT_Int w = line_bits;
/* handle initial byte (in target bitmap) specially if necessary */
if ( x_pos )
{
w = ( line_bits < 8 - x_pos ) ? line_bits : 8 - x_pos;
if ( h == height )
{
rval = *p++;
nbits = x_pos;
}
else if ( nbits < w )
{
if ( p < limit )
rval |= *p++;
nbits += 8 - w;
}
else
{
rval >>= 8;
nbits -= w;
}
*pwrite++ |= ( ( rval >> nbits ) & 0xFF ) &
( ~( 0xFF << w ) << ( 8 - w - x_pos ) );
rval <<= 8;
w = line_bits - w;
}
/* handle medial bytes */
for ( ; w >= 8; w -= 8 )
{
rval |= *p++;
*pwrite++ |= ( rval >> nbits ) & 0xFF;
rval <<= 8;
}
/* handle final byte if necessary */
if ( w > 0 )
{
if ( nbits < w )
{
if ( p < limit )
rval |= *p++;
*pwrite |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );
nbits += 8 - w;
rval <<= 8;
}
else
{
*pwrite |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w );
nbits -= w;
}
}
}
Exit:
if ( !error )
FT_TRACE3(( "tt_sbit_decoder_load_bit_aligned: loaded\n" ));
return error;
}
| 12,694
|
129,545
| 0
|
void AudioParam::connect(AudioNodeOutput* output)
{
ASSERT(context()->isGraphOwner());
ASSERT(output);
if (!output)
return;
if (m_outputs.contains(output))
return;
output->addParam(this);
m_outputs.add(output);
changedOutputs();
}
| 12,695
|
48,498
| 0
|
static void start_unregistering(struct ctl_table_header *p)
{
/*
* if p->used is 0, nobody will ever touch that entry again;
* we'll eliminate all paths to it before dropping sysctl_lock
*/
if (unlikely(p->used)) {
struct completion wait;
init_completion(&wait);
p->unregistering = &wait;
spin_unlock(&sysctl_lock);
wait_for_completion(&wait);
spin_lock(&sysctl_lock);
} else {
/* anything non-NULL; we'll never dereference it */
p->unregistering = ERR_PTR(-EINVAL);
}
/*
* do not remove from the list until nobody holds it; walking the
* list in do_sysctl() relies on that.
*/
erase_header(p);
}
| 12,696
|
10,060
| 0
|
event_font_change( int delta )
{
int num_indices;
if ( status.font_index + delta >= handle->num_fonts ||
status.font_index + delta < 0 )
return;
status.font_index += delta;
FTDemo_Set_Current_Font( handle, handle->fonts[status.font_index] );
FTDemo_Set_Current_Charsize( handle, status.ptsize, status.res );
FTDemo_Update_Current_Flags( handle );
num_indices = handle->current_font->num_indices;
if ( status.Num >= num_indices )
status.Num = num_indices - 1;
}
| 12,697
|
59,597
| 0
|
launchTests(testDescPtr tst) {
int res = 0, err = 0;
size_t i;
char *result;
char *error;
int mem;
if (tst == NULL) return(-1);
if (tst->in != NULL) {
glob_t globbuf;
globbuf.gl_offs = 0;
glob(tst->in, GLOB_DOOFFS, NULL, &globbuf);
for (i = 0;i < globbuf.gl_pathc;i++) {
if (!checkTestFile(globbuf.gl_pathv[i]))
continue;
if (tst->suffix != NULL) {
result = resultFilename(globbuf.gl_pathv[i], tst->out,
tst->suffix);
if (result == NULL) {
fprintf(stderr, "Out of memory !\n");
fatalError();
}
} else {
result = NULL;
}
if (tst->err != NULL) {
error = resultFilename(globbuf.gl_pathv[i], tst->out,
tst->err);
if (error == NULL) {
fprintf(stderr, "Out of memory !\n");
fatalError();
}
} else {
error = NULL;
}
if ((result) &&(!checkTestFile(result)) && !update_results) {
fprintf(stderr, "Missing result file %s\n", result);
} else if ((error) &&(!checkTestFile(error)) && !update_results) {
fprintf(stderr, "Missing error file %s\n", error);
} else {
mem = xmlMemUsed();
extraMemoryFromResolver = 0;
testErrorsSize = 0;
testErrors[0] = 0;
res = tst->func(globbuf.gl_pathv[i], result, error,
tst->options | XML_PARSE_COMPACT);
xmlResetLastError();
if (res != 0) {
fprintf(stderr, "File %s generated an error\n",
globbuf.gl_pathv[i]);
nb_errors++;
err++;
}
else if (xmlMemUsed() != mem) {
if ((xmlMemUsed() != mem) &&
(extraMemoryFromResolver == 0)) {
fprintf(stderr, "File %s leaked %d bytes\n",
globbuf.gl_pathv[i], xmlMemUsed() - mem);
nb_leaks++;
err++;
}
}
testErrorsSize = 0;
}
if (result)
free(result);
if (error)
free(error);
}
globfree(&globbuf);
} else {
testErrorsSize = 0;
testErrors[0] = 0;
extraMemoryFromResolver = 0;
res = tst->func(NULL, NULL, NULL, tst->options);
if (res != 0) {
nb_errors++;
err++;
}
}
return(err);
}
| 12,698
|
105,706
| 0
|
InputMethodLibrary* InputMethodLibrary::GetImpl(bool stub) {
if (stub) {
return new InputMethodLibraryStubImpl();
} else {
InputMethodLibraryImpl* impl = new InputMethodLibraryImpl();
if (!impl->Init()) {
LOG(ERROR) << "Failed to initialize InputMethodLibraryImpl";
}
return impl;
}
}
| 12,699
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.