idx
int64 | func
string | target
int64 |
|---|---|---|
325,290
|
void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome)
{
const ARMCPRegInfo *ri = rip;
int target_el;
if (arm_feature(env, ARM_FEATURE_XSCALE) && ri->cp < 14
&& extract32(env->cp15.c15_cpar, ri->cp, 1) == 0) {
raise_exception(env, EXCP_UDEF, syndrome, exception_target_el(env));
}
if (!ri->accessfn) {
return;
}
switch (ri->accessfn(env, ri)) {
case CP_ACCESS_OK:
return;
case CP_ACCESS_TRAP:
target_el = exception_target_el(env);
break;
case CP_ACCESS_TRAP_EL2:
/* Requesting a trap to EL2 when we're in EL3 or S-EL0/1 is
* a bug in the access function.
*/
assert(!arm_is_secure(env) && !arm_current_el(env) == 3);
target_el = 2;
break;
case CP_ACCESS_TRAP_EL3:
target_el = 3;
break;
case CP_ACCESS_TRAP_UNCATEGORIZED:
target_el = exception_target_el(env);
syndrome = syn_uncategorized();
break;
default:
g_assert_not_reached();
}
raise_exception(env, EXCP_UDEF, syndrome, target_el);
}
| 0
|
188,136
|
void Tab::OnGestureEvent(ui::GestureEvent* event) {
controller_->UpdateHoverCard(this, false);
switch (event->type()) {
case ui::ET_GESTURE_TAP_DOWN: {
DCHECK_EQ(1, event->details().touch_points());
ui::GestureEvent event_in_parent(*event, static_cast<View*>(this),
parent());
ui::ListSelectionModel original_selection;
original_selection = controller_->GetSelectionModel();
tab_activated_with_last_tap_down_ = !IsActive();
if (!IsSelected())
controller_->SelectTab(this, *event);
gfx::Point loc(event->location());
views::View::ConvertPointToScreen(this, &loc);
ui::GestureEvent cloned_event(event_in_parent, parent(),
static_cast<View*>(this));
controller_->MaybeStartDrag(this, cloned_event, original_selection);
break;
}
case ui::ET_GESTURE_END:
controller_->EndDrag(END_DRAG_COMPLETE);
break;
case ui::ET_GESTURE_SCROLL_UPDATE:
controller_->ContinueDrag(this, *event);
break;
default:
break;
}
event->SetHandled();
}
| 0
|
237,683
|
FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data)
{
FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder *)client_data;
if(
#if FLAC__HAS_OGG
/* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
!decoder->private_->is_ogg &&
#endif
decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)
) {
*bytes = 0;
decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
return false;
}
else if(*bytes > 0) {
/* While seeking, it is possible for our seek to land in the
* middle of audio data that looks exactly like a frame header
* from a future version of an encoder. When that happens, our
* error callback will get an
* FLAC__STREAM_DECODER_UNPARSEABLE_STREAM and increment its
* unparseable_frame_count. But there is a remote possibility
* that it is properly synced at such a "future-codec frame",
* so to make sure, we wait to see many "unparseable" errors in
* a row before bailing out.
*/
if(decoder->private_->is_seeking && decoder->private_->unparseable_frame_count > 20) {
decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
return false;
}
else {
const FLAC__StreamDecoderReadStatus status =
#if FLAC__HAS_OGG
decoder->private_->is_ogg?
read_callback_ogg_aspect_(decoder, buffer, bytes) :
#endif
decoder->private_->read_callback(decoder, buffer, bytes, decoder->private_->client_data)
;
if(status == FLAC__STREAM_DECODER_READ_STATUS_ABORT) {
decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
return false;
}
else if(*bytes == 0) {
if(
status == FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM ||
(
#if FLAC__HAS_OGG
/* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
!decoder->private_->is_ogg &&
#endif
decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)
)
) {
decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
return false;
}
else
return true;
}
else
return true;
}
}
else {
/* abort to avoid a deadlock */
decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED;
return false;
}
/* [1] @@@ HACK NOTE: The end-of-stream checking has to be hacked around
* for Ogg FLAC. This is because the ogg decoder aspect can lose sync
* and at the same time hit the end of the stream (for example, seeking
* to a point that is after the beginning of the last Ogg page). There
* is no way to report an Ogg sync loss through the callbacks (see note
* in read_callback_ogg_aspect_()) so it returns CONTINUE with *bytes==0.
* So to keep the decoder from stopping at this point we gate the call
* to the eof_callback and let the Ogg decoder aspect set the
* end-of-stream state when it is needed.
*/
}
| 0
|
377,115
|
static void bdrv_io_limits_intercept(BlockDriverState *bs,
unsigned int bytes,
bool is_write)
{
/* does this io must wait */
bool must_wait = throttle_schedule_timer(&bs->throttle_state, is_write);
/* if must wait or any request of this type throttled queue the IO */
if (must_wait ||
!qemu_co_queue_empty(&bs->throttled_reqs[is_write])) {
qemu_co_queue_wait(&bs->throttled_reqs[is_write]);
}
/* the IO will be executed, do the accounting */
throttle_account(&bs->throttle_state, is_write, bytes);
/* if the next request must wait -> do nothing */
if (throttle_schedule_timer(&bs->throttle_state, is_write)) {
return;
}
/* else queue next request for execution */
qemu_co_queue_next(&bs->throttled_reqs[is_write]);
}
| 0
|
505,082
|
static void signal_sep4(GtkWidget *w, gpointer data)
{
window_separation((IMAGE *)data, 4);
}
| 0
|
520,902
|
void Item_func_if::fix_after_pullout(st_select_lex *new_parent,
Item **ref, bool merge)
{
/* This will re-calculate attributes of the arguments */
Item_func::fix_after_pullout(new_parent, ref, merge);
/* Then, re-calculate not_null_tables_cache according to our special rules */
eval_not_null_tables(NULL);
}
| 0
|
132,883
|
position */
int find_set(REP_SETS *sets,REP_SET *find)
{
uint i;
for (i=0 ; i < sets->count-1 ; i++)
{
if (!cmp_bits(sets->set+i,find))
{
free_last_set(sets);
return i;
}
}
| 0
|
57,474
|
static int config_buf(struct usb_configuration *config,
enum usb_device_speed speed, void *buf, u8 type)
{
struct usb_config_descriptor *c = buf;
void *next = buf + USB_DT_CONFIG_SIZE;
int len;
struct usb_function *f;
int status;
len = USB_COMP_EP0_BUFSIZ - USB_DT_CONFIG_SIZE;
/* write the config descriptor */
c = buf;
c->bLength = USB_DT_CONFIG_SIZE;
c->bDescriptorType = type;
/* wTotalLength is written later */
c->bNumInterfaces = config->next_interface_id;
c->bConfigurationValue = config->bConfigurationValue;
c->iConfiguration = config->iConfiguration;
c->bmAttributes = USB_CONFIG_ATT_ONE | config->bmAttributes;
c->bMaxPower = encode_bMaxPower(speed, config);
/* There may be e.g. OTG descriptors */
if (config->descriptors) {
status = usb_descriptor_fillbuf(next, len,
config->descriptors);
if (status < 0)
return status;
len -= status;
next += status;
}
/* add each function's descriptors */
list_for_each_entry(f, &config->functions, list) {
struct usb_descriptor_header **descriptors;
descriptors = function_descriptors(f, speed);
if (!descriptors)
continue;
status = usb_descriptor_fillbuf(next, len,
(const struct usb_descriptor_header **) descriptors);
if (status < 0)
return status;
len -= status;
next += status;
}
len = next - buf;
c->wTotalLength = cpu_to_le16(len);
return len;
}
| 0
|
137,412
|
void SHA256Transform(void* pstate, void* pinput, const void* pinit)
{
SHA256_CTX ctx;
unsigned char data[64];
SHA256_Init(&ctx);
for (int i = 0; i < 16; i++)
((uint32_t*)data)[i] = ByteReverse(((uint32_t*)pinput)[i]);
for (int i = 0; i < 8; i++)
ctx.h[i] = ((uint32_t*)pinit)[i];
SHA256_Update(&ctx, data, sizeof(data));
for (int i = 0; i < 8; i++)
((uint32_t*)pstate)[i] = ctx.h[i];
}
| 0
|
332,862
|
static int pci_pbm_map_irq(PCIDevice *pci_dev, int irq_num)
{
int bus_offset;
if (pci_dev->devfn & 1)
bus_offset = 16;
else
bus_offset = 0;
return (bus_offset + (PCI_SLOT(pci_dev->devfn) << 2) + irq_num) & 0x1f;
}
| 0
|
396,784
|
static GC_bool setup_header(hdr * hhdr, struct hblk *block, size_t byte_sz,
int kind, unsigned flags)
{
word descr;
# ifdef MARK_BIT_PER_GRANULE
size_t granules;
if (byte_sz > MAXOBJBYTES)
flags |= LARGE_BLOCK;
# endif
# ifdef ENABLE_DISCLAIM
if (GC_obj_kinds[kind].ok_disclaim_proc)
flags |= HAS_DISCLAIM;
if (GC_obj_kinds[kind].ok_mark_unconditionally)
flags |= MARK_UNCONDITIONALLY;
# endif
/* Set size, kind and mark proc fields */
hhdr -> hb_sz = byte_sz;
hhdr -> hb_obj_kind = (unsigned char)kind;
hhdr -> hb_flags = (unsigned char)flags;
hhdr -> hb_block = block;
descr = GC_obj_kinds[kind].ok_descriptor;
if (GC_obj_kinds[kind].ok_relocate_descr) descr += byte_sz;
hhdr -> hb_descr = descr;
# ifdef MARK_BIT_PER_OBJ
/* Set hb_inv_sz as portably as possible. */
/* We set it to the smallest value such that sz * inv_sz > 2**32 */
/* This may be more precision than necessary. */
if (byte_sz > MAXOBJBYTES) {
hhdr -> hb_inv_sz = LARGE_INV_SZ;
} else {
word inv_sz;
# if CPP_WORDSZ == 64
inv_sz = ((word)1 << 32)/byte_sz;
if (((inv_sz*byte_sz) >> 32) == 0) ++inv_sz;
# else /* 32 bit words */
GC_ASSERT(byte_sz >= 4);
inv_sz = ((unsigned)1 << 31)/byte_sz;
inv_sz *= 2;
while (inv_sz*byte_sz > byte_sz) ++inv_sz;
# endif
hhdr -> hb_inv_sz = inv_sz;
}
# else /* MARK_BIT_PER_GRANULE */
granules = BYTES_TO_GRANULES(byte_sz);
if (EXPECT(!GC_add_map_entry(granules), FALSE)) {
/* Make it look like a valid block. */
hhdr -> hb_sz = HBLKSIZE;
hhdr -> hb_descr = 0;
hhdr -> hb_flags |= LARGE_BLOCK;
hhdr -> hb_map = 0;
return FALSE;
}
hhdr -> hb_map = GC_obj_map[(hhdr -> hb_flags & LARGE_BLOCK) != 0 ?
0 : granules];
# endif /* MARK_BIT_PER_GRANULE */
/* Clear mark bits */
GC_clear_hdr_marks(hhdr);
hhdr -> hb_last_reclaimed = (unsigned short)GC_gc_no;
return(TRUE);
}
| 0
|
88,854
|
decode(message *m, const char *in, unsigned char *out, unsigned char (*decoder)(char), bool isFast)
{
unsigned char b1, b2, b3, b4;
unsigned char cb1, cb2, cb3; /* carried over from last line */
/*cli_dbgmsg("decode %s (len %d isFast %d base64chars %d)\n", in,
in ? strlen(in) : 0,
isFast, m->base64chars);*/
cb1 = cb2 = cb3 = '\0';
switch(m->base64chars) {
case 3:
cb3 = m->base64_3;
/* FALLTHROUGH */
case 2:
cb2 = m->base64_2;
/* FALLTHROUGH */
case 1:
cb1 = m->base64_1;
isFast = FALSE;
break;
default:
assert(m->base64chars <= 3);
}
if(isFast)
/* Fast decoding if not last line */
while(*in) {
b1 = (*decoder)(*in++);
b2 = (*decoder)(*in++);
b3 = (*decoder)(*in++);
/*
* Put this line here to help on some compilers which
* can make use of some architecure's ability to
* multiprocess when different variables can be
* updated at the same time - here b3 is used in
* one line, b1/b2 in the next and b4 in the next after
* that, b3 and b4 rely on in but b1/b2 don't
*/
*out++ = (b1 << 2) | ((b2 >> 4) & 0x3);
b4 = (*decoder)(*in++);
*out++ = (b2 << 4) | ((b3 >> 2) & 0xF);
*out++ = (b3 << 6) | (b4 & 0x3F);
}
else if(in == NULL) { /* flush */
int nbytes;
if(m->base64chars == 0)
return out;
cli_dbgmsg("base64chars = %d (%c %c %c)\n", m->base64chars,
isalnum(cb1) ? cb1 : '@',
isalnum(cb2) ? cb2 : '@',
isalnum(cb3) ? cb3 : '@');
m->base64chars--;
b1 = cb1;
nbytes = 1;
if(m->base64chars) {
m->base64chars--;
b2 = cb2;
if(m->base64chars) {
nbytes = 2;
m->base64chars--;
b3 = cb3;
nbytes = 3;
} else if(b2)
nbytes = 2;
}
switch(nbytes) {
case 3:
b4 = '\0';
/* fall through */
case 4:
*out++ = (b1 << 2) | ((b2 >> 4) & 0x3);
*out++ = (b2 << 4) | ((b3 >> 2) & 0xF);
if((nbytes == 4) || (b3&0x3))
*out++ = (b3 << 6) | (b4 & 0x3F);
break;
case 2:
*out++ = (b1 << 2) | ((b2 >> 4) & 0x3);
if((b2 << 4) & 0xFF)
*out++ = b2 << 4;
break;
case 1:
*out++ = b1 << 2;
break;
default:
assert(0);
}
} else while(*in) {
int nbytes;
if(m->base64chars) {
m->base64chars--;
b1 = cb1;
} else
b1 = (*decoder)(*in++);
if(*in == '\0') {
b2 = '\0';
nbytes = 1;
} else {
if(m->base64chars) {
m->base64chars--;
b2 = cb2;
} else
b2 = (*decoder)(*in++);
if(*in == '\0') {
b3 = '\0';
nbytes = 2;
} else {
if(m->base64chars) {
m->base64chars--;
b3 = cb3;
} else
b3 = (*decoder)(*in++);
if(*in == '\0') {
b4 = '\0';
nbytes = 3;
} else {
b4 = (*decoder)(*in++);
nbytes = 4;
}
}
}
switch(nbytes) {
case 4:
*out++ = (b1 << 2) | ((b2 >> 4) & 0x3);
*out++ = (b2 << 4) | ((b3 >> 2) & 0xF);
*out++ = (b3 << 6) | (b4 & 0x3F);
continue;
case 3:
m->base64_3 = b3;
case 2:
m->base64_2 = b2;
case 1:
m->base64_1 = b1;
m->base64chars = nbytes;
break;
default:
assert(0);
}
break; /* nbytes != 4 => EOL */
}
return out;
}
| 0
|
241,332
|
standard_end(png_structp ppIn, png_infop pi)
{
png_const_structp pp = ppIn;
standard_display *dp = voidcast(standard_display*,
png_get_progressive_ptr(pp));
UNUSED(pi)
/* Validate the image - progressive reading only produces one variant for
* interlaced images.
*/
standard_text_validate(dp, pp, pi,
PNG_LIBPNG_VER >= 10518/*check_end: see comments above*/);
standard_image_validate(dp, pp, 0, -1);
}
| 0
|
284,684
|
unsupported_nesting(enum ofpact_type action, enum ofpact_type outer_action)
{
VLOG_WARN("%s action doesn't support nested action %s",
ofpact_name(outer_action), ofpact_name(action));
return OFPERR_OFPBAC_BAD_ARGUMENT;
}
| 0
|
300,634
|
static int amd_gpio_get_value(struct gpio_chip *gc, unsigned offset)
{
u32 pin_reg;
unsigned long flags;
struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
spin_lock_irqsave(&gpio_dev->lock, flags);
pin_reg = readl(gpio_dev->base + offset * 4);
spin_unlock_irqrestore(&gpio_dev->lock, flags);
return !!(pin_reg & BIT(PIN_STS_OFF));
}
| 0
|
186,452
|
void WebGL2RenderingContextBase::bufferSubData(GLenum target,
long long offset,
DOMArrayBuffer* data) {
WebGLRenderingContextBase::bufferSubData(target, offset, data);
}
| 0
|
517,073
|
uint st_select_lex_node::get_in_sum_expr() { return 0; }
| 0
|
271,263
|
static int __find_bmc_prod_dev_id(struct device *dev, void *data)
{
struct prod_dev_id *cid = data;
struct bmc_device *bmc;
int rv;
if (dev->type != &bmc_device_type)
return 0;
bmc = to_bmc_device(dev);
rv = (bmc->id.product_id == cid->product_id
&& bmc->id.device_id == cid->device_id);
if (rv)
rv = kref_get_unless_zero(&bmc->usecount);
return rv;
}
| 0
|
265,997
|
void crypto_unregister_skcipher(struct skcipher_alg *alg)
{
crypto_unregister_alg(&alg->base);
}
| 0
|
256,582
|
static inline uint32_t cirrus_src32 ( CirrusVGAState * s , uint32_t srcaddr ) {
uint32_t * src ;
if ( s -> cirrus_srccounter ) {
src = ( void * ) & s -> cirrus_bltbuf [ srcaddr & ( CIRRUS_BLTBUFSIZE - 1 ) & ~ 3 ] ;
}
else {
src = ( void * ) & s -> vga . vram_ptr [ srcaddr & s -> cirrus_addr_mask & ~ 3 ] ;
}
return * src ;
}
| 0
|
476,447
|
static int rtsx_usb_ms_suspend(struct device *dev)
{
struct rtsx_usb_ms *host = dev_get_drvdata(dev);
struct memstick_host *msh = host->msh;
/* Since we use rtsx_usb's resume callback to runtime resume its
* children to implement remote wakeup signaling, this causes
* rtsx_usb_ms' runtime resume callback runs after its suspend
* callback:
* rtsx_usb_ms_suspend()
* rtsx_usb_resume()
* -> rtsx_usb_ms_runtime_resume()
* -> memstick_detect_change()
*
* rtsx_usb_suspend()
*
* To avoid this, skip runtime resume/suspend if system suspend is
* underway.
*/
host->system_suspending = true;
memstick_suspend_host(msh);
return 0;
}
| 0
|
184,169
|
void RenderViewImpl::FocusNext() {
Send(new ViewHostMsg_TakeFocus(GetRoutingID(), false));
}
| 0
|
364,602
|
static char *nntp_parsesuccess(char *str, const char **status)
{
char *success = NULL;
if (!strncmp(str, "283 ", 4)) {
success = str+4;
}
if (status) *status = NULL;
return success;
}
| 0
|
423,326
|
static inline void tcp_openreq_init(struct request_sock *req,
struct tcp_options_received *rx_opt,
struct sk_buff *skb)
{
struct inet_request_sock *ireq = inet_rsk(req);
req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
req->cookie_ts = 0;
tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
tcp_rsk(req)->snt_synack = 0;
req->mss = rx_opt->mss_clamp;
req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
ireq->tstamp_ok = rx_opt->tstamp_ok;
ireq->sack_ok = rx_opt->sack_ok;
ireq->snd_wscale = rx_opt->snd_wscale;
ireq->wscale_ok = rx_opt->wscale_ok;
ireq->acked = 0;
ireq->ecn_ok = 0;
ireq->ir_rmt_port = tcp_hdr(skb)->source;
ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
}
| 0
|
311,088
|
void NavigationControllerImpl::RendererDidNavigateInPage(
const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry) {
DCHECK(PageTransitionIsMainFrame(params.transition)) <<
"WebKit should only tell us about in-page navs for the main frame.";
NavigationEntryImpl* existing_entry = GetEntryWithPageID(
web_contents_->GetSiteInstance(), params.page_id);
existing_entry->SetURL(params.url);
if (existing_entry->update_virtual_url_with_url())
UpdateVirtualURLToURL(existing_entry, params.url);
*did_replace_entry = true;
DiscardNonCommittedEntriesInternal();
last_committed_entry_index_ =
GetEntryIndexWithPageID(web_contents_->GetSiteInstance(), params.page_id);
}
| 0
|
238,561
|
void UiSceneCreator::CreateBackground() {
auto background =
Create<Background>(k2dBrowsingTexturedBackground, kPhaseBackground);
background->SetVisible(false);
background->AddBinding(base::MakeUnique<Binding<bool>>(
base::BindRepeating(
[](Model* m) {
return m->background_available && m->background_loaded;
},
base::Unretained(model_)),
base::BindRepeating([](UiElement* e, const bool& v) { e->SetVisible(v); },
base::Unretained(background.get()))));
scene_->AddUiElement(k2dBrowsingBackground, std::move(background));
auto element = Create<UiElement>(k2dBrowsingDefaultBackground, kPhaseNone);
element->set_hit_testable(false);
element->AddBinding(base::MakeUnique<Binding<bool>>(
base::BindRepeating([](Model* m) { return !m->background_available; },
base::Unretained(model_)),
base::BindRepeating([](UiElement* e, const bool& v) { e->SetVisible(v); },
base::Unretained(element.get()))));
scene_->AddUiElement(k2dBrowsingBackground, std::move(element));
struct Panel {
UiElementName name;
int x_offset;
int y_offset;
int z_offset;
int x_rotation;
int y_rotation;
int angle;
};
const std::vector<Panel> panels = {
{kBackgroundFront, 0, 0, -1, 0, 1, 0},
{kBackgroundLeft, -1, 0, 0, 0, 1, 1},
{kBackgroundBack, 0, 0, 1, 0, 1, 2},
{kBackgroundRight, 1, 0, 0, 0, 1, 3},
{kBackgroundTop, 0, 1, 0, 1, 0, 1},
{kBackgroundBottom, 0, -1, 0, 1, 0, -1},
};
for (auto& panel : panels) {
auto panel_element = Create<Rect>(panel.name, kPhaseBackground);
panel_element->SetSize(kSceneSize, kSceneSize);
panel_element->SetTranslate(panel.x_offset * kSceneSize / 2,
panel.y_offset * kSceneSize / 2,
panel.z_offset * kSceneSize / 2);
panel_element->SetRotate(panel.x_rotation, panel.y_rotation, 0,
base::kPiFloat / 2 * panel.angle);
panel_element->set_hit_testable(false);
BindColor(model_, panel_element.get(), &ColorScheme::world_background,
&Rect::SetColor);
panel_element->AddBinding(
VR_BIND_FUNC(bool, Model, model_, should_render_web_vr() == false,
UiElement, panel_element.get(), SetVisible));
scene_->AddUiElement(k2dBrowsingDefaultBackground,
std::move(panel_element));
}
auto floor = Create<Grid>(kFloor, kPhaseFloorCeiling);
floor->SetSize(kSceneSize, kSceneSize);
floor->SetTranslate(0.0, -kSceneHeight / 2, 0.0);
floor->SetRotate(1, 0, 0, -base::kPiFloat / 2);
floor->set_gridline_count(kFloorGridlineCount);
floor->set_focusable(false);
BindColor(model_, floor.get(), &ColorScheme::floor, &Grid::SetCenterColor);
BindColor(model_, floor.get(), &ColorScheme::world_background,
&Grid::SetEdgeColor);
BindColor(model_, floor.get(), &ColorScheme::floor_grid, &Grid::SetGridColor);
scene_->AddUiElement(k2dBrowsingDefaultBackground, std::move(floor));
auto ceiling = Create<Rect>(kCeiling, kPhaseFloorCeiling);
ceiling->set_focusable(false);
ceiling->SetSize(kSceneSize, kSceneSize);
ceiling->SetTranslate(0.0, kSceneHeight / 2, 0.0);
ceiling->SetRotate(1, 0, 0, base::kPiFloat / 2);
BindColor(model_, ceiling.get(), &ColorScheme::ceiling,
&Rect::SetCenterColor);
BindColor(model_, ceiling.get(), &ColorScheme::world_background,
&Rect::SetEdgeColor);
scene_->AddUiElement(k2dBrowsingDefaultBackground, std::move(ceiling));
}
| 0
|
6,623
|
monitor_init(void)
{
struct ssh *ssh = active_state; /* XXX */
struct monitor *mon;
mon = xcalloc(1, sizeof(*mon));
monitor_openfds(mon, 1);
/* Used to share zlib space across processes */
if (options.compression) {
mon->m_zback = mm_create(NULL, MM_MEMSIZE);
mon->m_zlib = mm_create(mon->m_zback, 20 * MM_MEMSIZE);
/* Compression needs to share state across borders */
ssh_packet_set_compress_hooks(ssh, mon->m_zlib,
(ssh_packet_comp_alloc_func *)mm_zalloc,
(ssh_packet_comp_free_func *)mm_zfree);
}
return mon;
}
| 1
|
155,887
|
static void rds_ib_sub_signaled(struct rds_ib_connection *ic, int nr)
{
if ((atomic_sub_return(nr, &ic->i_signaled_sends) == 0) &&
waitqueue_active(&rds_ib_ring_empty_wait))
wake_up(&rds_ib_ring_empty_wait);
BUG_ON(atomic_read(&ic->i_signaled_sends) < 0);
}
| 0
|
125,102
|
FileModule *_af_ms_adpcm_init_compress (Track *track, File *fh,
bool canSeek, bool headerless, AFframecount *chunkFrames)
{
return MSADPCM::createCompress(track, fh, canSeek, headerless, chunkFrames);
}
| 0
|
431,758
|
CmdMergeAuthzCollections() : Command("_mergeAuthzCollections") {}
| 0
|
8,931
|
void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, unsigned size)
{
if (!dd->locked)
error_msg_and_die("dump_dir is not opened"); /* bug */
if (!str_is_correct_filename(name))
error_msg_and_die("Cannot save binary. '%s' is not a valid file name", name);
char *full_path = concat_path_file(dd->dd_dirname, name);
save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid, dd->mode);
free(full_path);
}
| 1
|
363,492
|
irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
{
int rc;
if (!server)
{
weechat_printf (NULL,
_("%s%s: sending data to server: null pointer (please "
"report problem to developers)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return 0;
}
if (size_buf <= 0)
{
weechat_printf (server->buffer,
_("%s%s: sending data to server: empty buffer (please "
"report problem to developers)"),
weechat_prefix ("error"), IRC_PLUGIN_NAME);
return 0;
}
#ifdef HAVE_GNUTLS
if (server->ssl_connected)
rc = gnutls_record_send (server->gnutls_sess, buffer, size_buf);
else
#endif
rc = send (server->sock, buffer, size_buf, 0);
if (rc < 0)
{
#ifdef HAVE_GNUTLS
if (server->ssl_connected)
{
weechat_printf (server->buffer,
_("%s%s: sending data to server: %d %s"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
rc,
gnutls_strerror (rc));
}
else
#endif
{
weechat_printf (server->buffer,
_("%s%s: sending data to server: %d %s"),
weechat_prefix ("error"), IRC_PLUGIN_NAME,
errno,
strerror (errno));
}
}
return rc;
}
| 0
|
334,819
|
void event_notifier_set_handler(EventNotifier *e,
EventNotifierHandler *handler)
{
iohandler_init();
aio_set_event_notifier(iohandler_ctx, e, false,
handler, NULL);
}
| 0
|
122,567
|
njs_array_length_redefine(njs_vm_t *vm, njs_value_t *value, uint32_t length)
{
njs_object_prop_t *prop;
static const njs_value_t string_length = njs_string("length");
if (njs_slow_path(!njs_is_array(value))) {
njs_internal_error(vm, "njs_array_length_redefine() "
"applied to non-array");
return NJS_ERROR;
}
prop = njs_object_property_add(vm, value, njs_value_arg(&string_length), 1);
if (njs_slow_path(prop == NULL)) {
njs_internal_error(vm, "njs_array_length_redefine() "
"cannot redefine \"length\"");
return NJS_ERROR;
}
prop->enumerable = 0;
prop->configurable = 0;
njs_value_number_set(&prop->value, length);
return NJS_OK;
}
| 0
|
57,552
|
bool proc_fill_cache(struct file *file, struct dir_context *ctx,
const char *name, int len,
instantiate_t instantiate, struct task_struct *task, const void *ptr)
{
struct dentry *child, *dir = file->f_path.dentry;
struct qstr qname = QSTR_INIT(name, len);
struct inode *inode;
unsigned type;
ino_t ino;
child = d_hash_and_lookup(dir, &qname);
if (!child) {
child = d_alloc(dir, &qname);
if (!child)
goto end_instantiate;
if (instantiate(d_inode(dir), child, task, ptr) < 0) {
dput(child);
goto end_instantiate;
}
}
inode = d_inode(child);
ino = inode->i_ino;
type = inode->i_mode >> 12;
dput(child);
return dir_emit(ctx, name, len, ino, type);
end_instantiate:
return dir_emit(ctx, name, len, 1, DT_UNKNOWN);
}
| 0
|
289,098
|
TEST_F ( ExtensionServiceSyncTest , ProcessSyncDataSettings ) {
InitializeEmptyExtensionService ( ) ;
extension_sync_service ( ) -> MergeDataAndStartSyncing ( syncer : : EXTENSIONS , syncer : : SyncDataList ( ) , base : : MakeUnique < syncer : : FakeSyncChangeProcessor > ( ) , base : : MakeUnique < syncer : : SyncErrorFactoryMock > ( ) ) ;
InstallCRX ( data_dir ( ) . AppendASCII ( "good.crx" ) , INSTALL_NEW ) ;
EXPECT_TRUE ( service ( ) -> IsExtensionEnabled ( good_crx ) ) ;
EXPECT_FALSE ( extensions : : util : : IsIncognitoEnabled ( good_crx , profile ( ) ) ) ;
auto get_permissions_modifier = [ this ] ( ) {
const Extension * extension = registry ( ) -> GetExtensionById ( good_crx , extensions : : ExtensionRegistry : : EVERYTHING ) ;
return base : : MakeUnique < ScriptingPermissionsModifier > ( profile ( ) , extension ) ;
}
;
EXPECT_FALSE ( get_permissions_modifier ( ) -> HasSetAllowedOnAllUrls ( ) ) ;
const bool kDefaultAllowedScripting = ScriptingPermissionsModifier : : DefaultAllowedOnAllUrls ( ) ;
EXPECT_EQ ( kDefaultAllowedScripting , get_permissions_modifier ( ) -> IsAllowedOnAllUrls ( ) ) ;
sync_pb : : EntitySpecifics specifics ;
sync_pb : : ExtensionSpecifics * ext_specifics = specifics . mutable_extension ( ) ;
ext_specifics -> set_id ( good_crx ) ;
ext_specifics -> set_version ( service ( ) -> GetInstalledExtension ( good_crx ) -> version ( ) -> GetString ( ) ) ;
ext_specifics -> set_enabled ( false ) ;
{
SyncChangeList list = MakeSyncChangeList ( good_crx , specifics , SyncChange : : ACTION_UPDATE ) ;
extension_sync_service ( ) -> ProcessSyncChanges ( FROM_HERE , list ) ;
EXPECT_FALSE ( service ( ) -> IsExtensionEnabled ( good_crx ) ) ;
EXPECT_FALSE ( extensions : : util : : IsIncognitoEnabled ( good_crx , profile ( ) ) ) ;
EXPECT_FALSE ( get_permissions_modifier ( ) -> HasSetAllowedOnAllUrls ( ) ) ;
EXPECT_EQ ( kDefaultAllowedScripting , get_permissions_modifier ( ) -> IsAllowedOnAllUrls ( ) ) ;
}
{
ext_specifics -> set_enabled ( true ) ;
ext_specifics -> set_incognito_enabled ( true ) ;
SyncChangeList list = MakeSyncChangeList ( good_crx , specifics , SyncChange : : ACTION_UPDATE ) ;
extension_sync_service ( ) -> ProcessSyncChanges ( FROM_HERE , list ) ;
EXPECT_TRUE ( service ( ) -> IsExtensionEnabled ( good_crx ) ) ;
EXPECT_TRUE ( extensions : : util : : IsIncognitoEnabled ( good_crx , profile ( ) ) ) ;
}
{
ext_specifics -> set_enabled ( false ) ;
ext_specifics -> set_incognito_enabled ( true ) ;
SyncChangeList list = MakeSyncChangeList ( good_crx , specifics , SyncChange : : ACTION_UPDATE ) ;
extension_sync_service ( ) -> ProcessSyncChanges ( FROM_HERE , list ) ;
EXPECT_FALSE ( service ( ) -> IsExtensionEnabled ( good_crx ) ) ;
EXPECT_TRUE ( extensions : : util : : IsIncognitoEnabled ( good_crx , profile ( ) ) ) ;
}
{
ext_specifics -> set_enabled ( true ) ;
ext_specifics -> set_all_urls_enabled ( ! kDefaultAllowedScripting ) ;
SyncChangeList list = MakeSyncChangeList ( good_crx , specifics , SyncChange : : ACTION_UPDATE ) ;
extension_sync_service ( ) -> ProcessSyncChanges ( FROM_HERE , list ) ;
EXPECT_TRUE ( service ( ) -> IsExtensionEnabled ( good_crx ) ) ;
EXPECT_TRUE ( get_permissions_modifier ( ) -> HasSetAllowedOnAllUrls ( ) ) ;
EXPECT_EQ ( ! kDefaultAllowedScripting , get_permissions_modifier ( ) -> IsAllowedOnAllUrls ( ) ) ;
}
{
ext_specifics -> set_all_urls_enabled ( kDefaultAllowedScripting ) ;
SyncChangeList list = MakeSyncChangeList ( good_crx , specifics , SyncChange : : ACTION_UPDATE ) ;
extension_sync_service ( ) -> ProcessSyncChanges ( FROM_HERE , list ) ;
EXPECT_TRUE ( service ( ) -> IsExtensionEnabled ( good_crx ) ) ;
EXPECT_TRUE ( get_permissions_modifier ( ) -> HasSetAllowedOnAllUrls ( ) ) ;
EXPECT_EQ ( kDefaultAllowedScripting , get_permissions_modifier ( ) -> IsAllowedOnAllUrls ( ) ) ;
}
EXPECT_FALSE ( service ( ) -> pending_extension_manager ( ) -> IsIdPending ( good_crx ) ) ;
}
| 0
|
211,484
|
bool TabStrip::IsTabStripCloseable() const {
return !IsDragSessionActive();
}
| 0
|
96,670
|
compile_return(char_u *arg, int check_return_type, int legacy, cctx_T *cctx)
{
char_u *p = arg;
type_T *stack_type;
if (*p != NUL && *p != '|' && *p != '\n')
{
// For a lambda, "return expr" is always used, also when "expr" results
// in a void.
if (cctx->ctx_ufunc->uf_ret_type->tt_type == VAR_VOID
&& (cctx->ctx_ufunc->uf_flags & FC_LAMBDA) == 0)
{
emsg(_(e_returning_value_in_function_without_return_type));
return NULL;
}
if (legacy)
{
int save_flags = cmdmod.cmod_flags;
generate_LEGACY_EVAL(cctx, p);
if (need_type(&t_any, cctx->ctx_ufunc->uf_ret_type, -1,
0, cctx, FALSE, FALSE) == FAIL)
return NULL;
cmdmod.cmod_flags |= CMOD_LEGACY;
(void)skip_expr(&p, NULL);
cmdmod.cmod_flags = save_flags;
}
else
{
// compile return argument into instructions
if (compile_expr0(&p, cctx) == FAIL)
return NULL;
}
if (cctx->ctx_skip != SKIP_YES)
{
// "check_return_type" with uf_ret_type set to &t_unknown is used
// for an inline function without a specified return type. Set the
// return type here.
stack_type = get_type_on_stack(cctx, 0);
if ((check_return_type && (cctx->ctx_ufunc->uf_ret_type == NULL
|| cctx->ctx_ufunc->uf_ret_type == &t_unknown))
|| (!check_return_type
&& cctx->ctx_ufunc->uf_ret_type == &t_unknown))
{
cctx->ctx_ufunc->uf_ret_type = stack_type;
}
else
{
if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, -1,
0, cctx, FALSE, FALSE) == FAIL)
return NULL;
}
}
}
else
{
// "check_return_type" cannot be TRUE, only used for a lambda which
// always has an argument.
if (cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_VOID
&& cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_UNKNOWN)
{
emsg(_(e_missing_return_value));
return NULL;
}
// No argument, return zero.
generate_PUSHNR(cctx, 0);
}
// Undo any command modifiers.
generate_undo_cmdmods(cctx);
if (cctx->ctx_skip != SKIP_YES && generate_instr(cctx, ISN_RETURN) == NULL)
return NULL;
// "return val | endif" is possible
return skipwhite(p);
}
| 0
|
232,254
|
MYSQLND_METHOD(mysqlnd_protocol, get_row_packet)(MYSQLND_PROTOCOL * const protocol, zend_bool persistent TSRMLS_DC)
{
struct st_mysqlnd_packet_row * packet = mnd_pecalloc(1, packet_methods[PROT_ROW_PACKET].struct_size, persistent);
DBG_ENTER("mysqlnd_protocol::get_row_packet");
if (packet) {
packet->header.m = &packet_methods[PROT_ROW_PACKET];
packet->header.persistent = persistent;
}
DBG_RETURN(packet);
}
| 0
|
11,738
|
void OPENSSL_fork_child(void)
{
rand_fork();
}
| 1
|
125,427
|
static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
{
return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(address);
}
| 0
|
278,470
|
void BrowserWindowGtk::Paste() {
gtk_window_util::DoPaste(
window_, chrome::GetActiveWebContents(browser_.get()));
}
| 0
|
496,557
|
void SNC_io_parser<EW>::read_items(int plus01) {
typename std::vector<Vertex_iterator>::iterator vi;
for(vi=Vertex_of.begin(); vi!=Vertex_of.end(); ++vi) {
if (!read_vertex<K>(*vi))
{
std::cerr<<"SNC_io_parser::read: error in node line"<<std::endl;
return;
}
}
typename std::vector<Halfedge_iterator>::iterator ei;
for(ei=Edge_of.begin(); ei!=Edge_of.end(); ++ei) {
if (!read_edge<K>(*ei))
{
std::cerr<<"SNC_io_parser::read: error in edge line"<<std::endl;
return;
}
}
typedef typename std::vector<Halffacet_iterator>::iterator vhf_iterator;
vhf_iterator fi;
for(fi=Halffacet_of.begin(); fi!=Halffacet_of.end(); ++fi) {
if (!read_facet<K>(*fi))
{
std::cerr<<"SNC_io_parser::read: error in facet line"<<std::endl;
return;
}
}
typename std::vector<Volume_iterator>::iterator ci;
for(ci=Volume_of.begin()+plus01; ci!=Volume_of.end(); ++ci) {
if (!read_volume(*ci))
{
std::cerr<<"SNC_io_parser::read: error in volume line"<<std::endl;
return;
}
}
typename std::vector<SHalfedge_iterator>::iterator sei;
for(sei=SEdge_of.begin(); sei!=SEdge_of.end(); ++sei) {
if (!read_sedge<K>(*sei))
{
std::cerr<<"SNC_io_parser::read: error in sedge line"<<std::endl;
return;
}
}
typename std::vector<SHalfloop_iterator>::iterator sli;
for(sli=SLoop_of.begin(); sli!=SLoop_of.end(); ++sli) {
if (!read_sloop<K>(*sli))
{
std::cerr<<"SNC_io_parser::read: error in sloop line"<<std::endl;
return;
}
}
typename std::vector<SFace_iterator>::iterator sfi;
for(sfi=SFace_of.begin(); sfi!=SFace_of.end(); ++sfi) {
if (!read_sface(*sfi))
{
std::cerr<<"SNC_io_parser::read: error in sface line"<<std::endl;
return;
}
}
SNC_constructor C(*this->sncp());
C.assign_indices();
}
| 0
|
92,737
|
static int _notifier_call_chain(struct regulator_dev *rdev,
unsigned long event, void *data)
{
/* call rdev chain first */
return blocking_notifier_call_chain(&rdev->notifier, event, data);
}
| 0
|
117,825
|
static void hns_gmac_autoneg_stat(void *mac_drv, u32 *enable)
{
struct mac_driver *drv = (struct mac_driver *)mac_drv;
*enable = dsaf_get_dev_bit(drv, GMAC_TRANSMIT_CONTROL_REG,
GMAC_TX_AN_EN_B);
}
| 0
|
153,873
|
static GF_Err parse_track_action_params(char *string, TrackAction *action)
{
char *param = string;
if (!action || !string) return GF_BAD_PARAM;
while (param) {
param = gf_url_colon_suffix(param);
if (param) {
*param = 0;
param++;
#ifndef GPAC_DISABLE_MEDIA_EXPORT
if (!strncmp("vttnomerge", param, 10)) {
action->dump_type |= GF_EXPORT_WEBVTT_NOMERGE;
} else if (!strncmp("layer", param, 5)) {
action->dump_type |= GF_EXPORT_SVC_LAYER;
} else if (!strncmp("full", param, 4)) {
action->dump_type |= GF_EXPORT_NHML_FULL;
} else if (!strncmp("embedded", param, 8)) {
action->dump_type |= GF_EXPORT_WEBVTT_META_EMBEDDED;
} else if (!strncmp("output=", param, 7)) {
action->out_name = gf_strdup(param+7);
} else if (!strncmp("src=", param, 4)) {
action->src_name = gf_strdup(param+4);
} else if (!strncmp("box=", param, 4)) {
action->src_name = gf_strdup(param+4);
action->sample_num = 1;
} else if (!strncmp("type=", param, 4)) {
action->udta_type = GF_4CC(param[5], param[6], param[7], param[8]);
} else if (action->dump_type == GF_EXPORT_RAW_SAMPLES) {
action->sample_num = atoi(param);
}
#endif
}
}
if (!strcmp(string, "*")) {
action->trackID = (u32) -1;
} else {
action->trackID = atoi(string);
}
return GF_OK;
}
| 0
|
79,419
|
fst_q_work_item(u64 * queue, int card_index)
{
unsigned long flags;
u64 mask;
/*
* Grab the queue exclusively
*/
spin_lock_irqsave(&fst_work_q_lock, flags);
/*
* Making an entry in the queue is simply a matter of setting
* a bit for the card indicating that there is work to do in the
* bottom half for the card. Note the limitation of 64 cards.
* That ought to be enough
*/
mask = (u64)1 << card_index;
*queue |= mask;
spin_unlock_irqrestore(&fst_work_q_lock, flags);
}
| 0
|
33,914
|
static void sigterm(int sig)
{
const int olderrno = errno;
(void) sig;
stop_server = 1;
if (listenfd != -1) {
shutdown(listenfd, 2);
(void) close(listenfd);
}
if (listenfd6 != -1) {
shutdown(listenfd6, 2);
(void) close(listenfd6);
}
errno = olderrno;
}
| 0
|
392,563
|
static void pcpu_balance_workfn(struct work_struct *work)
{
LIST_HEAD(to_free);
struct list_head *free_head = &pcpu_slot[pcpu_nr_slots - 1];
struct pcpu_chunk *chunk, *next;
int slot, nr_to_pop, ret;
/*
* There's no reason to keep around multiple unused chunks and VM
* areas can be scarce. Destroy all free chunks except for one.
*/
mutex_lock(&pcpu_alloc_mutex);
spin_lock_irq(&pcpu_lock);
list_for_each_entry_safe(chunk, next, free_head, list) {
WARN_ON(chunk->immutable);
/* spare the first one */
if (chunk == list_first_entry(free_head, struct pcpu_chunk, list))
continue;
list_del_init(&chunk->map_extend_list);
list_move(&chunk->list, &to_free);
}
spin_unlock_irq(&pcpu_lock);
list_for_each_entry_safe(chunk, next, &to_free, list) {
int rs, re;
pcpu_for_each_pop_region(chunk, rs, re, 0, pcpu_unit_pages) {
pcpu_depopulate_chunk(chunk, rs, re);
spin_lock_irq(&pcpu_lock);
pcpu_chunk_depopulated(chunk, rs, re);
spin_unlock_irq(&pcpu_lock);
}
pcpu_destroy_chunk(chunk);
}
/* service chunks which requested async area map extension */
do {
int new_alloc = 0;
spin_lock_irq(&pcpu_lock);
chunk = list_first_entry_or_null(&pcpu_map_extend_chunks,
struct pcpu_chunk, map_extend_list);
if (chunk) {
list_del_init(&chunk->map_extend_list);
new_alloc = pcpu_need_to_extend(chunk, false);
}
spin_unlock_irq(&pcpu_lock);
if (new_alloc)
pcpu_extend_area_map(chunk, new_alloc);
} while (chunk);
/*
* Ensure there are certain number of free populated pages for
* atomic allocs. Fill up from the most packed so that atomic
* allocs don't increase fragmentation. If atomic allocation
* failed previously, always populate the maximum amount. This
* should prevent atomic allocs larger than PAGE_SIZE from keeping
* failing indefinitely; however, large atomic allocs are not
* something we support properly and can be highly unreliable and
* inefficient.
*/
retry_pop:
if (pcpu_atomic_alloc_failed) {
nr_to_pop = PCPU_EMPTY_POP_PAGES_HIGH;
/* best effort anyway, don't worry about synchronization */
pcpu_atomic_alloc_failed = false;
} else {
nr_to_pop = clamp(PCPU_EMPTY_POP_PAGES_HIGH -
pcpu_nr_empty_pop_pages,
0, PCPU_EMPTY_POP_PAGES_HIGH);
}
for (slot = pcpu_size_to_slot(PAGE_SIZE); slot < pcpu_nr_slots; slot++) {
int nr_unpop = 0, rs, re;
if (!nr_to_pop)
break;
spin_lock_irq(&pcpu_lock);
list_for_each_entry(chunk, &pcpu_slot[slot], list) {
nr_unpop = pcpu_unit_pages - chunk->nr_populated;
if (nr_unpop)
break;
}
spin_unlock_irq(&pcpu_lock);
if (!nr_unpop)
continue;
/* @chunk can't go away while pcpu_alloc_mutex is held */
pcpu_for_each_unpop_region(chunk, rs, re, 0, pcpu_unit_pages) {
int nr = min(re - rs, nr_to_pop);
ret = pcpu_populate_chunk(chunk, rs, rs + nr);
if (!ret) {
nr_to_pop -= nr;
spin_lock_irq(&pcpu_lock);
pcpu_chunk_populated(chunk, rs, rs + nr);
spin_unlock_irq(&pcpu_lock);
} else {
nr_to_pop = 0;
}
if (!nr_to_pop)
break;
}
}
if (nr_to_pop) {
/* ran out of chunks to populate, create a new one and retry */
chunk = pcpu_create_chunk();
if (chunk) {
spin_lock_irq(&pcpu_lock);
pcpu_chunk_relocate(chunk, -1);
spin_unlock_irq(&pcpu_lock);
goto retry_pop;
}
}
mutex_unlock(&pcpu_alloc_mutex);
}
| 0
|
305,180
|
SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
u64 persistent_fid, u64 volatile_fid)
{
struct smb2_close_req *req;
struct smb2_close_rsp *rsp;
struct TCP_Server_Info *server;
struct cifs_ses *ses = tcon->ses;
struct kvec iov[1];
int resp_buftype;
int rc = 0;
cifs_dbg(FYI, "Close\n");
if (ses && (ses->server))
server = ses->server;
else
return -EIO;
rc = small_smb2_init(SMB2_CLOSE, tcon, (void **) &req);
if (rc)
return rc;
req->PersistentFileId = persistent_fid;
req->VolatileFileId = volatile_fid;
iov[0].iov_base = (char *)req;
/* 4 for rfc1002 length field */
iov[0].iov_len = get_rfc1002_length(req) + 4;
rc = SendReceive2(xid, ses, iov, 1, &resp_buftype, 0);
rsp = (struct smb2_close_rsp *)iov[0].iov_base;
if (rc != 0) {
if (tcon)
cifs_stats_fail_inc(tcon, SMB2_CLOSE_HE);
goto close_exit;
}
/* BB FIXME - decode close response, update inode for caching */
close_exit:
free_rsp_buf(resp_buftype, rsp);
return rc;
}
| 0
|
494,973
|
static vm_fault_t snd_pcm_mmap_data_fault(struct vm_fault *vmf)
{
struct snd_pcm_substream *substream = vmf->vma->vm_private_data;
struct snd_pcm_runtime *runtime;
unsigned long offset;
struct page * page;
size_t dma_bytes;
if (substream == NULL)
return VM_FAULT_SIGBUS;
runtime = substream->runtime;
offset = vmf->pgoff << PAGE_SHIFT;
dma_bytes = PAGE_ALIGN(runtime->dma_bytes);
if (offset > dma_bytes - PAGE_SIZE)
return VM_FAULT_SIGBUS;
if (substream->ops->page)
page = substream->ops->page(substream, offset);
else if (!snd_pcm_get_dma_buf(substream))
page = virt_to_page(runtime->dma_area + offset);
else
page = snd_sgbuf_get_page(snd_pcm_get_dma_buf(substream), offset);
if (!page)
return VM_FAULT_SIGBUS;
get_page(page);
vmf->page = page;
return 0;
}
| 0
|
419,826
|
void server_process_syslog_message(
Server *s,
const char *buf,
size_t raw_len,
const struct ucred *ucred,
const struct timeval *tv,
const char *label,
size_t label_len) {
char *t, syslog_priority[sizeof("PRIORITY=") + DECIMAL_STR_MAX(int)],
syslog_facility[sizeof("SYSLOG_FACILITY=") + DECIMAL_STR_MAX(int)];
const char *msg, *syslog_ts, *a;
_cleanup_free_ char *identifier = NULL, *pid = NULL,
*dummy = NULL, *msg_msg = NULL, *msg_raw = NULL;
int priority = LOG_USER | LOG_INFO, r;
ClientContext *context = NULL;
struct iovec *iovec;
size_t n = 0, m, i, leading_ws, syslog_ts_len;
bool store_raw;
assert(s);
assert(buf);
/* The message cannot be empty. */
assert(raw_len > 0);
/* The buffer NUL-terminated and can be used a string. raw_len is the length
* without the terminating NUL byte, the buffer is actually one bigger. */
assert(buf[raw_len] == '\0');
if (ucred && pid_is_valid(ucred->pid)) {
r = client_context_get(s, ucred->pid, ucred, label, label_len, NULL, &context);
if (r < 0)
log_warning_errno(r, "Failed to retrieve credentials for PID " PID_FMT ", ignoring: %m", ucred->pid);
}
/* We are creating a copy of the message because we want to forward the original message
verbatim to the legacy syslog implementation */
for (i = raw_len; i > 0; i--)
if (!strchr(WHITESPACE, buf[i-1]))
break;
leading_ws = strspn(buf, WHITESPACE);
if (i == 0)
/* The message contains only whitespaces */
msg = buf + raw_len;
else if (i == raw_len)
/* Nice! No need to strip anything on the end, let's optimize this a bit */
msg = buf + leading_ws;
else {
msg = dummy = new(char, i - leading_ws + 1);
if (!dummy) {
log_oom();
return;
}
memcpy(dummy, buf + leading_ws, i - leading_ws);
dummy[i - leading_ws] = 0;
}
/* We will add the SYSLOG_RAW= field when we stripped anything
* _or_ if the input message contained NUL bytes. */
store_raw = msg != buf || strlen(msg) != raw_len;
syslog_parse_priority(&msg, &priority, true);
if (!client_context_test_priority(context, priority))
return;
syslog_ts = msg;
syslog_ts_len = syslog_skip_timestamp(&msg);
if (syslog_ts_len == 0)
/* We failed to parse the full timestamp, store the raw message too */
store_raw = true;
syslog_parse_identifier(&msg, &identifier, &pid);
if (s->forward_to_syslog)
forward_syslog_raw(s, priority, buf, raw_len, ucred, tv);
if (s->forward_to_kmsg)
server_forward_kmsg(s, priority, identifier, msg, ucred);
if (s->forward_to_console)
server_forward_console(s, priority, identifier, msg, ucred);
if (s->forward_to_wall)
server_forward_wall(s, priority, identifier, msg, ucred);
m = N_IOVEC_META_FIELDS + 8 + client_context_extra_fields_n_iovec(context);
iovec = newa(struct iovec, m);
iovec[n++] = IOVEC_MAKE_STRING("_TRANSPORT=syslog");
xsprintf(syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK);
iovec[n++] = IOVEC_MAKE_STRING(syslog_priority);
if (priority & LOG_FACMASK) {
xsprintf(syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority));
iovec[n++] = IOVEC_MAKE_STRING(syslog_facility);
}
if (identifier) {
a = strjoina("SYSLOG_IDENTIFIER=", identifier);
iovec[n++] = IOVEC_MAKE_STRING(a);
}
if (pid) {
a = strjoina("SYSLOG_PID=", pid);
iovec[n++] = IOVEC_MAKE_STRING(a);
}
if (syslog_ts_len > 0) {
const size_t hlen = strlen("SYSLOG_TIMESTAMP=");
t = newa(char, hlen + syslog_ts_len);
memcpy(t, "SYSLOG_TIMESTAMP=", hlen);
memcpy(t + hlen, syslog_ts, syslog_ts_len);
iovec[n++] = IOVEC_MAKE(t, hlen + syslog_ts_len);
}
msg_msg = strjoin("MESSAGE=", msg);
if (!msg_msg) {
log_oom();
return;
}
iovec[n++] = IOVEC_MAKE_STRING(msg_msg);
if (store_raw) {
const size_t hlen = strlen("SYSLOG_RAW=");
msg_raw = new(char, hlen + raw_len);
if (!msg_raw) {
log_oom();
return;
}
memcpy(msg_raw, "SYSLOG_RAW=", hlen);
memcpy(msg_raw + hlen, buf, raw_len);
iovec[n++] = IOVEC_MAKE(msg_raw, hlen + raw_len);
}
server_dispatch_message(s, iovec, n, m, context, tv, priority, 0);
}
| 0
|
356,322
|
static int add_parents_to_list(struct rev_info *revs, struct commit *commit, struct commit_list **list)
{
struct commit_list *parent = commit->parents;
unsigned left_flag;
if (commit->object.flags & ADDED)
return 0;
commit->object.flags |= ADDED;
/*
* If the commit is uninteresting, don't try to
* prune parents - we want the maximal uninteresting
* set.
*
* Normally we haven't parsed the parent
* yet, so we won't have a parent of a parent
* here. However, it may turn out that we've
* reached this commit some other way (where it
* wasn't uninteresting), in which case we need
* to mark its parents recursively too..
*/
if (commit->object.flags & UNINTERESTING) {
while (parent) {
struct commit *p = parent->item;
parent = parent->next;
if (parse_commit(p) < 0)
return -1;
p->object.flags |= UNINTERESTING;
if (p->parents)
mark_parents_uninteresting(p);
if (p->object.flags & SEEN)
continue;
p->object.flags |= SEEN;
insert_by_date(p, list);
}
return 0;
}
/*
* Ok, the commit wasn't uninteresting. Try to
* simplify the commit history and find the parent
* that has no differences in the path set if one exists.
*/
try_to_simplify_commit(revs, commit);
if (revs->no_walk)
return 0;
left_flag = (commit->object.flags & SYMMETRIC_LEFT);
for (parent = commit->parents; parent; parent = parent->next) {
struct commit *p = parent->item;
if (parse_commit(p) < 0)
return -1;
p->object.flags |= left_flag;
if (!(p->object.flags & SEEN)) {
p->object.flags |= SEEN;
insert_by_date(p, list);
}
if(revs->first_parent_only)
break;
}
return 0;
}
| 0
|
324,188
|
static const char *token_get_value(QObject *obj)
{
return qdict_get_str(qobject_to_qdict(obj), "token");
}
| 0
|
377,562
|
static int ide_handle_rw_error(IDEState *s, int error, int op)
{
bool is_read = (op & BM_STATUS_RETRY_READ) != 0;
BlockErrorAction action = bdrv_get_error_action(s->bs, is_read, error);
if (action == BDRV_ACTION_STOP) {
s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
s->bus->error_status = op;
} else if (action == BDRV_ACTION_REPORT) {
if (op & BM_STATUS_DMA_RETRY) {
dma_buf_commit(s);
ide_dma_error(s);
} else {
ide_rw_error(s);
}
}
bdrv_error_action(s->bs, action, is_read, error);
return action != BDRV_ACTION_IGNORE;
}
| 0
|
109,535
|
float32 helper_fqtos(CPUSPARCState *env)
{
float32 ret;
clear_float_exceptions(env);
ret = float128_to_float32(QT1, &env->fp_status);
check_ieee_exceptions(env);
return ret;
}
| 0
|
414,217
|
contact_list_uids_handler (LDAPOp *op,
LDAPMessage *res)
{
LDAPGetContactListUIDsOp *contact_list_uids_op = (LDAPGetContactListUIDsOp *) op;
EBookBackendLDAP *bl = E_BOOK_BACKEND_LDAP (op->backend);
LDAPMessage *e;
gint msg_type;
GTimeVal start, end;
gulong diff;
if (enable_debug) {
printf ("contact_list_uids_handler ...\n");
g_get_current_time (&start);
}
g_rec_mutex_lock (&eds_ldap_handler_lock);
if (!bl->priv->ldap) {
g_rec_mutex_unlock (&eds_ldap_handler_lock);
e_data_book_respond_get_contact_list_uids (op->book, op->opid, EDB_ERROR_NOT_CONNECTED (), NULL);
ldap_op_finished (op);
if (enable_debug)
printf ("contact_list_uids_handler ... ldap handler is NULL \n");
return;
}
g_rec_mutex_unlock (&eds_ldap_handler_lock);
msg_type = ldap_msgtype (res);
if (msg_type == LDAP_RES_SEARCH_ENTRY) {
g_rec_mutex_lock (&eds_ldap_handler_lock);
if (bl->priv->ldap)
e = ldap_first_entry (bl->priv->ldap, res);
else
e = NULL;
g_rec_mutex_unlock (&eds_ldap_handler_lock);
while (NULL != e) {
EContact *contact;
gchar *uid = NULL;
contact = build_contact_from_entry (bl, e, NULL, &uid);
g_clear_object (&contact);
if (enable_debug)
printf ("uid = %s\n", uid ? uid : "(null)");
if (uid)
contact_list_uids_op->uids = g_slist_append (contact_list_uids_op->uids, uid);
g_rec_mutex_lock (&eds_ldap_handler_lock);
if (bl->priv->ldap)
e = ldap_next_entry (bl->priv->ldap, e);
else
e = NULL;
g_rec_mutex_unlock (&eds_ldap_handler_lock);
}
} else if (msg_type == LDAP_RES_SEARCH_REFERENCE) {
/* ignore references */
} else if (msg_type == LDAP_RES_SEARCH_RESULT) {
gchar *ldap_error_msg = NULL;
gint ldap_error;
g_rec_mutex_lock (&eds_ldap_handler_lock);
if (bl->priv->ldap) {
ldap_parse_result (
bl->priv->ldap, res, &ldap_error,
NULL, &ldap_error_msg, NULL, NULL, 0);
} else {
ldap_error = LDAP_SERVER_DOWN;
}
g_rec_mutex_unlock (&eds_ldap_handler_lock);
if (ldap_error != LDAP_SUCCESS) {
g_warning (
"contact_list_uids_handler: %02X (%s), additional info: %s",
ldap_error,
ldap_err2string (ldap_error), ldap_error_msg);
}
if (ldap_error_msg)
ldap_memfree (ldap_error_msg);
g_warning ("search returned %d\n", ldap_error);
if (ldap_error == LDAP_TIMELIMIT_EXCEEDED)
e_data_book_respond_get_contact_list_uids (
op->book, op->opid,
EDB_ERROR (SEARCH_TIME_LIMIT_EXCEEDED),
contact_list_uids_op->uids);
else if (ldap_error == LDAP_SIZELIMIT_EXCEEDED)
e_data_book_respond_get_contact_list_uids (
op->book, op->opid,
EDB_ERROR (SEARCH_SIZE_LIMIT_EXCEEDED),
contact_list_uids_op->uids);
else if (ldap_error == LDAP_SUCCESS)
e_data_book_respond_get_contact_list_uids (
op->book, op->opid,
EDB_ERROR (SUCCESS),
contact_list_uids_op->uids);
else
e_data_book_respond_get_contact_list_uids (
op->book, op->opid,
ldap_error_to_response (ldap_error),
contact_list_uids_op->uids);
ldap_op_finished (op);
if (enable_debug) {
printf ("contact_list_uids_handler success ");
g_get_current_time (&end);
diff = end.tv_sec * 1000 + end.tv_usec / 1000;
diff -= start.tv_sec * 1000 + start.tv_usec / 1000;
printf ("and took %ld.%03ld seconds\n", diff / 1000, diff % 1000);
}
}
else {
g_warning ("unhandled search result type %d returned", msg_type);
e_data_book_respond_get_contact_list_uids (
op->book, op->opid,
e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR,
_("%s: Unhandled search result type %d returned"), G_STRFUNC, msg_type),
NULL);
ldap_op_finished (op);
}
}
| 0
|
102,273
|
static int nntp_mbox_sync(struct Mailbox *m, int *index_hint)
{
if (!m)
return -1;
struct NntpMboxData *mdata = m->mdata;
int rc;
/* check for new articles */
mdata->adata->check_time = 0;
rc = check_mailbox(m);
if (rc)
return rc;
#ifdef USE_HCACHE
mdata->last_cached = 0;
header_cache_t *hc = nntp_hcache_open(mdata);
#endif
for (int i = 0; i < m->msg_count; i++)
{
struct Email *e = m->emails[i];
if (!e)
break;
char buf[16];
snprintf(buf, sizeof(buf), ANUM, nntp_edata_get(e)->article_num);
if (mdata->bcache && e->deleted)
{
mutt_debug(LL_DEBUG2, "mutt_bcache_del %s\n", buf);
mutt_bcache_del(mdata->bcache, buf);
}
#ifdef USE_HCACHE
if (hc && (e->changed || e->deleted))
{
if (e->deleted && !e->read)
mdata->unread--;
mutt_debug(LL_DEBUG2, "mutt_hcache_store %s\n", buf);
mutt_hcache_store(hc, buf, strlen(buf), e, 0);
}
#endif
}
#ifdef USE_HCACHE
if (hc)
{
mutt_hcache_close(hc);
mdata->last_cached = mdata->last_loaded;
}
#endif
/* save .newsrc entries */
nntp_newsrc_gen_entries(m);
nntp_newsrc_update(mdata->adata);
nntp_newsrc_close(mdata->adata);
return 0;
}
| 0
|
221,423
|
String Document::OutgoingReferrer() const {
const Document* referrer_document = this;
if (GetSecurityOrigin()->IsOpaque())
return String();
if (LocalFrame* frame = frame_) {
while (frame->GetDocument()->IsSrcdocDocument()) {
frame = To<LocalFrame>(frame->Tree().Parent());
DCHECK(frame);
}
referrer_document = frame->GetDocument();
}
return referrer_document->url_.StrippedForUseAsReferrer();
}
| 0
|
191,862
|
void ewk_view_pre_render_cancel(Evas_Object* ewkView)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
EINA_SAFETY_ON_NULL_RETURN(smartData->api->pre_render_cancel);
smartData->api->pre_render_cancel(smartData);
}
| 0
|
121,308
|
DEFINE_TEST(test_read_too_many_filters)
{
const char *name = "test_read_too_many_filters.gz";
struct archive *a;
int r;
assert((a = archive_read_new()) != NULL);
r = archive_read_support_filter_gzip(a);
if (r == ARCHIVE_WARN) {
skipping("gzip reading not fully supported on this platform");
}
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
extract_reference_file(name);
assertEqualIntA(a, ARCHIVE_FATAL,
archive_read_open_filename(a, name, 200));
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}
| 0
|
427,157
|
static void __gvt_cache_remove_entry(struct intel_vgpu *vgpu,
struct gvt_dma *entry)
{
rb_erase(&entry->gfn_node, &vgpu->vdev.gfn_cache);
rb_erase(&entry->dma_addr_node, &vgpu->vdev.dma_addr_cache);
kfree(entry);
vgpu->vdev.nr_cache_entries--;
}
| 0
|
178,606
|
void FrameLoader::setDefersLoading(bool defers)
{
if (m_documentLoader)
m_documentLoader->setDefersLoading(defers);
if (m_provisionalDocumentLoader)
m_provisionalDocumentLoader->setDefersLoading(defers);
if (m_policyDocumentLoader)
m_policyDocumentLoader->setDefersLoading(defers);
if (!defers) {
m_frame->redirectScheduler()->startTimer();
startCheckCompleteTimer();
}
}
| 0
|
311,768
|
void FinishParseMediaMetadata(
metadata::MediaMetadataParser* /* parser */,
const extensions::api::media_galleries::MediaMetadata& metadata,
const std::vector<metadata::AttachedImage>& attached_images) {
Send(new ChromeUtilityHostMsg_ParseMediaMetadata_Finished(
true, *metadata.ToValue(), attached_images));
ReleaseProcessIfNeeded();
}
| 0
|
439,977
|
void
http_parser_init (http_parser *parser, enum http_parser_type t)
{
void *data = parser->data; /* preserve application data */
memset(parser, 0, sizeof(*parser));
parser->data = data;
parser->type = t;
parser->state = (t == HTTP_REQUEST ? s_start_req : (t == HTTP_RESPONSE ? s_start_res : s_start_req_or_res));
parser->http_errno = HPE_OK;
| 0
|
456,400
|
static void delete_char(struct vc_data *vc, unsigned int nr)
{
unsigned short *p = (unsigned short *) vc->vc_pos;
vc_uniscr_delete(vc, nr);
scr_memcpyw(p, p + nr, (vc->vc_cols - vc->state.x - nr) * 2);
scr_memsetw(p + vc->vc_cols - vc->state.x - nr, vc->vc_video_erase_char,
nr * 2);
vc->vc_need_wrap = 0;
if (con_should_update(vc))
do_update_region(vc, (unsigned long) p,
vc->vc_cols - vc->state.x);
}
| 0
|
56,330
|
static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *laddr)
{
struct sctp_hashbucket *head;
struct sctp_ep_common *epb;
struct sctp_endpoint *ep;
struct hlist_node *node;
int hash;
hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port));
head = &sctp_ep_hashtable[hash];
read_lock(&head->lock);
sctp_for_each_hentry(epb, node, &head->chain) {
ep = sctp_ep(epb);
if (sctp_endpoint_is_match(ep, laddr))
goto hit;
}
ep = sctp_sk((sctp_get_ctl_sock()))->ep;
hit:
sctp_endpoint_hold(ep);
read_unlock(&head->lock);
return ep;
}
| 0
|
6,372
|
static int oidc_request_post_preserved_restore(request_rec *r,
const char *original_url) {
oidc_debug(r, "enter: original_url=%s", original_url);
const char *method = "postOnLoad";
const char *script =
apr_psprintf(r->pool,
" <script type=\"text/javascript\">\n"
" function str_decode(string) {\n"
" try {\n"
" result = decodeURIComponent(string);\n"
" } catch (e) {\n"
" result = unescape(string);\n"
" }\n"
" return result;\n"
" }\n"
" function %s() {\n"
" var mod_auth_openidc_preserve_post_params = JSON.parse(sessionStorage.getItem('mod_auth_openidc_preserve_post_params'));\n"
" sessionStorage.removeItem('mod_auth_openidc_preserve_post_params');\n"
" for (var key in mod_auth_openidc_preserve_post_params) {\n"
" var input = document.createElement(\"input\");\n"
" input.name = str_decode(key);\n"
" input.value = str_decode(mod_auth_openidc_preserve_post_params[key]);\n"
" input.type = \"hidden\";\n"
" document.forms[0].appendChild(input);\n"
" }\n"
" document.forms[0].action = '%s';\n"
" document.forms[0].submit();\n"
" }\n"
" </script>\n", method, original_url);
const char *body = " <p>Restoring...</p>\n"
" <form method=\"post\"></form>\n";
return oidc_util_html_send(r, "Restoring...", script, method, body,
OK);
}
| 1
|
380,466
|
evbuffer_expand(struct evbuffer *buf, size_t datlen)
{
struct evbuffer_chain *chain;
EVBUFFER_LOCK(buf);
chain = evbuffer_expand_singlechain(buf, datlen);
EVBUFFER_UNLOCK(buf);
return chain ? 0 : -1;
}
| 0
|
211,566
|
void InspectorPageAgent::setDeviceOrientationOverride(ErrorString* error, double alpha, double beta, double gamma)
| 0
|
151,709
|
CConfig CUser::ToConfig() const {
CConfig config;
CConfig passConfig;
CString sHash;
switch (m_eHashType) {
case HASH_NONE:
sHash = "Plain";
break;
case HASH_MD5:
sHash = "MD5";
break;
case HASH_SHA256:
sHash = "SHA256";
break;
}
passConfig.AddKeyValuePair("Salt", m_sPassSalt);
passConfig.AddKeyValuePair("Method", sHash);
passConfig.AddKeyValuePair("Hash", GetPass());
config.AddSubConfig("Pass", "password", passConfig);
config.AddKeyValuePair("Nick", GetNick());
config.AddKeyValuePair("AltNick", GetAltNick());
config.AddKeyValuePair("Ident", GetIdent());
config.AddKeyValuePair("RealName", GetRealName());
config.AddKeyValuePair("BindHost", GetBindHost());
config.AddKeyValuePair("DCCBindHost", GetDCCBindHost());
config.AddKeyValuePair("QuitMsg", GetQuitMsg());
if (CZNC::Get().GetStatusPrefix() != GetStatusPrefix())
config.AddKeyValuePair("StatusPrefix", GetStatusPrefix());
config.AddKeyValuePair("Skin", GetSkinName());
config.AddKeyValuePair("ChanModes", GetDefaultChanModes());
config.AddKeyValuePair("ChanBufferSize", CString(GetChanBufferSize()));
config.AddKeyValuePair("QueryBufferSize", CString(GetQueryBufferSize()));
config.AddKeyValuePair("AutoClearChanBuffer",
CString(AutoClearChanBuffer()));
config.AddKeyValuePair("AutoClearQueryBuffer",
CString(AutoClearQueryBuffer()));
config.AddKeyValuePair("MultiClients", CString(MultiClients()));
config.AddKeyValuePair("DenyLoadMod", CString(DenyLoadMod()));
config.AddKeyValuePair("Admin", CString(IsAdmin()));
config.AddKeyValuePair("DenySetBindHost", CString(DenySetBindHost()));
config.AddKeyValuePair("TimestampFormat", GetTimestampFormat());
config.AddKeyValuePair("AppendTimestamp", CString(GetTimestampAppend()));
config.AddKeyValuePair("PrependTimestamp", CString(GetTimestampPrepend()));
config.AddKeyValuePair("AuthOnlyViaModule", CString(AuthOnlyViaModule()));
config.AddKeyValuePair("Timezone", m_sTimezone);
config.AddKeyValuePair("JoinTries", CString(m_uMaxJoinTries));
config.AddKeyValuePair("MaxNetworks", CString(m_uMaxNetworks));
config.AddKeyValuePair("MaxQueryBuffers", CString(m_uMaxQueryBuffers));
config.AddKeyValuePair("MaxJoins", CString(m_uMaxJoins));
config.AddKeyValuePair("ClientEncoding", GetClientEncoding());
config.AddKeyValuePair("Language", GetLanguage());
config.AddKeyValuePair("NoTrafficTimeout", CString(GetNoTrafficTimeout()));
// Allow Hosts
if (!m_ssAllowedHosts.empty()) {
for (const CString& sHost : m_ssAllowedHosts) {
config.AddKeyValuePair("Allow", sHost);
}
}
// CTCP Replies
if (!m_mssCTCPReplies.empty()) {
for (const auto& itb : m_mssCTCPReplies) {
config.AddKeyValuePair("CTCPReply",
itb.first.AsUpper() + " " + itb.second);
}
}
// Modules
const CModules& Mods = GetModules();
if (!Mods.empty()) {
for (CModule* pMod : Mods) {
CString sArgs = pMod->GetArgs();
if (!sArgs.empty()) {
sArgs = " " + sArgs;
}
config.AddKeyValuePair("LoadModule", pMod->GetModName() + sArgs);
}
}
// Networks
for (CIRCNetwork* pNetwork : m_vIRCNetworks) {
config.AddSubConfig("Network", pNetwork->GetName(),
pNetwork->ToConfig());
}
return config;
}
| 0
|
45,014
|
void *UntrustedCacheMalloc::GetBuffer() {
void **buffers = nullptr;
void *buffer;
bool is_pool_empty;
{
LockGuard spin_lock(&lock_);
is_pool_empty = buffer_pool_.empty();
if (is_pool_empty) {
buffers =
primitives::AllocateUntrustedBuffers(kPoolIncrement, kPoolEntrySize);
for (int i = 0; i < kPoolIncrement; i++) {
void *buf = buffers[i];
if (!buf || !TrustedPrimitives::IsOutsideEnclave(buf, kPoolEntrySize)) {
TrustedPrimitives::BestEffortAbort(
"Cached buffer is not outside the enclave");
}
buffer_pool_.push(buf);
}
}
buffer = buffer_pool_.top();
buffer_pool_.pop();
busy_buffers_.insert(buffer);
}
if (is_pool_empty) {
// Free memory held by the array of buffer pointers returned by
// AllocateUntrustedBuffers.
Free(buffers);
}
return buffer;
}
| 0
|
398,387
|
inbound_cap_nak (server *serv, const message_tags_data *tags_data)
{
serv->sent_capend = TRUE;
tcp_send_len (serv, "CAP END\r\n", 9);
}
| 0
|
426,370
|
static Image *ReadTIFFImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
#define ThrowTIFFException(severity,message) \
{ \
if (tiff_pixels != (unsigned char *) NULL) \
tiff_pixels=(unsigned char *) RelinquishMagickMemory(tiff_pixels); \
if (quantum_info != (QuantumInfo *) NULL) \
quantum_info=DestroyQuantumInfo(quantum_info); \
TIFFClose(tiff); \
ThrowReaderException(severity,message); \
}
const char
*option;
float
*chromaticity,
x_position,
y_position,
x_resolution,
y_resolution;
Image
*image;
int
tiff_status;
MagickBooleanType
more_frames,
status;
MagickSizeType
number_pixels;
QuantumInfo
*quantum_info;
QuantumType
quantum_type;
register ssize_t
i;
size_t
pad;
ssize_t
y;
TIFF
*tiff;
TIFFMethodType
method;
uint16
compress_tag,
bits_per_sample,
endian,
extra_samples,
interlace,
max_sample_value,
min_sample_value,
orientation,
pages,
photometric,
*sample_info,
sample_format,
samples_per_pixel,
units,
value;
uint32
height,
rows_per_strip,
width;
unsigned char
*tiff_pixels;
/*
Open image.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
(void) SetMagickThreadValue(tiff_exception,exception);
tiff=TIFFClientOpen(image->filename,"rb",(thandle_t) image,TIFFReadBlob,
TIFFWriteBlob,TIFFSeekBlob,TIFFCloseBlob,TIFFGetBlobSize,TIFFMapBlob,
TIFFUnmapBlob);
if (tiff == (TIFF *) NULL)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
if (exception->severity > ErrorException)
{
TIFFClose(tiff);
image=DestroyImageList(image);
return((Image *) NULL);
}
if (image_info->number_scenes != 0)
{
/*
Generate blank images for subimage specification (e.g. image.tif[4].
We need to check the number of directores because it is possible that
the subimage(s) are stored in the photoshop profile.
*/
if (image_info->scene < (size_t) TIFFNumberOfDirectories(tiff))
{
for (i=0; i < (ssize_t) image_info->scene; i++)
{
status=TIFFReadDirectory(tiff) != 0 ? MagickTrue : MagickFalse;
if (status == MagickFalse)
{
TIFFClose(tiff);
image=DestroyImageList(image);
return((Image *) NULL);
}
AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
TIFFClose(tiff);
image=DestroyImageList(image);
return((Image *) NULL);
}
image=SyncNextImageInList(image);
}
}
}
more_frames=MagickTrue;
do
{
DisableMSCWarning(4127)
if (0 && (image_info->verbose != MagickFalse))
TIFFPrintDirectory(tiff,stdout,MagickFalse);
RestoreMSCWarning
photometric=PHOTOMETRIC_RGB;
if ((TIFFGetField(tiff,TIFFTAG_IMAGEWIDTH,&width) != 1) ||
(TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&height) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_PHOTOMETRIC,&photometric) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_COMPRESSION,&compress_tag) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&endian) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_PLANARCONFIG,&interlace) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,&samples_per_pixel) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,&bits_per_sample) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLEFORMAT,&sample_format) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_MINSAMPLEVALUE,&min_sample_value) != 1) ||
(TIFFGetFieldDefaulted(tiff,TIFFTAG_MAXSAMPLEVALUE,&max_sample_value) != 1))
{
TIFFClose(tiff);
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
if (((sample_format != SAMPLEFORMAT_IEEEFP) || (bits_per_sample == 64)) &&
((bits_per_sample <= 0) || (bits_per_sample > 32)))
{
TIFFClose(tiff);
ThrowReaderException(CorruptImageError,"UnsupportedBitsPerPixel");
}
if (sample_format == SAMPLEFORMAT_IEEEFP)
(void) SetImageProperty(image,"quantum:format","floating-point",
exception);
switch (photometric)
{
case PHOTOMETRIC_MINISBLACK:
{
(void) SetImageProperty(image,"tiff:photometric","min-is-black",
exception);
break;
}
case PHOTOMETRIC_MINISWHITE:
{
(void) SetImageProperty(image,"tiff:photometric","min-is-white",
exception);
break;
}
case PHOTOMETRIC_PALETTE:
{
(void) SetImageProperty(image,"tiff:photometric","palette",exception);
break;
}
case PHOTOMETRIC_RGB:
{
(void) SetImageProperty(image,"tiff:photometric","RGB",exception);
break;
}
case PHOTOMETRIC_CIELAB:
{
(void) SetImageProperty(image,"tiff:photometric","CIELAB",exception);
break;
}
case PHOTOMETRIC_LOGL:
{
(void) SetImageProperty(image,"tiff:photometric","CIE Log2(L)",
exception);
break;
}
case PHOTOMETRIC_LOGLUV:
{
(void) SetImageProperty(image,"tiff:photometric","LOGLUV",exception);
break;
}
#if defined(PHOTOMETRIC_MASK)
case PHOTOMETRIC_MASK:
{
(void) SetImageProperty(image,"tiff:photometric","MASK",exception);
break;
}
#endif
case PHOTOMETRIC_SEPARATED:
{
(void) SetImageProperty(image,"tiff:photometric","separated",exception);
break;
}
case PHOTOMETRIC_YCBCR:
{
(void) SetImageProperty(image,"tiff:photometric","YCBCR",exception);
break;
}
default:
{
(void) SetImageProperty(image,"tiff:photometric","unknown",exception);
break;
}
}
if (image->debug != MagickFalse)
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"Geometry: %ux%u",
(unsigned int) width,(unsigned int) height);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"Interlace: %u",
interlace);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Bits per sample: %u",bits_per_sample);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Min sample value: %u",min_sample_value);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Max sample value: %u",max_sample_value);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"Photometric "
"interpretation: %s",GetImageProperty(image,"tiff:photometric",
exception));
}
image->columns=(size_t) width;
image->rows=(size_t) height;
image->depth=(size_t) bits_per_sample;
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"Image depth: %.20g",
(double) image->depth);
image->endian=MSBEndian;
if (endian == FILLORDER_LSB2MSB)
image->endian=LSBEndian;
#if defined(MAGICKCORE_HAVE_TIFFISBIGENDIAN)
if (TIFFIsBigEndian(tiff) == 0)
{
(void) SetImageProperty(image,"tiff:endian","lsb",exception);
image->endian=LSBEndian;
}
else
{
(void) SetImageProperty(image,"tiff:endian","msb",exception);
image->endian=MSBEndian;
}
#endif
if ((photometric == PHOTOMETRIC_MINISBLACK) ||
(photometric == PHOTOMETRIC_MINISWHITE))
SetImageColorspace(image,GRAYColorspace,exception);
if (photometric == PHOTOMETRIC_SEPARATED)
SetImageColorspace(image,CMYKColorspace,exception);
if (photometric == PHOTOMETRIC_CIELAB)
SetImageColorspace(image,LabColorspace,exception);
TIFFGetProfiles(tiff,image,exception);
TIFFGetProperties(tiff,image,exception);
option=GetImageOption(image_info,"tiff:exif-properties");
if (IsStringFalse(option) == MagickFalse) /* enabled by default */
TIFFGetEXIFProperties(tiff,image,exception);
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_SAMPLESPERPIXEL,
&samples_per_pixel);
if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XRESOLUTION,&x_resolution) == 1) &&
(TIFFGetFieldDefaulted(tiff,TIFFTAG_YRESOLUTION,&y_resolution) == 1))
{
image->resolution.x=x_resolution;
image->resolution.y=y_resolution;
}
if (TIFFGetFieldDefaulted(tiff,TIFFTAG_RESOLUTIONUNIT,&units) == 1)
{
if (units == RESUNIT_INCH)
image->units=PixelsPerInchResolution;
if (units == RESUNIT_CENTIMETER)
image->units=PixelsPerCentimeterResolution;
}
if ((TIFFGetFieldDefaulted(tiff,TIFFTAG_XPOSITION,&x_position) == 1) &&
(TIFFGetFieldDefaulted(tiff,TIFFTAG_YPOSITION,&y_position) == 1))
{
image->page.x=(ssize_t) ceil(x_position*image->resolution.x-0.5);
image->page.y=(ssize_t) ceil(y_position*image->resolution.y-0.5);
}
if (TIFFGetFieldDefaulted(tiff,TIFFTAG_ORIENTATION,&orientation) == 1)
image->orientation=(OrientationType) orientation;
if (TIFFGetField(tiff,TIFFTAG_WHITEPOINT,&chromaticity) == 1)
{
if (chromaticity != (float *) NULL)
{
image->chromaticity.white_point.x=chromaticity[0];
image->chromaticity.white_point.y=chromaticity[1];
}
}
if (TIFFGetField(tiff,TIFFTAG_PRIMARYCHROMATICITIES,&chromaticity) == 1)
{
if (chromaticity != (float *) NULL)
{
image->chromaticity.red_primary.x=chromaticity[0];
image->chromaticity.red_primary.y=chromaticity[1];
image->chromaticity.green_primary.x=chromaticity[2];
image->chromaticity.green_primary.y=chromaticity[3];
image->chromaticity.blue_primary.x=chromaticity[4];
image->chromaticity.blue_primary.y=chromaticity[5];
}
}
#if defined(MAGICKCORE_HAVE_TIFFISCODECCONFIGURED) || (TIFFLIB_VERSION > 20040919)
if ((compress_tag != COMPRESSION_NONE) &&
(TIFFIsCODECConfigured(compress_tag) == 0))
{
TIFFClose(tiff);
ThrowReaderException(CoderError,"CompressNotSupported");
}
#endif
switch (compress_tag)
{
case COMPRESSION_NONE: image->compression=NoCompression; break;
case COMPRESSION_CCITTFAX3: image->compression=FaxCompression; break;
case COMPRESSION_CCITTFAX4: image->compression=Group4Compression; break;
case COMPRESSION_JPEG:
{
image->compression=JPEGCompression;
#if defined(JPEG_SUPPORT)
{
char
sampling_factor[MagickPathExtent];
uint16
horizontal,
vertical;
tiff_status=TIFFGetField(tiff,TIFFTAG_YCBCRSUBSAMPLING,&horizontal,
&vertical);
if (tiff_status == 1)
{
(void) FormatLocaleString(sampling_factor,MagickPathExtent,
"%dx%d",horizontal,vertical);
(void) SetImageProperty(image,"jpeg:sampling-factor",
sampling_factor,exception);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
"Sampling Factors: %s",sampling_factor);
}
}
#endif
break;
}
case COMPRESSION_OJPEG: image->compression=JPEGCompression; break;
#if defined(COMPRESSION_LZMA)
case COMPRESSION_LZMA: image->compression=LZMACompression; break;
#endif
case COMPRESSION_LZW: image->compression=LZWCompression; break;
case COMPRESSION_DEFLATE: image->compression=ZipCompression; break;
case COMPRESSION_ADOBE_DEFLATE: image->compression=ZipCompression; break;
#if defined(COMPRESSION_WEBP)
case COMPRESSION_WEBP: image->compression=WebPCompression; break;
#endif
#if defined(COMPRESSION_ZSTD)
case COMPRESSION_ZSTD: image->compression=ZstdCompression; break;
#endif
default: image->compression=RLECompression; break;
}
quantum_info=(QuantumInfo *) NULL;
if ((photometric == PHOTOMETRIC_PALETTE) &&
(pow(2.0,1.0*bits_per_sample) <= MaxColormapSize))
{
size_t
colors;
colors=(size_t) GetQuantumRange(bits_per_sample)+1;
if (AcquireImageColormap(image,colors,exception) == MagickFalse)
{
TIFFClose(tiff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
}
value=(unsigned short) image->scene;
if (TIFFGetFieldDefaulted(tiff,TIFFTAG_PAGENUMBER,&value,&pages) == 1)
image->scene=value;
if (image->storage_class == PseudoClass)
{
size_t
range;
uint16
*blue_colormap,
*green_colormap,
*red_colormap;
/*
Initialize colormap.
*/
tiff_status=TIFFGetField(tiff,TIFFTAG_COLORMAP,&red_colormap,
&green_colormap,&blue_colormap);
if (tiff_status == 1)
{
if ((red_colormap != (uint16 *) NULL) &&
(green_colormap != (uint16 *) NULL) &&
(blue_colormap != (uint16 *) NULL))
{
range=255; /* might be old style 8-bit colormap */
for (i=0; i < (ssize_t) image->colors; i++)
if ((red_colormap[i] >= 256) || (green_colormap[i] >= 256) ||
(blue_colormap[i] >= 256))
{
range=65535;
break;
}
for (i=0; i < (ssize_t) image->colors; i++)
{
image->colormap[i].red=ClampToQuantum(((double)
QuantumRange*red_colormap[i])/range);
image->colormap[i].green=ClampToQuantum(((double)
QuantumRange*green_colormap[i])/range);
image->colormap[i].blue=ClampToQuantum(((double)
QuantumRange*blue_colormap[i])/range);
}
}
}
}
if (image_info->ping != MagickFalse)
{
if (image_info->number_scenes != 0)
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
goto next_tiff_frame;
}
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
{
TIFFClose(tiff);
return(DestroyImageList(image));
}
status=ResetImagePixels(image,exception);
if (status == MagickFalse)
{
TIFFClose(tiff);
return(DestroyImageList(image));
}
/*
Allocate memory for the image and pixel buffer.
*/
tiff_pixels=(unsigned char *) NULL;
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
if (sample_format == SAMPLEFORMAT_UINT)
status=SetQuantumFormat(image,quantum_info,UnsignedQuantumFormat);
if (sample_format == SAMPLEFORMAT_INT)
status=SetQuantumFormat(image,quantum_info,SignedQuantumFormat);
if (sample_format == SAMPLEFORMAT_IEEEFP)
status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);
if (status == MagickFalse)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
status=MagickTrue;
switch (photometric)
{
case PHOTOMETRIC_MINISBLACK:
{
quantum_info->min_is_white=MagickFalse;
break;
}
case PHOTOMETRIC_MINISWHITE:
{
quantum_info->min_is_white=MagickTrue;
break;
}
default:
break;
}
tiff_status=TIFFGetFieldDefaulted(tiff,TIFFTAG_EXTRASAMPLES,&extra_samples,
&sample_info);
if (tiff_status == 1)
{
(void) SetImageProperty(image,"tiff:alpha","unspecified",exception);
if (extra_samples == 0)
{
if ((samples_per_pixel == 4) && (photometric == PHOTOMETRIC_RGB))
image->alpha_trait=BlendPixelTrait;
}
else
for (i=0; i < extra_samples; i++)
{
image->alpha_trait=BlendPixelTrait;
if (sample_info[i] == EXTRASAMPLE_ASSOCALPHA)
{
SetQuantumAlphaType(quantum_info,AssociatedQuantumAlpha);
(void) SetImageProperty(image,"tiff:alpha","associated",
exception);
}
else
if (sample_info[i] == EXTRASAMPLE_UNASSALPHA)
{
SetQuantumAlphaType(quantum_info,DisassociatedQuantumAlpha);
(void) SetImageProperty(image,"tiff:alpha","unassociated",
exception);
}
}
}
if (image->alpha_trait != UndefinedPixelTrait)
(void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
method=ReadGenericMethod;
rows_per_strip=(uint32) image->rows;
if (TIFFGetField(tiff,TIFFTAG_ROWSPERSTRIP,&rows_per_strip) == 1)
{
char
buffer[MagickPathExtent];
method=ReadStripMethod;
(void) FormatLocaleString(buffer,MagickPathExtent,"%u",
(unsigned int) rows_per_strip);
(void) SetImageProperty(image,"tiff:rows-per-strip",buffer,exception);
}
if (rows_per_strip > (uint32) image->rows)
rows_per_strip=(uint32) image->rows;
if ((samples_per_pixel >= 3) && (interlace == PLANARCONFIG_CONTIG))
if ((image->alpha_trait == UndefinedPixelTrait) ||
(samples_per_pixel >= 4))
method=ReadRGBAMethod;
if ((samples_per_pixel >= 4) && (interlace == PLANARCONFIG_SEPARATE))
if ((image->alpha_trait == UndefinedPixelTrait) ||
(samples_per_pixel >= 5))
method=ReadCMYKAMethod;
if ((photometric != PHOTOMETRIC_RGB) &&
(photometric != PHOTOMETRIC_CIELAB) &&
(photometric != PHOTOMETRIC_SEPARATED))
method=ReadGenericMethod;
if (image->storage_class == PseudoClass)
method=ReadSingleSampleMethod;
if ((photometric == PHOTOMETRIC_MINISBLACK) ||
(photometric == PHOTOMETRIC_MINISWHITE))
method=ReadSingleSampleMethod;
if ((photometric != PHOTOMETRIC_SEPARATED) &&
(interlace == PLANARCONFIG_SEPARATE) && (bits_per_sample < 64))
method=ReadGenericMethod;
if (image->compression == JPEGCompression)
method=GetJPEGMethod(image,tiff,photometric,bits_per_sample,
samples_per_pixel);
if (compress_tag == COMPRESSION_JBIG)
method=ReadStripMethod;
if (TIFFIsTiled(tiff) != MagickFalse)
method=ReadTileMethod;
quantum_info->endian=LSBEndian;
quantum_type=RGBQuantum;
if (TIFFScanlineSize(tiff) <= 0)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
if (((MagickSizeType) TIFFScanlineSize(tiff)) > (2*GetBlobSize(image)))
ThrowTIFFException(CorruptImageError,"InsufficientImageDataInFile");
number_pixels=MagickMax(TIFFScanlineSize(tiff),MagickMax((ssize_t)
image->columns*samples_per_pixel*pow(2.0,ceil(log(bits_per_sample)/
log(2.0))),image->columns*rows_per_strip)*sizeof(uint32));
tiff_pixels=(unsigned char *) AcquireMagickMemory(number_pixels);
if (tiff_pixels == (unsigned char *) NULL)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
(void) memset(tiff_pixels,0,number_pixels);
switch (method)
{
case ReadSingleSampleMethod:
{
/*
Convert TIFF image to PseudoClass MIFF image.
*/
quantum_type=IndexQuantum;
pad=(size_t) MagickMax((ssize_t) samples_per_pixel-1,0);
if (image->alpha_trait != UndefinedPixelTrait)
{
if (image->storage_class != PseudoClass)
{
quantum_type=samples_per_pixel == 1 ? AlphaQuantum :
GrayAlphaQuantum;
pad=(size_t) MagickMax((ssize_t) samples_per_pixel-2,0);
}
else
{
quantum_type=IndexAlphaQuantum;
pad=(size_t) MagickMax((ssize_t) samples_per_pixel-2,0);
}
}
else
if (image->storage_class != PseudoClass)
{
quantum_type=GrayQuantum;
pad=(size_t) MagickMax((ssize_t) samples_per_pixel-1,0);
}
status=SetQuantumPad(image,quantum_info,pad*pow(2,ceil(log(
bits_per_sample)/log(2))));
if (status == MagickFalse)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
*magick_restrict q;
tiff_status=TIFFReadPixels(tiff,0,y,(char *) tiff_pixels);
if (tiff_status == -1)
break;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,tiff_pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
break;
}
case ReadRGBAMethod:
{
/*
Convert TIFF image to DirectClass MIFF image.
*/
pad=(size_t) MagickMax((size_t) samples_per_pixel-3,0);
quantum_type=RGBQuantum;
if (image->alpha_trait != UndefinedPixelTrait)
{
quantum_type=RGBAQuantum;
pad=(size_t) MagickMax((size_t) samples_per_pixel-4,0);
}
if (image->colorspace == CMYKColorspace)
{
pad=(size_t) MagickMax((size_t) samples_per_pixel-4,0);
quantum_type=CMYKQuantum;
if (image->alpha_trait != UndefinedPixelTrait)
{
quantum_type=CMYKAQuantum;
pad=(size_t) MagickMax((size_t) samples_per_pixel-5,0);
}
}
status=SetQuantumPad(image,quantum_info,pad*((bits_per_sample+7) >> 3));
if (status == MagickFalse)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
*magick_restrict q;
tiff_status=TIFFReadPixels(tiff,0,y,(char *) tiff_pixels);
if (tiff_status == -1)
break;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,tiff_pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
break;
}
case ReadCMYKAMethod:
{
/*
Convert TIFF image to DirectClass MIFF image.
*/
for (i=0; i < (ssize_t) samples_per_pixel; i++)
{
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
*magick_restrict q;
tiff_status=TIFFReadPixels(tiff,(tsample_t) i,y,(char *)
tiff_pixels);
if (tiff_status == -1)
break;
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
if (image->colorspace != CMYKColorspace)
switch (i)
{
case 0: quantum_type=RedQuantum; break;
case 1: quantum_type=GreenQuantum; break;
case 2: quantum_type=BlueQuantum; break;
case 3: quantum_type=AlphaQuantum; break;
default: quantum_type=UndefinedQuantum; break;
}
else
switch (i)
{
case 0: quantum_type=CyanQuantum; break;
case 1: quantum_type=MagentaQuantum; break;
case 2: quantum_type=YellowQuantum; break;
case 3: quantum_type=BlackQuantum; break;
case 4: quantum_type=AlphaQuantum; break;
default: quantum_type=UndefinedQuantum; break;
}
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
quantum_type,tiff_pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
break;
}
case ReadYCCKMethod:
{
for (y=0; y < (ssize_t) image->rows; y++)
{
register Quantum
*magick_restrict q;
register ssize_t
x;
unsigned char
*p;
tiff_status=TIFFReadPixels(tiff,0,y,(char *) tiff_pixels);
if (tiff_status == -1)
break;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
p=tiff_pixels;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelCyan(image,ScaleCharToQuantum(ClampYCC((double) *p+
(1.402*(double) *(p+2))-179.456)),q);
SetPixelMagenta(image,ScaleCharToQuantum(ClampYCC((double) *p-
(0.34414*(double) *(p+1))-(0.71414*(double ) *(p+2))+
135.45984)),q);
SetPixelYellow(image,ScaleCharToQuantum(ClampYCC((double) *p+
(1.772*(double) *(p+1))-226.816)),q);
SetPixelBlack(image,ScaleCharToQuantum((unsigned char) *(p+3)),q);
q+=GetPixelChannels(image);
p+=4;
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
break;
}
case ReadStripMethod:
{
register uint32
*p;
/*
Convert stripped TIFF image to DirectClass MIFF image.
*/
(void) SetImageStorageClass(image,DirectClass,exception);
i=0;
p=(uint32 *) NULL;
for (y=0; y < (ssize_t) image->rows; y++)
{
register ssize_t
x;
register Quantum
*magick_restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
if (i == 0)
{
if (TIFFReadRGBAStrip(tiff,(tstrip_t) y,(uint32 *) tiff_pixels) == 0)
break;
i=(ssize_t) MagickMin((ssize_t) rows_per_strip,(ssize_t)
image->rows-y);
}
i--;
p=((uint32 *) tiff_pixels)+image->columns*i;
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(image,ScaleCharToQuantum((unsigned char)
(TIFFGetR(*p))),q);
SetPixelGreen(image,ScaleCharToQuantum((unsigned char)
(TIFFGetG(*p))),q);
SetPixelBlue(image,ScaleCharToQuantum((unsigned char)
(TIFFGetB(*p))),q);
if (image->alpha_trait != UndefinedPixelTrait)
SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)
(TIFFGetA(*p))),q);
p++;
q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
break;
}
case ReadTileMethod:
{
register uint32
*p;
uint32
*tile_pixels,
columns,
rows;
/*
Convert tiled TIFF image to DirectClass MIFF image.
*/
if ((TIFFGetField(tiff,TIFFTAG_TILEWIDTH,&columns) != 1) ||
(TIFFGetField(tiff,TIFFTAG_TILELENGTH,&rows) != 1))
ThrowTIFFException(CoderError,"ImageIsNotTiled");
if ((AcquireMagickResource(WidthResource,columns) == MagickFalse) ||
(AcquireMagickResource(HeightResource,rows) == MagickFalse))
ThrowTIFFException(ImageError,"WidthOrHeightExceedsLimit");
(void) SetImageStorageClass(image,DirectClass,exception);
number_pixels=(MagickSizeType) columns*rows;
if (HeapOverflowSanityCheck(rows,sizeof(*tile_pixels)) != MagickFalse)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
tile_pixels=(uint32 *) AcquireQuantumMemory(columns,rows*
sizeof(*tile_pixels));
if (tile_pixels == (uint32 *) NULL)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
for (y=0; y < (ssize_t) image->rows; y+=rows)
{
register ssize_t
x;
register Quantum
*magick_restrict q,
*magick_restrict tile;
size_t
columns_remaining,
rows_remaining;
rows_remaining=image->rows-y;
if ((ssize_t) (y+rows) < (ssize_t) image->rows)
rows_remaining=rows;
tile=QueueAuthenticPixels(image,0,y,image->columns,rows_remaining,
exception);
if (tile == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x+=columns)
{
size_t
column,
row;
if (TIFFReadRGBATile(tiff,(uint32) x,(uint32) y,tile_pixels) == 0)
break;
columns_remaining=image->columns-x;
if ((ssize_t) (x+columns) < (ssize_t) image->columns)
columns_remaining=columns;
p=tile_pixels+(rows-rows_remaining)*columns;
q=tile+GetPixelChannels(image)*(image->columns*(rows_remaining-1)+
x);
for (row=rows_remaining; row > 0; row--)
{
if (image->alpha_trait != UndefinedPixelTrait)
for (column=columns_remaining; column > 0; column--)
{
SetPixelRed(image,ScaleCharToQuantum((unsigned char)
TIFFGetR(*p)),q);
SetPixelGreen(image,ScaleCharToQuantum((unsigned char)
TIFFGetG(*p)),q);
SetPixelBlue(image,ScaleCharToQuantum((unsigned char)
TIFFGetB(*p)),q);
SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)
TIFFGetA(*p)),q);
p++;
q+=GetPixelChannels(image);
}
else
for (column=columns_remaining; column > 0; column--)
{
SetPixelRed(image,ScaleCharToQuantum((unsigned char)
TIFFGetR(*p)),q);
SetPixelGreen(image,ScaleCharToQuantum((unsigned char)
TIFFGetG(*p)),q);
SetPixelBlue(image,ScaleCharToQuantum((unsigned char)
TIFFGetB(*p)),q);
p++;
q+=GetPixelChannels(image);
}
p+=columns-columns_remaining;
q-=GetPixelChannels(image)*(image->columns+columns_remaining);
}
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
tile_pixels=(uint32 *) RelinquishMagickMemory(tile_pixels);
break;
}
case ReadGenericMethod:
default:
{
MemoryInfo
*pixel_info;
register uint32
*p;
uint32
*pixels;
/*
Convert TIFF image to DirectClass MIFF image.
*/
(void) SetImageStorageClass(image,DirectClass,exception);
number_pixels=(MagickSizeType) image->columns*image->rows;
if (HeapOverflowSanityCheck(image->rows,sizeof(*pixels)) != MagickFalse)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
pixel_info=AcquireVirtualMemory(image->columns,image->rows*
sizeof(uint32));
if (pixel_info == (MemoryInfo *) NULL)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
pixels=(uint32 *) GetVirtualMemoryBlob(pixel_info);
(void) TIFFReadRGBAImage(tiff,(uint32) image->columns,(uint32)
image->rows,(uint32 *) pixels,0);
/*
Convert image to DirectClass pixel packets.
*/
p=pixels+number_pixels-1;
for (y=0; y < (ssize_t) image->rows; y++)
{
register ssize_t
x;
register Quantum
*magick_restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
break;
q+=GetPixelChannels(image)*(image->columns-1);
for (x=0; x < (ssize_t) image->columns; x++)
{
SetPixelRed(image,ScaleCharToQuantum((unsigned char)
TIFFGetR(*p)),q);
SetPixelGreen(image,ScaleCharToQuantum((unsigned char)
TIFFGetG(*p)),q);
SetPixelBlue(image,ScaleCharToQuantum((unsigned char)
TIFFGetB(*p)),q);
if (image->alpha_trait != UndefinedPixelTrait)
SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)
TIFFGetA(*p)),q);
p--;
q-=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
pixel_info=RelinquishVirtualMemory(pixel_info);
break;
}
}
tiff_pixels=(unsigned char *) RelinquishMagickMemory(tiff_pixels);
SetQuantumImageType(image,quantum_type);
next_tiff_frame:
if (quantum_info != (QuantumInfo *) NULL)
quantum_info=DestroyQuantumInfo(quantum_info);
if (photometric == PHOTOMETRIC_CIELAB)
DecodeLabImage(image,exception);
if ((photometric == PHOTOMETRIC_LOGL) ||
(photometric == PHOTOMETRIC_MINISBLACK) ||
(photometric == PHOTOMETRIC_MINISWHITE))
{
image->type=GrayscaleType;
if (bits_per_sample == 1)
image->type=BilevelType;
}
/*
Proceed to next image.
*/
if (image_info->number_scenes != 0)
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
more_frames=TIFFReadDirectory(tiff) != 0 ? MagickTrue : MagickFalse;
if (more_frames != MagickFalse)
{
/*
Allocate next image structure.
*/
AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
status=MagickFalse;
break;
}
image=SyncNextImageInList(image);
status=SetImageProgress(image,LoadImagesTag,image->scene-1,
image->scene);
if (status == MagickFalse)
break;
}
} while ((status != MagickFalse) && (more_frames != MagickFalse));
TIFFClose(tiff);
TIFFReadPhotoshopLayers(image_info,image,exception);
if ((image_info->number_scenes != 0) &&
(image_info->scene >= GetImageListLength(image)))
status=MagickFalse;
if (status == MagickFalse)
return(DestroyImageList(image));
return(GetFirstImageInList(image));
}
| 0
|
143,313
|
static int php_mb_parse_encoding_array(const Array& array,
mbfl_encoding ***return_list,
int *return_size, int persistent) {
int n, l, size, bauto,ret = 1;
mbfl_encoding *encoding;
mbfl_no_encoding *src;
mbfl_encoding **list, **entry;
list = nullptr;
mbfl_no_encoding *identify_list = MBSTRG(default_detect_order_list);
int identify_list_size = MBSTRG(default_detect_order_list_size);
size = array.size() + identify_list_size;
list = (mbfl_encoding **)calloc(size, sizeof(mbfl_encoding*));
if (list != nullptr) {
entry = list;
bauto = 0;
n = 0;
for (ArrayIter iter(array); iter; ++iter) {
auto const hash_entry = iter.second().toString();
if (strcasecmp(hash_entry.data(), "auto") == 0) {
if (!bauto) {
bauto = 1;
l = identify_list_size;
src = identify_list;
for (int j = 0; j < l; j++) {
*entry++ = (mbfl_encoding*) mbfl_no2encoding(*src++);
n++;
}
}
} else {
encoding = (mbfl_encoding*) mbfl_name2encoding(hash_entry.data());
if (encoding != nullptr) {
*entry++ = encoding;
n++;
} else {
ret = 0;
}
}
}
if (n > 0) {
if (return_list) {
*return_list = list;
} else {
free(list);
}
} else {
free(list);
if (return_list) {
*return_list = nullptr;
}
ret = 0;
}
if (return_size) {
*return_size = n;
}
} else {
if (return_list) {
*return_list = nullptr;
}
if (return_size) {
*return_size = 0;
}
ret = 0;
}
return ret;
}
| 0
|
277,613
|
void AppCacheUpdateJob::FetchManifest(bool is_first_fetch) {
DCHECK(!manifest_fetcher_);
manifest_fetcher_ = new URLFetcher(
manifest_url_,
is_first_fetch ? URLFetcher::MANIFEST_FETCH :
URLFetcher::MANIFEST_REFETCH,
this);
if (is_first_fetch) {
AppCacheEntry* entry = (update_type_ == UPGRADE_ATTEMPT) ?
group_->newest_complete_cache()->GetEntry(manifest_url_) : NULL;
if (entry && !doing_full_update_check_) {
storage_->LoadResponseInfo(manifest_url_, group_->group_id(),
entry->response_id(), this);
return;
}
manifest_fetcher_->Start();
return;
}
DCHECK(internal_state_ == REFETCH_MANIFEST);
DCHECK(manifest_response_info_.get());
manifest_fetcher_->set_existing_response_headers(
manifest_response_info_->headers.get());
manifest_fetcher_->Start();
}
| 0
|
72,436
|
correct_range(exarg_T *eap)
{
if (!(eap->argt & ZEROR)) /* zero in range not allowed */
{
if (eap->line1 == 0)
eap->line1 = 1;
if (eap->line2 == 0)
eap->line2 = 1;
}
}
| 0
|
221,473
|
get_object_start(void *state)
{
GetState *_state = (GetState *) state;
int lex_level = _state->lex->lex_level;
if (lex_level == 0 && _state->npath == 0)
{
/*
* Special case: we should match the entire object. We only need this
* at outermost level because at nested levels the match will have
* been started by the outer field or array element callback.
*/
_state->result_start = _state->lex->token_start;
}
}
| 0
|
46,970
|
struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)
{
struct mm_struct *mm;
int err;
err = mutex_lock_killable(&task->signal->exec_update_mutex);
if (err)
return ERR_PTR(err);
mm = get_task_mm(task);
if (mm && mm != current->mm &&
!ptrace_may_access(task, mode)) {
mmput(mm);
mm = ERR_PTR(-EACCES);
}
mutex_unlock(&task->signal->exec_update_mutex);
return mm;
}
| 0
|
451,808
|
static int rbd_try_acquire_lock(struct rbd_device *rbd_dev)
{
int ret;
down_read(&rbd_dev->lock_rwsem);
dout("%s rbd_dev %p read lock_state %d\n", __func__, rbd_dev,
rbd_dev->lock_state);
if (__rbd_is_lock_owner(rbd_dev)) {
up_read(&rbd_dev->lock_rwsem);
return 0;
}
up_read(&rbd_dev->lock_rwsem);
down_write(&rbd_dev->lock_rwsem);
dout("%s rbd_dev %p write lock_state %d\n", __func__, rbd_dev,
rbd_dev->lock_state);
if (__rbd_is_lock_owner(rbd_dev)) {
up_write(&rbd_dev->lock_rwsem);
return 0;
}
ret = rbd_try_lock(rbd_dev);
if (ret < 0) {
rbd_warn(rbd_dev, "failed to lock header: %d", ret);
if (ret == -EBLACKLISTED)
goto out;
ret = 1; /* request lock anyway */
}
if (ret > 0) {
up_write(&rbd_dev->lock_rwsem);
return ret;
}
rbd_assert(rbd_dev->lock_state == RBD_LOCK_STATE_LOCKED);
rbd_assert(list_empty(&rbd_dev->running_list));
ret = rbd_post_acquire_action(rbd_dev);
if (ret) {
rbd_warn(rbd_dev, "post-acquire action failed: %d", ret);
/*
* Can't stay in RBD_LOCK_STATE_LOCKED because
* rbd_lock_add_request() would let the request through,
* assuming that e.g. object map is locked and loaded.
*/
rbd_unlock(rbd_dev);
}
out:
wake_lock_waiters(rbd_dev, ret);
up_write(&rbd_dev->lock_rwsem);
return ret;
}
| 0
|
255,603
|
int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
rpmpsm psm, char ** failedFile)
{
FD_t payload = rpmtePayload(te);
rpmfi fi = NULL;
rpmfs fs = rpmteGetFileStates(te);
rpmPlugins plugins = rpmtsPlugins(ts);
int rc = 0;
int fx = -1;
int fc = rpmfilesFC(files);
int nodigest = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOFILEDIGEST) ? 1 : 0;
int nofcaps = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCAPS) ? 1 : 0;
FD_t firstlinkfile = NULL;
char *tid = NULL;
struct filedata_s *fdata = xcalloc(fc, sizeof(*fdata));
struct filedata_s *firstlink = NULL;
/* transaction id used for temporary path suffix while installing */
rasprintf(&tid, ";%08x", (unsigned)rpmtsGetTid(ts));
/* Collect state data for the whole operation */
fi = rpmfilesIter(files, RPMFI_ITER_FWD);
while (!rc && (fx = rpmfiNext(fi)) >= 0) {
struct filedata_s *fp = &fdata[fx];
if (rpmfiFFlags(fi) & RPMFILE_GHOST)
fp->action = FA_SKIP;
else
fp->action = rpmfsGetAction(fs, fx);
fp->skip = XFA_SKIPPING(fp->action);
fp->setmeta = 1;
if (XFA_CREATING(fp->action) && !S_ISDIR(rpmfiFMode(fi)))
fp->suffix = tid;
fp->fpath = fsmFsPath(fi, fp->suffix);
/* Remap file perms, owner, and group. */
rc = rpmfiStat(fi, 1, &fp->sb);
setFileState(fs, fx);
fsmDebug(fp->fpath, fp->action, &fp->sb);
/* Run fsm file pre hook for all plugins */
rc = rpmpluginsCallFsmFilePre(plugins, fi, fp->fpath,
fp->sb.st_mode, fp->action);
fp->stage = FILE_PRE;
}
fi = rpmfiFree(fi);
if (rc)
goto exit;
if (rpmteType(te) == TR_ADDED)
fi = rpmfiNewArchiveReader(payload, files, RPMFI_ITER_READ_ARCHIVE);
else
fi = rpmfilesIter(files, RPMFI_ITER_FWD);
if (fi == NULL) {
rc = RPMERR_BAD_MAGIC;
goto exit;
}
/* Detect and create directories not explicitly in package. */
if (!rc)
rc = fsmMkdirs(files, fs, plugins);
/* Process the payload */
while (!rc && (fx = rpmfiNext(fi)) >= 0) {
struct filedata_s *fp = &fdata[fx];
if (!fp->skip) {
/* Directories replacing something need early backup */
if (!fp->suffix) {
rc = fsmBackup(fi, fp->action);
}
/* Assume file does't exist when tmp suffix is in use */
if (!fp->suffix) {
if (fp->action == FA_TOUCH) {
struct stat sb;
rc = fsmStat(fp->fpath, 1, &sb);
} else {
rc = fsmVerify(fp->fpath, fi);
}
} else {
rc = RPMERR_ENOENT;
}
/* See if the file was removed while our attention was elsewhere */
if (rc == RPMERR_ENOENT && fp->action == FA_TOUCH) {
rpmlog(RPMLOG_DEBUG, "file %s vanished unexpectedly\n",
fp->fpath);
fp->action = FA_CREATE;
fsmDebug(fp->fpath, fp->action, &fp->sb);
}
/* When touching we don't need any of this... */
if (fp->action == FA_TOUCH)
continue;
if (S_ISREG(fp->sb.st_mode)) {
if (rc == RPMERR_ENOENT) {
rc = fsmMkfile(fi, fp, files, psm, nodigest,
&firstlink, &firstlinkfile);
}
} else if (S_ISDIR(fp->sb.st_mode)) {
if (rc == RPMERR_ENOENT) {
mode_t mode = fp->sb.st_mode;
mode &= ~07777;
mode |= 00700;
rc = fsmMkdir(fp->fpath, mode);
}
} else if (S_ISLNK(fp->sb.st_mode)) {
if (rc == RPMERR_ENOENT) {
rc = fsmSymlink(rpmfiFLink(fi), fp->fpath);
}
} else if (S_ISFIFO(fp->sb.st_mode)) {
/* This mimics cpio S_ISSOCK() behavior but probably isn't right */
if (rc == RPMERR_ENOENT) {
rc = fsmMkfifo(fp->fpath, 0000);
}
} else if (S_ISCHR(fp->sb.st_mode) ||
S_ISBLK(fp->sb.st_mode) ||
S_ISSOCK(fp->sb.st_mode))
{
if (rc == RPMERR_ENOENT) {
rc = fsmMknod(fp->fpath, fp->sb.st_mode, fp->sb.st_rdev);
}
} else {
/* XXX Special case /dev/log, which shouldn't be packaged anyways */
if (!IS_DEV_LOG(fp->fpath))
rc = RPMERR_UNKNOWN_FILETYPE;
}
} else if (firstlink && rpmfiArchiveHasContent(fi)) {
/*
* Tricksy case: this file is a being skipped, but it's part of
* a hardlinked set and has the actual content linked with it.
* Write the content to the first non-skipped file of the set
* instead.
*/
rc = fsmMkfile(fi, firstlink, files, psm, nodigest,
&firstlink, &firstlinkfile);
}
/* Notify on success. */
if (rc)
*failedFile = xstrdup(fp->fpath);
else
rpmpsmNotify(psm, RPMCALLBACK_INST_PROGRESS, rpmfiArchiveTell(fi));
fp->stage = FILE_UNPACK;
}
fi = rpmfiFree(fi);
if (!rc && fx < 0 && fx != RPMERR_ITER_END)
rc = fx;
/* Set permissions, timestamps etc for non-hardlink entries */
fi = rpmfilesIter(files, RPMFI_ITER_FWD);
while (!rc && (fx = rpmfiNext(fi)) >= 0) {
struct filedata_s *fp = &fdata[fx];
if (!fp->skip && fp->setmeta) {
rc = fsmSetmeta(fp->fpath, fi, plugins, fp->action,
&fp->sb, nofcaps);
}
if (rc)
*failedFile = xstrdup(fp->fpath);
fp->stage = FILE_PREP;
}
fi = rpmfiFree(fi);
/* If all went well, commit files to final destination */
fi = rpmfilesIter(files, RPMFI_ITER_FWD);
while (!rc && (fx = rpmfiNext(fi)) >= 0) {
struct filedata_s *fp = &fdata[fx];
if (!fp->skip) {
/* Backup file if needed. Directories are handled earlier */
if (!rc && fp->suffix)
rc = fsmBackup(fi, fp->action);
if (!rc)
rc = fsmCommit(&fp->fpath, fi, fp->action, fp->suffix);
if (!rc)
fp->stage = FILE_COMMIT;
else
*failedFile = xstrdup(fp->fpath);
}
}
fi = rpmfiFree(fi);
/* Walk backwards in case we need to erase */
fi = rpmfilesIter(files, RPMFI_ITER_BACK);
while ((fx = rpmfiNext(fi)) >= 0) {
struct filedata_s *fp = &fdata[fx];
/* Run fsm file post hook for all plugins for all processed files */
if (fp->stage) {
rpmpluginsCallFsmFilePost(plugins, fi, fp->fpath,
fp->sb.st_mode, fp->action, rc);
}
/* On failure, erase non-committed files */
if (rc && fp->stage > FILE_NONE && !fp->skip) {
(void) fsmRemove(fp->fpath, fp->sb.st_mode);
}
}
rpmswAdd(rpmtsOp(ts, RPMTS_OP_UNCOMPRESS), fdOp(payload, FDSTAT_READ));
rpmswAdd(rpmtsOp(ts, RPMTS_OP_DIGEST), fdOp(payload, FDSTAT_DIGEST));
exit:
fi = rpmfiFree(fi);
Fclose(payload);
free(tid);
for (int i = 0; i < fc; i++)
free(fdata[i].fpath);
free(fdata);
return rc;
}
| 1
|
207,109
|
void VerifyPrintPreviewGenerated(bool generated_preview) {
const IPC::Message* preview_msg =
render_thread_.sink().GetUniqueMessageMatching(
PrintHostMsg_MetafileReadyForPrinting::ID);
bool did_get_preview_msg = (NULL != preview_msg);
ASSERT_EQ(generated_preview, did_get_preview_msg);
if (did_get_preview_msg) {
PrintHostMsg_MetafileReadyForPrinting::Param preview_param;
PrintHostMsg_MetafileReadyForPrinting::Read(preview_msg, &preview_param);
EXPECT_NE(0, preview_param.a.document_cookie);
EXPECT_NE(0, preview_param.a.expected_pages_count);
EXPECT_NE(0U, preview_param.a.data_size);
}
}
| 0
|
343,290
|
static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun,
int evpd, int pc)
{
int full_size;
struct scsi_task *task = NULL;
task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, 64);
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
goto fail;
}
full_size = scsi_datain_getfullsize(task);
if (full_size > task->datain.size) {
scsi_free_scsi_task(task);
/* we need more data for the full list */
task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, full_size);
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
goto fail;
}
}
return task;
fail:
error_report("iSCSI: Inquiry command failed : %s",
iscsi_get_error(iscsi));
if (task) {
scsi_free_scsi_task(task);
return NULL;
}
return NULL;
}
| 1
|
404,912
|
static struct l2cap_chan *__l2cap_global_chan_by_addr(__le16 psm, bdaddr_t *src)
{
struct l2cap_chan *c;
list_for_each_entry(c, &chan_list, global_l) {
if (c->sport == psm && !bacmp(&c->src, src))
return c;
}
return NULL;
}
| 0
|
19,600
|
static void cirrus_bitblt_reset ( CirrusVGAState * s ) {
int need_update ;
s -> vga . gr [ 0x31 ] &= ~ ( CIRRUS_BLT_START | CIRRUS_BLT_BUSY | CIRRUS_BLT_FIFOUSED ) ;
need_update = s -> cirrus_srcptr != & s -> cirrus_bltbuf [ 0 ] || s -> cirrus_srcptr_end != & s -> cirrus_bltbuf [ 0 ] ;
s -> cirrus_srcptr = & s -> cirrus_bltbuf [ 0 ] ;
s -> cirrus_srcptr_end = & s -> cirrus_bltbuf [ 0 ] ;
s -> cirrus_srccounter = 0 ;
if ( ! need_update ) return ;
cirrus_update_memory_access ( s ) ;
}
| 0
|
277,492
|
void Gfx::doEndPath() {
if (state->isCurPt() && clip != clipNone) {
state->clip();
if (clip == clipNormal) {
out->clip(state);
} else {
out->eoClip(state);
}
}
clip = clipNone;
state->clearPath();
}
| 0
|
364,556
|
static void nntp_reset(void)
{
int i;
proc_cleanup();
/* close local mailbox */
if (group_state)
index_close(&group_state);
/* close backend connections */
i = 0;
while (backend_cached && backend_cached[i]) {
proxy_downserver(backend_cached[i]);
free(backend_cached[i]->context);
free(backend_cached[i]);
i++;
}
if (backend_cached) free(backend_cached);
backend_cached = NULL;
backend_current = NULL;
if (nntp_in) {
prot_NONBLOCK(nntp_in);
prot_fill(nntp_in);
prot_free(nntp_in);
}
if (nntp_out) {
prot_flush(nntp_out);
prot_free(nntp_out);
}
nntp_in = nntp_out = NULL;
if (protin) protgroup_reset(protin);
#ifdef HAVE_SSL
if (tls_conn) {
tls_reset_servertls(&tls_conn);
tls_conn = NULL;
}
#endif
cyrus_reset_stdio();
strcpy(nntp_clienthost, "[local]");
if (nntp_logfd != -1) {
close(nntp_logfd);
nntp_logfd = -1;
}
if (nntp_userid != NULL) {
free(nntp_userid);
nntp_userid = NULL;
}
if (nntp_authstate) {
auth_freestate(nntp_authstate);
nntp_authstate = NULL;
}
if (nntp_saslconn) {
sasl_dispose(&nntp_saslconn);
nntp_saslconn = NULL;
}
nntp_starttls_done = 0;
if(saslprops.iplocalport) {
free(saslprops.iplocalport);
saslprops.iplocalport = NULL;
}
if(saslprops.ipremoteport) {
free(saslprops.ipremoteport);
saslprops.ipremoteport = NULL;
}
if(saslprops.authid) {
free(saslprops.authid);
saslprops.authid = NULL;
}
saslprops.ssf = 0;
nntp_exists = 0;
nntp_current = 0;
did_capabilities = 0;
}
| 0
|
151,527
|
void Context::onQueueReady(uint32_t token) {
if (wasm_->onQueueReady_) {
wasm_->onQueueReady_(this, id_, token);
}
}
| 0
|
279,629
|
void RuleFeatureSet::collectFeaturesFromRuleData(const RuleData& ruleData)
{
updateInvalidationSets(ruleData);
FeatureMetadata metadata;
collectFeaturesFromSelector(ruleData.selector(), metadata);
m_metadata.add(metadata);
if (metadata.foundSiblingSelector)
siblingRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), ruleData.hasDocumentSecurityOrigin()));
if (ruleData.containsUncommonAttributeSelector())
uncommonAttributeRules.append(RuleFeature(ruleData.rule(), ruleData.selectorIndex(), ruleData.hasDocumentSecurityOrigin()));
}
| 0
|
413,575
|
_rpc_reboot(slurm_msg_t *msg)
{
char *reboot_program, *cmd = NULL, *sp;
reboot_msg_t *reboot_msg;
slurm_ctl_conf_t *cfg;
uid_t req_uid = g_slurm_auth_get_uid(msg->auth_cred,
conf->auth_info);
int exit_code;
if (!_slurm_authorized_user(req_uid))
error("Security violation, reboot RPC from uid %d",
req_uid);
else {
cfg = slurm_conf_lock();
reboot_program = cfg->reboot_program;
if (reboot_program) {
sp = strchr(reboot_program, ' ');
if (sp)
sp = xstrndup(reboot_program,
(sp - reboot_program));
else
sp = xstrdup(reboot_program);
reboot_msg = (reboot_msg_t *) msg->data;
if (reboot_msg && reboot_msg->features) {
/*
* Run reboot_program with only arguments given
* in reboot_msg->features.
*/
info("Node reboot request with features %s being processed",
reboot_msg->features);
(void) node_features_g_node_set(
reboot_msg->features);
if (reboot_msg->features[0]) {
xstrfmtcat(cmd, "%s %s",
sp, reboot_msg->features);
} else {
cmd = xstrdup(sp);
}
} else {
/* Run reboot_program verbatim */
cmd = xstrdup(reboot_program);
info("Node reboot request being processed");
}
if (access(sp, R_OK | X_OK) < 0)
error("Cannot run RebootProgram [%s]: %m", sp);
else if ((exit_code = system(cmd)))
error("system(%s) returned %d", reboot_program,
exit_code);
xfree(sp);
xfree(cmd);
} else
error("RebootProgram isn't defined in config");
slurm_conf_unlock();
}
/* Never return a message, slurmctld does not expect one */
/* slurm_send_rc_msg(msg, rc); */
}
| 0
|
72,364
|
int PageHuge(struct page *page)
{
compound_page_dtor *dtor;
if (!PageCompound(page))
return 0;
page = compound_head(page);
dtor = get_compound_page_dtor(page);
return dtor == free_huge_page;
}
| 0
|
206,486
|
bool ContentSecurityPolicy::IsNonceableElement(const Element* element) {
if (element->nonce().IsNull())
return false;
bool nonceable = true;
if (nonceable) {
static const char kScriptString[] = "<SCRIPT";
static const char kStyleString[] = "<STYLE";
for (const Attribute& attr : element->Attributes()) {
const AtomicString& name = attr.LocalName();
const AtomicString& value = attr.Value();
if (name.FindIgnoringASCIICase(kScriptString) != WTF::kNotFound ||
name.FindIgnoringASCIICase(kStyleString) != WTF::kNotFound ||
value.FindIgnoringASCIICase(kScriptString) != WTF::kNotFound ||
value.FindIgnoringASCIICase(kStyleString) != WTF::kNotFound) {
nonceable = false;
break;
}
}
}
UseCounter::Count(
element->GetDocument(),
nonceable ? WebFeature::kCleanScriptElementWithNonce
: WebFeature::kPotentiallyInjectedScriptElementWithNonce);
return nonceable;
}
| 0
|
454,030
|
BSONObj spec() {
return BSON("$eq" << BSON_ARRAY(1 << "$a"));
}
| 0
|
523,498
|
bool LEX::stmt_uninstall_plugin_by_soname(const DDL_options_st &opt,
const LEX_CSTRING &soname)
{
check_opt.init();
if (add_create_options_with_check(opt))
return true;
sql_command= SQLCOM_UNINSTALL_PLUGIN;
comment= null_clex_str;
ident= soname;
return false;
}
| 0
|
107,651
|
int SSL_set_session_secret_cb(SSL *s,
int (*tls_session_secret_cb) (SSL *s,
void *secret,
int *secret_len,
STACK_OF(SSL_CIPHER)
*peer_ciphers,
SSL_CIPHER
**cipher,
void *arg),
void *arg)
{
if (s == NULL)
return (0);
s->tls_session_secret_cb = tls_session_secret_cb;
s->tls_session_secret_cb_arg = arg;
return (1);
}
| 0
|
386,288
|
static void MClearArea(Window *p, int xs, int ys, int xe, int ye, int bce)
{
int n, y;
int xxe;
struct mline *ml;
/* Check for zero-height window */
if (ys < 0 || ye < ys)
return;
/* check for magic margin condition */
if (xs >= p->w_width)
xs = p->w_width - 1;
if (xe >= p->w_width)
xe = p->w_width - 1;
MKillDwRight(p, p->w_mlines + ys, xs);
MKillDwLeft(p, p->w_mlines + ye, xe);
ml = p->w_mlines + ys;
for (y = ys; y <= ye; y++, ml++) {
xxe = (y == ye) ? xe : p->w_width - 1;
n = xxe - xs + 1;
if (n > 0)
clear_mline(ml, xs, n);
if (n > 0 && bce)
MBceLine(p, y, xs, xs + n - 1, bce);
xs = 0;
}
}
| 0
|
523,672
|
int ssl_prepare_clienthello_tlsext(SSL *s)
{
s->s3->alpn_sent = 0;
return 1;
}
| 0
|
60,536
|
Status GetElementShapeFromInput(OpKernelContext* c,
const TensorList& tensor_list, int index,
PartialTensorShape* element_shape) {
TF_RETURN_IF_ERROR(TensorShapeFromTensor(c->input(index), element_shape));
// Check that `element_shape` and `tensor_list.element_shape` are
// compatible and store the merged shape in `element_shape`.
PartialTensorShape tmp = *element_shape;
TF_RETURN_IF_ERROR(tmp.MergeWith(tensor_list.element_shape, element_shape));
return Status::OK();
}
| 0
|
291,902
|
bool ValuesFromConstNode(const NodeDef& node, std::vector<T>* values) {
if (node.op() != "Const") {
return false;
}
if (node.attr().count("dtype") == 0 || node.attr().count("value") == 0 ||
node.attr().at("dtype").type() != DataTypeToEnum<T>::value) {
return false;
}
// TensorProto represents the content of the tensor in either <type>_val or
// tensor_content.
const TensorProto& tensor = node.attr().at("value").tensor();
typename checkpoint::SaveTypeTraits<T>::RepeatedField* tensor_values =
checkpoint::MutableTensorProtoData<T>(const_cast<TensorProto*>(&tensor));
if (!tensor_values->empty() && tensor.has_tensor_shape()) {
// When tensor_shape is set, theoretically the representation of the data
// could be compressed. So, before copying values to the returned vector,
// make sure no compression happens.
const TensorShapeProto& shape = tensor.tensor_shape();
if (shape.dim_size() == 1 && shape.dim(0).size() == tensor_values->size()) {
values->insert(values->end(), tensor_values->begin(),
tensor_values->end());
return true;
}
}
const auto tensor_content_size = tensor.tensor_content().size();
if (tensor_content_size > 0) {
CHECK_EQ(0, tensor_content_size % sizeof(T))
<< "tensor_content_size (" << tensor_content_size
<< ") is not a multiple of " << sizeof(T);
values->resize(tensor_content_size / sizeof(T));
port::CopyToArray(tensor.tensor_content(),
reinterpret_cast<char*>(values->data()));
return true;
}
return false;
}
| 0
|
271,261
|
GF_Err gf_laser_decoder_remove_stream(GF_LASeRCodec *codec, u16 ESID)
{
u32 i, count;
count = gf_list_count(codec->streamInfo);
for (i=0; i<count; i++) {
LASeRStreamInfo *ptr = (LASeRStreamInfo *) gf_list_get(codec->streamInfo, i);
if (ptr->ESID==ESID) {
gf_free(ptr);
gf_list_rem(codec->streamInfo, i);
return GF_OK;
}
}
return GF_BAD_PARAM;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.