SQLite

Check-in [cbaf5b6c1b]
Login

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

Overview
Comment:Tweak spellfix.c so that if SQLITE_SPELLFIX_5BYTE_MAPPINGS is defined at compile time the Transliteration structure has space for 5 byte (instead of 4 byte) mappings.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cbaf5b6c1b07b29b2c83fa01618de856d81cc1174769cb9770cb5c894cc87ace
User & Date: dan 2018-09-26 16:05:07.074
Context
2018-09-26
16:53
Begin revamping the ".help" command in the command-line shell so that it can accept an argument and will do a search for commands that match that argument. (check-in: 209afb8d06 user: drh tags: trunk)
16:05
Tweak spellfix.c so that if SQLITE_SPELLFIX_5BYTE_MAPPINGS is defined at compile time the Transliteration structure has space for 5 byte (instead of 4 byte) mappings. (check-in: cbaf5b6c1b user: dan tags: trunk)
03:43
Fix typos in the header comment for the sha1 and sha3 hash extensions in the ext/misc folder. (check-in: 4ed9d83a0b user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to ext/misc/spellfix.c.
1291
1292
1293
1294
1295
1296
1297



1298
1299
1300
1301
1302
1303
1304
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307







+
+
+







  return nChar;
}

typedef struct Transliteration Transliteration;
struct Transliteration {
 unsigned short int cFrom;
 unsigned char cTo0, cTo1, cTo2, cTo3;
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
 unsigned char cTo4;
#endif
};

/*
** Table of translations from unicode characters into ASCII.
*/
static const Transliteration translit[] = {
  { 0x00A0,  0x20, 0x00, 0x00, 0x00 },  /*   to   */
1704
1705
1706
1707
1708
1709
1710



1711

1712
1713
1714
1715
1716
1717
1718
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725







+
+
+

+







**
** The returned string might contain more characters than the input.
**
** Space to hold the returned string comes from sqlite3_malloc() and
** should be freed by the caller.
*/
static unsigned char *transliterate(const unsigned char *zIn, int nIn){
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
  unsigned char *zOut = sqlite3_malloc64( nIn*5 + 1 );
#else
  unsigned char *zOut = sqlite3_malloc64( nIn*4 + 1 );
#endif
  int c, sz, nOut;
  if( zOut==0 ) return 0;
  nOut = 0;
  while( nIn>0 ){
    c = utf8Read(zIn, nIn, &sz);
    zIn += sz;
    nIn -= sz;
1728
1729
1730
1731
1732
1733
1734





1735
1736
1737
1738
1739
1740
1741
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753







+
+
+
+
+







          zOut[nOut++] = tbl[x].cTo0;
          if( tbl[x].cTo1 ){
            zOut[nOut++] = tbl[x].cTo1;
            if( tbl[x].cTo2 ){
              zOut[nOut++] = tbl[x].cTo2;
              if( tbl[x].cTo3 ){
                zOut[nOut++] = tbl[x].cTo3;
#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
                if( tbl[x].cTo4 ){
                  zOut[nOut++] = tbl[x].cTo4;
                }
#endif /* SQLITE_SPELLFIX_5BYTE_MAPPINGS */
              }
            }
          }
          c = 0;
          break;
        }else if( tbl[x].cFrom>c ){
          xTop = x-1;