]> OCCT Git - occt-copy.git/commitdiff
0031113: Foundation Classes - TCollection_ExtendedString constructor from CString... CR31113
authorabv <abv@opencascade.com>
Sat, 24 Oct 2020 19:46:35 +0000 (22:46 +0300)
committerabv <abv@opencascade.com>
Sat, 24 Oct 2020 19:46:35 +0000 (22:46 +0300)
In constructor of TCollection_ExtendedString from Standard_CSTring (const char*), default value for the second argument (isMultiByte) is changed from False to True, for consistency with constructor from TCollection_AsciiString and adopted approach of using UTF-8 encoding for Unicode strings across OCCT.

src/DDataStd/DDataStd_BasicCommands.cxx
src/DDataStd/DDataStd_NameCommands.cxx
src/TCollection/TCollection_ExtendedString.hxx
src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx

index 6816f6a58744bf48995826801492001debf26b8d..f9f0d05f0e0a6e001ecb4aa20bb45f2ca49d3044 100644 (file)
@@ -208,7 +208,7 @@ static Standard_Integer DDataStd_SetComment (Draw_Interpretor& di,
     if (!DDF::GetDF(arg[1],DF)) return 1;
     TDF_Label L;
     DDF::AddLabel(DF, arg[2], L);
-    TDataStd_Comment::Set(L,TCollection_ExtendedString(arg[3],Standard_True));  
+    TDataStd_Comment::Set(L,arg[3]);
     return 0;
   }
   di << "DDataStd_SetComment : Error\n";
index 321422749d6bf0a773d2a09c5c18024a4eb8208e..1895197f5dfb09aeb3b37d8edd46add7b5804c7f 100644 (file)
@@ -64,7 +64,7 @@ static Standard_Integer DDataStd_SetName (Draw_Interpretor& di,
         return 1;
          }
          Standard_GUID guid(arg[4]);
-         TDataStd_Name::Set(L, guid, TCollection_ExtendedString(arg[3],Standard_True)); 
+         TDataStd_Name::Set(L, guid, arg[3]); 
      }
     return 0;
   }
index 3e16ca49dcd18465b8b734c1ce4a5be6efb50aae..dbdb3bd09f868e12cb8c3312a96caa0afed19b53 100644 (file)
@@ -63,13 +63,14 @@ public:
   //! Initializes a ExtendedString to an empty ExtendedString.
   Standard_EXPORT TCollection_ExtendedString();
   
-  //! Creation by converting a CString to an extended
-  //! string.  If <isMultiByte> is true then the string is
-  //! treated as having UTF-8 coding.  If it is not a UTF-8
-  //! then <isMultiByte> is ignored and each character is
-  //! copied to ExtCharacter.
-  Standard_EXPORT TCollection_ExtendedString(const Standard_CString astring, const Standard_Boolean isMultiByte = Standard_False);
-  
+  //! Creation by converting a plain C string to an extended string.
+  //! If @p isMultiByte is true then @p theString is treated as having UTF-8 encoding.
+  //! If @p isMultiByte is true but @p theString is not a valid UTF-8 string, 
+  //! or if @p isMultiByte is false, then each character of @p theString is
+  //! copied to ExtCharacter (as if @p theString was in ISO 8859-1 code page).
+  Standard_EXPORT TCollection_ExtendedString(const Standard_CString theString, 
+                                             const Standard_Boolean isMultiByte = Standard_True);
+
   //! Creation by converting an ExtString to an extended string.
   Standard_EXPORT TCollection_ExtendedString(const Standard_ExtString astring);
 
index 0eb954617bf47119e575c2d99ab05fb5afb41cae..3d8b497b4e5ce8a076838c49bf9eef9123c346c0 100644 (file)
@@ -201,7 +201,7 @@ static Standard_Integer ReadGltf (Draw_Interpretor& theDI,
     else
     {
       Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
-      TDataStd_Name::Set (aDoc->GetData()->Root(), aDestName.ToCString());
+      TDataStd_Name::Set (aDoc->GetData()->Root(), aDestName);
       Draw::Set (aDestName.ToCString(), aDrawDoc);
     }
   }
@@ -604,7 +604,7 @@ static Standard_Integer ReadObj (Draw_Interpretor& theDI,
     else
     {
       Handle(DDocStd_DrawDocument) aDrawDoc = new DDocStd_DrawDocument (aDoc);
-      TDataStd_Name::Set (aDoc->GetData()->Root(), aDestName.ToCString());
+      TDataStd_Name::Set (aDoc->GetData()->Root(), aDestName);
       Draw::Set (aDestName.ToCString(), aDrawDoc);
     }
   }