Skip to content

Commit

Permalink
Merge pull request #731 from matthiasblaesing/fix_gcc_build
Browse files Browse the repository at this point in the history
Fix build with mingw-64 on windows
  • Loading branch information
matthiasblaesing authored Nov 20, 2016
2 parents 38e158c + b09171c commit 8a85b6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Bug Fixes
* [#664](https://github.com/java-native-access/jna/issues/664): Prevent premature GC of Pointer and Function objects by passing whole object into JNI call in addition to the raw pointer value - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#669](https://github.com/java-native-access/jna/pull/669): Ensure XSI-compliant strerror_r is used, to prevent corrupted error messages on linux - [@DavidKeller](https://github.com/DavidKeller).
* [#697](https://github.com/java-native-access/jna/issues/697): Ensure disposed memory is removed from Memory#allocatedMemory map - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#731](https://github.com/java-native-access/jna/issues/731): Require mingw-w64 instead of mingw as the alternative to the MSVC build - [@matthiasblaesing](https://github.com/matthiasblaesing).

Release 4.2.1
=============
Expand Down
11 changes: 3 additions & 8 deletions native/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,8 @@ w32_short_name(JNIEnv* env, jstring str) {
size_t size = wcslen(wstr) + 5;
wchar_t* prefixed = (wchar_t*)alloca(sizeof(wchar_t) * size);

#ifdef _MSC_VER
swprintf(prefixed, size, L"\\\\?\\%ls", wstr);
#else
swprintf(prefixed, L"\\\\?\\%ls", wstr);
#endif

if ((required = GetShortPathNameW(prefixed, NULL, 0)) != 0) {
wchar_t* wshort = (wchar_t*)malloc(sizeof(wchar_t) * required);
if (GetShortPathNameW(prefixed, wshort, required)) {
Expand Down Expand Up @@ -3067,11 +3064,9 @@ Java_com_sun_jna_Native_getWindowHandle0(JNIEnv* UNUSED_JAWT(env), jclass UNUSED
const wchar_t* suffix = L"/bin/jawt.dll";
size_t len = wcslen(prop) + wcslen(suffix) + 1;
path = (wchar_t*)alloca(len * sizeof(wchar_t));
#ifdef _MSC_VER

swprintf(path, len, L"%s%s", prop, suffix);
#else
swprintf(path, L"%s%s", prop, suffix);
#endif

free((void *)prop);
}
#undef JAWT_NAME
Expand Down

0 comments on commit 8a85b6e

Please sign in to comment.