Merge "kill HAVE_POSIX_FILEMAP"
This commit is contained in:
commit
2c0839e9db
2 changed files with 12 additions and 14 deletions
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <utils/Compat.h>
|
||||
|
||||
#ifdef HAVE_WIN32_FILEMAP
|
||||
#if defined(__MINGW32__)
|
||||
// Ensure that we always pull in winsock2.h before windows.h
|
||||
#ifdef HAVE_WINSOCK
|
||||
#include <winsock2.h>
|
||||
|
|
@ -127,7 +127,7 @@ private:
|
|||
off64_t mDataOffset; // offset used when map was created
|
||||
void* mDataPtr; // start of requested data, offset from base
|
||||
size_t mDataLength; // length, measured from "mDataPtr"
|
||||
#ifdef HAVE_WIN32_FILEMAP
|
||||
#if defined(__MINGW32__)
|
||||
HANDLE mFileHandle; // Win32 file handle
|
||||
HANDLE mFileMapping; // Win32 file mapping handle
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <utils/FileMap.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#if defined(HAVE_WIN32_FILEMAP) && !defined(__USE_MINGW_ANSI_STDIO)
|
||||
#if defined(__MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO)
|
||||
# define PRId32 "I32d"
|
||||
# define PRIx32 "I32x"
|
||||
# define PRId64 "I64d"
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_POSIX_FILEMAP
|
||||
#if !defined(__MINGW32__)
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -64,12 +64,7 @@ FileMap::~FileMap(void)
|
|||
if (mFileName != NULL) {
|
||||
free(mFileName);
|
||||
}
|
||||
#ifdef HAVE_POSIX_FILEMAP
|
||||
if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) {
|
||||
ALOGD("munmap(%p, %zu) failed\n", mBasePtr, mBaseLength);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_WIN32_FILEMAP
|
||||
#if defined(__MINGW32__)
|
||||
if (mBasePtr && UnmapViewOfFile(mBasePtr) == 0) {
|
||||
ALOGD("UnmapViewOfFile(%p) failed, error = %" PRId32 "\n", mBasePtr,
|
||||
GetLastError() );
|
||||
|
|
@ -77,6 +72,10 @@ FileMap::~FileMap(void)
|
|||
if (mFileMapping != INVALID_HANDLE_VALUE) {
|
||||
CloseHandle(mFileMapping);
|
||||
}
|
||||
#else
|
||||
if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) {
|
||||
ALOGD("munmap(%p, %zu) failed\n", mBasePtr, mBaseLength);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +89,7 @@ FileMap::~FileMap(void)
|
|||
bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t length,
|
||||
bool readOnly)
|
||||
{
|
||||
#ifdef HAVE_WIN32_FILEMAP
|
||||
#if defined(__MINGW32__)
|
||||
int adjust;
|
||||
off64_t adjOffset;
|
||||
size_t adjLength;
|
||||
|
|
@ -128,8 +127,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le
|
|||
mFileMapping = INVALID_HANDLE_VALUE;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_POSIX_FILEMAP
|
||||
#else // !defined(__MINGW32__)
|
||||
int prot, flags, adjust;
|
||||
off64_t adjOffset;
|
||||
size_t adjLength;
|
||||
|
|
@ -179,7 +177,7 @@ try_again:
|
|||
return false;
|
||||
}
|
||||
mBasePtr = ptr;
|
||||
#endif // HAVE_POSIX_FILEMAP
|
||||
#endif // !defined(__MINGW32__)
|
||||
|
||||
mFileName = origFileName != NULL ? strdup(origFileName) : NULL;
|
||||
mBaseLength = adjLength;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue