]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix harmless compiler warnings for MSVC in the showdb/showwal command line tools.
authormistachkin <mistachkin@noemail.net>
Fri, 18 Jul 2014 21:16:37 +0000 (21:16 +0000)
committermistachkin <mistachkin@noemail.net>
Fri, 18 Jul 2014 21:16:37 +0000 (21:16 +0000)
FossilOrigin-Name: 6dc7b2f119eb92da17c9e914bdad30a9ceaebdb5

manifest
manifest.uuid
tool/showdb.c
tool/showwal.c

index 3fa4f049fa75b4f84d4fdfda8edae6175522eeaf..685f9ad5941b7206201e4f4e4113e45f3a3e66a5 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Update\sclean\stargets\swith\sthe\srecently\sadded\scommand-line\stools.
-D 2014-07-18T21:02:54.697
+C Fix\sharmless\scompiler\swarnings\sfor\sMSVC\sin\sthe\sshowdb/showwal\scommand\sline\stools.
+D 2014-07-18T21:16:37.850
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -1160,10 +1160,10 @@ F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
 F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b
 F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a
 F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5
-F tool/showdb.c 213e0288501b2cf67c1b2c72a9e5b8acda4738b3
+F tool/showdb.c 3c78d10af9bb7ee667ceaa271e1d1ecbcdc3e69c
 F tool/showjournal.c 053eb1cc774710c6890b7dd6293300cc297b16a5
 F tool/showstat4.c c39279d6bd37cb999b634f0064f6f86ad7af008f
-F tool/showwal.c 3f7f7da5ec0cba51b1449a75f700493377da57b5
+F tool/showwal.c 6e98bc0fe0ae75f4b08e39d21ed90d7d78d307c0
 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
 F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b
 F tool/spaceanal.tcl 8e50b217c56a6a086a1b47eac9d09c5cd65b996f
@@ -1182,7 +1182,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P ca92c0240681b199c4b8ecc557792b8aea71692d
-R 432f9d3a43bd2fc68603a985c53b9df5
+P 2beefa68c0c53f663321bebf0ac06f6c936be63f
+R 7c81b84c85a1fee51213cddde915664f
+T *branch * toolWarnings
+T *sym-toolWarnings *
+T -sym-trunk *
 U mistachkin
-Z 7459013a6be89cfe73225b448eb2a655
+Z 6dc51fde6dee7a6bda251af41648d319
index e37705787efa216f5db113d64b801ee9039cd609..e189e09c490a198c5cc3f75ad3d3d955c5928c0b 100644 (file)
@@ -1 +1 @@
-2beefa68c0c53f663321bebf0ac06f6c936be63f
\ No newline at end of file
+6dc7b2f119eb92da17c9e914bdad30a9ceaebdb5
\ No newline at end of file
index 8dd387365cc217e8d7f6bbee31090b7828cb9f4f..3324729184e1439108dc42dfd8ba79592619121f 100644 (file)
@@ -9,6 +9,8 @@
 
 #if !defined(_MSC_VER)
 #include <unistd.h>
+#else
+#include <io.h>
 #endif
 
 #include <stdlib.h>
@@ -190,14 +192,14 @@ static void print_db_header(void){
 /*
 ** Describe cell content.
 */
-static int describeContent(
+static i64 describeContent(
   unsigned char *a,       /* Cell content */
-  int nLocal,             /* Bytes in a[] */
+  i64 nLocal,             /* Bytes in a[] */
   char *zDesc             /* Write description here */
 ){
-  int nDesc = 0;
-  int n, i, j;
-  i64 x, v;
+  i64 nDesc = 0;
+  int n, j;
+  i64 i, x, v;
   const unsigned char *pData;
   const unsigned char *pLimit;
   char sep = ' ';
@@ -237,7 +239,7 @@ static int describeContent(
     }else if( x==9 ){
       sprintf(zDesc, "1");
     }else if( x>=12 ){
-      int size = (x-12)/2;
+      i64 size = (x-12)/2;
       if( (x&1)==0 ){
         sprintf(zDesc, "blob(%d)", size);
       }else{
@@ -256,11 +258,11 @@ static int describeContent(
 ** Compute the local payload size given the total payload size and
 ** the page size.
 */
-static int localPayload(i64 nPayload, char cType){
-  int maxLocal;
-  int minLocal;
-  int surplus;
-  int nLocal;
+static i64 localPayload(i64 nPayload, char cType){
+  i64 maxLocal;
+  i64 minLocal;
+  i64 surplus;
+  i64 nLocal;
   if( cType==13 ){
     /* Table leaf */
     maxLocal = pagesize-35;
@@ -288,19 +290,19 @@ static int localPayload(i64 nPayload, char cType){
 **
 ** The return value is the local cell size.
 */
-static int describeCell(
+static i64 describeCell(
   unsigned char cType,    /* Page type */
   unsigned char *a,       /* Cell content */
   int showCellContent,    /* Show cell content if true */
   char **pzDesc           /* Store description here */
 ){
   int i;
-  int nDesc = 0;
+  i64 nDesc = 0;
   int n = 0;
   int leftChild;
   i64 nPayload;
   i64 rowid;
-  int nLocal;
+  i64 nLocal;
   static char zDesc[1000];
   i = 0;
   if( cType<=5 ){
@@ -373,13 +375,14 @@ static void decodeCell(
   int szPgHdr,            /* Size of the page header.  0 or 100 */
   int ofst                /* Cell begins at a[ofst] */
 ){
-  int i, j, k;
+  int i, j;
   int leftChild;
+  i64 k;
   i64 nPayload;
   i64 rowid;
   i64 nHdr;
   i64 iType;
-  int nLocal;
+  i64 nLocal;
   unsigned char *x = a + ofst;
   unsigned char *end;
   unsigned char cType = a[0];
@@ -452,7 +455,7 @@ static void decodeCell(
        }
        printf("%s\n", zTypeName);
        szCol[nCol] = sz;
-       ofstCol[nCol] = k;
+       ofstCol[nCol] = (int)k;
        typeCol[nCol] = (int)iType;
        k += sz;
        nCol++;
@@ -585,13 +588,13 @@ static void decode_btree_page(
   for(i=0; i<nCell; i++){
     int cofst = iCellPtr + i*2;
     char *zDesc;
-    int n;
+    i64 n;
 
     cofst = a[cofst]*256 + a[cofst+1];
     n = describeCell(a[0], &a[cofst-hdrSize], showCellContent, &zDesc);
     if( showMap ){
       char zBuf[30];
-      memset(&zMap[cofst], '*', n);
+      memset(&zMap[cofst], '*', (size_t)n);
       zMap[cofst] = '[';
       zMap[cofst+n-1] = ']';
       sprintf(zBuf, "%d", i);
@@ -692,7 +695,7 @@ static void page_usage_cell(
   int n = 0;
   i64 nPayload;
   i64 rowid;
-  int nLocal;
+  i64 nLocal;
   i = 0;
   if( cType<=5 ){
     a += 4;
@@ -893,12 +896,12 @@ static void page_usage_report(const char *zDbName){
 ** Try to figure out how every page in the database file is being used.
 */
 static void ptrmap_coverage_report(const char *zDbName){
-  unsigned int pgno;
+  int pgno;
   unsigned char *aHdr;
   unsigned char *a;
   int usable;
   int perPage;
-  unsigned int i;
+  int i;
 
   /* Avoid the pathological case */
   if( mxPage<1 ){
index 2888c10aa590718b1ebf9a499745d0568e5fc6e3..b63e556c4b2bef2ee2dd8b8aaae6c646b5aa745a 100644 (file)
@@ -6,7 +6,13 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+
+#if !defined(_MSC_VER)
 #include <unistd.h>
+#else
+#include <io.h>
+#endif
+
 #include <stdlib.h>
 #include <string.h>
 
@@ -273,14 +279,14 @@ static void print_wal_header(Cksum *pCksum){
 /*
 ** Describe cell content.
 */
-static int describeContent(
+static i64 describeContent(
   unsigned char *a,       /* Cell content */
-  int nLocal,             /* Bytes in a[] */
+  i64 nLocal,             /* Bytes in a[] */
   char *zDesc             /* Write description here */
 ){
   int nDesc = 0;
-  int n, i, j;
-  i64 x, v;
+  int n, j;
+  i64 i, x, v;
   const unsigned char *pData;
   const unsigned char *pLimit;
   char sep = ' ';
@@ -320,7 +326,7 @@ static int describeContent(
     }else if( x==9 ){
       sprintf(zDesc, "1");
     }else if( x>=12 ){
-      int size = (x-12)/2;
+      i64 size = (x-12)/2;
       if( (x&1)==0 ){
         sprintf(zDesc, "blob(%d)", size);
       }else{
@@ -339,11 +345,11 @@ static int describeContent(
 ** Compute the local payload size given the total payload size and
 ** the page size.
 */
-static int localPayload(i64 nPayload, char cType){
-  int maxLocal;
-  int minLocal;
-  int surplus;
-  int nLocal;
+static i64 localPayload(i64 nPayload, char cType){
+  i64 maxLocal;
+  i64 minLocal;
+  i64 surplus;
+  i64 nLocal;
   if( cType==13 ){
     /* Table leaf */
     maxLocal = pagesize-35;
@@ -370,19 +376,19 @@ static int localPayload(i64 nPayload, char cType){
 **
 ** The return value is the local cell size.
 */
-static int describeCell(
+static i64 describeCell(
   unsigned char cType,    /* Page type */
   unsigned char *a,       /* Cell content */
   int showCellContent,    /* Show cell content if true */
   char **pzDesc           /* Store description here */
 ){
   int i;
-  int nDesc = 0;
+  i64 nDesc = 0;
   int n = 0;
   int leftChild;
   i64 nPayload;
   i64 rowid;
-  int nLocal;
+  i64 nLocal;
   static char zDesc[1000];
   i = 0;
   if( cType<=5 ){
@@ -479,13 +485,13 @@ static void decode_btree_page(
   for(i=0; i<nCell; i++){
     int cofst = iCellPtr + i*2;
     char *zDesc;
-    int n;
+    i64 n;
 
     cofst = a[cofst]*256 + a[cofst+1];
     n = describeCell(a[0], &a[cofst-hdrSize], showCellContent, &zDesc);
     if( showMap ){
       char zBuf[30];
-      memset(&zMap[cofst], '*', n);
+      memset(&zMap[cofst], '*', (size_t)n);
       zMap[cofst] = '[';
       zMap[cofst+n-1] = ']';
       sprintf(zBuf, "%d", i);