idx
int64 | func
string | target
int64 |
|---|---|---|
384,845
|
backslash_halve_save(char_u *p)
{
char_u *res;
res = vim_strsave(p);
if (res == NULL)
return p;
backslash_halve(res);
return res;
}
| 0
|
487,645
|
struct group_info *groups_alloc(int gidsetsize)
{
struct group_info *group_info;
int nblocks;
int i;
nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;
/* Make sure we always allocate at least one indirect block pointer */
nblocks = nblocks ? : 1;
group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);
if (!group_info)
return NULL;
group_info->ngroups = gidsetsize;
group_info->nblocks = nblocks;
atomic_set(&group_info->usage, 1);
if (gidsetsize <= NGROUPS_SMALL)
group_info->blocks[0] = group_info->small_block;
else {
for (i = 0; i < nblocks; i++) {
gid_t *b;
b = (void *)__get_free_page(GFP_USER);
if (!b)
goto out_undo_partial_alloc;
group_info->blocks[i] = b;
}
}
return group_info;
out_undo_partial_alloc:
while (--i >= 0) {
free_page((unsigned long)group_info->blocks[i]);
}
kfree(group_info);
return NULL;
}
| 0
|
90,780
|
void QuotaManager::GetStatistics(
std::map<std::string, std::string>* statistics) {
DCHECK(statistics);
if (temporary_storage_evictor_.get()) {
std::map<std::string, int64> stats;
temporary_storage_evictor_->GetStatistics(&stats);
for (std::map<std::string, int64>::iterator p = stats.begin();
p != stats.end();
++p)
(*statistics)[p->first] = base::Int64ToString(p->second);
}
}
| 0
|
500,054
|
static int kssl_test_confound(unsigned char *p)
{
int len = 2;
int xx = 0, yy = 0;
if (*p++ != 0x62) return 0;
if (*p > 0x82) return 0;
switch(*p) {
case 0x82: p++; xx = (*p++ << 8); xx += *p++; break;
case 0x81: p++; xx = *p++; break;
case 0x80: return 0;
default: xx = *p++; break;
}
if (*p++ != 0x30) return 0;
if (*p > 0x82) return 0;
switch(*p) {
case 0x82: p++; len+=2; yy = (*p++ << 8); yy += *p++; break;
case 0x81: p++; len++; yy = *p++; break;
case 0x80: return 0;
default: yy = *p++; break;
}
return (xx - len == yy)? 1: 0;
}
| 0
|
387,756
|
void InstanceKlass::purge_previous_version_list() {
assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
assert(has_been_redefined(), "Should only be called for main class");
// Quick exit.
if (previous_versions() == NULL) {
return;
}
// This klass has previous versions so see what we can cleanup
// while it is safe to do so.
int deleted_count = 0; // leave debugging breadcrumbs
int live_count = 0;
ClassLoaderData* loader_data = class_loader_data();
assert(loader_data != NULL, "should never be null");
ResourceMark rm;
log_trace(redefine, class, iklass, purge)("%s: previous versions", external_name());
// previous versions are linked together through the InstanceKlass
InstanceKlass* pv_node = previous_versions();
InstanceKlass* last = this;
int version = 0;
// check the previous versions list
for (; pv_node != NULL; ) {
ConstantPool* pvcp = pv_node->constants();
assert(pvcp != NULL, "cp ref was unexpectedly cleared");
if (!pvcp->on_stack()) {
// If the constant pool isn't on stack, none of the methods
// are executing. Unlink this previous_version.
// The previous version InstanceKlass is on the ClassLoaderData deallocate list
// so will be deallocated during the next phase of class unloading.
log_trace(redefine, class, iklass, purge)
("previous version " INTPTR_FORMAT " is dead.", p2i(pv_node));
// For debugging purposes.
pv_node->set_is_scratch_class();
// Unlink from previous version list.
assert(pv_node->class_loader_data() == loader_data, "wrong loader_data");
InstanceKlass* next = pv_node->previous_versions();
pv_node->link_previous_versions(NULL); // point next to NULL
last->link_previous_versions(next);
// Add to the deallocate list after unlinking
loader_data->add_to_deallocate_list(pv_node);
pv_node = next;
deleted_count++;
version++;
continue;
} else {
log_trace(redefine, class, iklass, purge)("previous version " INTPTR_FORMAT " is alive", p2i(pv_node));
assert(pvcp->pool_holder() != NULL, "Constant pool with no holder");
guarantee (!loader_data->is_unloading(), "unloaded classes can't be on the stack");
live_count++;
// found a previous version for next time we do class unloading
_has_previous_versions = true;
}
// At least one method is live in this previous version.
// Reset dead EMCP methods not to get breakpoints.
// All methods are deallocated when all of the methods for this class are no
// longer running.
Array<Method*>* method_refs = pv_node->methods();
if (method_refs != NULL) {
log_trace(redefine, class, iklass, purge)("previous methods length=%d", method_refs->length());
for (int j = 0; j < method_refs->length(); j++) {
Method* method = method_refs->at(j);
if (!method->on_stack()) {
// no breakpoints for non-running methods
if (method->is_running_emcp()) {
method->set_running_emcp(false);
}
} else {
assert (method->is_obsolete() || method->is_running_emcp(),
"emcp method cannot run after emcp bit is cleared");
log_trace(redefine, class, iklass, purge)
("purge: %s(%s): prev method @%d in version @%d is alive",
method->name()->as_C_string(), method->signature()->as_C_string(), j, version);
}
}
}
// next previous version
last = pv_node;
pv_node = pv_node->previous_versions();
version++;
}
log_trace(redefine, class, iklass, purge)
("previous version stats: live=%d, deleted=%d", live_count, deleted_count);
}
| 0
|
223,421
|
static void check_newlinechar(compiler_common *common, int nltype, jump_list **backtracks, BOOL jumpifmatch)
{
/* Character comes in TMP1. Checks if it is a newline. TMP2 may be destroyed. */
DEFINE_COMPILER;
struct sljit_jump *jump;
if (nltype == NLTYPE_ANY)
{
add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(jumpifmatch ? SLJIT_NOT_ZERO : SLJIT_ZERO));
}
else if (nltype == NLTYPE_ANYCRLF)
{
if (jumpifmatch)
{
add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR));
add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
}
else
{
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL));
JUMPHERE(jump);
}
}
else
{
SLJIT_ASSERT(nltype == NLTYPE_FIXED && common->newline < 256);
add_jump(compiler, backtracks, CMP(jumpifmatch ? SLJIT_EQUAL : SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, common->newline));
}
}
| 0
|
219,029
|
bool ConstantFolding::ReduceDivToReciprocalMul(GraphDef* optimized_graph,
NodeDef* node) {
// Strength reduce floating point division by a constant Div(x, const) to
// multiplication by the reciprocal Mul(x, Reciprocal(const)). This in turn
// will be constant folded to Mul(x, 1.0/const).
if (node->input_size() >= 2 &&
(IsDiv(*node) || IsRealDiv(*node) || IsXdivy(*node))) {
const string& const_input = node->input(1);
const NodeDef* denom = node_map_->GetNode(const_input);
CHECK(denom != nullptr);
if (!IsReallyConstant(*denom)) {
return false;
}
if (node->attr().count("T") == 0) {
return false;
}
DataType type = node->attr().at("T").type();
// Skip integer division.
if (IsDiv(*node) &&
!(DataTypeIsFloating(type) || DataTypeIsComplex(type))) {
return false;
}
// Insert new reciprocal op and change node from Div to Mul.
NodeDef* reciprocal_node = optimized_graph->add_node();
reciprocal_node->set_name(OptimizedNodeName(*node, "_recip"));
reciprocal_node->set_op("Reciprocal");
reciprocal_node->set_device(node->device());
reciprocal_node->add_input(const_input);
(*reciprocal_node->mutable_attr())["T"].set_type(type);
// Re-wire inputs and outputs.
if (IsXdivy(*node)) {
node->set_op("MulNoNan");
node->set_input(1, node->input(0));
node->set_input(0, reciprocal_node->name());
} else {
node->set_op("Mul");
node->set_input(1, reciprocal_node->name());
}
node_map_->AddNode(reciprocal_node->name(), reciprocal_node);
node_map_->UpdateOutput(node->name(), const_input, reciprocal_node->name());
return true;
}
return false;
}
| 0
|
462,220
|
static pj_status_t decode_uint_attr(pj_pool_t *pool,
const pj_uint8_t *buf,
const pj_stun_msg_hdr *msghdr,
void **p_attr)
{
pj_stun_uint_attr *attr;
PJ_UNUSED_ARG(msghdr);
/* Create the attribute */
attr = PJ_POOL_ZALLOC_T(pool, pj_stun_uint_attr);
GETATTRHDR(buf, &attr->hdr);
attr->value = GETVAL32H(buf, 4);
/* Check that the attribute length is valid */
if (attr->hdr.length != 4)
return PJNATH_ESTUNINATTRLEN;
/* Done */
*p_attr = attr;
return PJ_SUCCESS;
}
| 0
|
411,934
|
check_s4u2self(krb5_context context,
krb5_kdc_configuration *config,
HDB *clientdb,
hdb_entry_ex *client,
krb5_const_principal server)
{
krb5_error_code ret;
/* if client does a s4u2self to itself, that ok */
if (krb5_principal_compare(context, client->entry.principal, server) == TRUE)
return 0;
if (clientdb->hdb_check_s4u2self) {
ret = clientdb->hdb_check_s4u2self(context, clientdb, client, server);
if (ret == 0)
return 0;
} else {
ret = KRB5KDC_ERR_BADOPTION;
}
return ret;
}
| 0
|
430,364
|
void seq_put_decimal_ull_width(struct seq_file *m, const char *delimiter,
unsigned long long num, unsigned int width)
{
int len;
if (m->count + 2 >= m->size) /* we'll write 2 bytes at least */
goto overflow;
if (delimiter && delimiter[0]) {
if (delimiter[1] == 0)
seq_putc(m, delimiter[0]);
else
seq_puts(m, delimiter);
}
if (!width)
width = 1;
if (m->count + width >= m->size)
goto overflow;
len = num_to_str(m->buf + m->count, m->size - m->count, num, width);
if (!len)
goto overflow;
m->count += len;
return;
overflow:
seq_set_overflow(m);
}
| 0
|
195,665
|
njs_array_prototype_splice(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_index_t unused)
{
int64_t i, n, start, length, items, delta, delete;
njs_int_t ret;
njs_value_t *this, value, del_object;
njs_array_t *array, *deleted;
this = njs_argument(args, 0);
ret = njs_value_to_object(vm, this);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
ret = njs_object_length(vm, this, &length);
if (njs_slow_path(ret == NJS_ERROR)) {
return ret;
}
ret = njs_value_to_integer(vm, njs_arg(args, nargs, 1), &start);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
start = (start < 0) ? njs_max(length + start, 0) : njs_min(start, length);
items = 0;
delete = 0;
if (nargs == 2) {
delete = length - start;
} else if (nargs > 2) {
items = nargs - 3;
ret = njs_value_to_integer(vm, njs_arg(args, nargs, 2), &delete);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
delete = njs_min(njs_max(delete, 0), length - start);
}
delta = items - delete;
if (njs_slow_path((length + delta) > NJS_MAX_LENGTH)) {
njs_type_error(vm, "Invalid length");
return NJS_ERROR;
}
/* TODO: ArraySpeciesCreate(). */
deleted = njs_array_alloc(vm, 0, delete, 0);
if (njs_slow_path(deleted == NULL)) {
return NJS_ERROR;
}
if (njs_fast_path(njs_is_fast_array(this) && deleted->object.fast_array)) {
array = njs_array(this);
for (i = 0, n = start; i < delete; i++, n++) {
deleted->start[i] = array->start[n];
}
} else {
njs_set_array(&del_object, deleted);
for (i = 0, n = start; i < delete; i++, n++) {
ret = njs_value_property_i64(vm, this, n, &value);
if (njs_slow_path(ret == NJS_ERROR)) {
return NJS_ERROR;
}
if (ret == NJS_OK) {
/* TODO: CreateDataPropertyOrThrow(). */
ret = njs_value_property_i64_set(vm, &del_object, i, &value);
if (njs_slow_path(ret == NJS_ERROR)) {
return ret;
}
}
}
ret = njs_object_length_set(vm, &del_object, delete);
if (njs_slow_path(ret != NJS_OK)) {
return NJS_ERROR;
}
}
if (njs_fast_path(njs_is_fast_array(this))) {
array = njs_array(this);
if (delta != 0) {
/*
* Relocate the rest of items.
* Index of the first item is in "n".
*/
if (delta > 0) {
ret = njs_array_expand(vm, array, 0, delta);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
}
ret = njs_array_copy_within(vm, this, start + items, start + delete,
array->length - (start + delete), 0);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
array->length += delta;
}
/* Copy new items. */
if (items > 0) {
memcpy(&array->start[start], &args[3],
items * sizeof(njs_value_t));
}
} else {
if (delta != 0) {
ret = njs_array_copy_within(vm, this, start + items, start + delete,
length - (start + delete), delta < 0);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
for (i = length - 1; i >= length + delta; i--) {
ret = njs_value_property_i64_delete(vm, this, i, NULL);
if (njs_slow_path(ret == NJS_ERROR)) {
return NJS_ERROR;
}
}
}
/* Copy new items. */
for (i = 3, n = start; items-- > 0; i++, n++) {
ret = njs_value_property_i64_set(vm, this, n, &args[i]);
if (njs_slow_path(ret == NJS_ERROR)) {
return NJS_ERROR;
}
}
ret = njs_object_length_set(vm, this, length + delta);
if (njs_slow_path(ret != NJS_OK)) {
return NJS_ERROR;
}
}
njs_set_array(&vm->retval, deleted);
return NJS_OK;
}
| 1
|
369,380
|
static void io_req_complete_fail_submit(struct io_kiocb *req)
{
/*
* We don't submit, fail them all, for that replace hardlinks with
* normal links. Extra REQ_F_LINK is tolerated.
*/
req->flags &= ~REQ_F_HARDLINK;
req->flags |= REQ_F_LINK;
io_req_complete_failed(req, req->result);
}
| 0
|
254,881
|
const std::vector<AccumulationStatement>& DocumentSourceGroup::getAccumulatedFields() const {
return _accumulatedFields;
}
| 0
|
387,603
|
static int snd_ctl_elem_user_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct user_element *ue = kcontrol->private_data;
unsigned int size = ue->elem_data_size;
char *src = ue->elem_data +
snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size;
memcpy(&ucontrol->value, src, size);
return 0;
}
| 0
|
328,929
|
R_API RBinJavaVerificationObj *r_bin_java_read_from_buffer_verification_info_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {
if (sz < 8) {
return NULL;
}
ut64 offset = 0;
RBinJavaVerificationObj *se = R_NEW0 (RBinJavaVerificationObj);
if (!se) {
return NULL;
}
se->file_offset = buf_offset;
se->tag = buffer[offset];
offset += 1;
if (se->tag == R_BIN_JAVA_STACKMAP_OBJECT) {
se->info.obj_val_cp_idx = R_BIN_JAVA_USHORT (buffer, offset);
offset += 2;
} else if (se->tag == R_BIN_JAVA_STACKMAP_UNINIT) {
se->info.uninit_offset = R_BIN_JAVA_USHORT (buffer, offset);
offset += 2;
}
if (R_BIN_JAVA_STACKMAP_UNINIT < se->tag) {
r_bin_java_verification_info_free (se);
return NULL;
}
se->size = offset;
return se;
}
| 0
|
292,237
|
inbound_uback (server *serv, const message_tags_data *tags_data)
{
serv->is_away = FALSE;
serv->reconnect_away = FALSE;
fe_set_away (serv);
inbound_set_all_away_status (serv, serv->nick, 0);
}
| 0
|
301,357
|
static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
{
return sys_acl_set_file(handle, name, acltype, theacl);
}
| 0
|
355,638
|
eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
{
char_u *p;
int getnext;
/*
* Get the first variable.
*/
if (eval3(arg, rettv, evalarg) == FAIL)
return FAIL;
/*
* Handle the "||" operator.
*/
p = eval_next_non_blank(*arg, evalarg, &getnext);
if (p[0] == '|' && p[1] == '|')
{
evalarg_T *evalarg_used = evalarg;
evalarg_T local_evalarg;
int evaluate;
int orig_flags;
long result = FALSE;
typval_T var2;
int error = FALSE;
int vim9script = in_vim9script();
if (evalarg == NULL)
{
init_evalarg(&local_evalarg);
evalarg_used = &local_evalarg;
}
orig_flags = evalarg_used->eval_flags;
evaluate = orig_flags & EVAL_EVALUATE;
if (evaluate)
{
if (vim9script)
result = tv_get_bool_chk(rettv, &error);
else if (tv_get_number_chk(rettv, &error) != 0)
result = TRUE;
clear_tv(rettv);
if (error)
return FAIL;
}
/*
* Repeat until there is no following "||".
*/
while (p[0] == '|' && p[1] == '|')
{
if (getnext)
*arg = eval_next_line(evalarg_used);
else
{
if (evaluate && in_vim9script() && !VIM_ISWHITE(p[-1]))
{
error_white_both(p, 2);
clear_tv(rettv);
return FAIL;
}
*arg = p;
}
/*
* Get the second variable.
*/
if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2]))
{
error_white_both(*arg, 2);
clear_tv(rettv);
return FAIL;
}
*arg = skipwhite_and_linebreak(*arg + 2, evalarg_used);
evalarg_used->eval_flags = !result ? orig_flags
: orig_flags & ~EVAL_EVALUATE;
if (eval3(arg, &var2, evalarg_used) == FAIL)
return FAIL;
/*
* Compute the result.
*/
if (evaluate && !result)
{
if (vim9script)
result = tv_get_bool_chk(&var2, &error);
else if (tv_get_number_chk(&var2, &error) != 0)
result = TRUE;
clear_tv(&var2);
if (error)
return FAIL;
}
if (evaluate)
{
if (vim9script)
{
rettv->v_type = VAR_BOOL;
rettv->vval.v_number = result ? VVAL_TRUE : VVAL_FALSE;
}
else
{
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = result;
}
}
p = eval_next_non_blank(*arg, evalarg_used, &getnext);
}
if (evalarg == NULL)
clear_evalarg(&local_evalarg, NULL);
else
evalarg->eval_flags = orig_flags;
}
return OK;
}
| 0
|
253,559
|
smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_sb_info *cifs_sb, const char *full_path,
char **target_path, bool is_reparse_point)
{
int rc;
__le16 *utf16_path = NULL;
__u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
struct cifs_open_parms oparms;
struct cifs_fid fid;
struct kvec err_iov = {NULL, 0};
struct smb2_err_rsp *err_buf = NULL;
struct smb2_symlink_err_rsp *symlink;
struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
unsigned int sub_len;
unsigned int sub_offset;
unsigned int print_len;
unsigned int print_offset;
int flags = CIFS_CP_CREATE_CLOSE_OP;
struct smb_rqst rqst[3];
int resp_buftype[3];
struct kvec rsp_iov[3];
struct kvec open_iov[SMB2_CREATE_IOV_SIZE];
struct kvec io_iov[SMB2_IOCTL_IOV_SIZE];
struct kvec close_iov[1];
struct smb2_create_rsp *create_rsp;
struct smb2_ioctl_rsp *ioctl_rsp;
struct reparse_data_buffer *reparse_buf;
int create_options = is_reparse_point ? OPEN_REPARSE_POINT : 0;
u32 plen;
cifs_dbg(FYI, "%s: path: %s\n", __func__, full_path);
*target_path = NULL;
if (smb3_encryption_required(tcon))
flags |= CIFS_TRANSFORM_REQ;
memset(rqst, 0, sizeof(rqst));
resp_buftype[0] = resp_buftype[1] = resp_buftype[2] = CIFS_NO_BUFFER;
memset(rsp_iov, 0, sizeof(rsp_iov));
utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
if (!utf16_path)
return -ENOMEM;
/* Open */
memset(&open_iov, 0, sizeof(open_iov));
rqst[0].rq_iov = open_iov;
rqst[0].rq_nvec = SMB2_CREATE_IOV_SIZE;
memset(&oparms, 0, sizeof(oparms));
oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES;
oparms.disposition = FILE_OPEN;
oparms.create_options = cifs_create_options(cifs_sb, create_options);
oparms.fid = &fid;
oparms.reconnect = false;
rc = SMB2_open_init(tcon, server,
&rqst[0], &oplock, &oparms, utf16_path);
if (rc)
goto querty_exit;
smb2_set_next_command(tcon, &rqst[0]);
/* IOCTL */
memset(&io_iov, 0, sizeof(io_iov));
rqst[1].rq_iov = io_iov;
rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE;
rc = SMB2_ioctl_init(tcon, server,
&rqst[1], fid.persistent_fid,
fid.volatile_fid, FSCTL_GET_REPARSE_POINT,
true /* is_fctl */, NULL, 0,
CIFSMaxBufSize -
MAX_SMB2_CREATE_RESPONSE_SIZE -
MAX_SMB2_CLOSE_RESPONSE_SIZE);
if (rc)
goto querty_exit;
smb2_set_next_command(tcon, &rqst[1]);
smb2_set_related(&rqst[1]);
/* Close */
memset(&close_iov, 0, sizeof(close_iov));
rqst[2].rq_iov = close_iov;
rqst[2].rq_nvec = 1;
rc = SMB2_close_init(tcon, server,
&rqst[2], COMPOUND_FID, COMPOUND_FID, false);
if (rc)
goto querty_exit;
smb2_set_related(&rqst[2]);
rc = compound_send_recv(xid, tcon->ses, server,
flags, 3, rqst,
resp_buftype, rsp_iov);
create_rsp = rsp_iov[0].iov_base;
if (create_rsp && create_rsp->hdr.Status)
err_iov = rsp_iov[0];
ioctl_rsp = rsp_iov[1].iov_base;
/*
* Open was successful and we got an ioctl response.
*/
if ((rc == 0) && (is_reparse_point)) {
/* See MS-FSCC 2.3.23 */
reparse_buf = (struct reparse_data_buffer *)
((char *)ioctl_rsp +
le32_to_cpu(ioctl_rsp->OutputOffset));
plen = le32_to_cpu(ioctl_rsp->OutputCount);
if (plen + le32_to_cpu(ioctl_rsp->OutputOffset) >
rsp_iov[1].iov_len) {
cifs_tcon_dbg(VFS, "srv returned invalid ioctl len: %d\n",
plen);
rc = -EIO;
goto querty_exit;
}
rc = parse_reparse_point(reparse_buf, plen, target_path,
cifs_sb);
goto querty_exit;
}
if (!rc || !err_iov.iov_base) {
rc = -ENOENT;
goto querty_exit;
}
err_buf = err_iov.iov_base;
if (le32_to_cpu(err_buf->ByteCount) < sizeof(struct smb2_symlink_err_rsp) ||
err_iov.iov_len < SMB2_SYMLINK_STRUCT_SIZE) {
rc = -EINVAL;
goto querty_exit;
}
symlink = (struct smb2_symlink_err_rsp *)err_buf->ErrorData;
if (le32_to_cpu(symlink->SymLinkErrorTag) != SYMLINK_ERROR_TAG ||
le32_to_cpu(symlink->ReparseTag) != IO_REPARSE_TAG_SYMLINK) {
rc = -EINVAL;
goto querty_exit;
}
/* open must fail on symlink - reset rc */
rc = 0;
sub_len = le16_to_cpu(symlink->SubstituteNameLength);
sub_offset = le16_to_cpu(symlink->SubstituteNameOffset);
print_len = le16_to_cpu(symlink->PrintNameLength);
print_offset = le16_to_cpu(symlink->PrintNameOffset);
if (err_iov.iov_len < SMB2_SYMLINK_STRUCT_SIZE + sub_offset + sub_len) {
rc = -EINVAL;
goto querty_exit;
}
if (err_iov.iov_len <
SMB2_SYMLINK_STRUCT_SIZE + print_offset + print_len) {
rc = -EINVAL;
goto querty_exit;
}
*target_path = cifs_strndup_from_utf16(
(char *)symlink->PathBuffer + sub_offset,
sub_len, true, cifs_sb->local_nls);
if (!(*target_path)) {
rc = -ENOMEM;
goto querty_exit;
}
convert_delimiter(*target_path, '/');
cifs_dbg(FYI, "%s: target path: %s\n", __func__, *target_path);
querty_exit:
cifs_dbg(FYI, "query symlink rc %d\n", rc);
kfree(utf16_path);
SMB2_open_free(&rqst[0]);
SMB2_ioctl_free(&rqst[1]);
SMB2_close_free(&rqst[2]);
free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base);
free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base);
free_rsp_buf(resp_buftype[2], rsp_iov[2].iov_base);
return rc;
}
| 0
|
261,767
|
njs_function_frame_invoke(njs_vm_t *vm, njs_value_t *retval)
{
njs_native_frame_t *frame;
frame = vm->top_frame;
frame->retval = retval;
if (njs_function_object_type(vm, frame->function)
== NJS_OBJ_TYPE_ASYNC_FUNCTION)
{
return njs_async_function_frame_invoke(vm, retval);
}
if (frame->native) {
return njs_function_native_call(vm);
} else {
return njs_function_lambda_call(vm, NULL, NULL);
}
}
| 0
|
301,502
|
find_keepcap_word(slang_T *slang, char_u *fword, char_u *kword)
{
char_u uword[MAXWLEN]; // "fword" in upper-case
int depth;
idx_T tryidx;
// The following arrays are used at each depth in the tree.
idx_T arridx[MAXWLEN];
int round[MAXWLEN];
int fwordidx[MAXWLEN];
int uwordidx[MAXWLEN];
int kwordlen[MAXWLEN];
int flen, ulen;
int l;
int len;
int c;
idx_T lo, hi, m;
char_u *p;
char_u *byts = slang->sl_kbyts; // array with bytes of the words
idx_T *idxs = slang->sl_kidxs; // array with indexes
if (byts == NULL)
{
// array is empty: "cannot happen"
*kword = NUL;
return;
}
// Make an all-cap version of "fword".
allcap_copy(fword, uword);
// Each character needs to be tried both case-folded and upper-case.
// All this gets very complicated if we keep in mind that changing case
// may change the byte length of a multi-byte character...
depth = 0;
arridx[0] = 0;
round[0] = 0;
fwordidx[0] = 0;
uwordidx[0] = 0;
kwordlen[0] = 0;
while (depth >= 0)
{
if (fword[fwordidx[depth]] == NUL)
{
// We are at the end of "fword". If the tree allows a word to end
// here we have found a match.
if (byts[arridx[depth] + 1] == 0)
{
kword[kwordlen[depth]] = NUL;
return;
}
// kword is getting too long, continue one level up
--depth;
}
else if (++round[depth] > 2)
{
// tried both fold-case and upper-case character, continue one
// level up
--depth;
}
else
{
// round[depth] == 1: Try using the folded-case character.
// round[depth] == 2: Try using the upper-case character.
if (has_mbyte)
{
flen = MB_CPTR2LEN(fword + fwordidx[depth]);
ulen = MB_CPTR2LEN(uword + uwordidx[depth]);
}
else
ulen = flen = 1;
if (round[depth] == 1)
{
p = fword + fwordidx[depth];
l = flen;
}
else
{
p = uword + uwordidx[depth];
l = ulen;
}
for (tryidx = arridx[depth]; l > 0; --l)
{
// Perform a binary search in the list of accepted bytes.
len = byts[tryidx++];
c = *p++;
lo = tryidx;
hi = tryidx + len - 1;
while (lo < hi)
{
m = (lo + hi) / 2;
if (byts[m] > c)
hi = m - 1;
else if (byts[m] < c)
lo = m + 1;
else
{
lo = hi = m;
break;
}
}
// Stop if there is no matching byte.
if (hi < lo || byts[lo] != c)
break;
// Continue at the child (if there is one).
tryidx = idxs[lo];
}
if (l == 0)
{
// Found the matching char. Copy it to "kword" and go a
// level deeper.
if (round[depth] == 1)
{
STRNCPY(kword + kwordlen[depth], fword + fwordidx[depth],
flen);
kwordlen[depth + 1] = kwordlen[depth] + flen;
}
else
{
STRNCPY(kword + kwordlen[depth], uword + uwordidx[depth],
ulen);
kwordlen[depth + 1] = kwordlen[depth] + ulen;
}
fwordidx[depth + 1] = fwordidx[depth] + flen;
uwordidx[depth + 1] = uwordidx[depth] + ulen;
++depth;
arridx[depth] = tryidx;
round[depth] = 0;
}
}
}
// Didn't find it: "cannot happen".
*kword = NUL;
}
| 0
|
270,396
|
static bool ok_inflater_distance_tree(ok_inflater *inflater) {
bool done = ok_inflater_inflate_huffman_tree(inflater, inflater->distance_huffman,
inflater->code_length_huffman,
inflater->num_distance_codes);
if (done) {
inflater->state = OK_INFLATER_STATE_READING_DYNAMIC_COMPRESSED_BLOCK;
inflater->huffman_code = -1;
return true;
} else {
return false;
}
}
| 0
|
476,120
|
static int count_ext_prop(struct usb_configuration *c, int interface)
{
struct usb_function *f;
int j;
f = c->interface[interface];
for (j = 0; j < f->os_desc_n; ++j) {
struct usb_os_desc *d;
if (interface != f->os_desc_table[j].if_id)
continue;
d = f->os_desc_table[j].os_desc;
if (d && d->ext_compat_id)
return d->ext_prop_count;
}
return 0;
}
| 0
|
512,733
|
Item *build_clone(THD *thd) { return 0; }
| 0
|
486,829
|
static hwaddr gem_get_desc_addr(CadenceGEMState *s, bool tx, int q)
{
hwaddr desc_addr = 0;
if (s->regs[GEM_DMACFG] & GEM_DMACFG_ADDR_64B) {
desc_addr = s->regs[tx ? GEM_TBQPH : GEM_RBQPH];
}
desc_addr <<= 32;
desc_addr |= tx ? s->tx_desc_addr[q] : s->rx_desc_addr[q];
return desc_addr;
}
| 0
|
506,688
|
static int set_altname_email(X509 *crt, const char *name)
{
return set_altname(crt, GEN_EMAIL, name, 0);
}
| 0
|
353,236
|
bool SplashAxialPattern::getParameter(double xc, double yc, double *t) {
double s;
xc -= x0;
yc -= y0;
s = (xc * dx + yc * dy) * mul;
if (0 <= s && s <= 1) {
*t = t0 + dt * s;
} else if (s < 0 && shading->getExtend0()) {
*t = t0;
} else if (s > 1 && shading->getExtend1()) {
*t = t1;
} else {
return false;
}
return true;
}
| 0
|
413,665
|
static int fcn_list_table(RCore *core, const char *q, int fmt) {
char xref[128], ccstr[128], castr[128];
RAnalFunction *fcn;
RListIter *iter;
RTable *t = r_core_table (core, "fcns");
RTableColumnType *typeString = r_table_type ("string");
RTableColumnType *typeNumber = r_table_type ("number");
r_table_add_column (t, typeNumber, "addr", 0);
r_table_add_column (t, typeNumber, "size", 0);
r_table_add_column (t, typeString, "name", 0);
r_table_add_column (t, typeNumber, "nbbs", 0);
r_table_add_column (t, typeNumber, "xref", 0);
r_table_add_column (t, typeNumber, "calls", 0);
r_table_add_column (t, typeNumber, "cc", 0);
r_list_foreach (core->anal->fcns, iter, fcn) {
r_strf_var (fcnAddr, 32, "0x%08"PFMT64x, fcn->addr);
r_strf_var (fcnSize, 32, "%"PFMT64u, r_anal_function_linear_size (fcn)); // r_anal_function_size (fcn));
r_strf_var (nbbs, 32, "%d", r_list_length (fcn->bbs));
RList *xrefs = r_anal_function_get_xrefs (fcn);
snprintf (xref, sizeof (xref), "%d", r_list_length (xrefs));
r_list_free (xrefs);
RList *calls = r_core_anal_fcn_get_calls (core, fcn);
r_list_uniq_inplace (calls, (RListComparatorItem)RAnalRef_val);
snprintf (castr, sizeof (castr), "%d", r_list_length (calls));
r_list_free (calls);
snprintf (ccstr, sizeof (ccstr), "%d", r_anal_function_complexity (fcn));
r_table_add_row (t, fcnAddr, fcnSize, fcn->name, nbbs, xref, castr, ccstr, NULL);
}
if (r_table_query (t, q)) {
char *s = (fmt == 'j')
? r_table_tojson (t)
: r_table_tostring (t);
r_cons_printf ("%s\n", s);
free (s);
}
r_table_free (t);
return 0;
}
| 0
|
359,599
|
bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
enum clear_sort sort, enum bgp_clear_type stype,
const char *arg)
{
int ret;
struct bgp *bgp;
/* BGP structure lookup. */
if (name)
{
bgp = bgp_lookup_by_name (name);
if (bgp == NULL)
{
vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
return CMD_WARNING;
}
}
else
{
bgp = bgp_get_default ();
if (bgp == NULL)
{
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
return CMD_WARNING;
}
}
ret = bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
if (ret < 0)
return CMD_WARNING;
return CMD_SUCCESS;
}
| 0
|
201,382
|
drill_parse_T_code(gerb_file_t *fd, drill_state_t *state,
gerbv_image_t *image, ssize_t file_line)
{
int tool_num;
gboolean done = FALSE;
int temp;
double size;
gerbv_drill_stats_t *stats = image->drill_stats;
gerbv_aperture_t *apert;
gchar *tmps;
gchar *string;
dprintf("---> entering %s()...\n", __FUNCTION__);
/* Sneak a peek at what's hiding after the 'T'. Ugly fix for
broken headers from Orcad, which is crap */
temp = gerb_fgetc(fd);
dprintf(" Found a char '%s' (0x%02x) after the T\n",
gerbv_escape_char(temp), temp);
/* might be a tool tool change stop switch on/off*/
if((temp == 'C') && ((fd->ptr + 2) < fd->datalen)){
if(gerb_fgetc(fd) == 'S'){
if (gerb_fgetc(fd) == 'T' ){
fd->ptr -= 4;
tmps = get_line(fd++);
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_NOTE, -1,
_("Tool change stop switch found \"%s\" "
"at line %ld in file \"%s\""),
tmps, file_line, fd->filename);
g_free (tmps);
return -1;
}
gerb_ungetc(fd);
}
gerb_ungetc(fd);
}
if( !(isdigit(temp) != 0 || temp == '+' || temp =='-') ) {
if(temp != EOF) {
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_ERROR, -1,
_("OrCAD bug: Junk text found in place of tool definition"));
tmps = get_line(fd);
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_WARNING, -1,
_("Junk text \"%s\" "
"at line %ld in file \"%s\""),
tmps, file_line, fd->filename);
g_free (tmps);
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_WARNING, -1,
_("Ignoring junk text"));
}
return -1;
}
gerb_ungetc(fd);
tool_num = (int) gerb_fgetint(fd, NULL);
dprintf (" Handling tool T%d at line %ld\n", tool_num, file_line);
if (tool_num == 0)
return tool_num; /* T00 is a command to unload the drill */
if (tool_num < TOOL_MIN || tool_num >= TOOL_MAX) {
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_ERROR, -1,
_("Out of bounds drill number %d "
"at line %ld in file \"%s\""),
tool_num, file_line, fd->filename);
}
/* Set the current tool to the correct one */
state->current_tool = tool_num;
apert = image->aperture[tool_num];
/* Check for a size definition */
temp = gerb_fgetc(fd);
/* This bit of code looks for a tool definition by scanning for strings
* of form TxxC, TxxF, TxxS. */
while (!done) {
switch((char)temp) {
case 'C':
size = read_double(fd, state->header_number_format, GERBV_OMIT_ZEROS_TRAILING, state->decimals);
dprintf (" Read a size of %g\n", size);
if (state->unit == GERBV_UNIT_MM) {
size /= 25.4;
} else if(size >= 4.0) {
/* If the drill size is >= 4 inches, assume that this
must be wrong and that the units are mils.
The limit being 4 inches is because the smallest drill
I've ever seen used is 0,3mm(about 12mil). Half of that
seemed a bit too small a margin, so a third it is */
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_ERROR, -1,
_("Read a drill of diameter %g inches "
"at line %ld in file \"%s\""),
size, file_line, fd->filename);
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_WARNING, -1,
_("Assuming units are mils"));
size /= 1000.0;
}
if (size <= 0. || size >= 10000.) {
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_ERROR, -1,
_("Unreasonable drill size %g found for drill %d "
"at line %ld in file \"%s\""),
size, tool_num, file_line, fd->filename);
} else {
if (apert != NULL) {
/* allow a redefine of a tool only if the new definition is exactly the same.
* This avoid lots of spurious complaints with the output of some cad
* tools while keeping complaints if there is a true problem
*/
if (apert->parameter[0] != size
|| apert->type != GERBV_APTYPE_CIRCLE
|| apert->nuf_parameters != 1
|| apert->unit != GERBV_UNIT_INCH) {
gerbv_stats_printf(stats->error_list,
GERBV_MESSAGE_ERROR, -1,
_("Found redefinition of drill %d "
"at line %ld in file \"%s\""),
tool_num, file_line, fd->filename);
}
} else {
apert = image->aperture[tool_num] =
g_new0(gerbv_aperture_t, 1);
if (apert == NULL)
GERB_FATAL_ERROR("malloc tool failed in %s()",
__FUNCTION__);
/* There's really no way of knowing what unit the tools
are defined in without sneaking a peek in the rest of
the file first. That's done in drill_guess_format() */
apert->parameter[0] = size;
apert->type = GERBV_APTYPE_CIRCLE;
apert->nuf_parameters = 1;
apert->unit = GERBV_UNIT_INCH;
}
}
/* Add the tool whose definition we just found into the list
* of tools for this layer used to generate statistics. */
stats = image->drill_stats;
string = g_strdup_printf("%s", (state->unit == GERBV_UNIT_MM ? _("mm") : _("inch")));
drill_stats_add_to_drill_list(stats->drill_list,
tool_num,
state->unit == GERBV_UNIT_MM ? size*25.4 : size,
string);
g_free(string);
break;
case 'F':
case 'S' :
/* Silently ignored. They're not important. */
gerb_fgetint(fd, NULL);
break;
default:
/* Stop when finding anything but what's expected
(and put it back) */
gerb_ungetc(fd);
done = TRUE;
break;
} /* switch((char)temp) */
temp = gerb_fgetc(fd);
if (EOF == temp) {
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_ERROR, -1,
_("Unexpected EOF encountered in header of "
"drill file \"%s\""), fd->filename);
/* Restore new line character for processing */
if ('\n' == temp || '\r' == temp)
gerb_ungetc(fd);
}
} /* while(!done) */ /* Done looking at tool definitions */
/* Catch the tools that aren't defined.
This isn't strictly a good thing, but at least something is shown */
if (apert == NULL) {
double dia;
apert = image->aperture[tool_num] = g_new0(gerbv_aperture_t, 1);
if (apert == NULL)
GERB_FATAL_ERROR("malloc tool failed in %s()", __FUNCTION__);
/* See if we have the tool table */
dia = gerbv_get_tool_diameter(tool_num);
if (dia <= 0) {
/*
* There is no tool. So go out and make some.
* This size calculation is, of course, totally bogus.
*/
dia = (double)(16 + 8 * tool_num) / 1000;
/*
* Oooh, this is sooo ugly. But some CAD systems seem to always
* use T00 at the end of the file while others that don't have
* tool definitions inside the file never seem to use T00 at all.
*/
if (tool_num != 0) {
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_ERROR, -1,
_("Tool %02d used without being defined "
"at line %ld in file \"%s\""),
tool_num, file_line, fd->filename);
gerbv_stats_printf(stats->error_list, GERBV_MESSAGE_WARNING, -1,
_("Setting a default size of %g\""), dia);
}
}
apert->type = GERBV_APTYPE_CIRCLE;
apert->nuf_parameters = 1;
apert->parameter[0] = dia;
/* Add the tool whose definition we just found into the list
* of tools for this layer used to generate statistics. */
if (tool_num != 0) { /* Only add non-zero tool nums.
* Zero = unload command. */
stats = image->drill_stats;
string = g_strdup_printf("%s",
(state->unit == GERBV_UNIT_MM ? _("mm") : _("inch")));
drill_stats_add_to_drill_list(stats->drill_list,
tool_num,
state->unit == GERBV_UNIT_MM ? dia*25.4 : dia,
string);
g_free(string);
}
} /* if(image->aperture[tool_num] == NULL) */
dprintf("<---- ...leaving %s()\n", __FUNCTION__);
return tool_num;
} /* drill_parse_T_code() */
| 1
|
238,542
|
static void coerce_reg_to_size(struct bpf_reg_state *reg, int size)
{
u64 mask;
/* clear high bits in bit representation */
reg->var_off = tnum_cast(reg->var_off, size);
/* fix arithmetic bounds */
mask = ((u64)1 << (size * 8)) - 1;
if ((reg->umin_value & ~mask) == (reg->umax_value & ~mask)) {
reg->umin_value &= mask;
reg->umax_value &= mask;
} else {
reg->umin_value = 0;
reg->umax_value = mask;
}
reg->smin_value = reg->umin_value;
reg->smax_value = reg->umax_value;
/* If size is smaller than 32bit register the 32bit register
* values are also truncated so we push 64-bit bounds into
* 32-bit bounds. Above were truncated < 32-bits already.
*/
if (size >= 4)
return;
__reg_combine_64_into_32(reg);
}
| 0
|
291,840
|
static int __init rtrs_client_init(void)
{
rtrs_rdma_dev_pd_init(0, &dev_pd);
rtrs_clt_dev_class = class_create(THIS_MODULE, "rtrs-client");
if (IS_ERR(rtrs_clt_dev_class)) {
pr_err("Failed to create rtrs-client dev class\n");
return PTR_ERR(rtrs_clt_dev_class);
}
rtrs_wq = alloc_workqueue("rtrs_client_wq", 0, 0);
if (!rtrs_wq) {
class_destroy(rtrs_clt_dev_class);
return -ENOMEM;
}
return 0;
}
| 0
|
463,219
|
static void init_annotation_definitions(void)
{
char *p;
char aline[ANNOT_DEF_MAXLINELEN];
annotate_entrydesc_t *ae;
int i;
FILE* f;
struct parse_state state;
ptrarray_t *entries = NULL;
/* copy static entries into list */
for (i = 0 ; server_builtin_entries[i].name ; i++)
ptrarray_append(&server_entries, (void *)&server_builtin_entries[i]);
/* copy static entries into list */
for (i = 0 ; mailbox_builtin_entries[i].name ; i++)
ptrarray_append(&mailbox_entries, (void *)&mailbox_builtin_entries[i]);
/* copy static entries into list */
for (i = 0 ; message_builtin_entries[i].name ; i++)
ptrarray_append(&message_entries, (void *)&message_builtin_entries[i]);
memset(&state, 0, sizeof(state));
/* parse config file */
state.filename = config_getstring(IMAPOPT_ANNOTATION_DEFINITIONS);
if (!state.filename)
return;
f = fopen(state.filename,"r");
if (!f) {
syslog(LOG_ERR, "%s: could not open annotation definition file: %m",
state.filename);
return;
}
while (fgets(aline, sizeof(aline), f)) {
/* remove leading space, skip blank lines and comments */
state.lineno++;
for (p = aline; *p && isspace(*p); p++);
if (!*p || *p == '#') continue;
tok_initm(&state.tok, aline, ",", TOK_TRIMLEFT|TOK_TRIMRIGHT|TOK_EMPTY);
/* note, we only do the most basic validity checking and may
be more restrictive than necessary */
ae = xzmalloc(sizeof(*ae));
if (!(p = get_token(&state, ".-_/:"))) goto bad;
/* TV-TODO: should test for empty */
if (!strncmp(p, IMAP_ANNOT_NS, strlen(IMAP_ANNOT_NS))) {
parse_error(&state, "annotation under " IMAP_ANNOT_NS);
goto bad;
}
ae->name = xstrdup(p);
if (!(p = get_token(&state, ".-_/"))) goto bad;
switch (table_lookup(annotation_scope_names, p)) {
case ANNOTATION_SCOPE_SERVER:
entries = &server_entries;
break;
case ANNOTATION_SCOPE_MAILBOX:
entries = &mailbox_entries;
break;
case ANNOTATION_SCOPE_MESSAGE:
if (!strncmp(ae->name, "/flags/", 7)) {
/* RFC5257 reserves the /flags/ hierarchy for future use */
state.context = ae->name;
parse_error(&state, "message entry under /flags/");
goto bad;
}
entries = &message_entries;
break;
case -1:
parse_error(&state, "invalid annotation scope");
goto bad;
}
if (!(p = get_token(&state, NULL))) goto bad;
i = table_lookup(attribute_type_names, p);
if (i < 0) {
parse_error(&state, "invalid annotation type");
goto bad;
}
ae->type = i;
i = parse_table_lookup_bitmask(annotation_proxy_type_names, &state);
if (i < 0) {
parse_error(&state, "invalid annotation proxy type");
goto bad;
}
ae->proxytype = i;
i = parse_table_lookup_bitmask(annotation_attributes, &state);
if (i < 0) {
parse_error(&state, "invalid annotation attributes");
goto bad;
}
ae->attribs = normalise_attribs(&state, i);
if (!(p = get_token(&state, NULL))) goto bad;
cyrus_acl_strtomask(p, &ae->extra_rights);
/* XXX and if strtomask fails? */
p = tok_next(&state.tok);
if (p) {
parse_error(&state, "junk at end of line");
goto bad;
}
ae->get = annotation_get_fromdb;
ae->set = annotation_set_todb;
ae->rock = NULL;
ptrarray_append(entries, ae);
continue;
bad:
free((char *)ae->name);
free(ae);
tok_fini(&state.tok);
continue;
}
#if 0
/* Suppress the syslog message to fix the unit tests, but have the
* syslog message to aid the admin ...
*/
if (state.nerrors)
syslog(LOG_ERR, "%s: encountered %u errors. Struggling on, but "
"some of your annotation definitions may be "
"ignored. Please fix this file!",
state.filename, state.nerrors);
#endif
fclose(f);
}
| 0
|
384,874
|
FreeWild(int count, char_u **files)
{
if (count <= 0 || files == NULL)
return;
while (count--)
vim_free(files[count]);
vim_free(files);
}
| 0
|
359,358
|
DEFUN (clear_bgp_external_soft_in,
clear_bgp_external_soft_in_cmd,
"clear bgp external soft in",
CLEAR_STR
BGP_STR
"Clear all external peers\n"
"Soft reconfig\n"
"Soft reconfig inbound update\n")
{
return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
BGP_CLEAR_SOFT_IN, NULL);
}
| 0
|
447,231
|
apprentice_load(struct magic_set *ms, const char *fn, int action)
{
int errs = 0;
uint32_t i, j;
size_t files = 0, maxfiles = 0;
char **filearr = NULL;
struct stat st;
struct magic_map *map;
struct magic_entry_set mset[MAGIC_SETS];
php_stream *dir;
php_stream_dirent d;
TSRMLS_FETCH();
memset(mset, 0, sizeof(mset));
ms->flags |= MAGIC_CHECK; /* Enable checks for parsed files */
if ((map = CAST(struct magic_map *, ecalloc(1, sizeof(*map)))) == NULL)
{
file_oomem(ms, sizeof(*map));
return NULL;
}
/* print silly verbose header for USG compat. */
if (action == FILE_CHECK)
(void)fprintf(stderr, "%s\n", usg_hdr);
/* load directory or file */
/* FIXME: Read file names and sort them to prevent
non-determinism. See Debian bug #488562. */
if (php_sys_stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) {
int mflen;
char mfn[MAXPATHLEN];
dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL);
if (!dir) {
errs++;
goto out;
}
while (php_stream_readdir(dir, &d)) {
if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d.d_name)) < 0) {
file_oomem(ms,
strlen(fn) + strlen(d.d_name) + 2);
errs++;
php_stream_closedir(dir);
goto out;
}
if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) {
continue;
}
if (files >= maxfiles) {
size_t mlen;
maxfiles = (maxfiles + 1) * 2;
mlen = maxfiles * sizeof(*filearr);
if ((filearr = CAST(char **,
erealloc(filearr, mlen))) == NULL) {
file_oomem(ms, mlen);
php_stream_closedir(dir);
errs++;
goto out;
}
}
filearr[files++] = estrndup(mfn, (mflen > sizeof(mfn) - 1)? sizeof(mfn) - 1: mflen);
}
php_stream_closedir(dir);
qsort(filearr, files, sizeof(*filearr), cmpstrp);
for (i = 0; i < files; i++) {
load_1(ms, action, filearr[i], &errs, mset);
efree(filearr[i]);
}
efree(filearr);
} else
load_1(ms, action, fn, &errs, mset);
if (errs)
goto out;
for (j = 0; j < MAGIC_SETS; j++) {
/* Set types of tests */
for (i = 0; i < mset[j].count; ) {
if (mset[j].me[i].mp->cont_level != 0) {
i++;
continue;
}
i = set_text_binary(ms, mset[j].me, mset[j].count, i);
}
qsort(mset[j].me, mset[j].count, sizeof(*mset[j].me),
apprentice_sort);
/*
* Make sure that any level 0 "default" line is last
* (if one exists).
*/
set_last_default(ms, mset[j].me, mset[j].count);
/* coalesce per file arrays into a single one */
if (coalesce_entries(ms, mset[j].me, mset[j].count,
&map->magic[j], &map->nmagic[j]) == -1) {
errs++;
goto out;
}
}
out:
for (j = 0; j < MAGIC_SETS; j++)
magic_entry_free(mset[j].me, mset[j].count);
if (errs) {
for (j = 0; j < MAGIC_SETS; j++) {
if (map->magic[j])
efree(map->magic[j]);
}
efree(map);
return NULL;
}
return map;
}
| 0
|
244,176
|
GF_Err ctts_box_read(GF_Box *s, GF_BitStream *bs)
{
u32 i;
u32 sampleCount;
GF_CompositionOffsetBox *ptr = (GF_CompositionOffsetBox *)s;
ISOM_DECREASE_SIZE(ptr, 4);
ptr->nb_entries = gf_bs_read_u32(bs);
if (ptr->nb_entries > ptr->size / 8 || (u64)ptr->nb_entries > (u64)SIZE_MAX/sizeof(GF_DttsEntry) ) {
GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Invalid number of entries %d in ctts\n", ptr->nb_entries));
return GF_ISOM_INVALID_FILE;
}
ptr->alloc_size = ptr->nb_entries;
ptr->entries = (GF_DttsEntry *)gf_malloc(sizeof(GF_DttsEntry)*ptr->alloc_size);
if (!ptr->entries) return GF_OUT_OF_MEM;
sampleCount = 0;
for (i=0; i<ptr->nb_entries; i++) {
ISOM_DECREASE_SIZE(ptr, 8);
ptr->entries[i].sampleCount = gf_bs_read_u32(bs);
if (ptr->version)
ptr->entries[i].decodingOffset = gf_bs_read_int(bs, 32);
else
ptr->entries[i].decodingOffset = (s32) gf_bs_read_u32(bs);
if (ptr->max_cts_delta <= ABS(ptr->entries[i].decodingOffset)) {
ptr->max_cts_delta = ABS(ptr->entries[i].decodingOffset);
//ptr->sample_num_max_cts_delta = sampleCount;
}
sampleCount += ptr->entries[i].sampleCount;
}
#ifndef GPAC_DISABLE_ISOM_WRITE
ptr->w_LastSampleNumber = sampleCount;
#endif
return GF_OK;
}
| 0
|
443,706
|
init(void)
{
#ifdef USE_CALLOUT
int id;
OnigEncoding enc;
char* name;
unsigned int args[4];
OnigValue opts[4];
enc = ONIG_ENCODING_UTF16_BE;
name = "\000F\000A\000I\000L\000\000"; BC0_P(name, fail);
name = "\000M\000I\000S\000M\000A\000T\000C\000H\000\000"; BC0_P(name, mismatch);
name = "\000M\000A\000X\000\000";
args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
args[1] = ONIG_TYPE_CHAR;
opts[0].c = 'X';
BC_B_O(name, max, 2, args, 1, opts);
name = "\000E\000R\000R\000O\000R\000\000";
args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT;
BC_P_O(name, error, 1, args, 1, opts);
name = "\000C\000O\000U\000N\000T\000\000";
args[0] = ONIG_TYPE_CHAR; opts[0].c = '>';
BC_B_O(name, count, 1, args, 1, opts);
name = "\000T\000O\000T\000A\000L\000_\000C\000O\000U\000N\000T\000\000";
args[0] = ONIG_TYPE_CHAR; opts[0].c = '>';
BC_B_O(name, total_count, 1, args, 1, opts);
name = "\000C\000M\000P\000\000";
args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
args[1] = ONIG_TYPE_STRING;
args[2] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
BC_P(name, cmp, 3, args);
#endif /* USE_CALLOUT */
return ONIG_NORMAL;
}
| 0
|
371,226
|
static inline void fuse_make_bad(struct inode *inode)
{
remove_inode_hash(inode);
set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state);
}
| 0
|
361,296
|
stl_change_vertices(stl_file *stl, int facet_num, int vnot,
stl_vertex new_vertex) {
int first_facet;
int direction;
int next_edge;
int pivot_vertex;
if (stl->error) return;
first_facet = facet_num;
direction = 0;
for(;;) {
if(vnot > 2) {
if(direction == 0) {
pivot_vertex = (vnot + 2) % 3;
next_edge = pivot_vertex;
direction = 1;
} else {
pivot_vertex = (vnot + 1) % 3;
next_edge = vnot % 3;
direction = 0;
}
} else {
if(direction == 0) {
pivot_vertex = (vnot + 1) % 3;
next_edge = vnot;
} else {
pivot_vertex = (vnot + 2) % 3;
next_edge = pivot_vertex;
}
}
stl->facet_start[facet_num].vertex[pivot_vertex] = new_vertex;
vnot = stl->neighbors_start[facet_num].which_vertex_not[next_edge];
facet_num = stl->neighbors_start[facet_num].neighbor[next_edge];
if(facet_num == -1) {
break;
}
if(facet_num == first_facet) {
/* back to the beginning */
printf("\
Back to the first facet changing vertices: probably a mobius part.\n\
Try using a smaller tolerance or don't do a nearby check\n");
return;
}
}
}
| 0
|
513,120
|
bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
const LEX_STRING *dl_arg)
{
TABLE_LIST tables;
TABLE *table;
LEX_STRING dl= *dl_arg;
bool error;
int argc=orig_argc;
char **argv=orig_argv;
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
DBUG_ENTER("mysql_install_plugin");
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
if (!opt_noacl && check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
DBUG_RETURN(TRUE);
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/* need to open before acquiring LOCK_plugin or it will deadlock */
if (! (table = open_ltable(thd, &tables, TL_WRITE,
MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(TRUE);
if (my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL))
{
report_error(REPORT_TO_USER, ER_PLUGIN_IS_NOT_LOADED, name->str);
DBUG_RETURN(TRUE);
}
/*
Pre-acquire audit plugins for events that may potentially occur
during [UN]INSTALL PLUGIN.
When audit event is triggered, audit subsystem acquires interested
plugins by walking through plugin list. Evidently plugin list
iterator protects plugin list by acquiring LOCK_plugin, see
plugin_foreach_with_mask().
On the other hand [UN]INSTALL PLUGIN is acquiring LOCK_plugin
rather for a long time.
When audit event is triggered during [UN]INSTALL PLUGIN, plugin
list iterator acquires the same lock (within the same thread)
second time.
This hack should be removed when LOCK_plugin is fixed so it
protects only what it supposed to protect.
See also mysql_uninstall_plugin() and initialize_audit_plugin()
*/
if (mysql_audit_general_enabled())
mysql_audit_acquire_plugins(thd, event_class_mask);
mysql_mutex_lock(&LOCK_plugin);
error= plugin_add(thd->mem_root, name, &dl, REPORT_TO_USER);
if (error)
goto err;
if (name->str)
error= finalize_install(thd, table, name, &argc, argv);
else
{
st_plugin_dl *plugin_dl= plugin_dl_find(&dl);
struct st_maria_plugin *plugin;
for (plugin= plugin_dl->plugins; plugin->info; plugin++)
{
LEX_STRING str= { const_cast<char*>(plugin->name), strlen(plugin->name) };
error|= finalize_install(thd, table, &str, &argc, argv);
}
}
if (error)
{
reap_needed= true;
reap_plugins();
}
err:
global_plugin_version++;
mysql_mutex_unlock(&LOCK_plugin);
if (argv)
free_defaults(argv);
DBUG_RETURN(error);
WSREP_ERROR_LABEL:
DBUG_RETURN(TRUE);
}
| 0
|
513,333
|
static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
COND *cond,
COND_EQUAL *cond_equal,
void *table_join_idx)
{
Item_equal *item_equal;
COND *org_cond= cond; // Return this in case of fatal error
if (cond->type() == Item::COND_ITEM)
{
List<Item> *cond_list= ((Item_cond*) cond)->argument_list();
bool and_level= ((Item_cond*) cond)->functype() ==
Item_func::COND_AND_FUNC;
if (and_level)
{
cond_equal= &((Item_cond_and *) cond)->m_cond_equal;
cond_list->disjoin((List<Item> *) &cond_equal->current_level);/* remove Item_equal objects from the AND. */
List_iterator_fast<Item_equal> it(cond_equal->current_level);
while ((item_equal= it++))
{
item_equal->sort(&compare_fields_by_table_order, table_join_idx);
}
}
List_iterator<Item> li(*cond_list);
Item *item;
while ((item= li++))
{
Item *new_item= substitute_for_best_equal_field(thd, context_tab,
item, cond_equal,
table_join_idx);
/*
This works OK with PS/SP re-execution as changes are made to
the arguments of AND/OR items only
*/
if (new_item != item)
li.replace(new_item);
}
if (and_level)
{
COND *eq_cond= 0;
List_iterator_fast<Item_equal> it(cond_equal->current_level);
bool false_eq_cond= FALSE;
while ((item_equal= it++))
{
eq_cond= eliminate_item_equal(thd, eq_cond, cond_equal->upper_levels,
item_equal);
if (!eq_cond)
{
eq_cond= 0;
break;
}
else if (eq_cond->type() == Item::INT_ITEM && !eq_cond->val_bool())
{
/*
This occurs when eliminate_item_equal() founds that cond is
always false and substitutes it with Item_int 0.
Due to this, value of item_equal will be 0, so just return it.
*/
cond= eq_cond;
false_eq_cond= TRUE;
break;
}
}
if (eq_cond && !false_eq_cond)
{
/* Insert the generated equalities before all other conditions */
if (eq_cond->type() == Item::COND_ITEM)
((Item_cond *) cond)->add_at_head(
((Item_cond *) eq_cond)->argument_list());
else
{
if (cond_list->is_empty())
cond= eq_cond;
else
{
/* Do not add an equality condition if it's always true */
if (eq_cond->type() != Item::INT_ITEM &&
cond_list->push_front(eq_cond, thd->mem_root))
eq_cond= 0;
}
}
}
if (!eq_cond)
{
/*
We are out of memory doing the transformation.
This is a fatal error now. However we bail out by returning the
original condition that we had before we started the transformation.
*/
cond_list->append((List<Item> *) &cond_equal->current_level);
}
}
}
else if (cond->type() == Item::FUNC_ITEM &&
((Item_func*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
{
item_equal= (Item_equal *) cond;
item_equal->sort(&compare_fields_by_table_order, table_join_idx);
cond_equal= item_equal->upper_levels;
if (cond_equal && cond_equal->current_level.head() == item_equal)
cond_equal= cond_equal->upper_levels;
cond= eliminate_item_equal(thd, 0, cond_equal, item_equal);
return cond ? cond : org_cond;
}
else
{
while (cond_equal)
{
List_iterator_fast<Item_equal> it(cond_equal->current_level);
while((item_equal= it++))
{
REPLACE_EQUAL_FIELD_ARG arg= {item_equal, context_tab};
cond= cond->transform(thd, &Item::replace_equal_field, (uchar *) &arg);
}
cond_equal= cond_equal->upper_levels;
}
}
return cond;
}
| 0
|
436,097
|
static bool io_drain_req(struct io_kiocb *req)
{
struct io_kiocb *pos;
struct io_ring_ctx *ctx = req->ctx;
struct io_defer_entry *de;
int ret;
u32 seq;
/*
* If we need to drain a request in the middle of a link, drain the
* head request and the next request/link after the current link.
* Considering sequential execution of links, IOSQE_IO_DRAIN will be
* maintained for every request of our link.
*/
if (ctx->drain_next) {
req->flags |= REQ_F_IO_DRAIN;
ctx->drain_next = false;
}
/* not interested in head, start from the first linked */
io_for_each_link(pos, req->link) {
if (pos->flags & REQ_F_IO_DRAIN) {
ctx->drain_next = true;
req->flags |= REQ_F_IO_DRAIN;
break;
}
}
/* Still need defer if there is pending req in defer list. */
if (likely(list_empty_careful(&ctx->defer_list) &&
!(req->flags & REQ_F_IO_DRAIN))) {
ctx->drain_active = false;
return false;
}
seq = io_get_sequence(req);
/* Still a chance to pass the sequence check */
if (!req_need_defer(req, seq) && list_empty_careful(&ctx->defer_list))
return false;
ret = io_req_prep_async(req);
if (ret)
return ret;
io_prep_async_link(req);
de = kmalloc(sizeof(*de), GFP_KERNEL);
if (!de) {
io_req_complete_failed(req, -ENOMEM);
return true;
}
spin_lock_irq(&ctx->completion_lock);
if (!req_need_defer(req, seq) && list_empty(&ctx->defer_list)) {
spin_unlock_irq(&ctx->completion_lock);
kfree(de);
io_queue_async_work(req);
return true;
}
trace_io_uring_defer(ctx, req, req->user_data);
de->req = req;
de->seq = seq;
list_add_tail(&de->list, &ctx->defer_list);
spin_unlock_irq(&ctx->completion_lock);
return true;
| 0
|
474,084
|
cp949_is_code_ctype(OnigCodePoint code, unsigned int ctype, OnigEncoding enc)
{
return onigenc_mb2_is_code_ctype(enc, code, ctype);
}
| 0
|
202,889
|
int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)
{
u8 *tail;
int nfrags;
int esph_offset;
struct page *page;
struct sk_buff *trailer;
int tailen = esp->tailen;
if (x->encap) {
int err = esp6_output_encap(x, skb, esp);
if (err < 0)
return err;
}
if (!skb_cloned(skb)) {
if (tailen <= skb_tailroom(skb)) {
nfrags = 1;
trailer = skb;
tail = skb_tail_pointer(trailer);
goto skip_cow;
} else if ((skb_shinfo(skb)->nr_frags < MAX_SKB_FRAGS)
&& !skb_has_frag_list(skb)) {
int allocsize;
struct sock *sk = skb->sk;
struct page_frag *pfrag = &x->xfrag;
esp->inplace = false;
allocsize = ALIGN(tailen, L1_CACHE_BYTES);
spin_lock_bh(&x->lock);
if (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) {
spin_unlock_bh(&x->lock);
goto cow;
}
page = pfrag->page;
get_page(page);
tail = page_address(page) + pfrag->offset;
esp_output_fill_trailer(tail, esp->tfclen, esp->plen, esp->proto);
nfrags = skb_shinfo(skb)->nr_frags;
__skb_fill_page_desc(skb, nfrags, page, pfrag->offset,
tailen);
skb_shinfo(skb)->nr_frags = ++nfrags;
pfrag->offset = pfrag->offset + allocsize;
spin_unlock_bh(&x->lock);
nfrags++;
skb->len += tailen;
skb->data_len += tailen;
skb->truesize += tailen;
if (sk && sk_fullsock(sk))
refcount_add(tailen, &sk->sk_wmem_alloc);
goto out;
}
}
cow:
esph_offset = (unsigned char *)esp->esph - skb_transport_header(skb);
nfrags = skb_cow_data(skb, tailen, &trailer);
if (nfrags < 0)
goto out;
tail = skb_tail_pointer(trailer);
esp->esph = (struct ip_esp_hdr *)(skb_transport_header(skb) + esph_offset);
skip_cow:
esp_output_fill_trailer(tail, esp->tfclen, esp->plen, esp->proto);
pskb_put(skb, trailer, tailen);
out:
return nfrags;
}
| 1
|
395,071
|
text_to_screenline(win_T *wp, char_u *text, int col)
{
int off = (int)(current_ScreenLine - ScreenLines);
if (has_mbyte)
{
int cells;
int u8c, u8cc[MAX_MCO];
int i;
int idx;
int c_len;
char_u *p;
# ifdef FEAT_ARABIC
int prev_c = 0; // previous Arabic character
int prev_c1 = 0; // first composing char for prev_c
# endif
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
idx = off;
else
# endif
idx = off + col;
// Store multibyte characters in ScreenLines[] et al. correctly.
for (p = text; *p != NUL; )
{
cells = (*mb_ptr2cells)(p);
c_len = (*mb_ptr2len)(p);
if (col + cells > wp->w_width
# ifdef FEAT_RIGHTLEFT
- (wp->w_p_rl ? col : 0)
# endif
)
break;
ScreenLines[idx] = *p;
if (enc_utf8)
{
u8c = utfc_ptr2char(p, u8cc);
if (*p < 0x80 && u8cc[0] == 0)
{
ScreenLinesUC[idx] = 0;
#ifdef FEAT_ARABIC
prev_c = u8c;
#endif
}
else
{
#ifdef FEAT_ARABIC
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
{
// Do Arabic shaping.
int pc, pc1, nc;
int pcc[MAX_MCO];
int firstbyte = *p;
// The idea of what is the previous and next
// character depends on 'rightleft'.
if (wp->w_p_rl)
{
pc = prev_c;
pc1 = prev_c1;
nc = utf_ptr2char(p + c_len);
prev_c1 = u8cc[0];
}
else
{
pc = utfc_ptr2char(p + c_len, pcc);
nc = prev_c;
pc1 = pcc[0];
}
prev_c = u8c;
u8c = arabic_shape(u8c, &firstbyte, &u8cc[0],
pc, pc1, nc);
ScreenLines[idx] = firstbyte;
}
else
prev_c = u8c;
#endif
// Non-BMP character: display as ? or fullwidth ?.
ScreenLinesUC[idx] = u8c;
for (i = 0; i < Screen_mco; ++i)
{
ScreenLinesC[i][idx] = u8cc[i];
if (u8cc[i] == 0)
break;
}
}
if (cells > 1)
ScreenLines[idx + 1] = 0;
}
else if (enc_dbcs == DBCS_JPNU && *p == 0x8e)
// double-byte single width character
ScreenLines2[idx] = p[1];
else if (cells > 1)
// double-width character
ScreenLines[idx + 1] = p[1];
col += cells;
idx += cells;
p += c_len;
}
}
else
{
int len = (int)STRLEN(text);
if (len > wp->w_width - col)
len = wp->w_width - col;
if (len > 0)
{
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
mch_memmove(current_ScreenLine, text, len);
else
#endif
mch_memmove(current_ScreenLine + col, text, len);
col += len;
}
}
return col;
}
| 0
|
441,828
|
SProcXkbDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_kbUseExtension:
return SProcXkbUseExtension(client);
case X_kbSelectEvents:
return SProcXkbSelectEvents(client);
case X_kbBell:
return SProcXkbBell(client);
case X_kbGetState:
return SProcXkbGetState(client);
case X_kbLatchLockState:
return SProcXkbLatchLockState(client);
case X_kbGetControls:
return SProcXkbGetControls(client);
case X_kbSetControls:
return SProcXkbSetControls(client);
case X_kbGetMap:
return SProcXkbGetMap(client);
case X_kbSetMap:
return SProcXkbSetMap(client);
case X_kbGetCompatMap:
return SProcXkbGetCompatMap(client);
case X_kbSetCompatMap:
return SProcXkbSetCompatMap(client);
case X_kbGetIndicatorState:
return SProcXkbGetIndicatorState(client);
case X_kbGetIndicatorMap:
return SProcXkbGetIndicatorMap(client);
case X_kbSetIndicatorMap:
return SProcXkbSetIndicatorMap(client);
case X_kbGetNamedIndicator:
return SProcXkbGetNamedIndicator(client);
case X_kbSetNamedIndicator:
return SProcXkbSetNamedIndicator(client);
case X_kbGetNames:
return SProcXkbGetNames(client);
case X_kbSetNames:
return SProcXkbSetNames(client);
case X_kbGetGeometry:
return SProcXkbGetGeometry(client);
case X_kbSetGeometry:
return SProcXkbSetGeometry(client);
case X_kbPerClientFlags:
return SProcXkbPerClientFlags(client);
case X_kbListComponents:
return SProcXkbListComponents(client);
case X_kbGetKbdByName:
return SProcXkbGetKbdByName(client);
case X_kbGetDeviceInfo:
return SProcXkbGetDeviceInfo(client);
case X_kbSetDeviceInfo:
return SProcXkbSetDeviceInfo(client);
case X_kbSetDebuggingFlags:
return SProcXkbSetDebuggingFlags(client);
default:
return BadRequest;
}
}
| 0
|
498,085
|
void cgit_tag_link(const char *name, const char *title, const char *class,
const char *tag)
{
reporevlink("tag", name, title, class, tag, NULL, NULL);
}
| 0
|
439,074
|
ModuleExport size_t RegisterRLEImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("RLE");
entry->decoder=(DecodeImageHandler *) ReadRLEImage;
entry->magick=(IsImageFormatHandler *) IsRLE;
entry->seekable_stream=MagickTrue;
entry->adjoin=MagickFalse;
entry->description=ConstantString("Utah Run length encoded image");
entry->module=ConstantString("RLE");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
| 0
|
234,756
|
void btrfs_rm_dev_replace_free_srcdev(struct btrfs_device *srcdev)
{
struct btrfs_fs_devices *fs_devices = srcdev->fs_devices;
mutex_lock(&uuid_mutex);
btrfs_close_bdev(srcdev);
synchronize_rcu();
btrfs_free_device(srcdev);
/* if this is no devs we rather delete the fs_devices */
if (!fs_devices->num_devices) {
/*
* On a mounted FS, num_devices can't be zero unless it's a
* seed. In case of a seed device being replaced, the replace
* target added to the sprout FS, so there will be no more
* device left under the seed FS.
*/
ASSERT(fs_devices->seeding);
list_del_init(&fs_devices->seed_list);
close_fs_devices(fs_devices);
free_fs_devices(fs_devices);
}
mutex_unlock(&uuid_mutex);
}
| 0
|
219,947
|
int callback_glewlwyd_user_auth (const struct _u_request * request, struct _u_response * response, void * user_data) {
struct config_elements * config = (struct config_elements *)user_data;
json_t * j_param = ulfius_get_json_body_request(request, NULL), * j_result = NULL;
const char * ip_source = get_ip_source(request);
char * issued_for = get_client_hostname(request);
char * session_uid, expires[129];
time_t now;
struct tm ts;
time(&now);
now += GLEWLWYD_DEFAULT_SESSION_EXPIRATION_COOKIE;
gmtime_r(&now, &ts);
strftime(expires, 128, "%a, %d %b %Y %T %Z", &ts);
if (j_param != NULL) {
if (json_string_length(json_object_get(j_param, "username"))) {
if (json_object_get(j_param, "scheme_type") == NULL || 0 == o_strcmp(json_string_value(json_object_get(j_param, "scheme_type")), "password")) {
if (json_string_length(json_object_get(j_param, "password"))) {
j_result = auth_check_user_credentials(config, json_string_value(json_object_get(j_param, "username")), json_string_value(json_object_get(j_param, "password")));
if (check_result_value(j_result, G_OK)) {
if ((session_uid = get_session_id(config, request)) == NULL) {
session_uid = generate_session_id();
}
if (user_session_update(config, session_uid, u_map_get_case(request->map_header, "user-agent"), issued_for, json_string_value(json_object_get(j_param, "username")), NULL, 1) != G_OK) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_user_auth - Error user_session_update (1)");
response->status = 500;
} else {
ulfius_add_cookie_to_response(response, config->session_key, session_uid, expires, 0, config->cookie_domain, "/", config->cookie_secure, 0);
y_log_message(Y_LOG_LEVEL_INFO, "Event - User '%s' authenticated with password", json_string_value(json_object_get(j_param, "username")));
}
o_free(session_uid);
glewlwyd_metrics_increment_counter_va(config, GLWD_METRICS_AUTH_USER_VALID, 1, NULL);
glewlwyd_metrics_increment_counter_va(config, GLWD_METRICS_AUTH_USER_VALID_SCHEME, 1, "scheme_type", "password", NULL);
} else {
if (check_result_value(j_result, G_ERROR_UNAUTHORIZED)) {
y_log_message(Y_LOG_LEVEL_WARNING, "Security - Authorization invalid for username %s at IP Address %s", json_string_value(json_object_get(j_param, "username")), ip_source);
}
response->status = 401;
glewlwyd_metrics_increment_counter_va(config, GLWD_METRICS_AUTH_USER_INVALID, 1, NULL);
glewlwyd_metrics_increment_counter_va(config, GLWD_METRICS_AUTH_USER_INVALID_SCHEME, 1, "scheme_type", "password", NULL);
}
json_decref(j_result);
} else if (json_object_get(j_param, "password") != NULL && !json_is_string(json_object_get(j_param, "password"))) {
ulfius_set_string_body_response(response, 400, "password must be a string");
} else {
session_uid = get_session_id(config, request);
j_result = get_users_for_session(config, session_uid);
if (check_result_value(j_result, G_OK)) {
// Refresh username to set as default
if (user_session_update(config, u_map_get(request->map_cookie, config->session_key), u_map_get_case(request->map_header, "user-agent"), issued_for, json_string_value(json_object_get(j_param, "username")), NULL, 0) != G_OK) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_user_auth - Error user_session_update (3)");
response->status = 500;
} else {
ulfius_add_cookie_to_response(response, config->session_key, session_uid, expires, 0, config->cookie_domain, "/", config->cookie_secure, 0);
}
} else if (check_result_value(j_result, G_ERROR_NOT_FOUND)) {
response->status = 401;
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_user_auth - Error get_users_for_session");
response->status = 500;
}
o_free(session_uid);
json_decref(j_result);
}
} else {
if (json_string_length(json_object_get(j_param, "scheme_type")) && json_string_length(json_object_get(j_param, "scheme_name")) && json_is_object(json_object_get(j_param, "value"))) {
j_result = auth_check_user_scheme(config, json_string_value(json_object_get(j_param, "scheme_type")), json_string_value(json_object_get(j_param, "scheme_name")), json_string_value(json_object_get(j_param, "username")), json_object_get(j_param, "value"), request);
if (check_result_value(j_result, G_ERROR_PARAM)) {
ulfius_set_string_body_response(response, 400, "bad scheme response");
} else if (check_result_value(j_result, G_ERROR_UNAUTHORIZED)) {
y_log_message(Y_LOG_LEVEL_WARNING, "Security - Authorization invalid for username %s at IP Address %s", json_string_value(json_object_get(j_param, "username")), ip_source);
response->status = 401;
glewlwyd_metrics_increment_counter_va(config, GLWD_METRICS_AUTH_USER_INVALID, 1, NULL);
glewlwyd_metrics_increment_counter_va(config, GLWD_METRICS_AUTH_USER_INVALID_SCHEME, 1, "scheme_type", json_string_value(json_object_get(j_param, "scheme_type")), "scheme_name", json_string_value(json_object_get(j_param, "scheme_name")), NULL);
} else if (check_result_value(j_result, G_ERROR_NOT_FOUND)) {
response->status = 404;
} else if (check_result_value(j_result, G_OK)) {
if ((session_uid = get_session_id(config, request)) == NULL) {
session_uid = generate_session_id();
}
if (user_session_update(config, session_uid, u_map_get_case(request->map_header, "user-agent"), issued_for, json_string_value(json_object_get(j_param, "username")), json_string_value(json_object_get(j_param, "scheme_name")), 1) != G_OK) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_user_auth - Error user_session_update (4)");
response->status = 500;
} else {
ulfius_add_cookie_to_response(response, config->session_key, session_uid, expires, 0, config->cookie_domain, "/", config->cookie_secure, 0);
y_log_message(Y_LOG_LEVEL_INFO, "Event - User '%s' authenticated with scheme '%s/%s'", json_string_value(json_object_get(j_param, "username")), json_string_value(json_object_get(j_param, "scheme_type")), json_string_value(json_object_get(j_param, "scheme_name")));
}
o_free(session_uid);
glewlwyd_metrics_increment_counter_va(config, GLWD_METRICS_AUTH_USER_VALID, 1, NULL);
glewlwyd_metrics_increment_counter_va(config, GLWD_METRICS_AUTH_USER_VALID_SCHEME, 1, "scheme_type", json_string_value(json_object_get(j_param, "scheme_type")), "scheme_name", json_string_value(json_object_get(j_param, "scheme_name")), NULL);
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_user_auth - Error auth_check_user_scheme");
response->status = 500;
}
json_decref(j_result);
} else {
ulfius_set_string_body_response(response, 400, "scheme_type, scheme_name and value are mandatory");
}
}
} else {
if (json_string_length(json_object_get(j_param, "scheme_type")) && json_string_length(json_object_get(j_param, "scheme_name")) && json_is_object(json_object_get(j_param, "value"))) {
j_result = auth_check_identify_scheme(config, json_string_value(json_object_get(j_param, "scheme_type")), json_string_value(json_object_get(j_param, "scheme_name")), json_object_get(j_param, "value"), request);
if (check_result_value(j_result, G_ERROR_PARAM)) {
ulfius_set_string_body_response(response, 400, "bad scheme response");
} else if (check_result_value(j_result, G_ERROR_UNAUTHORIZED)) {
y_log_message(Y_LOG_LEVEL_WARNING, "Security - Authorization invalid for username <UNKNOWN> at IP Address %s", ip_source);
response->status = 401;
} else if (check_result_value(j_result, G_ERROR_NOT_FOUND)) {
response->status = 404;
} else if (check_result_value(j_result, G_OK)) {
if ((session_uid = get_session_id(config, request)) == NULL) {
session_uid = generate_session_id();
}
if (user_session_update(config, session_uid, u_map_get_case(request->map_header, "user-agent"), issued_for, json_string_value(json_object_get(j_result, "username")), json_string_value(json_object_get(j_param, "scheme_name")), 1) != G_OK) {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_user_auth - Error user_session_update (4)");
response->status = 500;
} else {
ulfius_add_cookie_to_response(response, config->session_key, session_uid, expires, 0, config->cookie_domain, "/", config->cookie_secure, 0);
y_log_message(Y_LOG_LEVEL_INFO, "Event - User '%s' authenticated with scheme '%s/%s'", json_string_value(json_object_get(j_result, "username")), json_string_value(json_object_get(j_param, "scheme_type")), json_string_value(json_object_get(j_param, "scheme_name")));
}
o_free(session_uid);
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_user_auth - Error auth_check_user_scheme");
response->status = 500;
}
json_decref(j_result);
} else {
ulfius_set_string_body_response(response, 400, "username is mandatory");
}
}
} else {
ulfius_set_string_body_response(response, 400, "Input parameters must be in JSON format");
}
json_decref(j_param);
o_free(issued_for);
return U_CALLBACK_CONTINUE;
}
| 0
|
521,481
|
ZipInputStream (ZipFile& zf, const ZipFile::ZipEntryHolder& zei)
: file (zf),
zipEntryHolder (zei),
inputStream (zf.inputStream)
{
if (zf.inputSource != nullptr)
{
streamToDelete.reset (file.inputSource->createInputStream());
inputStream = streamToDelete.get();
}
else
{
#if JUCE_DEBUG
zf.streamCounter.numOpenStreams++;
#endif
}
char buffer[30];
if (inputStream != nullptr
&& inputStream->setPosition (zei.streamOffset)
&& inputStream->read (buffer, 30) == 30
&& ByteOrder::littleEndianInt (buffer) == 0x04034b50)
{
headerSize = 30 + ByteOrder::littleEndianShort (buffer + 26)
+ ByteOrder::littleEndianShort (buffer + 28);
}
}
| 0
|
292,217
|
is_hilight (char *from, char *text, session *sess, server *serv)
{
if (alert_match_word (from, prefs.hex_irc_no_hilight))
return 0;
text = strip_color (text, -1, STRIP_ALL);
if (alert_match_text (text, serv->nick) ||
alert_match_text (text, prefs.hex_irc_extra_hilight) ||
alert_match_word (from, prefs.hex_irc_nick_hilight))
{
g_free (text);
if (sess != current_tab)
{
sess->nick_said = TRUE;
lastact_update (sess);
}
fe_set_hilight (sess);
return 1;
}
g_free (text);
return 0;
}
| 0
|
238,607
|
static bool signed_sub32_overflows(s32 a, s32 b)
{
/* Do the sub in u32, where overflow is well-defined */
s32 res = (s32)((u32)a - (u32)b);
if (b < 0)
return res < a;
return res > a;
}
| 0
|
437,309
|
alt_merge_opt_exact(OptExact* to, OptExact* add, OptEnv* env)
{
int i, j, len;
if (add->len == 0 || to->len == 0) {
clear_opt_exact(to);
return ;
}
if (! is_equal_mml(&to->mmd, &add->mmd)) {
clear_opt_exact(to);
return ;
}
for (i = 0; i < to->len && i < add->len; ) {
if (to->s[i] != add->s[i]) break;
len = enclen(env->enc, to->s + i);
for (j = 1; j < len; j++) {
if (to->s[i+j] != add->s[i+j]) break;
}
if (j < len) break;
i += len;
}
if (! add->reach_end || i < add->len || i < to->len) {
to->reach_end = 0;
}
to->len = i;
to->ignore_case |= add->ignore_case;
alt_merge_opt_anc_info(&to->anc, &add->anc);
if (! to->reach_end) to->anc.right = 0;
}
| 0
|
90,872
|
int additional_callback_count() const { return additional_callback_count_; }
| 0
|
309,882
|
spush(char *x)
{
if (TPS(stack_ptr) < STACKSIZE) {
TPS(stack)[TPS(stack_ptr)].num_type = FALSE;
TPS(stack)[TPS(stack_ptr)].data.str = x;
TPS(stack_ptr)++;
} else {
DEBUG(2, ("spush: stack overflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
}
| 0
|
200,672
|
static void sdhci_do_adma(SDHCIState *s)
{
unsigned int begin, length;
const uint16_t block_size = s->blksize & BLOCK_SIZE_MASK;
ADMADescr dscr = {};
int i;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN && !s->blkcnt) {
/* Stop Multiple Transfer */
sdhci_end_transfer(s);
return;
}
for (i = 0; i < SDHC_ADMA_DESCS_PER_DELAY; ++i) {
s->admaerr &= ~SDHC_ADMAERR_LENGTH_MISMATCH;
get_adma_description(s, &dscr);
trace_sdhci_adma_loop(dscr.addr, dscr.length, dscr.attr);
if ((dscr.attr & SDHC_ADMA_ATTR_VALID) == 0) {
/* Indicate that error occurred in ST_FDS state */
s->admaerr &= ~SDHC_ADMAERR_STATE_MASK;
s->admaerr |= SDHC_ADMAERR_STATE_ST_FDS;
/* Generate ADMA error interrupt */
if (s->errintstsen & SDHC_EISEN_ADMAERR) {
s->errintsts |= SDHC_EIS_ADMAERR;
s->norintsts |= SDHC_NIS_ERR;
}
sdhci_update_irq(s);
return;
}
length = dscr.length ? dscr.length : 64 * KiB;
switch (dscr.attr & SDHC_ADMA_ATTR_ACT_MASK) {
case SDHC_ADMA_ATTR_ACT_TRAN: /* data transfer */
if (s->trnmod & SDHC_TRNS_READ) {
while (length) {
if (s->data_count == 0) {
sdbus_read_data(&s->sdbus, s->fifo_buffer, block_size);
}
begin = s->data_count;
if ((length + begin) < block_size) {
s->data_count = length + begin;
length = 0;
} else {
s->data_count = block_size;
length -= block_size - begin;
}
dma_memory_write(s->dma_as, dscr.addr,
&s->fifo_buffer[begin],
s->data_count - begin);
dscr.addr += s->data_count - begin;
if (s->data_count == block_size) {
s->data_count = 0;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
if (s->blkcnt == 0) {
break;
}
}
}
}
} else {
while (length) {
begin = s->data_count;
if ((length + begin) < block_size) {
s->data_count = length + begin;
length = 0;
} else {
s->data_count = block_size;
length -= block_size - begin;
}
dma_memory_read(s->dma_as, dscr.addr,
&s->fifo_buffer[begin],
s->data_count - begin);
dscr.addr += s->data_count - begin;
if (s->data_count == block_size) {
sdbus_write_data(&s->sdbus, s->fifo_buffer, block_size);
s->data_count = 0;
if (s->trnmod & SDHC_TRNS_BLK_CNT_EN) {
s->blkcnt--;
if (s->blkcnt == 0) {
break;
}
}
}
}
}
s->admasysaddr += dscr.incr;
break;
case SDHC_ADMA_ATTR_ACT_LINK: /* link to next descriptor table */
s->admasysaddr = dscr.addr;
trace_sdhci_adma("link", s->admasysaddr);
break;
default:
s->admasysaddr += dscr.incr;
break;
}
if (dscr.attr & SDHC_ADMA_ATTR_INT) {
trace_sdhci_adma("interrupt", s->admasysaddr);
if (s->norintstsen & SDHC_NISEN_DMA) {
s->norintsts |= SDHC_NIS_DMA;
}
if (sdhci_update_irq(s) && !(dscr.attr & SDHC_ADMA_ATTR_END)) {
/* IRQ delivered, reschedule current transfer */
break;
}
}
/* ADMA transfer terminates if blkcnt == 0 or by END attribute */
if (((s->trnmod & SDHC_TRNS_BLK_CNT_EN) &&
(s->blkcnt == 0)) || (dscr.attr & SDHC_ADMA_ATTR_END)) {
trace_sdhci_adma_transfer_completed();
if (length || ((dscr.attr & SDHC_ADMA_ATTR_END) &&
(s->trnmod & SDHC_TRNS_BLK_CNT_EN) &&
s->blkcnt != 0)) {
trace_sdhci_error("SD/MMC host ADMA length mismatch");
s->admaerr |= SDHC_ADMAERR_LENGTH_MISMATCH |
SDHC_ADMAERR_STATE_ST_TFR;
if (s->errintstsen & SDHC_EISEN_ADMAERR) {
trace_sdhci_error("Set ADMA error flag");
s->errintsts |= SDHC_EIS_ADMAERR;
s->norintsts |= SDHC_NIS_ERR;
}
sdhci_update_irq(s);
}
sdhci_end_transfer(s);
return;
}
}
/* we have unfinished business - reschedule to continue ADMA */
timer_mod(s->transfer_timer,
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_TRANSFER_DELAY);
}
| 1
|
349,872
|
static int aq_fw1x_set_wake_magic(struct aq_hw_s *self, bool wol_enabled,
const u8 *mac)
{
struct hw_atl_utils_fw_rpc *prpc = NULL;
unsigned int rpc_size = 0U;
int err = 0;
err = hw_atl_utils_fw_rpc_wait(self, &prpc);
if (err < 0)
goto err_exit;
memset(prpc, 0, sizeof(*prpc));
if (wol_enabled) {
rpc_size = offsetof(struct hw_atl_utils_fw_rpc, msg_wol_add) +
sizeof(prpc->msg_wol_add);
prpc->msg_id = HAL_ATLANTIC_UTILS_FW_MSG_WOL_ADD;
prpc->msg_wol_add.priority =
HAL_ATLANTIC_UTILS_FW_MSG_WOL_PRIOR;
prpc->msg_wol_add.pattern_id =
HAL_ATLANTIC_UTILS_FW_MSG_WOL_PATTERN;
prpc->msg_wol_add.packet_type =
HAL_ATLANTIC_UTILS_FW_MSG_WOL_MAG_PKT;
ether_addr_copy((u8 *)&prpc->msg_wol_add.magic_packet_pattern,
mac);
} else {
rpc_size = sizeof(prpc->msg_wol_remove) +
offsetof(struct hw_atl_utils_fw_rpc, msg_wol_remove);
prpc->msg_id = HAL_ATLANTIC_UTILS_FW_MSG_WOL_DEL;
prpc->msg_wol_add.pattern_id =
HAL_ATLANTIC_UTILS_FW_MSG_WOL_PATTERN;
}
err = hw_atl_utils_fw_rpc_call(self, rpc_size);
err_exit:
return err;
}
| 0
|
225,019
|
connectDBComplete(PGconn *conn)
{
PostgresPollingStatusType flag = PGRES_POLLING_WRITING;
time_t finish_time = ((time_t) -1);
int timeout = 0;
int last_whichhost = -2; /* certainly different from whichhost */
struct addrinfo *last_addr_cur = NULL;
if (conn == NULL || conn->status == CONNECTION_BAD)
return 0;
/*
* Set up a time limit, if connect_timeout isn't zero.
*/
if (conn->connect_timeout != NULL)
{
if (!parse_int_param(conn->connect_timeout, &timeout, conn,
"connect_timeout"))
{
/* mark the connection as bad to report the parsing failure */
conn->status = CONNECTION_BAD;
return 0;
}
if (timeout > 0)
{
/*
* Rounding could cause connection to fail unexpectedly quickly;
* to prevent possibly waiting hardly-at-all, insist on at least
* two seconds.
*/
if (timeout < 2)
timeout = 2;
}
else /* negative means 0 */
timeout = 0;
}
for (;;)
{
int ret = 0;
/*
* (Re)start the connect_timeout timer if it's active and we are
* considering a different host than we were last time through. If
* we've already succeeded, though, needn't recalculate.
*/
if (flag != PGRES_POLLING_OK &&
timeout > 0 &&
(conn->whichhost != last_whichhost ||
conn->addr_cur != last_addr_cur))
{
finish_time = time(NULL) + timeout;
last_whichhost = conn->whichhost;
last_addr_cur = conn->addr_cur;
}
/*
* Wait, if necessary. Note that the initial state (just after
* PQconnectStart) is to wait for the socket to select for writing.
*/
switch (flag)
{
case PGRES_POLLING_OK:
return 1; /* success! */
case PGRES_POLLING_READING:
ret = pqWaitTimed(1, 0, conn, finish_time);
if (ret == -1)
{
/* hard failure, eg select() problem, aborts everything */
conn->status = CONNECTION_BAD;
return 0;
}
break;
case PGRES_POLLING_WRITING:
ret = pqWaitTimed(0, 1, conn, finish_time);
if (ret == -1)
{
/* hard failure, eg select() problem, aborts everything */
conn->status = CONNECTION_BAD;
return 0;
}
break;
default:
/* Just in case we failed to set it in PQconnectPoll */
conn->status = CONNECTION_BAD;
return 0;
}
if (ret == 1) /* connect_timeout elapsed */
{
/*
* Give up on current server/address, try the next one.
*/
conn->try_next_addr = true;
conn->status = CONNECTION_NEEDED;
}
/*
* Now try to advance the state machine.
*/
flag = PQconnectPoll(conn);
}
}
| 0
|
364,758
|
taglen_advance(int l)
{
if (l == MAXCOL)
{
msg_putchar('\n');
msg_advance(24);
}
else
msg_advance(13 + l);
}
| 0
|
281,150
|
static inline int secpath_has_nontransport(const struct sec_path *sp, int k, int *idxp)
{
for (; k < sp->len; k++) {
if (sp->xvec[k]->props.mode != XFRM_MODE_TRANSPORT) {
*idxp = k;
return 1;
}
}
return 0;
}
| 0
|
516,258
|
static int peer_attach(VirtIONet *n, int index)
{
NetClientState *nc = qemu_get_subqueue(n->nic, index);
if (!nc->peer) {
return 0;
}
if (nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
vhost_set_vring_enable(nc->peer, 1);
}
if (nc->peer->info->type != NET_CLIENT_DRIVER_TAP) {
return 0;
}
if (n->max_queues == 1) {
return 0;
}
return tap_enable(nc->peer);
}
| 0
|
256,987
|
route4_reset_fastmap(struct route4_head *head)
{
spin_lock_bh(&fastmap_lock);
memset(head->fastmap, 0, sizeof(head->fastmap));
spin_unlock_bh(&fastmap_lock);
}
| 0
|
450,771
|
re_mult_next(char *what)
{
if (re_multi_type(peekchr()) == MULTI_MULT)
{
semsg(_("E888: (NFA regexp) cannot repeat %s"), what);
rc_did_emsg = TRUE;
return FAIL;
}
return OK;
}
| 0
|
196,860
|
GF_Err afra_box_read(GF_Box *s, GF_BitStream *bs)
{
unsigned int i;
GF_AdobeFragRandomAccessBox *ptr = (GF_AdobeFragRandomAccessBox *)s;
ISOM_DECREASE_SIZE(ptr, 9)
ptr->long_ids = gf_bs_read_int(bs, 1);
ptr->long_offsets = gf_bs_read_int(bs, 1);
ptr->global_entries = gf_bs_read_int(bs, 1);
ptr->reserved = gf_bs_read_int(bs, 5);
ptr->time_scale = gf_bs_read_u32(bs);
ptr->entry_count = gf_bs_read_u32(bs);
if (ptr->size / ( (ptr->long_offsets ? 16 : 12) ) < ptr->entry_count)
return GF_ISOM_INVALID_FILE;
for (i=0; i<ptr->entry_count; i++) {
GF_AfraEntry *ae = gf_malloc(sizeof(GF_AfraEntry));
if (!ae) return GF_OUT_OF_MEM;
ISOM_DECREASE_SIZE(ptr, 8)
ae->time = gf_bs_read_u64(bs);
if (ptr->long_offsets) {
ISOM_DECREASE_SIZE(ptr, 8)
ae->offset = gf_bs_read_u64(bs);
} else {
ISOM_DECREASE_SIZE(ptr, 4)
ae->offset = gf_bs_read_u32(bs);
}
gf_list_insert(ptr->local_access_entries, ae, i);
}
if (ptr->global_entries) {
ISOM_DECREASE_SIZE(ptr, 4)
ptr->global_entry_count = gf_bs_read_u32(bs);
for (i=0; i<ptr->global_entry_count; i++) {
GF_GlobalAfraEntry *ae = gf_malloc(sizeof(GF_GlobalAfraEntry));
if (!ae) return GF_OUT_OF_MEM;
ISOM_DECREASE_SIZE(ptr, 8)
ae->time = gf_bs_read_u64(bs);
if (ptr->long_ids) {
ISOM_DECREASE_SIZE(ptr, 8)
ae->segment = gf_bs_read_u32(bs);
ae->fragment = gf_bs_read_u32(bs);
} else {
ISOM_DECREASE_SIZE(ptr, 4)
ae->segment = gf_bs_read_u16(bs);
ae->fragment = gf_bs_read_u16(bs);
}
if (ptr->long_offsets) {
ISOM_DECREASE_SIZE(ptr, 16)
ae->afra_offset = gf_bs_read_u64(bs);
ae->offset_from_afra = gf_bs_read_u64(bs);
} else {
ISOM_DECREASE_SIZE(ptr, 8)
ae->afra_offset = gf_bs_read_u32(bs);
ae->offset_from_afra = gf_bs_read_u32(bs);
}
gf_list_insert(ptr->global_access_entries, ae, i);
}
}
return GF_OK;
}
| 1
|
276,907
|
static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
uint chip;
uint devaddr, length;
uint alen;
u_char *memaddr;
int ret;
#if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *dev;
struct dm_i2c_chip *i2c_chip;
#endif
if ((argc < 5) || (argc > 6))
return cmd_usage(cmdtp);
/*
* memaddr is the address where to store things in memory
*/
memaddr = (u_char *)hextoul(argv[1], NULL);
/*
* I2C chip address
*/
chip = hextoul(argv[2], NULL);
/*
* I2C data address within the chip. This can be 1 or
* 2 bytes long. Some day it might be 3 bytes long :-).
*/
devaddr = hextoul(argv[3], NULL);
alen = get_alen(argv[3], DEFAULT_ADDR_LEN);
if (alen > 3)
return cmd_usage(cmdtp);
/*
* Length is the number of bytes.
*/
length = hextoul(argv[4], NULL);
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
if (!ret && alen != -1)
ret = i2c_set_chip_offset_len(dev, alen);
if (ret)
return i2c_report_err(ret, I2C_ERR_WRITE);
i2c_chip = dev_get_parent_plat(dev);
if (!i2c_chip)
return i2c_report_err(ret, I2C_ERR_WRITE);
#endif
if (argc == 6 && !strcmp(argv[5], "-s")) {
/*
* Write all bytes in a single I2C transaction. If the target
* device is an EEPROM, it is your responsibility to not cross
* a page boundary. No write delay upon completion, take this
* into account if linking commands.
*/
#if CONFIG_IS_ENABLED(DM_I2C)
i2c_chip->flags &= ~DM_I2C_CHIP_WR_ADDRESS;
ret = dm_i2c_write(dev, devaddr, memaddr, length);
#else
ret = i2c_write(chip, devaddr, alen, memaddr, length);
#endif
if (ret)
return i2c_report_err(ret, I2C_ERR_WRITE);
} else {
/*
* Repeated addressing - perform <length> separate
* write transactions of one byte each
*/
while (length-- > 0) {
#if CONFIG_IS_ENABLED(DM_I2C)
i2c_chip->flags |= DM_I2C_CHIP_WR_ADDRESS;
ret = dm_i2c_write(dev, devaddr++, memaddr++, 1);
#else
ret = i2c_write(chip, devaddr++, alen, memaddr++, 1);
#endif
if (ret)
return i2c_report_err(ret, I2C_ERR_WRITE);
/*
* No write delay with FRAM devices.
*/
#if !defined(CONFIG_SYS_I2C_FRAM)
udelay(11000);
#endif
}
}
return 0;
}
| 0
|
317,371
|
static int may_context_mount_inode_relabel(u32 sid,
struct superblock_security_struct *sbsec,
const struct cred *cred)
{
const struct task_security_struct *tsec = selinux_cred(cred);
int rc;
rc = avc_has_perm(&selinux_state,
tsec->sid, sbsec->sid, SECCLASS_FILESYSTEM,
FILESYSTEM__RELABELFROM, NULL);
if (rc)
return rc;
rc = avc_has_perm(&selinux_state,
sid, sbsec->sid, SECCLASS_FILESYSTEM,
FILESYSTEM__ASSOCIATE, NULL);
return rc;
}
| 0
|
262,001
|
static void *conncache_add_bundle(struct conncache *connc,
char *key,
struct connectbundle *bundle)
{
return Curl_hash_add(&connc->hash, key, strlen(key), bundle);
}
| 0
|
343,237
|
void die_mem(void)
{
die(421, LOG_ERR, MSG_OUT_OF_MEMORY);
}
| 0
|
356,175
|
void fs_machineid(void) {
union machineid_t {
uint8_t u8[16];
uint32_t u32[4];
} mid;
// if --machine-id flag is inactive, do nothing
if (arg_machineid == 0)
return;
if (arg_debug)
printf("Generating a new machine-id\n");
// init random number generator
srand(time(NULL));
// generate random id
mid.u32[0] = rand();
mid.u32[1] = rand();
mid.u32[2] = rand();
mid.u32[3] = rand();
// UUID version 4 and DCE variant
mid.u8[6] = (mid.u8[6] & 0x0F) | 0x40;
mid.u8[8] = (mid.u8[8] & 0x3F) | 0x80;
// write it in a file
FILE *fp = fopen(RUN_MACHINEID, "we");
if (!fp)
errExit("fopen");
fprintf(fp, "%08x%08x%08x%08x\n", mid.u32[0], mid.u32[1], mid.u32[2], mid.u32[3]);
fclose(fp);
if (set_perms(RUN_MACHINEID, 0, 0, 0444))
errExit("set_perms");
selinux_relabel_path(RUN_MACHINEID, "/etc/machine-id");
struct stat s;
if (stat("/etc/machine-id", &s) == 0) {
if (arg_debug)
printf("installing a new /etc/machine-id\n");
if (mount(RUN_MACHINEID, "/etc/machine-id", "none", MS_BIND, "mode=444,gid=0"))
errExit("mount");
}
if (stat("/var/lib/dbus/machine-id", &s) == 0) {
if (mount(RUN_MACHINEID, "/var/lib/dbus/machine-id", "none", MS_BIND, "mode=444,gid=0"))
errExit("mount");
}
}
| 0
|
195,017
|
u32 GetHintFormat(GF_TrackBox *trak)
{
GF_HintMediaHeaderBox *hmhd = (GF_HintMediaHeaderBox *)trak->Media->information->InfoHeader;
if (hmhd->type != GF_ISOM_BOX_TYPE_HMHD)
return 0;
if (!hmhd || !hmhd->subType) {
GF_Box *a = (GF_Box *)gf_list_get(trak->Media->information->sampleTable->SampleDescription->child_boxes, 0);
if (!hmhd) return a ? a->type : 0;
if (a) hmhd->subType = a->type;
return hmhd->subType;
}
return hmhd->subType;
}
| 1
|
289,299
|
static int snd_pcm_oss_get_active_substream(struct snd_pcm_oss_file *pcm_oss_file, struct snd_pcm_substream **r_substream)
{
int idx, err;
struct snd_pcm_substream *asubstream = NULL, *substream;
for (idx = 0; idx < 2; idx++) {
substream = pcm_oss_file->streams[idx];
if (substream == NULL)
continue;
if (asubstream == NULL)
asubstream = substream;
if (substream->runtime->oss.params) {
err = snd_pcm_oss_change_params(substream, false);
if (err < 0)
return err;
}
}
if (!asubstream)
return -EIO;
if (r_substream)
*r_substream = asubstream;
return 0;
}
| 0
|
244,056
|
GF_Box *dfla_box_new()
{
ISOM_DECL_BOX_ALLOC(GF_FLACConfigBox, GF_ISOM_BOX_TYPE_DFLA);
return (GF_Box *)tmp;
}
| 0
|
229,182
|
static void flush_queued_data_bh(void *opaque)
{
VirtIOSerialPort *port = opaque;
flush_queued_data(port);
}
| 0
|
234,241
|
display_debug_pubnames_worker (struct dwarf_section *section,
void *file ATTRIBUTE_UNUSED,
int is_gnu)
{
DWARF2_Internal_PubNames names;
unsigned char *start = section->start;
unsigned char *end = start + section->size;
/* It does not matter if this load fails,
we test for that later on. */
load_debug_info (file);
introduce (section, false);
while (start < end)
{
unsigned char *data;
unsigned long sec_off = start - section->start;
unsigned int offset_size;
SAFE_BYTE_GET_AND_INC (names.pn_length, start, 4, end);
if (names.pn_length == 0xffffffff)
{
SAFE_BYTE_GET_AND_INC (names.pn_length, start, 8, end);
offset_size = 8;
}
else
offset_size = 4;
if (names.pn_length > (size_t) (end - start))
{
warn (_("Debug info is corrupted, %s header at %#lx has length %s\n"),
section->name,
sec_off,
dwarf_vmatoa ("x", names.pn_length));
break;
}
data = start;
start += names.pn_length;
SAFE_BYTE_GET_AND_INC (names.pn_version, data, 2, start);
SAFE_BYTE_GET_AND_INC (names.pn_offset, data, offset_size, start);
if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE
&& num_debug_info_entries > 0
&& find_debug_info_for_offset (names.pn_offset) == NULL)
warn (_(".debug_info offset of 0x%lx in %s section does not point to a CU header.\n"),
(unsigned long) names.pn_offset, section->name);
SAFE_BYTE_GET_AND_INC (names.pn_size, data, offset_size, start);
printf (_(" Length: %ld\n"),
(long) names.pn_length);
printf (_(" Version: %d\n"),
names.pn_version);
printf (_(" Offset into .debug_info section: 0x%lx\n"),
(unsigned long) names.pn_offset);
printf (_(" Size of area in .debug_info section: %ld\n"),
(long) names.pn_size);
if (names.pn_version != 2 && names.pn_version != 3)
{
static int warned = 0;
if (! warned)
{
warn (_("Only DWARF 2 and 3 pubnames are currently supported\n"));
warned = 1;
}
continue;
}
if (is_gnu)
printf (_("\n Offset Kind Name\n"));
else
printf (_("\n Offset\tName\n"));
while (1)
{
bfd_size_type maxprint;
dwarf_vma offset;
SAFE_BYTE_GET_AND_INC (offset, data, offset_size, start);
if (offset == 0)
break;
if (data >= start)
break;
maxprint = (start - data) - 1;
if (is_gnu)
{
unsigned int kind_data;
gdb_index_symbol_kind kind;
const char *kind_name;
int is_static;
SAFE_BYTE_GET_AND_INC (kind_data, data, 1, start);
maxprint --;
/* GCC computes the kind as the upper byte in the CU index
word, and then right shifts it by the CU index size.
Left shift KIND to where the gdb-index.h accessor macros
can use it. */
kind_data <<= GDB_INDEX_CU_BITSIZE;
kind = GDB_INDEX_SYMBOL_KIND_VALUE (kind_data);
kind_name = get_gdb_index_symbol_kind_name (kind);
is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (kind_data);
printf (" %-6lx %s,%-10s %.*s\n",
(unsigned long) offset, is_static ? _("s") : _("g"),
kind_name, (int) maxprint, data);
}
else
printf (" %-6lx\t%.*s\n",
(unsigned long) offset, (int) maxprint, data);
data += strnlen ((char *) data, maxprint);
if (data < start)
data++;
if (data >= start)
break;
}
}
printf ("\n");
return 1;
}
| 0
|
521,454
|
inline uint32 readUnalignedLittleEndianInt (const void* buffer)
{
auto data = readUnaligned<uint32> (buffer);
return ByteOrder::littleEndianInt (&data);
}
| 0
|
432,172
|
MemoryRegionSection *iotlb_to_section(CPUState *cpu,
hwaddr index, MemTxAttrs attrs)
{
#ifdef TARGET_ARM
struct uc_struct *uc = cpu->uc;
#endif
int asidx = cpu_asidx_from_attrs(cpu, attrs);
CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx];
AddressSpaceDispatch *d = cpuas->memory_dispatch;
MemoryRegionSection *sections = d->map.sections;
return §ions[index & ~TARGET_PAGE_MASK];
}
| 0
|
225,875
|
GF_Err audio_sample_entry_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
gf_isom_audio_sample_entry_write((GF_AudioSampleEntryBox*)s, bs);
return GF_OK;
}
| 0
|
413,685
|
static bool opiscall(RCore *core, RAnalOp *aop, ut64 addr, const ut8* buf, int len, int arch) {
switch (arch) {
case R2_ARCH_ARM64:
aop->size = 4;
//addr should be aligned by 4 in aarch64
if (addr % 4) {
char diff = addr % 4;
addr = addr - diff;
buf = buf - diff;
}
//if is not bl do not analyze
if (buf[3] == 0x94) {
if (r_anal_op (core->anal, aop, addr, buf, len, R_ANAL_OP_MASK_BASIC)) {
return true;
}
}
break;
default:
aop->size = 1;
if (r_anal_op (core->anal, aop, addr, buf, len, R_ANAL_OP_MASK_BASIC)) {
switch (aop->type & R_ANAL_OP_TYPE_MASK) {
case R_ANAL_OP_TYPE_CALL:
case R_ANAL_OP_TYPE_CCALL:
return true;
}
}
break;
}
return false;
}
| 0
|
404,722
|
static unsigned long __fget_light(unsigned int fd, fmode_t mask)
{
struct files_struct *files = current->files;
struct file *file;
if (atomic_read(&files->count) == 1) {
file = files_lookup_fd_raw(files, fd);
if (!file || unlikely(file->f_mode & mask))
return 0;
return (unsigned long)file;
} else {
file = __fget(fd, mask, 1);
if (!file)
return 0;
return FDPUT_FPUT | (unsigned long)file;
}
}
| 0
|
361,302
|
stl_load_edge_nearby(stl_file *stl, stl_hash_edge *edge,
stl_vertex *a, stl_vertex *b, float tolerance) {
float diff_x;
float diff_y;
float diff_z;
float max_diff;
unsigned vertex1[3];
unsigned vertex2[3];
diff_x = ABS(a->x - b->x);
diff_y = ABS(a->y - b->y);
diff_z = ABS(a->z - b->z);
max_diff = STL_MAX(diff_x, diff_y);
max_diff = STL_MAX(diff_z, max_diff);
vertex1[0] = (unsigned)((a->x - stl->stats.min.x) / tolerance);
vertex1[1] = (unsigned)((a->y - stl->stats.min.y) / tolerance);
vertex1[2] = (unsigned)((a->z - stl->stats.min.z) / tolerance);
vertex2[0] = (unsigned)((b->x - stl->stats.min.x) / tolerance);
vertex2[1] = (unsigned)((b->y - stl->stats.min.y) / tolerance);
vertex2[2] = (unsigned)((b->z - stl->stats.min.z) / tolerance);
if( (vertex1[0] == vertex2[0])
&& (vertex1[1] == vertex2[1])
&& (vertex1[2] == vertex2[2])) {
/* Both vertices hash to the same value */
return 0;
}
if(diff_x == max_diff) {
if(a->x > b->x) {
memcpy(&edge->key[0], vertex1, sizeof(stl_vertex));
memcpy(&edge->key[3], vertex2, sizeof(stl_vertex));
} else {
memcpy(&edge->key[0], vertex2, sizeof(stl_vertex));
memcpy(&edge->key[3], vertex1, sizeof(stl_vertex));
edge->which_edge += 3; /* this edge is loaded backwards */
}
} else if(diff_y == max_diff) {
if(a->y > b->y) {
memcpy(&edge->key[0], vertex1, sizeof(stl_vertex));
memcpy(&edge->key[3], vertex2, sizeof(stl_vertex));
} else {
memcpy(&edge->key[0], vertex2, sizeof(stl_vertex));
memcpy(&edge->key[3], vertex1, sizeof(stl_vertex));
edge->which_edge += 3; /* this edge is loaded backwards */
}
} else {
if(a->z > b->z) {
memcpy(&edge->key[0], vertex1, sizeof(stl_vertex));
memcpy(&edge->key[3], vertex2, sizeof(stl_vertex));
} else {
memcpy(&edge->key[0], vertex2, sizeof(stl_vertex));
memcpy(&edge->key[3], vertex1, sizeof(stl_vertex));
edge->which_edge += 3; /* this edge is loaded backwards */
}
}
return 1;
}
| 0
|
244,272
|
GF_Err pdin_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
u32 i;
GF_ProgressiveDownloadBox *ptr = (GF_ProgressiveDownloadBox *)s;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
for (i=0; i<ptr->count; i++) {
gf_bs_write_u32(bs, ptr->rates[i]);
gf_bs_write_u32(bs, ptr->times[i]);
}
return GF_OK;
}
| 0
|
459,024
|
http_Proto(struct http *to)
{
const char *fm;
fm = to->hd[HTTP_HDR_PROTO].b;
if (fm != NULL &&
(fm[0] == 'H' || fm[0] == 'h') &&
(fm[1] == 'T' || fm[1] == 't') &&
(fm[2] == 'T' || fm[2] == 't') &&
(fm[3] == 'P' || fm[3] == 'p') &&
fm[4] == '/' &&
vct_isdigit(fm[5]) &&
fm[6] == '.' &&
vct_isdigit(fm[7]) &&
fm[8] == '\0') {
to->protover = 10 * (fm[5] - '0') + (fm[7] - '0');
} else {
to->protover = 0;
}
}
| 0
|
312,436
|
ex_cnext(exarg_T *eap)
{
qf_info_T *qi;
int errornr;
int dir;
if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL)
return;
if (eap->addr_count > 0
&& (eap->cmdidx != CMD_cdo && eap->cmdidx != CMD_ldo
&& eap->cmdidx != CMD_cfdo && eap->cmdidx != CMD_lfdo))
errornr = (int)eap->line2;
else
errornr = 1;
// Depending on the command jump to either next or previous entry/file.
switch (eap->cmdidx)
{
case CMD_cnext: case CMD_lnext: case CMD_cdo: case CMD_ldo:
dir = FORWARD;
break;
case CMD_cprevious: case CMD_lprevious: case CMD_cNext:
case CMD_lNext:
dir = BACKWARD;
break;
case CMD_cnfile: case CMD_lnfile: case CMD_cfdo: case CMD_lfdo:
dir = FORWARD_FILE;
break;
case CMD_cpfile: case CMD_lpfile: case CMD_cNfile: case CMD_lNfile:
dir = BACKWARD_FILE;
break;
default:
dir = FORWARD;
break;
}
qf_jump(qi, dir, errornr, eap->forceit);
}
| 0
|
221,174
|
GF_Err gf_odf_delete_descriptor_list(GF_List *descList)
{
GF_Err e;
GF_Descriptor*tmp;
u32 i;
//no error if NULL chain...
if (! descList) return GF_OK;
i=0;
while ((tmp = (GF_Descriptor*)gf_list_enum(descList, &i))) {
e = gf_odf_delete_descriptor(tmp);
if (e) return e;
}
gf_list_del(descList);
return GF_OK;
}
| 0
|
307,845
|
bool ciEnv::jvmti_state_changed() const {
if (!_jvmti_can_access_local_variables &&
JvmtiExport::can_access_local_variables()) {
return true;
}
if (!_jvmti_can_hotswap_or_post_breakpoint &&
JvmtiExport::can_hotswap_or_post_breakpoint()) {
return true;
}
if (!_jvmti_can_post_on_exceptions &&
JvmtiExport::can_post_on_exceptions()) {
return true;
}
if (!_jvmti_can_pop_frame &&
JvmtiExport::can_pop_frame()) {
return true;
}
return false;
}
| 0
|
234,147
|
comp_addr_base (const void * v0, const void * v1)
{
debug_info *info0 = *(debug_info **) v0;
debug_info *info1 = *(debug_info **) v1;
return info0->addr_base - info1->addr_base;
}
| 0
|
275,480
|
njs_vm_retval(njs_vm_t *vm)
{
return &vm->retval;
}
| 0
|
466,154
|
static void decode_register_operand(struct x86_emulate_ctxt *ctxt,
struct operand *op,
int inhibit_bytereg)
{
unsigned reg = ctxt->modrm_reg;
int highbyte_regs = ctxt->rex_prefix == 0;
if (!(ctxt->d & ModRM))
reg = (ctxt->b & 7) | ((ctxt->rex_prefix & 1) << 3);
if (ctxt->d & Sse) {
op->type = OP_XMM;
op->bytes = 16;
op->addr.xmm = reg;
read_sse_reg(ctxt, &op->vec_val, reg);
return;
}
op->type = OP_REG;
if ((ctxt->d & ByteOp) && !inhibit_bytereg) {
op->addr.reg = decode_register(reg, ctxt->regs, highbyte_regs);
op->bytes = 1;
} else {
op->addr.reg = decode_register(reg, ctxt->regs, 0);
op->bytes = ctxt->op_bytes;
}
fetch_register_operand(op);
op->orig_val = op->val;
}
| 0
|
309,970
|
save_text(const char *fmt, const char *s, int len)
{
size_t s_len = (size_t) len + strlen(s) + strlen(fmt);
get_space(s_len + 1);
_nc_SPRINTF(TPS(out_buff) + TPS(out_used),
_nc_SLIMIT(TPS(out_size) - TPS(out_used))
fmt, s);
TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
}
| 0
|
316,991
|
static void smack_free_mnt_opts(void *mnt_opts)
{
struct smack_mnt_opts *opts = mnt_opts;
kfree(opts->fsdefault);
kfree(opts->fsfloor);
kfree(opts->fshat);
kfree(opts->fsroot);
kfree(opts->fstransmute);
kfree(opts);
}
| 0
|
474,005
|
onig_free_shared_cclass_table(void)
{
THREAD_ATOMIC_START;
if (IS_NOT_NULL(OnigTypeCClassTable)) {
onig_st_foreach(OnigTypeCClassTable, i_free_shared_class, 0);
onig_st_free_table(OnigTypeCClassTable);
OnigTypeCClassTable = NULL;
}
THREAD_ATOMIC_END;
return 0;
}
| 0
|
279,938
|
skip_vimgrep_pat_ext(char_u *p, char_u **s, int *flags, char_u **nulp, int *cp)
{
int c;
if (vim_isIDc(*p))
{
// ":vimgrep pattern fname"
if (s != NULL)
*s = p;
p = skiptowhite(p);
if (s != NULL && *p != NUL)
{
if (nulp != NULL)
{
*nulp = p;
*cp = *p;
}
*p++ = NUL;
}
}
else
{
// ":vimgrep /pattern/[g][j] fname"
if (s != NULL)
*s = p + 1;
c = *p;
p = skip_regexp(p + 1, c, TRUE);
if (*p != c)
return NULL;
// Truncate the pattern.
if (s != NULL)
{
if (nulp != NULL)
{
*nulp = p;
*cp = *p;
}
*p = NUL;
}
++p;
// Find the flags
while (*p == 'g' || *p == 'j' || *p == 'f')
{
if (flags != NULL)
{
if (*p == 'g')
*flags |= VGR_GLOBAL;
else if (*p == 'j')
*flags |= VGR_NOJUMP;
else
*flags |= VGR_FUZZY;
}
++p;
}
}
return p;
}
| 0
|
344,249
|
int luaG_traceexec (lua_State *L, const Instruction *pc) {
CallInfo *ci = L->ci;
lu_byte mask = L->hookmask;
const Proto *p = ci_func(ci)->p;
int counthook;
if (!(mask & (LUA_MASKLINE | LUA_MASKCOUNT))) { /* no hooks? */
ci->u.l.trap = 0; /* don't need to stop again */
return 0; /* turn off 'trap' */
}
pc++; /* reference is always next instruction */
ci->u.l.savedpc = pc; /* save 'pc' */
counthook = (--L->hookcount == 0 && (mask & LUA_MASKCOUNT));
if (counthook)
resethookcount(L); /* reset count */
else if (!(mask & LUA_MASKLINE))
return 1; /* no line hook and count != 0; nothing to be done now */
if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */
ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */
return 1; /* do not call hook again (VM yielded, so it did not move) */
}
if (!isIT(*(ci->u.l.savedpc - 1))) /* top not being used? */
L->top = ci->top; /* correct top */
if (counthook)
luaD_hook(L, LUA_HOOKCOUNT, -1, 0, 0); /* call count hook */
if (mask & LUA_MASKLINE) {
/* 'L->oldpc' may be invalid; use zero in this case */
int oldpc = (L->oldpc < p->sizecode) ? L->oldpc : 0;
int npci = pcRel(pc, p);
if (npci <= oldpc || /* call hook when jump back (loop), */
changedline(p, oldpc, npci)) { /* or when enter new line */
int newline = luaG_getfuncline(p, npci);
luaD_hook(L, LUA_HOOKLINE, newline, 0, 0); /* call line hook */
}
L->oldpc = npci; /* 'pc' of last call to line hook */
}
if (L->status == LUA_YIELD) { /* did hook yield? */
if (counthook)
L->hookcount = 1; /* undo decrement to zero */
ci->u.l.savedpc--; /* undo increment (resume will increment it again) */
ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */
luaD_throw(L, LUA_YIELD);
}
return 1; /* keep 'trap' on */
}
| 0
|
317,248
|
static void smk_bu_mode(int mode, char *s)
{
int i = 0;
if (mode & MAY_READ)
s[i++] = 'r';
if (mode & MAY_WRITE)
s[i++] = 'w';
if (mode & MAY_EXEC)
s[i++] = 'x';
if (mode & MAY_APPEND)
s[i++] = 'a';
if (mode & MAY_TRANSMUTE)
s[i++] = 't';
if (mode & MAY_LOCK)
s[i++] = 'l';
if (i == 0)
s[i++] = '-';
s[i] = '\0';
}
| 0
|
459,086
|
int tc_setup_action(struct flow_action *flow_action,
struct tc_action *actions[])
{
int i, j, index, err = 0;
struct tc_action *act;
BUILD_BUG_ON(TCA_ACT_HW_STATS_ANY != FLOW_ACTION_HW_STATS_ANY);
BUILD_BUG_ON(TCA_ACT_HW_STATS_IMMEDIATE != FLOW_ACTION_HW_STATS_IMMEDIATE);
BUILD_BUG_ON(TCA_ACT_HW_STATS_DELAYED != FLOW_ACTION_HW_STATS_DELAYED);
if (!actions)
return 0;
j = 0;
tcf_act_for_each_action(i, act, actions) {
struct flow_action_entry *entry;
entry = &flow_action->entries[j];
spin_lock_bh(&act->tcfa_lock);
err = tcf_act_get_cookie(entry, act);
if (err)
goto err_out_locked;
entry->hw_stats = tc_act_hw_stats(act->hw_stats);
entry->hw_index = act->tcfa_index;
index = 0;
err = tc_setup_offload_act(act, entry, &index);
if (!err)
j += index;
else
goto err_out_locked;
spin_unlock_bh(&act->tcfa_lock);
}
err_out:
if (err)
tc_cleanup_offload_action(flow_action);
return err;
err_out_locked:
spin_unlock_bh(&act->tcfa_lock);
goto err_out;
}
| 0
|
201,007
|
static int print_media_desc(const pjmedia_sdp_media *m, char *buf, pj_size_t len)
{
char *p = buf;
char *end = buf+len;
unsigned i;
int printed;
/* check length for the "m=" line. */
if (len < (pj_size_t)m->desc.media.slen+m->desc.transport.slen+12+24) {
return -1;
}
*p++ = 'm'; /* m= */
*p++ = '=';
pj_memcpy(p, m->desc.media.ptr, m->desc.media.slen);
p += m->desc.media.slen;
*p++ = ' ';
printed = pj_utoa(m->desc.port, p);
p += printed;
if (m->desc.port_count > 1) {
*p++ = '/';
printed = pj_utoa(m->desc.port_count, p);
p += printed;
}
*p++ = ' ';
pj_memcpy(p, m->desc.transport.ptr, m->desc.transport.slen);
p += m->desc.transport.slen;
for (i=0; i<m->desc.fmt_count; ++i) {
*p++ = ' ';
pj_memcpy(p, m->desc.fmt[i].ptr, m->desc.fmt[i].slen);
p += m->desc.fmt[i].slen;
}
*p++ = '\r';
*p++ = '\n';
/* print connection info, if present. */
if (m->conn) {
printed = print_connection_info(m->conn, p, (int)(end-p));
if (printed < 0) {
return -1;
}
p += printed;
}
/* print optional bandwidth info. */
for (i=0; i<m->bandw_count; ++i) {
printed = (int)print_bandw(m->bandw[i], p, end-p);
if (printed < 0) {
return -1;
}
p += printed;
}
/* print attributes. */
for (i=0; i<m->attr_count; ++i) {
printed = (int)print_attr(m->attr[i], p, end-p);
if (printed < 0) {
return -1;
}
p += printed;
}
return (int)(p-buf);
}
| 1
|
336,566
|
static void reds_migrate_channels_seamless(RedsState *reds)
{
RedClient *client;
/* seamless migration is supported for only one client for now */
client = reds_get_client(reds);
client->migrate();
}
| 0
|
247,519
|
int expectedVerifyErrorCode() const { return expected_verify_error_code_; }
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.