summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2003-11-25 10:44:12 +0000
committerpixel <pixel>2003-11-25 10:44:12 +0000
commit9068113e6246a99881b463a2eb94418d154a5452 (patch)
treeb7f5ab5e539aa091d9ef2d2c5df5dc9bc77fc31a /lib
parent7fba30e97d12d2c9fb9cfeea0df82f5b6c0e7d52 (diff)
Fixing Linux port of mmap
Diffstat (limited to 'lib')
-rw-r--r--lib/GMPString.cc3
-rw-r--r--lib/Handle.cc8
-rw-r--r--lib/Output.cc4
3 files changed, 11 insertions, 4 deletions
diff --git a/lib/GMPString.cc b/lib/GMPString.cc
index 5b2d1c6..be39e38 100644
--- a/lib/GMPString.cc
+++ b/lib/GMPString.cc
@@ -24,4 +24,7 @@ GMPString::operator String() const {
return String(str);
}
+GMPString::~GMPString() {
+}
+
#endif
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 8ec6219..84004b0 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -29,6 +29,10 @@ inline Uint32 bswap_32(Uint32 w) {
#include <io.h>
#endif
+#ifndef _WIN32
+#include <sys/mman.h>
+#endif
+
#include "Handle.h"
#include "gettext.h"
@@ -535,10 +539,10 @@ void * Handle::mmap(off_t offset, size_t length) throw (GeneralException) {
throw GeneralException("Handle already mmap()ped");
}
mapped = true;
- maplength = length;
if (length == -1) {
length = GetSize();
}
+ maplength = length;
#ifndef _WIN32
r = ::mmap(0, length, (CanRead() ? PROT_READ : 0) | (CanWrite() ? PROT_WRITE : 0), MAP_SHARED, h, offset);
if (!r) {
@@ -578,7 +582,7 @@ void Handle::munmap() throw (GeneralException) {
throw GeneralException("Can't munmap, was not mapped");
}
#ifndef _WIN32
- if (::munmap(mappedarea, maplength) {
+ if (::munmap(mappedarea, maplength)) {
throw GeneralException(String("Was not able to munmap(): ") + strerror(errno));
}
#else
diff --git a/lib/Output.cc b/lib/Output.cc
index 912af25..7d619b6 100644
--- a/lib/Output.cc
+++ b/lib/Output.cc
@@ -39,8 +39,8 @@ Output::Output(String no, int create, int trunc) throw (GeneralException) :
int Output::wrapopen(const String & n, int create, int trunc) {
#ifndef _WIN32
- return open(no.to_charp(), (create ? O_CREAT : 0) |
- (trunc ? O_TRUNC : 0) | O_WRONLY, 00666);
+ return open(n.to_charp(), (create ? O_CREAT : 0) |
+ (trunc ? O_TRUNC : 0) | O_WRONLY, 00666);
#else
DWORD dwCreationDisposition;
switch ((create ? 1 : 0) | (trunc ? 2 : 0)) {