Fix for bug 3292 - [GCCE] Possible undefined behaviour warning in kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp GCC_SURGE
authorMike Kinghan <mikek@symbian.org>
Mon, 19 Jul 2010 14:32:36 +0100
branchGCC_SURGE
changeset 210 b592f7984442
parent 209 6035754ebf88
child 215 8096a832df02
Fix for bug 3292 - [GCCE] Possible undefined behaviour warning in kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp Fix for bug 3293 - [GCCE] Incorrect operator precedence assumptions in kerneltest/f32test/server/t_fsrv.cpp Fix for bug 3295 - [GCCE] deprecated conversion from string constant to 'char*' in f32test build Fix for bug 3297 - [GCCE] Operator precedence warnings in kerneltest/f32test/demandpaging/t_nandpaging.cpp Fix for bug 3309 - [GCCE] Terminal backslashes in comments are parsed as line-continuations in f32test
kerneltest/f32test/demandpaging/t_mmcpaging.cpp
kerneltest/f32test/demandpaging/t_nandpaging.cpp
kerneltest/f32test/filesystem/fat/b_fat32.cpp
kerneltest/f32test/filesystem/fat/t_scn32dr1.cpp
kerneltest/f32test/filesystem/fat/t_tscan32.cpp
kerneltest/f32test/plugins/version_1/virus/t_virus.cpp
kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp
kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp
kerneltest/f32test/server/t_fatcharsetconv_main.cpp
kerneltest/f32test/server/t_fsrv.cpp
kerneltest/f32test/server/t_prel.cpp
kerneltest/f32test/smassstorage/scsiprot/t_ms_main.cpp
kerneltest/f32test/smassstorage/scsiprot/t_ms_main.h
kerneltest/f32test/smassstorage/src/t_ms_main.cpp
--- a/kerneltest/f32test/demandpaging/t_mmcpaging.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/demandpaging/t_mmcpaging.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -350,7 +350,7 @@
 		{
 		TInt r=UserSvr::HalFunction(EHalGroupVM,EVMHalFlushCache,0,0);
 		if (Random() & 1)
-			User::AfterHighRes(500+Random() & 2047);
+			User::AfterHighRes((500+Random()) & 2047);
 
 		if (r<0)
 			{
@@ -376,7 +376,7 @@
 					}
 				PagedTrashCount++;
 				if (RandomNo & 1)
-					User::AfterHighRes(500+Random() & 2047);
+					User::AfterHighRes((500+Random()) & 2047);
 				}
 			}
 	
--- a/kerneltest/f32test/demandpaging/t_nandpaging.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/demandpaging/t_nandpaging.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -356,7 +356,7 @@
 		{
 		TInt r=UserSvr::HalFunction(EHalGroupVM,EVMHalFlushCache,0,0);
 		if (Random() & 1)
-			User::AfterHighRes(500+Random() & 2047);
+			User::AfterHighRes((500+Random()) & 2047);
 
 		if (r<0)
 			{
@@ -382,7 +382,7 @@
 					}
 				PagedTrashCount++;
 				if (RandomNo & 1)
-					User::AfterHighRes(500+Random() & 2047);
+					User::AfterHighRes((500+Random()) & 2047);
 				}
 			}
 	
@@ -671,7 +671,7 @@
 				TInt tries = 10;
 				do { // If we get zero hits, maybe the page hasnt hit yet.
 					tries--;
-					User::AfterHighRes(1000+Random() & 2047);  // Throw some uncertainly into things
+					User::AfterHighRes((1000+Random()) & 2047);  // Throw some uncertainly into things
 				
 					TPtr8 statsBuf((TUint8*) &stats, sizeof(stats));
 			 		r = Drive.ControlIO(KNandGetDeferStats,statsBuf,0);
--- a/kerneltest/f32test/filesystem/fat/b_fat32.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/filesystem/fat/b_fat32.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -305,7 +305,7 @@
 //
     {
     static TBuf<6> str(_L("------"));
-    static char*   atr = "RHSVDA";
+    static char const *   atr = "RHSVDA";
     for (TInt i = 0; i < 6; i++)
         if ((aAttrib >> i) & 1)
             str[i] = atr[i];
--- a/kerneltest/f32test/filesystem/fat/t_scn32dr1.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/filesystem/fat/t_scn32dr1.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -519,7 +519,7 @@
 //
     {
     LOCAL_D TBuf<6> str;
-    LOCAL_D char*   atr = "RHSVDA";
+    LOCAL_D char const *   atr = "RHSVDA";
     str.Fill(TText('-'), 6);
     for (TInt i = 0; i < 6; i++)
         if ((aAttrib >> i) & 1)
@@ -1987,7 +1987,7 @@
         ReadFatDisk(fatBuf);
         }
 
-    // use first entry \scndrv\dir2\almostfull\ 
+    // use first entry \scndrv\dir2\almostfull
     test.Next(_L("Partial entry in middle of subdir"));
     last = GetStartCluster(gClusterDir2_AFull,7);
     TEntryInfo partial2(ClusterEntryToBytes(gClusterDir2_AFull,2),6);
@@ -1998,7 +1998,7 @@
     res=TestPartialEntry(partial2);
     test(res);
 
-    // reduce size of \scndrv\dir2\full\ 
+    // reduce size of \scndrv\dir2\full 
     test.Next(_L("Test directory reclaim"));
     last = GetStartCluster(gClusterDir2_Full,gEntriesPerCluster-2);
     WriteEndOfDir(ClusterEntryToBytes(gClusterDir2_Full,gEntriesPerCluster-2));
@@ -2018,7 +2018,7 @@
     res=IsSameAsDrive(fatBuf,dirBuf);
     test(res);
 
-    // use last entry of first cluster in \scndrv\dir2\full\ 
+    // use last entry of first cluster in \scndrv\dir2\full
     test.Next(_L("Partial entry at end of subdir"));
     r=temp.Create(TheFs,_L("\\scndrv\\dir2\\full\\temp"),EFileShareAny);
     test_KErrNone(r);
@@ -2030,7 +2030,7 @@
     res=TestPartialEntry(partial3);
     test(res);
 
-    // use entry in \scndrv\dir2\almostfull\ 
+    // use entry in \scndrv\dir2\almostfull 
     test.Next(_L("Partial entry preceeding end-of-dir marker"));
     last = GetStartCluster(gClusterDir2_AFull,14);
     if (last > 0)
@@ -2052,7 +2052,7 @@
 	//	as it is impossible for ScanDrive to judge if the illegal byte is part of a legal
 	//	DBCS charater.
 
-	// create entry in \scndrv\dir2\almostfull\ 
+	// create entry in \scndrv\dir2\almostfull 
 //	test.Next(_L("Partial entry with invalid dos name"));
 //	r=temp.Create(TheFs,_L("\\scndrv\\dir2\\almostfull\\Dodgy file name"),EFileShareAny);
 //	test_KErrNone(r);
@@ -2069,7 +2069,7 @@
 
     if (BootSector.SectorsPerCluster() == 1)
         {
-        // use entry created in \scndrv\dir2\ 
+        // use entry created in \scndrv\dir2 
         test.Next(_L("Partial entry spanning more than two clusters"));
         last = GetStartCluster(gClusterDir2_Full,gEntriesPerCluster-1);
         WriteEndOfDir(ClusterEntryToBytes(gClusterDir2_Full,gEntriesPerCluster-2));
@@ -2121,7 +2121,7 @@
     test(res);
 
     // matching entries between 2 subdirs, one which has a full cluster
-    // first entry in \scndrv\dir2\full\ + end of \scndrv\dir2\almostfull\ 
+    // first entry in \scndrv\dir2\full\ + end of \scndrv\dir2\almostfull
     test.Next(_L("matching entries between 2 subdirs"));
     TEntryInfo from2(ClusterEntryToBytes(gClusterDir2_Full,2),2);
     TEntryInfo to2(ClusterEntryToBytes(gClusterDir2_AFull,14),2);
@@ -2130,7 +2130,7 @@
     test(res);
 
     // matching entries between two subdirs - one with end of dir marker next
-    // \scndrv\dir2\somedirwith3entries to \scndrv\ 
+    // \scndrv\dir2\somedirwith3entries to \scndrv 
     test.Next(_L("matching entries between two subdirs"));
     TEntryInfo from3(ClusterEntryToBytes(gClusterDir2,4),3);
     TEntryInfo to3(ClusterEntryToBytes(gClusterScnDrv,6),3);
@@ -2139,7 +2139,7 @@
     test(res);
 
     // matching entries in same subdir, one in new cluster - irrelevant if matching names
-    // 1st and last entries in \scndrv\dir2\full\ 
+    // 1st and last entries in \scndrv\dir2\full 
     test.Next(_L("matching entries in same subdir"));
     // delete entries to allow contiguous clusters in \scndrv\dir2\full directory
     TInt r=TheFs.RmDir(_L("\\scndrv\\dir2\\somedirwith3entries\\"));
@@ -2161,7 +2161,7 @@
     res=TestMatchingEntry(to4);
     test(res);
 
-    // \scndrv\dir1\very long name to \\scndrv\dir2\full\ 
+    // \scndrv\dir1\very long name to \\scndrv\dir2\full 
     test.Next(_L("matching entries in diff dirs + new cluster"));
     // delete last entry in directory
     r=TheFs.Delete(LastInFull);
--- a/kerneltest/f32test/filesystem/fat/t_tscan32.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/filesystem/fat/t_tscan32.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -475,7 +475,7 @@
 //
 	{
 	LOCAL_D TBuf<6> str(_L("------"));
-	LOCAL_D char*   atr = "RHSVDA";
+	LOCAL_D char const *   atr = "RHSVDA";
 	for (TInt i = 0; i < 6; i++)
 		if ((aAttrib >> i) & 1)
 			str[i] = atr[i];
--- a/kerneltest/f32test/plugins/version_1/virus/t_virus.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/plugins/version_1/virus/t_virus.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -21,13 +21,13 @@
 #include <f32dbg.h>
 #include "t_server.h"
 
-GLREF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[]);
+GLREF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char const * aFileName);
 
 #define TEST_FOR_ERROR( r )	TestIfEqual( r, KErrNone, __LINE__, __FILE__)
 #define TEST_FOR_VALUE( r, expected ) TestIfEqual( r, expected, __LINE__, __FILE__)
 
 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char const *aFileName)
 	{
 	if( aExpected != aValue )
 		{
--- a/kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -24,7 +24,7 @@
 #include "encrypt.h"
 #include "hex.h"
 
-GLREF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[]);
+GLREF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char const * aFileName);
 
 #define TEST_FOR_ERROR( r )	{ TInt _r = (r); if (_r < 0) HandleError(_r, __LINE__); }
 #define TEST_FOR_VALUE( r, expected ) TestIfEqual( r, expected, __LINE__, __FILE__)
--- a/kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -578,7 +578,8 @@
 	while(__FILE__[i]!='\0')
 		{
 		fileName.SetLength(i+1);
-		fileName[i] = __FILE__[i++];
+		fileName[i] = __FILE__[i];
+		++i;
 		}
 	gFileName = fileName;
 
--- a/kerneltest/f32test/server/t_fatcharsetconv_main.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/server/t_fatcharsetconv_main.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -1341,7 +1341,8 @@
 			while(__FILE__[i]!='\0')
 				{
 				fileName.SetLength(i+1);
-				fileName[i] = __FILE__[i++];
+				fileName[i] = __FILE__[i];
+				++i;
 				}
 			gFileName.Append(fileName);
 			
--- a/kerneltest/f32test/server/t_fsrv.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/server/t_fsrv.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -297,7 +297,7 @@
         if (anInfo.iType==EMediaNotPresent)
             return;
 
-		test_Value(anInfo.iDriveAtt, anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal)==KDriveAttLocal|KDriveAttInternal);	// LFFS sets KDriveAttTransaction as well
+		test_Value(anInfo.iDriveAtt, (anInfo.iDriveAtt&(KDriveAttLocal|KDriveAttInternal))==(KDriveAttLocal|KDriveAttInternal));	// LFFS sets KDriveAttTransaction as well
         test_Value(anInfo.iType, anInfo.iType==EMediaFlash);
         test_Value(anInfo.iMediaAtt, anInfo.iMediaAtt==KMediaAttFormattable);
 		}
--- a/kerneltest/f32test/server/t_prel.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/server/t_prel.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -22,7 +22,7 @@
 EXPORT_C void FurtiveD(TFileName &aInfo)
 	{
 
-	char *dummy="Link unit for Preload test";
+	char const *dummy="Link unit for Preload test";
 	dummy=dummy;
 	TFileName name;
 	Dll::FileName(name);
--- a/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -45,7 +45,7 @@
 	}
 
 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char const *aFileName)
 	{
 	if( aExpected != aValue )
 		{
--- a/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.h	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.h	Mon Jul 19 14:32:36 2010 +0100
@@ -34,7 +34,7 @@
 GLDEF_C void t_scsi_prot();
 
 
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[]);
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char const * aFileName);
 #define TEST_FOR_VALUE( r, expected ) TestIfEqual( r, expected, __LINE__, __FILE__)
 
 #define TEST_SENSE_CODE( aSensePtr, aExpKey, aExtAddCode ) 		\
--- a/kerneltest/f32test/smassstorage/src/t_ms_main.cpp	Mon Jul 19 08:40:05 2010 +0100
+++ b/kerneltest/f32test/smassstorage/src/t_ms_main.cpp	Mon Jul 19 14:32:36 2010 +0100
@@ -38,7 +38,7 @@
 
 
 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char const * aFileName)
 	{
 	if( aExpected != aValue )
 		{