persistentstorage/sql/SRC/Common/SqlBufFlat.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
--- a/persistentstorage/sql/SRC/Common/SqlBufFlat.cpp	Tue Aug 31 16:57:14 2010 +0300
+++ b/persistentstorage/sql/SRC/Common/SqlBufFlat.cpp	Wed Sep 01 12:39:58 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -15,7 +15,6 @@
 
 #include "SqlUtil.h"
 #include "SqlBufFlat.h"
-#include "OstTraceDefinitions.h"
 
 /**
 Sets the flat buffer pointer to NULL
@@ -46,7 +45,7 @@
 */
 TInt RSqlBufFlat::SetCount(TInt aCount)
 	{
-	__ASSERT_DEBUG(aCount >= 0, __SQLPANIC(ESqlPanicBadArgument));
+	__SQLASSERT(aCount >= 0, ESqlPanicBadArgument);
 	TInt headerSize = sizeof(RSqlBufFlat::TCell) * aCount;
 	TInt newSize = headerSize + sizeof(RSqlBufFlat::TBufFlat);
 	if(DoReAlloc(newSize) != KErrNone)
@@ -111,7 +110,7 @@
 		iMaxSize = KBufLimit - 1;  //to force the reallocation
 		(void)DoReAlloc(KBufLimit);//User::ReAlloc() does not fail if the new requested size is less than the current block size
 		}
-	__ASSERT_DEBUG(oldBuf == iBuf, __SQLPANIC(ESqlPanicInternalError));
+	__SQLASSERT(oldBuf == iBuf, ESqlPanicInternalError);
 	SQLFLATBUF_INVARIANT();
 	}
 
@@ -157,12 +156,12 @@
 TInt RSqlBufFlat::SetField(TInt aIndex, TInt aType, const void* aData, TInt aDataLength)
 	{
 	SQLFLATBUF_INVARIANT();
-	__ASSERT_DEBUG((TUint)aIndex < iBuf->iCount, __SQLPANIC(ESqlPanicBadArgument));
-	__ASSERT_DEBUG((TUint)aType < RSqlBufFlat::EMaxType, __SQLPANIC(ESqlPanicBadArgument));
-	__ASSERT_DEBUG((TUint)aDataLength < RSqlBufFlat::EMaxLength, __SQLPANIC(ESqlPanicBadArgument));
+	__SQLASSERT((TUint)aIndex < iBuf->iCount, ESqlPanicBadArgument);
+	__SQLASSERT((TUint)aType < RSqlBufFlat::EMaxType, ESqlPanicBadArgument);
+	__SQLASSERT((TUint)aDataLength < RSqlBufFlat::EMaxLength, ESqlPanicBadArgument);
 	if(aData)						//field value "present"
 		{
-		__ASSERT_DEBUG(aDataLength >= 0, __SQLPANIC(ESqlPanicBadArgument));
+		__SQLASSERT(aDataLength >= 0, ESqlPanicBadArgument);
 		if(aDataLength > 0)
 			{
 			if(Reserve(aDataLength) != KErrNone)
@@ -196,9 +195,9 @@
 void RSqlBufFlat::DoInit()
 	{
 	TBufFlat& buf = *iBuf;
-	__ASSERT_DEBUG(buf.iCount >= 0, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(buf.iSize <= iMaxSize, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(buf.iHeaderSize == sizeof(RSqlBufFlat::TCell) * buf.iCount, __SQLPANIC(ESqlPanicInternalError));
+	__SQLASSERT(buf.iCount >= 0, ESqlPanicInternalError);
+	__SQLASSERT(buf.iSize <= iMaxSize, ESqlPanicInternalError);
+	__SQLASSERT(buf.iHeaderSize == sizeof(RSqlBufFlat::TCell) * buf.iCount, ESqlPanicInternalError);
 	if(buf.iHeaderSize > 0)
 		{
 		Mem::FillZ(Header(), buf.iHeaderSize);
@@ -245,10 +244,10 @@
 void RSqlBufFlat::DoSet(TInt aIndex, TInt aType, const void* aData, TInt aDataLength)
 	{
 	TBufFlat& buf = *iBuf;
-	__ASSERT_DEBUG((TUint)aDataLength < RSqlBufFlat::EMaxLength, __SQLPANIC(ESqlPanicBadArgument));
-	__ASSERT_DEBUG(aDataLength > 0 ? aData != NULL : ETrue, __SQLPANIC(ESqlPanicBadArgument));
-	__ASSERT_DEBUG(aDataLength <= (iMaxSize - buf.iSize), __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(::IsAligned8(buf.iSize), __SQLPANIC(ESqlPanicInternalError));
+	__SQLASSERT((TUint)aDataLength < RSqlBufFlat::EMaxLength, ESqlPanicBadArgument);
+	__SQLASSERT(aDataLength > 0 ? aData != NULL : ETrue, ESqlPanicBadArgument);
+	__SQLASSERT(aDataLength <= (iMaxSize - buf.iSize), ESqlPanicInternalError);
+	__SQLASSERT(::IsAligned8(buf.iSize), ESqlPanicInternalError);
 	RSqlBufFlat::TCell& cell = *(Header() + aIndex);
 	cell.iBits = (TUint)(((TUint)aType << RSqlBufFlat::EWidthLen) | (TUint)aDataLength);
 	cell.iPos = 1;	//not 0, because 0 means "not present"
@@ -292,24 +291,24 @@
 */
 void RSqlBufFlat::Invariant() const
 	{
-	__ASSERT_DEBUG(iBuf != NULL, __SQLPANIC(ESqlPanicInternalError));
+	__SQLASSERT(iBuf != NULL, ESqlPanicInternalError);
 	const TBufFlat& buf = *iBuf;
-	__ASSERT_DEBUG(buf.iCount >= 0, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(buf.iHeaderSize == sizeof(RSqlBufFlat::TCell) * buf.iCount, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(::IsAligned8(buf.iSize), __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(buf.iSize >= buf.iHeaderSize + sizeof(RSqlBufFlat::TBufFlat), __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(buf.iSize <= iMaxSize, __SQLPANIC(ESqlPanicInternalError));
-	__ASSERT_DEBUG(buf.iSize <= User::AllocLen(iBuf), __SQLPANIC(ESqlPanicInternalError));	
+	__SQLASSERT(buf.iCount >= 0, ESqlPanicInternalError);
+	__SQLASSERT(buf.iHeaderSize == sizeof(RSqlBufFlat::TCell) * buf.iCount, ESqlPanicInternalError);
+	__SQLASSERT(::IsAligned8(buf.iSize), ESqlPanicInternalError);
+	__SQLASSERT(buf.iSize >= buf.iHeaderSize + sizeof(RSqlBufFlat::TBufFlat), ESqlPanicInternalError);
+	__SQLASSERT(buf.iSize <= iMaxSize, ESqlPanicInternalError);
+ 	__SQLASSERT(buf.iSize <= User::AllocLen(iBuf), ESqlPanicInternalError);	
 	for(TInt i=0;i<(TInt)buf.iCount;++i)
 		{
 		const RSqlBufFlat::TCell& cell = *((reinterpret_cast <const RSqlBufFlat::TCell*> (iBuf + 1)) + i);
-		__ASSERT_DEBUG(cell.Type() < RSqlBufFlat::EMaxType, __SQLPANIC(ESqlPanicInternalError));
+		__SQLASSERT(cell.Type() < RSqlBufFlat::EMaxType, ESqlPanicInternalError);
 		if(cell.Size() > 0 && cell.iPos >= buf.iHeaderSize) //only for present fields with length > 0
 			{
-			__ASSERT_DEBUG((TUint)cell.Size() <= buf.iSize, __SQLPANIC(ESqlPanicInternalError));
-			__ASSERT_DEBUG(cell.iPos < (buf.iSize - sizeof(RSqlBufFlat::TBufFlat)), __SQLPANIC(ESqlPanicInternalError));
+			__SQLASSERT((TUint)cell.Size() <= buf.iSize, ESqlPanicInternalError);
+			__SQLASSERT(cell.iPos < (buf.iSize - sizeof(RSqlBufFlat::TBufFlat)), ESqlPanicInternalError);
 			TUint64 val = *(TUint64*)(reinterpret_cast <TUint8*> (iBuf) + cell.iPos + sizeof(RSqlBufFlat::TBufFlat) - sizeof(KSqlBufFlatMagicValue));
-			__ASSERT_DEBUG(val == KSqlBufFlatMagicValue, __SQLPANIC(ESqlPanicInternalError));
+			__SQLASSERT(val == KSqlBufFlatMagicValue, ESqlPanicInternalError);
 			}
 		}
 	}