[Libreoffice] [PATCH] Replace ByteString with rtl::OString

Chr. Rossmanith ChrRossmanith at gmx.de
Wed Jan 4 14:06:09 PST 2012


Am 02.01.2012 23:26, schrieb Eike Rathke:
>
>>           if( ! aToken.compareToAscii( "pdf=", 4 ) )
>>           {
>>               sal_Int32 nPos = 0;
>>               aDir = aToken.getToken( 1, '=', nPos );
>> -            if( ! aDir.Len() )
>> -                aDir = String( ByteString( getenv( "HOME" ) ), osl_getThreadTextEncoding() );
>> +            if( aDir.isEmpty() )
>> +                aDir = rtl::OUString( getenv( "HOME" ), 4, osl_getThreadTextEncoding() );
> Trapped ;-)  The string isn't constructed of the word HOME, but the
> content of the HOME environment variable instead, so assuming 4 here
> isn't correct.
I've corrected that and checked for NULL.
> Besides that, already the original code didn't deal with a possible NULL
> pointer returned by getenv() in case a HOME variable wasn't set at all..
> that should be handled instead of relying on some OUString (back then
> String) magic, which it seems OUString does not silently do and would
> crash instead if a length>0 was passed.
>
> Otherwise the patch looks good.
I've finished genprnpsp.cxx and had to touch some related files as well 
(but didn't finish them yet). After a review and removing some 
unnecessary rtl:: prefices I'd like to push this modified patch.

Thank you for reviewing!

Christina


More information about the LibreOffice mailing list