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 <caol...@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. _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice