aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rfsv32.cc
diff options
context:
space:
mode:
authorDaniel Brahneborg <basic@chello.se>2002-03-08 19:42:40 +0000
committerDaniel Brahneborg <basic@chello.se>2002-03-08 19:42:40 +0000
commit0f623548115340cf5f2d39abf9098bf27b822b68 (patch)
tree0573142130e1b73fef1a89855a3712eff1a3b78d /lib/rfsv32.cc
parent49f6d0f0ca26c10f3e2aa42ef491d9a60bd1a9fc (diff)
downloadplptools-0f623548115340cf5f2d39abf9098bf27b822b68.tar.gz
plptools-0f623548115340cf5f2d39abf9098bf27b822b68.tar.bz2
plptools-0f623548115340cf5f2d39abf9098bf27b822b68.zip
Added copyFromPsion() that takes a 'to' argument that is a file
descriptor, to be able to use mkstemp().
Diffstat (limited to 'lib/rfsv32.cc')
-rw-r--r--lib/rfsv32.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/rfsv32.cc b/lib/rfsv32.cc
index 739844e..da9c6e0 100644
--- a/lib/rfsv32.cc
+++ b/lib/rfsv32.cc
@@ -507,6 +507,30 @@ copyFromPsion(const char *from, const char *to, void *ptr, cpCallback_t cb)
}
Enum<rfsv::errs> rfsv32::
+copyFromPsion(const char *from, int fd, cpCallback_t cb)
+{
+ Enum<rfsv::errs> res;
+ u_int32_t handle;
+ u_int32_t len;
+ u_int32_t total = 0;
+
+ if ((res = fopen(EPOC_OMODE_SHARE_READERS | EPOC_OMODE_BINARY, from, handle)) != E_PSI_GEN_NONE)
+ return res;
+ unsigned char *buff = new unsigned char[RFSV_SENDLEN];
+ do {
+ if ((res = fread(handle, buff, RFSV_SENDLEN, len)) == E_PSI_GEN_NONE) {
+ write(fd, buff, len);
+ total += len;
+ if (cb && !cb(NULL, total))
+ res = E_PSI_FILE_CANCEL;
+ }
+ } while ((len > 0) && (res == E_PSI_GEN_NONE));
+ delete [] buff;
+ fclose(handle);
+ return res;
+}
+
+Enum<rfsv::errs> rfsv32::
copyToPsion(const char *from, const char *to, void *ptr, cpCallback_t cb)
{
u_int32_t handle;