From 72de494c373c2d6b0ab2c2fed0113fcabad9fbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Szczerbi=C5=84ski?= Date: Wed, 6 Nov 2024 11:22:11 +0100 Subject: [PATCH] Fix vs14 builds --- cpp/lib/CacheFile.cpp | 6 +++--- cpp/lib/CacheFile.hpp | 4 ++-- cpp/lib/CredentialCache.cpp | 4 ++-- cpp/lib/CredentialCache.hpp | 4 ++-- cpp/platform/SecureStorage.cpp | 2 +- cpp/platform/SecureStorage.hpp | 4 ++-- cpp/platform/SecureStorageWin.cpp | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cpp/lib/CacheFile.cpp b/cpp/lib/CacheFile.cpp index 84dee306f1..c5102e9f60 100644 --- a/cpp/lib/CacheFile.cpp +++ b/cpp/lib/CacheFile.cpp @@ -57,7 +57,7 @@ namespace Client { } - std::optional findCacheDirRoot() { + boost::optional findCacheDirRoot() { for (auto const &envVar: CACHE_ROOT_ENV_VARS) { char *root = getenv(envVar.c_str()); @@ -69,7 +69,7 @@ namespace Client { return {}; } - std::optional getCredentialFilePath() + boost::optional getCredentialFilePath() { const auto cacheDirRootOpt = findCacheDirRoot(); if (!cacheDirRootOpt) @@ -194,7 +194,7 @@ namespace Client { } } - std::optional cacheFileGet(picojson::value &cache, const CredentialKey &key) { + boost::optional cacheFileGet(picojson::value &cache, const CredentialKey &key) { ensureObject(cache); picojson::object &cacheObj = cache.get(); diff --git a/cpp/lib/CacheFile.hpp b/cpp/lib/CacheFile.hpp index 014d2433c5..3ae0729ef4 100644 --- a/cpp/lib/CacheFile.hpp +++ b/cpp/lib/CacheFile.hpp @@ -12,7 +12,7 @@ namespace Snowflake { namespace Client { - std::optional getCredentialFilePath(); + boost::optional getCredentialFilePath(); std::string readFile(const std::string &path, picojson::value &result); @@ -22,7 +22,7 @@ namespace Client { void cacheFileRemove(picojson::value &cache, const CredentialKey &key); - std::optional cacheFileGet(picojson::value &cache, const CredentialKey &key); + boost::optional cacheFileGet(picojson::value &cache, const CredentialKey &key); } diff --git a/cpp/lib/CredentialCache.cpp b/cpp/lib/CredentialCache.cpp index b8325e2cd5..574e993a3b 100644 --- a/cpp/lib/CredentialCache.cpp +++ b/cpp/lib/CredentialCache.cpp @@ -24,7 +24,7 @@ namespace Client { class FileCredentialCache : public CredentialCache { public: - std::optional get(const CredentialKey& key) override + boost::optional get(const CredentialKey& key) override { auto pathOpt = getCredentialFilePath(); if (!pathOpt) @@ -125,7 +125,7 @@ namespace Client { class SecureStorageCredentialCache : public CredentialCache { public: - std::optional get(const CredentialKey &key) override { + boost::optional get(const CredentialKey &key) override { return storage.retrieveToken(key.host, key.user, credTypeToString(key.type)); } diff --git a/cpp/lib/CredentialCache.hpp b/cpp/lib/CredentialCache.hpp index 7b214f91fb..4454be9d9b 100644 --- a/cpp/lib/CredentialCache.hpp +++ b/cpp/lib/CredentialCache.hpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include "snowflake/mfa_token_cache.h" @@ -26,7 +26,7 @@ namespace Client { public: static CredentialCache *make(); - virtual std::optional get(const CredentialKey &key) = 0; + virtual boost::optional get(const CredentialKey &key) = 0; virtual bool save(const CredentialKey &key, const std::string &credential) = 0; diff --git a/cpp/platform/SecureStorage.cpp b/cpp/platform/SecureStorage.cpp index 6704837cd9..cee8c17b74 100644 --- a/cpp/platform/SecureStorage.cpp +++ b/cpp/platform/SecureStorage.cpp @@ -30,7 +30,7 @@ namespace Client { return true; } - std::optional SecureStorage::retrieveToken(const std::string& host, + boost::optional SecureStorage::retrieveToken(const std::string& host, const std::string& username, const std::string& credType) { diff --git a/cpp/platform/SecureStorage.hpp b/cpp/platform/SecureStorage.hpp index 0d27e89a2d..e130091fbe 100644 --- a/cpp/platform/SecureStorage.hpp +++ b/cpp/platform/SecureStorage.hpp @@ -8,7 +8,7 @@ #include #include -#include +#include namespace Snowflake { @@ -53,7 +53,7 @@ namespace Client { * @param tokenLen - on return, length of the credential retrieved * @return True / False */ - std::optional retrieveToken(const std::string& host, + boost::optional retrieveToken(const std::string& host, const std::string& username, const std::string& credType); diff --git a/cpp/platform/SecureStorageWin.cpp b/cpp/platform/SecureStorageWin.cpp index d3f4c4860c..b12a548bcc 100644 --- a/cpp/platform/SecureStorageWin.cpp +++ b/cpp/platform/SecureStorageWin.cpp @@ -89,7 +89,7 @@ namespace Client std::copy( retcreds->CredentialBlob, retcreds->CredentialBlob + blobSize, - std::back_inserter(token) + std::back_insert_iterator(token) ); CXX_LOG_DEBUG("Copied token");