telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmCustomTsy.cpp
branchRCL_3
changeset 21 2492a6e4aed7
parent 16 fe8b59ab9fa0
child 65 630d2f34d719
--- a/telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmCustomTsy.cpp	Wed Apr 14 17:11:46 2010 +0300
+++ b/telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmCustomTsy.cpp	Tue Apr 27 17:51:07 2010 +0300
@@ -1781,9 +1781,6 @@
     // local variable initialized to zero
     TInt counter = 0;
 
-    // empty tbuf for rand_db initialization
-    TBuf8<1> empty;
-    empty.Append( 0 );
 
     // fileSize is initialized to 2 because of filesize calculation method
     TInt fileSize = 2;
@@ -1824,11 +1821,22 @@
 
                 ret = file.SetSize( fileSize + METADATA_SIZE );
 
+				// empty tbuf for rand_db initialization
+				TBuf8<1024> empty;
+				TInt chunkSize = 1024;
+				empty.FillZ( chunkSize );
+				
                 // reset every byte of newly created rand_db to zero
-                for ( counter = 0; counter < ( fileSize + METADATA_SIZE );
-                    counter++ )
+				TInt maxSize = ( fileSize + METADATA_SIZE );
+                for ( counter = 0; counter < maxSize;
+                    counter+=chunkSize )
                     {
-                    ret = file.Write( counter, empty );
+                    TInt writeSize = maxSize - counter;
+                    if(writeSize > chunkSize)
+                        {
+                        writeSize = chunkSize;
+                        }
+                    ret = file.Write( counter, empty, writeSize );
                     }
 
                 if ( KErrNone != ret )