2011-02-22 12:27 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)

* harbour/src/rtl/fscopy.c
    * added runtime error for HB_FCOPY() bad param types only
    * made a function HB_FCOPY() a pure file system function 
      does not dependent on _SET_DEFAULT setting
    ; File open mode is not altered a avoid any influence on OS/2 
      behaviour if source and destination files are the same (see 
      ChangeLog entry at 2009-11-24 16:57). I guess, hb_fsExpOpen() 
      still can be changed to hb_fsOpen() with FO_EXCLUSIVE, 
      FO_CREAT, and FO_TRUNC but I'm unable to test it, so, I leave 
      current code.
This commit is contained in:
Mindaugas Kavaliauskas
2011-02-22 10:27:49 +00:00
parent 45bb463f06
commit 899023ede0
2 changed files with 16 additions and 6 deletions

View File

@@ -16,6 +16,18 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-02-22 12:27 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/src/rtl/fscopy.c
* added runtime error for HB_FCOPY() bad param types only
* made a function HB_FCOPY() a pure file system function
does not dependent on _SET_DEFAULT setting
; File open mode is not altered a avoid any influence on OS/2
behaviour if source and destination files are the same (see
ChangeLog entry at 2009-11-24 16:57). I guess, hb_fsExpOpen()
still can be changed to hb_fsOpen() with FO_EXCLUSIVE,
FO_CREAT, and FO_TRUNC but I'm unable to test it, so, I leave
current code.
2011-02-21 20:15 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/fscopy.c
* Reverted my recent changes.

View File

@@ -51,6 +51,7 @@
*/
#include "hbapi.h"
#include "hbapierr.h"
#include "hbapifs.h"
#if defined( HB_OS_UNIX )
@@ -67,9 +68,9 @@ HB_BOOL hb_fsCopy( const char * pszSource, const char * pszDest )
HB_FHANDLE fhndSource;
HB_FHANDLE fhndDest;
if( ( fhndSource = hb_fsExtOpen( pszSource, NULL, FO_READ | FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ) ) != FS_ERROR )
if( ( fhndSource = hb_fsExtOpen( pszSource, NULL, FO_READ | FXO_SHARELOCK, NULL, NULL ) ) != FS_ERROR )
{
if( ( fhndDest = hb_fsExtOpen( pszDest, NULL, FXO_TRUNCATE | FO_READWRITE | FO_EXCLUSIVE | FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL ) ) != FS_ERROR )
if( ( fhndDest = hb_fsExtOpen( pszDest, NULL, FXO_TRUNCATE | FO_READWRITE | FO_EXCLUSIVE | FXO_SHARELOCK, NULL, NULL ) ) != FS_ERROR )
{
#if defined( HB_OS_UNIX )
struct stat struFileInfo;
@@ -132,8 +133,5 @@ HB_FUNC( HB_FCOPY )
if( pszSource && pszDest )
hb_retni( hb_fsCopy( pszSource, pszDest ) ? 0 : F_ERROR );
else
{
hb_fsSetFError( 2 /* file not found */ );
hb_retni( F_ERROR );
}
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}