Strange line in sal/osl/unx/profile.c

Stephan Bergmann sbergman at redhat.com
Mon Jul 16 01:52:16 PDT 2012


On 07/14/2012 01:01 AM, julien2412 wrote:
> Cppcheck reported this :
> [sal/osl/unx/profile.c:1306] -> [sal/osl/unx/profile.c:1306]: (style) Same
> expression on both sides of '|'
>     1306         if ( Flags & (osl_Profile_WRITELOCK | osl_Profile_WRITELOCK
> ) )
>     1307         {
>     1308             OslProfile_lockFile(pFile, un_lock);
>     1309         }
>
> in comparison, there's on sal/osl/w32/profile.cxx this :
>     1225     if ( ProfileFlags & (osl_Profile_WRITELOCK |
> osl_Profile_READLOCK ) )
>     1226     {
>     1227 #ifdef DEBUG_OSL_PROFILE
>     1228         OSL_TRACE("locking '%s' file",pszFilename);
>     1229 #endif
>     1230
>     1231         lockFile(pFile, bWriteable ? write_lock : read_lock);
>     1232     }
>
> Should the if part in profile.c simply replaced by :
>    if ( Flags & (osl_Profile_WRITELOCK | osl_Profile_READLOCK ) )
> or is it less obvious ?

Looks like it should indeed be changed to WRITELOCK | READLOCK.  (Note 
that that whole profile stuff is deprecated, so the broken code likely 
makes no difference in practice.)

Stephan


More information about the LibreOffice mailing list