]> OCCT Git - occt.git/commitdiff
Coding - Resolving C26439 & type formatting warnings
authordpasukhi <dpasukhi@opencascade.com>
Tue, 10 Sep 2024 17:40:12 +0000 (17:40 +0000)
committerdpasukhi <dpasukhi@opencascade.com>
Sat, 14 Sep 2024 20:26:41 +0000 (20:26 +0000)
Sprintf  with %s always convert values into char*, not safety from int.
Move operators and constructors can be marked as noexcept

src/BOPTest/BOPTest_BOPCommands.cxx
src/NCollection/NCollection_DynamicArray.hxx
src/NCollection/NCollection_UtfString.hxx
src/NCollection/NCollection_UtfString.lxx

index 7ea2cdb65a6489ffd7d4846172ef1753265ef3d3..e870df16ace96d4f3b2a5f2f1a71f2cd97f22ea4 100644 (file)
@@ -229,7 +229,6 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
     return 0;
   }
   //
-  char buf[64];
   Standard_Boolean bRunParallel;
   Standard_Integer aNb;
   BOPAlgo_BOP aBOP;
@@ -237,8 +236,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
   const TopTools_ListOfShape& aLC=pPF->Arguments();
   aNb=aLC.Extent();
   if (aNb!=2) {
-    Sprintf (buf, " wrong number of arguments %s\n", aNb);
-    di << buf;
+    di << " wrong number of arguments " << aNb << '\n';
     return 0;
   }
   // 
@@ -298,7 +296,6 @@ Standard_Integer bopsection(Draw_Interpretor& di,
     return 0;
   }
   //
-  char buf[64];
   Standard_Boolean bRunParallel;
   Standard_Integer aNb;
   BOPAlgo_Section aBOP;
@@ -306,8 +303,7 @@ Standard_Integer bopsection(Draw_Interpretor& di,
   const TopTools_ListOfShape& aLC=pPF->Arguments();
   aNb=aLC.Extent();
   if (aNb!=2) {
-    Sprintf (buf, " wrong number of arguments %s\n", aNb);
-    di << buf;
+    di << " wrong number of arguments " << aNb << '\n';
     return 0;
   }
   //
index ac93f529086ea5475c1705a786052dc24dedde1f..fa303e4f80d7bab8681d66643dfc59388f47bc35 100644 (file)
@@ -240,7 +240,7 @@ public: //! @name public methods
   }
 
   //! Assignment operator
-  NCollection_DynamicArray& operator= (NCollection_DynamicArray&& theOther)
+  NCollection_DynamicArray& operator= (NCollection_DynamicArray&& theOther) noexcept
   {
     return Assign(std::forward<NCollection_DynamicArray>(theOther));
   }
index 58792a5dea3c56b2231ce88205688231c793a885..a3fe1da1a9c6cd71299f2dfa0b820daf105eab62 100755 (executable)
@@ -81,7 +81,7 @@ public:
   NCollection_UtfString (const NCollection_UtfString& theCopy);
 
   //! Move constructor
-  NCollection_UtfString (NCollection_UtfString&& theOther);
+  NCollection_UtfString (NCollection_UtfString&& theOther) noexcept;
 
   //! Copy constructor from UTF-8 string.
   //! @param theCopyUtf8 UTF-8 string to copy
index 839b86bc787d81ff457f076c1d2f616dd57ec2a4..4409840f655a01f5db3dd94d8ae0aeefaa425616 100755 (executable)
@@ -95,7 +95,7 @@ NCollection_UtfString<Type>::NCollection_UtfString (const NCollection_UtfString&
 // purpose  :
 // =======================================================================
 template<typename Type> inline
-NCollection_UtfString<Type>::NCollection_UtfString (NCollection_UtfString&& theOther)
+NCollection_UtfString<Type>::NCollection_UtfString (NCollection_UtfString&& theOther) noexcept
 : myString(theOther.myString),
   mySize  (theOther.mySize),
   myLength(theOther.myLength)