Changes in copyfile.c
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
19990624-08:00 WIB Andi Jahja <andij@aonlippo.co.id>
|
||||
* source/rtl/copyfile.c
|
||||
- function name now upper case
|
||||
- change filesys.api to filesys.h
|
||||
- add hb_ prefix to internal calls
|
||||
|
||||
19990623-22:30 WIB Andi Jahja <andij@aonlippo.co.id>
|
||||
+ tests/working/testcopy.prg
|
||||
+ source/rtl/copyfile.c
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
#include <extend.h>
|
||||
#include <errorapi.h>
|
||||
#include <ctoharb.h>
|
||||
#include <filesys.api>
|
||||
#include <filesys.h>
|
||||
|
||||
#define BUFFER_SIZE 8096
|
||||
|
||||
static long _fsCopy(BYTEP ,BYTEP ) ;
|
||||
|
||||
HARBOUR hb___copyfile() {
|
||||
HARBOUR HB___COPYFILE() {
|
||||
if ( ISCHAR(1) && ISCHAR(2) ) {
|
||||
hb_retnl(_fsCopy((BYTEP)hb_parc(1),(BYTEP)hb_parc(2)));
|
||||
}
|
||||
@@ -24,33 +24,33 @@ static long _fsCopy(BYTEP source,BYTEP dest) {
|
||||
char *buffer;
|
||||
USHORT usCount;
|
||||
ULONG ulCount = 0L;
|
||||
sHANDLE = _fsOpen(source, FO_READ);
|
||||
if ( ! _fsError() ) {
|
||||
dHANDLE = _fsCreate(dest,FC_NORMAL);
|
||||
if ( _fsError() ) {
|
||||
_fsClose(sHANDLE);
|
||||
sHANDLE = hb_fsOpen(source, FO_READ);
|
||||
if ( ! hb_fsError() ) {
|
||||
dHANDLE = hb_fsCreate(dest,FC_NORMAL);
|
||||
if ( hb_fsError() ) {
|
||||
hb_fsClose(sHANDLE);
|
||||
return( -2L) ;
|
||||
}
|
||||
buffer = hb_xgrab(BUFFER_SIZE);
|
||||
if (buffer == NULL) {
|
||||
_fsClose(sHANDLE);
|
||||
_fsClose(dHANDLE);
|
||||
hb_fsClose(sHANDLE);
|
||||
hb_fsClose(dHANDLE);
|
||||
return(-3L);
|
||||
}
|
||||
usCount = _fsRead(sHANDLE,buffer,BUFFER_SIZE);
|
||||
usCount = hb_fsRead(sHANDLE,buffer,BUFFER_SIZE);
|
||||
while(1) {
|
||||
ulCount += (ULONG)usCount;
|
||||
_fsWrite(dHANDLE,buffer, usCount);
|
||||
usCount = _fsRead(sHANDLE,buffer, BUFFER_SIZE);
|
||||
hb_fsWrite(dHANDLE,buffer, usCount);
|
||||
usCount = hb_fsRead(sHANDLE,buffer, BUFFER_SIZE);
|
||||
if (usCount != BUFFER_SIZE ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ulCount += (ULONG)usCount;
|
||||
_fsWrite(dHANDLE,buffer,usCount);
|
||||
hb_fsWrite(dHANDLE,buffer,usCount);
|
||||
hb_xfree(buffer);
|
||||
_fsClose(sHANDLE);
|
||||
_fsClose(dHANDLE);
|
||||
hb_fsClose(sHANDLE);
|
||||
hb_fsClose(dHANDLE);
|
||||
}
|
||||
return( ulCount );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user