Skip to content

Commit 11e2405

Browse files
committed
osx: fix inconsistent use of the macro TARGET_OS_OSX
Fixed the build error on iOS: ``` httplib.h:3583:3: error: unknown type name 'CFStringRef' 870 | CFStringRef hostname_ref = CFStringCreateWithCString( ``` Note, `TARGET_OS_OSX` is defined but is 0 when `TARGET_OS_IOS` is 1, and vise versa. Hence, `TARGET_OS_MAC` should have been used, that is set to 1 for the both targets.
1 parent fe7fe15 commit 11e2405

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

httplib.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,7 +3578,7 @@ inline int getaddrinfo_with_timeout(const char *node, const char *service,
35783578
}
35793579

35803580
return ret;
3581-
#elif defined(TARGET_OS_OSX)
3581+
#elif TARGET_OS_OSX
35823582
// macOS implementation using CFHost API for asynchronous DNS resolution
35833583
CFStringRef hostname_ref = CFStringCreateWithCString(
35843584
kCFAllocatorDefault, node, kCFStringEncodingUTF8);
@@ -6258,8 +6258,7 @@ inline bool load_system_certs_on_windows(X509_STORE *store) {
62586258

62596259
return result;
62606260
}
6261-
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && \
6262-
defined(TARGET_OS_OSX)
6261+
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && TARGET_OS_OSX
62636262
template <typename T>
62646263
using CFObjectPtr =
62656264
std::unique_ptr<typename std::remove_pointer<T>::type, void (*)(CFTypeRef)>;
@@ -11008,8 +11007,7 @@ inline bool SSLClient::load_certs() {
1100811007
#ifdef _WIN32
1100911008
loaded =
1101011009
detail::load_system_certs_on_windows(SSL_CTX_get_cert_store(ctx_));
11011-
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && \
11012-
defined(TARGET_OS_OSX)
11010+
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && TARGET_OS_OSX
1101311011
loaded = detail::load_system_certs_on_macos(SSL_CTX_get_cert_store(ctx_));
1101411012
#endif // _WIN32
1101511013
if (!loaded) { SSL_CTX_set_default_verify_paths(ctx_); }

0 commit comments

Comments
 (0)