/ Check-in [cbaf5b6c]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cbaf5b6c1b07b29b2c83fa01618de856d81cc1174769cb9770cb5c894cc87ace
User & Date: dan 2018-09-26 16:05:07
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: 209afb8d 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: cbaf5b6c 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: 4ed9d83a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to ext/misc/spellfix.c.

  1291   1291     return nChar;
  1292   1292   }
  1293   1293   
  1294   1294   typedef struct Transliteration Transliteration;
  1295   1295   struct Transliteration {
  1296   1296    unsigned short int cFrom;
  1297   1297    unsigned char cTo0, cTo1, cTo2, cTo3;
         1298  +#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
         1299  + unsigned char cTo4;
         1300  +#endif
  1298   1301   };
  1299   1302   
  1300   1303   /*
  1301   1304   ** Table of translations from unicode characters into ASCII.
  1302   1305   */
  1303   1306   static const Transliteration translit[] = {
  1304   1307     { 0x00A0,  0x20, 0x00, 0x00, 0x00 },  /*   to   */
................................................................................
  1704   1707   **
  1705   1708   ** The returned string might contain more characters than the input.
  1706   1709   **
  1707   1710   ** Space to hold the returned string comes from sqlite3_malloc() and
  1708   1711   ** should be freed by the caller.
  1709   1712   */
  1710   1713   static unsigned char *transliterate(const unsigned char *zIn, int nIn){
         1714  +#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
         1715  +  unsigned char *zOut = sqlite3_malloc64( nIn*5 + 1 );
         1716  +#else
  1711   1717     unsigned char *zOut = sqlite3_malloc64( nIn*4 + 1 );
         1718  +#endif
  1712   1719     int c, sz, nOut;
  1713   1720     if( zOut==0 ) return 0;
  1714   1721     nOut = 0;
  1715   1722     while( nIn>0 ){
  1716   1723       c = utf8Read(zIn, nIn, &sz);
  1717   1724       zIn += sz;
  1718   1725       nIn -= sz;
................................................................................
  1728   1735             zOut[nOut++] = tbl[x].cTo0;
  1729   1736             if( tbl[x].cTo1 ){
  1730   1737               zOut[nOut++] = tbl[x].cTo1;
  1731   1738               if( tbl[x].cTo2 ){
  1732   1739                 zOut[nOut++] = tbl[x].cTo2;
  1733   1740                 if( tbl[x].cTo3 ){
  1734   1741                   zOut[nOut++] = tbl[x].cTo3;
         1742  +#ifdef SQLITE_SPELLFIX_5BYTE_MAPPINGS
         1743  +                if( tbl[x].cTo4 ){
         1744  +                  zOut[nOut++] = tbl[x].cTo4;
         1745  +                }
         1746  +#endif /* SQLITE_SPELLFIX_5BYTE_MAPPINGS */
  1735   1747                 }
  1736   1748               }
  1737   1749             }
  1738   1750             c = 0;
  1739   1751             break;
  1740   1752           }else if( tbl[x].cFrom>c ){
  1741   1753             xTop = x-1;