From 668f31897cf90544d089f53f0f4499b828d7f84b Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Wed, 25 Oct 2017 19:50:08 -0700 Subject: 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. --- src/cvc4.i | 4 ++-- src/expr/record.i | 4 +++- src/util/statistics.i | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') 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 CVC4::JavaInputStreamAdapter::s_adapters; assert(clazz != NULL && jenv->ExceptionOccurred() == NULL); jmethodID method = jenv->GetMethodID(clazz, "", "(JZ)V"); assert(method != NULL && jenv->ExceptionOccurred() == NULL); - jthrowable t = static_cast(jenv->NewObject(clazz, method, reinterpret_cast(new $1_type($1)), true)); + jthrowable t = static_cast(jenv->NewObject(clazz, method, reinterpret_cast(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 CVC4::JavaInputStreamAdapter::s_adapters; assert(clazz != NULL && jenv->ExceptionOccurred() == NULL); jmethodID method = jenv->GetMethodID(clazz, "", "(JZ)V"); assert(method != NULL && jenv->ExceptionOccurred() == NULL); - jthrowable t = static_cast(jenv->NewObject(clazz, method, reinterpret_cast(new $1_type($1)), true)); + jthrowable t = static_cast(jenv->NewObject(clazz, method, reinterpret_cast(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, "", "(JZ)V"); - jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast(new CVC4::Type($1.second)), true)); + jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast(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, "", "(JZ)V"); - jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast(new CVC4::SExpr($1.second)), true)); + jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast(new CVC4::SExpr($1.second)), true)); }; #endif /* SWIGJAVA */ -- cgit v1.2.3