idx
int64 | func
string | target
int64 |
|---|---|---|
230,386
|
static void on_syntax_error(struct pj_scanner *scanner)
{
PJ_UNUSED_ARG(scanner);
PJ_THROW(EX_SYNTAX_ERROR);
}
| 0
|
395,076
|
redraw_later(int type)
{
redraw_win_later(curwin, type);
}
| 0
|
326,107
|
regnext(char_u *p)
{
int offset;
if (p == JUST_CALC_SIZE || reg_toolong)
return NULL;
offset = NEXT(p);
if (offset == 0)
return NULL;
if (OP(p) == BACK)
return p - offset;
else
return p + offset;
}
| 0
|
436,084
|
static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
const struct io_uring_sqe *sqe)
{
struct io_submit_state *state;
unsigned int sqe_flags;
int personality, ret = 0;
req->opcode = READ_ONCE(sqe->opcode);
/* same numerical values with corresponding REQ_F_*, safe to copy */
req->flags = sqe_flags = READ_ONCE(sqe->flags);
req->user_data = READ_ONCE(sqe->user_data);
req->file = NULL;
req->fixed_rsrc_refs = NULL;
/* one is dropped after submission, the other at completion */
atomic_set(&req->refs, 2);
req->task = current;
/* enforce forwards compatibility on users */
if (unlikely(sqe_flags & ~SQE_VALID_FLAGS))
return -EINVAL;
if (unlikely(req->opcode >= IORING_OP_LAST))
return -EINVAL;
if (!io_check_restriction(ctx, req, sqe_flags))
return -EACCES;
if ((sqe_flags & IOSQE_BUFFER_SELECT) &&
!io_op_defs[req->opcode].buffer_select)
return -EOPNOTSUPP;
if (unlikely(sqe_flags & IOSQE_IO_DRAIN))
ctx->drain_active = true;
personality = READ_ONCE(sqe->personality);
if (personality) {
req->creds = xa_load(&ctx->personalities, personality);
if (!req->creds)
return -EINVAL;
get_cred(req->creds);
req->flags |= REQ_F_CREDS;
}
state = &ctx->submit_state;
/*
* Plug now if we have more than 1 IO left after this, and the target
* is potentially a read/write to block based storage.
*/
if (!state->plug_started && state->ios_left > 1 &&
io_op_defs[req->opcode].plug) {
blk_start_plug(&state->plug);
state->plug_started = true;
}
if (io_op_defs[req->opcode].needs_file) {
bool fixed = req->flags & REQ_F_FIXED_FILE;
req->file = io_file_get(state, req, READ_ONCE(sqe->fd), fixed);
if (unlikely(!req->file))
ret = -EBADF;
}
state->ios_left--;
return ret;
| 0
|
225,406
|
static void buffer_written(struct v4l2_loopback_device *dev,
struct v4l2l_buffer *buf)
{
del_timer_sync(&dev->sustain_timer);
del_timer_sync(&dev->timeout_timer);
spin_lock_bh(&dev->lock);
dev->bufpos2index[dev->write_position % dev->used_buffers] =
buf->buffer.index;
list_move_tail(&buf->list_head, &dev->outbufs_list);
++dev->write_position;
dev->reread_count = 0;
check_timers(dev);
spin_unlock_bh(&dev->lock);
}
| 0
|
312,402
|
qf_process_qftf_option(void)
{
return option_set_callback_func(p_qftf, &qftf_cb);
}
| 0
|
385,838
|
COMPAT_SYSCALL_DEFINE2(truncate, const char __user *, path, compat_off_t, length)
{
return do_sys_truncate(path, length);
}
| 0
|
246,667
|
GF_Err afrt_box_read(GF_Box *s, GF_BitStream *bs)
{
unsigned int i;
GF_AdobeFragmentRunTableBox *ptr = (GF_AdobeFragmentRunTableBox *)s;
ISOM_DECREASE_SIZE(ptr, 5)
ptr->timescale = gf_bs_read_u32(bs);
ptr->quality_entry_count = gf_bs_read_u8(bs);
if (ptr->size < ptr->quality_entry_count)
return GF_ISOM_INVALID_FILE;
for (i=0; i<ptr->quality_entry_count; i++) {
int j=0;
u32 tmp_strsize=(u32)ptr->size-8;
char *tmp_str = (char*) gf_malloc(tmp_strsize);
if (!tmp_str) return GF_OUT_OF_MEM;
while (tmp_strsize) {
tmp_str[j] = gf_bs_read_u8(bs);
tmp_strsize--;
if (!tmp_str[j])
break;
j++;
}
ISOM_DECREASE_SIZE(ptr, j)
gf_list_insert(ptr->quality_segment_url_modifiers, tmp_str, i);
}
ptr->fragment_run_entry_count = gf_bs_read_u32(bs);
if (ptr->size / 16 < ptr->fragment_run_entry_count)
return GF_ISOM_INVALID_FILE;
for (i=0; i<ptr->fragment_run_entry_count; i++) {
GF_AdobeFragmentRunEntry *fre = gf_malloc(sizeof(GF_AdobeFragmentRunEntry));
if (!fre) return GF_OUT_OF_MEM;
ISOM_DECREASE_SIZE(ptr, 16)
fre->first_fragment = gf_bs_read_u32(bs);
fre->first_fragment_timestamp = gf_bs_read_u64(bs);
fre->fragment_duration = gf_bs_read_u32(bs);
if (!fre->fragment_duration) {
ISOM_DECREASE_SIZE(ptr, 1)
fre->discontinuity_indicator = gf_bs_read_u8(bs);
}
gf_list_insert(ptr->fragment_run_entry_table, fre, i);
}
return GF_OK;
}
| 0
|
312,425
|
qf_parse_fmt_l(regmatch_T *rmp, int midx, qffields_T *fields)
{
if (rmp->startp[midx] == NULL)
return QF_FAIL;
fields->lnum = atol((char *)rmp->startp[midx]);
return QF_OK;
}
| 0
|
341,821
|
zstringmatch(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
os_ptr op1 = op - 1;
bool result;
check_read_type(*op, t_string);
switch (r_type(op1)) {
case t_string:
check_read(*op1);
goto cmp;
case t_name:
name_string_ref(imemory, op1, op1); /* can't fail */
cmp:
result = string_match(op1->value.const_bytes, r_size(op1),
op->value.const_bytes, r_size(op),
NULL);
break;
default:
result = (r_size(op) == 1 && *op->value.bytes == '*');
}
make_bool(op1, result);
pop(1);
return 0;
}
| 0
|
310,274
|
dirserv_get_name_status(const char *id_digest, const char *nickname)
{
char fp[HEX_DIGEST_LEN+1];
char *fp_by_name;
base16_encode(fp, sizeof(fp), id_digest, DIGEST_LEN);
if ((fp_by_name =
strmap_get_lc(fingerprint_list->fp_by_name, nickname))) {
if (!strcasecmp(fp, fp_by_name)) {
return FP_NAMED;
} else {
return FP_UNNAMED; /* Wrong fingerprint. */
}
}
return 0;
}
| 0
|
508,847
|
void Lex_input_stream::body_utf8_append(const char *ptr,
const char *end_ptr)
{
DBUG_ASSERT(m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length);
DBUG_ASSERT(m_cpp_buf <= end_ptr && end_ptr <= m_cpp_buf + m_buf_length);
if (!m_body_utf8)
return;
if (m_cpp_utf8_processed_ptr >= ptr)
return;
size_t bytes_to_copy= ptr - m_cpp_utf8_processed_ptr;
memcpy(m_body_utf8_ptr, m_cpp_utf8_processed_ptr, bytes_to_copy);
m_body_utf8_ptr += bytes_to_copy;
*m_body_utf8_ptr= 0;
m_cpp_utf8_processed_ptr= end_ptr;
}
| 0
|
231,735
|
TEST_F(QuicServerTransportTest, RecvPathChallenge) {
auto& conn = server->getNonConstConn();
// Add additional peer id so PathResponse completes.
conn.peerConnectionIds.emplace_back(ConnectionId({1, 2, 3, 4}), 1);
ShortHeader header(
ProtectionType::KeyPhaseZero, *conn.serverConnectionId, 10);
RegularQuicPacketBuilder builder(
conn.udpSendPacketLen, std::move(header), 0 /* largestAcked */);
builder.encodePacketHeader();
PathChallengeFrame pathChallenge(123);
ASSERT_TRUE(builder.canBuildPacket());
writeSimpleFrame(QuicSimpleFrame(pathChallenge), builder);
auto packet = std::move(builder).buildPacket();
EXPECT_TRUE(conn.pendingEvents.frames.empty());
deliverData(packetToBuf(packet), false);
EXPECT_EQ(conn.pendingEvents.frames.size(), 2);
// The RetireConnectionId frame will be enqueued before the PathResponse.
auto retireFrame = conn.pendingEvents.frames[0].asRetireConnectionIdFrame();
EXPECT_EQ(retireFrame->sequenceNumber, 0);
PathResponseFrame& pathResponse =
*conn.pendingEvents.frames[1].asPathResponseFrame();
EXPECT_EQ(pathResponse.pathData, pathChallenge.pathData);
}
| 0
|
345,122
|
static void pxa3xx_gcu_debug_timedout(struct timer_list *unused)
{
struct pxa3xx_gcu_priv *priv = debug_timer_priv;
QERROR("Timer DUMP");
mod_timer(&pxa3xx_gcu_debug_timer, jiffies + 5 * HZ);
}
| 0
|
473,937
|
get_case_fold_codes_by_str(OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end,
OnigCaseFoldCodeItem items[],
OnigEncoding enc ARG_UNUSED)
{
return onigenc_get_case_fold_codes_by_str_with_map(
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
flag, p, end, items);
}
| 0
|
489,144
|
sctp_disposition_t sctp_sf_unk_chunk(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *unk_chunk = arg;
struct sctp_chunk *err_chunk;
sctp_chunkhdr_t *hdr;
SCTP_DEBUG_PRINTK("Processing the unknown chunk id %d.\n", type.chunk);
if (!sctp_vtag_verify(unk_chunk, asoc))
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
/* Make sure that the chunk has a valid length.
* Since we don't know the chunk type, we use a general
* chunkhdr structure to make a comparison.
*/
if (!sctp_chunk_length_valid(unk_chunk, sizeof(sctp_chunkhdr_t)))
return sctp_sf_violation_chunklen(ep, asoc, type, arg,
commands);
switch (type.chunk & SCTP_CID_ACTION_MASK) {
case SCTP_CID_ACTION_DISCARD:
/* Discard the packet. */
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
break;
case SCTP_CID_ACTION_DISCARD_ERR:
/* Generate an ERROR chunk as response. */
hdr = unk_chunk->chunk_hdr;
err_chunk = sctp_make_op_error(asoc, unk_chunk,
SCTP_ERROR_UNKNOWN_CHUNK, hdr,
WORD_ROUND(ntohs(hdr->length)));
if (err_chunk) {
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
SCTP_CHUNK(err_chunk));
}
/* Discard the packet. */
sctp_sf_pdiscard(ep, asoc, type, arg, commands);
return SCTP_DISPOSITION_CONSUME;
break;
case SCTP_CID_ACTION_SKIP:
/* Skip the chunk. */
return SCTP_DISPOSITION_DISCARD;
break;
case SCTP_CID_ACTION_SKIP_ERR:
/* Generate an ERROR chunk as response. */
hdr = unk_chunk->chunk_hdr;
err_chunk = sctp_make_op_error(asoc, unk_chunk,
SCTP_ERROR_UNKNOWN_CHUNK, hdr,
WORD_ROUND(ntohs(hdr->length)));
if (err_chunk) {
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
SCTP_CHUNK(err_chunk));
}
/* Skip the chunk. */
return SCTP_DISPOSITION_CONSUME;
break;
default:
break;
}
return SCTP_DISPOSITION_DISCARD;
}
| 0
|
366,215
|
bool legitimize_mnt(struct vfsmount *bastard, unsigned seq)
{
int res = __legitimize_mnt(bastard, seq);
if (likely(!res))
return true;
if (unlikely(res < 0)) {
rcu_read_unlock();
mntput(bastard);
rcu_read_lock();
}
return false;
}
| 0
|
386,582
|
bool DL_Dxf::getStrippedLine(std::string& s, unsigned int size, FILE *fp, bool stripSpace) {
if (!feof(fp)) {
// The whole line in the file. Includes space for NULL.
char* wholeLine = new char[size];
// Only the useful part of the line
char* line;
line = fgets(wholeLine, size, fp);
if (line!=NULL && line[0] != '\0') { // Evaluates to fgets() retval
// line == wholeLine at this point.
// Both guaranteed to be NULL terminated.
// Strip leading whitespace and trailing CR/LF.
stripWhiteSpace(&line, stripSpace);
s = line;
assert(size > s.length());
}
delete[] wholeLine; // Done with wholeLine
return true;
} else {
s = "";
return false;
}
}
| 0
|
276,964
|
~EncryptingStream() {
m_Output->Release();
delete m_StreamCipher;
}
| 0
|
259,218
|
static int64_t add_ctts_entry(MOVCtts** ctts_data, unsigned int* ctts_count, unsigned int* allocated_size,
int count, int duration)
{
MOVCtts *ctts_buf_new;
const size_t min_size_needed = (*ctts_count + 1) * sizeof(MOVCtts);
const size_t requested_size =
min_size_needed > *allocated_size ?
FFMAX(min_size_needed, 2 * (*allocated_size)) :
min_size_needed;
if ((unsigned)(*ctts_count) >= UINT_MAX / sizeof(MOVCtts) - 1)
return -1;
ctts_buf_new = av_fast_realloc(*ctts_data, allocated_size, requested_size);
if (!ctts_buf_new)
return -1;
*ctts_data = ctts_buf_new;
ctts_buf_new[*ctts_count].count = count;
ctts_buf_new[*ctts_count].duration = duration;
*ctts_count = (*ctts_count) + 1;
return *ctts_count;
}
| 0
|
220,173
|
uint64 InputTensor::Hash::operator()(InputTensor const& s) const {
return Hash64Combine(std::hash<const Node*>()(s.node),
std::hash<int>()(s.index));
}
| 0
|
274,724
|
callbacks_change_layer_color_clicked (GtkButton *button, gpointer user_data) {
gint index=callbacks_get_selected_row_index();
if (index < 0) {
show_no_layers_warning ();
return;
}
callbacks_show_color_picker_dialog (index);
}
| 0
|
242,989
|
static int ssl_compress_buf( mbedtls_ssl_context *ssl )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
unsigned char *msg_post = ssl->out_msg;
ptrdiff_t bytes_written = ssl->out_msg - ssl->out_buf;
size_t len_pre = ssl->out_msglen;
unsigned char *msg_pre = ssl->compress_buf;
#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
size_t out_buf_len = ssl->out_buf_len;
#else
size_t out_buf_len = MBEDTLS_SSL_OUT_BUFFER_LEN;
#endif
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> compress buf" ) );
if( len_pre == 0 )
return( 0 );
memcpy( msg_pre, ssl->out_msg, len_pre );
MBEDTLS_SSL_DEBUG_MSG( 3, ( "before compression: msglen = %" MBEDTLS_PRINTF_SIZET ", ",
ssl->out_msglen ) );
MBEDTLS_SSL_DEBUG_BUF( 4, "before compression: output payload",
ssl->out_msg, ssl->out_msglen );
ssl->transform_out->ctx_deflate.next_in = msg_pre;
ssl->transform_out->ctx_deflate.avail_in = len_pre;
ssl->transform_out->ctx_deflate.next_out = msg_post;
ssl->transform_out->ctx_deflate.avail_out = out_buf_len - bytes_written;
ret = deflate( &ssl->transform_out->ctx_deflate, Z_SYNC_FLUSH );
if( ret != Z_OK )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "failed to perform compression (%d)", ret ) );
return( MBEDTLS_ERR_SSL_COMPRESSION_FAILED );
}
ssl->out_msglen = out_buf_len -
ssl->transform_out->ctx_deflate.avail_out - bytes_written;
MBEDTLS_SSL_DEBUG_MSG( 3, ( "after compression: msglen = %" MBEDTLS_PRINTF_SIZET ", ",
ssl->out_msglen ) );
MBEDTLS_SSL_DEBUG_BUF( 4, "after compression: output payload",
ssl->out_msg, ssl->out_msglen );
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= compress buf" ) );
return( 0 );
}
| 0
|
230,142
|
static json_t * check_attestation_packed(json_t * j_params, cbor_item_t * auth_data, cbor_item_t * att_stmt, const unsigned char * client_data, gnutls_pubkey_t g_key) {
json_t * j_error = json_array(), * j_return;
cbor_item_t * key, * alg = NULL, * sig = NULL, * x5c_array = NULL, * cert_leaf = NULL;
size_t i, client_data_hash_len = 32, cert_export_len = 128, cert_export_b64_len = 0;
char * message;
gnutls_pubkey_t pubkey = NULL;
gnutls_x509_crt_t cert = NULL;
gnutls_datum_t cert_dat, data, signature, cert_issued_by;
int ret, sig_alg = GNUTLS_SIGN_UNKNOWN;
unsigned char client_data_hash[32], cert_export[128], cert_export_b64[256];
data.data = NULL;
UNUSED(j_params);
if (j_error != NULL) {
do {
for (i=0; i<cbor_map_size(att_stmt); i++) {
key = cbor_map_handle(att_stmt)[i].key;
if (cbor_isa_string(key)) {
if (0 == o_strncmp((const char *)cbor_string_handle(key), "alg", MIN(o_strlen("alg"), cbor_string_length(key))) && cbor_isa_negint(cbor_map_handle(att_stmt)[i].value)) {
alg = cbor_map_handle(att_stmt)[i].value;
if (cbor_get_int(alg) == 6) {
sig_alg = GNUTLS_SIGN_ECDSA_SHA256;
} else if (cbor_get_int(alg) == 34) {
sig_alg = GNUTLS_SIGN_ECDSA_SHA384;
} else if (cbor_get_int(alg) == 35) {
sig_alg = GNUTLS_SIGN_ECDSA_SHA512;
}
if (sig_alg == GNUTLS_SIGN_UNKNOWN) {
json_array_append_new(j_error, json_string("Signature algorithm not supported"));
break;
}
} else if (0 == o_strncmp((const char *)cbor_string_handle(key), "sig", MIN(o_strlen("sig"), cbor_string_length(key))) && cbor_isa_bytestring(cbor_map_handle(att_stmt)[i].value)) {
sig = cbor_map_handle(att_stmt)[i].value;
} else if (0 == o_strncmp((const char *)cbor_string_handle(key), "x5c", MIN(o_strlen("x5c"), cbor_string_length(key))) && cbor_isa_array(cbor_map_handle(att_stmt)[i].value) && cbor_array_size(cbor_map_handle(att_stmt)[i].value)) {
x5c_array = cbor_map_handle(att_stmt)[i].value;
} else if (0 == o_strncmp((const char *)cbor_string_handle(key), "ecdaaKeyId", MIN(o_strlen("ecdaaKeyId"), cbor_string_length(key)))) {
json_array_append_new(j_error, json_string("ecdaaKeyId not supported"));
break;
}
} else {
message = msprintf("attStmt map element %zu key is not a string", i);
json_array_append_new(j_error, json_string(message));
o_free(message);
break;
}
}
if (json_array_size(j_error)) {
break;
}
if (alg == NULL || sig == NULL) {
json_array_append_new(j_error, json_string("Internal error"));
y_log_message(Y_LOG_LEVEL_ERROR, "check_attestation_packed - Error alg or sig are not mapped in att_stmt");
break;
}
if (!generate_digest_raw(digest_SHA256, client_data, o_strlen((char *)client_data), client_data_hash, &client_data_hash_len)) {
json_array_append_new(j_error, json_string("Internal error"));
y_log_message(Y_LOG_LEVEL_DEBUG, "check_attestation_packed - Error generate_digest_raw client_data");
break;
}
if ((data.data = o_malloc(cbor_bytestring_length(auth_data) + client_data_hash_len)) == NULL) {
json_array_append_new(j_error, json_string("Internal error"));
y_log_message(Y_LOG_LEVEL_DEBUG, "check_attestation_packed - Error o_malloc data.data");
break;
}
signature.data = cbor_bytestring_handle(sig);
signature.size = cbor_bytestring_length(sig);
memcpy(data.data, cbor_bytestring_handle(auth_data), cbor_bytestring_length(auth_data));
memcpy(data.data + cbor_bytestring_length(auth_data), client_data_hash, client_data_hash_len);
data.size = cbor_bytestring_length(auth_data) + client_data_hash_len;
// packed disable SELF attestation for now
if (x5c_array == NULL) {
if (gnutls_pubkey_verify_data2(g_key, sig_alg, 0, &data, &signature)) {
json_array_append_new(j_error, json_string("Invalid signature"));
break;
}
cert_export_b64_len = 0;
cert_export_b64[0] = '\0';
} else {
if (gnutls_x509_crt_init(&cert)) {
json_array_append_new(j_error, json_string("check_attestation_packed - Error gnutls_x509_crt_init"));
break;
}
if (gnutls_pubkey_init(&pubkey)) {
json_array_append_new(j_error, json_string("check_attestation_packed - Error gnutls_pubkey_init"));
break;
}
cert_leaf = cbor_array_get(x5c_array, 0);
cert_dat.data = cbor_bytestring_handle(cert_leaf);
cert_dat.size = cbor_bytestring_length(cert_leaf);
if ((ret = gnutls_x509_crt_import(cert, &cert_dat, GNUTLS_X509_FMT_DER)) < 0) {
json_array_append_new(j_error, json_string("Error importing x509 certificate"));
y_log_message(Y_LOG_LEVEL_DEBUG, "check_attestation_packed - Error gnutls_pcert_import_x509_raw: %d", ret);
break;
}
if ((ret = gnutls_pubkey_import_x509(pubkey, cert, 0)) < 0) {
json_array_append_new(j_error, json_string("Error importing x509 certificate"));
y_log_message(Y_LOG_LEVEL_DEBUG, "check_attestation_packed - Error gnutls_pubkey_import_x509: %d", ret);
break;
}
if (gnutls_pubkey_verify_data2(pubkey, sig_alg, 0, &data, &signature)) {
json_array_append_new(j_error, json_string("Invalid signature"));
break;
}
if (validate_packed_leaf_certificate(cert, (cbor_bytestring_handle(auth_data)+ATTESTED_CRED_DATA_OFFSET)) != G_OK) {
json_array_append_new(j_error, json_string("Invalid certificate"));
break;
}
if ((ret = gnutls_x509_crt_get_key_id(cert, GNUTLS_KEYID_USE_SHA256, cert_export, &cert_export_len)) < 0) {
json_array_append_new(j_error, json_string("Error exporting x509 certificate"));
y_log_message(Y_LOG_LEVEL_DEBUG, "check_attestation_packed - Error gnutls_x509_crt_get_key_id: %d", ret);
break;
}
if (json_object_get(j_params, "root-ca-list") != json_null() && validate_certificate_from_root(j_params, cert, x5c_array) != G_OK) {
json_array_append_new(j_error, json_string("Unrecognized certificate authority"));
if (gnutls_x509_crt_get_issuer_dn2(cert, &cert_issued_by) >= 0) {
message = msprintf("Unrecognized certificate autohority: %.*s", cert_issued_by.size, cert_issued_by.data);
y_log_message(Y_LOG_LEVEL_DEBUG, "check_attestation_packed - %s", message);
o_free(message);
gnutls_free(cert_issued_by.data);
} else {
y_log_message(Y_LOG_LEVEL_DEBUG, "check_attestation_packed - Unrecognized certificate autohority (unable to get issuer dn)");
}
break;
}
if (!o_base64_encode(cert_export, cert_export_len, cert_export_b64, &cert_export_b64_len)) {
json_array_append_new(j_error, json_string("Internal error"));
y_log_message(Y_LOG_LEVEL_DEBUG, "check_attestation_packed - Error o_base64_encode cert_export");
break;
}
}
} while (0);
if (json_array_size(j_error)) {
j_return = json_pack("{sisO}", "result", G_ERROR_PARAM, "error", j_error);
} else {
j_return = json_pack("{sis{ss%}}", "result", G_OK, "data", "certificate", cert_export_b64, cert_export_b64_len);
}
json_decref(j_error);
gnutls_x509_crt_deinit(cert);
gnutls_pubkey_deinit(pubkey);
o_free(data.data);
if (cert_leaf != NULL) {
cbor_decref(&cert_leaf);
}
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "check_attestation_packed - Error allocating resources for j_error");
j_return = json_pack("{si}", "result", G_ERROR);
}
return j_return;
}
| 0
|
240,298
|
stuff_yank(int regname, char_u *p)
{
char_u *lp;
char_u **pp;
// check for read-only register
if (regname != 0 && !valid_yank_reg(regname, TRUE))
{
vim_free(p);
return FAIL;
}
if (regname == '_') // black hole: don't do anything
{
vim_free(p);
return OK;
}
get_yank_register(regname, TRUE);
if (y_append && y_current->y_array != NULL)
{
pp = &(y_current->y_array[y_current->y_size - 1]);
lp = alloc(STRLEN(*pp) + STRLEN(p) + 1);
if (lp == NULL)
{
vim_free(p);
return FAIL;
}
STRCPY(lp, *pp);
STRCAT(lp, p);
vim_free(p);
vim_free(*pp);
*pp = lp;
}
else
{
free_yank_all();
if ((y_current->y_array = ALLOC_ONE(char_u *)) == NULL)
{
vim_free(p);
return FAIL;
}
y_current->y_array[0] = p;
y_current->y_size = 1;
y_current->y_type = MCHAR; // used to be MLINE, why?
#ifdef FEAT_VIMINFO
y_current->y_time_set = vim_time();
#endif
}
return OK;
}
| 0
|
462,316
|
pcl_status_read(byte * data, uint max_data, pcl_state_t * pcs)
{
uint count = min(max_data,
pcs->status.write_pos - pcs->status.read_pos);
if (count)
memcpy(data, pcs->status.buffer + pcs->status.read_pos, count);
pcs->status.read_pos += count;
if (pcs->status.read_pos == pcs->status.write_pos) {
gs_free_object(pcs->memory, pcs->status.buffer, "status buffer");
pcs->status.buffer = NULL;
pcs->status.write_pos = pcs->status.read_pos = 0;
}
return count;
}
| 0
|
309,938
|
csi_length(const char *value)
{
int result = 0;
if (value[0] == '\033' && value[1] == '[') {
result = 2;
} else if (UChar(value[0]) == 0x9a) {
result = 1;
}
return result;
}
| 0
|
473,863
|
big5_uao_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc ARG_UNUSED)
{
return big5_mbc_enc_len0(p, e, 2, EncLen_BIG5_UAO);
}
| 0
|
513,136
|
static void update_func_int(THD *thd, struct st_mysql_sys_var *var,
void *tgt, const void *save)
{
*(int *)tgt= *(int *) save;
}
| 0
|
274,683
|
aperture_report(gerbv_aperture_t *apertures[], int aperture_num,
double x, double y, gerbv_image_t *img, gerbv_project_t *prj)
{
gerbv_aperture_type_t type = apertures[aperture_num]->type;
double *params = apertures[aperture_num]->parameter;
gerbv_simplified_amacro_t *sam = apertures[aperture_num]->simplified;
g_message (_(" Aperture used: D%d"), aperture_num);
g_message (_(" Aperture type: %s"),
(type == GERBV_APTYPE_MACRO)?
_(gerbv_aperture_type_name(sam->type)):
_(gerbv_aperture_type_name(type)));
switch (type) {
case GERBV_APTYPE_CIRCLE:
g_message (_(" Diameter: %g %s"),
screen_units(params[0]),
screen_units_str());
break;
case GERBV_APTYPE_RECTANGLE:
case GERBV_APTYPE_OVAL:
g_message (_(" Dimensions: %gx%g %s"),
screen_units(params[0]),
screen_units(params[1]),
screen_units_str());
break;
case GERBV_APTYPE_MACRO: {
switch (sam->type) {
case GERBV_APTYPE_MACRO_CIRCLE:
g_message (_(" Diameter: %g %s"),
screen_units(sam->parameter[CIRCLE_DIAMETER]),
screen_units_str());
x += sam->parameter[CIRCLE_CENTER_X];
y += sam->parameter[CIRCLE_CENTER_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Center: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
break;
case GERBV_APTYPE_MACRO_OUTLINE:
g_message (_(" Number of points: %g"),
sam->parameter[OUTLINE_NUMBER_OF_POINTS]);
x += sam->parameter[OUTLINE_FIRST_X];
y += sam->parameter[OUTLINE_FIRST_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Start: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
g_message (_(" Rotation: %g deg"),
sam->parameter[OUTLINE_ROTATION_IDX(sam->parameter)]);
break;
case GERBV_APTYPE_MACRO_POLYGON:
g_message (_(" Number of points: %g"),
sam->parameter[POLYGON_NUMBER_OF_POINTS]);
g_message (_(" Diameter: %g %s"),
screen_units(sam->parameter[POLYGON_DIAMETER]),
screen_units_str());
x += sam->parameter[POLYGON_CENTER_X];
y += sam->parameter[POLYGON_CENTER_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Center: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
g_message (_(" Rotation: %g deg"),
sam->parameter[POLYGON_ROTATION]);
break;
case GERBV_APTYPE_MACRO_MOIRE:
g_message (_(" Outside diameter: %g %s"),
screen_units(sam->parameter[MOIRE_OUTSIDE_DIAMETER]),
screen_units_str());
g_message (_(" Ring thickness: %g %s"),
screen_units(sam->parameter[MOIRE_CIRCLE_THICKNESS]),
screen_units_str());
g_message (_(" Gap width: %g %s"),
screen_units(sam->parameter[MOIRE_GAP_WIDTH]),
screen_units_str());
g_message (_(" Number of rings: %g"),
sam->parameter[MOIRE_NUMBER_OF_CIRCLES]);
g_message (_(" Crosshair thickness: %g %s"),
screen_units(
sam->parameter[MOIRE_CROSSHAIR_THICKNESS]),
screen_units_str());
g_message (_(" Crosshair length: %g %s"),
screen_units(sam->parameter[MOIRE_CROSSHAIR_LENGTH]),
screen_units_str());
x += sam->parameter[MOIRE_CENTER_X];
y += sam->parameter[MOIRE_CENTER_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Center: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
g_message (_(" Rotation: %g deg"),
sam->parameter[MOIRE_ROTATION]);
break;
case GERBV_APTYPE_MACRO_THERMAL:
g_message (_(" Outside diameter: %g %s"),
screen_units(sam->parameter[THERMAL_OUTSIDE_DIAMETER]),
screen_units_str());
g_message (_(" Inside diameter: %g %s"),
screen_units(sam->parameter[THERMAL_INSIDE_DIAMETER]),
screen_units_str());
g_message (_(" Crosshair thickness: %g %s"),
screen_units(
sam->parameter[THERMAL_CROSSHAIR_THICKNESS]),
screen_units_str());
x += sam->parameter[THERMAL_CENTER_X];
y += sam->parameter[THERMAL_CENTER_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Center: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
g_message (_(" Rotation: %g deg"),
sam->parameter[THERMAL_ROTATION]);
break;
case GERBV_APTYPE_MACRO_LINE20:
g_message (_(" Width: %g %s"),
screen_units(sam->parameter[LINE20_WIDTH]),
screen_units_str());
x += sam->parameter[LINE20_START_X];
y += sam->parameter[LINE20_START_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Start: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
x += sam->parameter[LINE20_END_X];
y += sam->parameter[LINE20_END_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Stop: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
g_message (_(" Rotation: %g deg"),
sam->parameter[LINE20_ROTATION]);
break;
case GERBV_APTYPE_MACRO_LINE21:
g_message (_(" Width: %g %s"),
screen_units(sam->parameter[LINE21_WIDTH]),
screen_units_str());
g_message (_(" Height: %g %s"),
screen_units(sam->parameter[LINE21_HEIGHT]),
screen_units_str());
x += sam->parameter[LINE21_CENTER_X];
y += sam->parameter[LINE21_CENTER_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Center: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
g_message (_(" Rotation: %g deg"),
sam->parameter[LINE21_ROTATION]);
break;
case GERBV_APTYPE_MACRO_LINE22:
g_message (_(" Width: %g %s"),
screen_units(sam->parameter[LINE22_WIDTH]),
screen_units_str());
g_message (_(" Height: %g %s"),
screen_units(sam->parameter[LINE22_HEIGHT]),
screen_units_str());
x += sam->parameter[LINE22_LOWER_LEFT_X];
y += sam->parameter[LINE22_LOWER_LEFT_Y];
gerbv_transform_coord_for_image(&x, &y, img, prj);
g_message (_(" Lower left: (%g, %g) %s"),
screen_units(x), screen_units(y),
screen_units_str());
g_message (_(" Rotation: %g deg"),
sam->parameter[LINE22_ROTATION]);
break;
default:
break;
}
break;
}
default:
break;
}
}
| 0
|
294,459
|
c_jd_to_nth_kday(int jd, double sg, int *ry, int *rm, int *rn, int *rk)
{
int rd, rjd, ns2;
c_jd_to_civil(jd, sg, ry, rm, &rd);
c_find_fdom(*ry, *rm, sg, &rjd, &ns2);
*rn = DIV(jd - rjd, 7) + 1;
*rk = c_jd_to_wday(jd);
}
| 0
|
512,295
|
virtual void quick_fix_field()
{
DBUG_ASSERT(0);
}
| 0
|
233,852
|
void fmtutil_handle_exif2(deark *c, i64 pos, i64 len,
u32 *returned_flags, u32 *orientation, u32 *exifversion)
{
int user_opt;
de_module_params *mparams = NULL;
if(returned_flags) {
*returned_flags = 0;
}
user_opt = de_get_ext_option_bool(c, "extractexif", -1);
if(user_opt==1 || (c->extract_level>=2 && user_opt!=0)) {
// Writing raw Exif data isn't very useful, but do so if requested.
dbuf_create_file_from_slice(c->infile, pos, len, "exif.tif", NULL, DE_CREATEFLAG_IS_AUX);
// Caller will have to reprocess the Exif file to extract anything from it.
return;
}
mparams = de_malloc(c, sizeof(de_module_params));
mparams->in_params.codes = "E";
de_run_module_by_id_on_slice(c, "tiff", mparams, c->infile, pos, len);
if(returned_flags) {
// FIXME: It's an unfortunate bug that returned_flags does not work if
// extract_level>=2, but for now there's no reasonable way to fix it.
// We have to process -- not extract -- the Exif chunk if we want to
// know what's in it.
*returned_flags = mparams->out_params.flags;
if((mparams->out_params.flags & 0x20) && orientation) {
*orientation = mparams->out_params.uint1;
}
if((mparams->out_params.flags & 0x40) && exifversion) {
*exifversion = mparams->out_params.uint2;
}
}
de_free(c, mparams);
}
| 0
|
424,521
|
static void video_timer(VideoClientContext* video, UINT64 now)
{
PresentationContext* presentation;
VideoClientContextPriv* priv = video->priv;
VideoFrame *peekFrame, *frame = NULL;
EnterCriticalSection(&priv->framesLock);
do
{
peekFrame = (VideoFrame*)Queue_Peek(priv->frames);
if (!peekFrame)
break;
if (peekFrame->publishTime > now)
break;
if (frame)
{
WLog_DBG(TAG, "dropping frame @%" PRIu64, frame->publishTime);
priv->droppedFrames++;
VideoFrame_free(&frame);
}
frame = peekFrame;
Queue_Dequeue(priv->frames);
} while (1);
LeaveCriticalSection(&priv->framesLock);
if (!frame)
goto treat_feedback;
presentation = frame->presentation;
priv->publishedFrames++;
memcpy(presentation->surfaceData, frame->surfaceData, frame->w * frame->h * 4);
video->showSurface(video, presentation->surface);
VideoFrame_free(&frame);
treat_feedback:
if (priv->nextFeedbackTime < now)
{
/* we can compute some feedback only if we have some published frames and
* a current presentation
*/
if (priv->publishedFrames && priv->currentPresentation)
{
UINT32 computedRate;
InterlockedIncrement(&priv->currentPresentation->refCounter);
if (priv->droppedFrames)
{
/**
* some dropped frames, looks like we're asking too many frames per seconds,
* try lowering rate. We go directly from unlimited rate to 24 frames/seconds
* otherwise we lower rate by 2 frames by seconds
*/
if (priv->lastSentRate == XF_VIDEO_UNLIMITED_RATE)
computedRate = 24;
else
{
computedRate = priv->lastSentRate - 2;
if (!computedRate)
computedRate = 2;
}
}
else
{
/**
* we treat all frames ok, so either ask the server to send more,
* or stay unlimited
*/
if (priv->lastSentRate == XF_VIDEO_UNLIMITED_RATE)
computedRate = XF_VIDEO_UNLIMITED_RATE; /* stay unlimited */
else
{
computedRate = priv->lastSentRate + 2;
if (computedRate > XF_VIDEO_UNLIMITED_RATE)
computedRate = XF_VIDEO_UNLIMITED_RATE;
}
}
if (computedRate != priv->lastSentRate)
{
TSMM_CLIENT_NOTIFICATION notif;
notif.PresentationId = priv->currentPresentation->PresentationId;
notif.NotificationType = TSMM_CLIENT_NOTIFICATION_TYPE_FRAMERATE_OVERRIDE;
if (computedRate == XF_VIDEO_UNLIMITED_RATE)
{
notif.FramerateOverride.Flags = 0x01;
notif.FramerateOverride.DesiredFrameRate = 0x00;
}
else
{
notif.FramerateOverride.Flags = 0x02;
notif.FramerateOverride.DesiredFrameRate = computedRate;
}
video_control_send_client_notification(video, ¬if);
priv->lastSentRate = computedRate;
WLog_DBG(TAG, "server notified with rate %d published=%d dropped=%d",
priv->lastSentRate, priv->publishedFrames, priv->droppedFrames);
}
PresentationContext_unref(priv->currentPresentation);
}
WLog_DBG(TAG, "currentRate=%d published=%d dropped=%d", priv->lastSentRate,
priv->publishedFrames, priv->droppedFrames);
priv->droppedFrames = 0;
priv->publishedFrames = 0;
priv->nextFeedbackTime = now + 1000;
}
}
| 0
|
486,799
|
static void gem_init(Object *obj)
{
CadenceGEMState *s = CADENCE_GEM(obj);
DeviceState *dev = DEVICE(obj);
DB_PRINT("\n");
gem_init_register_masks(s);
memory_region_init_io(&s->iomem, OBJECT(s), &gem_ops, s,
"enet", sizeof(s->regs));
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
object_property_add_link(obj, "dma", TYPE_MEMORY_REGION,
(Object **)&s->dma_mr,
qdev_prop_allow_set_link_before_realize,
OBJ_PROP_LINK_STRONG);
}
| 0
|
384,683
|
send_newstyle_option_reply_meta_context (uint32_t option, uint32_t reply,
uint32_t context_id,
const char *name)
{
GET_CONN;
struct nbd_fixed_new_option_reply fixed_new_option_reply;
struct nbd_fixed_new_option_reply_meta_context context;
const size_t namelen = strlen (name);
debug ("newstyle negotiation: %s: replying with %s id %d",
name_of_nbd_opt (option), name, context_id);
fixed_new_option_reply.magic = htobe64 (NBD_REP_MAGIC);
fixed_new_option_reply.option = htobe32 (option);
fixed_new_option_reply.reply = htobe32 (reply);
fixed_new_option_reply.replylen = htobe32 (sizeof context + namelen);
context.context_id = htobe32 (context_id);
if (conn->send (&fixed_new_option_reply,
sizeof fixed_new_option_reply, SEND_MORE) == -1 ||
conn->send (&context, sizeof context, SEND_MORE) == -1 ||
conn->send (name, namelen, 0) == -1) {
nbdkit_error ("write: %s: %m", name_of_nbd_opt (option));
return -1;
}
return 0;
}
| 0
|
254,903
|
DocumentSourceGroup::rewriteGroupAsTransformOnFirstDocument() const {
if (_idExpressions.size() != 1) {
// This transformation is only intended for $group stages that group on a single field.
return nullptr;
}
auto fieldPathExpr = dynamic_cast<ExpressionFieldPath*>(_idExpressions.front().get());
if (!fieldPathExpr || !fieldPathExpr->isRootFieldPath()) {
return nullptr;
}
const auto fieldPath = fieldPathExpr->getFieldPath();
if (fieldPath.getPathLength() == 1) {
// The path is $$CURRENT or $$ROOT. This isn't really a sensible value to group by (since
// each document has a unique _id, it will just return the entire collection). We only
// apply the rewrite when grouping by a single field, so we cannot apply it in this case,
// where we are grouping by the entire document.
invariant(fieldPath.getFieldName(0) == "CURRENT" || fieldPath.getFieldName(0) == "ROOT");
return nullptr;
}
const auto groupId = fieldPath.tail().fullPath();
// We can't do this transformation if there are any non-$first accumulators.
for (auto&& accumulator : _accumulatedFields) {
if (AccumulatorDocumentsNeeded::kFirstDocument !=
accumulator.makeAccumulator()->documentsNeeded()) {
return nullptr;
}
}
std::vector<std::pair<std::string, boost::intrusive_ptr<Expression>>> fields;
boost::intrusive_ptr<Expression> idField;
// The _id field can be specified either as a fieldpath (ex. _id: "$a") or as a singleton
// object (ex. _id: {v: "$a"}).
if (_idFieldNames.empty()) {
idField = ExpressionFieldPath::create(pExpCtx.get(), groupId);
} else {
invariant(_idFieldNames.size() == 1);
idField = ExpressionObject::create(pExpCtx.get(),
{{_idFieldNames.front(), _idExpressions.front()}});
}
fields.push_back(std::make_pair("_id", idField));
for (auto&& accumulator : _accumulatedFields) {
fields.push_back(std::make_pair(accumulator.fieldName, accumulator.expr.argument));
// Since we don't attempt this transformation for non-$first accumulators,
// the initializer should always be trivial.
}
return GroupFromFirstDocumentTransformation::create(pExpCtx, groupId, std::move(fields));
}
| 0
|
508,820
|
bool LEX::save_prep_leaf_tables()
{
if (!thd->save_prep_leaf_list)
return FALSE;
Query_arena *arena= thd->stmt_arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
//It is used for DETETE/UPDATE so top level has only one SELECT
DBUG_ASSERT(select_lex.next_select() == NULL);
bool res= select_lex.save_prep_leaf_tables(thd);
if (arena)
thd->restore_active_arena(arena, &backup);
if (res)
return TRUE;
thd->save_prep_leaf_list= FALSE;
return FALSE;
}
| 0
|
413,856
|
Method* LinkResolver::linktime_resolve_interface_method_or_null(
const LinkInfo& link_info) {
EXCEPTION_MARK;
Method* method_result = linktime_resolve_interface_method(link_info, THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
return NULL;
} else {
return method_result;
}
}
| 0
|
459,126
|
static void tcf_block_owner_del(struct tcf_block *block,
struct Qdisc *q,
enum flow_block_binder_type binder_type)
{
struct tcf_block_owner_item *item;
list_for_each_entry(item, &block->owner_list, list) {
if (item->q == q && item->binder_type == binder_type) {
list_del(&item->list);
kfree(item);
return;
}
}
WARN_ON(1);
}
| 0
|
387,727
|
bool InstanceKlass::is_dependent_nmethod(nmethod* nm) {
return dependencies().is_dependent_nmethod(nm);
}
| 0
|
506,696
|
int setup_tests(void)
{
ADD_ALL_TESTS(call_run_cert, OSSL_NELEM(name_fns));
ADD_TEST(test_GENERAL_NAME_cmp);
return 1;
}
| 0
|
253,517
|
parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
size_t buf_len,
struct cifs_server_iface **iface_list,
size_t *iface_count)
{
struct network_interface_info_ioctl_rsp *p;
struct sockaddr_in *addr4;
struct sockaddr_in6 *addr6;
struct iface_info_ipv4 *p4;
struct iface_info_ipv6 *p6;
struct cifs_server_iface *info;
ssize_t bytes_left;
size_t next = 0;
int nb_iface = 0;
int rc = 0;
*iface_list = NULL;
*iface_count = 0;
/*
* Fist pass: count and sanity check
*/
bytes_left = buf_len;
p = buf;
while (bytes_left >= sizeof(*p)) {
nb_iface++;
next = le32_to_cpu(p->Next);
if (!next) {
bytes_left -= sizeof(*p);
break;
}
p = (struct network_interface_info_ioctl_rsp *)((u8 *)p+next);
bytes_left -= next;
}
if (!nb_iface) {
cifs_dbg(VFS, "%s: malformed interface info\n", __func__);
rc = -EINVAL;
goto out;
}
/* Azure rounds the buffer size up 8, to a 16 byte boundary */
if ((bytes_left > 8) || p->Next)
cifs_dbg(VFS, "%s: incomplete interface info\n", __func__);
/*
* Second pass: extract info to internal structure
*/
*iface_list = kcalloc(nb_iface, sizeof(**iface_list), GFP_KERNEL);
if (!*iface_list) {
rc = -ENOMEM;
goto out;
}
info = *iface_list;
bytes_left = buf_len;
p = buf;
while (bytes_left >= sizeof(*p)) {
info->speed = le64_to_cpu(p->LinkSpeed);
info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0;
info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0;
cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, *iface_count);
cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed);
cifs_dbg(FYI, "%s: capabilities 0x%08x\n", __func__,
le32_to_cpu(p->Capability));
switch (p->Family) {
/*
* The kernel and wire socket structures have the same
* layout and use network byte order but make the
* conversion explicit in case either one changes.
*/
case INTERNETWORK:
addr4 = (struct sockaddr_in *)&info->sockaddr;
p4 = (struct iface_info_ipv4 *)p->Buffer;
addr4->sin_family = AF_INET;
memcpy(&addr4->sin_addr, &p4->IPv4Address, 4);
/* [MS-SMB2] 2.2.32.5.1.1 Clients MUST ignore these */
addr4->sin_port = cpu_to_be16(CIFS_PORT);
cifs_dbg(FYI, "%s: ipv4 %pI4\n", __func__,
&addr4->sin_addr);
break;
case INTERNETWORKV6:
addr6 = (struct sockaddr_in6 *)&info->sockaddr;
p6 = (struct iface_info_ipv6 *)p->Buffer;
addr6->sin6_family = AF_INET6;
memcpy(&addr6->sin6_addr, &p6->IPv6Address, 16);
/* [MS-SMB2] 2.2.32.5.1.2 Clients MUST ignore these */
addr6->sin6_flowinfo = 0;
addr6->sin6_scope_id = 0;
addr6->sin6_port = cpu_to_be16(CIFS_PORT);
cifs_dbg(FYI, "%s: ipv6 %pI6\n", __func__,
&addr6->sin6_addr);
break;
default:
cifs_dbg(VFS,
"%s: skipping unsupported socket family\n",
__func__);
goto next_iface;
}
(*iface_count)++;
info++;
next_iface:
next = le32_to_cpu(p->Next);
if (!next)
break;
p = (struct network_interface_info_ioctl_rsp *)((u8 *)p+next);
bytes_left -= next;
}
if (!*iface_count) {
rc = -EINVAL;
goto out;
}
out:
if (rc) {
kfree(*iface_list);
*iface_count = 0;
*iface_list = NULL;
}
return rc;
}
| 0
|
248,272
|
DLLIMPORT int cfg_parse(cfg_t *cfg, const char *filename)
{
int ret;
char *fn;
FILE *fp;
if (!cfg || !filename) {
errno = EINVAL;
return CFG_FILE_ERROR;
}
if (cfg->path)
fn = cfg_searchpath(cfg->path, filename);
else
fn = cfg_tilde_expand(filename);
if (!fn)
return CFG_FILE_ERROR;
free(cfg->filename);
cfg->filename = fn;
fp = fopen(cfg->filename, "r");
if (!fp)
return CFG_FILE_ERROR;
ret = cfg_parse_fp(cfg, fp);
fclose(fp);
return ret;
}
| 0
|
432,186
|
static MemTxResult subpage_read(struct uc_struct *uc, void *opaque, hwaddr addr, uint64_t *data,
unsigned len, MemTxAttrs attrs)
{
subpage_t *subpage = opaque;
uint8_t buf[8];
MemTxResult res;
#if defined(DEBUG_SUBPAGE)
printf("%s: subpage %p len %u addr " TARGET_FMT_plx "\n", __func__,
subpage, len, addr);
#endif
res = flatview_read(uc, subpage->fv, addr + subpage->base, attrs, buf, len);
if (res) {
return res;
}
*data = ldn_p(buf, len);
return MEMTX_OK;
}
| 0
|
226,343
|
GF_Err tfxd_box_read(GF_Box *s, GF_BitStream *bs)
{
GF_MSSTimeExtBox *ptr = (GF_MSSTimeExtBox *)s;
ISOM_DECREASE_SIZE(ptr, 4);
ptr->version = gf_bs_read_u8(bs);
ptr->flags = gf_bs_read_u24(bs);
if (ptr->version == 0x01) {
ISOM_DECREASE_SIZE(ptr, 16);
ptr->absolute_time_in_track_timescale = gf_bs_read_u64(bs);
ptr->fragment_duration_in_track_timescale = gf_bs_read_u64(bs);
} else {
ISOM_DECREASE_SIZE(ptr, 8);
ptr->absolute_time_in_track_timescale = gf_bs_read_u32(bs);
ptr->fragment_duration_in_track_timescale = gf_bs_read_u32(bs);
}
return GF_OK;
}
| 0
|
281,054
|
static void xfrm_statistics_fini(struct net *net)
{
xfrm_proc_fini(net);
free_percpu(net->mib.xfrm_statistics);
}
| 0
|
455,293
|
finddirs (pat, sdir, flags, ep, np)
char *pat;
char *sdir;
int flags;
struct globval **ep;
int *np;
{
char **r, *n;
int ndirs;
struct globval *ret, *e, *g;
/*itrace("finddirs: pat = `%s' sdir = `%s' flags = 0x%x", pat, sdir, flags);*/
e = ret = 0;
r = glob_vector (pat, sdir, flags);
if (r == 0 || r[0] == 0)
{
if (np)
*np = 0;
if (ep)
*ep = 0;
if (r && r != &glob_error_return)
free (r);
return (struct globval *)0;
}
for (ndirs = 0; r[ndirs] != 0; ndirs++)
{
g = (struct globval *) malloc (sizeof (struct globval));
if (g == 0)
{
while (ret) /* free list built so far */
{
g = ret->next;
free (ret);
ret = g;
}
free (r);
if (np)
*np = 0;
if (ep)
*ep = 0;
return (&finddirs_error_return);
}
if (e == 0)
e = g;
g->next = ret;
ret = g;
g->name = r[ndirs];
}
free (r);
if (ep)
*ep = e;
if (np)
*np = ndirs;
return ret;
}
| 0
|
252,378
|
static int tdefl_flush_block(tdefl_compressor *d, int flush) {
mz_uint saved_bit_buf, saved_bits_in;
mz_uint8 *pSaved_output_buf;
mz_bool comp_block_succeeded = MZ_FALSE;
int n, use_raw_block =
((d->m_flags & TDEFL_FORCE_ALL_RAW_BLOCKS) != 0) &&
(d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size;
mz_uint8 *pOutput_buf_start =
((d->m_pPut_buf_func == NULL) &&
((*d->m_pOut_buf_size - d->m_out_buf_ofs) >= TDEFL_OUT_BUF_SIZE))
? ((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs)
: d->m_output_buf;
d->m_pOutput_buf = pOutput_buf_start;
d->m_pOutput_buf_end = d->m_pOutput_buf + TDEFL_OUT_BUF_SIZE - 16;
MZ_ASSERT(!d->m_output_flush_remaining);
d->m_output_flush_ofs = 0;
d->m_output_flush_remaining = 0;
*d->m_pLZ_flags = (mz_uint8)(*d->m_pLZ_flags >> d->m_num_flags_left);
d->m_pLZ_code_buf -= (d->m_num_flags_left == 8);
if ((d->m_flags & TDEFL_WRITE_ZLIB_HEADER) && (!d->m_block_index)) {
TDEFL_PUT_BITS(0x78, 8);
TDEFL_PUT_BITS(0x01, 8);
}
TDEFL_PUT_BITS(flush == TDEFL_FINISH, 1);
pSaved_output_buf = d->m_pOutput_buf;
saved_bit_buf = d->m_bit_buffer;
saved_bits_in = d->m_bits_in;
if (!use_raw_block)
comp_block_succeeded =
tdefl_compress_block(d, (d->m_flags & TDEFL_FORCE_ALL_STATIC_BLOCKS) ||
(d->m_total_lz_bytes < 48));
// If the block gets expanded, forget the current contents of the output
// buffer and send a raw block instead.
if (((use_raw_block) ||
((d->m_total_lz_bytes) && ((d->m_pOutput_buf - pSaved_output_buf + 1U) >=
d->m_total_lz_bytes))) &&
((d->m_lookahead_pos - d->m_lz_code_buf_dict_pos) <= d->m_dict_size)) {
mz_uint i;
d->m_pOutput_buf = pSaved_output_buf;
d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in;
TDEFL_PUT_BITS(0, 2);
if (d->m_bits_in) {
TDEFL_PUT_BITS(0, 8 - d->m_bits_in);
}
for (i = 2; i; --i, d->m_total_lz_bytes ^= 0xFFFF) {
TDEFL_PUT_BITS(d->m_total_lz_bytes & 0xFFFF, 16);
}
for (i = 0; i < d->m_total_lz_bytes; ++i) {
TDEFL_PUT_BITS(
d->m_dict[(d->m_lz_code_buf_dict_pos + i) & TDEFL_LZ_DICT_SIZE_MASK],
8);
}
}
// Check for the extremely unlikely (if not impossible) case of the compressed
// block not fitting into the output buffer when using dynamic codes.
else if (!comp_block_succeeded) {
d->m_pOutput_buf = pSaved_output_buf;
d->m_bit_buffer = saved_bit_buf, d->m_bits_in = saved_bits_in;
tdefl_compress_block(d, MZ_TRUE);
}
if (flush) {
if (flush == TDEFL_FINISH) {
if (d->m_bits_in) {
TDEFL_PUT_BITS(0, 8 - d->m_bits_in);
}
if (d->m_flags & TDEFL_WRITE_ZLIB_HEADER) {
mz_uint i, a = d->m_adler32;
for (i = 0; i < 4; i++) {
TDEFL_PUT_BITS((a >> 24) & 0xFF, 8);
a <<= 8;
}
}
} else {
mz_uint i, z = 0;
TDEFL_PUT_BITS(0, 3);
if (d->m_bits_in) {
TDEFL_PUT_BITS(0, 8 - d->m_bits_in);
}
for (i = 2; i; --i, z ^= 0xFFFF) {
TDEFL_PUT_BITS(z & 0xFFFF, 16);
}
}
}
MZ_ASSERT(d->m_pOutput_buf < d->m_pOutput_buf_end);
memset(&d->m_huff_count[0][0], 0,
sizeof(d->m_huff_count[0][0]) * TDEFL_MAX_HUFF_SYMBOLS_0);
memset(&d->m_huff_count[1][0], 0,
sizeof(d->m_huff_count[1][0]) * TDEFL_MAX_HUFF_SYMBOLS_1);
d->m_pLZ_code_buf = d->m_lz_code_buf + 1;
d->m_pLZ_flags = d->m_lz_code_buf;
d->m_num_flags_left = 8;
d->m_lz_code_buf_dict_pos += d->m_total_lz_bytes;
d->m_total_lz_bytes = 0;
d->m_block_index++;
if ((n = (int)(d->m_pOutput_buf - pOutput_buf_start)) != 0) {
if (d->m_pPut_buf_func) {
*d->m_pIn_buf_size = d->m_pSrc - (const mz_uint8 *)d->m_pIn_buf;
if (!(*d->m_pPut_buf_func)(d->m_output_buf, n, d->m_pPut_buf_user))
return (d->m_prev_return_status = TDEFL_STATUS_PUT_BUF_FAILED);
} else if (pOutput_buf_start == d->m_output_buf) {
int bytes_to_copy = (int)MZ_MIN(
(size_t)n, (size_t)(*d->m_pOut_buf_size - d->m_out_buf_ofs));
memcpy((mz_uint8 *)d->m_pOut_buf + d->m_out_buf_ofs, d->m_output_buf,
bytes_to_copy);
d->m_out_buf_ofs += bytes_to_copy;
if ((n -= bytes_to_copy) != 0) {
d->m_output_flush_ofs = bytes_to_copy;
d->m_output_flush_remaining = n;
}
} else {
d->m_out_buf_ofs += n;
}
}
return d->m_output_flush_remaining;
}
| 0
|
225,952
|
void tfrf_box_del(GF_Box *s)
{
GF_MSSTimeRefBox *ptr = (GF_MSSTimeRefBox *)s;
if (ptr->frags) gf_free(ptr->frags);
gf_free(s);
}
| 0
|
512,995
|
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
cached_time.copy_to_mysql_time(ltime);
return (null_value= false);
}
| 0
|
466,125
|
static int em_bsf(struct x86_emulate_ctxt *ctxt)
{
u8 zf;
__asm__ ("bsf %2, %0; setz %1"
: "=r"(ctxt->dst.val), "=q"(zf)
: "r"(ctxt->src.val));
ctxt->eflags &= ~X86_EFLAGS_ZF;
if (zf) {
ctxt->eflags |= X86_EFLAGS_ZF;
/* Disable writeback. */
ctxt->dst.type = OP_NONE;
}
return X86EMUL_CONTINUE;
}
| 0
|
294,438
|
test_unit_v2v_iter2(VALUE (* conv1)(VALUE),
VALUE (* conv2)(VALUE))
{
if (!test_unit_v2v(INT2FIX(0), conv1, conv2))
return 0;
if (!test_unit_v2v(INT2FIX(1), conv1, conv2))
return 0;
if (!test_unit_v2v(INT2FIX(2), conv1, conv2))
return 0;
if (!test_unit_v2v(INT2FIX(3), conv1, conv2))
return 0;
if (!test_unit_v2v(INT2FIX(11), conv1, conv2))
return 0;
if (!test_unit_v2v(INT2FIX(65535), conv1, conv2))
return 0;
if (!test_unit_v2v(INT2FIX(1073741823), conv1, conv2))
return 0;
if (!test_unit_v2v(INT2NUM(1073741824), conv1, conv2))
return 0;
if (!test_unit_v2v(rb_rational_new2(INT2FIX(0), INT2FIX(1)), conv1, conv2))
return 0;
if (!test_unit_v2v(rb_rational_new2(INT2FIX(1), INT2FIX(1)), conv1, conv2))
return 0;
if (!test_unit_v2v(rb_rational_new2(INT2FIX(1), INT2FIX(2)), conv1, conv2))
return 0;
if (!test_unit_v2v(rb_rational_new2(INT2FIX(2), INT2FIX(3)), conv1, conv2))
return 0;
return 1;
}
| 0
|
261,227
|
static inline int MqttIsPubRespPacket(int packet_type)
{
return (packet_type == MQTT_PACKET_TYPE_PUBLISH_ACK /* Acknowledgment */ ||
packet_type == MQTT_PACKET_TYPE_PUBLISH_REC /* Received */ ||
packet_type == MQTT_PACKET_TYPE_PUBLISH_REL /* Release */ ||
packet_type == MQTT_PACKET_TYPE_PUBLISH_COMP /* Complete */);
}
| 0
|
292,137
|
void LinkResolver::resolve_invoke(CallInfo& result, Handle& recv,
const methodHandle& attached_method,
Bytecodes::Code byte, TRAPS) {
Klass* defc = attached_method->method_holder();
Symbol* name = attached_method->name();
Symbol* type = attached_method->signature();
LinkInfo link_info(defc, name, type);
switch(byte) {
case Bytecodes::_invokevirtual:
resolve_virtual_call(result, recv, recv->klass(), link_info,
/*check_null_and_abstract=*/true, CHECK);
break;
case Bytecodes::_invokeinterface:
resolve_interface_call(result, recv, recv->klass(), link_info,
/*check_null_and_abstract=*/true, CHECK);
break;
case Bytecodes::_invokestatic:
resolve_static_call(result, link_info, /*initialize_class=*/false, CHECK);
break;
case Bytecodes::_invokespecial:
resolve_special_call(result, recv, link_info, CHECK);
break;
default:
fatal("bad call: %s", Bytecodes::name(byte));
break;
}
}
| 0
|
508,341
|
bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_STRING *db,
LEX_STRING *table, thr_lock_type lock_type)
{
for (; tl; tl= tl->next_global )
{
if (tl->lock_type >= lock_type &&
tl->prelocking_placeholder == TABLE_LIST::FK &&
strcmp(tl->db, db->str) == 0 &&
strcmp(tl->table_name, table->str) == 0)
return true;
}
return false;
}
| 0
|
259,084
|
Status run(BundleReader* reader) {
TensorShape restored_full_shape;
TF_RETURN_IF_ERROR(
reader->LookupTensorShape(tensor_name, &restored_full_shape));
VLOG(1) << "Restoring tensor " << idx << " : " << tensor_name << " : "
<< restored_full_shape.num_elements();
Tensor* restored_tensor;
if (shape_and_slice.empty()) {
// Lookup the full tensor.
TF_RETURN_IF_ERROR(
context->allocate_output(idx, restored_full_shape, &restored_tensor));
TF_RETURN_IF_ERROR(reader->Lookup(tensor_name, restored_tensor));
} else {
// Lookup the slice.
TensorShape parsed_full_shape;
TensorSlice parsed_slice;
TensorShape parsed_slice_shape;
TF_RETURN_IF_ERROR(
checkpoint::ParseShapeAndSlice(shape_and_slice, &parsed_full_shape,
&parsed_slice, &parsed_slice_shape));
if (!restored_full_shape.IsSameSize(parsed_full_shape)) {
return errors::InvalidArgument(
"tensor_name = ", tensor_name, "; shape in shape_and_slice spec ",
parsed_full_shape.DebugString(),
" does not match the shape stored in checkpoint: ",
restored_full_shape.DebugString());
}
TF_RETURN_IF_ERROR(
context->allocate_output(idx, parsed_slice_shape, &restored_tensor));
TF_RETURN_IF_ERROR(
reader->LookupSlice(tensor_name, parsed_slice, restored_tensor));
}
if (VLOG_IS_ON(5)) {
if (restored_tensor->dtype() == DT_FLOAT) {
const float* t_data = restored_tensor->flat<float>().data();
float min = std::numeric_limits<float>::infinity();
float max = -std::numeric_limits<float>::infinity();
double avg = 0.0;
for (int i = 0; i < restored_tensor->NumElements(); ++i) {
if (t_data[i] < min) min = t_data[i];
if (t_data[i] > max) max = t_data[i];
avg += t_data[i];
}
VLOG(5) << " min " << min << " max " << max << " avg "
<< avg / restored_tensor->NumElements() << " total elts "
<< restored_tensor->NumElements();
}
}
VLOG(1) << "Done restoring tensor " << idx << " : " << tensor_name << " : "
<< restored_full_shape.num_elements();
return Status::OK();
}
| 0
|
513,051
|
void print(String *str, enum_query_type query_type)
{
str->append(STRING_WITH_LEN("ignore"));
}
| 0
|
221,154
|
void gf_odf_vp_cfg_del(GF_VPConfig *cfg)
{
if (!cfg) return;
if (cfg->codec_initdata) {
gf_free(cfg->codec_initdata);
cfg->codec_initdata = NULL;
}
gf_free(cfg);
}
| 0
|
384,876
|
expand_backtick(
garray_T *gap,
char_u *pat,
int flags) // EW_* flags
{
char_u *p;
char_u *cmd;
char_u *buffer;
int cnt = 0;
int i;
// Create the command: lop off the backticks.
cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2);
if (cmd == NULL)
return -1;
#ifdef FEAT_EVAL
if (*cmd == '=') // `={expr}`: Expand expression
buffer = eval_to_string(cmd + 1, TRUE);
else
#endif
buffer = get_cmd_output(cmd, NULL,
(flags & EW_SILENT) ? SHELL_SILENT : 0, NULL);
vim_free(cmd);
if (buffer == NULL)
return -1;
cmd = buffer;
while (*cmd != NUL)
{
cmd = skipwhite(cmd); // skip over white space
p = cmd;
while (*p != NUL && *p != '\r' && *p != '\n') // skip over entry
++p;
// add an entry if it is not empty
if (p > cmd)
{
i = *p;
*p = NUL;
addfile(gap, cmd, flags);
*p = i;
++cnt;
}
cmd = p;
while (*cmd != NUL && (*cmd == '\r' || *cmd == '\n'))
++cmd;
}
vim_free(buffer);
return cnt;
}
| 0
|
359,481
|
peer_lookup_vty (struct vty *vty, const char *ip_str)
{
int ret;
struct bgp *bgp;
union sockunion su;
struct peer *peer;
bgp = vty->index;
ret = str2sockunion (ip_str, &su);
if (ret < 0)
{
vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
return NULL;
}
peer = peer_lookup (bgp, &su);
if (! peer)
{
vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
return NULL;
}
return peer;
}
| 0
|
326,646
|
hfs_write_decmpfs_block(struct archive_write_disk *a, const char *buff,
size_t size)
{
const char *buffer_to_write;
size_t bytes_to_write;
int ret;
if (a->decmpfs_block_count == (unsigned)-1) {
void *new_block;
size_t new_size;
unsigned int block_count;
if (a->decmpfs_header_p == NULL) {
new_block = malloc(MAX_DECMPFS_XATTR_SIZE
+ sizeof(uint32_t));
if (new_block == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for decmpfs");
return (ARCHIVE_FATAL);
}
a->decmpfs_header_p = new_block;
}
a->decmpfs_attr_size = DECMPFS_HEADER_SIZE;
archive_le32enc(&a->decmpfs_header_p[DECMPFS_COMPRESSION_MAGIC],
DECMPFS_MAGIC);
archive_le32enc(&a->decmpfs_header_p[DECMPFS_COMPRESSION_TYPE],
CMP_RESOURCE_FORK);
archive_le64enc(&a->decmpfs_header_p[DECMPFS_UNCOMPRESSED_SIZE],
a->filesize);
/* Calculate a block count of the file. */
block_count =
(a->filesize + MAX_DECMPFS_BLOCK_SIZE -1) /
MAX_DECMPFS_BLOCK_SIZE;
/*
* Allocate buffer for resource fork.
* Set up related pointers;
*/
new_size =
RSRC_H_SIZE + /* header */
4 + /* Block count */
(block_count * sizeof(uint32_t) * 2) +
RSRC_F_SIZE; /* footer */
if (new_size > a->resource_fork_allocated_size) {
new_block = realloc(a->resource_fork, new_size);
if (new_block == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for ResourceFork");
return (ARCHIVE_FATAL);
}
a->resource_fork_allocated_size = new_size;
a->resource_fork = new_block;
}
/* Allocate uncompressed buffer */
if (a->uncompressed_buffer == NULL) {
new_block = malloc(MAX_DECMPFS_BLOCK_SIZE);
if (new_block == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate memory for decmpfs");
return (ARCHIVE_FATAL);
}
a->uncompressed_buffer = new_block;
}
a->block_remaining_bytes = MAX_DECMPFS_BLOCK_SIZE;
a->file_remaining_bytes = a->filesize;
a->compressed_buffer_remaining = a->compressed_buffer_size;
/*
* Set up a resource fork.
*/
a->rsrc_xattr_options = XATTR_CREATE;
/* Get the position where we are going to set a bunch
* of block info. */
a->decmpfs_block_info =
(uint32_t *)(a->resource_fork + RSRC_H_SIZE);
/* Set the block count to the resource fork. */
archive_le32enc(a->decmpfs_block_info++, block_count);
/* Get the position where we are going to set compressed
* data. */
a->compressed_rsrc_position =
RSRC_H_SIZE + 4 + (block_count * 8);
a->compressed_rsrc_position_v = a->compressed_rsrc_position;
a->decmpfs_block_count = block_count;
}
/* Ignore redundant bytes. */
if (a->file_remaining_bytes == 0)
return ((ssize_t)size);
/* Do not overrun a block size. */
if (size > a->block_remaining_bytes)
bytes_to_write = a->block_remaining_bytes;
else
bytes_to_write = size;
/* Do not overrun the file size. */
if (bytes_to_write > a->file_remaining_bytes)
bytes_to_write = a->file_remaining_bytes;
/* For efficiency, if a copy length is full of the uncompressed
* buffer size, do not copy writing data to it. */
if (bytes_to_write == MAX_DECMPFS_BLOCK_SIZE)
buffer_to_write = buff;
else {
memcpy(a->uncompressed_buffer +
MAX_DECMPFS_BLOCK_SIZE - a->block_remaining_bytes,
buff, bytes_to_write);
buffer_to_write = a->uncompressed_buffer;
}
a->block_remaining_bytes -= bytes_to_write;
a->file_remaining_bytes -= bytes_to_write;
if (a->block_remaining_bytes == 0 || a->file_remaining_bytes == 0) {
ret = hfs_drive_compressor(a, buffer_to_write,
MAX_DECMPFS_BLOCK_SIZE - a->block_remaining_bytes);
if (ret < 0)
return (ret);
a->block_remaining_bytes = MAX_DECMPFS_BLOCK_SIZE;
}
/* Ignore redundant bytes. */
if (a->file_remaining_bytes == 0)
return ((ssize_t)size);
return (bytes_to_write);
}
| 0
|
353,180
|
SplashGouraudPattern::~SplashGouraudPattern() {
}
| 0
|
246,692
|
static GF_Err do_compress_top_boxes(char *inName, char *outName)
{
FILE *in, *out;
u8 *buf;
u32 buf_alloc, comp_size;
s32 bytes_comp=0;
s32 bytes_uncomp=0;
GF_Err e = GF_OK;
u64 source_size, dst_size;
u32 orig_box_overhead;
u32 final_box_overhead;
u32 nb_added_box_bytes=0;
Bool has_mov = GF_FALSE;
Bool replace_all = !strcmp(compress_top_boxes, "*");
GF_BitStream *bs_in, *bs_out;
if (!outName) {
M4_LOG(GF_LOG_ERROR, ("Missing output file name\n"));
return GF_BAD_PARAM;
}
in = gf_fopen(inName, "rb");
if (!in) return GF_URL_ERROR;
out = gf_fopen(outName, "wb");
if (!out) return GF_IO_ERR;
buf_alloc = 4096;
buf = gf_malloc(buf_alloc);
bs_in = gf_bs_from_file(in, GF_BITSTREAM_READ);
source_size = gf_bs_get_size(bs_in);
bs_out = gf_bs_from_file(out, GF_BITSTREAM_WRITE);
orig_box_overhead = 0;
final_box_overhead = 0;
while (gf_bs_available(bs_in)) {
u32 size = gf_bs_read_u32(bs_in);
u32 type = gf_bs_read_u32(bs_in);
const char *b4cc = gf_4cc_to_str(type);
const u8 *replace = (const u8 *) strstr(compress_top_boxes, b4cc);
if (!strcmp(b4cc, "moov")) has_mov = GF_TRUE;
if (!replace && !replace_all) {
gf_bs_write_u32(bs_out, size);
gf_bs_write_u32(bs_out, type);
size-=8;
while (size) {
u32 nbytes = size;
if (nbytes>buf_alloc) nbytes=buf_alloc;
gf_bs_read_data(bs_in, buf, nbytes);
gf_bs_write_data(bs_out, buf, nbytes);
size-=nbytes;
}
continue;
}
orig_box_overhead += size;
size-=8;
if (size>buf_alloc) {
buf_alloc = size;
buf = gf_realloc(buf, buf_alloc);
}
gf_bs_read_data(bs_in, buf, size);
replace+=5;
comp_size = buf_alloc;
e = gf_gz_compress_payload(&buf, size, &comp_size);
if (e) break;
if (comp_size>buf_alloc) {
buf_alloc = comp_size;
}
bytes_uncomp += size;
bytes_comp += comp_size;
//write size
gf_bs_write_u32(bs_out, comp_size+8);
//write type
gf_bs_write_data(bs_out, replace, 4);
//write data
gf_bs_write_data(bs_out, buf, comp_size);
final_box_overhead += 8+comp_size;
}
dst_size = gf_bs_get_position(bs_out);
if (buf) gf_free(buf);
gf_bs_del(bs_in);
gf_bs_del(bs_out);
gf_fclose(in);
gf_fclose(out);
if (e) {
M4_LOG(GF_LOG_ERROR, ("Error compressing: %s\n", gf_error_to_string(e)));
return e;
}
if (has_mov) {
u32 i, nb_tracks, nb_samples;
GF_ISOFile *mov;
Double rate, new_rate, duration;
mov = gf_isom_open(inName, GF_ISOM_OPEN_READ, NULL);
duration = (Double) gf_isom_get_duration(mov);
duration /= gf_isom_get_timescale(mov);
nb_samples = 0;
nb_tracks = gf_isom_get_track_count(mov);
for (i=0; i<nb_tracks; i++) {
nb_samples += gf_isom_get_sample_count(mov, i+1);
}
gf_isom_close(mov);
rate = (Double) source_size;
rate /= duration;
rate /= 1000;
new_rate = (Double) dst_size;
new_rate /= duration;
new_rate /= 1000;
fprintf(stderr, "Log format:\nname\torig\tcomp\tgain\tadded_bytes\torate\tcrate\tsamples\tduration\tobbps\tcbbps\n");
fprintf(stdout, "%s\t%d\t%d\t%g\t%d\t%g\t%g\t%d\t%g\t%g\t%g\n", inName, bytes_uncomp, bytes_comp, ((Double)(bytes_uncomp-bytes_comp)*100)/bytes_uncomp, nb_added_box_bytes, rate, new_rate, nb_samples, duration, ((Double)orig_box_overhead)/nb_samples, ((Double)final_box_overhead)/nb_samples );
fprintf(stderr, "%s Compressing top-level boxes saved %d bytes out of %d (reduced by %g %%) additional bytes %d original rate %g kbps new rate %g kbps, orig %g box bytes/sample final %g bytes/sample\n", inName, bytes_uncomp-bytes_comp, bytes_uncomp, ((Double)(bytes_uncomp-bytes_comp)*100)/bytes_uncomp, nb_added_box_bytes, rate, new_rate, ((Double)orig_box_overhead)/nb_samples, ((Double)final_box_overhead)/nb_samples );
} else {
fprintf(stderr, "Log format:\nname\torig\tcomp\tgain\tadded_bytes\n");
fprintf(stdout, "%s\t%d\t%d\t%g\t%d\n", inName, bytes_uncomp, bytes_comp, ((Double) (bytes_uncomp - bytes_comp)*100)/(bytes_uncomp), nb_added_box_bytes);
fprintf(stderr, "%s Compressing top-level boxes saved %d bytes out of %d (reduced by %g %%) additional bytes %d\n", inName, bytes_uncomp-bytes_comp, bytes_uncomp, ((Double)(bytes_uncomp-bytes_comp)*100)/bytes_uncomp, nb_added_box_bytes);
}
return GF_OK;
}
| 0
|
384,799
|
f_finddir(typval_T *argvars, typval_T *rettv)
{
findfilendir(argvars, rettv, FINDFILE_DIR);
}
| 0
|
336,583
|
void reds_on_vm_stop(RedsState *reds)
{
FOREACH_QXL_INSTANCE(reds, qxl) {
red_qxl_stop(qxl);
}
}
| 0
|
509,525
|
static int mark_recovery_start(const char* log_dir)
{
int res;
DBUG_ENTER("mark_recovery_start");
if (!(maria_recover_options & HA_RECOVER_ANY))
ma_message_no_user(ME_WARNING, "Please consider using option"
" --aria-recover-options[=...] to automatically check and"
" repair tables when logs are removed by option"
" --aria-force-start-after-recovery-failures=#");
if (recovery_failures >= force_start_after_recovery_failures)
{
/*
Remove logs which cause the problem; keep control file which has
critical info like uuid, max_trid (removing control file may make
correct tables look corrupted!).
*/
char msg[100];
res= translog_walk_filenames(log_dir, &translog_callback_delete_all);
my_snprintf(msg, sizeof(msg),
"%s logs after %u consecutive failures of"
" recovery from logs",
(res ? "failed to remove some" : "removed all"),
recovery_failures);
ma_message_no_user((res ? 0 : ME_WARNING), msg);
}
else
res= ma_control_file_write_and_force(last_checkpoint_lsn, last_logno,
max_trid_in_control_file,
recovery_failures + 1);
DBUG_RETURN(res);
}
| 0
|
413,663
|
static int core_anal_graph_construct_nodes(RCore *core, RAnalFunction *fcn, int opts, PJ *pj, Sdb *DB) {
RAnalBlock *bbi;
RListIter *iter;
int is_keva = opts & R_CORE_ANAL_KEYVALUE;
int is_star = opts & R_CORE_ANAL_STAR;
int is_json = opts & R_CORE_ANAL_JSON;
int is_html = r_cons_context ()->is_html;
int left = 300;
int top = 0;
int is_json_format_disasm = opts & R_CORE_ANAL_JSON_FORMAT_DISASM;
char *pal_curr = palColorFor ("graph.current");
char *pal_traced = palColorFor ("graph.traced");
char *pal_box4 = palColorFor ("graph.box4");
const char *font = r_config_get (core->config, "graph.font");
bool color_current = r_config_get_i (core->config, "graph.gv.current");
char *str;
int nodes = 0;
r_list_foreach (fcn->bbs, iter, bbi) {
if (is_keva) {
char key[128];
sdb_array_push_num (DB, "bbs", bbi->addr, 0);
snprintf (key, sizeof (key), "bb.0x%08"PFMT64x".size", bbi->addr);
sdb_num_set (DB, key, bbi->size, 0); // bb.<addr>.size=<num>
} else if (is_json) {
RDebugTracepoint *t = r_debug_trace_get (core->dbg, bbi->addr);
pj_o (pj);
pj_kn (pj, "offset", bbi->addr);
pj_kn (pj, "size", bbi->size);
if (bbi->jump != UT64_MAX) {
pj_kn (pj, "jump", bbi->jump);
}
if (bbi->fail != -1) {
pj_kn (pj, "fail", bbi->fail);
}
if (bbi->switch_op) {
RAnalSwitchOp *op = bbi->switch_op;
pj_k (pj, "switchop");
pj_o (pj);
pj_kn (pj, "offset", op->addr);
pj_kn (pj, "defval", op->def_val);
pj_kn (pj, "maxval", op->max_val);
pj_kn (pj, "minval", op->min_val);
pj_k (pj, "cases");
pj_a (pj);
RAnalCaseOp *case_op;
RListIter *case_iter;
r_list_foreach (op->cases, case_iter, case_op) {
pj_o (pj);
pj_kn (pj, "offset", case_op->addr);
pj_kn (pj, "value", case_op->value);
pj_kn (pj, "jump", case_op->jump);
pj_end (pj);
}
pj_end (pj);
pj_end (pj);
}
if (t) {
pj_k (pj, "trace");
pj_o (pj);
pj_ki (pj, "count", t->count);
pj_ki (pj, "times", t->times);
pj_end (pj);
}
if (bbi->color.r || bbi->color.g || bbi->color.b) {
char *s = r_cons_rgb_tostring (bbi->color.r, bbi->color.g, bbi->color.b);
pj_ks (pj, "color", s);
free (s);
}
pj_k (pj, "ops");
pj_a (pj);
ut8 *buf = malloc (bbi->size);
if (buf) {
r_io_read_at (core->io, bbi->addr, buf, bbi->size);
if (is_json_format_disasm) {
r_core_print_disasm (core, bbi->addr, buf, bbi->size, bbi->size, 0, NULL, true, true, pj, NULL);
} else {
r_core_print_disasm_json (core, bbi->addr, buf, bbi->size, 0, pj);
}
free (buf);
} else {
eprintf ("cannot allocate %"PFMT64u" byte(s)\n", bbi->size);
}
pj_end (pj);
pj_end (pj);
continue;
}
if ((str = core_anal_graph_label (core, bbi, opts))) {
if (opts & R_CORE_ANAL_GRAPHDIFF) {
const char *difftype = bbi->diff? (\
bbi->diff->type==R_ANAL_DIFF_TYPE_MATCH? "lightgray":
bbi->diff->type==R_ANAL_DIFF_TYPE_UNMATCH? "yellow": "red"): "orange";
const char *diffname = bbi->diff? (\
bbi->diff->type==R_ANAL_DIFF_TYPE_MATCH? "match":
bbi->diff->type==R_ANAL_DIFF_TYPE_UNMATCH? "unmatch": "new"): "unk";
if (is_keva) {
sdb_set (DB, "diff", diffname, 0);
sdb_set (DB, "label", str, 0);
} else if (!is_json) {
nodes++;
RConfigHold *hc = r_config_hold_new (core->config);
r_config_hold (hc, "scr.color", "scr.utf8", "asm.offset", "asm.lines",
"asm.cmt.right", "asm.lines.fcn", "asm.bytes", NULL);
RDiff *d = r_diff_new ();
r_config_set_i (core->config, "scr.utf8", 0);
r_config_set_i (core->config, "asm.offset", 0);
r_config_set_i (core->config, "asm.lines", 0);
r_config_set_i (core->config, "asm.cmt.right", 0);
r_config_set_i (core->config, "asm.lines.fcn", 0);
r_config_set_i (core->config, "asm.bytes", 0);
if (!is_star) {
r_config_set_i (core->config, "scr.color", 0); // disable color for dot
}
if (bbi->diff && bbi->diff->type != R_ANAL_DIFF_TYPE_MATCH && core->c2) {
RCore *c = core->c2;
RConfig *oc = c->config;
char *str = r_core_cmd_strf (core, "pdb @ 0x%08"PFMT64x, bbi->addr);
c->config = core->config;
// XXX. the bbi->addr doesnt needs to be in the same address in core2
char *str2 = r_core_cmd_strf (c, "pdb @ 0x%08"PFMT64x, bbi->diff->addr);
char *diffstr = r_diff_buffers_to_string (d,
(const ut8*)str, strlen (str),
(const ut8*)str2, strlen (str2));
if (diffstr) {
char *nl = strchr (diffstr, '\n');
if (nl) {
nl = strchr (nl + 1, '\n');
if (nl) {
nl = strchr (nl + 1, '\n');
if (nl) {
r_str_cpy (diffstr, nl + 1);
}
}
}
}
if (is_star) {
char *title = get_title (bbi->addr);
char *body_b64 = r_base64_encode_dyn (diffstr, -1);
if (!title || !body_b64) {
free (body_b64);
free (title);
r_diff_free (d);
return false;
}
body_b64 = r_str_prepend (body_b64, "base64:");
r_cons_printf ("agn %s %s %d\n", title, body_b64, bbi->diff->type);
free (body_b64);
free (title);
} else {
diffstr = r_str_replace (diffstr, "\n", "\\l", 1);
diffstr = r_str_replace (diffstr, "\"", "'", 1);
r_cons_printf(" \"0x%08"PFMT64x"\" [fillcolor=\"%s\","
"color=\"black\", fontname=\"%s\","
" label=\"%s\", URL=\"%s/0x%08"PFMT64x"\"]\n",
bbi->addr, difftype, font, diffstr, fcn->name,
bbi->addr);
}
free (diffstr);
c->config = oc;
} else {
if (is_star) {
char *title = get_title (bbi->addr);
char *body_b64 = r_base64_encode_dyn (str, -1);
int color = (bbi && bbi->diff) ? bbi->diff->type : 0;
if (!title || !body_b64) {
free (body_b64);
free (title);
r_diff_free (d);
return false;
}
body_b64 = r_str_prepend (body_b64, "base64:");
r_cons_printf ("agn %s %s %d\n", title, body_b64, color);
free (body_b64);
free (title);
} else {
r_cons_printf(" \"0x%08"PFMT64x"\" [fillcolor=\"%s\","
"color=\"black\", fontname=\"%s\","
" label=\"%s\", URL=\"%s/0x%08"PFMT64x"\"]\n",
bbi->addr, difftype, font, str, fcn->name, bbi->addr);
}
}
r_diff_free (d);
r_config_set_i (core->config, "scr.color", 1);
r_config_hold_free (hc);
}
} else {
if (is_html) {
nodes++;
r_cons_printf ("<p class=\"block draggable\" style=\""
"top: %dpx; left: %dpx; width: 400px;\" id=\""
"_0x%08"PFMT64x"\">\n%s</p>\n",
top, left, bbi->addr, str);
left = left? 0: 600;
if (!left) {
top += 250;
}
} else if (!is_json && !is_keva) {
bool current = r_anal_block_contains (bbi, core->offset);
const char *label_color = bbi->traced
? pal_traced
: (current && color_current)
? pal_curr
: pal_box4;
const char *fill_color = ((current && color_current) || label_color == pal_traced)? pal_traced: "white";
nodes++;
if (is_star) {
char *title = get_title (bbi->addr);
char *body_b64 = r_base64_encode_dyn (str, -1);
int color = (bbi && bbi->diff) ? bbi->diff->type : 0;
if (!title || !body_b64) {
free (body_b64);
free (title);
return false;
}
body_b64 = r_str_prepend (body_b64, "base64:");
r_cons_printf ("agn %s %s %d\n", title, body_b64, color);
free (body_b64);
free (title);
} else {
r_cons_printf ("\t\"0x%08"PFMT64x"\" ["
"URL=\"%s/0x%08"PFMT64x"\", fillcolor=\"%s\","
"color=\"%s\", fontname=\"%s\","
"label=\"%s\"]\n",
bbi->addr, fcn->name, bbi->addr,
fill_color, label_color, font, str);
}
}
}
free (str);
}
}
return nodes;
}
| 0
|
432,179
|
static void test_map_big_memory(void)
{
uc_engine *uc;
OK(uc_open(UC_ARCH_X86, UC_MODE_64, &uc));
uc_assert_err(UC_ERR_NOMEM,
uc_mem_map(uc, 0x0, 0xfffffffffffff000, UC_PROT_ALL));
OK(uc_close(uc));
}
| 0
|
413,852
|
void CallInfo::set_interface(Klass* resolved_klass,
const methodHandle& resolved_method,
const methodHandle& selected_method,
int itable_index, TRAPS) {
// This is only called for interface methods. If the resolved_method
// comes from java/lang/Object, it can be the subject of a virtual call, so
// we should pick the vtable index from the resolved method.
// In that case, the caller must call set_virtual instead of set_interface.
assert(resolved_method->method_holder()->is_interface(), "");
assert(itable_index == resolved_method()->itable_index(), "");
set_common(resolved_klass, resolved_method, selected_method, CallInfo::itable_call, itable_index, CHECK);
}
| 0
|
312,387
|
ex_cwindow(exarg_T *eap)
{
qf_info_T *qi;
qf_list_T *qfl;
win_T *win;
if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL)
return;
qfl = qf_get_curlist(qi);
// Look for an existing quickfix window.
win = qf_find_win(qi);
// If a quickfix window is open but we have no errors to display,
// close the window. If a quickfix window is not open, then open
// it if we have errors; otherwise, leave it closed.
if (qf_stack_empty(qi)
|| qfl->qf_nonevalid
|| qf_list_empty(qfl))
{
if (win != NULL)
ex_cclose(eap);
}
else if (win == NULL)
ex_copen(eap);
}
| 0
|
434,098
|
ex_argedit(exarg_T *eap)
{
int i = eap->addr_count ? (int)eap->line2 : curwin->w_arg_idx + 1;
// Whether curbuf will be reused, curbuf->b_ffname will be set.
int curbuf_is_reusable = curbuf_reusable();
if (do_arglist(eap->arg, AL_ADD, i, TRUE) == FAIL)
return;
maketitle();
if (curwin->w_arg_idx == 0
&& (curbuf->b_ml.ml_flags & ML_EMPTY)
&& (curbuf->b_ffname == NULL || curbuf_is_reusable))
i = 0;
// Edit the argument.
if (i < ARGCOUNT)
do_argfile(eap, i);
}
| 0
|
487,654
|
int raw_notifier_chain_unregister(struct raw_notifier_head *nh,
struct notifier_block *n)
{
return notifier_chain_unregister(&nh->head, n);
}
| 0
|
229,334
|
inline tensorflow::Fprint128 FingerprintCat128(const tensorflow::Fprint128& a,
const tensorflow::Fprint128& b) {
return {tensorflow::FingerprintCat64(a.low64, b.low64),
tensorflow::FingerprintCat64(a.high64, b.high64)};
}
| 0
|
225,755
|
void stdp_box_del(GF_Box *s)
{
GF_DegradationPriorityBox *ptr = (GF_DegradationPriorityBox *)s;
if (ptr == NULL ) return;
if (ptr->priorities) gf_free(ptr->priorities);
gf_free(ptr);
}
| 0
|
274,717
|
void callbacks_update_scrollbar_limits (void){
gerbv_render_info_t tempRenderInfo = {0, 0, 0, 0,
GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY,
screenRenderInfo.displayWidth,
screenRenderInfo.displayHeight};
GtkAdjustment *hAdjust = (GtkAdjustment *)screen.win.hAdjustment;
GtkAdjustment *vAdjust = (GtkAdjustment *)screen.win.vAdjustment;
gerbv_render_zoom_to_fit_display (mainProject, &tempRenderInfo);
hAdjust->lower = tempRenderInfo.lowerLeftX;
hAdjust->page_increment = hAdjust->page_size;
hAdjust->step_increment = hAdjust->page_size / 10.0;
vAdjust->lower = tempRenderInfo.lowerLeftY;
vAdjust->page_increment = vAdjust->page_size;
vAdjust->step_increment = vAdjust->page_size / 10.0;
hAdjust->upper = tempRenderInfo.lowerLeftX + (tempRenderInfo.displayWidth / tempRenderInfo.scaleFactorX);
hAdjust->page_size = screenRenderInfo.displayWidth / screenRenderInfo.scaleFactorX;
vAdjust->upper = tempRenderInfo.lowerLeftY + (tempRenderInfo.displayHeight / tempRenderInfo.scaleFactorY);
vAdjust->page_size = screenRenderInfo.displayHeight / screenRenderInfo.scaleFactorY;
callbacks_update_scrollbar_positions ();
}
| 0
|
359,208
|
BPF_CALL_2(bpf_ringbuf_discard, void *, sample, u64, flags)
{
bpf_ringbuf_commit(sample, flags, true /* discard */);
return 0;
}
| 0
|
225,891
|
#ifndef GPAC_DISABLE_ISOM_WRITE
GF_Err sgpd_box_write(GF_Box *s, GF_BitStream *bs)
{
u32 i, nb_descs;
GF_SampleGroupDescriptionBox *p = (GF_SampleGroupDescriptionBox *)s;
GF_Err e;
e = gf_isom_full_box_write(s, bs);
if (e) return e;
gf_bs_write_u32(bs, p->grouping_type);
if (p->version>=1) gf_bs_write_u32(bs, p->default_length);
if (p->version>=2) gf_bs_write_u32(bs, p->default_description_index);
nb_descs = gf_list_count(p->group_descriptions);
gf_bs_write_u32(bs, nb_descs);
for (i=0; i<nb_descs; i++) {
void *ptr = gf_list_get(p->group_descriptions, i);
if ((p->version >= 1) && !p->default_length) {
u32 size = sgpd_size_entry(p->grouping_type, ptr);
gf_bs_write_u32(bs, size);
}
sgpd_write_entry(p->grouping_type, ptr, bs);
}
return GF_OK;
| 0
|
238,798
|
get_spat_last_idx(void)
{
return last_idx;
}
| 0
|
345,133
|
static int pxa3xx_gcu_remove(struct platform_device *pdev)
{
struct pxa3xx_gcu_priv *priv = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
pxa3xx_gcu_wait_idle(priv);
misc_deregister(&priv->misc_dev);
dma_free_coherent(dev, SHARED_SIZE, priv->shared, priv->shared_phys);
clk_disable_unprepare(priv->clk);
pxa3xx_gcu_free_buffers(dev, priv);
return 0;
}
| 0
|
484,798
|
static void __exit netif_exit(void)
{
xenbus_unregister_driver(&netfront_driver);
}
| 0
|
222,503
|
FunctionLibraryDefinition::FindHelper(const string& func) const {
auto iter = function_defs_.find(func);
if (iter == function_defs_.end()) {
return nullptr;
} else {
return iter->second;
}
}
| 0
|
459,509
|
BPF_CALL_4(bpf_get_stack, struct pt_regs *, regs, void *, buf, u32, size,
u64, flags)
{
return __bpf_get_stack(regs, NULL, NULL, buf, size, flags);
}
| 0
|
238,402
|
njs_function_lambda_frame(njs_vm_t *vm, njs_function_t *function,
const njs_value_t *this, const njs_value_t *args, njs_uint_t nargs,
njs_bool_t ctor)
{
size_t n, frame_size;
uint32_t args_count, value_count, value_size, temp_size;
njs_value_t *value, *bound, **new, **temp;
njs_frame_t *frame;
njs_function_t *target;
njs_native_frame_t *native_frame;
njs_function_lambda_t *lambda;
bound = function->bound;
if (njs_fast_path(bound == NULL)) {
lambda = function->u.lambda;
target = function;
} else {
target = function->u.bound_target;
if (njs_slow_path(target->bound != NULL)) {
/*
* FIXME: bound functions should call target function with
* bound "this" and bound args.
*/
njs_internal_error(vm, "chain of bound function are not supported");
return NJS_ERROR;
}
lambda = target->u.lambda;
}
args_count = function->args_offset + njs_max(nargs, lambda->nargs);
value_count = args_count + njs_max(args_count, lambda->nlocal);
value_size = value_count * sizeof(njs_value_t *);
temp_size = lambda->temp * sizeof(njs_value_t *);
frame_size = value_size + temp_size
+ ((value_count + lambda->temp) * sizeof(njs_value_t));
native_frame = njs_function_frame_alloc(vm, NJS_FRAME_SIZE + frame_size);
if (njs_slow_path(native_frame == NULL)) {
return NJS_ERROR;
}
/* Local */
new = (njs_value_t **) ((u_char *) native_frame + NJS_FRAME_SIZE);
value = (njs_value_t *) ((u_char *) new + value_size + temp_size);
n = value_count + lambda->temp;
while (n != 0) {
n--;
new[n] = &value[n];
njs_set_invalid(new[n]);
}
/* Temp */
temp = (njs_value_t **) ((u_char *) native_frame + NJS_FRAME_SIZE
+ value_size);
native_frame->arguments = value;
native_frame->arguments_offset = value + (function->args_offset - 1);
native_frame->local = new + args_count;
native_frame->temp = temp;
native_frame->function = target;
native_frame->nargs = nargs;
native_frame->ctor = ctor;
native_frame->native = 0;
native_frame->pc = NULL;
/* Set this and bound arguments. */
*native_frame->local[0] = *this;
if (njs_slow_path(function->global_this
&& njs_is_null_or_undefined(this)))
{
njs_set_object(native_frame->local[0], &vm->global_object);
}
if (bound != NULL) {
n = function->args_offset;
native_frame->nargs += n - 1;
if (!ctor) {
*native_frame->local[0] = *bound;
}
bound++;
n--;
while (n != 0) {
*value++ = *bound++;
n--;
};
}
/* Copy arguments. */
if (args != NULL) {
while (nargs != 0) {
*value++ = *args++;
nargs--;
}
}
frame = (njs_frame_t *) native_frame;
frame->exception.catch = NULL;
frame->exception.next = NULL;
frame->previous_active_frame = vm->active_frame;
return NJS_OK;
}
| 0
|
440,874
|
LogSetParameter(LogParameter param, int value)
{
switch (param) {
case XLOG_FLUSH:
logFlush = value ? TRUE : FALSE;
return TRUE;
case XLOG_SYNC:
logSync = value ? TRUE : FALSE;
return TRUE;
case XLOG_VERBOSITY:
logVerbosity = value;
return TRUE;
case XLOG_FILE_VERBOSITY:
logFileVerbosity = value;
return TRUE;
default:
return FALSE;
}
}
| 0
|
244,285
|
GF_Err jp2h_on_child_box(GF_Box *s, GF_Box *a, Bool is_rem)
{
GF_J2KHeaderBox *ptr = (GF_J2KHeaderBox *)s;
switch(a->type) {
case GF_ISOM_BOX_TYPE_IHDR:
BOX_FIELD_ASSIGN(ihdr, GF_J2KImageHeaderBox)
return GF_OK;
case GF_ISOM_BOX_TYPE_COLR:
BOX_FIELD_ASSIGN(colr, GF_ColourInformationBox)
return GF_OK;
}
return GF_OK;
}
| 0
|
256,945
|
static Status ReshapeToRank3(const Tensor& input, int batch_size,
Tensor* output) {
const int rank = input.dims();
TensorShape output_shape = {batch_size, input.dim_size(rank - 2),
input.dim_size(rank - 1)};
return CopyFrom(input, output_shape, output);
}
| 0
|
488,362
|
void unmap_mapping_range(struct address_space *mapping,
loff_t const holebegin, loff_t const holelen, int even_cows)
{
struct zap_details details;
pgoff_t hba = holebegin >> PAGE_SHIFT;
pgoff_t hlen = (holelen + PAGE_SIZE - 1) >> PAGE_SHIFT;
/* Check for overflow. */
if (sizeof(holelen) > sizeof(hlen)) {
long long holeend =
(holebegin + holelen + PAGE_SIZE - 1) >> PAGE_SHIFT;
if (holeend & ~(long long)ULONG_MAX)
hlen = ULONG_MAX - hba + 1;
}
details.check_mapping = even_cows? NULL: mapping;
details.nonlinear_vma = NULL;
details.first_index = hba;
details.last_index = hba + hlen - 1;
if (details.last_index < details.first_index)
details.last_index = ULONG_MAX;
details.i_mmap_lock = &mapping->i_mmap_lock;
spin_lock(&mapping->i_mmap_lock);
/* Protect against endless unmapping loops */
mapping->truncate_count++;
if (unlikely(is_restart_addr(mapping->truncate_count))) {
if (mapping->truncate_count == 0)
reset_vma_truncate_counts(mapping);
mapping->truncate_count++;
}
details.truncate_count = mapping->truncate_count;
if (unlikely(!prio_tree_empty(&mapping->i_mmap)))
unmap_mapping_range_tree(&mapping->i_mmap, &details);
if (unlikely(!list_empty(&mapping->i_mmap_nonlinear)))
unmap_mapping_range_list(&mapping->i_mmap_nonlinear, &details);
spin_unlock(&mapping->i_mmap_lock);
}
| 0
|
484,761
|
static int xennet_change_mtu(struct net_device *dev, int mtu)
{
int max = xennet_can_sg(dev) ? XEN_NETIF_MAX_TX_SIZE : ETH_DATA_LEN;
if (mtu > max)
return -EINVAL;
dev->mtu = mtu;
return 0;
}
| 0
|
248,763
|
static const char *get_top_domain(const char * const domain, size_t *outlen)
{
size_t len = 0;
const char *first = NULL, *last;
if(domain) {
len = strlen(domain);
last = memrchr(domain, '.', len);
if(last) {
first = memrchr(domain, '.', (last - domain));
if(first)
len -= (++first - domain);
}
}
if(outlen)
*outlen = len;
return first? first: domain;
}
| 0
|
219,990
|
int callback_glewlwyd_scheme_check_forbid_profile (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_scheme = get_user_auth_scheme_module(config, json_string_value(json_object_get(j_param, "scheme_name")));
int ret = U_CALLBACK_CONTINUE;
if (check_result_value(j_scheme, G_OK)) {
if (json_object_get(json_object_get(j_scheme, "module"), "forbid_user_profile") == json_true()) {
response->status = 403;
ret = U_CALLBACK_COMPLETE;
}
} else if (check_result_value(j_scheme, G_ERROR_NOT_FOUND)) {
response->status = 404;
} else {
y_log_message(Y_LOG_LEVEL_ERROR, "callback_glewlwyd_scheme_check_forbid_profile - Error auth_register_get_user_scheme");
response->status = 500;
}
json_decref(j_param);
json_decref(j_scheme);
return ret;
}
| 0
|
294,557
|
ns_to_day(VALUE n)
{
if (FIXNUM_P(n))
return rb_rational_new2(n, day_in_nanoseconds);
return f_quo(n, day_in_nanoseconds);
}
| 0
|
349,281
|
void squashfs_closedir(struct dir *dir)
{
struct dir_ent *ent = dir->dirs;
while(ent) {
struct dir_ent *tmp = ent;
ent = ent->next;
free(tmp->name);
free(tmp);
}
free(dir);
}
| 0
|
299,905
|
readconf_main(void)
{
int sep = 0;
struct stat statbuf;
uschar *s, *filename;
uschar *list = config_main_filelist;
/* Loop through the possible file names */
while((filename = string_nextinlist(&list, &sep, big_buffer, big_buffer_size))
!= NULL)
{
/* Cut out all the fancy processing unless specifically wanted */
#if defined(CONFIGURE_FILE_USE_NODE) || defined(CONFIGURE_FILE_USE_EUID)
uschar *suffix = filename + Ustrlen(filename);
/* Try for the node-specific file if a node name exists */
#ifdef CONFIGURE_FILE_USE_NODE
struct utsname uts;
if (uname(&uts) >= 0)
{
#ifdef CONFIGURE_FILE_USE_EUID
sprintf(CS suffix, ".%ld.%.256s", (long int)original_euid, uts.nodename);
config_file = Ufopen(filename, "rb");
if (config_file == NULL)
#endif /* CONFIGURE_FILE_USE_EUID */
{
sprintf(CS suffix, ".%.256s", uts.nodename);
config_file = Ufopen(filename, "rb");
}
}
#endif /* CONFIGURE_FILE_USE_NODE */
/* Otherwise, try the generic name, possibly with the euid added */
#ifdef CONFIGURE_FILE_USE_EUID
if (config_file == NULL)
{
sprintf(CS suffix, ".%ld", (long int)original_euid);
config_file = Ufopen(filename, "rb");
}
#endif /* CONFIGURE_FILE_USE_EUID */
/* Finally, try the unadorned name */
if (config_file == NULL)
{
*suffix = 0;
config_file = Ufopen(filename, "rb");
}
#else /* if neither defined */
/* This is the common case when the fancy processing is not included. */
config_file = Ufopen(filename, "rb");
#endif
/* If the file does not exist, continue to try any others. For any other
error, break out (and die). */
if (config_file != NULL || errno != ENOENT) break;
}
/* On success, save the name for verification; config_filename is used when
logging configuration errors (it changes for .included files) whereas
config_main_filename is the name shown by -bP. Failure to open a configuration
file is a serious disaster. */
if (config_file != NULL)
{
config_filename = config_main_filename = string_copy(filename);
}
else
{
if (filename == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "non-existent configuration file(s): "
"%s", config_main_filelist);
else
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "%s", string_open_failed(errno,
"configuration file %s", filename));
}
/* Check the status of the file we have opened, if we have retained root
privileges. */
if (trusted_config)
{
if (fstat(fileno(config_file), &statbuf) != 0)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to stat configuration file %s",
big_buffer);
if ((statbuf.st_uid != root_uid /* owner not root */
#ifdef CONFIGURE_OWNER
&& statbuf.st_uid != config_uid /* owner not the special one */
#endif
) || /* or */
(statbuf.st_gid != root_gid /* group not root & */
#ifdef CONFIGURE_GROUP
&& statbuf.st_gid != config_gid /* group not the special one */
#endif
&& (statbuf.st_mode & 020) != 0) || /* group writeable */
/* or */
((statbuf.st_mode & 2) != 0)) /* world writeable */
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Exim configuration file %s has the "
"wrong owner, group, or mode", big_buffer);
}
/* Process the main configuration settings. They all begin with a lower case
letter. If we see something starting with an upper case letter, it is taken as
a macro definition. */
while ((s = get_config_line()) != NULL)
{
if (isupper(s[0])) read_macro_assignment(s);
else if (Ustrncmp(s, "domainlist", 10) == 0)
read_named_list(&domainlist_anchor, &domainlist_count,
MAX_NAMED_LIST, s+10, US"domain list");
else if (Ustrncmp(s, "hostlist", 8) == 0)
read_named_list(&hostlist_anchor, &hostlist_count,
MAX_NAMED_LIST, s+8, US"host list");
else if (Ustrncmp(s, US"addresslist", 11) == 0)
read_named_list(&addresslist_anchor, &addresslist_count,
MAX_NAMED_LIST, s+11, US"address list");
else if (Ustrncmp(s, US"localpartlist", 13) == 0)
read_named_list(&localpartlist_anchor, &localpartlist_count,
MAX_NAMED_LIST, s+13, US"local part list");
else
(void) readconf_handle_option(s, optionlist_config, optionlist_config_size,
NULL, US"main option \"%s\" unknown");
}
/* If local_sender_retain is set, local_from_check must be unset. */
if (local_sender_retain && local_from_check)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "both local_from_check and "
"local_sender_retain are set; this combination is not allowed");
/* If the timezone string is empty, set it to NULL, implying no TZ variable
wanted. */
if (timezone_string != NULL && *timezone_string == 0) timezone_string = NULL;
/* The max retry interval must not be greater than 24 hours. */
if (retry_interval_max > 24*60*60) retry_interval_max = 24*60*60;
/* remote_max_parallel must be > 0 */
if (remote_max_parallel <= 0) remote_max_parallel = 1;
/* Save the configured setting of freeze_tell, so we can re-instate it at the
start of a new SMTP message. */
freeze_tell_config = freeze_tell;
/* The primary host name may be required for expansion of spool_directory
and log_file_path, so make sure it is set asap. It is obtained from uname(),
but if that yields an unqualified value, make a FQDN by using gethostbyname to
canonize it. Some people like upper case letters in their host names, so we
don't force the case. */
if (primary_hostname == NULL)
{
uschar *hostname;
struct utsname uts;
if (uname(&uts) < 0)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "uname() failed to yield host name");
hostname = US uts.nodename;
if (Ustrchr(hostname, '.') == NULL)
{
int af = AF_INET;
struct hostent *hostdata;
#if HAVE_IPV6
if (!disable_ipv6 && (dns_ipv4_lookup == NULL ||
match_isinlist(hostname, &dns_ipv4_lookup, 0, NULL, NULL, MCL_DOMAIN,
TRUE, NULL) != OK))
af = AF_INET6;
#else
af = AF_INET;
#endif
for (;;)
{
#if HAVE_IPV6
#if HAVE_GETIPNODEBYNAME
int error_num;
hostdata = getipnodebyname(CS hostname, af, 0, &error_num);
#else
hostdata = gethostbyname2(CS hostname, af);
#endif
#else
hostdata = gethostbyname(CS hostname);
#endif
if (hostdata != NULL)
{
hostname = US hostdata->h_name;
break;
}
if (af == AF_INET) break;
af = AF_INET;
}
}
primary_hostname = string_copy(hostname);
}
/* Set up default value for smtp_active_hostname */
smtp_active_hostname = primary_hostname;
/* If spool_directory wasn't set in the build-time configuration, it must have
got set above. Of course, writing to the log may not work if log_file_path is
not set, but it will at least get to syslog or somewhere, with any luck. */
if (*spool_directory == 0)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "spool_directory undefined: cannot "
"proceed");
/* Expand the spool directory name; it may, for example, contain the primary
host name. Same comment about failure. */
s = expand_string(spool_directory);
if (s == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to expand spool_directory "
"\"%s\": %s", spool_directory, expand_string_message);
spool_directory = s;
/* Expand log_file_path, which must contain "%s" in any component that isn't
the null string or "syslog". It is also allowed to contain one instance of %D.
However, it must NOT contain % followed by anything else. */
if (*log_file_path != 0)
{
uschar *ss, *sss;
int sep = ':'; /* Fixed for log file path */
s = expand_string(log_file_path);
if (s == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to expand log_file_path "
"\"%s\": %s", log_file_path, expand_string_message);
ss = s;
while ((sss = string_nextinlist(&ss,&sep,big_buffer,big_buffer_size)) != NULL)
{
uschar *t;
if (sss[0] == 0 || Ustrcmp(sss, "syslog") == 0) continue;
t = Ustrstr(sss, "%s");
if (t == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "log_file_path \"%s\" does not "
"contain \"%%s\"", sss);
*t = 'X';
t = Ustrchr(sss, '%');
if (t != NULL)
{
if (t[1] != 'D' || Ustrchr(t+2, '%') != NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "log_file_path \"%s\" contains "
"unexpected \"%%\" character", s);
}
}
log_file_path = s;
}
/* Interpret syslog_facility into an integer argument for 'ident' param to
openlog(). Default is LOG_MAIL set in globals.c. Allow the user to omit the
leading "log_". */
if (syslog_facility_str != NULL)
{
int i;
uschar *s = syslog_facility_str;
if ((Ustrlen(syslog_facility_str) >= 4) &&
(strncmpic(syslog_facility_str, US"log_", 4) == 0))
s += 4;
for (i = 0; i < syslog_list_size; i++)
{
if (strcmpic(s, syslog_list[i].name) == 0)
{
syslog_facility = syslog_list[i].value;
break;
}
}
if (i >= syslog_list_size)
{
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"failed to interpret syslog_facility \"%s\"", syslog_facility_str);
}
}
/* Expand pid_file_path */
if (*pid_file_path != 0)
{
s = expand_string(pid_file_path);
if (s == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "failed to expand pid_file_path "
"\"%s\": %s", pid_file_path, expand_string_message);
pid_file_path = s;
}
/* Compile the regex for matching a UUCP-style "From_" line in an incoming
message. */
regex_From = regex_must_compile(uucp_from_pattern, FALSE, TRUE);
/* Unpick the SMTP rate limiting options, if set */
if (smtp_ratelimit_mail != NULL)
{
unpick_ratelimit(smtp_ratelimit_mail, &smtp_rlm_threshold,
&smtp_rlm_base, &smtp_rlm_factor, &smtp_rlm_limit);
}
if (smtp_ratelimit_rcpt != NULL)
{
unpick_ratelimit(smtp_ratelimit_rcpt, &smtp_rlr_threshold,
&smtp_rlr_base, &smtp_rlr_factor, &smtp_rlr_limit);
}
/* The qualify domains default to the primary host name */
if (qualify_domain_sender == NULL)
qualify_domain_sender = primary_hostname;
if (qualify_domain_recipient == NULL)
qualify_domain_recipient = qualify_domain_sender;
/* Setting system_filter_user in the configuration sets the gid as well if a
name is given, but a numerical value does not. */
if (system_filter_uid_set && !system_filter_gid_set)
{
struct passwd *pw = getpwuid(system_filter_uid);
if (pw == NULL)
log_write(0, LOG_MAIN|LOG_PANIC_DIE, "Failed to look up uid %ld",
(long int)system_filter_uid);
system_filter_gid = pw->pw_gid;
system_filter_gid_set = TRUE;
}
/* If the errors_reply_to field is set, check that it is syntactically valid
and ensure it contains a domain. */
if (errors_reply_to != NULL)
{
uschar *errmess;
int start, end, domain;
uschar *recipient = parse_extract_address(errors_reply_to, &errmess,
&start, &end, &domain, FALSE);
if (recipient == NULL)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"error in errors_reply_to (%s): %s", errors_reply_to, errmess);
if (domain == 0)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"errors_reply_to (%s) does not contain a domain", errors_reply_to);
}
/* If smtp_accept_queue or smtp_accept_max_per_host is set, then
smtp_accept_max must also be set. */
if (smtp_accept_max == 0 &&
(smtp_accept_queue > 0 || smtp_accept_max_per_host != NULL))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"smtp_accept_max must be set if smtp_accept_queue or "
"smtp_accept_max_per_host is set");
/* Set up the host number if anything is specified. It is an expanded string
so that it can be computed from the host name, for example. We do this last
so as to ensure that everything else is set up before the expansion. */
if (host_number_string != NULL)
{
uschar *end;
uschar *s = expand_string(host_number_string);
long int n = Ustrtol(s, &end, 0);
while (isspace(*end)) end++;
if (*end != 0)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"localhost_number value is not a number: %s", s);
if (n > LOCALHOST_MAX)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"localhost_number is greater than the maximum allowed value (%d)",
LOCALHOST_MAX);
host_number = n;
}
#ifdef SUPPORT_TLS
/* If tls_verify_hosts is set, tls_verify_certificates must also be set */
if ((tls_verify_hosts != NULL || tls_try_verify_hosts != NULL) &&
tls_verify_certificates == NULL)
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"tls_%sverify_hosts is set, but tls_verify_certificates is not set",
(tls_verify_hosts != NULL)? "" : "try_");
/* If openssl_options is set, validate it */
if (openssl_options != NULL)
{
# ifdef USE_GNUTLS
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"openssl_options is set but we're using GnuTLS");
# else
long dummy;
if (!(tls_openssl_options_parse(openssl_options, &dummy)))
log_write(0, LOG_PANIC_DIE|LOG_CONFIG,
"openssl_options parse error: %s", openssl_options);
# endif
}
#endif
}
| 0
|
487,669
|
asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim)
{
struct rlimit x;
if (resource >= RLIM_NLIMITS)
return -EINVAL;
task_lock(current->group_leader);
x = current->signal->rlim[resource];
task_unlock(current->group_leader);
if (x.rlim_cur > 0x7FFFFFFF)
x.rlim_cur = 0x7FFFFFFF;
if (x.rlim_max > 0x7FFFFFFF)
x.rlim_max = 0x7FFFFFFF;
return copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0;
}
| 0
|
294,542
|
d_new_by_frags(VALUE klass, VALUE hash, VALUE sg)
{
VALUE jd;
if (!c_valid_start_p(NUM2DBL(sg))) {
sg = INT2FIX(DEFAULT_SG);
rb_warning("invalid start is ignored");
}
if (NIL_P(hash))
rb_raise(eDateError, "invalid date");
if (NIL_P(ref_hash("jd")) &&
NIL_P(ref_hash("yday")) &&
!NIL_P(ref_hash("year")) &&
!NIL_P(ref_hash("mon")) &&
!NIL_P(ref_hash("mday")))
jd = rt__valid_civil_p(ref_hash("year"),
ref_hash("mon"),
ref_hash("mday"), sg);
else {
hash = rt_rewrite_frags(hash);
hash = rt_complete_frags(klass, hash);
jd = rt__valid_date_frags_p(hash, sg);
}
if (NIL_P(jd))
rb_raise(eDateError, "invalid date");
{
VALUE nth;
int rjd;
decode_jd(jd, &nth, &rjd);
return d_simple_new_internal(klass,
nth, rjd,
NUM2DBL(sg),
0, 0, 0,
HAVE_JD);
}
}
| 0
|
226,189
|
GF_Err stvi_box_size(GF_Box *s)
{
GF_StereoVideoBox *ptr = (GF_StereoVideoBox *)s;
ptr->size+= 12 + ptr->sit_len;
return GF_OK;
| 0
|
359,332
|
DEFUN (clear_ip_bgp_external_in_prefix_filter,
clear_ip_bgp_external_in_prefix_filter_cmd,
"clear ip bgp external in prefix-filter",
CLEAR_STR
IP_STR
BGP_STR
"Clear all external peers\n"
"Soft reconfig inbound update\n"
"Push out prefix-list ORF and do inbound soft reconfig\n")
{
return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
}
| 0
|
175,700
|
virtual bool ethernet_available() const {
return available_devices_ & (1 << TYPE_ETHERNET);
}
| 0
|
437,305
|
tree_min_len(Node* node, ScanEnv* env)
{
OnigLen len;
OnigLen tmin;
len = 0;
switch (NODE_TYPE(node)) {
case NODE_BACKREF:
if (! NODE_IS_CHECKER(node)) {
int i;
int* backs;
MemEnv* mem_env = SCANENV_MEMENV(env);
BackRefNode* br = BACKREF_(node);
if (NODE_IS_RECURSION(node)) break;
backs = BACKREFS_P(br);
len = tree_min_len(mem_env[backs[0]].node, env);
for (i = 1; i < br->back_num; i++) {
tmin = tree_min_len(mem_env[backs[i]].node, env);
if (len > tmin) len = tmin;
}
}
break;
#ifdef USE_CALL
case NODE_CALL:
{
Node* t = NODE_BODY(node);
if (NODE_IS_RECURSION(node)) {
if (NODE_IS_MIN_FIXED(t))
len = ENCLOSURE_(t)->min_len;
}
else
len = tree_min_len(t, env);
}
break;
#endif
case NODE_LIST:
do {
tmin = tree_min_len(NODE_CAR(node), env);
len = distance_add(len, tmin);
} while (IS_NOT_NULL(node = NODE_CDR(node)));
break;
case NODE_ALT:
{
Node *x, *y;
y = node;
do {
x = NODE_CAR(y);
tmin = tree_min_len(x, env);
if (y == node) len = tmin;
else if (len > tmin) len = tmin;
} while (IS_NOT_NULL(y = NODE_CDR(y)));
}
break;
case NODE_STRING:
{
StrNode* sn = STR_(node);
len = (int )(sn->end - sn->s);
}
break;
case NODE_CTYPE:
case NODE_CCLASS:
len = ONIGENC_MBC_MINLEN(env->enc);
break;
case NODE_QUANT:
{
QuantNode* qn = QUANT_(node);
if (qn->lower > 0) {
len = tree_min_len(NODE_BODY(node), env);
len = distance_multiply(len, qn->lower);
}
}
break;
case NODE_ENCLOSURE:
{
EnclosureNode* en = ENCLOSURE_(node);
switch (en->type) {
case ENCLOSURE_MEMORY:
if (NODE_IS_MIN_FIXED(node))
len = en->min_len;
else {
if (NODE_IS_MARK1(node))
len = 0; /* recursive */
else {
NODE_STATUS_ADD(node, MARK1);
len = tree_min_len(NODE_BODY(node), env);
NODE_STATUS_REMOVE(node, MARK1);
en->min_len = len;
NODE_STATUS_ADD(node, MIN_FIXED);
}
}
break;
case ENCLOSURE_OPTION:
case ENCLOSURE_STOP_BACKTRACK:
len = tree_min_len(NODE_BODY(node), env);
break;
case ENCLOSURE_IF_ELSE:
{
OnigLen elen;
len = tree_min_len(NODE_BODY(node), env);
if (IS_NOT_NULL(en->te.Then))
len += tree_min_len(en->te.Then, env);
if (IS_NOT_NULL(en->te.Else))
elen = tree_min_len(en->te.Else, env);
else elen = 0;
if (elen < len) len = elen;
}
break;
}
}
break;
case NODE_GIMMICK:
{
GimmickNode* g = GIMMICK_(node);
if (g->type == GIMMICK_FAIL) {
len = INFINITE_LEN;
break;
}
}
/* fall */
case NODE_ANCHOR:
default:
break;
}
return len;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.