Issue 123068

Summary: remove implicit rtl::O*String conversions to char/utf-16 pointers
Product: General Reporter: hdu <hdu>
Component: codeAssignee: hdu <hdu>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: issues
Version: 4.0.0   
Target Milestone: 4.1.0   
Hardware: All   
OS: All   
Issue Type: TASK Latest Confirmation in: 4.0.0
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 123107, 122208    

Description 2013-08-19 16:24:44 UTC
The implicit conversions from string to pointers are dangerous. Checking the AOO codebase for problems caused by it finds several problems:

- string concatenations that assume the Java-behavior that adding a value to a string results in a string and the string-value to be concatenated. Instead the the value does some pointer arithmetic with the string buffer address

- tests that assume that there is an OUString to bool operator that checks for the emptiness of the string. This assumption is not only wrong but the implicit OUString->pointer conversion and the fact that an empty rtl-string's buffer doesn't point to NULL result in a wrong answer.

- unexpected template specializations being created
Comment 1 SVN Robot 2013-08-20 10:48:47 UTC
"hdu" committed SVN revision 1515767 into branches/rejuvenate01:
#i123068# remove implicit conversions from rtl strings to their elements
Comment 2 2013-08-20 11:45:24 UTC
Fixed with the commit above.

It shows that additionally to the three problem categories outlined above an implicit conversion from the reference counted rtl strings to unmanaged plain pointers introduces the risk that lifetime issues for the character buffer are introduced. 

An example for that risk is the assignment to SfxSlot's pName member in SfxShell::setVerbs(). It was converted 1:1 for now but the lifetime of the buffer is so suspicious that it needs to be analyzed
Comment 3 SVN Robot 2013-08-21 11:19:22 UTC
"hdu" committed SVN revision 1516138 into branches/rejuvenate01:
#i123068# remove more implicit conversions from rtl strings to their elements
Comment 4 SVN Robot 2013-08-22 08:51:18 UTC
"hdu" committed SVN revision 1516387 into branches/rejuvenate01:
#i123068# replace implicit conversion in migration/wizard
Comment 5 SVN Robot 2013-11-28 15:52:33 UTC
"hdu" committed SVN revision 1546390 into trunk:
#i123068# remove implicit conversions from rtl strings to their elements
Comment 6 SVN Robot 2013-11-29 15:13:42 UTC
"hdu" committed SVN revision 1546578 into trunk:
#i123068# allow OString argument for tools' DbgOut() function
Comment 7 SVN Robot 2014-02-05 07:19:11 UTC
"hdu" committed SVN revision 1564650 into trunk:
#i123068# remove implicit conversion from aUTF8String to its char pointer
Comment 8 2014-04-01 12:26:28 UTC
Closing the resolved issue.