Fix harmless compiler warnings in the showdb and showwal tools and in

the unicode tokenizer of FTS3.

FossilOrigin-Name: 574cc8eb1448cff67390f2e16cc9b7c3ddd4658b
This commit is contained in:
drh
2014-07-19 17:49:40 +00:00
5 changed files with 78 additions and 68 deletions
+5 -5
View File
@@ -231,7 +231,7 @@ static int unicodeCreate(
for(i=0; rc==SQLITE_OK && i<nArg; i++){
const char *z = azArg[i];
int n = strlen(z);
int n = (int)strlen(z);
if( n==19 && memcmp("remove_diacritics=1", z, 19)==0 ){
pNew->bRemoveDiacritic = 1;
@@ -363,11 +363,11 @@ static int unicodeNext(
);
/* Set the output variables and return. */
pCsr->iOff = (z - pCsr->aInput);
pCsr->iOff = (int)(z - pCsr->aInput);
*paToken = pCsr->zToken;
*pnToken = zOut - pCsr->zToken;
*piStart = (zStart - pCsr->aInput);
*piEnd = (zEnd - pCsr->aInput);
*pnToken = (int)(zOut - pCsr->zToken);
*piStart = (int)(zStart - pCsr->aInput);
*piEnd = (int)(zEnd - pCsr->aInput);
*piPos = pCsr->iToken++;
return SQLITE_OK;
}
+10 -9
View File
@@ -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\sin\sthe\sshowdb\sand\sshowwal\stools\sand\sin\nthe\sunicode\stokenizer\sof\sFTS3.
D 2014-07-19T17:49:40.535
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -94,7 +94,7 @@ F ext/fts3/fts3_tokenize_vtab.c 011170fe9eba5ff062f1a31d3188e00267716706
F ext/fts3/fts3_tokenizer.c bbdc731bc91338050675c6d1da9ab82147391e16
F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
F ext/fts3/fts3_unicode.c 0f598fa4c96af1188e4d5f5e8e78e25500bd5922
F ext/fts3/fts3_unicode.c e80eef8a11f2020dc9c1eb95c5b405b9012f2fbe
F ext/fts3/fts3_unicode2.c c8adda75aad0c6c252ef3dd555f811f437485044
F ext/fts3/fts3_write.c 8260388626516a7005d06a9dce94f9e55c6c2a41
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
@@ -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 b9ee6b6c81a094bf33badbf7e9da34cdbc0cce25
F tool/showjournal.c 053eb1cc774710c6890b7dd6293300cc297b16a5
F tool/showstat4.c c39279d6bd37cb999b634f0064f6f86ad7af008f
F tool/showwal.c 3f7f7da5ec0cba51b1449a75f700493377da57b5
F tool/showwal.c 3209120269cdf9380f091459e47b776b4f81dfd3
F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe
F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b
F tool/spaceanal.tcl 8e50b217c56a6a086a1b47eac9d09c5cd65b996f
@@ -1182,7 +1182,8 @@ 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
U mistachkin
Z 7459013a6be89cfe73225b448eb2a655
P 2beefa68c0c53f663321bebf0ac06f6c936be63f c01caea5d6ad7a570628b85fb3056ac955ff03dd
R 4ac50ab96ea64a1527703075acfe4ff2
T +closed c01caea5d6ad7a570628b85fb3056ac955ff03dd
U drh
Z cd2aeeb09b327b0fcacfc59206b5ba8f
+1 -1
View File
@@ -1 +1 @@
2beefa68c0c53f663321bebf0ac06f6c936be63f
574cc8eb1448cff67390f2e16cc9b7c3ddd4658b
+35 -32
View File
@@ -9,6 +9,8 @@
#if !defined(_MSC_VER)
#include <unistd.h>
#else
#include <io.h>
#endif
#include <stdlib.h>
@@ -141,7 +143,7 @@ static void print_decode_line(
int val = aData[ofst];
char zBuf[100];
sprintf(zBuf, " %03x: %02x", ofst, aData[ofst]);
i = strlen(zBuf);
i = (int)strlen(zBuf);
for(j=1; j<4; j++){
if( j>=nByte ){
sprintf(&zBuf[i], " ");
@@ -149,7 +151,7 @@ static void print_decode_line(
sprintf(&zBuf[i], " %02x", aData[ofst+j]);
val = val*256 + aData[ofst+j];
}
i += strlen(&zBuf[i]);
i += (int)strlen(&zBuf[i]);
}
sprintf(&zBuf[i], " %9d", val);
printf("%s %s\n", zBuf, zMsg);
@@ -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,15 +239,15 @@ 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);
sprintf(zDesc, "blob(%lld)", size);
}else{
sprintf(zDesc, "txt(%d)", size);
sprintf(zDesc, "txt(%lld)", size);
}
pData += size;
}
j = strlen(zDesc);
j = (int)strlen(zDesc);
zDesc += j;
nDesc += j;
}
@@ -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];
@@ -400,10 +403,10 @@ static void decodeCell(
printBytes(a, x, i);
nLocal = localPayload(nPayload, cType);
if( nLocal==nPayload ){
printf("payload-size: %d\n", (int)nPayload);
printf("payload-size: %lld\n", nPayload);
}else{
printf("payload-size: %d (%d local, %d overflow)\n",
(int)nPayload, nLocal, (int)(nPayload-nLocal));
printf("payload-size: %lld (%lld local, %lld overflow)\n",
nPayload, nLocal, nPayload-nLocal);
}
x += i;
}else{
@@ -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++;
@@ -506,7 +509,7 @@ static void decodeCell(
}
if( j<nLocal ){
printBytes(a, x+j, 0);
printf("... %d bytes of content ...\n", nLocal-j);
printf("... %lld bytes of content ...\n", nLocal-j);
}
if( nLocal<nPayload ){
printBytes(a, x+nLocal, 4);
@@ -585,17 +588,17 @@ 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);
j = strlen(zBuf);
j = (int)strlen(zBuf);
if( j<=n-2 ) memcpy(&zMap[cofst+1], zBuf, j);
}
if( cellToDecode==(-2) ){
@@ -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 ){
+27 -21
View 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>
@@ -172,7 +178,7 @@ static void print_decode_line(
int val = aData[ofst];
char zBuf[100];
sprintf(zBuf, " %03x: %02x", ofst, aData[ofst]);
i = strlen(zBuf);
i = (int)strlen(zBuf);
for(j=1; j<4; j++){
if( j>=nByte ){
sprintf(&zBuf[i], " ");
@@ -180,7 +186,7 @@ static void print_decode_line(
sprintf(&zBuf[i], " %02x", aData[ofst+j]);
val = val*256 + aData[ofst+j];
}
i += strlen(&zBuf[i]);
i += (int)strlen(&zBuf[i]);
}
if( asHex ){
sprintf(&zBuf[i], " 0x%08x", val);
@@ -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,15 +326,15 @@ 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);
sprintf(zDesc, "blob(%lld)", size);
}else{
sprintf(zDesc, "txt(%d)", size);
sprintf(zDesc, "txt(%lld)", size);
}
pData += size;
}
j = strlen(zDesc);
j = (int)strlen(zDesc);
zDesc += j;
nDesc += j;
}
@@ -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,17 +485,17 @@ 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);
j = strlen(zBuf);
j = (int)strlen(zBuf);
if( j<=n-2 ) memcpy(&zMap[cofst+1], zBuf, j);
}
printf(" %03x: cell[%d] %s\n", cofst, i, zDesc);