idx
int64
func
string
target
int64
512,308
void Item_func_like::cleanup() { canDoTurboBM= FALSE; Item_bool_func2::cleanup(); }
0
398,488
static inline ut64 dwarf_read_offset(bool is_64bit, bool big_endian, const ut8 **buf, const ut8 *buf_end) { ut64 result; if (is_64bit) { result = READ64(*buf); } else { result = READ32(*buf); } return result; }
0
267,978
static bool __isDataSection(RBinFile *a, RBinSection *s) { if (s->has_strings || s->is_data) { return true; } // Rust return strstr (s->name, "_const"); }
0
344,254
static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { /* calling function is a known function? */ if (ci != NULL && !(ci->callstatus & CIST_TAIL)) return funcnamefromcall(L, ci->previous, name); else return NULL; /* no way to find a name */ }
0
430,351
int seq_release_private(struct inode *inode, struct file *file) { struct seq_file *seq = file->private_data; kfree(seq->private); seq->private = NULL; return seq_release(inode, file); }
0
223,460
static void detect_partial_match_to(compiler_common *common, struct sljit_label *label) { DEFINE_COMPILER; CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, label); process_partial_match(common); }
0
445,921
save_archive_thread (GSimpleAsyncResult *result, GObject *object, GCancellable *cancellable) { SaveData *save_data; LoadData *load_data; struct archive *a, *b; struct archive_entry *r_entry; int ra, rb; save_data = g_simple_async_result_get_op_res_gpointer (result); load_data = LOAD_DATA (save_data); save_data->b = b = archive_write_new (); _archive_write_set_format_from_context (b, save_data); archive_write_open (b, save_data, save_data_open, save_data_write, save_data_close); archive_write_set_bytes_in_last_block (b, 1); a = archive_read_new (); archive_read_support_filter_all (a); archive_read_support_format_all (a); archive_read_open (a, load_data, load_data_open, load_data_read, load_data_close); if (save_data->begin_operation != NULL) save_data->begin_operation (save_data, save_data->user_data); while ((load_data->error == NULL) && (ra = archive_read_next_header (a, &r_entry)) == ARCHIVE_OK) { struct archive_entry *w_entry; WriteAction action; if (g_cancellable_is_cancelled (cancellable)) break; action = WRITE_ACTION_WRITE_ENTRY; w_entry = archive_entry_clone (r_entry); if (save_data->entry_action != NULL) action = save_data->entry_action (save_data, w_entry, save_data->user_data); if (action == WRITE_ACTION_WRITE_ENTRY) { const void *buffer; size_t buffer_size; __LA_INT64_T offset; rb = archive_write_header (b, w_entry); if (rb != ARCHIVE_OK) break; switch (archive_entry_filetype (r_entry)) { case AE_IFREG: while ((ra = archive_read_data_block (a, &buffer, &buffer_size, &offset)) == ARCHIVE_OK) { archive_write_data (b, buffer, buffer_size); fr_archive_progress_inc_completed_bytes (load_data->archive, buffer_size); } if (ra != ARCHIVE_EOF) load_data->error = g_error_new_literal (FR_ERROR, FR_ERROR_COMMAND_ERROR, archive_error_string (a)); break; default: break; } rb = archive_write_finish_entry (b); } else if (action == WRITE_ACTION_SKIP_ENTRY) fr_archive_progress_inc_completed_bytes (load_data->archive, archive_entry_size (r_entry)); archive_entry_free (w_entry); } if (g_error_matches (load_data->error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) ra = ARCHIVE_EOF; if (save_data->end_operation != NULL) save_data->end_operation (save_data, save_data->user_data); rb = archive_write_close (b); if ((load_data->error == NULL) && (ra != ARCHIVE_EOF)) load_data->error = g_error_new_literal (FR_ERROR, FR_ERROR_COMMAND_ERROR, archive_error_string (a)); if ((load_data->error == NULL) && (rb != ARCHIVE_OK)) load_data->error = g_error_new_literal (FR_ERROR, FR_ERROR_COMMAND_ERROR, archive_error_string (b)); if (load_data->error == NULL) g_cancellable_set_error_if_cancelled (cancellable, &load_data->error); if (load_data->error != NULL) g_simple_async_result_set_from_error (result, load_data->error); archive_read_free (a); archive_write_free (b); save_data_free (save_data); }
0
208,076
RList *r_bin_ne_get_entrypoints(r_bin_ne_obj_t *bin) { RList *entries = r_list_newf (free); if (!entries) { return NULL; } RList *segments = r_bin_ne_get_segments (bin); if (!segments) { r_list_free (entries); return NULL; } if (bin->ne_header->csEntryPoint) { RBinAddr *entry = R_NEW0 (RBinAddr); if (!entry) { r_list_free (entries); return NULL; } entry->bits = 16; ut32 entry_cs = bin->ne_header->csEntryPoint; RBinSection *s = r_list_get_n (segments, entry_cs - 1); entry->paddr = bin->ne_header->ipEntryPoint + (s? s->paddr: 0); r_list_append (entries, entry); } int off = 0; size_t tableat = bin->header_offset + bin->ne_header->EntryTableOffset; while (off < bin->ne_header->EntryTableLength) { if (tableat + off >= r_buf_size (bin->buf)) { break; } ut8 bundle_length = *(ut8 *)(bin->entry_table + off); if (!bundle_length) { break; } off++; ut8 bundle_type = *(ut8 *)(bin->entry_table + off); off++; int i; for (i = 0; i < bundle_length; i++) { if (tableat + off + 4 >= r_buf_size (bin->buf)) { break; } RBinAddr *entry = R_NEW0 (RBinAddr); if (!entry) { r_list_free (entries); return NULL; } off++; if (!bundle_type) { // Skip off--; free (entry); break; } else if (bundle_type == 0xff) { // moveable off += 2; ut8 segnum = *(bin->entry_table + off); off++; ut16 segoff = *(ut16 *)(bin->entry_table + off); if (segnum > 0) { entry->paddr = (ut64)bin->segment_entries[segnum - 1].offset * bin->alignment + segoff; } } else { // Fixed if (bundle_type < bin->ne_header->SegCount) { entry->paddr = (ut64)bin->segment_entries[bundle_type - 1].offset * bin->alignment + *(ut16 *)(bin->entry_table + off); } } off += 2; r_list_append (entries, entry); } } r_list_free (segments); bin->entries = entries; return entries; }
1
343,234
void usleep2(const unsigned long microsec) { disablesignals(); usleep(microsec); enablesignals(); }
0
502,732
void SSL_SESSION_free(SSL_SESSION *ss) { int i; if (ss == NULL) return; i = CRYPTO_add(&ss->references, -1, CRYPTO_LOCK_SSL_SESSION); #ifdef REF_PRINT REF_PRINT("SSL_SESSION", ss); #endif if (i > 0) return; #ifdef REF_CHECK if (i < 0) { fprintf(stderr, "SSL_SESSION_free, bad reference count\n"); abort(); /* ok */ } #endif CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data); OPENSSL_cleanse(ss->key_arg, sizeof ss->key_arg); OPENSSL_cleanse(ss->master_key, sizeof ss->master_key); OPENSSL_cleanse(ss->session_id, sizeof ss->session_id); if (ss->sess_cert != NULL) ssl_sess_cert_free(ss->sess_cert); if (ss->peer != NULL) X509_free(ss->peer); if (ss->ciphers != NULL) sk_SSL_CIPHER_free(ss->ciphers); #ifndef OPENSSL_NO_TLSEXT if (ss->tlsext_hostname != NULL) OPENSSL_free(ss->tlsext_hostname); if (ss->tlsext_tick != NULL) OPENSSL_free(ss->tlsext_tick); # ifndef OPENSSL_NO_EC ss->tlsext_ecpointformatlist_length = 0; if (ss->tlsext_ecpointformatlist != NULL) OPENSSL_free(ss->tlsext_ecpointformatlist); ss->tlsext_ellipticcurvelist_length = 0; if (ss->tlsext_ellipticcurvelist != NULL) OPENSSL_free(ss->tlsext_ellipticcurvelist); # endif /* OPENSSL_NO_EC */ #endif #ifndef OPENSSL_NO_PSK if (ss->psk_identity_hint != NULL) OPENSSL_free(ss->psk_identity_hint); if (ss->psk_identity != NULL) OPENSSL_free(ss->psk_identity); #endif #ifndef OPENSSL_NO_SRP if (ss->srp_username != NULL) OPENSSL_free(ss->srp_username); #endif OPENSSL_cleanse(ss, sizeof(*ss)); OPENSSL_free(ss); }
0
276,962
OpenOutput(const char* filename_pattern, unsigned int segment_number) { AP4_ByteStream* output = NULL; char filename[4096]; sprintf(filename, filename_pattern, segment_number); AP4_Result result = AP4_FileByteStream::Create(filename, AP4_FileByteStream::STREAM_MODE_WRITE, output); if (AP4_FAILED(result)) { fprintf(stderr, "ERROR: cannot open output (%d)\n", result); return NULL; } return output; }
0
225,451
string GeneratedNameForIdentityConsumingSwitch( const MutableGraphView::OutputPort& fanin) { return AddPrefixToNodeName( absl::StrCat(fanin.node->name(), "_", fanin.port_id), kMutableGraphViewCtrl); }
0
241,365
int64 GetCostPerUnit(const TensorShapes& input_matrix_shapes) const final { double rows = static_cast<double>(input_matrix_shapes[0].dim_size(0)); double num_rhss = static_cast<double>(input_matrix_shapes[1].dim_size(1)); double cost = rows * rows * (rows + num_rhss); return cost >= static_cast<double>(kint64max) ? kint64max : static_cast<int64>(cost); }
0
455,335
setup_ignore_patterns (ivp) struct ignorevar *ivp; { int numitems, maxitems, ptr; char *colon_bit, *this_ignoreval; struct ign *p; this_ignoreval = get_string_value (ivp->varname); /* If nothing has changed then just exit now. */ if ((this_ignoreval && ivp->last_ignoreval && STREQ (this_ignoreval, ivp->last_ignoreval)) || (!this_ignoreval && !ivp->last_ignoreval)) return; /* Oops. The ignore variable has changed. Re-parse it. */ ivp->num_ignores = 0; if (ivp->ignores) { for (p = ivp->ignores; p->val; p++) free(p->val); free (ivp->ignores); ivp->ignores = (struct ign *)NULL; } if (ivp->last_ignoreval) { free (ivp->last_ignoreval); ivp->last_ignoreval = (char *)NULL; } if (this_ignoreval == 0 || *this_ignoreval == '\0') return; ivp->last_ignoreval = savestring (this_ignoreval); numitems = maxitems = ptr = 0; #if 0 while (colon_bit = extract_colon_unit (this_ignoreval, &ptr)) #else while (colon_bit = split_ignorespec (this_ignoreval, &ptr)) #endif { if (numitems + 1 >= maxitems) { maxitems += 10; ivp->ignores = (struct ign *)xrealloc (ivp->ignores, maxitems * sizeof (struct ign)); } ivp->ignores[numitems].val = colon_bit; ivp->ignores[numitems].len = strlen (colon_bit); ivp->ignores[numitems].flags = 0; if (ivp->item_func) (*ivp->item_func) (&ivp->ignores[numitems]); numitems++; } ivp->ignores[numitems].val = (char *)NULL; ivp->num_ignores = numitems; }
0
223,450
static BOOL optimize_class_ranges(compiler_common *common, const sljit_u8 *bits, BOOL nclass, BOOL invert, jump_list **backtracks) { /* May destroy TMP1. */ DEFINE_COMPILER; int ranges[MAX_CLASS_RANGE_SIZE]; sljit_u8 bit, cbit, all; int i, byte, length = 0; bit = bits[0] & 0x1; /* All bits will be zero or one (since bit is zero or one). */ all = -bit; for (i = 0; i < 256; ) { byte = i >> 3; if ((i & 0x7) == 0 && bits[byte] == all) i += 8; else { cbit = (bits[byte] >> (i & 0x7)) & 0x1; if (cbit != bit) { if (length >= MAX_CLASS_RANGE_SIZE) return FALSE; ranges[length] = i; length++; bit = cbit; all = -cbit; } i++; } } if (((bit == 0) && nclass) || ((bit == 1) && !nclass)) { if (length >= MAX_CLASS_RANGE_SIZE) return FALSE; ranges[length] = 256; length++; } if (length < 0 || length > 4) return FALSE; bit = bits[0] & 0x1; if (invert) bit ^= 0x1; /* No character is accepted. */ if (length == 0 && bit == 0) add_jump(compiler, backtracks, JUMP(SLJIT_JUMP)); switch(length) { case 0: /* When bit != 0, all characters are accepted. */ return TRUE; case 1: add_jump(compiler, backtracks, CMP(bit == 0 ? SLJIT_LESS : SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0])); return TRUE; case 2: if (ranges[0] + 1 != ranges[1]) { OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[0]); add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_LESS : SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0])); } else add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_EQUAL : SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0])); return TRUE; case 3: if (bit != 0) { add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2])); if (ranges[0] + 1 != ranges[1]) { OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[0]); add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0])); } else add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0])); return TRUE; } add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[0])); if (ranges[1] + 1 != ranges[2]) { OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[1]); add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[1])); } else add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1])); return TRUE; case 4: if ((ranges[1] - ranges[0]) == (ranges[3] - ranges[2]) && (ranges[0] | (ranges[2] - ranges[0])) == ranges[2] && (ranges[1] & (ranges[2] - ranges[0])) == 0 && is_powerof2(ranges[2] - ranges[0])) { SLJIT_ASSERT((ranges[0] & (ranges[2] - ranges[0])) == 0 && (ranges[2] & ranges[3] & (ranges[2] - ranges[0])) != 0); OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[0]); if (ranges[2] + 1 != ranges[3]) { OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[2]); add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_LESS : SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[2])); } else add_jump(compiler, backtracks, CMP(bit != 0 ? SLJIT_EQUAL : SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2])); return TRUE; } if (bit != 0) { i = 0; if (ranges[0] + 1 != ranges[1]) { OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[0]); add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0])); i = ranges[0]; } else add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[0])); if (ranges[2] + 1 != ranges[3]) { OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[2] - i); add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[2])); } else add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[2] - i)); return TRUE; } OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[0]); add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[3] - ranges[0])); if (ranges[1] + 1 != ranges[2]) { OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0]); add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[1])); } else add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, ranges[1] - ranges[0])); return TRUE; default: SLJIT_UNREACHABLE(); return FALSE; } }
0
238,806
pat_has_uppercase(char_u *pat) { char_u *p = pat; magic_T magic_val = MAGIC_ON; // get the magicness of the pattern (void)skip_regexp_ex(pat, NUL, magic_isset(), NULL, NULL, &magic_val); while (*p != NUL) { int l; if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { if (enc_utf8 && utf_isupper(utf_ptr2char(p))) return TRUE; p += l; } else if (*p == '\\' && magic_val <= MAGIC_ON) { if (p[1] == '_' && p[2] != NUL) // skip "\_X" p += 3; else if (p[1] == '%' && p[2] != NUL) // skip "\%X" p += 3; else if (p[1] != NUL) // skip "\X" p += 2; else p += 1; } else if ((*p == '%' || *p == '_') && magic_val == MAGIC_ALL) { if (p[1] != NUL) // skip "_X" and %X p += 2; else p++; } else if (MB_ISUPPER(*p)) return TRUE; else ++p; } return FALSE; }
0
517,444
static void do_home_filesystem(HttpResponse res) { char buf[STRLEN]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_conf; s; s = s->next_conf) { if (s->type != Service_Filesystem) continue; if (header) { StringBuffer_append(res->outputbuffer, "<table id='header-row'>" "<tr>" "<th class='left first'>Filesystem</th>" "<th class='left'>Status</th>" "<th class='right'>Space usage</th>" "<th class='right'>Inodes usage</th>" "<th class='right column'>Read</th>" "<th class='right column'>Write</th>" "</tr>"); header = false; } StringBuffer_append(res->outputbuffer, "<tr %s>" "<td class='left'><a href='%s'>%s</a></td>" "<td class='left'>%s</td>", on ? "class='stripe'" : "", s->name, s->name, get_service_status(HTML, s, buf, sizeof(buf))); if (! Util_hasServiceStatus(s)) { StringBuffer_append(res->outputbuffer, "<td class='right'>- [-]</td>" "<td class='right'>- [-]</td>" "<td class='right column'>- [-]</td>" "<td class='right column'>- [-]</td>"); } else { StringBuffer_append(res->outputbuffer, "<td class='right column%s'>%.1f%% [%s]</td>", (s->error & Event_Resource) ? " red-text" : "", s->inf.filesystem->space_percent, s->inf.filesystem->f_bsize > 0 ? Fmt_bytes2str(s->inf.filesystem->f_blocksused * s->inf.filesystem->f_bsize, buf) : "0 MB"); if (s->inf.filesystem->f_files > 0) { StringBuffer_append(res->outputbuffer, "<td class='right column%s'>%.1f%% [%lld objects]</td>", (s->error & Event_Resource) ? " red-text" : "", s->inf.filesystem->inode_percent, s->inf.filesystem->f_filesused); } else { StringBuffer_append(res->outputbuffer, "<td class='right column'>not supported by filesystem</td>"); } StringBuffer_append(res->outputbuffer, "<td class='right column%s'>%s/s</td>" "<td class='right column%s'>%s/s</td>", (s->error & Event_Resource) ? " red-text" : "", Fmt_bytes2str(Statistics_deltaNormalize(&(s->inf.filesystem->read.bytes)), (char[10]){}), (s->error & Event_Resource) ? " red-text" : "", Fmt_bytes2str(Statistics_deltaNormalize(&(s->inf.filesystem->write.bytes)), (char[10]){})); } StringBuffer_append(res->outputbuffer, "</tr>"); on = ! on; } if (! header) StringBuffer_append(res->outputbuffer, "</table>"); }
0
226,440
std::unique_ptr<IteratorBase> MakeIteratorInternal( const string& prefix) const override { return absl::make_unique<Iterator>(typename Iterator::Params{ this, strings::StrCat(prefix, "::SparseTensorSlice")}); }
0
343,125
static void esp_output_done_esn(struct crypto_async_request *base, int err) { struct sk_buff *skb = base->data; esp_output_restore_header(skb); esp_output_done(base, err); }
0
263,514
static int sco_sock_shutdown(struct socket *sock, int how) { struct sock *sk = sock->sk; int err = 0; BT_DBG("sock %p, sk %p", sock, sk); if (!sk) return 0; sock_hold(sk); lock_sock(sk); if (!sk->sk_shutdown) { sk->sk_shutdown = SHUTDOWN_MASK; sco_sock_clear_timer(sk); __sco_sock_close(sk); if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime && !(current->flags & PF_EXITING)) err = bt_sock_wait_state(sk, BT_CLOSED, sk->sk_lingertime); } release_sock(sk); sock_put(sk); return err; }
0
307,865
ciEnv::ciEnv(CompileTask* task, int system_dictionary_modification_counter) : _ciEnv_arena(mtCompiler) { VM_ENTRY_MARK; // Set up ciEnv::current immediately, for the sake of ciObjectFactory, etc. thread->set_env(this); assert(ciEnv::current() == this, "sanity"); _oop_recorder = NULL; _debug_info = NULL; _dependencies = NULL; _failure_reason = NULL; _compilable = MethodCompilable; _break_at_compile = false; _compiler_data = NULL; #ifndef PRODUCT assert(!firstEnv, "not initialized properly"); #endif /* !PRODUCT */ _system_dictionary_modification_counter = system_dictionary_modification_counter; _num_inlined_bytecodes = 0; assert(task == NULL || thread->task() == task, "sanity"); _task = task; _log = NULL; // Temporary buffer for creating symbols and such. _name_buffer = NULL; _name_buffer_len = 0; _arena = &_ciEnv_arena; _factory = new (_arena) ciObjectFactory(_arena, 128); // Preload commonly referenced system ciObjects. // During VM initialization, these instances have not yet been created. // Assertions ensure that these instances are not accessed before // their initialization. assert(Universe::is_fully_initialized(), "should be complete"); oop o = Universe::null_ptr_exception_instance(); assert(o != NULL, "should have been initialized"); _NullPointerException_instance = get_object(o)->as_instance(); o = Universe::arithmetic_exception_instance(); assert(o != NULL, "should have been initialized"); _ArithmeticException_instance = get_object(o)->as_instance(); _ArrayIndexOutOfBoundsException_instance = NULL; _ArrayStoreException_instance = NULL; _ClassCastException_instance = NULL; _the_null_string = NULL; _the_min_jint_string = NULL; _jvmti_can_hotswap_or_post_breakpoint = false; _jvmti_can_access_local_variables = false; _jvmti_can_post_on_exceptions = false; _jvmti_can_pop_frame = false; }
0
295,887
mp_sint32 LoaderXM::load(XMFileBase& f, XModule* module) { mp_ubyte insData[230]; mp_sint32 smpReloc[MP_MAXINSSAMPS]; mp_ubyte nbu[MP_MAXINSSAMPS]; mp_uint32 fileSize = 0; module->cleanUp(); // this will make code much easier to read TXMHeader* header = &module->header; TXMInstrument* instr = module->instr; TXMSample* smp = module->smp; TXMPattern* phead = module->phead; // we're already out of memory here if (!phead || !instr || !smp) return MP_OUT_OF_MEMORY; fileSize = f.sizeWithBaseOffset(); f.read(&header->sig,1,17); f.read(&header->name,1,20); f.read(&header->whythis1a,1,1); header->whythis1a=0; f.read(&header->tracker,1,20); f.readWords(&header->ver,1); if (header->ver != 0x102 && header->ver != 0x103 && // untested header->ver != 0x104) return MP_LOADER_FAILED; f.readDwords(&header->hdrsize,1); header->hdrsize-=4; mp_uint32 hdrSize = 0x110; if (header->hdrsize > hdrSize) hdrSize = header->hdrsize; mp_ubyte* hdrBuff = new mp_ubyte[hdrSize]; memset(hdrBuff, 0, hdrSize); f.read(hdrBuff, 1, header->hdrsize); header->ordnum = LittleEndian::GET_WORD(hdrBuff); header->restart = LittleEndian::GET_WORD(hdrBuff+2); header->channum = LittleEndian::GET_WORD(hdrBuff+4); header->patnum = LittleEndian::GET_WORD(hdrBuff+6); header->insnum = LittleEndian::GET_WORD(hdrBuff+8); header->freqtab = LittleEndian::GET_WORD(hdrBuff+10); header->tempo = LittleEndian::GET_WORD(hdrBuff+12); header->speed = LittleEndian::GET_WORD(hdrBuff+14); memcpy(header->ord, hdrBuff+16, 256); if(header->ordnum > MP_MAXORDERS) header->ordnum = MP_MAXORDERS; if(header->insnum > MP_MAXINS) return MP_LOADER_FAILED; delete[] hdrBuff; header->mainvol=255; header->flags = XModule::MODULE_XMNOTECLIPPING | XModule::MODULE_XMARPEGGIO | XModule::MODULE_XMPORTANOTEBUFFER | XModule::MODULE_XMVOLCOLUMNVIBRATO; header->uppernotebound = 119; mp_sint32 i,y,sc; for (i=0;i<32;i++) header->pan[i]=0x80; // old version? if (header->ver == 0x102 || header->ver == 0x103) { mp_sint32 s = 0; mp_sint32 e = 0; for (y=0;y<header->insnum;y++) { f.readDwords(&instr[y].size,1); f.read(&instr[y].name,1,22); f.read(&instr[y].type,1,1); mp_uword numSamples = 0; f.readWords(&numSamples,1); if(numSamples > MP_MAXINSSAMPS) return MP_LOADER_FAILED; instr[y].samp = numSamples; if (instr[y].size == 29) { #ifdef MILKYTRACKER s+=16; #endif for (mp_sint32 i = 0; i < 120; i++) instr[y].snum[i] = -1; continue; } f.readDwords(&instr[y].shsize,1); memset(insData, 0, 230); if (instr[y].size - 33 > 230) return MP_OUT_OF_MEMORY; f.read(insData, 1, instr[y].size - 33); if (instr[y].samp) { mp_ubyte* insDataPtr = insData; memcpy(nbu, insDataPtr, MP_MAXINSSAMPS); insDataPtr+=MP_MAXINSSAMPS; TEnvelope venv; TEnvelope penv; memset(&venv,0,sizeof(venv)); memset(&penv,0,sizeof(penv)); mp_sint32 k; for (k = 0; k < XM_ENVELOPENUMPOINTS; k++) { venv.env[k][0] = LittleEndian::GET_WORD(insDataPtr); venv.env[k][1] = LittleEndian::GET_WORD(insDataPtr+2); insDataPtr+=4; } for (k = 0; k < XM_ENVELOPENUMPOINTS; k++) { penv.env[k][0] = LittleEndian::GET_WORD(insDataPtr); penv.env[k][1] = LittleEndian::GET_WORD(insDataPtr+2); insDataPtr+=4; } venv.num = *insDataPtr++; if (venv.num > XM_ENVELOPENUMPOINTS) venv.num = XM_ENVELOPENUMPOINTS; penv.num = *insDataPtr++; if (penv.num > XM_ENVELOPENUMPOINTS) penv.num = XM_ENVELOPENUMPOINTS; venv.sustain = *insDataPtr++; venv.loops = *insDataPtr++; venv.loope = *insDataPtr++; penv.sustain = *insDataPtr++; penv.loops = *insDataPtr++; penv.loope = *insDataPtr++; venv.type = *insDataPtr++; penv.type = *insDataPtr++; mp_ubyte vibtype, vibsweep, vibdepth, vibrate; mp_uword volfade; vibtype = *insDataPtr++; vibsweep = *insDataPtr++; vibdepth = *insDataPtr++; vibrate = *insDataPtr++; vibdepth<<=1; volfade = LittleEndian::GET_WORD(insDataPtr); insDataPtr+=2; volfade<<=1; //instr[y].res = LittleEndian::GET_WORD(insDataPtr); insDataPtr+=2; for (mp_sint32 l=0;l<XM_ENVELOPENUMPOINTS;l++) { venv.env[l][1]<<=2; penv.env[l][1]<<=2; } if (!module->addVolumeEnvelope(venv)) return MP_OUT_OF_MEMORY; if (!module->addPanningEnvelope(penv)) return MP_OUT_OF_MEMORY; mp_sint32 g=0, sc; for (sc=0;sc<instr[y].samp;sc++) { smp[g+s].flags=3; smp[g+s].venvnum=e+1; smp[g+s].penvnum=e+1; smp[g+s].vibtype=vibtype; smp[g+s].vibsweep=vibsweep; smp[g+s].vibdepth=vibdepth; smp[g+s].vibrate=vibrate; smp[g+s].volfade=volfade; // not sure why I did that, actually doesn't make sense //if (!(venv.type&1)) smp[g+s].volfade=0; f.readDwords(&smp[g+s].samplen,1); f.readDwords(&smp[g+s].loopstart,1); f.readDwords(&smp[g+s].looplen,1); smp[g+s].vol=XModule::vol64to255(f.readByte()); //f.read(&smp[g+s].vol,1,1); f.read(&smp[g+s].finetune,1,1); f.read(&smp[g+s].type,1,1); #ifdef VERBOSE printf("Before: %i, After: %i\n", smp[g+s].type, smp[g+s].type & (3+16)); #endif f.read(&smp[g+s].pan,1,1); f.read(&smp[g+s].relnote,1,1); f.read(&smp[g+s].res,1,1); f.read(&smp[g+s].name,1,22); char line[30]; memset(line, 0, sizeof(line)); XModule::convertStr(line, smp[g+s].name, 23, false); if (line[0]) module->addSongMessageLine(line); // ignore empty samples #ifndef MILKYTRACKER // ignore empty samples when not being a tracker if (smp[g+s].samplen) { smpReloc[sc] = g; g++; } else smpReloc[sc] = -1; #else smpReloc[sc] = g; g++; #endif } instr[y].samp = g; for (sc = 0; sc < MP_MAXINSSAMPS; sc++) { if (smpReloc[nbu[sc]] == -1) instr[y].snum[sc] = -1; else instr[y].snum[sc] = smpReloc[nbu[sc]]+s; } e++; } else { for (mp_sint32 i = 0; i < 120; i++) instr[y].snum[i] = -1; } #ifdef MILKYTRACKER s+=16; #else s+=instr[y].samp; #endif } header->smpnum=s; header->volenvnum=e; header->panenvnum=e; } for (y=0;y<header->patnum;y++) { if (header->ver == 0x104 || header->ver == 0x103) { f.readDwords(&phead[y].len,1); f.read(&phead[y].ptype,1,1); f.readWords(&phead[y].rows,1); f.readWords(&phead[y].patdata,1); } else { f.readDwords(&phead[y].len,1); f.read(&phead[y].ptype,1,1); phead[y].rows = (mp_uword)f.readByte()+1; f.readWords(&phead[y].patdata,1); } phead[y].effnum=2; phead[y].channum=(mp_ubyte)header->channum; phead[y].patternData = new mp_ubyte[phead[y].rows*header->channum*6]; // out of memory? if (phead[y].patternData == NULL) { return MP_OUT_OF_MEMORY; } memset(phead[y].patternData,0,phead[y].rows*header->channum*6); if (phead[y].patdata) { mp_ubyte *buffer = new mp_ubyte[phead[y].patdata]; // out of memory? if (buffer == NULL) { return MP_OUT_OF_MEMORY; } f.read(buffer,1,phead[y].patdata); //printf("%i\n", phead[y].patdata); mp_sint32 pc = 0, bc = 0; for (mp_sint32 r=0;r<phead[y].rows;r++) { for (mp_sint32 c=0;c<header->channum;c++) { mp_ubyte slot[5]; memset(slot,0,5); if ((buffer[pc]&128)) { mp_ubyte pb = buffer[pc]; pc++; if ((pb&1)) { //phead[y].patternData[bc]=buffer[pc]; slot[0]=buffer[pc]; pc++; } if ((pb&2)) { //phead[y].patternData[bc+1]=buffer[pc]; slot[1]=buffer[pc]; pc++; } if ((pb&4)) { //phead[y].patternData[bc+2]=buffer[pc]; slot[2]=buffer[pc]; pc++; } if ((pb&8)) { //phead[y].patternData[bc+3]=buffer[pc]; slot[3]=buffer[pc]; pc++; } if ((pb&16)) { //phead[y].patternData[bc+4]=buffer[pc]; slot[4]=buffer[pc]; pc++; } } else { //memcpy(phead[y].patternData+bc,buffer+pc,5); memcpy(slot,buffer+pc,5); pc+=5; } char gl=0; for (mp_sint32 i=0;i<XModule::numValidXMEffects;i++) if (slot[3]==XModule::validXMEffects[i]) gl=1; if (!gl) slot[3]=slot[4]=0; if ((slot[3]==0xC)||(slot[3]==0x10)) { slot[4] = XModule::vol64to255(slot[4]); /*mp_sint32 bl = slot[4]; if (bl>64) bl=64; slot[4]=(bl*261120)>>16;*/ } if ((!slot[3])&&(slot[4])) slot[3]=0x20; if (slot[3]==0xE) { slot[3]=(slot[4]>>4)+0x30; slot[4]=slot[4]&0xf; } if (slot[3]==0x21) { slot[3]=(slot[4]>>4)+0x40; slot[4]=slot[4]&0xf; } if (slot[0]==97) slot[0]=XModule::NOTE_OFF; phead[y].patternData[bc]=slot[0]; phead[y].patternData[bc+1]=slot[1]; XModule::convertXMVolumeEffects(slot[2], phead[y].patternData[bc+2], phead[y].patternData[bc+3]); phead[y].patternData[bc+4]=slot[3]; phead[y].patternData[bc+5]=slot[4]; /*if ((y==3)&&(c==2)) { for (mp_sint32 bl=0;bl<6;bl++) cprintf("%x ",phead[y].patternData[bc+bl]); cprintf("\r\n"); getch(); };*/ /*printf("Note : %i\r\n",phead[y].patternData[bc]); printf("Ins : %i\r\n",phead[y].patternData[bc+1]); printf("Vol : %i\r\n",phead[y].patternData[bc+2]); printf("Eff : %i\r\n",phead[y].patternData[bc+3]); printf("Effop: %i\r\n",phead[y].patternData[bc+4]); getch();*/ bc+=6; } // for c } // for r delete[] buffer; } } if (header->ver == 0x104) { mp_sint32 s = 0; mp_sint32 e = 0; for (y=0;y<header->insnum;y++) { // fixes MOOH.XM loading problems // seems to store more instruments in the header than in the actual file if (f.posWithBaseOffset() >= fileSize) break; //TXMInstrument* ins = &instr[y]; f.readDwords(&instr[y].size,1); if (instr[y].size >= 4 && instr[y].size < 29) { mp_ubyte buffer[29]; memset(buffer, 0, sizeof(buffer)); f.read(buffer, 1, instr[y].size - 4); memcpy(instr[y].name, buffer, 22); instr[y].type = buffer[22]; instr[y].samp = LittleEndian::GET_WORD(buffer + 23); } else { f.read(&instr[y].name,1,22); f.read(&instr[y].type,1,1); f.readWords(&instr[y].samp,1); } if (instr[y].samp > MP_MAXINSSAMPS) return MP_LOADER_FAILED; //printf("%i, %i\n", instr[y].size, instr[y].samp); if (instr[y].size <= 29) { #ifdef MILKYTRACKER s+=16; #endif for (mp_sint32 i = 0; i < 120; i++) instr[y].snum[i] = -1; continue; } f.readDwords(&instr[y].shsize,1); #ifdef VERBOSE printf("%i/%i: %i, %i, %i, %s\n",y,header->insnum-1,instr[y].size,instr[y].shsize,instr[y].samp,instr[y].name); #endif memset(insData, 0, 230); if (instr[y].size - 33 > 230) { //return -7; break; } f.read(insData, 1, instr[y].size - 33); /*printf("%i\r\n",instr[y].size); printf("%s\r\n",instr[y].name); printf("%i\r\n",instr[y].type); printf("%i\r\n",instr[y].samp); printf("%i\r\n",instr[y].shsize);*/ //getch(); memset(smpReloc, 0, sizeof(smpReloc)); if (instr[y].samp) { mp_ubyte* insDataPtr = insData; //f.read(&nbu,1,96); memcpy(nbu, insDataPtr, MP_MAXINSSAMPS); insDataPtr+=MP_MAXINSSAMPS; TEnvelope venv; TEnvelope penv; memset(&venv,0,sizeof(venv)); memset(&penv,0,sizeof(penv)); mp_sint32 k; for (k = 0; k < XM_ENVELOPENUMPOINTS; k++) { venv.env[k][0] = LittleEndian::GET_WORD(insDataPtr); venv.env[k][1] = LittleEndian::GET_WORD(insDataPtr+2); insDataPtr+=4; } for (k = 0; k < XM_ENVELOPENUMPOINTS; k++) { penv.env[k][0] = LittleEndian::GET_WORD(insDataPtr); penv.env[k][1] = LittleEndian::GET_WORD(insDataPtr+2); insDataPtr+=4; } venv.num = *insDataPtr++; if (venv.num > XM_ENVELOPENUMPOINTS) venv.num = XM_ENVELOPENUMPOINTS; penv.num = *insDataPtr++; if (penv.num > XM_ENVELOPENUMPOINTS) penv.num = XM_ENVELOPENUMPOINTS; venv.sustain = *insDataPtr++; venv.loops = *insDataPtr++; venv.loope = *insDataPtr++; penv.sustain = *insDataPtr++; penv.loops = *insDataPtr++; penv.loope = *insDataPtr++; venv.type = *insDataPtr++; penv.type = *insDataPtr++; mp_ubyte vibtype, vibsweep, vibdepth, vibrate; mp_uword volfade; vibtype = *insDataPtr++; vibsweep = *insDataPtr++; vibdepth = *insDataPtr++; vibrate = *insDataPtr++; vibdepth<<=1; //f.readWords(&volfade,1); volfade = LittleEndian::GET_WORD(insDataPtr); insDataPtr+=2; volfade<<=1; //instr[y].res = LittleEndian::GET_WORD(insDataPtr); insDataPtr+=2; for (mp_sint32 l=0;l<XM_ENVELOPENUMPOINTS;l++) { venv.env[l][1]<<=2; penv.env[l][1]<<=2; } if (!module->addVolumeEnvelope(venv)) return MP_OUT_OF_MEMORY; if (!module->addPanningEnvelope(penv)) return MP_OUT_OF_MEMORY; mp_sint32 g=0, sc; for (sc=0;sc<instr[y].samp;sc++) { //TXMSample* smpl = &smp[g+s]; smp[g+s].flags=3; smp[g+s].venvnum=e+1; smp[g+s].penvnum=e+1; smp[g+s].vibtype=vibtype; smp[g+s].vibsweep=vibsweep; smp[g+s].vibdepth=vibdepth; smp[g+s].vibrate=vibrate; smp[g+s].volfade=volfade; // not sure why I did that, actually doesn't make sense //if (!(venv.type&1)) smp[g+s].volfade=0; f.readDwords(&smp[g+s].samplen,1); f.readDwords(&smp[g+s].loopstart,1); f.readDwords(&smp[g+s].looplen,1); smp[g+s].vol=XModule::vol64to255(f.readByte()); //f.read(&smp[g+s].vol,1,1); f.read(&smp[g+s].finetune,1,1); f.read(&smp[g+s].type,1,1); #ifdef VERBOSE printf("Before: %i, After: %i\n", smp[g+s].type, smp[g+s].type & (3+16)); #endif f.read(&smp[g+s].pan,1,1); f.read(&smp[g+s].relnote,1,1); f.read(&smp[g+s].res,1,1); f.read(&smp[g+s].name,1,22); char line[30]; memset(line, 0, sizeof(line)); XModule::convertStr(line, smp[g+s].name, 23, false); if (line[0]) module->addSongMessageLine(line); #ifndef MILKYTRACKER // ignore empty samples when not being a tracker if (smp[g+s].samplen) { smpReloc[sc] = g; g++; } else smpReloc[sc] = -1; #else smpReloc[sc] = g; g++; #endif } instr[y].samp = g; for (sc = 0; sc < MP_MAXINSSAMPS; sc++) { if (smpReloc[nbu[sc]] == -1) instr[y].snum[sc] = -1; else instr[y].snum[sc] = smpReloc[nbu[sc]]+s; } for (sc=0;sc<instr[y].samp;sc++) { if (smp[s].samplen) { bool adpcm = (smp[s].res == 0xAD); mp_uint32 oldSize = smp[s].samplen; if (smp[s].type&16) { smp[s].samplen>>=1; smp[s].loopstart>>=1; smp[s].looplen>>=1; } mp_sint32 result = module->loadModuleSample(f, s, adpcm ? XModule::ST_PACKING_ADPCM : XModule::ST_DELTA, adpcm ? (XModule::ST_PACKING_ADPCM | XModule::ST_16BIT) : (XModule::ST_DELTA | XModule::ST_16BIT), oldSize); if (result != MP_OK) return result; if (adpcm) smp[s].res = 0; } s++; if (s>=MP_MAXSAMPLES) return MP_OUT_OF_MEMORY; } e++; } else { for (mp_sint32 i = 0; i < 120; i++) instr[y].snum[i] = -1; } #ifdef MILKYTRACKER s+=16 - instr[y].samp; #endif } header->smpnum=s; header->volenvnum=e; header->panenvnum=e; } else { mp_sint32 s = 0; for (y=0;y<header->insnum;y++) { for (sc=0;sc<instr[y].samp;sc++) { if (smp[s].samplen) { mp_uint32 oldSize = smp[s].samplen; if (smp[s].type&16) { smp[s].samplen>>=1; smp[s].loopstart>>=1; smp[s].looplen>>=1; } mp_sint32 result = module->loadModuleSample(f, s, XModule::ST_DELTA, XModule::ST_DELTA | XModule::ST_16BIT, oldSize); if (result != MP_OK) return result; } s++; if (s>=MP_MAXSAMPLES) return MP_OUT_OF_MEMORY; } #ifdef MILKYTRACKER s+=16 - instr[y].samp; #endif } } // convert modplug stereo samples for (mp_sint32 s = 0; s < header->smpnum; s++) { if (smp[s].type & 32) { // that's what's allowed, stupid modplug tracker smp[s].type &= 3+16; if (smp[s].sample == NULL) continue; if (!(smp[s].type&16)) { smp[s].samplen>>=1; smp[s].loopstart>>=1; smp[s].looplen>>=1; mp_sbyte* sample = (mp_sbyte*)smp[s].sample; mp_sint32 samplen = smp[s].samplen; for (mp_sint32 i = 0; i < samplen; i++) { mp_sint32 s = ((mp_sint32)sample[i] + (mp_sint32)sample[i + samplen]) >> 1; if (s < -128) s = -128; if (s > 127) s = 127; sample[i] = (mp_sbyte)s; } } else { smp[s].samplen>>=1; smp[s].loopstart>>=1; smp[s].looplen>>=1; mp_sword* sample = (mp_sword*)smp[s].sample; mp_sint32 samplen = smp[s].samplen; for (mp_sint32 i = 0; i < samplen; i++) { mp_sint32 s = ((mp_sint32)sample[i] + (mp_sint32)sample[i + samplen]) >> 1; if (s < -32768) s = -32768; if (s > 32767) s = 32767; sample[i] = (mp_sword)s; } } } // correct loop type 0x03 (undefined) // will become ping pong loop // note that FT2 will refuse to load XM files with such a loop type if ((smp[s].type & 0x3) == 0x3) smp[s].type&=~1; } // correct number of patterns if necessary, otherwise the post processing will remove // the "invalid" patterns from the order list bool addPatterns = false; for (i = 0; i < header->ordnum; i++) if (header->ord[i]+1 > header->patnum) { header->patnum = header->ord[i]+1; addPatterns = true; } // if the pattern number has been adjusted, add some empty patterns if (addPatterns) { for (i = 0; i < header->patnum; i++) if (phead[i].patternData == NULL) { phead[i].rows = 64; phead[i].effnum = 2; phead[i].channum = (mp_ubyte)header->channum; phead[i].patternData = new mp_ubyte[phead[i].rows*header->channum*6]; // out of memory? if (phead[i].patternData == NULL) { return MP_OUT_OF_MEMORY; } memset(phead[i].patternData,0,phead[i].rows*header->channum*6); } } // check for MODPLUG extensions if (f.posWithBaseOffset() + 8 <= fileSize) { char buffer[4]; f.read(buffer, 1, 4); if (memcmp(buffer, "text", 4) == 0) { mp_uint32 len = f.readDword(); module->allocateSongMessage(len+1); memset(module->message, 0, len+1); f.read(module->message, 1, len); } } module->postProcessSamples(); return MP_OK; }
0
352,951
csnNormalize( slap_mask_t usage, Syntax *syntax, MatchingRule *mr, struct berval *val, struct berval *normalized, void *ctx ) { struct berval cnt, sid, mod; char *ptr; ber_len_t i; assert( val != NULL ); assert( normalized != NULL ); assert( SLAP_MR_IS_VALUE_OF_SYNTAX( usage ) != 0 ); if ( BER_BVISEMPTY( val ) ) { return LDAP_INVALID_SYNTAX; } if ( val->bv_len == STRLENOF( "YYYYmmddHHMMSSZ#SSSSSS#ID#ssssss" ) ) { /* Openldap <= 2.3 */ return csnNormalize23( usage, syntax, mr, val, normalized, ctx ); } if ( val->bv_len == STRLENOF( "YYYYmmddHH:MM:SSZ#0xSSSS#I#ssss" ) ) { /* Openldap 2.1 */ return csnNormalize21( usage, syntax, mr, val, normalized, ctx ); } if ( val->bv_len != STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#SID#ssssss" ) ) { return LDAP_INVALID_SYNTAX; } ptr = ber_bvchr( val, '#' ); if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } if ( ptr - val->bv_val != STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ" ) ) { return LDAP_INVALID_SYNTAX; } cnt.bv_val = ptr + 1; cnt.bv_len = val->bv_len - ( cnt.bv_val - val->bv_val ); ptr = ber_bvchr( &cnt, '#' ); if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } if ( ptr - cnt.bv_val != STRLENOF( "000000" ) ) { return LDAP_INVALID_SYNTAX; } sid.bv_val = ptr + 1; sid.bv_len = val->bv_len - ( sid.bv_val - val->bv_val ); ptr = ber_bvchr( &sid, '#' ); if ( ptr == NULL || ptr == &val->bv_val[val->bv_len] ) { return LDAP_INVALID_SYNTAX; } sid.bv_len = ptr - sid.bv_val; if ( sid.bv_len != STRLENOF( "000" ) ) { return LDAP_INVALID_SYNTAX; } mod.bv_val = ptr + 1; mod.bv_len = val->bv_len - ( mod.bv_val - val->bv_val ); if ( mod.bv_len != STRLENOF( "000000" ) ) { return LDAP_INVALID_SYNTAX; } ber_dupbv_x( normalized, val, ctx ); for ( i = STRLENOF( "YYYYmmddHHMMSS.uuuuuuZ#SSSSSS#" ); i < normalized->bv_len; i++ ) { /* assume it's already validated that's all hex digits */ normalized->bv_val[ i ] = TOLOWER( normalized->bv_val[ i ] ); } return LDAP_SUCCESS; }
0
309,987
main(int argc, char **argv) { char *term; int errret; bool cmdline = TRUE; int c; char buf[BUFSIZ]; int result = 0; int fd; TTY tty_settings; bool opt_x = FALSE; /* clear scrollback if possible */ bool is_alias; bool need_tty; prg_name = check_aliases(_nc_rootname(argv[0]), TRUE); term = getenv("TERM"); while ((c = getopt(argc, argv, "ST:Vx")) != -1) { switch (c) { case 'S': cmdline = FALSE; break; case 'T': use_env(FALSE); use_tioctl(TRUE); term = optarg; break; case 'V': puts(curses_version()); ExitProgram(EXIT_SUCCESS); case 'x': /* do not try to clear scrollback */ opt_x = TRUE; break; default: usage(); /* NOTREACHED */ } } is_alias = (is_clear || is_reset || is_init); need_tty = ((is_reset || is_init) || (optind < argc && (!strcmp(argv[optind], "reset") || !strcmp(argv[optind], "init")))); /* * Modify the argument list to omit the options we processed. */ if (is_alias) { if (optind-- < argc) { argc -= optind; argv += optind; } argv[0] = prg_name; } else { argc -= optind; argv += optind; } if (term == 0 || *term == '\0') quit(ErrUsage, "No value for $TERM and no -T specified"); fd = save_tty_settings(&tty_settings, need_tty); if (setupterm(term, fd, &errret) != OK && errret <= 0) quit(ErrTermType, "unknown terminal \"%s\"", term); if (cmdline) { if ((argc <= 0) && !is_alias) usage(); ExitProgram(tput_cmd(fd, &tty_settings, opt_x, argc, argv)); } while (fgets(buf, sizeof(buf), stdin) != 0) { char *argvec[16]; /* command, 9 parms, null, & slop */ int argnum = 0; char *cp; /* crack the argument list into a dope vector */ for (cp = buf; *cp; cp++) { if (isspace(UChar(*cp))) { *cp = '\0'; } else if (cp == buf || cp[-1] == 0) { argvec[argnum++] = cp; if (argnum >= (int) SIZEOF(argvec) - 1) break; } } argvec[argnum] = 0; if (argnum != 0 && tput_cmd(fd, &tty_settings, opt_x, argnum, argvec) != 0) { if (result == 0) result = ErrSystem(0); /* will return value >4 */ ++result; } } ExitProgram(result); }
0
234,169
display_block (unsigned char *data, dwarf_vma length, const unsigned char * const end, char delimiter) { dwarf_vma maxlen; printf (_("%c%s byte block: "), delimiter, dwarf_vmatoa ("u", length)); if (data > end) return (unsigned char *) end; maxlen = (dwarf_vma) (end - data); length = length > maxlen ? maxlen : length; while (length --) printf ("%lx ", (unsigned long) byte_get (data++, 1)); return data; }
0
256,158
ALWAYS_INLINE void LoadSingleScalar(const bfloat16** data, Packet* l) { auto tmp = ConvertBfloat16ToFloat(*data); *l = Eigen::internal::pset1<Packet>(tmp); ++*data; }
0
432,289
static bool memory_region_big_endian(MemoryRegion *mr) { #ifdef TARGET_WORDS_BIGENDIAN return mr->ops->endianness != DEVICE_LITTLE_ENDIAN; #else return mr->ops->endianness == DEVICE_BIG_ENDIAN; #endif }
0
463,162
EXPORTED void appendattvalue(struct attvaluelist **l, const char *attrib, const struct buf *value) { struct attvaluelist **tail = l; while (*tail) tail = &(*tail)->next; *tail = xzmalloc(sizeof(struct attvaluelist)); (*tail)->attrib = xstrdup(attrib); buf_copy(&(*tail)->value, value); }
0
359,611
DEFUN (no_neighbor_interface, no_neighbor_interface_cmd, NO_NEIGHBOR_CMD "interface WORD", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR "Interface\n" "Interface name\n") { return peer_interface_vty (vty, argv[0], NULL); }
0
384,118
raptor_xml_writer_nsd_compare(const void *a, const void *b) { struct nsd* nsd_a = (struct nsd*)a; struct nsd* nsd_b = (struct nsd*)b; return strcmp((const char*)nsd_a->declaration, (const char*)nsd_b->declaration); }
0
450,370
int vnc_tight_send_framebuffer_update(VncState *vs, int x, int y, int w, int h) { vs->tight->type = VNC_ENCODING_TIGHT; return tight_send_framebuffer_update(vs, x, y, w, h); }
0
226,063
void stsd_box_del(GF_Box *s) { GF_SampleDescriptionBox *ptr = (GF_SampleDescriptionBox *)s; if (ptr == NULL) return; gf_free(ptr); }
0
402,621
daemon_logger(cms_context *cms, int priority, char *fmt, ...) { context *ctx = (context *)cms->log_priv; va_list ap; int rc = 0; if (ctx->errstr) xfree(ctx->errstr); va_start(ap, fmt); if (priority & LOG_ERR) { va_list aq; va_copy(aq, ap); rc = vasprintf(&ctx->errstr, fmt, aq); va_end(aq); } vsyslog(ctx->priority | priority, fmt, ap); va_end(ap); return rc; }
0
384,208
static struct nft_trans *nft_trans_alloc_gfp(const struct nft_ctx *ctx, int msg_type, u32 size, gfp_t gfp) { struct nft_trans *trans; trans = kzalloc(sizeof(struct nft_trans) + size, gfp); if (trans == NULL) return NULL; INIT_LIST_HEAD(&trans->list); trans->msg_type = msg_type; trans->ctx = *ctx; return trans; }
0
215,216
__zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, struct _disk_trailer *_zzip_restrict trailer, zzip_plugin_io_t io) { #ifdef DEBUG #define return(val) { e=val; HINT2("%s", zzip_strerror(e)); goto cleanup; } #else #define return(val) { e=val; goto cleanup; } #endif register int e; #ifndef _LOWSTK auto char buffer[2 * ZZIP_BUFSIZ]; char *buf = buffer; #else char *buf = malloc(2 * ZZIP_BUFSIZ); #endif zzip_off_t offset = 0; zzip_ssize_t maplen = 0; /* mmap(),read(),getpagesize() use size_t !! */ char *fd_map = 0; if (! trailer) { return(EINVAL); } if (filesize < __sizeof(struct zzip_disk_trailer)) { return(ZZIP_DIR_TOO_SHORT); } if (! buf) { return(ZZIP_OUTOFMEM); } offset = filesize; /* a.k.a. old offset */ while (1) /* outer loop */ { register unsigned char *mapped; if (offset <= 0) { return(ZZIP_DIR_EDH_MISSING); } /* trailer cannot be farther away than 64K from fileend */ if (filesize - offset > 64 * 1024) { return(ZZIP_DIR_EDH_MISSING); } /* the new offset shall overlap with the area after the old offset! */ if (USE_MMAP && io->fd.sys) { zzip_off_t mapoff = offset; { zzip_ssize_t pagesize = _zzip_getpagesize(io->fd.sys); if (pagesize < ZZIP_BUFSIZ) goto non_mmap; /* an error? */ if (mapoff == filesize && filesize > pagesize) mapoff -= pagesize; if (mapoff < pagesize) { maplen = (zzip_ssize_t) mapoff + pagesize; mapoff = 0; } else { mapoff -= pagesize; maplen = 2 * pagesize; if ((zzip_ssize_t) mapoff & (pagesize - 1)) { /*only 1. run */ pagesize -= (zzip_ssize_t) mapoff & (pagesize - 1); mapoff += pagesize; maplen -= pagesize; } } if (mapoff + maplen > filesize) maplen = filesize - mapoff; } fd_map = _zzip_mmap(io->fd.sys, fd, mapoff, (zzip_size_t) maplen); if (fd_map == MAP_FAILED) goto non_mmap; mapped = (unsigned char *) fd_map; offset = mapoff; /* success */ HINT3("mapped *%p len=%li", fd_map, (long) maplen); } else { non_mmap: fd_map = 0; /* have no mmap */ { zzip_off_t pagesize = ZZIP_BUFSIZ; if (offset == filesize && filesize > pagesize) offset -= pagesize; if (offset < pagesize) { maplen = (zzip_ssize_t) offset + pagesize; offset = 0; } else { offset -= pagesize; maplen = 2 * pagesize; if ((zzip_ssize_t) offset & (pagesize - 1)) { /*on 1st run */ pagesize -= (zzip_ssize_t) offset & (pagesize - 1); offset += pagesize; maplen -= pagesize; } } if (offset + maplen > filesize) maplen = filesize - offset; } if (io->fd.seeks(fd, offset, SEEK_SET) < 0) { return(ZZIP_DIR_SEEK); } if (io->fd.read(fd, buf, (zzip_size_t) maplen) < maplen) { return(ZZIP_DIR_READ); } mapped = (unsigned char *) buf; /* success */ HINT5("offs=$%lx len=%li filesize=%li pagesize=%i", (long) offset, (long) maplen, (long) filesize, ZZIP_BUFSIZ); } { /* now, check for the trailer-magic, hopefully near the end of file */ register unsigned char *end = mapped + maplen; register unsigned char *tail; for (tail = end - 1; (tail >= mapped); tail--) { if ((*tail == 'P') && /* quick pre-check for trailer magic */ end - tail >= __sizeof(struct zzip_disk_trailer) - 2 && zzip_disk_trailer_check_magic(tail)) { # ifndef ZZIP_DISK64_TRAILER /* if the file-comment is not present, it happens that the z_comment field often isn't either */ if (end - tail >= __sizeof(*trailer)) { memcpy(trailer, tail, sizeof(*trailer)); } else { memcpy(trailer, tail, sizeof(*trailer) - 2); trailer->z_comment[0] = 0; trailer->z_comment[1] = 0; } # else struct zzip_disk_trailer *orig = (struct zzip_disk_trailer *) tail; trailer->zz_tail = tail; trailer->zz_entries = zzip_disk_trailer_localentries(orig); trailer->zz_finalentries = zzip_disk_trailer_finalentries(orig); trailer->zz_rootseek = zzip_disk_trailer_rootseek(orig); trailer->zz_rootsize = zzip_disk_trailer_rootsize(orig); # endif __fixup_rootseek(offset + tail - mapped, trailer); { return(0); } } else if ((*tail == 'P') && end - tail >= __sizeof(struct zzip_disk64_trailer) - 2 && zzip_disk64_trailer_check_magic(tail)) { # ifndef ZZIP_DISK64_TRAILER return (ZZIP_DIR_LARGEFILE); # else struct zzip_disk64_trailer *orig = (struct zzip_disk64_trailer *) tail; trailer->zz_tail = tail; trailer->zz_entries = zzip_disk64_trailer_localentries(orig); trailer->zz_finalentries = zzip_disk64_trailer_finalentries(orig); trailer->zz_rootseek = zzip_disk64_trailer_rootseek(orig); trailer->zz_rootsize = zzip_disk64_trailer_rootsize(orig); { return(0); } # endif } } } if (USE_MMAP && fd_map) { HINT3("unmap *%p len=%li", fd_map, (long) maplen); _zzip_munmap(io->fd.sys, fd_map, (zzip_size_t) maplen); fd_map = 0; } } /*outer loop */ cleanup: if (USE_MMAP && fd_map) { HINT3("unmap *%p len=%li", fd_map, (long) maplen); _zzip_munmap(io->fd.sys, fd_map, (zzip_size_t) maplen); } # ifdef _LOWSTK free(buf); # endif # undef return return e; }
1
338,152
bool WasmBinaryBuilder::maybeVisitArrayCopy(Expression*& out, uint32_t code) { if (code != BinaryConsts::ArrayCopy) { return false; } auto destHeapType = getIndexedHeapType(); auto srcHeapType = getIndexedHeapType(); auto* length = popNonVoidExpression(); auto* srcIndex = popNonVoidExpression(); auto* srcRef = popNonVoidExpression(); auto* destIndex = popNonVoidExpression(); auto* destRef = popNonVoidExpression(); validateHeapTypeUsingChild(destRef, destHeapType); validateHeapTypeUsingChild(srcRef, srcHeapType); out = Builder(wasm).makeArrayCopy(destRef, destIndex, srcRef, srcIndex, length); return true; }
0
226,389
GF_Err dvvC_box_size(GF_Box *s) { return dvcC_box_size(s);
0
312,382
ex_cc(exarg_T *eap) { qf_info_T *qi; int errornr; if ((qi = qf_cmd_get_stack(eap, TRUE)) == NULL) return; if (eap->addr_count > 0) errornr = (int)eap->line2; else { switch (eap->cmdidx) { case CMD_cc: case CMD_ll: errornr = 0; break; case CMD_crewind: case CMD_lrewind: case CMD_cfirst: case CMD_lfirst: errornr = 1; break; default: errornr = 32767; } } // For cdo and ldo commands, jump to the nth valid error. // For cfdo and lfdo commands, jump to the nth valid file entry. if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo || eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo) errornr = qf_get_nth_valid_entry(qf_get_curlist(qi), eap->addr_count > 0 ? (int)eap->line1 : 1, eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo); qf_jump(qi, 0, errornr, eap->forceit); }
0
245,203
bool format_time(time_t time, char *dest, size_t max_size) { tm tm; localtime_r(&time, &tm); return strftime(dest, max_size, "%Y-%m-%d %H:%M:%S", &tm) != 0; }
0
462,437
destroyIoQ(void) { io_req_t *n; if (io_q.stats != NULL) { statsobj.Destruct(&io_q.stats); } pthread_mutex_lock(&io_q.mut); while (!STAILQ_EMPTY(&io_q.q)) { n = STAILQ_FIRST(&io_q.q); STAILQ_REMOVE_HEAD(&io_q.q, link); errmsg.LogError(0, RS_RET_INTERNAL_ERROR, "imptcp: discarded enqueued io-work to allow shutdown - ignored"); free(n); } io_q.sz = 0; pthread_mutex_unlock(&io_q.mut); pthread_cond_destroy(&io_q.wakeup_worker); pthread_mutex_destroy(&io_q.mut); }
0
361,757
static int em28xx_usb_suspend(struct usb_interface *intf, pm_message_t message) { struct em28xx *dev; dev = usb_get_intfdata(intf); if (!dev) return 0; em28xx_suspend_extension(dev); return 0; }
0
400,746
const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t flags) { *new = *old; if (unlikely(iov_iter_is_pipe(new))) { WARN_ON(1); return NULL; } if (unlikely(iov_iter_is_discard(new) || iov_iter_is_xarray(new))) return NULL; if (iov_iter_is_bvec(new)) return new->bvec = kmemdup(new->bvec, new->nr_segs * sizeof(struct bio_vec), flags); else /* iovec and kvec have identical layout */ return new->iov = kmemdup(new->iov, new->nr_segs * sizeof(struct iovec), flags); }
0
503,988
t_auth_request_var_expand(const char *str, const struct auth_request *auth_request, auth_request_escape_func_t *escape_func) { string_t *dest = t_str_new(128); auth_request_var_expand(dest, str, auth_request, escape_func); return str_c(dest); }
0
476,144
int usb_composite_probe(struct usb_composite_driver *driver) { struct usb_gadget_driver *gadget_driver; if (!driver || !driver->dev || !driver->bind) return -EINVAL; if (!driver->name) driver->name = "composite"; driver->gadget_driver = composite_driver_template; gadget_driver = &driver->gadget_driver; gadget_driver->function = (char *) driver->name; gadget_driver->driver.name = driver->name; gadget_driver->max_speed = driver->max_speed; return usb_gadget_probe_driver(gadget_driver); }
0
413,640
static bool esilbreak_mem_read(RAnalEsil *esil, ut64 addr, ut8 *buf, int len) { ut8 str[128]; if (addr != UT64_MAX) { esilbreak_last_read = addr; } handle_var_stack_access (esil, addr, R_ANAL_VAR_ACCESS_TYPE_READ, len); if (myvalid (mycore->io, addr) && r_io_read_at (mycore->io, addr, (ut8*)buf, len)) { ut64 refptr; bool trace = true; switch (len) { case 2: esilbreak_last_data = refptr = (ut64)r_read_ble16 (buf, esil->anal->big_endian); break; case 4: esilbreak_last_data = refptr = (ut64)r_read_ble32 (buf, esil->anal->big_endian); break; case 8: esilbreak_last_data = refptr = r_read_ble64 (buf, esil->anal->big_endian); break; default: trace = false; r_io_read_at (mycore->io, addr, (ut8*)buf, len); break; } // TODO incorrect bool validRef = false; if (trace && myvalid (mycore->io, refptr)) { if (ntarget == UT64_MAX || ntarget == refptr) { str[0] = 0; if (r_io_read_at (mycore->io, refptr, str, sizeof (str)) < 1) { //eprintf ("Invalid read\n"); str[0] = 0; validRef = false; } else { r_anal_xrefs_set (mycore->anal, esil->address, refptr, R_ANAL_REF_TYPE_DATA); str[sizeof (str) - 1] = 0; add_string_ref (mycore, esil->address, refptr); esilbreak_last_data = UT64_MAX; validRef = true; } } } /** resolve ptr */ if (ntarget == UT64_MAX || ntarget == addr || (ntarget == UT64_MAX && !validRef)) { r_anal_xrefs_set (mycore->anal, esil->address, addr, R_ANAL_REF_TYPE_DATA); } } return false; // fallback }
0
240,303
dnd_yank_drag_data(char_u *str, long len) { yankreg_T *curr; curr = y_current; y_current = &y_regs[TILDE_REGISTER]; free_yank_all(); str_to_reg(y_current, MCHAR, str, len, 0L, FALSE); y_current = curr; }
0
220,434
ary_fill_with_nil(mrb_value *ptr, mrb_int size) { mrb_value nil = mrb_nil_value(); while (size--) { *ptr++ = nil; } }
0
291,818
static int rtrs_rdma_conn_established(struct rtrs_clt_con *con, struct rdma_cm_event *ev) { struct rtrs_clt_path *clt_path = to_clt_path(con->c.path); struct rtrs_clt_sess *clt = clt_path->clt; const struct rtrs_msg_conn_rsp *msg; u16 version, queue_depth; int errno; u8 len; msg = ev->param.conn.private_data; len = ev->param.conn.private_data_len; if (len < sizeof(*msg)) { rtrs_err(clt, "Invalid RTRS connection response\n"); return -ECONNRESET; } if (le16_to_cpu(msg->magic) != RTRS_MAGIC) { rtrs_err(clt, "Invalid RTRS magic\n"); return -ECONNRESET; } version = le16_to_cpu(msg->version); if (version >> 8 != RTRS_PROTO_VER_MAJOR) { rtrs_err(clt, "Unsupported major RTRS version: %d, expected %d\n", version >> 8, RTRS_PROTO_VER_MAJOR); return -ECONNRESET; } errno = le16_to_cpu(msg->errno); if (errno) { rtrs_err(clt, "Invalid RTRS message: errno %d\n", errno); return -ECONNRESET; } if (con->c.cid == 0) { queue_depth = le16_to_cpu(msg->queue_depth); if (clt_path->queue_depth > 0 && queue_depth != clt_path->queue_depth) { rtrs_err(clt, "Error: queue depth changed\n"); /* * Stop any more reconnection attempts */ clt_path->reconnect_attempts = -1; rtrs_err(clt, "Disabling auto-reconnect. Trigger a manual reconnect after issue is resolved\n"); return -ECONNRESET; } if (!clt_path->rbufs) { clt_path->rbufs = kcalloc(queue_depth, sizeof(*clt_path->rbufs), GFP_KERNEL); if (!clt_path->rbufs) return -ENOMEM; } clt_path->queue_depth = queue_depth; clt_path->s.signal_interval = min_not_zero(queue_depth, (unsigned short) SERVICE_CON_QUEUE_DEPTH); clt_path->max_hdr_size = le32_to_cpu(msg->max_hdr_size); clt_path->max_io_size = le32_to_cpu(msg->max_io_size); clt_path->flags = le32_to_cpu(msg->flags); clt_path->chunk_size = clt_path->max_io_size + clt_path->max_hdr_size; /* * Global IO size is always a minimum. * If while a reconnection server sends us a value a bit * higher - client does not care and uses cached minimum. * * Since we can have several sessions (paths) restablishing * connections in parallel, use lock. */ mutex_lock(&clt->paths_mutex); clt->queue_depth = clt_path->queue_depth; clt->max_io_size = min_not_zero(clt_path->max_io_size, clt->max_io_size); mutex_unlock(&clt->paths_mutex); /* * Cache the hca_port and hca_name for sysfs */ clt_path->hca_port = con->c.cm_id->port_num; scnprintf(clt_path->hca_name, sizeof(clt_path->hca_name), clt_path->s.dev->ib_dev->name); clt_path->s.src_addr = con->c.cm_id->route.addr.src_addr; /* set for_new_clt, to allow future reconnect on any path */ clt_path->for_new_clt = 1; } return 0; }
0
273,896
static int open_data_connection(ctrl_t *ctrl) { socklen_t len = sizeof(struct sockaddr); struct sockaddr_in sin; /* Previous PORT command from client */ if (ctrl->data_address[0]) { int rc; ctrl->data_sd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); if (-1 == ctrl->data_sd) { ERR(errno, "Failed creating data socket"); return -1; } memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = htons(ctrl->data_port); inet_aton(ctrl->data_address, &(sin.sin_addr)); rc = connect(ctrl->data_sd, (struct sockaddr *)&sin, len); if (rc == -1 && EINPROGRESS != errno) { ERR(errno, "Failed connecting data socket to client"); close(ctrl->data_sd); ctrl->data_sd = -1; return -1; } DBG("Connected successfully to client's previously requested address:PORT %s:%d", ctrl->data_address, ctrl->data_port); return 0; } /* Previous PASV command, accept connect from client */ if (ctrl->data_listen_sd > 0) { const int const_int_1 = 1; int retries = 3; char client_ip[100]; retry: ctrl->data_sd = accept(ctrl->data_listen_sd, (struct sockaddr *)&sin, &len); if (-1 == ctrl->data_sd) { if (EAGAIN == errno && --retries) { sleep(1); goto retry; } ERR(errno, "Failed accepting connection from client"); return -1; } setsockopt(ctrl->data_sd, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1)); set_nonblock(ctrl->data_sd); inet_ntop(AF_INET, &(sin.sin_addr), client_ip, INET_ADDRSTRLEN); DBG("Client PASV data connection from %s:%d", client_ip, ntohs(sin.sin_port)); close(ctrl->data_listen_sd); ctrl->data_listen_sd = -1; } return 0; }
0
328,878
R_API void r_bin_java_get_fm_type_definition_json(RBinJavaObj *bin, RBinJavaField *fm_type, PJ *pj, int is_method) { r_return_if_fail (bin && fm_type && pj); ut64 addr = UT64_MAX; char *prototype = NULL, *fq_name = NULL; bool is_native = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_NATIVE) != 0); bool is_static = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_STATIC) != 0); bool is_synthetic = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_SYNTHETIC) != 0); bool is_private = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PRIVATE) != 0); bool is_public = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PUBLIC) != 0); bool is_protected = ((fm_type->flags & R_BIN_JAVA_METHOD_ACC_PROTECTED) != 0); bool is_super = ((fm_type->flags & R_BIN_JAVA_CLASS_ACC_SUPER) != 0); pj_o (pj); pj_ki (pj, "access_flags", fm_type->flags); pj_ki (pj, "is_method", is_method); pj_ki (pj, "is_native", is_native); pj_ki (pj, "is_synthetic", is_synthetic); pj_ki (pj, "is_private", is_private); pj_ki (pj, "is_public", is_public); pj_ki (pj, "is_static", is_static); pj_ki (pj, "is_protected", is_protected); pj_ki (pj, "is_super", is_super); addr = r_bin_java_get_method_code_offset (fm_type); if (addr == 0) { addr = fm_type->file_offset; } addr += bin->loadaddr; pj_ki (pj, "addr", addr); pj_ki (pj, "offset", fm_type->file_offset + bin->loadaddr); pj_ks (pj, "class_name", fm_type->class_name); pj_ks (pj, "signature", fm_type->descriptor); pj_ks (pj, "name", fm_type->name); if (is_method) { fq_name = r_bin_java_create_method_fq_str (fm_type->class_name, fm_type->name, fm_type->descriptor); } else { fq_name = r_bin_java_create_field_fq_str (fm_type->class_name, fm_type->name, fm_type->descriptor); } pj_ks (pj, "fq_name", fq_name); free (fq_name); prototype = r_bin_java_unmangle (fm_type->flags_str, fm_type->name, fm_type->descriptor); pj_ks (pj, "prototype", prototype); free (prototype); pj_end (pj); }
0
486,825
static inline void rx_desc_set_ownership(uint32_t *desc) { desc[0] |= DESC_0_RX_OWNERSHIP; }
0
274,722
callbacks_begin_print (GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data) { gtk_print_operation_set_n_pages (operation, 1); }
0
432,714
static void lite_font_map( wmfAPI* API, wmfFont* font) { wmfFontData *font_data; wmf_magick_font_t *magick_font; wmf_magick_t *ddata = WMF_MAGICK_GetData(API); ExceptionInfo *exception; const TypeInfo *type_info, *type_info_base; const char *wmf_font_name; if (font == 0) return; font_data = (wmfFontData*)API->font_data; font->user_data = font_data->user_data; magick_font = (wmf_magick_font_t*)font->user_data; wmf_font_name = WMF_FONT_NAME(font); if (magick_font->ps_name != (char *) NULL) magick_font->ps_name=DestroyString(magick_font->ps_name); exception=ddata->exception; type_info_base=GetTypeInfo("*",exception); if (type_info_base == 0) return; /* Certain short-hand font names are not the proper Windows names and should be promoted to the proper names */ if (LocaleCompare(wmf_font_name,"Times") == 0) wmf_font_name = "Times New Roman"; else if (LocaleCompare(wmf_font_name,"Courier") == 0) wmf_font_name = "Courier New"; /* Look for a family-based best-match */ if (!magick_font->ps_name) { int target_weight; if (WMF_FONT_WEIGHT(font) == 0) target_weight = 400; else target_weight = WMF_FONT_WEIGHT(font); type_info=GetTypeInfoByFamily(wmf_font_name,AnyStyle,AnyStretch, target_weight,exception); if (type_info == (const TypeInfo *) NULL) type_info=GetTypeInfoByFamily(wmf_font_name,AnyStyle,AnyStretch,0, exception); if (type_info != (const TypeInfo *) NULL) CloneString(&magick_font->ps_name,type_info->name); } /* Now let's try simple substitution mappings from WMFFontMap */ if (!magick_font->ps_name) { char target[MagickPathExtent]; int target_weight = 400, want_italic = MagickFalse, want_bold = MagickFalse, i; if ( WMF_FONT_WEIGHT(font) != 0 ) target_weight = WMF_FONT_WEIGHT(font); if ( (target_weight > 550) || ((strstr(wmf_font_name,"Bold") || strstr(wmf_font_name,"Heavy") || strstr(wmf_font_name,"Black"))) ) want_bold = MagickTrue; if ( (WMF_FONT_ITALIC(font)) || ((strstr(wmf_font_name,"Italic") || strstr(wmf_font_name,"Oblique"))) ) want_italic = MagickTrue; (void) CopyMagickString(target,"Times",MagickPathExtent); for( i=0; SubFontMap[i].name != NULL; i++ ) { if (LocaleCompare(wmf_font_name, SubFontMap[i].name) == 0) { (void) CopyMagickString(target,SubFontMap[i].mapping, MagickPathExtent); break; } } for( i=0; WMFFontMap[i].name != NULL; i++ ) { if (LocaleNCompare(WMFFontMap[i].name,target,strlen(WMFFontMap[i].name)) == 0) { if (want_bold && want_italic) CloneString(&magick_font->ps_name,WMFFontMap[i].bolditalic); else if (want_italic) CloneString(&magick_font->ps_name,WMFFontMap[i].italic); else if (want_bold) CloneString(&magick_font->ps_name,WMFFontMap[i].bold); else CloneString(&magick_font->ps_name,WMFFontMap[i].normal); } } } #if 0 printf("\nlite_font_map\n"); printf("WMF_FONT_NAME = \"%s\"\n", WMF_FONT_NAME(font)); printf("WMF_FONT_WEIGHT = %i\n", WMF_FONT_WEIGHT(font)); printf("WMF_FONT_PSNAME = \"%s\"\n", WMF_FONT_PSNAME(font)); fflush(stdout); #endif }
0
238,557
static int __check_mem_access(struct bpf_verifier_env *env, int regno, int off, int size, u32 mem_size, bool zero_size_allowed) { bool size_ok = size > 0 || (size == 0 && zero_size_allowed); struct bpf_reg_state *reg; if (off >= 0 && size_ok && (u64)off + size <= mem_size) return 0; reg = &cur_regs(env)[regno]; switch (reg->type) { case PTR_TO_MAP_KEY: verbose(env, "invalid access to map key, key_size=%d off=%d size=%d\n", mem_size, off, size); break; case PTR_TO_MAP_VALUE: verbose(env, "invalid access to map value, value_size=%d off=%d size=%d\n", mem_size, off, size); break; case PTR_TO_PACKET: case PTR_TO_PACKET_META: case PTR_TO_PACKET_END: verbose(env, "invalid access to packet, off=%d size=%d, R%d(id=%d,off=%d,r=%d)\n", off, size, regno, reg->id, off, mem_size); break; case PTR_TO_MEM: default: verbose(env, "invalid access to memory, mem_size=%u off=%d size=%d\n", mem_size, off, size); } return -EACCES; }
0
437,702
inline int cx23888_ir_write4(struct cx23885_dev *dev, u32 addr, u32 value) { cx_write(addr, value); return 0; }
0
439,168
static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception) { const unsigned char *pixels; Image *canvas_image, *image; MagickBooleanType status; MagickOffsetType scene; QuantumInfo *quantum_info; QuantumType quantum_type; size_t length; ssize_t count, y; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info); if ((image->columns == 0) || (image->rows == 0)) ThrowReaderException(OptionError,"MustSpecifyImageSize"); status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse) ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); /* Create virtual canvas to support cropping (i.e. image.gray[100x100+10+20]). */ canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse, exception); if (canvas_image == (Image *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); (void) SetImageVirtualPixelMethod(canvas_image,BlackVirtualPixelMethod); quantum_type=GrayQuantum; quantum_info=AcquireQuantumInfo(image_info,canvas_image); if (quantum_info == (QuantumInfo *) NULL) { canvas_image=DestroyImage(canvas_image); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } pixels=(const unsigned char *) NULL; if (image_info->number_scenes != 0) while (image->scene < image_info->scene) { /* Skip to next image. */ image->scene++; length=GetQuantumExtent(canvas_image,quantum_info,quantum_type); for (y=0; y < (ssize_t) image->rows; y++) { pixels=(const unsigned char *) ReadBlobStream(image,length, GetQuantumPixels(quantum_info),&count); if (count != (ssize_t) length) break; } } scene=0; count=0; length=0; status=MagickTrue; do { /* Read pixels to virtual canvas image then push to image. */ if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) break; if (scene == 0) { length=GetQuantumExtent(canvas_image,quantum_info,quantum_type); pixels=(const unsigned char *) ReadBlobStream(image,length, GetQuantumPixels(quantum_info),&count); if (count != (ssize_t) length) break; } for (y=0; y < (ssize_t) image->extract_info.height; y++) { register const PixelPacket *magick_restrict p; register PixelPacket *magick_restrict q; register ssize_t x; if (count != (ssize_t) length) { status=MagickFalse; ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,exception); if (q == (PixelPacket *) NULL) break; length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,quantum_info, quantum_type,pixels,exception); if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse) break; if (((y-image->extract_info.y) >= 0) && ((y-image->extract_info.y) < (ssize_t) image->rows)) { p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0, image->columns,1,exception); q=QueueAuthenticPixels(image,0,y-image->extract_info.y,image->columns, 1,exception); if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL)) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,GetPixelRed(p)); SetPixelGreen(q,GetPixelGreen(p)); SetPixelBlue(q,GetPixelBlue(p)); p++; q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } pixels=(const unsigned char *) ReadBlobStream(image,length, GetQuantumPixels(quantum_info),&count); if (count != (ssize_t) length) break; } SetQuantumImageType(image,quantum_type); /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; if (count == (ssize_t) length) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { status=MagickFalse; break; } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } scene++; } while (count == (ssize_t) length); quantum_info=DestroyQuantumInfo(quantum_info); InheritException(exception,&canvas_image->exception); InheritException(exception,&image->exception); canvas_image=DestroyImage(canvas_image); (void) CloseBlob(image); if (status == MagickFalse) return(DestroyImageList(image)); return(GetFirstImageInList(image)); }
0
487,638
int blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v) { int ret = NOTIFY_DONE; /* * We check the head outside the lock, but if this access is * racy then it does not matter what the result of the test * is, we re-check the list after having taken the lock anyway: */ if (rcu_dereference(nh->head)) { down_read(&nh->rwsem); ret = notifier_call_chain(&nh->head, val, v); up_read(&nh->rwsem); } return ret; }
0
508,846
st_select_lex_node *st_select_lex_node:: insert_chain_before( st_select_lex_node **ptr_pos_to_insert, st_select_lex_node *end_chain_node) { end_chain_node->link_next= *ptr_pos_to_insert; (*ptr_pos_to_insert)->link_prev= &end_chain_node->link_next; this->link_prev= ptr_pos_to_insert; return this; }
0
244,339
void trgt_box_del(GF_Box *s) { GF_TrackGroupTypeBox *ptr = (GF_TrackGroupTypeBox *)s; if (ptr == NULL) return; gf_free(ptr); }
0
233,831
void fmtutil_generate_bmpfileheader(deark *c, dbuf *outf, const struct de_bmpinfo *bi, i64 file_size_override) { i64 file_size_to_write; dbuf_write(outf, (const u8*)"BM", 2); if(file_size_override) file_size_to_write = file_size_override; else file_size_to_write = 14 + bi->total_size; dbuf_writeu32le(outf, file_size_to_write); dbuf_write_zeroes(outf, 4); dbuf_writeu32le(outf, 14 + bi->size_of_headers_and_pal); }
0
348,438
static int ax_open_dev(struct net_device *dev) { struct mkiss *ax = netdev_priv(dev); if (ax->tty == NULL) return -ENODEV; return 0; }
0
337,807
struct sctp_chunk *sctp_make_shutdown(const struct sctp_association *asoc, const struct sctp_chunk *chunk) { struct sctp_shutdownhdr shut; struct sctp_chunk *retval; __u32 ctsn; ctsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); shut.cum_tsn_ack = htonl(ctsn); retval = sctp_make_control(asoc, SCTP_CID_SHUTDOWN, 0, sizeof(shut), GFP_ATOMIC); if (!retval) goto nodata; retval->subh.shutdown_hdr = sctp_addto_chunk(retval, sizeof(shut), &shut); if (chunk) retval->transport = chunk->transport; nodata: return retval; }
0
512,727
double val_real() { return cached_time.to_double(); }
0
264,707
void AddShapeNodeToConstantGraph( Node* n, const std::unordered_map<const Node*, std::vector<Tensor>>& shape_replacement_map, std::unordered_map<Node*, std::vector<Node*>>* node_map, const ConstantFoldNameGenerator& generate_new_name, Graph* constant_graph) { std::vector<Node*>& added = (*node_map)[n]; const string& node_name = n->name(); for (const Tensor& t : shape_replacement_map.at(n)) { auto builder = NodeDefBuilder(generate_new_name(constant_graph, node_name), "Const") .Attr("dtype", t.dtype()) .Attr("value", t); NodeDef def; CHECK(builder.Finalize(&def).ok()); Node* constant_node; CHECK(NodeBuilder(builder).Finalize(constant_graph, &constant_node).ok()); added.push_back(constant_node); } // Don't copy incoming edges to shape nodes that are being replaced. }
0
317,026
static int selinux_shm_shmctl(struct kern_ipc_perm *shp, int cmd) { int perms; int err; switch (cmd) { case IPC_INFO: case SHM_INFO: /* No specific object, just general system-wide information. */ return avc_has_perm(&selinux_state, current_sid(), SECINITSID_KERNEL, SECCLASS_SYSTEM, SYSTEM__IPC_INFO, NULL); case IPC_STAT: case SHM_STAT: case SHM_STAT_ANY: perms = SHM__GETATTR | SHM__ASSOCIATE; break; case IPC_SET: perms = SHM__SETATTR; break; case SHM_LOCK: case SHM_UNLOCK: perms = SHM__LOCK; break; case IPC_RMID: perms = SHM__DESTROY; break; default: return 0; } err = ipc_has_perm(shp, perms); return err; }
0
199,851
ex_retab(exarg_T *eap) { linenr_T lnum; int got_tab = FALSE; long num_spaces = 0; long num_tabs; long len; long col; long vcol; long start_col = 0; // For start of white-space string long start_vcol = 0; // For start of white-space string long old_len; char_u *ptr; char_u *new_line = (char_u *)1; // init to non-NULL int did_undo; // called u_save for current line #ifdef FEAT_VARTABS int *new_vts_array = NULL; char_u *new_ts_str; // string value of tab argument #else int temp; int new_ts; #endif int save_list; linenr_T first_line = 0; // first changed line linenr_T last_line = 0; // last changed line save_list = curwin->w_p_list; curwin->w_p_list = 0; // don't want list mode here #ifdef FEAT_VARTABS new_ts_str = eap->arg; if (tabstop_set(eap->arg, &new_vts_array) == FAIL) return; while (vim_isdigit(*(eap->arg)) || *(eap->arg) == ',') ++(eap->arg); // This ensures that either new_vts_array and new_ts_str are freshly // allocated, or new_vts_array points to an existing array and new_ts_str // is null. if (new_vts_array == NULL) { new_vts_array = curbuf->b_p_vts_array; new_ts_str = NULL; } else new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str); #else ptr = eap->arg; new_ts = getdigits(&ptr); if (new_ts < 0 && *eap->arg == '-') { emsg(_(e_argument_must_be_positive)); return; } if (new_ts < 0 || new_ts > TABSTOP_MAX) { semsg(_(e_invalid_argument_str), eap->arg); return; } if (new_ts == 0) new_ts = curbuf->b_p_ts; #endif for (lnum = eap->line1; !got_int && lnum <= eap->line2; ++lnum) { ptr = ml_get(lnum); col = 0; vcol = 0; did_undo = FALSE; for (;;) { if (VIM_ISWHITE(ptr[col])) { if (!got_tab && num_spaces == 0) { // First consecutive white-space start_vcol = vcol; start_col = col; } if (ptr[col] == ' ') num_spaces++; else got_tab = TRUE; } else { if (got_tab || (eap->forceit && num_spaces > 1)) { // Retabulate this string of white-space // len is virtual length of white string len = num_spaces = vcol - start_vcol; num_tabs = 0; if (!curbuf->b_p_et) { #ifdef FEAT_VARTABS int t, s; tabstop_fromto(start_vcol, vcol, curbuf->b_p_ts, new_vts_array, &t, &s); num_tabs = t; num_spaces = s; #else temp = new_ts - (start_vcol % new_ts); if (num_spaces >= temp) { num_spaces -= temp; num_tabs++; } num_tabs += num_spaces / new_ts; num_spaces -= (num_spaces / new_ts) * new_ts; #endif } if (curbuf->b_p_et || got_tab || (num_spaces + num_tabs < len)) { if (did_undo == FALSE) { did_undo = TRUE; if (u_save((linenr_T)(lnum - 1), (linenr_T)(lnum + 1)) == FAIL) { new_line = NULL; // flag out-of-memory break; } } // len is actual number of white characters used len = num_spaces + num_tabs; old_len = (long)STRLEN(ptr); new_line = alloc(old_len - col + start_col + len + 1); if (new_line == NULL) break; if (start_col > 0) mch_memmove(new_line, ptr, (size_t)start_col); mch_memmove(new_line + start_col + len, ptr + col, (size_t)(old_len - col + 1)); ptr = new_line + start_col; for (col = 0; col < len; col++) ptr[col] = (col < num_tabs) ? '\t' : ' '; if (ml_replace(lnum, new_line, FALSE) == OK) // "new_line" may have been copied new_line = curbuf->b_ml.ml_line_ptr; if (first_line == 0) first_line = lnum; last_line = lnum; ptr = new_line; col = start_col + len; } } got_tab = FALSE; num_spaces = 0; } if (ptr[col] == NUL) break; vcol += chartabsize(ptr + col, (colnr_T)vcol); if (has_mbyte) col += (*mb_ptr2len)(ptr + col); else ++col; } if (new_line == NULL) // out of memory break; line_breakcheck(); } if (got_int) emsg(_(e_interrupted)); #ifdef FEAT_VARTABS // If a single value was given then it can be considered equal to // either the value of 'tabstop' or the value of 'vartabstop'. if (tabstop_count(curbuf->b_p_vts_array) == 0 && tabstop_count(new_vts_array) == 1 && curbuf->b_p_ts == tabstop_first(new_vts_array)) ; // not changed else if (tabstop_count(curbuf->b_p_vts_array) > 0 && tabstop_eq(curbuf->b_p_vts_array, new_vts_array)) ; // not changed else redraw_curbuf_later(NOT_VALID); #else if (curbuf->b_p_ts != new_ts) redraw_curbuf_later(NOT_VALID); #endif if (first_line != 0) changed_lines(first_line, 0, last_line + 1, 0L); curwin->w_p_list = save_list; // restore 'list' #ifdef FEAT_VARTABS if (new_ts_str != NULL) // set the new tabstop { // If 'vartabstop' is in use or if the value given to retab has more // than one tabstop then update 'vartabstop'. int *old_vts_ary = curbuf->b_p_vts_array; if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1) { set_string_option_direct((char_u *)"vts", -1, new_ts_str, OPT_FREE|OPT_LOCAL, 0); curbuf->b_p_vts_array = new_vts_array; vim_free(old_vts_ary); } else { // 'vartabstop' wasn't in use and a single value was given to // retab then update 'tabstop'. curbuf->b_p_ts = tabstop_first(new_vts_array); vim_free(new_vts_array); } vim_free(new_ts_str); } #else curbuf->b_p_ts = new_ts; #endif coladvance(curwin->w_curswant); u_clearline(); }
1
293,757
static RList *filter_kexts(RKernelCacheObj *obj, RBinFile *bf) { RCFValueArray *kext_array = NULL; RListIter *iter; RCFKeyValue *item; r_list_foreach (obj->prelink_info->pairs, iter, item) { if (!strcmp (item->key, "_PrelinkInfoDictionary")) { kext_array = (RCFValueArray*) item->value; break; } } if (!kext_array) { return NULL; } RList *kexts = r_list_newf ((RListFree) &r_kext_free); if (!kexts) { return NULL; } bool is_sorted = true; RKext *prev_kext = NULL; RCFValueDict *kext_item; r_list_foreach (kext_array->values, iter, kext_item) { RKext *kext = R_NEW0 (RKext); if (!kext) { R_FREE (kexts); return NULL; } int kext_incomplete = 5; RListIter *internal_iter; r_list_foreach (kext_item->pairs, internal_iter, item) { if (!strcmp (item->key, "CFBundlePackageType")) { if (item->value->type != R_CF_STRING) { break; } RCFValueString *type = (RCFValueString*) item->value; if (strcmp (type->value, "KEXT")) { break; } kext_incomplete--; } if (!strcmp (item->key, "_PrelinkExecutableLoadAddr")) { if (item->value->type == R_CF_INTEGER) { kext_incomplete--; kext->vaddr = ((RCFValueInteger*) item->value)->value; kext->range.offset = kext->vaddr - obj->pa2va_exec; } } if (!strcmp (item->key, "_PrelinkExecutableSize")) { kext_incomplete--; if (item->value->type == R_CF_INTEGER) { kext->range.size = ((RCFValueInteger*) item->value)->value; } else { kext->range.size = 0; } } if (!strcmp (item->key, "_PrelinkKmodInfo")) { if (item->value->type == R_CF_INTEGER) { kext_incomplete--; kext->mod_info = ((RCFValueInteger*) item->value)->value; kext->mod_info -= obj->pa2va_data; } } if (!strcmp (item->key, "CFBundleIdentifier")) { if (item->value->type == R_CF_STRING) { kext_incomplete--; kext->name = ((RCFValueString*) item->value)->value; } } } if (kext_incomplete) { r_kext_free (kext); continue; } if (prev_kext && kext->vaddr < prev_kext->vaddr) { is_sorted = false; } prev_kext = kext; kext->mach0 = create_kext_mach0 (obj, kext, bf); if (!kext->mach0) { r_kext_free (kext); continue; } r_kext_fill_text_range (kext); r_list_push (kexts, kext); } if (!is_sorted) { eprintf ("SORTING KEXTs...\n"); r_list_sort (kexts, kexts_sort_vaddr_func); } return kexts; }
0
226,268
GF_Err svhd_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_SphericalVideoInfoBox *ptr = (GF_SphericalVideoInfoBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; if (ptr->string) gf_bs_write_data(bs, ptr->string, (u32) strlen(ptr->string)); gf_bs_write_u8(bs, 0); return GF_OK;
0
247,652
TestUtilOptions& enableOcspStapling() { ocsp_stapling_enabled_ = true; return *this; }
0
206,845
static unsigned long get_ctl_id_hash(const struct snd_ctl_elem_id *id) { int i; unsigned long h; h = id->iface; h = MULTIPLIER * h + id->device; h = MULTIPLIER * h + id->subdevice; for (i = 0; id->name[i] && i < SNDRV_CTL_ELEM_ID_NAME_MAXLEN; i++) h = MULTIPLIER * h + id->name[i]; h = MULTIPLIER * h + id->index; h &= LONG_MAX; return h; }
1
355,014
static void parse_rtcp_bye(pjmedia_rtcp_session *sess, const void *pkt, pj_size_t size) { pj_str_t reason = {"-", 1}; /* Check and get BYE reason */ if (size > 8) { /* Make sure the BYE reason does not exceed: * - the size of the available buffer * - the declared reason's length * - the actual packet size */ reason.slen = PJ_MIN(sizeof(sess->stat.peer_sdes_buf_), *((pj_uint8_t*)pkt+8)); reason.slen = PJ_MIN(reason.slen, size-9); pj_memcpy(sess->stat.peer_sdes_buf_, ((pj_uint8_t*)pkt+9), reason.slen); reason.ptr = sess->stat.peer_sdes_buf_; } /* Just print RTCP BYE log */ PJ_LOG(5, (sess->name, "Received RTCP BYE, reason: %.*s", reason.slen, reason.ptr)); }
0
326,635
restore_entry(struct archive_write_disk *a) { int ret = ARCHIVE_OK, en; if (a->flags & ARCHIVE_EXTRACT_UNLINK && !S_ISDIR(a->mode)) { /* * TODO: Fix this. Apparently, there are platforms * that still allow root to hose the entire filesystem * by unlinking a dir. The S_ISDIR() test above * prevents us from using unlink() here if the new * object is a dir, but that doesn't mean the old * object isn't a dir. */ if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS) (void)clear_nochange_fflags(a); if (unlink(a->name) == 0) { /* We removed it, reset cached stat. */ a->pst = NULL; } else if (errno == ENOENT) { /* File didn't exist, that's just as good. */ } else if (rmdir(a->name) == 0) { /* It was a dir, but now it's gone. */ a->pst = NULL; } else { /* We tried, but couldn't get rid of it. */ archive_set_error(&a->archive, errno, "Could not unlink"); return(ARCHIVE_FAILED); } } /* Try creating it first; if this fails, we'll try to recover. */ en = create_filesystem_object(a); if ((en == ENOTDIR || en == ENOENT) && !(a->flags & ARCHIVE_EXTRACT_NO_AUTODIR)) { /* If the parent dir doesn't exist, try creating it. */ create_parent_dir(a, a->name); /* Now try to create the object again. */ en = create_filesystem_object(a); } if ((en == ENOENT) && (archive_entry_hardlink(a->entry) != NULL)) { archive_set_error(&a->archive, en, "Hard-link target '%s' does not exist.", archive_entry_hardlink(a->entry)); return (ARCHIVE_FAILED); } if ((en == EISDIR || en == EEXIST) && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { /* If we're not overwriting, we're done. */ if (S_ISDIR(a->mode)) { /* Don't overwrite any settings on existing directories. */ a->todo = 0; } archive_entry_unset_size(a->entry); return (ARCHIVE_OK); } /* * Some platforms return EISDIR if you call * open(O_WRONLY | O_EXCL | O_CREAT) on a directory, some * return EEXIST. POSIX is ambiguous, requiring EISDIR * for open(O_WRONLY) on a dir and EEXIST for open(O_EXCL | O_CREAT) * on an existing item. */ if (en == EISDIR) { /* A dir is in the way of a non-dir, rmdir it. */ if (rmdir(a->name) != 0) { archive_set_error(&a->archive, errno, "Can't remove already-existing dir"); return (ARCHIVE_FAILED); } a->pst = NULL; /* Try again. */ en = create_filesystem_object(a); } else if (en == EEXIST) { /* * We know something is in the way, but we don't know what; * we need to find out before we go any further. */ int r = 0; /* * The SECURE_SYMLINKS logic has already removed a * symlink to a dir if the client wants that. So * follow the symlink if we're creating a dir. */ if (S_ISDIR(a->mode)) r = la_stat(a->name, &a->st); /* * If it's not a dir (or it's a broken symlink), * then don't follow it. */ if (r != 0 || !S_ISDIR(a->mode)) r = lstat(a->name, &a->st); if (r != 0) { archive_set_error(&a->archive, errno, "Can't stat existing object"); return (ARCHIVE_FAILED); } /* * NO_OVERWRITE_NEWER doesn't apply to directories. */ if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER) && !S_ISDIR(a->st.st_mode)) { if (!older(&(a->st), a->entry)) { archive_entry_unset_size(a->entry); return (ARCHIVE_OK); } } /* If it's our archive, we're done. */ if (a->skip_file_set && a->st.st_dev == (dev_t)a->skip_file_dev && a->st.st_ino == (ino_t)a->skip_file_ino) { archive_set_error(&a->archive, 0, "Refusing to overwrite archive"); return (ARCHIVE_FAILED); } if (!S_ISDIR(a->st.st_mode)) { if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS) (void)clear_nochange_fflags(a); if ((a->flags & ARCHIVE_EXTRACT_SAFE_WRITES) && S_ISREG(a->st.st_mode)) { /* Use a temporary file to extract */ if ((a->fd = la_mktemp(a)) == -1) { archive_set_error(&a->archive, errno, "Can't create temporary file"); return ARCHIVE_FAILED; } a->pst = NULL; en = 0; } else { /* A non-dir is in the way, unlink it. */ if (unlink(a->name) != 0) { archive_set_error(&a->archive, errno, "Can't unlink already-existing " "object"); return (ARCHIVE_FAILED); } a->pst = NULL; /* Try again. */ en = create_filesystem_object(a); } } else if (!S_ISDIR(a->mode)) { /* A dir is in the way of a non-dir, rmdir it. */ if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS) (void)clear_nochange_fflags(a); if (rmdir(a->name) != 0) { archive_set_error(&a->archive, errno, "Can't replace existing directory with non-directory"); return (ARCHIVE_FAILED); } /* Try again. */ en = create_filesystem_object(a); } else { /* * There's a dir in the way of a dir. Don't * waste time with rmdir()/mkdir(), just fix * up the permissions on the existing dir. * Note that we don't change perms on existing * dirs unless _EXTRACT_PERM is specified. */ if ((a->mode != a->st.st_mode) && (a->todo & TODO_MODE_FORCE)) a->deferred |= (a->todo & TODO_MODE); /* Ownership doesn't need deferred fixup. */ en = 0; /* Forget the EEXIST. */ } } if (en) { /* Everything failed; give up here. */ if ((&a->archive)->error == NULL) archive_set_error(&a->archive, en, "Can't create '%s'", a->name); return (ARCHIVE_FAILED); } a->pst = NULL; /* Cached stat data no longer valid. */ return (ret); }
0
359,524
peer_remote_as_vty (struct vty *vty, const char *peer_str, const char *as_str, afi_t afi, safi_t safi) { int ret; struct bgp *bgp; as_t as; union sockunion su; bgp = vty->index; /* Get AS number. */ VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, 65535); /* If peer is peer group, call proper function. */ ret = str2sockunion (peer_str, &su); if (ret < 0) { ret = peer_group_remote_as (bgp, peer_str, &as); if (ret < 0) { vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE); return CMD_WARNING; } return CMD_SUCCESS; } if (peer_address_self_check (&su)) { vty_out (vty, "%% Can not configure the local system as neighbor%s", VTY_NEWLINE); return CMD_WARNING; } ret = peer_remote_as (bgp, &su, &as, afi, safi); /* This peer belongs to peer group. */ switch (ret) { case BGP_ERR_PEER_GROUP_MEMBER: vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); return CMD_WARNING; case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: vty_out (vty, "%% The AS# can not be changed from %d to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE); return CMD_WARNING; } return bgp_vty_return (vty, ret); }
0
207,520
static const ut8 *parse_die(const ut8 *buf, const ut8 *buf_end, RzBinDwarfDebugInfo *info, RzBinDwarfAbbrevDecl *abbrev, RzBinDwarfCompUnitHdr *hdr, RzBinDwarfDie *die, const ut8 *debug_str, size_t debug_str_len, bool big_endian) { size_t i; const char *comp_dir = NULL; ut64 line_info_offset = UT64_MAX; for (i = 0; i < abbrev->count - 1; i++) { memset(&die->attr_values[i], 0, sizeof(die->attr_values[i])); buf = parse_attr_value(buf, buf_end - buf, &abbrev->defs[i], &die->attr_values[i], hdr, debug_str, debug_str_len, big_endian); RzBinDwarfAttrValue *attribute = &die->attr_values[i]; if (attribute->attr_name == DW_AT_comp_dir && (attribute->attr_form == DW_FORM_strp || attribute->attr_form == DW_FORM_string) && attribute->string.content) { comp_dir = attribute->string.content; } if (attribute->attr_name == DW_AT_stmt_list) { if (attribute->kind == DW_AT_KIND_CONSTANT) { line_info_offset = attribute->uconstant; } else if (attribute->kind == DW_AT_KIND_REFERENCE) { line_info_offset = attribute->reference; } } die->count++; } // If this is a compilation unit dir attribute, we want to cache it so the line info parsing // which will need this info can quickly look it up. if (comp_dir && line_info_offset != UT64_MAX) { char *name = strdup(comp_dir); if (name) { if (!ht_up_insert(info->line_info_offset_comp_dir, line_info_offset, name)) { free(name); } } } return buf; }
1
261,224
int MqttClient_Ping(MqttClient *client) { MqttPing ping; XMEMSET(&ping, 0, sizeof(ping)); return MqttClient_Ping_ex(client, &ping); }
0
338,203
Name WasmBinaryBuilder::getTableName(Index index) { if (index >= wasm.tables.size()) { throwError("invalid table index"); } return wasm.tables[index]->name; }
0
232,404
Status AsGraphDefInternal(SerializationContext* ctx, DatasetGraphDefBuilder* b, Node** output) const override { Node* indices_node; TF_RETURN_IF_ERROR(b->AddTensor(sparse_tensor_.indices(), &indices_node)); Node* value_node; TF_RETURN_IF_ERROR(b->AddTensor(sparse_tensor_.values(), &value_node)); Node* dense_shape_node; std::vector<int64> dense_shape; dense_shape.reserve(sparse_tensor_.shape().size()); for (int i = 0; i < sparse_tensor_.shape().size(); i++) dense_shape.emplace_back(sparse_tensor_.shape()[i]); TF_RETURN_IF_ERROR(b->AddVector(dense_shape, &dense_shape_node)); AttrValue val_dtype; b->BuildAttrValue(sparse_tensor_.dtype(), &val_dtype); TF_RETURN_IF_ERROR( b->AddDataset(this, {indices_node, value_node, dense_shape_node}, {{"Tvalues", val_dtype}}, output)); return Status::OK(); }
0
238,602
static int check_ld_imm(struct bpf_verifier_env *env, struct bpf_insn *insn) { struct bpf_insn_aux_data *aux = cur_aux(env); struct bpf_reg_state *regs = cur_regs(env); struct bpf_reg_state *dst_reg; struct bpf_map *map; int err; if (BPF_SIZE(insn->code) != BPF_DW) { verbose(env, "invalid BPF_LD_IMM insn\n"); return -EINVAL; } if (insn->off != 0) { verbose(env, "BPF_LD_IMM64 uses reserved fields\n"); return -EINVAL; } err = check_reg_arg(env, insn->dst_reg, DST_OP); if (err) return err; dst_reg = &regs[insn->dst_reg]; if (insn->src_reg == 0) { u64 imm = ((u64)(insn + 1)->imm << 32) | (u32)insn->imm; dst_reg->type = SCALAR_VALUE; __mark_reg_known(&regs[insn->dst_reg], imm); return 0; } /* All special src_reg cases are listed below. From this point onwards * we either succeed and assign a corresponding dst_reg->type after * zeroing the offset, or fail and reject the program. */ mark_reg_known_zero(env, regs, insn->dst_reg); if (insn->src_reg == BPF_PSEUDO_BTF_ID) { dst_reg->type = aux->btf_var.reg_type; switch (base_type(dst_reg->type)) { case PTR_TO_MEM: dst_reg->mem_size = aux->btf_var.mem_size; break; case PTR_TO_BTF_ID: case PTR_TO_PERCPU_BTF_ID: dst_reg->btf = aux->btf_var.btf; dst_reg->btf_id = aux->btf_var.btf_id; break; default: verbose(env, "bpf verifier is misconfigured\n"); return -EFAULT; } return 0; } if (insn->src_reg == BPF_PSEUDO_FUNC) { struct bpf_prog_aux *aux = env->prog->aux; u32 subprogno = find_subprog(env, env->insn_idx + insn->imm + 1); if (!aux->func_info) { verbose(env, "missing btf func_info\n"); return -EINVAL; } if (aux->func_info_aux[subprogno].linkage != BTF_FUNC_STATIC) { verbose(env, "callback function not static\n"); return -EINVAL; } dst_reg->type = PTR_TO_FUNC; dst_reg->subprogno = subprogno; return 0; } map = env->used_maps[aux->map_index]; dst_reg->map_ptr = map; if (insn->src_reg == BPF_PSEUDO_MAP_VALUE || insn->src_reg == BPF_PSEUDO_MAP_IDX_VALUE) { dst_reg->type = PTR_TO_MAP_VALUE; dst_reg->off = aux->map_off; if (map_value_has_spin_lock(map)) dst_reg->id = ++env->id_gen; } else if (insn->src_reg == BPF_PSEUDO_MAP_FD || insn->src_reg == BPF_PSEUDO_MAP_IDX) { dst_reg->type = CONST_PTR_TO_MAP; } else { verbose(env, "bpf verifier is misconfigured\n"); return -EINVAL; } return 0; }
0
201,343
static int selinux_ptrace_traceme(struct task_struct *parent) { return avc_has_perm(&selinux_state, task_sid_subj(parent), task_sid_obj(current), SECCLASS_PROCESS, PROCESS__PTRACE, NULL); }
1
314,746
cdf_dump_sat(const char *prefix, const cdf_sat_t *sat, size_t size) { size_t i, j, s = size / sizeof(cdf_secid_t); for (i = 0; i < sat->sat_len; i++) { (void)fprintf(stderr, "%s[%" SIZE_T_FORMAT "u]:\n%.6" SIZE_T_FORMAT "u: ", prefix, i, i * s); for (j = 0; j < s; j++) { (void)fprintf(stderr, "%5d, ", CDF_TOLE4(sat->sat_tab[s * i + j])); if ((j + 1) % 10 == 0) (void)fprintf(stderr, "\n%.6" SIZE_T_FORMAT "u: ", i * s + j + 1); } (void)fprintf(stderr, "\n"); } }
0
390,531
ProcXkbGetControls(ClientPtr client) { xkbGetControlsReply rep; XkbControlsPtr xkb; DeviceIntPtr dev; register int n; REQUEST(xkbGetControlsReq); REQUEST_SIZE_MATCH(xkbGetControlsReq); if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); xkb = dev->key->xkbInfo->desc->ctrls; rep.type = X_Reply; rep.length = (SIZEOF(xkbGetControlsReply)- SIZEOF(xGenericReply)) >> 2; rep.sequenceNumber = client->sequence; rep.deviceID = ((DeviceIntPtr)dev)->id; rep.numGroups = xkb->num_groups; rep.groupsWrap = xkb->groups_wrap; rep.internalMods = xkb->internal.mask; rep.ignoreLockMods = xkb->ignore_lock.mask; rep.internalRealMods = xkb->internal.real_mods; rep.ignoreLockRealMods = xkb->ignore_lock.real_mods; rep.internalVMods = xkb->internal.vmods; rep.ignoreLockVMods = xkb->ignore_lock.vmods; rep.enabledCtrls = xkb->enabled_ctrls; rep.repeatDelay = xkb->repeat_delay; rep.repeatInterval = xkb->repeat_interval; rep.slowKeysDelay = xkb->slow_keys_delay; rep.debounceDelay = xkb->debounce_delay; rep.mkDelay = xkb->mk_delay; rep.mkInterval = xkb->mk_interval; rep.mkTimeToMax = xkb->mk_time_to_max; rep.mkMaxSpeed = xkb->mk_max_speed; rep.mkCurve = xkb->mk_curve; rep.mkDfltBtn = xkb->mk_dflt_btn; rep.axTimeout = xkb->ax_timeout; rep.axtCtrlsMask = xkb->axt_ctrls_mask; rep.axtCtrlsValues = xkb->axt_ctrls_values; rep.axtOptsMask = xkb->axt_opts_mask; rep.axtOptsValues = xkb->axt_opts_values; rep.axOptions = xkb->ax_options; memcpy(rep.perKeyRepeat,xkb->per_key_repeat,XkbPerKeyBitArraySize); if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length,n); swaps(&rep.internalVMods, n); swaps(&rep.ignoreLockVMods, n); swapl(&rep.enabledCtrls, n); swaps(&rep.repeatDelay, n); swaps(&rep.repeatInterval, n); swaps(&rep.slowKeysDelay, n); swaps(&rep.debounceDelay, n); swaps(&rep.mkDelay, n); swaps(&rep.mkInterval, n); swaps(&rep.mkTimeToMax, n); swaps(&rep.mkMaxSpeed, n); swaps(&rep.mkCurve, n); swaps(&rep.axTimeout, n); swapl(&rep.axtCtrlsMask, n); swapl(&rep.axtCtrlsValues, n); swaps(&rep.axtOptsMask, n); swaps(&rep.axtOptsValues, n); swaps(&rep.axOptions, n); } WriteToClient(client, SIZEOF(xkbGetControlsReply), (char *)&rep); return(client->noClientException); }
0
333,050
nfa_get_match_text(nfa_state_T *start) { nfa_state_T *p = start; int len = 0; char_u *ret; char_u *s; if (p->c != NFA_MOPEN) return NULL; // just in case p = p->out; while (p->c > 0) { len += MB_CHAR2LEN(p->c); p = p->out; } if (p->c != NFA_MCLOSE || p->out->c != NFA_MATCH) return NULL; ret = alloc(len); if (ret != NULL) { p = start->out->out; // skip first char, it goes into regstart s = ret; while (p->c > 0) { if (has_mbyte) s += (*mb_char2bytes)(p->c, s); else *s++ = p->c; p = p->out; } *s = NUL; } return ret; }
0
96,950
bool decode(ArgumentDecoder* decoder, RetainPtr<SecKeychainItemRef>& result) { RetainPtr<CFDataRef> data; if (!CoreIPC::decode(decoder, data)) return false; SecKeychainItemRef item; if (SecKeychainItemCopyFromPersistentReference(data.get(), &item) != errSecSuccess || !item) return false; result.adoptCF(item); return true; }
0
359,502
hex_append(char *s, int len, u_long x) { char buf[30]; char *t; if (!x) return str_append(s,len,"0"); *(t = &buf[sizeof(buf)-1]) = '\0'; while (x && (t > buf)) { u_int cc = (x % 16); *--t = ((cc < 10) ? ('0'+cc) : ('a'+cc-10)); x /= 16; } return str_append(s,len,t); }
0
244,356
GF_Err tref_box_write(GF_Box *s, GF_BitStream *bs) { // GF_TrackReferenceBox *ptr = (GF_TrackReferenceBox *)s; return gf_isom_box_write_header(s, bs); }
0
261,916
njs_string_decode_utf8(njs_vm_t *vm, njs_value_t *value, const njs_str_t *src) { size_t length; njs_str_t dst; length = njs_decode_utf8_length(src, &dst.length); dst.start = njs_string_alloc(vm, value, dst.length, length); if (njs_fast_path(dst.start != NULL)) { njs_decode_utf8(&dst, src); return NJS_OK; } return NJS_ERROR; }
0
281,129
static void xfrm_byidx_resize(struct net *net, int total) { unsigned int hmask = net->xfrm.policy_idx_hmask; unsigned int nhashmask = xfrm_new_hash_mask(hmask); unsigned int nsize = (nhashmask + 1) * sizeof(struct hlist_head); struct hlist_head *oidx = net->xfrm.policy_byidx; struct hlist_head *nidx = xfrm_hash_alloc(nsize); int i; if (!nidx) return; spin_lock_bh(&net->xfrm.xfrm_policy_lock); for (i = hmask; i >= 0; i--) xfrm_idx_hash_transfer(oidx + i, nidx, nhashmask); net->xfrm.policy_byidx = nidx; net->xfrm.policy_idx_hmask = nhashmask; spin_unlock_bh(&net->xfrm.xfrm_policy_lock); xfrm_hash_free(oidx, (hmask + 1) * sizeof(struct hlist_head)); }
0
343,144
int esp_input_done2(struct sk_buff *skb, int err) { const struct iphdr *iph; struct xfrm_state *x = xfrm_input_state(skb); struct xfrm_offload *xo = xfrm_offload(skb); struct crypto_aead *aead = x->data; int hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead); int ihl; if (!xo || !(xo->flags & CRYPTO_DONE)) kfree(ESP_SKB_CB(skb)->tmp); if (unlikely(err)) goto out; err = esp_remove_trailer(skb); if (unlikely(err < 0)) goto out; iph = ip_hdr(skb); ihl = iph->ihl * 4; if (x->encap) { struct xfrm_encap_tmpl *encap = x->encap; struct tcphdr *th = (void *)(skb_network_header(skb) + ihl); struct udphdr *uh = (void *)(skb_network_header(skb) + ihl); __be16 source; switch (x->encap->encap_type) { case TCP_ENCAP_ESPINTCP: source = th->source; break; case UDP_ENCAP_ESPINUDP: case UDP_ENCAP_ESPINUDP_NON_IKE: source = uh->source; break; default: WARN_ON_ONCE(1); err = -EINVAL; goto out; } /* * 1) if the NAT-T peer's IP or port changed then * advertize the change to the keying daemon. * This is an inbound SA, so just compare * SRC ports. */ if (iph->saddr != x->props.saddr.a4 || source != encap->encap_sport) { xfrm_address_t ipaddr; ipaddr.a4 = iph->saddr; km_new_mapping(x, &ipaddr, source); /* XXX: perhaps add an extra * policy check here, to see * if we should allow or * reject a packet from a * different source * address/port. */ } /* * 2) ignore UDP/TCP checksums in case * of NAT-T in Transport Mode, or * perform other post-processing fixes * as per draft-ietf-ipsec-udp-encaps-06, * section 3.1.2 */ if (x->props.mode == XFRM_MODE_TRANSPORT) skb->ip_summed = CHECKSUM_UNNECESSARY; } skb_pull_rcsum(skb, hlen); if (x->props.mode == XFRM_MODE_TUNNEL) skb_reset_transport_header(skb); else skb_set_transport_header(skb, -ihl); /* RFC4303: Drop dummy packets without any error */ if (err == IPPROTO_NONE) err = -EINVAL; out: return err; }
0
404,741
struct file *fget_task(struct task_struct *task, unsigned int fd) { struct file *file = NULL; task_lock(task); if (task->files) file = __fget_files(task->files, fd, 0, 1); task_unlock(task); return file; }
0
277,488
bool mobi_indx_has_tag(const MOBIIndx *indx, const size_t tagid) { if (indx) { for (size_t i = 0; i < indx->entries_count; i++) { MOBIIndexEntry entry = indx->entries[i]; for(size_t j = 0; j < entry.tags_count; j++) { if (entry.tags[j].tagid == tagid) { return true; } } } } return false; }
0
357,669
SQInstance::SQInstance(SQSharedState *ss, SQInstance *i, SQInteger memsize) { _memsize = memsize; _class = i->_class; SQUnsignedInteger nvalues = _class->_defaultvalues.size(); for(SQUnsignedInteger n = 0; n < nvalues; n++) { new (&_values[n]) SQObjectPtr(i->_values[n]); } Init(ss); }
0
243,988
GF_Err fecr_box_size(GF_Box *s) { FECReservoirBox *ptr = (FECReservoirBox *)s; ptr->size += (ptr->version ? 4 : 2) + ptr->nb_entries * (ptr->version ? 8 : 6); return GF_OK; }
0
513,047
Item_float(THD *thd, const char *str, double val_arg, uint decimal_par, uint length): Item_num(thd), value(val_arg) { presentation= name.str= str; name.length= safe_strlen(str); decimals=(uint8) decimal_par; max_length= length; }
0
336,004
static int sr_read_eeprom_word(struct usbnet *dev, u8 offset, void *value) { return sr_share_read_word(dev, 0, offset, value); }
0
387,853
void InstanceKlass::add_previous_version(InstanceKlass* scratch_class, int emcp_method_count) { assert(Thread::current()->is_VM_thread(), "only VMThread can add previous versions"); ResourceMark rm; log_trace(redefine, class, iklass, add) ("adding previous version ref for %s, EMCP_cnt=%d", scratch_class->external_name(), emcp_method_count); // Clean out old previous versions for this class purge_previous_version_list(); // Mark newly obsolete methods in remaining previous versions. An EMCP method from // a previous redefinition may be made obsolete by this redefinition. Array<Method*>* old_methods = scratch_class->methods(); mark_newly_obsolete_methods(old_methods, emcp_method_count); // If the constant pool for this previous version of the class // is not marked as being on the stack, then none of the methods // in this previous version of the class are on the stack so // we don't need to add this as a previous version. ConstantPool* cp_ref = scratch_class->constants(); if (!cp_ref->on_stack()) { log_trace(redefine, class, iklass, add)("scratch class not added; no methods are running"); // For debugging purposes. scratch_class->set_is_scratch_class(); scratch_class->class_loader_data()->add_to_deallocate_list(scratch_class); return; } if (emcp_method_count != 0) { // At least one method is still running, check for EMCP methods for (int i = 0; i < old_methods->length(); i++) { Method* old_method = old_methods->at(i); if (!old_method->is_obsolete() && old_method->on_stack()) { // if EMCP method (not obsolete) is on the stack, mark as EMCP so that // we can add breakpoints for it. // We set the method->on_stack bit during safepoints for class redefinition // and use this bit to set the is_running_emcp bit. // After the safepoint, the on_stack bit is cleared and the running emcp // method may exit. If so, we would set a breakpoint in a method that // is never reached, but this won't be noticeable to the programmer. old_method->set_running_emcp(true); log_trace(redefine, class, iklass, add) ("EMCP method %s is on_stack " INTPTR_FORMAT, old_method->name_and_sig_as_C_string(), p2i(old_method)); } else if (!old_method->is_obsolete()) { log_trace(redefine, class, iklass, add) ("EMCP method %s is NOT on_stack " INTPTR_FORMAT, old_method->name_and_sig_as_C_string(), p2i(old_method)); } } } // Add previous version if any methods are still running. // Set has_previous_version flag for processing during class unloading. _has_previous_versions = true; log_trace(redefine, class, iklass, add) ("scratch class added; one of its methods is on_stack."); assert(scratch_class->previous_versions() == NULL, "shouldn't have a previous version"); scratch_class->link_previous_versions(previous_versions()); link_previous_versions(scratch_class); } // end add_previous_version()
0
412,119
dnsc_nonces_compfunc(void *m1, void *m2) { struct nonce_cache_key *k1 = m1, *k2 = m2; return sodium_memcmp( k1->nonce, k2->nonce, crypto_box_HALF_NONCEBYTES) != 0 || sodium_memcmp( k1->magic_query, k2->magic_query, DNSCRYPT_MAGIC_HEADER_LEN) != 0 || sodium_memcmp( k1->client_publickey, k2->client_publickey, crypto_box_PUBLICKEYBYTES) != 0; }
0
226,037
GF_Err elst_box_size(GF_Box *s) { u32 durtimebytes; u32 i, nb_entries; GF_EditListBox *ptr = (GF_EditListBox *)s; //entry count ptr->size += 4; nb_entries = gf_list_count(ptr->entryList); ptr->version = 0; for (i=0; i<nb_entries; i++) { GF_EdtsEntry *p = (GF_EdtsEntry*)gf_list_get(ptr->entryList, i); if ((p->segmentDuration>0xFFFFFFFF) || (p->mediaTime>0xFFFFFFFF)) { ptr->version = 1; break; } } durtimebytes = (ptr->version == 1 ? 16 : 8) + 4; ptr->size += (nb_entries * durtimebytes); return GF_OK; }
0
462,425
DataRcvdUncompressed(ptcpsess_t *pThis, char *pData, size_t iLen, struct syslogTime *stTime, time_t ttGenTime) { multi_submit_t multiSub; smsg_t *pMsgs[CONF_NUM_MULTISUB]; char *pEnd; unsigned nMsgs = 0; DEFiRet; assert(pData != NULL); assert(iLen > 0); if(ttGenTime == 0) datetime.getCurrTime(stTime, &ttGenTime, TIME_IN_LOCALTIME); multiSub.ppMsgs = pMsgs; multiSub.maxElem = CONF_NUM_MULTISUB; multiSub.nElem = 0; /* We now copy the message to the session buffer. */ pEnd = pData + iLen; /* this is one off, which is intensional */ while(pData < pEnd) { CHKiRet(processDataRcvd(pThis, &pData, pEnd - pData, stTime, ttGenTime, &multiSub, &nMsgs)); pData++; } iRet = multiSubmitFlush(&multiSub); if(glblSenderKeepTrack) statsRecordSender(propGetSzStr(pThis->peerName), nMsgs, ttGenTime); finalize_it: RETiRet; }
0
336,560
static void reds_client_monitors_config(RedsState *reds, VDAgentMonitorsConfig *monitors_config) { FOREACH_QXL_INSTANCE(reds, qxl) { if (!red_qxl_client_monitors_config(qxl, monitors_config)) { /* this is a normal condition, some qemu devices might not implement it */ spice_debug("QXLInterface::client_monitors_config failed"); } } }
0
337,804
struct sctp_chunk *sctp_make_abort_no_data( const struct sctp_association *asoc, const struct sctp_chunk *chunk, __u32 tsn) { struct sctp_chunk *retval; __be32 payload; retval = sctp_make_abort(asoc, chunk, sizeof(struct sctp_errhdr) + sizeof(tsn)); if (!retval) goto no_mem; /* Put the tsn back into network byte order. */ payload = htonl(tsn); sctp_init_cause(retval, SCTP_ERROR_NO_DATA, sizeof(payload)); sctp_addto_chunk(retval, sizeof(payload), (const void *)&payload); /* RFC 2960 6.4 Multi-homed SCTP Endpoints * * An endpoint SHOULD transmit reply chunks (e.g., SACK, * HEARTBEAT ACK, * etc.) to the same destination transport * address from which it * received the DATA or control chunk * to which it is replying. * * [ABORT back to where the offender came from.] */ if (chunk) retval->transport = chunk->transport; no_mem: return retval; }
0