1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023947: Eliminate trivial compiler warnings in MSVC++ with warning level 4

Fix first subset of warnings (about 100)
- while(1) and similar constructs replaced by for(;;)
- some uninitialized variables corrected
Got rid of Warning C4189: local variable is initialised but not referenced
Corrected mistakes after getting rid of C4189 compiler warning
Corrected some mistakes that led to compiling errors
Fixed test case because of improvement message - removed unnecessary TODO.
Small fix: tabs have been replaced with whitespaces.
Added TODO for Windows platform
removed last TODO
Corrected mistakes, returned some #ifdef DEB code, fixed test case .
Restoring a few places which have been modified too much
Small grammar fix
Deleted unnecessary puts in bugs/end
This commit is contained in:
omy
2013-07-12 12:37:38 +04:00
parent a8195d65ba
commit 302f96fb0d
189 changed files with 455 additions and 1010 deletions

View File

@@ -42,7 +42,8 @@ Standard_Boolean OSD::RealToCString(const Standard_Real aReal,
// Suppress "e+00" and unsignificant 0's
if ((p = strchr(aString,'e'))) {
p = strchr(aString,'e');
if (p) {
if (!strcmp(p,"e+00"))
*p = 0 ;
for (q = p-1 ; *q == '0' ; q--) ;

View File

@@ -327,7 +327,7 @@ Standard_Integer OSD_DirectoryIterator :: Error () const {
OSD_DirectoryIterator::OSD_DirectoryIterator() {}
void OSD_DirectoryIterator::Initialize(
const OSD_Path& where,
const TCollection_AsciiString& Mask){}
const OSD_Path& /*where*/,
const TCollection_AsciiString& /*Mask*/){}
#endif

View File

@@ -329,7 +329,7 @@ Standard_Integer OSD_Disk :: DiskQuota () {
} // end OSD_Disk :: DiskQuota
void OSD_Disk :: SetDiskQuota ( const Standard_Integer QuotaSize ) {
void OSD_Disk :: SetDiskQuota ( const Standard_Integer /*QuotaSize*/ ) {
SetLastError ( ( DWORD )STG_E_UNIMPLEMENTEDFUNCTION );

View File

@@ -960,9 +960,8 @@ void OSD_File :: Build (
// Open a file
// ---------------------------------------------------------------------
void OSD_File :: Open (
const OSD_OpenMode Mode, const OSD_Protection& Protect
) {
void OSD_File :: Open (const OSD_OpenMode Mode, const OSD_Protection& /*Protect*/)
{
TCollection_AsciiString fName;
@@ -1516,7 +1515,7 @@ void OSD_File :: Seek (
const Standard_Integer Offset, const OSD_FromWhere Whence
) {
DWORD dwMoveMethod;
DWORD dwMoveMethod = 0;
TEST_RAISE( TEXT( "Seek" ) );
@@ -1940,7 +1939,7 @@ PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd (
PTOKEN_OWNER pTkOwner = NULL;
PTOKEN_GROUPS pTkGroups = NULL;
PTOKEN_PRIMARY_GROUP pTkPrimaryGroup = NULL;
PSECURITY_DESCRIPTOR retVal;
PSECURITY_DESCRIPTOR retVal = NULL;
PSECURITY_DESCRIPTOR pfSD = NULL;
BOOL fDummy;
PFILE_ACE pFileACE;
@@ -2388,7 +2387,7 @@ static int __fastcall _get_buffer (
static DWORD __fastcall _get_access_mask ( OSD_SingleProtection prt ) {
DWORD retVal;
DWORD retVal = 0;
switch ( prt ) {
@@ -2500,7 +2499,7 @@ static DWORD __fastcall _get_access_mask ( OSD_SingleProtection prt ) {
static DWORD __fastcall _get_dir_access_mask ( OSD_SingleProtection prt ) {
DWORD retVal;
DWORD retVal = 0;
switch ( prt ) {
@@ -2617,7 +2616,7 @@ static HANDLE __fastcall _open_file (
) {
HANDLE retVal = INVALID_HANDLE_VALUE;
DWORD dwDesiredAccess;
DWORD dwDesiredAccess = 0;
DWORD dwCreationDistribution;
switch ( oMode ) {
@@ -2680,7 +2679,7 @@ Standard_Integer __fastcall _get_file_type (
Standard_CString fName, Standard_Integer fileHandle
) {
Standard_Integer retVal;
Standard_Integer retVal = 0;
DWORD dwType;
int fileType;
@@ -3049,9 +3048,9 @@ static OSD_SingleProtection __fastcall _get_protection_dir ( DWORD mask ) {
BOOL __fastcall _osd_print (const Standard_PCharacter pName, Standard_CString fName ) {
BOOL fOK, fJob;
HANDLE hPrinter;
HANDLE hPrinter = NULL;
BYTE jobInfo[ MAX_PATH + sizeof ( DWORD ) ];
DWORD dwNeeded, dwCode;
DWORD dwNeeded, dwCode = 0;
fOK = fJob = FALSE;
@@ -3187,7 +3186,7 @@ Standard_Boolean OSD_File::ReadLastLine(TCollection_AsciiString& aLine,const Sta
if (Count <= 0)
return Standard_False ;
while(1) {
for(;;) {
ReadLine(aLine, MaxLength, Len) ;
if (!aLine.IsEmpty())
return Standard_True ;

View File

@@ -411,7 +411,7 @@ Standard_Integer OSD_FileIterator :: Error () const {
OSD_FileIterator::OSD_FileIterator() {}
void OSD_FileIterator::Initialize(
const OSD_Path& where,
const TCollection_AsciiString& Mask){}
const OSD_Path& /*where*/,
const TCollection_AsciiString& /*Mask*/){}
#endif

View File

@@ -851,7 +851,7 @@ Quantity_Date OSD_FileNode::CreationMoment () {
Standard_Integer OSD_FileNode::UserId () {
PSID pSIDowner = NULL;
PSID retVal;
PSID retVal = NULL;
BOOL fDefaulted;
TCollection_AsciiString fName;
PSECURITY_DESCRIPTOR pSD;
@@ -1002,7 +1002,7 @@ static BOOL __fastcall _get_file_time (
FILETIME ftCreationTime;
FILETIME ftLastWriteTime;
LPFILETIME lpftPtr;
HANDLE hFile;
HANDLE hFile = INVALID_HANDLE_VALUE;
__try {

View File

@@ -246,7 +246,7 @@ OSD_Host :: OSD_Host () {
DWORD nSize;
Standard_Character szHostName[ MAX_COMPUTERNAME_LENGTH + 1 ];
char* hostAddr;
char* hostAddr = 0;
MEMORYSTATUS ms;
WSADATA wd;
PHOSTENT phe;
@@ -258,6 +258,7 @@ OSD_Host :: OSD_Host () {
nSize = MAX_COMPUTERNAME_LENGTH + 1;
osVerInfo.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO );
ZeroMemory (&ms, sizeof(ms));
ZeroMemory ( szHostName, sizeof ( Standard_Character ) * (MAX_COMPUTERNAME_LENGTH + 1) );
if ( !GetVersionEx ( &osVerInfo ) ) {

View File

@@ -39,6 +39,11 @@
static OSD_MAllocHook::Callback* MypCurrentCallback = NULL;
namespace {
// dummy function to call at place where break point might be needed
inline void place_for_breakpoint () {}
};
//=======================================================================
//function : GetCallback
//purpose :
@@ -414,11 +419,9 @@ void OSD_MAllocHook::LogFileHandler::AllocEvent
myMutex.Lock();
myLogFile << "alloc "<< std::setw(10) << theRequestNum
<< std::setw(20) << theSize << std::endl;
myMutex.Unlock();
if (myBreakSize == theSize)
{
int a = 1;
}
place_for_breakpoint();
myMutex.Unlock();
}
}
@@ -562,9 +565,7 @@ void OSD_MAllocHook::CollectBySize::AllocEvent
long /*theRequestNum*/)
{
if (myBreakSize == theSize)
{
int a = 1;
}
place_for_breakpoint();
if (theSize > 0)
{
myMutex.Lock();

View File

@@ -1209,7 +1209,7 @@ void OSD_Path :: SystemName (
} // end OSD_Path :: SystemName
Standard_Boolean OSD_Path :: IsValid (
const TCollection_AsciiString& aDependentName,
const TCollection_AsciiString& /*aDependentName*/,
const OSD_SysType aSysType
) const {
@@ -1263,7 +1263,7 @@ Standard_Integer OSD_Path :: TrekLength () const {
return retVal;
while ( Standard_True ) {
for (;;) {
if ( myTrek.Token ( TEXT( "|" ), i++ ).IsEmpty () )

View File

@@ -340,7 +340,7 @@ Standard_Boolean OSD_Process :: IsSuperUser () {
Standard_Boolean retVal = FALSE;
PSID pSIDadmin;
HANDLE hProcessToken = INVALID_HANDLE_VALUE;
PTOKEN_GROUPS pTKgroups;
PTOKEN_GROUPS pTKgroups = NULL;
if ( !OpenProcessToken (
GetCurrentProcess (),

View File

@@ -298,7 +298,7 @@ Standard_CString OSD_SharedLibrary :: Name () const {
} // end OSD_SharedLibrary :: Name
Standard_Boolean OSD_SharedLibrary :: DlOpen ( const OSD_LoadMode Mode ) {
Standard_Boolean OSD_SharedLibrary :: DlOpen ( const OSD_LoadMode /*Mode*/ ) {
Standard_Boolean retVal = Standard_True;

View File

@@ -911,7 +911,7 @@ BOOL MoveDirectory ( LPCTSTR oldDir, LPCTSTR newDir ) {
LPTSTR pathSrc, pathDst;
HANDLE hFindFile;
BOOL fFind;
BOOL retVal;
BOOL retVal = FALSE;
DIR_RESPONSE response;
DWORD level;
@@ -1043,16 +1043,14 @@ retry:
if ( pFD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
if ( !( retVal = MoveDirectory ( pFullNameSrc, pFullNameDst ) ) ) break;
retVal = MoveDirectory ( pFullNameSrc, pFullNameDst );
if (!retVal) break;
} else {
retry_1:
if ( !( retVal = MoveFileEx (
pFullNameSrc, pFullNameDst,
MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED
)
)
) {
retVal = MoveFileEx (pFullNameSrc, pFullNameDst,
MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED);
if (! retVal) {
if ( _response_dir_proc != NULL ) {
@@ -1142,7 +1140,7 @@ retry_2:
/***/
BOOL CopyDirectory ( LPCTSTR dirSrc, LPCTSTR dirDst ) {
PWIN32_FIND_DATA pFD;
PWIN32_FIND_DATA pFD = NULL;
LPTSTR pName = NULL;
LPTSTR pFullNameSrc = NULL;
LPTSTR pFullNameDst = NULL;
@@ -1203,11 +1201,13 @@ BOOL CopyDirectory ( LPCTSTR dirSrc, LPCTSTR dirDst ) {
if ( pFD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
if ( !( retVal = CopyDirectory ( pFullNameSrc, pFullNameDst ) ) ) break;
retVal = CopyDirectory ( pFullNameSrc, pFullNameDst );
if ( ! retVal ) break;
} else {
retry:
if ( !( retVal = CopyFile ( pFullNameSrc, pFullNameDst, FALSE ) ) ) {
retVal = CopyFile ( pFullNameSrc, pFullNameDst, FALSE );
if ( ! retVal ) {
if ( _response_dir_proc != NULL ) {

View File

@@ -403,7 +403,8 @@ void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
SetConsoleCtrlHandler (&_osd_ctrl_break_handler, TRUE);
#ifdef _MSC_VER
_se_translator_function pOldSeFunc = _set_se_translator (TranslateSE);
// _se_translator_function pOldSeFunc =
_set_se_translator (TranslateSE);
#endif
fFltExceptions = theFloatingSignal;
@@ -533,7 +534,7 @@ LONG _osd_debug ( void ) {
if ( !fDbgLoaded ) {
HKEY hKey;
HKEY hKey = NULL;
HANDLE hEvent = INVALID_HANDLE_VALUE;
DWORD dwKeyType;
DWORD dwValueLen;
@@ -620,12 +621,12 @@ LONG _osd_debug ( void ) {
//void OSD::Handler(const OSD_Signals aSig,
// const OSD_Signals aCode){}
void OSD::Handler(const OSD_Signals theSignal,
const Standard_Address theSigInfo,
const Standard_Address theContext) {}
void OSD::Handler(const OSD_Signals /*theSignal*/,
const Standard_Address /*theSigInfo*/,
const Standard_Address /*theContext*/) {}
void OSD::SegvHandler(const OSD_Signals aSig,
const Standard_Address code,
const Standard_Address scp){}
void OSD::SegvHandler(const OSD_Signals /*aSig*/,
const Standard_Address /*code*/,
const Standard_Address /*scp*/){}
#endif // WNT