idx
int64 | func
string | target
int64 |
|---|---|---|
382,981
|
build_enter_admin_pin_prompt (app_t app, char **r_prompt)
{
void *relptr;
unsigned char *value;
size_t valuelen;
int remaining;
char *prompt;
*r_prompt = NULL;
relptr = get_one_do (app, 0x00C4, &value, &valuelen, NULL);
if (!relptr || valuelen < 7)
{
log_error (_("error retrieving CHV status from card\n"));
xfree (relptr);
return gpg_error (GPG_ERR_CARD);
}
if (value[6] == 0)
{
log_info (_("card is permanently locked!\n"));
xfree (relptr);
return gpg_error (GPG_ERR_BAD_PIN);
}
remaining = value[6];
xfree (relptr);
log_info(_("%d Admin PIN attempts remaining before card"
" is permanently locked\n"), remaining);
if (remaining < 3)
{
/* TRANSLATORS: Do not translate the "|A|" prefix but keep it at
the start of the string. Use %%0A to force a linefeed. */
prompt = xtryasprintf (_("|A|Please enter the Admin PIN%%0A"
"[remaining attempts: %d]"), remaining);
}
else
prompt = xtrystrdup (_("|A|Please enter the Admin PIN"));
if (!prompt)
return gpg_error_from_syserror ();
*r_prompt = prompt;
return 0;
}
| 0
|
68,725
|
mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
int len, bool more)
{
struct page *page = virt_to_head_page(data);
int offset = data - page_address(page);
struct sk_buff *skb = q->rx_head;
struct skb_shared_info *shinfo = skb_shinfo(skb);
if (shinfo->nr_frags < ARRAY_SIZE(shinfo->frags)) {
offset += q->buf_offset;
skb_add_rx_frag(skb, shinfo->nr_frags, page, offset, len,
q->buf_size);
}
if (more)
return;
q->rx_head = NULL;
dev->drv->rx_skb(dev, q - dev->q_rx, skb);
}
| 0
|
191,643
|
void DrawingBuffer::ResolveMultisampleFramebufferInternal() {
DCHECK(state_restorer_);
state_restorer_->SetFramebufferBindingDirty();
if (WantExplicitResolve()) {
state_restorer_->SetClearStateDirty();
gl_->BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, multisample_fbo_);
gl_->BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, fbo_);
gl_->Disable(GL_SCISSOR_TEST);
int width = size_.Width();
int height = size_.Height();
GLuint filter = GL_NEAREST;
gl_->BlitFramebufferCHROMIUM(0, 0, width, height, 0, 0, width, height,
GL_COLOR_BUFFER_BIT, filter);
if (DefaultBufferRequiresAlphaChannelToBePreserved() &&
ContextProvider()
->GetCapabilities()
.disable_multisampling_color_mask_usage) {
gl_->ClearColor(0, 0, 0, 1);
gl_->ColorMask(false, false, false, true);
gl_->Clear(GL_COLOR_BUFFER_BIT);
}
}
gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_);
if (anti_aliasing_mode_ == kScreenSpaceAntialiasing)
gl_->ApplyScreenSpaceAntialiasingCHROMIUM();
}
| 0
|
375,831
|
static void put_int16(QEMUFile *f, void *pv, size_t size)
{
int16_t *v = pv;
qemu_put_sbe16s(f, v);
}
| 0
|
164,969
|
void DevToolsWindow::OpenDevToolsWindow(
content::WebContents* inspected_web_contents) {
ToggleDevToolsWindow(
inspected_web_contents, true, DevToolsToggleAction::Show(), "");
}
| 0
|
123,398
|
static int slcan_ioctl(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct slcan *sl = (struct slcan *) tty->disc_data;
unsigned int tmp;
/* First make sure we're connected. */
if (!sl || sl->magic != SLCAN_MAGIC)
return -EINVAL;
switch (cmd) {
case SIOCGIFNAME:
tmp = strlen(sl->dev->name) + 1;
if (copy_to_user((void __user *)arg, sl->dev->name, tmp))
return -EFAULT;
return 0;
case SIOCSIFHWADDR:
return -EINVAL;
default:
return tty_mode_ioctl(tty, file, cmd, arg);
}
}
| 0
|
215,581
|
const binder_size_t* Parcel::objects() const
{
return mObjects;
}
| 0
|
427,507
|
merge_queue_lists(queue_filename *a, queue_filename *b)
{
queue_filename *first = NULL;
queue_filename **append = &first;
while (a && b)
{
int d;
if ((d = Ustrncmp(a->text, b->text, 6)) == 0)
d = Ustrcmp(a->text + 14, b->text + 14);
if (d < 0)
{
*append = a;
append= &a->next;
a = a->next;
}
else
{
*append = b;
append= &b->next;
b = b->next;
}
}
*append = a ? a : b;
return first;
}
| 0
|
225,265
|
void AudioRendererHost::OnNotifyPacketReady(
const IPC::Message& msg, int stream_id, uint32 packet_size) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
AudioEntry* entry = LookupById(msg.routing_id(), stream_id);
if (!entry) {
SendErrorMessage(msg.routing_id(), stream_id);
return;
}
DCHECK(!entry->controller->LowLatencyMode());
CHECK(packet_size <= entry->shared_memory.created_size());
if (!entry->pending_buffer_request) {
NOTREACHED() << "Buffer received but no such pending request";
}
entry->pending_buffer_request = false;
entry->controller->EnqueueData(
reinterpret_cast<uint8*>(entry->shared_memory.memory()),
packet_size);
}
| 0
|
435,112
|
psutil_proc_memory_info(PyObject *self, PyObject *args) {
HANDLE hProcess;
DWORD pid;
#if (_WIN32_WINNT >= 0x0501) // Windows XP with SP2
PROCESS_MEMORY_COUNTERS_EX cnt;
#else
PROCESS_MEMORY_COUNTERS cnt;
#endif
SIZE_T private = 0;
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;
hProcess = psutil_handle_from_pid(pid, PROCESS_QUERY_LIMITED_INFORMATION);
if (NULL == hProcess)
return NULL;
if (! GetProcessMemoryInfo(hProcess, (PPROCESS_MEMORY_COUNTERS)&cnt,
sizeof(cnt))) {
PyErr_SetFromWindowsErr(0);
CloseHandle(hProcess);
return NULL;
}
#if (_WIN32_WINNT >= 0x0501) // Windows XP with SP2
private = cnt.PrivateUsage;
#endif
CloseHandle(hProcess);
// PROCESS_MEMORY_COUNTERS values are defined as SIZE_T which on 64bits
// is an (unsigned long long) and on 32bits is an (unsigned int).
// "_WIN64" is defined if we're running a 64bit Python interpreter not
// exclusively if the *system* is 64bit.
#if defined(_WIN64)
return Py_BuildValue(
"(kKKKKKKKKK)",
cnt.PageFaultCount, // unsigned long
(unsigned long long)cnt.PeakWorkingSetSize,
(unsigned long long)cnt.WorkingSetSize,
(unsigned long long)cnt.QuotaPeakPagedPoolUsage,
(unsigned long long)cnt.QuotaPagedPoolUsage,
(unsigned long long)cnt.QuotaPeakNonPagedPoolUsage,
(unsigned long long)cnt.QuotaNonPagedPoolUsage,
(unsigned long long)cnt.PagefileUsage,
(unsigned long long)cnt.PeakPagefileUsage,
(unsigned long long)private);
#else
return Py_BuildValue(
"(kIIIIIIIII)",
cnt.PageFaultCount, // unsigned long
(unsigned int)cnt.PeakWorkingSetSize,
(unsigned int)cnt.WorkingSetSize,
(unsigned int)cnt.QuotaPeakPagedPoolUsage,
(unsigned int)cnt.QuotaPagedPoolUsage,
(unsigned int)cnt.QuotaPeakNonPagedPoolUsage,
(unsigned int)cnt.QuotaNonPagedPoolUsage,
(unsigned int)cnt.PagefileUsage,
(unsigned int)cnt.PeakPagefileUsage,
(unsigned int)private);
#endif
}
| 0
|
308,995
|
void RemoteFrame::SetCcLayer(cc::Layer* cc_layer,
bool prevent_contents_opaque_changes,
bool is_surface_layer) {
DCHECK(Owner());
if (cc_layer_)
GraphicsLayer::UnregisterContentsLayer(cc_layer_);
cc_layer_ = cc_layer;
prevent_contents_opaque_changes_ = prevent_contents_opaque_changes;
is_surface_layer_ = is_surface_layer;
if (cc_layer_) {
GraphicsLayer::RegisterContentsLayer(cc_layer_);
PointerEventsChanged();
}
ToHTMLFrameOwnerElement(Owner())->SetNeedsCompositingUpdate();
}
| 0
|
495,563
|
const u8 *gf_isom_get_mpegh_compatible_profiles(GF_ISOFile *movie, u32 trackNumber, u32 sampleDescIndex, u32 *nb_compat_profiles)
{
GF_SampleEntryBox *ent;
GF_MHACompatibleProfilesBox *mhap;
GF_TrackBox *trak;
trak = gf_isom_get_track_from_file(movie, trackNumber);
if (!trak || !trak->Media || !nb_compat_profiles) return NULL;
*nb_compat_profiles = 0;
ent = gf_list_get(trak->Media->information->sampleTable->SampleDescription->child_boxes, sampleDescIndex-1);
if (!ent) return NULL;
mhap = (GF_MHACompatibleProfilesBox *) gf_isom_box_find_child(ent->child_boxes, GF_ISOM_BOX_TYPE_MHAP);
if (!mhap) return NULL;
*nb_compat_profiles = mhap->num_profiles;
return mhap->compat_profiles;
}
| 0
|
314,049
|
bool LiveSyncTest::SetUpLocalTestServer() {
CommandLine* cl = CommandLine::ForCurrentProcess();
CommandLine::StringType server_cmdline_string = cl->GetSwitchValueNative(
switches::kSyncServerCommandLine);
CommandLine::StringVector server_cmdline_vector;
CommandLine::StringType delimiters(FILE_PATH_LITERAL(" "));
Tokenize(server_cmdline_string, delimiters, &server_cmdline_vector);
CommandLine server_cmdline(server_cmdline_vector);
if (!base::LaunchApp(server_cmdline, false, true, &test_server_handle_))
LOG(ERROR) << "Could not launch local test server.";
const int kMaxWaitTime = TestTimeouts::live_operation_timeout_ms();
const int kNumIntervals = 15;
if (WaitForTestServerToStart(kMaxWaitTime, kNumIntervals)) {
VLOG(1) << "Started local test server at "
<< cl->GetSwitchValueASCII(switches::kSyncServiceURL) << ".";
return true;
} else {
LOG(ERROR) << "Could not start local test server at "
<< cl->GetSwitchValueASCII(switches::kSyncServiceURL) << ".";
return false;
}
}
| 0
|
44,829
|
**/
const CImg<T>& save_dlm(const char *const filename) const {
return _save_dlm(0,filename);
| 0
|
44,311
|
static void unpack_14(const uint8_t b[14], uint16_t s[16])
{
unsigned short shift = (b[ 2] >> 2) & 15;
unsigned short bias = (0x20 << shift);
int i;
s[ 0] = (b[0] << 8) | b[1];
s[ 4] = s[ 0] + ((((b[ 2] << 4) | (b[ 3] >> 4)) & 0x3f) << shift) - bias;
s[ 8] = s[ 4] + ((((b[ 3] << 2) | (b[ 4] >> 6)) & 0x3f) << shift) - bias;
s[12] = s[ 8] + ((b[ 4] & 0x3f) << shift) - bias;
s[ 1] = s[ 0] + ((b[ 5] >> 2) << shift) - bias;
s[ 5] = s[ 4] + ((((b[ 5] << 4) | (b[ 6] >> 4)) & 0x3f) << shift) - bias;
s[ 9] = s[ 8] + ((((b[ 6] << 2) | (b[ 7] >> 6)) & 0x3f) << shift) - bias;
s[13] = s[12] + ((b[ 7] & 0x3f) << shift) - bias;
s[ 2] = s[ 1] + ((b[ 8] >> 2) << shift) - bias;
s[ 6] = s[ 5] + ((((b[ 8] << 4) | (b[ 9] >> 4)) & 0x3f) << shift) - bias;
s[10] = s[ 9] + ((((b[ 9] << 2) | (b[10] >> 6)) & 0x3f) << shift) - bias;
s[14] = s[13] + ((b[10] & 0x3f) << shift) - bias;
s[ 3] = s[ 2] + ((b[11] >> 2) << shift) - bias;
s[ 7] = s[ 6] + ((((b[11] << 4) | (b[12] >> 4)) & 0x3f) << shift) - bias;
s[11] = s[10] + ((((b[12] << 2) | (b[13] >> 6)) & 0x3f) << shift) - bias;
s[15] = s[14] + ((b[13] & 0x3f) << shift) - bias;
for (i = 0; i < 16; ++i) {
if (s[i] & 0x8000)
s[i] &= 0x7fff;
else
s[i] = ~s[i];
}
}
| 0
|
278,105
|
bool ContextualSearchFieldTrial::IsSendBasePageURLDisabled() {
return GetBooleanParam(kContextualSearchSendURLDisabledParamName,
&is_send_base_page_url_disabled_cached_,
&is_send_base_page_url_disabled_);
}
| 0
|
92,507
|
njs_generate_try_left(njs_vm_t *vm, njs_generator_t *generator,
njs_parser_node_t *node)
{
njs_int_t ret;
njs_index_t exit_index, catch_index;
njs_jump_off_t try_end_offset;
njs_variable_t *var;
njs_vmcode_catch_t *catch;
njs_vmcode_try_end_t *try_end;
njs_generator_block_t *try_block;
njs_generator_try_ctx_t *ctx;
njs_vmcode_try_trampoline_t *try_break, *try_continue;
ctx = generator->context;
try_block = ctx->try_block;
exit_index = try_block->index;
njs_generate_code(generator, njs_vmcode_try_end_t, try_end,
NJS_VMCODE_TRY_END, 0, NULL);
try_end_offset = njs_code_offset(generator, try_end);
if (try_block->exit != NULL) {
ctx->try_exit_label = try_block->exit->label;
njs_debug_generator(vm, "TRY CTX %p EXIT LABEL %V", ctx,
&ctx->try_exit_label);
njs_generate_patch_block(vm, generator, try_block,
NJS_GENERATOR_EXIT);
njs_generate_code(generator, njs_vmcode_try_trampoline_t, try_break,
NJS_VMCODE_TRY_BREAK, 1, NULL);
try_break->exit_value = exit_index;
try_break->offset = -sizeof(njs_vmcode_try_end_t);
} else {
try_break = NULL;
}
if (try_block->continuation != NULL) {
ctx->try_cont_label = try_block->continuation->label;
njs_generate_patch_block(vm, generator, try_block,
NJS_GENERATOR_CONTINUATION);
njs_generate_code(generator, njs_vmcode_try_trampoline_t, try_continue,
NJS_VMCODE_TRY_CONTINUE, 1, NULL);
try_continue->exit_value = exit_index;
try_continue->offset = -sizeof(njs_vmcode_try_end_t);
if (try_break != NULL) {
try_continue->offset -= sizeof(njs_vmcode_try_trampoline_t);
}
}
njs_debug_generator(vm, "EXIT %s %p",
njs_block_type(generator->block->type),
generator->block);
generator->block = try_block->next;
njs_code_set_jump_offset(generator, njs_vmcode_try_start_t,
ctx->try_offset);
ctx->try_offset = try_end_offset;
node = node->right;
if (node->token_type == NJS_TOKEN_CATCH) {
/* A "try/catch" case. */
var = njs_variable_reference(vm, node->left);
if (njs_slow_path(var == NULL)) {
return NJS_ERROR;
}
catch_index = node->left->index;
njs_generate_code_catch(generator, catch, catch_index, node);
njs_generator_next(generator, njs_generate, node->right);
return njs_generator_after(vm, generator,
njs_queue_first(&generator->stack), node,
njs_generate_try_catch, ctx, 0);
}
if (node->left != NULL) {
/* A try/catch/finally case. */
var = njs_variable_reference(vm, node->left->left);
if (njs_slow_path(var == NULL)) {
return NJS_ERROR;
}
catch_index = node->left->left->index;
njs_generate_code_catch(generator, catch, catch_index, node);
ctx->catch_offset = njs_code_offset(generator, catch);
ret = njs_generate_start_block(vm, generator, NJS_GENERATOR_TRY,
&no_label);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
ctx->catch_block = generator->block;
ctx->catch_block->index = exit_index;
njs_generator_next(generator, njs_generate, node->left->right);
return njs_generator_after(vm, generator,
njs_queue_first(&generator->stack), node,
njs_generate_try_finally, ctx, 0);
}
/* A try/finally case. */
njs_generate_code_catch(generator, catch, ctx->exception_index, NULL);
ctx->catch_block = NULL;
njs_code_set_jump_offset(generator, njs_vmcode_try_end_t,
ctx->try_offset);
njs_generator_next(generator, njs_generate, node->right);
return njs_generator_after(vm, generator,
njs_queue_first(&generator->stack), node,
njs_generate_try_end, ctx, 0);
}
| 0
|
312,013
|
PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec)
{
RefPtr<Event> event = EventFactory::create(eventType);
if (event)
return event.release();
ec = NOT_SUPPORTED_ERR;
return 0;
}
| 0
|
354,681
|
pfm_context_free(pfm_context_t *ctx)
{
if (ctx) {
DPRINT(("free ctx @%p\n", ctx));
kfree(ctx);
}
}
| 0
|
164,702
|
void HTMLFormControlElement::DidChangeForm() {
ListedElement::DidChangeForm();
if (formOwner() && isConnected() && CanBeSuccessfulSubmitButton())
formOwner()->InvalidateDefaultButtonStyle();
}
| 0
|
453,292
|
perf_cgroup_event_disable(struct perf_event *event, struct perf_event_context *ctx)
{
struct perf_cpu_context *cpuctx;
if (!is_cgroup_event(event))
return;
/*
* Because cgroup events are always per-cpu events,
* @ctx == &cpuctx->ctx.
*/
cpuctx = container_of(ctx, struct perf_cpu_context, ctx);
if (--ctx->nr_cgroups)
return;
if (ctx->is_active && cpuctx->cgrp)
cpuctx->cgrp = NULL;
list_del(&cpuctx->cgrp_cpuctx_entry);
}
| 0
|
82,083
|
static void virtnet_config_changed_work(struct work_struct *work)
{
struct virtnet_info *vi =
container_of(work, struct virtnet_info, config_work);
u16 v;
if (virtio_cread_feature(vi->vdev, VIRTIO_NET_F_STATUS,
struct virtio_net_config, status, &v) < 0)
return;
if (v & VIRTIO_NET_S_ANNOUNCE) {
netdev_notify_peers(vi->dev);
virtnet_ack_link_announce(vi);
}
/* Ignore unknown (future) status bits */
v &= VIRTIO_NET_S_LINK_UP;
if (vi->status == v)
return;
vi->status = v;
if (vi->status & VIRTIO_NET_S_LINK_UP) {
netif_carrier_on(vi->dev);
netif_tx_wake_all_queues(vi->dev);
} else {
netif_carrier_off(vi->dev);
netif_tx_stop_all_queues(vi->dev);
}
}
| 0
|
14,299
|
uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
{
uint32_t old_val;
trace_esp_mem_readb(saddr, s->rregs[saddr]);
switch (saddr) {
case ESP_FIFO:
if (s->ti_size > 0) {
s->ti_size--;
if ((s->rregs[ESP_RSTAT] & STAT_PIO_MASK) == 0) {
/* Data out. */
qemu_log_mask(LOG_UNIMP,
"esp: PIO data read not implemented\n");
s->rregs[ESP_FIFO] = 0;
} else {
s->rregs[ESP_FIFO] = s->ti_buf[s->ti_rptr++];
}
esp_raise_irq(s);
}
if (s->ti_size == 0) {
s->ti_rptr = 0;
s->ti_wptr = 0;
}
s->ti_wptr = 0;
}
break;
case ESP_RINTR:
/* Clear sequence step, interrupt register and all status bits
except TC */
old_val = s->rregs[ESP_RINTR];
s->rregs[ESP_RINTR] = 0;
s->rregs[ESP_RSTAT] &= ~STAT_TC;
s->rregs[ESP_RSEQ] = SEQ_CD;
esp_lower_irq(s);
return old_val;
case ESP_TCHI:
/* Return the unique id if the value has never been written */
if (!s->tchi_written) {
return s->chip_id;
}
default:
break;
}
| 1
|
477,197
|
nwfilterBindingLookupByPortDev(virConnectPtr conn,
const char *portdev)
{
virNWFilterBindingPtr ret = NULL;
virNWFilterBindingObj *obj;
virNWFilterBindingDef *def;
obj = virNWFilterBindingObjListFindByPortDev(driver->bindings,
portdev);
if (!obj) {
virReportError(VIR_ERR_NO_NWFILTER_BINDING,
_("no nwfilter binding for port dev '%s'"), portdev);
goto cleanup;
}
def = virNWFilterBindingObjGetDef(obj);
if (virNWFilterBindingLookupByPortDevEnsureACL(conn, def) < 0)
goto cleanup;
ret = virGetNWFilterBinding(conn, def->portdevname, def->filter);
cleanup:
virNWFilterBindingObjEndAPI(&obj);
return ret;
}
| 0
|
397,026
|
wc_ucs_to_any(wc_uint32 ucs, wc_table *t)
{
wc_wchar_t cc;
wc_map *map;
if (t && t->map && ucs && ucs <= WC_C_UCS2_END) {
map = wc_map_search((wc_uint16)ucs, t->map, t->n);
if (map)
return t->conv(t->ccs, map->code2);
}
if (t && (ucs & ~0xFFFF) == WC_C_UCS4_PLANE2) {
if (t->ccs == WC_CCS_JIS_X_0213_1)
map = wc_map_search((wc_uint16)(ucs & 0xffff),
ucs_p2_jisx02131_map, N_ucs_p2_jisx02131_map);
else if (t->ccs == WC_CCS_JIS_X_0213_2)
map = wc_map_search((wc_uint16)(ucs & 0xffff),
ucs_p2_jisx02132_map, N_ucs_p2_jisx02132_map);
else if (t->ccs == WC_CCS_HKSCS ||
t->ccs == WC_CCS_HKSCS_1 || t->ccs == WC_CCS_HKSCS_2)
map = wc_map_search((wc_uint16)(ucs & 0xffff),
ucs_p2_hkscs_map, N_ucs_p2_hkscs_map);
else
map = NULL;
if (map)
return t->conv(t->ccs, map->code2);
}
cc.ccs = WC_CCS_UNKNOWN;
cc.code = 0;
return cc;
}
| 0
|
295,135
|
static unsigned long scale_rt_capacity(struct sched_domain *sd, int cpu)
{
struct rq *rq = cpu_rq(cpu);
unsigned long max = arch_scale_cpu_capacity(sd, cpu);
unsigned long used, free;
unsigned long irq;
irq = cpu_util_irq(rq);
if (unlikely(irq >= max))
return 1;
used = READ_ONCE(rq->avg_rt.util_avg);
used += READ_ONCE(rq->avg_dl.util_avg);
if (unlikely(used >= max))
return 1;
free = max - used;
return scale_irq_capacity(free, irq, max);
}
| 0
|
128,184
|
GF_Err moov_on_child_box(GF_Box *s, GF_Box *a)
{
GF_MovieBox *ptr = (GF_MovieBox *)s;
switch (a->type) {
case GF_ISOM_BOX_TYPE_IODS:
if (ptr->iods) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->iods = (GF_ObjectDescriptorBox *)a;
//if no IOD, delete the box
if (!ptr->iods->descriptor) {
ptr->iods = NULL;
gf_isom_box_del_parent(&s->child_boxes, a);
}
return GF_OK;
case GF_ISOM_BOX_TYPE_MVHD:
if (ptr->mvhd) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->mvhd = (GF_MovieHeaderBox *)a;
return GF_OK;
case GF_ISOM_BOX_TYPE_UDTA:
if (ptr->udta) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->udta = (GF_UserDataBox *)a;
return GF_OK;
#ifndef GPAC_DISABLE_ISOM_FRAGMENTS
case GF_ISOM_BOX_TYPE_MVEX:
if (ptr->mvex) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->mvex = (GF_MovieExtendsBox *)a;
ptr->mvex->mov = ptr->mov;
return GF_OK;
#endif
case GF_ISOM_BOX_TYPE_META:
if (ptr->meta) ERROR_ON_DUPLICATED_BOX(a, ptr)
ptr->meta = (GF_MetaBox *)a;
return GF_OK;
case GF_ISOM_BOX_TYPE_TRAK:
//set our pointer to this obj
((GF_TrackBox *)a)->moov = ptr;
return gf_list_add(ptr->trackList, a);
}
return GF_OK;
}
| 0
|
379,783
|
static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2, free_res;
zval **container = _get_zval_ptr_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zval *property = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
if (IS_VAR == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
if (IS_VAR == IS_VAR && !container) {
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
}
zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_UNSET TSRMLS_CC);
if (1) {
zval_ptr_dtor(&property);
} else {
zval_dtor(free_op2.var);
}
if (IS_VAR == IS_VAR && (free_op1.var != NULL) &&
READY_TO_DESTROY(free_op1.var)) {
AI_USE_PTR(EX_T(opline->result.u.var).var);
if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) &&
Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) {
SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr);
}
}
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res);
if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr);
}
PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr);
FREE_OP_VAR_PTR(free_res);
ZEND_VM_NEXT_OPCODE();
}
| 0
|
240,991
|
bool AccessibilityUIElement::addNotificationListener(JSValueRef functionCallback)
{
return true;
}
| 0
|
120,852
|
QPDFObjectHandle::ParserCallbacks::terminateParsing()
{
throw TerminateParsing();
}
| 0
|
230,751
|
InvalidationNotifier::~InvalidationNotifier() {
DCHECK(CalledOnValidThread());
}
| 0
|
315,891
|
check_data_region (struct tar_sparse_file *file, size_t i)
{
off_t size_left;
if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
return false;
size_left = file->stat_info->sparse_map[i].numbytes;
mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
while (size_left > 0)
{
size_t bytes_read;
size_t rdsize = (size_left > BLOCKSIZE) ? BLOCKSIZE : size_left;
char diff_buffer[BLOCKSIZE];
union block *blk = find_next_block ();
if (!blk)
{
ERROR ((0, 0, _("Unexpected EOF in archive")));
return false;
}
set_next_block_after (blk);
file->dumped_size += BLOCKSIZE;
bytes_read = safe_read (file->fd, diff_buffer, rdsize);
if (bytes_read == SAFE_READ_ERROR)
{
read_diag_details (file->stat_info->orig_file_name,
(file->stat_info->sparse_map[i].offset
+ file->stat_info->sparse_map[i].numbytes
- size_left),
rdsize);
return false;
}
else if (bytes_read == 0)
{
report_difference (¤t_stat_info, _("Size differs"));
return false;
}
size_left -= bytes_read;
mv_size_left (file->stat_info->archive_file_size - file->dumped_size);
if (memcmp (blk->buffer, diff_buffer, rdsize))
{
report_difference (file->stat_info, _("Contents differ"));
return false;
}
}
return true;
}
| 0
|
160,399
|
mono_reflection_parse_type (char *name, MonoTypeNameParse *info)
{
return _mono_reflection_parse_type (name, NULL, FALSE, info);
}
| 0
|
421,523
|
process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, RD_BOOL delta)
{
int index, next, data;
uint8 flags = 0;
PEN pen;
RD_POINT *points;
if (present & 0x01)
rdp_in_coord(s, &os->x, delta);
if (present & 0x02)
rdp_in_coord(s, &os->y, delta);
if (present & 0x04)
in_uint8(s, os->opcode);
if (present & 0x10)
rdp_in_colour(s, &os->fgcolour);
if (present & 0x20)
in_uint8(s, os->lines);
if (present & 0x40)
{
in_uint8(s, os->datasize);
in_uint8a(s, os->data, os->datasize);
}
DEBUG(("POLYLINE(x=%d,y=%d,op=0x%x,fg=0x%x,n=%d,sz=%d)\n",
os->x, os->y, os->opcode, os->fgcolour, os->lines, os->datasize));
DEBUG(("Data: "));
for (index = 0; index < os->datasize; index++)
DEBUG(("%02x ", os->data[index]));
DEBUG(("\n"));
if (os->opcode < 0x01 || os->opcode > 0x10)
{
error("bad ROP2 0x%x\n", os->opcode);
return;
}
points = (RD_POINT *) xmalloc((os->lines + 1) * sizeof(RD_POINT));
memset(points, 0, (os->lines + 1) * sizeof(RD_POINT));
points[0].x = os->x;
points[0].y = os->y;
pen.style = pen.width = 0;
pen.colour = os->fgcolour;
index = 0;
data = ((os->lines - 1) / 4) + 1;
for (next = 1; (next <= os->lines) && (data < os->datasize); next++)
{
if ((next - 1) % 4 == 0)
flags = os->data[index++];
if (~flags & 0x80)
points[next].x = parse_delta(os->data, &data);
if (~flags & 0x40)
points[next].y = parse_delta(os->data, &data);
flags <<= 2;
}
if (next - 1 == os->lines)
ui_polyline(os->opcode - 1, points, os->lines + 1, &pen);
else
error("polyline parse error\n");
xfree(points);
}
| 0
|
289,081
|
static struct remote_lock * lock_remote ( const char * path , long timeout ) {
struct active_request_slot * slot ;
struct slot_results results ;
struct buffer out_buffer = {
STRBUF_INIT , 0 }
;
struct strbuf in_buffer = STRBUF_INIT ;
char * url ;
char * ep ;
char timeout_header [ 25 ] ;
struct remote_lock * lock = NULL ;
struct curl_slist * dav_headers = NULL ;
struct xml_ctx ctx ;
char * escaped ;
url = xstrfmt ( "%s%s" , repo -> url , path ) ;
ep = strchr ( url + strlen ( repo -> url ) + 1 , '/' ) ;
while ( ep ) {
char saved_character = ep [ 1 ] ;
ep [ 1 ] = '\0' ;
slot = get_active_slot ( ) ;
slot -> results = & results ;
curl_setup_http_get ( slot -> curl , url , DAV_MKCOL ) ;
if ( start_active_slot ( slot ) ) {
run_active_slot ( slot ) ;
if ( results . curl_result != CURLE_OK && results . http_code != 405 ) {
fprintf ( stderr , "Unable to create branch path %s\n" , url ) ;
free ( url ) ;
return NULL ;
}
}
else {
fprintf ( stderr , "Unable to start MKCOL request\n" ) ;
free ( url ) ;
return NULL ;
}
ep [ 1 ] = saved_character ;
ep = strchr ( ep + 1 , '/' ) ;
}
escaped = xml_entities ( ident_default_email ( ) ) ;
strbuf_addf ( & out_buffer . buf , LOCK_REQUEST , escaped ) ;
free ( escaped ) ;
xsnprintf ( timeout_header , sizeof ( timeout_header ) , "Timeout: Second-%ld" , timeout ) ;
dav_headers = curl_slist_append ( dav_headers , timeout_header ) ;
dav_headers = curl_slist_append ( dav_headers , "Content-Type: text/xml" ) ;
slot = get_active_slot ( ) ;
slot -> results = & results ;
curl_setup_http ( slot -> curl , url , DAV_LOCK , & out_buffer , fwrite_buffer ) ;
curl_easy_setopt ( slot -> curl , CURLOPT_HTTPHEADER , dav_headers ) ;
curl_easy_setopt ( slot -> curl , CURLOPT_FILE , & in_buffer ) ;
lock = xcalloc ( 1 , sizeof ( * lock ) ) ;
lock -> timeout = - 1 ;
if ( start_active_slot ( slot ) ) {
run_active_slot ( slot ) ;
if ( results . curl_result == CURLE_OK ) {
XML_Parser parser = XML_ParserCreate ( NULL ) ;
enum XML_Status result ;
ctx . name = xcalloc ( 10 , 1 ) ;
ctx . len = 0 ;
ctx . cdata = NULL ;
ctx . userFunc = handle_new_lock_ctx ;
ctx . userData = lock ;
XML_SetUserData ( parser , & ctx ) ;
XML_SetElementHandler ( parser , xml_start_tag , xml_end_tag ) ;
XML_SetCharacterDataHandler ( parser , xml_cdata ) ;
result = XML_Parse ( parser , in_buffer . buf , in_buffer . len , 1 ) ;
free ( ctx . name ) ;
if ( result != XML_STATUS_OK ) {
fprintf ( stderr , "XML error: %s\n" , XML_ErrorString ( XML_GetErrorCode ( parser ) ) ) ;
lock -> timeout = - 1 ;
}
XML_ParserFree ( parser ) ;
}
}
else {
fprintf ( stderr , "Unable to start LOCK request\n" ) ;
}
curl_slist_free_all ( dav_headers ) ;
strbuf_release ( & out_buffer . buf ) ;
strbuf_release ( & in_buffer ) ;
if ( lock -> token == NULL || lock -> timeout <= 0 ) {
free ( lock -> token ) ;
free ( lock -> owner ) ;
free ( url ) ;
free ( lock ) ;
lock = NULL ;
}
else {
lock -> url = url ;
lock -> start_time = time ( NULL ) ;
lock -> next = repo -> locks ;
repo -> locks = lock ;
}
return lock ;
}
| 0
|
410,264
|
void readMetadata()
{
}
| 0
|
513,435
|
RefreshArea(xs, ys, xe, ye, isblank)
int xs, ys, xe, ye, isblank;
{
int y;
ASSERT(display);
debug2("Refresh Area: %d,%d", xs, ys);
debug3(" - %d,%d (isblank=%d)\n", xe, ye, isblank);
if (!isblank && xs == 0 && xe == D_width - 1 && ye == D_height - 1 && (ys == 0 || D_CD))
{
ClearArea(xs, ys, xs, xe, xe, ye, 0, 0);
isblank = 1;
}
for (y = ys; y <= ye; y++)
RefreshLine(y, xs, xe, isblank);
}
| 0
|
275,877
|
static void perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterCallbackForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestInterfaceNodeV8Internal::perWorldBindingsReadonlyTestInterfaceEmptyAttributeAttributeGetterForMainWorld(info);
}
| 0
|
164,045
|
static void cmd_sort(char *tag, int usinguid)
{
int c;
struct sortcrit *sortcrit = NULL;
struct searchargs *searchargs = NULL;
clock_t start = clock();
char mytime[100];
int n;
if (backend_current) {
/* remote mailbox */
const char *cmd = usinguid ? "UID Sort" : "Sort";
prot_printf(backend_current->out, "%s %s ", tag, cmd);
if (!pipe_command(backend_current, 65536)) {
pipe_including_tag(backend_current, tag, 0);
}
return;
}
/* local mailbox */
c = getsortcriteria(tag, &sortcrit);
if (c == EOF) goto error;
searchargs = new_searchargs(tag, GETSEARCH_CHARSET_FIRST,
&imapd_namespace, imapd_userid, imapd_authstate,
imapd_userisadmin || imapd_userisproxyadmin);
if (imapd_id.quirks & QUIRK_SEARCHFUZZY)
searchargs->fuzzy_depth++;
c = get_search_program(imapd_in, imapd_out, searchargs);
if (c == EOF) goto error;
if (c == '\r') c = prot_getc(imapd_in);
if (c != '\n') {
prot_printf(imapd_out,
"%s BAD Unexpected extra arguments to Sort\r\n", tag);
goto error;
}
n = index_sort(imapd_index, sortcrit, searchargs, usinguid);
snprintf(mytime, sizeof(mytime), "%2.3f",
(clock() - start) / (double) CLOCKS_PER_SEC);
if (CONFIG_TIMING_VERBOSE) {
char *s = sortcrit_as_string(sortcrit);
syslog(LOG_DEBUG, "SORT (%s) processing time: %d msg in %s sec",
s, n, mytime);
free(s);
}
prot_printf(imapd_out, "%s OK %s (%d msgs in %s secs)\r\n", tag,
error_message(IMAP_OK_COMPLETED), n, mytime);
freesortcrit(sortcrit);
freesearchargs(searchargs);
return;
error:
eatline(imapd_in, (c == EOF ? ' ' : c));
freesortcrit(sortcrit);
freesearchargs(searchargs);
}
| 0
|
60,029
|
void proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupConfigs &extra_proxy_group, bool clashR, extra_settings &ext)
{
YAML::Node proxies, singleproxy, singlegroup, original_groups;
std::vector<Proxy> nodelist;
string_array remarks_list, filtered_nodelist;
/// proxies style
bool block = false, compact = false;
switch(hash_(ext.clash_proxies_style))
{
case "block"_hash:
block = true;
break;
default:
case "flow"_hash:
break;
case "compact"_hash:
compact = true;
break;
}
for(Proxy &x : nodes)
{
singleproxy.reset();
std::string type = getProxyTypeName(x.Type);
std::string remark, pluginopts = replaceAllDistinct(x.PluginOption, ";", "&");
if(ext.append_proxy_type)
x.Remark = "[" + type + "] " + x.Remark;
processRemark(x.Remark, remark, remarks_list, false);
tribool udp = ext.udp;
tribool scv = ext.skip_cert_verify;
udp.define(x.UDP);
scv.define(x.AllowInsecure);
singleproxy["name"] = remark;
singleproxy["server"] = x.Hostname;
singleproxy["port"] = x.Port;
switch(x.Type)
{
case ProxyType::Shadowsocks:
//latest clash core removed support for chacha20 encryption
if(ext.filter_deprecated && x.EncryptMethod == "chacha20")
continue;
singleproxy["type"] = "ss";
singleproxy["cipher"] = x.EncryptMethod;
singleproxy["password"] = x.Password;
if(std::all_of(x.Password.begin(), x.Password.end(), ::isdigit) && !x.Password.empty())
singleproxy["password"].SetTag("str");
switch(hash_(x.Plugin))
{
case "simple-obfs"_hash:
case "obfs-local"_hash:
singleproxy["plugin"] = "obfs";
singleproxy["plugin-opts"]["mode"] = urlDecode(getUrlArg(pluginopts, "obfs"));
singleproxy["plugin-opts"]["host"] = urlDecode(getUrlArg(pluginopts, "obfs-host"));
break;
case "v2ray-plugin"_hash:
singleproxy["plugin"] = "v2ray-plugin";
singleproxy["plugin-opts"]["mode"] = getUrlArg(pluginopts, "mode");
singleproxy["plugin-opts"]["host"] = getUrlArg(pluginopts, "host");
singleproxy["plugin-opts"]["path"] = getUrlArg(pluginopts, "path");
singleproxy["plugin-opts"]["tls"] = pluginopts.find("tls") != std::string::npos;
singleproxy["plugin-opts"]["mux"] = pluginopts.find("mux") != std::string::npos;
if(!scv.is_undef())
singleproxy["plugin-opts"]["skip-cert-verify"] = scv.get();
break;
}
break;
case ProxyType::VMess:
singleproxy["type"] = "vmess";
singleproxy["uuid"] = x.UserId;
singleproxy["alterId"] = x.AlterId;
singleproxy["cipher"] = x.EncryptMethod;
singleproxy["tls"] = x.TLSSecure;
if(!scv.is_undef())
singleproxy["skip-cert-verify"] = scv.get();
if(!x.ServerName.empty())
singleproxy["servername"] = x.ServerName;
switch(hash_(x.TransferProtocol))
{
case "tcp"_hash:
break;
case "ws"_hash:
singleproxy["network"] = x.TransferProtocol;
if(ext.clash_new_field_name)
{
singleproxy["ws-opts"]["path"] = x.Path;
if(!x.Host.empty())
singleproxy["ws-opts"]["headers"]["Host"] = x.Host;
if(!x.Edge.empty())
singleproxy["ws-opts"]["headers"]["Edge"] = x.Edge;
}
else
{
singleproxy["ws-path"] = x.Path;
if(!x.Host.empty())
singleproxy["ws-headers"]["Host"] = x.Host;
if(!x.Edge.empty())
singleproxy["ws-headers"]["Edge"] = x.Edge;
}
break;
case "http"_hash:
singleproxy["network"] = x.TransferProtocol;
singleproxy["http-opts"]["method"] = "GET";
singleproxy["http-opts"]["path"].push_back(x.Path);
if(!x.Host.empty())
singleproxy["http-opts"]["headers"]["Host"].push_back(x.Host);
if(!x.Edge.empty())
singleproxy["http-opts"]["headers"]["Edge"].push_back(x.Edge);
break;
case "h2"_hash:
singleproxy["network"] = x.TransferProtocol;
singleproxy["h2-opts"]["path"] = x.Path;
if(!x.Host.empty())
singleproxy["h2-opts"]["host"].push_back(x.Host);
break;
case "grpc"_hash:
singleproxy["network"] = x.TransferProtocol;
singleproxy["servername"] = x.Host;
singleproxy["grpc-opts"]["grpc-service-name"] = x.Path;
break;
default:
continue;
}
break;
case ProxyType::ShadowsocksR:
//ignoring all nodes with unsupported obfs, protocols and encryption
if(ext.filter_deprecated)
{
if(!clashR && std::find(clash_ssr_ciphers.cbegin(), clash_ssr_ciphers.cend(), x.EncryptMethod) == clash_ssr_ciphers.cend())
continue;
if(std::find(clashr_protocols.cbegin(), clashr_protocols.cend(), x.Protocol) == clashr_protocols.cend())
continue;
if(std::find(clashr_obfs.cbegin(), clashr_obfs.cend(), x.OBFS) == clashr_obfs.cend())
continue;
}
singleproxy["type"] = "ssr";
singleproxy["cipher"] = x.EncryptMethod == "none" ? "dummy" : x.EncryptMethod;
singleproxy["password"] = x.Password;
if(std::all_of(x.Password.begin(), x.Password.end(), ::isdigit) && !x.Password.empty())
singleproxy["password"].SetTag("str");
singleproxy["protocol"] = x.Protocol;
singleproxy["obfs"] = x.OBFS;
if(clashR)
{
singleproxy["protocolparam"] = x.ProtocolParam;
singleproxy["obfsparam"] = x.OBFSParam;
}
else
{
singleproxy["protocol-param"] = x.ProtocolParam;
singleproxy["obfs-param"] = x.OBFSParam;
}
break;
case ProxyType::SOCKS5:
singleproxy["type"] = "socks5";
if(!x.Username.empty())
singleproxy["username"] = x.Username;
if(!x.Password.empty())
{
singleproxy["password"] = x.Password;
if(std::all_of(x.Password.begin(), x.Password.end(), ::isdigit))
singleproxy["password"].SetTag("str");
}
if(!scv.is_undef())
singleproxy["skip-cert-verify"] = scv.get();
break;
case ProxyType::HTTP:
case ProxyType::HTTPS:
singleproxy["type"] = "http";
if(!x.Username.empty())
singleproxy["username"] = x.Username;
if(!x.Password.empty())
{
singleproxy["password"] = x.Password;
if(std::all_of(x.Password.begin(), x.Password.end(), ::isdigit))
singleproxy["password"].SetTag("str");
}
singleproxy["tls"] = x.TLSSecure;
if(!scv.is_undef())
singleproxy["skip-cert-verify"] = scv.get();
break;
case ProxyType::Trojan:
singleproxy["type"] = "trojan";
singleproxy["password"] = x.Password;
if(!x.Host.empty())
singleproxy["sni"] = x.Host;
if(std::all_of(x.Password.begin(), x.Password.end(), ::isdigit) && !x.Password.empty())
singleproxy["password"].SetTag("str");
if(!scv.is_undef())
singleproxy["skip-cert-verify"] = scv.get();
switch(hash_(x.TransferProtocol))
{
case "tcp"_hash:
break;
case "grpc"_hash:
singleproxy["network"] = x.TransferProtocol;
if(!x.Path.empty())
singleproxy["grpc-opts"]["grpc-service-name"] = x.Path;
break;
case "ws"_hash:
singleproxy["network"] = x.TransferProtocol;
singleproxy["ws-opts"]["path"] = x.Path;
if(!x.Host.empty())
singleproxy["ws-opts"]["headers"]["Host"] = x.Host;
break;
}
break;
case ProxyType::Snell:
singleproxy["type"] = "snell";
singleproxy["psk"] = x.Password;
if(x.SnellVersion != 0)
singleproxy["version"] = x.SnellVersion;
if(!x.OBFS.empty())
{
singleproxy["obfs-opts"]["mode"] = x.OBFS;
if(!x.Host.empty())
singleproxy["obfs-opts"]["host"] = x.Host;
}
if(std::all_of(x.Password.begin(), x.Password.end(), ::isdigit) && !x.Password.empty())
singleproxy["password"].SetTag("str");
break;
default:
continue;
}
if(udp)
singleproxy["udp"] = true;
if(block)
singleproxy.SetStyle(YAML::EmitterStyle::Block);
else
singleproxy.SetStyle(YAML::EmitterStyle::Flow);
proxies.push_back(singleproxy);
remarks_list.emplace_back(std::move(remark));
nodelist.emplace_back(x);
}
if(compact)
proxies.SetStyle(YAML::EmitterStyle::Flow);
if(ext.nodelist)
{
YAML::Node provider;
provider["proxies"] = proxies;
yamlnode.reset(provider);
return;
}
if(ext.clash_new_field_name)
yamlnode["proxies"] = proxies;
else
yamlnode["Proxy"] = proxies;
for(const ProxyGroupConfig &x : extra_proxy_group)
{
singlegroup.reset();
eraseElements(filtered_nodelist);
singlegroup["name"] = x.Name;
singlegroup["type"] = x.TypeStr();
switch(x.Type)
{
case ProxyGroupType::Select:
case ProxyGroupType::Relay:
break;
case ProxyGroupType::LoadBalance:
singlegroup["strategy"] = x.StrategyStr();
[[fallthrough]];
case ProxyGroupType::URLTest:
if(!x.Lazy.is_undef())
singlegroup["lazy"] = x.Lazy.get();
[[fallthrough]];
case ProxyGroupType::Fallback:
singlegroup["url"] = x.Url;
if(x.Interval > 0)
singlegroup["interval"] = x.Interval;
if(x.Tolerance > 0)
singlegroup["tolerance"] = x.Tolerance;
break;
default:
continue;
}
if(!x.DisableUdp.is_undef())
singlegroup["disable-udp"] = x.DisableUdp.get();
for(const auto& y : x.Proxies)
groupGenerate(y, nodelist, filtered_nodelist, true, ext);
if(!x.UsingProvider.empty())
singlegroup["use"] = x.UsingProvider;
else
{
if(filtered_nodelist.empty())
filtered_nodelist.emplace_back("DIRECT");
}
if(!filtered_nodelist.empty())
singlegroup["proxies"] = filtered_nodelist;
//singlegroup.SetStyle(YAML::EmitterStyle::Flow);
bool replace_flag = false;
for(unsigned int i = 0; i < original_groups.size(); i++)
{
if(original_groups[i]["name"].as<std::string>() == x.Name)
{
original_groups[i] = singlegroup;
replace_flag = true;
break;
}
}
if(!replace_flag)
original_groups.push_back(singlegroup);
}
if(ext.clash_new_field_name)
yamlnode["proxy-groups"] = original_groups;
else
yamlnode["Proxy Group"] = original_groups;
}
| 0
|
473,779
|
static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
struct ieee80211_channel *channel,
struct ieee80211_mgmt *mgmt,
const u8 *country_ie, u8 country_ie_len,
const u8 *pwr_constr_ie,
const u8 *cisco_dtpc_ie)
{
bool has_80211h_pwr = false, has_cisco_pwr = false;
int chan_pwr = 0, pwr_reduction_80211h = 0;
int pwr_level_cisco, pwr_level_80211h;
int new_ap_level;
__le16 capab = mgmt->u.probe_resp.capab_info;
if (country_ie &&
(capab & cpu_to_le16(WLAN_CAPABILITY_SPECTRUM_MGMT) ||
capab & cpu_to_le16(WLAN_CAPABILITY_RADIO_MEASURE))) {
has_80211h_pwr = ieee80211_find_80211h_pwr_constr(
sdata, channel, country_ie, country_ie_len,
pwr_constr_ie, &chan_pwr, &pwr_reduction_80211h);
pwr_level_80211h =
max_t(int, 0, chan_pwr - pwr_reduction_80211h);
}
if (cisco_dtpc_ie) {
ieee80211_find_cisco_dtpc(
sdata, channel, cisco_dtpc_ie, &pwr_level_cisco);
has_cisco_pwr = true;
}
if (!has_80211h_pwr && !has_cisco_pwr)
return 0;
/* If we have both 802.11h and Cisco DTPC, apply both limits
* by picking the smallest of the two power levels advertised.
*/
if (has_80211h_pwr &&
(!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) {
new_ap_level = pwr_level_80211h;
if (sdata->ap_power_level == new_ap_level)
return 0;
sdata_dbg(sdata,
"Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n",
pwr_level_80211h, chan_pwr, pwr_reduction_80211h,
sdata->u.mgd.bssid);
} else { /* has_cisco_pwr is always true here. */
new_ap_level = pwr_level_cisco;
if (sdata->ap_power_level == new_ap_level)
return 0;
sdata_dbg(sdata,
"Limiting TX power to %d dBm as advertised by %pM\n",
pwr_level_cisco, sdata->u.mgd.bssid);
}
sdata->ap_power_level = new_ap_level;
if (__ieee80211_recalc_txpower(sdata))
return BSS_CHANGED_TXPOWER;
return 0;
}
| 0
|
496,303
|
static bool ad_convert_xattr(vfs_handle_struct *handle,
struct adouble *ad,
const struct smb_filename *smb_fname,
const char *catia_mappings,
bool *converted_xattr)
{
static struct char_mappings **string_replace_cmaps = NULL;
uint16_t i;
int saved_errno = 0;
NTSTATUS status;
int rc;
bool ok;
*converted_xattr = false;
if (ad_getentrylen(ad, ADEID_FINDERI) == ADEDLEN_FINDERI) {
return true;
}
if (string_replace_cmaps == NULL) {
const char **mappings = NULL;
mappings = str_list_make_v3_const(
talloc_tos(), catia_mappings, NULL);
if (mappings == NULL) {
return false;
}
string_replace_cmaps = string_replace_init_map(
handle->conn->sconn, mappings);
TALLOC_FREE(mappings);
}
for (i = 0; i < ad->adx_header.adx_num_attrs; i++) {
struct ad_xattr_entry *e = &ad->adx_entries[i];
char *mapped_name = NULL;
char *tmp = NULL;
struct smb_filename *stream_name = NULL;
files_struct *fsp = NULL;
ssize_t nwritten;
status = string_replace_allocate(handle->conn,
e->adx_name,
string_replace_cmaps,
talloc_tos(),
&mapped_name,
vfs_translate_to_windows);
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED))
{
DBG_ERR("string_replace_allocate failed\n");
ok = false;
goto fail;
}
tmp = mapped_name;
mapped_name = talloc_asprintf(talloc_tos(), ":%s", tmp);
TALLOC_FREE(tmp);
if (mapped_name == NULL) {
ok = false;
goto fail;
}
stream_name = synthetic_smb_fname(talloc_tos(),
smb_fname->base_name,
mapped_name,
NULL,
smb_fname->twrp,
smb_fname->flags);
TALLOC_FREE(mapped_name);
if (stream_name == NULL) {
DBG_ERR("synthetic_smb_fname failed\n");
ok = false;
goto fail;
}
DBG_DEBUG("stream_name: %s\n", smb_fname_str_dbg(stream_name));
rc = vfs_stat(handle->conn, stream_name);
if (rc == -1 && errno != ENOENT) {
ok = false;
goto fail;
}
status = openat_pathref_fsp(handle->conn->cwd_fsp, stream_name);
if (!NT_STATUS_IS_OK(status) &&
!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND))
{
ok = false;
goto fail;
}
status = SMB_VFS_CREATE_FILE(
handle->conn, /* conn */
NULL, /* req */
stream_name, /* fname */
FILE_GENERIC_WRITE, /* access_mask */
FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
FILE_OPEN_IF, /* create_disposition */
0, /* create_options */
0, /* file_attributes */
INTERNAL_OPEN_ONLY, /* oplock_request */
NULL, /* lease */
0, /* allocation_size */
0, /* private_flags */
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL, /* psbuf */
NULL, NULL); /* create context */
TALLOC_FREE(stream_name);
if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("SMB_VFS_CREATE_FILE failed\n");
ok = false;
goto fail;
}
nwritten = SMB_VFS_PWRITE(fsp,
ad->ad_data + e->adx_offset,
e->adx_length,
0);
if (nwritten == -1) {
DBG_ERR("SMB_VFS_PWRITE failed\n");
saved_errno = errno;
close_file(NULL, fsp, ERROR_CLOSE);
errno = saved_errno;
ok = false;
goto fail;
}
status = close_file(NULL, fsp, NORMAL_CLOSE);
if (!NT_STATUS_IS_OK(status)) {
ok = false;
goto fail;
}
fsp = NULL;
}
ad->adx_header.adx_num_attrs = 0;
TALLOC_FREE(ad->adx_entries);
ad_setentrylen(ad, ADEID_FINDERI, ADEDLEN_FINDERI);
rc = ad_fset(handle, ad, ad->ad_fsp);
if (rc != 0) {
DBG_ERR("ad_fset on [%s] failed: %s\n",
fsp_str_dbg(ad->ad_fsp), strerror(errno));
ok = false;
goto fail;
}
ok = ad_convert_move_reso(handle, ad, smb_fname);
if (!ok) {
goto fail;
}
*converted_xattr = true;
ok = true;
fail:
return ok;
}
| 0
|
157,875
|
void Pipe::handle_ack(uint64_t seq)
{
lsubdout(msgr->cct, ms, 15) << "reader got ack seq " << seq << dendl;
// trim sent list
while (!sent.empty() &&
sent.front()->get_seq() <= seq) {
Message *m = sent.front();
sent.pop_front();
lsubdout(msgr->cct, ms, 10) << "reader got ack seq "
<< seq << " >= " << m->get_seq() << " on " << m << " " << *m << dendl;
m->put();
}
}
| 0
|
72,988
|
static OPJ_BOOL opj_tcd_mct_decode(opj_tcd_t *p_tcd, opj_event_mgr_t *p_manager)
{
opj_tcd_tile_t * l_tile = p_tcd->tcd_image->tiles;
opj_tcp_t * l_tcp = p_tcd->tcp;
opj_tcd_tilecomp_t * l_tile_comp = l_tile->comps;
OPJ_UINT32 l_samples, i;
if (! l_tcp->mct) {
return OPJ_TRUE;
}
l_samples = (OPJ_UINT32)((l_tile_comp->x1 - l_tile_comp->x0) *
(l_tile_comp->y1 - l_tile_comp->y0));
if (l_tile->numcomps >= 3) {
/* testcase 1336.pdf.asan.47.376 */
if ((l_tile->comps[0].x1 - l_tile->comps[0].x0) * (l_tile->comps[0].y1 -
l_tile->comps[0].y0) < (OPJ_INT32)l_samples ||
(l_tile->comps[1].x1 - l_tile->comps[1].x0) * (l_tile->comps[1].y1 -
l_tile->comps[1].y0) < (OPJ_INT32)l_samples ||
(l_tile->comps[2].x1 - l_tile->comps[2].x0) * (l_tile->comps[2].y1 -
l_tile->comps[2].y0) < (OPJ_INT32)l_samples) {
opj_event_msg(p_manager, EVT_ERROR,
"Tiles don't all have the same dimension. Skip the MCT step.\n");
return OPJ_FALSE;
} else if (l_tcp->mct == 2) {
OPJ_BYTE ** l_data;
if (! l_tcp->m_mct_decoding_matrix) {
return OPJ_TRUE;
}
l_data = (OPJ_BYTE **) opj_malloc(l_tile->numcomps * sizeof(OPJ_BYTE*));
if (! l_data) {
return OPJ_FALSE;
}
for (i = 0; i < l_tile->numcomps; ++i) {
l_data[i] = (OPJ_BYTE*) l_tile_comp->data;
++l_tile_comp;
}
if (! opj_mct_decode_custom(/* MCT data */
(OPJ_BYTE*) l_tcp->m_mct_decoding_matrix,
/* size of components */
l_samples,
/* components */
l_data,
/* nb of components (i.e. size of pData) */
l_tile->numcomps,
/* tells if the data is signed */
p_tcd->image->comps->sgnd)) {
opj_free(l_data);
return OPJ_FALSE;
}
opj_free(l_data);
} else {
if (l_tcp->tccps->qmfbid == 1) {
opj_mct_decode(l_tile->comps[0].data,
l_tile->comps[1].data,
l_tile->comps[2].data,
l_samples);
} else {
opj_mct_decode_real((OPJ_FLOAT32*)l_tile->comps[0].data,
(OPJ_FLOAT32*)l_tile->comps[1].data,
(OPJ_FLOAT32*)l_tile->comps[2].data,
l_samples);
}
}
} else {
opj_event_msg(p_manager, EVT_ERROR,
"Number of components (%d) is inconsistent with a MCT. Skip the MCT step.\n",
l_tile->numcomps);
}
return OPJ_TRUE;
}
| 0
|
253,558
|
static int netjoin_set_nickmode(IRC_SERVER_REC *server, NETJOIN_REC *rec,
const char *channel, char prefix)
{
GSList *pos;
const char *flags;
char *found_chan = NULL;
for (pos = rec->now_channels; pos != NULL; pos = pos->next) {
char *chan = pos->data;
if (strcasecmp(chan+1, channel) == 0) {
found_chan = chan;
break;
}
}
if (found_chan == NULL)
return FALSE;
flags = server->get_nick_flags(SERVER(server));
while (*flags != '\0') {
if (found_chan[0] == *flags)
break;
if (prefix == *flags) {
found_chan[0] = prefix;
break;
}
flags++;
}
return TRUE;
}
| 0
|
94,963
|
static void usb_parse_ssp_isoc_endpoint_companion(struct device *ddev,
int cfgno, int inum, int asnum, struct usb_host_endpoint *ep,
unsigned char *buffer, int size)
{
struct usb_ssp_isoc_ep_comp_descriptor *desc;
/*
* The SuperSpeedPlus Isoc endpoint companion descriptor immediately
* follows the SuperSpeed Endpoint Companion descriptor
*/
desc = (struct usb_ssp_isoc_ep_comp_descriptor *) buffer;
if (desc->bDescriptorType != USB_DT_SSP_ISOC_ENDPOINT_COMP ||
size < USB_DT_SSP_ISOC_EP_COMP_SIZE) {
dev_warn(ddev, "Invalid SuperSpeedPlus isoc endpoint companion"
"for config %d interface %d altsetting %d ep %d.\n",
cfgno, inum, asnum, ep->desc.bEndpointAddress);
return;
}
memcpy(&ep->ssp_isoc_ep_comp, desc, USB_DT_SSP_ISOC_EP_COMP_SIZE);
}
| 0
|
160,354
|
ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct file *lower_file = ecryptfs_file_to_lower(file);
long rc = -ENOIOCTLCMD;
if (!lower_file->f_op->compat_ioctl)
return rc;
switch (cmd) {
case FS_IOC32_GETFLAGS:
case FS_IOC32_SETFLAGS:
case FS_IOC32_GETVERSION:
case FS_IOC32_SETVERSION:
rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
fsstack_copy_attr_all(file_inode(file), file_inode(lower_file));
return rc;
default:
return rc;
}
}
| 0
|
90,416
|
static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
{
pvc_device *pvc = dev->ml_priv;
if (pvc->state.active) {
if (dev->type == ARPHRD_ETHER) {
int pad = ETH_ZLEN - skb->len;
if (pad > 0) { /* Pad the frame with zeros */
int len = skb->len;
if (skb_tailroom(skb) < pad)
if (pskb_expand_head(skb, 0, pad,
GFP_ATOMIC)) {
dev->stats.tx_dropped++;
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
skb_put(skb, pad);
memset(skb->data + len, 0, pad);
}
skb->protocol = cpu_to_be16(ETH_P_802_3);
}
if (!fr_hard_header(&skb, pvc->dlci)) {
dev->stats.tx_bytes += skb->len;
dev->stats.tx_packets++;
if (pvc->state.fecn) /* TX Congestion counter */
dev->stats.tx_compressed++;
skb->dev = pvc->frad;
dev_queue_xmit(skb);
return NETDEV_TX_OK;
}
}
dev->stats.tx_dropped++;
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
| 0
|
126,299
|
DisplayNameValueList(char * buffer, int bufsize)
{
struct NameValueParserData pdata;
struct NameValue * nv;
ParseNameValue(buffer, bufsize, &pdata);
for(nv = pdata.l_head;
nv != NULL;
nv = nv->l_next)
{
printf("%s = %s\n", nv->name, nv->value);
}
ClearNameValueList(&pdata);
}
| 0
|
261,881
|
_message_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata)
{
log_debug("Message stanza handler fired");
char *text;
size_t text_size;
xmpp_stanza_to_text(stanza, &text, &text_size);
gboolean cont = plugins_on_message_stanza_receive(text);
xmpp_free(connection_get_ctx(), text);
if (!cont) {
return 1;
}
const char *type = xmpp_stanza_get_type(stanza);
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
_handle_error(stanza);
}
if (g_strcmp0(type, STANZA_TYPE_GROUPCHAT) == 0) {
_handle_groupchat(stanza);
}
xmpp_stanza_t *mucuser = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER);
if (mucuser) {
_handel_muc_user(stanza);
}
xmpp_stanza_t *conference = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE);
if (conference) {
_handle_conference(stanza);
}
xmpp_stanza_t *captcha = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CAPTCHA);
if (captcha) {
_handle_captcha(stanza);
}
xmpp_stanza_t *receipts = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS);
if (receipts) {
_handle_receipt_received(stanza);
}
_handle_chat(stanza);
return 1;
}
| 0
|
423,725
|
setmodtime(dns_zone_t *zone, isc_time_t *expiretime) {
isc_result_t result;
isc_time_t when;
isc_interval_t i;
isc_interval_set(&i, zone->expire, 0);
result = isc_time_subtract(expiretime, &i, &when);
if (result != ISC_R_SUCCESS)
return;
result = ISC_R_FAILURE;
if (zone->journal != NULL)
result = isc_file_settime(zone->journal, &when);
if (result == ISC_R_SUCCESS &&
!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP) &&
!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP))
result = isc_file_settime(zone->masterfile, &when);
else if (result != ISC_R_SUCCESS)
result = isc_file_settime(zone->masterfile, &when);
/*
* Someone removed the file from underneath us!
*/
if (result == ISC_R_FILENOTFOUND) {
zone_needdump(zone, DNS_DUMP_DELAY);
} else if (result != ISC_R_SUCCESS)
dns_zone_log(zone, ISC_LOG_ERROR, "refresh: could not set "
"file modification time of '%s': %s",
zone->masterfile, dns_result_totext(result));
}
| 0
|
206,902
|
void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c)
{
int i;
int lx, ly;
typedef void (*image_line)(gdImagePtr im, int x1, int y1, int x2, int y2, int color);
image_line draw_line;
if (n <= 0) {
return;
}
/* Let it be known that we are drawing a polygon so that the opacity
* mask doesn't get cleared after each line.
*/
if (c == gdAntiAliased) {
im->AA_polygon = 1;
}
if ( im->antialias) {
draw_line = gdImageAALine;
} else {
draw_line = gdImageLine;
}
lx = p->x;
ly = p->y;
draw_line(im, lx, ly, p[n - 1].x, p[n - 1].y, c);
for (i = 1; i < n; i++) {
p++;
draw_line(im, lx, ly, p->x, p->y, c);
lx = p->x;
ly = p->y;
}
if (c == gdAntiAliased) {
im->AA_polygon = 0;
gdImageAABlend(im);
}
}
| 0
|
143,243
|
file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
{
if (!(m->flag & UNSIGNED)) {
switch(m->type) {
/*
* Do not remove the casts below. They are
* vital. When later compared with the data,
* the sign extension must have happened.
*/
case FILE_BYTE:
v = (signed char) v;
break;
case FILE_SHORT:
case FILE_BESHORT:
case FILE_LESHORT:
v = (short) v;
break;
case FILE_DATE:
case FILE_BEDATE:
case FILE_LEDATE:
case FILE_MEDATE:
case FILE_LDATE:
case FILE_BELDATE:
case FILE_LELDATE:
case FILE_MELDATE:
case FILE_LONG:
case FILE_BELONG:
case FILE_LELONG:
case FILE_MELONG:
case FILE_FLOAT:
case FILE_BEFLOAT:
case FILE_LEFLOAT:
v = (int32_t) v;
break;
case FILE_QUAD:
case FILE_BEQUAD:
case FILE_LEQUAD:
case FILE_QDATE:
case FILE_QLDATE:
case FILE_QWDATE:
case FILE_BEQDATE:
case FILE_BEQLDATE:
case FILE_BEQWDATE:
case FILE_LEQDATE:
case FILE_LEQLDATE:
case FILE_LEQWDATE:
case FILE_DOUBLE:
case FILE_BEDOUBLE:
case FILE_LEDOUBLE:
v = (int64_t) v;
break;
case FILE_STRING:
case FILE_PSTRING:
case FILE_BESTRING16:
case FILE_LESTRING16:
case FILE_REGEX:
case FILE_SEARCH:
case FILE_DEFAULT:
case FILE_INDIRECT:
case FILE_NAME:
case FILE_USE:
case FILE_CLEAR:
break;
default:
if (ms->flags & MAGIC_CHECK)
file_magwarn(ms, "cannot happen: m->type=%d\n",
m->type);
return ~0U;
}
}
return v;
}
| 0
|
137,656
|
static int set_offload(struct tun_struct *tun, unsigned long arg)
{
netdev_features_t features = 0;
if (arg & TUN_F_CSUM) {
features |= NETIF_F_HW_CSUM;
arg &= ~TUN_F_CSUM;
if (arg & (TUN_F_TSO4|TUN_F_TSO6)) {
if (arg & TUN_F_TSO_ECN) {
features |= NETIF_F_TSO_ECN;
arg &= ~TUN_F_TSO_ECN;
}
if (arg & TUN_F_TSO4)
features |= NETIF_F_TSO;
if (arg & TUN_F_TSO6)
features |= NETIF_F_TSO6;
arg &= ~(TUN_F_TSO4|TUN_F_TSO6);
}
if (arg & TUN_F_UFO) {
features |= NETIF_F_UFO;
arg &= ~TUN_F_UFO;
}
}
/* This gives the user a way to test for new features in future by
* trying to set them. */
if (arg)
return -EINVAL;
tun->set_features = features;
netdev_update_features(tun->dev);
return 0;
}
| 0
|
195,334
|
static unsigned deflateNoCompression(ucvector* out, const unsigned char* data, size_t datasize)
{
/*non compressed deflate block data: 1 bit BFINAL,2 bits BTYPE,(5 bits): it jumps to start of next byte,
2 bytes LEN, 2 bytes NLEN, LEN bytes literal DATA*/
size_t i, j, numdeflateblocks = (datasize + 65534) / 65535;
unsigned datapos = 0;
for(i = 0; i < numdeflateblocks; i++)
{
unsigned BFINAL, BTYPE, LEN, NLEN;
unsigned char firstbyte;
BFINAL = (i == numdeflateblocks - 1);
BTYPE = 0;
firstbyte = (unsigned char)(BFINAL + ((BTYPE & 1) << 1) + ((BTYPE & 2) << 1));
if (!ucvector_push_back(out, firstbyte)) return 83;
LEN = 65535;
if(datasize - datapos < 65535) LEN = (unsigned)datasize - datapos;
NLEN = 65535 - LEN;
if (!ucvector_push_back(out, (unsigned char)(LEN % 256))) return 83;
if (!ucvector_push_back(out, (unsigned char)(LEN / 256))) return 83;
if (!ucvector_push_back(out, (unsigned char)(NLEN % 256))) return 83;
if (!ucvector_push_back(out, (unsigned char)(NLEN / 256))) return 83;
/*Decompressed data*/
for(j = 0; j < 65535 && datapos < datasize; j++)
{
if (!ucvector_push_back(out, data[datapos++])) return 83;
}
}
return 0;
}
| 0
|
361,559
|
static connection_struct *switch_message(uint8 type, struct smb_request *req, int size)
{
int flags;
uint16 session_tag;
connection_struct *conn = NULL;
struct smbd_server_connection *sconn = smbd_server_conn;
errno = 0;
/* Make sure this is an SMB packet. smb_size contains NetBIOS header
* so subtract 4 from it. */
if (!valid_smb_header(req->inbuf)
|| (size < (smb_size - 4))) {
DEBUG(2,("Non-SMB packet of length %d. Terminating server\n",
smb_len(req->inbuf)));
exit_server_cleanly("Non-SMB packet");
}
if (smb_messages[type].fn == NULL) {
DEBUG(0,("Unknown message type %d!\n",type));
smb_dump("Unknown", 1, (char *)req->inbuf, size);
reply_unknown_new(req, type);
return NULL;
}
flags = smb_messages[type].flags;
/* In share mode security we must ignore the vuid. */
session_tag = (lp_security() == SEC_SHARE)
? UID_FIELD_INVALID : req->vuid;
conn = req->conn;
DEBUG(3,("switch message %s (pid %d) conn 0x%lx\n", smb_fn_name(type),
(int)sys_getpid(), (unsigned long)conn));
smb_dump(smb_fn_name(type), 1, (char *)req->inbuf, size);
/* Ensure this value is replaced in the incoming packet. */
SSVAL(req->inbuf,smb_uid,session_tag);
/*
* Ensure the correct username is in current_user_info. This is a
* really ugly bugfix for problems with multiple session_setup_and_X's
* being done and allowing %U and %G substitutions to work correctly.
* There is a reason this code is done here, don't move it unless you
* know what you're doing... :-).
* JRA.
*/
if (session_tag != sconn->smb1.sessions.last_session_tag) {
user_struct *vuser = NULL;
sconn->smb1.sessions.last_session_tag = session_tag;
if(session_tag != UID_FIELD_INVALID) {
vuser = get_valid_user_struct(sconn, session_tag);
if (vuser) {
set_current_user_info(
vuser->server_info->sanitized_username,
vuser->server_info->unix_name,
pdb_get_domain(vuser->server_info
->sam_account));
}
}
}
/* Does this call need to be run as the connected user? */
if (flags & AS_USER) {
/* Does this call need a valid tree connection? */
if (!conn) {
/*
* Amazingly, the error code depends on the command
* (from Samba4).
*/
if (type == SMBntcreateX) {
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
} else {
reply_nterror(req, NT_STATUS_NETWORK_NAME_DELETED);
}
return NULL;
}
if (!change_to_user(conn,session_tag)) {
DEBUG(0, ("Error: Could not change to user. Removing "
"deferred open, mid=%d.\n", req->mid));
reply_force_doserror(req, ERRSRV, ERRbaduid);
return conn;
}
/* All NEED_WRITE and CAN_IPC flags must also have AS_USER. */
/* Does it need write permission? */
if ((flags & NEED_WRITE) && !CAN_WRITE(conn)) {
reply_nterror(req, NT_STATUS_MEDIA_WRITE_PROTECTED);
return conn;
}
/* IPC services are limited */
if (IS_IPC(conn) && !(flags & CAN_IPC)) {
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return conn;
}
} else {
/* This call needs to be run as root */
change_to_root_user();
}
/* load service specific parameters */
if (conn) {
if (req->encrypted) {
conn->encrypted_tid = true;
/* encrypted required from now on. */
conn->encrypt_level = Required;
} else if (ENCRYPTION_REQUIRED(conn)) {
if (req->cmd != SMBtrans2 && req->cmd != SMBtranss2) {
exit_server_cleanly("encryption required "
"on connection");
return conn;
}
}
if (!set_current_service(conn,SVAL(req->inbuf,smb_flg),
(flags & (AS_USER|DO_CHDIR)
?True:False))) {
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return conn;
}
conn->num_smb_operations++;
}
/* does this protocol need to be run as guest? */
if ((flags & AS_GUEST)
&& (!change_to_guest() ||
!check_access(smbd_server_fd(), lp_hostsallow(-1),
lp_hostsdeny(-1)))) {
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return conn;
}
smb_messages[type].fn(req);
return req->conn;
}
| 0
|
470,451
|
void CrwMap::decode0x180e(const CiffComponent& ciffComponent,
const CrwMapping* pCrwMapping,
Image& image,
ByteOrder byteOrder)
{
if (ciffComponent.size() < 8 || ciffComponent.typeId() != unsignedLong) {
return decodeBasic(ciffComponent, pCrwMapping, image, byteOrder);
}
assert(pCrwMapping != 0);
ULongValue v;
v.read(ciffComponent.pData(), 8, byteOrder);
time_t t = v.value_[0];
struct tm* tm = std::localtime(&t);
if (tm) {
const size_t m = 20;
char s[m];
std::strftime(s, m, "%Y:%m:%d %H:%M:%S", tm);
ExifKey key(pCrwMapping->tag_, Internal::groupName(pCrwMapping->ifdId_));
AsciiValue value;
value.read(std::string(s));
image.exifData().add(key, &value);
}
} // CrwMap::decode0x180e
| 0
|
298,237
|
void sctp_assoc_update(struct sctp_association *asoc,
struct sctp_association *new)
{
struct sctp_transport *trans;
struct list_head *pos, *temp;
/* Copy in new parameters of peer. */
asoc->c = new->c;
asoc->peer.rwnd = new->peer.rwnd;
asoc->peer.sack_needed = new->peer.sack_needed;
asoc->peer.auth_capable = new->peer.auth_capable;
asoc->peer.i = new->peer.i;
sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,
asoc->peer.i.initial_tsn, GFP_ATOMIC);
/* Remove any peer addresses not present in the new association. */
list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
trans = list_entry(pos, struct sctp_transport, transports);
if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) {
sctp_assoc_rm_peer(asoc, trans);
continue;
}
if (asoc->state >= SCTP_STATE_ESTABLISHED)
sctp_transport_reset(trans);
}
/* If the case is A (association restart), use
* initial_tsn as next_tsn. If the case is B, use
* current next_tsn in case data sent to peer
* has been discarded and needs retransmission.
*/
if (asoc->state >= SCTP_STATE_ESTABLISHED) {
asoc->next_tsn = new->next_tsn;
asoc->ctsn_ack_point = new->ctsn_ack_point;
asoc->adv_peer_ack_point = new->adv_peer_ack_point;
/* Reinitialize SSN for both local streams
* and peer's streams.
*/
sctp_ssnmap_clear(asoc->ssnmap);
/* Flush the ULP reassembly and ordered queue.
* Any data there will now be stale and will
* cause problems.
*/
sctp_ulpq_flush(&asoc->ulpq);
/* reset the overall association error count so
* that the restarted association doesn't get torn
* down on the next retransmission timer.
*/
asoc->overall_error_count = 0;
} else {
/* Add any peer addresses from the new association. */
list_for_each_entry(trans, &new->peer.transport_addr_list,
transports) {
if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))
sctp_assoc_add_peer(asoc, &trans->ipaddr,
GFP_ATOMIC, trans->state);
}
asoc->ctsn_ack_point = asoc->next_tsn - 1;
asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
if (!asoc->ssnmap) {
/* Move the ssnmap. */
asoc->ssnmap = new->ssnmap;
new->ssnmap = NULL;
}
if (!asoc->assoc_id) {
/* get a new association id since we don't have one
* yet.
*/
sctp_assoc_set_id(asoc, GFP_ATOMIC);
}
}
/* SCTP-AUTH: Save the peer parameters from the new associations
* and also move the association shared keys over
*/
kfree(asoc->peer.peer_random);
asoc->peer.peer_random = new->peer.peer_random;
new->peer.peer_random = NULL;
kfree(asoc->peer.peer_chunks);
asoc->peer.peer_chunks = new->peer.peer_chunks;
new->peer.peer_chunks = NULL;
kfree(asoc->peer.peer_hmacs);
asoc->peer.peer_hmacs = new->peer.peer_hmacs;
new->peer.peer_hmacs = NULL;
sctp_auth_asoc_init_active_key(asoc, GFP_ATOMIC);
}
| 0
|
194,646
|
RenderThreadImpl::~RenderThreadImpl() {
for (std::map<int, mojo::MessagePipeHandle>::iterator it =
pending_render_frame_connects_.begin();
it != pending_render_frame_connects_.end();
++it) {
mojo::CloseRaw(it->second);
}
}
| 0
|
393,765
|
system_read(gnutls_transport_ptr_t ptr, void *data, size_t data_size)
{
return recv(GNUTLS_POINTER_TO_INT(ptr), data, data_size, 0);
}
| 0
|
199,538
|
static MagickBooleanType WritePICTImage(const ImageInfo *image_info,
Image *image)
{
#define MaxCount 128
#define PictCropRegionOp 0x01
#define PictEndOfPictureOp 0xff
#define PictJPEGOp 0x8200
#define PictInfoOp 0x0C00
#define PictInfoSize 512
#define PictPixmapOp 0x9A
#define PictPICTOp 0x98
#define PictVersion 0x11
const StringInfo
*profile;
double
x_resolution,
y_resolution;
MagickBooleanType
status;
MagickOffsetType
offset;
PICTPixmap
pixmap;
PICTRectangle
bounds,
crop_rectangle,
destination_rectangle,
frame_rectangle,
size_rectangle,
source_rectangle;
register const IndexPacket
*indexes;
register const PixelPacket
*p;
register ssize_t
i,
x;
size_t
bytes_per_line,
count,
storage_class;
ssize_t
y;
unsigned char
*buffer,
*packed_scanline,
*scanline;
unsigned short
base_address,
row_bytes,
transfer_mode;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if ((image->columns > 65535L) || (image->rows > 65535L))
ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace);
/*
Initialize image info.
*/
size_rectangle.top=0;
size_rectangle.left=0;
size_rectangle.bottom=(short) image->rows;
size_rectangle.right=(short) image->columns;
frame_rectangle=size_rectangle;
crop_rectangle=size_rectangle;
source_rectangle=size_rectangle;
destination_rectangle=size_rectangle;
base_address=0xff;
row_bytes=(unsigned short) (image->columns | 0x8000);
bounds.top=0;
bounds.left=0;
bounds.bottom=(short) image->rows;
bounds.right=(short) image->columns;
pixmap.version=0;
pixmap.pack_type=0;
pixmap.pack_size=0;
pixmap.pixel_type=0;
pixmap.bits_per_pixel=8;
pixmap.component_count=1;
pixmap.component_size=8;
pixmap.plane_bytes=0;
pixmap.table=0;
pixmap.reserved=0;
transfer_mode=0;
x_resolution=image->x_resolution != 0.0 ? image->x_resolution :
DefaultResolution;
y_resolution=image->y_resolution != 0.0 ? image->y_resolution :
DefaultResolution;
storage_class=image->storage_class;
if (image_info->compression == JPEGCompression)
storage_class=DirectClass;
if (storage_class == DirectClass)
{
pixmap.component_count=image->matte != MagickFalse ? 4 : 3;
pixmap.pixel_type=16;
pixmap.bits_per_pixel=32;
pixmap.pack_type=0x04;
transfer_mode=0x40;
row_bytes=(unsigned short) ((4*image->columns) | 0x8000);
}
/*
Allocate memory.
*/
bytes_per_line=image->columns;
if (storage_class == DirectClass)
bytes_per_line*=image->matte != MagickFalse ? 4 : 3;
buffer=(unsigned char *) AcquireQuantumMemory(PictInfoSize,sizeof(*buffer));
packed_scanline=(unsigned char *) AcquireQuantumMemory((size_t)
(row_bytes+MaxCount),sizeof(*packed_scanline));
scanline=(unsigned char *) AcquireQuantumMemory(row_bytes,sizeof(*scanline));
if ((buffer == (unsigned char *) NULL) ||
(packed_scanline == (unsigned char *) NULL) ||
(scanline == (unsigned char *) NULL))
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
(void) ResetMagickMemory(scanline,0,row_bytes);
(void) ResetMagickMemory(packed_scanline,0,(size_t) (row_bytes+MaxCount));
/*
Write header, header size, size bounding box, version, and reserved.
*/
(void) ResetMagickMemory(buffer,0,PictInfoSize);
(void) WriteBlob(image,PictInfoSize,buffer);
(void) WriteBlobMSBShort(image,0);
(void) WriteBlobMSBShort(image,(unsigned short) size_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) size_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) size_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) size_rectangle.right);
(void) WriteBlobMSBShort(image,PictVersion);
(void) WriteBlobMSBShort(image,0x02ff); /* version #2 */
(void) WriteBlobMSBShort(image,PictInfoOp);
(void) WriteBlobMSBLong(image,0xFFFE0000UL);
/*
Write full size of the file, resolution, frame bounding box, and reserved.
*/
(void) WriteBlobMSBShort(image,(unsigned short) x_resolution);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) y_resolution);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) frame_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) frame_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) frame_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) frame_rectangle.right);
(void) WriteBlobMSBLong(image,0x00000000L);
profile=GetImageProfile(image,"iptc");
if (profile != (StringInfo *) NULL)
{
(void) WriteBlobMSBShort(image,0xa1);
(void) WriteBlobMSBShort(image,0x1f2);
(void) WriteBlobMSBShort(image,(unsigned short)
(GetStringInfoLength(profile)+4));
(void) WriteBlobString(image,"8BIM");
(void) WriteBlob(image,GetStringInfoLength(profile),
GetStringInfoDatum(profile));
}
profile=GetImageProfile(image,"icc");
if (profile != (StringInfo *) NULL)
{
(void) WriteBlobMSBShort(image,0xa1);
(void) WriteBlobMSBShort(image,0xe0);
(void) WriteBlobMSBShort(image,(unsigned short)
(GetStringInfoLength(profile)+4));
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlob(image,GetStringInfoLength(profile),
GetStringInfoDatum(profile));
(void) WriteBlobMSBShort(image,0xa1);
(void) WriteBlobMSBShort(image,0xe0);
(void) WriteBlobMSBShort(image,4);
(void) WriteBlobMSBLong(image,0x00000002UL);
}
/*
Write crop region opcode and crop bounding box.
*/
(void) WriteBlobMSBShort(image,PictCropRegionOp);
(void) WriteBlobMSBShort(image,0xa);
(void) WriteBlobMSBShort(image,(unsigned short) crop_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) crop_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) crop_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) crop_rectangle.right);
if (image_info->compression == JPEGCompression)
{
Image
*jpeg_image;
ImageInfo
*jpeg_info;
size_t
length;
unsigned char
*blob;
jpeg_image=CloneImage(image,0,0,MagickTrue,&image->exception);
if (jpeg_image == (Image *) NULL)
{
(void) CloseBlob(image);
return(MagickFalse);
}
jpeg_info=CloneImageInfo(image_info);
(void) CopyMagickString(jpeg_info->magick,"JPEG",MaxTextExtent);
length=0;
blob=(unsigned char *) ImageToBlob(jpeg_info,jpeg_image,&length,
&image->exception);
jpeg_info=DestroyImageInfo(jpeg_info);
if (blob == (unsigned char *) NULL)
return(MagickFalse);
jpeg_image=DestroyImage(jpeg_image);
(void) WriteBlobMSBShort(image,PictJPEGOp);
(void) WriteBlobMSBLong(image,(unsigned int) length+154);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBLong(image,0x00010000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00010000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x40000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00400000UL);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) image->rows);
(void) WriteBlobMSBShort(image,(unsigned short) image->columns);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,768);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00566A70UL);
(void) WriteBlobMSBLong(image,0x65670000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000001UL);
(void) WriteBlobMSBLong(image,0x00016170UL);
(void) WriteBlobMSBLong(image,0x706C0000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBShort(image,768);
(void) WriteBlobMSBShort(image,(unsigned short) image->columns);
(void) WriteBlobMSBShort(image,(unsigned short) image->rows);
(void) WriteBlobMSBShort(image,(unsigned short) x_resolution);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) y_resolution);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x87AC0001UL);
(void) WriteBlobMSBLong(image,0x0B466F74UL);
(void) WriteBlobMSBLong(image,0x6F202D20UL);
(void) WriteBlobMSBLong(image,0x4A504547UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x00000000UL);
(void) WriteBlobMSBLong(image,0x0018FFFFUL);
(void) WriteBlob(image,length,blob);
if ((length & 0x01) != 0)
(void) WriteBlobByte(image,'\0');
blob=(unsigned char *) RelinquishMagickMemory(blob);
}
/*
Write picture opcode, row bytes, and picture bounding box, and version.
*/
if (storage_class == PseudoClass)
(void) WriteBlobMSBShort(image,PictPICTOp);
else
{
(void) WriteBlobMSBShort(image,PictPixmapOp);
(void) WriteBlobMSBLong(image,(size_t) base_address);
}
(void) WriteBlobMSBShort(image,(unsigned short) (row_bytes | 0x8000));
(void) WriteBlobMSBShort(image,(unsigned short) bounds.top);
(void) WriteBlobMSBShort(image,(unsigned short) bounds.left);
(void) WriteBlobMSBShort(image,(unsigned short) bounds.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) bounds.right);
/*
Write pack type, pack size, resolution, pixel type, and pixel size.
*/
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.version);
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.pack_type);
(void) WriteBlobMSBLong(image,(unsigned int) pixmap.pack_size);
(void) WriteBlobMSBShort(image,(unsigned short) (x_resolution+0.5));
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) (y_resolution+0.5));
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.pixel_type);
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.bits_per_pixel);
/*
Write component count, size, plane bytes, table size, and reserved.
*/
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.component_count);
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.component_size);
(void) WriteBlobMSBLong(image,(unsigned int) pixmap.plane_bytes);
(void) WriteBlobMSBLong(image,(unsigned int) pixmap.table);
(void) WriteBlobMSBLong(image,(unsigned int) pixmap.reserved);
if (storage_class == PseudoClass)
{
/*
Write image colormap.
*/
(void) WriteBlobMSBLong(image,0x00000000L); /* color seed */
(void) WriteBlobMSBShort(image,0L); /* color flags */
(void) WriteBlobMSBShort(image,(unsigned short) (image->colors-1));
for (i=0; i < (ssize_t) image->colors; i++)
{
(void) WriteBlobMSBShort(image,(unsigned short) i);
(void) WriteBlobMSBShort(image,ScaleQuantumToShort(
image->colormap[i].red));
(void) WriteBlobMSBShort(image,ScaleQuantumToShort(
image->colormap[i].green));
(void) WriteBlobMSBShort(image,ScaleQuantumToShort(
image->colormap[i].blue));
}
}
/*
Write source and destination rectangle.
*/
(void) WriteBlobMSBShort(image,(unsigned short) source_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) source_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) source_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) source_rectangle.right);
(void) WriteBlobMSBShort(image,(unsigned short) destination_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) destination_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) destination_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) destination_rectangle.right);
(void) WriteBlobMSBShort(image,(unsigned short) transfer_mode);
/*
Write picture data.
*/
count=0;
if (storage_class == PseudoClass)
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
scanline[x]=(unsigned char) GetPixelIndex(indexes+x);
count+=EncodeImage(image,scanline,(size_t) (row_bytes & 0x7FFF),
packed_scanline);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
else
if (image_info->compression == JPEGCompression)
{
(void) ResetMagickMemory(scanline,0,row_bytes);
for (y=0; y < (ssize_t) image->rows; y++)
count+=EncodeImage(image,scanline,(size_t) (row_bytes & 0x7FFF),
packed_scanline);
}
else
{
register unsigned char
*blue,
*green,
*opacity,
*red;
red=scanline;
green=scanline+image->columns;
blue=scanline+2*image->columns;
opacity=scanline+3*image->columns;
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
red=scanline;
green=scanline+image->columns;
blue=scanline+2*image->columns;
if (image->matte != MagickFalse)
{
opacity=scanline;
red=scanline+image->columns;
green=scanline+2*image->columns;
blue=scanline+3*image->columns;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
*red++=ScaleQuantumToChar(GetPixelRed(p));
*green++=ScaleQuantumToChar(GetPixelGreen(p));
*blue++=ScaleQuantumToChar(GetPixelBlue(p));
if (image->matte != MagickFalse)
*opacity++=ScaleQuantumToChar((Quantum)
(GetPixelAlpha(p)));
p++;
}
count+=EncodeImage(image,scanline,bytes_per_line & 0x7FFF,
packed_scanline);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
}
if ((count & 0x01) != 0)
(void) WriteBlobByte(image,'\0');
(void) WriteBlobMSBShort(image,PictEndOfPictureOp);
offset=TellBlob(image);
offset=SeekBlob(image,512,SEEK_SET);
(void) WriteBlobMSBShort(image,(unsigned short) offset);
scanline=(unsigned char *) RelinquishMagickMemory(scanline);
packed_scanline=(unsigned char *) RelinquishMagickMemory(packed_scanline);
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
(void) CloseBlob(image);
return(MagickTrue);
}
| 0
|
282,725
|
void Document::ProcessJavaScriptUrl(
const KURL& url,
ContentSecurityPolicyDisposition disposition) {
DCHECK(url.ProtocolIsJavaScript());
if (frame_->Loader().StateMachine()->IsDisplayingInitialEmptyDocument())
load_event_progress_ = kLoadEventNotRun;
frame_->Loader().Progress().ProgressStarted();
if (frame_->Loader().StateMachine()->IsDisplayingInitialEmptyDocument() &&
(url == "javascript:''" || url == "javascript:\"\"")) {
ExecuteJavaScriptUrl(url, disposition);
return;
}
javascript_url_task_handle_ = PostCancellableTask(
*GetTaskRunner(TaskType::kNetworking), FROM_HERE,
WTF::Bind(&Document::ExecuteJavaScriptUrl, WrapWeakPersistent(this), url,
disposition));
}
| 0
|
505,955
|
STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s)
{
STACK_OF(X509) *r;
if ((s == NULL) || (s->session == NULL) || (s->session->sess_cert == NULL))
r=NULL;
else
r=s->session->sess_cert->cert_chain;
/* If we are a client, cert_chain includes the peer's own
* certificate; if we are a server, it does not. */
return(r);
}
| 0
|
427,659
|
static int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){
int rc = SQLITE_OK;
RtreeNode *pChild = pLeaf;
while( rc==SQLITE_OK && pChild->iNode!=1 && pChild->pParent==0 ){
int rc2 = SQLITE_OK; /* sqlite3_reset() return code */
sqlite3_bind_int64(pRtree->pReadParent, 1, pChild->iNode);
rc = sqlite3_step(pRtree->pReadParent);
if( rc==SQLITE_ROW ){
RtreeNode *pTest; /* Used to test for reference loops */
i64 iNode; /* Node number of parent node */
/* Before setting pChild->pParent, test that we are not creating a
** loop of references (as we would if, say, pChild==pParent). We don't
** want to do this as it leads to a memory leak when trying to delete
** the referenced counted node structures.
*/
iNode = sqlite3_column_int64(pRtree->pReadParent, 0);
for(pTest=pLeaf; pTest && pTest->iNode!=iNode; pTest=pTest->pParent);
if( !pTest ){
rc2 = nodeAcquire(pRtree, iNode, 0, &pChild->pParent);
}
}
rc = sqlite3_reset(pRtree->pReadParent);
if( rc==SQLITE_OK ) rc = rc2;
if( rc==SQLITE_OK && !pChild->pParent ){
RTREE_IS_CORRUPT(pRtree);
rc = SQLITE_CORRUPT_VTAB;
}
pChild = pChild->pParent;
}
return rc;
}
| 0
|
473,414
|
PHP_LIBXML_API int php_libxml_decrement_node_ptr(php_libxml_node_object *object)
{
int ret_refcount = -1;
php_libxml_node_ptr *obj_node;
if (object != NULL && object->node != NULL) {
obj_node = (php_libxml_node_ptr *) object->node;
ret_refcount = --obj_node->refcount;
if (ret_refcount == 0) {
if (obj_node->node != NULL) {
obj_node->node->_private = NULL;
}
efree(obj_node);
}
object->node = NULL;
}
return ret_refcount;
}
| 0
|
467,679
|
Client::adjustBodyBytesRead(const int64_t delta)
{
int64_t &bodyBytesRead = originalRequest()->hier.bodyBytesRead;
// if we got here, do not log a dash even if we got nothing from the server
if (bodyBytesRead < 0)
bodyBytesRead = 0;
bodyBytesRead += delta; // supports negative and zero deltas
// check for overflows ("infinite" response?) and underflows (a bug)
Must(bodyBytesRead >= 0);
}
| 0
|
156,757
|
static int quit_callback(sd_event_source *event, void *userdata) {
sd_bus *bus = userdata;
assert(event);
if (bus->close_on_exit) {
sd_bus_flush(bus);
sd_bus_close(bus);
}
return 1;
}
| 0
|
296,669
|
static bool get_reqs_available(struct kioctx *ctx)
{
struct kioctx_cpu *kcpu;
bool ret = false;
preempt_disable();
kcpu = this_cpu_ptr(ctx->cpu);
if (!kcpu->reqs_available) {
int old, avail = atomic_read(&ctx->reqs_available);
do {
if (avail < ctx->req_batch)
goto out;
old = avail;
avail = atomic_cmpxchg(&ctx->reqs_available,
avail, avail - ctx->req_batch);
} while (avail != old);
kcpu->reqs_available += ctx->req_batch;
}
ret = true;
kcpu->reqs_available--;
out:
preempt_enable();
return ret;
}
| 0
|
259,205
|
flatpak_appstream_xml_root_to_data (FlatpakXml *appstream_root,
GBytes **uncompressed,
GBytes **compressed,
GError **error)
{
g_autoptr(GString) xml = NULL;
g_autoptr(GZlibCompressor) compressor = NULL;
g_autoptr(GOutputStream) out2 = NULL;
g_autoptr(GOutputStream) out = NULL;
flatpak_xml_add (appstream_root->first_child, flatpak_xml_new_text ("\n"));
xml = g_string_new ("");
flatpak_xml_to_string (appstream_root, xml);
if (compressed)
{
compressor = g_zlib_compressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP, -1);
out = g_memory_output_stream_new_resizable ();
out2 = g_converter_output_stream_new (out, G_CONVERTER (compressor));
if (!g_output_stream_write_all (out2, xml->str, xml->len,
NULL, NULL, error))
return FALSE;
if (!g_output_stream_close (out2, NULL, error))
return FALSE;
}
if (uncompressed)
*uncompressed = g_string_free_to_bytes (g_steal_pointer (&xml));
if (compressed)
*compressed = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (out));
return TRUE;
}
| 0
|
100,366
|
update_curswant(void)
{
if (curwin->w_set_curswant)
{
validate_virtcol();
curwin->w_curswant = curwin->w_virtcol;
curwin->w_set_curswant = FALSE;
}
}
| 0
|
193,368
|
static PassRefPtr<CSSPrimitiveValue> fontVariantFromStyle(RenderStyle* style)
{
if (style->fontDescription().smallCaps())
return cssValuePool().createIdentifierValue(CSSValueSmallCaps);
return cssValuePool().createIdentifierValue(CSSValueNormal);
}
| 0
|
480,580
|
void DL_Dxf::addLine(DL_CreationInterface* creationInterface) {
DL_LineData d(getRealValue(10, 0.0),
getRealValue(20, 0.0),
getRealValue(30, 0.0),
getRealValue(11, 0.0),
getRealValue(21, 0.0),
getRealValue(31, 0.0));
creationInterface->addLine(d);
}
| 0
|
34,452
|
static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
{
int page_lru;
VM_BUG_ON_PAGE(compound_order(page) && !PageTransHuge(page), page);
/* Avoid migrating to a node that is nearly full */
if (!migrate_balanced_pgdat(pgdat, 1UL << compound_order(page)))
return 0;
if (isolate_lru_page(page))
return 0;
/*
* migrate_misplaced_transhuge_page() skips page migration's usual
* check on page_count(), so we must do it here, now that the page
* has been isolated: a GUP pin, or any other pin, prevents migration.
* The expected page count is 3: 1 for page's mapcount and 1 for the
* caller's pin and 1 for the reference taken by isolate_lru_page().
*/
if (PageTransHuge(page) && page_count(page) != 3) {
putback_lru_page(page);
return 0;
}
page_lru = page_is_file_cache(page);
mod_zone_page_state(page_zone(page), NR_ISOLATED_ANON + page_lru,
hpage_nr_pages(page));
/*
* Isolating the page has taken another reference, so the
* caller's reference can be safely dropped without the page
* disappearing underneath us during migration.
*/
put_page(page);
return 1;
}
| 0
|
383,580
|
static int do_sect_fault(unsigned long addr, unsigned int esr,
struct pt_regs *regs)
{
do_bad_area(addr, esr, regs);
return 0;
}
| 0
|
279,343
|
GpuRasterizationSucceedsWithLargeImage()
: viewport_size_(1024, 2048), large_image_size_(20000, 10) {}
| 0
|
303,116
|
void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1,
uint8_t *dst2, ThreadFrame *ref, const VP56mv *mv,
int x_off, int y_off, int block_w, int block_h,
int width, int height, ptrdiff_t linesize,
vp8_mc_func mc_func[3][3])
{
uint8_t *src1 = ref->f->data[1], *src2 = ref->f->data[2];
if (AV_RN32A(mv)) {
int mx = mv->x & 7, mx_idx = subpel_idx[0][mx];
int my = mv->y & 7, my_idx = subpel_idx[0][my];
x_off += mv->x >> 3;
y_off += mv->y >> 3;
// edge emulation
src1 += y_off * linesize + x_off;
src2 += y_off * linesize + x_off;
ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 3, 0);
if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] ||
y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
src1 - my_idx * linesize - mx_idx,
EDGE_EMU_LINESIZE, linesize,
block_w + subpel_idx[1][mx],
block_h + subpel_idx[1][my],
x_off - mx_idx, y_off - my_idx, width, height);
src1 = td->edge_emu_buffer + mx_idx + EDGE_EMU_LINESIZE * my_idx;
mc_func[my_idx][mx_idx](dst1, linesize, src1, EDGE_EMU_LINESIZE, block_h, mx, my);
s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
src2 - my_idx * linesize - mx_idx,
EDGE_EMU_LINESIZE, linesize,
block_w + subpel_idx[1][mx],
block_h + subpel_idx[1][my],
x_off - mx_idx, y_off - my_idx, width, height);
src2 = td->edge_emu_buffer + mx_idx + EDGE_EMU_LINESIZE * my_idx;
mc_func[my_idx][mx_idx](dst2, linesize, src2, EDGE_EMU_LINESIZE, block_h, mx, my);
} else {
mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);
mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);
}
} else {
ff_thread_await_progress(ref, (3 + y_off + block_h) >> 3, 0);
mc_func[0][0](dst1, linesize, src1 + y_off * linesize + x_off, linesize, block_h, 0, 0);
mc_func[0][0](dst2, linesize, src2 + y_off * linesize + x_off, linesize, block_h, 0, 0);
}
}
| 0
|
359,584
|
applet_get_all_connections (NMApplet *applet)
{
GSList *list;
GSList *connections = NULL;
list = nm_settings_list_connections (NM_SETTINGS (applet->dbus_settings));
g_slist_foreach (list, exported_connection_to_connection, &connections);
g_slist_free (list);
list = nm_settings_list_connections (NM_SETTINGS (applet->gconf_settings));
g_slist_foreach (list, exported_connection_to_connection, &connections);
g_slist_free (list);
return connections;
}
| 0
|
357,676
|
long do_fork(unsigned long clone_flags,
unsigned long stack_start,
struct pt_regs *regs,
unsigned long stack_size,
int __user *parent_tidptr,
int __user *child_tidptr)
{
struct task_struct *p;
int trace = 0;
long nr;
/*
* Do some preliminary argument and permissions checking before we
* actually start allocating stuff
*/
if (clone_flags & CLONE_NEWUSER) {
if (clone_flags & CLONE_THREAD)
return -EINVAL;
/* hopefully this check will go away when userns support is
* complete
*/
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SETUID) ||
!capable(CAP_SETGID))
return -EPERM;
}
/*
* We hope to recycle these flags after 2.6.26
*/
if (unlikely(clone_flags & CLONE_STOPPED)) {
static int __read_mostly count = 100;
if (count > 0 && printk_ratelimit()) {
char comm[TASK_COMM_LEN];
count--;
printk(KERN_INFO "fork(): process `%s' used deprecated "
"clone flags 0x%lx\n",
get_task_comm(comm, current),
clone_flags & CLONE_STOPPED);
}
}
/*
* When called from kernel_thread, don't do user tracing stuff.
*/
if (likely(user_mode(regs)))
trace = tracehook_prepare_clone(clone_flags);
p = copy_process(clone_flags, stack_start, regs, stack_size,
child_tidptr, NULL, trace);
/*
* Do this prior waking up the new thread - the thread pointer
* might get invalid after that point, if the thread exits quickly.
*/
if (!IS_ERR(p)) {
struct completion vfork;
trace_sched_process_fork(current, p);
nr = task_pid_vnr(p);
if (clone_flags & CLONE_PARENT_SETTID)
put_user(nr, parent_tidptr);
if (clone_flags & CLONE_VFORK) {
p->vfork_done = &vfork;
init_completion(&vfork);
}
audit_finish_fork(p);
tracehook_report_clone(trace, regs, clone_flags, nr, p);
/*
* We set PF_STARTING at creation in case tracing wants to
* use this to distinguish a fully live task from one that
* hasn't gotten to tracehook_report_clone() yet. Now we
* clear it and set the child going.
*/
p->flags &= ~PF_STARTING;
if (unlikely(clone_flags & CLONE_STOPPED)) {
/*
* We'll start up with an immediate SIGSTOP.
*/
sigaddset(&p->pending.signal, SIGSTOP);
set_tsk_thread_flag(p, TIF_SIGPENDING);
__set_task_state(p, TASK_STOPPED);
} else {
wake_up_new_task(p, clone_flags);
}
tracehook_report_clone_complete(trace, regs,
clone_flags, nr, p);
if (clone_flags & CLONE_VFORK) {
freezer_do_not_count();
wait_for_completion(&vfork);
freezer_count();
tracehook_report_vfork_done(p, nr);
}
} else {
nr = PTR_ERR(p);
}
return nr;
}
| 0
|
57,582
|
mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter,
struct mwifiex_private **priv, int *tid)
{
struct mwifiex_private *priv_tmp;
struct mwifiex_ra_list_tbl *ptr;
struct mwifiex_tid_tbl *tid_ptr;
atomic_t *hqp;
int i, j;
/* check the BSS with highest priority first */
for (j = adapter->priv_num - 1; j >= 0; --j) {
/* iterate over BSS with the equal priority */
list_for_each_entry(adapter->bss_prio_tbl[j].bss_prio_cur,
&adapter->bss_prio_tbl[j].bss_prio_head,
list) {
try_again:
priv_tmp = adapter->bss_prio_tbl[j].bss_prio_cur->priv;
if (((priv_tmp->bss_mode != NL80211_IFTYPE_ADHOC) &&
!priv_tmp->port_open) ||
(atomic_read(&priv_tmp->wmm.tx_pkts_queued) == 0))
continue;
if (adapter->if_ops.is_port_ready &&
!adapter->if_ops.is_port_ready(priv_tmp))
continue;
/* iterate over the WMM queues of the BSS */
hqp = &priv_tmp->wmm.highest_queued_prio;
for (i = atomic_read(hqp); i >= LOW_PRIO_TID; --i) {
spin_lock_bh(&priv_tmp->wmm.ra_list_spinlock);
tid_ptr = &(priv_tmp)->wmm.
tid_tbl_ptr[tos_to_tid[i]];
/* iterate over receiver addresses */
list_for_each_entry(ptr, &tid_ptr->ra_list,
list) {
if (!ptr->tx_paused &&
!skb_queue_empty(&ptr->skb_head))
/* holds both locks */
goto found;
}
spin_unlock_bh(&priv_tmp->wmm.ra_list_spinlock);
}
if (atomic_read(&priv_tmp->wmm.tx_pkts_queued) != 0) {
atomic_set(&priv_tmp->wmm.highest_queued_prio,
HIGH_PRIO_TID);
/* Iterate current private once more, since
* there still exist packets in data queue
*/
goto try_again;
} else
atomic_set(&priv_tmp->wmm.highest_queued_prio,
NO_PKT_PRIO_TID);
}
}
return NULL;
found:
/* holds ra_list_spinlock */
if (atomic_read(hqp) > i)
atomic_set(hqp, i);
spin_unlock_bh(&priv_tmp->wmm.ra_list_spinlock);
*priv = priv_tmp;
*tid = tos_to_tid[i];
return ptr;
}
| 0
|
503,996
|
const std::string& clientSecret() const override {
CONSTRUCT_ON_FIRST_USE(std::string, "asdf_client_secret_fdsa");
}
| 0
|
114,616
|
njs_generator_stack_pop(njs_vm_t *vm, njs_generator_t *generator, void *ctx)
{
njs_queue_link_t *link;
njs_generator_stack_entry_t *entry;
entry = njs_queue_link_data(njs_queue_first(&generator->stack),
njs_generator_stack_entry_t, link);
link = njs_queue_first(&generator->stack);
njs_queue_remove(link);
if (ctx != NULL) {
njs_mp_free(vm->mem_pool, ctx);
}
generator->context = entry->context;
njs_generator_next(generator, entry->state, entry->node);
njs_mp_free(vm->mem_pool, entry);
return NJS_OK;
}
| 0
|
193,384
|
ProcPseudoramiXQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
xXineramaQueryScreensReply rep;
DEBUG_LOG("noPseudoramiXExtension=%d, pseudoramiXNumScreens=%d\n",
noPseudoramiXExtension,
pseudoramiXNumScreens);
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.number = noPseudoramiXExtension ? 0 : pseudoramiXNumScreens;
rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.number);
}
WriteToClient(client, sizeof(xXineramaQueryScreensReply),&rep);
if (!noPseudoramiXExtension) {
xXineramaScreenInfo scratch;
int i;
for (i = 0; i < pseudoramiXNumScreens; i++) {
scratch.x_org = pseudoramiXScreens[i].x;
scratch.y_org = pseudoramiXScreens[i].y;
scratch.width = pseudoramiXScreens[i].w;
scratch.height = pseudoramiXScreens[i].h;
if (client->swapped) {
swaps(&scratch.x_org);
swaps(&scratch.y_org);
swaps(&scratch.width);
swaps(&scratch.height);
}
WriteToClient(client, sz_XineramaScreenInfo,&scratch);
}
}
return Success;
}
| 0
|
505,843
|
dtls1_hm_fragment_free(hm_fragment *frag)
{
if (frag->msg_header.is_ccs)
{
EVP_CIPHER_CTX_free(frag->msg_header.saved_retransmit_state.enc_write_ctx);
EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash);
}
if (frag->fragment) OPENSSL_free(frag->fragment);
if (frag->reassembly) OPENSSL_free(frag->reassembly);
OPENSSL_free(frag);
}
| 0
|
447,571
|
static cl_error_t egg_parse_archive_headers(egg_handle* handle)
{
cl_error_t status = CL_EPARSE;
cl_error_t retval;
egg_header* eggHeader = NULL;
uint32_t magic = 0;
const uint8_t* index = 0;
if (!handle) {
cli_errmsg("egg_parse_archive_headers: Invalid args!\n");
return CL_EARG;
}
if (CL_SUCCESS != EGG_VALIDATE_HANDLE(handle)) {
cli_errmsg("egg_parse_archive_headers: Invalid handle values!\n");
status = CL_EARG;
goto done;
}
/*
* 1st:
* Archive headers begins with the egg_header.
*/
index = (const uint8_t*)fmap_need_off_once(handle->map, handle->offset, sizeof(egg_header));
if (!index) {
cli_dbgmsg("egg_parse_archive_headers: File buffer too small to contain egg_header.\n");
goto done;
}
eggHeader = (egg_header*)index;
if (EGG_HEADER_MAGIC != le32_to_host(eggHeader->magic)) {
cli_dbgmsg("egg_parse_archive_headers: Invalid egg header magic: %08x.\n", le32_to_host(eggHeader->magic));
goto done;
}
cli_dbgmsg("egg_parse_archive_headers: egg_header->magic: %08x (%s)\n", le32_to_host(eggHeader->magic), getMagicHeaderName(le32_to_host(eggHeader->magic)));
cli_dbgmsg("egg_parse_archive_headers: egg_header->version: %04x\n", le16_to_host(eggHeader->version));
cli_dbgmsg("egg_parse_archive_headers: egg_header->header_id: %08x\n", le32_to_host(eggHeader->header_id));
cli_dbgmsg("egg_parse_archive_headers: egg_header->reserved: %08x\n", le32_to_host(eggHeader->reserved));
if (EGG_HEADER_VERSION != le16_to_host(eggHeader->version)) {
cli_dbgmsg("egg_parse_archive_headers: Unexpected EGG archive version #: %04x.\n",
le16_to_host(eggHeader->version));
}
handle->offset += sizeof(egg_header);
/*
* 2nd:
* Egg Header may be followed by:
* a) split_compression header and/or
* b) solid_compression
* c) global encryption header
* d) EOFARC
*/
while (handle->map->len > handle->offset) {
/* Get the next magic32_t */
index = (const uint8_t*)fmap_need_off_once(handle->map, handle->offset, sizeof(magic32_t));
if (!index) {
cli_dbgmsg("egg_parse_archive_headers: File buffer too small to contain end of archive magic bytes.\n");
goto done;
}
magic = le32_to_host(*((uint32_t*)index));
if (EOFARC == magic) {
/*
* Archive headers should conclude with EOFARC magic bytes.
*/
handle->offset += sizeof(magic32_t);
cli_dbgmsg("egg_parse_archive_headers: End of archive headers.\n");
break; /* Break out of the loop */
} else {
/*
* Parse extra fields.
*/
retval = egg_parse_archive_extra_field(handle);
if (CL_SUCCESS != retval) {
cli_dbgmsg("egg_parse_archive_headers: Failed to parse archive header, magic: %08x (%s)\n", magic, getMagicHeaderName(magic));
break; /* Break out of the loop */
}
}
}
status = CL_SUCCESS;
done:
return status;
}
| 0
|
453,240
|
bool wsrep_sst_receive_address_check (sys_var *self, THD* thd, set_var* var)
{
const char* c_str = var->value->str_value.c_ptr();
if (sst_receive_address_check (c_str))
{
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "wsrep_sst_receive_address", c_str ? c_str : "NULL");
return 1;
}
return 0;
}
| 0
|
185,795
|
int __trace_bputs(unsigned long ip, const char *str)
{
struct ring_buffer_event *event;
struct ring_buffer *buffer;
struct bputs_entry *entry;
unsigned long irq_flags;
int size = sizeof(struct bputs_entry);
int pc;
if (!(global_trace.trace_flags & TRACE_ITER_PRINTK))
return 0;
pc = preempt_count();
if (unlikely(tracing_selftest_running || tracing_disabled))
return 0;
local_save_flags(irq_flags);
buffer = global_trace.trace_buffer.buffer;
event = __trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
irq_flags, pc);
if (!event)
return 0;
entry = ring_buffer_event_data(event);
entry->ip = ip;
entry->str = str;
__buffer_unlock_commit(buffer, event);
ftrace_trace_stack(&global_trace, buffer, irq_flags, 4, pc, NULL);
return 1;
}
| 0
|
150,384
|
Result negotiateSpawn(NegotiationDetails &details) {
TRACE_POINT();
details.spawnStartTime = SystemTime::getUsec();
details.gupid = integerToHex(SystemTime::get() / 60) + "-" +
config->randomGenerator->generateAsciiString(10);
details.timeout = details.options->startTimeout * 1000;
string result;
try {
result = readMessageLine(details);
} catch (const SystemException &e) {
throwAppSpawnException("An error occurred while starting the "
"web application. There was an I/O error while reading its "
"handshake message: " + e.sys(),
SpawnException::APP_STARTUP_PROTOCOL_ERROR,
details);
} catch (const TimeoutException &) {
throwAppSpawnException("An error occurred while starting the "
"web application: it did not write a handshake message in time.",
SpawnException::APP_STARTUP_TIMEOUT,
details);
}
protocol_begin:
if (result == "I have control 1.0\n") {
UPDATE_TRACE_POINT();
sendSpawnRequest(details);
try {
result = readMessageLine(details);
} catch (const SystemException &e) {
throwAppSpawnException("An error occurred while starting the "
"web application. There was an I/O error while reading its "
"startup response: " + e.sys(),
SpawnException::APP_STARTUP_PROTOCOL_ERROR,
details);
} catch (const TimeoutException &) {
throwAppSpawnException("An error occurred while starting the "
"web application: it did not write a startup response in time. "
"If your app needs more time to start you can increase the "
"Passenger start timeout config option.",
SpawnException::APP_STARTUP_TIMEOUT,
details);
}
if (result == "Ready\n") {
return handleSpawnResponse(details);
} else if (result == "Error\n") {
handleSpawnErrorResponse(details);
} else if (result == "I have control 1.0\n") {
goto protocol_begin;
} else {
handleInvalidSpawnResponseType(result, details);
}
} else {
UPDATE_TRACE_POINT();
if (result == "Error\n") {
handleSpawnErrorResponse(details);
} else {
handleInvalidSpawnResponseType(result, details);
}
}
return Result(); // Never reached.
}
| 0
|
275,396
|
RAND_DRBG *RAND_DRBG_secure_new(int type, unsigned int flags, RAND_DRBG *parent)
{
return rand_drbg_new(1, type, flags, parent);
}
| 0
|
510,299
|
int Item_param::save_in_field(Field *field, bool no_conversions)
{
field->set_notnull();
switch (state) {
case INT_VALUE:
return field->store(value.integer, unsigned_flag);
case REAL_VALUE:
return field->store(value.real);
case DECIMAL_VALUE:
return field->store_decimal(&decimal_value);
case TIME_VALUE:
field->store_time_dec(&value.time, decimals);
return 0;
case STRING_VALUE:
case LONG_DATA_VALUE:
return field->store(str_value.ptr(), str_value.length(),
str_value.charset());
case NULL_VALUE:
return set_field_to_null_with_conversions(field, no_conversions);
case NO_VALUE:
default:
DBUG_ASSERT(0);
}
return 1;
}
| 0
|
182,996
|
std::string DevToolsAgentHostImpl::GetParentId() {
return std::string();
}
| 0
|
232,624
|
void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *rmsgp, int chunks)
| 0
|
6,872
|
static int string_scan_range(RList *list, const ut8 *buf, int min,
const ut64 from, const ut64 to, int type) {
ut8 tmp[R_STRING_SCAN_BUFFER_SIZE];
ut64 str_start, needle = from;
int count = 0, i, rc, runes;
int str_type = R_STRING_TYPE_DETECT;
if (type == -1) {
type = R_STRING_TYPE_DETECT;
}
if (!buf || !min) {
return -1;
}
while (needle < to) {
rc = r_utf8_decode (buf + needle, to - needle, NULL);
if (!rc) {
needle++;
continue;
}
if (type == R_STRING_TYPE_DETECT) {
char *w = (char *)buf + needle + rc;
if ((to - needle) > 4) {
bool is_wide32 = needle + rc + 2 < to && !w[0] && !w[1] && !w[2] && w[3] && !w[4];
if (is_wide32) {
str_type = R_STRING_TYPE_WIDE32;
} else {
bool is_wide = needle + rc + 2 < to && !w[0] && w[1] && !w[2];
str_type = is_wide? R_STRING_TYPE_WIDE: R_STRING_TYPE_ASCII;
}
} else {
str_type = R_STRING_TYPE_ASCII;
}
} else {
str_type = type;
}
runes = 0;
str_start = needle;
/* Eat a whole C string */
for (rc = i = 0; i < sizeof (tmp) - 3 && needle < to; i += rc) {
RRune r = {0};
if (str_type == R_STRING_TYPE_WIDE32) {
rc = r_utf32le_decode (buf + needle, to - needle, &r);
if (rc) {
rc = 4;
}
} else if (str_type == R_STRING_TYPE_WIDE) {
rc = r_utf16le_decode (buf + needle, to - needle, &r);
if (rc == 1) {
rc = 2;
}
} else {
rc = r_utf8_decode (buf + needle, to - needle, &r);
if (rc > 1) {
str_type = R_STRING_TYPE_UTF8;
}
}
/* Invalid sequence detected */
if (!rc) {
needle++;
break;
}
needle += rc;
if (r_isprint (r)) {
if (str_type == R_STRING_TYPE_WIDE32) {
if (r == 0xff) {
r = 0;
}
}
rc = r_utf8_encode (&tmp[i], r);
runes++;
/* Print the escape code */
} else if (r && r < 0x100 && strchr ("\b\v\f\n\r\t\a\e", (char)r)) {
if ((i + 32) < sizeof (tmp) && r < 28) {
tmp[i + 0] = '\\';
tmp[i + 1] = " abtnvfr e"[r];
} else {
// string too long
break;
}
rc = 2;
runes++;
} else {
/* \0 marks the end of C-strings */
break;
}
}
tmp[i++] = '\0';
if (runes >= min) {
if (str_type == R_STRING_TYPE_ASCII) {
// reduce false positives
int j;
for (j = 0; j < i; j++) {
char ch = tmp[j];
if (ch != '\n' && ch != '\r' && ch != '\t') {
if (!IS_PRINTABLE (tmp[j])) {
continue;
}
}
}
}
if (list) {
RBinString *new = R_NEW0 (RBinString);
if (!new) {
break;
}
new->type = str_type;
new->length = runes;
new->size = needle - str_start;
new->ordinal = count++;
// TODO: move into adjust_offset
switch (str_type) {
case R_STRING_TYPE_WIDE:
{
const ut8 *p = buf + str_start - 2;
if (p[0] == 0xff && p[1] == 0xfe) {
str_start -= 2; // \xff\xfe
}
}
break;
case R_STRING_TYPE_WIDE32:
{
const ut8 *p = buf + str_start - 4;
if (p[0] == 0xff && p[1] == 0xfe) {
str_start -= 4; // \xff\xfe\x00\x00
}
}
break;
}
new->paddr = new->vaddr = str_start;
new->string = r_str_ndup ((const char *)tmp, i);
r_list_append (list, new);
} else {
// DUMP TO STDOUT. raw dumping for rabin2 -zzz
printf ("0x%08" PFMT64x " %s\n", str_start, tmp);
}
}
}
return count;
}
| 1
|
8,815
|
void operator()(const CPUDevice& d, typename TTypes<T, 4>::ConstTensor input,
typename TTypes<T, 3>::ConstTensor filter,
typename TTypes<T, 4>::ConstTensor out_backprop,
int stride_rows, int stride_cols, int rate_rows,
int rate_cols, int pad_top, int pad_left,
typename TTypes<T, 3>::Tensor filter_backprop) {
const int batch = input.dimension(0);
const int input_rows = input.dimension(1);
const int input_cols = input.dimension(2);
const int depth = input.dimension(3);
const int filter_rows = filter.dimension(0);
const int filter_cols = filter.dimension(1);
const int output_rows = out_backprop.dimension(1);
const int output_cols = out_backprop.dimension(2);
// Initialize gradient with all zeros.
filter_backprop.setZero();
// This is a reference implementation, likely to be slow.
// TODO(gpapan): Write multi-threaded implementation.
// In the case of multiple argmax branches, we only back-propagate along the
// last branch, i.e., the one with largest value of `h * filter_cols + w`,
// similarly to the max-pooling backward routines.
for (int b = 0; b < batch; ++b) {
for (int h_out = 0; h_out < output_rows; ++h_out) {
int h_beg = h_out * stride_rows - pad_top;
for (int w_out = 0; w_out < output_cols; ++w_out) {
int w_beg = w_out * stride_cols - pad_left;
for (int d = 0; d < depth; ++d) {
T cur_val = Eigen::NumTraits<T>::lowest();
int h_max = 0;
int w_max = 0;
for (int h = 0; h < filter_rows; ++h) {
const int h_in = h_beg + h * rate_rows;
if (h_in >= 0 && h_in < input_rows) {
for (int w = 0; w < filter_cols; ++w) {
const int w_in = w_beg + w * rate_cols;
if (w_in >= 0 && w_in < input_cols) {
const T val = input(b, h_in, w_in, d) + filter(h, w, d);
if (val > cur_val) {
cur_val = val;
h_max = h;
w_max = w;
}
}
}
}
}
filter_backprop(h_max, w_max, d) +=
out_backprop(b, h_out, w_out, d);
}
}
}
}
}
| 1
|
38,763
|
int mod_timer(struct timer_list *timer, unsigned long expires)
{
return __mod_timer(timer, expires, 0);
}
| 0
|
254,214
|
_PUBLIC_ char *strlower_talloc_handle(struct smb_iconv_handle *iconv_handle,
TALLOC_CTX *ctx, const char *src)
{
size_t size=0;
char *dest;
if(src == NULL) {
return NULL;
}
/* this takes advantage of the fact that upper/lower can't
change the length of a character by more than 1 byte */
dest = talloc_array(ctx, char, 2*(strlen(src))+1);
if (dest == NULL) {
return NULL;
}
while (*src) {
size_t c_size;
codepoint_t c = next_codepoint_handle(iconv_handle, src, &c_size);
src += c_size;
c = tolower_m(c);
c_size = push_codepoint_handle(iconv_handle, dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
}
size += c_size;
}
dest[size] = 0;
/* trim it so talloc_append_string() works */
dest = talloc_realloc(ctx, dest, char, size+1);
talloc_set_name_const(dest, dest);
return dest;
}
| 0
|
19,814
|
IN_PROC_BROWSER_TEST_F ( SiteDetailsBrowserTest , IsolateExtensionsHostedApps ) {
GURL app_with_web_iframe_url = embedded_test_server ( ) -> GetURL ( "app.org" , "/cross_site_iframe_factory.html?app.org(b.com)" ) ;
GURL app_in_web_iframe_url = embedded_test_server ( ) -> GetURL ( "b.com" , "/cross_site_iframe_factory.html?b.com(app.org)" ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , app_with_web_iframe_url ) ;
scoped_refptr < TestMemoryDetails > details = new TestMemoryDetails ( ) ;
details -> StartFetchAndWait ( ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.CurrentRendererProcessCount" ) , HasOneSample ( GetRenderProcessCount ( ) ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateNothingProcessCountEstimate" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountEstimate" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountLowerBound" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountNoLimit" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( GetRenderProcessCount ( ) , DependingOnPolicy ( 1 , 1 , 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountEstimate" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountLowerBound" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountNoLimit" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( GetRenderProcessCount ( ) , DependingOnPolicy ( 1 , 1 , 2 ) ) ;
EXPECT_THAT ( details -> GetOutOfProcessIframeCount ( ) , DependingOnPolicy ( 0 , 0 , 1 ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , app_in_web_iframe_url ) ;
details = new TestMemoryDetails ( ) ;
details -> StartFetchAndWait ( ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.CurrentRendererProcessCount" ) , HasOneSample ( GetRenderProcessCount ( ) ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateNothingProcessCountEstimate" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountEstimate" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountLowerBound" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountNoLimit" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( GetRenderProcessCount ( ) , DependingOnPolicy ( 1 , 1 , 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountEstimate" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountLowerBound" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountNoLimit" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( GetRenderProcessCount ( ) , DependingOnPolicy ( 1 , 1 , 2 ) ) ;
EXPECT_THAT ( details -> GetOutOfProcessIframeCount ( ) , DependingOnPolicy ( 0 , 0 , 1 ) ) ;
CreateHostedApp ( "App" , GURL ( "http://app.org" ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , app_with_web_iframe_url ) ;
details = new TestMemoryDetails ( ) ;
details -> StartFetchAndWait ( ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.CurrentRendererProcessCount" ) , HasOneSample ( GetRenderProcessCount ( ) ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateNothingProcessCountEstimate" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountEstimate" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountLowerBound" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountNoLimit" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( GetRenderProcessCount ( ) , DependingOnPolicy ( 1 , 1 , 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountEstimate" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountLowerBound" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountNoLimit" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( GetRenderProcessCount ( ) , DependingOnPolicy ( 1 , 1 , 2 ) ) ;
EXPECT_THAT ( details -> GetOutOfProcessIframeCount ( ) , DependingOnPolicy ( 0 , 0 , 1 ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , app_in_web_iframe_url ) ;
details = new TestMemoryDetails ( ) ;
details -> StartFetchAndWait ( ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.CurrentRendererProcessCount" ) , HasOneSample ( GetRenderProcessCount ( ) ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateNothingProcessCountEstimate" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountEstimate" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountLowerBound" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateExtensionsProcessCountNoLimit" ) , HasOneSample ( 1 ) ) ;
EXPECT_THAT ( GetRenderProcessCount ( ) , DependingOnPolicy ( 1 , 1 , 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountEstimate" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountLowerBound" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( details -> uma ( ) -> GetAllSamples ( "SiteIsolation.IsolateAllSitesProcessCountNoLimit" ) , HasOneSample ( 2 ) ) ;
EXPECT_THAT ( GetRenderProcessCount ( ) , DependingOnPolicy ( 1 , 1 , 2 ) ) ;
EXPECT_THAT ( details -> GetOutOfProcessIframeCount ( ) , DependingOnPolicy ( 0 , 0 , 1 ) ) ;
}
| 0
|
454,933
|
TEST_F(QueryPlannerTest, ExistsTrueSparseIndexOnOtherField) {
addIndex(BSON("x" << 1), false, true);
runQuery(fromjson("{x: 1, y: {$exists: true}}"));
assertNumSolutions(2U);
assertSolutionExists("{cscan: {dir: 1}}");
assertSolutionExists("{fetch: {node: {ixscan: {pattern: {x: 1}}}}}");
}
| 0
|
99,110
|
static RList *sections(RBinFile *bf) {
return MACH0_(get_segments) (bf);
}
| 0
|
210,482
|
bool TabsUpdateFunction::UpdateURL(const std::string& url_string,
int tab_id,
std::string* error) {
GURL url =
ExtensionTabUtil::ResolvePossiblyRelativeURL(url_string, extension());
if (!url.is_valid()) {
*error = ErrorUtils::FormatErrorMessage(tabs_constants::kInvalidUrlError,
url_string);
return false;
}
if (ExtensionTabUtil::IsKillURL(url)) {
*error = tabs_constants::kNoCrashBrowserError;
return false;
}
const bool is_javascript_scheme = url.SchemeIs(url::kJavaScriptScheme);
UMA_HISTOGRAM_BOOLEAN("Extensions.ApiTabUpdateJavascript",
is_javascript_scheme);
if (is_javascript_scheme) {
*error = tabs_constants::kJavaScriptUrlsNotAllowedInTabsUpdate;
return false;
}
bool use_renderer_initiated = false;
if (extension() && extension()->id() == extension_misc::kPdfExtensionId)
use_renderer_initiated = true;
NavigationController::LoadURLParams load_params(url);
load_params.is_renderer_initiated = use_renderer_initiated;
web_contents_->GetController().LoadURLWithParams(load_params);
DCHECK_EQ(url,
web_contents_->GetController().GetPendingEntry()->GetVirtualURL());
return true;
}
| 0
|
120,543
|
fst_process_int_work_q(unsigned long /*void **/work_q)
{
unsigned long flags;
u64 work_intq;
int i;
/*
* Grab the queue exclusively
*/
dbg(DBG_INTR, "fst_process_int_work_q\n");
spin_lock_irqsave(&fst_work_q_lock, flags);
work_intq = fst_work_intq;
fst_work_intq = 0;
spin_unlock_irqrestore(&fst_work_q_lock, flags);
/*
* Call the bottom half for each card with work waiting
*/
for (i = 0; i < FST_MAX_CARDS; i++) {
if (work_intq & 0x01) {
if (fst_card_array[i] != NULL) {
dbg(DBG_INTR,
"Calling rx & tx bh for card %d\n", i);
do_bottom_half_rx(fst_card_array[i]);
do_bottom_half_tx(fst_card_array[i]);
}
}
work_intq = work_intq >> 1;
}
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.