src/hbcore/core/hbsharedmemorymanager_p.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
--- a/src/hbcore/core/hbsharedmemorymanager_p.cpp	Tue Jul 06 14:36:53 2010 +0300
+++ b/src/hbcore/core/hbsharedmemorymanager_p.cpp	Wed Aug 18 10:05:37 2010 +0300
@@ -298,7 +298,7 @@
             
             if (!binCSSConverterApp) {
                 if (memoryFileSize == 0) {
-                    cachePtr = createSharedCache(0, 0, 0);
+                    cachePtr = createSharedCache(0, 0, 0, -1);
                 }
             }
         }
@@ -325,7 +325,7 @@
  * This function throws std::bad_alloc in case of OOM condition, else
  * proper offset in case of a successful memory allocation
  */
-int HbSharedMemoryManager::alloc(int size)
+qptrdiff HbSharedMemoryManager::alloc(int size)
 {
 #ifdef HB_THEME_SERVER_MEMORY_REPORT
 // some code copied, but much more readable this way
@@ -376,7 +376,7 @@
 
 #else // normal alloc without reporting
     if (isWritable() && size > 0) {
-        int offset = -1;
+        qptrdiff offset = -1;
 #ifdef USE_SUBALLOCATOR
         if (size <= MAXIMUM_ALLOC_SIZE_FOR_SUBALLOCATOR) {
             offset = subAllocator->alloc(size);
@@ -409,7 +409,7 @@
 /**
  * free
  */
-void HbSharedMemoryManager::free(int offset)
+void HbSharedMemoryManager::free(qptrdiff offset)
 {
     // don't do anything when freeing NULL (pointer)offset
     if (isWritable() && (offset > 0)) {
@@ -446,9 +446,9 @@
  * 
  * This function can throw if alloc fails
  */
-int HbSharedMemoryManager::realloc(int offset, int newSize)
+qptrdiff HbSharedMemoryManager::realloc(qptrdiff offset, int newSize)
 {
-    int newOffset = -1;
+    qptrdiff newOffset = -1;
     if (isWritable()) {
 #ifdef HB_THEME_SERVER_FULL_MEMORY_REPORT
         if (offset > 0) { // if offset == -1, just do normal alloc and not report realloc
@@ -519,7 +519,7 @@
 }
 
 HbSharedCache *HbSharedMemoryManager::createSharedCache(
-    const char *offsetMapData, int size, int offsetItemCount, int sharedCacheOffset)
+    const char *dataArray, int size, int offsetItemCount, int globalParametersOffset, qptrdiff sharedCacheOffset)
 {
     HbSharedCache *cache = 0;
     HbSharedChunkHeader *chunkHeader = static_cast<HbSharedChunkHeader*>(chunk->data());
@@ -527,7 +527,7 @@
         free(chunkHeader->sharedCacheOffset);
         chunkHeader->sharedCacheOffset = 0;
     }
-    if (!offsetMapData) {
+    if (!dataArray) {
         size = 0;
     }
 
@@ -539,7 +539,7 @@
 
     if (sharedCacheOffset >= 0) {
         cache = new (address<char>(sharedCacheOffset)) HbSharedCache();
-        cache->addOffsetMap(offsetMapData, size, offsetItemCount);
+        cache->setContent(dataArray, size, offsetItemCount, globalParametersOffset);
         chunkHeader->sharedCacheOffset = sharedCacheOffset;
     }
     return cache;