本文整理汇总了C++中overflow函数的典型用法代码示例。如果您正苦于以下问题:C++ overflow函数的具体用法?C++ overflow怎么用?C++ overflow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了overflow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plus
double Ariphmetic::plus(double a, double b) {
bool positive_a = (a > 0) ? true : false;
bool positive_b = (b > 0) ? true : false;
if (!(positive_a ^ positive_b)) {
double limit = std::numeric_limits<double>::max();
double _a = (positive_a) ? a : -a;
double _b = (positive_b) ? b : -b;
if (_a > limit - _b) throw overflow();
}
return a + b;
}
示例2: Q_D
/*!
\overload
Displays the number \a num.
*/
void QLCDNumber::display(int num)
{
Q_D(QLCDNumber);
d->val = (double)num;
bool of;
QString s = int2string(num, d->base, d->ndigits, &of);
if (of)
emit overflow();
else
d->internalSetString(s);
}
示例3: main
main(int argc, char **argv)
{
int c;
char ip[16], user[32], pass[32], rep[512];
ip[0] = 0;
user[0] = 0;
pass[0] = 0;
rep[0] = 0;
if (argc < 2) {
usage(argv[0]);
exit(0);
}
while ((c = getopt(argc, argv, "h::l:p:i:r:")) != -1) {
switch(c) {
case 'h':
usage(argv[0]);
exit(0);
case 'i':
strncpy(ip, optarg, sizeof(ip));
break;
case 'l':
strncpy(user, optarg, sizeof(user));
break;
case 'p':
strncpy(pass, optarg, sizeof(pass));
break;
case 'r':
strncpy(rep, optarg, sizeof(rep));
break;
}
}
if(ip) {
printf("Connecting to vulnerable CVS server ...");
xp_connect(ip);
printf("OK\n");
}
printf("Logging in ...");
login(user, pass, rep);
printf("OK\n");
printf("Exploiting the CVS error_prog_name double free now ...");
overflow();
printf("DONE\n");
printf("If everything went well there should be a shell on port
30464\n");
}
示例4: customCSSText
String CSSContentDistributionValue::customCSSText() const {
CSSValueList* list = CSSValueList::createSpaceSeparated();
if (m_distribution != CSSValueInvalid)
list->append(*distribution());
if (m_position != CSSValueInvalid)
list->append(*position());
if (m_overflow != CSSValueInvalid)
list->append(*overflow());
return list->customCSSText();
}
示例5: remaining
/// Equivalent to a vsprintf on the string.
int ostringstream::vformat (const char* fmt, va_list args)
{
size_t rv, space;
do {
space = remaining();
rv = vsnprintf (const_cast<char *>(ipos()), space, fmt, args);
if (ssize_t(rv) < 0)
rv = space;
} while (rv >= space && rv < overflow(rv + 1));
SetPos (pos() + minV (rv, space));
return (int)(rv);
}
示例6: log_event
/*
* Write current event to the event log
* @this_fn -- function address
* @call_site -- where it was called from
* @type -- entry or exit
*/
static void __noprof log_event(void *this_fn, void *call_site, u8 type)
{
if (!overflow()) {
events[top].type = type;
events[top].time = NOW();
events[top].function = this_fn;
events[top++].call_site = call_site;
if (top == PROFBUF_MAX)
mode = PROFILER_NEEDFLUSH;
} else
mode = PROFILER_NEEDFLUSH;
}
示例7: __test_static_string_size
void __test_static_string_size()
{
my_static_string_t a("a");
my_static_string_t empty("");
my_static_string_t full("aaaaaaaaaaa");
my_static_string_t overflow("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
UF_TEST_EQUAL(a.size(), 1);
UF_TEST_EQUAL(empty.size(), 0);
UF_TEST_EQUAL(full.size(), 11);
UF_TEST_EQUAL(overflow.size(), my_static_string_t::capacity);
}
示例8: sync
virtual int sync()
{
// first, call overflow to clear in_buff
overflow();
if (! pptr()) return -1;
// then, call deflate asking to finish the zlib stream
zstrm_p->next_in = nullptr;
zstrm_p->avail_in = 0;
if (deflate_loop(Z_FINISH) != 0) return -1;
deflateReset(zstrm_p);
return 0;
}
示例9: size
void Histogram<T>::print () const {
std::cout << "Total: " << size() << ", " << "Min: " << _min << ", " << "Max: " << _max << '\n';
std::cout << std::left << std::setw(6) << "-1" << '(' << std::setw(5)
<< lowest() << "-) " << std::right << std::setw(6) << underflow() << '\n';
for (unsigned i=0; i<_bins; ++i) {
std::cout << std::left << std::setw(6) << i << '(' << std::setw(5)
<< low(i) << ", " << std::setw(5) << high(i) << ")"
<< std::right << std::setw(6) << _bin[i] << '\n';
}
std::cout << std::left << std::setw(6) << _bins << '(' << std::setw(5)
<< highest() << "+) " << std::right << std::setw(6) << overflow() << '\n';
}
示例10: adc
void adc(CPU *cpu, unsigned char* memory)
{
uint16_t imm = fetch_data(cpu,memory);
uint16_t temp = imm + cpu->A + cpu->P[0];
cpu->P[1] = ((temp & 0xFF) == 0) ? 1 : 0;
cpu->P[7] = (temp & 0x80) ? 1 : 0;
cpu->P[6] = overflow(cpu->A, (uint8_t)(imm), (uint8_t)(temp));
cpu->P[0] = (temp & 0x100) ? 1 : 0;
cpu->A = (uint8_t)(temp & 0x0FF);
cpu->PC += address_bytes[memory[cpu->PC]] + 1;
cpu->cycles += 2;
}
示例11: push_level
static void
push_level(name_pointer p)
#line 340 "ctangle.w"
{
if(stack_ptr==stack_end)overflow("stack");
*stack_ptr= cur_state;
stack_ptr++;
if(p!=NULL){
cur_name= p;cur_repl= (text_pointer)p->equiv;
cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;
cur_section= 0;
}
}
示例12: overflow
int
Mystreambuf::sync (void)
{
if (!unbuffered())
{
overflow (); // Force output
char * gp = base();
setp (gp, gp + blen() / 2);
gp = base() + blen() / 2;
setg (0, 0, 0);
}
return 0;
}
示例13: customCSSText
String CSSContentDistributionValue::customCSSText() const
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (m_distribution != CSSValueInvalid)
list->append(distribution());
if (m_position != CSSValueInvalid)
list->append(position());
if (m_overflow != CSSValueInvalid)
list->append(overflow());
return list.release()->customCSSText();
}
示例14: P1C
void
#line 211 "./cwebdir/ctang-w2c.ch"
push_level P1C(name_pointer,p)
#line 340 "./cwebdir/ctangle.w"
{
if(stack_ptr==stack_end)overflow("stack");
*stack_ptr= cur_state;
stack_ptr++;
if(p!=NULL){
cur_name= p;cur_repl= (text_pointer)p->equiv;
cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;
cur_section= 0;
}
}
示例15: iq_opt_insert_doread
void iq_opt_insert_doread(iq_t iq, seqno_t i, iq_item_t msg) {
item_t *item ;
seqno_t next ;
assert(iq_opt_insert_check(iq, i)) ;
assert (i >= iq->lo) ;
next = i + 1 ;
iq->read = next ;
iq->hi = next ;
if (i >= maxi(iq)) {
overflow(iq, i) ;
}
item = get_unsafe(iq, i) ;
do_set(item, msg) ;
}