Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 09/08/12 11:09, Caolán McNamara wrote:
 sw/source/filter/ww1/fltshell.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 3a1c8eeb694e26835f6f9c010b5d305b57ddd0d5
Author: Caolán McNamara <caolanm@redhat.com>
Date:   Thu Aug 9 10:06:44 2012 +0100

    rtl::OUStrings are supposed to be immutable
    
    The cast away of constness in d64ecf4e94a81d9c1fd4be74c098eb0e58345c60 makes me
    feel icky

not only that, it can be a real bug as well (though isn't in this case).
the OUString, or more precisely the buffer it holds, is immutable by
design, and has a intern() method that effectively enters it into a
global hash-table; if an intern()ed string is later modified then that
hash table is going to be very unhappy (about unhappy hashtables, see
also 3ea6b1c1594fa3fdb7e13c544b3beecd369b67d0).

-    OUString sOut( rIn );
+    OUStringBuffer sOut( rIn );

             if( bAllowCr )
-            {
-                sal_Unicode* pStr = (sal_Unicode*)sOut.getStr();
-                pStr[n] = (sal_Unicode)'\n';
-            }
+                sOut[n] = '\n';

right: if you want to modify an OUString, use OUStringBuffer, that's why
it exists.



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.