From: mudathirmahgoub Date: Wed, 27 Oct 2021 10:05:43 +0000 (-0500) Subject: Fix mac compile errors in sort.cpp (#7507) X-Git-Tag: cvc5-1.0.0~959 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d31194c3ebd03ce28206c98958010c972d22cde;p=cvc5.git Fix mac compile errors in sort.cpp (#7507) This fixes compile errors in Mac for the java api where `jlong` means `long long`. --- diff --git a/src/api/java/jni/sort.cpp b/src/api/java/jni/sort.cpp index fed1f3a41..e5b4f06fe 100644 --- a/src/api/java/jni/sort.cpp +++ b/src/api/java/jni/sort.cpp @@ -652,10 +652,10 @@ Java_io_github_cvc5_api_Sort_getConstructorDomainSorts(JNIEnv* env, CVC5_JAVA_API_TRY_CATCH_BEGIN; Sort* current = reinterpret_cast(pointer); std::vector sorts = current->getConstructorDomainSorts(); - std::vector sortPointers(sorts.size()); + std::vector sortPointers(sorts.size()); for (size_t i = 0; i < sorts.size(); i++) { - sortPointers[i] = (long)new Sort(sorts[i]); + sortPointers[i] = reinterpret_cast (new Sort(sorts[i])); } jlongArray ret = env->NewLongArray(sorts.size()); env->SetLongArrayRegion(ret, 0, sorts.size(), sortPointers.data()); @@ -765,10 +765,10 @@ Java_io_github_cvc5_api_Sort_getFunctionDomainSorts(JNIEnv* env, CVC5_JAVA_API_TRY_CATCH_BEGIN; Sort* current = reinterpret_cast(pointer); std::vector sorts = current->getFunctionDomainSorts(); - std::vector sortPointers(sorts.size()); + std::vector sortPointers(sorts.size()); for (size_t i = 0; i < sorts.size(); i++) { - sortPointers[i] = (long)new Sort(sorts[i]); + sortPointers[i] = reinterpret_cast(new Sort(sorts[i])); } jlongArray ret = env->NewLongArray(sorts.size()); env->SetLongArrayRegion(ret, 0, sorts.size(), sortPointers.data()); @@ -909,10 +909,10 @@ Java_io_github_cvc5_api_Sort_getUninterpretedSortParamSorts(JNIEnv* env, CVC5_JAVA_API_TRY_CATCH_BEGIN; Sort* current = reinterpret_cast(pointer); std::vector sorts = current->getUninterpretedSortParamSorts(); - std::vector sortPointers(sorts.size()); + std::vector sortPointers(sorts.size()); for (size_t i = 0; i < sorts.size(); i++) { - sortPointers[i] = (long)new Sort(sorts[i]); + sortPointers[i] = reinterpret_cast(new Sort(sorts[i])); } jlongArray ret = env->NewLongArray(sorts.size()); env->SetLongArrayRegion(ret, 0, sorts.size(), sortPointers.data()); @@ -1005,10 +1005,10 @@ JNIEXPORT jlongArray JNICALL Java_io_github_cvc5_api_Sort_getDatatypeParamSorts( CVC5_JAVA_API_TRY_CATCH_BEGIN; Sort* current = reinterpret_cast(pointer); std::vector sorts = current->getDatatypeParamSorts(); - std::vector sortPointers(sorts.size()); + std::vector sortPointers(sorts.size()); for (size_t i = 0; i < sorts.size(); i++) { - sortPointers[i] = (long)new Sort(sorts[i]); + sortPointers[i] = reinterpret_cast(new Sort(sorts[i])); } jlongArray ret = env->NewLongArray(sorts.size()); env->SetLongArrayRegion(ret, 0, sorts.size(), sortPointers.data()); @@ -1055,10 +1055,10 @@ Java_io_github_cvc5_api_Sort_getTupleSorts(JNIEnv* env, jobject, jlong pointer) CVC5_JAVA_API_TRY_CATCH_BEGIN; Sort* current = reinterpret_cast(pointer); std::vector sorts = current->getTupleSorts(); - std::vector sortPointers(sorts.size()); + std::vector sortPointers(sorts.size()); for (size_t i = 0; i < sorts.size(); i++) { - sortPointers[i] = (long)new Sort(sorts[i]); + sortPointers[i] = reinterpret_cast(new Sort(sorts[i])); } jlongArray ret = env->NewLongArray(sorts.size()); env->SetLongArrayRegion(ret, 0, sorts.size(), sortPointers.data());