Apache OpenOffice (AOO) Bugzilla – Issue 70752
unhelpful string constructors ...
Last modified: 2017-05-20 11:33:52 UTC
The existing string constructors cause problems because people do: String( ...CONST_ASCII_PARAM("foo")) and this bogusly passes the length as the textencoding to the string: UniString( const sal_Char* pByteStr, rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS ); Which is deadly broken - a number of these happen on OO.o startup, see bug i#70166#. In order to do anything, I'd like a design that would be acceptable up-stream, an idea might be some: class StringEncoding { rtl_TextEncoding eEncoding; public: explicit StringEncoding( rtl_TextEncoding eFoo ) : eEncoding (eFoo) {} }; ... UniString( const sal_Char* pByteStr, - rtl_TextEncoding eTextEncoding, + StringEncoding aTextEncoding, sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS ); or whatever you like. Thanks.
taken over
I would suggest to just drop UniString( const sal_Char* pByteStr, rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS); and only keep UniString( const sal_Char* pByteStr, xub_StrLen nLen, rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags = BYTESTRING_TO_UNISTRING_CVTFLAGS); and do an incompatible cleanup from tools upwards. (ByteString, rtl::OUString, rtl::OString seem to not have any equally problematic functions, by the way.) @kr,mt: Are you planning on any tools string changes, anyway? Otherwise, I would suggest we do this on a OOo 2.x target (I assume there are not too many occurrences of that constructor).
It appears that issue 70166 will introduce some code to work around consequences of this issue. That work-around code should be removed once this issue is fixed.
Removing the c'tor looks fine for me!
Valid uses of the to-be-dropped ctor String(p, enc[, flags]) can be replaced with String(p, STRING_LEN, enc[, flags]) see tools/source/string/strucvt.cxx:1.10 l. 115--116.
according to release status meeting -> target 3.x
Reset assigne to the default "issues@openoffice.apache.org".