1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Fix harmless compiler warnings for MSVC in the showdb/showwal command line tools.

FossilOrigin-Name: 6dc7b2f119eb92da17c9e914bdad30a9ceaebdb5
This commit is contained in:
mistachkin
2014-07-18 21:16:37 +00:00
parent 3a046c6c31
commit 0461cc4795
4 changed files with 57 additions and 45 deletions

View 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 ){