Branch Coverage

util.c
Criterion Covered Total %
branch 131 382 34.2


line true false branch
254 0 6199 if( (p = malloc(n))==0 ){
255 0 0 if( n>0 ) sqlite_malloc_failed++;
268 0 4696 if( (p = malloc(n))==0 ){
269 0 0 if( n>0 ) sqlite_malloc_failed++;
278 10844 9589 if( p ){
290 1113 78 if( p==0 ){
293 0 78 if( n==0 ){
298 0 78 if( p2==0 ){
309 0 33 if( z==0 ) return 0;
311 33 0 if( zNew ) strcpy(zNew, z);
316 0 688 if( z==0 ) return 0;
318 688 0 if( zNew ){
339 0 147 if( pz==0 ) return;
342 455 108 while( (z = va_arg(ap, const char*))!=0 ){
416 147 while( (z = va_arg(ap, const char*))!=0 ){
348 0 147 if( zResult==0 ){
354 455 108 while( (z = va_arg(ap, const char*))!=0 ){
416 147 while( (z = va_arg(ap, const char*))!=0 ){
380 0 2024 if( pz==0 ) return;
383 4048 0 while( (z = va_arg(ap, const char*))!=0 ){
2024 2024 while( (z = va_arg(ap, const char*))!=0 ){
384 2024 0 n = va_arg(ap, int);
385 456 1568 if( n<=0 ) n = strlen(z);
391 0 2024 if( zResult==0 ) return;
393 4048 0 while( (z = va_arg(ap, const char*))!=0 ){
2024 2024 while( (z = va_arg(ap, const char*))!=0 ){
394 2024 0 n = va_arg(ap, int);
395 456 1568 if( n<=0 ) n = strlen(z);
440 0 1469 if( z==0 ) return;
448 34021 0 for(i=1, j=0; z[i]; i++){
449 271 33750 if( z[i]==quote ){
450 128 143 if( z[i+1]==quote ){
490 0 8454 if( n<=0 ) n = strlen(z);
491 53067 8454 while( n > 0 ){
506 5463 626 while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
3741 1722 while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
513 16696 2441 while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
16456 240 while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
15778 678 while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
514 918 2441 return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
524 100 0 if( *z=='-' || *z=='+' ) z++;
0 100 if( *z=='-' || *z=='+' ) z++;
525 87 13 if( !isdigit(*z) ){
529 0 13 while( isdigit(*z) ){ z++; }
530 0 13 if( *z=='.' ){
532 0 0 if( !isdigit(*z) ) return 0;
533 0 0 while( isdigit(*z) ){ z++; }
535 13 0 if( *z=='e' || *z=='E' ){
0 13 if( *z=='e' || *z=='E' ){
537 0 0 if( *z=='+' || *z=='-' ) z++;
0 0 if( *z=='+' || *z=='-' ) z++;
538 0 0 if( !isdigit(*z) ) return 0;
539 0 0 while( isdigit(*z) ){ z++; }
559 0 13 if( *z=='-' ){
562 0 13 }else if( *z=='+' ){
565 13 13 while( isdigit(*z) ){
569 0 13 if( *z=='.' ){
572 0 0 while( isdigit(*z) ){
579 13 0 if( *z=='e' || *z=='E' ){
0 13 if( *z=='e' || *z=='E' ){
584 0 0 if( *z=='-' ){
587 0 0 }else if( *z=='+' ){
590 0 0 while( isdigit(*z) ){
594 0 0 while( eval>=64 ){ scale *= 1.0e+64; eval -= 64; }
595 0 0 while( eval>=16 ){ scale *= 1.0e+16; eval -= 16; }
596 0 0 while( eval>=4 ){ scale *= 1.0e+4; eval -= 4; }
597 0 0 while( eval>=1 ){ scale *= 1.0e+1; eval -= 1; }
598 0 0 if( esign<0 ){
604 0 13 if( pzEnd ) *pzEnd = z;
605 0 13 return sign<0 ? -v1 : v1;
621 119 0 if( *zNum=='-' || *zNum=='+' ) zNum++;
0 119 if( *zNum=='-' || *zNum=='+' ) zNum++;
622 122 119 for(i=0; (c=zNum[i])>='0' && c<='9'; i++){}
122 0 for(i=0; (c=zNum[i])>='0' && c<='9'; i++){}
623 0 119 return i<10 || (i==10 && memcmp(zNum,"2147483647",10)<=0);
0 0 return i<10 || (i==10 && memcmp(zNum,"2147483647",10)<=0);
0 0 return i<10 || (i==10 && memcmp(zNum,"2147483647",10)<=0);
642 0 15 if( atext==0 ){
644 0 15 }else if( btext==0 ){
649 0 15 if( isNumA ){
650 0 0 if( !isNumB ){
656 0 0 if( rA
658 0 0 }else if( rA>rB ){
664 0 15 }else if( isNumB ){
718 45 0 while( res==0 && *a && *b ){
45 0 while( res==0 && *a && *b ){
45 0 while( res==0 && *a && *b ){
719 33 12 if( a[0]=='N' || b[0]=='N' ){
0 33 if( a[0]=='N' || b[0]=='N' ){
720 12 0 if( a[0]==b[0] ){
725 0 0 if( a[0]=='N' ){
735 33 0 if( (dir=a[0])=='A' || a[0]=='D' ){
0 33 if( (dir=a[0])=='A' || a[0]=='D' ){
737 0 0 if( res ) break;
741 5 28 if( isNumA ){
743 0 5 if( !isNumB ){
749 1 4 if( rA
753 4 0 if( rA>rB ){
757 0 28 }else if( isNumB ){
762 16 12 if( res ) break;
768 21 0 if( dir=='-' || dir=='D' ) res = -res;
0 21 if( dir=='-' || dir=='D' ) res = -res;
811 0 4 if( r<0.0 ){
821 0 4 if( r==0.0 ){
823 0 4 }else if( r<(0.5/64.0) ){
824 0 0 while( r < 0.5/_64e64 && exp > -961 ){ r *= _64e64; exp -= 64; }
0 0 while( r < 0.5/_64e64 && exp > -961 ){ r *= _64e64; exp -= 64; }
825 0 0 while( r < 0.5/_64e16 && exp > -1009 ){ r *= _64e16; exp -= 16; }
0 0 while( r < 0.5/_64e16 && exp > -1009 ){ r *= _64e16; exp -= 16; }
826 0 0 while( r < 0.5/_64e4 && exp > -1021 ){ r *= _64e4; exp -= 4; }
0 0 while( r < 0.5/_64e4 && exp > -1021 ){ r *= _64e4; exp -= 4; }
827 0 0 while( r < 0.5/64.0 && exp > -1024 ){ r *= 64.0; exp -= 1; }
0 0 while( r < 0.5/64.0 && exp > -1024 ){ r *= 64.0; exp -= 1; }
828 4 0 }else if( r>=0.5 ){
829 0 4 while( r >= 0.5*_64e63 && exp < 960 ){ r *= 1.0/_64e64; exp += 64; }
0 0 while( r >= 0.5*_64e63 && exp < 960 ){ r *= 1.0/_64e64; exp += 64; }
830 0 4 while( r >= 0.5*_64e15 && exp < 1008 ){ r *= 1.0/_64e16; exp += 16; }
0 0 while( r >= 0.5*_64e15 && exp < 1008 ){ r *= 1.0/_64e16; exp += 16; }
831 0 4 while( r >= 0.5*_64e3 && exp < 1020 ){ r *= 1.0/_64e4; exp += 4; }
0 0 while( r >= 0.5*_64e3 && exp < 1020 ){ r *= 1.0/_64e4; exp += 4; }
832 4 4 while( r >= 0.5 && exp < 1023 ){ r *= 1.0/64.0; exp += 1; }
4 0 while( r >= 0.5 && exp < 1023 ){ r *= 1.0/64.0; exp += 1; }
834 0 4 if( neg ){
840 0 4 if( exp<0 ) return;
841 4 0 if( exp>=2048 || r>=1.0 ){
0 4 if( exp>=2048 || r>=1.0 ){
847 4 4 while( r>0.0 && cnt<10 ){
4 0 while( r>0.0 && cnt<10 ){
907 0 0 while( (0xc0&*z)==0x80 ){
949 0 0 while( (c = *zPattern)!=0 ){
952 0 0 while( (c=zPattern[1]) == '*' || c == '?' ){
0 0 while( (c=zPattern[1]) == '*' || c == '?' ){
953 0 0 if( c=='?' ){
954 0 0 if( *zString==0 ) return 0;
955 0 0 sqliteNextChar(zString);
959 0 0 if( c==0 ) return 1;
960 0 0 if( c=='[' ){
961 0 0 while( *zString && sqliteGlobCompare(&zPattern[1],zString)==0 ){
0 0 while( *zString && sqliteGlobCompare(&zPattern[1],zString)==0 ){
962 0 0 sqliteNextChar(zString);
966 0 0 while( (c2 = *zString)!=0 ){
967 0 0 while( c2 != 0 && c2 != c ){ c2 = *++zString; }
0 0 while( c2 != 0 && c2 != c ){ c2 = *++zString; }
968 0 0 if( c2==0 ) return 0;
969 0 0 if( sqliteGlobCompare(&zPattern[1],zString) ) return 1;
970 0 0 sqliteNextChar(zString);
975 0 0 if( *zString==0 ) return 0;
976 0 0 sqliteNextChar(zString);
985 0 0 if( c==0 ) return 0;
987 0 0 if( c2=='^' ){ invert = 1; c2 = *++zPattern; }
988 0 0 if( c2==']' ){
989 0 0 if( c==']' ) seen = 1;
992 0 0 while( (c2 = sqliteCharVal(zPattern))!=0 && c2!=']' ){
0 0 while( (c2 = sqliteCharVal(zPattern))!=0 && c2!=']' ){
993 0 0 if( c2=='-' && zPattern[1]!=']' && zPattern[1]!=0 && prior_c>0 ){
0 0 if( c2=='-' && zPattern[1]!=']' && zPattern[1]!=0 && prior_c>0 ){
0 0 if( c2=='-' && zPattern[1]!=']' && zPattern[1]!=0 && prior_c>0 ){
0 0 if( c2=='-' && zPattern[1]!=']' && zPattern[1]!=0 && prior_c>0 ){
996 0 0 if( c>=prior_c && c<=c2 ) seen = 1;
0 0 if( c>=prior_c && c<=c2 ) seen = 1;
998 0 0 }else if( c==c2 ){
1004 0 0 sqliteNextChar(zPattern);
1006 0 0 if( c2==0 || (seen ^ invert)==0 ) return 0;
0 0 if( c2==0 || (seen ^ invert)==0 ) return 0;
1007 0 0 sqliteNextChar(zString);
1012 0 0 if( c != *zString ) return 0;
1036 58 2 while( (c = UpperToLower[*zPattern])!=0 ){
1039 0 8 while( (c=zPattern[1]) == '%' || c == '_' ){
0 8 while( (c=zPattern[1]) == '%' || c == '_' ){
1040 0 0 if( c=='_' ){
1041 0 0 if( *zString==0 ) return 0;
1042 0 0 sqliteNextChar(zString);
1046 8 0 if( c==0 ) return 1;
1048 0 0 while( (c2=UpperToLower[*zString])!=0 ){
1049 0 0 while( c2 != 0 && c2 != c ){ c2 = UpperToLower[*++zString]; }
0 0 while( c2 != 0 && c2 != c ){ c2 = UpperToLower[*++zString]; }
1050 0 0 if( c2==0 ) return 0;
1051 0 0 if( sqliteLikeCompare(&zPattern[1],zString) ) return 1;
1052 0 0 sqliteNextChar(zString);
1057 0 0 if( *zString==0 ) return 0;
1058 0 0 sqliteNextChar(zString);
1063 16 34 if( c != UpperToLower[*zString] ) return 0;
1092 980 0 if( db->magic==SQLITE_MAGIC_OPEN ){
1095 0 0 }else if( db->magic==SQLITE_MAGIC_BUSY || db->magic==SQLITE_MAGIC_ERROR
0 0 }else if( db->magic==SQLITE_MAGIC_BUSY || db->magic==SQLITE_MAGIC_ERROR
1096 0 0 || db->want_to_close ){
1109 955 0 if( db->magic==SQLITE_MAGIC_BUSY ){
1112 0 0 }else if( db->magic==SQLITE_MAGIC_OPEN || db->magic==SQLITE_MAGIC_ERROR
0 0 }else if( db->magic==SQLITE_MAGIC_OPEN || db->magic==SQLITE_MAGIC_ERROR
1113 0 0 || db->want_to_close ){
1130 0 942 if( db->pVdbe!=0 ){