/ Check-in [f0f02d46]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix harmless compiler warnings from MSVC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:f0f02d46e40667d0fc31c57eb26d459ce2f3a3c222c767fa371100b36e5335d1
User & Date: drh 2019-03-20 12:08:27
Context
2019-03-20
16:58
Fix a potential dangling pointer deference in an ALTER TABLE run on a schema that contains constructs of the form "PRIMARY KEY(column COLLATE collation)". check-in: b9e2393c user: dan tags: trunk
16:03
Merge latest trunk changes into this branch. check-in: 4cd20ca6 user: dan tags: reuse-schema
12:08
Fix harmless compiler warnings from MSVC. check-in: f0f02d46 user: drh tags: trunk
11:16
Enhance the rtreenode() function of rtree (used for testing) so that it uses the newer sqlite3_str object for better performance and improved error reporting. Test cases added to TH3. check-in: 90acdbfc user: drh tags: trunk
05:45
Fix various harmless compiler warnings seen with MSVC. Closed-Leaf check-in: 1c0fe5b5 user: mistachkin tags: noWarnings
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_term.c.

    94     94   
    95     95     rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA);
    96     96     if( rc!=SQLITE_OK ) return rc;
    97     97   
    98     98     nByte = sizeof(Fts3termTable) + sizeof(Fts3Table) + nDb + nFts3 + 2;
    99     99     p = (Fts3termTable *)sqlite3_malloc64(nByte);
   100    100     if( !p ) return SQLITE_NOMEM;
   101         -  memset(p, 0, nByte);
          101  +  memset(p, 0, (size_t)nByte);
   102    102   
   103    103     p->pFts3Tab = (Fts3Table *)&p[1];
   104    104     p->pFts3Tab->zDb = (char *)&p->pFts3Tab[1];
   105    105     p->pFts3Tab->zName = &p->pFts3Tab->zDb[nDb+1];
   106    106     p->pFts3Tab->db = db;
   107    107     p->pFts3Tab->nIndex = iIndex+1;
   108    108     p->iIndex = iIndex;

Changes to ext/fts3/unicode/mkunicode.tcl.

   734    734       void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii){
   735    735         int i = 0;
   736    736         int iTbl = 0;
   737    737         while( i<128 ){
   738    738           int bToken = aArray[ aFts5UnicodeData[iTbl] & 0x1F ];
   739    739           int n = (aFts5UnicodeData[iTbl] >> 5) + i;
   740    740           for(; i<128 && i<n; i++){
   741         -          aAscii[i] = bToken;
          741  +          aAscii[i] = (u8)bToken;
   742    742           }
   743    743           iTbl++;
   744    744         }
   745    745       }
   746    746     }]
   747    747   }
   748    748   

Changes to ext/fts5/fts5_aux.c.

   349    349     }
   350    350   
   351    351     *pnScore = nScore;
   352    352     if( piPos ){
   353    353       sqlite3_int64 iAdj = iFirst - (nToken - (iLast-iFirst)) / 2;
   354    354       if( (iAdj+nToken)>nDocsize ) iAdj = nDocsize - nToken;
   355    355       if( iAdj<0 ) iAdj = 0;
   356         -    *piPos = iAdj;
          356  +    *piPos = (int)iAdj;
   357    357     }
   358    358   
   359    359     return rc;
   360    360   }
   361    361   
   362    362   /*
   363    363   ** Return the value in pVal interpreted as utf-8 text. Except, if pVal 
................................................................................
   577    577       /* Allocate the Fts5Bm25Data object */
   578    578       nPhrase = pApi->xPhraseCount(pFts);
   579    579       nByte = sizeof(Fts5Bm25Data) + nPhrase*2*sizeof(double);
   580    580       p = (Fts5Bm25Data*)sqlite3_malloc64(nByte);
   581    581       if( p==0 ){
   582    582         rc = SQLITE_NOMEM;
   583    583       }else{
   584         -      memset(p, 0, nByte);
          584  +      memset(p, 0, (size_t)nByte);
   585    585         p->nPhrase = nPhrase;
   586    586         p->aIDF = (double*)&p[1];
   587    587         p->aFreq = &p->aIDF[nPhrase];
   588    588       }
   589    589   
   590    590       /* Calculate the average document length for this FTS5 table */
   591    591       if( rc==SQLITE_OK ) rc = pApi->xRowCount(pFts, &nRow);

Changes to ext/fts5/fts5_buffer.c.

    23     23         nNew = nNew * 2;
    24     24       }
    25     25       pNew = sqlite3_realloc64(pBuf->p, nNew);
    26     26       if( pNew==0 ){
    27     27         *pRc = SQLITE_NOMEM;
    28     28         return 1;
    29     29       }else{
    30         -      pBuf->nSpace = nNew;
           30  +      pBuf->nSpace = (int)nNew;
    31     31         pBuf->p = pNew;
    32     32       }
    33     33     }
    34     34     return 0;
    35     35   }
    36     36   
    37     37   
................................................................................
   247    247   void *sqlite3Fts5MallocZero(int *pRc, sqlite3_int64 nByte){
   248    248     void *pRet = 0;
   249    249     if( *pRc==SQLITE_OK ){
   250    250       pRet = sqlite3_malloc64(nByte);
   251    251       if( pRet==0 ){
   252    252         if( nByte>0 ) *pRc = SQLITE_NOMEM;
   253    253       }else{
   254         -      memset(pRet, 0, nByte);
          254  +      memset(pRet, 0, (size_t)nByte);
   255    255       }
   256    256     }
   257    257     return pRet;
   258    258   }
   259    259   
   260    260   /*
   261    261   ** Return a nul-terminated copy of the string indicated by pIn. If nIn

Changes to ext/fts5/fts5_config.c.

   321    321             }
   322    322           }
   323    323           if( p==0 ){
   324    324             *pzErr = sqlite3_mprintf("parse error in tokenize directive");
   325    325             rc = SQLITE_ERROR;
   326    326           }else{
   327    327             rc = sqlite3Fts5GetTokenizer(pGlobal, 
   328         -              (const char**)azArg, nArg, &pConfig->pTok, &pConfig->pTokApi,
          328  +              (const char**)azArg, (int)nArg, &pConfig->pTok, &pConfig->pTokApi,
   329    329                 pzErr
   330    330             );
   331    331           }
   332    332         }
   333    333       }
   334    334   
   335    335       sqlite3_free(azArg);
................................................................................
   431    431     assert( *pRc==SQLITE_OK );
   432    432     *pbQuoted = 0;
   433    433     *pzOut = 0;
   434    434   
   435    435     if( zOut==0 ){
   436    436       *pRc = SQLITE_NOMEM;
   437    437     }else{
   438         -    memcpy(zOut, zIn, nIn+1);
          438  +    memcpy(zOut, zIn, (size_t)(nIn+1));
   439    439       if( fts5_isopenquote(zOut[0]) ){
   440    440         int ii = fts5Dequote(zOut);
   441    441         zRet = &zIn[ii];
   442    442         *pbQuoted = 1;
   443    443       }else{
   444    444         zRet = fts5ConfigSkipBareword(zIn);
   445    445         if( zRet ){

Changes to ext/fts5/fts5_expr.c.

  1483   1483       if( pNear==0 ){
  1484   1484         sqlite3_int64 nByte;
  1485   1485         nByte = sizeof(Fts5ExprNearset) + SZALLOC * sizeof(Fts5ExprPhrase*);
  1486   1486         pRet = sqlite3_malloc64(nByte);
  1487   1487         if( pRet==0 ){
  1488   1488           pParse->rc = SQLITE_NOMEM;
  1489   1489         }else{
  1490         -        memset(pRet, 0, nByte);
         1490  +        memset(pRet, 0, (size_t)nByte);
  1491   1491         }
  1492   1492       }else if( (pNear->nPhrase % SZALLOC)==0 ){
  1493   1493         int nNew = pNear->nPhrase + SZALLOC;
  1494   1494         sqlite3_int64 nByte;
  1495   1495   
  1496   1496         nByte = sizeof(Fts5ExprNearset) + nNew * sizeof(Fts5ExprPhrase*);
  1497   1497         pRet = (Fts5ExprNearset*)sqlite3_realloc64(pNear, nByte);
................................................................................
  1559   1559     if( pPhrase && pPhrase->nTerm>0 && (tflags & FTS5_TOKEN_COLOCATED) ){
  1560   1560       Fts5ExprTerm *pSyn;
  1561   1561       sqlite3_int64 nByte = sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer) + nToken+1;
  1562   1562       pSyn = (Fts5ExprTerm*)sqlite3_malloc64(nByte);
  1563   1563       if( pSyn==0 ){
  1564   1564         rc = SQLITE_NOMEM;
  1565   1565       }else{
  1566         -      memset(pSyn, 0, nByte);
         1566  +      memset(pSyn, 0, (size_t)nByte);
  1567   1567         pSyn->zTerm = ((char*)pSyn) + sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer);
  1568   1568         memcpy(pSyn->zTerm, pToken, nToken);
  1569   1569         pSyn->pSynonym = pPhrase->aTerm[pPhrase->nTerm-1].pSynonym;
  1570   1570         pPhrase->aTerm[pPhrase->nTerm-1].pSynonym = pSyn;
  1571   1571       }
  1572   1572     }else{
  1573   1573       Fts5ExprTerm *pTerm;
................................................................................
  1719   1719       Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset;
  1720   1720       if( pColsetOrig ){
  1721   1721         sqlite3_int64 nByte;
  1722   1722         Fts5Colset *pColset;
  1723   1723         nByte = sizeof(Fts5Colset) + (pColsetOrig->nCol-1) * sizeof(int);
  1724   1724         pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte);
  1725   1725         if( pColset ){ 
  1726         -        memcpy(pColset, pColsetOrig, nByte);
         1726  +        memcpy(pColset, pColsetOrig, (size_t)nByte);
  1727   1727         }
  1728   1728         pNew->pRoot->pNear->pColset = pColset;
  1729   1729       }
  1730   1730     }
  1731   1731   
  1732   1732     if( pOrig->nTerm ){
  1733   1733       int i;                          /* Used to iterate through phrase terms */
................................................................................
  1936   1936   */
  1937   1937   static Fts5Colset *fts5CloneColset(int *pRc, Fts5Colset *pOrig){
  1938   1938     Fts5Colset *pRet;
  1939   1939     if( pOrig ){
  1940   1940       sqlite3_int64 nByte = sizeof(Fts5Colset) + (pOrig->nCol-1) * sizeof(int);
  1941   1941       pRet = (Fts5Colset*)sqlite3Fts5MallocZero(pRc, nByte);
  1942   1942       if( pRet ){ 
  1943         -      memcpy(pRet, pOrig, nByte);
         1943  +      memcpy(pRet, pOrig, (size_t)nByte);
  1944   1944       }
  1945   1945     }else{
  1946   1946       pRet = 0;
  1947   1947     }
  1948   1948     return pRet;
  1949   1949   }
  1950   1950   

Changes to ext/fts5/fts5_hash.c.

    99     99       nByte = sizeof(Fts5HashEntry*) * pNew->nSlot;
   100    100       pNew->aSlot = (Fts5HashEntry**)sqlite3_malloc64(nByte);
   101    101       if( pNew->aSlot==0 ){
   102    102         sqlite3_free(pNew);
   103    103         *ppNew = 0;
   104    104         rc = SQLITE_NOMEM;
   105    105       }else{
   106         -      memset(pNew->aSlot, 0, nByte);
          106  +      memset(pNew->aSlot, 0, (size_t)nByte);
   107    107       }
   108    108     }
   109    109     return rc;
   110    110   }
   111    111   
   112    112   /*
   113    113   ** Free a hash table object.
................................................................................
   280    280         iHash = fts5HashKey2(pHash->nSlot, (u8)bByte, (const u8*)pToken, nToken);
   281    281       }
   282    282   
   283    283       /* Allocate new Fts5HashEntry and add it to the hash table. */
   284    284       p = (Fts5HashEntry*)sqlite3_malloc64(nByte);
   285    285       if( !p ) return SQLITE_NOMEM;
   286    286       memset(p, 0, sizeof(Fts5HashEntry));
   287         -    p->nAlloc = nByte;
          287  +    p->nAlloc = (int)nByte;
   288    288       zKey = fts5EntryKey(p);
   289    289       zKey[0] = bByte;
   290    290       memcpy(&zKey[1], pToken, nToken);
   291    291       assert( iHash==fts5HashKey(pHash->nSlot, (u8*)zKey, nToken+1) );
   292    292       p->nKey = nToken;
   293    293       zKey[nToken+1] = '\0';
   294    294       p->nData = nToken+1 + 1 + sizeof(Fts5HashEntry);

Changes to ext/fts5/fts5_main.c.

   629    629   
   630    630     rc = fts5NewTransaction(pTab);
   631    631     if( rc==SQLITE_OK ){
   632    632       nByte = sizeof(Fts5Cursor) + pConfig->nCol * sizeof(int);
   633    633       pCsr = (Fts5Cursor*)sqlite3_malloc64(nByte);
   634    634       if( pCsr ){
   635    635         Fts5Global *pGlobal = pTab->pGlobal;
   636         -      memset(pCsr, 0, nByte);
          636  +      memset(pCsr, 0, (size_t)nByte);
   637    637         pCsr->aColumnSize = (int*)&pCsr[1];
   638    638         pCsr->pNext = pGlobal->pCsr;
   639    639         pGlobal->pCsr = pCsr;
   640    640         pCsr->iCsrId = ++pGlobal->iNextId;
   641    641       }else{
   642    642         rc = SQLITE_NOMEM;
   643    643       }
................................................................................
   910    910     const char *zRank = pCsr->zRank;
   911    911     const char *zRankArgs = pCsr->zRankArgs;
   912    912     
   913    913     nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr);
   914    914     nByte = sizeof(Fts5Sorter) + sizeof(int) * (nPhrase-1);
   915    915     pSorter = (Fts5Sorter*)sqlite3_malloc64(nByte);
   916    916     if( pSorter==0 ) return SQLITE_NOMEM;
   917         -  memset(pSorter, 0, nByte);
          917  +  memset(pSorter, 0, (size_t)nByte);
   918    918     pSorter->nIdx = nPhrase;
   919    919   
   920    920     /* TODO: It would be better to have some system for reusing statement
   921    921     ** handles here, rather than preparing a new one for each query. But that
   922    922     ** is not possible as SQLite reference counts the virtual table objects.
   923    923     ** And since the statement required here reads from this very virtual 
   924    924     ** table, saving it creates a circular reference.

Changes to ext/fts5/fts5_storage.c.

   285    285     sqlite3_int64 nByte;            /* Bytes of space to allocate */
   286    286   
   287    287     nByte = sizeof(Fts5Storage)               /* Fts5Storage object */
   288    288           + pConfig->nCol * sizeof(i64);      /* Fts5Storage.aTotalSize[] */
   289    289     *pp = p = (Fts5Storage*)sqlite3_malloc64(nByte);
   290    290     if( !p ) return SQLITE_NOMEM;
   291    291   
   292         -  memset(p, 0, nByte);
          292  +  memset(p, 0, (size_t)nByte);
   293    293     p->aTotalSize = (i64*)&p[1];
   294    294     p->pConfig = pConfig;
   295    295     p->pIndex = pIndex;
   296    296   
   297    297     if( bCreate ){
   298    298       if( pConfig->eContent==FTS5_CONTENT_NORMAL ){
   299    299         int nDefn = 32 + pConfig->nCol*10;

Changes to ext/fts5/fts5_unicode2.c.

   765    765   void sqlite3Fts5UnicodeAscii(u8 *aArray, u8 *aAscii){
   766    766     int i = 0;
   767    767     int iTbl = 0;
   768    768     while( i<128 ){
   769    769       int bToken = aArray[ aFts5UnicodeData[iTbl] & 0x1F ];
   770    770       int n = (aFts5UnicodeData[iTbl] >> 5) + i;
   771    771       for(; i<128 && i<n; i++){
   772         -      aAscii[i] = bToken;
          772  +      aAscii[i] = (u8)bToken;
   773    773       }
   774    774       iTbl++;
   775    775     }
   776    776   }

Changes to ext/misc/amatch.c.

   743    743   
   744    744     nIn = strlen(zIn);
   745    745     zOut = sqlite3_malloc64(nIn+1);
   746    746     if( zOut ){
   747    747       char q = zIn[0];              /* Quote character (if any ) */
   748    748   
   749    749       if( q!='[' && q!= '\'' && q!='"' && q!='`' ){
   750         -      memcpy(zOut, zIn, nIn+1);
          750  +      memcpy(zOut, zIn, (size_t)(nIn+1));
   751    751       }else{
   752    752         int iOut = 0;               /* Index of next byte to write to output */
   753    753         int iIn;                    /* Index of next byte to read from input */
   754    754   
   755    755         if( q=='[' ) q = ']';
   756    756         for(iIn=1; iIn<nIn; iIn++){
   757    757           if( zIn[iIn]==q ) iIn++;

Changes to ext/misc/closure.c.

   427    427   
   428    428     nIn = strlen(zIn);
   429    429     zOut = sqlite3_malloc64(nIn+1);
   430    430     if( zOut ){
   431    431       char q = zIn[0];              /* Quote character (if any ) */
   432    432   
   433    433       if( q!='[' && q!= '\'' && q!='"' && q!='`' ){
   434         -      memcpy(zOut, zIn, nIn+1);
          434  +      memcpy(zOut, zIn, (size_t)(nIn+1));
   435    435       }else{
   436    436         int iOut = 0;               /* Index of next byte to write to output */
   437    437         int iIn;                    /* Index of next byte to read from input */
   438    438   
   439    439         if( q=='[' ) q = ']';
   440    440         for(iIn=1; iIn<nIn; iIn++){
   441    441           if( zIn[iIn]==q ) iIn++;

Changes to ext/misc/fileio.c.

   154    154     }
   155    155     pBuf = sqlite3_malloc64( nIn ? nIn : 1 );
   156    156     if( pBuf==0 ){
   157    157       sqlite3_result_error_nomem(ctx);
   158    158       fclose(in);
   159    159       return;
   160    160     }
   161         -  if( nIn==fread(pBuf, 1, nIn, in) ){
          161  +  if( nIn==fread(pBuf, 1, (size_t)nIn, in) ){
   162    162       sqlite3_result_blob64(ctx, pBuf, nIn, sqlite3_free);
   163    163     }else{
   164    164       sqlite3_result_error_code(ctx, SQLITE_IOERR);
   165    165       sqlite3_free(pBuf);
   166    166     }
   167    167     fclose(in);
   168    168   }

Changes to ext/misc/fuzzer.c.

   452    452   
   453    453     nIn = strlen(zIn);
   454    454     zOut = sqlite3_malloc64(nIn+1);
   455    455     if( zOut ){
   456    456       char q = zIn[0];              /* Quote character (if any ) */
   457    457   
   458    458       if( q!='[' && q!= '\'' && q!='"' && q!='`' ){
   459         -      memcpy(zOut, zIn, nIn+1);
          459  +      memcpy(zOut, zIn, (size_t)(nIn+1));
   460    460       }else{
   461    461         int iOut = 0;               /* Index of next byte to write to output */
   462    462         int iIn;                    /* Index of next byte to read from input */
   463    463   
   464    464         if( q=='[' ) q = ']';
   465    465         for(iIn=1; iIn<nIn; iIn++){
   466    466           if( zIn[iIn]==q ) iIn++;
................................................................................
   520    520       if( pNew==0 ){
   521    521         rc = SQLITE_NOMEM;
   522    522       }else{
   523    523         char *zTab;                 /* Dequoted name of fuzzer data table */
   524    524   
   525    525         memset(pNew, 0, sizeof(*pNew));
   526    526         pNew->zClassName = (char*)&pNew[1];
   527         -      memcpy(pNew->zClassName, zModule, nModule+1);
          527  +      memcpy(pNew->zClassName, zModule, (size_t)(nModule+1));
   528    528   
   529    529         zTab = fuzzerDequote(argv[3]);
   530    530         if( zTab==0 ){
   531    531           rc = SQLITE_NOMEM;
   532    532         }else{
   533    533           rc = fuzzerLoadRules(db, pNew, zDb, zTab, pzErr);
   534    534           sqlite3_free(zTab);

Changes to ext/misc/unionvtab.c.

   252    252   */
   253    253   static void *unionMalloc(int *pRc, sqlite3_int64 nByte){
   254    254     void *pRet;
   255    255     assert( nByte>0 );
   256    256     if( *pRc==SQLITE_OK ){
   257    257       pRet = sqlite3_malloc64(nByte);
   258    258       if( pRet ){
   259         -      memset(pRet, 0, nByte);
          259  +      memset(pRet, 0, (size_t)nByte);
   260    260       }else{
   261    261         *pRc = SQLITE_NOMEM;
   262    262       }
   263    263     }else{
   264    264       pRet = 0;
   265    265     }
   266    266     return pRet;
................................................................................
   275    275   */
   276    276   static char *unionStrdup(int *pRc, const char *zIn){
   277    277     char *zRet = 0;
   278    278     if( zIn ){
   279    279       sqlite3_int64 nByte = strlen(zIn) + 1;
   280    280       zRet = unionMalloc(pRc, nByte);
   281    281       if( zRet ){
   282         -      memcpy(zRet, zIn, nByte);
          282  +      memcpy(zRet, zIn, (size_t)nByte);
   283    283       }
   284    284     }
   285    285     return zRet;
   286    286   }
   287    287   
   288    288   /*
   289    289   ** If the first character of the string passed as the only argument to this

Changes to ext/session/changeset.c.

    51     51     }
    52     52     fseek(f, 0, SEEK_END);
    53     53     sz = ftell(f);
    54     54     rewind(f);
    55     55     pBuf = sqlite3_malloc64( sz ? sz : 1 );
    56     56     if( pBuf==0 ){
    57     57       fprintf(stderr, "cannot allocate %d to hold content of \"%s\"\n",
    58         -            sz, zFilename);
           58  +            (int)sz, zFilename);
    59     59       exit(1);
    60     60     }
    61     61     if( sz>0 ){
    62         -    if( fread(pBuf, sz, 1, f)!=1 ){
    63         -      fprintf(stderr, "cannot read all %d bytes of \"%s\"\n", sz, zFilename);
           62  +    if( fread(pBuf, (size_t)sz, 1, f)!=1 ){
           63  +      fprintf(stderr, "cannot read all %d bytes of \"%s\"\n",
           64  +              (int)sz, zFilename);
    64     65         exit(1);
    65     66       }
    66     67       fclose(f);
    67     68     }
    68         -  *pSz = sz;
           69  +  *pSz = (int)sz;
    69     70     *ppBuf = pBuf;
    70     71   }
    71     72   
    72     73   /* Array for converting from half-bytes (nybbles) into ASCII hex
    73     74   ** digits. */
    74     75   static const char hexdigits[] = {
    75     76     '0', '1', '2', '3', '4', '5', '6', '7',

Changes to src/btree.c.

  2009   2009     }
  2010   2010     testcase( pPage->nCell==MX_CELL(pBt) );
  2011   2011     /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
  2012   2012     ** possible for a root page of a table that contains no rows) then the
  2013   2013     ** offset to the cell content area will equal the page size minus the
  2014   2014     ** bytes of reserved space. */
  2015   2015     assert( pPage->nCell>0
  2016         -       || get2byteNotZero(&data[5])==pBt->usableSize
         2016  +       || get2byteNotZero(&data[5])==(int)pBt->usableSize
  2017   2017          || CORRUPT_DB );
  2018   2018     pPage->nFree = -1;  /* Indicate that this value is yet uncomputed */
  2019   2019     pPage->isInit = 1;
  2020   2020     if( pBt->db->flags & SQLITE_CellSizeCk ){
  2021   2021       return btreeCellSizeCheck(pPage);
  2022   2022     }
  2023   2023     return SQLITE_OK;

Changes to test/fuzzcheck.c.

   527    527     if( nIn<4 ) return -1;
   528    528     n = (unsigned int)nIn;
   529    529     a = sqlite3_malloc64( nAlloc );
   530    530     if( a==0 ){
   531    531       fprintf(stderr, "Out of memory!\n");
   532    532       exit(1);
   533    533     }
   534         -  memset(a, 0, nAlloc);
          534  +  memset(a, 0, (size_t)nAlloc);
   535    535     for(i=k=0; i<n; i++){
   536    536       unsigned char c = (unsigned char)zIn[i];
   537    537       if( isxdigit(c) ){
   538    538         k++;
   539    539         if( k & 1 ){
   540    540           b = hexToInt(c)*16;
   541    541         }else{
................................................................................
   564    564             }
   565    565             a = sqlite3_realloc64( a, newSize );
   566    566             if( a==0 ){
   567    567               fprintf(stderr, "Out of memory!\n");
   568    568               exit(1);
   569    569             }
   570    570             assert( newSize > nAlloc );
   571         -          memset(a+nAlloc, 0, newSize - nAlloc);
          571  +          memset(a+nAlloc, 0, (size_t)(newSize - nAlloc));
   572    572             nAlloc = newSize;
   573    573           }
   574    574           if( j>=(unsigned)mx ){
   575    575             mx = (j + 4095)&~4095;
   576    576             if( mx>MX_FILE_SZ ) mx = MX_FILE_SZ;
   577    577           }
   578    578           assert( j<nAlloc );