1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +03:00

0032119: Coding Rules - eliminate msvc warning C4800 (implicit cast to bool) after fix for 32115

Fixed incorrect comparison and forcing cast
This commit is contained in:
dpasukhi 2021-02-06 18:43:43 +03:00 committed by bugmaster
parent e03a03fdc2
commit 830616a60b
2 changed files with 10 additions and 10 deletions

@ -1219,13 +1219,13 @@ namespace step {
void step::parser::error(const std::string& m) void step::parser::error(const std::string& m)
{ {
char newmess[120]; char newmess[120];
Standard_Boolean isSyntax = (Standard_Boolean)strncmp(m.c_str(), "syntax error", 13); Standard_Boolean isSyntax = strncmp(m.c_str(), "syntax error", 12) == 0;
if (isSyntax && strlen(m.c_str()) > 13) if (isSyntax && m.length() > 13)
sprintf(newmess, "Undefined Parsing: Line %d: %s: %s", scanner->lineno() + 1, "Incorrect syntax", m.c_str() + 14); Sprintf(newmess, "Undefined Parsing: Line %d: %s: %s", scanner->lineno() + 1, "Incorrect syntax", m.c_str() + 14);
else if (isSyntax) else if (isSyntax)
sprintf(newmess, "Undefined Parsing: Line %d: Incorrect syntax", scanner->lineno() + 1); Sprintf(newmess, "Undefined Parsing: Line %d: Incorrect syntax", scanner->lineno() + 1);
else else
sprintf(newmess, "Undefined Parsing: Line %d: %s", scanner->lineno() + 1, m.c_str()); Sprintf(newmess, "Undefined Parsing: Line %d: %s", scanner->lineno() + 1, m.c_str());
StepFile_Interrupt(newmess, Standard_False); StepFile_Interrupt(newmess, Standard_False);

@ -181,13 +181,13 @@ enttype : TYPE
void step::parser::error(const std::string& m) void step::parser::error(const std::string& m)
{ {
char newmess[120]; char newmess[120];
Standard_Boolean isSyntax = (Standard_Boolean)strncmp(m.c_str(), "syntax error", 13); Standard_Boolean isSyntax = strncmp(m.c_str(), "syntax error", 12) == 0;
if (isSyntax && strlen(m.c_str()) > 13) if (isSyntax && m.length() > 13)
sprintf(newmess, "Undefined Parsing: Line %d: %s: %s", scanner->lineno() + 1, "Incorrect syntax", m.c_str() + 14); Sprintf(newmess, "Undefined Parsing: Line %d: %s: %s", scanner->lineno() + 1, "Incorrect syntax", m.c_str() + 14);
else if (isSyntax) else if (isSyntax)
sprintf(newmess, "Undefined Parsing: Line %d: Incorrect syntax", scanner->lineno() + 1); Sprintf(newmess, "Undefined Parsing: Line %d: Incorrect syntax", scanner->lineno() + 1);
else else
sprintf(newmess, "Undefined Parsing: Line %d: %s", scanner->lineno() + 1, m.c_str()); Sprintf(newmess, "Undefined Parsing: Line %d: %s", scanner->lineno() + 1, m.c_str());
StepFile_Interrupt(newmess, Standard_False); StepFile_Interrupt(newmess, Standard_False);