Skip to content

Commit 7547365

Browse files
Windows build fixes
1 parent 10c201a commit 7547365

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/countly.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
#include "nlohmann/json.hpp"
1616
using json = nlohmann::json;
1717

18+
#ifdef _WIN32
19+
#undef ERROR
20+
#endif
21+
1822
#define COUNTLY_SDK_NAME "cpp-native-unknown"
1923
#define COUNTLY_SDK_VERSION "0.1.0"
2024
#define COUNTLY_API_VERSION "19.8.0"
@@ -136,6 +140,8 @@ class Countly {
136140
void SetPath(const std::string& path) {
137141
#ifdef COUNTLY_USE_SQLITE
138142
setDatabasePath(path);
143+
#elif defined _WIN32
144+
UNREFERENCED_PARAMETER(path);
139145
#endif
140146
}
141147

src/countly.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ using json = nlohmann::json;
1717
#ifdef _WIN32
1818
#include "Windows.h"
1919
#include "WinHTTP.h"
20+
#undef ERROR
2021
#pragma comment(lib, "winhttp.lib")
2122
#else
2223
#include "curl/curl.h"
@@ -694,7 +695,7 @@ Countly::HTTPResponse Countly::sendHTTP(std::string path, std::string data) {
694695
}
695696

696697
if (hRequest) {
697-
bool ok = WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, use_post ? data.c_str() : WINHTTP_NO_REQUEST_DATA, use_post ? data.size() : 0, 0, nullptr) != 0;
698+
bool ok = WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, use_post ? (LPVOID)data.data() : WINHTTP_NO_REQUEST_DATA, use_post ? data.size() : 0, 0, 0) != 0;
698699
if (ok) {
699700
ok = WinHttpReceiveResponse(hRequest, NULL);
700701
if (ok) {

0 commit comments

Comments
 (0)