telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmCustomTsy.cpp
changeset 23 6b1d113cdff3
parent 20 244d7c5f118e
child 24 6638e7f4bd8f
child 42 3adadc800673
equal deleted inserted replaced
20:244d7c5f118e 23:6b1d113cdff3
  1779     TInt ret = ( KErrNone );
  1779     TInt ret = ( KErrNone );
  1780 
  1780 
  1781     // local variable initialized to zero
  1781     // local variable initialized to zero
  1782     TInt counter = 0;
  1782     TInt counter = 0;
  1783 
  1783 
  1784     // empty tbuf for rand_db initialization
       
  1785     TBuf8<1> empty;
       
  1786     empty.Append( 0 );
       
  1787 
  1784 
  1788     // fileSize is initialized to 2 because of filesize calculation method
  1785     // fileSize is initialized to 2 because of filesize calculation method
  1789     TInt fileSize = 2;
  1786     TInt fileSize = 2;
  1790 
  1787 
  1791     RFs   fs;
  1788     RFs   fs;
  1822                 // filesize
  1819                 // filesize
  1823                 fileSize = ( fileSize / 8 );
  1820                 fileSize = ( fileSize / 8 );
  1824 
  1821 
  1825                 ret = file.SetSize( fileSize + METADATA_SIZE );
  1822                 ret = file.SetSize( fileSize + METADATA_SIZE );
  1826 
  1823 
       
  1824 				// empty tbuf for rand_db initialization
       
  1825 				TBuf8<1024> empty;
       
  1826 				TInt chunkSize = 1024;
       
  1827 				empty.FillZ( chunkSize );
       
  1828 				
  1827                 // reset every byte of newly created rand_db to zero
  1829                 // reset every byte of newly created rand_db to zero
  1828                 for ( counter = 0; counter < ( fileSize + METADATA_SIZE );
  1830 				TInt maxSize = ( fileSize + METADATA_SIZE );
  1829                     counter++ )
  1831                 for ( counter = 0; counter < maxSize;
       
  1832                     counter+=chunkSize )
  1830                     {
  1833                     {
  1831                     ret = file.Write( counter, empty );
  1834                     TInt writeSize = maxSize - counter;
       
  1835                     if(writeSize > chunkSize)
       
  1836                         {
       
  1837                         writeSize = chunkSize;
       
  1838                         }
       
  1839                     ret = file.Write( counter, empty, writeSize );
  1832                     }
  1840                     }
  1833 
  1841 
  1834                 if ( KErrNone != ret )
  1842                 if ( KErrNone != ret )
  1835                     {
  1843                     {
  1836 TFLOGSTRING( "TSY: CMmCustomTsy: 'rand_db.cur' initialization failed!" );
  1844 TFLOGSTRING( "TSY: CMmCustomTsy: 'rand_db.cur' initialization failed!" );