OpenCoverage

utf.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/sqlite/src/src/utf.c
Switch to Source codePreprocessed file
LineSourceCount
1static const unsigned char sqlite3Utf8Trans1[] = {-
2 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,-
3 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,-
4 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,-
5 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,-
6 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,-
7 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,-
8 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,-
9 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,-
10};-
11u32 sqlite3Utf8Read(-
12 const unsigned char **pz-
13){-
14 unsigned int c;-
15-
16-
17-
18-
19 c = *((*pz)++);-
20 if( c>=0xc0
c>=0xc0Description
TRUEevaluated 1126423 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1741 times by 1 test
Evaluated by:
  • Self test (438)
){
1741-1126423
21 c = sqlite3Utf8Trans1[c-0xc0];-
22 while( (*(*
(*(*pz) & 0xc0)==0x80Description
TRUEevaluated 3306782 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1126423 times by 1 test
Evaluated by:
  • Self test (438)
pz) & 0xc0)==0x80
(*(*pz) & 0xc0)==0x80Description
TRUEevaluated 3306782 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1126423 times by 1 test
Evaluated by:
  • Self test (438)
){
1126423-3306782
23 c = (c<<6) + (0x3f & *((*pz)++));-
24 }
executed 3306782 times by 1 test: end of block
Executed by:
  • Self test (438)
3306782
25 if( c<0x80
c<0x80Description
TRUEevaluated 52 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1126371 times by 1 test
Evaluated by:
  • Self test (438)
52-1126371
26 || (
(c&0xFFFFF800)==0xD800Description
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1124323 times by 1 test
Evaluated by:
  • Self test (438)
c&0xFFFFF800)==0xD800
(c&0xFFFFF800)==0xD800Description
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1124323 times by 1 test
Evaluated by:
  • Self test (438)
2048-1124323
27 || (
(c&0xFFFFFFFE)==0xFFFEDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1124317 times by 1 test
Evaluated by:
  • Self test (438)
c&0xFFFFFFFE)==0xFFFE
(c&0xFFFFFFFE)==0xFFFEDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1124317 times by 1 test
Evaluated by:
  • Self test (438)
){ c = 0xFFFD; }
executed 2106 times by 1 test: end of block
Executed by:
  • Self test (438)
6-1124317
28 }
executed 1126423 times by 1 test: end of block
Executed by:
  • Self test (438)
1126423
29 return
executed 1128164 times by 1 test: return c;
Executed by:
  • Self test (438)
c;
executed 1128164 times by 1 test: return c;
Executed by:
  • Self test (438)
1128164
30}-
31__attribute__((noinline)) int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){-
32 int len;-
33 unsigned char *zOut;-
34 unsigned char *zIn;-
35 unsigned char *zTerm;-
36 unsigned char *z;-
37 unsigned int c;-
38-
39 -
40 ((void) (0))-
41 ;-
42 -
43 ((void) (0))-
44 ;-
45 -
46 ((void) (0))-
47 ;-
48 -
49 ((void) (0))-
50 ;-
51 -
52 ((void) (0))-
53 ;-
54 if( pMem->enc!=1
pMem->enc!=1Description
TRUEevaluated 2895 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1225 times by 1 test
Evaluated by:
  • Self test (438)
&& desiredEnc!=1
desiredEnc!=1Description
TRUEevaluated 228 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2667 times by 1 test
Evaluated by:
  • Self test (438)
){
228-2895
55 u8 temp;-
56 int rc;-
57 rc = sqlite3VdbeMemMakeWriteable(pMem);-
58 if( rc!=0
rc!=0Description
TRUEnever evaluated
FALSEevaluated 228 times by 1 test
Evaluated by:
  • Self test (438)
){
0-228
59 -
60 ((void) (0))-
61 ;-
62 return
never executed: return 7;
7;
never executed: return 7;
0
63 }-
64 zIn = (u8*)pMem->z;-
65 zTerm = &zIn[pMem->n&~1];-
66 while( zIn<zTerm
zIn<zTermDescription
TRUEevaluated 5803 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 228 times by 1 test
Evaluated by:
  • Self test (438)
){
228-5803
67 temp = *zIn;-
68 *zIn = *(zIn+1);-
69 zIn++;-
70 *zIn++ = temp;-
71 }
executed 5803 times by 1 test: end of block
Executed by:
  • Self test (438)
5803
72 pMem->enc = desiredEnc;-
73 goto
executed 228 times by 1 test: goto translate_out;
Executed by:
  • Self test (438)
translate_out;
executed 228 times by 1 test: goto translate_out;
Executed by:
  • Self test (438)
228
74 }-
75-
76-
77 if( desiredEnc==1
desiredEnc==1Description
TRUEevaluated 2667 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1225 times by 1 test
Evaluated by:
  • Self test (438)
){
1225-2667
78-
79-
80-
81-
82-
83 pMem->n &= ~1;-
84 len = pMem->n * 2 + 1;-
85 }
executed 2667 times by 1 test: end of block
Executed by:
  • Self test (438)
else{
2667
86-
87-
88-
89-
90-
91 len = pMem->n * 2 + 2;-
92 }
executed 1225 times by 1 test: end of block
Executed by:
  • Self test (438)
1225
93-
94-
95-
96-
97-
98-
99-
100 zIn = (u8*)pMem->z;-
101 zTerm = &zIn[pMem->n];-
102 zOut = sqlite3DbMallocRaw(pMem->db, len);-
103 if( !zOut
!zOutDescription
TRUEnever evaluated
FALSEevaluated 3892 times by 1 test
Evaluated by:
  • Self test (438)
){
0-3892
104 return
never executed: return 7;
7;
never executed: return 7;
0
105 }-
106 z = zOut;-
107-
108 if( pMem->enc==1
pMem->enc==1Description
TRUEevaluated 1225 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2667 times by 1 test
Evaluated by:
  • Self test (438)
){
1225-2667
109 if( desiredEnc==2
desiredEnc==2Description
TRUEevaluated 857 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 368 times by 1 test
Evaluated by:
  • Self test (438)
){
368-857
110-
111 while( zIn<zTerm
zIn<zTermDescription
TRUEevaluated 8983 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 857 times by 1 test
Evaluated by:
  • Self test (438)
){
857-8983
112 c = *(zIn++); if( c>=0xc0
c>=0xc0Description
TRUEevaluated 1110 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 7873 times by 1 test
Evaluated by:
  • Self test (438)
){ c = sqlite3Utf8Trans1[c-0xc0]; while( zIn!=zTerm
zIn!=zTermDescription
TRUEevaluated 2719 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
&& (*
(*zIn & 0xc0)==0x80Description
TRUEevaluated 1615 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1104 times by 1 test
Evaluated by:
  • Self test (438)
zIn & 0xc0)==0x80
(*zIn & 0xc0)==0x80Description
TRUEevaluated 1615 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1104 times by 1 test
Evaluated by:
  • Self test (438)
){ c = (c<<6) + (0x3f & *(zIn++)); }
executed 1615 times by 1 test: end of block
Executed by:
  • Self test (438)
if( c<0x80
c<0x80Description
TRUEnever evaluated
FALSEevaluated 1110 times by 1 test
Evaluated by:
  • Self test (438)
|| (
(c&0xFFFFF800)==0xD800Description
TRUEnever evaluated
FALSEevaluated 1110 times by 1 test
Evaluated by:
  • Self test (438)
c&0xFFFFF800)==0xD800
(c&0xFFFFF800)==0xD800Description
TRUEnever evaluated
FALSEevaluated 1110 times by 1 test
Evaluated by:
  • Self test (438)
|| (
(c&0xFFFFFFFE)==0xFFFEDescription
TRUEnever evaluated
FALSEevaluated 1110 times by 1 test
Evaluated by:
  • Self test (438)
c&0xFFFFFFFE)==0xFFFE
(c&0xFFFFFFFE)==0xFFFEDescription
TRUEnever evaluated
FALSEevaluated 1110 times by 1 test
Evaluated by:
  • Self test (438)
){ c = 0xFFFD; }
never executed: end of block
}
executed 1110 times by 1 test: end of block
Executed by:
  • Self test (438)
;
0-7873
113 { if( c<=0xFFFF
c<=0xFFFFDescription
TRUEevaluated 8983 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
){ *z++ = (u8)(c&0x00FF); *z++ = (u8)((c>>8)&0x00FF); }
executed 8983 times by 1 test: end of block
Executed by:
  • Self test (438)
else{ *z++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); *z++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); *z++ = (u8)(c&0x00FF); *z++ = (u8)(0x00DC + ((c>>8)&0x03)); }
never executed: end of block
};
0-8983
114 }-
115 }
executed 857 times by 1 test: end of block
Executed by:
  • Self test (438)
else{
857
116 -
117 ((void) (0))-
118 ;-
119-
120 while( zIn<zTerm
zIn<zTermDescription
TRUEevaluated 4629 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 368 times by 1 test
Evaluated by:
  • Self test (438)
){
368-4629
121 c = *(zIn++); if( c>=0xc0
c>=0xc0Description
TRUEevaluated 1125 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3504 times by 1 test
Evaluated by:
  • Self test (438)
){ c = sqlite3Utf8Trans1[c-0xc0]; while( zIn!=zTerm
zIn!=zTermDescription
TRUEevaluated 2836 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 21 times by 1 test
Evaluated by:
  • Self test (438)
&& (*
(*zIn & 0xc0)==0x80Description
TRUEevaluated 1732 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1104 times by 1 test
Evaluated by:
  • Self test (438)
zIn & 0xc0)==0x80
(*zIn & 0xc0)==0x80Description
TRUEevaluated 1732 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1104 times by 1 test
Evaluated by:
  • Self test (438)
){ c = (c<<6) + (0x3f & *(zIn++)); }
executed 1732 times by 1 test: end of block
Executed by:
  • Self test (438)
if( c<0x80
c<0x80Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1118 times by 1 test
Evaluated by:
  • Self test (438)
|| (
(c&0xFFFFF800)==0xD800Description
TRUEnever evaluated
FALSEevaluated 1118 times by 1 test
Evaluated by:
  • Self test (438)
c&0xFFFFF800)==0xD800
(c&0xFFFFF800)==0xD800Description
TRUEnever evaluated
FALSEevaluated 1118 times by 1 test
Evaluated by:
  • Self test (438)
|| (
(c&0xFFFFFFFE)==0xFFFEDescription
TRUEnever evaluated
FALSEevaluated 1118 times by 1 test
Evaluated by:
  • Self test (438)
c&0xFFFFFFFE)==0xFFFE
(c&0xFFFFFFFE)==0xFFFEDescription
TRUEnever evaluated
FALSEevaluated 1118 times by 1 test
Evaluated by:
  • Self test (438)
){ c = 0xFFFD; }
executed 7 times by 1 test: end of block
Executed by:
  • Self test (438)
}
executed 1125 times by 1 test: end of block
Executed by:
  • Self test (438)
;
0-3504
122 { if( c<=0xFFFF
c<=0xFFFFDescription
TRUEevaluated 4629 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
){ *z++ = (u8)((c>>8)&0x00FF); *z++ = (u8)(c&0x00FF); }
executed 4629 times by 1 test: end of block
Executed by:
  • Self test (438)
else{ *z++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); *z++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); *z++ = (u8)(0x00DC + ((c>>8)&0x03)); *z++ = (u8)(c&0x00FF); }
never executed: end of block
};
0-4629
123 }-
124 }
executed 368 times by 1 test: end of block
Executed by:
  • Self test (438)
368
125 pMem->n = (int)(z - zOut);-
126 *z++ = 0;-
127 }
executed 1225 times by 1 test: end of block
Executed by:
  • Self test (438)
else{
1225
128 -
129 ((void) (0))-
130 ;-
131 if( pMem->enc==2
pMem->enc==2Description
TRUEevaluated 2466 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 201 times by 1 test
Evaluated by:
  • Self test (438)
){
201-2466
132-
133 while( zIn<zTerm
zIn<zTermDescription
TRUEevaluated 98974 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2466 times by 1 test
Evaluated by:
  • Self test (438)
){
2466-98974
134 { c = (*zIn++); c += ((*zIn++)<<8); if( c>=0xD800
c>=0xD800Description
TRUEevaluated 602 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 98372 times by 1 test
Evaluated by:
  • Self test (438)
&& c<0xE000
c<0xE000Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 600 times by 1 test
Evaluated by:
  • Self test (438)
&& zIn<zTerm
zIn<zTermDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
){ int c2 = (*zIn++); c2 += ((*zIn++)<<8); c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); }
never executed: end of block
};
0-98372
135 { if( c<0x00080
c<0x00080Description
TRUEevaluated 96755 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2219 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = (u8)(c&0xFF); }
executed 96755 times by 1 test: end of block
Executed by:
  • Self test (438)
else if( c<0x00800
c<0x00800Description
TRUEevaluated 1207 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1012 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = 0xC0 + (u8)((c>>6)&0x1F); *z++ = 0x80 + (u8)(c & 0x3F); }
executed 1207 times by 1 test: end of block
Executed by:
  • Self test (438)
else if( c<0x10000
c<0x10000Description
TRUEevaluated 1012 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
){ *z++ = 0xE0 + (u8)((c>>12)&0x0F); *z++ = 0x80 + (u8)((c>>6) & 0x3F); *z++ = 0x80 + (u8)(c & 0x3F); }
executed 1012 times by 1 test: end of block
Executed by:
  • Self test (438)
else{ *z++ = 0xF0 + (u8)((c>>18) & 0x07); *z++ = 0x80 + (u8)((c>>12) & 0x3F); *z++ = 0x80 + (u8)((c>>6) & 0x3F); *z++ = 0x80 + (u8)(c & 0x3F); }
never executed: end of block
};
0-96755
136 }-
137 }
executed 2466 times by 1 test: end of block
Executed by:
  • Self test (438)
else{
2466
138-
139 while( zIn<zTerm
zIn<zTermDescription
TRUEevaluated 3303 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 201 times by 1 test
Evaluated by:
  • Self test (438)
){
201-3303
140 { c = ((*zIn++)<<8); c += (*zIn++); if( c>=0xD800
c>=0xD800Description
TRUEevaluated 302 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3001 times by 1 test
Evaluated by:
  • Self test (438)
&& c<0xE000
c<0xE000Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 300 times by 1 test
Evaluated by:
  • Self test (438)
&& zIn<zTerm
zIn<zTermDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
){ int c2 = ((*zIn++)<<8); c2 += (*zIn++); c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); }
never executed: end of block
};
0-3001
141 { if( c<0x00080
c<0x00080Description
TRUEevaluated 2187 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1116 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = (u8)(c&0xFF); }
executed 2187 times by 1 test: end of block
Executed by:
  • Self test (438)
else if( c<0x00800
c<0x00800Description
TRUEevaluated 607 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 509 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = 0xC0 + (u8)((c>>6)&0x1F); *z++ = 0x80 + (u8)(c & 0x3F); }
executed 607 times by 1 test: end of block
Executed by:
  • Self test (438)
else if( c<0x10000
c<0x10000Description
TRUEevaluated 509 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
){ *z++ = 0xE0 + (u8)((c>>12)&0x0F); *z++ = 0x80 + (u8)((c>>6) & 0x3F); *z++ = 0x80 + (u8)(c & 0x3F); }
executed 509 times by 1 test: end of block
Executed by:
  • Self test (438)
else{ *z++ = 0xF0 + (u8)((c>>18) & 0x07); *z++ = 0x80 + (u8)((c>>12) & 0x3F); *z++ = 0x80 + (u8)((c>>6) & 0x3F); *z++ = 0x80 + (u8)(c & 0x3F); }
never executed: end of block
};
0-2187
142 }-
143 }
executed 201 times by 1 test: end of block
Executed by:
  • Self test (438)
201
144 pMem->n = (int)(z - zOut);-
145 }
executed 2667 times by 1 test: end of block
Executed by:
  • Self test (438)
2667
146 *z = 0;-
147 -
148 ((void) (0))-
149 ;-
150-
151 c = pMem->flags;-
152 sqlite3VdbeMemRelease(pMem);-
153 pMem->flags = 0x0002|0x0200|(c&(0x001f|0x8000));-
154 pMem->enc = desiredEnc;-
155 pMem->z = (char*)zOut;-
156 pMem->zMalloc = pMem->z;-
157 pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->z);-
158-
159translate_out:
code before this statement executed 3892 times by 1 test: translate_out:
Executed by:
  • Self test (438)
3892
160-
161-
162-
163-
164-
165-
166-
167 return
executed 4120 times by 1 test: return 0;
Executed by:
  • Self test (438)
0;
executed 4120 times by 1 test: return 0;
Executed by:
  • Self test (438)
4120
168}-
169int sqlite3VdbeMemHandleBom(Mem *pMem){-
170 int rc = 0;-
171 u8 bom = 0;-
172-
173 -
174 ((void) (0))-
175 ;-
176 if( pMem->n>1
pMem->n>1Description
TRUEevaluated 2509 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
){
2-2509
177 u8 b1 = *(u8 *)pMem->z;-
178 u8 b2 = *(((u8 *)pMem->z) + 1);-
179 if( b1==0xFE
b1==0xFEDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2475 times by 1 test
Evaluated by:
  • Self test (438)
&& b2==0xFF
b2==0xFFDescription
TRUEevaluated 33 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
){
1-2475
180 bom = 3;-
181 }
executed 33 times by 1 test: end of block
Executed by:
  • Self test (438)
33
182 if( b1==0xFF
b1==0xFFDescription
TRUEevaluated 35 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2474 times by 1 test
Evaluated by:
  • Self test (438)
&& b2==0xFE
b2==0xFEDescription
TRUEevaluated 33 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
){
2-2474
183 bom = 2;-
184 }
executed 33 times by 1 test: end of block
Executed by:
  • Self test (438)
33
185 }
executed 2509 times by 1 test: end of block
Executed by:
  • Self test (438)
2509
186-
187 if( bom
bomDescription
TRUEevaluated 66 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2445 times by 1 test
Evaluated by:
  • Self test (438)
){
66-2445
188 rc = sqlite3VdbeMemMakeWriteable(pMem);-
189 if( rc==0
rc==0Description
TRUEevaluated 66 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
){
0-66
190 pMem->n -= 2;-
191 memmove(pMem->z, &pMem->z[2], pMem->n);-
192 pMem->z[pMem->n] = '\0';-
193 pMem->z[pMem->n+1] = '\0';-
194 pMem->flags |= 0x0200;-
195 pMem->enc = bom;-
196 }
executed 66 times by 1 test: end of block
Executed by:
  • Self test (438)
66
197 }
executed 66 times by 1 test: end of block
Executed by:
  • Self test (438)
66
198 return
executed 2511 times by 1 test: return rc;
Executed by:
  • Self test (438)
rc;
executed 2511 times by 1 test: return rc;
Executed by:
  • Self test (438)
2511
199}-
200int sqlite3Utf8CharLen(const char *zIn, int nByte){-
201 int r = 0;-
202 const u8 *z = (const u8*)zIn;-
203 const u8 *zTerm;-
204 if( nByte>=0
nByte>=0Description
TRUEevaluated 77156 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 881 times by 1 test
Evaluated by:
  • Self test (438)
){
881-77156
205 zTerm = &z[nByte];-
206 }
executed 77156 times by 436 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
else{
77156
207 zTerm = (const u8*)(-1);-
208 }
executed 881 times by 1 test: end of block
Executed by:
  • Self test (438)
881
209 -
210 ((void) (0))-
211 ;-
212 while( *
*z!=0Description
TRUEevaluated 3433298 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 2606 times by 1 test
Evaluated by:
  • Self test (438)
z!=0
*z!=0Description
TRUEevaluated 3433298 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 2606 times by 1 test
Evaluated by:
  • Self test (438)
&& z<zTerm
z<zTermDescription
TRUEevaluated 3357867 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 75431 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
){
2606-3433298
213 { if( (*(
(*(z++))>=0xc0Description
TRUEevaluated 78 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3357789 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
z++))>=0xc0
(*(z++))>=0xc0Description
TRUEevaluated 78 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3357789 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
){ while( (*
(*z & 0xc0)==0x80Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 78 times by 1 test
Evaluated by:
  • Self test (438)
z & 0xc0)==0x80
(*z & 0xc0)==0x80Description
TRUEevaluated 104 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 78 times by 1 test
Evaluated by:
  • Self test (438)
){ z++; }
executed 104 times by 1 test: end of block
Executed by:
  • Self test (438)
}
executed 78 times by 1 test: end of block
Executed by:
  • Self test (438)
};
78-3357789
214 r++;-
215 }
executed 3357867 times by 436 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
3357867
216 return
executed 78037 times by 436 tests: return r;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
r;
executed 78037 times by 436 tests: return r;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
78037
217}-
218char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte, u8 enc){-
219 Mem m;-
220 memset(&m, 0, sizeof(m));-
221 m.db = db;-
222 sqlite3VdbeMemSetStr(&m, z, nByte, enc, ((sqlite3_destructor_type)0));-
223 sqlite3VdbeChangeEncoding(&m, 1);-
224 if( db->mallocFailed
db->mallocFailedDescription
TRUEnever evaluated
FALSEevaluated 1751 times by 1 test
Evaluated by:
  • Self test (438)
){
0-1751
225 sqlite3VdbeMemRelease(&m);-
226 m.z = 0;-
227 }
never executed: end of block
0
228 -
229 ((void) (0))-
230 ;-
231 -
232 ((void) (0))-
233 ;-
234 -
235 ((void) (0))-
236 ;-
237 return
executed 1751 times by 1 test: return m.z;
Executed by:
  • Self test (438)
m.z;
executed 1751 times by 1 test: return m.z;
Executed by:
  • Self test (438)
1751
238}-
239-
240-
241-
242-
243-
244-
245int sqlite3Utf16ByteLen(const void *zIn, int nChar){-
246 int c;-
247 unsigned char const *z = zIn;-
248 int n = 0;-
249-
250 if( 2==3
2==3Description
TRUEnever evaluated
FALSEevaluated 1727 times by 1 test
Evaluated by:
  • Self test (438)
){
0-1727
251 while( n<nChar
n<nCharDescription
TRUEnever evaluated
FALSEnever evaluated
){
0
252 { c = ((*z++)<<8); c += (*z++); if( c>=0xD800
c>=0xD800Description
TRUEnever evaluated
FALSEnever evaluated
&& c<0xE000
c<0xE000Description
TRUEnever evaluated
FALSEnever evaluated
&& 1 ){ int c2 = ((*z++)<<8); c2 += (*z++); c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); }
never executed: end of block
};
0
253 n++;-
254 }
never executed: end of block
0
255 }
never executed: end of block
else{
0
256 while( n<nChar
n<nCharDescription
TRUEevaluated 87352 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1727 times by 1 test
Evaluated by:
  • Self test (438)
){
1727-87352
257 { c = (*z++); c += ((*z++)<<8); if( c>=0xD800
c>=0xD800Description
TRUEnever evaluated
FALSEevaluated 87352 times by 1 test
Evaluated by:
  • Self test (438)
&& c<0xE000
c<0xE000Description
TRUEnever evaluated
FALSEnever evaluated
&& 1 ){ int c2 = (*z++); c2 += ((*z++)<<8); c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); }
never executed: end of block
};
0-87352
258 n++;-
259 }
executed 87352 times by 1 test: end of block
Executed by:
  • Self test (438)
87352
260 }
executed 1727 times by 1 test: end of block
Executed by:
  • Self test (438)
1727
261 return
executed 1727 times by 1 test: return (int)(z-(unsigned char const *)zIn);
Executed by:
  • Self test (438)
(int)(z-(unsigned char const *)zIn);
executed 1727 times by 1 test: return (int)(z-(unsigned char const *)zIn);
Executed by:
  • Self test (438)
1727
262}-
263-
264-
265-
266-
267-
268-
269-
270void sqlite3UtfSelfTest(void){-
271 unsigned int i, t;-
272 unsigned char zBuf[20];-
273 unsigned char *z;-
274 int n;-
275 unsigned int c;-
276-
277 for(i=0; i<0x00110000
i<0x00110000Description
TRUEevaluated 1114112 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
; i++){
1-1114112
278 z = zBuf;-
279 { if( i<0x00080
i<0x00080Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1113984 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = (u8)(i&0xFF); }
executed 128 times by 1 test: end of block
Executed by:
  • Self test (438)
else if( i<0x00800
i<0x00800Description
TRUEevaluated 1920 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1112064 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = 0xC0 + (u8)((i>>6)&0x1F); *z++ = 0x80 + (u8)(i & 0x3F); }
executed 1920 times by 1 test: end of block
Executed by:
  • Self test (438)
else if( i<0x10000
i<0x10000Description
TRUEevaluated 63488 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1048576 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = 0xE0 + (u8)((i>>12)&0x0F); *z++ = 0x80 + (u8)((i>>6) & 0x3F); *z++ = 0x80 + (u8)(i & 0x3F); }
executed 63488 times by 1 test: end of block
Executed by:
  • Self test (438)
else{ *z++ = 0xF0 + (u8)((i>>18) & 0x07); *z++ = 0x80 + (u8)((i>>12) & 0x3F); *z++ = 0x80 + (u8)((i>>6) & 0x3F); *z++ = 0x80 + (u8)(i & 0x3F); }
executed 1048576 times by 1 test: end of block
Executed by:
  • Self test (438)
};
128-1113984
280 n = (int)(z-zBuf);-
281 -
282 ((void) (0))-
283 ;-
284 z[0] = 0;-
285 z = zBuf;-
286 c = sqlite3Utf8Read((const u8**)&z);-
287 t = i;-
288 if( i>=0xD800
i>=0xD800Description
TRUEevaluated 1058816 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 55296 times by 1 test
Evaluated by:
  • Self test (438)
&& i<=0xDFFF
i<=0xDFFFDescription
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1056768 times by 1 test
Evaluated by:
  • Self test (438)
) t = 0xFFFD;
executed 2048 times by 1 test: t = 0xFFFD;
Executed by:
  • Self test (438)
2048-1058816
289 if( (
(i&0xFFFFFFFE)==0xFFFEDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1114110 times by 1 test
Evaluated by:
  • Self test (438)
i&0xFFFFFFFE)==0xFFFE
(i&0xFFFFFFFE)==0xFFFEDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1114110 times by 1 test
Evaluated by:
  • Self test (438)
) t = 0xFFFD;
executed 2 times by 1 test: t = 0xFFFD;
Executed by:
  • Self test (438)
2-1114110
290 -
291 ((void) (0))-
292 ;-
293 -
294 ((void) (0))-
295 ;-
296 }
executed 1114112 times by 1 test: end of block
Executed by:
  • Self test (438)
1114112
297 for(i=0; i<0x00110000
i<0x00110000Description
TRUEevaluated 1114112 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
; i++){
1-1114112
298 if( i>=0xD800
i>=0xD800Description
TRUEevaluated 1058816 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 55296 times by 1 test
Evaluated by:
  • Self test (438)
&& i<0xE000
i<0xE000Description
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1056768 times by 1 test
Evaluated by:
  • Self test (438)
) continue;
executed 2048 times by 1 test: continue;
Executed by:
  • Self test (438)
2048-1058816
299 z = zBuf;-
300 { if( i<=0xFFFF
i<=0xFFFFDescription
TRUEevaluated 63488 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1048576 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = (u8)(i&0x00FF); *z++ = (u8)((i>>8)&0x00FF); }
executed 63488 times by 1 test: end of block
Executed by:
  • Self test (438)
else{ *z++ = (u8)(((i>>10)&0x003F) + (((i-0x10000)>>10)&0x00C0)); *z++ = (u8)(0x00D8 + (((i-0x10000)>>18)&0x03)); *z++ = (u8)(i&0x00FF); *z++ = (u8)(0x00DC + ((i>>8)&0x03)); }
executed 1048576 times by 1 test: end of block
Executed by:
  • Self test (438)
};
63488-1048576
301 n = (int)(z-zBuf);-
302 -
303 ((void) (0))-
304 ;-
305 z[0] = 0;-
306 z = zBuf;-
307 { c = (*z++); c += ((*z++)<<8); if( c>=0xD800
c>=0xD800Description
TRUEevaluated 1056768 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 55296 times by 1 test
Evaluated by:
  • Self test (438)
&& c<0xE000
c<0xE000Description
TRUEevaluated 1048576 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 8192 times by 1 test
Evaluated by:
  • Self test (438)
&& 1 ){ int c2 = (*z++); c2 += ((*z++)<<8); c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); }
executed 1048576 times by 1 test: end of block
Executed by:
  • Self test (438)
};
8192-1056768
308 -
309 ((void) (0))-
310 ;-
311 -
312 ((void) (0))-
313 ;-
314 }
executed 1112064 times by 1 test: end of block
Executed by:
  • Self test (438)
1112064
315 for(i=0; i<0x00110000
i<0x00110000Description
TRUEevaluated 1114112 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
; i++){
1-1114112
316 if( i>=0xD800
i>=0xD800Description
TRUEevaluated 1058816 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 55296 times by 1 test
Evaluated by:
  • Self test (438)
&& i<0xE000
i<0xE000Description
TRUEevaluated 2048 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1056768 times by 1 test
Evaluated by:
  • Self test (438)
) continue;
executed 2048 times by 1 test: continue;
Executed by:
  • Self test (438)
2048-1058816
317 z = zBuf;-
318 { if( i<=0xFFFF
i<=0xFFFFDescription
TRUEevaluated 63488 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1048576 times by 1 test
Evaluated by:
  • Self test (438)
){ *z++ = (u8)((i>>8)&0x00FF); *z++ = (u8)(i&0x00FF); }
executed 63488 times by 1 test: end of block
Executed by:
  • Self test (438)
else{ *z++ = (u8)(0x00D8 + (((i-0x10000)>>18)&0x03)); *z++ = (u8)(((i>>10)&0x003F) + (((i-0x10000)>>10)&0x00C0)); *z++ = (u8)(0x00DC + ((i>>8)&0x03)); *z++ = (u8)(i&0x00FF); }
executed 1048576 times by 1 test: end of block
Executed by:
  • Self test (438)
};
63488-1048576
319 n = (int)(z-zBuf);-
320 -
321 ((void) (0))-
322 ;-
323 z[0] = 0;-
324 z = zBuf;-
325 { c = ((*z++)<<8); c += (*z++); if( c>=0xD800
c>=0xD800Description
TRUEevaluated 1056768 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 55296 times by 1 test
Evaluated by:
  • Self test (438)
&& c<0xE000
c<0xE000Description
TRUEevaluated 1048576 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 8192 times by 1 test
Evaluated by:
  • Self test (438)
&& 1 ){ int c2 = ((*z++)<<8); c2 += (*z++); c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); }
executed 1048576 times by 1 test: end of block
Executed by:
  • Self test (438)
};
8192-1056768
326 -
327 ((void) (0))-
328 ;-
329 -
330 ((void) (0))-
331 ;-
332 }
executed 1112064 times by 1 test: end of block
Executed by:
  • Self test (438)
1112064
333}
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2