From 892a453a931b41967c7dca72097da9c5be7f84d6 Mon Sep 17 00:00:00 2001 From: zecke Date: Sun, 16 Feb 2003 21:01:09 +0000 Subject: its memcpy(destination, src and not vice versa.... --- (limited to 'core/obex/receiver.cpp') diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp index d5a7271..31c6afe 100644 --- a/core/obex/receiver.cpp +++ b/core/obex/receiver.cpp @@ -137,17 +137,18 @@ QString OtherHandler::targetName( const QString& file ) { QString newFileBase = newFile; int trie = 0; - while (QFile::exists(newFile + info.extension() ) ) { + while (QFile::exists(newFile + "."+info.extension() ) ) { newFile = newFileBase + "_"+QString::number(trie) ; trie++; } - newFile += info.extension(); + newFile += "." + info.extension(); return newFile; } /* fast cpy */ void OtherHandler::copy(const QString& src, const QString& file) { + qWarning("src %s, dest %s", src.latin1(),file.latin1() ); int src_fd = ::open( QFile::encodeName( src ), O_RDONLY ); int to_fd = ::open( QFile::encodeName( file), O_RDWR| O_CREAT| O_TRUNC, S_IRUSR, S_IWUSR, S_IRGRP, S_IRGRP ); @@ -155,6 +156,7 @@ void OtherHandler::copy(const QString& src, const QString& file) { struct stat stater; ::fstat(src_fd, &stater ); ::lseek(to_fd, stater.st_size-1, SEEK_SET ); + ::write(to_fd, "", 1 ); void *src_addr, *dest_addr; src_addr = ::mmap(0, stater.st_size, PROT_READ, @@ -162,7 +164,7 @@ void OtherHandler::copy(const QString& src, const QString& file) { dest_addr= ::mmap(0, stater.st_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_PRIVATE, to_fd, 0 ); - ::memcpy(src_addr , dest_addr, stater.st_size ); + ::memcpy(dest_addr , src_addr, stater.st_size ); ::munmap(src_addr , stater.st_size ); ::munmap(dest_addr, stater.st_size ); -- cgit v0.9.0.2