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

0026781: Coding rules - eliminate GCC warning -Wunused-result

Check return code of fgets() and system() within FSD_BinaryFile::ReadChar(),
IFSelect_SessionFile::ReadFile(), IFSelect_SessionPilot::ReadScript(),
OSD_File::Print(), OSD_Process::Spawn(), RWStl::ReadAscii(), iges_lire().
This commit is contained in:
rkv
2015-10-28 10:13:28 +03:00
committed by bugmaster
parent 71958f7db2
commit 9816003815
8 changed files with 42 additions and 21 deletions

View File

@@ -750,7 +750,8 @@ TCollection_AsciiString PrinterName;
else
sprintf(buffer,"lpr -P%s %s",PrinterName.ToCString(),aBuffer.ToCString());
system(buffer);
if (system(buffer) != 0)
Standard_ProgramError::Raise("OSD_File::Print : No output device was available, or an error occurred");
}

View File

@@ -36,10 +36,10 @@ OSD_Process::OSD_Process(){
}
void OSD_Process::Spawn (const TCollection_AsciiString& cmd,
Standard_Integer OSD_Process::Spawn (const TCollection_AsciiString& cmd,
const Standard_Boolean /*ShowWindow*/)
{
system(cmd.ToCString());
return system(cmd.ToCString());
}
@@ -206,11 +206,13 @@ OSD_Process :: OSD_Process () {
} // end constructor
void OSD_Process :: Spawn ( const TCollection_AsciiString& cmd ,
Standard_Integer OSD_Process::Spawn (const TCollection_AsciiString& cmd,
const Standard_Boolean ShowWindow /* = Standard_True */) {
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD aRes = 0;
ZeroMemory ( &si, sizeof ( STARTUPINFO ) );
@@ -229,20 +231,22 @@ void OSD_Process :: Spawn ( const TCollection_AsciiString& cmd ,
if (!CreateProcess (
NULL, (char *)cmd.ToCString (), NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi
)
)
) {
_osd_wnt_set_error ( myError, OSD_WProcess );
aRes = myError.Error();
}
else {
CloseHandle ( pi.hThread );
WaitForSingleObject ( pi.hProcess, INFINITE );
GetExitCodeProcess (pi.hProcess, &aRes);
CloseHandle ( pi.hProcess );
} // end else
return aRes;
} // end OSD_Process :: Spawn
void OSD_Process :: TerminalType ( TCollection_AsciiString& Name ) {

View File

@@ -43,7 +43,7 @@ public:
//! Issues a shell command
//! ShowWindow : flag to allow show/hide of the window ( only used on WNT )
Standard_EXPORT void Spawn (const TCollection_AsciiString& cmd, const Standard_Boolean ShowWindow = Standard_True);
Standard_EXPORT Standard_Integer Spawn (const TCollection_AsciiString& cmd, const Standard_Boolean ShowWindow = Standard_True);
//! Returns the terminal used (vt100, vt200 ,sun-cmd ...)
Standard_EXPORT void TerminalType (TCollection_AsciiString& Name);