This file is part of MXE. See index.html for further information. This patch has been taken from: https://bitbucket.org/msys2/coin/commits/69e9990b05cee506f5fa16c6edad02a7808bc610/raw/ It was modified to work with Coin 3.1.3. (The order of the template arguments of SbHash was switched.) diff --git a/include/Inventor/C/glue/spidermonkey.h b/include/Inventor/C/glue/spidermonkey.h --- a/include/Inventor/C/glue/spidermonkey.h +++ b/include/Inventor/C/glue/spidermonkey.h @@ -56,7 +56,7 @@ Structs and defines. */ typedef int JSBool; -typedef long jsword; +typedef intmax_t jsword; typedef jsword jsval; typedef jsword jsid; typedef int intN; diff --git a/src/foreignfiles/SoSTLFileKit.cpp b/src/foreignfiles/SoSTLFileKit.cpp --- a/src/foreignfiles/SoSTLFileKit.cpp +++ b/src/foreignfiles/SoSTLFileKit.cpp @@ -566,14 +566,14 @@ SO_GET_ANY_PART(this, "facets", SoIndexedFaceSet); // find existing indexes if any - long v1idx = PRIVATE(this)->points->findPoint(v1), v1new = (v1idx == -1); - long v2idx = PRIVATE(this)->points->findPoint(v2), v2new = (v2idx == -1); - long v3idx = PRIVATE(this)->points->findPoint(v3), v3new = (v3idx == -1); - if (!v1new) { v1idx = (long) PRIVATE(this)->points->getUserData(v1idx); } - if (!v2new) { v2idx = (long) PRIVATE(this)->points->getUserData(v2idx); } - if (!v3new) { v3idx = (long) PRIVATE(this)->points->getUserData(v3idx); } - long nidx = PRIVATE(this)->normals->findPoint(n); - if (nidx != -1) { nidx = (long) PRIVATE(this)->normals->getUserData(nidx); } + intmax_t v1idx = PRIVATE(this)->points->findPoint(v1), v1new = (v1idx == -1); + intmax_t v2idx = PRIVATE(this)->points->findPoint(v2), v2new = (v2idx == -1); + intmax_t v3idx = PRIVATE(this)->points->findPoint(v3), v3new = (v3idx == -1); + if (!v1new) { v1idx = (intmax_t) PRIVATE(this)->points->getUserData(v1idx); } + if (!v2new) { v2idx = (intmax_t) PRIVATE(this)->points->getUserData(v2idx); } + if (!v3new) { v3idx = (intmax_t) PRIVATE(this)->points->getUserData(v3idx); } + intmax_t nidx = PRIVATE(this)->normals->findPoint(n); + if (nidx != -1) { nidx = (intmax_t) PRIVATE(this)->normals->getUserData(nidx); } // toss out invalid facets - facets where two or more points are in // the same location. what are these - are they lines and points or diff --git a/src/threads/thread.cpp b/src/threads/thread.cpp --- a/src/threads/thread.cpp +++ b/src/threads/thread.cpp @@ -130,7 +130,7 @@ void cc_sleep(float seconds) { -#ifndef _WIN32 +#if !defined(_WIN32) || defined(__MINGW32__) /* FIXME: 20011107, thammer: create a configure macro to detect * which sleep function is available */ sleep(floor(seconds)); @@ -164,7 +164,7 @@ assert(0 && "unexpected failure"); } } - return (unsigned long) val; + return static_cast(reinterpret_cast(val)); } static void diff --git a/src/threads/thread_win32.icc b/src/threads/thread_win32.icc --- a/src/threads/thread_win32.icc +++ b/src/threads/thread_win32.icc @@ -38,7 +38,7 @@ cc_w32thread_thread_proc(LPVOID lpParameter) { cc_thread *thread = (cc_thread *)lpParameter; - return (DWORD) thread->func(thread->closure); + return static_cast(reinterpret_cast(thread->func(thread->closure))); } static int diff --git a/src/vrml97/JS_VRMLClasses.cpp b/src/vrml97/JS_VRMLClasses.cpp --- a/src/vrml97/JS_VRMLClasses.cpp +++ b/src/vrml97/JS_VRMLClasses.cpp @@ -110,8 +110,11 @@ struct CoinVrmlJs_SensorInfo { SbList objects; }; +#if defined(_WIN64) +SbHash * CoinVrmlJs_sensorinfohash = NULL; +#else SbHash * CoinVrmlJs_sensorinfohash = NULL; - +#endif const char * CoinVrmlJs_SFColorAliases[] = {"r", "g", "b"}; const char * CoinVrmlJs_SFRotationAliases[] = {"x", "y", "z", "angle"}; @@ -674,7 +677,11 @@ { SoNode * node = ((SoNodeSensor *) sensor)->getAttachedNode(); void * tmp; +#if defined(_WIN64) + if(!CoinVrmlJs_sensorinfohash->get((unsigned long long) node, tmp)) { +#else if(!CoinVrmlJs_sensorinfohash->get((unsigned long) node, tmp)) { +#endif assert(FALSE && "Trying to delete an unregistered SoNodeSensor. Internal error."); return; } @@ -690,7 +697,11 @@ // Store the sensor-pointer so that it can be properly deleted later nodesensorstobedeleted->append((SoNodeSensor *) sensor); +#if defined(_WIN64) + CoinVrmlJs_sensorinfohash->remove((unsigned long long) node); +#else CoinVrmlJs_sensorinfohash->remove((unsigned long) node); +#endif delete si; } @@ -1428,13 +1439,21 @@ { // Has the hash-table been initialized? if (!CoinVrmlJs_sensorinfohash) { +#if defined(_WIN64) + CoinVrmlJs_sensorinfohash = new SbHash ; +#else CoinVrmlJs_sensorinfohash = new SbHash ; +#endif coin_atexit(deleteSensorInfoHash, CC_ATEXIT_NORMAL); } // Is a sensor already attached to this SoNode? void * tmp; +#if defined(_WIN64) + if (CoinVrmlJs_sensorinfohash->get((unsigned long long) node, tmp)) { +#else if (CoinVrmlJs_sensorinfohash->get((unsigned long) node, tmp)) { +#endif CoinVrmlJs_SensorInfo * si = (CoinVrmlJs_SensorInfo *) tmp; si->objects.append(obj); } @@ -1444,7 +1463,11 @@ ns->attach(node); CoinVrmlJs_SensorInfo * si = new CoinVrmlJs_SensorInfo; si->objects.append(obj); +#if defined(_WIN64) + CoinVrmlJs_sensorinfohash->put((unsigned long long) node, si); +#else CoinVrmlJs_sensorinfohash->put((unsigned long) node, si); +#endif } }