summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2017-10-25 19:50:08 -0700
committerGitHub <noreply@github.com>2017-10-25 19:50:08 -0700
commit668f31897cf90544d089f53f0f4499b828d7f84b (patch)
treef6418e58df5d9512adb11043f853fdea1398be82
parent13c8e4a7b8575142ce9b70747969b71039389dfa (diff)
Use uintptr_t for pointer casts in Swig files (#1278)
CVC4's Swig interface files were casting pointers to longs in multiple instances. The problem with that is that on certain platforms *cough* Windows/MinGW *cough* long is only 32-bit even when compiling a 64-bit executable (they use the LLP64 data model). This made the compilation of language bindings fail with MinGW. This commit changes the types to uintptr_t defined in Swig's stdint.i.
-rw-r--r--src/cvc4.i4
-rw-r--r--src/expr/record.i4
-rw-r--r--src/util/statistics.i4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/cvc4.i b/src/cvc4.i
index f07f9fba3..e1138649c 100644
--- a/src/cvc4.i
+++ b/src/cvc4.i
@@ -125,7 +125,7 @@ std::set<JavaInputStreamAdapter*> CVC4::JavaInputStreamAdapter::s_adapters;
assert(clazz != NULL && jenv->ExceptionOccurred() == NULL);
jmethodID method = jenv->GetMethodID(clazz, "<init>", "(JZ)V");
assert(method != NULL && jenv->ExceptionOccurred() == NULL);
- jthrowable t = static_cast<jthrowable>(jenv->NewObject(clazz, method, reinterpret_cast<long>(new $1_type($1)), true));
+ jthrowable t = static_cast<jthrowable>(jenv->NewObject(clazz, method, reinterpret_cast<uintptr_t>(new $1_type($1)), true));
assert(t != NULL && jenv->ExceptionOccurred() == NULL);
int status = jenv->Throw(t);
assert(status == 0);
@@ -142,7 +142,7 @@ std::set<JavaInputStreamAdapter*> CVC4::JavaInputStreamAdapter::s_adapters;
assert(clazz != NULL && jenv->ExceptionOccurred() == NULL);
jmethodID method = jenv->GetMethodID(clazz, "<init>", "(JZ)V");
assert(method != NULL && jenv->ExceptionOccurred() == NULL);
- jthrowable t = static_cast<jthrowable>(jenv->NewObject(clazz, method, reinterpret_cast<long>(new $1_type($1)), true));
+ jthrowable t = static_cast<jthrowable>(jenv->NewObject(clazz, method, reinterpret_cast<uintptr_t>(new $1_type($1)), true));
assert(t != NULL && jenv->ExceptionOccurred() == NULL);
int status = jenv->Throw(t);
assert(status == 0);
diff --git a/src/expr/record.i b/src/expr/record.i
index d5b018f72..6133114cd 100644
--- a/src/expr/record.i
+++ b/src/expr/record.i
@@ -9,6 +9,8 @@
#endif /* SWIGJAVA */
%}
+%include "stdint.i"
+
%rename(equals) CVC4::RecordUpdate::operator==(const RecordUpdate&) const;
%ignore CVC4::RecordUpdate::operator!=(const RecordUpdate&) const;
@@ -35,7 +37,7 @@
jenv->SetObjectArrayElement($result, 0, jenv->NewStringUTF($1.first.c_str()));
jclass clazz = jenv->FindClass("edu/nyu/acsys/CVC4/Type");
jmethodID methodid = jenv->GetMethodID(clazz, "<init>", "(JZ)V");
- jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast<long>(new CVC4::Type($1.second)), true));
+ jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast<uintptr_t>(new CVC4::Type($1.second)), true));
};
diff --git a/src/util/statistics.i b/src/util/statistics.i
index bd3a4eeb9..9ff6757d8 100644
--- a/src/util/statistics.i
+++ b/src/util/statistics.i
@@ -9,6 +9,8 @@
#endif /* SWIGJAVA */
%}
+%include "stdint.i"
+
%rename(assign) CVC4::Statistics::operator=(const StatisticsBase&);
%rename(assign) CVC4::Statistics::operator=(const Statistics& stats);
@@ -62,7 +64,7 @@
jenv->SetObjectArrayElement($result, 0, jenv->NewStringUTF($1.first.c_str()));
jclass clazz = jenv->FindClass("edu/nyu/acsys/CVC4/SExpr");
jmethodID methodid = jenv->GetMethodID(clazz, "<init>", "(JZ)V");
- jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast<long>(new CVC4::SExpr($1.second)), true));
+ jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast<uintptr_t>(new CVC4::SExpr($1.second)), true));
};
#endif /* SWIGJAVA */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback