/ Check-in [cb808c14]
Login

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

Overview
Comment:Explicit casts to squelch bogus warnings for vc++. Ticket #194. (CVS 932)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cb808c14bc14e7bd1cfff134ae5206ace451f2df
User & Date: drh 2003-04-25 03:13:25
Context
2003-04-25
13:22
Make VACUUM work even if multiple processes have the database open at once. (CVS 933) check-in: caa96028 user: drh tags: trunk
03:13
Explicit casts to squelch bogus warnings for vc++. Ticket #194. (CVS 932) check-in: cb808c14 user: drh tags: trunk
02:43
Get VACUUM working again - with test cases. Some other minor cleanups. (CVS 931) check-in: 5afb8800 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.89 2003/04/16 01:28:16 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
................................................................................
/*
** Macros used for byteswapping.  B is a pointer to the Btree
** structure.  This is needed to access the Btree.needSwab boolean
** in order to tell if byte swapping is needed or not.
** X is an unsigned integer.  SWAB16 byte swaps a 16-bit integer.
** SWAB32 byteswaps a 32-bit integer.
*/
#define SWAB16(B,X)   ((B)->needSwab? swab16(X) : (X))
#define SWAB32(B,X)   ((B)->needSwab? swab32(X) : (X))
#define SWAB_ADD(B,X,A) \
   if((B)->needSwab){ X=swab32(swab32(X)+A); }else{ X += (A); }

/*
** The following global variable - available only if SQLITE_TEST is
** defined - is used to determine whether new databases are created in
................................................................................
    pFBlk = (FreeBlk*)&pPage->u.aDisk[idx];
    iSize = SWAB16(pBt, pFBlk->iSize);
    if( idx + iSize == start ){
      pFBlk->iSize = SWAB16(pBt, iSize + size);
      if( idx + iSize + size == SWAB16(pBt, pFBlk->iNext) ){
        pNext = (FreeBlk*)&pPage->u.aDisk[idx + iSize + size];
        if( pBt->needSwab ){
          pFBlk->iSize = swab16(swab16(pNext->iSize)+iSize+size);
        }else{
          pFBlk->iSize += pNext->iSize;
        }
        pFBlk->iNext = pNext->iNext;
      }
      pPage->nFree += size;
      return;







|







 







|







 







|







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.90 2003/04/25 03:13:25 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
................................................................................
/*
** Macros used for byteswapping.  B is a pointer to the Btree
** structure.  This is needed to access the Btree.needSwab boolean
** in order to tell if byte swapping is needed or not.
** X is an unsigned integer.  SWAB16 byte swaps a 16-bit integer.
** SWAB32 byteswaps a 32-bit integer.
*/
#define SWAB16(B,X)   ((B)->needSwab? swab16((u16)X) : ((u16)X))
#define SWAB32(B,X)   ((B)->needSwab? swab32(X) : (X))
#define SWAB_ADD(B,X,A) \
   if((B)->needSwab){ X=swab32(swab32(X)+A); }else{ X += (A); }

/*
** The following global variable - available only if SQLITE_TEST is
** defined - is used to determine whether new databases are created in
................................................................................
    pFBlk = (FreeBlk*)&pPage->u.aDisk[idx];
    iSize = SWAB16(pBt, pFBlk->iSize);
    if( idx + iSize == start ){
      pFBlk->iSize = SWAB16(pBt, iSize + size);
      if( idx + iSize + size == SWAB16(pBt, pFBlk->iNext) ){
        pNext = (FreeBlk*)&pPage->u.aDisk[idx + iSize + size];
        if( pBt->needSwab ){
          pFBlk->iSize = swab16((u16)swab16(pNext->iSize)+iSize+size);
        }else{
          pFBlk->iSize += pNext->iSize;
        }
        pFBlk->iNext = pNext->iNext;
      }
      pPage->nFree += size;
      return;