Skip to content

Commit 4bf7f17

Browse files
committed
Added __ANDROID__ macro overloads
1 parent fdc1d7c commit 4bf7f17

File tree

16 files changed

+41
-41
lines changed

16 files changed

+41
-41
lines changed

Release/include/cpprest/asyncrt_utils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace pplx = Concurrency;
4949

5050
#ifndef _MS_WINDOWS
5151
#include <boost/algorithm/string.hpp>
52-
#ifndef ANDROID // CodePlex 269
52+
#if !defined(ANDROID) && !defined(__ANDROID__) // CodePlex 269
5353
#include <xlocale.h>
5454
#endif
5555
#endif
@@ -172,7 +172,7 @@ namespace details
172172
_ASYNCRTIMP scoped_c_thread_locale();
173173
_ASYNCRTIMP ~scoped_c_thread_locale();
174174

175-
#ifndef ANDROID // CodePlex 269
175+
#if !defined(ANDROID) && !defined(__ANDROID__) // CodePlex 269
176176
#ifdef _MS_WINDOWS
177177
typedef _locale_t xplat_locale;
178178
#else
@@ -185,7 +185,7 @@ namespace details
185185
#ifdef _MS_WINDOWS
186186
std::string m_prevLocale;
187187
int m_prevThreadSetting;
188-
#elif !defined(ANDROID)
188+
#elif !(defined(ANDROID) || defined(__ANDROID__))
189189
locale_t m_prevLocale;
190190
#endif
191191
scoped_c_thread_locale(const scoped_c_thread_locale &);

Release/include/cpprest/details/linux_compat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <sstream>
2626
#include <iostream>
2727

28-
#if defined(ANDROID) && defined(__arm__)
28+
#if (defined(ANDROID) || defined(__ANDROID__)) && defined(__arm__)
2929
// Cdecl is not used on ARM
3030
#define __cdecl
3131
#else

Release/include/cpprest/x509_cert_utilities.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <vector>
3131
#include <string>
3232

33-
#if defined(__APPLE__) || defined(ANDROID) || (defined(_MS_WINDOWS) && !defined(__cplusplus_winrt) && !defined(_M_ARM))
33+
#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) || (defined(_MS_WINDOWS) && !defined(__cplusplus_winrt) && !defined(_M_ARM))
3434

3535
#include <boost/asio/ssl.hpp>
3636

Release/include/pplx/pplxinterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#include <atomic>
4949
#endif
5050

51-
#if defined(ANDROID)
51+
#if (defined(ANDROID) || defined(__ANDROID__))
5252
// This prevents users from requiring -Wno-attributes when using gcc-4.8 with the android NDK.
5353
#define _pplx_cdecl
5454
#else

Release/include/pplx/threadpool.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@
3838
#pragma clang diagnostic pop
3939
#endif
4040

41-
#if defined(ANDROID)
41+
#if (defined(ANDROID) || defined(__ANDROID__))
4242
#include <atomic>
4343
#include <jni.h>
4444
#include "pplx/pplx.h"
4545
#endif
4646

4747
namespace crossplat {
4848

49-
#if defined(ANDROID)
49+
#if (defined(ANDROID) || defined(__ANDROID__))
5050
// IDEA: Break this section into a separate android/jni header
5151
extern std::atomic<JavaVM*> JVM;
5252
JNIEnv* get_jvm_env();
@@ -120,7 +120,7 @@ class threadpool
120120
schedule([]() -> void { throw _cancel_thread(); });
121121
}
122122

123-
#if defined(ANDROID)
123+
#if (defined(ANDROID) || defined(__ANDROID__))
124124
static void detach_from_java(void*)
125125
{
126126
JVM.load()->DetachCurrentThread();
@@ -129,7 +129,7 @@ class threadpool
129129

130130
static void* thread_start(void *arg)
131131
{
132-
#if defined(ANDROID)
132+
#if (defined(ANDROID) || defined(__ANDROID__))
133133
// Spinlock on the JVM calling JNI_OnLoad()
134134
while (JVM == nullptr)
135135
{
@@ -151,15 +151,15 @@ class threadpool
151151
catch (...)
152152
{
153153
// Something bad happened
154-
#if defined(ANDROID)
154+
#if (defined(ANDROID) || defined(__ANDROID__))
155155
// Reach into the depths of the 'droid!
156156
// NOTE: Uses internals of the bionic library
157157
// Written against android ndk r9d, 7/26/2014
158158
__pthread_cleanup_pop(&__cleanup, true);
159159
throw;
160160
#endif
161161
}
162-
#if defined(ANDROID)
162+
#if (defined(ANDROID) || defined(__ANDROID__))
163163
pthread_cleanup_pop(true);
164164
#endif
165165
return arg;

Release/src/http/client/http_linux.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ namespace web { namespace http
446446
boost::asio::streambuf m_body_buf;
447447
std::shared_ptr<linux_connection> m_connection;
448448

449-
#if defined(__APPLE__) || defined(ANDROID)
449+
#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__))
450450
bool m_openssl_failed;
451451
#endif
452452

@@ -647,7 +647,7 @@ namespace web { namespace http
647647
// certificate chain, the rest are optional intermediate certificates, followed
648648
// finally by the root CA self signed certificate.
649649

650-
#if defined(__APPLE__) || defined(ANDROID)
650+
#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__))
651651
// On OS X, iOS, and Android, OpenSSL doesn't have access to where the OS
652652
// stores keychains. If OpenSSL fails we will doing verification at the
653653
// end using the whole certificate chain so wait until the 'leaf' cert.
@@ -1154,7 +1154,7 @@ namespace web { namespace http
11541154
, m_needChunked(false)
11551155
, m_timer(static_cast<int>(client->client_config().timeout().count()))
11561156
, m_connection(connection)
1157-
#if defined(__APPLE__) || defined(ANDROID)
1157+
#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__))
11581158
, m_openssl_failed(false)
11591159
#endif
11601160
{}

Release/src/http/client/x509_cert_utilities.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include <Security/SecTrust.h>
4040
#endif
4141

42-
#if defined(ANDROID)
42+
#if (defined(ANDROID) || defined(__ANDROID__))
4343
#include <jni.h>
4444
using namespace crossplat;
4545
#endif
@@ -50,7 +50,7 @@ using namespace crossplat;
5050

5151
namespace web { namespace http { namespace client { namespace details {
5252

53-
#if defined(__APPLE__) || defined(ANDROID) || (defined(_MS_WINDOWS) && !defined(__cplusplus_winrt) && !defined(_M_ARM))
53+
#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) || (defined(_MS_WINDOWS) && !defined(__cplusplus_winrt) && !defined(_M_ARM))
5454
bool verify_cert_chain_platform_specific(boost::asio::ssl::verify_context &verifyCtx, const std::string &hostName)
5555
{
5656
X509_STORE_CTX *storeContext = verifyCtx.native_handle();
@@ -263,7 +263,7 @@ bool verify_X509_cert_chain(const std::vector<std::string> &certChain, const std
263263
}
264264
#endif
265265

266-
#if defined(ANDROID)
266+
#if (defined(ANDROID) || defined(__ANDROID__))
267267

268268
/// <summary>
269269
/// Helper function to check return value and see if any exceptions

Release/src/http/oauth/oauth1.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace experimental
6060
#include <bcrypt.h>
6161

6262
std::vector<unsigned char> oauth1_config::_hmac_sha1(const utility::string_t& key, const utility::string_t& data)
63-
{
63+
{
6464
NTSTATUS status;
6565
BCRYPT_ALG_HANDLE alg_handle = nullptr;
6666
BCRYPT_HASH_HANDLE hash_handle = nullptr;
@@ -112,7 +112,7 @@ std::vector<unsigned char> oauth1_config::_hmac_sha1(const utility::string_t& ke
112112
BCryptCloseAlgorithmProvider(alg_handle, 0);
113113
}
114114

115-
return hash;
115+
return hash;
116116
}
117117

118118
#elif defined(_MS_WINDOWS) && defined(__cplusplus_winrt) // Windows RT
@@ -122,7 +122,7 @@ using namespace Windows::Security::Cryptography::Core;
122122
using namespace Windows::Storage::Streams;
123123

124124
std::vector<unsigned char> oauth1_config::_hmac_sha1(const utility::string_t& key, const utility::string_t& data)
125-
{
125+
{
126126
Platform::String^ data_str = ref new Platform::String(data.c_str());
127127
Platform::String^ key_str = ref new Platform::String(key.c_str());
128128

@@ -135,23 +135,23 @@ std::vector<unsigned char> oauth1_config::_hmac_sha1(const utility::string_t& ke
135135

136136
Platform::Array<unsigned char, 1>^ arr;
137137
CryptographicBuffer::CopyToByteArray(signed_buffer, &arr);
138-
return std::vector<unsigned char>(arr->Data, arr->Data + arr->Length);
138+
return std::vector<unsigned char>(arr->Data, arr->Data + arr->Length);
139139
}
140140

141141
#else // Linux, Mac OS X
142142

143143
#include <openssl/hmac.h>
144144

145145
std::vector<unsigned char> oauth1_config::_hmac_sha1(const utility::string_t& key, const utility::string_t& data)
146-
{
146+
{
147147
unsigned char digest[HMAC_MAX_MD_CBLOCK];
148148
unsigned int digest_len = 0;
149149

150150
HMAC(EVP_sha1(), key.c_str(), static_cast<int>(key.length()),
151151
(const unsigned char*) data.c_str(), data.length(),
152152
digest, &digest_len);
153153

154-
return std::vector<unsigned char>(digest, digest + digest_len);
154+
return std::vector<unsigned char>(digest, digest + digest_len);
155155
}
156156

157157
#endif

Release/src/pch/stdafx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
#include <atomic>
7171
#include <signal.h>
7272
#include "pthread.h"
73-
#if defined(ANDROID)
73+
#if (defined(ANDROID) || defined(__ANDROID__))
7474
// Boost doesn't recognize libstdcpp on top of clang correctly
7575
#include "boost/config/stdlib/libstdcpp3.hpp"
7676
#undef BOOST_NO_CXX11_SMART_PTR

Release/src/pplx/threadpool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace crossplat
2323
// initialize the static shared threadpool
2424
threadpool threadpool::s_shared(40);
2525

26-
#if defined(ANDROID)
26+
#if (defined(ANDROID) || defined(__ANDROID__))
2727
// This pointer will be 0-initialized by default (at load time).
2828
std::atomic<JavaVM*> JVM;
2929

@@ -47,7 +47,7 @@ JNIEnv* get_jvm_env()
4747

4848
}
4949

50-
#if defined(ANDROID)
50+
#if (defined(ANDROID) || defined(__ANDROID__))
5151
extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
5252
{
5353
JNIEnv* env;

0 commit comments

Comments
 (0)