SQLite

Check-in [500c50561f]
Login

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

Overview
Comment:Check for failures in winTruncate. Ticket #3415. (CVS 5811)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 500c50561fba88948aad21d1aef1e1e96ab8c3aa
User & Date: shane 2008-10-12 02:27:39.000
Context
2008-10-13
10:37
If sqlite3_column_value() is called to obtain a value with the MEM_Static flag set, clear it and set the MEM_Ephem flag before returning. Otherwise, if the value is passed to sqlite3_bind_value() or sqlite3_result_value(), sqlite may attempt to use the buffer after the statement has been finalized. This is not always valid, as MEM_Static only guarantees that a MEM.z buffer will be valid for the lifetime of the owner statement, not that it is actually a static buffer. (CVS 5812) (check-in: b055bfc4e5 user: danielk1977 tags: trunk)
2008-10-12
02:27
Check for failures in winTruncate. Ticket #3415. (CVS 5811) (check-in: 500c50561f user: shane tags: trunk)
02:03
Added -DSQLITE_ENABLE_RTREE=1 to the mkdll.sh script. Ticket #3427. (CVS 5810) (check-in: 66f57ecb16 user: shane tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_win.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to windows.
**
** $Id: os_win.c,v 1.134 2008/09/30 04:20:08 shane Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN               /* This file is used for windows only */


/*
** A Note About Memory Allocation:







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to windows.
**
** $Id: os_win.c,v 1.135 2008/10/12 02:27:39 shane Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN               /* This file is used for windows only */


/*
** A Note About Memory Allocation:
709
710
711
712
713
714
715

716
717
718
719
720
721


722
723



724
725
726
727
728
729
730
  return SQLITE_OK;
}

/*
** Truncate an open file to a specified size
*/
static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){

  LONG upperBits = (nByte>>32) & 0x7fffffff;
  LONG lowerBits = nByte & 0xffffffff;
  winFile *pFile = (winFile*)id;
  OSTRACE3("TRUNCATE %d %lld\n", pFile->h, nByte);
  SimulateIOError(return SQLITE_IOERR_TRUNCATE);
  SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);


  SetEndOfFile(pFile->h);
  return SQLITE_OK;



}

#ifdef SQLITE_TEST
/*
** Count the number of fullsyncs and normal syncs.  This is used to test
** that syncs and fullsyncs are occuring at the right times.
*/







>





|
>
>
|
|
>
>
>







709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
  return SQLITE_OK;
}

/*
** Truncate an open file to a specified size
*/
static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
  DWORD rc;
  LONG upperBits = (nByte>>32) & 0x7fffffff;
  LONG lowerBits = nByte & 0xffffffff;
  winFile *pFile = (winFile*)id;
  OSTRACE3("TRUNCATE %d %lld\n", pFile->h, nByte);
  SimulateIOError(return SQLITE_IOERR_TRUNCATE);
  rc = SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
  if( INVALID_SET_FILE_POINTER != rc ){
    /* SetEndOfFile will fail if nByte is negative */
    if( SetEndOfFile(pFile->h) ){
      return SQLITE_OK;
    }
  }
  return SQLITE_IOERR_TRUNCATE;
}

#ifdef SQLITE_TEST
/*
** Count the number of fullsyncs and normal syncs.  This is used to test
** that syncs and fullsyncs are occuring at the right times.
*/