Fossil

Diff
Login

Diff

Differences From Artifact [c96a3f58ac]:

To Artifact [3ae7e19f08]:


155
156
157
158
159
160
161
162
163


164
165
166
167

168
169
170
171
172
173
174
155
156
157
158
159
160
161


162
163
164
165
166

167
168
169
170
171
172
173
174







-
-
+
+



-
+








  if( n==0 ) return 0;  /* Empty file -> OK */
  c = *z;
  while( --n>0 ){
    c2 = c;
    c = *++z;
    if( c2>=0x80 ){
      if( ((c&0xc0)!=0x80) || ((c2<0xc2) || (c2>=0xf4)) &&
          (((c2!=0xf4) || (c>=0x90)) && ((c2!=0xc0) || (c!=0x80))) ){
      if( ((c&0xc0)!=0x80) || (((c2<0xc2) || (c2>=0xf4)) &&
          (((c2!=0xf4) || (c>=0x90)) && ((c2!=0xc0) || (c!=0x80)))) ){
        return LOOK_INVALID; /* Invalid UTF-8 */
      }
      if( c2>=0xe0 ){
        if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0)){
        if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0) ){
          return LOOK_INVALID; /* Invalid UTF-8, too short */
        }
        c = (c2<<1)|3;
      }else{
        c = ' ';
      }
    }