idx
int64
func
string
target
int64
139,081
int PE_(r_bin_pe_is_pie)(RBinPEObj* pe) { if (!pe || !pe->nt_headers) { return false; } return HASCHR (IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE); #if 0 BOOL aslr = inh->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE; //TODO: implement dep? BOOL dep = inh->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT; #endif }
0
141,236
int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; int ret; /* * Try the generic SCSI command ioctl's first. */ ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp); if (ret != -ENOTTY) return ret; switch (cmd) { case CDROMMULTISESSION: return cdrom_ioctl_multisession(cdi, argp); case CDROMEJECT: return cdrom_ioctl_eject(cdi); case CDROMCLOSETRAY: return cdrom_ioctl_closetray(cdi); case CDROMEJECT_SW: return cdrom_ioctl_eject_sw(cdi, arg); case CDROM_MEDIA_CHANGED: return cdrom_ioctl_media_changed(cdi, arg); case CDROM_SET_OPTIONS: return cdrom_ioctl_set_options(cdi, arg); case CDROM_CLEAR_OPTIONS: return cdrom_ioctl_clear_options(cdi, arg); case CDROM_SELECT_SPEED: return cdrom_ioctl_select_speed(cdi, arg); case CDROM_SELECT_DISC: return cdrom_ioctl_select_disc(cdi, arg); case CDROMRESET: return cdrom_ioctl_reset(cdi, bdev); case CDROM_LOCKDOOR: return cdrom_ioctl_lock_door(cdi, arg); case CDROM_DEBUG: return cdrom_ioctl_debug(cdi, arg); case CDROM_GET_CAPABILITY: return cdrom_ioctl_get_capability(cdi); case CDROM_GET_MCN: return cdrom_ioctl_get_mcn(cdi, argp); case CDROM_DRIVE_STATUS: return cdrom_ioctl_drive_status(cdi, arg); case CDROM_DISC_STATUS: return cdrom_ioctl_disc_status(cdi); case CDROM_CHANGER_NSLOTS: return cdrom_ioctl_changer_nslots(cdi); } /* * Use the ioctls that are implemented through the generic_packet() * interface. this may look at bit funny, but if -ENOTTY is * returned that particular ioctl is not implemented and we * let it go through the device specific ones. */ if (CDROM_CAN(CDC_GENERIC_PACKET)) { ret = mmc_ioctl(cdi, cmd, arg); if (ret != -ENOTTY) return ret; } /* * Note: most of the cd_dbg() calls are commented out here, * because they fill up the sys log when CD players poll * the drive. */ switch (cmd) { case CDROMSUBCHNL: return cdrom_ioctl_get_subchnl(cdi, argp); case CDROMREADTOCHDR: return cdrom_ioctl_read_tochdr(cdi, argp); case CDROMREADTOCENTRY: return cdrom_ioctl_read_tocentry(cdi, argp); case CDROMPLAYMSF: return cdrom_ioctl_play_msf(cdi, argp); case CDROMPLAYTRKIND: return cdrom_ioctl_play_trkind(cdi, argp); case CDROMVOLCTRL: return cdrom_ioctl_volctrl(cdi, argp); case CDROMVOLREAD: return cdrom_ioctl_volread(cdi, argp); case CDROMSTART: case CDROMSTOP: case CDROMPAUSE: case CDROMRESUME: return cdrom_ioctl_audioctl(cdi, cmd); } return -ENOSYS; }
0
391,134
static void put_reqs_available(struct kioctx *ctx, unsigned nr) { struct kioctx_cpu *kcpu; unsigned long flags; preempt_disable(); kcpu = this_cpu_ptr(ctx->cpu); local_irq_save(flags); kcpu->reqs_available += nr; while (kcpu->reqs_available >= ctx->req_batch * 2) { kcpu->reqs_available -= ctx->req_batch; atomic_add(ctx->req_batch, &ctx->reqs_available); } local_irq_restore(flags); preempt_enable(); }
0
63,041
(flatpak_dir_log) (FlatpakDir * self, const char *file, int line, const char *func, const char *source, /* overrides self->name */ const char *change, const char *remote, const char *ref, const char *commit, const char *old_commit, const char *url, const char *format, ...) { #ifdef HAVE_LIBSYSTEMD const char *installation = source ? source : flatpak_dir_get_name_cached (self); pid_t source_pid = flatpak_dir_get_source_pid (self); char message[1024]; int len; va_list args; len = g_snprintf (message, sizeof (message), "%s: ", installation); va_start (args, format); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" g_vsnprintf (message + len, sizeof (message) - len, format, args); #pragma GCC diagnostic pop va_end (args); /* See systemd.journal-fields(7) for the meaning of the * standard fields we use, in particular OBJECT_PID */ sd_journal_send ("MESSAGE_ID=" FLATPAK_MESSAGE_ID, "PRIORITY=5", "OBJECT_PID=%d", source_pid, "CODE_FILE=%s", file, "CODE_LINE=%d", line, "CODE_FUNC=%s", func, "MESSAGE=%s", message, /* custom fields below */ "FLATPAK_VERSION=" PACKAGE_VERSION, "INSTALLATION=%s", installation, "OPERATION=%s", change, "REMOTE=%s", remote ? remote : "", "REF=%s", ref ? ref : "", "COMMIT=%s", commit ? commit : "", "OLD_COMMIT=%s", old_commit ? old_commit : "", "URL=%s", url ? url : "", NULL); #endif }
0
17,559
int net_slirp_redir ( const char * redir_str ) { struct slirp_config_str * config ; if ( QTAILQ_EMPTY ( & slirp_stacks ) ) { config = g_malloc ( sizeof ( * config ) ) ; pstrcpy ( config -> str , sizeof ( config -> str ) , redir_str ) ; config -> flags = SLIRP_CFG_HOSTFWD | SLIRP_CFG_LEGACY ; config -> next = slirp_configs ; slirp_configs = config ; return 0 ; } return slirp_hostfwd ( QTAILQ_FIRST ( & slirp_stacks ) , redir_str , 1 ) ; }
0
76,086
static bool __stratum_send(struct pool *pool, char *s, ssize_t len) { SOCKETTYPE sock = pool->sock; ssize_t ssent = 0; if (opt_protocol) applog(LOG_DEBUG, "SEND: %s", s); strcat(s, "\n"); len++; while (len > 0 ) { struct timeval timeout = {0, 0}; ssize_t sent; fd_set wd; FD_ZERO(&wd); FD_SET(sock, &wd); if (select(sock + 1, NULL, &wd, NULL, &timeout) < 1) { applog(LOG_DEBUG, "Write select failed on pool %d sock", pool->pool_no); return false; } sent = send(pool->sock, s + ssent, len, 0); if (sent < 0) { if (errno != EAGAIN && errno != EWOULDBLOCK) { applog(LOG_DEBUG, "Failed to curl_easy_send in stratum_send"); return false; } sent = 0; } ssent += sent; len -= sent; } pool->cgminer_pool_stats.times_sent++; pool->cgminer_pool_stats.bytes_sent += ssent; total_bytes_xfer += ssent; pool->cgminer_pool_stats.net_bytes_sent += ssent; return true; }
0
14,892
static int detect_flash ( const TWO_PASS * twopass , int offset ) { const FIRSTPASS_STATS * const next_frame = read_frame_stats ( twopass , offset ) ; return next_frame != NULL && next_frame -> pcnt_second_ref > next_frame -> pcnt_inter && next_frame -> pcnt_second_ref >= 0.5 ; }
0
99,996
static inline size_t WriteChannelSize(const PSDInfo *psd_info,Image *image, const signed short channel) { ssize_t count; count=WriteBlobMSBSignedShort(image,channel); count+=SetPSDSize(psd_info,image,0); return((size_t) count); }
0
28,123
static void clear_codec_buffers ( WmallDecodeCtx * s ) { int ich , ilms ; memset ( s -> acfilter_coeffs , 0 , sizeof ( s -> acfilter_coeffs ) ) ; memset ( s -> acfilter_prevvalues , 0 , sizeof ( s -> acfilter_prevvalues ) ) ; memset ( s -> lpc_coefs , 0 , sizeof ( s -> lpc_coefs ) ) ; memset ( s -> mclms_coeffs , 0 , sizeof ( s -> mclms_coeffs ) ) ; memset ( s -> mclms_coeffs_cur , 0 , sizeof ( s -> mclms_coeffs_cur ) ) ; memset ( s -> mclms_prevvalues , 0 , sizeof ( s -> mclms_prevvalues ) ) ; memset ( s -> mclms_updates , 0 , sizeof ( s -> mclms_updates ) ) ; for ( ich = 0 ; ich < s -> num_channels ; ich ++ ) { for ( ilms = 0 ; ilms < s -> cdlms_ttl [ ich ] ; ilms ++ ) { memset ( s -> cdlms [ ich ] [ ilms ] . coefs , 0 , sizeof ( s -> cdlms [ ich ] [ ilms ] . coefs ) ) ; memset ( s -> cdlms [ ich ] [ ilms ] . lms_prevvalues , 0 , sizeof ( s -> cdlms [ ich ] [ ilms ] . lms_prevvalues ) ) ; memset ( s -> cdlms [ ich ] [ ilms ] . lms_updates , 0 , sizeof ( s -> cdlms [ ich ] [ ilms ] . lms_updates ) ) ; } s -> ave_sum [ ich ] = 0 ; } }
0
301,974
int loop_register_transfer(struct loop_func_table *funcs) { unsigned int n = funcs->number; if (n >= MAX_LO_CRYPT || xfer_funcs[n]) return -EINVAL; xfer_funcs[n] = funcs; return 0; }
0
349,880
CNF_ReadFile(const char *filename) { FILE *in; char line[2048]; int i; in = fopen(filename, "r"); if (!in) { LOG_FATAL("Could not open configuration file %s : %s", filename, strerror(errno)); return; } DEBUG_LOG("Reading %s", filename); for (i = 1; fgets(line, sizeof(line), in); i++) { CNF_ParseLine(filename, i, line); } fclose(in); }
1
118,003
unsigned avcodec_version(void) { // av_assert0(AV_CODEC_ID_V410==164); av_assert0(AV_CODEC_ID_PCM_S8_PLANAR==65563); av_assert0(AV_CODEC_ID_ADPCM_G722==69660); // av_assert0(AV_CODEC_ID_BMV_AUDIO==86071); av_assert0(AV_CODEC_ID_SRT==94216); av_assert0(LIBAVCODEC_VERSION_MICRO >= 100); return LIBAVCODEC_VERSION_INT; }
0
141,718
static void rdma_umap_close(struct vm_area_struct *vma) { struct ib_uverbs_file *ufile = vma->vm_file->private_data; struct rdma_umap_priv *priv = vma->vm_private_data; if (!priv) return; /* * The vma holds a reference on the struct file that created it, which * in turn means that the ib_uverbs_file is guaranteed to exist at * this point. */ mutex_lock(&ufile->umap_lock); list_del(&priv->list); mutex_unlock(&ufile->umap_lock); kfree(priv); }
0
190,887
channel_register_fds(Channel *c, int rfd, int wfd, int efd, int extusage, int nonblock, int is_tty) { /* Update the maximum file descriptor value. */ channel_max_fd = MAX(channel_max_fd, rfd); channel_max_fd = MAX(channel_max_fd, wfd); channel_max_fd = MAX(channel_max_fd, efd); if (rfd != -1) fcntl(rfd, F_SETFD, FD_CLOEXEC); if (wfd != -1 && wfd != rfd) fcntl(wfd, F_SETFD, FD_CLOEXEC); if (efd != -1 && efd != rfd && efd != wfd) fcntl(efd, F_SETFD, FD_CLOEXEC); c->rfd = rfd; c->wfd = wfd; c->sock = (rfd == wfd) ? rfd : -1; c->efd = efd; c->extended_usage = extusage; if ((c->isatty = is_tty) != 0) debug2("channel %d: rfd %d isatty", c->self, c->rfd); #ifdef _AIX /* XXX: Later AIX versions can't push as much data to tty */ c->wfd_isatty = is_tty || isatty(c->wfd); #endif /* enable nonblocking mode */ if (nonblock) { if (rfd != -1) set_nonblock(rfd); if (wfd != -1) set_nonblock(wfd); if (efd != -1) set_nonblock(efd); } }
0
7,140
static void recovery_abort(void) { if (!dry_run) { storage_reset(); } awaiting_character = false; memzero(mnemonic, sizeof(mnemonic)); memzero(cipher, sizeof(cipher)); }
1
215,198
bool MessageLoop::DoIdleWork() { if (ProcessNextDelayedNonNestableTask()) return true; if (run_loop_client_->ShouldQuitWhenIdle()) pump_->Quit(); #if defined(OS_WIN) bool high_res = pending_high_res_tasks_ > 0; if (high_res != in_high_res_mode_) { in_high_res_mode_ = high_res; Time::ActivateHighResolutionTimer(in_high_res_mode_); } #endif return false; }
0
33,901
compile_tree_empty_check(Node* node, regex_t* reg, int empty_info, ScanEnv* env) { int r; int saved_num_null_check = reg->num_null_check; if (empty_info != BODY_IS_NOT_EMPTY) { r = add_op(reg, OP_EMPTY_CHECK_START); if (r != 0) return r; COP(reg)->empty_check_start.mem = reg->num_null_check; /* NULL CHECK ID */ reg->num_null_check++; } r = compile_tree(node, reg, env); if (r != 0) return r; if (empty_info != BODY_IS_NOT_EMPTY) { if (empty_info == BODY_IS_EMPTY) r = add_op(reg, OP_EMPTY_CHECK_END); else if (empty_info == BODY_IS_EMPTY_MEM) r = add_op(reg, OP_EMPTY_CHECK_END_MEMST); else if (empty_info == BODY_IS_EMPTY_REC) r = add_op(reg, OP_EMPTY_CHECK_END_MEMST_PUSH); if (r != 0) return r; COP(reg)->empty_check_end.mem = saved_num_null_check; /* NULL CHECK ID */ } return r; }
0
66,323
pid_t enc_untrusted_waitpid(pid_t pid, int *status, int options) { int klinux_status; pid_t result = EnsureInitializedAndDispatchSyscall( asylo::system_call::kSYS_wait4, pid, &klinux_status, TokLinuxWaitOption(options), /*rusage=*/nullptr); if (status) { *status = FromkLinuxToNewlibWstatus(klinux_status); } return result; }
0
152,090
void lodepng_info_cleanup(LodePNGInfo* info) { lodepng_color_mode_cleanup(&info->color); #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS LodePNGText_cleanup(info); LodePNGIText_cleanup(info); LodePNGUnknownChunks_cleanup(info); #endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ }
0
336,217
static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp) { ChardevCommon *common = qapi_ChardevVC_base(vc); CharDriverState *chr; chr = qemu_chr_alloc(common, errp); if (!chr) { chr->chr_write = gd_vc_chr_write; chr->chr_set_echo = gd_vc_chr_set_echo; /* Temporary, until gd_vc_vte_init runs. */ chr->opaque = g_new0(VirtualConsole, 1); vcs[nb_vcs++] = chr; return chr;
1
455,913
TEST(OverflowArithmetic, UnsignedSubtractionTests) { using T = uint64_t; static constexpr auto f = polySub; ASSERT(test<T>(f, kMax<T>, 0, kMax<T>)); ASSERT(test<T>(f, kMax<T>, 1, kMax<T> - 1)); ASSERT(test<T>(f, kMax<T>, kMax<T>, 0)); ASSERT(test<T>(f, 0, 0, 0)); ASSERT(test<T>(f, 1, 1, 0)); ASSERT(testOflow<T>(f, 0, 1)); ASSERT(testOflow<T>(f, 0, kMax<T>)); }
0
254,815
hb_unicode_funcs_t * hb_icu_get_unicode_funcs ( void ) { static const hb_unicode_funcs_t _hb_icu_unicode_funcs = { HB_OBJECT_HEADER_STATIC , NULL , true , { # define HB_UNICODE_FUNC_IMPLEMENT ( name ) hb_icu_unicode_ ## name , HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS # undef HB_UNICODE_FUNC_IMPLEMENT } } ; # if U_ICU_VERSION_MAJOR_NUM >= 49 if ( ! hb_atomic_ptr_get ( & normalizer ) ) { UErrorCode icu_err = U_ZERO_ERROR ; hb_atomic_ptr_cmpexch ( & normalizer , NULL , unorm2_getNFCInstance ( & icu_err ) ) ; } # endif return const_cast < hb_unicode_funcs_t * > ( & _hb_icu_unicode_funcs ) ; }
1
98,158
static void show_vma_header_prefix(struct seq_file *m, unsigned long start, unsigned long end, vm_flags_t flags, unsigned long long pgoff, dev_t dev, unsigned long ino) { seq_setwidth(m, 25 + sizeof(void *) * 6 - 1); seq_put_hex_ll(m, NULL, start, 8); seq_put_hex_ll(m, "-", end, 8); seq_putc(m, ' '); seq_putc(m, flags & VM_READ ? 'r' : '-'); seq_putc(m, flags & VM_WRITE ? 'w' : '-'); seq_putc(m, flags & VM_EXEC ? 'x' : '-'); seq_putc(m, flags & VM_MAYSHARE ? 's' : 'p'); seq_put_hex_ll(m, " ", pgoff, 8); seq_put_hex_ll(m, " ", MAJOR(dev), 2); seq_put_hex_ll(m, ":", MINOR(dev), 2); seq_put_decimal_ull(m, " ", ino); seq_putc(m, ' '); }
0
338,409
int cpu_breakpoint_insert(CPUState *env, target_ulong pc, int flags, CPUBreakpoint **breakpoint) { #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp; bp = qemu_malloc(sizeof(*bp)); bp->pc = pc; bp->flags = flags; /* keep all GDB-injected breakpoints in front */ if (flags & BP_GDB) TAILQ_INSERT_HEAD(&env->breakpoints, bp, entry); else TAILQ_INSERT_TAIL(&env->breakpoints, bp, entry); breakpoint_invalidate(env, pc); if (breakpoint) *breakpoint = bp; return 0; #else return -ENOSYS; #endif }
0
304,398
static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf, struct cfg80211_chan_def *ch) { struct brcmu_chan ch_inf; s32 primary_offset; brcmf_dbg(TRACE, "chandef: control %d center %d width %d\n", ch->chan->center_freq, ch->center_freq1, ch->width); ch_inf.chnum = ieee80211_frequency_to_channel(ch->center_freq1); primary_offset = ch->chan->center_freq - ch->center_freq1; switch (ch->width) { case NL80211_CHAN_WIDTH_20: case NL80211_CHAN_WIDTH_20_NOHT: ch_inf.bw = BRCMU_CHAN_BW_20; WARN_ON(primary_offset != 0); break; case NL80211_CHAN_WIDTH_40: ch_inf.bw = BRCMU_CHAN_BW_40; if (primary_offset > 0) ch_inf.sb = BRCMU_CHAN_SB_U; else ch_inf.sb = BRCMU_CHAN_SB_L; break; case NL80211_CHAN_WIDTH_80: ch_inf.bw = BRCMU_CHAN_BW_80; if (primary_offset == -30) ch_inf.sb = BRCMU_CHAN_SB_LL; else if (primary_offset == -10) ch_inf.sb = BRCMU_CHAN_SB_LU; else if (primary_offset == 10) ch_inf.sb = BRCMU_CHAN_SB_UL; else ch_inf.sb = BRCMU_CHAN_SB_UU; break; case NL80211_CHAN_WIDTH_80P80: case NL80211_CHAN_WIDTH_160: case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_10: default: WARN_ON_ONCE(1); } switch (ch->chan->band) { case NL80211_BAND_2GHZ: ch_inf.band = BRCMU_CHAN_BAND_2G; break; case NL80211_BAND_5GHZ: ch_inf.band = BRCMU_CHAN_BAND_5G; break; case NL80211_BAND_60GHZ: default: WARN_ON_ONCE(1); } d11inf->encchspec(&ch_inf); return ch_inf.chspec; }
0
157,216
rb_fiddle_handle_enable_close(VALUE self) { struct dl_handle *fiddle_handle; TypedData_Get_Struct(self, struct dl_handle, &fiddle_handle_data_type, fiddle_handle); fiddle_handle->enable_close = 1; return Qnil; }
0
81,325
mrb_singleton_class(mrb_state *mrb, mrb_value v) { struct RClass *c = mrb_singleton_class_ptr(mrb, v); if (c == NULL) { mrb_raise(mrb, E_TYPE_ERROR, "can't define singleton"); } return mrb_obj_value(c); }
0
218,938
virtual void didReadDirectory(const WebKit::WebVector<WebKit::WebFileSystemEntry>& entries, bool hasMore) { ASSERT_NOT_REACHED(); delete this; }
0
205,895
int __pte_alloc_kernel(pmd_t *pmd, unsigned long address) { pte_t *new = pte_alloc_one_kernel(&init_mm, address); if (!new) return -ENOMEM; smp_wmb(); /* See comment in __pte_alloc */ spin_lock(&init_mm.page_table_lock); if (likely(pmd_none(*pmd))) { /* Has another populated it ? */ pmd_populate_kernel(&init_mm, pmd, new); new = NULL; } else VM_BUG_ON(pmd_trans_splitting(*pmd)); spin_unlock(&init_mm.page_table_lock); if (new) pte_free_kernel(&init_mm, new); return 0; }
0
338,902
static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end) { int pal_start, pal_count, i, ret; if(buf_end - buf < 16) { av_log(s->avctx, AV_LOG_WARNING, "truncated header\n"); return AVERROR_INVALIDDATA; } s->width = AV_RL16(&buf[4]); s->height = AV_RL16(&buf[6]); ret = ff_set_dimensions(s->avctx, s->width, s->height); if (ret < 0) return ret; s->avctx->time_base.num = 1; s->avctx->time_base.den = AV_RL16(&buf[10]); pal_start = AV_RL16(&buf[12]); pal_count = AV_RL16(&buf[14]); buf += 16; for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf_end - buf >= 3; i++) { s->palette[i] = AV_RB24(buf); buf += 3; } return 0; }
0
127,401
unsigned char* lodepng_chunk_data(unsigned char* chunk) { return &chunk[8]; }
0
5,172
int crypto_reportstat(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, struct nlattr **attrs) { struct net *net = sock_net(in_skb->sk); struct crypto_user_alg *p = nlmsg_data(in_nlh); struct crypto_alg *alg; struct sk_buff *skb; struct crypto_dump_info info; int err; if (!null_terminated(p->cru_name) || !null_terminated(p->cru_driver_name)) return -EINVAL; alg = crypto_alg_match(p, 0); if (!alg) return -ENOENT; err = -ENOMEM; skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); if (!skb) goto drop_alg; info.in_skb = in_skb; info.out_skb = skb; info.nlmsg_seq = in_nlh->nlmsg_seq; info.nlmsg_flags = 0; err = crypto_reportstat_alg(alg, &info); drop_alg: crypto_mod_put(alg); if (err) return err; return nlmsg_unicast(net->crypto_nlsk, skb, NETLINK_CB(in_skb).portid); }
1
300,507
void spl_array_iterator_key(zval *object, zval *return_value TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (spl_array_object_verify_pos(intern, aht TSRMLS_CC) == FAILURE) { return; } zend_hash_get_current_key_zval_ex(aht, return_value, &intern->pos); }
0
270,870
static void caif_ctrl_cb(struct cflayer *layr, enum caif_ctrlcmd flow, int phyid) { struct caifsock *cf_sk = container_of(layr, struct caifsock, layer); switch (flow) { case CAIF_CTRLCMD_FLOW_ON_IND: /* OK from modem to start sending again */ set_tx_flow_on(cf_sk); cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_FLOW_OFF_IND: /* Modem asks us to shut up */ set_tx_flow_off(cf_sk); cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_INIT_RSP: /* We're now connected */ caif_client_register_refcnt(&cf_sk->layer, cfsk_hold, cfsk_put); cf_sk->sk.sk_state = CAIF_CONNECTED; set_tx_flow_on(cf_sk); cf_sk->sk.sk_shutdown = 0; cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_DEINIT_RSP: /* We're now disconnected */ cf_sk->sk.sk_state = CAIF_DISCONNECTED; cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_INIT_FAIL_RSP: /* Connect request failed */ cf_sk->sk.sk_err = ECONNREFUSED; cf_sk->sk.sk_state = CAIF_DISCONNECTED; cf_sk->sk.sk_shutdown = SHUTDOWN_MASK; /* * Socket "standards" seems to require POLLOUT to * be set at connect failure. */ set_tx_flow_on(cf_sk); cf_sk->sk.sk_state_change(&cf_sk->sk); break; case CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND: /* Modem has closed this connection, or device is down. */ cf_sk->sk.sk_shutdown = SHUTDOWN_MASK; cf_sk->sk.sk_err = ECONNRESET; set_rx_flow_on(cf_sk); cf_sk->sk.sk_error_report(&cf_sk->sk); break; default: pr_debug("Unexpected flow command %d\n", flow); } }
0
381,484
my_strusage( int level ) { static char *digests, *pubkeys, *ciphers; static char *ver_gcry, *ver_ksba; const char *p; switch (level) { case 11: p = "@GPGSM@ (@GNUPG@)"; break; case 13: p = VERSION; break; case 17: p = PRINTABLE_OS_NAME; break; case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break; case 1: case 40: p = _("Usage: @GPGSM@ [options] [files] (-h for help)"); break; case 41: p = _("Syntax: @GPGSM@ [options] [files]\n" "Sign, check, encrypt or decrypt using the S/MIME protocol\n" "Default operation depends on the input data\n"); break; case 20: if (!ver_gcry) ver_gcry = make_libversion ("libgcrypt", gcry_check_version); p = ver_gcry; break; case 21: if (!ver_ksba) ver_ksba = make_libversion ("libksba", ksba_check_version); p = ver_ksba; break; case 31: p = "\nHome: "; break; case 32: p = opt.homedir; break; case 33: p = _("\nSupported algorithms:\n"); break; case 34: if (!ciphers) ciphers = build_list ("Cipher: ", gnupg_cipher_algo_name, our_cipher_test_algo ); p = ciphers; break; case 35: if (!pubkeys) pubkeys = build_list ("Pubkey: ", gcry_pk_algo_name, our_pk_test_algo ); p = pubkeys; break; case 36: if (!digests) digests = build_list("Hash: ", gcry_md_algo_name, our_md_test_algo ); p = digests; break; default: p = NULL; break; } return p; }
0
11,989
BrowserActionsContainer::BrowserActionsContainer( Profile* profile, ToolbarView* toolbar) : profile_(profile), toolbar_(toolbar), popup_(NULL), popup_button_(NULL), model_(NULL), resize_gripper_(NULL), chevron_(NULL), suppress_chevron_(false), resize_amount_(0), animation_target_size_(0), ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { SetID(VIEW_ID_BROWSER_ACTION_TOOLBAR); ExtensionsService* extension_service = profile->GetExtensionsService(); if (!extension_service) // The |extension_service| can be NULL in Incognito. return; registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(profile_)); model_ = extension_service->toolbar_model(); model_->AddObserver(this); resize_animation_.reset(new SlideAnimation(this)); resize_gripper_ = new views::ResizeGripper(this); resize_gripper_->SetVisible(false); AddChildView(resize_gripper_); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); SkBitmap* chevron_image = rb.GetBitmapNamed(IDR_BOOKMARK_BAR_CHEVRONS); chevron_ = new views::MenuButton(NULL, std::wstring(), this, false); chevron_->SetVisible(false); chevron_->SetIcon(*chevron_image); chevron_->EnableCanvasFlippingForRTLUI(true); AddChildView(chevron_); int predefined_width = profile_->GetPrefs()->GetInteger(prefs::kBrowserActionContainerWidth); container_size_ = gfx::Size(predefined_width, kButtonSize); }
1
253,751
void (*SSL_CTX_get_info_callback(SSL_CTX *ctx)) (const SSL *ssl, int type, int val) { return ctx->info_callback; }
0
189,367
ZEND_API const char* zend_resolve_method_name(zend_class_entry *ce, zend_function *f) /* {{{ */ { zend_function *func; HashPosition iterator; HashTable *function_table; if (f->common.type != ZEND_USER_FUNCTION || *(f->op_array.refcount) < 2 || !f->common.scope || !f->common.scope->trait_aliases) { return f->common.function_name; } function_table = &ce->function_table; zend_hash_internal_pointer_reset_ex(function_table, &iterator); while (zend_hash_get_current_data_ex(function_table, (void **)&func, &iterator) == SUCCESS) { if (func == f) { char *name; uint len; ulong idx; if (zend_hash_get_current_key_ex(function_table, &name, &len, &idx, 0, &iterator) != HASH_KEY_IS_STRING) { return f->common.function_name; } --len; if (len == strlen(f->common.function_name) && !strncasecmp(name, f->common.function_name, len)) { return f->common.function_name; } return zend_find_alias_name(f->common.scope, name, len); } zend_hash_move_forward_ex(function_table, &iterator); } return f->common.function_name; } /* }}} */
0
185,870
void WebProcessProxy::interactionOccurredWhileUnresponsive(ResponsivenessTimer*) { Vector<RefPtr<WebPageProxy> > pages; copyValuesToVector(m_pageMap, pages); for (size_t i = 0, size = pages.size(); i < size; ++i) pages[i]->interactionOccurredWhileProcessUnresponsive(); }
0
211,761
static int get_extra_state(QEMUFile *f, void *pv, size_t size) { VirtIODevice *vdev = pv; BusState *qbus = qdev_get_parent_bus(DEVICE(vdev)); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); if (!k->load_extra_state) { return -1; } else { return k->load_extra_state(qbus->parent, f); } }
0
102,611
static void test_bug57058() { MYSQL_RES *res; int rc; DBUG_ENTER("test_bug57058"); myheader("test_bug57058"); rc= mysql_query(mysql, "set @@session.long_query_time=0.1"); myquery(rc); DIE_UNLESS(!(mysql->server_status & SERVER_QUERY_WAS_SLOW)); rc= mysql_query(mysql, "select sleep(1)"); myquery(rc); /* Important: the flag is sent in the last EOF packet of the query, the one which ends the result. Read the result to see the "slow" status. */ res= mysql_store_result(mysql); DIE_UNLESS(mysql->server_status & SERVER_QUERY_WAS_SLOW); mysql_free_result(res); rc= mysql_query(mysql, "set @@session.long_query_time=default"); myquery(rc); DBUG_VOID_RETURN; }
0
201,273
~LocalSiteCharacteristicsWebContentsObserver() { DCHECK(!writer_); }
0
172,272
SPICE_GNUC_VISIBLE int spice_server_set_agent_copypaste(SpiceServer *s, int enable) { spice_assert(reds == s); agent_copypaste = enable; reds->agent_state.write_filter.copy_paste_enabled = agent_copypaste; reds->agent_state.read_filter.copy_paste_enabled = agent_copypaste; return 0; }
0
102,361
static const char *jsi_TildePath(Jsi_Interp *interp, const char* path, Jsi_DString *dStr) { if (*path != '~') return path; const char *homedir = jsi_GetHomeDir(interp); if (!homedir) return path; Jsi_DSAppend(dStr, homedir, path[1] == '/' ? "" : "/", path+1, NULL); return Jsi_DSValue(dStr); }
0
73,882
static int tipc_sk_create(struct net *net, struct socket *sock, int protocol, int kern) { const struct proto_ops *ops; struct sock *sk; struct tipc_sock *tsk; struct tipc_msg *msg; /* Validate arguments */ if (unlikely(protocol != 0)) return -EPROTONOSUPPORT; switch (sock->type) { case SOCK_STREAM: ops = &stream_ops; break; case SOCK_SEQPACKET: ops = &packet_ops; break; case SOCK_DGRAM: case SOCK_RDM: ops = &msg_ops; break; default: return -EPROTOTYPE; } /* Allocate socket's protocol area */ sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto, kern); if (sk == NULL) return -ENOMEM; tsk = tipc_sk(sk); tsk->max_pkt = MAX_PKT_DEFAULT; tsk->maxnagle = 0; tsk->nagle_start = NAGLE_START_INIT; INIT_LIST_HEAD(&tsk->publications); INIT_LIST_HEAD(&tsk->cong_links); msg = &tsk->phdr; /* Finish initializing socket data structures */ sock->ops = ops; sock_init_data(sock, sk); tipc_set_sk_state(sk, TIPC_OPEN); if (tipc_sk_insert(tsk)) { pr_warn("Socket create failed; port number exhausted\n"); return -EINVAL; } /* Ensure tsk is visible before we read own_addr. */ smp_mb(); tipc_msg_init(tipc_own_addr(net), msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, NAMED_H_SIZE, 0); msg_set_origport(msg, tsk->portid); timer_setup(&sk->sk_timer, tipc_sk_timeout, 0); sk->sk_shutdown = 0; sk->sk_backlog_rcv = tipc_sk_backlog_rcv; sk->sk_rcvbuf = sysctl_tipc_rmem[1]; sk->sk_data_ready = tipc_data_ready; sk->sk_write_space = tipc_write_space; sk->sk_destruct = tipc_sock_destruct; tsk->conn_timeout = CONN_TIMEOUT_DEFAULT; tsk->group_is_open = true; atomic_set(&tsk->dupl_rcvcnt, 0); /* Start out with safe limits until we receive an advertised window */ tsk->snd_win = tsk_adv_blocks(RCVBUF_MIN); tsk->rcv_win = tsk->snd_win; if (tipc_sk_type_connectionless(sk)) { tsk_set_unreturnable(tsk, true); if (sock->type == SOCK_DGRAM) tsk_set_unreliable(tsk, true); } __skb_queue_head_init(&tsk->mc_method.deferredq); trace_tipc_sk_create(sk, NULL, TIPC_DUMP_NONE, " "); return 0; }
0
498,251
static inline bool verify_client_lsn(struct ntfs_log *log, const struct CLIENT_REC *client, u64 lsn) { return lsn >= le64_to_cpu(client->oldest_lsn) && lsn <= le64_to_cpu(log->ra->current_lsn) && lsn; }
0
492,516
void FunctionContextImpl::free_local_allocations() { for (int i = 0; i < _local_allocations.size(); ++i) { _pool->free(_local_allocations[i]); } _local_allocations.clear(); }
0
364,321
static int ISO8859_8ToUTF8 (unsigned char* out, int *outlen, const unsigned char* in, int *inlen) { return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_8); }
0
209,218
static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image) { char buffer[MaxTextExtent], cache_filename[MaxTextExtent]; const char *property, *value; MagickBooleanType status; MagickOffsetType offset, scene; register ssize_t i; size_t depth, one; /* Open persistent cache. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception); if (status == MagickFalse) return(status); (void) CopyMagickString(cache_filename,image->filename,MaxTextExtent); AppendImageFormat("cache",cache_filename); scene=0; offset=0; one=1; do { /* Write persistent cache meta-information. */ depth=GetImageQuantumDepth(image,MagickTrue); if ((image->storage_class == PseudoClass) && (image->colors > (one << depth))) image->storage_class=DirectClass; (void) WriteBlobString(image,"id=MagickCache\n"); (void) FormatLocaleString(buffer,MaxTextExtent,"magick-signature=%u\n", GetMagickSignature((const StringInfo *) NULL)); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MaxTextExtent, "class=%s colors=%.20g matte=%s\n",CommandOptionToMnemonic( MagickClassOptions,image->storage_class),(double) image->colors, CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte)); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MaxTextExtent, "columns=%.20g rows=%.20g depth=%.20g\n",(double) image->columns, (double) image->rows,(double) image->depth); (void) WriteBlobString(image,buffer); if (image->type != UndefinedType) { (void) FormatLocaleString(buffer,MaxTextExtent,"type=%s\n", CommandOptionToMnemonic(MagickTypeOptions,image->type)); (void) WriteBlobString(image,buffer); } if (image->colorspace != UndefinedColorspace) { (void) FormatLocaleString(buffer,MaxTextExtent,"colorspace=%s\n", CommandOptionToMnemonic(MagickColorspaceOptions,image->colorspace)); (void) WriteBlobString(image,buffer); } if (image->intensity != UndefinedPixelIntensityMethod) { (void) FormatLocaleString(buffer,MaxTextExtent,"pixel-intensity=%s\n", CommandOptionToMnemonic(MagickPixelIntensityOptions, image->intensity)); (void) WriteBlobString(image,buffer); } if (image->endian != UndefinedEndian) { (void) FormatLocaleString(buffer,MaxTextExtent,"endian=%s\n", CommandOptionToMnemonic(MagickEndianOptions,image->endian)); (void) WriteBlobString(image,buffer); } if (image->compression != UndefinedCompression) { (void) FormatLocaleString(buffer,MaxTextExtent, "compression=%s quality=%.20g\n",CommandOptionToMnemonic( MagickCompressOptions,image->compression),(double) image->quality); (void) WriteBlobString(image,buffer); } if (image->units != UndefinedResolution) { (void) FormatLocaleString(buffer,MaxTextExtent,"units=%s\n", CommandOptionToMnemonic(MagickResolutionOptions,image->units)); (void) WriteBlobString(image,buffer); } if ((image->x_resolution != 0) || (image->y_resolution != 0)) { (void) FormatLocaleString(buffer,MaxTextExtent, "resolution=%gx%g\n",image->x_resolution,image->y_resolution); (void) WriteBlobString(image,buffer); } if ((image->page.width != 0) || (image->page.height != 0)) { (void) FormatLocaleString(buffer,MaxTextExtent, "page=%.20gx%.20g%+.20g%+.20g\n",(double) image->page.width,(double) image->page.height,(double) image->page.x,(double) image->page.y); (void) WriteBlobString(image,buffer); } else if ((image->page.x != 0) || (image->page.y != 0)) { (void) FormatLocaleString(buffer,MaxTextExtent,"page=%+ld%+ld\n", (long) image->page.x,(long) image->page.y); (void) WriteBlobString(image,buffer); } if ((image->tile_offset.x != 0) || (image->tile_offset.y != 0)) { (void) FormatLocaleString(buffer,MaxTextExtent,"tile-offset=%+ld%+ld\n", (long) image->tile_offset.x,(long) image->tile_offset.y); (void) WriteBlobString(image,buffer); } if ((GetNextImageInList(image) != (Image *) NULL) || (GetPreviousImageInList(image) != (Image *) NULL)) { if (image->scene == 0) (void) FormatLocaleString(buffer,MaxTextExtent, "iterations=%.20g delay=%.20g ticks-per-second=%.20g\n",(double) image->iterations,(double) image->delay,(double) image->ticks_per_second); else (void) FormatLocaleString(buffer,MaxTextExtent,"scene=%.20g " "iterations=%.20g delay=%.20g ticks-per-second=%.20g\n", (double) image->scene,(double) image->iterations,(double) image->delay,(double) image->ticks_per_second); (void) WriteBlobString(image,buffer); } else { if (image->scene != 0) { (void) FormatLocaleString(buffer,MaxTextExtent,"scene=%.20g\n", (double) image->scene); (void) WriteBlobString(image,buffer); } if (image->iterations != 0) { (void) FormatLocaleString(buffer,MaxTextExtent,"iterations=%.20g\n", (double) image->iterations); (void) WriteBlobString(image,buffer); } if (image->delay != 0) { (void) FormatLocaleString(buffer,MaxTextExtent,"delay=%.20g\n", (double) image->delay); (void) WriteBlobString(image,buffer); } if (image->ticks_per_second != UndefinedTicksPerSecond) { (void) FormatLocaleString(buffer,MaxTextExtent, "ticks-per-second=%.20g\n",(double) image->ticks_per_second); (void) WriteBlobString(image,buffer); } } if (image->gravity != UndefinedGravity) { (void) FormatLocaleString(buffer,MaxTextExtent,"gravity=%s\n", CommandOptionToMnemonic(MagickGravityOptions,image->gravity)); (void) WriteBlobString(image,buffer); } if (image->dispose != UndefinedDispose) { (void) FormatLocaleString(buffer,MaxTextExtent,"dispose=%s\n", CommandOptionToMnemonic(MagickDisposeOptions,image->dispose)); (void) WriteBlobString(image,buffer); } if (image->rendering_intent != UndefinedIntent) { (void) FormatLocaleString(buffer,MaxTextExtent, "rendering-intent=%s\n",CommandOptionToMnemonic(MagickIntentOptions, image->rendering_intent)); (void) WriteBlobString(image,buffer); } if (image->gamma != 0.0) { (void) FormatLocaleString(buffer,MaxTextExtent,"gamma=%g\n", image->gamma); (void) WriteBlobString(image,buffer); } if (image->chromaticity.white_point.x != 0.0) { /* Note chomaticity points. */ (void) FormatLocaleString(buffer,MaxTextExtent,"red-primary=" "%g,%g green-primary=%g,%g blue-primary=%g,%g\n", image->chromaticity.red_primary.x,image->chromaticity.red_primary.y, image->chromaticity.green_primary.x, image->chromaticity.green_primary.y, image->chromaticity.blue_primary.x, image->chromaticity.blue_primary.y); (void) WriteBlobString(image,buffer); (void) FormatLocaleString(buffer,MaxTextExtent, "white-point=%g,%g\n",image->chromaticity.white_point.x, image->chromaticity.white_point.y); (void) WriteBlobString(image,buffer); } if (image->orientation != UndefinedOrientation) { (void) FormatLocaleString(buffer,MaxTextExtent, "orientation=%s\n",CommandOptionToMnemonic(MagickOrientationOptions, image->orientation)); (void) WriteBlobString(image,buffer); } if (image->profiles != (void *) NULL) { const char *name; const StringInfo *profile; /* Generic profile. */ ResetImageProfileIterator(image); for (name=GetNextImageProfile(image); name != (const char *) NULL; ) { profile=GetImageProfile(image,name); if (profile != (StringInfo *) NULL) { (void) FormatLocaleString(buffer,MaxTextExtent, "profile:%s=%.20g\n",name,(double) GetStringInfoLength(profile)); (void) WriteBlobString(image,buffer); } name=GetNextImageProfile(image); } } if (image->montage != (char *) NULL) { (void) FormatLocaleString(buffer,MaxTextExtent,"montage=%s\n", image->montage); (void) WriteBlobString(image,buffer); } ResetImagePropertyIterator(image); property=GetNextImageProperty(image); while (property != (const char *) NULL) { (void) FormatLocaleString(buffer,MaxTextExtent,"%s=",property); (void) WriteBlobString(image,buffer); value=GetImageProperty(image,property); if (value != (const char *) NULL) { size_t length; length=strlen(value); for (i=0; i < (ssize_t) length; i++) if (isspace((int) ((unsigned char) value[i])) != 0) break; if ((i == (ssize_t) length) && (i != 0)) (void) WriteBlob(image,length,(const unsigned char *) value); else { (void) WriteBlobByte(image,'{'); if (strchr(value,'}') == (char *) NULL) (void) WriteBlob(image,length,(const unsigned char *) value); else for (i=0; i < (ssize_t) length; i++) { if (value[i] == (int) '}') (void) WriteBlobByte(image,'\\'); (void) WriteBlobByte(image,value[i]); } (void) WriteBlobByte(image,'}'); } } (void) WriteBlobByte(image,'\n'); property=GetNextImageProperty(image); }
0
174,481
void NetworkHandler::ContinueInterceptedRequest( const std::string& interception_id, Maybe<std::string> error_reason, Maybe<std::string> base64_raw_response, Maybe<std::string> url, Maybe<std::string> method, Maybe<std::string> post_data, Maybe<protocol::Network::Headers> headers, Maybe<protocol::Network::AuthChallengeResponse> auth_challenge_response, std::unique_ptr<ContinueInterceptedRequestCallback> callback) { DevToolsInterceptorController* interceptor = DevToolsInterceptorController::FromBrowserContext(browser_context_); if (!interceptor) { callback->sendFailure(Response::InternalError()); return; } base::Optional<std::string> raw_response; if (base64_raw_response.isJust()) { std::string decoded; if (!base::Base64Decode(base64_raw_response.fromJust(), &decoded)) { callback->sendFailure(Response::InvalidParams("Invalid rawResponse.")); return; } raw_response = decoded; } base::Optional<net::Error> error; bool mark_as_canceled = false; if (error_reason.isJust()) { bool ok; error = NetErrorFromString(error_reason.fromJust(), &ok); if (!ok) { callback->sendFailure(Response::InvalidParams("Invalid errorReason.")); return; } mark_as_canceled = true; } interceptor->ContinueInterceptedRequest( interception_id, std::make_unique<DevToolsURLRequestInterceptor::Modifications>( std::move(error), std::move(raw_response), std::move(url), std::move(method), std::move(post_data), std::move(headers), std::move(auth_challenge_response), mark_as_canceled), std::move(callback)); }
0
460,713
static char *addr_to_string(const char *format, struct sockaddr_storage *sa, socklen_t salen) { char host[NI_MAXHOST]; char serv[NI_MAXSERV]; int err; if ((err = getnameinfo((struct sockaddr *)sa, salen, host, sizeof(host), serv, sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { spice_warning("Cannot resolve address %d: %s", err, gai_strerror(err)); return NULL; } return g_strdup_printf(format, host, serv); }
0
447,387
int sldns_fp2wire_rr_buf(FILE* in, uint8_t* rr, size_t* len, size_t* dname_len, struct sldns_file_parse_state* parse_state) { char line[LDNS_RR_BUF_SIZE+1]; ssize_t size; /* read an entire line in from the file */ if((size = sldns_fget_token_l(in, line, LDNS_PARSE_SKIP_SPACE, LDNS_RR_BUF_SIZE, parse_state?&parse_state->lineno:NULL)) == -1) { /* if last line was empty, we are now at feof, which is not * always a parse error (happens when for instance last line * was a comment) */ return LDNS_WIREPARSE_ERR_SYNTAX; } /* we can have the situation, where we've read ok, but still got * no bytes to play with, in this case size is 0 */ if(size == 0) { if(*len > 0) rr[0] = 0; *len = 0; *dname_len = 0; return LDNS_WIREPARSE_ERR_OK; } if(strncmp(line, "$ORIGIN", 7) == 0 && isspace((unsigned char)line[7])) { int s; strlcpy((char*)rr, line, *len); *len = 0; *dname_len = 0; if(!parse_state) return LDNS_WIREPARSE_ERR_OK; parse_state->origin_len = sizeof(parse_state->origin); s = sldns_str2wire_dname_buf(sldns_strip_ws(line+8), parse_state->origin, &parse_state->origin_len); if(s) parse_state->origin_len = 0; return s; } else if(strncmp(line, "$TTL", 4) == 0 && isspace((unsigned char)line[4])) { const char* end = NULL; strlcpy((char*)rr, line, *len); *len = 0; *dname_len = 0; if(!parse_state) return LDNS_WIREPARSE_ERR_OK; parse_state->default_ttl = sldns_str2period( sldns_strip_ws(line+5), &end); } else if (strncmp(line, "$INCLUDE", 8) == 0) { strlcpy((char*)rr, line, *len); *len = 0; *dname_len = 0; return LDNS_WIREPARSE_ERR_INCLUDE; } else if (strncmp(line, "$", 1) == 0) { strlcpy((char*)rr, line, *len); *len = 0; *dname_len = 0; return LDNS_WIREPARSE_ERR_INCLUDE; } else { int r = sldns_str2wire_rr_buf(line, rr, len, dname_len, parse_state?parse_state->default_ttl:0, (parse_state&&parse_state->origin_len)? parse_state->origin:NULL, parse_state?parse_state->origin_len:0, (parse_state&&parse_state->prev_rr_len)? parse_state->prev_rr:NULL, parse_state?parse_state->prev_rr_len:0); if(r == LDNS_WIREPARSE_ERR_OK && (*dname_len) != 0 && parse_state && (*dname_len) <= sizeof(parse_state->prev_rr)) { memmove(parse_state->prev_rr, rr, *dname_len); parse_state->prev_rr_len = (*dname_len); } return r; } return LDNS_WIREPARSE_ERR_OK; }
0
437,652
PHPAPI char* spl_filesystem_object_get_path(spl_filesystem_object *intern, size_t *len) /* {{{ */ { #ifdef HAVE_GLOB if (intern->type == SPL_FS_DIR) { if (php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) { return php_glob_stream_get_path(intern->u.dir.dirp, 0, len); } } #endif if (len) { *len = intern->_path_len; } return intern->_path; } /* }}} */
0
512,095
initialize_shell_variables (env, privmode) char **env; int privmode; { char *name, *string, *temp_string; int c, char_index, string_index, string_length, ro; SHELL_VAR *temp_var; create_variable_tables (); for (string_index = 0; string = env[string_index++]; ) { char_index = 0; name = string; while ((c = *string++) && c != '=') ; if (string[-1] == '=') char_index = string - name - 1; /* If there are weird things in the environment, like `=xxx' or a string without an `=', just skip them. */ if (char_index == 0) continue; /* ASSERT(name[char_index] == '=') */ name[char_index] = '\0'; /* Now, name = env variable name, string = env variable value, and char_index == strlen (name) */ temp_var = (SHELL_VAR *)NULL; /* If exported function, define it now. Don't import functions from the environment in privileged mode. */ if (privmode == 0 && read_but_dont_execute == 0 && STREQN ("() {", string, 4)) { string_length = strlen (string); temp_string = (char *)xmalloc (3 + string_length + char_index); strcpy (temp_string, name); temp_string[char_index] = ' '; strcpy (temp_string + char_index + 1, string); parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST); /* Ancient backwards compatibility. Old versions of bash exported functions like name()=() {...} */ if (name[char_index - 1] == ')' && name[char_index - 2] == '(') name[char_index - 2] = '\0'; if (temp_var = find_function (name)) { VSETATTR (temp_var, (att_exported|att_imported)); array_needs_making = 1; } else { last_command_exit_value = 1; report_error (_("error importing function definition for `%s'"), name); } /* ( */ if (name[char_index - 1] == ')' && name[char_index - 2] == '\0') name[char_index - 2] = '('; /* ) */ } #if defined (ARRAY_VARS) # if 0 /* Array variables may not yet be exported. */ else if (*string == '(' && string[1] == '[' && string[strlen (string) - 1] == ')') { string_length = 1; temp_string = extract_array_assignment_list (string, &string_length); temp_var = assign_array_from_string (name, temp_string); FREE (temp_string); VSETATTR (temp_var, (att_exported | att_imported)); array_needs_making = 1; } # endif #endif #if 0 else if (legal_identifier (name)) #else else #endif { ro = 0; if (posixly_correct && STREQ (name, "SHELLOPTS")) { temp_var = find_variable ("SHELLOPTS"); ro = temp_var && readonly_p (temp_var); if (temp_var) VUNSETATTR (temp_var, att_readonly); } temp_var = bind_variable (name, string, 0); if (temp_var) { if (legal_identifier (name)) VSETATTR (temp_var, (att_exported | att_imported)); else VSETATTR (temp_var, (att_exported | att_imported | att_invisible)); if (ro) VSETATTR (temp_var, att_readonly); array_needs_making = 1; } } name[char_index] = '='; /* temp_var can be NULL if it was an exported function with a syntax error (a different bug, but it still shouldn't dump core). */ if (temp_var && function_p (temp_var) == 0) /* XXX not yet */ { CACHE_IMPORTSTR (temp_var, name); } } set_pwd (); /* Set up initial value of $_ */ temp_var = set_if_not ("_", dollar_vars[0]); /* Remember this pid. */ dollar_dollar_pid = getpid (); /* Now make our own defaults in case the vars that we think are important are missing. */ temp_var = set_if_not ("PATH", DEFAULT_PATH_VALUE); #if 0 set_auto_export (temp_var); /* XXX */ #endif temp_var = set_if_not ("TERM", "dumb"); #if 0 set_auto_export (temp_var); /* XXX */ #endif #if defined (__QNX__) /* set node id -- don't import it from the environment */ { char node_name[22]; # if defined (__QNXNTO__) netmgr_ndtostr(ND2S_LOCAL_STR, ND_LOCAL_NODE, node_name, sizeof(node_name)); # else qnx_nidtostr (getnid (), node_name, sizeof (node_name)); # endif temp_var = bind_variable ("NODE", node_name, 0); set_auto_export (temp_var); } #endif /* set up the prompts. */ if (interactive_shell) { #if defined (PROMPT_STRING_DECODE) set_if_not ("PS1", primary_prompt); #else if (current_user.uid == -1) get_current_user_info (); set_if_not ("PS1", current_user.euid == 0 ? "# " : primary_prompt); #endif set_if_not ("PS2", secondary_prompt); } set_if_not ("PS4", "+ "); /* Don't allow IFS to be imported from the environment. */ temp_var = bind_variable ("IFS", " \t\n", 0); setifs (temp_var); /* Magic machine types. Pretty convenient. */ set_machine_vars (); /* Default MAILCHECK for interactive shells. Defer the creation of a default MAILPATH until the startup files are read, because MAIL names a mail file if MAILPATH is not set, and we should provide a default only if neither is set. */ if (interactive_shell) { temp_var = set_if_not ("MAILCHECK", posixly_correct ? "600" : "60"); VSETATTR (temp_var, att_integer); } /* Do some things with shell level. */ initialize_shell_level (); set_ppid (); /* Initialize the `getopts' stuff. */ temp_var = bind_variable ("OPTIND", "1", 0); VSETATTR (temp_var, att_integer); getopts_reset (0); bind_variable ("OPTERR", "1", 0); sh_opterr = 1; if (login_shell == 1 && posixly_correct == 0) set_home_var (); /* Get the full pathname to THIS shell, and set the BASH variable to it. */ name = get_bash_name (); temp_var = bind_variable ("BASH", name, 0); free (name); /* Make the exported environment variable SHELL be the user's login shell. Note that the `tset' command looks at this variable to determine what style of commands to output; if it ends in "csh", then C-shell commands are output, else Bourne shell commands. */ set_shell_var (); /* Make a variable called BASH_VERSION which contains the version info. */ bind_variable ("BASH_VERSION", shell_version_string (), 0); #if defined (ARRAY_VARS) make_vers_array (); #endif if (command_execution_string) bind_variable ("BASH_EXECUTION_STRING", command_execution_string, 0); /* Find out if we're supposed to be in Posix.2 mode via an environment variable. */ temp_var = find_variable ("POSIXLY_CORRECT"); if (!temp_var) temp_var = find_variable ("POSIX_PEDANTIC"); if (temp_var && imported_p (temp_var)) sv_strict_posix (temp_var->name); #if defined (HISTORY) /* Set history variables to defaults, and then do whatever we would do if the variable had just been set. Do this only in the case that we are remembering commands on the history list. */ if (remember_on_history) { name = bash_tilde_expand (posixly_correct ? "~/.sh_history" : "~/.bash_history", 0); set_if_not ("HISTFILE", name); free (name); } #endif /* HISTORY */ /* Seed the random number generator. */ seedrand (); /* Handle some "special" variables that we may have inherited from a parent shell. */ if (interactive_shell) { temp_var = find_variable ("IGNOREEOF"); if (!temp_var) temp_var = find_variable ("ignoreeof"); if (temp_var && imported_p (temp_var)) sv_ignoreeof (temp_var->name); } #if defined (HISTORY) if (interactive_shell && remember_on_history) { sv_history_control ("HISTCONTROL"); sv_histignore ("HISTIGNORE"); sv_histtimefmt ("HISTTIMEFORMAT"); } #endif /* HISTORY */ #if defined (READLINE) && defined (STRICT_POSIX) /* POSIXLY_CORRECT will only be 1 here if the shell was compiled -DSTRICT_POSIX */ if (interactive_shell && posixly_correct && no_line_editing == 0) rl_prefer_env_winsize = 1; #endif /* READLINE && STRICT_POSIX */ /* * 24 October 2001 * * I'm tired of the arguing and bug reports. Bash now leaves SSH_CLIENT * and SSH2_CLIENT alone. I'm going to rely on the shell_level check in * isnetconn() to avoid running the startup files more often than wanted. * That will, of course, only work if the user's login shell is bash, so * I've made that behavior conditional on SSH_SOURCE_BASHRC being defined * in config-top.h. */ #if 0 temp_var = find_variable ("SSH_CLIENT"); if (temp_var && imported_p (temp_var)) { VUNSETATTR (temp_var, att_exported); array_needs_making = 1; } temp_var = find_variable ("SSH2_CLIENT"); if (temp_var && imported_p (temp_var)) { VUNSETATTR (temp_var, att_exported); array_needs_making = 1; } #endif /* Get the user's real and effective user ids. */ uidset (); temp_var = find_variable ("BASH_XTRACEFD"); if (temp_var && imported_p (temp_var)) sv_xtracefd (temp_var->name); /* Initialize the dynamic variables, and seed their values. */ initialize_dynamic_variables (); }
0
87,438
panel_set_option(struct parsed_tagarg *arg) { FILE *f = NULL; char *p; Str s = Strnew(), tmp; if (config_file == NULL) { disp_message("There's no config file... config not saved", FALSE); } else { f = fopen(config_file, "wt"); if (f == NULL) { disp_message("Can't write option!", FALSE); } } while (arg) { /* InnerCharset -> SystemCharset */ if (arg->value) { p = conv_to_system(arg->value); if (set_param(arg->arg, p)) { tmp = Sprintf("%s %s\n", arg->arg, p); Strcat(tmp, s); s = tmp; } } arg = arg->next; } if (f) { fputs(s->ptr, f); fclose(f); } sync_with_option(); backBf(); }
0
324,620
static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, int access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot, target_ulong *page_size_ptr, uint32_t *fsr, ARMMMUFaultInfo *fi) { ARMCPU *cpu = arm_env_get_cpu(env); CPUState *cs = CPU(cpu); /* Read an LPAE long-descriptor translation table. */ MMUFaultType fault_type = translation_fault; uint32_t level; uint32_t epd = 0; int32_t t0sz, t1sz; uint32_t tg; uint64_t ttbr; int ttbr_select; hwaddr descaddr, indexmask, indexmask_grainsize; uint32_t tableattrs; target_ulong page_size; uint32_t attrs; int32_t stride = 9; int32_t va_size; int inputsize; int32_t tbi = 0; TCR *tcr = regime_tcr(env, mmu_idx); int ap, ns, xn, pxn; uint32_t el = regime_el(env, mmu_idx); bool ttbr1_valid = true; uint64_t descaddrmask; /* TODO: * This code does not handle the different format TCR for VTCR_EL2. * This code also does not support shareability levels. * Attribute and permission bit handling should also be checked when adding * support for those page table walks. */ if (arm_el_is_aa64(env, el)) { level = 0; va_size = 64; if (el > 1) { if (mmu_idx != ARMMMUIdx_S2NS) { tbi = extract64(tcr->raw_tcr, 20, 1); } } else { if (extract64(address, 55, 1)) { tbi = extract64(tcr->raw_tcr, 38, 1); } else { tbi = extract64(tcr->raw_tcr, 37, 1); } } tbi *= 8; /* If we are in 64-bit EL2 or EL3 then there is no TTBR1, so mark it * invalid. */ if (el > 1) { ttbr1_valid = false; } } else { level = 1; va_size = 32; /* There is no TTBR1 for EL2 */ if (el == 2) { ttbr1_valid = false; } } /* Determine whether this address is in the region controlled by * TTBR0 or TTBR1 (or if it is in neither region and should fault). * This is a Non-secure PL0/1 stage 1 translation, so controlled by * TTBCR/TTBR0/TTBR1 in accordance with ARM ARM DDI0406C table B-32: */ if (va_size == 64) { /* AArch64 translation. */ t0sz = extract32(tcr->raw_tcr, 0, 6); t0sz = MIN(t0sz, 39); t0sz = MAX(t0sz, 16); } else if (mmu_idx != ARMMMUIdx_S2NS) { /* AArch32 stage 1 translation. */ t0sz = extract32(tcr->raw_tcr, 0, 3); } else { /* AArch32 stage 2 translation. */ bool sext = extract32(tcr->raw_tcr, 4, 1); bool sign = extract32(tcr->raw_tcr, 3, 1); t0sz = sextract32(tcr->raw_tcr, 0, 4); /* If the sign-extend bit is not the same as t0sz[3], the result * is unpredictable. Flag this as a guest error. */ if (sign != sext) { qemu_log_mask(LOG_GUEST_ERROR, "AArch32: VTCR.S / VTCR.T0SZ[3] missmatch\n"); } } t1sz = extract32(tcr->raw_tcr, 16, 6); if (va_size == 64) { t1sz = MIN(t1sz, 39); t1sz = MAX(t1sz, 16); } if (t0sz && !extract64(address, va_size - t0sz, t0sz - tbi)) { /* there is a ttbr0 region and we are in it (high bits all zero) */ ttbr_select = 0; } else if (ttbr1_valid && t1sz && !extract64(~address, va_size - t1sz, t1sz - tbi)) { /* there is a ttbr1 region and we are in it (high bits all one) */ ttbr_select = 1; } else if (!t0sz) { /* ttbr0 region is "everything not in the ttbr1 region" */ ttbr_select = 0; } else if (!t1sz && ttbr1_valid) { /* ttbr1 region is "everything not in the ttbr0 region" */ ttbr_select = 1; } else { /* in the gap between the two regions, this is a Translation fault */ fault_type = translation_fault; goto do_fault; } /* Note that QEMU ignores shareability and cacheability attributes, * so we don't need to do anything with the SH, ORGN, IRGN fields * in the TTBCR. Similarly, TTBCR:A1 selects whether we get the * ASID from TTBR0 or TTBR1, but QEMU's TLB doesn't currently * implement any ASID-like capability so we can ignore it (instead * we will always flush the TLB any time the ASID is changed). */ if (ttbr_select == 0) { ttbr = regime_ttbr(env, mmu_idx, 0); if (el < 2) { epd = extract32(tcr->raw_tcr, 7, 1); } inputsize = va_size - t0sz; tg = extract32(tcr->raw_tcr, 14, 2); if (tg == 1) { /* 64KB pages */ stride = 13; } if (tg == 2) { /* 16KB pages */ stride = 11; } } else { /* We should only be here if TTBR1 is valid */ assert(ttbr1_valid); ttbr = regime_ttbr(env, mmu_idx, 1); epd = extract32(tcr->raw_tcr, 23, 1); inputsize = va_size - t1sz; tg = extract32(tcr->raw_tcr, 30, 2); if (tg == 3) { /* 64KB pages */ stride = 13; } if (tg == 1) { /* 16KB pages */ stride = 11; } } /* Here we should have set up all the parameters for the translation: * va_size, inputsize, ttbr, epd, stride, tbi */ if (epd) { /* Translation table walk disabled => Translation fault on TLB miss * Note: This is always 0 on 64-bit EL2 and EL3. */ goto do_fault; } if (mmu_idx != ARMMMUIdx_S2NS) { /* The starting level depends on the virtual address size (which can * be up to 48 bits) and the translation granule size. It indicates * the number of strides (stride bits at a time) needed to * consume the bits of the input address. In the pseudocode this is: * level = 4 - RoundUp((inputsize - grainsize) / stride) * where their 'inputsize' is our 'inputsize', 'grainsize' is * our 'stride + 3' and 'stride' is our 'stride'. * Applying the usual "rounded up m/n is (m+n-1)/n" and simplifying: * = 4 - (inputsize - stride - 3 + stride - 1) / stride * = 4 - (inputsize - 4) / stride; */ level = 4 - (inputsize - 4) / stride; } else { /* For stage 2 translations the starting level is specified by the * VTCR_EL2.SL0 field (whose interpretation depends on the page size) */ uint32_t sl0 = extract32(tcr->raw_tcr, 6, 2); uint32_t startlevel; bool ok; if (va_size == 32 || stride == 9) { /* AArch32 or 4KB pages */ startlevel = 2 - sl0; } else { /* 16KB or 64KB pages */ startlevel = 3 - sl0; } /* Check that the starting level is valid. */ ok = check_s2_mmu_setup(cpu, va_size == 64, startlevel, inputsize, stride); if (!ok) { fault_type = translation_fault; goto do_fault; } level = startlevel; } indexmask_grainsize = (1ULL << (stride + 3)) - 1; indexmask = (1ULL << (inputsize - (stride * (4 - level)))) - 1; /* Now we can extract the actual base address from the TTBR */ descaddr = extract64(ttbr, 0, 48); descaddr &= ~indexmask; /* The address field in the descriptor goes up to bit 39 for ARMv7 * but up to bit 47 for ARMv8, but we use the descaddrmask * up to bit 39 for AArch32, because we don't need other bits in that case * to construct next descriptor address (anyway they should be all zeroes). */ descaddrmask = ((1ull << (va_size == 64 ? 48 : 40)) - 1) & ~indexmask_grainsize; /* Secure accesses start with the page table in secure memory and * can be downgraded to non-secure at any step. Non-secure accesses * remain non-secure. We implement this by just ORing in the NSTable/NS * bits at each step. */ tableattrs = regime_is_secure(env, mmu_idx) ? 0 : (1 << 4); for (;;) { uint64_t descriptor; bool nstable; descaddr |= (address >> (stride * (4 - level))) & indexmask; descaddr &= ~7ULL; nstable = extract32(tableattrs, 4, 1); descriptor = arm_ldq_ptw(cs, descaddr, !nstable, mmu_idx, fsr, fi); if (fi->s1ptw) { goto do_fault; } if (!(descriptor & 1) || (!(descriptor & 2) && (level == 3))) { /* Invalid, or the Reserved level 3 encoding */ goto do_fault; } descaddr = descriptor & descaddrmask; if ((descriptor & 2) && (level < 3)) { /* Table entry. The top five bits are attributes which may * propagate down through lower levels of the table (and * which are all arranged so that 0 means "no effect", so * we can gather them up by ORing in the bits at each level). */ tableattrs |= extract64(descriptor, 59, 5); level++; indexmask = indexmask_grainsize; continue; } /* Block entry at level 1 or 2, or page entry at level 3. * These are basically the same thing, although the number * of bits we pull in from the vaddr varies. */ page_size = (1ULL << ((stride * (4 - level)) + 3)); descaddr |= (address & (page_size - 1)); /* Extract attributes from the descriptor */ attrs = extract64(descriptor, 2, 10) | (extract64(descriptor, 52, 12) << 10); if (mmu_idx == ARMMMUIdx_S2NS) { /* Stage 2 table descriptors do not include any attribute fields */ break; } /* Merge in attributes from table descriptors */ attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */ attrs |= extract32(tableattrs, 3, 1) << 5; /* APTable[1] => AP[2] */ /* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1 * means "force PL1 access only", which means forcing AP[1] to 0. */ if (extract32(tableattrs, 2, 1)) { attrs &= ~(1 << 4); } attrs |= nstable << 3; /* NS */ break; } /* Here descaddr is the final physical address, and attributes * are all in attrs. */ fault_type = access_fault; if ((attrs & (1 << 8)) == 0) { /* Access flag */ goto do_fault; } ap = extract32(attrs, 4, 2); xn = extract32(attrs, 12, 1); if (mmu_idx == ARMMMUIdx_S2NS) { ns = true; *prot = get_S2prot(env, ap, xn); } else { ns = extract32(attrs, 3, 1); pxn = extract32(attrs, 11, 1); *prot = get_S1prot(env, mmu_idx, va_size == 64, ap, ns, xn, pxn); } fault_type = permission_fault; if (!(*prot & (1 << access_type))) { goto do_fault; } if (ns) { /* The NS bit will (as required by the architecture) have no effect if * the CPU doesn't support TZ or this is a non-secure translation * regime, because the attribute will already be non-secure. */ txattrs->secure = false; } *phys_ptr = descaddr; *page_size_ptr = page_size; return false; do_fault: /* Long-descriptor format IFSR/DFSR value */ *fsr = (1 << 9) | (fault_type << 2) | level; /* Tag the error as S2 for failed S1 PTW at S2 or ordinary S2. */ fi->stage2 = fi->s1ptw || (mmu_idx == ARMMMUIdx_S2NS); return true; }
0
421,628
static inline int u128_cmp(u128_t x, u128_t y) { /* return -1, 0, 1 on sort order */ if(x.h < y.h) return -1; if(x.h > y.h) return 1; if(x.l < y.l) return -1; if(x.l > y.l) return 1; return 0; }
0
63,479
void CLASS setCanonBodyFeatures(unsigned id) { imgdata.lens.makernotes.CamID = id; if ((id == 0x80000001) || // 1D (id == 0x80000174) || // 1D2 (id == 0x80000232) || // 1D2N (id == 0x80000169) || // 1D3 (id == 0x80000281) // 1D4 ) { imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSH; imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; } else if ((id == 0x80000167) || // 1Ds (id == 0x80000188) || // 1Ds2 (id == 0x80000215) || // 1Ds3 (id == 0x80000269) || // 1DX (id == 0x80000328) || // 1DX2 (id == 0x80000324) || // 1DC (id == 0x80000213) || // 5D (id == 0x80000218) || // 5D2 (id == 0x80000285) || // 5D3 (id == 0x80000349) || // 5D4 (id == 0x80000382) || // 5DS (id == 0x80000401) || // 5DS R (id == 0x80000302) // 6D ) { imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_FF; imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; } else if ((id == 0x80000331) || // M (id == 0x80000355) || // M2 (id == 0x80000374) || // M3 (id == 0x80000384) || // M10 (id == 0x80000394) // M5 ) { imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF_M; } else if ((id == 0x01140000) || // D30 (id == 0x01668000) || // D60 (id > 0x80000000)) { imgdata.lens.makernotes.CameraFormat = LIBRAW_FORMAT_APSC; imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_Canon_EF; imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_Unknown; } else { imgdata.lens.makernotes.CameraMount = LIBRAW_MOUNT_FixedLens; imgdata.lens.makernotes.LensMount = LIBRAW_MOUNT_FixedLens; } return; }
0
127,758
generate_primary_key_list(MYSQL *mysql, option_string *engine_stmt) { MYSQL_RES *result; MYSQL_ROW row; unsigned long long counter; DBUG_ENTER("generate_primary_key_list"); /* Blackhole is a special case, this allows us to test the upper end of the server during load runs. */ if (opt_only_print || (engine_stmt && strstr(engine_stmt->string, "blackhole"))) { primary_keys_number_of= 1; primary_keys= (char **)my_malloc(PSI_NOT_INSTRUMENTED, (uint)(sizeof(char *) * primary_keys_number_of), MYF(MY_ZEROFILL|MY_FAE|MY_WME)); /* Yes, we strdup a const string to simplify the interface */ primary_keys[0]= my_strdup(PSI_NOT_INSTRUMENTED, "796c4422-1d94-102a-9d6d-00e0812d", MYF(0)); } else { if (run_query(mysql, "SELECT id from t1", strlen("SELECT id from t1"))) { fprintf(stderr,"%s: Cannot select GUID primary keys. (%s)\n", my_progname, mysql_error(mysql)); exit(1); } if (!(result= mysql_store_result(mysql))) { fprintf(stderr, "%s: Error when storing result: %d %s\n", my_progname, mysql_errno(mysql), mysql_error(mysql)); exit(1); } primary_keys_number_of= mysql_num_rows(result); /* So why check this? Blackhole :) */ if (primary_keys_number_of) { /* We create the structure and loop and create the items. */ primary_keys= (char **)my_malloc(PSI_NOT_INSTRUMENTED, (uint)(sizeof(char *) * primary_keys_number_of), MYF(MY_ZEROFILL|MY_FAE|MY_WME)); row= mysql_fetch_row(result); for (counter= 0; counter < primary_keys_number_of; counter++, row= mysql_fetch_row(result)) primary_keys[counter]= my_strdup(PSI_NOT_INSTRUMENTED, row[0], MYF(0)); } mysql_free_result(result); } DBUG_RETURN(0); }
0
444,289
bool ConnectionManagerImpl::ActiveStreamFilterBase::commonHandleAfterDataCallback( FilterDataStatus status, Buffer::Instance& provided_data, bool& buffer_was_streaming) { if (status == FilterDataStatus::Continue) { if (iteration_state_ == IterationState::StopSingleIteration) { commonHandleBufferData(provided_data); commonContinue(); return false; } else { ASSERT(headers_continued_); } } else { iteration_state_ = IterationState::StopSingleIteration; if (status == FilterDataStatus::StopIterationAndBuffer || status == FilterDataStatus::StopIterationAndWatermark) { buffer_was_streaming = status == FilterDataStatus::StopIterationAndWatermark; commonHandleBufferData(provided_data); } else if (complete() && !hasTrailers() && !bufferedData()) { // If this filter is doing StopIterationNoBuffer and this stream is terminated with a zero // byte data frame, we need to create an empty buffer to make sure that when commonContinue // is called, the pipeline resumes with an empty data frame with end_stream = true ASSERT(end_stream_); bufferedData() = createBuffer(); } return false; } return true; }
0
465,925
BnGeneratePrimeForRSA( bigNum prime, // IN/OUT: points to the BN that will get the // random value UINT32 bits, // IN: number of bits to get UINT32 exponent, // IN: the exponent RAND_STATE *rand // IN: the random state ) { BOOL found = FALSE; // // Make sure that the prime is large enough pAssert(prime->allocated >= BITS_TO_CRYPT_WORDS(bits)); // Only try to handle specific sizes of keys in order to save overhead pAssert((bits % 32) == 0); prime->size = BITS_TO_CRYPT_WORDS(bits); while(!found) { // The change below is to make sure that all keys that are generated from the same // seed value will be the same regardless of the endianess or word size of the CPU. // DRBG_Generate(rand, (BYTE *)prime->d, (UINT16)BITS_TO_BYTES(bits));// old // if(g_inFailureMode) // old // libtpms changed begin if (1) { DRBG_Generate(rand, (BYTE *)prime->d, (UINT16)BITS_TO_BYTES(bits)); if (g_inFailureMode) return TPM_RC_FAILURE; } else { if(!BnGetRandomBits(prime, bits, rand)) // new return TPM_RC_FAILURE; } RsaAdjustPrimeCandidate(prime); // libtpms changed end found = RsaCheckPrime(prime, exponent, rand) == TPM_RC_SUCCESS; } return TPM_RC_SUCCESS; }
0
141,828
void CWebServer::Cmd_GetPlanDevices(WebEmSession & session, const request& req, Json::Value &root) { std::string idx = request::findValue(&req, "idx"); if (idx.empty()) return; root["status"] = "OK"; root["title"] = "GetPlanDevices"; std::vector<std::vector<std::string> > result; result = m_sql.safe_query("SELECT ID, DevSceneType, DeviceRowID, [Order] FROM DeviceToPlansMap WHERE (PlanID=='%q') ORDER BY [Order]", idx.c_str()); if (!result.empty()) { int ii = 0; for (const auto & itt : result) { std::vector<std::string> sd = itt; std::string ID = sd[0]; int DevSceneType = atoi(sd[1].c_str()); std::string DevSceneRowID = sd[2]; std::string Name = ""; if (DevSceneType == 0) { std::vector<std::vector<std::string> > result2; result2 = m_sql.safe_query("SELECT Name FROM DeviceStatus WHERE (ID=='%q')", DevSceneRowID.c_str()); if (!result2.empty()) { Name = result2[0][0]; } } else { std::vector<std::vector<std::string> > result2; result2 = m_sql.safe_query("SELECT Name FROM Scenes WHERE (ID=='%q')", DevSceneRowID.c_str()); if (!result2.empty()) { Name = "[Scene] " + result2[0][0]; } } if (Name != "") { root["result"][ii]["idx"] = ID; root["result"][ii]["devidx"] = DevSceneRowID; root["result"][ii]["type"] = DevSceneType; root["result"][ii]["DevSceneRowID"] = DevSceneRowID; root["result"][ii]["order"] = sd[3]; root["result"][ii]["Name"] = Name; ii++; } } } }
0
293,333
static const char* Helper(PyObject* obj, int depth, ConverterState* state, T** buf) { if (TF_PREDICT_FALSE(obj == nullptr)) { return ErrorConverting; } Safe_PyObjectPtr seq = make_safe(PySequence_Fast(obj, "")); if (TF_PREDICT_FALSE(seq == nullptr)) return ErrorRectangular; const int64 s = state->inferred_shape.dim_size(depth); if (TF_PREDICT_FALSE(s != PySequence_Fast_GET_SIZE(seq.get()))) { return ErrorRectangular; } if (state->inferred_shape.dims() - depth > 1) { /* Iterate over outer dim, and recursively convert each element. */ for (int64 i = 0; i < s; ++i) { const char* error = Helper(PySequence_Fast_GET_ITEM(seq.get(), i), depth + 1, state, buf); if (TF_PREDICT_FALSE(error != nullptr)) return error; } } else { PyObject** l = PySequence_Fast_ITEMS(seq.get()); for (int64 i = 0; i < s; ++i) { auto scalar = ZeroDimArrayToScalar(l[i], state); const char* error = ConverterTraits<T>::ConvertScalar(scalar, *buf); Py_DECREF(scalar); if (TF_PREDICT_FALSE(error != nullptr)) return error; ++*buf; } } return nullptr; }
0
359,386
static inline u32 tcf_auto_prio(struct tcf_proto *tp) { u32 first = TC_H_MAKE(0xC0000000U, 0U); if (tp) first = tp->prio-1; return first; }
0
24,553
static inline bool is_ra ( hb_codepoint_t u ) { for ( unsigned int i = 0 ; i < ARRAY_LENGTH ( ra_chars ) ; i ++ ) if ( u == ra_chars [ i ] ) return true ; return false ; }
0
309,969
void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect, const gfx::Rect& clip_rect) { if (window_rect.width() < 0 || window_rect.width() > (1<<15) || window_rect.height() < 0 || window_rect.height() > (1<<15) || window_rect.width() * window_rect.height() > (8<<20)) { return; } plugin_rect_ = window_rect; bool bitmaps_changed = false; PluginMsg_UpdateGeometry_Param param; #if defined(OS_MACOSX) param.ack_key = -1; #endif if (windowless_) { if (!backing_store_canvas_.get() || (window_rect.width() != backing_store_canvas_->getDevice()->width() || window_rect.height() != backing_store_canvas_->getDevice()->height())) { bitmaps_changed = true; #if defined(OS_MACOSX) if (backing_store_.get()) { param.ack_key = backing_store_->handle().fd; } #endif ResetWindowlessBitmaps(); if (!window_rect.IsEmpty()) { if (!CreateBitmap(&backing_store_, &backing_store_canvas_) || !CreateBitmap(&transport_store_, &transport_store_canvas_) || (transparent_ && !CreateBitmap(&background_store_, &background_store_canvas_))) { DCHECK(false); ResetWindowlessBitmaps(); return; } } } } param.window_rect = window_rect; param.clip_rect = clip_rect; param.windowless_buffer = TransportDIB::DefaultHandleValue(); param.background_buffer = TransportDIB::DefaultHandleValue(); #if defined(OS_POSIX) if (bitmaps_changed) #endif { if (transport_store_.get()) param.windowless_buffer = transport_store_->handle(); if (background_store_.get()) param.background_buffer = background_store_->handle(); } IPC::Message* msg; #if defined (OS_WIN) if (info_.name.find(L"Windows Media Player") != std::wstring::npos) { msg = new PluginMsg_UpdateGeometrySync(instance_id_, param); } else #endif { msg = new PluginMsg_UpdateGeometry(instance_id_, param); msg->set_unblock(true); } Send(msg); }
0
208,621
void ThreadHeap::VerifyMarking() { for (int i = 0; i < BlinkGC::kNumberOfArenas; ++i) { arenas_[i]->VerifyMarking(); } }
0
223,932
bool Layer::Update(ResourceUpdateQueue* queue, const OcclusionTracker<Layer>* occlusion) { DCHECK(layer_tree_host_); DCHECK_EQ(layer_tree_host_->source_frame_number(), paint_properties_.source_frame_number) << "SavePaintProperties must be called for any layer that is painted."; return false; }
0
201,471
void LocalDOMWindow::DocumentWasClosed() { DispatchWindowLoadEvent(); EnqueuePageshowEvent(kPageshowEventNotPersisted); if (pending_state_object_) EnqueuePopstateEvent(std::move(pending_state_object_)); }
0
447,939
_XimProtoDestroyIC( XIC xic) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; INT16 len; CARD32 reply32[BUFSIZE/4]; char *reply = (char *)reply32; XPointer preply; int buf_size; int ret_code; if (IS_SERVER_CONNECTED(im)) { buf_s[0] = im->private.proto.imid; /* imid */ buf_s[1] = ic->private.proto.icid; /* icid */ len = sizeof(CARD16) /* sizeof imid */ + sizeof(CARD16); /* sizeof icid */ _XimSetHeader((XPointer)buf, XIM_DESTROY_IC, 0, &len); (void)_XimWrite(im, len, (XPointer)buf); _XimFlush(im); buf_size = BUFSIZE; ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, _XimDestroyICCheck, (XPointer)ic); if (ret_code == XIM_OVERFLOW) { buf_size = len; preply = Xmalloc(buf_size); (void)_XimRead(im, &len, preply, buf_size, _XimDestroyICCheck, (XPointer)ic); Xfree(preply); } } UNMARK_IC_CONNECTED(ic); _XimUnregisterFilter(ic); _XimProtoICFree(ic); return; }
0
70,757
static void MagickPNGErrorHandler(png_struct *ping,png_const_charp message) { ExceptionInfo *exception; Image *image; PNGErrorInfo *error_info; error_info=(PNGErrorInfo *) png_get_error_ptr(ping); image=error_info->image; exception=error_info->exception; (void) LogMagickEvent(CoderEvent,GetMagickModule(), " libpng-%s error: %s", png_get_libpng_ver(NULL),message); (void) ThrowMagickException(exception,GetMagickModule(),CoderError,message, "`%s'",image->filename); #if (PNG_LIBPNG_VER < 10500) /* A warning about deprecated use of jmpbuf here is unavoidable if you * are building with libpng-1.4.x and can be ignored. */ longjmp(ping->jmpbuf,1); #else png_longjmp(ping,1); #endif }
0
308,642
void Instance::CreateHorizontalScrollbar() { if (h_scrollbar_.get()) return; h_scrollbar_.reset(new pp::Scrollbar_Dev(this, false)); }
0
448,844
template_mark_fill_rect(int w, int h, byte *gs_restrict dst_ptr, byte *gs_restrict src, int num_comp, int num_spots, int first_blend_spot, byte src_alpha, int rowstride, int planestride, bool additive, pdf14_device *pdev, gs_blend_mode_t blend_mode, bool overprint, gx_color_index drawn_comps, int tag_off, gs_graphics_type_tag_t curr_tag, int alpha_g_off, int shape_off, byte shape, bool isolated) { int i, j, k; gx_color_index comps; byte dst[PDF14_MAX_PLANES] = { 0 }; byte dest_alpha; bool tag_blend = blend_mode == BLEND_MODE_Normal || blend_mode == BLEND_MODE_Compatible || blend_mode == BLEND_MODE_CompatibleOverprint; for (j = h; j > 0; --j) { for (i = w; i > 0; --i) { if ((blend_mode == BLEND_MODE_Normal && src[num_comp] == 0xff && !overprint) || dst_ptr[num_comp * planestride] == 0) { /* dest alpha is zero (or normal, and solid src) just use source. */ if (additive) { /* Hybrid case */ for (k = 0; k < (num_comp - num_spots); k++) { dst_ptr[k * planestride] = src[k]; } for (k = 0; k < num_spots; k++) { dst_ptr[(k + num_comp - num_spots) * planestride] = 255 - src[k + num_comp - num_spots]; } } else { /* Pure subtractive */ for (k = 0; k < num_comp; k++) { dst_ptr[k * planestride] = 255 - src[k]; } } /* alpha */ dst_ptr[num_comp * planestride] = src[num_comp]; } else if (src[num_comp] != 0) { byte *pdst; /* Complement subtractive planes */ if (!additive) { /* Pure subtractive */ for (k = 0; k < num_comp; ++k) dst[k] = 255 - dst_ptr[k * planestride]; } else { /* Hybrid case, additive with subtractive spots */ for (k = 0; k < (num_comp - num_spots); k++) { dst[k] = dst_ptr[k * planestride]; } for (k = 0; k < num_spots; k++) { dst[k + num_comp - num_spots] = 255 - dst_ptr[(k + num_comp - num_spots) * planestride]; } } dst[num_comp] = dst_ptr[num_comp * planestride]; dest_alpha = dst[num_comp]; pdst = art_pdf_composite_pixel_alpha_8_inline(dst, src, num_comp, blend_mode, first_blend_spot, pdev->blend_procs, pdev); /* Until I see otherwise in AR or the spec, do not fool with spot overprinting while we are in an RGB or Gray blend color space. */ if (!additive && overprint) { /* If this is an overprint case, and alpha_r is different than alpha_d then we will need to adjust the colors of the non-drawn components here too */ for (k = 0, comps = drawn_comps; comps != 0; ++k, comps >>= 1) { if ((comps & 0x1) != 0) { dst_ptr[k * planestride] = 255 - pdst[k]; } else if (dest_alpha != pdst[num_comp]) { /* We need val_new = (val_old * old_alpha) / new_alpha */ if (pdst[num_comp] != 0) { int val = (int)floor(((float)dest_alpha / (float)pdst[num_comp]) * (255 - pdst[k]) + 0.5); if (val < 0) val = 0; else if (val > 255) val = 255; dst_ptr[k * planestride] = val; } } } } else { /* Post blend complement for subtractive */ if (!additive) { /* Pure subtractive */ for (k = 0; k < num_comp; ++k) dst_ptr[k * planestride] = 255 - pdst[k]; } else { /* Hybrid case, additive with subtractive spots */ for (k = 0; k < (num_comp - num_spots); k++) { dst_ptr[k * planestride] = pdst[k]; } for (k = 0; k < num_spots; k++) { dst_ptr[(k + num_comp - num_spots) * planestride] = 255 - pdst[k + num_comp - num_spots]; } } } /* The alpha channel */ dst_ptr[num_comp * planestride] = pdst[num_comp]; } if (tag_off) { /* If src alpha is 100% then set to curr_tag, else or */ /* other than Normal BM, we always OR */ if (src[num_comp] == 255 && tag_blend) { dst_ptr[tag_off] = curr_tag; } else { dst_ptr[tag_off] |= curr_tag; } } if (alpha_g_off) { int tmp = (255 - dst_ptr[alpha_g_off]) * src_alpha + 0x80; dst_ptr[alpha_g_off] = 255 - ((tmp + (tmp >> 8)) >> 8); } if (shape_off) { int tmp = (255 - dst_ptr[shape_off]) * shape + 0x80; dst_ptr[shape_off] = 255 - ((tmp + (tmp >> 8)) >> 8); } ++dst_ptr; } dst_ptr += rowstride; } }
0
284,342
WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate( WebContents* web_contents) { return NULL; }
0
346,206
http_splitheader(struct http *hp, int req) { char *p, *q, **hh; int n; char buf[20]; CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); if (req) { memset(hp->req, 0, sizeof hp->req); hh = hp->req; } else { memset(hp->resp, 0, sizeof hp->resp); hh = hp->resp; } n = 0; p = hp->rxbuf; /* REQ/PROTO */ while (vct_islws(*p)) p++; hh[n++] = p; while (!vct_islws(*p)) p++; assert(!vct_iscrlf(*p)); *p++ = '\0'; /* URL/STATUS */ while (vct_issp(*p)) /* XXX: H space only */ p++; assert(!vct_iscrlf(*p)); hh[n++] = p; while (!vct_islws(*p)) p++; if (vct_iscrlf(*p)) { hh[n++] = NULL; q = p; p += vct_skipcrlf(p); *q = '\0'; } else { *p++ = '\0'; /* PROTO/MSG */ while (vct_issp(*p)) /* XXX: H space only */ p++; hh[n++] = p; while (!vct_iscrlf(*p)) p++; q = p; p += vct_skipcrlf(p); *q = '\0'; } assert(n == 3); while (*p != '\0') { assert(n < MAX_HDR); if (vct_iscrlf(*p)) break; hh[n++] = p++; while (*p != '\0' && !vct_iscrlf(*p)) p++; q = p; p += vct_skipcrlf(p); *q = '\0'; } p += vct_skipcrlf(p); assert(*p == '\0'); for (n = 0; n < 3 || hh[n] != NULL; n++) { sprintf(buf, "http[%2d] ", n); vtc_dump(hp->vl, 4, buf, hh[n], -1); } }
1
181,973
fbStore_b5g6r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Split(READ(values + i)); WRITE(pixel++, ((b << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((r >> 3) )); } }
0
252,767
void Con_Close( void ) { if ( !com_cl_running->integer ) { return; } Field_Clear( &g_consoleField ); Con_ClearNotify(); Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CONSOLE ); con.finalFrac = 0; // none visible con.displayFrac = 0; }
0
210,032
xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, xmlNodePtr out) { if (ns == NULL) return(NULL); #ifdef XSLT_REFACTORED /* * Namespace exclusion and ns-aliasing is performed at * compilation-time in the refactored code. * Additionally, aliasing is not intended for non Literal * Result Elements. */ return(xsltGetSpecialNamespace(ctxt, cur, ns->href, ns->prefix, out)); #else { xsltStylesheetPtr style; const xmlChar *URI = NULL; /* the replacement URI */ if ((ctxt == NULL) || (cur == NULL) || (out == NULL)) return(NULL); style = ctxt->style; while (style != NULL) { if (style->nsAliases != NULL) URI = (const xmlChar *) xmlHashLookup(style->nsAliases, ns->href); if (URI != NULL) break; style = xsltNextImport(style); } if (URI == UNDEFINED_DEFAULT_NS) { return(xsltGetSpecialNamespace(ctxt, cur, NULL, NULL, out)); #if 0 /* * TODO: Removed, since wrong. If there was no default * namespace in the stylesheet then this must resolve to * the NULL namespace. */ xmlNsPtr dflt; dflt = xmlSearchNs(cur->doc, cur, NULL); if (dflt != NULL) URI = dflt->href; else return NULL; #endif } else if (URI == NULL) URI = ns->href; return(xsltGetSpecialNamespace(ctxt, cur, URI, ns->prefix, out)); } #endif }
0
221,008
explicit FindAdapter(Plugin* plugin) : pp::Find_Dev(plugin), plugin_(plugin) { BrowserPpp* proxy = plugin_->ppapi_proxy(); CHECK(proxy != NULL); ppp_find_ = static_cast<const PPP_Find_Dev*>( proxy->GetPluginInterface(PPP_FIND_DEV_INTERFACE)); }
0
214,418
FakeRemoteGattService* FakeCentral::GetFakeRemoteGattService( const std::string& peripheral_address, const std::string& service_id) const { FakePeripheral* fake_peripheral = GetFakePeripheral(peripheral_address); if (fake_peripheral == nullptr) { return nullptr; } return static_cast<FakeRemoteGattService*>( fake_peripheral->GetGattService(service_id)); }
0
172,082
_bdf_list_ensure( _bdf_list_t* list, unsigned long num_items ) /* same as _bdf_list_t.used */ { FT_Error error = BDF_Err_Ok; if ( num_items > list->size ) { unsigned long oldsize = list->size; /* same as _bdf_list_t.size */ unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5; unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) ); FT_Memory memory = list->memory; if ( oldsize == bigsize ) { error = BDF_Err_Out_Of_Memory; goto Exit; } else if ( newsize < oldsize || newsize > bigsize ) newsize = bigsize; if ( FT_RENEW_ARRAY( list->field, oldsize, newsize ) ) goto Exit; list->size = newsize; } Exit: return error; }
0
191,931
static void ByteStringMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8SetReturnValueString(info, impl->byteStringMethod(), info.GetIsolate()); }
0
309,421
PHP_FUNCTION(pg_num_fields) { php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_NUM_FIELDS); }
0
57,693
void str_to_file(const char *fname, char *str, int size) { str_to_file2(fname, str, size, FALSE); }
0
476,478
static int xattr_map_client(const struct lo_data *lo, const char *client_name, char **out_name) { size_t i; for (i = 0; i < lo->xattr_map_nentries; i++) { const XattrMapEntry *cur_entry = lo->xattr_map_list + i; if ((cur_entry->flags & XATTR_MAP_FLAG_CLIENT) && (strstart(client_name, cur_entry->key, NULL))) { if (cur_entry->flags & XATTR_MAP_FLAG_BAD) { return -EPERM; } if (cur_entry->flags & XATTR_MAP_FLAG_UNSUPPORTED) { return -ENOTSUP; } if (cur_entry->flags & XATTR_MAP_FLAG_OK) { /* Unmodified name */ return 0; } if (cur_entry->flags & XATTR_MAP_FLAG_PREFIX) { *out_name = g_try_malloc(strlen(client_name) + strlen(cur_entry->prepend) + 1); if (!*out_name) { return -ENOMEM; } sprintf(*out_name, "%s%s", cur_entry->prepend, client_name); return 0; } } } return -EPERM; }
0
116,403
x86_Init(struct _7zip *zip) { zip->bcj_state = 0; zip->bcj_prevPosT = (size_t)0 - 1; zip->bcj_prevMask = 0; zip->bcj_ip = 5; }
0
78,158
static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, unsigned int optlen) { struct sctp_sock *sp = sctp_sk(sk); /* Applicable to UDP-style socket only */ if (sctp_style(sk, TCP)) return -EOPNOTSUPP; if (optlen != sizeof(int)) return -EINVAL; if (copy_from_user(&sp->autoclose, optval, optlen)) return -EFAULT; return 0; }
0
271,525
int ext4_change_inode_journal_flag(struct inode *inode, int val) { journal_t *journal; handle_t *handle; int err; /* * We have to be very careful here: changing a data block's * journaling status dynamically is dangerous. If we write a * data block to the journal, change the status and then delete * that block, we risk forgetting to revoke the old log record * from the journal and so a subsequent replay can corrupt data. * So, first we make sure that the journal is empty and that * nobody is changing anything. */ journal = EXT4_JOURNAL(inode); if (!journal) return 0; if (is_journal_aborted(journal)) return -EROFS; /* We have to allocate physical blocks for delalloc blocks * before flushing journal. otherwise delalloc blocks can not * be allocated any more. even more truncate on delalloc blocks * could trigger BUG by flushing delalloc blocks in journal. * There is no delalloc block in non-journal data mode. */ if (val && test_opt(inode->i_sb, DELALLOC)) { err = ext4_alloc_da_blocks(inode); if (err < 0) return err; } /* Wait for all existing dio workers */ ext4_inode_block_unlocked_dio(inode); inode_dio_wait(inode); jbd2_journal_lock_updates(journal); /* * OK, there are no updates running now, and all cached data is * synced to disk. We are now in a completely consistent state * which doesn't have anything in the journal, and we know that * no filesystem updates are running, so it is safe to modify * the inode's in-core data-journaling state flag now. */ if (val) ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); else { err = jbd2_journal_flush(journal); if (err < 0) { jbd2_journal_unlock_updates(journal); ext4_inode_resume_unlocked_dio(inode); return err; } ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); } ext4_set_aops(inode); jbd2_journal_unlock_updates(journal); ext4_inode_resume_unlocked_dio(inode); /* Finally we can mark the inode as dirty. */ handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); if (IS_ERR(handle)) return PTR_ERR(handle); err = ext4_mark_inode_dirty(handle, inode); ext4_handle_sync(handle); ext4_journal_stop(handle); ext4_std_error(inode->i_sb, err); return err; }
0
216,578
void _WM_do_control_channel_expression(struct _mdi *mdi, struct _event_data *data) { uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__,ch, data->data.value); mdi->channel[ch].expression = data->data.value; _WM_AdjustChannelVolumes(mdi, ch); }
0
215,217
isofile_add_entry(struct iso9660 *iso9660, struct isofile *file) { file->allnext = NULL; *iso9660->all_file_list.last = file; iso9660->all_file_list.last = &(file->allnext); }
0
173,505
ClampScrollableAreas() { for (auto& scrollable_area : NeedsClampList()) scrollable_area->ClampScrollOffsetAfterOverflowChange(); NeedsClampList().clear(); }
0
389,737
static inline bool cpu_watchpoint_address_matches(CPUWatchpoint *wp, vaddr addr, vaddr len) { /* We know the lengths are non-zero, but a little caution is * required to avoid errors in the case where the range ends * exactly at the top of the address space and so addr + len * wraps round to zero. */ vaddr wpend = wp->vaddr + wp->len - 1; vaddr addrend = addr + len - 1; return !(addr > wpend || wp->vaddr > addrend); }
0
235,206
void FileSystemOperationRunner::OnCopyProgress( const OperationID id, const CopyProgressCallback& callback, FileSystemOperation::CopyProgressType type, const FileSystemURL& source_url, const FileSystemURL& dest_url, int64_t size) { if (is_beginning_operation_) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&FileSystemOperationRunner::OnCopyProgress, weak_ptr_, id, callback, type, source_url, dest_url, size)); return; } callback.Run(type, source_url, dest_url, size); }
0
96,363
int inet_release(struct socket *sock) { struct sock *sk = sock->sk; if (sk) { long timeout; sock_rps_reset_flow(sk); /* Applications forget to leave groups before exiting */ ip_mc_drop_socket(sk); /* If linger is set, we don't return until the close * is complete. Otherwise we return immediately. The * actually closing is done the same either way. * * If the close is due to the process exiting, we never * linger.. */ timeout = 0; if (sock_flag(sk, SOCK_LINGER) && !(current->flags & PF_EXITING)) timeout = sk->sk_lingertime; sock->sk = NULL; sk->sk_prot->close(sk, timeout); } return 0; }
0
69,715
void setHandshakeKeys() { conn_.handshakeWriteCipher = createNoOpAead(); conn_.handshakeWriteHeaderCipher = createNoOpHeaderCipher(); handshakeReadCipher_ = createNoOpAead(); handshakeReadHeaderCipher_ = createNoOpHeaderCipher(); }
0
163,389
bool AwContents::OnReceivedHttpAuthRequest(const JavaRef<jobject>& handler, const std::string& host, const std::string& realm) { DCHECK_CURRENTLY_ON(BrowserThread::UI); JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); if (obj.is_null()) return false; ScopedJavaLocalRef<jstring> jhost = ConvertUTF8ToJavaString(env, host); ScopedJavaLocalRef<jstring> jrealm = ConvertUTF8ToJavaString(env, realm); devtools_instrumentation::ScopedEmbedderCallbackTask embedder_callback( "onReceivedHttpAuthRequest"); Java_AwContents_onReceivedHttpAuthRequest(env, obj.obj(), handler.obj(), jhost.obj(), jrealm.obj()); return true; }
0
324,210
int av_picture_crop(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int top_band, int left_band) { int y_shift; int x_shift; if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB) return -1; y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h; x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w; if (is_yuv_planar(&pix_fmt_info[pix_fmt])) { dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift); dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift); } else{ if(top_band % (1<<y_shift) || left_band % (1<<x_shift)) return -1; if(left_band) //FIXME add support for this too return -1; dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; } dst->linesize[0] = src->linesize[0]; dst->linesize[1] = src->linesize[1]; dst->linesize[2] = src->linesize[2]; return 0; }
0
452,338
static gboolean si_io_channel_cb(GIOChannel *source, GIOCondition condition, gpointer data) { active_session = session_info_get_active_session(session_info); update_active_session_connection(NULL); return G_SOURCE_CONTINUE; }
0
463,041
NamespaceString IDLParserErrorContext::parseNSCollectionRequired(StringData dbName, const BSONElement& element) { const bool isUUID = (element.canonicalType() == canonicalizeBSONType(mongo::BinData) && element.binDataType() == BinDataType::newUUID); uassert(ErrorCodes::BadValue, str::stream() << "Collection name must be provided. UUID is not valid in this " << "context", !isUUID); uassert(ErrorCodes::BadValue, str::stream() << "collection name has invalid type " << typeName(element.type()), element.canonicalType() == canonicalizeBSONType(mongo::String)); const NamespaceString nss(dbName, element.valueStringData()); uassert(ErrorCodes::InvalidNamespace, str::stream() << "Invalid namespace specified '" << nss.ns() << "'", nss.isValid()); return nss; }
0
57,526
QString Display::sessionType() const { return m_displayServer->sessionType(); }
0