Skip to content

Commit e6aabaa

Browse files
authored
external hash-library fixes (#31)
1 parent 9b55029 commit e6aabaa

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/configservice.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include "configcat/timeutils.h"
44
#include "configcatlogger.h"
55
#include "configfetcher.h"
6-
#include <hash-library/sha1.h>
76
#include <iostream>
87

98
using namespace std;
@@ -119,7 +118,7 @@ void ConfigService::setOffline() {
119118
}
120119

121120
string ConfigService::generateCacheKey(const string& sdkKey) {
122-
return SHA1()(sdkKey + "_" + ConfigFetcher::kConfigJsonName + "_" + ConfigEntry::kSerializationFormatVersion);
121+
return sha1(sdkKey + "_" + ConfigFetcher::kConfigJsonName + "_" + ConfigEntry::kSerializationFormatVersion);
123122
}
124123
tuple<shared_ptr<const ConfigEntry>, std::optional<std::string>, std::exception_ptr> ConfigService::fetchIfOlder(double threshold, bool preferCached) {
125124
{

src/utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
#include "utils.h"
44

5-
#ifndef CONFIGCAT_EXTERNAL_SHA
5+
#ifndef CONFIGCAT_EXTERNAL_SHA_ENABLED
66
#include <hash-library/sha1.h>
77
#include <hash-library/sha256.h>
8-
#endif // CONFIGCAT_EXTERNAL_SHA
8+
#endif // CONFIGCAT_EXTERNAL_SHA_ENABLED
99

1010
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON
1111
#define JS_NUMBER_EPSILON 2.2204460492503130808472633361816e-16
@@ -178,7 +178,7 @@ std::optional<long long> integer_from_string(const std::string& str) {
178178
return value;
179179
}
180180

181-
#ifndef CONFIGCAT_EXTERNAL_SHA
181+
#ifndef CONFIGCAT_EXTERNAL_SHA_ENABLED
182182
SHA1 sha1Calculator;
183183
SHA256 sha256Calculator;
184184

@@ -189,7 +189,7 @@ std::string sha1(const std::string& input) {
189189
std::string sha256(const std::string& input) {
190190
return sha256Calculator(input);
191191
}
192-
#endif // CONFIGCAT_EXTERNAL_SHA
192+
#endif // CONFIGCAT_EXTERNAL_SHA_ENABLED
193193

194194

195195
} // namespace configcat

src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#pragma once
22

3-
#define CONFIGCAT_VERSION "4.0.2"
3+
#define CONFIGCAT_VERSION "4.0.3"

0 commit comments

Comments
 (0)