From c8a81160e71f51505e0d5bd017bb34a0a793f939 Mon Sep 17 00:00:00 2001 From: Graeme Hill Date: Sun, 18 Jun 2017 12:56:32 -0700 Subject: [PATCH 1/3] More whitespace fixes --- test/TestMain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TestMain.cpp b/test/TestMain.cpp index 20705db..2ef5c15 100644 --- a/test/TestMain.cpp +++ b/test/TestMain.cpp @@ -3,5 +3,5 @@ int main() { - return test(std::cout); + return test(std::cout); } From 668cd94ee3dc31b1dc03e6f6a7c2499c3eee6d17 Mon Sep 17 00:00:00 2001 From: Graeme Hill Date: Sun, 18 Jun 2017 14:14:25 -0700 Subject: [PATCH 2/3] Make android work again --- Guid.cpp | 37 ++++++++++++++++++++----------------- Guid.hpp | 8 ++++---- android/jni/Android.mk | 3 ++- android/jni/Application.mk | 2 +- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/Guid.cpp b/Guid.cpp index 57b3fcf..7e5c6fc 100644 --- a/Guid.cpp +++ b/Guid.cpp @@ -223,7 +223,7 @@ Guid::Guid(const std::string &fromString) } // create empty guid -Guid::Guid() : _bytes{ 0 } +Guid::Guid() : _bytes({0}) { } // copy constructor @@ -350,23 +350,26 @@ Guid newGuid() std::array bytes = { - (mostSignificant >> 56) & 0xFF, - (mostSignificant >> 48) & 0xFF, - (mostSignificant >> 40) & 0xFF, - (mostSignificant >> 32) & 0xFF, - (mostSignificant >> 24) & 0xFF, - (mostSignificant >> 16) & 0xFF, - (mostSignificant >> 8) & 0xFF, - (mostSignificant) & 0xFF, - (leastSignificant >> 56) & 0xFF, - (leastSignificant >> 48) & 0xFF, - (leastSignificant >> 40) & 0xFF, - (leastSignificant >> 32) & 0xFF, - (leastSignificant >> 24) & 0xFF, - (leastSignificant >> 16) & 0xFF, - (leastSignificant >> 8) & 0xFF, - (leastSignificant) & 0xFF, + (unsigned char)((mostSignificant >> 56) & 0xFF), + (unsigned char)((mostSignificant >> 48) & 0xFF), + (unsigned char)((mostSignificant >> 40) & 0xFF), + (unsigned char)((mostSignificant >> 32) & 0xFF), + (unsigned char)((mostSignificant >> 24) & 0xFF), + (unsigned char)((mostSignificant >> 16) & 0xFF), + (unsigned char)((mostSignificant >> 8) & 0xFF), + (unsigned char)((mostSignificant) & 0xFF), + (unsigned char)((leastSignificant >> 56) & 0xFF), + (unsigned char)((leastSignificant >> 48) & 0xFF), + (unsigned char)((leastSignificant >> 40) & 0xFF), + (unsigned char)((leastSignificant >> 32) & 0xFF), + (unsigned char)((leastSignificant >> 24) & 0xFF), + (unsigned char)((leastSignificant >> 16) & 0xFF), + (unsigned char)((leastSignificant >> 8) & 0xFF), + (unsigned char)((leastSignificant) & 0xFF) }; + + androidInfo.env->DeleteLocalRef(javaUuid); + return bytes; } #endif diff --git a/Guid.hpp b/Guid.hpp index 269af57..28a1cea 100644 --- a/Guid.hpp +++ b/Guid.hpp @@ -24,6 +24,10 @@ THE SOFTWARE. #pragma once +#ifdef GUID_ANDROID +#include +#endif + #include #include #include @@ -32,10 +36,6 @@ THE SOFTWARE. #include #include -#ifdef GUID_ANDROID -#include -#endif - #define BEGIN_XG_NAMESPACE namespace xg { #define END_XG_NAMESPACE } diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 8ea01f9..db23683 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -6,6 +6,7 @@ LOCAL_MODULE := crossguidtest LOCAL_CFLAGS := -Wall LOCAL_SRC_FILES := ../../Guid.cpp ../../test/Test.cpp jnitest.cpp LOCAL_CPP_FLAGS := -std=c++14 -LOCAL_CPPFLAGS := -DGUID_ANDROID -Wno-c++11-extensions +LOCAL_CPPFLAGS := -DGUID_ANDROID -Wno-c++11-extensions -Wno-missing-braces +LOCAL_LDLIBS := -latomic include $(BUILD_SHARED_LIBRARY) diff --git a/android/jni/Application.mk b/android/jni/Application.mk index d6e11bd..4691b86 100644 --- a/android/jni/Application.mk +++ b/android/jni/Application.mk @@ -1,4 +1,4 @@ -APP_STL := stlport_static +APP_STL := c++_static NDK_TOOLCHAIN_VERSION := clang LOCAL_CPP_FLAGS := -DGUID_ANDROID APP_ABI := all From 8da099bd5554eec630c1506a39ca926ee77fc014 Mon Sep 17 00:00:00 2001 From: Graeme Hill Date: Sun, 18 Jun 2017 14:26:44 -0700 Subject: [PATCH 3/3] Revert change to initializer --- Guid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Guid.cpp b/Guid.cpp index 7e5c6fc..bd8c61c 100644 --- a/Guid.cpp +++ b/Guid.cpp @@ -223,7 +223,7 @@ Guid::Guid(const std::string &fromString) } // create empty guid -Guid::Guid() : _bytes({0}) +Guid::Guid() : _bytes{ 0 } { } // copy constructor