From b4aa359990c90553d91f7d2a5d4c4a4361e6d5d6 Mon Sep 17 00:00:00 2001
From: mread <qt-info@nokia.com>
Date: Thu, 30 Sep 2010 13:19:04 +0100
Subject: hybrid heap further review changes

changing the way enums are declared and used.
commenting and restricting export macro changes.
improved flagging

Task-number: QT-3967
Reviewed-by: Shane Kearns
---
 src/corelib/arch/symbian/debugfunction.cpp         | 17 ++++++++---------
 src/corelib/arch/symbian/heap_hybrid_p.h           |  4 ++--
 src/corelib/arch/symbian/qt_hybridheap_symbian_p.h | 11 ++++-------
 3 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/corelib/arch/symbian/debugfunction.cpp b/src/corelib/arch/symbian/debugfunction.cpp
index f4daf03..f3b5d2d 100644
--- a/src/corelib/arch/symbian/debugfunction.cpp
+++ b/src/corelib/arch/symbian/debugfunction.cpp
@@ -42,7 +42,6 @@
 #include "qt_hybridheap_symbian_p.h"
 
 #ifdef QT_USE_NEW_SYMBIAN_ALLOCATOR
-#define RAllocator RHybridHeap
 
 #define GM  (&iGlobalMallocState)
 #define __HEAP_CORRUPTED_TRACE(t,p,l) BTraceContext12(BTrace::EHeap, BTrace::EHeapCorruption, (TUint32)t, (TUint32)p, (TUint32)l);
@@ -80,11 +79,11 @@ TInt RHybridHeap::DebugFunction(TInt aFunc, TAny* a1, TAny* a2)
             __DEBUG_ONLY(DoSetAllocFail((TAllocFail)(TInt)a1, (TInt)a2));
             break;
 
-        case RAllocator::EGetFail:
+        case RHybridHeap::EGetFail:
             __DEBUG_ONLY(r = iFailType);
             break;
 
-        case RAllocator::ESetBurstFail:
+        case RHybridHeap::ESetBurstFail:
 #if _DEBUG
             {
             SRAllocatorBurstFail* fail = (SRAllocatorBurstFail*) a2;
@@ -93,7 +92,7 @@ TInt RHybridHeap::DebugFunction(TInt aFunc, TAny* a1, TAny* a2)
 #endif
             break;
             
-        case RAllocator::ECheckFailure:
+        case RHybridHeap::ECheckFailure:
             // iRand will be incremented for each EFailNext, EBurstFailNext,
             // EDeterministic and EBurstDeterministic failure.
             r = iRand;
@@ -106,31 +105,31 @@ TInt RHybridHeap::DebugFunction(TInt aFunc, TAny* a1, TAny* a2)
             break;
             }
 
-		case RAllocator::EGetSize:
+		case RHybridHeap::EGetSize:
 			{
 			r = iChunkSize - sizeof(RHybridHeap);
 			break;
 			}
 
-		case RAllocator::EGetMaxLength:
+		case RHybridHeap::EGetMaxLength:
 			{
 			r = iMaxLength;
 			break;
 			}
 
-		case RAllocator::EGetBase:
+		case RHybridHeap::EGetBase:
 			{
 			*(TAny**)a1 = iBase;
 			break;
 			}
 
-		case RAllocator::EAlignInteger:
+		case RHybridHeap::EAlignInteger:
 			{
 			r = _ALIGN_UP((TInt)a1, iAlign);
 			break;
 			}
 
-		case RAllocator::EAlignAddr:
+		case RHybridHeap::EAlignAddr:
 			{
             *(TAny**)a2 = (TAny*)_ALIGN_UP((TLinAddr)a1, iAlign);
 			break;
diff --git a/src/corelib/arch/symbian/heap_hybrid_p.h b/src/corelib/arch/symbian/heap_hybrid_p.h
index 6583657..736af72 100644
--- a/src/corelib/arch/symbian/heap_hybrid_p.h
+++ b/src/corelib/arch/symbian/heap_hybrid_p.h
@@ -105,8 +105,8 @@ public:
 	enum TDebugOp { EWalk = 128, EHybridHeap };
 	enum TAllocFail
 		{
-		/*ERandom, ETrueRandom, EDeterministic, ENone, EFailNext, EReset, EBurstRandom,
-		EBurstTrueRandom, EBurstDeterministic, EBurstFailNext,*/ ECheckFailure = 10,
+		ERandom, ETrueRandom, EDeterministic, EHybridNone, EFailNext, EReset, EBurstRandom,
+		EBurstTrueRandom, EBurstDeterministic, EBurstFailNext, ECheckFailure,
 		};
 
 	struct HeapInfo
diff --git a/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h b/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h
index 7b569fd..a59f29e 100644
--- a/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h
+++ b/src/corelib/arch/symbian/qt_hybridheap_symbian_p.h
@@ -44,7 +44,7 @@
 
 #include <qglobal.h>
 
-#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) && !defined(__WINSCW__)
+#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) && !defined(__WINS__)
 //Enable the (backported) new allocator. When it is available in OS,
 //this flag should be disabled for that OS version onward
 #define QT_USE_NEW_SYMBIAN_ALLOCATOR
@@ -52,7 +52,7 @@
 
 #ifdef QT_USE_NEW_SYMBIAN_ALLOCATOR
 
-#ifndef __WINS__
+#ifdef Q_CC_RVCT
 #pragma push
 #pragma arm
 #pragma Otime
@@ -78,11 +78,8 @@
 #endif
 #include "heap_hybrid_p.h"
 
-// disabling Symbian import/export macros to prevent code copied from Symbian^4 from exporting symbols in arm builds
-#undef UIMPORT_C
-#define UIMPORT_C
-#undef IMPORT_C
-#define IMPORT_C
+// disabling Symbian import/export macros to prevent heap_hybrid.cpp, copied from Symbian^4, from exporting symbols in arm builds
+// this minimises the code changes to heap_hybrid.cpp to ease future integration
 #undef UEXPORT_C
 #define UEXPORT_C
 #undef EXPORT_C
-- 
cgit v0.12