idx
int64 | func
string | target
int64 |
|---|---|---|
329,465
|
void net_hub_check_clients(void)
{
NetHub *hub;
NetHubPort *port;
NetClientState *peer;
QLIST_FOREACH(hub, &hubs, next) {
int has_nic = 0, has_host_dev = 0;
QLIST_FOREACH(port, &hub->ports, next) {
peer = port->nc.peer;
if (!peer) {
fprintf(stderr, "Warning: hub port %s has no peer\n",
port->nc.name);
continue;
}
switch (peer->info->type) {
case NET_CLIENT_DRIVER_NIC:
has_nic = 1;
break;
case NET_CLIENT_DRIVER_USER:
case NET_CLIENT_DRIVER_TAP:
case NET_CLIENT_DRIVER_SOCKET:
case NET_CLIENT_DRIVER_VDE:
case NET_CLIENT_DRIVER_VHOST_USER:
has_host_dev = 1;
break;
default:
break;
}
}
if (has_host_dev && !has_nic) {
warn_report("vlan %d with no nics", hub->id);
}
if (has_nic && !has_host_dev) {
fprintf(stderr,
"Warning: vlan %d is not connected to host network\n",
hub->id);
}
}
}
| 0
|
6,831
|
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
if (input->type != kTfLiteFloat32) {
TF_LITE_UNSUPPORTED_TYPE(context, input->type, "Ceil");
}
optimized_ops::Ceil(GetTensorShape(input), GetTensorData<float>(input),
GetTensorShape(output), GetTensorData<float>(output));
return kTfLiteOk;
}
| 1
|
415,572
|
imapx_disconnect (CamelIMAPXServer *is)
{
g_cancellable_cancel (is->priv->cancellable);
g_mutex_lock (&is->priv->stream_lock);
if (is->priv->connection) {
/* No need to wait for close for too long */
imapx_server_set_connection_timeout (is->priv->connection, 3);
}
g_clear_object (&is->priv->input_stream);
g_clear_object (&is->priv->output_stream);
g_clear_object (&is->priv->connection);
g_clear_object (&is->priv->subprocess);
if (is->priv->cinfo) {
imapx_free_capability (is->priv->cinfo);
is->priv->cinfo = NULL;
}
g_mutex_unlock (&is->priv->stream_lock);
g_mutex_lock (&is->priv->select_lock);
g_weak_ref_set (&is->priv->select_mailbox, NULL);
g_weak_ref_set (&is->priv->select_pending, NULL);
g_mutex_unlock (&is->priv->select_lock);
is->priv->is_cyrus = FALSE;
is->priv->state = IMAPX_DISCONNECTED;
g_mutex_lock (&is->priv->idle_lock);
is->priv->idle_state = IMAPX_IDLE_STATE_OFF;
g_cond_broadcast (&is->priv->idle_cond);
g_mutex_unlock (&is->priv->idle_lock);
}
| 0
|
250,118
|
int RenderFlexibleBox::firstLineBoxBaseline() const
{
if (isWritingModeRoot() || m_numberOfInFlowChildrenOnFirstLine <= 0)
return -1;
RenderBox* baselineChild = 0;
int childNumber = 0;
for (RenderBox* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
if (child->isOutOfFlowPositioned())
continue;
if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(child)) {
baselineChild = child;
break;
}
if (!baselineChild)
baselineChild = child;
++childNumber;
if (childNumber == m_numberOfInFlowChildrenOnFirstLine)
break;
}
if (!baselineChild)
return -1;
if (!isColumnFlow() && hasOrthogonalFlow(baselineChild))
return crossAxisExtentForChild(baselineChild) + baselineChild->logicalTop();
if (isColumnFlow() && !hasOrthogonalFlow(baselineChild))
return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop();
int baseline = baselineChild->firstLineBoxBaseline();
if (baseline == -1) {
LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
return synthesizedBaselineFromContentBox(baselineChild, direction) + baselineChild->logicalTop();
}
return baseline + baselineChild->logicalTop();
}
| 0
|
228,676
|
bool HttpUtil::NameValuePairsIterator::GetNext() {
if (!props_.GetNext())
return false;
value_begin_ = props_.value_begin();
value_end_ = props_.value_end();
name_begin_ = name_end_ = value_end_;
std::string::const_iterator equals = std::find(value_begin_, value_end_, '=');
if (equals == value_end_ || equals == value_begin_)
return valid_ = false; // Malformed, no equals sign
for (std::string::const_iterator it = value_begin_; it != equals; ++it) {
if (HttpUtil::IsQuote(*it))
return valid_ = false; // Malformed, quote appears before equals sign
}
name_begin_ = value_begin_;
name_end_ = equals;
value_begin_ = equals + 1;
TrimLWS(&name_begin_, &name_end_);
TrimLWS(&value_begin_, &value_end_);
value_is_quoted_ = false;
unquoted_value_.clear();
if (value_begin_ == value_end_)
return valid_ = false; // Malformed, value is empty
if (HttpUtil::IsQuote(*value_begin_)) {
if (*value_begin_ != *(value_end_ - 1) || value_begin_ + 1 == value_end_) {
++value_begin_; // Gracefully recover from mismatching quotes.
} else {
value_is_quoted_ = true;
unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_);
}
}
return true;
}
| 0
|
58,381
|
int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *ecdsa)
{
return ASN1_i2d_bio_of(EC_KEY,i2d_EC_PUBKEY,bp,ecdsa);
}
| 0
|
229,341
|
GSList *gslist_find_string(GSList *list, const char *key)
{
for (; list != NULL; list = list->next)
if (g_strcmp0(list->data, key) == 0) return list;
return NULL;
}
| 0
|
166,936
|
xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) {
const xmlChar *in;
int nbchar = 0;
int line = ctxt->input->line;
int col = ctxt->input->col;
int ccol;
SHRINK;
GROW;
/*
* Accelerated common case where input don't need to be
* modified before passing it to the handler.
*/
if (!cdata) {
in = ctxt->input->cur;
do {
get_more_space:
while (*in == 0x20) { in++; ctxt->input->col++; }
if (*in == 0xA) {
do {
ctxt->input->line++; ctxt->input->col = 1;
in++;
} while (*in == 0xA);
goto get_more_space;
}
if (*in == '<') {
nbchar = in - ctxt->input->cur;
if (nbchar > 0) {
const xmlChar *tmp = ctxt->input->cur;
ctxt->input->cur = in;
if ((ctxt->sax != NULL) &&
(ctxt->sax->ignorableWhitespace !=
ctxt->sax->characters)) {
if (areBlanks(ctxt, tmp, nbchar, 1)) {
if (ctxt->sax->ignorableWhitespace != NULL)
ctxt->sax->ignorableWhitespace(ctxt->userData,
tmp, nbchar);
} else {
if (ctxt->sax->characters != NULL)
ctxt->sax->characters(ctxt->userData,
tmp, nbchar);
if (*ctxt->space == -1)
*ctxt->space = -2;
}
} else if ((ctxt->sax != NULL) &&
(ctxt->sax->characters != NULL)) {
ctxt->sax->characters(ctxt->userData,
tmp, nbchar);
}
}
return;
}
get_more:
ccol = ctxt->input->col;
while (test_char_data[*in]) {
in++;
ccol++;
}
ctxt->input->col = ccol;
if (*in == 0xA) {
do {
ctxt->input->line++; ctxt->input->col = 1;
in++;
} while (*in == 0xA);
goto get_more;
}
if (*in == ']') {
if ((in[1] == ']') && (in[2] == '>')) {
xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL);
ctxt->input->cur = in;
return;
}
in++;
ctxt->input->col++;
goto get_more;
}
nbchar = in - ctxt->input->cur;
if (nbchar > 0) {
if ((ctxt->sax != NULL) &&
(ctxt->sax->ignorableWhitespace !=
ctxt->sax->characters) &&
(IS_BLANK_CH(*ctxt->input->cur))) {
const xmlChar *tmp = ctxt->input->cur;
ctxt->input->cur = in;
if (areBlanks(ctxt, tmp, nbchar, 0)) {
if (ctxt->sax->ignorableWhitespace != NULL)
ctxt->sax->ignorableWhitespace(ctxt->userData,
tmp, nbchar);
} else {
if (ctxt->sax->characters != NULL)
ctxt->sax->characters(ctxt->userData,
tmp, nbchar);
if (*ctxt->space == -1)
*ctxt->space = -2;
}
line = ctxt->input->line;
col = ctxt->input->col;
} else if (ctxt->sax != NULL) {
if (ctxt->sax->characters != NULL)
ctxt->sax->characters(ctxt->userData,
ctxt->input->cur, nbchar);
line = ctxt->input->line;
col = ctxt->input->col;
}
/* something really bad happened in the SAX callback */
if (ctxt->instate != XML_PARSER_CONTENT)
return;
}
ctxt->input->cur = in;
if (*in == 0xD) {
in++;
if (*in == 0xA) {
ctxt->input->cur = in;
in++;
ctxt->input->line++; ctxt->input->col = 1;
continue; /* while */
}
in--;
}
if (*in == '<') {
return;
}
if (*in == '&') {
return;
}
SHRINK;
GROW;
if (ctxt->instate == XML_PARSER_EOF)
return;
in = ctxt->input->cur;
} while (((*in >= 0x20) && (*in <= 0x7F)) || (*in == 0x09));
nbchar = 0;
}
ctxt->input->line = line;
ctxt->input->col = col;
xmlParseCharDataComplex(ctxt, cdata);
}
| 0
|
425,610
|
UsbHubCtrlClearPortFeature (
IN USB_DEVICE *HubDev,
IN UINT8 Port,
IN UINT16 Feature
)
{
EFI_STATUS Status;
//
// In USB bus, all the port index starts from 0. But HUB
// indexes its port from 1. So, port number is added one.
//
Status = UsbCtrlRequest (
HubDev,
EfiUsbNoData,
USB_REQ_TYPE_CLASS,
USB_HUB_TARGET_PORT,
USB_HUB_REQ_CLEAR_FEATURE,
Feature,
(UINT16) (Port + 1),
NULL,
0
);
return Status;
}
| 0
|
401,454
|
cr_tknzr_parse_w (CRTknzr * a_this,
guchar ** a_start,
guchar ** a_end,
CRParsingLocation *a_location)
{
guint32 cur_char = 0;
CRInputPos init_pos;
enum CRStatus status = CR_OK;
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& PRIVATE (a_this)->input
&& a_start && a_end,
CR_BAD_PARAM_ERROR);
RECORD_INITIAL_POS (a_this, &init_pos);
*a_start = NULL;
*a_end = NULL;
READ_NEXT_CHAR (a_this, &cur_char);
if (cr_utils_is_white_space (cur_char) == FALSE) {
status = CR_PARSING_ERROR;
goto error;
}
if (a_location) {
cr_tknzr_get_parsing_location (a_this,
a_location) ;
}
RECORD_CUR_BYTE_ADDR (a_this, a_start);
*a_end = *a_start;
for (;;) {
gboolean is_eof = FALSE;
cr_input_get_end_of_file (PRIVATE (a_this)->input, &is_eof);
if (is_eof)
break;
status = cr_tknzr_peek_char (a_this, &cur_char);
if (status == CR_END_OF_INPUT_ERROR) {
break;
} else if (status != CR_OK) {
goto error;
}
if (cr_utils_is_white_space (cur_char) == TRUE) {
READ_NEXT_CHAR (a_this, &cur_char);
RECORD_CUR_BYTE_ADDR (a_this, a_end);
} else {
break;
}
}
return CR_OK;
error:
cr_tknzr_set_cur_pos (a_this, &init_pos);
return status;
}
| 0
|
260,220
|
static int netlbl_cipsov4_listall(struct sk_buff *skb,
struct netlink_callback *cb)
{
struct netlbl_cipsov4_doiwalk_arg cb_arg;
int doi_skip = cb->args[0];
cb_arg.nl_cb = cb;
cb_arg.skb = skb;
cb_arg.seq = cb->nlh->nlmsg_seq;
cipso_v4_doi_walk(&doi_skip, netlbl_cipsov4_listall_cb, &cb_arg);
cb->args[0] = doi_skip;
return skb->len;
}
| 0
|
172,473
|
PHP_FUNCTION(pg_fetch_all_columns)
{
zval *result;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
zend_long colno=0;
int pg_numrows, pg_row;
size_t num_fields;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &result, &colno) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
pgsql_result = pg_result->result;
num_fields = PQnfields(pgsql_result);
if (colno >= (zend_long)num_fields || colno < 0) {
php_error_docref(NULL, E_WARNING, "Invalid column number '%pd'", colno);
RETURN_FALSE;
}
array_init(return_value);
if ((pg_numrows = PQntuples(pgsql_result)) <= 0) {
return;
}
for (pg_row = 0; pg_row < pg_numrows; pg_row++) {
if (PQgetisnull(pgsql_result, pg_row, (int)colno)) {
add_next_index_null(return_value);
} else {
add_next_index_string(return_value, PQgetvalue(pgsql_result, pg_row, (int)colno));
}
}
}
| 0
|
476,275
|
void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
// Orphan the mirror first, CMS thinks it's still live.
if (java_mirror() != NULL) {
java_lang_Class::set_klass(java_mirror(), NULL);
}
// Also remove mirror from handles
loader_data->remove_handle(_java_mirror);
// Need to take this class off the class loader data list.
loader_data->remove_class(this);
// The array_klass for this class is created later, after error handling.
// For class redefinition, we keep the original class so this scratch class
// doesn't have an array class. Either way, assert that there is nothing
// to deallocate.
assert(array_klasses() == NULL, "array classes shouldn't be created for this class yet");
// Release C heap allocated data that this might point to, which includes
// reference counting symbol names.
release_C_heap_structures();
deallocate_methods(loader_data, methods());
set_methods(NULL);
if (method_ordering() != NULL &&
method_ordering() != Universe::the_empty_int_array() &&
!method_ordering()->is_shared()) {
MetadataFactory::free_array<int>(loader_data, method_ordering());
}
set_method_ordering(NULL);
// default methods can be empty
if (default_methods() != NULL &&
default_methods() != Universe::the_empty_method_array() &&
!default_methods()->is_shared()) {
MetadataFactory::free_array<Method*>(loader_data, default_methods());
}
// Do NOT deallocate the default methods, they are owned by superinterfaces.
set_default_methods(NULL);
// default methods vtable indices can be empty
if (default_vtable_indices() != NULL &&
!default_vtable_indices()->is_shared()) {
MetadataFactory::free_array<int>(loader_data, default_vtable_indices());
}
set_default_vtable_indices(NULL);
// This array is in Klass, but remove it with the InstanceKlass since
// this place would be the only caller and it can share memory with transitive
// interfaces.
if (secondary_supers() != NULL &&
secondary_supers() != Universe::the_empty_klass_array() &&
secondary_supers() != transitive_interfaces() &&
!secondary_supers()->is_shared()) {
MetadataFactory::free_array<Klass*>(loader_data, secondary_supers());
}
set_secondary_supers(NULL);
deallocate_interfaces(loader_data, super(), local_interfaces(), transitive_interfaces());
set_transitive_interfaces(NULL);
set_local_interfaces(NULL);
if (fields() != NULL && !fields()->is_shared()) {
MetadataFactory::free_array<jushort>(loader_data, fields());
}
set_fields(NULL, 0);
// If a method from a redefined class is using this constant pool, don't
// delete it, yet. The new class's previous version will point to this.
if (constants() != NULL) {
assert (!constants()->on_stack(), "shouldn't be called if anything is onstack");
if (!constants()->is_shared()) {
MetadataFactory::free_metadata(loader_data, constants());
}
// Delete any cached resolution errors for the constant pool
SystemDictionary::delete_resolution_error(constants());
set_constants(NULL);
}
if (inner_classes() != NULL &&
inner_classes() != Universe::the_empty_short_array() &&
!inner_classes()->is_shared()) {
MetadataFactory::free_array<jushort>(loader_data, inner_classes());
}
set_inner_classes(NULL);
if (nest_members() != NULL &&
nest_members() != Universe::the_empty_short_array() &&
!nest_members()->is_shared()) {
MetadataFactory::free_array<jushort>(loader_data, nest_members());
}
set_nest_members(NULL);
// We should deallocate the Annotations instance if it's not in shared spaces.
if (annotations() != NULL && !annotations()->is_shared()) {
MetadataFactory::free_metadata(loader_data, annotations());
}
set_annotations(NULL);
}
| 0
|
149,014
|
void ksz9131WritePhyReg(NetInterface *interface, uint8_t address,
uint16_t data)
{
//Write the specified PHY register
if(interface->smiDriver != NULL)
{
interface->smiDriver->writePhyReg(SMI_OPCODE_WRITE,
interface->phyAddr, address, data);
}
else
{
interface->nicDriver->writePhyReg(SMI_OPCODE_WRITE,
interface->phyAddr, address, data);
}
}
| 0
|
328,286
|
void virtio_queue_notify(VirtIODevice *vdev, int n)
{
if (n < VIRTIO_PCI_QUEUE_MAX && vdev->vq[n].vring.desc) {
trace_virtio_queue_notify(vdev, n, &vdev->vq[n]);
vdev->vq[n].handle_output(vdev, &vdev->vq[n]);
}
}
| 0
|
182,053
|
SWFInput_dtor(SWFInput input)
{
#if TRACK_ALLOCS
ming_gc_remove_node(input->gcnode);
#endif
free(input);
}
| 0
|
495,964
|
bool queueMicrotask(JSContext *cx, unsigned argc, Value *vp) {
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.requireAtLeast(cx, "queueMicrotask", 1)) {
return false;
}
if (!args[0].isObject() || !JS::IsCallable(&args[0].toObject())) {
JS_ReportErrorLatin1(cx, "queueMicrotask: Argument 1 is not a function");
return false;
}
RootedObject callback(cx, &args[0].toObject());
RootedObject promise(cx, JS::CallOriginalPromiseResolve(cx, JS::UndefinedHandleValue));
if (!promise) {
return false;
}
if (!JS::AddPromiseReactions(cx, promise, callback, nullptr)) {
return false;
}
args.rval().setUndefined();
return true;
}
| 0
|
244,425
|
BluetoothRemoteGATTCharacteristic::BluetoothRemoteGATTCharacteristic(
ExecutionContext* context,
mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr characteristic,
BluetoothRemoteGATTService* service,
BluetoothDevice* device)
: ContextLifecycleObserver(context),
m_characteristic(std::move(characteristic)),
m_service(service),
m_stopped(false),
m_device(device) {
m_properties =
BluetoothCharacteristicProperties::create(m_characteristic->properties);
}
| 0
|
293,789
|
GF_Err tsro_Write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_TimeOffHintEntryBox *ptr = (GF_TimeOffHintEntryBox *)s;
if (ptr == NULL) return GF_BAD_PARAM;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_bs_write_u32(bs, ptr->TimeOffset);
return GF_OK;
}
| 0
|
33,859
|
void test_checkout_nasty__dot_git_hfs_ignorable(void)
{
#ifdef __APPLE__
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_1", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_2", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_3", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_4", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_5", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_6", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_7", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_8", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_9", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_10", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_11", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_12", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_13", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_14", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_15", ".git/foobar");
test_checkout_fails("refs/heads/dotgit_hfs_ignorable_16", ".git/foobar");
#endif
}
| 0
|
502,447
|
static void descriptor_changes_parser(TDB_DATA key, TDB_DATA data, void *private_data)
{
struct descriptor_changes **c_ptr = (struct descriptor_changes **)private_data;
uintptr_t ptr = 0;
SMB_ASSERT(data.dsize == sizeof(ptr));
memcpy(&ptr, data.dptr, data.dsize);
*c_ptr = talloc_get_type_abort((void *)ptr, struct descriptor_changes);
}
| 0
|
321,180
|
void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len)
{
if (s->chr_read) {
s->chr_read(s->handler_opaque, buf, len);
}
}
| 0
|
329,713
|
int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
{
graph->filters = av_realloc(graph->filters,
sizeof(AVFilterContext*) * ++graph->filter_count);
if (!graph->filters)
return AVERROR(ENOMEM);
graph->filters[graph->filter_count - 1] = filter;
return 0;
}
| 1
|
239,289
|
bool WebContentsImpl::IsLoadingToDifferentDocument() const {
return IsLoading() && is_load_to_different_document_;
}
| 0
|
128,559
|
static int php_var_unserialize_internal(UNSERIALIZE_PARAMETER)
{
const unsigned char *cursor, *limit, *marker, *start;
zval *rval_ref;
limit = max;
cursor = *p;
if (YYCURSOR >= YYLIMIT) {
return 0;
}
if (var_hash && (*p)[0] != 'R') {
var_push(var_hash, rval);
}
start = cursor;
#line 576 "ext/standard/var_unserializer.c"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
if ((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
yych = *YYCURSOR;
switch (yych) {
case 'C':
case 'O': goto yy4;
case 'N': goto yy5;
case 'R': goto yy6;
case 'S': goto yy7;
case 'a': goto yy8;
case 'b': goto yy9;
case 'd': goto yy10;
case 'i': goto yy11;
case 'o': goto yy12;
case 'r': goto yy13;
case 's': goto yy14;
case '}': goto yy15;
default: goto yy2;
}
yy2:
++YYCURSOR;
yy3:
#line 951 "ext/standard/var_unserializer.re"
{ return 0; }
#line 636 "ext/standard/var_unserializer.c"
yy4:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy17;
goto yy3;
yy5:
yych = *++YYCURSOR;
if (yych == ';') goto yy19;
goto yy3;
yy6:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy21;
goto yy3;
yy7:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy22;
goto yy3;
yy8:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy23;
goto yy3;
yy9:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy24;
goto yy3;
yy10:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy25;
goto yy3;
yy11:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy26;
goto yy3;
yy12:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy27;
goto yy3;
yy13:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy28;
goto yy3;
yy14:
yych = *(YYMARKER = ++YYCURSOR);
if (yych == ':') goto yy29;
goto yy3;
yy15:
++YYCURSOR;
#line 945 "ext/standard/var_unserializer.re"
{
/* this is the case where we have less data than planned */
php_error_docref(NULL, E_NOTICE, "Unexpected end of serialized data");
return 0; /* not sure if it should be 0 or 1 here? */
}
#line 689 "ext/standard/var_unserializer.c"
yy17:
yych = *++YYCURSOR;
if (yybm[0+yych] & 128) {
goto yy31;
}
if (yych == '+') goto yy30;
yy18:
YYCURSOR = YYMARKER;
goto yy3;
yy19:
++YYCURSOR;
#line 629 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_NULL(rval);
return 1;
}
#line 707 "ext/standard/var_unserializer.c"
yy21:
yych = *++YYCURSOR;
if (yych <= ',') {
if (yych == '+') goto yy33;
goto yy18;
} else {
if (yych <= '-') goto yy33;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy34;
goto yy18;
}
yy22:
yych = *++YYCURSOR;
if (yych == '+') goto yy36;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy37;
goto yy18;
yy23:
yych = *++YYCURSOR;
if (yych == '+') goto yy39;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy40;
goto yy18;
yy24:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '1') goto yy42;
goto yy18;
yy25:
yych = *++YYCURSOR;
if (yych <= '/') {
if (yych <= ',') {
if (yych == '+') goto yy43;
goto yy18;
} else {
if (yych <= '-') goto yy44;
if (yych <= '.') goto yy45;
goto yy18;
}
} else {
if (yych <= 'I') {
if (yych <= '9') goto yy46;
if (yych <= 'H') goto yy18;
goto yy48;
} else {
if (yych == 'N') goto yy49;
goto yy18;
}
}
yy26:
yych = *++YYCURSOR;
if (yych <= ',') {
if (yych == '+') goto yy50;
goto yy18;
} else {
if (yych <= '-') goto yy50;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy51;
goto yy18;
}
yy27:
yych = *++YYCURSOR;
if (yych <= ',') {
if (yych == '+') goto yy53;
goto yy18;
} else {
if (yych <= '-') goto yy53;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy54;
goto yy18;
}
yy28:
yych = *++YYCURSOR;
if (yych <= ',') {
if (yych == '+') goto yy56;
goto yy18;
} else {
if (yych <= '-') goto yy56;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy57;
goto yy18;
}
yy29:
yych = *++YYCURSOR;
if (yych == '+') goto yy59;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy60;
goto yy18;
yy30:
yych = *++YYCURSOR;
if (yybm[0+yych] & 128) {
goto yy31;
}
goto yy18;
yy31:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yybm[0+yych] & 128) {
goto yy31;
}
if (yych <= '/') goto yy18;
if (yych <= ':') goto yy62;
goto yy18;
yy33:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
yy34:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy34;
if (yych == ';') goto yy63;
goto yy18;
yy36:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
yy37:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy37;
if (yych <= ':') goto yy65;
goto yy18;
yy39:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
yy40:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy40;
if (yych <= ':') goto yy66;
goto yy18;
yy42:
yych = *++YYCURSOR;
if (yych == ';') goto yy67;
goto yy18;
yy43:
yych = *++YYCURSOR;
if (yych == '.') goto yy45;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy46;
goto yy18;
yy44:
yych = *++YYCURSOR;
if (yych <= '/') {
if (yych != '.') goto yy18;
} else {
if (yych <= '9') goto yy46;
if (yych == 'I') goto yy48;
goto yy18;
}
yy45:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy69;
goto yy18;
yy46:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
if (yych <= ':') {
if (yych <= '.') {
if (yych <= '-') goto yy18;
goto yy69;
} else {
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy46;
goto yy18;
}
} else {
if (yych <= 'E') {
if (yych <= ';') goto yy71;
if (yych <= 'D') goto yy18;
goto yy73;
} else {
if (yych == 'e') goto yy73;
goto yy18;
}
}
yy48:
yych = *++YYCURSOR;
if (yych == 'N') goto yy74;
goto yy18;
yy49:
yych = *++YYCURSOR;
if (yych == 'A') goto yy75;
goto yy18;
yy50:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
yy51:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy51;
if (yych == ';') goto yy76;
goto yy18;
yy53:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
yy54:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy54;
if (yych <= ':') goto yy78;
goto yy18;
yy56:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
yy57:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy57;
if (yych == ';') goto yy79;
goto yy18;
yy59:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
yy60:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy60;
if (yych <= ':') goto yy81;
goto yy18;
yy62:
yych = *++YYCURSOR;
if (yych == '"') goto yy82;
goto yy18;
yy63:
++YYCURSOR;
#line 580 "ext/standard/var_unserializer.re"
{
zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
id = parse_iv(start + 2) - 1;
if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) {
return 0;
}
if (Z_ISUNDEF_P(rval_ref) || (Z_ISREF_P(rval_ref) && Z_ISUNDEF_P(Z_REFVAL_P(rval_ref)))) {
return 0;
}
if (Z_ISREF_P(rval_ref)) {
ZVAL_COPY(rval, rval_ref);
} else {
ZVAL_NEW_REF(rval_ref, rval_ref);
ZVAL_COPY(rval, rval_ref);
}
return 1;
}
#line 982 "ext/standard/var_unserializer.c"
yy65:
yych = *++YYCURSOR;
if (yych == '"') goto yy84;
goto yy18;
yy66:
yych = *++YYCURSOR;
if (yych == '{') goto yy86;
goto yy18;
yy67:
++YYCURSOR;
#line 635 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
ZVAL_BOOL(rval, parse_iv(start + 2));
return 1;
}
#line 999 "ext/standard/var_unserializer.c"
yy69:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
yych = *YYCURSOR;
if (yych <= ';') {
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy69;
if (yych <= ':') goto yy18;
} else {
if (yych <= 'E') {
if (yych <= 'D') goto yy18;
goto yy73;
} else {
if (yych == 'e') goto yy73;
goto yy18;
}
}
yy71:
++YYCURSOR;
#line 683 "ext/standard/var_unserializer.re"
{
#if SIZEOF_ZEND_LONG == 4
use_double:
#endif
*p = YYCURSOR;
ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL));
return 1;
}
#line 1028 "ext/standard/var_unserializer.c"
yy73:
yych = *++YYCURSOR;
if (yych <= ',') {
if (yych == '+') goto yy88;
goto yy18;
} else {
if (yych <= '-') goto yy88;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy89;
goto yy18;
}
yy74:
yych = *++YYCURSOR;
if (yych == 'F') goto yy91;
goto yy18;
yy75:
yych = *++YYCURSOR;
if (yych == 'N') goto yy91;
goto yy18;
yy76:
++YYCURSOR;
#line 641 "ext/standard/var_unserializer.re"
{
#if SIZEOF_ZEND_LONG == 4
int digits = YYCURSOR - start - 3;
if (start[2] == '-' || start[2] == '+') {
digits--;
}
/* Use double for large zend_long values that were serialized on a 64-bit system */
if (digits >= MAX_LENGTH_OF_LONG - 1) {
if (digits == MAX_LENGTH_OF_LONG - 1) {
int cmp = strncmp((char*)YYCURSOR - MAX_LENGTH_OF_LONG, long_min_digits, MAX_LENGTH_OF_LONG - 1);
if (!(cmp < 0 || (cmp == 0 && start[2] == '-'))) {
goto use_double;
}
} else {
goto use_double;
}
}
#endif
*p = YYCURSOR;
ZVAL_LONG(rval, parse_iv(start + 2));
return 1;
}
#line 1076 "ext/standard/var_unserializer.c"
yy78:
yych = *++YYCURSOR;
if (yych == '"') goto yy92;
goto yy18;
yy79:
++YYCURSOR;
#line 605 "ext/standard/var_unserializer.re"
{
zend_long id;
*p = YYCURSOR;
if (!var_hash) return 0;
id = parse_iv(start + 2) - 1;
if (id == -1 || (rval_ref = var_access(var_hash, id)) == NULL) {
return 0;
}
if (rval_ref == rval) {
return 0;
}
if (Z_ISUNDEF_P(rval_ref) || (Z_ISREF_P(rval_ref) && Z_ISUNDEF_P(Z_REFVAL_P(rval_ref)))) {
return 0;
}
ZVAL_COPY(rval, rval_ref);
return 1;
}
#line 1107 "ext/standard/var_unserializer.c"
yy81:
yych = *++YYCURSOR;
if (yych == '"') goto yy94;
goto yy18;
yy82:
++YYCURSOR;
#line 793 "ext/standard/var_unserializer.re"
{
size_t len, len2, len3, maxlen;
zend_long elements;
char *str;
zend_string *class_name;
zend_class_entry *ce;
int incomplete_class = 0;
int custom_object = 0;
zval user_func;
zval retval;
zval args[1];
if (!var_hash) return 0;
if (*start == 'C') {
custom_object = 1;
}
len2 = len = parse_uiv(start + 2);
maxlen = max - YYCURSOR;
if (maxlen < len || len == 0) {
*p = start + 2;
return 0;
}
str = (char*)YYCURSOR;
YYCURSOR += len;
if (*(YYCURSOR) != '"') {
*p = YYCURSOR;
return 0;
}
if (*(YYCURSOR+1) != ':') {
*p = YYCURSOR+1;
return 0;
}
len3 = strspn(str, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\");
if (len3 != len)
{
*p = YYCURSOR + len3 - len;
return 0;
}
class_name = zend_string_init(str, len, 0);
do {
if(!unserialize_allowed_class(class_name, classes)) {
incomplete_class = 1;
ce = PHP_IC_ENTRY;
break;
}
/* Try to find class directly */
BG(serialize_lock)++;
ce = zend_lookup_class(class_name);
if (ce) {
BG(serialize_lock)--;
if (EG(exception)) {
zend_string_release(class_name);
return 0;
}
break;
}
BG(serialize_lock)--;
if (EG(exception)) {
zend_string_release(class_name);
return 0;
}
/* Check for unserialize callback */
if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\0')) {
incomplete_class = 1;
ce = PHP_IC_ENTRY;
break;
}
/* Call unserialize callback */
ZVAL_STRING(&user_func, PG(unserialize_callback_func));
ZVAL_STR_COPY(&args[0], class_name);
BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL) != SUCCESS) {
BG(serialize_lock)--;
if (EG(exception)) {
zend_string_release(class_name);
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
return 0;
}
php_error_docref(NULL, E_WARNING, "defined (%s) but not found", Z_STRVAL(user_func));
incomplete_class = 1;
ce = PHP_IC_ENTRY;
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
break;
}
BG(serialize_lock)--;
zval_ptr_dtor(&retval);
if (EG(exception)) {
zend_string_release(class_name);
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
return 0;
}
/* The callback function may have defined the class */
BG(serialize_lock)++;
if ((ce = zend_lookup_class(class_name)) == NULL) {
php_error_docref(NULL, E_WARNING, "Function %s() hasn't defined the class it was called for", Z_STRVAL(user_func));
incomplete_class = 1;
ce = PHP_IC_ENTRY;
}
BG(serialize_lock)--;
zval_ptr_dtor(&user_func);
zval_ptr_dtor(&args[0]);
break;
} while (1);
*p = YYCURSOR;
if (custom_object) {
int ret;
ret = object_custom(UNSERIALIZE_PASSTHRU, ce);
if (ret && incomplete_class) {
php_store_class_name(rval, ZSTR_VAL(class_name), len2);
}
zend_string_release(class_name);
return ret;
}
elements = object_common1(UNSERIALIZE_PASSTHRU, ce);
if (elements < 0) {
zend_string_release(class_name);
return 0;
}
if (incomplete_class) {
php_store_class_name(rval, ZSTR_VAL(class_name), len2);
}
zend_string_release(class_name);
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
#line 1266 "ext/standard/var_unserializer.c"
yy84:
++YYCURSOR;
#line 724 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
zend_string *str;
len = parse_uiv(start + 2);
maxlen = max - YYCURSOR;
if (maxlen < len) {
*p = start + 2;
return 0;
}
if ((str = unserialize_str(&YYCURSOR, len, maxlen)) == NULL) {
return 0;
}
if (*(YYCURSOR) != '"') {
zend_string_free(str);
*p = YYCURSOR;
return 0;
}
if (*(YYCURSOR + 1) != ';') {
efree(str);
*p = YYCURSOR + 1;
return 0;
}
YYCURSOR += 2;
*p = YYCURSOR;
ZVAL_STR(rval, str);
return 1;
}
#line 1303 "ext/standard/var_unserializer.c"
yy86:
++YYCURSOR;
#line 758 "ext/standard/var_unserializer.re"
{
zend_long elements = parse_iv(start + 2);
/* use iv() not uiv() in order to check data range */
*p = YYCURSOR;
if (!var_hash) return 0;
if (elements < 0 || elements >= HT_MAX_SIZE) {
return 0;
}
array_init_size(rval, elements);
if (elements) {
/* we can't convert from packed to hash during unserialization, because
reference to some zvals might be keept in var_hash (to support references) */
zend_hash_real_init(Z_ARRVAL_P(rval), 0);
}
if (!process_nested_data(UNSERIALIZE_PASSTHRU, Z_ARRVAL_P(rval), elements, 0)) {
return 0;
}
return finish_nested_data(UNSERIALIZE_PASSTHRU);
}
#line 1330 "ext/standard/var_unserializer.c"
yy88:
yych = *++YYCURSOR;
if (yych <= ',') {
if (yych == '+') goto yy96;
goto yy18;
} else {
if (yych <= '-') goto yy96;
if (yych <= '/') goto yy18;
if (yych >= ':') goto yy18;
}
yy89:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy89;
if (yych == ';') goto yy71;
goto yy18;
yy91:
yych = *++YYCURSOR;
if (yych == ';') goto yy97;
goto yy18;
yy92:
++YYCURSOR;
#line 782 "ext/standard/var_unserializer.re"
{
zend_long elements;
if (!var_hash) return 0;
elements = object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR);
if (elements < 0 || elements >= HT_MAX_SIZE) {
return 0;
}
return object_common2(UNSERIALIZE_PASSTHRU, elements);
}
#line 1366 "ext/standard/var_unserializer.c"
yy94:
++YYCURSOR;
#line 692 "ext/standard/var_unserializer.re"
{
size_t len, maxlen;
char *str;
len = parse_uiv(start + 2);
maxlen = max - YYCURSOR;
if (maxlen < len) {
*p = start + 2;
return 0;
}
str = (char*)YYCURSOR;
YYCURSOR += len;
if (*(YYCURSOR) != '"') {
*p = YYCURSOR;
return 0;
}
if (*(YYCURSOR + 1) != ';') {
*p = YYCURSOR + 1;
return 0;
}
YYCURSOR += 2;
*p = YYCURSOR;
ZVAL_STRINGL(rval, str, len);
return 1;
}
#line 1401 "ext/standard/var_unserializer.c"
yy96:
yych = *++YYCURSOR;
if (yych <= '/') goto yy18;
if (yych <= '9') goto yy89;
goto yy18;
yy97:
++YYCURSOR;
#line 667 "ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
if (!strncmp((char*)start + 2, "NAN", 3)) {
ZVAL_DOUBLE(rval, php_get_nan());
} else if (!strncmp((char*)start + 2, "INF", 3)) {
ZVAL_DOUBLE(rval, php_get_inf());
} else if (!strncmp((char*)start + 2, "-INF", 4)) {
ZVAL_DOUBLE(rval, -php_get_inf());
} else {
ZVAL_NULL(rval);
}
return 1;
}
#line 1425 "ext/standard/var_unserializer.c"
}
#line 953 "ext/standard/var_unserializer.re"
return 0;
}
| 0
|
476,484
|
static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
off_t offset, struct fuse_file_info *fi, int plus)
{
struct lo_data *lo = lo_data(req);
struct lo_dirp *d = NULL;
struct lo_inode *dinode;
g_autofree char *buf = NULL;
char *p;
size_t rem = size;
int err = EBADF;
dinode = lo_inode(req, ino);
if (!dinode) {
goto error;
}
d = lo_dirp(req, fi);
if (!d) {
goto error;
}
err = ENOMEM;
buf = g_try_malloc0(size);
if (!buf) {
goto error;
}
p = buf;
if (offset != d->offset) {
seekdir(d->dp, offset);
d->entry = NULL;
d->offset = offset;
}
while (1) {
size_t entsize;
off_t nextoff;
const char *name;
if (!d->entry) {
errno = 0;
d->entry = readdir(d->dp);
if (!d->entry) {
if (errno) { /* Error */
err = errno;
goto error;
} else { /* End of stream */
break;
}
}
}
nextoff = d->entry->d_off;
name = d->entry->d_name;
fuse_ino_t entry_ino = 0;
struct fuse_entry_param e = (struct fuse_entry_param){
.attr.st_ino = d->entry->d_ino,
.attr.st_mode = d->entry->d_type << 12,
};
/* Hide root's parent directory */
if (dinode == &lo->root && strcmp(name, "..") == 0) {
e.attr.st_ino = lo->root.key.ino;
e.attr.st_mode = DT_DIR << 12;
}
if (plus) {
if (!is_dot_or_dotdot(name)) {
err = lo_do_lookup(req, ino, name, &e, NULL);
if (err) {
goto error;
}
entry_ino = e.ino;
}
entsize = fuse_add_direntry_plus(req, p, rem, name, &e, nextoff);
} else {
entsize = fuse_add_direntry(req, p, rem, name, &e.attr, nextoff);
}
if (entsize > rem) {
if (entry_ino != 0) {
lo_forget_one(req, entry_ino, 1);
}
break;
}
p += entsize;
rem -= entsize;
d->entry = NULL;
d->offset = nextoff;
}
err = 0;
error:
lo_dirp_put(&d);
lo_inode_put(lo, &dinode);
/*
* If there's an error, we can only signal it if we haven't stored
* any entries yet - otherwise we'd end up with wrong lookup
* counts for the entries that are already in the buffer. So we
* return what we've collected until that point.
*/
if (err && rem == size) {
fuse_reply_err(req, err);
} else {
fuse_reply_buf(req, buf, size - rem);
}
}
| 0
|
68,216
|
int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v)
{
int changed = 0;
if (snd_BUG_ON(snd_interval_empty(i)))
return -EINVAL;
if (i->min < v->min) {
i->min = v->min;
i->openmin = v->openmin;
changed = 1;
} else if (i->min == v->min && !i->openmin && v->openmin) {
i->openmin = 1;
changed = 1;
}
if (i->max > v->max) {
i->max = v->max;
i->openmax = v->openmax;
changed = 1;
} else if (i->max == v->max && !i->openmax && v->openmax) {
i->openmax = 1;
changed = 1;
}
if (!i->integer && v->integer) {
i->integer = 1;
changed = 1;
}
if (i->integer) {
if (i->openmin) {
i->min++;
i->openmin = 0;
}
if (i->openmax) {
i->max--;
i->openmax = 0;
}
} else if (!i->openmin && !i->openmax && i->min == i->max)
i->integer = 1;
if (snd_interval_checkempty(i)) {
snd_interval_none(i);
return -EINVAL;
}
return changed;
}
| 0
|
128,291
|
PJ_DEF(pj_status_t) pjmedia_sdp_media_add_attr( pjmedia_sdp_media *m,
pjmedia_sdp_attr *attr)
{
return pjmedia_sdp_attr_add(&m->attr_count, m->attr, attr);
}
| 0
|
50,131
|
void Context::removeHeaderMapValue(HeaderMapType type, absl::string_view key) {
auto map = getMap(type);
if (!map) {
return;
}
const Http::LowerCaseString lower_key(std::move(std::string(key)));
map->remove(lower_key);
}
| 0
|
163,317
|
bool WindowCanOpenTabs(Browser* browser) {
if (browser->tab_count() >= browser_defaults::kMaxTabCount)
return false;
return browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP) ||
browser->tabstrip_model()->empty();
}
| 0
|
325,425
|
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
long width, long height,
long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
{
long y;
const long chromWidth= width>>1;
for(y=0; y<height; y++)
{
#ifdef HAVE_MMX
//FIXME handle 2 lines a once (fewer prefetch, reuse some chrom, but very likely limited by mem anyway)
asm volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
ASMALIGN16
"1: \n\t"
PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
PREFETCH" 32(%2, %%"REG_a") \n\t"
PREFETCH" 32(%3, %%"REG_a") \n\t"
"movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
"movq %%mm0, %%mm2 \n\t" // U(0)
"movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
"punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
"punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
"movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
"movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
"movq %%mm0, %%mm4 \n\t" // Y(0)
"movq %%mm2, %%mm6 \n\t" // Y(8)
"punpcklbw %%mm3, %%mm0 \n\t" // YUYV YUYV(0)
"punpckhbw %%mm3, %%mm4 \n\t" // YUYV YUYV(4)
"punpcklbw %%mm5, %%mm2 \n\t" // YUYV YUYV(8)
"punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12)
MOVNTQ" %%mm0, (%0, %%"REG_a", 4)\n\t"
MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t"
MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4)\n\t"
MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t"
"add $8, %%"REG_a" \n\t"
"cmp %4, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
: "%"REG_a
);
#else
//FIXME adapt the alpha asm code from yv12->yuy2
#if __WORDSIZE >= 64
int i;
uint64_t *ldst = (uint64_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for(i = 0; i < chromWidth; i += 2){
uint64_t k, l;
k = uc[0] + (yc[0] << 8) +
(vc[0] << 16) + (yc[1] << 24);
l = uc[1] + (yc[2] << 8) +
(vc[1] << 16) + (yc[3] << 24);
*ldst++ = k + (l << 32);
yc += 4;
uc += 2;
vc += 2;
}
#else
int i, *idst = (int32_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for(i = 0; i < chromWidth; i++){
#ifdef WORDS_BIGENDIAN
*idst++ = (uc[0] << 24)+ (yc[0] << 16) +
(vc[0] << 8) + (yc[1] << 0);
#else
*idst++ = uc[0] + (yc[0] << 8) +
(vc[0] << 16) + (yc[1] << 24);
#endif
yc += 2;
uc++;
vc++;
}
#endif
#endif
if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
{
usrc += chromStride;
vsrc += chromStride;
}
ysrc += lumStride;
dst += dstStride;
}
#ifdef HAVE_MMX
asm( EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#endif
}
| 0
|
323,265
|
static void patch_reloc(uint8_t *code_ptr, int type,
intptr_t value, intptr_t addend)
{
uint32_t insn;
value += addend;
switch (type) {
case R_SPARC_32:
if (value != (uint32_t)value) {
tcg_abort();
}
*(uint32_t *)code_ptr = value;
break;
case R_SPARC_WDISP16:
value -= (intptr_t)code_ptr;
if (!check_fit_tl(value >> 2, 16)) {
tcg_abort();
}
insn = *(uint32_t *)code_ptr;
insn &= ~INSN_OFF16(-1);
insn |= INSN_OFF16(value);
*(uint32_t *)code_ptr = insn;
break;
case R_SPARC_WDISP19:
value -= (intptr_t)code_ptr;
if (!check_fit_tl(value >> 2, 19)) {
tcg_abort();
}
insn = *(uint32_t *)code_ptr;
insn &= ~INSN_OFF19(-1);
insn |= INSN_OFF19(value);
*(uint32_t *)code_ptr = insn;
break;
default:
tcg_abort();
}
}
| 0
|
346,808
|
static struct n_hdlc *n_hdlc_alloc(void)
{
struct n_hdlc_buf *buf;
int i;
struct n_hdlc *n_hdlc = kzalloc(sizeof(*n_hdlc), GFP_KERNEL);
if (!n_hdlc)
return NULL;
spin_lock_init(&n_hdlc->rx_free_buf_list.spinlock);
spin_lock_init(&n_hdlc->tx_free_buf_list.spinlock);
spin_lock_init(&n_hdlc->rx_buf_list.spinlock);
spin_lock_init(&n_hdlc->tx_buf_list.spinlock);
/* allocate free rx buffer list */
for(i=0;i<DEFAULT_RX_BUF_COUNT;i++) {
buf = kmalloc(N_HDLC_BUF_SIZE, GFP_KERNEL);
if (buf)
n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,buf);
else if (debuglevel >= DEBUG_LEVEL_INFO)
printk("%s(%d)n_hdlc_alloc(), kalloc() failed for rx buffer %d\n",__FILE__,__LINE__, i);
}
/* allocate free tx buffer list */
for(i=0;i<DEFAULT_TX_BUF_COUNT;i++) {
buf = kmalloc(N_HDLC_BUF_SIZE, GFP_KERNEL);
if (buf)
n_hdlc_buf_put(&n_hdlc->tx_free_buf_list,buf);
else if (debuglevel >= DEBUG_LEVEL_INFO)
printk("%s(%d)n_hdlc_alloc(), kalloc() failed for tx buffer %d\n",__FILE__,__LINE__, i);
}
/* Initialize the control block */
n_hdlc->magic = HDLC_MAGIC;
n_hdlc->flags = 0;
return n_hdlc;
} /* end of n_hdlc_alloc() */
| 1
|
118,667
|
void HTTPSession::setByteEventTracker(
std::shared_ptr<ByteEventTracker> byteEventTracker) {
if (byteEventTracker && byteEventTracker_) {
byteEventTracker->absorb(std::move(*byteEventTracker_));
}
byteEventTracker_ = byteEventTracker;
if (byteEventTracker_) {
byteEventTracker_->setCallback(this);
byteEventTracker_->setTTLBAStats(sessionStats_);
}
}
| 0
|
477,749
|
float operator()(const float x, const float y) const {
return (float)ref((int)x,(int)y);
}
| 0
|
355,014
|
shmem_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
struct inode *inode = file->f_path.dentry->d_inode;
loff_t pos;
unsigned long written;
ssize_t err;
if ((ssize_t) count < 0)
return -EINVAL;
if (!access_ok(VERIFY_READ, buf, count))
return -EFAULT;
mutex_lock(&inode->i_mutex);
pos = *ppos;
written = 0;
err = generic_write_checks(file, &pos, &count, 0);
if (err || !count)
goto out;
err = remove_suid(file->f_path.dentry);
if (err)
goto out;
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
do {
struct page *page = NULL;
unsigned long bytes, index, offset;
char *kaddr;
int left;
offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
index = pos >> PAGE_CACHE_SHIFT;
bytes = PAGE_CACHE_SIZE - offset;
if (bytes > count)
bytes = count;
/*
* We don't hold page lock across copy from user -
* what would it guard against? - so no deadlock here.
* But it still may be a good idea to prefault below.
*/
err = shmem_getpage(inode, index, &page, SGP_WRITE, NULL);
if (err)
break;
left = bytes;
if (PageHighMem(page)) {
volatile unsigned char dummy;
__get_user(dummy, buf);
__get_user(dummy, buf + bytes - 1);
kaddr = kmap_atomic(page, KM_USER0);
left = __copy_from_user_inatomic(kaddr + offset,
buf, bytes);
kunmap_atomic(kaddr, KM_USER0);
}
if (left) {
kaddr = kmap(page);
left = __copy_from_user(kaddr + offset, buf, bytes);
kunmap(page);
}
written += bytes;
count -= bytes;
pos += bytes;
buf += bytes;
if (pos > inode->i_size)
i_size_write(inode, pos);
flush_dcache_page(page);
set_page_dirty(page);
mark_page_accessed(page);
page_cache_release(page);
if (left) {
pos -= left;
written -= left;
err = -EFAULT;
break;
}
/*
* Our dirty pages are not counted in nr_dirty,
* and we do not attempt to balance dirty pages.
*/
cond_resched();
} while (count);
*ppos = pos;
if (written)
err = written;
out:
mutex_unlock(&inode->i_mutex);
return err;
}
| 0
|
506,206
|
int tls12_get_req_sig_algs(SSL *s, unsigned char *p)
{
size_t slen = sizeof(tls12_sigalgs);
#ifdef OPENSSL_FIPS
/* If FIPS mode don't include MD5 which is last */
if (FIPS_mode())
slen -= 2;
#endif
if (p)
memcpy(p, tls12_sigalgs, slen);
return (int)slen;
}
| 0
|
459,296
|
static void cmd_read(IDEState *s, uint8_t* buf)
{
int nb_sectors, lba;
if (buf[0] == GPCMD_READ_10) {
nb_sectors = lduw_be_p(buf + 7);
} else {
nb_sectors = ldl_be_p(buf + 6);
}
lba = ldl_be_p(buf + 2);
if (nb_sectors == 0) {
ide_atapi_cmd_ok(s);
return;
}
ide_atapi_cmd_read(s, lba, nb_sectors, 2048);
}
| 0
|
141,618
|
int snd_timer_open(struct snd_timer_instance **ti,
char *owner, struct snd_timer_id *tid,
unsigned int slave_id)
{
struct snd_timer *timer;
struct snd_timer_instance *timeri = NULL;
if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) {
/* open a slave instance */
if (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE ||
tid->dev_sclass > SNDRV_TIMER_SCLASS_OSS_SEQUENCER) {
pr_debug("ALSA: timer: invalid slave class %i\n",
tid->dev_sclass);
return -EINVAL;
}
mutex_lock(®ister_mutex);
timeri = snd_timer_instance_new(owner, NULL);
if (!timeri) {
mutex_unlock(®ister_mutex);
return -ENOMEM;
}
timeri->slave_class = tid->dev_sclass;
timeri->slave_id = tid->device;
timeri->flags |= SNDRV_TIMER_IFLG_SLAVE;
list_add_tail(&timeri->open_list, &snd_timer_slave_list);
snd_timer_check_slave(timeri);
mutex_unlock(®ister_mutex);
*ti = timeri;
return 0;
}
/* open a master instance */
mutex_lock(®ister_mutex);
timer = snd_timer_find(tid);
#ifdef CONFIG_MODULES
if (!timer) {
mutex_unlock(®ister_mutex);
snd_timer_request(tid);
mutex_lock(®ister_mutex);
timer = snd_timer_find(tid);
}
#endif
if (!timer) {
mutex_unlock(®ister_mutex);
return -ENODEV;
}
if (!list_empty(&timer->open_list_head)) {
timeri = list_entry(timer->open_list_head.next,
struct snd_timer_instance, open_list);
if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) {
mutex_unlock(®ister_mutex);
return -EBUSY;
}
}
timeri = snd_timer_instance_new(owner, timer);
if (!timeri) {
mutex_unlock(®ister_mutex);
return -ENOMEM;
}
/* take a card refcount for safe disconnection */
if (timer->card)
get_device(&timer->card->card_dev);
timeri->slave_class = tid->dev_sclass;
timeri->slave_id = slave_id;
if (list_empty(&timer->open_list_head) && timer->hw.open)
timer->hw.open(timer);
list_add_tail(&timeri->open_list, &timer->open_list_head);
snd_timer_check_master(timeri);
mutex_unlock(®ister_mutex);
*ti = timeri;
return 0;
}
| 0
|
291,723
|
smb2_echo_callback(struct mid_q_entry *mid)
{
struct TCP_Server_Info *server = mid->callback_data;
struct smb2_echo_rsp *smb2 = (struct smb2_echo_rsp *)mid->resp_buf;
unsigned int credits_received = 1;
if (mid->mid_state == MID_RESPONSE_RECEIVED)
credits_received = le16_to_cpu(smb2->hdr.CreditRequest);
DeleteMidQEntry(mid);
add_credits(server, credits_received, CIFS_ECHO_OP);
}
| 0
|
87,660
|
Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
pos(0),
eod(false)
{
this->inbuf[0] = '0';
this->inbuf[1] = '0';
this->inbuf[2] = '\0';
}
| 0
|
429,870
|
void ClientHandler::reset_upstream_read_timeout(ev_tstamp t) {
conn_.rt.repeat = t;
if (ev_is_active(&conn_.rt)) {
ev_timer_again(conn_.loop, &conn_.rt);
}
}
| 0
|
47,694
|
int mp_radix_size (mp_int *a, int radix, int *size)
{
int res, digs;
fp_digit d;
#ifndef WOLFSSL_SMALL_STACK
fp_int t[1];
#else
fp_int *t;
#endif
*size = 0;
/* special case for binary */
if (radix == 2) {
*size = fp_count_bits (a) + (a->sign == FP_NEG ? 1 : 0) + 1;
return FP_YES;
}
/* make sure the radix is in range */
if (radix < 2 || radix > 64) {
return FP_VAL;
}
if (fp_iszero(a) == MP_YES) {
*size = 2;
return FP_OKAY;
}
/* digs is the digit count */
digs = 0;
/* if it's negative add one for the sign */
if (a->sign == FP_NEG) {
++digs;
}
#ifdef WOLFSSL_SMALL_STACK
t = (fp_int*)XMALLOC(sizeof(fp_int), NULL, DYNAMIC_TYPE_BIGINT);
if (t == NULL)
return FP_MEM;
#endif
/* init a copy of the input */
fp_init_copy (t, a);
/* force temp to positive */
t->sign = FP_ZPOS;
/* fetch out all of the digits */
while (fp_iszero (t) == FP_NO) {
if ((res = fp_div_d (t, (mp_digit) radix, t, &d)) != FP_OKAY) {
fp_zero (t);
#ifdef WOLFSSL_SMALL_STACK
XFREE(t, NULL, DYNAMIC_TYPE_BIGINT);
#endif
return res;
}
++digs;
}
fp_zero (t);
/* return digs + 1, the 1 is for the NULL byte that would be required. */
*size = digs + 1;
#ifdef WOLFSSL_SMALL_STACK
XFREE(t, NULL, DYNAMIC_TYPE_BIGINT);
#endif
return FP_OKAY;
}
| 0
|
155,421
|
recvauth_common(krb5_context context,
krb5_auth_context * auth_context,
/* IN */
krb5_pointer fd,
char *appl_version,
krb5_principal server,
krb5_int32 flags,
krb5_keytab keytab,
/* OUT */
krb5_ticket ** ticket,
krb5_data *version)
{
krb5_auth_context new_auth_context;
krb5_flags ap_option = 0;
krb5_error_code retval, problem;
krb5_data inbuf;
krb5_data outbuf;
krb5_rcache rcache = 0;
krb5_octet response;
krb5_data null_server;
krb5_data d;
int need_error_free = 0;
int local_rcache = 0, local_authcon = 0;
/*
* Zero out problem variable. If problem is set at the end of
* the intial version negotiation section, it means that we
* need to send an error code back to the client application
* and exit.
*/
problem = 0;
response = 0;
if (!(flags & KRB5_RECVAUTH_SKIP_VERSION)) {
/*
* First read the sendauth version string and check it.
*/
if ((retval = krb5_read_message(context, fd, &inbuf)))
return(retval);
d = make_data((char *)sendauth_version, strlen(sendauth_version) + 1);
if (!data_eq(inbuf, d)) {
problem = KRB5_SENDAUTH_BADAUTHVERS;
response = 1;
}
free(inbuf.data);
}
if (flags & KRB5_RECVAUTH_BADAUTHVERS) {
problem = KRB5_SENDAUTH_BADAUTHVERS;
response = 1;
}
/*
* Do the same thing for the application version string.
*/
if ((retval = krb5_read_message(context, fd, &inbuf)))
return(retval);
if (appl_version != NULL && !problem) {
d = make_data(appl_version, strlen(appl_version) + 1);
if (!data_eq(inbuf, d)) {
problem = KRB5_SENDAUTH_BADAPPLVERS;
response = 2;
}
}
if (version && !problem)
*version = inbuf;
else
free(inbuf.data);
/*
* Now we actually write the response. If the response is non-zero,
* exit with a return value of problem
*/
if ((krb5_net_write(context, *((int *)fd), (char *)&response, 1)) < 0) {
return(problem); /* We'll return the top-level problem */
}
if (problem)
return(problem);
/* We are clear of errors here */
/*
* Now, let's read the AP_REQ message and decode it
*/
if ((retval = krb5_read_message(context, fd, &inbuf)))
return retval;
if (*auth_context == NULL) {
problem = krb5_auth_con_init(context, &new_auth_context);
*auth_context = new_auth_context;
local_authcon = 1;
}
krb5_auth_con_getrcache(context, *auth_context, &rcache);
if ((!problem) && rcache == NULL) {
/*
* Setup the replay cache.
*/
if (server != NULL && server->length > 0) {
problem = krb5_get_server_rcache(context, &server->data[0],
&rcache);
} else {
null_server.length = 7;
null_server.data = "default";
problem = krb5_get_server_rcache(context, &null_server, &rcache);
}
if (!problem)
problem = krb5_auth_con_setrcache(context, *auth_context, rcache);
local_rcache = 1;
}
if (!problem) {
problem = krb5_rd_req(context, auth_context, &inbuf, server,
keytab, &ap_option, ticket);
free(inbuf.data);
}
/*
* If there was a problem, send back a krb5_error message,
* preceeded by the length of the krb5_error message. If
* everything's ok, send back 0 for the length.
*/
if (problem) {
krb5_error error;
const char *message;
memset(&error, 0, sizeof(error));
krb5_us_timeofday(context, &error.stime, &error.susec);
if(server)
error.server = server;
else {
/* If this fails - ie. ENOMEM we are hosed
we cannot even send the error if we wanted to... */
(void) krb5_parse_name(context, "????", &error.server);
need_error_free = 1;
}
error.error = problem - ERROR_TABLE_BASE_krb5;
if (error.error > 127)
error.error = KRB_ERR_GENERIC;
message = error_message(problem);
error.text.length = strlen(message) + 1;
error.text.data = strdup(message);
if (!error.text.data) {
retval = ENOMEM;
goto cleanup;
}
if ((retval = krb5_mk_error(context, &error, &outbuf))) {
free(error.text.data);
goto cleanup;
}
free(error.text.data);
if(need_error_free)
krb5_free_principal(context, error.server);
} else {
outbuf.length = 0;
outbuf.data = 0;
}
retval = krb5_write_message(context, fd, &outbuf);
if (outbuf.data) {
free(outbuf.data);
/* We sent back an error, we need cleanup then return */
retval = problem;
goto cleanup;
}
if (retval)
goto cleanup;
/* Here lies the mutual authentication stuff... */
if ((ap_option & AP_OPTS_MUTUAL_REQUIRED)) {
if ((retval = krb5_mk_rep(context, *auth_context, &outbuf))) {
return(retval);
}
retval = krb5_write_message(context, fd, &outbuf);
free(outbuf.data);
}
cleanup:;
if (retval) {
if (local_authcon) {
krb5_auth_con_free(context, *auth_context);
} else if (local_rcache && rcache != NULL) {
krb5_rc_close(context, rcache);
krb5_auth_con_setrcache(context, *auth_context, NULL);
}
}
return retval;
}
| 0
|
431,229
|
CmdGrantRolesToRole() : BasicCommand("grantRolesToRole") {}
| 0
|
199,081
|
WebCookieJar* RenderViewImpl::GetCookieJar() {
return &cookie_jar_;
}
| 0
|
341,040
|
Visitor *qmp_input_visitor_new(QObject *obj, bool strict)
{
QmpInputVisitor *v;
assert(obj);
v = g_malloc0(sizeof(*v));
v->visitor.type = VISITOR_INPUT;
v->visitor.start_struct = qmp_input_start_struct;
v->visitor.check_struct = qmp_input_check_struct;
v->visitor.end_struct = qmp_input_pop;
v->visitor.start_list = qmp_input_start_list;
v->visitor.next_list = qmp_input_next_list;
v->visitor.end_list = qmp_input_pop;
v->visitor.start_alternate = qmp_input_start_alternate;
v->visitor.type_int64 = qmp_input_type_int64;
v->visitor.type_uint64 = qmp_input_type_uint64;
v->visitor.type_bool = qmp_input_type_bool;
v->visitor.type_str = qmp_input_type_str;
v->visitor.type_number = qmp_input_type_number;
v->visitor.type_any = qmp_input_type_any;
v->visitor.type_null = qmp_input_type_null;
v->visitor.optional = qmp_input_optional;
v->visitor.free = qmp_input_free;
v->strict = strict;
v->root = obj;
qobject_incref(obj);
return &v->visitor;
}
| 0
|
451,398
|
void HeaderToMetadataFilter::applyKeyValue(std::string&& value, const Rule& rule,
const KeyValuePair& keyval, StructMap& np) {
if (!keyval.value().empty()) {
value = keyval.value();
} else {
const auto& matcher = rule.regexRewrite();
if (matcher != nullptr) {
value = matcher->replaceAll(value, rule.regexSubstitution());
}
}
if (!value.empty()) {
const auto& nspace = decideNamespace(keyval.metadata_namespace());
addMetadata(np, nspace, keyval.key(), value, keyval.type(), keyval.encode());
} else {
ENVOY_LOG(debug, "value is empty, not adding metadata");
}
}
| 0
|
489,805
|
static GF_AUContext *gf_seng_create_new_au(GF_StreamContext *sc, u32 time)
{
GF_AUContext *new_au, *last_au;
if (!sc) return NULL;
last_au = gf_list_last(sc->AUs);
if (last_au && last_au->timing == time) {
GF_LOG(GF_LOG_DEBUG, GF_LOG_SCENE, ("[SceneEngine] Forcing new AU\n"));
time++;
}
new_au = gf_sm_stream_au_new(sc, time, 0, 0);
return new_au;
}
| 0
|
255,885
|
void GeneratePathsToCheck(const GURL& url, std::vector<std::string>* paths) {
paths->clear();
const std::string path = url.path(); // const sidesteps GCC bugs below!
if (path.empty())
return;
const size_t kMaxPathsToCheck = 4;
for (std::string::const_iterator i(path.begin());
i != path.end() && paths->size() < kMaxPathsToCheck; ++i) {
if (*i == '/')
paths->push_back(std::string(path.begin(), i + 1));
}
if (paths->back() != path)
paths->push_back(path);
if (url.has_query())
paths->push_back(path + "?" + url.query());
}
| 1
|
283,831
|
Offliner::RequestStatus BackgroundLoaderOffliner::CanSavePageInBackground(
content::WebContents* web_contents) {
DCHECK(is_low_bar_met_)
<< "Minimum quality must have been reached before checking loaded page";
std::unique_ptr<security_state::VisibleSecurityState> visible_security_state =
GetVisibleSecurityState(web_contents);
if (security_state::HasMajorCertificateError(*visible_security_state))
return Offliner::RequestStatus::LOADED_PAGE_HAS_CERTIFICATE_ERROR;
if (visible_security_state->malicious_content_status !=
security_state::MaliciousContentStatus::MALICIOUS_CONTENT_STATUS_NONE) {
return Offliner::RequestStatus::LOADED_PAGE_IS_BLOCKED;
}
if (GetPageType(web_contents) != content::PageType::PAGE_TYPE_NORMAL)
return Offliner::RequestStatus::LOADED_PAGE_IS_CHROME_INTERNAL;
return Offliner::RequestStatus::UNKNOWN;
}
| 0
|
406,551
|
void init()
{
resolve_in_select_list= FALSE;
error_processor= &dummy_error_processor;
first_name_resolution_table= NULL;
last_name_resolution_table= NULL;
}
| 0
|
368,140
|
process_cmd_maxdelayratio(CMD_Request *msg, char *line)
{
IPAddr address;
double max_delay_ratio;
int ok;
if (read_address_double(line, &address, &max_delay_ratio)) {
UTI_IPHostToNetwork(&address, &msg->data.modify_maxdelayratio.address);
msg->data.modify_maxdelayratio.new_max_delay_ratio = UTI_FloatHostToNetwork(max_delay_ratio);
msg->command = htons(REQ_MODIFY_MAXDELAYRATIO);
ok = 1;
} else {
ok = 0;
}
return ok;
}
| 0
|
294,145
|
xfs_vn_symlink(
struct inode *dir,
struct dentry *dentry,
const char *symname)
{
struct inode *inode;
struct xfs_inode *cip = NULL;
struct xfs_name name;
int error;
umode_t mode;
mode = S_IFLNK |
(irix_symlink_mode ? 0777 & ~current_umask() : S_IRWXUGO);
error = xfs_dentry_mode_to_name(&name, dentry, mode);
if (unlikely(error))
goto out;
error = xfs_symlink(XFS_I(dir), &name, symname, mode, &cip);
if (unlikely(error))
goto out;
inode = VFS_I(cip);
error = xfs_init_security(inode, dir, &dentry->d_name);
if (unlikely(error))
goto out_cleanup_inode;
xfs_setup_iops(cip);
d_instantiate(dentry, inode);
xfs_finish_inode_setup(cip);
return 0;
out_cleanup_inode:
xfs_finish_inode_setup(cip);
xfs_cleanup_inode(dir, inode, dentry);
xfs_irele(cip);
out:
return error;
}
| 0
|
257,334
|
static void pdf_process_stream ( fz_context * ctx , pdf_processor * proc , pdf_csi * csi , fz_stream * stm ) {
pdf_document * doc = csi -> doc ;
pdf_lexbuf * buf = csi -> buf ;
fz_cookie * cookie = csi -> cookie ;
pdf_token tok = PDF_TOK_ERROR ;
int in_text_array = 0 ;
int syntax_errors = 0 ;
pdf_clear_stack ( ctx , csi ) ;
fz_var ( in_text_array ) ;
fz_var ( tok ) ;
if ( cookie ) {
cookie -> progress_max = - 1 ;
cookie -> progress = 0 ;
}
do {
fz_try ( ctx ) {
do {
if ( cookie ) {
if ( cookie -> abort ) {
tok = PDF_TOK_EOF ;
break ;
}
cookie -> progress ++ ;
}
tok = pdf_lex ( ctx , stm , buf ) ;
if ( in_text_array ) {
switch ( tok ) {
case PDF_TOK_CLOSE_ARRAY : in_text_array = 0 ;
break ;
case PDF_TOK_REAL : pdf_array_push_drop ( ctx , csi -> obj , pdf_new_real ( ctx , doc , buf -> f ) ) ;
break ;
case PDF_TOK_INT : pdf_array_push_drop ( ctx , csi -> obj , pdf_new_int ( ctx , doc , buf -> i ) ) ;
break ;
case PDF_TOK_STRING : pdf_array_push_drop ( ctx , csi -> obj , pdf_new_string ( ctx , doc , buf -> scratch , buf -> len ) ) ;
break ;
case PDF_TOK_EOF : break ;
case PDF_TOK_KEYWORD : if ( buf -> scratch [ 0 ] == 'T' && ( buf -> scratch [ 1 ] == 'w' || buf -> scratch [ 1 ] == 'c' ) && buf -> scratch [ 2 ] == 0 ) {
int n = pdf_array_len ( ctx , csi -> obj ) ;
if ( n > 0 ) {
pdf_obj * o = pdf_array_get ( ctx , csi -> obj , n - 1 ) ;
if ( pdf_is_number ( ctx , o ) ) {
csi -> stack [ 0 ] = pdf_to_real ( ctx , o ) ;
pdf_array_delete ( ctx , csi -> obj , n - 1 ) ;
pdf_process_keyword ( ctx , proc , csi , stm , buf -> scratch ) ;
}
}
}
default : fz_throw ( ctx , FZ_ERROR_SYNTAX , "syntax error in array" ) ;
}
}
else switch ( tok ) {
case PDF_TOK_ENDSTREAM : case PDF_TOK_EOF : tok = PDF_TOK_EOF ;
break ;
case PDF_TOK_OPEN_ARRAY : if ( csi -> obj ) {
pdf_drop_obj ( ctx , csi -> obj ) ;
csi -> obj = NULL ;
}
if ( csi -> in_text ) {
in_text_array = 1 ;
csi -> obj = pdf_new_array ( ctx , doc , 4 ) ;
}
else {
csi -> obj = pdf_parse_array ( ctx , doc , stm , buf ) ;
}
break ;
case PDF_TOK_OPEN_DICT : if ( csi -> obj ) {
pdf_drop_obj ( ctx , csi -> obj ) ;
csi -> obj = NULL ;
}
csi -> obj = pdf_parse_dict ( ctx , doc , stm , buf ) ;
break ;
case PDF_TOK_NAME : if ( csi -> name [ 0 ] ) {
pdf_drop_obj ( ctx , csi -> obj ) ;
csi -> obj = NULL ;
csi -> obj = pdf_new_name ( ctx , doc , buf -> scratch ) ;
}
else fz_strlcpy ( csi -> name , buf -> scratch , sizeof ( csi -> name ) ) ;
break ;
case PDF_TOK_INT : if ( csi -> top < nelem ( csi -> stack ) ) {
csi -> stack [ csi -> top ] = buf -> i ;
csi -> top ++ ;
}
else fz_throw ( ctx , FZ_ERROR_SYNTAX , "stack overflow" ) ;
break ;
case PDF_TOK_REAL : if ( csi -> top < nelem ( csi -> stack ) ) {
csi -> stack [ csi -> top ] = buf -> f ;
csi -> top ++ ;
}
else fz_throw ( ctx , FZ_ERROR_SYNTAX , "stack overflow" ) ;
break ;
case PDF_TOK_STRING : if ( buf -> len <= sizeof ( csi -> string ) ) {
memcpy ( csi -> string , buf -> scratch , buf -> len ) ;
csi -> string_len = buf -> len ;
}
else {
if ( csi -> obj ) {
pdf_drop_obj ( ctx , csi -> obj ) ;
csi -> obj = NULL ;
}
csi -> obj = pdf_new_string ( ctx , doc , buf -> scratch , buf -> len ) ;
}
break ;
case PDF_TOK_KEYWORD : pdf_process_keyword ( ctx , proc , csi , stm , buf -> scratch ) ;
pdf_clear_stack ( ctx , csi ) ;
break ;
default : fz_throw ( ctx , FZ_ERROR_SYNTAX , "syntax error in content stream" ) ;
}
}
while ( tok != PDF_TOK_EOF ) ;
}
fz_always ( ctx ) {
pdf_clear_stack ( ctx , csi ) ;
}
fz_catch ( ctx ) {
int caught = fz_caught ( ctx ) ;
if ( cookie ) {
if ( caught == FZ_ERROR_TRYLATER ) {
if ( cookie -> incomplete_ok ) cookie -> incomplete ++ ;
else fz_rethrow ( ctx ) ;
}
else if ( caught == FZ_ERROR_ABORT ) {
fz_rethrow ( ctx ) ;
}
else if ( caught == FZ_ERROR_SYNTAX ) {
cookie -> errors ++ ;
if ( ++ syntax_errors >= MAX_SYNTAX_ERRORS ) {
fz_warn ( ctx , "too many syntax errors;
ignoring rest of page" ) ;
tok = PDF_TOK_EOF ;
}
}
else {
cookie -> errors ++ ;
fz_warn ( ctx , "unrecoverable error;
ignoring rest of page" ) ;
tok = PDF_TOK_EOF ;
}
}
else {
if ( caught == FZ_ERROR_TRYLATER ) fz_rethrow ( ctx ) ;
else if ( caught == FZ_ERROR_ABORT ) fz_rethrow ( ctx ) ;
else if ( caught == FZ_ERROR_SYNTAX ) {
if ( ++ syntax_errors >= MAX_SYNTAX_ERRORS ) {
fz_warn ( ctx , "too many syntax errors;
ignoring rest of page" ) ;
tok = PDF_TOK_EOF ;
}
}
else {
fz_warn ( ctx , "unrecoverable error;
ignoring rest of page" ) ;
tok = PDF_TOK_EOF ;
}
}
in_text_array = 0 ;
}
}
while ( tok != PDF_TOK_EOF ) ;
}
| 0
|
90,700
|
bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
{
return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
}
| 0
|
470,645
|
static void htab_init_buckets(struct bpf_htab *htab)
{
unsigned i;
for (i = 0; i < htab->n_buckets; i++) {
INIT_HLIST_NULLS_HEAD(&htab->buckets[i].head, i);
if (htab_use_raw_lock(htab)) {
raw_spin_lock_init(&htab->buckets[i].raw_lock);
lockdep_set_class(&htab->buckets[i].raw_lock,
&htab->lockdep_key);
} else {
spin_lock_init(&htab->buckets[i].lock);
lockdep_set_class(&htab->buckets[i].lock,
&htab->lockdep_key);
}
cond_resched();
}
}
| 0
|
505,760
|
int ssl3_renegotiate(SSL *s)
{
if (s->handshake_func == NULL)
return(1);
if (s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)
return(0);
s->s3->renegotiate=1;
return(1);
}
| 0
|
275,737
|
DownloadInterruptReason DownloadItemImpl::GetLastReason() const {
return last_reason_;
}
| 0
|
113,449
|
sctp_disposition_t sctp_sf_cookie_echoed_prm_abort(
struct net *net,
const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
/* There is a single T1 timer, so we should be able to use
* common function with the COOKIE-WAIT state.
*/
return sctp_sf_cookie_wait_prm_abort(net, ep, asoc, type, arg, commands);
}
| 0
|
202,769
|
zstatus(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
switch (r_type(op)) {
case t_file:
{
stream *s;
make_bool(op, (file_is_valid(s, op) ? 1 : 0));
}
return 0;
case t_string:
{
gs_parsed_file_name_t pname;
struct stat fstat;
int code = parse_file_name(op, &pname,
i_ctx_p->LockFilePermissions, imemory);
if (code < 0) {
if (code == gs_error_undefinedfilename) {
make_bool(op, 0);
code = 0;
}
return code;
}
code = gs_terminate_file_name(&pname, imemory, "status");
if (code < 0)
return code;
code = gs_terminate_file_name(&pname, imemory, "status");
if (code < 0)
return code;
if ((code = check_file_permissions(i_ctx_p, pname.fname, pname.len,
"PermitFileReading")) >= 0) {
code = (*pname.iodev->procs.file_status)(pname.iodev,
pname.fname, &fstat);
}
switch (code) {
case 0:
check_ostack(4);
make_int(op - 4, stat_blocks(&fstat));
make_int(op - 3, fstat.st_size);
/*
* We can't check the value simply by using ==,
* because signed/unsigned == does the wrong thing.
* Instead, since integer assignment only keeps the
* bottom bits, we convert the values to double
* and then test for equality. This handles all
* cases of signed/unsigned or width mismatch.
*/
if ((double)op[-4].value.intval !=
(double)stat_blocks(&fstat) ||
(double)op[-3].value.intval !=
(double)fstat.st_size
)
return_error(gs_error_limitcheck);
make_int(op - 2, fstat.st_mtime);
make_int(op - 1, fstat.st_ctime);
make_bool(op, 1);
break;
case gs_error_undefinedfilename:
make_bool(op, 0);
code = 0;
}
gs_free_file_name(&pname, "status");
return code;
}
default:
return_op_typecheck(op);
}
}
| 0
|
494,051
|
static bool ParseExtensionsProperty(ExtensionMap *ret, std::string *err,
const json &o) {
(void)err;
json_const_iterator it;
if (!FindMember(o, "extensions", it)) {
return false;
}
auto &obj = GetValue(it);
if (!IsObject(obj)) {
return false;
}
ExtensionMap extensions;
json_const_iterator extIt = ObjectBegin(obj); // it.value().begin();
json_const_iterator extEnd = ObjectEnd(obj);
for (; extIt != extEnd; ++extIt) {
auto &itObj = GetValue(extIt);
if (!IsObject(itObj)) continue;
std::string key(GetKey(extIt));
if (!ParseJsonAsValue(&extensions[key], itObj)) {
if (!key.empty()) {
// create empty object so that an extension object is still of type
// object
extensions[key] = Value{Value::Object{}};
}
}
}
if (ret) {
(*ret) = std::move(extensions);
}
return true;
}
| 0
|
193,519
|
double timeDelta(base::TimeTicks time,
base::TimeTicks start,
double invalid_value = -1) {
return time.is_null() ? invalid_value : (time - start).InMillisecondsF();
}
| 0
|
21,922
|
gcry_sexp_t gcry_sexp_nth ( const gcry_sexp_t list , int number ) {
const byte * p ;
DATALEN n ;
gcry_sexp_t newlist ;
byte * d ;
int level = 0 ;
if ( ! list || list -> d [ 0 ] != ST_OPEN ) return NULL ;
p = list -> d ;
while ( number > 0 ) {
p ++ ;
if ( * p == ST_DATA ) {
memcpy ( & n , ++ p , sizeof n ) ;
p += sizeof n + n ;
p -- ;
if ( ! level ) number -- ;
}
else if ( * p == ST_OPEN ) {
level ++ ;
}
else if ( * p == ST_CLOSE ) {
level -- ;
if ( ! level ) number -- ;
}
else if ( * p == ST_STOP ) {
return NULL ;
}
}
p ++ ;
if ( * p == ST_DATA ) {
memcpy ( & n , p , sizeof n ) ;
p += sizeof n ;
newlist = gcry_malloc ( sizeof * newlist + n + 1 ) ;
if ( ! newlist ) return NULL ;
d = newlist -> d ;
memcpy ( d , p , n ) ;
d += n ;
* d ++ = ST_STOP ;
}
else if ( * p == ST_OPEN ) {
const byte * head = p ;
level = 1 ;
do {
p ++ ;
if ( * p == ST_DATA ) {
memcpy ( & n , ++ p , sizeof n ) ;
p += sizeof n + n ;
p -- ;
}
else if ( * p == ST_OPEN ) {
level ++ ;
}
else if ( * p == ST_CLOSE ) {
level -- ;
}
else if ( * p == ST_STOP ) {
BUG ( ) ;
}
}
while ( level ) ;
n = p + 1 - head ;
newlist = gcry_malloc ( sizeof * newlist + n ) ;
if ( ! newlist ) return NULL ;
d = newlist -> d ;
memcpy ( d , head , n ) ;
d += n ;
* d ++ = ST_STOP ;
}
else newlist = NULL ;
return normalize ( newlist ) ;
}
| 0
|
141,543
|
static int matroska_parse_frame(MatroskaDemuxContext *matroska,
MatroskaTrack *track, AVStream *st,
uint8_t *data, int pkt_size,
uint64_t timecode, uint64_t duration,
int64_t pos, int is_keyframe)
{
MatroskaTrackEncoding *encodings = track->encodings.elem;
uint8_t *pkt_data = data;
int offset = 0, res;
AVPacket *pkt;
if (encodings && encodings->scope & 1) {
res = matroska_decode_buffer(&pkt_data, &pkt_size, track);
if (res < 0)
return res;
}
if (st->codec->codec_id == AV_CODEC_ID_WAVPACK) {
uint8_t *wv_data;
res = matroska_parse_wavpack(track, pkt_data, &wv_data, &pkt_size);
if (res < 0) {
av_log(matroska->ctx, AV_LOG_ERROR,
"Error parsing a wavpack block.\n");
goto fail;
}
if (pkt_data != data)
pkt_data = wv_data;
}
if (st->codec->codec_id == AV_CODEC_ID_PRORES)
offset = 8;
pkt = av_mallocz(sizeof(AVPacket));
/* XXX: prevent data copy... */
if (av_new_packet(pkt, pkt_size + offset) < 0) {
av_free(pkt);
return AVERROR(ENOMEM);
}
if (st->codec->codec_id == AV_CODEC_ID_PRORES) {
uint8_t *buf = pkt->data;
bytestream_put_be32(&buf, pkt_size);
bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f'));
}
memcpy(pkt->data + offset, pkt_data, pkt_size);
if (pkt_data != data)
av_free(pkt_data);
pkt->flags = is_keyframe;
pkt->stream_index = st->index;
if (track->ms_compat)
pkt->dts = timecode;
else
pkt->pts = timecode;
pkt->pos = pos;
if (st->codec->codec_id == AV_CODEC_ID_TEXT)
pkt->convergence_duration = duration;
else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE)
pkt->duration = duration;
if (st->codec->codec_id == AV_CODEC_ID_SSA)
matroska_fix_ass_packet(matroska, pkt, duration);
if (matroska->prev_pkt &&
timecode != AV_NOPTS_VALUE &&
matroska->prev_pkt->pts == timecode &&
matroska->prev_pkt->stream_index == st->index &&
st->codec->codec_id == AV_CODEC_ID_SSA)
matroska_merge_packets(matroska->prev_pkt, pkt);
else {
dynarray_add(&matroska->packets, &matroska->num_packets, pkt);
matroska->prev_pkt = pkt;
}
return 0;
fail:
if (pkt_data != data)
return res;
}
| 1
|
117,377
|
ALWAYS_INLINE Variant preg_return_no_error(Variant&& return_value) {
*rl_last_error_code = PHP_PCRE_NO_ERROR;
return std::move(return_value);
}
| 0
|
187,785
|
SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
SafeBrowsingUIManager* ui_manager,
WebContents* web_contents,
const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) {
if (unsafe_resources.size() == 1 &&
(unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE ||
unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_PHISHING)) {
return new SafeBrowsingBlockingPageV2(ui_manager, web_contents,
unsafe_resources);
}
return new SafeBrowsingBlockingPageV1(ui_manager, web_contents,
unsafe_resources);
}
| 0
|
171,391
|
BluetoothSocketUpdateFunction::BluetoothSocketUpdateFunction() {}
| 0
|
61,726
|
term_push_title(int which)
{
if ((which & SAVE_RESTORE_TITLE) && T_CST != NULL && *T_CST != NUL)
{
OUT_STR(T_CST);
out_flush();
}
if ((which & SAVE_RESTORE_ICON) && T_SSI != NULL && *T_SSI != NUL)
{
OUT_STR(T_SSI);
out_flush();
}
}
| 0
|
344,577
|
cmsBool OptimizeByResampling(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUInt32Number* InputFormat, cmsUInt32Number* OutputFormat, cmsUInt32Number* dwFlags)
{
cmsPipeline* Src;
cmsPipeline* Dest;
cmsStage* mpe;
cmsStage* CLUT;
cmsStage *KeepPreLin = NULL, *KeepPostLin = NULL;
int nGridPoints;
cmsColorSpaceSignature ColorSpace, OutputColorSpace;
cmsStage *NewPreLin = NULL;
cmsStage *NewPostLin = NULL;
_cmsStageCLutData* DataCLUT;
cmsToneCurve** DataSetIn;
cmsToneCurve** DataSetOut;
Prelin16Data* p16;
// This is a loosy optimization! does not apply in floating-point cases
if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) return FALSE;
ColorSpace = _cmsICCcolorSpace(T_COLORSPACE(*InputFormat));
OutputColorSpace = _cmsICCcolorSpace(T_COLORSPACE(*OutputFormat));
nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags);
// For empty LUTs, 2 points are enough
if (cmsPipelineStageCount(*Lut) == 0)
nGridPoints = 2;
Src = *Lut;
// Named color pipelines cannot be optimized either
for (mpe = cmsPipelineGetPtrToFirstStage(Src);
mpe != NULL;
mpe = cmsStageNext(mpe)) {
if (cmsStageType(mpe) == cmsSigNamedColorElemType) return FALSE;
}
// Allocate an empty LUT
Dest = cmsPipelineAlloc(Src ->ContextID, Src ->InputChannels, Src ->OutputChannels);
if (!Dest) return FALSE;
// Prelinearization tables are kept unless indicated by flags
if (*dwFlags & cmsFLAGS_CLUT_PRE_LINEARIZATION) {
// Get a pointer to the prelinearization element
cmsStage* PreLin = cmsPipelineGetPtrToFirstStage(Src);
// Check if suitable
if (PreLin ->Type == cmsSigCurveSetElemType) {
// Maybe this is a linear tram, so we can avoid the whole stuff
if (!AllCurvesAreLinear(PreLin)) {
// All seems ok, proceed.
NewPreLin = cmsStageDup(PreLin);
cmsPipelineInsertStage(Dest, cmsAT_BEGIN, NewPreLin);
// Remove prelinearization. Since we have duplicated the curve
// in destination LUT, the sampling shoud be applied after this stage.
cmsPipelineUnlinkStage(Src, cmsAT_BEGIN, &KeepPreLin);
}
}
}
// Allocate the CLUT
CLUT = cmsStageAllocCLut16bit(Src ->ContextID, nGridPoints, Src ->InputChannels, Src->OutputChannels, NULL);
if (CLUT == NULL) return FALSE;
// Add the CLUT to the destination LUT
cmsPipelineInsertStage(Dest, cmsAT_END, CLUT);
// Postlinearization tables are kept unless indicated by flags
if (*dwFlags & cmsFLAGS_CLUT_POST_LINEARIZATION) {
// Get a pointer to the postlinearization if present
cmsStage* PostLin = cmsPipelineGetPtrToLastStage(Src);
// Check if suitable
if (cmsStageType(PostLin) == cmsSigCurveSetElemType) {
// Maybe this is a linear tram, so we can avoid the whole stuff
if (!AllCurvesAreLinear(PostLin)) {
// All seems ok, proceed.
NewPostLin = cmsStageDup(PostLin);
cmsPipelineInsertStage(Dest, cmsAT_END, NewPostLin);
// In destination LUT, the sampling shoud be applied after this stage.
cmsPipelineUnlinkStage(Src, cmsAT_END, &KeepPostLin);
}
}
}
// Now its time to do the sampling. We have to ignore pre/post linearization
// The source LUT whithout pre/post curves is passed as parameter.
if (!cmsStageSampleCLut16bit(CLUT, XFormSampler16, (void*) Src, 0)) {
// Ops, something went wrong, Restore stages
if (KeepPreLin != NULL) cmsPipelineInsertStage(Src, cmsAT_BEGIN, KeepPreLin);
if (KeepPostLin != NULL) cmsPipelineInsertStage(Src, cmsAT_END, KeepPostLin);
cmsPipelineFree(Dest);
return FALSE;
}
// Done.
if (KeepPreLin != NULL) cmsStageFree(KeepPreLin);
if (KeepPostLin != NULL) cmsStageFree(KeepPostLin);
cmsPipelineFree(Src);
DataCLUT = (_cmsStageCLutData*) CLUT ->Data;
if (NewPreLin == NULL) DataSetIn = NULL;
else DataSetIn = ((_cmsStageToneCurvesData*) NewPreLin ->Data) ->TheCurves;
if (NewPostLin == NULL) DataSetOut = NULL;
else DataSetOut = ((_cmsStageToneCurvesData*) NewPostLin ->Data) ->TheCurves;
if (DataSetIn == NULL && DataSetOut == NULL) {
_cmsPipelineSetOptimizationParameters(Dest, (_cmsOPTeval16Fn) DataCLUT->Params->Interpolation.Lerp16, DataCLUT->Params, NULL, NULL);
}
else {
p16 = PrelinOpt16alloc(Dest ->ContextID,
DataCLUT ->Params,
Dest ->InputChannels,
DataSetIn,
Dest ->OutputChannels,
DataSetOut);
_cmsPipelineSetOptimizationParameters(Dest, PrelinEval16, (void*) p16, PrelinOpt16free, Prelin16dup);
}
// Don't fix white on absolute colorimetric
if (Intent == INTENT_ABSOLUTE_COLORIMETRIC)
*dwFlags |= cmsFLAGS_NOWHITEONWHITEFIXUP;
if (!(*dwFlags & cmsFLAGS_NOWHITEONWHITEFIXUP)) {
FixWhiteMisalignment(Dest, ColorSpace, OutputColorSpace);
}
*Lut = Dest;
return TRUE;
cmsUNUSED_PARAMETER(Intent);
}
| 1
|
16,914
|
static int dissect_h245_IndR_multiplex ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_IndR_multiplex , IndR_multiplex_choice , NULL ) ;
return offset ;
}
| 0
|
239,705
|
void ServiceWorkerContextCore::AddProviderHost(
std::unique_ptr<ServiceWorkerProviderHost> host) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
int provider_id = host->provider_id();
providers_->emplace(provider_id, std::move(host));
}
| 0
|
138,297
|
void btrfs_dev_stat_inc_and_print(struct btrfs_device *dev, int index)
{
btrfs_dev_stat_inc(dev, index);
btrfs_dev_stat_print_on_error(dev);
}
| 0
|
224,951
|
param_cmp(const X509_VERIFY_PARAM * const *a,
const X509_VERIFY_PARAM * const *b)
{
return strcmp((*a)->name, (*b)->name);
}
| 0
|
30,217
|
static void ImportBlackQuantum ( const Image * image , QuantumInfo * quantum_info , const MagickSizeType number_pixels , const unsigned char * magick_restrict p , Quantum * magick_restrict q , ExceptionInfo * exception ) {
QuantumAny range ;
register ssize_t x ;
unsigned int pixel ;
if ( image -> colorspace != CMYKColorspace ) {
( void ) ThrowMagickException ( exception , GetMagickModule ( ) , ImageError , "ColorSeparatedImageRequired" , "`%s'" , image -> filename ) ;
return ;
}
switch ( quantum_info -> depth ) {
case 8 : {
unsigned char pixel ;
for ( x = 0 ;
x < ( ssize_t ) number_pixels ;
x ++ ) {
p = PushCharPixel ( p , & pixel ) ;
SetPixelBlack ( image , ScaleCharToQuantum ( pixel ) , q ) ;
p += quantum_info -> pad ;
q += GetPixelChannels ( image ) ;
}
break ;
}
case 16 : {
unsigned short pixel ;
if ( quantum_info -> format == FloatingPointQuantumFormat ) {
for ( x = 0 ;
x < ( ssize_t ) number_pixels ;
x ++ ) {
p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ;
SetPixelBlack ( image , ClampToQuantum ( QuantumRange * HalfToSinglePrecision ( pixel ) ) , q ) ;
p += quantum_info -> pad ;
q += GetPixelChannels ( image ) ;
}
break ;
}
for ( x = 0 ;
x < ( ssize_t ) number_pixels ;
x ++ ) {
p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ;
SetPixelBlack ( image , ScaleShortToQuantum ( pixel ) , q ) ;
p += quantum_info -> pad ;
q += GetPixelChannels ( image ) ;
}
break ;
}
case 32 : {
unsigned int pixel ;
if ( quantum_info -> format == FloatingPointQuantumFormat ) {
float pixel ;
for ( x = 0 ;
x < ( ssize_t ) number_pixels ;
x ++ ) {
p = PushFloatPixel ( quantum_info , p , & pixel ) ;
SetPixelBlack ( image , ClampToQuantum ( pixel ) , q ) ;
p += quantum_info -> pad ;
q += GetPixelChannels ( image ) ;
}
break ;
}
for ( x = 0 ;
x < ( ssize_t ) number_pixels ;
x ++ ) {
p = PushLongPixel ( quantum_info -> endian , p , & pixel ) ;
SetPixelBlack ( image , ScaleLongToQuantum ( pixel ) , q ) ;
p += quantum_info -> pad ;
q += GetPixelChannels ( image ) ;
}
break ;
}
case 64 : {
if ( quantum_info -> format == FloatingPointQuantumFormat ) {
double pixel ;
for ( x = 0 ;
x < ( ssize_t ) number_pixels ;
x ++ ) {
p = PushDoublePixel ( quantum_info , p , & pixel ) ;
SetPixelBlack ( image , ClampToQuantum ( pixel ) , q ) ;
p += quantum_info -> pad ;
q += GetPixelChannels ( image ) ;
}
break ;
}
}
default : {
range = GetQuantumRange ( quantum_info -> depth ) ;
for ( x = 0 ;
x < ( ssize_t ) number_pixels ;
x ++ ) {
p = PushQuantumPixel ( quantum_info , p , & pixel ) ;
SetPixelBlack ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ;
p += quantum_info -> pad ;
q += GetPixelChannels ( image ) ;
}
break ;
}
}
}
| 0
|
220,113
|
WebContents* WebContents::FromRenderFrameHost(RenderFrameHost* rfh) {
RenderFrameHostImpl* rfh_impl = static_cast<RenderFrameHostImpl*>(rfh);
if (!rfh_impl)
return NULL;
return rfh_impl->delegate()->GetAsWebContents();
}
| 0
|
432,842
|
backend_can_extents (struct backend *b, struct connection *conn)
{
struct b_conn_handle *h = &conn->handles[b->i];
debug ("%s: can_extents", b->name);
if (h->can_extents == -1)
h->can_extents = b->can_extents (b, conn);
return h->can_extents;
}
| 0
|
74,024
|
void HTTPSession::onSessionParseError(const HTTPException& error) {
VLOG(4) << *this << " session layer parse error. Terminate the session.";
if (error.hasCodecStatusCode()) {
std::unique_ptr<folly::IOBuf> errorMsg =
folly::IOBuf::copyBuffer(error.what());
codec_->generateGoaway(writeBuf_,
codec_->getLastIncomingStreamID(),
error.getCodecStatusCode(),
isHTTP2CodecProtocol(codec_->getProtocol()) ?
std::move(errorMsg) : nullptr);
scheduleWrite();
}
setCloseReason(ConnectionCloseReason::SESSION_PARSE_ERROR);
shutdownTransport(true, true);
}
| 0
|
250,251
|
int HttpProxyClientSocket::DoDrainBody() {
DCHECK(drain_buf_.get());
DCHECK(transport_->is_initialized());
next_state_ = STATE_DRAIN_BODY_COMPLETE;
return http_stream_parser_->ReadResponseBody(
drain_buf_.get(), kDrainBodyBufferSize, io_callback_);
}
| 0
|
134,219
|
static int newlabelentry (LexState *ls, Labellist *l, TString *name,
int line, int pc) {
int n = l->n;
luaM_growvector(ls->L, l->arr, n, l->size,
Labeldesc, SHRT_MAX, "labels/gotos");
l->arr[n].name = name;
l->arr[n].line = line;
l->arr[n].nactvar = ls->fs->nactvar;
l->arr[n].close = 0;
l->arr[n].pc = pc;
l->n = n + 1;
return n;
}
| 0
|
419,260
|
winlink_cmp(struct winlink *wl1, struct winlink *wl2)
{
return (wl1->idx - wl2->idx);
}
| 0
|
98,064
|
int key_link(struct key *keyring, struct key *key)
{
struct assoc_array_edit *edit;
int ret;
kenter("{%d,%d}", keyring->serial, refcount_read(&keyring->usage));
key_check(keyring);
key_check(key);
ret = __key_link_begin(keyring, &key->index_key, &edit);
if (ret == 0) {
kdebug("begun {%d,%d}", keyring->serial, refcount_read(&keyring->usage));
ret = __key_link_check_restriction(keyring, key);
if (ret == 0)
ret = __key_link_check_live_key(keyring, key);
if (ret == 0)
__key_link(key, &edit);
__key_link_end(keyring, &key->index_key, edit);
}
kleave(" = %d {%d,%d}", ret, keyring->serial, refcount_read(&keyring->usage));
return ret;
}
| 0
|
435,634
|
static u32 ql_get_speed(struct ql3_adapter *qdev)
{
u32 status;
unsigned long hw_flags;
spin_lock_irqsave(&qdev->hw_lock, hw_flags);
if (ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK,
(QL_RESOURCE_BITS_BASE_CODE |
(qdev->mac_index) * 2) << 7)) {
spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
return 0;
}
status = ql_get_link_speed(qdev);
ql_sem_unlock(qdev, QL_PHY_GIO_SEM_MASK);
spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
return status;
| 0
|
381,419
|
cmd_readkey (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
int rc;
unsigned char *cert = NULL;
size_t ncert, n;
ksba_cert_t kc = NULL;
ksba_sexp_t p;
unsigned char *pk;
size_t pklen;
if ((rc = open_card (ctrl, NULL)))
return rc;
line = xstrdup (line); /* Need a copy of the line. */
/* If the application supports the READKEY function we use that.
Otherwise we use the old way by extracting it from the
certificate. */
rc = app_readkey (ctrl->app_ctx, line, &pk, &pklen);
if (!rc)
{ /* Yeah, got that key - send it back. */
rc = assuan_send_data (ctx, pk, pklen);
xfree (pk);
xfree (line);
line = NULL;
goto leave;
}
if (gpg_err_code (rc) != GPG_ERR_UNSUPPORTED_OPERATION)
log_error ("app_readkey failed: %s\n", gpg_strerror (rc));
else
{
rc = app_readcert (ctrl->app_ctx, line, &cert, &ncert);
if (rc)
log_error ("app_readcert failed: %s\n", gpg_strerror (rc));
}
xfree (line);
line = NULL;
if (rc)
goto leave;
rc = ksba_cert_new (&kc);
if (rc)
goto leave;
rc = ksba_cert_init_from_mem (kc, cert, ncert);
if (rc)
{
log_error ("failed to parse the certificate: %s\n", gpg_strerror (rc));
goto leave;
}
p = ksba_cert_get_public_key (kc);
if (!p)
{
rc = gpg_error (GPG_ERR_NO_PUBKEY);
goto leave;
}
n = gcry_sexp_canon_len (p, 0, NULL, NULL);
rc = assuan_send_data (ctx, p, n);
xfree (p);
leave:
ksba_cert_release (kc);
xfree (cert);
TEST_CARD_REMOVAL (ctrl, rc);
return rc;
}
| 0
|
405,402
|
bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
int classzone_idx, unsigned int alloc_flags,
long free_pages)
{
long min = mark;
int o;
const bool alloc_harder = (alloc_flags & (ALLOC_HARDER|ALLOC_OOM));
/* free_pages may go negative - that's OK */
free_pages -= (1 << order) - 1;
if (alloc_flags & ALLOC_HIGH)
min -= min / 2;
/*
* If the caller does not have rights to ALLOC_HARDER then subtract
* the high-atomic reserves. This will over-estimate the size of the
* atomic reserve but it avoids a search.
*/
if (likely(!alloc_harder)) {
free_pages -= z->nr_reserved_highatomic;
} else {
/*
* OOM victims can try even harder than normal ALLOC_HARDER
* users on the grounds that it's definitely going to be in
* the exit path shortly and free memory. Any allocation it
* makes during the free path will be small and short-lived.
*/
if (alloc_flags & ALLOC_OOM)
min -= min / 2;
else
min -= min / 4;
}
#ifdef CONFIG_CMA
/* If allocation can't use CMA areas don't use free CMA pages */
if (!(alloc_flags & ALLOC_CMA))
free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES);
#endif
/*
* Check watermarks for an order-0 allocation request. If these
* are not met, then a high-order request also cannot go ahead
* even if a suitable page happened to be free.
*/
if (free_pages <= min + z->lowmem_reserve[classzone_idx])
return false;
/* If this is an order-0 request then the watermark is fine */
if (!order)
return true;
/* For a high-order request, check at least one suitable page is free */
for (o = order; o < MAX_ORDER; o++) {
struct free_area *area = &z->free_area[o];
int mt;
if (!area->nr_free)
continue;
for (mt = 0; mt < MIGRATE_PCPTYPES; mt++) {
if (!list_empty(&area->free_list[mt]))
return true;
}
#ifdef CONFIG_CMA
if ((alloc_flags & ALLOC_CMA) &&
!list_empty(&area->free_list[MIGRATE_CMA])) {
return true;
}
#endif
if (alloc_harder &&
!list_empty(&area->free_list[MIGRATE_HIGHATOMIC]))
return true;
}
return false;
}
| 0
|
184,049
|
void GLES2DecoderImpl::DoBlitFramebufferCHROMIUM(
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter) {
const char* func_name = "glBlitFramebufferCHROMIUM";
DCHECK(!ShouldDeferReads() && !ShouldDeferDraws());
if (!CheckFramebufferValid(GetBoundDrawFramebuffer(),
GetDrawFramebufferTarget(),
GL_INVALID_FRAMEBUFFER_OPERATION, func_name)) {
return;
}
gfx::Size draw_size = GetBoundDrawFramebufferSize();
if (!CheckFramebufferValid(GetBoundReadFramebuffer(),
GetReadFramebufferTarget(),
GL_INVALID_FRAMEBUFFER_OPERATION, func_name)) {
return;
}
if (GetBoundFramebufferSamples(GL_DRAW_FRAMEBUFFER) > 0) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"destination framebuffer is multisampled");
return;
}
GLsizei read_buffer_samples = GetBoundFramebufferSamples(GL_READ_FRAMEBUFFER);
if (read_buffer_samples > 0 &&
(srcX0 != dstX0 || srcY0 != dstY0 || srcX1 != dstX1 || srcY1 != dstY1)) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"src framebuffer is multisampled, but src/dst regions are different");
return;
}
GLbitfield mask_blit = mask;
bool read_framebuffer_miss_image = false;
enum FeedbackLoopState {
FeedbackLoopTrue,
FeedbackLoopFalse,
FeedbackLoopUnknown
};
FeedbackLoopState is_feedback_loop = FeedbackLoopUnknown;
Framebuffer* read_framebuffer =
framebuffer_state_.bound_read_framebuffer.get();
Framebuffer* draw_framebuffer =
framebuffer_state_.bound_draw_framebuffer.get();
if (!read_framebuffer && !draw_framebuffer) {
is_feedback_loop = FeedbackLoopTrue;
} else if (!read_framebuffer || !draw_framebuffer) {
is_feedback_loop = FeedbackLoopFalse;
if (read_framebuffer) {
if (((mask & GL_COLOR_BUFFER_BIT) != 0 &&
!GetBoundReadFramebufferInternalFormat()) ||
((mask & GL_DEPTH_BUFFER_BIT) != 0 &&
!read_framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT) &&
BoundFramebufferHasDepthAttachment()) ||
((mask & GL_STENCIL_BUFFER_BIT) != 0 &&
!read_framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT) &&
BoundFramebufferHasStencilAttachment())) {
read_framebuffer_miss_image = true;
}
}
} else {
DCHECK(read_framebuffer && draw_framebuffer);
if ((mask & GL_DEPTH_BUFFER_BIT) != 0) {
const Framebuffer::Attachment* depth_buffer_read =
read_framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT);
const Framebuffer::Attachment* depth_buffer_draw =
draw_framebuffer->GetAttachment(GL_DEPTH_ATTACHMENT);
if (!depth_buffer_draw || !depth_buffer_read) {
mask_blit &= ~GL_DEPTH_BUFFER_BIT;
if (depth_buffer_draw) {
read_framebuffer_miss_image = true;
}
} else if (depth_buffer_draw->IsSameAttachment(depth_buffer_read)) {
is_feedback_loop = FeedbackLoopTrue;
}
}
if ((mask & GL_STENCIL_BUFFER_BIT) != 0) {
const Framebuffer::Attachment* stencil_buffer_read =
read_framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT);
const Framebuffer::Attachment* stencil_buffer_draw =
draw_framebuffer->GetAttachment(GL_STENCIL_ATTACHMENT);
if (!stencil_buffer_draw || !stencil_buffer_read) {
mask_blit &= ~GL_STENCIL_BUFFER_BIT;
if (stencil_buffer_draw) {
read_framebuffer_miss_image = true;
}
} else if (stencil_buffer_draw->IsSameAttachment(stencil_buffer_read)) {
is_feedback_loop = FeedbackLoopTrue;
}
}
}
GLenum src_internal_format = GetBoundReadFramebufferInternalFormat();
GLenum src_type = GetBoundReadFramebufferTextureType();
bool read_buffer_has_srgb = GLES2Util::GetColorEncodingFromInternalFormat(
src_internal_format) == GL_SRGB;
bool draw_buffers_has_srgb = false;
if ((mask & GL_COLOR_BUFFER_BIT) != 0) {
bool is_src_signed_int =
GLES2Util::IsSignedIntegerFormat(src_internal_format);
bool is_src_unsigned_int =
GLES2Util::IsUnsignedIntegerFormat(src_internal_format);
DCHECK(!is_src_signed_int || !is_src_unsigned_int);
if ((is_src_signed_int || is_src_unsigned_int) && filter == GL_LINEAR) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"invalid filter for integer format");
return;
}
GLenum src_sized_format =
GLES2Util::ConvertToSizedFormat(src_internal_format, src_type);
DCHECK(read_framebuffer || (is_feedback_loop != FeedbackLoopUnknown));
const Framebuffer::Attachment* read_buffer =
is_feedback_loop == FeedbackLoopUnknown ?
read_framebuffer->GetReadBufferAttachment() : nullptr;
bool draw_buffer_has_image = false;
for (uint32_t ii = 0; ii < group_->max_draw_buffers(); ++ii) {
GLenum dst_format = GetBoundColorDrawBufferInternalFormat(
static_cast<GLint>(ii));
GLenum dst_type = GetBoundColorDrawBufferType(static_cast<GLint>(ii));
if (dst_format == 0)
continue;
draw_buffer_has_image = true;
if (!src_internal_format) {
read_framebuffer_miss_image = true;
}
if (GLES2Util::GetColorEncodingFromInternalFormat(dst_format) == GL_SRGB)
draw_buffers_has_srgb = true;
if (read_buffer_samples > 0 &&
(src_sized_format !=
GLES2Util::ConvertToSizedFormat(dst_format, dst_type))) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"src and dst formats differ for color");
return;
}
bool is_dst_signed_int = GLES2Util::IsSignedIntegerFormat(dst_format);
bool is_dst_unsigned_int = GLES2Util::IsUnsignedIntegerFormat(dst_format);
DCHECK(!is_dst_signed_int || !is_dst_unsigned_int);
if (is_src_signed_int != is_dst_signed_int ||
is_src_unsigned_int != is_dst_unsigned_int) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"incompatible src/dst color formats");
return;
}
if (is_feedback_loop == FeedbackLoopUnknown) {
GLenum attachment = static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + ii);
DCHECK(draw_framebuffer);
const Framebuffer::Attachment* draw_buffer =
draw_framebuffer->GetAttachment(attachment);
if (!draw_buffer || !read_buffer) {
continue;
}
if (draw_buffer->IsSameAttachment(read_buffer)) {
is_feedback_loop = FeedbackLoopTrue;
break;
}
}
}
if (draw_framebuffer && !draw_buffer_has_image)
mask_blit &= ~GL_COLOR_BUFFER_BIT;
}
if (is_feedback_loop == FeedbackLoopTrue) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"source buffer and destination buffers are identical");
return;
}
if (read_framebuffer_miss_image == true) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"The designated attachment point(s) in read framebuffer miss image");
return;
}
if ((mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0) {
if (filter != GL_NEAREST) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"invalid filter for depth/stencil");
return;
}
}
mask = mask_blit;
if (!mask)
return;
if (((mask & GL_DEPTH_BUFFER_BIT) != 0 &&
(GetBoundFramebufferDepthFormat(GL_READ_FRAMEBUFFER) !=
GetBoundFramebufferDepthFormat(GL_DRAW_FRAMEBUFFER))) ||
((mask & GL_STENCIL_BUFFER_BIT) != 0 &&
((GetBoundFramebufferStencilFormat(GL_READ_FRAMEBUFFER) !=
GetBoundFramebufferStencilFormat(GL_DRAW_FRAMEBUFFER))))) {
LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
"src and dst formats differ for depth/stencil");
return;
}
base::CheckedNumeric<GLint> src_width_temp = srcX1;
src_width_temp -= srcX0;
base::CheckedNumeric<GLint> src_height_temp = srcY1;
src_height_temp -= srcY0;
base::CheckedNumeric<GLint> dst_width_temp = dstX1;
dst_width_temp -= dstX0;
base::CheckedNumeric<GLint> dst_height_temp = dstY1;
dst_height_temp -= dstY0;
if (!src_width_temp.Abs().IsValid() || !src_height_temp.Abs().IsValid() ||
!dst_width_temp.Abs().IsValid() || !dst_height_temp.Abs().IsValid()) {
LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name,
"the width or height of src or dst region overflowed");
return;
}
if (workarounds().adjust_src_dst_region_for_blitframebuffer) {
gfx::Size read_size = GetBoundReadFramebufferSize();
GLint src_x = srcX1 > srcX0 ? srcX0 : srcX1;
GLint src_y = srcY1 > srcY0 ? srcY0 : srcY1;
unsigned int src_width = base::checked_cast<unsigned int>(
src_width_temp.Abs().ValueOrDefault(0));
unsigned int src_height = base::checked_cast<unsigned int>(
src_height_temp.Abs().ValueOrDefault(0));
GLint dst_x = dstX1 > dstX0 ? dstX0 : dstX1;
GLint dst_y = dstY1 > dstY0 ? dstY0 : dstY1;
unsigned int dst_width = base::checked_cast<unsigned int>(
dst_width_temp.Abs().ValueOrDefault(0));
unsigned int dst_height = base::checked_cast<unsigned int>(
dst_height_temp.Abs().ValueOrDefault(0));
if (dst_width == 0 || src_width == 0 || dst_height == 0 ||
src_height == 0) {
return;
}
gfx::Rect src_bounds(0, 0, read_size.width(), read_size.height());
gfx::Rect src_region(src_x, src_y, src_width, src_height);
gfx::Rect dst_bounds(0, 0, draw_size.width(), draw_size.height());
gfx::Rect dst_region(dst_x, dst_y, dst_width, dst_height);
if (gfx::IntersectRects(dst_bounds, dst_region).IsEmpty()) {
return;
}
bool x_flipped = ((srcX1 > srcX0) && (dstX1 < dstX0)) ||
((srcX1 < srcX0) && (dstX1 > dstX0));
bool y_flipped = ((srcY1 > srcY0) && (dstY1 < dstY0)) ||
((srcY1 < srcY0) && (dstY1 > dstY0));
if (!dst_bounds.Contains(dst_region)) {
unsigned int dst_x_halvings = 0;
unsigned int dst_y_halvings = 0;
int dst_origin_x = dst_x;
int dst_origin_y = dst_y;
int dst_clipped_width = dst_region.width();
while (dst_clipped_width > 2 * dst_bounds.width()) {
dst_clipped_width = dst_clipped_width >> 1;
dst_x_halvings++;
}
int dst_clipped_height = dst_region.height();
while (dst_clipped_height > 2 * dst_bounds.height()) {
dst_clipped_height = dst_clipped_height >> 1;
dst_y_halvings++;
}
int left = dst_region.x();
int right = dst_region.right();
int top = dst_region.y();
int bottom = dst_region.bottom();
if (left >= 0 && left < dst_bounds.width()) {
dst_origin_x = dst_x;
} else if (right > 0 && right <= dst_bounds.width()) {
dst_origin_x = right - dst_clipped_width;
} else {
dst_origin_x = dst_x;
}
if (top >= 0 && top < dst_bounds.height()) {
dst_origin_y = dst_y;
} else if (bottom > 0 && bottom <= dst_bounds.height()) {
dst_origin_y = bottom - dst_clipped_height;
} else {
dst_origin_y = dst_y;
}
dst_region.SetRect(dst_origin_x, dst_origin_y, dst_clipped_width,
dst_clipped_height);
base::CheckedNumeric<unsigned int> checked_xoffset(dst_region.x() -
dst_x);
base::CheckedNumeric<unsigned int> checked_yoffset(dst_region.y() -
dst_y);
if (x_flipped) {
checked_xoffset = (dst_x + dst_width - dst_region.right());
}
if (y_flipped) {
checked_yoffset = (dst_y + dst_height - dst_region.bottom());
}
unsigned int xoffset, yoffset;
if (!checked_xoffset.AssignIfValid(&xoffset) ||
!checked_yoffset.AssignIfValid(&yoffset)) {
NOTREACHED();
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE, func_name,
"the width or height of src or dst region overflowed");
return;
}
src_region.SetRect(src_x + (xoffset >> dst_x_halvings),
src_y + (yoffset >> dst_y_halvings),
src_region.width() >> dst_x_halvings,
src_region.height() >> dst_y_halvings);
if (src_region.width() == 0) {
src_region.set_width(1);
}
if (src_region.height() == 0) {
src_region.set_height(1);
}
}
if (!src_bounds.Contains(src_region)) {
src_region.Intersect(src_bounds);
GLuint src_real_width = src_region.width();
GLuint src_real_height = src_region.height();
GLuint xoffset = src_region.x() - src_x;
GLuint yoffset = src_region.y() - src_y;
if (x_flipped) {
xoffset = src_x + src_width - src_region.x() - src_region.width();
}
if (y_flipped) {
yoffset = src_y + src_height - src_region.y() - src_region.height();
}
GLfloat dst_mapping_width =
static_cast<GLfloat>(src_real_width) * dst_width / src_width;
GLfloat dst_mapping_height =
static_cast<GLfloat>(src_real_height) * dst_height / src_height;
GLfloat dst_mapping_xoffset =
static_cast<GLfloat>(xoffset) * dst_width / src_width;
GLfloat dst_mapping_yoffset =
static_cast<GLfloat>(yoffset) * dst_height / src_height;
GLuint dst_mapping_x0 =
std::round(dst_x + dst_mapping_xoffset);
GLuint dst_mapping_y0 =
std::round(dst_y + dst_mapping_yoffset);
GLuint dst_mapping_x1 =
std::round(dst_x + dst_mapping_xoffset + dst_mapping_width);
GLuint dst_mapping_y1 =
std::round(dst_y + dst_mapping_yoffset + dst_mapping_height);
dst_region.SetRect(dst_mapping_x0, dst_mapping_y0,
dst_mapping_x1 - dst_mapping_x0,
dst_mapping_y1 - dst_mapping_y0);
}
srcX0 = srcX0 < srcX1 ? src_region.x() : src_region.right();
srcY0 = srcY0 < srcY1 ? src_region.y() : src_region.bottom();
srcX1 = srcX0 < srcX1 ? src_region.right() : src_region.x();
srcY1 = srcY0 < srcY1 ? src_region.bottom() : src_region.y();
dstX0 = dstX0 < dstX1 ? dst_region.x() : dst_region.right();
dstY0 = dstY0 < dstY1 ? dst_region.y() : dst_region.bottom();
dstX1 = dstX0 < dstX1 ? dst_region.right() : dst_region.x();
dstY1 = dstY0 < dstY1 ? dst_region.bottom() : dst_region.y();
}
bool enable_srgb =
(read_buffer_has_srgb || draw_buffers_has_srgb) &&
((mask & GL_COLOR_BUFFER_BIT) != 0);
bool encode_srgb_only =
(draw_buffers_has_srgb && !read_buffer_has_srgb) &&
((mask & GL_COLOR_BUFFER_BIT) != 0);
if (!enable_srgb ||
read_buffer_samples > 0 ||
!feature_info_->feature_flags().desktop_srgb_support ||
gl_version_info().IsAtLeastGL(4, 4) ||
(gl_version_info().IsAtLeastGL(4, 2) && encode_srgb_only)) {
if (enable_srgb && gl_version_info().IsAtLeastGL(4, 2)) {
state_.EnableDisableFramebufferSRGB(enable_srgb);
}
api()->glBlitFramebufferFn(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1,
dstY1, mask, filter);
return;
}
state_.EnableDisableFramebufferSRGB(true);
if (!InitializeSRGBConverter(func_name)) {
return;
}
GLenum src_format =
TextureManager::ExtractFormatFromStorageFormat(src_internal_format);
srgb_converter_->Blit(this, srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter,
GetBoundReadFramebufferSize(),
GetBoundReadFramebufferServiceId(),
src_internal_format, src_format, src_type,
GetBoundDrawFramebufferServiceId(),
read_buffer_has_srgb, draw_buffers_has_srgb,
state_.enable_flags.scissor_test);
}
| 0
|
204,155
|
static void unsignedShortAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
TestObjectV8Internal::unsignedShortAttrAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 0
|
197,532
|
void SyncBackendHost::Core::DoRequestConfig(
syncable::ModelTypeSet types_to_config,
sync_api::ConfigureReason reason) {
DCHECK_EQ(MessageLoop::current(), sync_loop_);
sync_manager_->RequestConfig(types_to_config, reason);
}
| 0
|
466,450
|
TEST_F(ConnectionManagerUtilityTest, ViaEmpty) {
connection_.stream_info_.downstream_address_provider_->setRemoteAddress(
std::make_shared<Network::Address::Ipv4Instance>("10.0.0.1"));
ON_CALL(config_, useRemoteAddress()).WillByDefault(Return(true));
TestRequestHeaderMapImpl request_headers;
EXPECT_EQ((MutateRequestRet{"10.0.0.1:0", true, Tracing::Reason::NotTraceable}),
callMutateRequestHeaders(request_headers, Protocol::Http2));
EXPECT_FALSE(request_headers.has(Headers::get().Via));
TestResponseHeaderMapImpl response_headers;
ConnectionManagerUtility::mutateResponseHeaders(response_headers, &request_headers, config_,
via_);
EXPECT_FALSE(response_headers.has(Headers::get().Via));
}
| 0
|
363,465
|
_gdm_user_show_full_display_name (GdmUser *user)
{
char *uniq_name;
g_return_if_fail (GDM_IS_USER (user));
if (user->real_name != NULL) {
uniq_name = g_strdup_printf ("%s (%s)",
user->real_name,
user->user_name);
} else {
uniq_name = NULL;
}
if ((user->real_name && !user->display_name) ||
(!user->real_name && user->display_name) ||
(user->real_name &&
user->display_name &&
strcmp (uniq_name, user->display_name) != 0)) {
g_free (user->display_name);
user->display_name = uniq_name;
g_object_notify (G_OBJECT (user), "display-name");
} else {
g_free (uniq_name);
}
}
| 0
|
214,389
|
gfx::Size GLES2DecoderImpl::GetBoundReadFramebufferSize() {
Framebuffer* framebuffer = GetBoundReadFramebuffer();
if (framebuffer) {
return framebuffer->GetFramebufferValidSize();
} else if (offscreen_target_frame_buffer_.get()) {
return offscreen_size_;
} else {
return surface_->GetSize();
}
}
| 0
|
29,913
|
static guint16 de_tp_sub_channel ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) {
guint32 curr_offset ;
guchar oct ;
const gchar * str ;
curr_offset = offset ;
oct = tvb_get_guint8 ( tvb , curr_offset ) & 0x3f ;
if ( ( oct & 0x38 ) == 0x38 ) str = "I" ;
else if ( ( oct & 0x38 ) == 0x18 ) str = "F" ;
else if ( ( oct & 0x38 ) == 0x10 ) str = "E" ;
else if ( ( oct & 0x38 ) == 0x08 ) str = "D" ;
else if ( ( oct & 0x3c ) == 0x04 ) str = "C" ;
else if ( ( oct & 0x3e ) == 0x02 ) str = "B" ;
else if ( ( oct & 0x3e ) == 0x00 ) str = "A" ;
else str = "unknown" ;
proto_tree_add_uint_format_value ( tree , hf_gsm_a_dtap_test_loop , tvb , curr_offset , 1 , oct , "%s" , str ) ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_subchannel , tvb , curr_offset , 1 , ENC_NA ) ;
curr_offset += 1 ;
return ( curr_offset - offset ) ;
}
| 0
|
419,877
|
Rename a mailbox */
PHP_FUNCTION(imap_renamemailbox)
{
zval *streamind;
zend_string *old_mailbox, *new_mailbox;
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS", &streamind, &old_mailbox, &new_mailbox) == FAILURE) {
return;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
RETURN_FALSE;
}
if (mail_rename(imap_le_struct->imap_stream, ZSTR_VAL(old_mailbox), ZSTR_VAL(new_mailbox)) == T) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
| 0
|
148,373
|
char *Hub::inflate(char *data, size_t &length) {
dynamicInflationBuffer.clear();
inflationStream.next_in = (Bytef *) data;
inflationStream.avail_in = length;
int err;
do {
inflationStream.next_out = (Bytef *) inflationBuffer;
inflationStream.avail_out = LARGE_BUFFER_SIZE;
err = ::inflate(&inflationStream, Z_FINISH);
if (!inflationStream.avail_in) {
break;
}
dynamicInflationBuffer.append(inflationBuffer, LARGE_BUFFER_SIZE - inflationStream.avail_out);
} while (err == Z_BUF_ERROR && dynamicInflationBuffer.length() <= INFLATE_LESS_THAN_ROUGHLY);
inflateReset(&inflationStream);
if ((err != Z_BUF_ERROR && err != Z_OK) || dynamicInflationBuffer.length() > INFLATE_LESS_THAN_ROUGHLY) {
length = 0;
return nullptr;
}
if (dynamicInflationBuffer.length()) {
dynamicInflationBuffer.append(inflationBuffer, LARGE_BUFFER_SIZE - inflationStream.avail_out);
length = dynamicInflationBuffer.length();
return (char *) dynamicInflationBuffer.data();
}
length = LARGE_BUFFER_SIZE - inflationStream.avail_out;
return inflationBuffer;
}
| 0
|
487,556
|
void WillReleaseScriptContext(v8::Local<v8::Context> context,
int world_id) final {
// Unset spell checker when the script context is going to be released, as
// the spell check implementation lives there.
UnsetAndDestroy();
}
| 0
|
292,700
|
inline void post () {_sem.post();}
| 0
|
152,143
|
const T* data(const unsigned int x, const unsigned int y=0, const unsigned int z=0, const unsigned int c=0) const {
return _data + x + (ulongT)y*_width + (ulongT)z*_width*_height + (ulongT)c*_width*_height*_depth;
| 0
|
39,232
|
SMB2_sess_alloc_buffer(struct SMB2_sess_data *sess_data)
{
int rc;
struct cifs_ses *ses = sess_data->ses;
struct smb2_sess_setup_req *req;
struct TCP_Server_Info *server = ses->server;
rc = small_smb2_init(SMB2_SESSION_SETUP, NULL, (void **) &req);
if (rc)
return rc;
/* First session, not a reauthenticate */
req->hdr.sync_hdr.SessionId = 0;
/* if reconnect, we need to send previous sess id, otherwise it is 0 */
req->PreviousSessionId = sess_data->previous_session;
req->Flags = 0; /* MBZ */
/* to enable echos and oplocks */
req->hdr.sync_hdr.CreditRequest = cpu_to_le16(3);
/* only one of SMB2 signing flags may be set in SMB2 request */
if (server->sign)
req->SecurityMode = SMB2_NEGOTIATE_SIGNING_REQUIRED;
else if (global_secflags & CIFSSEC_MAY_SIGN) /* one flag unlike MUST_ */
req->SecurityMode = SMB2_NEGOTIATE_SIGNING_ENABLED;
else
req->SecurityMode = 0;
req->Capabilities = 0;
req->Channel = 0; /* MBZ */
sess_data->iov[0].iov_base = (char *)req;
/* 4 for rfc1002 length field and 1 for pad */
sess_data->iov[0].iov_len = get_rfc1002_length(req) + 4 - 1;
/*
* This variable will be used to clear the buffer
* allocated above in case of any error in the calling function.
*/
sess_data->buf0_type = CIFS_SMALL_BUFFER;
return 0;
}
| 0
|
35,525
|
static inline const char *FxSubexpression(const char *expression,
ExceptionInfo *exception)
{
const char
*subexpression;
register ssize_t
level;
level=0;
subexpression=expression;
while ((*subexpression != '\0') &&
((level != 1) || (strchr(")",(int) *subexpression) == (char *) NULL)))
{
if (strchr("(",(int) *subexpression) != (char *) NULL)
level++;
else
if (strchr(")",(int) *subexpression) != (char *) NULL)
level--;
subexpression++;
}
if (*subexpression == '\0')
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
"UnbalancedParenthesis","`%s'",expression);
return(subexpression);
}
| 0
|
236,776
|
int svc_rdma_post_recv(struct svcxprt_rdma *xprt, gfp_t flags)
{
struct ib_recv_wr recv_wr, *bad_recv_wr;
struct svc_rdma_op_ctxt *ctxt;
struct page *page;
dma_addr_t pa;
int sge_no;
int buflen;
int ret;
ctxt = svc_rdma_get_context(xprt);
buflen = 0;
ctxt->direction = DMA_FROM_DEVICE;
ctxt->cqe.done = svc_rdma_wc_receive;
for (sge_no = 0; buflen < xprt->sc_max_req_size; sge_no++) {
if (sge_no >= xprt->sc_max_sge) {
pr_err("svcrdma: Too many sges (%d)\n", sge_no);
goto err_put_ctxt;
}
page = alloc_page(flags);
if (!page)
goto err_put_ctxt;
ctxt->pages[sge_no] = page;
pa = ib_dma_map_page(xprt->sc_cm_id->device,
page, 0, PAGE_SIZE,
DMA_FROM_DEVICE);
if (ib_dma_mapping_error(xprt->sc_cm_id->device, pa))
goto err_put_ctxt;
svc_rdma_count_mappings(xprt, ctxt);
ctxt->sge[sge_no].addr = pa;
ctxt->sge[sge_no].length = PAGE_SIZE;
ctxt->sge[sge_no].lkey = xprt->sc_pd->local_dma_lkey;
ctxt->count = sge_no + 1;
buflen += PAGE_SIZE;
}
recv_wr.next = NULL;
recv_wr.sg_list = &ctxt->sge[0];
recv_wr.num_sge = ctxt->count;
recv_wr.wr_cqe = &ctxt->cqe;
svc_xprt_get(&xprt->sc_xprt);
ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr);
if (ret) {
svc_rdma_unmap_dma(ctxt);
svc_rdma_put_context(ctxt, 1);
svc_xprt_put(&xprt->sc_xprt);
}
return ret;
err_put_ctxt:
svc_rdma_unmap_dma(ctxt);
svc_rdma_put_context(ctxt, 1);
return -ENOMEM;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.