From 9068113e6246a99881b463a2eb94418d154a5452 Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 25 Nov 2003 10:44:12 +0000 Subject: Fixing Linux port of mmap --- lib/GMPString.cc | 3 +++ lib/Handle.cc | 8 ++++++-- lib/Output.cc | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'lib') 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 #endif +#ifndef _WIN32 +#include +#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)) { -- cgit v1.2.3