/ Check-in [28957d63]
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:Form-feed is not valid whitespace for json. Fix for ticket [57eec374ae1d0a1d]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 28957d635961c525f735a52b8ffe3e69ccf31382
User & Date: drh 2015-10-16 15:16:06
Context
2015-10-16
15:56
Cherrypick the json form-feed fix, and other #ifdef and build script changes to address minor issues that came to light after the 3.9.0 release. Update the version number to 3.9.1. No logic changes except for the form-feed bug-fix in json1 (ticket [57eec374ae1d0a1d4a]). check-in: 746fcd2f user: drh tags: branch-3.9
15:35
Fix the JSON1 extension so that it does not depend on isdigit() and strtod() from the standard library when compiled into SQLite as part of the amalgamation. check-in: bc9a9a60 user: drh tags: trunk
15:16
Form-feed is not valid whitespace for json. Fix for ticket [57eec374ae1d0a1d] check-in: 28957d63 user: drh tags: trunk
14:54
Have the sqlite3VdbeSerialType() function go ahead and compute the serial length as well, since it is always needed. This avoids unnecessary calls to sqlite3VdbeSerialTypeLen(). check-in: 2ad72be1 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/json1.c.

    48     48   
    49     49   /*
    50     50   ** Growing our own isspace() routine this way is twice as fast as
    51     51   ** the library isspace() function, resulting in a 7% overall performance
    52     52   ** increase for the parser.  (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
    53     53   */
    54     54   static const char jsonIsSpace[] = {
    55         -  0, 0, 0, 0, 0, 0, 0, 0,     0, 1, 1, 0, 1, 1, 0, 0,
           55  +  0, 0, 0, 0, 0, 0, 0, 0,     0, 1, 1, 0, 0, 1, 0, 0,
    56     56     0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
    57     57     1, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
    58     58     0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
    59     59     0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
    60     60     0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
    61     61     0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
    62     62     0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,

Changes to test/json101.test.

   320    320   do_execsql_test json-6.3 {
   321    321     SELECT json_valid('["a",55,"b",72,]');
   322    322   } {0}
   323    323   do_execsql_test json-6.4 {
   324    324     SELECT json_valid('["a",55,"b",72]');
   325    325   } {1}
   326    326   
          327  +# White-space tests.  Note that form-feed is not white-space in JSON.
          328  +# ticket [57eec374ae1d0a1d4a23077a95f4e173fe269113]
          329  +# 
          330  +foreach {tn isvalid ws} {
          331  +  7.1  1  char(0x20)
          332  +  7.2  1  char(0x09)
          333  +  7.3  1  char(0x0A)
          334  +  7.4  1  char(0x0D)
          335  +  7.5  0  char(0x0C)
          336  +  7.6  1  char(0x20,0x09,0x0a,0x0d,0x20)
          337  +  7.7  0  char(0x20,0x09,0x0a,0x0c,0x0d,0x20)
          338  +} {
          339  +  do_execsql_test json-$tn.1 \
          340  +    "SELECT json_valid(printf('%s{%s\"x\"%s:%s9%s}%s',
          341  +         $::ws,$::ws,$::ws,$::ws,$::ws,$::ws));" \
          342  +  $isvalid
          343  +}
   327    344   
   328    345   finish_test