persistentstorage/sqlite3api/OsLayer/FileBuf64.cpp
branchRCL_3
changeset 45 cc28652e0254
parent 44 26645d81f48d
equal deleted inserted replaced
44:26645d81f48d 45:cc28652e0254
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 #include "FileBuf64.h"
    15 #include "FileBuf64.h"
    16 #include "OstTraceDefinitions.h"
       
    17 #ifdef OST_TRACE_COMPILER_IN_USE
       
    18 #include "FileBuf64Traces.h"
       
    19 #endif
       
    20 #include "SqliteTraceDef.h"
       
    21 
    16 
    22 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    17 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       
    18 ///////////////////////////        PROFILER       ////////////////////////////////////////////////////////////////////
       
    19 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       
    20 
       
    21 #ifdef _SQLPROFILER
       
    22 
       
    23 #define PROFILE_READ(pos,amount) \
       
    24 	do \
       
    25 		{ \
       
    26 		++iFileReadCount; iFileReadAmount += (amount); \
       
    27         RDebug::Print(_L(" -- FRead    this=%X, Cnt=%d, Pos=%ld, Amt=%d, Ttl=%ld\r\n"), (TUint32)this, iFileReadCount,  pos, amount, iFileReadAmount); \
       
    28 		} while(0)
       
    29 	
       
    30 #define PROFILE_WRITE(pos,amount) \
       
    31 	do \
       
    32 		{ \
       
    33 		++iFileWriteCount; iFileWriteAmount += (amount); \
       
    34 		RDebug::Print(_L(" -- FWrite   this=%X, Cnt=%d, Pos=%ld, Amt=%d, Ttl=%ld\r\n"), (TUint32)this, iFileWriteCount, pos, amount, iFileWriteAmount); \
       
    35 		} while(0)
       
    36 
       
    37 #define PROFILE_SIZE() \
       
    38 	do \
       
    39 		{ \
       
    40 		++iFileSizeCount; \
       
    41 		RDebug::Print(_L(" -- FSize    this=%X, Cnt=%d\r\n"), (TUint32)this, iFileSizeCount); \
       
    42 		} while(0)
       
    43 
       
    44 #define PROFILE_SETSIZE() \
       
    45 	do \
       
    46 		{ \
       
    47 		++iFileSetSizeCount; \
       
    48 		RDebug::Print(_L(" -- FSetSize this=%X, Cnt=%d\r\n"), (TUint32)this, iFileSetSizeCount); \
       
    49 		} while(0)
       
    50 
       
    51 #define PROFILE_FLUSH()	\
       
    52 	do \
       
    53 		{ \
       
    54 		++iFileFlushCount; \
       
    55 		RDebug::Print(_L(" -- FFlush   this=%X, Cnt=%d\r\n"), (TUint32)this, iFileFlushCount); \
       
    56 		} while(0)
       
    57 
       
    58 #else
       
    59 
       
    60 #define PROFILE_READ(pos,amount)	void(0)
       
    61 #define PROFILE_WRITE(pos,amount)	void(0)
       
    62 
       
    63 #define PROFILE_SIZE()			void(0)
       
    64 #define PROFILE_SETSIZE()		void(0)
       
    65 #define PROFILE_FLUSH()			void(0)
       
    66 
       
    67 #endif//_SQLPROFILER
    23 
    68 
    24 /**
    69 /**
    25 This constant is used for initializing the RFileBuf64::iFileSize data member and means that
    70 This constant is used for initializing the RFileBuf64::iFileSize data member and means that
    26 the iFileSize is not yet initialized with the real file size value. 
    71 the iFileSize is not yet initialized with the real file size value. 
    27 (RFileBuf64::iFileSize caches the file size value)
    72 (RFileBuf64::iFileSize caches the file size value)
    35 @internalComponent
    80 @internalComponent
    36 */
    81 */
    37 static const TInt KNextReadFilePosNotSet = -1;
    82 static const TInt KNextReadFilePosNotSet = -1;
    38 
    83 
    39 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    84 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    40 ///////////////////////////        FBUF INVARIANT      ///////////////////////////////////////////////////////////////
    85 ///////////////////////////        ASSERTS & INVARIANT      //////////////////////////////////////////////////////////
    41 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    86 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    42 
    87 
    43 #ifdef _DEBUG
    88 #ifdef _DEBUG
    44 
    89 
    45 #define __FILEBUF64_INVARIANT() Invariant()
    90 #define __FILEBUF64_INVARIANT() Invariant()
    46 
    91 
       
    92 /**
       
    93 String literal used in _DEBUG mode for indicating that the reported panic happened inside the RFileBuf64 implementation.
       
    94 
       
    95 @see TFileBufPanic64
       
    96 @internalComponent
       
    97 */
       
    98 _LIT(KPanicCategory, "FBuf64");
       
    99 
       
   100 /**
       
   101 Set of numeric constants used together with the KPanicCategory string literal in _DEBUG mode for providing more detailed
       
   102 information about the reason of the panic.
       
   103 
       
   104 @see KPanicCategory
       
   105 @internalComponent
       
   106 */
       
   107 enum TFileBufPanic64
       
   108 	{
       
   109 	EFBufPanicCapacity = 1,				//1
       
   110 	EFBufPanicNullBuf,
       
   111 	EFBufPanicBufLen,
       
   112 	EFBufPanicFilePos,
       
   113 	EFBufPanicFileSize,					//5
       
   114 	EFBufPanicFileHandle,
       
   115 	EFBufPanicFsHandle,
       
   116 	EFBufPanicMsgHandle,
       
   117 	EFBufPanicMsgIndex,
       
   118 	EFBufPanicFileNameLen,				//10
       
   119 	EFBufPanicNullThis,
       
   120 	EFBufPanicDirty,
       
   121 	EFBufPanicNextReadFilePos,
       
   122 	EFBufPanicNextReadFilePosHits,
       
   123 	EFBufPanicFileBlockSize,			//15
       
   124 	};
       
   125 
       
   126 /**
       
   127 Helper function used in the implementation of the __FBUF64_ASSERT() macro.
       
   128 In case if the expression in __FBUF64_ASSERT() macro evaluates to false, 
       
   129 PanicFileBuf64() will use the supplied aLine and aPanicCode arguments together with the KPanicCategory string literal
       
   130 to prepare and print out a line (including the time of the panic) to the default log. The calling thread will be panic'ed
       
   131 after that.
       
   132 
       
   133 @see TFileBufPanic64
       
   134 @see KPanicCategory
       
   135 @internalComponent
       
   136 */
       
   137 static void PanicFileBuf64(TInt aLine, TFileBufPanic64 aPanicCode)
       
   138 	{
       
   139 	TTime time;
       
   140 	time.HomeTime();
       
   141 	TDateTime dt = time.DateTime();
       
   142 	TBuf<16> tbuf;
       
   143 	tbuf.Format(_L("%02d:%02d:%02d.%06d"), dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond());
       
   144 	
       
   145 	TBuf<64> buf;
       
   146 	_LIT(KFormat,"**%S:RFileBuf64 panic %d, at line(%d)");
       
   147 	buf.Format(KFormat, &tbuf, aPanicCode, aLine);
       
   148 	RDebug::Print(buf);
       
   149 	User::Panic(KPanicCategory, aPanicCode);
       
   150 	}
       
   151 
       
   152 /**
       
   153 This macro should be used when there is a need to panic the client/server if "expr" condition is not satisfied.
       
   154 Works in only in debug mode. In release mode evaluates to nothing.
       
   155 
       
   156 @see TFileBufPanic64
       
   157 @see KPanicCategory
       
   158 @see PanicFileBuf64()
       
   159 @internalComponent
       
   160 */
       
   161 #define __FBUF64_ASSERT(expr, panicCode)	(void)(!(expr) ? ::PanicFileBuf64(__LINE__, panicCode) : void(0))
       
   162 
    47 #else //_DEBUG
   163 #else //_DEBUG
    48 
   164 
    49 #define __FILEBUF64_INVARIANT() void(0)
   165 #define __FILEBUF64_INVARIANT() void(0)
       
   166 
       
   167 #define __FBUF64_ASSERT(expr, panicCode) 	void(0)
    50 
   168 
    51 #endif//_DEBUG
   169 #endif//_DEBUG
    52 
   170 
    53 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   171 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    54 ///////////////////////////        RFileBuf64    /////////////////////////////////////////////////////////////////////
   172 ///////////////////////////        RFileBuf64    /////////////////////////////////////////////////////////////////////
    57 /**
   175 /**
    58 Initializes RFileBuf64 data members with their default values.
   176 Initializes RFileBuf64 data members with their default values.
    59 
   177 
    60 @param aSize Max file buffer size (capacity) in bytes.
   178 @param aSize Max file buffer size (capacity) in bytes.
    61 
   179 
    62 @panic Sqlite3 1 In _DEBUG mode - aSize is 0 or negative.
   180 @panic FBuf64 1 In _DEBUG mode - aSize is 0 or negative.
    63 */
   181 */
    64 RFileBuf64::RFileBuf64(TInt aSize) :
   182 RFileBuf64::RFileBuf64(TInt aSize) :
    65 	iCapacity(aSize),
   183 	iCapacity(aSize),
    66 	iBase(NULL),
       
    67 	iReadAheadSize(RFileBuf64::KDefaultReadAheadSize)
   184 	iReadAheadSize(RFileBuf64::KDefaultReadAheadSize)
    68 	{
   185 	{
    69 	SQLITE_TRACE_FBUF(OstTraceExt3(TRACE_INTERNALS, RFILEBUF64_RFILEBUF64, "FBuf;0x%X;RFileBuf64::RFileBuf64;aSize=%d;iReadAheadSize=%d", (TUint)this, aSize, iReadAheadSize));
   186 	__FBUF64_ASSERT(aSize > 0, EFBufPanicCapacity);
    70 	__ASSERT_DEBUG(aSize > 0, __SQLITEPANIC(EFBufPanicCapacity));
       
    71 	}
   187 	}
    72 
   188 
    73 /**
   189 /**
    74 Initializes the RFileBuf64 object and creates and opens a new file that will be accessed through RFileBuf64 public interface.
   190 Initializes the RFileBuf64 object and creates and opens a new file that will be accessed through RFileBuf64 public interface.
    75 If the file already exists, an error is returned.
   191 If the file already exists, an error is returned.
    84 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   200 @return KErrNone if successful, otherwise one of the other system-wide error codes.
    85 
   201 
    86 @see TFileMode
   202 @see TFileMode
    87 @see RFile64::Create()
   203 @see RFile64::Create()
    88 
   204 
    89 @panic Sqlite3  7 In _DEBUG mode - Invalid aFs object (null file session handle).
   205 @panic FBuf64  7 In _DEBUG mode - Invalid aFs object (null file session handle).
    90 @panic Sqlite3 10 In _DEBUG mode - Invalid file name length (zero file name length).
   206 @panic FBuf64 10 In _DEBUG mode - Invalid file name length (zero file name length).
    91 */
   207 */
    92 TInt RFileBuf64::Create(RFs& aFs, const TDesC& aFileName, TUint aFileMode)
   208 TInt RFileBuf64::Create(RFs& aFs, const TDesC& aFileName, TUint aFileMode)
    93 	{
   209 	{
    94 	__ASSERT_DEBUG(aFs.Handle() != 0, __SQLITEPANIC(EFBufPanicFsHandle));
   210 	__FBUF64_ASSERT(aFs.Handle() != 0, EFBufPanicFsHandle);
    95 	__ASSERT_DEBUG(aFileName.Length() > 0, __SQLITEPANIC(EFBufPanicFileNameLen));
   211 	__FBUF64_ASSERT(aFileName.Length() > 0, EFBufPanicFileNameLen);
    96 	
   212 	
    97 	TInt err = DoPreInit();
   213     TInt err = DoPreInit();
    98 	if(err == KErrNone)
   214     if(err == KErrNone)
    99 	    {
   215         {
   100 	    err = iFile.Create(aFs, aFileName, aFileMode);
   216         err = iFile.Create(aFs, aFileName, aFileMode);
   101 	    }
   217         }
   102 	SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_CREATE, "FBuf;0x%X;RFileBuf64::Create;aFs.Handle()=0x%X;aFileName=%S;iFile.SubSessionHandle()=0x%X;err=%d", (TUint)this, (TUint)aFs.Handle(), __SQLITEPRNSTR(aFileName), (TUint)iFile.SubSessionHandle(), err));
   218     return DoPostInit(err);
   103 	DoPostInit(err);
       
   104 	return err;
       
   105 	}
   219 	}
   106 
   220 
   107 /**
   221 /**
   108 Initializes the RFileBuf64 object and opens an existing file that will be accessed through RFileBuf64 public interface.
   222 Initializes the RFileBuf64 object and opens an existing file that will be accessed through RFileBuf64 public interface.
   109 If the file does not already exist, an error is returned.
   223 If the file does not already exist, an error is returned.
   117 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   231 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   118 
   232 
   119 @see TFileMode
   233 @see TFileMode
   120 @see RFile64::Open()
   234 @see RFile64::Open()
   121 
   235 
   122 @panic Sqlite3  7 In _DEBUG mode - Invalid aFs object (null file session handle).
   236 @panic FBuf64  7 In _DEBUG mode - Invalid aFs object (null file session handle).
   123 @panic Sqlite3 10 In _DEBUG mode - Invalid file name length (zero file name length).
   237 @panic FBuf64 10 In _DEBUG mode - Invalid file name length (zero file name length).
   124 */
   238 */
   125 TInt RFileBuf64::Open(RFs& aFs, const TDesC& aFileName, TUint aFileMode)
   239 TInt RFileBuf64::Open(RFs& aFs, const TDesC& aFileName, TUint aFileMode)
   126 	{
   240 	{
   127 	__ASSERT_DEBUG(aFs.Handle() != 0, __SQLITEPANIC(EFBufPanicFsHandle));
   241 	__FBUF64_ASSERT(aFs.Handle() != 0, EFBufPanicFsHandle);
   128 	__ASSERT_DEBUG(aFileName.Length() > 0, __SQLITEPANIC(EFBufPanicFileNameLen));
   242 	__FBUF64_ASSERT(aFileName.Length() > 0, EFBufPanicFileNameLen);
   129 	
   243     
   130     TInt err = DoPreInit();
   244     TInt err = DoPreInit();
   131     if(err == KErrNone)
   245     if(err == KErrNone)
   132         {
   246         {
   133         err = iFile.Open(aFs, aFileName, aFileMode);
   247         err = iFile.Open(aFs, aFileName, aFileMode);
   134         }
   248         }
   135 	SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_OPEN, "FBuf;0x%X;RFileBuf64::Open;aFs.Handle()=0x%X;aFileName=%S;iFile.SubSessionHandle()=0x%X;err=%d", (TUint)this, (TUint)aFs.Handle(), __SQLITEPRNSTR(aFileName), (TUint)iFile.SubSessionHandle(), err));
   249     return DoPostInit(err);
   136     DoPostInit(err);
       
   137 	return err;
       
   138 	}
   250 	}
   139 
   251 
   140 /**
   252 /**
   141 Initializes the RFileBuf64 object and creates and opens a temporary file with unique name that will be accessed through 
   253 Initializes the RFileBuf64 object and creates and opens a temporary file with unique name that will be accessed through 
   142 RFileBuf64 public interface.
   254 RFileBuf64 public interface.
   152 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   264 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   153 
   265 
   154 @see TFileMode
   266 @see TFileMode
   155 @see RFile64::Temp()
   267 @see RFile64::Temp()
   156 
   268 
   157 @panic Sqlite3  7 In _DEBUG mode - Invalid aFs object (null file session handle).
   269 @panic FBuf64  7 In _DEBUG mode - Invalid aFs object (null file session handle).
   158 */
   270 */
   159 TInt RFileBuf64::Temp(RFs& aFs, const TDesC& aPath, TFileName& aFileName, TUint aFileMode)
   271 TInt RFileBuf64::Temp(RFs& aFs, const TDesC& aPath, TFileName& aFileName, TUint aFileMode)
   160 	{
   272 	{
   161 	__ASSERT_DEBUG(aFs.Handle() != 0, __SQLITEPANIC(EFBufPanicFsHandle));
   273 	__FBUF64_ASSERT(aFs.Handle() != 0, EFBufPanicFsHandle);
   162 	
   274     
   163     TInt err = DoPreInit();
   275     TInt err = DoPreInit();
   164     if(err == KErrNone)
   276     if(err == KErrNone)
   165         {
   277         {
   166         err = iFile.Temp(aFs, aPath, aFileName, aFileMode);
   278         err = iFile.Temp(aFs, aPath, aFileName, aFileMode);
   167         }
   279         }
   168 	SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_TEMP, "FBuf;0x%X;RFileBuf64::Temp;aFs.Handle()=0x%X;aFileName=%S;iFile.SubSessionHandle()=0x%X;err=%d", (TUint)this, (TUint)aFs.Handle(), __SQLITEPRNSTR(aFileName), (TUint)iFile.SubSessionHandle(), err));
   280     return DoPostInit(err);
   169     DoPostInit(err);
       
   170 	return err;
       
   171 	}
   281 	}
   172 
   282 
   173 /**
   283 /**
   174 Writes to the file the pending data (if the buffer contains pending data), closes the file and releases
   284 Writes to the file the pending data (if the buffer contains pending data), closes the file and releases
   175 the RFileBuf64 resources. 
   285 the RFileBuf64 resources. 
   178 
   288 
   179 @see RFileBuf64::Flush()
   289 @see RFileBuf64::Flush()
   180 */
   290 */
   181 void RFileBuf64::Close()
   291 void RFileBuf64::Close()
   182 	{
   292 	{
   183 	SQLITE_TRACE_FBUF(OstTraceExt2(TRACE_INTERNALS, RFILEBUF64_CLOSE, "FBuf;0x%X;RFileBuf64::Close;iFile.SubSessionHandle()=0x%X", (TUint)this, (TUint)iFile.SubSessionHandle()));
       
   184 	if(iFile.SubSessionHandle() != 0 && iBase != 0)
   293 	if(iFile.SubSessionHandle() != 0 && iBase != 0)
   185 		{
   294 		{
   186 		(void)DoFileWrite2();
   295 		(void)DoFileWrite2();
   187 		}
   296 		}
   188 	iFile.Close();
   297 	iFile.Close();
   210 @see TVolumeIOParamInfo
   319 @see TVolumeIOParamInfo
   211 */
   320 */
   212 TInt RFileBuf64::SetReadAheadSize(TInt aBlockSize, TInt aReadRecBufSize)
   321 TInt RFileBuf64::SetReadAheadSize(TInt aBlockSize, TInt aReadRecBufSize)
   213 	{
   322 	{
   214 	__FILEBUF64_INVARIANT();
   323 	__FILEBUF64_INVARIANT();
   215 	if((aReadRecBufSize & (aReadRecBufSize - 1)) == 0 && aReadRecBufSize > RFileBuf64::KDefaultReadAheadSize)
   324 	if(aReadRecBufSize > 0 && (aReadRecBufSize & (aReadRecBufSize - 1)) == 0 && aReadRecBufSize > RFileBuf64::KDefaultReadAheadSize)
   216 		{
   325 		{
   217 		iReadAheadSize = aReadRecBufSize > iCapacity ? iCapacity : aReadRecBufSize;
   326 		iReadAheadSize = aReadRecBufSize > iCapacity ? iCapacity : aReadRecBufSize;
   218 		}
   327 		}
   219 	else if((aBlockSize & (aBlockSize - 1)) == 0 && aBlockSize > RFileBuf64::KDefaultReadAheadSize)
   328 	else if(aBlockSize > 0 && (aBlockSize & (aBlockSize - 1)) == 0 && aBlockSize > RFileBuf64::KDefaultReadAheadSize)
   220 		{
   329 		{
   221 		iReadAheadSize = aBlockSize > iCapacity ? iCapacity : aBlockSize;
   330 		iReadAheadSize = aBlockSize > iCapacity ? iCapacity : aBlockSize;
   222 		}
   331 		}
   223 	SQLITE_TRACE_FBUF(OstTraceExt4(TRACE_INTERNALS, RFILEBUF64_SETREADAHEADSIZE, "FBuf;0x%X;RFileBuf64::SetReadAheadSize;aBlockSize=%d;aReadRecBufSize=%d;iReadAheadSize=%d", (TUint)this, aBlockSize, aReadRecBufSize, iReadAheadSize));
       
   224 	__FILEBUF64_INVARIANT();
   332 	__FILEBUF64_INVARIANT();
   225 	return iReadAheadSize;
   333 	return iReadAheadSize;
   226 	}
   334 	}
   227 
   335 
   228 /**
   336 /**
   237             are overwritten. On return, its length is set to the number of
   345             are overwritten. On return, its length is set to the number of
   238             bytes read.
   346             bytes read.
   239             
   347             
   240 @return KErrNone if successful, otherwise one of the other system-wide error  codes.
   348 @return KErrNone if successful, otherwise one of the other system-wide error  codes.
   241 
   349 
   242 @panic Sqlite3  4 In _DEBUG mode - negative aFilePos value.
   350 @panic FBuf64  4 In _DEBUG mode - negative aFilePos value.
   243 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   351 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   244 
   352 
   245 @see RFileBuf64::Invariant()
   353 @see RFileBuf64::Invariant()
   246 */
   354 */
   247 TInt RFileBuf64::Read(TInt64 aFilePos, TDes8& aDes)
   355 TInt RFileBuf64::Read(TInt64 aFilePos, TDes8& aDes)
   248 	{
   356 	{
   249 	__ASSERT_DEBUG(aFilePos >= 0, __SQLITEPANIC(EFBufPanicFilePos));
   357 	__FBUF64_ASSERT(aFilePos >= 0, EFBufPanicFilePos);
   250 	__FILEBUF64_INVARIANT();
   358 	__FILEBUF64_INVARIANT();
   251 	aDes.SetLength(0);
   359 	aDes.SetLength(0);
   252 	//1. The output buffer max len is 0
   360 	//1. The output buffer max len is 0
   253 	if(aDes.MaxLength() == 0)
   361 	if(aDes.MaxLength() == 0)
   254 		{
   362 		{
   264 		}
   372 		}
   265 	//3. Too big "read" request - read directly from the file
   373 	//3. Too big "read" request - read directly from the file
   266 	TInt len = aDes.MaxLength();
   374 	TInt len = aDes.MaxLength();
   267 	if(len > iCapacity)
   375 	if(len > iCapacity)
   268 		{
   376 		{
   269 		if((aFilePos + len) > iFilePos && aFilePos < (iFilePos + iLength))
   377 		if((aFilePos + len) > iFilePos && !(aFilePos >= (iFilePos + iLength)))
   270 			{//Write the pending data if the iDirty flag is set, otherwise preserve the buffer content.
   378 			{//Write the pending data if the iDirty flag is set, otherwise preserve the buffer content.
   271 			err = DoFileWrite1(aFilePos);
   379 			err = DoFileWrite1(aFilePos);
   272 			}
   380 			}
   273 		if(err == KErrNone)
   381 		if(err == KErrNone)
   274 			{
   382 			{
   275 			err = iFile.Read(aFilePos, aDes);
   383 			err = iFile.Read(aFilePos, aDes);
   276 			SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_READ1, "FBuf;0x%X;RFileBuf64::Read;TooBigRq;iFileSize=%lld;aFilePos=%lld;len=%d;err=%d", (TUint)this, iFileSize, aFilePos, len, err));
   384 			PROFILE_READ(aFilePos, aDes.Size());
   277 			}
   385 			}
   278 		__FILEBUF64_INVARIANT();
   386 		__FILEBUF64_INVARIANT();
   279 		return err;
   387 		return err;
   280 		}
   388 		}
   281 	//4. The requested data size is smaller than the buffer capacity
   389 	//4. The requested data size is smaller than the buffer capacity
   302 			if(iNextReadFilePos != aFilePos)
   410 			if(iNextReadFilePos != aFilePos)
   303 				{//Guessed read ahead was wrong. Direct "file read" operation
   411 				{//Guessed read ahead was wrong. Direct "file read" operation
   304 				iNextReadFilePosHits = 0;
   412 				iNextReadFilePosHits = 0;
   305 				TPtr8 ptr2(outptr, len);
   413 				TPtr8 ptr2(outptr, len);
   306 				err = iFile.Read(aFilePos, ptr2);
   414 				err = iFile.Read(aFilePos, ptr2);
   307 				SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_READ2, "FBuf;0x%X;RFileBuf64::Read;Read;iFileSize=%lld;aFilePos=%lld;len=%d;err=%d", (TUint)this, iFileSize, aFilePos, len, err));
   415 				PROFILE_READ(aFilePos, ptr2.Size());
   308 				if(err == KErrNone)
   416 				if(err == KErrNone)
   309 					{
   417 					{
   310 					iNextReadFilePos = aFilePos + len;
   418 					iNextReadFilePos = aFilePos + len;
   311 					len -= ptr2.Length();
   419 					len -= ptr2.Length();
   312 					}
   420 					}
   326 				// if read-ahead doesn't cross block boundary do it all
   434 				// if read-ahead doesn't cross block boundary do it all
   327 				readahead = maxReadAhead;	
   435 				readahead = maxReadAhead;	
   328 				}
   436 				}
   329 			TPtr8 ptr(iBase, Min(iCapacity, (len + readahead)));
   437 			TPtr8 ptr(iBase, Min(iCapacity, (len + readahead)));
   330 			err = iFile.Read(aFilePos, ptr);
   438 			err = iFile.Read(aFilePos, ptr);
   331 			SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_READ3, "FBuf;0x%X;RFileBuf64::Read;ReadAhead;iFileSize=%lld;aFilePos=%lld;len=%d;err=%d", (TUint)this, iFileSize, aFilePos, ptr.MaxLength(), err));
   439 			PROFILE_READ(aFilePos, ptr.Size());
   332 			if(err == KErrNone)
   440 			if(err == KErrNone)
   333 				{
   441 				{
   334 				iFilePos = aFilePos;
   442 				iFilePos = aFilePos;
   335 				iLength = ptr.Length();	
   443 				iLength = ptr.Length();	
   336 				iNextReadFilePos = iFilePos + iLength;
   444 				iNextReadFilePos = iFilePos + iLength;
   362 @param aData The descriptor from which binary data is written. The function writes 
   470 @param aData The descriptor from which binary data is written. The function writes 
   363              the entire contents of aData to the file.
   471              the entire contents of aData to the file.
   364 
   472 
   365 @return KErrNone if successful, otherwise one of the other system-wide error  codes.
   473 @return KErrNone if successful, otherwise one of the other system-wide error  codes.
   366 
   474 
   367 @panic Sqlite3  4 In _DEBUG mode - negative aFilePos value.
   475 @panic FBuf64  4 In _DEBUG mode - negative aFilePos value.
   368 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   476 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   369 
   477 
   370 @see RFileBuf64::Invariant()
   478 @see RFileBuf64::Invariant()
   371 */
   479 */
   372 TInt RFileBuf64::Write(TInt64 aFilePos, const TDesC8& aData)
   480 TInt RFileBuf64::Write(TInt64 aFilePos, const TDesC8& aData)
   373 	{
   481 	{
   374 	__ASSERT_DEBUG(aFilePos >= 0, __SQLITEPANIC(EFBufPanicFilePos));
   482 	__FBUF64_ASSERT(aFilePos >= 0, EFBufPanicFilePos);
   375 	__FILEBUF64_INVARIANT();
   483 	__FILEBUF64_INVARIANT();
   376 	if(aData.Length() == 0)
   484 	if(aData.Length() == 0)
   377 		{
   485 		{
   378 		__FILEBUF64_INVARIANT();
   486 		__FILEBUF64_INVARIANT();
   379 		return KErrNone;	
   487 		return KErrNone;	
   498 
   606 
   499 @param aFileSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic.
   607 @param aFileSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic.
   500 
   608 
   501 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   609 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   502 
   610 
   503 @panic Sqlite3  5 In _DEBUG mode - negative aFileSize value.
   611 @panic FBuf64  5 In _DEBUG mode - negative aFileSize value.
   504 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   612 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   505 
   613 
   506 @see RFileBuf64::Invariant()
   614 @see RFileBuf64::Invariant()
   507 */
   615 */
   508 TInt RFileBuf64::SetSize(TInt64 aFileSize)
   616 TInt RFileBuf64::SetSize(TInt64 aFileSize)
   509 	{
   617 	{
   510 	__ASSERT_DEBUG(aFileSize >= 0, __SQLITEPANIC(EFBufPanicFileSize));
   618 	__FBUF64_ASSERT(aFileSize >= 0, EFBufPanicFileSize);
   511 	__FILEBUF64_INVARIANT();
   619 	__FILEBUF64_INVARIANT();
   512 	return DoSetFileSize(aFileSize);
   620 	return DoSetFileSize(aFileSize);
   513 	}
   621 	}
   514 
   622 
   515 /**
   623 /**
   524         codes.
   632         codes.
   525 */
   633 */
   526 TInt RFileBuf64::Lock(TInt64 aFilePos, TInt64 aLength) const
   634 TInt RFileBuf64::Lock(TInt64 aFilePos, TInt64 aLength) const
   527 	{
   635 	{
   528 	__FILEBUF64_INVARIANT();
   636 	__FILEBUF64_INVARIANT();
   529 	TInt err = iFile.Lock(aFilePos, aLength);
   637 	return iFile.Lock(aFilePos, aLength);
   530 	SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_LOCK, "FBuf;0x%X;RFileBuf64::Lock;iFileSize=%lld;aFilePos=%lld;aLength=%lld;err=%d", (TUint)this, iFileSize, aFilePos, aLength, err));
       
   531 	return err;
       
   532 	}
   638 	}
   533 	
   639 	
   534 /**
   640 /**
   535 Unlocks a region within the file as defined by a range of bytes.
   641 Unlocks a region within the file as defined by a range of bytes.
   536 
   642 
   542 @return KErrNone if successful, otherwise one of the other  system-wide error codes.
   648 @return KErrNone if successful, otherwise one of the other  system-wide error codes.
   543 */
   649 */
   544 TInt RFileBuf64::UnLock(TInt64 aFilePos, TInt64 aLength) const
   650 TInt RFileBuf64::UnLock(TInt64 aFilePos, TInt64 aLength) const
   545 	{
   651 	{
   546 	__FILEBUF64_INVARIANT();
   652 	__FILEBUF64_INVARIANT();
   547 	TInt err = iFile.UnLock(aFilePos, aLength);
   653 	return iFile.UnLock(aFilePos, aLength);
   548 	SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_UNLOCK, "FBuf;0x%X;RFileBuf64::UnLock;iFileSize=%lld;aFilePos=%lld;aLength=%lld;err=%d", (TUint)this, iFileSize, aFilePos, aLength, err));
       
   549 	return err;
       
   550 	}
   654 	}
   551 
   655 
   552 /**
   656 /**
   553 Writes the pending data and then flushes the file.
   657 Writes the pending data and then flushes the file.
   554 
   658 
   593 @see RFileBuf64::Invariant()
   697 @see RFileBuf64::Invariant()
   594 */
   698 */
   595 TInt RFileBuf64::Drive(TInt& aDriveNumber, TDriveInfo& aDriveInfo) const
   699 TInt RFileBuf64::Drive(TInt& aDriveNumber, TDriveInfo& aDriveInfo) const
   596 	{
   700 	{
   597 	__FILEBUF64_INVARIANT();
   701 	__FILEBUF64_INVARIANT();
   598 	TInt err = iFile.Drive(aDriveNumber, aDriveInfo);
   702 	return iFile.Drive(aDriveNumber, aDriveInfo);
   599 	SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_DRIVE, "FBuf;0x%X;RFileBuf64::Drive;aDriveNumber=%d;driveAtt=0x%X;mediaAtt=0x%X;err=%d", (TUint)this, aDriveNumber, (TUint)aDriveInfo.iDriveAtt, (TUint)aDriveInfo.iMediaAtt, err));
       
   600 	return err;
       
   601 	}
   703 	}
   602 
   704 
   603 /**
   705 /**
   604 Initializes RFileBuf64 data members with their initial values.   
   706 Initializes RFileBuf64 data members with their initial values.   
   605 Allocates memory for the file buffer. 
   707 Allocates memory for the file buffer. 
   616     }
   718     }
   617 
   719 
   618 /**
   720 /**
   619 Performs post-initialization of the RFileBuf64 object.   
   721 Performs post-initialization of the RFileBuf64 object.   
   620 If aInitErr is not KErrNone, then the buffer memory will be released.
   722 If aInitErr is not KErrNone, then the buffer memory will be released.
       
   723 The function returns the aInitErr value to the caller. 
   621 
   724 
   622 @param aInitErr The result of the performed before the call RFileBuf64 initialization.
   725 @param aInitErr The result of the performed before the call RFileBuf64 initialization.
   623 */
   726  
   624 void RFileBuf64::DoPostInit(TInt aInitErr)
   727 @return KErrNone if successful, otherwise one of the other system-wide error codes.
       
   728 */
       
   729 TInt RFileBuf64::DoPostInit(TInt aInitErr)
   625     {
   730     {
   626     if(aInitErr != KErrNone)
   731     if(aInitErr != KErrNone)
   627         {
   732         {
   628         User::Free(iBase);
   733         User::Free(iBase);
   629         iBase = 0;
   734         iBase = 0;
   630         }
   735         }
       
   736     return aInitErr;
   631     }
   737     }
   632 
   738 
   633 /**
   739 /**
   634 Discards the content of the RFileBuf64 object returning it to the state as if it has just been created. 
   740 Discards the content of the RFileBuf64 object returning it to the state as if it has just been created. 
   635 */
   741 */
   660 	if(iFileSize != KFileSizeNotSet)
   766 	if(iFileSize != KFileSizeNotSet)
   661 		{
   767 		{
   662 		__FILEBUF64_INVARIANT();
   768 		__FILEBUF64_INVARIANT();
   663 		return KErrNone;
   769 		return KErrNone;
   664 		}
   770 		}
       
   771 	PROFILE_SIZE();
   665 	TInt err = iFile.Size(iFileSize);
   772 	TInt err = iFile.Size(iFileSize);
   666 	SQLITE_TRACE_FBUF(OstTraceExt3(TRACE_INTERNALS, RFILEBUF64_DOFILESIZE, "FBuf;0x%X;RFileBuf64::DoFileSize;iFileSize=%lld;err=%d", (TUint)this, iFileSize, err));
       
   667 	if(err != KErrNone)
   773 	if(err != KErrNone)
   668 		{
   774 		{
   669 		DoDiscard();
   775 		DoDiscard();
   670 		}
   776 		}
   671 	__FILEBUF64_INVARIANT();
   777 	__FILEBUF64_INVARIANT();
   679 
   785 
   680 @param aFileSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic.
   786 @param aFileSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic.
   681 
   787 
   682 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   788 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   683 
   789 
   684 @panic Sqlite3  5 In _DEBUG mode - negative aFileSize value.
   790 @panic FBuf64  5 In _DEBUG mode - negative aFileSize value.
   685 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   791 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   686 
   792 
   687 @see RFileBuf64::Invariant()
   793 @see RFileBuf64::Invariant()
   688 */
   794 */
   689 TInt RFileBuf64::DoSetFileSize(TInt64 aFileSize)
   795 TInt RFileBuf64::DoSetFileSize(TInt64 aFileSize)
   690 	{
   796 	{
   691 	__ASSERT_DEBUG(aFileSize >= 0, __SQLITEPANIC(EFBufPanicFileSize));
   797 	__FBUF64_ASSERT(aFileSize >= 0, EFBufPanicFileSize);
   692 	__FILEBUF64_INVARIANT();
   798 	__FILEBUF64_INVARIANT();
   693 	if(aFileSize < iFilePos)
   799 	if(aFileSize < iFilePos)
   694 		{
   800 		{
   695 		iDirty = EFalse;
   801 		iDirty = EFalse;
   696 		iLength = 0;	
   802 		iLength = 0;	
   698 	//If the new file size is "in" the buffer then change the "iLength"
   804 	//If the new file size is "in" the buffer then change the "iLength"
   699 	else if(aFileSize < (iFilePos + iLength))
   805 	else if(aFileSize < (iFilePos + iLength))
   700 		{
   806 		{
   701 		iLength = aFileSize - iFilePos;
   807 		iLength = aFileSize - iFilePos;
   702 		}
   808 		}
       
   809 	PROFILE_SETSIZE();
   703 	TInt err = iFile.SetSize(aFileSize);
   810 	TInt err = iFile.SetSize(aFileSize);
   704 	SQLITE_TRACE_FBUF(OstTraceExt4(TRACE_INTERNALS, RFILEBUF64_DOSETFILESIZE, "FBuf;0x%X;RFileBuf64::DoSetFileSize;iFileSize=%lld;aFileSize=%lld;err=%d", (TUint)this, iFileSize, aFileSize, err));
       
   705 	if(err != KErrNone)
   811 	if(err != KErrNone)
   706 		{
   812 		{
   707 		DoDiscard();
   813 		DoDiscard();
   708 		}
   814 		}
   709 	else
   815 	else
   730 	if(err != KErrNone)
   836 	if(err != KErrNone)
   731 		{
   837 		{
   732 		__FILEBUF64_INVARIANT();
   838 		__FILEBUF64_INVARIANT();
   733 		return err;	
   839 		return err;	
   734 		}
   840 		}
       
   841 	PROFILE_FLUSH();
   735 	err = iFile.Flush();
   842 	err = iFile.Flush();
   736 	SQLITE_TRACE_FBUF(OstTraceExt3(TRACE_INTERNALS, RFILEBUF64_DOFILEFLUSH, "FBuf;0x%X;RFileBuf64::DoFileFlush;iFileSize=%lld;err=%d", (TUint)this, iFileSize, err));
       
   737 	if(err != KErrNone)
   843 	if(err != KErrNone)
   738 		{
   844 		{
   739 		DoDiscard();
   845 		DoDiscard();
   740 		}
   846 		}
   741 	iLength = 0;
   847 	iLength = 0;
   762 	if(iLength == 0)
   868 	if(iLength == 0)
   763 		{
   869 		{
   764 		__FILEBUF64_INVARIANT();
   870 		__FILEBUF64_INVARIANT();
   765 		return KErrNone;	
   871 		return KErrNone;	
   766 		}
   872 		}
       
   873 	PROFILE_WRITE(iFilePos, iLength);
   767 	TPtrC8 data(iBase, iLength);		
   874 	TPtrC8 data(iBase, iLength);		
   768 	TInt err = iFile.Write(iFilePos, data);
   875 	TInt err = iFile.Write(iFilePos, data);
   769 	SQLITE_TRACE_FBUF(OstTraceExt5(TRACE_INTERNALS, RFILEBUF64_DOFILEWRITE, "FBuf;0x%X;RFileBuf64::DoFileWrite;iFileSize=%lld;iFilePos=%lld;iLength=%d;err=%d", (TUint)this, iFileSize, iFilePos, iLength, err));
       
   770 	if(err == KErrNone)
   876 	if(err == KErrNone)
   771 		{
   877 		{
   772 		iFileSize = Max(iFileSize, (iFilePos + iLength));
   878 		iFileSize = Max(iFileSize, (iFilePos + iLength));
   773 		}
   879 		}
   774 	else
   880 	else
   794 
   900 
   795 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   901 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   796 
   902 
   797 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   903 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   798 				   
   904 				   
   799 @panic Sqlite3  4 In _DEBUG mode - negative aNewFilePos value.
   905 @panic FBuf64  4 In _DEBUG mode - negative aNewFilePos value.
   800 
   906 
   801 @see RFileBuf64::Read()
   907 @see RFileBuf64::Read()
   802 @see RFileBuf64::DoFileWrite()
   908 @see RFileBuf64::DoFileWrite()
   803 @see RFileBuf64::DoFileWrite2()
   909 @see RFileBuf64::DoFileWrite2()
   804 @see RFileBuf64::Invariant()
   910 @see RFileBuf64::Invariant()
   805 */
   911 */
   806 TInt RFileBuf64::DoFileWrite1(TInt64 aNewFilePos)
   912 TInt RFileBuf64::DoFileWrite1(TInt64 aNewFilePos)
   807 	{
   913 	{
   808 	__ASSERT_DEBUG(aNewFilePos >= 0, __SQLITEPANIC(EFBufPanicFilePos));
   914 	__FBUF64_ASSERT(aNewFilePos >= 0, EFBufPanicFilePos);
   809 	__FILEBUF64_INVARIANT();
   915 	__FILEBUF64_INVARIANT();
   810 	TInt err = KErrNone;
   916 	TInt err = KErrNone;
   811 	if(iDirty)
   917 	if(iDirty)
   812 		{
   918 		{
   813 		err = DoFileWrite();
   919 		err = DoFileWrite();
   841 
   947 
   842 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   948 @return KErrNone if successful, otherwise one of the other system-wide error codes.
   843 
   949 
   844 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   950 See RFileBuf64::Invariant() for other possible panics that may occur when this method is called.
   845 				   
   951 				   
   846 @panic Sqlite3  4 In _DEBUG mode - negative aNewFilePos value.
   952 @panic FBuf64  4 In _DEBUG mode - negative aNewFilePos value.
   847 
   953 
   848 @see RFileBuf64::Write()
   954 @see RFileBuf64::Write()
   849 @see RFileBuf64::DoFileWrite()
   955 @see RFileBuf64::DoFileWrite()
   850 @see RFileBuf64::DoFileWrite1()
   956 @see RFileBuf64::DoFileWrite1()
   851 @see RFileBuf64::Invariant()
   957 @see RFileBuf64::Invariant()
   852 */
   958 */
   853 TInt RFileBuf64::DoFileWrite2(TInt64 aNewFilePos)
   959 TInt RFileBuf64::DoFileWrite2(TInt64 aNewFilePos)
   854 	{
   960 	{
   855 	__ASSERT_DEBUG(aNewFilePos >= 0, __SQLITEPANIC(EFBufPanicFilePos));
   961 	__FBUF64_ASSERT(aNewFilePos >= 0, EFBufPanicFilePos);
   856 	__FILEBUF64_INVARIANT();
   962 	__FILEBUF64_INVARIANT();
   857 	TInt err = KErrNone;
   963 	TInt err = KErrNone;
   858 	if(iDirty)
   964 	if(iDirty)
   859 		{
   965 		{
   860 		err = DoFileWrite();
   966 		err = DoFileWrite();
   901 
  1007 
   902 /**
  1008 /**
   903 RFileBuf64 invariant. Called in _DEBUG mode at the beginning and before the end of every RFileBuf64 method
  1009 RFileBuf64 invariant. Called in _DEBUG mode at the beginning and before the end of every RFileBuf64 method
   904 (except the init/destroy methods).
  1010 (except the init/destroy methods).
   905 
  1011 
   906 @panic Sqlite3  11 In _DEBUG mode - null "this" pointer.
  1012 @panic FBuf64  11 In _DEBUG mode - null "this" pointer.
   907 @panic Sqlite3   1 In _DEBUG mode - negative iCapacity value.
  1013 @panic FBuf64   1 In _DEBUG mode - negative iCapacity value.
   908 @panic Sqlite3   2 In _DEBUG mode - the buffer pointer is null (possible the buffer is not allocated or already destroyed).
  1014 @panic FBuf64   2 In _DEBUG mode - the buffer pointer is null (possible the buffer is not allocated or already destroyed).
   909 @panic Sqlite3   3 In _DEBUG mode - invalid iLength value (negative or bigger than iCapacity).
  1015 @panic FBuf64   3 In _DEBUG mode - invalid iLength value (negative or bigger than iCapacity).
   910 @panic Sqlite3   4 In _DEBUG mode - negative iFilePos value.
  1016 @panic FBuf64   4 In _DEBUG mode - negative iFilePos value.
   911 @panic Sqlite3   5 In _DEBUG mode - set but negative iFileSize value.
  1017 @panic FBuf64   5 In _DEBUG mode - set but negative iFileSize value.
   912 @panic Sqlite3   6 In _DEBUG mode - null file handle (the RFile64 object is not created or already destroyed).
  1018 @panic FBuf64   6 In _DEBUG mode - null file handle (the RFile64 object is not created or already destroyed).
   913 @panic Sqlite3  13 In _DEBUG mode - set but negative iNextReadFilePos value.
  1019 @panic FBuf64  13 In _DEBUG mode - set but negative iNextReadFilePos value.
   914 @panic Sqlite3  14 In _DEBUG mode - negative iNextReadFilePosHits value.
  1020 @panic FBuf64  14 In _DEBUG mode - negative iNextReadFilePosHits value.
   915 @panic Sqlite3  15 In _DEBUG mode - iReadAheadSize is negative or is not power of two.
  1021 @panic FBuf64  15 In _DEBUG mode - iReadAheadSize is negative or is not power of two.
   916 */
  1022 */
   917 void RFileBuf64::Invariant() const
  1023 void RFileBuf64::Invariant() const
   918 	{
  1024 	{
   919 	__ASSERT_DEBUG(this != 0, __SQLITEPANIC(EFBufPanicNullThis));
  1025 	__FBUF64_ASSERT(this != 0, EFBufPanicNullThis);
   920 	__ASSERT_DEBUG(iCapacity > 0, __SQLITEPANIC(EFBufPanicCapacity));
  1026 	__FBUF64_ASSERT(iCapacity > 0, EFBufPanicCapacity);
   921 	__ASSERT_DEBUG(iBase != 0, __SQLITEPANIC(EFBufPanicNullBuf));
  1027 	__FBUF64_ASSERT(iBase != 0, EFBufPanicNullBuf);
   922 	__ASSERT_DEBUG(iLength >= 0 && iLength <= iCapacity, __SQLITEPANIC(EFBufPanicBufLen));
  1028 	__FBUF64_ASSERT(iLength >= 0 && iLength <= iCapacity, EFBufPanicBufLen);
   923 	__ASSERT_DEBUG(iFilePos >= 0, __SQLITEPANIC(EFBufPanicFilePos));
  1029 	__FBUF64_ASSERT(iFilePos >= 0, EFBufPanicFilePos);
   924 	__ASSERT_DEBUG(iFileSize == KFileSizeNotSet || iFileSize >= 0, __SQLITEPANIC(EFBufPanicFileSize));
  1030 	__FBUF64_ASSERT(iFileSize == KFileSizeNotSet || iFileSize >= 0, EFBufPanicFileSize);
   925 	__ASSERT_DEBUG(iFile.SubSessionHandle() != 0, __SQLITEPANIC(EFBufPanicFileHandle));
  1031 	__FBUF64_ASSERT(iFile.SubSessionHandle() != 0, EFBufPanicFileHandle);
   926 	__ASSERT_DEBUG(iNextReadFilePos == KNextReadFilePosNotSet || iNextReadFilePos >= 0, __SQLITEPANIC(EFBufPanicNextReadFilePos));
  1032 	__FBUF64_ASSERT(iNextReadFilePos == KNextReadFilePosNotSet || iNextReadFilePos >= 0, EFBufPanicNextReadFilePos);
   927 	__ASSERT_DEBUG(iNextReadFilePosHits >= 0, __SQLITEPANIC(EFBufPanicNextReadFilePosHits));
  1033 	__FBUF64_ASSERT(iNextReadFilePosHits >= 0, EFBufPanicNextReadFilePosHits);
   928 	__ASSERT_DEBUG(iReadAheadSize > 0 && (iReadAheadSize & (iReadAheadSize - 1)) == 0, __SQLITEPANIC(EFBufPanicFileBlockSize));
  1034 	__FBUF64_ASSERT(iReadAheadSize > 0 && (iReadAheadSize & (iReadAheadSize - 1)) == 0, EFBufPanicFileBlockSize);
   929 	}
  1035 	}
   930 	
  1036 	
   931 #endif
  1037 #endif