telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmCustomTsy.cpp
changeset 23 6b1d113cdff3
parent 20 244d7c5f118e
child 24 6638e7f4bd8f
child 42 3adadc800673
--- a/telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmCustomTsy.cpp	Fri Apr 16 16:12:37 2010 +0300
+++ b/telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmCustomTsy.cpp	Mon May 03 13:37:20 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 )