From: mistachkin Date: Wed, 17 Jun 2015 19:06:23 +0000 (+0000) Subject: Use 'binary' mode for popen with MSVC. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2FpopenMsvc;p=thirdparty%2Fsqlite.git Use 'binary' mode for popen with MSVC. FossilOrigin-Name: 7b84641e55654f8e81b62893d0bb66b12dedfcf2 --- diff --git a/manifest b/manifest index 5bc880ee3d..8d5cd14449 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improve\sspacing\sand\scomment\sstyle\sfor\sthe\sshell.\s\sNo\schanges\sto\scode. -D 2015-06-17T18:57:37.637 +C Use\s'binary'\smode\sfor\spopen\swith\sMSVC. +D 2015-06-17T19:06:23.479 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1063c58075b7400d93326b0eb332b48a54f53025 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -251,7 +251,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c 84c571794e3ee5806274d95158a4c0177c6c4708 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c 45a814a755f90c1a6345164d2da4a8ef293da53d -F src/shell.c 8af3cced094aebb5f57a8ad739b9dafc7867eed7 +F src/shell.c 5ebff868cf3124a484d7b107907589bf4f127f82 F src/sqlite.h.in 76d2f5637eb795b6300d9dd3c3ec3632ffafd721 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h be1a718b7d2ce40ceba725ae92c8eb5f18003066 @@ -1286,7 +1286,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P a7e27d19280048bcfff6d2e796eed72287b9dabe -R 10ec64cfc3a208bfe24294966a7ab6ac +P 5b547da00d131a494a6b348339af3d91dfa6e3b6 +R 8612529b13f9ca5434e4332b04ad8958 +T *branch * popenMsvc +T *sym-popenMsvc * +T -sym-trunk * U mistachkin -Z 7cf2fc34937c3a0e66c014198502d58b +Z 113266189542ecf55e5f2a32a4472f5b diff --git a/manifest.uuid b/manifest.uuid index 27a46f6c68..7d0f101b2f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5b547da00d131a494a6b348339af3d91dfa6e3b6 \ No newline at end of file +7b84641e55654f8e81b62893d0bb66b12dedfcf2 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index d097e913a3..f8b28622a7 100644 --- a/src/shell.c +++ b/src/shell.c @@ -109,6 +109,11 @@ # define popen _popen # undef pclose # define pclose _pclose +# if !defined(SQLITE_POPEN_MODE) && defined(_MSC_VER) +# define SQLITE_POPEN_MODE "b" +# else +# define SQLITE_POPEN_MODE "" +# endif #else /* Make sure isatty() has a prototype. */ extern int isatty(int); @@ -118,6 +123,9 @@ ** sometimes omitted from the header */ extern FILE *popen(const char*,const char*); extern int pclose(FILE*); +# ifndef SQLITE_POPEN_MODE +# define SQLITE_POPEN_MODE "" +# endif # else # define SQLITE_OMIT_POPEN 1 # endif @@ -3004,7 +3012,7 @@ static int do_meta_command(char *zLine, ShellState *p){ fprintf(stderr, "Error: pipes are not supported in this OS\n"); return 1; #else - sCtx.in = popen(sCtx.zFile+1, "r"); + sCtx.in = popen(sCtx.zFile+1, "r" SQLITE_POPEN_MODE); sCtx.zFile = ""; xCloser = pclose; #endif @@ -3392,7 +3400,7 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = 1; p->out = stdout; #else - p->out = popen(zFile + 1, "w"); + p->out = popen(zFile + 1, "w" SQLITE_POPEN_MODE); if( p->out==0 ){ fprintf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1); p->out = stdout;