diff options
author | 2014-03-19 19:28:00 +0000 | |
---|---|---|
committer | 2014-03-19 19:28:00 +0000 | |
commit | 8e13a159f3a54f761ab80b16377015e5a9077411 (patch) | |
tree | 6b4d9b3f6e495b0f8157d1643a46820b4a9b65cb /src/ports/SkOSFile_win.cpp | |
parent | bdc772ebbe5834a2fb6dbc2c152b54cdc5bd47e0 (diff) |
Fixed cross compilation with mingw.
Tested in Mozilla source tree. I tried to use skia build system, but it's up to the task for cross compilation.
SkHRESULT.cpp - Use proper file name (that matters on case sensitive OSes)
SkAtomics_win.h - Don't use pragma intrinsic on GCC (this causes massive warnings)
SkOSFile_win.cpp - This one is tricky. GCC doesn't allow (void*) casts in template argument constants and INVALID_HANDLE_VALUE looks like this:
((HANDLE)(LONG_PTR)-1)
where HANDLE is typedefed to void*. Changed the code to use LONG_PTR as template argument and cast it when needed.
BUG=skia:
R=bungeman@google.com, reed@google.com
Author: cjacek@gmail.com
Review URL: https://codereview.chromium.org/198643004
git-svn-id: http://skia.googlecode.com/svn/trunk@13862 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports/SkOSFile_win.cpp')
-rw-r--r-- | src/ports/SkOSFile_win.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ports/SkOSFile_win.cpp b/src/ports/SkOSFile_win.cpp index 7fec557987..a0848915ba 100644 --- a/src/ports/SkOSFile_win.cpp +++ b/src/ports/SkOSFile_win.cpp @@ -50,18 +50,16 @@ bool sk_fidentical(SkFILE* a, SkFILE* b) { && aID.fVolume == bID.fVolume; } -template <typename HandleType, HandleType InvalidValue, BOOL (WINAPI * Close)(HandleType)> -class SkAutoTHandle : SkNoncopyable { +class SkAutoNullKernelHandle : SkNoncopyable { public: - SkAutoTHandle(HandleType handle) : fHandle(handle) { } - ~SkAutoTHandle() { Close(fHandle); } - operator HandleType() { return fHandle; } - bool isValid() { return InvalidValue != fHandle; } + SkAutoNullKernelHandle(const HANDLE handle) : fHandle(handle) { } + ~SkAutoNullKernelHandle() { CloseHandle(fHandle); } + operator HANDLE() const { return fHandle; } + bool isValid() const { return NULL != fHandle; } private: - HandleType fHandle; + HANDLE fHandle; }; -typedef SkAutoTHandle<HANDLE, INVALID_HANDLE_VALUE, CloseHandle> SkAutoWinFile; -typedef SkAutoTHandle<HANDLE, NULL, CloseHandle> SkAutoWinMMap; +typedef SkAutoNullKernelHandle SkAutoWinMMap; void sk_fmunmap(const void* addr, size_t) { UnmapViewOfFile(addr); |