src/hbcore/core/hbsharedmemorymanager_p.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
--- a/src/hbcore/core/hbsharedmemorymanager_p.cpp	Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/core/hbsharedmemorymanager_p.cpp	Fri Sep 17 08:32:10 2010 +0300
@@ -253,9 +253,7 @@
         writable = false;
     }
     if ( !success ) {
-#ifdef THEME_SERVER_TRACES
-        qDebug() << "HbSharedMemoryManager:: Could not initialize shared memory chunk";
-#endif //THEME_SERVER_TRACES
+        THEME_GENERIC_DEBUG() << "HbSharedMemoryManager:: Could not initialize shared memory chunk";
         delete chunk; 
         chunk = 0;
     }
@@ -287,11 +285,11 @@
             chunkHeader->mainAllocatorOffset = memoryFileSize ? ALIGN(memoryFileSize)
                                                               : sizeof(HbSharedChunkHeader);
             // Clear also allocator identifier so that they will not try to re-connect
-            int *mainAllocatorIdentifier = address<int>(chunkHeader->mainAllocatorOffset);
+            quint32 *mainAllocatorIdentifier = address<quint32>(chunkHeader->mainAllocatorOffset);
             *mainAllocatorIdentifier = 0;
             mainAllocator->initialize(chunk, chunkHeader->mainAllocatorOffset);
             chunkHeader->subAllocatorOffset = alloc(SPACE_NEEDED_FOR_MULTISEGMENT_ALLOCATOR);
-            int *subAllocatorIdentifier = address<int>(chunkHeader->subAllocatorOffset);
+            quint32 *subAllocatorIdentifier = address<quint32>(chunkHeader->subAllocatorOffset);
             *subAllocatorIdentifier = 0;
             subAllocator->initialize(chunk, chunkHeader->subAllocatorOffset, mainAllocator);
             chunkHeader->identifier = INITIALIZED_CHUNK_IDENTIFIER;
@@ -413,7 +411,7 @@
 {
     // don't do anything when freeing NULL (pointer)offset
     if (isWritable() && (offset > 0)) {
-        int metaData = *address<int>(offset - sizeof(int));
+        qptrdiff metaData = *address<qptrdiff>(offset - sizeof(qptrdiff));
 #ifdef HB_THEME_SERVER_MEMORY_REPORT
         int size = 0;
         if (metaData & MAIN_ALLOCATOR_IDENTIFIER) {
@@ -462,7 +460,7 @@
             HbCssConverterUtils::cellMoved(offset, newOffset);
 #endif
             unsigned char *scrPtr = address<unsigned char>(offset);
-            int metaData = *address<int>(offset - sizeof(int));
+            qptrdiff metaData = *address<qptrdiff>(offset - sizeof(qptrdiff));
             if (metaData & MAIN_ALLOCATOR_IDENTIFIER) {
                 int oldSize = mainAllocator->allocatedSize(offset);
                 memcpy(address<unsigned char>(newOffset), scrPtr, qMin(oldSize, allocatedSize));
@@ -593,9 +591,7 @@
     if (!memManager) {
         memManager = new HbSharedMemoryManager();
         if (!memManager->initialize()) {
-#ifdef THEME_SERVER_TRACES
-            qWarning( "HbSharedMemoryManager:Could not initialize shared memory" );
-#endif
+            THEME_GENERIC_DEBUG() << "HbSharedMemoryManager:Could not initialize shared memory";
             delete memManager;
             memManager = 0;
         }
@@ -633,10 +629,8 @@
 int HbSharedMemoryManager::loadMemoryFile(const QString &filePath)
 {
     int loadedSize = 0;
-
-#ifdef CSSBIN_TRACES
-    qDebug() << "loading: " << filePath;
-#endif
+    THEME_CSSBIN_DEBUG() << "loading: " << filePath;
+    
     QFile file(filePath);
     if(file.open(QFile::ReadOnly)) {
         qint64 fileSize = file.size();
@@ -644,9 +638,7 @@
         file.close();
         loadedSize = (int)fileSize;
     }
-#ifdef CSSBIN_TRACES
-    qDebug() << "Loading memory file status: " << (loadedSize > 0 ? "no error" : file.errorString());
-#endif
+    THEME_CSSBIN_DEBUG() << "Loading memory file status: " << (loadedSize > 0 ? "no error" : file.errorString());
     return loadedSize;
 }
 
@@ -685,7 +677,7 @@
 
     QFile file(filePath);
     if (!file.open(QFile::WriteOnly | QFile::Append | QFile::Text)) {
-        qWarning() << "Create shared memory report error - can't write to file " << filePath;
+        hbWarning() << "Create shared memory report error - can't write to file " << filePath;
         return;
     }
 
@@ -791,7 +783,7 @@
 #endif
     file.close();
     if (file.error()) {
-        qWarning() << "Create shared memory report error - error with file " << filePath;
+        hbWarning() << "Create shared memory report error - error with file " << filePath;
     }
 }
 #endif