Re: harmful code??

2020-04-25 Thread Peter Kovacs

*facepalm* Yea of course.

Am 25.04.20 um 14:18 schrieb Damjan Jovanovic:

On Sat, Apr 25, 2020 at 2:11 PM Peter Kovacs  wrote:


Hello all,

I hunt some Warnings and Errors that get logged during build.

I stumbled over this code here in file_misc.cxx [1]:

684
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#684>*static*

oslFileError
<
http://opengrok.openoffice.org/openoffice/s?defs=oslFileError&project=trunk>

oslDoMoveFile
<
http://opengrok.openoffice.org/openoffice/s?refs=oslDoMoveFile&project=trunk>(

*const* sal_Char
*

pszPath
,
*const* sal_Char
*

pszDestPath
<
http://opengrok.openoffice.org/openoffice/s?refs=pszDestPath&project=trunk>)

685
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#685>{

686
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#686>oslFileError

<
http://opengrok.openoffice.org/openoffice/s?defs=oslFileError&project=trunk>

tErr
=osl_File_E_invalidError

<
http://opengrok.openoffice.org/openoffice/s?defs=osl_File_E_invalidError&project=trunk>;

687
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#687>688

<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#688>tErr

 =
osl_psz_moveFile
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#osl_psz_moveFile>(pszPath

,pszDestPath

<
http://opengrok.openoffice.org/openoffice/s?defs=pszDestPath&project=trunk>);

689
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#689>*if*

( tErr
 ==
osl_File_E_None
<
http://opengrok.openoffice.org/openoffice/s?defs=osl_File_E_None&project=trunk>

) 690
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#690>{

691
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#691>*return*

tErr
;
692
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#692>}

693
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#693>694

<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#694>*if*

( tErr
 !=
osl_File_E_XDEV
<
http://opengrok.openoffice.org/openoffice/s?defs=osl_File_E_XDEV&project=trunk>

) 695
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#695>{

696
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#696>*return*

tErr
;
697
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#697>}

698
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#698>699

<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#699>tErr

=osl_psz_copyFile

<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#osl_psz_copyFile>(pszPath

,pszDestPath

<
http://opengrok.openoffice.org/openoffice/s?defs=pszDestPath&project=trunk>);

700
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#700>701

<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#701>*if*

( tErr
 !=
osl_File_E_None
<
http://opengrok.openoffice.org/openoffice/s?defs=osl_File_E_None&project=trunk>

) 702
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#702>{

703
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#703>oslFileError

<
http://opengrok.openoffice.org/openoffice/s?defs=oslFileError&project=trunk>

tErrRemove
;

704
<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#704>tErrRemove

<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#tErrRemove>=osl_psz_removeFile

<
http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#osl_psz_removeFil

Re: harmful code??

2020-04-25 Thread Damjan Jovanovic
On Sat, Apr 25, 2020 at 2:11 PM Peter Kovacs  wrote:

> Hello all,
>
> I hunt some Warnings and Errors that get logged during build.
>
> I stumbled over this code here in file_misc.cxx [1]:
>
> 684
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#684>*static*
>
> oslFileError
> <
> http://opengrok.openoffice.org/openoffice/s?defs=oslFileError&project=trunk>
>
> oslDoMoveFile
> <
> http://opengrok.openoffice.org/openoffice/s?refs=oslDoMoveFile&project=trunk>(
>
> *const* sal_Char
> *
>
> pszPath
> ,
> *const* sal_Char
> *
>
> pszDestPath
> <
> http://opengrok.openoffice.org/openoffice/s?refs=pszDestPath&project=trunk>)
>
> 685
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#685>{
>
> 686
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#686>oslFileError
>
> <
> http://opengrok.openoffice.org/openoffice/s?defs=oslFileError&project=trunk>
>
> tErr
> =osl_File_E_invalidError
>
> <
> http://opengrok.openoffice.org/openoffice/s?defs=osl_File_E_invalidError&project=trunk>;
>
> 687
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#687>688
>
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#688>tErr
>
>  =
> osl_psz_moveFile
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#osl_psz_moveFile>(pszPath
>
> ,pszDestPath
>
> <
> http://opengrok.openoffice.org/openoffice/s?defs=pszDestPath&project=trunk>);
>
> 689
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#689>*if*
>
> ( tErr
>  ==
> osl_File_E_None
> <
> http://opengrok.openoffice.org/openoffice/s?defs=osl_File_E_None&project=trunk>
>
> ) 690
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#690>{
>
> 691
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#691>*return*
>
> tErr
> ;
> 692
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#692>}
>
> 693
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#693>694
>
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#694>*if*
>
> ( tErr
>  !=
> osl_File_E_XDEV
> <
> http://opengrok.openoffice.org/openoffice/s?defs=osl_File_E_XDEV&project=trunk>
>
> ) 695
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#695>{
>
> 696
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#696>*return*
>
> tErr
> ;
> 697
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#697>}
>
> 698
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#698>699
>
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#699>tErr
>
> =osl_psz_copyFile
>
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#osl_psz_copyFile>(pszPath
>
> ,pszDestPath
>
> <
> http://opengrok.openoffice.org/openoffice/s?defs=pszDestPath&project=trunk>);
>
> 700
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#700>701
>
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#701>*if*
>
> ( tErr
>  !=
> osl_File_E_None
> <
> http://opengrok.openoffice.org/openoffice/s?defs=osl_File_E_None&project=trunk>
>
> ) 702
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#702>{
>
> 703
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#703>oslFileError
>
> <
> http://opengrok.openoffice.org/openoffice/s?defs=oslFileError&project=trunk>
>
> tErrRemove
> ;
>
> 704
> <
> http://opengrok.openoffice.org/xref/trunk/main/sal/osl/unx/file_misc.cxx?r=3f12a67e#704>tErrRemove
>
> <
> http://ope

harmful code??

2020-04-25 Thread Peter Kovacs

Hello all,

I hunt some Warnings and Errors that get logged during build.

I stumbled over this code here in file_misc.cxx [1]:

684 
*static* 
oslFileError 
 
oslDoMoveFile 
( 
*const* sal_Char 
* 
pszPath 
, 
*const* sal_Char 
* 
pszDestPath 
) 
685 
{ 
686 
oslFileError 
 
tErr 
=osl_File_E_invalidError 
; 
687 
688 
tErr 
 = 
osl_psz_moveFile 
(pszPath 
,pszDestPath 
); 
689 
*if* 
( tErr 
 == 
osl_File_E_None 
 
) 690 
{ 
691 
*return* 
tErr 
; 
692 
} 
693 
694 
*if* 
( tErr 
 != 
osl_File_E_XDEV 
 
) 695 
{ 
696 
*return* 
tErr 
; 
697 
} 
698 
699 
tErr 
=osl_psz_copyFile 
(pszPath 
,pszDestPath 
); 
700 
701 
*if* 
( tErr 
 != 
osl_File_E_None 
 
) 702 
{ 
703 
oslFileError 
 
tErrRemove 
; 
704 
tErrRemove 
=osl_psz_removeFile 
(pszDestPath 
); 
705