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
This commit is contained in:
commit-bot@chromium.org 2014-03-19 19:28:00 +00:00
Родитель bdc772ebbe
Коммит 8e13a159f3
4 изменённых файлов: 10 добавлений и 11 удалений

Просмотреть файл

@ -16,6 +16,7 @@ ARM <*@arm.com>
George Wright <george@mozilla.com> George Wright <george@mozilla.com>
Google Inc. <*@google.com> Google Inc. <*@google.com>
Intel <*@intel.com> Intel <*@intel.com>
Jacek Caban <cjacek@gmail.com>
NVIDIA <*@nvidia.com> NVIDIA <*@nvidia.com>
Samsung <*@samsung.com> Samsung <*@samsung.com>
The Chromium Authors <*@chromium.org> The Chromium Authors <*@chromium.org>

Просмотреть файл

@ -374,7 +374,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
#ifndef SK_ATOMICS_PLATFORM_H #ifndef SK_ATOMICS_PLATFORM_H
# if defined(SK_BUILD_FOR_WIN) # if defined(_MSC_VER)
# define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_win.h" # define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_win.h"
# elif defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) # elif defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
# define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_android.h" # define SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_android.h"

Просмотреть файл

@ -50,18 +50,16 @@ bool sk_fidentical(SkFILE* a, SkFILE* b) {
&& aID.fVolume == bID.fVolume; && aID.fVolume == bID.fVolume;
} }
template <typename HandleType, HandleType InvalidValue, BOOL (WINAPI * Close)(HandleType)> class SkAutoNullKernelHandle : SkNoncopyable {
class SkAutoTHandle : SkNoncopyable {
public: public:
SkAutoTHandle(HandleType handle) : fHandle(handle) { } SkAutoNullKernelHandle(const HANDLE handle) : fHandle(handle) { }
~SkAutoTHandle() { Close(fHandle); } ~SkAutoNullKernelHandle() { CloseHandle(fHandle); }
operator HandleType() { return fHandle; } operator HANDLE() const { return fHandle; }
bool isValid() { return InvalidValue != fHandle; } bool isValid() const { return NULL != fHandle; }
private: private:
HandleType fHandle; HANDLE fHandle;
}; };
typedef SkAutoTHandle<HANDLE, INVALID_HANDLE_VALUE, CloseHandle> SkAutoWinFile; typedef SkAutoNullKernelHandle SkAutoWinMMap;
typedef SkAutoTHandle<HANDLE, NULL, CloseHandle> SkAutoWinMMap;
void sk_fmunmap(const void* addr, size_t) { void sk_fmunmap(const void* addr, size_t) {
UnmapViewOfFile(addr); UnmapViewOfFile(addr);

Просмотреть файл

@ -7,7 +7,7 @@
#include "SkTypes.h" #include "SkTypes.h"
#include "SKHRESULT.h" #include "SkHRESULT.h"
void SkTraceHR(const char* file, unsigned long line, void SkTraceHR(const char* file, unsigned long line,
HRESULT hr, const char* msg) { HRESULT hr, const char* msg) {