diff options
author | dan <Dan Kennedy> | 2021-03-17 11:25:42 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2021-03-17 11:25:42 +0000 |
commit | 42470513b74040da1f87d9ac223fbb89170c1079 (patch) | |
tree | 3f324c45028a3da9e04f35479cff4c2d8b8be9e4 /tool/sqldiff.c | |
parent | a7d8d4a07a37ade15622e83eb12e109a452ad07f (diff) | |
download | sqlite-42470513b74040da1f87d9ac223fbb89170c1079.tar.gz sqlite-42470513b74040da1f87d9ac223fbb89170c1079.zip |
Fix a problem in sqldiff virtual table hanlding to do with tab and other non-space whitespace characters in the CREATE VIRTUAL TABLE statement.
FossilOrigin-Name: 1737e4fdfc9a3628415b234338a68a64cbbaadb23598517761e571ab7ed7ad14
Diffstat (limited to 'tool/sqldiff.c')
-rw-r--r-- | tool/sqldiff.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tool/sqldiff.c b/tool/sqldiff.c index 123d5b49b..9844cbadf 100644 --- a/tool/sqldiff.c +++ b/tool/sqldiff.c @@ -1713,19 +1713,27 @@ end_changeset_one_table: } /* +** Return true if the ascii character passed as the only argument is a +** whitespace character. Otherwise return false. +*/ +static int is_whitespace(char x){ + return (x==' ' || x=='\t' || x=='\n' || x=='\r'); +} + +/* ** Extract the next SQL keyword or quoted string from buffer zIn and copy it ** (or a prefix of it if it will not fit) into buffer zBuf, size nBuf bytes. ** Return a pointer to the character within zIn immediately following ** the token or quoted string just extracted. */ -const char *gobble_token(const char *zIn, char *zBuf, int nBuf){ +static const char *gobble_token(const char *zIn, char *zBuf, int nBuf){ const char *p = zIn; char *pOut = zBuf; char *pEnd = &pOut[nBuf-1]; char q = 0; /* quote character, if any */ if( p==0 ) return 0; - while( *p==' ' ) p++; + while( is_whitespace(*p) ) p++; switch( *p ){ case '"': q = '"'; break; case '\'': q = '\''; break; @@ -1744,7 +1752,7 @@ const char *gobble_token(const char *zIn, char *zBuf, int nBuf){ p++; } }else{ - while( *p && *p!=' ' && *p!='(' ){ + while( *p && !is_whitespace(*p) && *p!='(' ){ if( pOut<pEnd ) *pOut++ = *p; p++; } |