mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0032903: Coding Rules - eliminate MSVC warning C26451 on VS2019/C++20
Put explicit type casting to avoid: Warning C26451 Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).
This commit is contained in:
@@ -271,7 +271,7 @@ public: //! @name Preparation methods
|
||||
if (!theName.IsEmpty())
|
||||
{
|
||||
myIsOwnName = true;
|
||||
myName = (char* )Standard::Allocate (theName.Length() + 1);
|
||||
myName = (char* )Standard::Allocate (Standard_Size(theName.Length()) + Standard_Size(1));
|
||||
char* aName = (char* )myName;
|
||||
memcpy (aName, theName.ToCString(), theName.Length());
|
||||
aName[theName.Length()] = '\0';
|
||||
|
Reference in New Issue
Block a user