idx
int64
func
string
target
int64
462,547
void controller::execute_commands(char ** argv, unsigned int i) { if (v->formaction_stack_size() > 0) v->pop_current_formaction(); for (; argv[i]; ++i) { LOG(level::DEBUG, "controller::execute_commands: executing `%s'", argv[i]); std::string cmd(argv[i]); if (cmd == "reload") { reload_all(true); } else if (cmd == "print-unread") { std::cout << strprintf::fmt(_("%u unread articles"), rsscache->get_unread_count()) << std::endl; } else { std::cerr << strprintf::fmt(_("%s: %s: unknown command"), argv[0], argv[i]) << std::endl; ::std::exit(EXIT_FAILURE); } } }
0
261,908
njs_string_prototype_to_string(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, njs_index_t unused) { njs_int_t ret; njs_str_t enc, str; njs_value_t value; njs_string_prop_t string; ret = njs_string_prototype_value_of(vm, args, nargs, unused); if (njs_slow_path(ret != NJS_OK)) { return ret; } if (nargs < 2) { return NJS_OK; } if (njs_slow_path(!njs_is_string(&args[1]))) { njs_type_error(vm, "encoding must be a string"); return NJS_ERROR; } value = vm->retval; (void) njs_string_prop(&string, &value); njs_string_get(&args[1], &enc); str.length = string.size; str.start = string.start; if (enc.length == 3 && memcmp(enc.start, "hex", 3) == 0) { return njs_string_hex(vm, &vm->retval, &str); } else if (enc.length == 6 && memcmp(enc.start, "base64", 6) == 0) { return njs_string_base64(vm, &vm->retval, &str); } else if (enc.length == 9 && memcmp(enc.start, "base64url", 9) == 0) { return njs_string_base64url(vm, &vm->retval, &str); } njs_type_error(vm, "Unknown encoding: \"%V\"", &enc); return NJS_ERROR; }
0
436,105
static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll, __poll_t mask, io_req_tw_func_t func) { /* for instances that support it check for an event match first: */ if (mask && !(mask & poll->events)) return 0; trace_io_uring_task_add(req->ctx, req->opcode, req->user_data, mask); list_del_init(&poll->wait.entry); req->result = mask; req->io_task_work.func = func; /* * If this fails, then the task is exiting. When a task exits, the * work gets canceled, so just cancel this request as well instead * of executing it. We can't safely execute it anyway, as we may not * have the needed state needed for it anyway. */ io_req_task_work_add(req); return 1;
0
234,135
xcrealloc (void *ptr, size_t nmemb, size_t size) { /* Check for overflow. */ if (nmemb >= ~(size_t) 0 / size) { error (_("Attempt to re-allocate an array with an excessive number of elements: 0x%lx\n"), (long) nmemb); xexit (1); } return xrealloc (ptr, nmemb * size); }
0
244,085
void tref_box_del(GF_Box *s) { GF_TrackReferenceBox *ptr = (GF_TrackReferenceBox *)s; if (ptr == NULL) return; gf_free(ptr); }
0
508,885
void st_select_lex_node::include_down(st_select_lex_node *upper) { if ((next= upper->slave)) next->prev= &next; prev= &upper->slave; upper->slave= this; master= upper; slave= 0; }
0
359,274
peer_address_self_check (union sockunion *su) { struct interface *ifp = NULL; if (su->sa.sa_family == AF_INET) ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr); #ifdef HAVE_IPV6 else if (su->sa.sa_family == AF_INET6) ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr); #endif /* HAVE IPV6 */ if (ifp) return 1; return 0; }
0
247,371
int pgpPrtParamsSubkeys(const uint8_t *pkts, size_t pktlen, pgpDigParams mainkey, pgpDigParams **subkeys, int *subkeysCount) { const uint8_t *p = pkts; const uint8_t *pend = pkts + pktlen; pgpDigParams *digps = NULL; int count = 0; int alloced = 10; struct pgpPkt pkt; int rc, i; digps = xmalloc(alloced * sizeof(*digps)); while (p < pend) { if (decodePkt(p, (pend - p), &pkt)) break; p += (pkt.body - pkt.head) + pkt.blen; if (pkt.tag == PGPTAG_PUBLIC_SUBKEY) { if (count == alloced) { alloced <<= 1; digps = xrealloc(digps, alloced * sizeof(*digps)); } digps[count] = pgpDigParamsNew(PGPTAG_PUBLIC_SUBKEY); /* Copy UID from main key to subkey */ digps[count]->userid = xstrdup(mainkey->userid); if (getKeyID(pkt.body, pkt.blen, digps[count]->signid)) { pgpDigParamsFree(digps[count]); continue; } if (pgpPrtKey(pkt.tag, pkt.body, pkt.blen, digps[count])) { pgpDigParamsFree(digps[count]); continue; } count++; } } rc = (p == pend) ? 0 : -1; if (rc == 0) { *subkeys = xrealloc(digps, count * sizeof(*digps)); *subkeysCount = count; } else { for (i = 0; i < count; i++) pgpDigParamsFree(digps[i]); free(digps); } return rc; }
0
517,459
static void do_home(HttpResponse res) { do_head(res, "", "", Run.polltime); StringBuffer_append(res->outputbuffer, "<table id='header' width='100%%'>" " <tr>" " <td colspan=2 valign='top' class='left' width='100%%'>" " <h1>Monit Service Manager</h1>" " <p class='center'>Monit is <a href='_runtime'>running</a> on %s and monitoring:</p><br>" " </td>" " </tr>" "</table>", Run.system->name); do_home_system(res); do_home_process(res); do_home_program(res); do_home_filesystem(res); do_home_file(res); do_home_fifo(res); do_home_directory(res); do_home_net(res); do_home_host(res); do_foot(res); }
0
498,150
void cgit_patch_link(const char *name, const char *title, const char *class, const char *head, const char *rev, const char *path) { reporevlink("patch", name, title, class, head, rev, path); }
0
522,356
int GmfCpyLin(int64_t InpIdx, int64_t OutIdx, int KwdCod) { char s[ WrdSiz * FilStrSiz ]; double d; float f; int i, a, err; int64_t l; GmfMshSct *InpMsh = (GmfMshSct *)InpIdx, *OutMsh = (GmfMshSct *)OutIdx; KwdSct *kwd = &InpMsh->KwdTab[ KwdCod ]; // Save the current stack environment for longjmp if( (err = setjmp(InpMsh->err)) != 0) { #ifdef GMFDEBUG printf("libMeshb : mesh %p : error %d\n", InpMsh, err); #endif return(0); } for(i=0;i<kwd->SolSiz;i++) { if(kwd->fmt[i] == 'r') { if(InpMsh->FltSiz == 32) { if(InpMsh->typ & Asc) safe_fscanf(InpMsh->hdl, "%f", &f, InpMsh->err); else ScaWrd(InpMsh, (unsigned char *)&f); d = (double)f; } else { if(InpMsh->typ & Asc) safe_fscanf(InpMsh->hdl, "%lf", &d, InpMsh->err); else ScaDblWrd(InpMsh, (unsigned char *)&d); f = (float)d; } if(OutMsh->FltSiz == 32) if(OutMsh->typ & Asc) fprintf(OutMsh->hdl, "%.9g ", (double)f); else RecWrd(OutMsh, (unsigned char *)&f); else if(OutMsh->typ & Asc) fprintf(OutMsh->hdl, "%.17g ", d); else RecDblWrd(OutMsh, (unsigned char *)&d); } else if(kwd->fmt[i] == 'i') { if(InpMsh->ver <= 3) { if(InpMsh->typ & Asc) safe_fscanf(InpMsh->hdl, "%d", &a, InpMsh->err); else ScaWrd(InpMsh, (unsigned char *)&a); l = (int64_t)a; } else { if(InpMsh->typ & Asc) safe_fscanf(InpMsh->hdl, INT64_T_FMT, &l, InpMsh->err); else ScaDblWrd(InpMsh, (unsigned char *)&l); a = (int)l; } if( (i == kwd->SolSiz-1) && (a > GmfMaxRefTab[ KwdCod ]) ) GmfMaxRefTab[ KwdCod ] = a; if(OutMsh->ver <= 3) { if(OutMsh->typ & Asc) fprintf(OutMsh->hdl, "%d ", a); else RecWrd(OutMsh, (unsigned char *)&a); } else { if(OutMsh->typ & Asc) fprintf(OutMsh->hdl, INT64_T_FMT" ", l); else RecDblWrd(OutMsh, (unsigned char *)&l); } } else if(kwd->fmt[i] == 'c') { memset(s, 0, FilStrSiz * WrdSiz); if(InpMsh->typ & Asc) safe_fgets(s, WrdSiz * FilStrSiz, InpMsh->hdl, InpMsh->err); else #ifdef WITH_GMF_AIO read(InpMsh->FilDes, s, WrdSiz * FilStrSiz); #else safe_fread(s, WrdSiz, FilStrSiz, InpMsh->hdl, InpMsh->err); #endif if(OutMsh->typ & Asc) fprintf(OutMsh->hdl, "%s ", s); else #ifdef WITH_GMF_AIO write(OutMsh->FilDes, s, WrdSiz * FilStrSiz); #else fwrite(s, WrdSiz, FilStrSiz, OutMsh->hdl); #endif } } if(OutMsh->typ & Asc) fprintf(OutMsh->hdl, "\n"); return(1); }
0
232,360
GF_Err gf_isom_box_write_listing(GF_Box *a, GF_BitStream *bs) { if (!a) return GF_BAD_PARAM; if (!a->registry) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] Write invalid box type %s without registry\n", gf_4cc_to_str(a->type) )); return GF_ISOM_INVALID_FILE; } return a->registry->write_fn(a, bs);
0
488,378
static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *page_table, pmd_t *pmd, int write_access, pte_t orig_pte) { pgoff_t pgoff = (((address & PAGE_MASK) - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; unsigned int flags = (write_access ? FAULT_FLAG_WRITE : 0); pte_unmap(page_table); return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); }
0
319,424
static MagickBooleanType IsCIN(const unsigned char *magick,const size_t length) { if (length < 4) return(MagickFalse); if (memcmp(magick,"\200\052\137\327",4) == 0) return(MagickTrue); return(MagickFalse); }
0
253,574
smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon, struct cifsFileInfo *cfile, void __user *ioc_buf) { char *retbuf = NULL; unsigned int ret_data_len = 0; int rc; u32 max_response_size; struct smb_snapshot_array snapshot_in; /* * On the first query to enumerate the list of snapshots available * for this volume the buffer begins with 0 (number of snapshots * which can be returned is zero since at that point we do not know * how big the buffer needs to be). On the second query, * it (ret_data_len) is set to number of snapshots so we can * know to set the maximum response size larger (see below). */ if (get_user(ret_data_len, (unsigned int __user *)ioc_buf)) return -EFAULT; /* * Note that for snapshot queries that servers like Azure expect that * the first query be minimal size (and just used to get the number/size * of previous versions) so response size must be specified as EXACTLY * sizeof(struct snapshot_array) which is 16 when rounded up to multiple * of eight bytes. */ if (ret_data_len == 0) max_response_size = MIN_SNAPSHOT_ARRAY_SIZE; else max_response_size = CIFSMaxBufSize; rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, cfile->fid.volatile_fid, FSCTL_SRV_ENUMERATE_SNAPSHOTS, true /* is_fsctl */, NULL, 0 /* no input data */, max_response_size, (char **)&retbuf, &ret_data_len); cifs_dbg(FYI, "enum snaphots ioctl returned %d and ret buflen is %d\n", rc, ret_data_len); if (rc) return rc; if (ret_data_len && (ioc_buf != NULL) && (retbuf != NULL)) { /* Fixup buffer */ if (copy_from_user(&snapshot_in, ioc_buf, sizeof(struct smb_snapshot_array))) { rc = -EFAULT; kfree(retbuf); return rc; } /* * Check for min size, ie not large enough to fit even one GMT * token (snapshot). On the first ioctl some users may pass in * smaller size (or zero) to simply get the size of the array * so the user space caller can allocate sufficient memory * and retry the ioctl again with larger array size sufficient * to hold all of the snapshot GMT tokens on the second try. */ if (snapshot_in.snapshot_array_size < GMT_TOKEN_SIZE) ret_data_len = sizeof(struct smb_snapshot_array); /* * We return struct SRV_SNAPSHOT_ARRAY, followed by * the snapshot array (of 50 byte GMT tokens) each * representing an available previous version of the data */ if (ret_data_len > (snapshot_in.snapshot_array_size + sizeof(struct smb_snapshot_array))) ret_data_len = snapshot_in.snapshot_array_size + sizeof(struct smb_snapshot_array); if (copy_to_user(ioc_buf, retbuf, ret_data_len)) rc = -EFAULT; } kfree(retbuf); return rc; }
0
450,406
static int send_png_rect(VncState *vs, int x, int y, int w, int h, VncPalette *palette) { png_byte color_type; png_structp png_ptr; png_infop info_ptr; png_colorp png_palette = NULL; pixman_image_t *linebuf; int level = tight_png_conf[vs->tight->compression].png_zlib_level; int filters = tight_png_conf[vs->tight->compression].png_filters; uint8_t *buf; int dy; png_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL, NULL, vnc_png_malloc, vnc_png_free); if (png_ptr == NULL) return -1; info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { png_destroy_write_struct(&png_ptr, NULL); return -1; } png_set_write_fn(png_ptr, (void *) vs, png_write_data, png_flush_data); png_set_compression_level(png_ptr, level); png_set_filter(png_ptr, PNG_FILTER_TYPE_DEFAULT, filters); if (palette) { color_type = PNG_COLOR_TYPE_PALETTE; } else { color_type = PNG_COLOR_TYPE_RGB; } png_set_IHDR(png_ptr, info_ptr, w, h, 8, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); if (color_type == PNG_COLOR_TYPE_PALETTE) { struct palette_cb_priv priv; png_palette = png_malloc(png_ptr, sizeof(*png_palette) * palette_size(palette)); priv.vs = vs; priv.png_palette = png_palette; palette_iter(palette, write_png_palette, &priv); png_set_PLTE(png_ptr, info_ptr, png_palette, palette_size(palette)); if (vs->client_pf.bytes_per_pixel == 4) { tight_encode_indexed_rect32(vs->tight->tight.buffer, w * h, palette); } else { tight_encode_indexed_rect16(vs->tight->tight.buffer, w * h, palette); } } png_write_info(png_ptr, info_ptr); buffer_reserve(&vs->tight->png, 2048); linebuf = qemu_pixman_linebuf_create(PIXMAN_BE_r8g8b8, w); buf = (uint8_t *)pixman_image_get_data(linebuf); for (dy = 0; dy < h; dy++) { if (color_type == PNG_COLOR_TYPE_PALETTE) { memcpy(buf, vs->tight->tight.buffer + (dy * w), w); } else { qemu_pixman_linebuf_fill(linebuf, vs->vd->server, w, x, y + dy); } png_write_row(png_ptr, buf); } qemu_pixman_image_unref(linebuf); png_write_end(png_ptr, NULL); if (color_type == PNG_COLOR_TYPE_PALETTE) { png_free(png_ptr, png_palette); } png_destroy_write_struct(&png_ptr, &info_ptr); vnc_write_u8(vs, VNC_TIGHT_PNG << 4); tight_send_compact_size(vs, vs->tight->png.offset); vnc_write(vs, vs->tight->png.buffer, vs->tight->png.offset); buffer_reset(&vs->tight->png); return 1; }
0
387,627
int snd_ctl_rename_id(struct snd_card *card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id) { struct snd_kcontrol *kctl; down_write(&card->controls_rwsem); kctl = snd_ctl_find_id(card, src_id); if (kctl == NULL) { up_write(&card->controls_rwsem); return -ENOENT; } remove_hash_entries(card, kctl); kctl->id = *dst_id; kctl->id.numid = card->last_numid + 1; card->last_numid += kctl->count; add_hash_entries(card, kctl); up_write(&card->controls_rwsem); return 0; }
0
275,475
njs_value_string_get(njs_value_t *value, njs_str_t *dst) { njs_string_get(value, dst); }
0
225,944
void free_box_del(GF_Box *s) { GF_FreeSpaceBox *ptr = (GF_FreeSpaceBox *)s; if (ptr->data) gf_free(ptr->data); gf_free(ptr); }
0
294,721
df_utc_to_local(int df, int of) { df += of; if (df < 0) df += DAY_IN_SECONDS; else if (df >= DAY_IN_SECONDS) df -= DAY_IN_SECONDS; return df; }
0
245,191
char* get_xtrabackup_info(MYSQL *connection) { const char *uuid = get_backup_uuid(connection); char *server_version = read_mysql_one_value(connection, "SELECT VERSION()"); static const size_t time_buf_size = 100; char buf_start_time[time_buf_size]; char buf_end_time[time_buf_size]; format_time(history_start_time, buf_start_time, time_buf_size); format_time(history_end_time, buf_end_time, time_buf_size); ut_a(uuid); ut_a(server_version); char* result = NULL; asprintf(&result, "uuid = %s\n" "name = %s\n" "tool_name = %s\n" "tool_command = %s\n" "tool_version = %s\n" "ibbackup_version = %s\n" "server_version = %s\n" "start_time = %s\n" "end_time = %s\n" "lock_time = %ld\n" "binlog_pos = %s\n" "innodb_from_lsn = " LSN_PF "\n" "innodb_to_lsn = " LSN_PF "\n" "partial = %s\n" "incremental = %s\n" "format = %s\n" "compact = %s\n" "compressed = %s\n" "encrypted = %s\n", uuid, /* uuid */ opt_history ? opt_history : "", /* name */ tool_name, /* tool_name */ tool_args, /* tool_command */ XTRABACKUP_VERSION, /* tool_version */ XTRABACKUP_VERSION, /* ibbackup_version */ server_version, /* server_version */ buf_start_time, /* start_time */ buf_end_time, /* end_time */ (long int)history_lock_time, /* lock_time */ mysql_binlog_position ? mysql_binlog_position : "", /* binlog_pos */ incremental_lsn, /* innodb_from_lsn */ metadata_to_lsn, /* innodb_to_lsn */ (xtrabackup_tables /* partial */ || xtrabackup_tables_exclude || xtrabackup_tables_file || xtrabackup_databases || xtrabackup_databases_exclude || xtrabackup_databases_file) ? "Y" : "N", xtrabackup_incremental ? "Y" : "N", /* incremental */ xb_stream_format_name[xtrabackup_stream_fmt], /* format */ xtrabackup_compact ? "Y" : "N", /* compact */ xtrabackup_compress ? "compressed" : "N", /* compressed */ xtrabackup_encrypt ? "Y" : "N"); /* encrypted */ free(server_version); return result; }
0
254,877
Value DocumentSourceGroup::serialize(boost::optional<ExplainOptions::Verbosity> explain) const { MutableDocument insides; // Add the _id. if (_idFieldNames.empty()) { invariant(_idExpressions.size() == 1); insides["_id"] = _idExpressions[0]->serialize(static_cast<bool>(explain)); } else { // Decomposed document case. invariant(_idExpressions.size() == _idFieldNames.size()); MutableDocument md; for (size_t i = 0; i < _idExpressions.size(); i++) { md[_idFieldNames[i]] = _idExpressions[i]->serialize(static_cast<bool>(explain)); } insides["_id"] = md.freezeToValue(); } // Add the remaining fields. for (auto&& accumulatedField : _accumulatedFields) { intrusive_ptr<AccumulatorState> accum = accumulatedField.makeAccumulator(); insides[accumulatedField.fieldName] = Value(accum->serialize(accumulatedField.expr.initializer, accumulatedField.expr.argument, static_cast<bool>(explain))); } if (_doingMerge) { // This makes the output unparsable (with error) on pre 2.6 shards, but it will never // be sent to old shards when this flag is true since they can't do a merge anyway. insides["$doingMerge"] = Value(true); } return Value(DOC(getSourceName() << insides.freeze())); }
0
522,351
int my_aio_write(struct aiocb *aiocbp) { if( (MYFSEEK(aiocbp->aio_fildes, (off_t)aiocbp->aio_offset, SEEK_SET) == 0) && (fwrite(aiocbp->aio_buf, 1, aiocbp->aio_nbytes, aiocbp->aio_fildes) == aiocbp->aio_nbytes) ) { aiocbp->aio_lio_opcode = 0; } else { aiocbp->aio_lio_opcode = -1; } return(aiocbp->aio_lio_opcode); }
0
482,484
parseDots(const FileInfo *file, CharsString *cells, const CharsString *token) { /* get dot patterns */ widechar cell = 0; /* assembly place for dots */ int cellCount = 0; int index; int start = 0; for (index = 0; index < token->length; index++) { int started = index != start; widechar character = token->chars[index]; switch (character) { /* or dots to make up Braille cell */ { int dot; case '1': dot = LOU_DOT_1; goto haveDot; case '2': dot = LOU_DOT_2; goto haveDot; case '3': dot = LOU_DOT_3; goto haveDot; case '4': dot = LOU_DOT_4; goto haveDot; case '5': dot = LOU_DOT_5; goto haveDot; case '6': dot = LOU_DOT_6; goto haveDot; case '7': dot = LOU_DOT_7; goto haveDot; case '8': dot = LOU_DOT_8; goto haveDot; case '9': dot = LOU_DOT_9; goto haveDot; case 'a': case 'A': dot = LOU_DOT_10; goto haveDot; case 'b': case 'B': dot = LOU_DOT_11; goto haveDot; case 'c': case 'C': dot = LOU_DOT_12; goto haveDot; case 'd': case 'D': dot = LOU_DOT_13; goto haveDot; case 'e': case 'E': dot = LOU_DOT_14; goto haveDot; case 'f': case 'F': dot = LOU_DOT_15; haveDot: if (started && !cell) goto invalid; if (cell & dot) { compileError(file, "dot specified more than once."); return 0; } cell |= dot; break; } case '0': /* blank */ if (started) goto invalid; break; case '-': /* got all dots for this cell */ if (!started) { compileError(file, "missing cell specification."); return 0; } cells->chars[cellCount++] = cell | LOU_DOTS; cell = 0; start = index + 1; break; default: invalid: compileError( file, "invalid dot number %s.", _lou_showString(&character, 1, 0)); return 0; } } if (index == start) { compileError(file, "missing cell specification."); return 0; } cells->chars[cellCount++] = cell | LOU_DOTS; /* last cell */ cells->length = cellCount; return 1; }
0
294,672
m_min(union DateData *x) { if (simple_dat_p(x)) return 0; else { get_c_time(x); #ifndef USE_PACK return x->c.min; #else return EX_MIN(x->c.pc); #endif } }
0
310,179
reset_color_pairs(void) { NCURSES_SP_NAME(reset_color_pairs) (CURRENT_SCREEN); }
0
247,326
int pgpPubkeyKeyID(const uint8_t * pkt, size_t pktlen, pgpKeyID_t keyid) { struct pgpPkt p; if (decodePkt(pkt, pktlen, &p)) return -1; return getKeyID(p.body, p.blen, keyid); }
0
369,278
static unsigned int io_file_get_flags(struct file *file) { umode_t mode = file_inode(file)->i_mode; unsigned int res = 0; if (S_ISREG(mode)) res |= FFS_ISREG; if (__io_file_supports_nowait(file, mode)) res |= FFS_NOWAIT; return res; }
0
265,058
tsetcap(int cap, int flags) { if (tccan(cap) && !isset(SINGLELINEZLE) && !(termflags & (TERM_NOUP|TERM_BAD|TERM_UNKNOWN))) { switch (flags & TSC_OUTPUT_MASK) { case TSC_RAW: tputs(tcstr[cap], 1, putraw); break; case 0: default: tputs(tcstr[cap], 1, putshout); break; case TSC_PROMPT: if (!bv->dontcount) { addbufspc(1); *bv->bp++ = Inpar; } tputs(tcstr[cap], 1, putstr); if (!bv->dontcount) { int glitch = 0; if (cap == TCSTANDOUTBEG || cap == TCSTANDOUTEND) glitch = tgetnum("sg"); else if (cap == TCUNDERLINEBEG || cap == TCUNDERLINEEND) glitch = tgetnum("ug"); if(glitch < 0) glitch = 0; addbufspc(glitch + 1); while(glitch--) *bv->bp++ = Nularg; *bv->bp++ = Outpar; } break; } if (flags & TSC_DIRTY) { flags &= ~TSC_DIRTY; if (txtisset(TXTBOLDFACE) && cap != TCBOLDFACEBEG) tsetcap(TCBOLDFACEBEG, flags); if (txtisset(TXTSTANDOUT)) tsetcap(TCSTANDOUTBEG, flags); if (txtisset(TXTUNDERLINE)) tsetcap(TCUNDERLINEBEG, flags); if (txtisset(TXTFGCOLOUR)) set_colour_attribute(txtattrmask, COL_SEQ_FG, TSC_PROMPT); if (txtisset(TXTBGCOLOUR)) set_colour_attribute(txtattrmask, COL_SEQ_BG, TSC_PROMPT); } } }
0
502,727
void SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*cb) (SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)) { ctx->app_gen_cookie_cb = cb; }
0
203,622
con_insert_unipair(struct uni_pagedir *p, u_short unicode, u_short fontpos) { int i, n; u16 **p1, *p2; p1 = p->uni_pgdir[n = unicode >> 11]; if (!p1) { p1 = p->uni_pgdir[n] = kmalloc_array(32, sizeof(u16 *), GFP_KERNEL); if (!p1) return -ENOMEM; for (i = 0; i < 32; i++) p1[i] = NULL; } p2 = p1[n = (unicode >> 6) & 0x1f]; if (!p2) { p2 = p1[n] = kmalloc_array(64, sizeof(u16), GFP_KERNEL); if (!p2) { kfree(p1); p->uni_pgdir[n] = NULL; return -ENOMEM; } memset(p2, 0xff, 64*sizeof(u16)); /* No glyphs for the characters (yet) */ } p2[unicode & 0x3f] = fontpos; p->sum += (fontpos << 20) + unicode; return 0; }
1
294,532
date_s__iso8601(int argc, VALUE *argv, VALUE klass) { VALUE str, opt; rb_scan_args(argc, argv, "1:", &str, &opt); check_limit(str, opt); return date__iso8601(str); }
0
318,105
static int rsi_reset_card(struct rsi_hw *adapter) { int ret; rsi_dbg(INFO_ZONE, "Resetting Card...\n"); rsi_usb_master_reg_write(adapter, RSI_TA_HOLD_REG, 0xE, 4); /* This msleep will ensure Thread-Arch processor to go to hold * and any pending dma transfers to rf in device to finish. */ msleep(100); ret = rsi_usb_master_reg_write(adapter, SWBL_REGOUT, RSI_FW_WDT_DISABLE_REQ, RSI_COMMON_REG_SIZE); if (ret < 0) { rsi_dbg(ERR_ZONE, "Disabling firmware watchdog timer failed\n"); goto fail; } if (adapter->device_model != RSI_DEV_9116) { ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_1, RSI_ULP_WRITE_2, 32); if (ret < 0) goto fail; ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_2, RSI_ULP_WRITE_0, 32); if (ret < 0) goto fail; ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_DELAY_TIMER_1, RSI_ULP_WRITE_50, 32); if (ret < 0) goto fail; ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_DELAY_TIMER_2, RSI_ULP_WRITE_0, 32); if (ret < 0) goto fail; ret = usb_ulp_read_write(adapter, RSI_WATCH_DOG_TIMER_ENABLE, RSI_ULP_TIMER_ENABLE, 32); if (ret < 0) goto fail; } else { if ((rsi_usb_master_reg_write(adapter, NWP_WWD_INTERRUPT_TIMER, NWP_WWD_INT_TIMER_CLKS, RSI_9116_REG_SIZE)) < 0) { goto fail; } if ((rsi_usb_master_reg_write(adapter, NWP_WWD_SYSTEM_RESET_TIMER, NWP_WWD_SYS_RESET_TIMER_CLKS, RSI_9116_REG_SIZE)) < 0) { goto fail; } if ((rsi_usb_master_reg_write(adapter, NWP_WWD_MODE_AND_RSTART, NWP_WWD_TIMER_DISABLE, RSI_9116_REG_SIZE)) < 0) { goto fail; } } rsi_dbg(INFO_ZONE, "Reset card done\n"); return ret; fail: rsi_dbg(ERR_ZONE, "Reset card failed\n"); return ret; }
0
90,896
ClientUsageTracker* UsageTracker::GetClientTracker(QuotaClient::ID client_id) { ClientTrackerMap::iterator found = client_tracker_map_.find(client_id); if (found != client_tracker_map_.end()) return found->second; return NULL; }
0
221,641
LiteralString *hermes::evalToString(IRBuilder &builder, Literal *operand) { if (auto *str = llvh::dyn_cast<LiteralString>(operand)) return str; if (auto *num = llvh::dyn_cast<LiteralNumber>(operand)) { char buf[NUMBER_TO_STRING_BUF_SIZE]; auto len = numberToString(num->getValue(), buf, sizeof(buf)); return builder.getLiteralString(StringRef(buf, len)); } return nullptr; }
0
384,887
win_nolbr_chartabsize( win_T *wp, char_u *s, colnr_T col, int *headp) { int n; if (*s == TAB && (!wp->w_p_list || wp->w_lcs_chars.tab1)) { # ifdef FEAT_VARTABS return tabstop_padding(col, wp->w_buffer->b_p_ts, wp->w_buffer->b_p_vts_array); # else n = wp->w_buffer->b_p_ts; return (int)(n - (col % n)); # endif } n = ptr2cells(s); // Add one cell for a double-width character in the last column of the // window, displayed with a ">". if (n == 2 && MB_BYTE2LEN(*s) > 1 && in_win_border(wp, col)) { if (headp != NULL) *headp = 1; return 3; } return n; }
0
427,232
static void yindex (LexState *ls, expdesc *v) { /* index -> '[' expr ']' */ luaX_next(ls); /* skip the '[' */ expr(ls, v); luaK_exp2val(ls->fs, v); checknext(ls, ']'); }
0
513,282
bool JOIN::prepare_result(List<Item> **columns_list) { DBUG_ENTER("JOIN::prepare_result"); error= 0; /* Create result tables for materialized views. */ if (!zero_result_cause && select_lex->handle_derived(thd->lex, DT_CREATE)) goto err; if (result->prepare2()) goto err; if ((select_lex->options & OPTION_SCHEMA_TABLE) && get_schema_tables_result(this, PROCESSED_BY_JOIN_EXEC)) goto err; DBUG_RETURN(FALSE); err: error= 1; DBUG_RETURN(TRUE); }
0
313,771
nv_lineop(cmdarg_T *cap) { cap->oap->motion_type = MLINE; if (cursor_down(cap->count1 - 1L, cap->oap->op_type == OP_NOP) == FAIL) clearopbeep(cap->oap); else if ( (cap->oap->op_type == OP_DELETE // only with linewise motions && cap->oap->motion_force != 'v' && cap->oap->motion_force != Ctrl_V) || cap->oap->op_type == OP_LSHIFT || cap->oap->op_type == OP_RSHIFT) beginline(BL_SOL | BL_FIX); else if (cap->oap->op_type != OP_YANK) // 'Y' does not move cursor beginline(BL_WHITE | BL_FIX); }
0
417,473
virNodeDeviceCapMdevTypesFormat(virBufferPtr buf, virMediatedDeviceTypePtr *mdev_types, const size_t nmdev_types) { size_t i; if (nmdev_types > 0) { virBufferAddLit(buf, "<capability type='mdev_types'>\n"); virBufferAdjustIndent(buf, 2); for (i = 0; i < nmdev_types; i++) { virMediatedDeviceTypePtr type = mdev_types[i]; virBufferEscapeString(buf, "<type id='%s'>\n", type->id); virBufferAdjustIndent(buf, 2); if (type->name) virBufferEscapeString(buf, "<name>%s</name>\n", type->name); virBufferEscapeString(buf, "<deviceAPI>%s</deviceAPI>\n", type->device_api); virBufferAsprintf(buf, "<availableInstances>%u</availableInstances>\n", type->available_instances); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</type>\n"); } virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</capability>\n"); } }
0
492,677
vte_sequence_handler_ta (VteTerminal *terminal, GValueArray *params) { VteScreen *screen; long old_len, newcol, col; /* Calculate which column is the next tab stop. */ screen = terminal->pvt->screen; newcol = col = screen->cursor_current.col; g_assert (col >= 0); if (terminal->pvt->tabstops != NULL) { /* Find the next tabstop. */ for (newcol++; newcol < VTE_TAB_MAX; newcol++) { if (_vte_terminal_get_tabstop(terminal, newcol)) { break; } } } /* If we have no tab stops or went past the end of the line, stop * at the right-most column. */ if (newcol >= terminal->column_count) { newcol = terminal->column_count - 1; } /* but make sure we don't move cursor back (bug #340631) */ if (col < newcol) { VteRowData *rowdata = _vte_terminal_ensure_row (terminal); /* Smart tab handling: bug 353610 * * If we currently don't have any cells in the space this * tab creates, we try to make the tab character copyable, * by appending a single tab char with lots of fragment * cells following it. * * Otherwise, just append empty cells that will show up * as a space each. */ old_len = _vte_row_data_length (rowdata); _vte_row_data_fill (rowdata, &screen->fill_defaults, newcol); /* Insert smart tab if there's nothing in the line after * us. Though, there may be empty cells (with non-default * background color for example. * * Notable bugs here: 545924 and 597242 */ { glong i; gboolean found = FALSE; for (i = old_len; i > col; i--) { const VteCell *cell = _vte_row_data_get (rowdata, i - 1); if (cell->attr.fragment || cell->c != 0) { found = TRUE; break; } } /* Nothing found on the line after us, turn this into * a smart tab */ if (!found) { VteCell *cell = _vte_row_data_get_writable (rowdata, col); VteCell tab = *cell; tab.attr.columns = newcol - col; tab.c = '\t'; /* Check if it fits in columns */ if (tab.attr.columns == newcol - col) { /* Save tab char */ *cell = tab; /* And adjust the fragments */ for (i = col + 1; i < newcol; i++) { cell = _vte_row_data_get_writable (rowdata, i); cell->c = '\t'; cell->attr.columns = 1; cell->attr.fragment = 1; } } } } _vte_invalidate_cells (terminal, screen->cursor_current.col, newcol - screen->cursor_current.col, screen->cursor_current.row, 1); screen->cursor_current.col = newcol; } }
0
316,986
static int smk_bu_inode(struct inode *inode, int mode, int rc) { struct task_smack *tsp = smack_cred(current_cred()); struct inode_smack *isp = smack_inode(inode); char acc[SMK_NUM_ACCESS_TYPE + 1]; if (isp->smk_flags & SMK_INODE_IMPURE) pr_info("Smack Unconfined Corruption: inode=(%s %ld) %s\n", inode->i_sb->s_id, inode->i_ino, current->comm); if (rc <= 0) return rc; if (rc > SMACK_UNCONFINED_OBJECT) rc = 0; if (rc == SMACK_UNCONFINED_SUBJECT && (mode & (MAY_WRITE | MAY_APPEND))) isp->smk_flags |= SMK_INODE_IMPURE; smk_bu_mode(mode, acc); pr_info("Smack %s: (%s %s %s) inode=(%s %ld) %s\n", smk_bu_mess[rc], tsp->smk_task->smk_known, isp->smk_inode->smk_known, acc, inode->i_sb->s_id, inode->i_ino, current->comm); return 0; }
0
513,099
in_string::in_string(THD *thd, uint elements, qsort2_cmp cmp_func, CHARSET_INFO *cs) :in_vector(thd, elements, sizeof(String), cmp_func, cs), tmp(buff, sizeof(buff), &my_charset_bin) {}
0
275,970
static void mul2add(uECC_word_t a, uECC_word_t b, uECC_word_t *r0, uECC_word_t *r1, uECC_word_t *r2) { #if uECC_WORD_SIZE == 8 && !SUPPORTS_INT128 uint64_t a0 = a & 0xffffffffull; uint64_t a1 = a >> 32; uint64_t b0 = b & 0xffffffffull; uint64_t b1 = b >> 32; uint64_t i0 = a0 * b0; uint64_t i1 = a0 * b1; uint64_t i2 = a1 * b0; uint64_t i3 = a1 * b1; uint64_t p0, p1; i2 += (i0 >> 32); i2 += i1; if (i2 < i1) { /* overflow */ i3 += 0x100000000ull; } p0 = (i0 & 0xffffffffull) | (i2 << 32); p1 = i3 + (i2 >> 32); *r2 += (p1 >> 63); p1 = (p1 << 1) | (p0 >> 63); p0 <<= 1; *r0 += p0; *r1 += (p1 + (*r0 < p0)); *r2 += ((*r1 < p1) || (*r1 == p1 && *r0 < p0)); #else uECC_dword_t p = (uECC_dword_t)a * b; uECC_dword_t r01 = ((uECC_dword_t)(*r1) << uECC_WORD_BITS) | *r0; *r2 += (p >> (uECC_WORD_BITS * 2 - 1)); p *= 2; r01 += p; *r2 += (r01 < p); *r1 = r01 >> uECC_WORD_BITS; *r0 = (uECC_word_t)r01; #endif }
0
202,276
block_insert( oparg_T *oap, char_u *s, int b_insert, struct block_def *bdp) { int ts_val; int count = 0; // extra spaces to replace a cut TAB int spaces = 0; // non-zero if cutting a TAB colnr_T offset; // pointer along new line colnr_T startcol; // column where insert starts unsigned s_len; // STRLEN(s) char_u *newp, *oldp; // new, old lines linenr_T lnum; // loop var int oldstate = State; State = INSERT; // don't want REPLACE for State s_len = (unsigned)STRLEN(s); for (lnum = oap->start.lnum + 1; lnum <= oap->end.lnum; lnum++) { block_prep(oap, bdp, lnum, TRUE); if (bdp->is_short && b_insert) continue; // OP_INSERT, line ends before block start oldp = ml_get(lnum); if (b_insert) { ts_val = bdp->start_char_vcols; spaces = bdp->startspaces; if (spaces != 0) count = ts_val - 1; // we're cutting a TAB offset = bdp->textcol; } else // append { ts_val = bdp->end_char_vcols; if (!bdp->is_short) // spaces = padding after block { spaces = (bdp->endspaces ? ts_val - bdp->endspaces : 0); if (spaces != 0) count = ts_val - 1; // we're cutting a TAB offset = bdp->textcol + bdp->textlen - (spaces != 0); } else // spaces = padding to block edge { // if $ used, just append to EOL (ie spaces==0) if (!bdp->is_MAX) spaces = (oap->end_vcol - bdp->end_vcol) + 1; count = spaces; offset = bdp->textcol + bdp->textlen; } } if (has_mbyte && spaces > 0) { int off; // Avoid starting halfway a multi-byte character. if (b_insert) { off = (*mb_head_off)(oldp, oldp + offset + spaces); spaces -= off; count -= off; } else { // spaces fill the gap, the character that's at the edge moves // right off = (*mb_head_off)(oldp, oldp + offset); offset -= off; } } if (spaces < 0) // can happen when the cursor was moved spaces = 0; // Make sure the allocated size matches what is actually copied below. newp = alloc(STRLEN(oldp) + spaces + s_len + (spaces > 0 && !bdp->is_short ? ts_val - spaces : 0) + count + 1); if (newp == NULL) continue; // copy up to shifted part mch_memmove(newp, oldp, (size_t)offset); oldp += offset; // insert pre-padding vim_memset(newp + offset, ' ', (size_t)spaces); startcol = offset + spaces; // copy the new text mch_memmove(newp + startcol, s, (size_t)s_len); offset += s_len; if (spaces > 0 && !bdp->is_short) { if (*oldp == TAB) { // insert post-padding vim_memset(newp + offset + spaces, ' ', (size_t)(ts_val - spaces)); // we're splitting a TAB, don't copy it oldp++; // We allowed for that TAB, remember this now count++; } else // Not a TAB, no extra spaces count = spaces; } if (spaces > 0) offset += count; STRMOVE(newp + offset, oldp); ml_replace(lnum, newp, FALSE); if (b_insert) // correct any text properties inserted_bytes(lnum, startcol, s_len); if (lnum == oap->end.lnum) { // Set "']" mark to the end of the block instead of the end of // the insert in the first line. curbuf->b_op_end.lnum = oap->end.lnum; curbuf->b_op_end.col = offset; } } // for all lnum changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L); State = oldstate; }
1
229,286
cql_server::connection::process_query(uint16_t stream, request_reader in, service::client_state& client_state, service_permit permit, tracing::trace_state_ptr trace_state) { ++_server._stats.query_requests; return process(stream, in, client_state, std::move(permit), std::move(trace_state), process_query_internal); }
0
281,646
void CLASS canon_sraw_load_raw() { struct jhead jh; short *rp=0, (*ip)[4]; int jwide, slice, scol, ecol, row, col, jrow=0, jcol=0, pix[3], c; int v[3]={0,0,0}, ver, hue; char *cp; if (!ljpeg_start (&jh, 0) || jh.clrs < 4) return; jwide = (jh.wide >>= 1) * jh.clrs; #ifdef LIBRAW_LIBRARY_BUILD try { #endif for (ecol=slice=0; slice <= cr2_slice[0]; slice++) { scol = ecol; ecol += cr2_slice[1] * 2 / jh.clrs; if (!cr2_slice[0] || ecol > raw_width-1) ecol = raw_width & -2; for (row=0; row < height; row += (jh.clrs >> 1) - 1) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif ip = (short (*)[4]) image + row*width; for (col=scol; col < ecol; col+=2, jcol+=jh.clrs) { if ((jcol %= jwide) == 0) rp = (short *) ljpeg_row (jrow++, &jh); if (col >= width) continue; #ifdef LIBRAW_LIBRARY_BUILD if(imgdata.params.sraw_ycc>=2) { FORC (jh.clrs-2) { ip[col + (c >> 1)*width + (c & 1)][0] = rp[jcol+c]; ip[col + (c >> 1)*width + (c & 1)][1] = ip[col + (c >> 1)*width + (c & 1)][2] = 8192; } ip[col][1] = rp[jcol+jh.clrs-2] - 8192; ip[col][2] = rp[jcol+jh.clrs-1] - 8192; } else if(imgdata.params.sraw_ycc) { FORC (jh.clrs-2) ip[col + (c >> 1)*width + (c & 1)][0] = rp[jcol+c]; ip[col][1] = rp[jcol+jh.clrs-2] - 8192; ip[col][2] = rp[jcol+jh.clrs-1] - 8192; } else #endif { FORC (jh.clrs-2) ip[col + (c >> 1)*width + (c & 1)][0] = rp[jcol+c]; ip[col][1] = rp[jcol+jh.clrs-2] - 16384; ip[col][2] = rp[jcol+jh.clrs-1] - 16384; } } } } #ifdef LIBRAW_LIBRARY_BUILD } catch (...) { ljpeg_end (&jh); throw ; } #endif #ifdef LIBRAW_LIBRARY_BUILD if(imgdata.params.sraw_ycc>=2) { ljpeg_end (&jh); maximum = 0x3fff; return; } #endif #ifdef LIBRAW_LIBRARY_BUILD try { #endif for (cp=model2; *cp && !isdigit(*cp); cp++); sscanf (cp, "%d.%d.%d", v, v+1, v+2); ver = (v[0]*1000 + v[1])*1000 + v[2]; hue = (jh.sraw+1) << 2; if (unique_id >= 0x80000281 || (unique_id == 0x80000218 && ver > 1000006)) hue = jh.sraw << 1; ip = (short (*)[4]) image; rp = ip[0]; for (row=0; row < height; row++, ip+=width) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif if (row & (jh.sraw >> 1)) for (col=0; col < width; col+=2) for (c=1; c < 3; c++) if (row == height-1) ip[col][c] = ip[col-width][c]; else ip[col][c] = (ip[col-width][c] + ip[col+width][c] + 1) >> 1; for (col=1; col < width; col+=2) for (c=1; c < 3; c++) if (col == width-1) ip[col][c] = ip[col-1][c]; else ip[col][c] = (ip[col-1][c] + ip[col+1][c] + 1) >> 1; } #ifdef LIBRAW_LIBRARY_BUILD if(!imgdata.params.sraw_ycc) #endif for ( ; rp < ip[0]; rp+=4) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif if (unique_id == 0x80000218 || unique_id == 0x80000250 || unique_id == 0x80000261 || unique_id == 0x80000281 || unique_id == 0x80000287) { rp[1] = (rp[1] << 2) + hue; rp[2] = (rp[2] << 2) + hue; pix[0] = rp[0] + (( 50*rp[1] + 22929*rp[2]) >> 14); pix[1] = rp[0] + ((-5640*rp[1] - 11751*rp[2]) >> 14); pix[2] = rp[0] + ((29040*rp[1] - 101*rp[2]) >> 14); } else { if (unique_id < 0x80000218) rp[0] -= 512; pix[0] = rp[0] + rp[2]; pix[2] = rp[0] + rp[1]; pix[1] = rp[0] + ((-778*rp[1] - (rp[2] << 11)) >> 12); } FORC3 rp[c] = CLIP(pix[c] * sraw_mul[c] >> 10); } #ifdef LIBRAW_LIBRARY_BUILD } catch (...) { ljpeg_end (&jh); throw ; } #endif ljpeg_end (&jh); maximum = 0x3fff; }
0
244,317
GF_Box *lsrc_box_new() { ISOM_DECL_BOX_ALLOC(GF_LASERConfigurationBox, GF_ISOM_BOX_TYPE_LSRC); return (GF_Box *)tmp; }
0
336,140
static void ip6gre_tnl_parm_to_user(struct ip6_tnl_parm2 *u, const struct __ip6_tnl_parm *p) { u->proto = IPPROTO_GRE; u->laddr = p->laddr; u->raddr = p->raddr; u->flags = p->flags; u->hop_limit = p->hop_limit; u->encap_limit = p->encap_limit; u->flowinfo = p->flowinfo; u->link = p->link; u->i_key = p->i_key; u->o_key = p->o_key; u->i_flags = gre_tnl_flags_to_gre_flags(p->i_flags); u->o_flags = gre_tnl_flags_to_gre_flags(p->o_flags); memcpy(u->name, p->name, sizeof(u->name)); }
0
359,377
bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi, int *write) { int i; /* Unicast redistribution only. */ if (safi != SAFI_UNICAST) return 0; for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { /* Redistribute BGP does not make sense. */ if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP) { /* Display "address-family" when it is not yet diplayed. */ bgp_config_write_family_header (vty, afi, safi, write); /* "redistribute" configuration. */ vty_out (vty, " redistribute %s", zebra_route_string(i)); if (bgp->redist_metric_flag[afi][i]) vty_out (vty, " metric %d", bgp->redist_metric[afi][i]); if (bgp->rmap[afi][i].name) vty_out (vty, " route-map %s", bgp->rmap[afi][i].name); vty_out (vty, "%s", VTY_NEWLINE); } } return *write; }
0
343,273
void addreply_noformat(const int code, const char * const line) { if (code != 0) { replycode = code; } addreply_newline(line, strlen(line) + (size_t) 1U); }
0
521,480
~ZipInputStream() override { #if JUCE_DEBUG if (inputStream != nullptr && inputStream == file.inputStream) file.streamCounter.numOpenStreams--; #endif }
0
265,423
static int getLineToStop( const std::string &fulltext){ int lineNo=1; bool inString=false; for (unsigned int i=0; i<fulltext.length(); ++i) { // increase line number if (fulltext[i] == '\n') { lineNo++; continue; } // skip escaped quotes inside strings if (inString && fulltext.compare(i, 2, "\\\"") == 0) { i++; continue; } //start or end of string negate the checkpoint if (fulltext[i] == '"') { inString = !inString; continue; } if (!inString && fulltext.compare(i, 2, "//") == 0) { i++; while (fulltext[i] != '\n' && i<fulltext.length()) i++; lineNo++; continue; } //start of multi line comment if check is true if (!inString && fulltext.compare(i, 2, "/*") == 0) { i ++; if(i<fulltext.length()) { i++; } else { continue; } // till */ every character is comment while (fulltext.compare(i, 2, "*/") != 0 && i<fulltext.length()) { if(fulltext[i]=='\n'){ lineNo++; } i++; } } if (fulltext[i]== '{') { return lineNo; } } return lineNo; }
0
247,555
TEST_P(SslSocketTest, NoCert) { const std::string client_ctx_yaml = R"EOF( common_tls_context: )EOF"; const std::string server_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem" private_key: filename: "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem" )EOF"; TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, true, GetParam()); testUtil(test_options.setExpectedServerStats("ssl.no_certificate") .setExpectNoCert() .setExpectNoCertChain()); }
0
384,885
transstr(char_u *s) { char_u *res; char_u *p; int l, len, c; char_u hexbuf[11]; if (has_mbyte) { // Compute the length of the result, taking account of unprintable // multi-byte characters. len = 0; p = s; while (*p != NUL) { if ((l = (*mb_ptr2len)(p)) > 1) { c = (*mb_ptr2char)(p); p += l; if (vim_isprintc(c)) len += l; else { transchar_hex(hexbuf, c); len += (int)STRLEN(hexbuf); } } else { l = byte2cells(*p++); if (l > 0) len += l; else len += 4; // illegal byte sequence } } res = alloc(len + 1); } else res = alloc(vim_strsize(s) + 1); if (res != NULL) { *res = NUL; p = s; while (*p != NUL) { if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { c = (*mb_ptr2char)(p); if (vim_isprintc(c)) STRNCAT(res, p, l); // append printable multi-byte char else transchar_hex(res + STRLEN(res), c); p += l; } else STRCAT(res, transchar_byte(*p++)); } } return res; }
0
256,175
ALWAYS_INLINE Packet ConvertFourBfloat16ToFloat(const bfloat16* src) { return Eigen::internal::pload4bf16<Packet>( reinterpret_cast<const float*>(src)); }
0
291,849
static void rtrs_clt_path_up(struct rtrs_clt_path *clt_path) { struct rtrs_clt_sess *clt = clt_path->clt; int up; /* * We can fire RECONNECTED event only when all paths were * connected on rtrs_clt_open(), then each was disconnected * and the first one connected again. That's why this nasty * game with counter value. */ mutex_lock(&clt->paths_ev_mutex); up = ++clt->paths_up; /* * Here it is safe to access paths num directly since up counter * is greater than MAX_PATHS_NUM only while rtrs_clt_open() is * in progress, thus paths removals are impossible. */ if (up > MAX_PATHS_NUM && up == MAX_PATHS_NUM + clt->paths_num) clt->paths_up = clt->paths_num; else if (up == 1) clt->link_ev(clt->priv, RTRS_CLT_LINK_EV_RECONNECTED); mutex_unlock(&clt->paths_ev_mutex); /* Mark session as established */ clt_path->established = true; clt_path->reconnect_attempts = 0; clt_path->stats->reconnects.successful_cnt++; }
0
238,505
static bool check_ids(u32 old_id, u32 cur_id, struct bpf_id_pair *idmap) { unsigned int i; for (i = 0; i < BPF_ID_MAP_SIZE; i++) { if (!idmap[i].old) { /* Reached an empty slot; haven't seen this id before */ idmap[i].old = old_id; idmap[i].cur = cur_id; return true; } if (idmap[i].old == old_id) return idmap[i].cur == cur_id; } /* We ran out of idmap slots, which should be impossible */ WARN_ON_ONCE(1); return false; }
0
226,007
GF_Box *srpp_box_new() { ISOM_DECL_BOX_ALLOC(GF_SRTPProcessBox, GF_ISOM_BOX_TYPE_SRPP); return (GF_Box *)tmp; }
0
224,284
gopherStateFree(const CommCloseCbParams &params) { GopherStateData *gopherState = (GopherStateData *)params.data; // Assume that FwdState is monitoring and calls noteClosure(). See XXX about // Connection sharing with FwdState in gopherStart(). delete gopherState; }
0
247,115
Bool gf_filter_unclaim_opengl_provider(GF_Filter *filter, void *vout) { return GF_FALSE; }
0
310,337
_free_cached_dir(void *_d) { cached_dir_t *d; if (!_d) return; d = (cached_dir_t *)_d; cached_dir_decref(d); }
0
294,493
dt_lite_iso8601(int argc, VALUE *argv, VALUE self) { long n = 0; rb_check_arity(argc, 0, 1); if (argc >= 1) n = NUM2LONG(argv[0]); return rb_str_append(strftimev("%Y-%m-%d", self, set_tmx), iso8601_timediv(self, n)); }
0
276,982
virtual ~SampleReader() {}
0
489,135
sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *chunk = arg; struct sctp_chunk *asconf_ack = NULL; struct sctp_paramhdr *err_param = NULL; sctp_addiphdr_t *hdr; union sctp_addr_param *addr_param; __u32 serial; int length; if (!sctp_vtag_verify(chunk, asoc)) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(ep, asoc, type, arg, commands); } /* ADD-IP: Section 4.1.1 * This chunk MUST be sent in an authenticated way by using * the mechanism defined in [I-D.ietf-tsvwg-sctp-auth]. If this chunk * is received unauthenticated it MUST be silently discarded as * described in [I-D.ietf-tsvwg-sctp-auth]. */ if (!sctp_addip_noauth && !chunk->auth) return sctp_sf_discard_chunk(ep, asoc, type, arg, commands); /* Make sure that the ASCONF ADDIP chunk has a valid length. */ if (!sctp_chunk_length_valid(chunk, sizeof(sctp_addip_chunk_t))) return sctp_sf_violation_chunklen(ep, asoc, type, arg, commands); hdr = (sctp_addiphdr_t *)chunk->skb->data; serial = ntohl(hdr->serial); addr_param = (union sctp_addr_param *)hdr->params; length = ntohs(addr_param->p.length); if (length < sizeof(sctp_paramhdr_t)) return sctp_sf_violation_paramlen(ep, asoc, type, arg, (void *)addr_param, commands); /* Verify the ASCONF chunk before processing it. */ if (!sctp_verify_asconf(asoc, (sctp_paramhdr_t *)((void *)addr_param + length), (void *)chunk->chunk_end, &err_param)) return sctp_sf_violation_paramlen(ep, asoc, type, arg, (void *)err_param, commands); /* ADDIP 5.2 E1) Compare the value of the serial number to the value * the endpoint stored in a new association variable * 'Peer-Serial-Number'. */ if (serial == asoc->peer.addip_serial + 1) { /* If this is the first instance of ASCONF in the packet, * we can clean our old ASCONF-ACKs. */ if (!chunk->has_asconf) sctp_assoc_clean_asconf_ack_cache(asoc); /* ADDIP 5.2 E4) When the Sequence Number matches the next one * expected, process the ASCONF as described below and after * processing the ASCONF Chunk, append an ASCONF-ACK Chunk to * the response packet and cache a copy of it (in the event it * later needs to be retransmitted). * * Essentially, do V1-V5. */ asconf_ack = sctp_process_asconf((struct sctp_association *) asoc, chunk); if (!asconf_ack) return SCTP_DISPOSITION_NOMEM; } else if (serial < asoc->peer.addip_serial + 1) { /* ADDIP 5.2 E2) * If the value found in the Sequence Number is less than the * ('Peer- Sequence-Number' + 1), simply skip to the next * ASCONF, and include in the outbound response packet * any previously cached ASCONF-ACK response that was * sent and saved that matches the Sequence Number of the * ASCONF. Note: It is possible that no cached ASCONF-ACK * Chunk exists. This will occur when an older ASCONF * arrives out of order. In such a case, the receiver * should skip the ASCONF Chunk and not include ASCONF-ACK * Chunk for that chunk. */ asconf_ack = sctp_assoc_lookup_asconf_ack(asoc, hdr->serial); if (!asconf_ack) return SCTP_DISPOSITION_DISCARD; } else { /* ADDIP 5.2 E5) Otherwise, the ASCONF Chunk is discarded since * it must be either a stale packet or from an attacker. */ return SCTP_DISPOSITION_DISCARD; } /* ADDIP 5.2 E6) The destination address of the SCTP packet * containing the ASCONF-ACK Chunks MUST be the source address of * the SCTP packet that held the ASCONF Chunks. * * To do this properly, we'll set the destination address of the chunk * and at the transmit time, will try look up the transport to use. * Since ASCONFs may be bundled, the correct transport may not be * created untill we process the entire packet, thus this workaround. */ asconf_ack->dest = chunk->source; sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(asconf_ack)); return SCTP_DISPOSITION_CONSUME; }
0
294,416
check_numeric(VALUE obj, const char* field) { if(!RTEST(rb_obj_is_kind_of(obj, rb_cNumeric))) { rb_raise(rb_eTypeError, "invalid %s (not numeric)", field); } }
0
226,377
GF_Err fpar_box_read(GF_Box *s, GF_BitStream *bs) { u32 i; GF_Err e; FilePartitionBox *ptr = (FilePartitionBox *)s; ISOM_DECREASE_SIZE(ptr, ((ptr->version ? 4 : 2) + 12) ); ptr->itemID = gf_bs_read_int(bs, ptr->version ? 32 : 16); ptr->packet_payload_size = gf_bs_read_u16(bs); gf_bs_read_u8(bs); ptr->FEC_encoding_ID = gf_bs_read_u8(bs); ptr->FEC_instance_ID = gf_bs_read_u16(bs); ptr->max_source_block_length = gf_bs_read_u16(bs); ptr->encoding_symbol_length = gf_bs_read_u16(bs); ptr->max_number_of_encoding_symbols = gf_bs_read_u16(bs); e = gf_isom_read_null_terminated_string(s, bs, ptr->size, &ptr->scheme_specific_info); if (e) return e; ISOM_DECREASE_SIZE(ptr, (ptr->version ? 4 : 2) ); ptr->nb_entries = gf_bs_read_int(bs, ptr->version ? 32 : 16); if (ptr->nb_entries > ptr->size / 6 || (u64)ptr->nb_entries > (u64)SIZE_MAX/sizeof(FilePartitionEntry)) return GF_ISOM_INVALID_FILE; ISOM_DECREASE_SIZE(ptr, ptr->nb_entries * 6 ); GF_SAFE_ALLOC_N(ptr->entries, ptr->nb_entries, FilePartitionEntry); if (!ptr->entries) return GF_OUT_OF_MEM; for (i=0;i < ptr->nb_entries; i++) { ptr->entries[i].block_count = gf_bs_read_u16(bs); ptr->entries[i].block_size = gf_bs_read_u32(bs); } return GF_OK;
0
310,057
safe_strdup(const char *value) { if (value == NULL) value = ""; return strdup(value); }
0
336,522
static void reds_disconnect(RedsState *reds) { spice_debug("trace"); for (auto client: reds->clients) { reds_client_disconnect(reds, client); } reds_mig_cleanup(reds); }
0
448,931
static unsigned long mmap_rnd(void) { unsigned long rnd = 0; if (current->flags & PF_RANDOMIZE) rnd = (long)get_random_int() & STACK_RND_MASK; return rnd << PAGE_SHIFT; }
0
219,031
string ConstantFolding::OptimizedNodeName(const NodeDef& node, StringPiece suffix) const { return AddPrefixToNodeName(strings::StrCat(node.name(), suffix), kConstantFoldingConst); }
0
220,831
gemmlowp::FixedPoint<tRawType, tIntegerBits> SaturatingAddNonGemmlowp( gemmlowp::FixedPoint<tRawType, tIntegerBits> a, gemmlowp::FixedPoint<tRawType, tIntegerBits> b) { return gemmlowp::FixedPoint<tRawType, tIntegerBits>::FromRaw( SaturatingAddNonGemmlowp(a.raw(), b.raw())); }
0
452,256
PHP_FUNCTION(xsl_xsltprocessor_register_php_functions) { zval *id; xsl_object *intern; zval *array_value, **entry, *new_string; int name_len = 0; char *name; DOM_GET_THIS(id); if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "a", &array_value) == SUCCESS) { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); zend_hash_internal_pointer_reset(Z_ARRVAL_P(array_value)); while (zend_hash_get_current_data(Z_ARRVAL_P(array_value), (void **)&entry) == SUCCESS) { SEPARATE_ZVAL(entry); convert_to_string_ex(entry); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry) + 1, &new_string, sizeof(zval*), NULL); zend_hash_move_forward(Z_ARRVAL_P(array_value)); } intern->registerPhpFunctions = 2; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == SUCCESS) { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); MAKE_STD_ZVAL(new_string); ZVAL_LONG(new_string,1); zend_hash_update(intern->registered_phpfunctions, name, name_len + 1, &new_string, sizeof(zval*), NULL); intern->registerPhpFunctions = 2; } else { intern = (xsl_object *)zend_object_store_get_object(id TSRMLS_CC); intern->registerPhpFunctions = 1; } }
0
247,762
void InvertibleRWFunction::BERDecode(BufferedTransformation &bt) { BERSequenceDecoder seq(bt); m_n.BERDecode(seq); m_p.BERDecode(seq); m_q.BERDecode(seq); m_u.BERDecode(seq); seq.MessageEnd(); }
0
90,897
void UsageTracker::GetGlobalUsage(GlobalUsageCallback* callback) { if (client_tracker_map_.size() == 0) { callback->Run(type_, 0, 0); delete callback; return; } if (global_usage_callbacks_.Add(callback)) { global_usage_.pending_clients = client_tracker_map_.size(); global_usage_.usage = 0; global_usage_.unlimited_usage = 0; for (ClientTrackerMap::iterator iter = client_tracker_map_.begin(); iter != client_tracker_map_.end(); ++iter) { iter->second->GetGlobalUsage(callback_factory_.NewCallback( &UsageTracker::DidGetClientGlobalUsage)); } } }
0
225,771
GF_Err strk_on_child_box(GF_Box *s, GF_Box *a, Bool is_rem) { GF_SubTrackBox *ptr = (GF_SubTrackBox *)s; if (!a) return GF_OK; switch (a->type) { case GF_ISOM_BOX_TYPE_STRI: BOX_FIELD_ASSIGN(info, GF_SubTrackInformationBox) return GF_OK; case GF_ISOM_BOX_TYPE_STRD: BOX_FIELD_ASSIGN(strd, GF_Box) return GF_OK; } return GF_OK;
0
452,995
nft_fwd_select_ops(const struct nft_ctx *ctx, const struct nlattr * const tb[]) { if (tb[NFTA_FWD_SREG_ADDR]) return &nft_fwd_neigh_netdev_ops; if (tb[NFTA_FWD_SREG_DEV]) return &nft_fwd_netdev_ops; return ERR_PTR(-EOPNOTSUPP); }
0
262,004
Curl_conncache_find_bundle(struct Curl_easy *data, struct connectdata *conn, struct conncache *connc, const char **hostp) { struct connectbundle *bundle = NULL; CONNCACHE_LOCK(data); if(connc) { char key[HASHKEY_SIZE]; hashkey(conn, key, sizeof(key), hostp); bundle = Curl_hash_pick(&connc->hash, key, strlen(key)); } return bundle; }
0
220,803
explicit RaggedCount(OpKernelConstruction* context) : OpKernel(context) { OP_REQUIRES_OK(context, context->GetAttr("minlength", &minlength_)); OP_REQUIRES_OK(context, context->GetAttr("maxlength", &maxlength_)); OP_REQUIRES_OK(context, context->GetAttr("binary_output", &binary_output_)); }
0
336,567
static void reds_mig_target_client_add(RedsState *reds, RedClient *client) { RedsMigTargetClient *mig_client; g_return_if_fail(reds); spice_debug("trace"); mig_client = g_new0(RedsMigTargetClient, 1); mig_client->client = client; reds->mig_target_clients = g_list_append(reds->mig_target_clients, mig_client); }
0
267,354
parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case OPTION_CONSOLE_SOCKET: exec_options.console_socket = arg; break; case OPTION_PID_FILE: exec_options.pid_file = arg; break; case OPTION_NO_NEW_PRIVS: exec_options.no_new_privs = true; break; case OPTION_PROCESS_LABEL: exec_options.process_label = argp_mandatory_argument (arg, state); break; case OPTION_APPARMOR: exec_options.apparmor = argp_mandatory_argument (arg, state); break; case OPTION_PRESERVE_FDS: exec_options.preserve_fds = strtoul (argp_mandatory_argument (arg, state), NULL, 10); break; case OPTION_CGROUP: exec_options.cgroup = argp_mandatory_argument (arg, state); break; case 'd': exec_options.detach = true; break; case 'p': exec_options.process = arg; break; case 't': exec_options.tty = arg == NULL || (strcmp (arg, "false") != 0 && strcmp (arg, "no") != 0); break; case 'u': exec_options.user = arg; break; case 'e': append_env (arg); break; case 'c': append_cap (arg); break; case OPTION_CWD: exec_options.cwd = xstrdup (arg); break; case ARGP_KEY_NO_ARGS: libcrun_fail_with_error (0, "please specify a ID for the container"); default: return ARGP_ERR_UNKNOWN; } return 0; }
0
405,385
static int xfrm_policy_addr_delta(const xfrm_address_t *a, const xfrm_address_t *b, u8 prefixlen, u16 family) { u32 ma, mb, mask; unsigned int pdw, pbi; int delta = 0; switch (family) { case AF_INET: if (prefixlen == 0) return 0; mask = ~0U << (32 - prefixlen); ma = ntohl(a->a4) & mask; mb = ntohl(b->a4) & mask; if (ma < mb) delta = -1; else if (ma > mb) delta = 1; break; case AF_INET6: pdw = prefixlen >> 5; pbi = prefixlen & 0x1f; if (pdw) { delta = memcmp(a->a6, b->a6, pdw << 2); if (delta) return delta; } if (pbi) { mask = ~0U << (32 - pbi); ma = ntohl(a->a6[pdw]) & mask; mb = ntohl(b->a6[pdw]) & mask; if (ma < mb) delta = -1; else if (ma > mb) delta = 1; } break; default: break; } return delta; }
0
224,468
static Bool ttml_check_range(TTMLInterval *interval, s64 ts_begin, s64 ts_end) { //if in current interval, push node if ((ts_begin != -1) && (ts_end != -1) && ((ts_begin>=interval->begin) && (ts_end<=interval->end)) ) { return GF_TRUE; } //begin not set, end set: in range if end less than interval end range else if ((ts_begin==-1) && (ts_end != -1) && (ts_end<=interval->end)) { return GF_TRUE; } //begin set, end not set: in range if begin greater than interval begin range else if ((ts_begin!=-1) && (ts_end==-1) && (ts_begin>=interval->begin)) { return GF_TRUE; } return GF_FALSE; }
0
373,549
OVS_REQUIRES(ipf->ipf_lock) { bool duped_frag = ipf_is_frag_duped(ipf_list->frag_list, ipf_list->last_inuse_idx, start_data_byte, end_data_byte); int last_inuse_idx = ipf_list->last_inuse_idx; if (!duped_frag) { if (last_inuse_idx < ipf_list->size - 1) { /* In the case of dpdk, it would be unfortunate if we had * to create a clone fragment outside the dpdk mp due to the * mempool size being too limited. We will otherwise need to * recommend not setting the mempool number of buffers too low * and also clamp the number of fragments. */ struct ipf_frag *frag = &ipf_list->frag_list[last_inuse_idx + 1]; frag->pkt = dp_packet_clone(pkt); frag->start_data_byte = start_data_byte; frag->end_data_byte = end_data_byte; ipf_list->last_inuse_idx++; atomic_count_inc(&ipf->nfrag); ipf_count(ipf, v6, IPF_NFRAGS_ACCEPTED); ipf_list_state_transition(ipf, ipf_list, ff, lf, v6); } else { OVS_NOT_REACHED(); } } else { ipf_count(ipf, v6, IPF_NFRAGS_OVERLAP); pkt->md.ct_state = CS_INVALID; return false; } return true; }
0
307,830
bool ciEnv::check_klass_accessibility(ciKlass* accessing_klass, Klass* resolved_klass) { if (accessing_klass == NULL || !accessing_klass->is_loaded()) { return true; } if (accessing_klass->is_obj_array_klass()) { accessing_klass = accessing_klass->as_obj_array_klass()->base_element_klass(); } if (!accessing_klass->is_instance_klass()) { return true; } if (resolved_klass->oop_is_objArray()) { // Find the element klass, if this is an array. resolved_klass = ObjArrayKlass::cast(resolved_klass)->bottom_klass(); } if (resolved_klass->oop_is_instance()) { return Reflection::verify_class_access(accessing_klass->get_Klass(), resolved_klass, true); } return true; }
0
247,578
void testUtilV2(const TestUtilOptionsV2& options) { Event::SimulatedTimeSystem time_system; ContextManagerImpl manager(*time_system); // SNI-based selection logic isn't happening in SslSocket anymore. ASSERT(options.listener().filter_chains().size() == 1); const auto& filter_chain = options.listener().filter_chains(0); std::vector<std::string> server_names(filter_chain.filter_chain_match().server_names().begin(), filter_chain.filter_chain_match().server_names().end()); Stats::TestUtil::TestStore server_stats_store; Api::ApiPtr server_api = Api::createApiForTest(server_stats_store, time_system); testing::NiceMock<Server::Configuration::MockTransportSocketFactoryContext> server_factory_context; NiceMock<Runtime::MockLoader> runtime; ON_CALL(server_factory_context, api()).WillByDefault(ReturnRef(*server_api)); envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context; const envoy::config::core::v3::TransportSocket& transport_socket = filter_chain.transport_socket(); ASSERT(transport_socket.has_typed_config()); transport_socket.typed_config().UnpackTo(&tls_context); auto server_cfg = std::make_unique<ServerContextConfigImpl>(tls_context, server_factory_context); ServerSslSocketFactory server_ssl_socket_factory(std::move(server_cfg), manager, server_stats_store, server_names); EXPECT_FALSE(server_ssl_socket_factory.usesProxyProtocolOptions()); Event::DispatcherPtr dispatcher(server_api->allocateDispatcher("test_thread")); auto socket = std::make_shared<Network::Test::TcpListenSocketImmediateListen>( Network::Test::getCanonicalLoopbackAddress(options.version())); NiceMock<Network::MockTcpListenerCallbacks> callbacks; Network::ListenerPtr listener = dispatcher->createListener(socket, callbacks, runtime, true, false); Stats::TestUtil::TestStore client_stats_store; Api::ApiPtr client_api = Api::createApiForTest(client_stats_store, time_system); testing::NiceMock<Server::Configuration::MockTransportSocketFactoryContext> client_factory_context; ON_CALL(client_factory_context, api()).WillByDefault(ReturnRef(*client_api)); auto client_cfg = std::make_unique<ClientContextConfigImpl>(options.clientCtxProto(), client_factory_context); ClientSslSocketFactory client_ssl_socket_factory(std::move(client_cfg), manager, client_stats_store); Network::ClientConnectionPtr client_connection = dispatcher->createClientConnection( socket->connectionInfoProvider().localAddress(), Network::Address::InstanceConstSharedPtr(), client_ssl_socket_factory.createTransportSocket(options.transportSocketOptions()), nullptr); if (!options.clientSession().empty()) { const SslHandshakerImpl* ssl_socket = dynamic_cast<const SslHandshakerImpl*>(client_connection->ssl().get()); SSL* client_ssl_socket = ssl_socket->ssl(); SSL_CTX* client_ssl_context = SSL_get_SSL_CTX(client_ssl_socket); SSL_SESSION* client_ssl_session = SSL_SESSION_from_bytes(reinterpret_cast<const uint8_t*>(options.clientSession().data()), options.clientSession().size(), client_ssl_context); int rc = SSL_set_session(client_ssl_socket, client_ssl_session); ASSERT(rc == 1); SSL_SESSION_free(client_ssl_session); } Network::ConnectionPtr server_connection; Network::MockConnectionCallbacks server_connection_callbacks; NiceMock<StreamInfo::MockStreamInfo> stream_info; EXPECT_CALL(callbacks, onAccept_(_)) .WillOnce(Invoke([&](Network::ConnectionSocketPtr& socket) -> void { std::string sni = options.transportSocketOptions() != nullptr && options.transportSocketOptions()->serverNameOverride().has_value() ? options.transportSocketOptions()->serverNameOverride().value() : options.clientCtxProto().sni(); socket->setRequestedServerName(sni); Network::TransportSocketPtr transport_socket = server_ssl_socket_factory.createTransportSocket(nullptr); EXPECT_FALSE(transport_socket->startSecureTransport()); server_connection = dispatcher->createServerConnection( std::move(socket), std::move(transport_socket), stream_info); server_connection->addConnectionCallbacks(server_connection_callbacks); })); Network::MockConnectionCallbacks client_connection_callbacks; client_connection->addConnectionCallbacks(client_connection_callbacks); client_connection->connect(); size_t connect_count = 0; auto connect_second_time = [&]() { if (++connect_count == 2) { if (!options.expectedServerCertDigest().empty()) { EXPECT_EQ(options.expectedServerCertDigest(), client_connection->ssl()->sha256PeerCertificateDigest()); } if (!options.expectedALPNProtocol().empty()) { EXPECT_EQ(options.expectedALPNProtocol(), client_connection->nextProtocol()); } EXPECT_EQ(options.expectedClientCertUri(), server_connection->ssl()->uriSanPeerCertificate()); const SslHandshakerImpl* ssl_socket = dynamic_cast<const SslHandshakerImpl*>(client_connection->ssl().get()); SSL* client_ssl_socket = ssl_socket->ssl(); if (!options.expectedProtocolVersion().empty()) { // Assert twice to ensure a cached value is returned and still valid. EXPECT_EQ(options.expectedProtocolVersion(), client_connection->ssl()->tlsVersion()); EXPECT_EQ(options.expectedProtocolVersion(), client_connection->ssl()->tlsVersion()); } if (!options.expectedCiphersuite().empty()) { EXPECT_EQ(options.expectedCiphersuite(), client_connection->ssl()->ciphersuiteString()); const SSL_CIPHER* cipher = SSL_get_cipher_by_value(client_connection->ssl()->ciphersuiteId()); EXPECT_NE(nullptr, cipher); EXPECT_EQ(options.expectedCiphersuite(), SSL_CIPHER_get_name(cipher)); } absl::optional<std::string> server_ssl_requested_server_name; const SslHandshakerImpl* server_ssl_socket = dynamic_cast<const SslHandshakerImpl*>(server_connection->ssl().get()); SSL* server_ssl = server_ssl_socket->ssl(); auto requested_server_name = SSL_get_servername(server_ssl, TLSEXT_NAMETYPE_host_name); if (requested_server_name != nullptr) { server_ssl_requested_server_name = std::string(requested_server_name); } if (!options.expectedRequestedServerName().empty()) { EXPECT_TRUE(server_ssl_requested_server_name.has_value()); EXPECT_EQ(options.expectedRequestedServerName(), server_ssl_requested_server_name.value()); } else { EXPECT_FALSE(server_ssl_requested_server_name.has_value()); } const uint16_t tls_version = SSL_version(client_ssl_socket); if (SSL3_VERSION <= tls_version && tls_version <= TLS1_2_VERSION) { // Prior to TLS 1.3, one should be able to resume the session. With TLS // 1.3, tickets come after the handshake and the SSL_SESSION on the // client is a dummy object. SSL_SESSION* client_ssl_session = SSL_get_session(client_ssl_socket); EXPECT_TRUE(SSL_SESSION_is_resumable(client_ssl_session)); } server_connection->close(Network::ConnectionCloseType::NoFlush); client_connection->close(Network::ConnectionCloseType::NoFlush); dispatcher->exit(); } }; size_t close_count = 0; auto close_second_time = [&close_count, &dispatcher]() { if (++close_count == 2) { dispatcher->exit(); } }; if (options.expectSuccess()) { EXPECT_CALL(client_connection_callbacks, onEvent(Network::ConnectionEvent::Connected)) .WillOnce(Invoke([&](Network::ConnectionEvent) -> void { connect_second_time(); })); EXPECT_CALL(server_connection_callbacks, onEvent(Network::ConnectionEvent::Connected)) .WillOnce(Invoke([&](Network::ConnectionEvent) -> void { EXPECT_EQ(options.expectedRequestedServerName(), server_connection->requestedServerName()); connect_second_time(); })); EXPECT_CALL(client_connection_callbacks, onEvent(Network::ConnectionEvent::LocalClose)); EXPECT_CALL(server_connection_callbacks, onEvent(Network::ConnectionEvent::LocalClose)); } else { EXPECT_CALL(client_connection_callbacks, onEvent(Network::ConnectionEvent::RemoteClose)) .WillOnce(Invoke([&](Network::ConnectionEvent) -> void { close_second_time(); })); EXPECT_CALL(server_connection_callbacks, onEvent(Network::ConnectionEvent::RemoteClose)) .WillOnce(Invoke([&](Network::ConnectionEvent) -> void { close_second_time(); })); } dispatcher->run(Event::Dispatcher::RunType::Block); if (!options.expectedServerStats().empty()) { EXPECT_EQ(1UL, server_stats_store.counter(options.expectedServerStats()).value()) << options.expectedServerStats(); } if (!options.expectedClientStats().empty()) { EXPECT_EQ(1UL, client_stats_store.counter(options.expectedClientStats()).value()); } if (options.expectSuccess()) { EXPECT_EQ("", client_connection->transportFailureReason()); EXPECT_EQ("", server_connection->transportFailureReason()); } else { EXPECT_THAT(std::string(client_connection->transportFailureReason()), ContainsRegex(options.expectedTransportFailureReasonContains())); EXPECT_NE("", server_connection->transportFailureReason()); } }
0
317,199
static void selinux_bprm_committed_creds(struct linux_binprm *bprm) { const struct task_security_struct *tsec = selinux_cred(current_cred()); u32 osid, sid; int rc; osid = tsec->osid; sid = tsec->sid; if (sid == osid) return; /* Check whether the new SID can inherit signal state from the old SID. * If not, clear itimers to avoid subsequent signal generation and * flush and unblock signals. * * This must occur _after_ the task SID has been updated so that any * kill done after the flush will be checked against the new SID. */ rc = avc_has_perm(&selinux_state, osid, sid, SECCLASS_PROCESS, PROCESS__SIGINH, NULL); if (rc) { clear_itimer(); spin_lock_irq(&current->sighand->siglock); if (!fatal_signal_pending(current)) { flush_sigqueue(&current->pending); flush_sigqueue(&current->signal->shared_pending); flush_signal_handlers(current, 1); sigemptyset(&current->blocked); recalc_sigpending(); } spin_unlock_irq(&current->sighand->siglock); } /* Wake up the parent if it is waiting so that it can recheck * wait permission to the new task SID. */ read_lock(&tasklist_lock); __wake_up_parent(current, current->real_parent); read_unlock(&tasklist_lock); }
0
202,822
search_impl(i_ctx_t *i_ctx_p, bool forward) { os_ptr op = osp; os_ptr op1 = op - 1; uint size = r_size(op); uint count; byte *pat; byte *ptr; byte ch; int incr = forward ? 1 : -1; check_read_type(*op1, t_string); check_read_type(*op, t_string); if (size > r_size(op1)) { /* can't match */ make_false(op); return 0; } count = r_size(op1) - size; ptr = op1->value.bytes; if (size == 0) goto found; if (!forward) ptr += count; pat = op->value.bytes; ch = pat[0]; do { if (*ptr == ch && (size == 1 || !memcmp(ptr, pat, size))) goto found; ptr += incr; } while (count--); /* No match */ make_false(op); return 0; found: op->tas.type_attrs = op1->tas.type_attrs; op->value.bytes = ptr; r_set_size(op, size); push(2); op[-1] = *op1; r_set_size(op - 1, ptr - op[-1].value.bytes); op1->value.bytes = ptr + size; r_set_size(op1, count + (!forward ? (size - 1) : 0)); make_true(op); return 0; }
1
355,629
eval_index( char_u **arg, typval_T *rettv, evalarg_T *evalarg, int verbose) // give error messages { int evaluate = evalarg != NULL && (evalarg->eval_flags & EVAL_EVALUATE); int empty1 = FALSE, empty2 = FALSE; typval_T var1, var2; int range = FALSE; char_u *key = NULL; int keylen = -1; int vim9 = in_vim9script(); if (check_can_index(rettv, evaluate, verbose) == FAIL) return FAIL; init_tv(&var1); init_tv(&var2); if (**arg == '.') { /* * dict.name */ key = *arg + 1; for (keylen = 0; eval_isdictc(key[keylen]); ++keylen) ; if (keylen == 0) return FAIL; *arg = key + keylen; } else { /* * something[idx] * * Get the (first) variable from inside the []. */ *arg = skipwhite_and_linebreak(*arg + 1, evalarg); if (**arg == ':') empty1 = TRUE; else if (eval1(arg, &var1, evalarg) == FAIL) // recursive! return FAIL; else if (vim9 && **arg == ':') { semsg(_(e_white_space_required_before_and_after_str_at_str), ":", *arg); clear_tv(&var1); return FAIL; } else if (evaluate) { int error = FALSE; #ifdef FEAT_FLOAT // allow for indexing with float if (vim9 && rettv->v_type == VAR_DICT && var1.v_type == VAR_FLOAT) { var1.vval.v_string = typval_tostring(&var1, TRUE); var1.v_type = VAR_STRING; } #endif if (vim9 && rettv->v_type == VAR_LIST) tv_get_number_chk(&var1, &error); else error = tv_get_string_chk(&var1) == NULL; if (error) { // not a number or string clear_tv(&var1); return FAIL; } } /* * Get the second variable from inside the [:]. */ *arg = skipwhite_and_linebreak(*arg, evalarg); if (**arg == ':') { range = TRUE; ++*arg; if (vim9 && !IS_WHITE_OR_NUL(**arg) && **arg != ']') { semsg(_(e_white_space_required_before_and_after_str_at_str), ":", *arg - 1); if (!empty1) clear_tv(&var1); return FAIL; } *arg = skipwhite_and_linebreak(*arg, evalarg); if (**arg == ']') empty2 = TRUE; else if (eval1(arg, &var2, evalarg) == FAIL) // recursive! { if (!empty1) clear_tv(&var1); return FAIL; } else if (evaluate && tv_get_string_chk(&var2) == NULL) { // not a number or string if (!empty1) clear_tv(&var1); clear_tv(&var2); return FAIL; } } // Check for the ']'. *arg = skipwhite_and_linebreak(*arg, evalarg); if (**arg != ']') { if (verbose) emsg(_(e_missing_closing_square_brace)); clear_tv(&var1); if (range) clear_tv(&var2); return FAIL; } *arg = *arg + 1; // skip over the ']' } if (evaluate) { int res = eval_index_inner(rettv, range, empty1 ? NULL : &var1, empty2 ? NULL : &var2, FALSE, key, keylen, verbose); if (!empty1) clear_tv(&var1); if (range) clear_tv(&var2); return res; } return OK; }
0
226,148
GF_Err smhd_box_write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_SoundMediaHeaderBox *ptr = (GF_SoundMediaHeaderBox *)s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u16(bs, ptr->balance); gf_bs_write_u16(bs, ptr->reserved); return GF_OK; }
0
387,637
static int snd_ctl_dev_register(struct snd_device *device) { struct snd_card *card = device->device_data; struct snd_ctl_layer_ops *lops; int err; err = snd_register_device(SNDRV_DEVICE_TYPE_CONTROL, card, -1, &snd_ctl_f_ops, card, &card->ctl_dev); if (err < 0) return err; down_read(&card->controls_rwsem); down_read(&snd_ctl_layer_rwsem); for (lops = snd_ctl_layer; lops; lops = lops->next) lops->lregister(card); up_read(&snd_ctl_layer_rwsem); up_read(&card->controls_rwsem); return 0; }
0
517,428
static void doGet(HttpRequest req, HttpResponse res) { set_content_type(res, "text/html"); if (ACTION(HOME)) { LOCK(Run.mutex) do_home(res); END_LOCK; } else if (ACTION(RUNTIME)) { handle_runtime(req, res); } else if (ACTION(TEST)) { is_monit_running(res); } else if (ACTION(ABOUT)) { do_about(res); } else if (ACTION(FAVICON)) { printFavicon(res); } else if (ACTION(PING)) { do_ping(res); } else if (ACTION(GETID)) { do_getid(res); } else if (ACTION(STATUS)) { print_status(req, res, 1); } else if (ACTION(STATUS2)) { print_status(req, res, 2); } else if (ACTION(SUMMARY)) { print_summary(req, res); } else if (ACTION(REPORT)) { _printReport(req, res); } else { handle_service(req, res); } }
0
333,044
nfa_regbranch(void) { int old_post_pos; old_post_pos = (int)(post_ptr - post_start); // First branch, possibly the only one if (nfa_regconcat() == FAIL) return FAIL; // Try next concats while (peekchr() == Magic('&')) { skipchr(); // if concat is empty do emit a node if (old_post_pos == (int)(post_ptr - post_start)) EMIT(NFA_EMPTY); EMIT(NFA_NOPEN); EMIT(NFA_PREV_ATOM_NO_WIDTH); old_post_pos = (int)(post_ptr - post_start); if (nfa_regconcat() == FAIL) return FAIL; // if concat is empty do emit a node if (old_post_pos == (int)(post_ptr - post_start)) EMIT(NFA_EMPTY); EMIT(NFA_CONCAT); } // if a branch is empty, emit one node for it if (old_post_pos == (int)(post_ptr - post_start)) EMIT(NFA_EMPTY); return OK; }
0
226,111
GF_Err tssy_box_size(GF_Box *s) { s->size += 1; return GF_OK; }
0
252,334
void clear() { channels.clear(); attributes.clear(); data_window[0] = 0; data_window[1] = 0; data_window[2] = 0; data_window[3] = 0; line_order = 0; display_window[0] = 0; display_window[1] = 0; display_window[2] = 0; display_window[3] = 0; screen_window_center[0] = 0.0f; screen_window_center[1] = 0.0f; screen_window_width = 0.0f; pixel_aspect_ratio = 0.0f; chunk_count = 0; // Tiled format tile_size_x = 0; tile_size_y = 0; tile_level_mode = 0; tile_rounding_mode = 0; header_len = 0; compression_type = 0; }
0
234,168
read_and_display_attr_value (unsigned long attribute, unsigned long form, dwarf_signed_vma implicit_const, unsigned char * start, unsigned char * data, unsigned char * end, dwarf_vma cu_offset, dwarf_vma pointer_size, dwarf_vma offset_size, int dwarf_version, debug_info * debug_info_p, int do_loc, struct dwarf_section * section, struct cu_tu_set * this_set, char delimiter, int level) { dwarf_signed_vma svalue; dwarf_vma uvalue = 0; dwarf_vma uvalue_hi = 0; unsigned char *block_start = NULL; unsigned char *orig_data = data; if (data > end || (data == end && form != DW_FORM_flag_present)) { warn (_("Corrupt attribute\n")); return data; } if (do_wide && ! do_loc) { /* PR 26847: Display the name of the form. */ const char * name = get_FORM_name (form); /* For convenience we skip the DW_FORM_ prefix to the name. */ if (name[0] == 'D') name += 8; /* strlen ("DW_FORM_") */ printf ("%c(%s)", delimiter, name); } switch (form) { case DW_FORM_ref_addr: if (dwarf_version == 2) SAFE_BYTE_GET_AND_INC (uvalue, data, pointer_size, end); else if (dwarf_version > 2) SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end); else error (_("Internal error: DW_FORM_ref_addr is not supported in DWARF version 1.\n")); break; case DW_FORM_addr: SAFE_BYTE_GET_AND_INC (uvalue, data, pointer_size, end); break; case DW_FORM_strp_sup: case DW_FORM_strp: case DW_FORM_line_strp: case DW_FORM_sec_offset: case DW_FORM_GNU_ref_alt: case DW_FORM_GNU_strp_alt: SAFE_BYTE_GET_AND_INC (uvalue, data, offset_size, end); break; case DW_FORM_flag_present: uvalue = 1; break; case DW_FORM_ref1: case DW_FORM_flag: case DW_FORM_data1: case DW_FORM_strx1: case DW_FORM_addrx1: SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end); break; case DW_FORM_ref2: case DW_FORM_data2: case DW_FORM_strx2: case DW_FORM_addrx2: SAFE_BYTE_GET_AND_INC (uvalue, data, 2, end); break; case DW_FORM_strx3: case DW_FORM_addrx3: SAFE_BYTE_GET_AND_INC (uvalue, data, 3, end); break; case DW_FORM_ref_sup4: case DW_FORM_ref4: case DW_FORM_data4: case DW_FORM_strx4: case DW_FORM_addrx4: SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end); break; case DW_FORM_ref_sup8: case DW_FORM_ref8: case DW_FORM_data8: case DW_FORM_ref_sig8: SAFE_BYTE_GET_AND_INC (uvalue, data, 8, end); break; case DW_FORM_data16: SAFE_BYTE_GET_AND_INC (uvalue, data, 8, end); SAFE_BYTE_GET_AND_INC (uvalue_hi, data, 8, end); if (byte_get != byte_get_little_endian) { dwarf_vma utmp = uvalue; uvalue = uvalue_hi; uvalue_hi = utmp; } break; case DW_FORM_sdata: READ_SLEB (svalue, data, end); uvalue = svalue; break; case DW_FORM_GNU_str_index: case DW_FORM_strx: case DW_FORM_ref_udata: case DW_FORM_udata: case DW_FORM_GNU_addr_index: case DW_FORM_addrx: case DW_FORM_loclistx: case DW_FORM_rnglistx: READ_ULEB (uvalue, data, end); break; case DW_FORM_indirect: READ_ULEB (form, data, end); if (!do_loc) printf ("%c%s", delimiter, get_FORM_name (form)); if (form == DW_FORM_implicit_const) READ_SLEB (implicit_const, data, end); return read_and_display_attr_value (attribute, form, implicit_const, start, data, end, cu_offset, pointer_size, offset_size, dwarf_version, debug_info_p, do_loc, section, this_set, delimiter, level); case DW_FORM_implicit_const: uvalue = implicit_const; break; default: break; } switch (form) { case DW_FORM_ref_addr: if (!do_loc) printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue)); break; case DW_FORM_GNU_ref_alt: if (!do_loc) { if (do_wide) /* We have already printed the form name. */ printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue)); else printf ("%c<alt 0x%s>", delimiter, dwarf_vmatoa ("x", uvalue)); } /* FIXME: Follow the reference... */ break; case DW_FORM_ref1: case DW_FORM_ref2: case DW_FORM_ref4: case DW_FORM_ref_sup4: case DW_FORM_ref_udata: if (!do_loc) printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue + cu_offset)); break; case DW_FORM_data4: case DW_FORM_addr: case DW_FORM_sec_offset: if (!do_loc) printf ("%c0x%s", delimiter, dwarf_vmatoa ("x", uvalue)); break; case DW_FORM_flag_present: case DW_FORM_flag: case DW_FORM_data1: case DW_FORM_data2: case DW_FORM_sdata: if (!do_loc) printf ("%c%s", delimiter, dwarf_vmatoa ("d", uvalue)); break; case DW_FORM_udata: if (!do_loc) printf ("%c%s", delimiter, dwarf_vmatoa ("u", uvalue)); break; case DW_FORM_implicit_const: if (!do_loc) printf ("%c%s", delimiter, dwarf_vmatoa ("d", implicit_const)); break; case DW_FORM_ref_sup8: case DW_FORM_ref8: case DW_FORM_data8: if (!do_loc) { dwarf_vma utmp = uvalue; if (form == DW_FORM_ref8) utmp += cu_offset; printf ("%c0x%s", delimiter, dwarf_vmatoa ("x", utmp)); } break; case DW_FORM_data16: if (!do_loc) printf (" 0x%s%s", uvalue_hi == 0 ? "" : dwarf_vmatoa ("x", uvalue_hi), dwarf_vmatoa_1 ("x", uvalue, uvalue_hi == 0 ? 0 : 8)); break; case DW_FORM_string: if (!do_loc) printf ("%c%.*s", delimiter, (int) (end - data), data); data += strnlen ((char *) data, end - data); if (data < end) data++; break; case DW_FORM_block: case DW_FORM_exprloc: READ_ULEB (uvalue, data, end); do_block: block_start = data; if (block_start >= end) { warn (_("Block ends prematurely\n")); uvalue = 0; block_start = end; } uvalue = check_uvalue (block_start, uvalue, end); data = block_start + uvalue; if (!do_loc) { unsigned char op; SAFE_BYTE_GET (op, block_start, sizeof (op), end); if (op != DW_OP_addrx) data = display_block (block_start, uvalue, end, delimiter); } break; case DW_FORM_block1: SAFE_BYTE_GET_AND_INC (uvalue, data, 1, end); goto do_block; case DW_FORM_block2: SAFE_BYTE_GET_AND_INC (uvalue, data, 2, end); goto do_block; case DW_FORM_block4: SAFE_BYTE_GET_AND_INC (uvalue, data, 4, end); goto do_block; case DW_FORM_strp: if (!do_loc) { if (do_wide) /* We have already displayed the form name. */ printf (_("%c(offset: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_indirect_string (uvalue)); else printf (_("%c(indirect string, offset: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_indirect_string (uvalue)); } break; case DW_FORM_line_strp: if (!do_loc) { if (do_wide) /* We have already displayed the form name. */ printf (_("%c(offset: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_indirect_line_string (uvalue)); else printf (_("%c(indirect line string, offset: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_indirect_line_string (uvalue)); } break; case DW_FORM_GNU_str_index: case DW_FORM_strx: case DW_FORM_strx1: case DW_FORM_strx2: case DW_FORM_strx3: case DW_FORM_strx4: if (!do_loc) { const char *suffix = section ? strrchr (section->name, '.') : NULL; bool dwo = suffix && strcmp (suffix, ".dwo") == 0; const char *strng; strng = fetch_indexed_string (uvalue, this_set, offset_size, dwo, debug_info_p ? debug_info_p->str_offsets_base : 0); if (do_wide) /* We have already displayed the form name. */ printf (_("%c(offset: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), strng); else printf (_("%c(indexed string: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), strng); } break; case DW_FORM_GNU_strp_alt: if (!do_loc) { if (do_wide) /* We have already displayed the form name. */ printf (_("%c(offset: 0x%s) %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_alt_indirect_string (uvalue)); else printf (_("%c(alt indirect string, offset: 0x%s) %s"), delimiter, dwarf_vmatoa ("x", uvalue), fetch_alt_indirect_string (uvalue)); } break; case DW_FORM_indirect: /* Handled above. */ break; case DW_FORM_ref_sig8: if (!do_loc) printf ("%c%s: 0x%s", delimiter, do_wide ? "" : "signature", dwarf_vmatoa ("x", uvalue)); break; case DW_FORM_GNU_addr_index: case DW_FORM_addrx: case DW_FORM_addrx1: case DW_FORM_addrx2: case DW_FORM_addrx3: case DW_FORM_addrx4: case DW_FORM_loclistx: case DW_FORM_rnglistx: if (!do_loc) { dwarf_vma base; dwarf_vma offset; if (debug_info_p == NULL) base = 0; else if (debug_info_p->addr_base == DEBUG_INFO_UNAVAILABLE) base = 0; else base = debug_info_p->addr_base; offset = base + uvalue * pointer_size; if (do_wide) /* We have already displayed the form name. */ if (form == DW_FORM_loclistx) printf (_("%c(index: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), dwarf_vmatoa ("x", debug_info_p->loc_offsets [uvalue])); else printf (_("%c(index: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), dwarf_vmatoa ("x", fetch_indexed_addr (offset, pointer_size))); else if (form == DW_FORM_loclistx) printf (_("%c(addr_index: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), dwarf_vmatoa ("x", debug_info_p->loc_offsets [uvalue])); else printf (_("%c(addr_index: 0x%s): %s"), delimiter, dwarf_vmatoa ("x", uvalue), dwarf_vmatoa ("x", fetch_indexed_addr (offset, pointer_size))); } break; case DW_FORM_strp_sup: if (!do_loc) printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue + cu_offset)); break; default: warn (_("Unrecognized form: 0x%lx\n"), form); /* What to do? Consume a byte maybe? */ ++data; break; } if ((do_loc || do_debug_loc || do_debug_ranges || do_debug_info) && num_debug_info_entries == 0 && debug_info_p != NULL) { switch (attribute) { case DW_AT_loclists_base: if (debug_info_p->loclists_base) warn (_("CU @ 0x%s has multiple loclists_base values"), dwarf_vmatoa ("x", debug_info_p->cu_offset)); debug_info_p->loclists_base = uvalue; break; case DW_AT_rnglists_base: if (debug_info_p->rnglists_base) warn (_("CU @ 0x%s has multiple rnglists_base values"), dwarf_vmatoa ("x", debug_info_p->cu_offset)); debug_info_p->rnglists_base = uvalue; break; case DW_AT_str_offsets_base: if (debug_info_p->str_offsets_base) warn (_("CU @ 0x%s has multiple str_offsets_base values"), dwarf_vmatoa ("x", debug_info_p->cu_offset)); debug_info_p->str_offsets_base = uvalue; break; case DW_AT_frame_base: have_frame_base = 1; /* Fall through. */ case DW_AT_location: case DW_AT_GNU_locviews: case DW_AT_string_length: case DW_AT_return_addr: case DW_AT_data_member_location: case DW_AT_vtable_elem_location: case DW_AT_segment: case DW_AT_static_link: case DW_AT_use_location: case DW_AT_call_value: case DW_AT_GNU_call_site_value: case DW_AT_call_data_value: case DW_AT_GNU_call_site_data_value: case DW_AT_call_target: case DW_AT_GNU_call_site_target: case DW_AT_call_target_clobbered: case DW_AT_GNU_call_site_target_clobbered: if ((dwarf_version < 4 && (form == DW_FORM_data4 || form == DW_FORM_data8)) || form == DW_FORM_sec_offset || form == DW_FORM_loclistx) { /* Process location list. */ unsigned int lmax = debug_info_p->max_loc_offsets; unsigned int num = debug_info_p->num_loc_offsets; if (lmax == 0 || num >= lmax) { lmax += 1024; debug_info_p->loc_offsets = (dwarf_vma *) xcrealloc (debug_info_p->loc_offsets, lmax, sizeof (*debug_info_p->loc_offsets)); debug_info_p->loc_views = (dwarf_vma *) xcrealloc (debug_info_p->loc_views, lmax, sizeof (*debug_info_p->loc_views)); debug_info_p->have_frame_base = (int *) xcrealloc (debug_info_p->have_frame_base, lmax, sizeof (*debug_info_p->have_frame_base)); debug_info_p->max_loc_offsets = lmax; } if (form == DW_FORM_loclistx) uvalue = fetch_indexed_value (num, loclists, debug_info_p->loclists_base); else if (this_set != NULL) uvalue += this_set->section_offsets [DW_SECT_LOC]; debug_info_p->have_frame_base [num] = have_frame_base; if (attribute != DW_AT_GNU_locviews) { uvalue += debug_info_p->loclists_base; /* Corrupt DWARF info can produce more offsets than views. See PR 23062 for an example. */ if (debug_info_p->num_loc_offsets > debug_info_p->num_loc_views) warn (_("More location offset attributes than DW_AT_GNU_locview attributes\n")); else { debug_info_p->loc_offsets [num] = uvalue; debug_info_p->num_loc_offsets++; } } else { assert (debug_info_p->num_loc_views <= num); num = debug_info_p->num_loc_views; if (num > debug_info_p->num_loc_offsets) warn (_("More DW_AT_GNU_locview attributes than location offset attributes\n")); else { debug_info_p->loc_views [num] = uvalue; debug_info_p->num_loc_views++; } } } break; case DW_AT_low_pc: if (need_base_address) debug_info_p->base_address = uvalue; break; case DW_AT_GNU_addr_base: case DW_AT_addr_base: debug_info_p->addr_base = uvalue; break; case DW_AT_GNU_ranges_base: debug_info_p->ranges_base = uvalue; break; case DW_AT_ranges: if ((dwarf_version < 4 && (form == DW_FORM_data4 || form == DW_FORM_data8)) || form == DW_FORM_sec_offset || form == DW_FORM_rnglistx) { /* Process range list. */ unsigned int lmax = debug_info_p->max_range_lists; unsigned int num = debug_info_p->num_range_lists; if (lmax == 0 || num >= lmax) { lmax += 1024; debug_info_p->range_lists = (dwarf_vma *) xcrealloc (debug_info_p->range_lists, lmax, sizeof (*debug_info_p->range_lists)); debug_info_p->max_range_lists = lmax; } if (form == DW_FORM_rnglistx) uvalue = fetch_indexed_value (uvalue, rnglists, 0); debug_info_p->range_lists [num] = uvalue; debug_info_p->num_range_lists++; } break; case DW_AT_GNU_dwo_name: case DW_AT_dwo_name: if (need_dwo_info) switch (form) { case DW_FORM_strp: add_dwo_name ((const char *) fetch_indirect_string (uvalue), cu_offset); break; case DW_FORM_GNU_strp_alt: add_dwo_name ((const char *) fetch_alt_indirect_string (uvalue), cu_offset); break; case DW_FORM_GNU_str_index: case DW_FORM_strx: case DW_FORM_strx1: case DW_FORM_strx2: case DW_FORM_strx3: case DW_FORM_strx4: add_dwo_name (fetch_indexed_string (uvalue, this_set, offset_size, false, debug_info_p->str_offsets_base), cu_offset); break; case DW_FORM_string: add_dwo_name ((const char *) orig_data, cu_offset); break; default: warn (_("Unsupported form (%s) for attribute %s\n"), get_FORM_name (form), get_AT_name (attribute)); break; } break; case DW_AT_comp_dir: /* FIXME: Also extract a build-id in a CU/TU. */ if (need_dwo_info) switch (form) { case DW_FORM_strp: add_dwo_dir ((const char *) fetch_indirect_string (uvalue), cu_offset); break; case DW_FORM_GNU_strp_alt: add_dwo_dir (fetch_alt_indirect_string (uvalue), cu_offset); break; case DW_FORM_line_strp: add_dwo_dir ((const char *) fetch_indirect_line_string (uvalue), cu_offset); break; case DW_FORM_GNU_str_index: case DW_FORM_strx: case DW_FORM_strx1: case DW_FORM_strx2: case DW_FORM_strx3: case DW_FORM_strx4: add_dwo_dir (fetch_indexed_string (uvalue, this_set, offset_size, false, debug_info_p->str_offsets_base), cu_offset); break; case DW_FORM_string: add_dwo_dir ((const char *) orig_data, cu_offset); break; default: warn (_("Unsupported form (%s) for attribute %s\n"), get_FORM_name (form), get_AT_name (attribute)); break; } break; case DW_AT_GNU_dwo_id: if (need_dwo_info) switch (form) { case DW_FORM_data8: /* FIXME: Record the length of the ID as well ? */ add_dwo_id ((const char *) (data - 8), cu_offset); break; default: warn (_("Unsupported form (%s) for attribute %s\n"), get_FORM_name (form), get_AT_name (attribute)); break; } break; default: break; } } if (do_loc || attribute == 0) return data; /* For some attributes we can display further information. */ switch (attribute) { case DW_AT_type: if (level >= 0 && level < MAX_CU_NESTING && uvalue < (size_t) (end - start)) { bool is_signed = false; abbrev_entry *type_abbrev; unsigned char *type_data; abbrev_map *map; type_abbrev = get_type_abbrev_from_form (form, uvalue, cu_offset, end, section, NULL, &type_data, &map); if (type_abbrev != NULL) { get_type_signedness (type_abbrev, section, type_data, map ? section->start + map->end : end, map ? map->start : cu_offset, pointer_size, offset_size, dwarf_version, & is_signed, 0); } level_type_signed[level] = is_signed; } break; case DW_AT_inline: printf ("\t"); switch (uvalue) { case DW_INL_not_inlined: printf (_("(not inlined)")); break; case DW_INL_inlined: printf (_("(inlined)")); break; case DW_INL_declared_not_inlined: printf (_("(declared as inline but ignored)")); break; case DW_INL_declared_inlined: printf (_("(declared as inline and inlined)")); break; default: printf (_(" (Unknown inline attribute value: %s)"), dwarf_vmatoa ("x", uvalue)); break; } break; case DW_AT_language: printf ("\t"); switch (uvalue) { /* Ordered by the numeric value of these constants. */ case DW_LANG_C89: printf ("(ANSI C)"); break; case DW_LANG_C: printf ("(non-ANSI C)"); break; case DW_LANG_Ada83: printf ("(Ada)"); break; case DW_LANG_C_plus_plus: printf ("(C++)"); break; case DW_LANG_Cobol74: printf ("(Cobol 74)"); break; case DW_LANG_Cobol85: printf ("(Cobol 85)"); break; case DW_LANG_Fortran77: printf ("(FORTRAN 77)"); break; case DW_LANG_Fortran90: printf ("(Fortran 90)"); break; case DW_LANG_Pascal83: printf ("(ANSI Pascal)"); break; case DW_LANG_Modula2: printf ("(Modula 2)"); break; /* DWARF 2.1 values. */ case DW_LANG_Java: printf ("(Java)"); break; case DW_LANG_C99: printf ("(ANSI C99)"); break; case DW_LANG_Ada95: printf ("(ADA 95)"); break; case DW_LANG_Fortran95: printf ("(Fortran 95)"); break; /* DWARF 3 values. */ case DW_LANG_PLI: printf ("(PLI)"); break; case DW_LANG_ObjC: printf ("(Objective C)"); break; case DW_LANG_ObjC_plus_plus: printf ("(Objective C++)"); break; case DW_LANG_UPC: printf ("(Unified Parallel C)"); break; case DW_LANG_D: printf ("(D)"); break; /* DWARF 4 values. */ case DW_LANG_Python: printf ("(Python)"); break; /* DWARF 5 values. */ case DW_LANG_OpenCL: printf ("(OpenCL)"); break; case DW_LANG_Go: printf ("(Go)"); break; case DW_LANG_Modula3: printf ("(Modula 3)"); break; case DW_LANG_Haskell: printf ("(Haskell)"); break; case DW_LANG_C_plus_plus_03: printf ("(C++03)"); break; case DW_LANG_C_plus_plus_11: printf ("(C++11)"); break; case DW_LANG_OCaml: printf ("(OCaml)"); break; case DW_LANG_Rust: printf ("(Rust)"); break; case DW_LANG_C11: printf ("(C11)"); break; case DW_LANG_Swift: printf ("(Swift)"); break; case DW_LANG_Julia: printf ("(Julia)"); break; case DW_LANG_Dylan: printf ("(Dylan)"); break; case DW_LANG_C_plus_plus_14: printf ("(C++14)"); break; case DW_LANG_Fortran03: printf ("(Fortran 03)"); break; case DW_LANG_Fortran08: printf ("(Fortran 08)"); break; case DW_LANG_RenderScript: printf ("(RenderScript)"); break; /* MIPS extension. */ case DW_LANG_Mips_Assembler: printf ("(MIPS assembler)"); break; /* UPC extension. */ case DW_LANG_Upc: printf ("(Unified Parallel C)"); break; default: if (uvalue >= DW_LANG_lo_user && uvalue <= DW_LANG_hi_user) printf (_("(implementation defined: %s)"), dwarf_vmatoa ("x", uvalue)); else printf (_("(Unknown: %s)"), dwarf_vmatoa ("x", uvalue)); break; } break; case DW_AT_encoding: printf ("\t"); switch (uvalue) { case DW_ATE_void: printf ("(void)"); break; case DW_ATE_address: printf ("(machine address)"); break; case DW_ATE_boolean: printf ("(boolean)"); break; case DW_ATE_complex_float: printf ("(complex float)"); break; case DW_ATE_float: printf ("(float)"); break; case DW_ATE_signed: printf ("(signed)"); break; case DW_ATE_signed_char: printf ("(signed char)"); break; case DW_ATE_unsigned: printf ("(unsigned)"); break; case DW_ATE_unsigned_char: printf ("(unsigned char)"); break; /* DWARF 2.1 values: */ case DW_ATE_imaginary_float: printf ("(imaginary float)"); break; case DW_ATE_decimal_float: printf ("(decimal float)"); break; /* DWARF 3 values: */ case DW_ATE_packed_decimal: printf ("(packed_decimal)"); break; case DW_ATE_numeric_string: printf ("(numeric_string)"); break; case DW_ATE_edited: printf ("(edited)"); break; case DW_ATE_signed_fixed: printf ("(signed_fixed)"); break; case DW_ATE_unsigned_fixed: printf ("(unsigned_fixed)"); break; /* DWARF 4 values: */ case DW_ATE_UTF: printf ("(unicode string)"); break; /* DWARF 5 values: */ case DW_ATE_UCS: printf ("(UCS)"); break; case DW_ATE_ASCII: printf ("(ASCII)"); break; /* HP extensions: */ case DW_ATE_HP_float80: printf ("(HP_float80)"); break; case DW_ATE_HP_complex_float80: printf ("(HP_complex_float80)"); break; case DW_ATE_HP_float128: printf ("(HP_float128)"); break; case DW_ATE_HP_complex_float128:printf ("(HP_complex_float128)"); break; case DW_ATE_HP_floathpintel: printf ("(HP_floathpintel)"); break; case DW_ATE_HP_imaginary_float80: printf ("(HP_imaginary_float80)"); break; case DW_ATE_HP_imaginary_float128: printf ("(HP_imaginary_float128)"); break; default: if (uvalue >= DW_ATE_lo_user && uvalue <= DW_ATE_hi_user) printf (_("(user defined type)")); else printf (_("(unknown type)")); break; } break; case DW_AT_accessibility: printf ("\t"); switch (uvalue) { case DW_ACCESS_public: printf ("(public)"); break; case DW_ACCESS_protected: printf ("(protected)"); break; case DW_ACCESS_private: printf ("(private)"); break; default: printf (_("(unknown accessibility)")); break; } break; case DW_AT_visibility: printf ("\t"); switch (uvalue) { case DW_VIS_local: printf ("(local)"); break; case DW_VIS_exported: printf ("(exported)"); break; case DW_VIS_qualified: printf ("(qualified)"); break; default: printf (_("(unknown visibility)")); break; } break; case DW_AT_endianity: printf ("\t"); switch (uvalue) { case DW_END_default: printf ("(default)"); break; case DW_END_big: printf ("(big)"); break; case DW_END_little: printf ("(little)"); break; default: if (uvalue >= DW_END_lo_user && uvalue <= DW_END_hi_user) printf (_("(user specified)")); else printf (_("(unknown endianity)")); break; } break; case DW_AT_virtuality: printf ("\t"); switch (uvalue) { case DW_VIRTUALITY_none: printf ("(none)"); break; case DW_VIRTUALITY_virtual: printf ("(virtual)"); break; case DW_VIRTUALITY_pure_virtual:printf ("(pure_virtual)"); break; default: printf (_("(unknown virtuality)")); break; } break; case DW_AT_identifier_case: printf ("\t"); switch (uvalue) { case DW_ID_case_sensitive: printf ("(case_sensitive)"); break; case DW_ID_up_case: printf ("(up_case)"); break; case DW_ID_down_case: printf ("(down_case)"); break; case DW_ID_case_insensitive: printf ("(case_insensitive)"); break; default: printf (_("(unknown case)")); break; } break; case DW_AT_calling_convention: printf ("\t"); switch (uvalue) { case DW_CC_normal: printf ("(normal)"); break; case DW_CC_program: printf ("(program)"); break; case DW_CC_nocall: printf ("(nocall)"); break; case DW_CC_pass_by_reference: printf ("(pass by ref)"); break; case DW_CC_pass_by_value: printf ("(pass by value)"); break; case DW_CC_GNU_renesas_sh: printf ("(Rensas SH)"); break; case DW_CC_GNU_borland_fastcall_i386: printf ("(Borland fastcall i386)"); break; default: if (uvalue >= DW_CC_lo_user && uvalue <= DW_CC_hi_user) printf (_("(user defined)")); else printf (_("(unknown convention)")); } break; case DW_AT_ordering: printf ("\t"); switch (uvalue) { case 255: case -1: printf (_("(undefined)")); break; case 0: printf ("(row major)"); break; case 1: printf ("(column major)"); break; } break; case DW_AT_decimal_sign: printf ("\t"); switch (uvalue) { case DW_DS_unsigned: printf (_("(unsigned)")); break; case DW_DS_leading_overpunch: printf (_("(leading overpunch)")); break; case DW_DS_trailing_overpunch: printf (_("(trailing overpunch)")); break; case DW_DS_leading_separate: printf (_("(leading separate)")); break; case DW_DS_trailing_separate: printf (_("(trailing separate)")); break; default: printf (_("(unrecognised)")); break; } break; case DW_AT_defaulted: printf ("\t"); switch (uvalue) { case DW_DEFAULTED_no: printf (_("(no)")); break; case DW_DEFAULTED_in_class: printf (_("(in class)")); break; case DW_DEFAULTED_out_of_class: printf (_("(out of class)")); break; default: printf (_("(unrecognised)")); break; } break; case DW_AT_discr_list: printf ("\t"); display_discr_list (form, uvalue, data, level); break; case DW_AT_frame_base: have_frame_base = 1; /* Fall through. */ case DW_AT_location: case DW_AT_loclists_base: case DW_AT_rnglists_base: case DW_AT_str_offsets_base: case DW_AT_string_length: case DW_AT_return_addr: case DW_AT_data_member_location: case DW_AT_vtable_elem_location: case DW_AT_segment: case DW_AT_static_link: case DW_AT_use_location: case DW_AT_call_value: case DW_AT_GNU_call_site_value: case DW_AT_call_data_value: case DW_AT_GNU_call_site_data_value: case DW_AT_call_target: case DW_AT_GNU_call_site_target: case DW_AT_call_target_clobbered: case DW_AT_GNU_call_site_target_clobbered: if ((dwarf_version < 4 && (form == DW_FORM_data4 || form == DW_FORM_data8)) || form == DW_FORM_sec_offset || form == DW_FORM_loclistx) { if (attribute != DW_AT_rnglists_base && attribute != DW_AT_str_offsets_base) printf (_(" (location list)")); } /* Fall through. */ case DW_AT_allocated: case DW_AT_associated: case DW_AT_data_location: case DW_AT_stride: case DW_AT_upper_bound: case DW_AT_lower_bound: if (block_start) { int need_frame_base; printf ("\t("); need_frame_base = decode_location_expression (block_start, pointer_size, offset_size, dwarf_version, uvalue, cu_offset, section); printf (")"); if (need_frame_base && !have_frame_base) printf (_(" [without DW_AT_frame_base]")); } break; case DW_AT_data_bit_offset: case DW_AT_byte_size: case DW_AT_bit_size: case DW_AT_string_length_byte_size: case DW_AT_string_length_bit_size: case DW_AT_bit_stride: if (form == DW_FORM_exprloc) { printf ("\t("); (void) decode_location_expression (block_start, pointer_size, offset_size, dwarf_version, uvalue, cu_offset, section); printf (")"); } break; case DW_AT_import: { unsigned long abbrev_number; abbrev_entry *entry; entry = get_type_abbrev_from_form (form, uvalue, cu_offset, end, section, & abbrev_number, NULL, NULL); if (entry == NULL) { if (form != DW_FORM_GNU_ref_alt) warn (_("Offset %s used as value for DW_AT_import attribute of DIE at offset 0x%lx is too big.\n"), dwarf_vmatoa ("x", uvalue), (unsigned long) (orig_data - section->start)); } else { printf (_("\t[Abbrev Number: %ld"), abbrev_number); printf (" (%s)", get_TAG_name (entry->tag)); printf ("]"); } } break; default: break; } return data; }
0
261,969
njs_string_slice_args(njs_vm_t *vm, njs_slice_prop_t *slice, njs_value_t *args, njs_uint_t nargs) { int64_t start, end, length; njs_int_t ret; njs_value_t *value; length = slice->string_length; value = njs_arg(args, nargs, 1); if (njs_slow_path(!njs_is_number(value))) { ret = njs_value_to_integer(vm, value, &start); if (njs_slow_path(ret != NJS_OK)) { return ret; } } else { start = njs_number_to_integer(njs_number(value)); } if (start < 0) { start += length; if (start < 0) { start = 0; } } if (start >= length) { start = 0; length = 0; } else { value = njs_arg(args, nargs, 2); if (njs_slow_path(!njs_is_number(value))) { if (njs_is_defined(value)) { ret = njs_value_to_integer(vm, value, &end); if (njs_slow_path(ret != NJS_OK)) { return ret; } } else { end = length; } } else { end = njs_number_to_integer(njs_number(value)); } if (end < 0) { end += length; } if (length >= end) { length = end - start; if (length < 0) { start = 0; length = 0; } } else { length -= start; } } slice->start = start; slice->length = length; return NJS_OK; }
0
338,180
int32_t WasmBinaryBuilder::getS32LEB() { BYN_TRACE("<==\n"); S32LEB ret; ret.read([&]() { return (int8_t)getInt8(); }); BYN_TRACE("getS32LEB: " << ret.value << " ==>\n"); return ret.value; }
0
346,468
source_breakpoint(void *cookie) { return &((source_cookie_T *)cookie)->breakpoint; }
0
401,554
static inline struct timer_base *get_timer_cpu_base(u32 tflags, u32 cpu) { struct timer_base *base = per_cpu_ptr(&timer_bases[BASE_STD], cpu); /* * If the timer is deferrable and NO_HZ_COMMON is set then we need * to use the deferrable base. */ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && (tflags & TIMER_DEFERRABLE)) base = per_cpu_ptr(&timer_bases[BASE_DEF], cpu); return base; }
0