line |
true |
false |
branch |
153
|
0 |
30 |
if( (*cnt)++ >= 16 ) return '0'; |
233
|
53 |
51 |
for(; (c=(*fmt))!=0; ++fmt){ |
234
|
8 |
45 |
if( c!='%' ){ |
238
|
104 |
7 |
while( (c=(*++fmt))!='%' && c!=0 ) amt++; |
|
103 |
1 |
while( (c=(*++fmt))!='%' && c!=0 ) amt++; |
241
|
1 |
7 |
if( c==0 ) break; |
243
|
0 |
52 |
if( (c=(*++fmt))==0 ){ |
261
|
0 |
52 |
}while( c==0 && (c=(*++fmt))!=0 ); |
|
0 |
0 |
}while( c==0 && (c=(*++fmt))!=0 ); |
264
|
0 |
52 |
if( c=='*' ){ |
265
|
0 |
0 |
width = va_arg(ap,int); |
266
|
0 |
0 |
if( width<0 ){ |
272
|
50 |
2 |
while( c>='0' && c<='9' ){ |
|
0 |
50 |
while( c>='0' && c<='9' ){ |
277
|
0 |
52 |
if( width > etBUFSIZE-10 ){ |
281
|
2 |
50 |
if( c=='.' ){ |
284
|
0 |
2 |
if( c=='*' ){ |
285
|
0 |
0 |
precision = va_arg(ap,int); |
286
|
0 |
0 |
if( precision<0 ) precision = -precision; |
289
|
6 |
0 |
while( c>='0' && c<='9' ){ |
|
4 |
2 |
while( c>='0' && c<='9' ){ |
295
|
0 |
2 |
if( precision>etBUFSIZE-40 ) precision = etBUFSIZE-40; |
300
|
0 |
52 |
if( c=='l' ){ |
309
|
211 |
0 |
for(idx=0; idx
|
310
|
52 |
159 |
if( c==fmtinfo[idx].fmttype ){ |
312
|
45 |
7 |
if( useExtended || (infop->flags & FLAG_INTERN)==0 ){ |
|
45 |
0 |
if( useExtended || (infop->flags & FLAG_INTERN)==0 ){ |
340
|
0 |
43 |
if( flag_long ) longvalue = va_arg(ap,long); |
|
0 |
0 |
if( flag_long ) longvalue = va_arg(ap,long); |
341
|
43 |
0 |
else longvalue = va_arg(ap,int); |
345
|
1 |
42 |
if( longvalue==0 ) flag_alternateform = 0; |
351
|
43 |
0 |
if( infop->flags & FLAG_SIGNED ){ |
352
|
0 |
43 |
if( *(long*)&longvalue<0 ){ |
355
|
0 |
43 |
}else if( flag_plussign ) prefix = '+'; |
356
|
0 |
43 |
else if( flag_blanksign ) prefix = ' '; |
359
|
0 |
43 |
if( flag_zeropad && precision
|
|
0 |
0 |
if( flag_zeropad && precision
|
371
|
15 |
43 |
}while( longvalue>0 ); |
374
|
0 |
43 |
for(idx=precision-length; idx>0; idx--){ |
377
|
0 |
43 |
if( prefix ) *(--bufpt) = prefix; /* Add sign */ |
378
|
0 |
43 |
if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */ |
|
0 |
0 |
if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */ |
381
|
0 |
0 |
if( *bufpt!=pre[0] ){ |
382
|
0 |
0 |
for(pre=infop->prefix; (x=(*pre))!=0; pre++) *(--bufpt) = x; |
390
|
2 |
0 |
realvalue = va_arg(ap,double); |
392
|
0 |
2 |
if( precision<0 ) precision = 6; /* Set default precision */ |
393
|
0 |
2 |
if( precision>etBUFSIZE-10 ) precision = etBUFSIZE-10; |
394
|
0 |
2 |
if( realvalue<0.0 ){ |
398
|
0 |
2 |
if( flag_plussign ) prefix = '+'; |
399
|
0 |
2 |
else if( flag_blanksign ) prefix = ' '; |
402
|
2 |
0 |
if( infop->type==etGENERIC && precision>0 ) precision--; |
|
2 |
0 |
if( infop->type==etGENERIC && precision>0 ) precision--; |
409
|
28 |
2 |
for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1); |
411
|
0 |
2 |
if( infop->type==etFLOAT ) realvalue += rounder; |
414
|
2 |
0 |
if( realvalue>0.0 ){ |
415
|
1 |
2 |
while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; } |
|
1 |
0 |
while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; } |
416
|
1 |
2 |
while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; } |
|
1 |
0 |
while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; } |
417
|
0 |
2 |
while( realvalue<1e-8 && exp>=-350 ){ realvalue *= 1e8; exp-=8; } |
|
0 |
0 |
while( realvalue<1e-8 && exp>=-350 ){ realvalue *= 1e8; exp-=8; } |
418
|
0 |
2 |
while( realvalue<1.0 && exp>=-350 ){ realvalue *= 10.0; exp--; } |
|
0 |
0 |
while( realvalue<1.0 && exp>=-350 ){ realvalue *= 10.0; exp--; } |
419
|
2 |
0 |
if( exp>350 || exp<-350 ){ |
|
0 |
2 |
if( exp>350 || exp<-350 ){ |
431
|
2 |
0 |
if( xtype!=etFLOAT ){ |
433
|
0 |
2 |
if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; } |
435
|
2 |
0 |
if( xtype==etGENERIC ){ |
437
|
2 |
0 |
if( exp<-4 || exp>precision ){ |
|
0 |
2 |
if( exp<-4 || exp>precision ){ |
451
|
2 |
0 |
if( xtype==etFLOAT && exp+precision
|
|
2 |
0 |
if( xtype==etFLOAT && exp+precision
|
452
|
0 |
2 |
flag_dp = (precision>0 || flag_alternateform); |
|
0 |
0 |
flag_dp = (precision>0 || flag_alternateform); |
453
|
0 |
2 |
if( prefix ) *(bufpt++) = prefix; /* Sign */ |
454
|
0 |
2 |
if( exp<0 ) *(bufpt++) = '0'; /* Digits before "." */ |
455
|
11 |
2 |
else for(; exp>=0; exp--) *(bufpt++) = et_getdigit(&realvalue,&nsd); |
456
|
2 |
0 |
if( flag_dp ) *(bufpt++) = '.'; /* The decimal point */ |
457
|
0 |
2 |
for(exp++; exp<0 && precision>0; precision--, exp++){ |
|
0 |
0 |
for(exp++; exp<0 && precision>0; precision--, exp++){ |
460
|
19 |
2 |
while( (precision--)>0 ) *(bufpt++) = et_getdigit(&realvalue,&nsd); |
462
|
2 |
0 |
if( flag_rtz && flag_dp ){ /* Remove trailing zeros and "." */ |
|
2 |
0 |
if( flag_rtz && flag_dp ){ /* Remove trailing zeros and "." */ |
463
|
20 |
0 |
while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0; |
|
18 |
2 |
while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0; |
464
|
2 |
0 |
if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0; |
|
1 |
1 |
if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0; |
468
|
0 |
0 |
flag_dp = (precision>0 || flag_alternateform); |
|
0 |
0 |
flag_dp = (precision>0 || flag_alternateform); |
469
|
0 |
0 |
if( prefix ) *(bufpt++) = prefix; /* Sign */ |
471
|
0 |
0 |
if( flag_dp ) *(bufpt++) = '.'; /* Decimal point */ |
472
|
0 |
0 |
while( (precision--)>0 ) *(bufpt++) = et_getdigit(&realvalue,&nsd); |
474
|
0 |
0 |
if( flag_rtz && flag_dp ){ /* Remove tail zeros */ |
|
0 |
0 |
if( flag_rtz && flag_dp ){ /* Remove tail zeros */ |
475
|
0 |
0 |
while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0; |
|
0 |
0 |
while( bufpt>=buf && *bufpt=='0' ) *(bufpt--) = 0; |
476
|
0 |
0 |
if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0; |
|
0 |
0 |
if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0; |
479
|
0 |
0 |
if( exp || flag_exp ){ |
|
0 |
0 |
if( exp || flag_exp ){ |
481
|
0 |
0 |
if( exp<0 ){ *(bufpt++) = '-'; exp = -exp; } /* sign of exp */ |
483
|
0 |
0 |
if( exp>=100 ){ |
499
|
0 |
2 |
if( flag_zeropad && !flag_leftjustify && length < width){ |
|
0 |
0 |
if( flag_zeropad && !flag_leftjustify && length < width){ |
|
0 |
0 |
if( flag_zeropad && !flag_leftjustify && length < width){ |
502
|
0 |
0 |
for(i=width; i>=nPad; i--){ |
506
|
0 |
0 |
while( nPad-- ) bufpt[i++] = '0'; |
512
|
0 |
0 |
*(va_arg(ap,int*)) = count; |
522
|
0 |
0 |
c = buf[0] = (xtype==etCHARX ? va_arg(ap,int) : *++fmt); |
|
0 |
0 |
c = buf[0] = (xtype==etCHARX ? va_arg(ap,int) : *++fmt); |
523
|
0 |
0 |
if( precision>=0 ){ |
524
|
0 |
0 |
for(idx=1; idx
|
533
|
0 |
0 |
bufpt = va_arg(ap,char*); |
534
|
0 |
0 |
if( bufpt==0 ){ |
536
|
0 |
0 |
}else if( xtype==etDYNSTRING ){ |
540
|
0 |
0 |
if( precision>=0 && precision
|
|
0 |
0 |
if( precision>=0 && precision
|
546
|
0 |
0 |
char *arg = va_arg(ap,char*); |
548
|
0 |
0 |
if( isnull ) arg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)"); |
|
0 |
0 |
if( isnull ) arg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)"); |
549
|
0 |
0 |
for(i=n=0; (c=arg[i])!=0; i++){ |
550
|
0 |
0 |
if( c=='\'' ) n++; |
552
|
0 |
0 |
n += i + 1 + ((!isnull && xtype==etSQLESCAPE2) ? 2 : 0); |
|
0 |
0 |
n += i + 1 + ((!isnull && xtype==etSQLESCAPE2) ? 2 : 0); |
553
|
0 |
0 |
if( n>etBUFSIZE ){ |
555
|
0 |
0 |
if( bufpt==0 ) return -1; |
560
|
0 |
0 |
if( !isnull && xtype==etSQLESCAPE2 ) bufpt[j++] = '\''; |
|
0 |
0 |
if( !isnull && xtype==etSQLESCAPE2 ) bufpt[j++] = '\''; |
561
|
0 |
0 |
for(i=0; (c=arg[i])!=0; i++){ |
563
|
0 |
0 |
if( c=='\'' ) bufpt[j++] = c; |
565
|
0 |
0 |
if( !isnull && xtype==etSQLESCAPE2 ) bufpt[j++] = '\''; |
|
0 |
0 |
if( !isnull && xtype==etSQLESCAPE2 ) bufpt[j++] = '\''; |
568
|
0 |
0 |
if( precision>=0 && precision
|
|
0 |
0 |
if( precision>=0 && precision
|
572
|
7 |
0 |
Token *pToken = va_arg(ap, Token*); |
578
|
0 |
0 |
SrcList *pSrc = va_arg(ap, SrcList*); |
579
|
0 |
0 |
int k = va_arg(ap, int); |
582
|
0 |
0 |
if( pItem->zDatabase && pItem->zDatabase[0] ){ |
|
0 |
0 |
if( pItem->zDatabase && pItem->zDatabase[0] ){ |
594
|
0 |
0 |
idx = 1+(c!=0); |
597
|
0 |
0 |
if( c==0 ) fmt--; |
605
|
52 |
0 |
if( !flag_leftjustify ){ |
608
|
0 |
52 |
if( nspace>0 ){ |
610
|
0 |
0 |
while( nspace>=etSPACESIZE ){ |
614
|
0 |
0 |
if( nspace>0 ) (*func)(arg,spaces,nspace); |
617
|
45 |
7 |
if( length>0 ){ |
621
|
0 |
52 |
if( flag_leftjustify ){ |
624
|
0 |
0 |
if( nspace>0 ){ |
626
|
0 |
0 |
while( nspace>=etSPACESIZE ){ |
630
|
0 |
0 |
if( nspace>0 ) (*func)(arg,spaces,nspace); |
633
|
0 |
52 |
if( zExtra ){ |
637
|
52 |
0 |
return errorflag ? -1 : count; |
662
|
0 |
112 |
if( pM->nChar + nNewChar + 1 > pM->nAlloc ){ |
663
|
0 |
0 |
if( pM->xRealloc==0 ){ |
667
|
0 |
0 |
if( pM->zText==pM->zBase ){ |
669
|
0 |
0 |
if( pM->zText && pM->nChar ){ |
|
0 |
0 |
if( pM->zText && pM->nChar ){ |
677
|
112 |
0 |
if( pM->zText ){ |
678
|
60 |
52 |
if( nNewChar>0 ){ |
704
|
7 |
45 |
if( xRealloc ){ |
705
|
7 |
0 |
if( sM.zText==sM.zBase ){ |
708
|
0 |
0 |
}else if( sM.nAlloc>sM.nChar+10 ){ |