summaryrefslogtreecommitdiffstats
path: root/src/coin-1-fixes.patch
blob: 2ab958ec8b44760a57ecad21fbccff68ecc95a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
This file is part of MXE. See LICENSE.md for licensing 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<unsigned long>(reinterpret_cast<intptr_t>(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<DWORD>(reinterpret_cast<intptr_t>(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 <JSObject *> objects;
 };
+#if defined(_WIN64)
+SbHash <void *, unsigned long long> * CoinVrmlJs_sensorinfohash = NULL;
+#else
 SbHash <void *, unsigned long> * 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 <void *, unsigned long long>;
+#else
     CoinVrmlJs_sensorinfohash = new SbHash <void *, unsigned long>;
+#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
   }
 }