Skip to content

Commit 9c3246f

Browse files
committed
Final commenting and cleanup
1 parent 13a3c96 commit 9c3246f

File tree

13 files changed

+45
-32
lines changed

13 files changed

+45
-32
lines changed

Release/CMakeLists.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,13 @@ if(IOS)
2828
option(BUILD_TESTS "Build tests." ON)
2929
elseif(ANDROID)
3030
set(ANDROID_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../Build_android")
31-
# list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_BINARY_DIR}/../Boost-for-Android")
32-
# list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_BINARY_DIR}/../Boost-for-Android/build")
33-
# list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_BINARY_DIR}/../Boost-for-Android/build/lib")
3431

35-
#set(Boost_DEBUG ON)
3632
set(Boost_COMPILER "-gcc")
3733
set(Boost_USE_STATIC_LIBS ON)
3834
set(BOOST_ROOT "${CMAKE_BINARY_DIR}/../Boost-for-Android/build")
3935
set(BOOST_LIBRARYDIR "${CMAKE_BINARY_DIR}/../Boost-for-Android/build/lib")
4036
find_host_package(Boost 1.55 EXACT REQUIRED COMPONENTS random system thread locale filesystem chrono atomic)
41-
#find_package(Boost 1.55 EXACT REQUIRED COMPONENTS random system thread locale filesystem chrono atomic)
37+
4238
find_package(Threads REQUIRED)
4339
set(OPENSSL_FOUND 1)
4440
set(OPENSSL_INCLUDE_DIR "${CMAKE_BINARY_DIR}/../openssl/r9d-9-armeabiv7/include")
@@ -90,12 +86,6 @@ if(ANDROID)
9086
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
9187
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pedantic")
9288
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes -Wno-pointer-arith")
93-
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gcc-toolchain ${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.8/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}")
94-
#include_directories(
95-
# "${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include"
96-
# "${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/../gabi++/include"
97-
# "${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/../../android/support/include"
98-
# )
9989
include_directories(
10090
"${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/include"
10191
"${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include"

Release/include/pplx/pplxlinux.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ namespace platform
224224
_M_cs.lock();
225225
_M_owner = id;
226226
_M_recursionCount = 1;
227-
}
227+
}
228228
}
229229

230230
void unlock()
@@ -238,7 +238,7 @@ namespace platform
238238
{
239239
_M_owner = -1;
240240
_M_cs.unlock();
241-
}
241+
}
242242
}
243243

244244
private:
@@ -312,7 +312,7 @@ namespace extensibility
312312
#else
313313
typedef details::linux_scheduler default_scheduler_t;
314314
#endif
315-
315+
316316
namespace details
317317
{
318318
/// <summary>

Release/include/pplx/threadpool.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
namespace crossplat {
4444

4545
#if defined(ANDROID)
46+
// IDEA: Break this section into a separate android/jni header
4647
extern std::atomic<JavaVM*> JVM;
4748
JNIEnv* get_jvm_env();
4849

@@ -130,8 +131,8 @@ class threadpool
130131
{
131132
pplx::details::platform::YieldExecution();
132133
}
133-
// Calling get_jvm_env() here forces the thread to be attached.
134-
get_jvm_env();
134+
// Calling get_jvm_env() here forces the thread to be attached.
135+
get_jvm_env();
135136
pthread_cleanup_push(detach_from_java, nullptr);
136137
#endif
137138
threadpool* _this = reinterpret_cast<threadpool*>(arg);

Release/src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ if(WIN32)
103103
set_target_properties(${Casablanca_LIBRARY} PROPERTIES
104104
OUTPUT_NAME "${Casablanca_LIBRARY}_${CPPREST_VERSION_MAJOR}_${CPPREST_VERSION_MINOR}")
105105
elseif(ANDROID)
106-
# Do not use SOVERSION on android
106+
# Do not use SOVERSION on android. It is completely unsupported (and causes problems).
107+
# Perhaps revisit in the future? (NDK r9d, 8/7/14)
107108
else()
108109
set_target_properties(${Casablanca_LIBRARY} PROPERTIES
109110
SOVERSION ${CPPREST_VERSION_MAJOR}.${CPPREST_VERSION_MINOR})

Release/src/json/json_parsing.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
namespace crossplat
3535
{
3636
// These two are initialized in threadpool.cpp
37+
// HACK: This uses silently shared global variables. Revisit in the future if android
38+
// JNI code gets its own header and cpp file.
3739
extern jmethodID java_parseDouble;
3840
extern jclass java_lang_double;
3941
}
@@ -406,15 +408,27 @@ namespace
406408
#ifdef ANDROID
407409
static double anystod(const char* str)
408410
{
411+
// HACK: To work around issues with bionic's strtod() implementation, we ship
412+
// the string to parse into java, call the java function
413+
// java.lang.Double.parseDouble(), and bring it back down to native code.
414+
//
415+
// The strtod() bug causes problems when parsing large strings; furthermore, it
416+
// is arguable that it uses "locale" information, which is announced as being
417+
// off-limits for native code.
418+
//
419+
// It is highly unlikely this situation will be remedied due to ecosystem
420+
// fragmentation.
409421
if (str == nullptr)
410422
str = "";
411423

412-
auto env = crossplat::get_jvm_env();
424+
auto env = crossplat::get_jvm_env();
413425

414426
jdouble parsed_double;
415427

416428
crossplat::java_local_ref<jstring> jstr{env->NewStringUTF(str)};
417-
parsed_double = env->CallStaticDoubleMethod(crossplat::java_lang_double, crossplat::java_parseDouble, jstr.get());
429+
parsed_double = env->CallStaticDoubleMethod(crossplat::java_lang_double,
430+
crossplat::java_parseDouble,
431+
jstr.get());
418432

419433
jthrowable exc = env->ExceptionOccurred();
420434
if (exc)

Release/src/json/json_serialization.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ using namespace web::json;
3434
using namespace utility;
3535
using namespace utility::conversions;
3636

37+
3738
//
3839
// JSON Serialization
3940
//

Release/src/utilities/asyncrt_utils.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,15 @@ datetime __cdecl datetime::from_string(const utility::string_t& dateString, date
883883
}
884884

885885
#if defined(ANDROID)
886+
// HACK: The (nonportable?) POSIX function timegm is not available in
887+
// bionic. As a workaround[1][2], we set the C library timezone to
888+
// UTC, call mktime, then set the timezone back. However, the C
889+
// environment is fundamentally a shared global resource and thread-
890+
// unsafe. We can protect our usage here, however any other code might
891+
// manipulate the environment at the same time.
892+
//
893+
// [1] http://linux.die.net/man/3/timegm
894+
// [2] http://www.gnu.org/software/libc/manual/html_node/Broken_002ddown-Time.html
886895
time_t time;
887896

888897
static boost::mutex env_var_lock;

Release/tests/Common/UnitTestpp/src/ExecuteTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void ExecuteTest(T& testObject, TestDetails const& details, bool isMockTest)
6969
#else
7070
UT_TRY
7171
({
72-
UNITTEST_THROW_SIGNALS_POSIX_ONLY
72+
UNITTEST_THROW_SIGNALS_POSIX_ONLY
7373
testObject.RunImpl();
7474
})
7575
#endif

Release/tests/Functional/http/client/http_client_tests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ void test_connection(tests::functional::http::utilities::test_http_server *p_ser
4646
// Take in the path to request and what path should be received in the server.
4747
void test_connection(tests::functional::http::utilities::test_http_server *p_server, web::http::client::http_client *p_client, const utility::string_t &request_path, const utility::string_t &expected_path);
4848

49-
}}}}
49+
}}}}

Release/tests/Functional/http/client/multiple_requests.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ TEST_FIXTURE(uri_address, requests_with_data)
154154
try
155155
{
156156
http_asserts::assert_response_equals(responses[i].get(), code);
157-
} catch (...)
157+
}
158+
catch (...)
158159
{
159160
VERIFY_ARE_EQUAL(1, 0);
160161
}
@@ -198,7 +199,8 @@ TEST_FIXTURE(uri_address, responses_with_data)
198199
http_response rsp = responses[i].get();
199200
http_asserts::assert_response_equals(rsp, code, headers);
200201
VERIFY_ARE_EQUAL(to_string_t(request_body), rsp.extract_string().get());
201-
} catch (...)
202+
}
203+
catch (...)
202204
{
203205
VERIFY_ARE_EQUAL(1, 0);
204206
}

0 commit comments

Comments
 (0)