本文整理汇总了C++中prf函数的典型用法代码示例。如果您正苦于以下问题:C++ prf函数的具体用法?C++ prf怎么用?C++ prf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_theme_rect
/*virtual*/ void gui_filterbar_c::created()
{
set_theme_rect(CONSTASTR("filter"), false);
filtereditheight = gui->theme().conf().get_int(CONSTASTR("filtereditheight"), 25);
if (prf().get_options().is(UIOPT_SHOW_SEARCH_BAR))
{
gui_textfield_c &e = (MAKE_CHILD<gui_textfield_c>(getrid(), L"", MAX_PATH, 0, false) << (gui_textedit_c::TEXTCHECKFUNC)DELEGATE(this, update_filter));
edit = &e;
e.set_placeholder(TOOLTIP(TTT("Search", 277)), get_default_text_color(COL_PLACEHOLDER));
e.register_kbd_callback(DELEGATE(this, cancel_filter), SSK_ESC, false);
}
if (prf().get_options().is(UIOPT_TAGFILETR_BAR))
{
fill_tags();
}
search_in_messages = prf().is_loaded() && prf().get_options().is(MSGOP_FULL_SEARCH);
if (!is_all())
refresh_list();
__super::created();
}
示例2: prf
void active_protocol_c::save_config( const ts::blob_c &cfg_ )
{
tableview_active_protocol_s &t = prf().get_table_active_protocol();
if (auto *r = t.find<true>(id))
{
if ( r->other.config != cfg_)
{
time_t n = now();
if ( (n-last_backup_time) > prf().backup_period() )
{
last_backup_time = n;
tableview_backup_protocol_s &backup = prf().get_table_backup_protocol();
auto &row = backup.getcreate(0);
row.other.time = now();
row.other.tick = GetTickCount();
row.other.protoid = id;
row.other.config = r->other.config;
}
}
r->other.config = cfg_;
r->other.config.set_size(cfg_.size()); // copy content
r->changed();
prf().changed();
}
}
示例3: verbose
int verbose(const char * fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if (gVerboseMode)
{
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
prf(fmt, ap, putchar, 0);
else
vprf(fmt, ap);
}
{
// Kabyl: BooterLog
struct putc_info pi;
if (!msgbuf)
return 0;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return 0;
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
}
va_end(ap);
return(0);
}
示例4: lastconfig
active_protocol_c::active_protocol_c(int id, const active_protocol_data_s &pd):id(id), lastconfig(ts::Time::past())
{
int dspflags = cfg().dsp_flags();
auto w = syncdata.lock_write();
w().data = pd;
w().data.config.set_size(pd.config.size()); // copy content due race condition
if (w().data.sort_factor == 0)
{
w().data.sort_factor = id;
for(; nullptr != prf().find_ap([&]( const active_protocol_c &oap )->bool {
if (&oap == this) return false;
return oap.sort_factor() == w().data.sort_factor;
}) ; ++w().data.sort_factor );
}
g_app->F_PROTOSORTCHANGED = true;
w().volume = cfg().vol_talk();
w().dsp_flags = dspflags;
w().manual_cos = (contact_online_state_e)prf().manual_cos();
cvt.volume = cfg().vol_mic();
cvt.filter_options.init(fmt_converter_s::FO_NOISE_REDUCTION, FLAG(dspflags, DSP_MIC_NOISE));
cvt.filter_options.init(fmt_converter_s::FO_GAINER, FLAG(dspflags, DSP_MIC_AGC));
}
示例5: error
int error(const char * fmt, ...)
{
va_list ap;
gErrors = true;
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
prf(fmt, ap, putchar, 0);
} else {
vprf(fmt, ap);
}
{
// Kabyl: BooterLog
struct putc_info pi;
if (!msgbuf) {
return 0;
}
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) {
return 0;
}
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
}
va_end(ap);
return(0);
}
示例6: prf
bool gui_filterbar_c::option_handler(RID, GUIPARAM p)
{
search_in_messages = p != nullptr;
if (prf().is_loaded())
prf().set_options( search_in_messages ? MSGOP_FULL_SEARCH : 0, MSGOP_FULL_SEARCH );
found_stuff.fsplit.clear();
refresh_list();
return true;
}
示例7: reader
/*
* reader: read from remote: line -> 1
*/
static int
reader(int oldmask)
{
/*
* 4.3bsd or later and SunOS 4.0 or later use the posiitive
* pid; otherwise use the negative.
*/
pid_t pid = getpid();
int n, remaining;
char *bufp = rcvbuf;
(void) sigset(SIGTTOU, SIG_IGN);
(void) sigset(SIGURG, (void (*)())oob);
ppid = getppid();
if (fcntl(rem, F_SETOWN, pid) == -1)
perror("fcntl F_SETOWN");
/*
* A SIGURG may have been posted before we were completely forked,
* which means we may not have received it. To insure we do not miss
* any urgent data, we force the signal. The signal hander will be
* able to determine if in fact there is urgent data or not.
*/
(void) kill(pid, SIGURG);
(void) setjmp(rcvtop);
sigsetmask(oldmask);
for (;;) {
while ((remaining = rcvcnt - (bufp - rcvbuf)) > 0) {
rcvstate = WRITING;
n = write(STDOUT_FILENO, bufp, remaining);
if (n < 0) {
if (errno != EINTR) {
prf(gettext(
"Write error to terminal: %s"),
strerror(errno));
return (-1);
}
continue;
}
bufp += n;
}
bufp = rcvbuf;
rcvcnt = 0;
rcvstate = READING;
rcvcnt = desread(rem, rcvbuf, sizeof (rcvbuf), 0);
if (rcvcnt == 0)
return (0);
if (rcvcnt < 0) {
if (errno == EINTR)
continue;
prf(gettext("Read error from network: %s"),
strerror(errno));
return (-1);
}
}
}
示例8: generate_key_material
// Generate key material from the shared secret created from the ECDHE key exchange.
static bool generate_key_material(sptps_t *s, const char *shared, size_t len) {
// Initialise cipher and digest structures if necessary
if(!s->outstate) {
s->incipher = chacha_poly1305_init();
s->outcipher = chacha_poly1305_init();
if(!s->incipher || !s->outcipher)
return error(s, EINVAL, "Failed to open cipher");
}
// Allocate memory for key material
size_t keylen = 2 * CHACHA_POLY1305_KEYLEN;
s->key = realloc(s->key, keylen);
if(!s->key)
return error(s, errno, strerror(errno));
// Create the HMAC seed, which is "key expansion" + session label + server nonce + client nonce
char seed[s->labellen + 64 + 13];
strcpy(seed, "key expansion");
if(s->initiator) {
memcpy(seed + 13, s->mykex + 1, 32);
memcpy(seed + 45, s->hiskex + 1, 32);
} else {
memcpy(seed + 13, s->hiskex + 1, 32);
memcpy(seed + 45, s->mykex + 1, 32);
}
memcpy(seed + 77, s->label, s->labellen);
// Use PRF to generate the key material
if(!prf(shared, len, seed, s->labellen + 64 + 13, s->key, keylen))
return error(s, EINVAL, "Failed to generate key material");
return true;
}
示例9: push_debug_settings
void active_protocol_c::push_debug_settings()
{
if (prf().get_options().is(OPTOPT_POWER_USER))
ipcp->send(ipcw(AQ_DEBUG_SETTINGS) << cfg().debug());
else
ipcp->send(ipcw(AQ_DEBUG_SETTINGS) << ts::str_c());
}
示例10: prcmd
void
prcmd(struct trenod *t)
{
nonl++;
prf(t);
nonl = 0;
}
示例11: main
int main(void)
{
Name l[1001]; // l[0][0] stores the size of l[0]
int lsize, i;
lsize = 0;
while(fgets(l[lsize].ori, 90, stdin))
{
l[lsize].len = strlen(l[lsize].ori) - 1;
l[lsize].ori[ l[lsize].len ] = '\0';
//prf("'%s' len = %d\n", l[lsize].ori, l[lsize].len);
if(l[lsize].len == 0)
break;
for(i = 0; i < l[lsize].len; i++)
l[lsize].min[i] = tolower(l[lsize].ori[i]);
lsize++;
}
qsort(l, lsize, sizeof(Name), cmpName);
prf("%s\n", l[lsize - 1].ori);
return 0;
}
示例12: lostpeer
static void
lostpeer(void)
{
(void) sigset(SIGPIPE, SIG_IGN);
prf(gettext("\aConnection to %.*s closed."), MAXHOSTNAMELEN, host);
done(EXIT_FAILURE);
}
示例13: error
int error(const char * fmt, ...)
{
va_list ap;
gErrors = YES;
va_start(ap, fmt);
prf(fmt, ap, putchar, 0);
va_end(ap);
return(0);
}
示例14: printf
int printf(const char * fmt, ...)
{
va_list ap;
if (bootArgs->graphicsMode != TEXT_MODE) return -1;
va_start(ap, fmt);
prf(fmt, ap, putchar, 0);
va_end(ap);
return 0;
}
示例15: switch
ts::uint32 active_protocol_c::gm_handler(gmsg<ISOGM_CHANGED_SETTINGS>&ch)
{
if (ch.pass == 0 && ipcp && (ch.protoid == 0 || ch.protoid == id))
{
switch (ch.sp)
{
case PP_USERNAME:
if (ch.protoid == id)
{
syncdata.lock_write()().data.user_name = ch.s;
ipcp->send(ipcw(AQ_SET_NAME) << ch.s);
} else if (syncdata.lock_read()().data.user_name.is_empty())
ipcp->send(ipcw(AQ_SET_NAME) << ch.s);
return GMRBIT_CALLAGAIN;
case PP_USERSTATUSMSG:
if (ch.protoid == id)
{
syncdata.lock_write()().data.user_statusmsg = ch.s;
ipcp->send(ipcw(AQ_SET_STATUSMSG) << ch.s);
} else if (syncdata.lock_read()().data.user_statusmsg.is_empty())
ipcp->send(ipcw(AQ_SET_STATUSMSG) << ch.s);
return GMRBIT_CALLAGAIN;
case PP_NETWORKNAME:
if (ch.protoid == id)
syncdata.lock_write()().data.name = ch.s;
return GMRBIT_CALLAGAIN;
case PP_ONLINESTATUS:
if (contact_c *c = contacts().get_self().subget( contact_key_s(0, id) ))
set_ostate(c->get_ostate());
break;
case PP_PROFILEOPTIONS:
if (0 != (ch.bits & UIOPT_PROTOICONS) && !prf().get_options().is(UIOPT_PROTOICONS))
icons_cache.clear(); // FREE MEMORY
break;
case CFG_TALKVOLUME:
syncdata.lock_write()().volume = cfg().vol_talk();
break;
case CFG_MICVOLUME:
cvt.volume = cfg().vol_mic();
break;
case CFG_DSPFLAGS:
{
int flags = cfg().dsp_flags();
cvt.filter_options.init( fmt_converter_s::FO_NOISE_REDUCTION, FLAG(flags, DSP_MIC_NOISE) );
cvt.filter_options.init( fmt_converter_s::FO_GAINER, FLAG(flags, DSP_MIC_AGC) );
syncdata.lock_write()().dsp_flags = flags;
}
break;
case CFG_DEBUG:
push_debug_settings();
break;
}
}
return 0;
}