persistentstorage/dbms/tdbms/t_dbperf2.cpp
changeset 40 b8bdbc8f59c7
parent 17 55f2396f6d25
child 55 44f437012c90
--- a/persistentstorage/dbms/tdbms/t_dbperf2.cpp	Thu Jul 08 12:09:58 2010 +0100
+++ b/persistentstorage/dbms/tdbms/t_dbperf2.cpp	Thu Aug 12 11:53:23 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -1292,16 +1292,19 @@
 	{
 	_LIT(KSpace, " ");
 	TheTest.Printf(_L("%*.*S%S\r\n"), aOffset, aOffset, &KSpace, &aPath);
-	TFindFile findFile(TheFs);
+	TFindFile* findFile = new TFindFile(TheFs);//TFindFile has TParse data member. 
+											   //Since this function is called recoursively, on some platforms
+											   //the test might crash - "stack overflow" problem.
+	TEST(findFile != NULL);
 	CDir* fileNameCol = NULL;
 	TBuf<8> fileNameMask;
 	fileNameMask.Copy(_L("*.*"));
-	TInt err = findFile.FindWildByDir(fileNameMask, aPath, fileNameCol);
+	TInt err = findFile->FindWildByDir(fileNameMask, aPath, fileNameCol);
 	if(err == KErrNone)
 		{
 		do
 			{
-			const TDesC& file = findFile.File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case.
+			const TDesC& file = findFile->File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case.
 			(void)TheParse.Set(file, NULL, NULL);
 			TPtrC driveName = TheParse.Drive();
 			if(aPath.FindF(driveName) >= 0)
@@ -1316,23 +1319,26 @@
                         }
                     else
                         {
-                        TBuf<100> path;
-                        path.Copy(aPath);
-                        path.Append(entry.iName);
-                        path.Append(_L("\\"));
-                        PrintDiskUsage(path, aOffset + 4);
+						TFileName* path = new TFileName;//allocated in heap to prevent "stack overflow" prolem
+						TEST(path != NULL);
+						path->Copy(aPath);
+						path->Append(entry.iName);
+						path->Append(_L("\\"));
+                        PrintDiskUsage(*path, aOffset + 4);
+                        delete path;
                         }
                     }
 				} // if(aPath.FindF(driveName) >= 0)
 			
 			delete fileNameCol;
 			fileNameCol = NULL;
-			} while((err = findFile.FindWild(fileNameCol)) == KErrNone);//Get the next set of files
+			} while((err = findFile->FindWild(fileNameCol)) == KErrNone);//Get the next set of files
 		}
 	else
 		{
 		TheTest.Printf(_L("  FindWildByDir() failed with err=%d\r\n"), err);
 		}
+	delete findFile;
 	}
 
 void DoTestL()
@@ -1399,7 +1405,7 @@
 	DeleteFile(TheTestFileName);
 	TEST2(err, KErrNone);
 
-	TheTest.Printf(_L("====================================================\r\n"));
+	TheTest.Printf(_L("====================== Disk usage ==================\r\n"));
 	PrintDiskUsage(_L("c:\\"));
 	TheTest.Printf(_L("====================================================\r\n"));