activityfw/activitydatabase/s60/src/hsserializer.cpp
changeset 93 82b66994846c
parent 92 782e3408c2ab
child 94 dbb8300717f7
--- a/activityfw/activitydatabase/s60/src/hsserializer.cpp	Fri Apr 16 14:45:49 2010 +0300
+++ b/activityfw/activitydatabase/s60/src/hsserializer.cpp	Fri Apr 30 15:22:08 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 #include "hsserializer.h"
-
+#include <s32mem.h>
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -106,10 +106,28 @@
 //
 QList<QVariantHash>& operator <<(QList<QVariantHash>& dst, const TDesC8 &src)
 {
-    QByteArray buffer(QByteArray::fromRawData(reinterpret_cast<const char *>(src.Ptr()),
-                                              src.Length()));
-
-    QDataStream stream(&buffer, QIODevice::ReadOnly);
-    QT_TRYCATCH_LEAVING(stream >> dst);
+    dst.clear();
+    
+    QVariantHash item;
+    TRAP_IGNORE(
+    RDesReadStream srcStream(src);
+    int numOfItems(srcStream.ReadInt32L());
+    int bufferSize;
+    
+    RBuf8 tmpBuff;
+    CleanupClosePushL(tmpBuff);
+    for (int iter(0); iter < numOfItems; ++iter) {
+        bufferSize = srcStream.ReadInt32L();
+        if (tmpBuff.MaxLength() < bufferSize) {
+            tmpBuff.ReAllocL(bufferSize);
+        }
+        item.clear();
+        if (0 < bufferSize) {
+            srcStream.ReadL(tmpBuff, bufferSize);
+            item << tmpBuff;
+        }
+        dst.append(item);
+    }
+    CleanupStack::PopAndDestroy(&tmpBuff));
     return dst;
 }