Question on dubious code

Matteo Casalin matteo.casalin at
Sat Oct 5 10:45:07 PDT 2013

Hi all,
     in sw/source/core/graphic/ndgrf.cxx I stepped into the following 
code in function lcl_GetStreamStorageNames (this is after OUString 

     const OUString aProt( "" );
     if (sUserData.startsWith(aProt))
         // 6.0 (XML) Package
         const sal_Int32 nPos = sUserData.indexOf('/');
         if (nPos<0)
             aNames.sStream = sUserData.copy(aProt.getLength());
             sal_Int32 nPathStart = aProt.getLength();
             if (sUserData.startsWith("./"))
                 nPathStart += 2;
             aNames.sStorage = sUserData.copy( nPathStart, 
nPos-nPathStart );
             aNames.sStream = sUserData.copy( nPos+1 );

which looks wrong to me since aUserData cannot start with both aProt and 
".". I had a look at older revisions, but the logic remains the same at 
least from when it was integrated in 2005 with commit 

Does anybody knows ho to deal with this (the comparison with "./" should 
be done after aProt, is completely unnecessary, or something else)?

Thanks and kind regards

PS: with OpenGrok I found some other locations in which 
"" is used, with also #define in two header files:


I don't have the necessary background, but maybe there could be some 
room for sharing code.

More information about the LibreOffice mailing list