Skip to content

Commit

Permalink
Merge pull request #13 from kou/make-buildable-with-mingw
Browse files Browse the repository at this point in the history
Make buildable with MinGW
  • Loading branch information
taku910 committed Feb 7, 2016
2 parents 1f0fbe2 + 0b7a96a commit 32041d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions mecab/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,15 @@
#define EXIT_SUCCESS 0
#endif

#if defined(_WIN32) && !defined(__CYGWIN__)
#define WPATH(path) (MeCab::Utf8ToWide(path).c_str())
#ifdef _WIN32
#ifdef __GNUC__
#define WPATH_FORCE(path) (MeCab::Utf8ToWide(path).c_str())
#define WPATH(path) (path)
#else
#define WPATH(path) WPATH_FORCE(path)
#endif
#else
#define WPATH_FORCE(path) (path)
#define WPATH(path) (path)
#endif

Expand Down
2 changes: 1 addition & 1 deletion mecab/src/mmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ template <class T> class Mmap {
CHECK_FALSE(false) << "unknown open mode:" << filename;
}

hFile = ::CreateFileW(WPATH(filename), mode1, FILE_SHARE_READ, 0,
hFile = ::CreateFileW(WPATH_FORCE(filename), mode1, FILE_SHARE_READ, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
CHECK_FALSE(hFile != INVALID_HANDLE_VALUE)
<< "CreateFile() failed: " << filename;
Expand Down

0 comments on commit 32041d9

Please sign in to comment.