idx
int64 | func
string | target
int64 |
|---|---|---|
82,478
|
static void svm_vcpu_reset(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);
u32 dummy;
u32 eax = 1;
init_vmcb(svm);
kvm_cpuid(vcpu, &eax, &dummy, &dummy, &dummy);
kvm_register_write(vcpu, VCPU_REGS_RDX, eax);
}
| 0
|
23,396
|
static ssize_t virtio_net_receive ( VLANClientState * nc , const uint8_t * buf , size_t size ) {
VirtIONet * n = DO_UPCAST ( NICState , nc , nc ) -> opaque ;
struct virtio_net_hdr_mrg_rxbuf * mhdr = NULL ;
size_t guest_hdr_len , offset , i , host_hdr_len ;
if ( ! virtio_net_can_receive ( & n -> nic -> nc ) ) return - 1 ;
guest_hdr_len = n -> mergeable_rx_bufs ? sizeof ( struct virtio_net_hdr_mrg_rxbuf ) : sizeof ( struct virtio_net_hdr ) ;
host_hdr_len = n -> has_vnet_hdr ? sizeof ( struct virtio_net_hdr ) : 0 ;
if ( ! virtio_net_has_buffers ( n , size + guest_hdr_len - host_hdr_len ) ) return 0 ;
if ( ! receive_filter ( n , buf , size ) ) return size ;
offset = i = 0 ;
while ( offset < size ) {
VirtQueueElement elem ;
int len , total ;
struct iovec sg [ VIRTQUEUE_MAX_SIZE ] ;
total = 0 ;
if ( virtqueue_pop ( n -> rx_vq , & elem ) == 0 ) {
if ( i == 0 ) return - 1 ;
error_report ( "virtio-net unexpected empty queue: " "i %zd mergeable %d offset %zd, size %zd, " "guest hdr len %zd, host hdr len %zd guest features 0x%x" , i , n -> mergeable_rx_bufs , offset , size , guest_hdr_len , host_hdr_len , n -> vdev . guest_features ) ;
exit ( 1 ) ;
}
if ( elem . in_num < 1 ) {
error_report ( "virtio-net receive queue contains no in buffers" ) ;
exit ( 1 ) ;
}
if ( ! n -> mergeable_rx_bufs && elem . in_sg [ 0 ] . iov_len != guest_hdr_len ) {
error_report ( "virtio-net header not in first element" ) ;
exit ( 1 ) ;
}
memcpy ( & sg , & elem . in_sg [ 0 ] , sizeof ( sg [ 0 ] ) * elem . in_num ) ;
if ( i == 0 ) {
if ( n -> mergeable_rx_bufs ) mhdr = ( struct virtio_net_hdr_mrg_rxbuf * ) sg [ 0 ] . iov_base ;
offset += receive_header ( n , sg , elem . in_num , buf + offset , size - offset , guest_hdr_len ) ;
total += guest_hdr_len ;
}
len = iov_from_buf ( sg , elem . in_num , 0 , buf + offset , size - offset ) ;
total += len ;
offset += len ;
if ( ! n -> mergeable_rx_bufs && offset < size ) {
# if 0 error_report ( "virtio-net truncated non-mergeable packet: " "i %zd mergeable %d offset %zd, size %zd, " "guest hdr len %zd, host hdr len %zd" , i , n -> mergeable_rx_bufs , offset , size , guest_hdr_len , host_hdr_len ) ;
# endif return size ;
}
virtqueue_fill ( n -> rx_vq , & elem , total , i ++ ) ;
}
if ( mhdr ) {
stw_p ( & mhdr -> num_buffers , i ) ;
}
virtqueue_flush ( n -> rx_vq , i ) ;
virtio_notify ( & n -> vdev , n -> rx_vq ) ;
return size ;
}
| 0
|
331,962
|
static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset,
ram_addr_t *ram_addr_abs)
{
RAMBlock *block = NULL;
qemu_mutex_lock(&rs->src_page_req_mutex);
if (!QSIMPLEQ_EMPTY(&rs->src_page_requests)) {
struct RAMSrcPageRequest *entry =
QSIMPLEQ_FIRST(&rs->src_page_requests);
block = entry->rb;
*offset = entry->offset;
*ram_addr_abs = (entry->offset + entry->rb->offset) &
TARGET_PAGE_MASK;
if (entry->len > TARGET_PAGE_SIZE) {
entry->len -= TARGET_PAGE_SIZE;
entry->offset += TARGET_PAGE_SIZE;
} else {
memory_region_unref(block->mr);
QSIMPLEQ_REMOVE_HEAD(&rs->src_page_requests, next_req);
g_free(entry);
}
}
qemu_mutex_unlock(&rs->src_page_req_mutex);
return block;
}
| 1
|
292,891
|
nonce64 getNextNonce() {
SimpleMutex::scoped_lock lk(_randMutex);
return _random->nextInt64();
}
| 0
|
313,358
|
void ChromeContentBrowserClient::UpdateInspectorSetting(
RenderViewHost* rvh, const std::string& key, const std::string& value) {
content::BrowserContext* browser_context =
rvh->GetProcess()->GetBrowserContext();
DictionaryPrefUpdate update(
Profile::FromBrowserContext(browser_context)->GetPrefs(),
prefs::kWebKitInspectorSettings);
DictionaryValue* inspector_settings = update.Get();
inspector_settings->SetWithoutPathExpansion(key,
Value::CreateStringValue(value));
}
| 0
|
179,962
|
CSPHandler::CSPHandler(bool is_platform_app)
: is_platform_app_(is_platform_app) {
}
| 0
|
434,032
|
static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr,
void *image_oes)
{
uint level;
GLenum internalformat, glformat, gltype;
enum virgl_formats format = gr->base.format;
struct vrend_texture *gt = (struct vrend_texture *)gr;
struct pipe_resource *pr = &gr->base;
if (pr->width0 == 0)
return EINVAL;
if (!image_oes && vrend_allocate_using_gbm(gr)) {
if ((gr->base.bind & (VIRGL_BIND_RENDER_TARGET | VIRGL_BIND_SAMPLER_VIEW)) == 0) {
gr->storage = VREND_RESOURCE_STORAGE_GBM_ONLY;
return 0;
}
image_oes = virgl_egl_image_from_dmabuf(egl, gr->gbm_bo);
if (!image_oes) {
gbm_bo_destroy(gr->gbm_bo);
gr->gbm_bo = NULL;
} else {
gr->egl_image = image_oes;
}
}
bool format_can_texture_storage = has_feature(feat_texture_storage) &&
(tex_conv_table[format].flags & VIRGL_TEXTURE_CAN_TEXTURE_STORAGE);
if (image_oes)
gr->base.bind &= ~VIRGL_BIND_PREFER_EMULATED_BGRA;
else {
/* On GLES there is no support for glTexImage*DMultisample and
* BGRA surfaces are also unlikely to support glTexStorage2DMultisample
* so we try to emulate here */
if (vrend_state.use_gles && pr->nr_samples > 0 && !format_can_texture_storage) {
VREND_DEBUG(dbg_tex, NULL, "Apply VIRGL_BIND_PREFER_EMULATED_BGRA because GLES+MS+noTS\n");
gr->base.bind |= VIRGL_BIND_PREFER_EMULATED_BGRA;
}
format = vrend_format_replace_emulated(gr->base.bind, gr->base.format);
format_can_texture_storage = has_feature(feat_texture_storage) &&
(tex_conv_table[format].flags & VIRGL_TEXTURE_CAN_TEXTURE_STORAGE);
}
gr->target = tgsitargettogltarget(pr->target, pr->nr_samples);
gr->storage = VREND_RESOURCE_STORAGE_TEXTURE;
/* ugly workaround for texture rectangle missing on GLES */
if (vrend_state.use_gles && gr->target == GL_TEXTURE_RECTANGLE_NV) {
/* for some guests this is the only usage of rect */
if (pr->width0 != 1 || pr->height0 != 1) {
report_gles_warn(NULL, GLES_WARN_TEXTURE_RECT);
}
gr->target = GL_TEXTURE_2D;
}
/* fallback for 1D textures */
if (vrend_state.use_gles && gr->target == GL_TEXTURE_1D) {
gr->target = GL_TEXTURE_2D;
}
/* fallback for 1D array textures */
if (vrend_state.use_gles && gr->target == GL_TEXTURE_1D_ARRAY) {
gr->target = GL_TEXTURE_2D_ARRAY;
}
debug_texture(__func__, gr);
glGenTextures(1, &gr->id);
glBindTexture(gr->target, gr->id);
if (image_oes) {
if (epoxy_has_gl_extension("GL_OES_EGL_image_external")) {
glEGLImageTargetTexture2DOES(gr->target, (GLeglImageOES) image_oes);
} else {
vrend_printf( "missing GL_OES_EGL_image_external extension\n");
glBindTexture(gr->target, 0);
FREE(gr);
return EINVAL;
}
} else {
internalformat = tex_conv_table[format].internalformat;
glformat = tex_conv_table[format].glformat;
gltype = tex_conv_table[format].gltype;
if (internalformat == 0) {
vrend_printf("unknown format is %d\n", pr->format);
glBindTexture(gr->target, 0);
FREE(gt);
return EINVAL;
}
if (pr->nr_samples > 0) {
if (format_can_texture_storage) {
if (gr->target == GL_TEXTURE_2D_MULTISAMPLE) {
glTexStorage2DMultisample(gr->target, pr->nr_samples,
internalformat, pr->width0, pr->height0,
GL_TRUE);
} else {
glTexStorage3DMultisample(gr->target, pr->nr_samples,
internalformat, pr->width0, pr->height0, pr->array_size,
GL_TRUE);
}
} else {
if (gr->target == GL_TEXTURE_2D_MULTISAMPLE) {
glTexImage2DMultisample(gr->target, pr->nr_samples,
internalformat, pr->width0, pr->height0,
GL_TRUE);
} else {
glTexImage3DMultisample(gr->target, pr->nr_samples,
internalformat, pr->width0, pr->height0, pr->array_size,
GL_TRUE);
}
}
} else if (gr->target == GL_TEXTURE_CUBE_MAP) {
int i;
if (format_can_texture_storage)
glTexStorage2D(GL_TEXTURE_CUBE_MAP, pr->last_level + 1, internalformat, pr->width0, pr->height0);
else {
for (i = 0; i < 6; i++) {
GLenum ctarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i;
for (level = 0; level <= pr->last_level; level++) {
unsigned mwidth = u_minify(pr->width0, level);
unsigned mheight = u_minify(pr->height0, level);
glTexImage2D(ctarget, level, internalformat, mwidth, mheight, 0, glformat,
gltype, NULL);
}
}
}
} else if (gr->target == GL_TEXTURE_3D ||
gr->target == GL_TEXTURE_2D_ARRAY ||
gr->target == GL_TEXTURE_CUBE_MAP_ARRAY) {
if (format_can_texture_storage) {
unsigned depth_param = (gr->target == GL_TEXTURE_2D_ARRAY || gr->target == GL_TEXTURE_CUBE_MAP_ARRAY) ?
pr->array_size : pr->depth0;
glTexStorage3D(gr->target, pr->last_level + 1, internalformat, pr->width0, pr->height0, depth_param);
} else {
for (level = 0; level <= pr->last_level; level++) {
unsigned depth_param = (gr->target == GL_TEXTURE_2D_ARRAY || gr->target == GL_TEXTURE_CUBE_MAP_ARRAY) ?
pr->array_size : u_minify(pr->depth0, level);
unsigned mwidth = u_minify(pr->width0, level);
unsigned mheight = u_minify(pr->height0, level);
glTexImage3D(gr->target, level, internalformat, mwidth, mheight,
depth_param, 0, glformat, gltype, NULL);
}
}
} else if (gr->target == GL_TEXTURE_1D && vrend_state.use_gles) {
report_gles_missing_func(NULL, "glTexImage1D");
} else if (gr->target == GL_TEXTURE_1D) {
if (format_can_texture_storage) {
glTexStorage1D(gr->target, pr->last_level + 1, internalformat, pr->width0);
} else {
for (level = 0; level <= pr->last_level; level++) {
unsigned mwidth = u_minify(pr->width0, level);
glTexImage1D(gr->target, level, internalformat, mwidth, 0,
glformat, gltype, NULL);
}
}
} else {
if (format_can_texture_storage)
glTexStorage2D(gr->target, pr->last_level + 1, internalformat, pr->width0,
gr->target == GL_TEXTURE_1D_ARRAY ? pr->array_size : pr->height0);
else {
for (level = 0; level <= pr->last_level; level++) {
unsigned mwidth = u_minify(pr->width0, level);
unsigned mheight = u_minify(pr->height0, level);
glTexImage2D(gr->target, level, internalformat, mwidth,
gr->target == GL_TEXTURE_1D_ARRAY ? pr->array_size : mheight,
0, glformat, gltype, NULL);
}
}
}
}
if (!format_can_texture_storage) {
glTexParameteri(gr->target, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(gr->target, GL_TEXTURE_MAX_LEVEL, pr->last_level);
}
glBindTexture(gr->target, 0);
gt->state.max_lod = -1;
gt->cur_swizzle_r = gt->cur_swizzle_g = gt->cur_swizzle_b = gt->cur_swizzle_a = -1;
gt->cur_base = -1;
gt->cur_max = 10000;
return 0;
}
| 0
|
41,399
|
void Compute(OpKernelContext* context) override {
const Tensor& data = context->input(0);
const Tensor& segment_ids = context->input(1);
const Tensor& num_segments = context->input(2);
if (!UnsortedSegmentReductionDoValidation(this, context, data, segment_ids,
num_segments)) {
return;
}
const auto segment_flat = segment_ids.flat<Index>();
const int64 output_rows = internal::SubtleMustCopy(static_cast<int64>(
num_segments.dtype() == DT_INT32 ? num_segments.scalar<int32>()()
: num_segments.scalar<int64>()()));
OP_REQUIRES(context, output_rows >= 0,
errors::InvalidArgument("Input num_segments == ", output_rows,
" must not be negative."));
TensorShape output_shape;
output_shape.AddDim(output_rows);
for (int i = segment_ids.dims(); i < data.dims(); i++) {
output_shape.AddDim(data.dim_size(i));
}
Tensor* output = nullptr;
OP_REQUIRES_OK(context, context->allocate_output(0, output_shape, &output));
auto output_flat = output->flat_outer_dims<T>();
auto data_flat = data.flat_inner_outer_dims<T, 2>(segment_ids.dims() - 1);
reduction_functor_(context, segment_ids.shape(), segment_flat, data_flat,
output_flat);
}
| 0
|
458,001
|
struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx)
{
struct tty_struct *tty;
tty = kzalloc(sizeof(*tty), GFP_KERNEL);
if (!tty)
return NULL;
kref_init(&tty->kref);
tty->magic = TTY_MAGIC;
if (tty_ldisc_init(tty)) {
kfree(tty);
return NULL;
}
tty->session = NULL;
tty->pgrp = NULL;
mutex_init(&tty->legacy_mutex);
mutex_init(&tty->throttle_mutex);
init_rwsem(&tty->termios_rwsem);
mutex_init(&tty->winsize_mutex);
init_ldsem(&tty->ldisc_sem);
init_waitqueue_head(&tty->write_wait);
init_waitqueue_head(&tty->read_wait);
INIT_WORK(&tty->hangup_work, do_tty_hangup);
mutex_init(&tty->atomic_write_lock);
spin_lock_init(&tty->ctrl_lock);
spin_lock_init(&tty->flow_lock);
spin_lock_init(&tty->files_lock);
INIT_LIST_HEAD(&tty->tty_files);
INIT_WORK(&tty->SAK_work, do_SAK_work);
tty->driver = driver;
tty->ops = driver->ops;
tty->index = idx;
tty_line_name(driver, idx, tty->name);
tty->dev = tty_get_device(tty);
return tty;
}
| 0
|
407,546
|
ldns_str2rdf_str(ldns_rdf **rd, const char *str)
{
uint8_t *data, *dp, ch = 0;
size_t length;
/* Worst case space requirement. We'll realloc to actual size later. */
dp = data = LDNS_XMALLOC(uint8_t, strlen(str) > 255 ? 256 : (strlen(str) + 1));
if (! data) {
return LDNS_STATUS_MEM_ERR;
}
/* Fill data (up to 255 characters) */
while (parse_char(&ch, &str)) {
if (dp - data >= 255) {
LDNS_FREE(data);
return LDNS_STATUS_INVALID_STR;
}
*++dp = ch;
}
if (! str) {
return LDNS_STATUS_SYNTAX_BAD_ESCAPE;
}
length = (size_t)(dp - data);
/* Fix last length byte */
data[0] = (uint8_t)length;
/* Lose the overmeasure */
data = LDNS_XREALLOC(dp = data, uint8_t, length + 1);
if (! data) {
LDNS_FREE(dp);
return LDNS_STATUS_MEM_ERR;
}
/* Create rdf */
*rd = ldns_rdf_new(LDNS_RDF_TYPE_STR, length + 1, data);
if (! *rd) {
LDNS_FREE(data);
return LDNS_STATUS_MEM_ERR;
}
return LDNS_STATUS_OK;
}
| 0
|
451,951
|
static void rbd_obj_handle_request(struct rbd_obj_request *obj_req, int result)
{
if (__rbd_obj_handle_request(obj_req, &result))
rbd_img_handle_request(obj_req->img_request, result);
}
| 0
|
333,973
|
static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
hwaddr base,
qemu_irq kbd_int, qemu_irq gpio_int, qemu_irq wakeup,
omap_clk clk)
{
struct omap_mpuio_s *s = (struct omap_mpuio_s *)
g_malloc0(sizeof(struct omap_mpuio_s));
s->irq = gpio_int;
s->kbd_irq = kbd_int;
s->wakeup = wakeup;
s->in = qemu_allocate_irqs(omap_mpuio_set, s, 16);
omap_mpuio_reset(s);
memory_region_init_io(&s->iomem, NULL, &omap_mpuio_ops, s,
"omap-mpuio", 0x800);
memory_region_add_subregion(memory, base, &s->iomem);
omap_clk_adduser(clk, qemu_allocate_irq(omap_mpuio_onoff, s, 0));
return s;
}
| 1
|
141,349
|
void set_task_comm(struct task_struct *tsk, char *buf)
{
task_lock(tsk);
trace_task_rename(tsk, buf);
/*
* Threads may access current->comm without holding
* the task lock, so write the string carefully.
* Readers without a lock may see incomplete new
* names but are safe from non-terminating string reads.
*/
memset(tsk->comm, 0, TASK_COMM_LEN);
wmb();
strlcpy(tsk->comm, buf, sizeof(tsk->comm));
task_unlock(tsk);
perf_event_comm(tsk);
}
| 0
|
224,728
|
parse_inline_image(fz_context *ctx, pdf_csi *csi, fz_stream *stm)
{
pdf_document *doc = csi->doc;
pdf_obj *rdb = csi->rdb;
pdf_obj *obj = NULL;
fz_image *img = NULL;
int ch, found;
fz_var(obj);
fz_var(img);
fz_try(ctx)
{
obj = pdf_parse_dict(ctx, doc, stm, &doc->lexbuf.base);
/* read whitespace after ID keyword */
ch = fz_read_byte(ctx, stm);
if (ch == '\r')
if (fz_peek_byte(ctx, stm) == '\n')
fz_read_byte(ctx, stm);
img = pdf_load_inline_image(ctx, doc, rdb, obj, stm);
/* find EI */
found = 0;
ch = fz_read_byte(ctx, stm);
do
{
while (ch != 'E' && ch != EOF)
ch = fz_read_byte(ctx, stm);
if (ch == 'E')
{
ch = fz_read_byte(ctx, stm);
if (ch == 'I')
{
ch = fz_peek_byte(ctx, stm);
if (ch == ' ' || ch <= 32 || ch == EOF || ch == '<' || ch == '/')
{
found = 1;
break;
}
}
}
} while (ch != EOF);
if (!found)
fz_throw(ctx, FZ_ERROR_SYNTAX, "syntax error after inline image");
}
fz_always(ctx)
{
pdf_drop_obj(ctx, obj);
}
fz_catch(ctx)
{
fz_drop_image(ctx, img);
fz_rethrow(ctx);
}
return img;
}
| 0
|
502,002
|
bool samdb_set_ntds_settings_dn(struct ldb_context *ldb, struct ldb_dn *ntds_settings_dn_in)
{
TALLOC_CTX *tmp_ctx;
struct ldb_dn *ntds_settings_dn_new;
struct ldb_dn *ntds_settings_dn_old;
/* see if we have a forced copy from provision */
ntds_settings_dn_old = talloc_get_type(ldb_get_opaque(ldb,
"forced.ntds_settings_dn"), struct ldb_dn);
tmp_ctx = talloc_new(ldb);
if (tmp_ctx == NULL) {
goto failed;
}
ntds_settings_dn_new = ldb_dn_copy(tmp_ctx, ntds_settings_dn_in);
if (!ntds_settings_dn_new) {
goto failed;
}
/* set the DN in the ldb to avoid lookups during provision */
if (ldb_set_opaque(ldb, "forced.ntds_settings_dn", ntds_settings_dn_new) != LDB_SUCCESS) {
goto failed;
}
talloc_steal(ldb, ntds_settings_dn_new);
talloc_free(tmp_ctx);
talloc_free(ntds_settings_dn_old);
return true;
failed:
DEBUG(1,("Failed to set our NTDS Settings DN in the ldb!\n"));
talloc_free(tmp_ctx);
return false;
}
| 0
|
40,876
|
flatpak_dir_current_ref (FlatpakDir *self,
const char *name,
GCancellable *cancellable)
{
g_autoptr(GFile) base = NULL;
g_autoptr(GFile) dir = NULL;
g_autoptr(GFile) current_link = NULL;
g_autoptr(GFileInfo) file_info = NULL;
FlatpakDecomposed *decomposed;
char *ref;
base = g_file_get_child (flatpak_dir_get_path (self), "app");
dir = g_file_get_child (base, name);
current_link = g_file_get_child (dir, "current");
file_info = g_file_query_info (current_link, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable, NULL);
if (file_info == NULL)
return NULL;
ref = g_strconcat ("app/", name, "/", g_file_info_get_symlink_target (file_info), NULL);
decomposed = flatpak_decomposed_new_from_ref_take (ref, NULL);
if (decomposed == NULL)
g_free (ref);
return decomposed;
}
| 0
|
396,439
|
do_device_not_available(struct pt_regs *regs, long error_code)
{
RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
BUG_ON(use_eager_fpu());
#ifdef CONFIG_MATH_EMULATION
if (read_cr0() & X86_CR0_EM) {
struct math_emu_info info = { };
conditional_sti(regs);
info.regs = regs;
math_emulate(&info);
return;
}
#endif
fpu__restore(¤t->thread.fpu); /* interrupts still off */
#ifdef CONFIG_X86_32
conditional_sti(regs);
#endif
}
| 0
|
27,595
|
static char * _get_user_from_associd ( mysql_conn_t * mysql_conn , char * cluster , uint32_t associd ) {
char * user = NULL ;
char * query = NULL ;
MYSQL_RES * result = NULL ;
MYSQL_ROW row ;
query = xstrdup_printf ( "select user from \"%s_%s\" where id_assoc=%u" , cluster , assoc_table , associd ) ;
debug4 ( "%d(%s:%d) query\n%s" , mysql_conn -> conn , THIS_FILE , __LINE__ , query ) ;
if ( ! ( result = mysql_db_query_ret ( mysql_conn , query , 0 ) ) ) {
xfree ( query ) ;
return NULL ;
}
xfree ( query ) ;
if ( ( row = mysql_fetch_row ( result ) ) && row [ 0 ] [ 0 ] ) user = xstrdup ( row [ 0 ] ) ;
mysql_free_result ( result ) ;
return user ;
}
| 0
|
434,942
|
MockReadFilterCallbacks::MockReadFilterCallbacks() {
ON_CALL(*this, connection()).WillByDefault(ReturnRef(connection_));
ON_CALL(*this, upstreamHost()).WillByDefault(ReturnPointee(&host_));
ON_CALL(*this, upstreamHost(_)).WillByDefault(SaveArg<0>(&host_));
}
| 0
|
401,930
|
ZEND_API int ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
int op1_val, op2_val;
do {
if (Z_TYPE_P(op1) == IS_FALSE) {
op1_val = 0;
} else if (EXPECTED(Z_TYPE_P(op1) == IS_TRUE)) {
op1_val = 1;
} else {
if (Z_ISREF_P(op1)) {
op1 = Z_REFVAL_P(op1);
if (Z_TYPE_P(op1) == IS_FALSE) {
op1_val = 0;
break;
} else if (EXPECTED(Z_TYPE_P(op1) == IS_TRUE)) {
op1_val = 1;
break;
}
}
ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(ZEND_BOOL_XOR, boolean_xor_function);
op1_val = zval_is_true(op1);
}
} while (0);
do {
if (Z_TYPE_P(op2) == IS_FALSE) {
op2_val = 0;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_TRUE)) {
op2_val = 1;
} else {
if (Z_ISREF_P(op2)) {
op2 = Z_REFVAL_P(op2);
if (Z_TYPE_P(op2) == IS_FALSE) {
op2_val = 0;
break;
} else if (EXPECTED(Z_TYPE_P(op2) == IS_TRUE)) {
op2_val = 1;
break;
}
}
ZEND_TRY_BINARY_OP2_OBJECT_OPERATION(ZEND_BOOL_XOR);
op2_val = zval_is_true(op2);
}
} while (0);
ZVAL_BOOL(result, op1_val ^ op2_val);
return SUCCESS;
}
| 0
|
501,984
|
int samdb_reference_dn_is_our_ntdsa(struct ldb_context *ldb, struct ldb_dn *base,
const char *attribute, bool *is_ntdsa)
{
int ret;
struct ldb_dn *referenced_dn;
TALLOC_CTX *tmp_ctx = talloc_new(ldb);
if (tmp_ctx == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
ret = samdb_reference_dn(ldb, tmp_ctx, base, attribute, &referenced_dn);
if (ret != LDB_SUCCESS) {
DEBUG(0, ("Failed to find object %s for attribute %s - %s\n", ldb_dn_get_linearized(base), attribute, ldb_errstring(ldb)));
return ret;
}
ret = samdb_dn_is_our_ntdsa(ldb, referenced_dn, is_ntdsa);
talloc_free(tmp_ctx);
return ret;
}
| 0
|
468,655
|
ClientRequestContext::clientAccessCheckDone(const Acl::Answer &answer)
{
acl_checklist = NULL;
err_type page_id;
Http::StatusCode status;
debugs(85, 2, "The request " << http->request->method << ' ' <<
http->uri << " is " << answer <<
"; last ACL checked: " << (AclMatchedName ? AclMatchedName : "[none]"));
#if USE_AUTH
char const *proxy_auth_msg = "<null>";
if (http->getConn() != NULL && http->getConn()->getAuth() != NULL)
proxy_auth_msg = http->getConn()->getAuth()->denyMessage("<null>");
else if (http->request->auth_user_request != NULL)
proxy_auth_msg = http->request->auth_user_request->denyMessage("<null>");
#endif
if (!answer.allowed()) {
// auth has a grace period where credentials can be expired but okay not to challenge.
/* Send an auth challenge or error */
// XXX: do we still need aclIsProxyAuth() ?
bool auth_challenge = (answer == ACCESS_AUTH_REQUIRED || aclIsProxyAuth(AclMatchedName));
debugs(85, 5, "Access Denied: " << http->uri);
debugs(85, 5, "AclMatchedName = " << (AclMatchedName ? AclMatchedName : "<null>"));
#if USE_AUTH
if (auth_challenge)
debugs(33, 5, "Proxy Auth Message = " << (proxy_auth_msg ? proxy_auth_msg : "<null>"));
#endif
/*
* NOTE: get page_id here, based on AclMatchedName because if
* USE_DELAY_POOLS is enabled, then AclMatchedName gets clobbered in
* the clientCreateStoreEntry() call just below. Pedro Ribeiro
* <pribeiro@isel.pt>
*/
page_id = aclGetDenyInfoPage(&Config.denyInfoList, AclMatchedName, answer != ACCESS_AUTH_REQUIRED);
http->logType.update(LOG_TCP_DENIED);
if (auth_challenge) {
#if USE_AUTH
if (http->request->flags.sslBumped) {
/*SSL Bumped request, authentication is not possible*/
status = Http::scForbidden;
} else if (!http->flags.accel) {
/* Proxy authorisation needed */
status = Http::scProxyAuthenticationRequired;
} else {
/* WWW authorisation needed */
status = Http::scUnauthorized;
}
#else
// need auth, but not possible to do.
status = Http::scForbidden;
#endif
if (page_id == ERR_NONE)
page_id = ERR_CACHE_ACCESS_DENIED;
} else {
status = Http::scForbidden;
if (page_id == ERR_NONE)
page_id = ERR_ACCESS_DENIED;
}
Ip::Address tmpnoaddr;
tmpnoaddr.setNoAddr();
error = clientBuildError(page_id, status,
NULL,
http->getConn() != NULL ? http->getConn()->clientConnection->remote : tmpnoaddr,
http->request, http->al
);
#if USE_AUTH
error->auth_user_request =
http->getConn() != NULL && http->getConn()->getAuth() != NULL ?
http->getConn()->getAuth() : http->request->auth_user_request;
#endif
readNextRequest = true;
}
/* ACCESS_ALLOWED continues here ... */
xfree(http->uri);
http->uri = SBufToCstring(http->request->effectiveRequestUri());
http->doCallouts();
}
| 0
|
367,991
|
impl_pause (DBusConnection * bus, DBusMessage * message, void *user_data)
{
return NULL;
}
| 0
|
361,807
|
u32 ethtool_op_get_tx_csum(struct net_device *dev)
{
return (dev->features & NETIF_F_ALL_CSUM) != 0;
}
| 0
|
85,590
|
static void digestNtoStr(const unsigned char digest[], int n, char *output)
{
int i;
for (i = 0; i<n; ++i) {
pj_val_to_hex_digit(digest[i], output);
output += 2;
}
}
| 0
|
24,831
|
SPL_METHOD ( SplFileInfo , func_name ) \ {
\ spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
\ zend_error_handling error_handling ;
\ if ( zend_parse_parameters_none ( ) == FAILURE ) {
\ return ;
\ }
\ \ zend_replace_error_handling ( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ;
\ spl_filesystem_object_get_file_name ( intern TSRMLS_CC ) ;
\ php_stat ( intern -> file_name , intern -> file_name_len , func_num , return_value TSRMLS_CC ) ;
\ zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
\ }
FileInfoFunction ( getPerms , FS_PERMS ) FileInfoFunction ( getInode , FS_INODE ) FileInfoFunction ( getSize , FS_SIZE ) FileInfoFunction ( getOwner , FS_OWNER )
| 0
|
214,675
|
std::string GetIdFromImeSpec(const std::string& ime_spec) {
static const std::string kPrefix("m17n:");
return base::StartsWith(ime_spec, kPrefix, base::CompareCase::SENSITIVE)
? ime_spec.substr(kPrefix.length())
: std::string();
}
| 0
|
366,080
|
_gnutls_cert_get_issuer_dn (gnutls_pcert_st * cert, gnutls_datum_t * odn)
{
ASN1_TYPE dn;
int len, result;
int start, end;
if ((result = asn1_create_element
(_gnutls_get_pkix (), "PKIX1.Certificate", &dn)) != ASN1_SUCCESS)
{
gnutls_assert ();
return _gnutls_asn2err (result);
}
result = asn1_der_decoding (&dn, cert->cert.data, cert->cert.size, NULL);
if (result != ASN1_SUCCESS)
{
/* couldn't decode DER */
gnutls_assert ();
asn1_delete_structure (&dn);
return _gnutls_asn2err (result);
}
result = asn1_der_decoding_startEnd (dn, cert->cert.data, cert->cert.size,
"tbsCertificate.issuer", &start, &end);
if (result != ASN1_SUCCESS)
{
/* couldn't decode DER */
gnutls_assert ();
asn1_delete_structure (&dn);
return _gnutls_asn2err (result);
}
asn1_delete_structure (&dn);
len = end - start + 1;
odn->size = len;
odn->data = &cert->cert.data[start];
return 0;
}
| 0
|
360,403
|
should_skip_file (NautilusDirectory *directory, GFileInfo *info)
{
static gboolean show_hidden_files_changed_callback_installed = FALSE;
static gboolean show_backup_files_changed_callback_installed = FALSE;
/* Add the callback once for the life of our process */
if (!show_hidden_files_changed_callback_installed) {
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
show_hidden_files_changed_callback,
NULL);
show_hidden_files_changed_callback_installed = TRUE;
/* Peek for the first time */
show_hidden_files_changed_callback (NULL);
}
/* Add the callback once for the life of our process */
if (!show_backup_files_changed_callback_installed) {
eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
show_backup_files_changed_callback,
NULL);
show_backup_files_changed_callback_installed = TRUE;
/* Peek for the first time */
show_backup_files_changed_callback (NULL);
}
if (!show_hidden_files &&
(g_file_info_get_is_hidden (info) ||
(directory != NULL && directory->details->hidden_file_hash != NULL &&
g_hash_table_lookup (directory->details->hidden_file_hash,
g_file_info_get_name (info)) != NULL))) {
return TRUE;
}
if (!show_backup_files && g_file_info_get_is_backup (info)) {
return TRUE;
}
return FALSE;
}
| 0
|
262,334
|
static inline struct sk_buff *tcp_send_head(const struct sock *sk)
{
return sk->sk_send_head;
}
| 0
|
304,879
|
static struct dm_table *dm_get_live_table_fast(struct mapped_device *md) __acquires(RCU)
{
rcu_read_lock();
return rcu_dereference(md->map);
}
| 0
|
348,135
|
print_help (void)
{
#ifndef TESTING
/* We split the help text this way to ease translation of individual
entries. */
static const char *help[] = {
"\n",
N_("\
Mandatory arguments to long options are mandatory for short options too.\n\n"),
N_("\
Startup:\n"),
N_("\
-V, --version display the version of Wget and exit\n"),
N_("\
-h, --help print this help\n"),
N_("\
-b, --background go to background after startup\n"),
N_("\
-e, --execute=COMMAND execute a `.wgetrc'-style command\n"),
"\n",
N_("\
Logging and input file:\n"),
N_("\
-o, --output-file=FILE log messages to FILE\n"),
N_("\
-a, --append-output=FILE append messages to FILE\n"),
#ifdef ENABLE_DEBUG
N_("\
-d, --debug print lots of debugging information\n"),
#endif
#ifdef USE_WATT32
N_("\
--wdebug print Watt-32 debug output\n"),
#endif
N_("\
-q, --quiet quiet (no output)\n"),
N_("\
-v, --verbose be verbose (this is the default)\n"),
N_("\
-nv, --no-verbose turn off verboseness, without being quiet\n"),
N_("\
--report-speed=TYPE output bandwidth as TYPE. TYPE can be bits\n"),
N_("\
-i, --input-file=FILE download URLs found in local or external FILE\n"),
#ifdef HAVE_METALINK
N_("\
--input-metalink=FILE download files covered in local Metalink FILE\n"),
#endif
N_("\
-F, --force-html treat input file as HTML\n"),
N_("\
-B, --base=URL resolves HTML input-file links (-i -F)\n\
relative to URL\n"),
N_("\
--config=FILE specify config file to use\n"),
N_("\
--no-config do not read any config file\n"),
N_("\
--rejected-log=FILE log reasons for URL rejection to FILE\n"),
"\n",
N_("\
Download:\n"),
N_("\
-t, --tries=NUMBER set number of retries to NUMBER (0 unlimits)\n"),
N_("\
--retry-connrefused retry even if connection is refused\n"),
N_("\
--retry-on-http-error=ERRORS comma-separated list of HTTP errors to retry\n"),
N_("\
-O, --output-document=FILE write documents to FILE\n"),
N_("\
-nc, --no-clobber skip downloads that would download to\n\
existing files (overwriting them)\n"),
N_("\
--no-netrc don't try to obtain credentials from .netrc\n"),
N_("\
-c, --continue resume getting a partially-downloaded file\n"),
N_("\
--start-pos=OFFSET start downloading from zero-based position OFFSET\n"),
N_("\
--progress=TYPE select progress gauge type\n"),
N_("\
--show-progress display the progress bar in any verbosity mode\n"),
N_("\
-N, --timestamping don't re-retrieve files unless newer than\n\
local\n"),
N_("\
--no-if-modified-since don't use conditional if-modified-since get\n\
requests in timestamping mode\n"),
N_("\
--no-use-server-timestamps don't set the local file's timestamp by\n\
the one on the server\n"),
N_("\
-S, --server-response print server response\n"),
N_("\
--spider don't download anything\n"),
N_("\
-T, --timeout=SECONDS set all timeout values to SECONDS\n"),
#ifdef HAVE_LIBCARES
N_("\
--dns-servers=ADDRESSES list of DNS servers to query (comma separated)\n"),
N_("\
--bind-dns-address=ADDRESS bind DNS resolver to ADDRESS (hostname or IP) on local host\n"),
#endif
N_("\
--dns-timeout=SECS set the DNS lookup timeout to SECS\n"),
N_("\
--connect-timeout=SECS set the connect timeout to SECS\n"),
N_("\
--read-timeout=SECS set the read timeout to SECS\n"),
N_("\
-w, --wait=SECONDS wait SECONDS between retrievals\n"),
N_("\
--waitretry=SECONDS wait 1..SECONDS between retries of a retrieval\n"),
N_("\
--random-wait wait from 0.5*WAIT...1.5*WAIT secs between retrievals\n"),
N_("\
--no-proxy explicitly turn off proxy\n"),
N_("\
-Q, --quota=NUMBER set retrieval quota to NUMBER\n"),
N_("\
--bind-address=ADDRESS bind to ADDRESS (hostname or IP) on local host\n"),
N_("\
--limit-rate=RATE limit download rate to RATE\n"),
N_("\
--no-dns-cache disable caching DNS lookups\n"),
N_("\
--restrict-file-names=OS restrict chars in file names to ones OS allows\n"),
N_("\
--ignore-case ignore case when matching files/directories\n"),
#ifdef ENABLE_IPV6
N_("\
-4, --inet4-only connect only to IPv4 addresses\n"),
N_("\
-6, --inet6-only connect only to IPv6 addresses\n"),
N_("\
--prefer-family=FAMILY connect first to addresses of specified family,\n\
one of IPv6, IPv4, or none\n"),
#endif
N_("\
--user=USER set both ftp and http user to USER\n"),
N_("\
--password=PASS set both ftp and http password to PASS\n"),
N_("\
--ask-password prompt for passwords\n"),
N_("\
--use-askpass=COMMAND specify credential handler for requesting \n\
username and password. If no COMMAND is \n\
specified the WGET_ASKPASS or the SSH_ASKPASS \n\
environment variable is used.\n"),
N_("\
--no-iri turn off IRI support\n"),
N_("\
--local-encoding=ENC use ENC as the local encoding for IRIs\n"),
N_("\
--remote-encoding=ENC use ENC as the default remote encoding\n"),
N_("\
--unlink remove file before clobber\n"),
#ifdef HAVE_METALINK
N_("\
--keep-badhash keep files with checksum mismatch (append .badhash)\n"),
N_("\
--metalink-index=NUMBER Metalink application/metalink4+xml metaurl ordinal NUMBER\n"),
N_("\
--metalink-over-http use Metalink metadata from HTTP response headers\n"),
N_("\
--preferred-location preferred location for Metalink resources\n"),
#endif
#ifdef ENABLE_XATTR
N_("\
--no-xattr turn off storage of metadata in extended file attributes\n"),
#endif
"\n",
N_("\
Directories:\n"),
N_("\
-nd, --no-directories don't create directories\n"),
N_("\
-x, --force-directories force creation of directories\n"),
N_("\
-nH, --no-host-directories don't create host directories\n"),
N_("\
--protocol-directories use protocol name in directories\n"),
N_("\
-P, --directory-prefix=PREFIX save files to PREFIX/..\n"),
N_("\
--cut-dirs=NUMBER ignore NUMBER remote directory components\n"),
"\n",
N_("\
HTTP options:\n"),
N_("\
--http-user=USER set http user to USER\n"),
N_("\
--http-password=PASS set http password to PASS\n"),
N_("\
--no-cache disallow server-cached data\n"),
N_ ("\
--default-page=NAME change the default page name (normally\n\
this is 'index.html'.)\n"),
N_("\
-E, --adjust-extension save HTML/CSS documents with proper extensions\n"),
N_("\
--ignore-length ignore 'Content-Length' header field\n"),
N_("\
--header=STRING insert STRING among the headers\n"),
#ifdef HAVE_LIBZ
N_("\
--compression=TYPE choose compression, one of auto, gzip and none. (default: none)\n"),
#endif
N_("\
--max-redirect maximum redirections allowed per page\n"),
N_("\
--proxy-user=USER set USER as proxy username\n"),
N_("\
--proxy-password=PASS set PASS as proxy password\n"),
N_("\
--referer=URL include 'Referer: URL' header in HTTP request\n"),
N_("\
--save-headers save the HTTP headers to file\n"),
N_("\
-U, --user-agent=AGENT identify as AGENT instead of Wget/VERSION\n"),
N_("\
--no-http-keep-alive disable HTTP keep-alive (persistent connections)\n"),
N_("\
--no-cookies don't use cookies\n"),
N_("\
--load-cookies=FILE load cookies from FILE before session\n"),
N_("\
--save-cookies=FILE save cookies to FILE after session\n"),
N_("\
--keep-session-cookies load and save session (non-permanent) cookies\n"),
N_("\
--post-data=STRING use the POST method; send STRING as the data\n"),
N_("\
--post-file=FILE use the POST method; send contents of FILE\n"),
N_("\
--method=HTTPMethod use method \"HTTPMethod\" in the request\n"),
N_("\
--body-data=STRING send STRING as data. --method MUST be set\n"),
N_("\
--body-file=FILE send contents of FILE. --method MUST be set\n"),
N_("\
--content-disposition honor the Content-Disposition header when\n\
choosing local file names (EXPERIMENTAL)\n"),
N_("\
--content-on-error output the received content on server errors\n"),
N_("\
--auth-no-challenge send Basic HTTP authentication information\n\
without first waiting for the server's\n\
challenge\n"),
"\n",
#ifdef HAVE_SSL
N_("\
HTTPS (SSL/TLS) options:\n"),
N_("\
--secure-protocol=PR choose secure protocol, one of auto, SSLv2,\n\
SSLv3, TLSv1, TLSv1_1, TLSv1_2 and PFS\n"),
N_("\
--https-only only follow secure HTTPS links\n"),
N_("\
--no-check-certificate don't validate the server's certificate\n"),
N_("\
--certificate=FILE client certificate file\n"),
N_("\
--certificate-type=TYPE client certificate type, PEM or DER\n"),
N_("\
--private-key=FILE private key file\n"),
N_("\
--private-key-type=TYPE private key type, PEM or DER\n"),
N_("\
--ca-certificate=FILE file with the bundle of CAs\n"),
N_("\
--ca-directory=DIR directory where hash list of CAs is stored\n"),
N_("\
--crl-file=FILE file with bundle of CRLs\n"),
N_("\
--pinnedpubkey=FILE/HASHES Public key (PEM/DER) file, or any number\n\
of base64 encoded sha256 hashes preceded by\n\
\'sha256//\' and separated by \';\', to verify\n\
peer against\n"),
#if defined(HAVE_LIBSSL) || defined(HAVE_LIBSSL32)
N_("\
--random-file=FILE file with random data for seeding the SSL PRNG\n"),
#endif
#if (defined(HAVE_LIBSSL) || defined(HAVE_LIBSSL32)) && defined(HAVE_RAND_EGD)
N_("\
--egd-file=FILE file naming the EGD socket with random data\n"),
#endif
"\n",
N_("\
--ciphers=STR Set the priority string (GnuTLS) or cipher list string (OpenSSL) directly.\n\
Use with care. This option overrides --secure-protocol.\n\
The format and syntax of this string depend on the specific SSL/TLS engine.\n"),
#endif /* HAVE_SSL */
#ifdef HAVE_HSTS
N_("\
HSTS options:\n"),
N_("\
--no-hsts disable HSTS\n"),
N_("\
--hsts-file path of HSTS database (will override default)\n"),
"\n",
#endif
N_("\
FTP options:\n"),
#ifdef __VMS
N_("\
--ftp-stmlf use Stream_LF format for all binary FTP files\n"),
#endif /* def __VMS */
N_("\
--ftp-user=USER set ftp user to USER\n"),
N_("\
--ftp-password=PASS set ftp password to PASS\n"),
N_("\
--no-remove-listing don't remove '.listing' files\n"),
N_("\
--no-glob turn off FTP file name globbing\n"),
N_("\
--no-passive-ftp disable the \"passive\" transfer mode\n"),
N_("\
--preserve-permissions preserve remote file permissions\n"),
N_("\
--retr-symlinks when recursing, get linked-to files (not dir)\n"),
"\n",
#ifdef HAVE_SSL
N_("\
FTPS options:\n"),
N_("\
--ftps-implicit use implicit FTPS (default port is 990)\n"),
N_("\
--ftps-resume-ssl resume the SSL/TLS session started in the control connection when\n"
" opening a data connection\n"),
N_("\
--ftps-clear-data-connection cipher the control channel only; all the data will be in plaintext\n"),
N_("\
--ftps-fallback-to-ftp fall back to FTP if FTPS is not supported in the target server\n"),
#endif
N_("\
WARC options:\n"),
N_("\
--warc-file=FILENAME save request/response data to a .warc.gz file\n"),
N_("\
--warc-header=STRING insert STRING into the warcinfo record\n"),
N_("\
--warc-max-size=NUMBER set maximum size of WARC files to NUMBER\n"),
N_("\
--warc-cdx write CDX index files\n"),
N_("\
--warc-dedup=FILENAME do not store records listed in this CDX file\n"),
#ifdef HAVE_LIBZ
N_("\
--no-warc-compression do not compress WARC files with GZIP\n"),
#endif
N_("\
--no-warc-digests do not calculate SHA1 digests\n"),
N_("\
--no-warc-keep-log do not store the log file in a WARC record\n"),
N_("\
--warc-tempdir=DIRECTORY location for temporary files created by the\n\
WARC writer\n"),
"\n",
N_("\
Recursive download:\n"),
N_("\
-r, --recursive specify recursive download\n"),
N_("\
-l, --level=NUMBER maximum recursion depth (inf or 0 for infinite)\n"),
N_("\
--delete-after delete files locally after downloading them\n"),
N_("\
-k, --convert-links make links in downloaded HTML or CSS point to\n\
local files\n"),
N_("\
--convert-file-only convert the file part of the URLs only (usually known as the basename)\n"),
N_("\
--backups=N before writing file X, rotate up to N backup files\n"),
#ifdef __VMS
N_("\
-K, --backup-converted before converting file X, back up as X_orig\n"),
#else /* def __VMS */
N_("\
-K, --backup-converted before converting file X, back up as X.orig\n"),
#endif /* def __VMS [else] */
N_("\
-m, --mirror shortcut for -N -r -l inf --no-remove-listing\n"),
N_("\
-p, --page-requisites get all images, etc. needed to display HTML page\n"),
N_("\
--strict-comments turn on strict (SGML) handling of HTML comments\n"),
"\n",
N_("\
Recursive accept/reject:\n"),
N_("\
-A, --accept=LIST comma-separated list of accepted extensions\n"),
N_("\
-R, --reject=LIST comma-separated list of rejected extensions\n"),
N_("\
--accept-regex=REGEX regex matching accepted URLs\n"),
N_("\
--reject-regex=REGEX regex matching rejected URLs\n"),
#if defined HAVE_LIBPCRE || defined HAVE_LIBPCRE2
N_("\
--regex-type=TYPE regex type (posix|pcre)\n"),
#else
N_("\
--regex-type=TYPE regex type (posix)\n"),
#endif
N_("\
-D, --domains=LIST comma-separated list of accepted domains\n"),
N_("\
--exclude-domains=LIST comma-separated list of rejected domains\n"),
N_("\
--follow-ftp follow FTP links from HTML documents\n"),
N_("\
--follow-tags=LIST comma-separated list of followed HTML tags\n"),
N_("\
--ignore-tags=LIST comma-separated list of ignored HTML tags\n"),
N_("\
-H, --span-hosts go to foreign hosts when recursive\n"),
N_("\
-L, --relative follow relative links only\n"),
N_("\
-I, --include-directories=LIST list of allowed directories\n"),
N_("\
--trust-server-names use the name specified by the redirection\n\
URL's last component\n"),
N_("\
-X, --exclude-directories=LIST list of excluded directories\n"),
N_("\
-np, --no-parent don't ascend to the parent directory\n"),
"\n",
N_("Email bug reports, questions, discussions to <bug-wget@gnu.org>\n"),
N_("and/or open issues at https://savannah.gnu.org/bugs/?func=additem&group=wget.\n")
};
size_t i;
if (printf (_("GNU Wget %s, a non-interactive network retriever.\n"),
version_string) < 0)
exit (WGET_EXIT_IO_FAIL);
if (print_usage (0) < 0)
exit (WGET_EXIT_IO_FAIL);
for (i = 0; i < countof (help); i++)
if (fputs (_(help[i]), stdout) < 0)
exit (WGET_EXIT_IO_FAIL);
#endif /* TESTING */
exit (WGET_EXIT_SUCCESS);
}
| 1
|
457,895
|
static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode,
int sync, void *key)
{
struct io_kiocb *req = wait->private;
struct io_poll_iocb *poll = io_poll_get_single(req);
__poll_t mask = key_to_poll(key);
/* for instances that support it check for an event match first: */
if (mask && !(mask & poll->events))
return 0;
list_del_init(&wait->entry);
if (poll && poll->head) {
bool done;
spin_lock(&poll->head->lock);
done = list_empty(&poll->wait.entry);
if (!done)
list_del_init(&poll->wait.entry);
/* make sure double remove sees this as being gone */
wait->private = NULL;
spin_unlock(&poll->head->lock);
if (!done)
__io_async_wake(req, poll, mask, io_poll_task_func);
}
refcount_dec(&req->refs);
return 1;
}
| 0
|
74,645
|
R_API int extract_type_value(const char *arg_str, char **output) {
ut8 found_one = 0, array_cnt = 0;
ut32 len = 0, consumed = 0;
char *str = NULL;
if (!arg_str || !output) {
return 0;
}
if (output && *output && *output != NULL) {
R_FREE (*output);
}
while (arg_str && *arg_str && !found_one) {
len = 1;
// handle the end of an object
switch (*arg_str) {
case 'V':
str = get_type_value_str ("void", array_cnt);
break;
case 'J':
str = get_type_value_str ("long", array_cnt);
array_cnt = 0;
break;
case 'I':
str = get_type_value_str ("int", array_cnt);
array_cnt = 0;
break;
case 'D':
str = get_type_value_str ("double", array_cnt);
array_cnt = 0;
break;
case 'F':
str = get_type_value_str ("float", array_cnt);
array_cnt = 0;
break;
case 'B':
str = get_type_value_str ("byte", array_cnt);
array_cnt = 0;
break;
case 'C':
str = get_type_value_str ("char", array_cnt);
array_cnt = 0;
break;
case 'Z':
str = get_type_value_str ("boolean", array_cnt);
array_cnt = 0;
break;
case 'S':
str = get_type_value_str ("short", array_cnt);
array_cnt = 0;
break;
case '[':
array_cnt++;
break;
case 'L':
len = r_bin_java_extract_reference_name (arg_str, &str, array_cnt);
array_cnt = 0;
break;
case '(':
str = strdup ("(");
break;
case ')':
str = strdup (")");
break;
default:
return 0;
}
if (len < 1) {
break;
}
consumed += len;
arg_str += len;
if (str) {
*output = str;
break;
}
}
return consumed;
}
| 0
|
490,937
|
void ThreadCommand::count(uint32_t count) {
count_ = count;
}
| 0
|
302,237
|
void kfree_skb(struct sk_buff *skb)
{
if (unlikely(!skb))
return;
if (likely(atomic_read(&skb->users) == 1))
smp_rmb();
else if (likely(!atomic_dec_and_test(&skb->users)))
return;
trace_kfree_skb(skb, __builtin_return_address(0));
__kfree_skb(skb);
}
| 0
|
277,881
|
void InputImeEventRouterFactory::RemoveProfile(Profile* profile) {
if (!profile || router_map_.empty())
return;
auto it = router_map_.find(profile);
if (it != router_map_.end() && it->first == profile) {
delete it->second;
router_map_.erase(it);
}
}
| 0
|
246,666
|
bool RenderLayerCompositor::isMainFrame() const
{
return !m_renderView->document().ownerElement();
}
| 0
|
513,164
|
void Gfx::opSave(Object args[], int numArgs) {
saveState();
}
| 0
|
87,710
|
send_lock_cancel(const unsigned int xid, struct cifs_tcon *tcon,
struct smb_hdr *in_buf,
struct smb_hdr *out_buf)
{
int bytes_returned;
struct cifs_ses *ses = tcon->ses;
LOCK_REQ *pSMB = (LOCK_REQ *)in_buf;
/* We just modify the current in_buf to change
the type of lock from LOCKING_ANDX_SHARED_LOCK
or LOCKING_ANDX_EXCLUSIVE_LOCK to
LOCKING_ANDX_CANCEL_LOCK. */
pSMB->LockType = LOCKING_ANDX_CANCEL_LOCK|LOCKING_ANDX_LARGE_FILES;
pSMB->Timeout = 0;
pSMB->hdr.Mid = get_next_mid(ses->server);
return SendReceive(xid, ses, in_buf, out_buf,
&bytes_returned, 0);
}
| 0
|
284,768
|
bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
if (!renderer_initialized())
return false;
if (owner_delegate_ && owner_delegate_->OnMessageReceived(msg))
return true;
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostImpl, msg)
IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone)
IPC_MESSAGE_HANDLER(FrameHostMsg_HittestData, OnHittestData)
IPC_MESSAGE_HANDLER(InputHostMsg_QueueSyntheticGesture,
OnQueueSyntheticGesture)
IPC_MESSAGE_HANDLER(InputHostMsg_ImeCancelComposition,
OnImeCancelComposition)
IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK,
OnUpdateScreenRectsAck)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText)
IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame,
OnSwapCompositorFrame(msg))
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
OnTextInputStateChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup,
OnShowDisambiguationPopup)
IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnSelectionChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionBoundsChanged,
OnSelectionBoundsChanged)
#if defined(OS_WIN)
IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowCreated,
OnWindowlessPluginDummyWindowCreated)
IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowDestroyed,
OnWindowlessPluginDummyWindowDestroyed)
#endif
IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
OnImeCompositionRangeChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad,
OnFirstPaintAfterLoad)
IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardCompositorProto,
OnForwardCompositorProto)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
if (!handled && input_router_ && input_router_->OnMessageReceived(msg))
return true;
if (!handled && view_ && view_->OnMessageReceived(msg))
return true;
return handled;
}
| 0
|
506,114
|
BIGNUM *bn_expand2(BIGNUM *b, int words)
{
bn_check_top(b);
if (words > b->dmax)
{
BN_ULONG *a = bn_expand_internal(b, words);
if(!a) return NULL;
if(b->d) OPENSSL_free(b->d);
b->d=a;
b->dmax=words;
}
/* None of this should be necessary because of what b->top means! */
#if 0
/* NB: bn_wexpand() calls this only if the BIGNUM really has to grow */
if (b->top < b->dmax)
{
int i;
BN_ULONG *A = &(b->d[b->top]);
for (i=(b->dmax - b->top)>>3; i>0; i--,A+=8)
{
A[0]=0; A[1]=0; A[2]=0; A[3]=0;
A[4]=0; A[5]=0; A[6]=0; A[7]=0;
}
for (i=(b->dmax - b->top)&7; i>0; i--,A++)
A[0]=0;
assert(A == &(b->d[b->dmax]));
}
#endif
bn_check_top(b);
return b;
}
| 0
|
1,758
|
static int flic_decode_frame_15_16BPP ( AVCodecContext * avctx , void * data , int * got_frame , const uint8_t * buf , int buf_size ) {
FlicDecodeContext * s = avctx -> priv_data ;
GetByteContext g2 ;
int pixel_ptr ;
unsigned char palette_idx1 ;
unsigned int frame_size ;
int num_chunks ;
unsigned int chunk_size ;
int chunk_type ;
int i , j , ret ;
int lines ;
int compressed_lines ;
signed short line_packets ;
int y_ptr ;
int byte_run ;
int pixel_skip ;
int pixel_countdown ;
unsigned char * pixels ;
int pixel ;
unsigned int pixel_limit ;
bytestream2_init ( & g2 , buf , buf_size ) ;
s -> frame . reference = 1 ;
s -> frame . buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE ;
if ( ( ret = avctx -> reget_buffer ( avctx , & s -> frame ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
pixels = s -> frame . data [ 0 ] ;
pixel_limit = s -> avctx -> height * s -> frame . linesize [ 0 ] ;
frame_size = bytestream2_get_le32 ( & g2 ) ;
bytestream2_skip ( & g2 , 2 ) ;
num_chunks = bytestream2_get_le16 ( & g2 ) ;
bytestream2_skip ( & g2 , 8 ) ;
frame_size -= 16 ;
while ( ( frame_size > 0 ) && ( num_chunks > 0 ) ) {
chunk_size = bytestream2_get_le32 ( & g2 ) ;
chunk_type = bytestream2_get_le16 ( & g2 ) ;
switch ( chunk_type ) {
case FLI_256_COLOR : case FLI_COLOR : av_dlog ( avctx , "Unexpected Palette chunk %d in non-palettized FLC\n" , chunk_type ) ;
bytestream2_skip ( & g2 , chunk_size - 6 ) ;
break ;
case FLI_DELTA : case FLI_DTA_LC : y_ptr = 0 ;
compressed_lines = bytestream2_get_le16 ( & g2 ) ;
while ( compressed_lines > 0 ) {
line_packets = bytestream2_get_le16 ( & g2 ) ;
if ( line_packets < 0 ) {
line_packets = - line_packets ;
y_ptr += line_packets * s -> frame . linesize [ 0 ] ;
}
else {
compressed_lines -- ;
pixel_ptr = y_ptr ;
CHECK_PIXEL_PTR ( 0 ) ;
pixel_countdown = s -> avctx -> width ;
for ( i = 0 ;
i < line_packets ;
i ++ ) {
pixel_skip = bytestream2_get_byte ( & g2 ) ;
pixel_ptr += ( pixel_skip * 2 ) ;
pixel_countdown -= pixel_skip ;
byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
if ( byte_run < 0 ) {
byte_run = - byte_run ;
pixel = bytestream2_get_le16 ( & g2 ) ;
CHECK_PIXEL_PTR ( 2 * byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ , pixel_countdown -= 2 ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = pixel ;
pixel_ptr += 2 ;
}
}
else {
CHECK_PIXEL_PTR ( 2 * byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ , pixel_countdown -- ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = bytestream2_get_le16 ( & g2 ) ;
pixel_ptr += 2 ;
}
}
}
y_ptr += s -> frame . linesize [ 0 ] ;
}
}
break ;
case FLI_LC : av_log ( avctx , AV_LOG_ERROR , "Unexpected FLI_LC chunk in non-paletised FLC\n" ) ;
bytestream2_skip ( & g2 , chunk_size - 6 ) ;
break ;
case FLI_BLACK : memset ( pixels , 0x0000 , s -> frame . linesize [ 0 ] * s -> avctx -> height ) ;
break ;
case FLI_BRUN : y_ptr = 0 ;
for ( lines = 0 ;
lines < s -> avctx -> height ;
lines ++ ) {
pixel_ptr = y_ptr ;
bytestream2_skip ( & g2 , 1 ) ;
pixel_countdown = ( s -> avctx -> width * 2 ) ;
while ( pixel_countdown > 0 ) {
byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
if ( byte_run > 0 ) {
palette_idx1 = bytestream2_get_byte ( & g2 ) ;
CHECK_PIXEL_PTR ( byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ ) {
pixels [ pixel_ptr ++ ] = palette_idx1 ;
pixel_countdown -- ;
if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d) (linea%d)\n" , pixel_countdown , lines ) ;
}
}
else {
byte_run = - byte_run ;
CHECK_PIXEL_PTR ( byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ ) {
palette_idx1 = bytestream2_get_byte ( & g2 ) ;
pixels [ pixel_ptr ++ ] = palette_idx1 ;
pixel_countdown -- ;
if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d) at line %d\n" , pixel_countdown , lines ) ;
}
}
}
# if HAVE_BIGENDIAN pixel_ptr = y_ptr ;
pixel_countdown = s -> avctx -> width ;
while ( pixel_countdown > 0 ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = AV_RL16 ( & buf [ pixel_ptr ] ) ;
pixel_ptr += 2 ;
}
# endif y_ptr += s -> frame . linesize [ 0 ] ;
}
break ;
case FLI_DTA_BRUN : y_ptr = 0 ;
for ( lines = 0 ;
lines < s -> avctx -> height ;
lines ++ ) {
pixel_ptr = y_ptr ;
bytestream2_skip ( & g2 , 1 ) ;
pixel_countdown = s -> avctx -> width ;
while ( pixel_countdown > 0 ) {
byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
if ( byte_run > 0 ) {
pixel = bytestream2_get_le16 ( & g2 ) ;
CHECK_PIXEL_PTR ( 2 * byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = pixel ;
pixel_ptr += 2 ;
pixel_countdown -- ;
if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d)\n" , pixel_countdown ) ;
}
}
else {
byte_run = - byte_run ;
CHECK_PIXEL_PTR ( 2 * byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = bytestream2_get_le16 ( & g2 ) ;
pixel_ptr += 2 ;
pixel_countdown -- ;
if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d)\n" , pixel_countdown ) ;
}
}
}
y_ptr += s -> frame . linesize [ 0 ] ;
}
break ;
case FLI_COPY : case FLI_DTA_COPY : if ( chunk_size - 6 > ( unsigned int ) ( s -> avctx -> width * s -> avctx -> height ) * 2 ) {
av_log ( avctx , AV_LOG_ERROR , "In chunk FLI_COPY : source data (%d bytes) " \ "bigger than image, skipping chunk\n" , chunk_size - 6 ) ;
bytestream2_skip ( & g2 , chunk_size - 6 ) ;
}
else {
for ( y_ptr = 0 ;
y_ptr < s -> frame . linesize [ 0 ] * s -> avctx -> height ;
y_ptr += s -> frame . linesize [ 0 ] ) {
pixel_countdown = s -> avctx -> width ;
pixel_ptr = 0 ;
while ( pixel_countdown > 0 ) {
* ( ( signed short * ) ( & pixels [ y_ptr + pixel_ptr ] ) ) = bytestream2_get_le16 ( & g2 ) ;
pixel_ptr += 2 ;
pixel_countdown -- ;
}
}
}
break ;
case FLI_MINI : bytestream2_skip ( & g2 , chunk_size - 6 ) ;
break ;
default : av_log ( avctx , AV_LOG_ERROR , "Unrecognized chunk type: %d\n" , chunk_type ) ;
break ;
}
frame_size -= chunk_size ;
num_chunks -- ;
}
if ( ( bytestream2_get_bytes_left ( & g2 ) != 0 ) && ( bytestream2_get_bytes_left ( & g2 ) != 1 ) ) av_log ( avctx , AV_LOG_ERROR , "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n" , buf_size , bytestream2_tell ( & g2 ) ) ;
* got_frame = 1 ;
* ( AVFrame * ) data = s -> frame ;
return buf_size ;
}
| 1
|
289,124
|
void vp9_restore_layer_context ( VP9_COMP * const cpi ) {
LAYER_CONTEXT * const lc = get_layer_context ( cpi ) ;
const int old_frame_since_key = cpi -> rc . frames_since_key ;
const int old_frame_to_key = cpi -> rc . frames_to_key ;
cpi -> rc = lc -> rc ;
cpi -> twopass = lc -> twopass ;
cpi -> oxcf . target_bandwidth = lc -> target_bandwidth ;
cpi -> alt_ref_source = lc -> alt_ref_source ;
if ( cpi -> svc . number_temporal_layers > 1 ) {
cpi -> rc . frames_since_key = old_frame_since_key ;
cpi -> rc . frames_to_key = old_frame_to_key ;
}
}
| 0
|
277,856
|
PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
DCHECK(CanHaveTilingWithScale(contents_scale)) <<
"contents_scale: " << contents_scale;
PictureLayerTiling* tiling =
tilings_->AddTiling(contents_scale, raster_source_->GetSize());
DCHECK(raster_source_->HasRecordings());
return tiling;
}
| 0
|
103,220
|
static void ca8210_dev_com_clear(struct ca8210_priv *priv)
{
flush_workqueue(priv->mlme_workqueue);
destroy_workqueue(priv->mlme_workqueue);
flush_workqueue(priv->irq_workqueue);
destroy_workqueue(priv->irq_workqueue);
}
| 0
|
129,318
|
cherokee_validator_ldap_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props)
{
ret_t ret;
cherokee_list_t *i;
cherokee_validator_ldap_props_t *props;
UNUSED(srv);
if (*_props == NULL) {
CHEROKEE_NEW_STRUCT (n, validator_ldap_props);
cherokee_validator_props_init_base (VALIDATOR_PROPS(n), MODULE_PROPS_FREE(props_free));
n->port = LDAP_DEFAULT_PORT;
n->tls = false;
cherokee_buffer_init (&n->server);
cherokee_buffer_init (&n->binddn);
cherokee_buffer_init (&n->bindpw);
cherokee_buffer_init (&n->basedn);
cherokee_buffer_init (&n->filter);
cherokee_buffer_init (&n->ca_file);
*_props = MODULE_PROPS(n);
}
props = PROP_LDAP(*_props);
cherokee_config_node_foreach (i, conf) {
cherokee_config_node_t *subconf = CONFIG_NODE(i);
if (equal_buf_str (&subconf->key, "server")) {
cherokee_buffer_add_buffer (&props->server, &subconf->val);
} else if (equal_buf_str (&subconf->key, "port")) {
ret = cherokee_atoi (subconf->val.buf, &props->port);
if (ret != ret_ok) return ret_error;
} else if (equal_buf_str (&subconf->key, "bind_dn")) {
cherokee_buffer_add_buffer (&props->binddn, &subconf->val);
} else if (equal_buf_str (&subconf->key, "bind_pw")) {
cherokee_buffer_add_buffer (&props->bindpw, &subconf->val);
} else if (equal_buf_str (&subconf->key, "base_dn")) {
cherokee_buffer_add_buffer (&props->basedn, &subconf->val);
} else if (equal_buf_str (&subconf->key, "filter")) {
cherokee_buffer_add_buffer (&props->filter, &subconf->val);
} else if (equal_buf_str (&subconf->key, "tls")) {
ret = cherokee_atob (subconf->val.buf, &props->tls);
if (ret != ret_ok) return ret_error;
} else if (equal_buf_str (&subconf->key, "ca_file")) {
cherokee_buffer_add_buffer (&props->ca_file, &subconf->val);
} else if (equal_buf_str (&subconf->key, "methods") ||
equal_buf_str (&subconf->key, "realm") ||
equal_buf_str (&subconf->key, "users")) {
/* Handled in validator.c
*/
} else {
LOG_WARNING (CHEROKEE_ERROR_VALIDATOR_LDAP_KEY, subconf->key.buf);
}
}
/* Checks
*/
if (cherokee_buffer_is_empty (&props->basedn)) {
LOG_ERROR (CHEROKEE_ERROR_VALIDATOR_LDAP_PROPERTY, "base_dn");
return ret_error;
}
if (cherokee_buffer_is_empty (&props->server)) {
LOG_ERROR (CHEROKEE_ERROR_VALIDATOR_LDAP_PROPERTY, "server");
return ret_error;
}
if ((cherokee_buffer_is_empty (&props->bindpw) &&
(! cherokee_buffer_is_empty (&props->basedn))))
{
LOG_ERROR_S (CHEROKEE_ERROR_VALIDATOR_LDAP_SECURITY);
return ret_error;
}
return ret_ok;
}
| 0
|
425,701
|
void *idr_replace(struct idr *idp, void *ptr, int id)
{
int n;
struct idr_layer *p, *old_p;
p = idp->top;
if (!p)
return ERR_PTR(-EINVAL);
n = (p->layer+1) * IDR_BITS;
id &= MAX_ID_MASK;
if (id >= (1 << n))
return ERR_PTR(-EINVAL);
n -= IDR_BITS;
while ((n > 0) && p) {
p = p->ary[(id >> n) & IDR_MASK];
n -= IDR_BITS;
}
n = id & IDR_MASK;
if (unlikely(p == NULL || !test_bit(n, &p->bitmap)))
return ERR_PTR(-ENOENT);
old_p = p->ary[n];
rcu_assign_pointer(p->ary[n], ptr);
return old_p;
}
| 0
|
324,129
|
void rgb8tobgr8(const uint8_t *src, uint8_t *dst, long src_size)
{
long i;
long num_pixels = src_size;
for(i=0; i<num_pixels; i++)
{
unsigned b,g,r;
register uint8_t rgb;
rgb = src[i];
r = (rgb&0x07);
g = (rgb&0x38)>>3;
b = (rgb&0xC0)>>6;
dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6);
}
}
| 1
|
491,108
|
xfs_ioc_getlabel(
struct xfs_mount *mp,
char __user *user_label)
{
struct xfs_sb *sbp = &mp->m_sb;
char label[XFSLABEL_MAX + 1];
/* Paranoia */
BUILD_BUG_ON(sizeof(sbp->sb_fname) > FSLABEL_MAX);
/* 1 larger than sb_fname, so this ensures a trailing NUL char */
memset(label, 0, sizeof(label));
spin_lock(&mp->m_sb_lock);
strncpy(label, sbp->sb_fname, XFSLABEL_MAX);
spin_unlock(&mp->m_sb_lock);
if (copy_to_user(user_label, label, sizeof(label)))
return -EFAULT;
return 0;
}
| 0
|
64,125
|
small_smb2_init(__le16 smb2_command, struct cifs_tcon *tcon,
void **request_buf)
{
int rc;
unsigned int total_len;
struct smb2_pdu *pdu;
rc = smb2_reconnect(smb2_command, tcon);
if (rc)
return rc;
/* BB eventually switch this to SMB2 specific small buf size */
*request_buf = cifs_small_buf_get();
if (*request_buf == NULL) {
/* BB should we add a retry in here if not a writepage? */
return -ENOMEM;
}
pdu = (struct smb2_pdu *)(*request_buf);
fill_small_buf(smb2_command, tcon, get_sync_hdr(pdu), &total_len);
/* Note this is only network field converted to big endian */
pdu->hdr.smb2_buf_length = cpu_to_be32(total_len);
if (tcon != NULL) {
#ifdef CONFIG_CIFS_STATS2
uint16_t com_code = le16_to_cpu(smb2_command);
cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]);
#endif
cifs_stats_inc(&tcon->num_smbs_sent);
}
return rc;
}
| 0
|
417,822
|
Init_pack(void)
{
rb_define_method(rb_cArray, "pack", pack_pack, -1);
rb_define_method(rb_cString, "unpack", pack_unpack, 1);
rb_define_method(rb_cString, "unpack1", pack_unpack1, 1);
id_associated = rb_make_internal_id();
}
| 0
|
283,185
|
unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf,
unsigned char *limit)
{
int extdatalen = 0;
unsigned char *orig = buf;
unsigned char *ret = buf;
# ifndef OPENSSL_NO_NEXTPROTONEG
int next_proto_neg_seen;
# endif
/*
* don't add extensions for SSLv3, unless doing secure renegotiation
*/
if (s->version == SSL3_VERSION && !s->s3->send_connection_binding)
return orig;
ret += 2;
if (ret >= limit)
return NULL; /* this really never occurs, but ... */
if (!s->hit && s->servername_done == 1
&& s->session->tlsext_hostname != NULL) {
if ((long)(limit - ret - 4) < 0)
return NULL;
s2n(TLSEXT_TYPE_server_name, ret);
s2n(0, ret);
}
if (s->s3->send_connection_binding) {
int el;
if (!ssl_add_serverhello_renegotiate_ext(s, 0, &el, 0)) {
SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return NULL;
}
if ((limit - ret - 4 - el) < 0)
return NULL;
s2n(TLSEXT_TYPE_renegotiate, ret);
s2n(el, ret);
if (!ssl_add_serverhello_renegotiate_ext(s, ret, &el, el)) {
SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return NULL;
}
ret += el;
}
# ifndef OPENSSL_NO_EC
if (s->tlsext_ecpointformatlist != NULL) {
/*
* Add TLS extension ECPointFormats to the ServerHello message
*/
long lenmax;
if ((lenmax = limit - ret - 5) < 0)
return NULL;
if (s->tlsext_ecpointformatlist_length > (unsigned long)lenmax)
return NULL;
if (s->tlsext_ecpointformatlist_length > 255) {
SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return NULL;
}
s2n(TLSEXT_TYPE_ec_point_formats, ret);
s2n(s->tlsext_ecpointformatlist_length + 1, ret);
*(ret++) = (unsigned char)s->tlsext_ecpointformatlist_length;
memcpy(ret, s->tlsext_ecpointformatlist,
s->tlsext_ecpointformatlist_length);
ret += s->tlsext_ecpointformatlist_length;
}
/*
* Currently the server should not respond with a SupportedCurves
* extension
*/
# endif /* OPENSSL_NO_EC */
if (s->tlsext_ticket_expected && !(SSL_get_options(s) & SSL_OP_NO_TICKET)) {
if ((long)(limit - ret - 4) < 0)
return NULL;
s2n(TLSEXT_TYPE_session_ticket, ret);
s2n(0, ret);
}
if (s->tlsext_status_expected) {
if ((long)(limit - ret - 4) < 0)
return NULL;
s2n(TLSEXT_TYPE_status_request, ret);
s2n(0, ret);
}
# ifdef TLSEXT_TYPE_opaque_prf_input
if (s->s3->server_opaque_prf_input != NULL && s->version != DTLS1_VERSION) {
size_t sol = s->s3->server_opaque_prf_input_len;
if ((long)(limit - ret - 6 - sol) < 0)
return NULL;
if (sol > 0xFFFD) /* can't happen */
return NULL;
s2n(TLSEXT_TYPE_opaque_prf_input, ret);
s2n(sol + 2, ret);
s2n(sol, ret);
memcpy(ret, s->s3->server_opaque_prf_input, sol);
ret += sol;
}
# endif
# ifndef OPENSSL_NO_SRTP
if (SSL_IS_DTLS(s) && s->srtp_profile) {
int el;
ssl_add_serverhello_use_srtp_ext(s, 0, &el, 0);
if ((limit - ret - 4 - el) < 0)
return NULL;
s2n(TLSEXT_TYPE_use_srtp, ret);
s2n(el, ret);
if (ssl_add_serverhello_use_srtp_ext(s, ret, &el, el)) {
SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return NULL;
}
ret += el;
}
# endif
if (((s->s3->tmp.new_cipher->id & 0xFFFF) == 0x80
|| (s->s3->tmp.new_cipher->id & 0xFFFF) == 0x81)
&& (SSL_get_options(s) & SSL_OP_CRYPTOPRO_TLSEXT_BUG)) {
const unsigned char cryptopro_ext[36] = {
0xfd, 0xe8, /* 65000 */
0x00, 0x20, /* 32 bytes length */
0x30, 0x1e, 0x30, 0x08, 0x06, 0x06, 0x2a, 0x85,
0x03, 0x02, 0x02, 0x09, 0x30, 0x08, 0x06, 0x06,
0x2a, 0x85, 0x03, 0x02, 0x02, 0x16, 0x30, 0x08,
0x06, 0x06, 0x2a, 0x85, 0x03, 0x02, 0x02, 0x17
};
if (limit - ret < 36)
return NULL;
memcpy(ret, cryptopro_ext, 36);
ret += 36;
}
# ifndef OPENSSL_NO_HEARTBEATS
/* Add Heartbeat extension if we've received one */
if (s->tlsext_heartbeat & SSL_TLSEXT_HB_ENABLED) {
if ((limit - ret - 4 - 1) < 0)
return NULL;
s2n(TLSEXT_TYPE_heartbeat, ret);
s2n(1, ret);
/*-
* Set mode:
* 1: peer may send requests
* 2: peer not allowed to send requests
*/
if (s->tlsext_heartbeat & SSL_TLSEXT_HB_DONT_RECV_REQUESTS)
*(ret++) = SSL_TLSEXT_HB_DONT_SEND_REQUESTS;
else
*(ret++) = SSL_TLSEXT_HB_ENABLED;
}
# endif
# ifndef OPENSSL_NO_NEXTPROTONEG
next_proto_neg_seen = s->s3->next_proto_neg_seen;
s->s3->next_proto_neg_seen = 0;
if (next_proto_neg_seen && s->ctx->next_protos_advertised_cb) {
const unsigned char *npa;
unsigned int npalen;
int r;
r = s->ctx->next_protos_advertised_cb(s, &npa, &npalen,
s->
ctx->next_protos_advertised_cb_arg);
if (r == SSL_TLSEXT_ERR_OK) {
if ((long)(limit - ret - 4 - npalen) < 0)
return NULL;
s2n(TLSEXT_TYPE_next_proto_neg, ret);
s2n(npalen, ret);
memcpy(ret, npa, npalen);
ret += npalen;
s->s3->next_proto_neg_seen = 1;
}
}
# endif
if ((extdatalen = ret - orig - 2) == 0)
return orig;
s2n(extdatalen, orig);
return ret;
}
| 0
|
519,545
|
virtual ulonglong get_max_int_value() const
{
return unsigned_flag ? 0xFFULL : 0x7FULL;
}
| 0
|
252,478
|
int DownloadManagerImpl::NonMaliciousInProgressCount() const {
int count = 0;
for (const auto& it : downloads_) {
if (it.second->GetState() == download::DownloadItem::IN_PROGRESS &&
it.second->GetDangerType() !=
download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL &&
it.second->GetDangerType() !=
download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT &&
it.second->GetDangerType() !=
download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST &&
it.second->GetDangerType() !=
download::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED) {
++count;
}
}
return count;
}
| 0
|
201,642
|
status_t BnHDCP::onTransact(
uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
switch (code) {
case HDCP_SET_OBSERVER:
{
CHECK_INTERFACE(IHDCP, data, reply);
sp<IHDCPObserver> observer =
interface_cast<IHDCPObserver>(data.readStrongBinder());
reply->writeInt32(setObserver(observer));
return OK;
}
case HDCP_INIT_ASYNC:
{
CHECK_INTERFACE(IHDCP, data, reply);
const char *host = data.readCString();
unsigned port = data.readInt32();
reply->writeInt32(initAsync(host, port));
return OK;
}
case HDCP_SHUTDOWN_ASYNC:
{
CHECK_INTERFACE(IHDCP, data, reply);
reply->writeInt32(shutdownAsync());
return OK;
}
case HDCP_GET_CAPS:
{
CHECK_INTERFACE(IHDCP, data, reply);
reply->writeInt32(getCaps());
return OK;
}
case HDCP_ENCRYPT:
{
size_t size = data.readInt32();
// watch out for overflow
if (size <= SIZE_MAX / 2) {
inData = malloc(2 * size);
}
if (inData == NULL) {
reply->writeInt32(ERROR_OUT_OF_RANGE);
return OK;
}
void *outData = (uint8_t *)inData + size;
status_t err = data.read(inData, size);
if (err != OK) {
free(inData);
reply->writeInt32(err);
return OK;
}
uint32_t streamCTR = data.readInt32();
uint64_t inputCTR;
err = encrypt(inData, size, streamCTR, &inputCTR, outData);
reply->writeInt32(err);
if (err == OK) {
reply->writeInt64(inputCTR);
reply->write(outData, size);
}
free(inData);
inData = outData = NULL;
return OK;
}
case HDCP_ENCRYPT_NATIVE:
{
CHECK_INTERFACE(IHDCP, data, reply);
sp<GraphicBuffer> graphicBuffer = new GraphicBuffer();
data.read(*graphicBuffer);
size_t offset = data.readInt32();
size_t size = data.readInt32();
uint32_t streamCTR = data.readInt32();
void *outData = malloc(size);
uint64_t inputCTR;
status_t err = encryptNative(graphicBuffer, offset, size,
streamCTR, &inputCTR, outData);
reply->writeInt32(err);
if (err == OK) {
reply->writeInt64(inputCTR);
reply->write(outData, size);
}
free(outData);
outData = NULL;
return OK;
}
case HDCP_DECRYPT:
{
size_t size = data.readInt32();
size_t bufSize = 2 * size;
void *inData = NULL;
if (bufSize > size) {
inData = malloc(bufSize);
}
if (inData == NULL) {
reply->writeInt32(ERROR_OUT_OF_RANGE);
return OK;
}
void *outData = (uint8_t *)inData + size;
data.read(inData, size);
uint32_t streamCTR = data.readInt32();
uint64_t inputCTR = data.readInt64();
status_t err = decrypt(inData, size, streamCTR, inputCTR, outData);
reply->writeInt32(err);
if (err == OK) {
reply->write(outData, size);
}
free(inData);
inData = outData = NULL;
return OK;
}
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
| 0
|
31,068
|
static int add_one_ref ( const char * path , const struct object_id * oid , int flag , void * cb_data ) {
struct rev_info * revs = ( struct rev_info * ) cb_data ;
struct object * object ;
if ( ( flag & REF_ISSYMREF ) && ( flag & REF_ISBROKEN ) ) {
warning ( "symbolic ref is dangling: %s" , path ) ;
return 0 ;
}
object = parse_object_or_die ( oid -> hash , path ) ;
add_pending_object ( revs , object , "" ) ;
return 0 ;
}
| 0
|
224,226
|
void Tab::SetClosing(bool closing) {
closing_ = closing;
ActiveStateChanged();
if (closing) {
focus_ring_.reset();
}
}
| 0
|
284,644
|
ProcUnmapSubwindows(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq);
rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
if (rc != Success)
return rc;
UnmapSubwindows(pWin);
return Success;
}
| 0
|
505,484
|
int tls1_mac(SSL *ssl, unsigned char *md, int send)
{
SSL3_RECORD *rec;
unsigned char *mac_sec,*seq;
const EVP_MD *hash;
size_t md_size;
int i;
HMAC_CTX hmac;
unsigned char header[13];
if (send)
{
rec= &(ssl->s3->wrec);
mac_sec= &(ssl->s3->write_mac_secret[0]);
seq= &(ssl->s3->write_sequence[0]);
hash=ssl->write_hash;
}
else
{
rec= &(ssl->s3->rrec);
mac_sec= &(ssl->s3->read_mac_secret[0]);
seq= &(ssl->s3->read_sequence[0]);
hash=ssl->read_hash;
}
md_size=EVP_MD_size(hash);
/* I should fix this up TLS TLS TLS TLS TLS XXXXXXXX */
HMAC_CTX_init(&hmac);
HMAC_Init_ex(&hmac,mac_sec,EVP_MD_size(hash),hash,NULL);
if (ssl->version == DTLS1_BAD_VER ||
(ssl->version == DTLS1_VERSION && ssl->client_version != DTLS1_BAD_VER))
{
unsigned char dtlsseq[8],*p=dtlsseq;
s2n(send?ssl->d1->w_epoch:ssl->d1->r_epoch, p);
memcpy (p,&seq[2],6);
memcpy(header, dtlsseq, 8);
}
else
memcpy(header, seq, 8);
header[8]=rec->type;
header[9]=(unsigned char)(ssl->version>>8);
header[10]=(unsigned char)(ssl->version);
header[11]=(rec->length)>>8;
header[12]=(rec->length)&0xff;
if (!send &&
EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
ssl3_cbc_record_digest_supported(hash))
{
/* This is a CBC-encrypted record. We must avoid leaking any
* timing-side channel information about how many blocks of
* data we are hashing because that gives an attacker a
* timing-oracle. */
ssl3_cbc_digest_record(
hash,
md, &md_size,
header, rec->input,
rec->length + md_size, rec->orig_len,
ssl->s3->read_mac_secret,
EVP_MD_size(ssl->read_hash),
0 /* not SSLv3 */);
}
else
{
unsigned mds;
HMAC_Update(&hmac,header,sizeof(header));
HMAC_Update(&hmac,rec->input,rec->length);
HMAC_Final(&hmac,md,&mds);
md_size = mds;
#ifdef OPENSSL_FIPS
if (!send && FIPS_mode())
tls_fips_digest_extra(
ssl->enc_read_ctx,
hash,
&hmac, rec->input,
rec->length, rec->orig_len);
#endif
}
HMAC_CTX_cleanup(&hmac);
#ifdef TLS_DEBUG
printf("sec=");
{unsigned int z; for (z=0; z<md_size; z++) printf("%02X ",mac_sec[z]); printf("\n"); }
printf("seq=");
{int z; for (z=0; z<8; z++) printf("%02X ",seq[z]); printf("\n"); }
printf("buf=");
{int z; for (z=0; z<5; z++) printf("%02X ",buf[z]); printf("\n"); }
printf("rec=");
{unsigned int z; for (z=0; z<rec->length; z++) printf("%02X ",buf[z]); printf("\n"); }
#endif
if ( SSL_version(ssl) != DTLS1_VERSION && SSL_version(ssl) != DTLS1_BAD_VER)
{
for (i=7; i>=0; i--)
{
++seq[i];
if (seq[i] != 0) break;
}
}
#ifdef TLS_DEBUG
{unsigned int z; for (z=0; z<md_size; z++) printf("%02X ",md[z]); printf("\n"); }
#endif
return(md_size);
}
| 0
|
275,384
|
HarfBuzzShaper::HarfBuzzRun::~HarfBuzzRun()
{
}
| 0
|
58,906
|
wiki_handle_http_request(HttpRequest *req)
{
HttpResponse *res = http_response_new(req);
char *page = http_request_get_path_info(req);
char *command = http_request_get_query_string(req);
char *wikitext = "";
util_dehttpize(page); /* remove any encoding on the requested
page name. */
if (!strcmp(page, "/"))
{
if (access("WikiHome", R_OK) != 0)
wiki_redirect(res, "/WikiHome?create");
page = "/WikiHome";
}
if (!strcmp(page, "/styles.css"))
{
/* Return CSS page */
http_response_set_content_type(res, "text/css");
http_response_printf(res, "%s", CssData);
http_response_send(res);
exit(0);
}
if (!strcmp(page, "/favicon.ico"))
{
/* Return favicon */
http_response_set_content_type(res, "image/ico");
http_response_set_data(res, FaviconData, FaviconDataLen);
http_response_send(res);
exit(0);
}
page = page + 1; /* skip slash */
if (!strncmp(page, "api/", 4))
{
char *p;
page += 4;
for (p=page; *p != '\0'; p++)
if (*p=='?') { *p ='\0'; break; }
wiki_handle_rest_call(req, res, page);
exit(0);
}
/* A little safety. issue a malformed request for any paths,
* There shouldn't need to be any..
*/
if (!page_name_is_good(page))
{
http_response_set_status(res, 404, "Not Found");
http_response_printf(res, "<html><body>404 Not Found</body></html>\n");
http_response_send(res);
exit(0);
}
if (!strcmp(page, "Changes"))
{
wiki_show_changes_page(res);
}
else if (!strcmp(page, "ChangesRss"))
{
wiki_show_changes_page_rss(res);
}
else if (!strcmp(page, "Search"))
{
wiki_show_search_results_page(res, http_request_param_get(req, "expr"));
}
else if (!strcmp(page, "Create"))
{
if ( (wikitext = http_request_param_get(req, "title")) != NULL)
{
/* create page and redirect */
wiki_redirect(res, http_request_param_get(req, "title"));
}
else
{
/* show create page form */
wiki_show_create_page(res);
}
}
else
{
/* TODO: dont blindly write wikitext data to disk */
if ( (wikitext = http_request_param_get(req, "wikitext")) != NULL)
{
file_write(page, wikitext);
}
if (access(page, R_OK) == 0) /* page exists */
{
wikitext = file_read(page);
if (!strcmp(command, "edit"))
{
/* print edit page */
wiki_show_edit_page(res, wikitext, page);
}
else
{
wiki_show_page(res, wikitext, page);
}
}
else
{
if (!strcmp(command, "create"))
{
wiki_show_edit_page(res, NULL, page);
}
else
{
char buf[1024];
snprintf(buf, 1024, "%s?create", page);
wiki_redirect(res, buf);
}
}
}
}
| 0
|
16,636
|
static void hscroll ( AVCodecContext * avctx ) {
AnsiContext * s = avctx -> priv_data ;
int i ;
if ( s -> y < avctx -> height - s -> font_height ) {
s -> y += s -> font_height ;
return ;
}
i = 0 ;
for ( ;
i < avctx -> height - s -> font_height ;
i ++ ) memcpy ( s -> frame -> data [ 0 ] + i * s -> frame -> linesize [ 0 ] , s -> frame -> data [ 0 ] + ( i + s -> font_height ) * s -> frame -> linesize [ 0 ] , avctx -> width ) ;
for ( ;
i < avctx -> height ;
i ++ ) memset ( s -> frame -> data [ 0 ] + i * s -> frame -> linesize [ 0 ] , DEFAULT_BG_COLOR , avctx -> width ) ;
}
| 0
|
471,827
|
int zsetAdd(robj *zobj, double score, sds ele, int *flags, double *newscore) {
/* Turn options into simple to check vars. */
int incr = (*flags & ZADD_INCR) != 0;
int nx = (*flags & ZADD_NX) != 0;
int xx = (*flags & ZADD_XX) != 0;
*flags = 0; /* We'll return our response flags. */
double curscore;
/* NaN as input is an error regardless of all the other parameters. */
if (isnan(score)) {
*flags = ZADD_NAN;
return 0;
}
/* Update the sorted set according to its encoding. */
if (zobj->encoding == OBJ_ENCODING_ZIPLIST) {
unsigned char *eptr;
if ((eptr = zzlFind(zobj->ptr,ele,&curscore)) != NULL) {
/* NX? Return, same element already exists. */
if (nx) {
*flags |= ZADD_NOP;
return 1;
}
/* Prepare the score for the increment if needed. */
if (incr) {
score += curscore;
if (isnan(score)) {
*flags |= ZADD_NAN;
return 0;
}
if (newscore) *newscore = score;
}
/* Remove and re-insert when score changed. */
if (score != curscore) {
zobj->ptr = zzlDelete(zobj->ptr,eptr);
zobj->ptr = zzlInsert(zobj->ptr,ele,score);
*flags |= ZADD_UPDATED;
}
return 1;
} else if (!xx) {
/* check if the element is too large or the list
* becomes too long *before* executing zzlInsert. */
if (zzlLength(zobj->ptr)+1 > server.zset_max_ziplist_entries ||
sdslen(ele) > server.zset_max_ziplist_value ||
!ziplistSafeToAdd(zobj->ptr, sdslen(ele)))
{
zsetConvert(zobj,OBJ_ENCODING_SKIPLIST);
} else {
zobj->ptr = zzlInsert(zobj->ptr,ele,score);
if (newscore) *newscore = score;
*flags |= ZADD_ADDED;
return 1;
}
} else {
*flags |= ZADD_NOP;
return 1;
}
}
/* Note that the above block handling ziplist would have either returned or
* converted the key to skiplist. */
if (zobj->encoding == OBJ_ENCODING_SKIPLIST) {
zset *zs = zobj->ptr;
zskiplistNode *znode;
dictEntry *de;
de = dictFind(zs->dict,ele);
if (de != NULL) {
/* NX? Return, same element already exists. */
if (nx) {
*flags |= ZADD_NOP;
return 1;
}
curscore = *(double*)dictGetVal(de);
/* Prepare the score for the increment if needed. */
if (incr) {
score += curscore;
if (isnan(score)) {
*flags |= ZADD_NAN;
return 0;
}
if (newscore) *newscore = score;
}
/* Remove and re-insert when score changes. */
if (score != curscore) {
znode = zslUpdateScore(zs->zsl,curscore,ele,score);
/* Note that we did not removed the original element from
* the hash table representing the sorted set, so we just
* update the score. */
dictGetVal(de) = &znode->score; /* Update score ptr. */
*flags |= ZADD_UPDATED;
}
return 1;
} else if (!xx) {
ele = sdsdup(ele);
znode = zslInsert(zs->zsl,score,ele);
serverAssert(dictAdd(zs->dict,ele,&znode->score) == DICT_OK);
*flags |= ZADD_ADDED;
if (newscore) *newscore = score;
return 1;
} else {
*flags |= ZADD_NOP;
return 1;
}
} else {
serverPanic("Unknown sorted set encoding");
}
return 0; /* Never reached. */
}
| 0
|
156,888
|
__napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
{
struct sk_buff *p;
if (netpoll_rx_on(skb))
return GRO_NORMAL;
for (p = napi->gro_list; p; p = p->next) {
NAPI_GRO_CB(p)->same_flow =
(p->dev == skb->dev) &&
!compare_ether_header(skb_mac_header(p),
skb_gro_mac_header(skb));
NAPI_GRO_CB(p)->flush = 0;
}
return dev_gro_receive(napi, skb);
}
| 0
|
499,900
|
unsigned int rijndaelSetupEncrypt(u32 *rk, const u8 *key, size_t keybits)
{
int i = 0;
u32 temp;
rk[0] = GETU32(key );
rk[1] = GETU32(key + 4);
rk[2] = GETU32(key + 8);
rk[3] = GETU32(key + 12);
if (keybits == 128)
{
for (;;)
{
temp = rk[3];
rk[4] = rk[0] ^
(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
(Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
(Te4[(temp ) & 0xff] & 0x0000ff00) ^
(Te4[(temp >> 24) ] & 0x000000ff) ^
rcon[i];
rk[5] = rk[1] ^ rk[4];
rk[6] = rk[2] ^ rk[5];
rk[7] = rk[3] ^ rk[6];
if (++i == 10)
return 10;
rk += 4;
}
}
rk[4] = GETU32(key + 16);
rk[5] = GETU32(key + 20);
if (keybits == 192)
{
for (;;)
{
temp = rk[ 5];
rk[ 6] = rk[ 0] ^
(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
(Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
(Te4[(temp ) & 0xff] & 0x0000ff00) ^
(Te4[(temp >> 24) ] & 0x000000ff) ^
rcon[i];
rk[ 7] = rk[ 1] ^ rk[ 6];
rk[ 8] = rk[ 2] ^ rk[ 7];
rk[ 9] = rk[ 3] ^ rk[ 8];
if (++i == 8)
return 12;
rk[10] = rk[ 4] ^ rk[ 9];
rk[11] = rk[ 5] ^ rk[10];
rk += 6;
}
}
rk[6] = GETU32(key + 24);
rk[7] = GETU32(key + 28);
if (keybits == 256)
{
for (;;)
{
temp = rk[ 7];
rk[ 8] = rk[ 0] ^
(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
(Te4[(temp >> 8) & 0xff] & 0x00ff0000) ^
(Te4[(temp ) & 0xff] & 0x0000ff00) ^
(Te4[(temp >> 24) ] & 0x000000ff) ^
rcon[i];
rk[ 9] = rk[ 1] ^ rk[ 8];
rk[10] = rk[ 2] ^ rk[ 9];
rk[11] = rk[ 3] ^ rk[10];
if (++i == 7)
return 14;
temp = rk[11];
rk[12] = rk[ 4] ^
(Te4[(temp >> 24) ] & 0xff000000) ^
(Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
(Te4[(temp >> 8) & 0xff] & 0x0000ff00) ^
(Te4[(temp ) & 0xff] & 0x000000ff);
rk[13] = rk[ 5] ^ rk[12];
rk[14] = rk[ 6] ^ rk[13];
rk[15] = rk[ 7] ^ rk[14];
rk += 8;
}
}
return 0;
}
| 0
|
121,740
|
mrb_io_close_on_exec_p(mrb_state *mrb, mrb_value self)
{
#if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
struct mrb_io *fptr;
int ret;
fptr = io_get_open_fptr(mrb, self);
if (fptr->fd2 >= 0) {
if ((ret = fcntl(fptr->fd2, F_GETFD)) == -1) mrb_sys_fail(mrb, "F_GETFD failed");
if (!(ret & FD_CLOEXEC)) return mrb_false_value();
}
if ((ret = fcntl(fptr->fd, F_GETFD)) == -1) mrb_sys_fail(mrb, "F_GETFD failed");
if (!(ret & FD_CLOEXEC)) return mrb_false_value();
return mrb_true_value();
#else
mrb_raise(mrb, E_NOTIMP_ERROR, "IO#close_on_exec? is not supported on the platform");
return mrb_false_value();
#endif
}
| 0
|
400,965
|
static LEX_CSTRING event_to_str(unsigned int event_class,
unsigned long event_subclass)
{
int count;
for (count= 0; event_subclass; count++, event_subclass >>= 1);
return event_names[event_class][count - 1];
}
| 0
|
180,648
|
void ResourceMessageFilter::OnClipboardWriteObjectsSync(
const Clipboard::ObjectMap& objects,
base::SharedMemoryHandle bitmap_handle) {
DCHECK(base::SharedMemory::IsHandleValid(bitmap_handle))
<< "Bad bitmap handle";
Clipboard::ObjectMap* long_living_objects = new Clipboard::ObjectMap(objects);
Clipboard::ReplaceSharedMemHandle(long_living_objects, bitmap_handle,
handle());
ChromeThread::PostTask(
ChromeThread::UI,
FROM_HERE,
new WriteClipboardTask(long_living_objects));
}
| 0
|
112,141
|
static int SQLITE_NOINLINE handleMovedCursor(VdbeCursor *p){
int isDifferentRow, rc;
assert( p->eCurType==CURTYPE_BTREE );
assert( p->uc.pCursor!=0 );
assert( sqlite3BtreeCursorHasMoved(p->uc.pCursor) );
rc = sqlite3BtreeCursorRestore(p->uc.pCursor, &isDifferentRow);
p->cacheStatus = CACHE_STALE;
if( isDifferentRow ) p->nullRow = 1;
return rc;
}
| 0
|
430,371
|
ippGetStatusCode(ipp_t *ipp) /* I - IPP response or event message */
{
/*
* Range check input...
*/
if (!ipp)
return (IPP_STATUS_ERROR_INTERNAL);
/*
* Return the value...
*/
return (ipp->request.status.status_code);
}
| 0
|
2,817
|
Pl_Count::write(unsigned char* buf, size_t len)
{
if (len)
{
this->m->count += QIntC::to_offset(len);
getNext()->write(buf, len);
this->m->last_char = buf[len - 1];
}
}
| 1
|
4,736
|
static inline int xsave_state_booting(struct xsave_struct *fx, u64 mask)
{
u32 lmask = mask;
u32 hmask = mask >> 32;
int err = 0;
WARN_ON(system_state != SYSTEM_BOOTING);
if (boot_cpu_has(X86_FEATURE_XSAVES))
asm volatile("1:"XSAVES"\n\t"
"2:\n\t"
: : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
: "memory");
else
asm volatile("1:"XSAVE"\n\t"
"2:\n\t"
: : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
: "memory");
asm volatile(xstate_fault
: "0" (0)
: "memory");
return err;
}
| 1
|
483,309
|
struct cgroup *cgroup_get_from_path(const char *path)
{
struct kernfs_node *kn;
struct cgroup *cgrp = ERR_PTR(-ENOENT);
kn = kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path);
if (!kn)
goto out;
if (kernfs_type(kn) != KERNFS_DIR) {
cgrp = ERR_PTR(-ENOTDIR);
goto out_kernfs;
}
rcu_read_lock();
cgrp = rcu_dereference(*(void __rcu __force **)&kn->priv);
if (!cgrp || !cgroup_tryget(cgrp))
cgrp = ERR_PTR(-ENOENT);
rcu_read_unlock();
out_kernfs:
kernfs_put(kn);
out:
return cgrp;
}
| 0
|
322,437
|
void pci_bridge_exitfn(PCIDevice *pci_dev)
{
PCIBridge *s = DO_UPCAST(PCIBridge, dev, pci_dev);
assert(QLIST_EMPTY(&s->sec_bus.child));
QLIST_REMOVE(&s->sec_bus, sibling);
pci_bridge_region_cleanup(s);
memory_region_destroy(&s->address_space_mem);
memory_region_destroy(&s->address_space_io);
/* qbus_free() is called automatically by qdev_free() */
}
| 1
|
340,895
|
static int mov_text_decode_frame(AVCodecContext *avctx,
void *data, int *got_sub_ptr, AVPacket *avpkt)
{
AVSubtitle *sub = data;
int ret, ts_start, ts_end;
AVBPrint buf;
char *ptr = avpkt->data;
char *end;
//char *ptr_temp;
int text_length, tsmb_type, style_entries, tsmb_size;
int **style_start = {0,};
int **style_end = {0,};
int **style_flags = {0,};
const uint8_t *tsmb;
int index, i;
int *flag;
int *style_pos;
if (!ptr || avpkt->size < 2)
return AVERROR_INVALIDDATA;
/*
* A packet of size two with value zero is an empty subtitle
* used to mark the end of the previous non-empty subtitle.
* We can just drop them here as we have duration information
* already. If the value is non-zero, then it's technically a
* bad packet.
*/
if (avpkt->size == 2)
return AV_RB16(ptr) == 0 ? 0 : AVERROR_INVALIDDATA;
/*
* The first two bytes of the packet are the length of the text string
* In complex cases, there are style descriptors appended to the string
* so we can't just assume the packet size is the string size.
*/
text_length = AV_RB16(ptr);
end = ptr + FFMIN(2 + text_length, avpkt->size);
ptr += 2;
ts_start = av_rescale_q(avpkt->pts,
avctx->time_base,
(AVRational){1,100});
ts_end = av_rescale_q(avpkt->pts + avpkt->duration,
avctx->time_base,
(AVRational){1,100});
tsmb_size = 0;
// Note that the spec recommends lines be no longer than 2048 characters.
av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
if (text_length + 2 != avpkt->size) {
while (text_length + 2 + tsmb_size < avpkt->size) {
tsmb = ptr + text_length + tsmb_size;
tsmb_size = AV_RB32(tsmb);
tsmb += 4;
tsmb_type = AV_RB32(tsmb);
tsmb += 4;
if (tsmb_type == MKBETAG('s','t','y','l')) {
style_entries = AV_RB16(tsmb);
tsmb += 2;
for(i = 0; i < style_entries; i++) {
style_pos = av_malloc(4);
*style_pos = AV_RB16(tsmb);
index = i;
av_dynarray_add(&style_start, &index, style_pos);
tsmb += 2;
style_pos = av_malloc(4);
*style_pos = AV_RB16(tsmb);
index = i;
av_dynarray_add(&style_end, &index, style_pos);
tsmb += 2;
// fontID = AV_RB16(tsmb);
tsmb += 2;
flag = av_malloc(4);
*flag = AV_RB8(tsmb);
index = i;
av_dynarray_add(&style_flags, &index, flag);
//fontsize=AV_RB8(tsmb);
tsmb += 2;
// text-color-rgba
tsmb += 4;
}
text_to_ass(&buf, ptr, end, style_start, style_end, style_flags, style_entries);
av_freep(&style_start);
av_freep(&style_end);
av_freep(&style_flags);
}
}
} else
text_to_ass(&buf, ptr, end, NULL, NULL, 0, 0);
ret = ff_ass_add_rect_bprint(sub, &buf, ts_start, ts_end - ts_start);
av_bprint_finalize(&buf, NULL);
if (ret < 0)
return ret;
*got_sub_ptr = sub->num_rects > 0;
return avpkt->size;
}
| 1
|
157,254
|
PG::RecoveryCtx OSD::create_context()
{
ObjectStore::Transaction *t = new ObjectStore::Transaction;
C_Contexts *on_applied = new C_Contexts(cct);
C_Contexts *on_safe = new C_Contexts(cct);
map<int, map<spg_t,pg_query_t> > *query_map =
new map<int, map<spg_t, pg_query_t> >;
map<int,vector<pair<pg_notify_t, PastIntervals> > > *notify_list =
new map<int, vector<pair<pg_notify_t, PastIntervals> > >;
map<int,vector<pair<pg_notify_t, PastIntervals> > > *info_map =
new map<int,vector<pair<pg_notify_t, PastIntervals> > >;
PG::RecoveryCtx rctx(query_map, info_map, notify_list,
on_applied, on_safe, t);
return rctx;
}
| 0
|
273,849
|
static void icall_aulevel_handler(struct icall *icall, struct list *levell, void *arg)
{
struct wcall *wcall = arg;
struct calling_instance *inst = wcall ? wcall->inst : NULL;
char *json_str = NULL;
char *info_str = NULL;
uint64_t now;
int err = 0;
if (!WCALL_VALID(wcall)) {
warning("wcall(%p): icall_aulevel_handler wcall not valid\n",
wcall);
return;
}
info("icall_aulevel_handler(%p): %d levels\n", wcall, list_count(levell));
if (!inst->active_speakerh)
return;
err = audio_level_json(levell,
inst->userid, inst->clientid,
&json_str, &info_str);
if (err) {
warning("icall_aulevel_handler(%p): could not create json\n", wcall);
return;
}
info(APITAG "wcall(%p): calling active_speakerh:%p with: %s\n",
wcall, inst->clients_reqh, info_str);
now = tmr_jiffies();
inst->active_speakerh(inst2wuser(inst), wcall->convid, json_str, inst->arg);
info(APITAG "wcall(%p): active_speakerh took %llu ms\n",
wcall, tmr_jiffies() - now);
mem_deref(json_str);
mem_deref(info_str);
}
| 0
|
188,261
|
int bdrv_commit_all(void)
{
BlockDriverState *bs;
QTAILQ_FOREACH(bs, &bdrv_states, device_list) {
if (bs->drv && bs->backing_hd) {
int ret = bdrv_commit(bs);
if (ret < 0) {
return ret;
}
}
}
return 0;
}
| 0
|
96,470
|
static inline void ModulateHCLp(const double percent_hue,
const double percent_chroma,const double percent_luma,double *red,
double *green,double *blue)
{
double
hue,
luma,
chroma;
/*
Increase or decrease color luma, chroma, or hue.
*/
ConvertRGBToHCLp(*red,*green,*blue,&hue,&chroma,&luma);
hue+=fmod((percent_hue-100.0),200.0)/200.0;
chroma*=0.01*percent_chroma;
luma*=0.01*percent_luma;
ConvertHCLpToRGB(hue,chroma,luma,red,green,blue);
}
| 0
|
38,603
|
static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
int initial)
{
struct megasas_cmd *cmd;
struct megasas_dcmd_frame *dcmd;
struct MR_LD_VF_AFFILIATION *new_affiliation = NULL;
struct MR_LD_VF_MAP *newmap = NULL, *savedmap = NULL;
dma_addr_t new_affiliation_h;
int i, j, retval = 0, found = 0, doscan = 0;
u8 thisVf;
cmd = megasas_get_cmd(instance);
if (!cmd) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_vf_affiliation12: "
"Failed to get cmd for scsi%d\n",
instance->host->host_no);
return -ENOMEM;
}
dcmd = &cmd->frame->dcmd;
if (!instance->vf_affiliation) {
dev_warn(&instance->pdev->dev, "SR-IOV: Couldn't get LD/VF "
"affiliation for scsi%d\n", instance->host->host_no);
megasas_return_cmd(instance, cmd);
return -ENOMEM;
}
if (initial)
memset(instance->vf_affiliation, 0, (MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION));
else {
new_affiliation =
dma_zalloc_coherent(&instance->pdev->dev,
(MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION),
&new_affiliation_h, GFP_KERNEL);
if (!new_affiliation) {
dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
"memory for new affiliation for scsi%d\n",
instance->host->host_no);
megasas_return_cmd(instance, cmd);
return -ENOMEM;
}
}
memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
dcmd->cmd = MFI_CMD_DCMD;
dcmd->cmd_status = MFI_STAT_INVALID_STATUS;
dcmd->sge_count = 1;
dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_BOTH);
dcmd->timeout = 0;
dcmd->pad_0 = 0;
dcmd->data_xfer_len = cpu_to_le32((MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION));
dcmd->opcode = cpu_to_le32(MR_DCMD_LD_VF_MAP_GET_ALL_LDS);
if (initial)
dcmd->sgl.sge32[0].phys_addr =
cpu_to_le32(instance->vf_affiliation_h);
else
dcmd->sgl.sge32[0].phys_addr =
cpu_to_le32(new_affiliation_h);
dcmd->sgl.sge32[0].length = cpu_to_le32((MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION));
dev_warn(&instance->pdev->dev, "SR-IOV: Getting LD/VF affiliation for "
"scsi%d\n", instance->host->host_no);
if (megasas_issue_blocked_cmd(instance, cmd, 0) != DCMD_SUCCESS) {
dev_warn(&instance->pdev->dev, "SR-IOV: LD/VF affiliation DCMD"
" failed with status 0x%x for scsi%d\n",
dcmd->cmd_status, instance->host->host_no);
retval = 1; /* Do a scan if we couldn't get affiliation */
goto out;
}
if (!initial) {
if (!new_affiliation->ldCount) {
dev_warn(&instance->pdev->dev, "SR-IOV: Got new LD/VF "
"affiliation for passive path for scsi%d\n",
instance->host->host_no);
retval = 1;
goto out;
}
newmap = new_affiliation->map;
savedmap = instance->vf_affiliation->map;
thisVf = new_affiliation->thisVf;
for (i = 0 ; i < new_affiliation->ldCount; i++) {
found = 0;
for (j = 0; j < instance->vf_affiliation->ldCount;
j++) {
if (newmap->ref.targetId ==
savedmap->ref.targetId) {
found = 1;
if (newmap->policy[thisVf] !=
savedmap->policy[thisVf]) {
doscan = 1;
goto out;
}
}
savedmap = (struct MR_LD_VF_MAP *)
((unsigned char *)savedmap +
savedmap->size);
}
if (!found && newmap->policy[thisVf] !=
MR_LD_ACCESS_HIDDEN) {
doscan = 1;
goto out;
}
newmap = (struct MR_LD_VF_MAP *)
((unsigned char *)newmap + newmap->size);
}
newmap = new_affiliation->map;
savedmap = instance->vf_affiliation->map;
for (i = 0 ; i < instance->vf_affiliation->ldCount; i++) {
found = 0;
for (j = 0 ; j < new_affiliation->ldCount; j++) {
if (savedmap->ref.targetId ==
newmap->ref.targetId) {
found = 1;
if (savedmap->policy[thisVf] !=
newmap->policy[thisVf]) {
doscan = 1;
goto out;
}
}
newmap = (struct MR_LD_VF_MAP *)
((unsigned char *)newmap +
newmap->size);
}
if (!found && savedmap->policy[thisVf] !=
MR_LD_ACCESS_HIDDEN) {
doscan = 1;
goto out;
}
savedmap = (struct MR_LD_VF_MAP *)
((unsigned char *)savedmap +
savedmap->size);
}
}
out:
if (doscan) {
dev_warn(&instance->pdev->dev, "SR-IOV: Got new LD/VF "
"affiliation for scsi%d\n", instance->host->host_no);
memcpy(instance->vf_affiliation, new_affiliation,
new_affiliation->size);
retval = 1;
}
if (new_affiliation)
dma_free_coherent(&instance->pdev->dev,
(MAX_LOGICAL_DRIVES + 1) *
sizeof(struct MR_LD_VF_AFFILIATION),
new_affiliation, new_affiliation_h);
megasas_return_cmd(instance, cmd);
return retval;
}
| 0
|
250,208
|
static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
TestObjectPythonV8Internal::removeEventListenerMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 0
|
250,378
|
static int _make_words(char *l,long n,ogg_uint32_t *r,long quantvals,
codebook *b, oggpack_buffer *opb,int maptype){
long i,j,count=0;
long top=0;
ogg_uint32_t marker[MARKER_SIZE];
if (n<1)
return 1;
if(n<2){
r[0]=0x80000000;
}else{
memset(marker,0,sizeof(marker));
for(i=0;i<n;i++){
long length=l[i];
if(length){
if (length < 0 || length >= MARKER_SIZE) {
ALOGE("b/23881715");
return 1;
}
ogg_uint32_t entry=marker[length];
long chase=0;
if(count && !entry)return -1; /* overpopulated tree! */
/* chase the tree as far as it's already populated, fill in past */
for(j=0;j<length-1;j++){
int bit=(entry>>(length-j-1))&1;
if(chase>=top){
if (chase < 0 || chase >= n) return 1;
top++;
r[chase*2]=top;
r[chase*2+1]=0;
}else
if (chase < 0 || chase >= n || chase*2+bit > n*2+1) return 1;
if(!r[chase*2+bit])
r[chase*2+bit]=top;
chase=r[chase*2+bit];
if (chase < 0 || chase >= n) return 1;
}
{
int bit=(entry>>(length-j-1))&1;
if(chase>=top){
top++;
r[chase*2+1]=0;
}
r[chase*2+bit]= decpack(i,count++,quantvals,b,opb,maptype) |
0x80000000;
}
/* Look to see if the next shorter marker points to the node
above. if so, update it and repeat. */
for(j=length;j>0;j--){
if(marker[j]&1){
marker[j]=marker[j-1]<<1;
break;
}
marker[j]++;
}
/* prune the tree; the implicit invariant says all the longer
markers were dangling from our just-taken node. Dangle them
from our *new* node. */
for(j=length+1;j<MARKER_SIZE;j++)
if((marker[j]>>1) == entry){
entry=marker[j];
marker[j]=marker[j-1]<<1;
}else
break;
}
}
}
/* sanity check the huffman tree; an underpopulated tree must be
rejected. The only exception is the one-node pseudo-nil tree,
which appears to be underpopulated because the tree doesn't
really exist; there's only one possible 'codeword' or zero bits,
but the above tree-gen code doesn't mark that. */
if(b->used_entries != 1){
for(i=1;i<MARKER_SIZE;i++)
if(marker[i] & (0xffffffffUL>>(32-i))){
return 1;
}
}
return 0;
}
| 0
|
397,459
|
static void ringbuf_chr_close(struct CharDriverState *chr)
{
RingBufCharDriver *d = chr->opaque;
g_free(d->cbuf);
g_free(d);
chr->opaque = NULL;
}
| 0
|
81,034
|
static int verify_newpolicy_info(struct xfrm_userpolicy_info *p)
{
switch (p->share) {
case XFRM_SHARE_ANY:
case XFRM_SHARE_SESSION:
case XFRM_SHARE_USER:
case XFRM_SHARE_UNIQUE:
break;
default:
return -EINVAL;
}
switch (p->action) {
case XFRM_POLICY_ALLOW:
case XFRM_POLICY_BLOCK:
break;
default:
return -EINVAL;
}
switch (p->sel.family) {
case AF_INET:
break;
case AF_INET6:
#if IS_ENABLED(CONFIG_IPV6)
break;
#else
return -EAFNOSUPPORT;
#endif
default:
return -EINVAL;
}
return verify_policy_dir(p->dir);
}
| 0
|
287,216
|
static void parse_class(RBinFile *binfile, RBinDexObj *bin, RBinDexClass *c,
int class_index, int *methods, int *sym_count) {
struct r_bin_t *rbin = binfile->rbin;
char *class_name;
int z;
const ut8 *p, *p_end;
if (!c) {
return;
}
class_name = dex_class_name (bin, c);
class_name = r_str_replace (class_name, ";", "", 0); //TODO: move to func
if (!class_name || !*class_name) {
return;
}
RBinClass *cls = R_NEW0 (RBinClass);
if (!cls) {
return;
}
cls->name = class_name;
cls->index = class_index;
cls->addr = bin->header.class_offset + class_index * DEX_CLASS_SIZE;
cls->methods = r_list_new ();
if (!cls->methods) {
free (cls);
return;
}
cls->fields = r_list_new ();
if (!cls->fields) {
r_list_free (cls->methods);
free (cls);
return;
}
r_list_append (bin->classes_list, cls);
if (dexdump) {
rbin->cb_printf (" Class descriptor : '%s;'\n", class_name);
rbin->cb_printf (
" Access flags : 0x%04x (%s)\n", c->access_flags,
createAccessFlagStr (c->access_flags, kAccessForClass));
rbin->cb_printf (" Superclass : '%s'\n",
dex_class_super_name (bin, c));
rbin->cb_printf (" Interfaces -\n");
}
if (c->interfaces_offset > 0 &&
bin->header.data_offset < c->interfaces_offset &&
c->interfaces_offset <
bin->header.data_offset + bin->header.data_size) {
p = r_buf_get_at (binfile->buf, c->interfaces_offset, NULL);
int types_list_size = r_read_le32(p);
if (types_list_size < 0 || types_list_size >= bin->header.types_size ) {
return;
}
for (z = 0; z < types_list_size; z++) {
int t = r_read_le16 (p + 4 + z * 2);
if (t > 0 && t < bin->header.types_size ) {
int tid = bin->types[t].descriptor_id;
if (dexdump) {
rbin->cb_printf (
" #%d : '%s'\n",
z, getstr (bin, tid));
}
}
}
}
// TODO: this is quite ugly
if (!c || !c->class_data_offset) {
if (dexdump) {
rbin->cb_printf (
" Static fields -\n Instance fields "
"-\n Direct methods -\n Virtual methods "
"-\n");
}
} else {
// TODO: move to func, def or inline
// class_data_offset => [class_offset, class_defs_off+class_defs_size*32]
if (bin->header.class_offset > c->class_data_offset ||
c->class_data_offset <
bin->header.class_offset +
bin->header.class_size * DEX_CLASS_SIZE) {
return;
}
p = r_buf_get_at (binfile->buf, c->class_data_offset, NULL);
p_end = p + binfile->buf->length - c->class_data_offset;
//XXX check for NULL!!
c->class_data = (struct dex_class_data_item_t *)malloc (
sizeof (struct dex_class_data_item_t));
p = r_uleb128 (p, p_end - p, &c->class_data->static_fields_size);
p = r_uleb128 (p, p_end - p, &c->class_data->instance_fields_size);
p = r_uleb128 (p, p_end - p, &c->class_data->direct_methods_size);
p = r_uleb128 (p, p_end - p, &c->class_data->virtual_methods_size);
if (dexdump) {
rbin->cb_printf (" Static fields -\n");
}
p = parse_dex_class_fields (
binfile, bin, c, cls, p, p_end, sym_count,
c->class_data->static_fields_size, true);
if (dexdump) {
rbin->cb_printf (" Instance fields -\n");
}
p = parse_dex_class_fields (
binfile, bin, c, cls, p, p_end, sym_count,
c->class_data->instance_fields_size, false);
if (dexdump) {
rbin->cb_printf (" Direct methods -\n");
}
p = parse_dex_class_method (
binfile, bin, c, cls, p, p_end, sym_count,
c->class_data->direct_methods_size, methods, true);
if (dexdump) {
rbin->cb_printf (" Virtual methods -\n");
}
p = parse_dex_class_method (
binfile, bin, c, cls, p, p_end, sym_count,
c->class_data->virtual_methods_size, methods, false);
}
if (dexdump) {
char *source_file = getstr (bin, c->source_file);
if (!source_file) {
rbin->cb_printf (
" source_file_idx : %d (unknown)\n\n",
c->source_file);
} else {
rbin->cb_printf (" source_file_idx : %d (%s)\n\n",
c->source_file, source_file);
}
}
// TODO:!!!!
// FIX: FREE BEFORE ALLOCATE!!!
//free (class_name);
}
| 1
|
496,552
|
static Plane_3 convert(Plane_3 p){return p;}
| 0
|
181,644
|
FileTransfer::addFileToExeptionList( const char* filename )
{
if ( !ExceptionFiles ) {
ExceptionFiles = new StringList;
ASSERT ( NULL != ExceptionFiles );
} else if ( ExceptionFiles->file_contains ( filename ) ) {
return true;
}
ExceptionFiles->append ( filename );
return true;
}
| 0
|
358,597
|
static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
struct desc_struct *seg_desc)
{
gpa_t gpa;
struct descriptor_table dtable;
u16 index = selector >> 3;
get_segment_descriptor_dtable(vcpu, selector, &dtable);
if (dtable.limit < index * 8 + 7) {
kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc);
return 1;
}
gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base);
gpa += index * 8;
return kvm_read_guest(vcpu->kvm, gpa, seg_desc, 8);
}
| 0
|
393,438
|
referenceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
{
callbacks++;
if (quiet)
return;
fprintf(SAXdebug, "SAX.reference(%s)\n", name);
}
| 0
|
519,586
|
void Field_varstring::sql_rpl_type(String *res) const
{
CHARSET_INFO *cs=charset();
if (Field_varstring::has_charset())
{
size_t length= cs->cset->snprintf(cs, (char*) res->ptr(),
res->alloced_length(),
"varchar(%u octets) character set %s",
field_length,
charset()->csname);
res->length(length);
}
else
Field_varstring::sql_type(*res);
}
| 0
|
398,284
|
void js_pushlstring(js_State *J, const char *v, int n)
{
CHECKSTACK(1);
if (n <= soffsetof(js_Value, type)) {
char *s = STACK[TOP].u.shrstr;
while (n--) *s++ = *v++;
*s = 0;
STACK[TOP].type = JS_TSHRSTR;
} else {
STACK[TOP].type = JS_TMEMSTR;
STACK[TOP].u.memstr = jsV_newmemstring(J, v, n);
}
++TOP;
}
| 0
|
107,368
|
ovsinst_bitmap_from_openflow(ovs_be32 ofpit_bitmap, enum ofp_version version)
{
uint32_t ovsinst_bitmap = 0;
const struct ovsinst_map *x;
for (x = get_ovsinst_map(version); x->ofpit >= 0; x++) {
if (ofpit_bitmap & htonl(1u << x->ofpit)) {
ovsinst_bitmap |= 1u << x->ovsinst;
}
}
return ovsinst_bitmap;
}
| 0
|
453,468
|
group_sched_out(struct perf_event *group_event,
struct perf_cpu_context *cpuctx,
struct perf_event_context *ctx)
{
struct perf_event *event;
if (group_event->state != PERF_EVENT_STATE_ACTIVE)
return;
perf_pmu_disable(ctx->pmu);
event_sched_out(group_event, cpuctx, ctx);
/*
* Schedule out siblings (if any):
*/
for_each_sibling_event(event, group_event)
event_sched_out(event, cpuctx, ctx);
perf_pmu_enable(ctx->pmu);
if (group_event->attr.exclusive)
cpuctx->exclusive = 0;
}
| 0
|
469,600
|
mat_copy(const char* src, const char* dst)
{
size_t len;
char buf[BUFSIZ] = {'\0'};
FILE* in = NULL;
FILE* out = NULL;
#if defined(_WIN32) && defined(_MSC_VER)
{
wchar_t* wname = utf82u(src);
if ( NULL != wname ) {
in = _wfopen(wname, L"rb");
free(wname);
}
}
#else
in = fopen(src, "rb");
#endif
if ( in == NULL ) {
Mat_Critical("Cannot open file \"%s\" for reading.", src);
return -1;
}
#if defined(_WIN32) && defined(_MSC_VER)
{
wchar_t* wname = utf82u(dst);
if ( NULL != wname ) {
out = _wfopen(wname, L"wb");
free(wname);
}
}
#else
out = fopen(dst, "wb");
#endif
if ( out == NULL ) {
fclose(in);
Mat_Critical("Cannot open file \"%s\" for writing.", dst);
return -1;
}
while ( (len = fread(buf, sizeof(char), BUFSIZ, in)) > 0 ) {
if ( len != fwrite(buf, sizeof(char), len, out) ) {
fclose(in);
fclose(out);
Mat_Critical("Error writing to file \"%s\".", dst);
return -1;
}
}
fclose(in);
fclose(out);
return 0;
}
| 0
|
333,718
|
static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
{
if (xen_hvm_init() != 0) {
hw_error("xen hardware virtual machine initialisation failed");
}
pc_init_pci(args);
}
| 0
|
428,526
|
replace_rw_async_data_free (ReplaceRWAsyncData *data)
{
g_free (data->etag);
g_free (data);
}
| 0
|
239,129
|
virtual void drawLayers()
{
CCLayerTreeHostImpl::drawLayers();
m_testHooks->drawLayersOnCCThread(this);
}
| 0
|
212,725
|
static bool VerifyNumber(const uint8* buffer,
int buffer_size,
int* offset,
int max_digits) {
RCHECK(*offset < buffer_size);
while (isspace(buffer[*offset])) {
++(*offset);
RCHECK(*offset < buffer_size);
}
int numSeen = 0;
while (--max_digits >= 0 && isdigit(buffer[*offset])) {
++numSeen;
++(*offset);
if (*offset >= buffer_size)
return true; // Out of space but seen a digit.
}
return (numSeen > 0);
}
| 0
|
431,946
|
static inline unsigned int xfrm_expire_msgsize(void)
{
return NLMSG_ALIGN(sizeof(struct xfrm_user_expire))
+ nla_total_size(sizeof(struct xfrm_mark));
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.