Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/countly/countly_configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct CountlyConfiguration {

nlohmann::json metrics;

CountlyConfiguration(std::string appKey, std::string serverUrl) {
CountlyConfiguration(const std::string appKey, std::string serverUrl) {
this->appKey = appKey;
this->serverUrl = serverUrl;
}
Expand Down
6 changes: 3 additions & 3 deletions src/request_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ HTTPResponse RequestModule::sendHTTP(std::string path, std::string data) {
size_t scheme_offset = impl->use_https ? (sizeof("https://") - 1) : (sizeof("http://") - 1);
size_t buffer_size = MultiByteToWideChar(CP_ACP, 0, impl->_configuration->serverUrl.c_str() + scheme_offset, -1, nullptr, 0);
wchar_t *wide_hostname = new wchar_t[buffer_size];
MultiByteToWideChar(CP_ACP, 0, impl->_configuration->serverUrl.c_str() + scheme_offset, -1, wide_hostname, buffer_size);
MultiByteToWideChar(CP_ACP, 0, impl->_configuration->serverUrl.c_str() + scheme_offset, -1, wide_hostname, static_cast<int>(buffer_size));

hConnect = WinHttpConnect(hSession, wide_hostname, impl->_configuration->port, 0);

Expand All @@ -227,7 +227,7 @@ HTTPResponse RequestModule::sendHTTP(std::string path, std::string data) {

size_t buffer_size = MultiByteToWideChar(CP_ACP, 0, path.c_str(), -1, nullptr, 0);
wchar_t *wide_path = new wchar_t[buffer_size];
MultiByteToWideChar(CP_ACP, 0, path.c_str(), -1, wide_path, buffer_size);
MultiByteToWideChar(CP_ACP, 0, path.c_str(), -1, wide_path, static_cast<int>(buffer_size));

hRequest = WinHttpOpenRequest(hConnect, use_post ? L"POST" : L"GET", wide_path, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, impl->use_https ? WINHTTP_FLAG_SECURE : 0);
delete[] wide_path;
Expand All @@ -240,7 +240,7 @@ HTTPResponse RequestModule::sendHTTP(std::string path, std::string data) {
ok = WinHttpReceiveResponse(hRequest, NULL);
if (ok) {
DWORD dwStatusCode = 0;
DWORD dwSize = sizeof(dwStatusCode);
DWORD dwSize = static_cast<DWORD>(sizeof(dwStatusCode));
WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, WINHTTP_HEADER_NAME_BY_INDEX, &dwStatusCode, &dwSize, WINHTTP_NO_HEADER_INDEX);
response.success = (dwStatusCode >= 200 && dwStatusCode < 300);
if (response.success) {
Expand Down
2 changes: 1 addition & 1 deletion tests/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <string>
using namespace cly;

void valideEventParams(nlohmann::json eventJson, std::string key, int count) {
void valideEventParams(nlohmann::json eventJson, const std::string key, int count) {
CHECK(eventJson["key"].get<std::string>() == key);
CHECK(eventJson["count"].get<int>() == count);
CHECK(std::to_string(eventJson["timestamp"].get<long long>()).size() == 13);
Expand Down
2 changes: 1 addition & 1 deletion tests/storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void validateSizes(std::shared_ptr<StorageModuleBase> storageModule, long long s
/**
* Validates request.
*/
void validateDataEntry(std::shared_ptr<DataEntry> testedEntry, long long id, std::string data) {
void validateDataEntry(std::shared_ptr<DataEntry> testedEntry, long long id, const std::string data) {
CHECK(testedEntry->getId() == id);
CHECK(testedEntry->getData() == data);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static HTTPResponse fakeSendHTTP(bool use_post, const std::string &url, const st

if (http_call.url == "/i") {
response.success = true;
} else if (http_call.url == "/o/sdk" && http_call.data["method"] == "fetch_remote_config") {
} else if ((http_call.url == "/o/sdk") && (http_call.data["method"] == "fetch_remote_config")) {
nlohmann::json remote_config = {{"color", "#FF9900"}, {"playerQueueTimeout", 32}, {"isChristmas", true}};

response.success = true;
Expand Down
2 changes: 1 addition & 1 deletion tests/views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using namespace std::literals::chrono_literals;
* @param isOpenView: set 'true' if it is a open view.
* @param isFirstView: set 'true' if it is very first view.
*/
void validateViewSegmentation(nlohmann::json e, std::string name, std::string &viewId, double duration, bool isOpenView, bool isFirstView = false) {
void validateViewSegmentation(nlohmann::json e, const std::string name, std::string &viewId, double duration, bool isOpenView, bool isFirstView = false) {
CHECK(e["key"].get<std::string>() == "[CLY]_view");
CHECK(e["count"].get<int>() == 1);
CHECK(e["dur"].get<double>() >= duration);
Expand Down