Fossil

Check-in [e449ede3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Eliminate (harmless) compiler warning
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e449ede35ee20c58b70e9e7c1669a8b08da72564
User & Date: jan.nijtmans 2016-06-14 07:43:53
Context
2016-06-14
11:10
Version 1.35 check-in: 3aa86af6 user: drh tags: trunk, release, version-1.35
07:43
Eliminate (harmless) compiler warning check-in: e449ede3 user: jan.nijtmans tags: trunk
2016-06-13
08:29
Fix handling of byte sequence \xF4\x00 in utf-8 validation. Now all tests pass again. Thanks to Scott Robison for discovering this! check-in: 5684672a user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/lookslike.c.

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))) ){
        return LOOK_INVALID; /* Invalid UTF-8 */
      }
      if( c2>=0xe0 ){
        if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0)){
          return LOOK_INVALID; /* Invalid UTF-8, too short */
        }
        c = (c2<<1)|3;
      }else{
        c = ' ';
      }
    }







|
|



|







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)))) ){
        return LOOK_INVALID; /* Invalid UTF-8 */
      }
      if( c2>=0xe0 ){
        if ((c2==0xf0 && c<0x90)||(c2==0xe0 && c<0xa0) ){
          return LOOK_INVALID; /* Invalid UTF-8, too short */
        }
        c = (c2<<1)|3;
      }else{
        c = ' ';
      }
    }