mirror of
https://github.com/depp/syncfiles.git
synced 2024-11-26 15:49:19 +00:00
20 lines
351 B
C
20 lines
351 B
C
|
#include "convert.h"
|
||
|
|
||
|
int copy_data(short srcRef, short destRef, void *buf) {
|
||
|
long count;
|
||
|
int r, r2;
|
||
|
|
||
|
do {
|
||
|
count = kBufferBaseSize;
|
||
|
r = convert_read(srcRef, &count, buf);
|
||
|
if (r == kConvertError) {
|
||
|
return 1;
|
||
|
}
|
||
|
r2 = convert_write(destRef, count, buf);
|
||
|
if (r2 != kConvertOK) {
|
||
|
return 1;
|
||
|
}
|
||
|
} while (r != kConvertEOF);
|
||
|
return 0;
|
||
|
}
|