From 6da90a37164a41781e486e729c1d15183ed823da Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 2 Jan 2019 12:08:57 -0600 Subject: [PATCH 1/5] chore: Remove static decoration from base path functions Removed static from base path functions to clear warnings. If this function is in a header it is public and should not be static. --- src/include/cpp-client/api/paths.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/include/cpp-client/api/paths.h b/src/include/cpp-client/api/paths.h index fcbc31c2..aab2c7fe 100644 --- a/src/include/cpp-client/api/paths.h +++ b/src/include/cpp-client/api/paths.h @@ -23,7 +23,7 @@ namespace Paths { namespace Blocks { - static const char* base() { return "/api/v2/blocks"; }; + const char* base() { return "/api/v2/blocks"; }; /***/ extern std::string get(Host& newHost, const char *const blockId); /***/ @@ -39,7 +39,7 @@ namespace Blocks namespace Delegates { - static const char* base() { return "/api/v2/delegates"; }; + const char* base() { return "/api/v2/delegates"; }; /***/ extern std::string get(Host& newHost, const char *const identifier); /***/ @@ -55,7 +55,7 @@ namespace Delegates namespace Node { - static const char* base() { return "/api/v2/node"; }; + const char* base() { return "/api/v2/node"; }; /***/ extern std::string configuration(Host& newHost); /***/ @@ -69,7 +69,7 @@ namespace Node namespace Peers { - static const char* base() { return "/api/v2/peers"; }; + const char* base() { return "/api/v2/peers"; }; /***/ extern std::string get(Host& newHost, const char *const ip); /***/ @@ -81,7 +81,7 @@ namespace Peers namespace Transactions { - static const char* base() { return "/api/v2/transactions"; }; + const char* base() { return "/api/v2/transactions"; }; /***/ extern std::string getUnconfirmed(Host& newHost, const char *const identifier); /***/ @@ -101,7 +101,7 @@ namespace Transactions namespace Votes { - static const char* base() { return "/api/v2/votes"; }; + const char* base() { return "/api/v2/votes"; }; /***/ extern std::string get(Host& newHost, const char *const identifier); /***/ @@ -113,7 +113,7 @@ namespace Votes namespace Wallets { - static const char* base() { return "/api/v2/wallets"; }; + const char* base() { return "/api/v2/wallets"; }; /***/ extern std::string get(Host& newHost, const char *const identifier); /***/ From 1e8678e77d4f1545bacf3c3fc73e130c83d0b20e Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 2 Jan 2019 12:15:47 -0600 Subject: [PATCH 2/5] chore: Cleared signed/unsigned mismatch warnings. --- src/api/paths.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/paths.cpp b/src/api/paths.cpp index cb142eaa..958993c1 100644 --- a/src/api/paths.cpp +++ b/src/api/paths.cpp @@ -43,9 +43,9 @@ std::pair Ark::Client::API::Paths::Blocks::search( char uri[96] = { }; snprintf(uri, sizeof(uri), "%s%s/search?limit=%d&page=%d", newHost.toString().c_str(), Ark::Client::API::Paths::Blocks::base(), limit, page); std::string parameterBuffer; - int count = 0; + auto count = 0ul; for (const auto& p : bodyParameters) { - count++; + ++count; parameterBuffer += p.first + '=' + p.second; if (bodyParameters.size() > 1 && count < bodyParameters.size()) { parameterBuffer += '&'; @@ -228,9 +228,9 @@ std::pair Ark::Client::API::Paths::Transactions::searc char uri[96] = { }; snprintf(uri, sizeof(uri), "%s%s/search?limit=%d&page=%d", newHost.toString().c_str(), Ark::Client::API::Paths::Transactions::base(), limit, page); std::string parameterBuffer; - int count = 0; + auto count = 0ul; for (const auto& p : bodyParameters) { - count++; + ++count; parameterBuffer += p.first + '=' + p.second; if (bodyParameters.size() > 1 && count < bodyParameters.size()) { parameterBuffer += '&'; @@ -364,9 +364,9 @@ std::pair Ark::Client::API::Paths::Wallets::search( char uri[96] = { }; snprintf(uri, sizeof(uri), "%s%s/search?limit=%d&page=%d", newHost.toString().c_str(), Ark::Client::API::Paths::Wallets::base(), limit, page); std::string parameterBuffer; - int count = 0; + auto count = 0ul; for (const auto& p : bodyParameters) { - count++; + ++count; parameterBuffer += p.first + '=' + p.second; if (bodyParameters.size() > 1 && count < bodyParameters.size()) { parameterBuffer += '&'; From 2e2396695984af744abfc29bdffc3e79f33e27b9 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Wed, 2 Jan 2019 14:07:52 -0600 Subject: [PATCH 3/5] fix: Make base path extern --- src/include/cpp-client/api/paths.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/include/cpp-client/api/paths.h b/src/include/cpp-client/api/paths.h index aab2c7fe..aefd56c2 100644 --- a/src/include/cpp-client/api/paths.h +++ b/src/include/cpp-client/api/paths.h @@ -23,7 +23,7 @@ namespace Paths { namespace Blocks { - const char* base() { return "/api/v2/blocks"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const blockId); /***/ @@ -39,7 +39,7 @@ namespace Blocks namespace Delegates { - const char* base() { return "/api/v2/delegates"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const identifier); /***/ @@ -55,7 +55,7 @@ namespace Delegates namespace Node { - const char* base() { return "/api/v2/node"; }; + extern const char* base(); /***/ extern std::string configuration(Host& newHost); /***/ @@ -69,7 +69,7 @@ namespace Node namespace Peers { - const char* base() { return "/api/v2/peers"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const ip); /***/ @@ -81,7 +81,7 @@ namespace Peers namespace Transactions { - const char* base() { return "/api/v2/transactions"; }; + extern const char* base(); /***/ extern std::string getUnconfirmed(Host& newHost, const char *const identifier); /***/ @@ -101,7 +101,7 @@ namespace Transactions namespace Votes { - const char* base() { return "/api/v2/votes"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const identifier); /***/ @@ -113,7 +113,7 @@ namespace Votes namespace Wallets { - const char* base() { return "/api/v2/wallets"; }; + extern const char* base(); /***/ extern std::string get(Host& newHost, const char *const identifier); /***/ From 29bb5cf809b7b6f06d32887079351ebe473d2fcd Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Wed, 2 Jan 2019 14:07:56 -0600 Subject: [PATCH 4/5] fix: Make base path extern --- src/api/paths.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/api/paths.cpp b/src/api/paths.cpp index 958993c1..144a2c05 100644 --- a/src/api/paths.cpp +++ b/src/api/paths.cpp @@ -4,6 +4,9 @@ /** * Blocks **/ + +const char* Ark::Client::API::Paths::Blocks::base() { return "/api/v2/blocks"; } + std::string Ark::Client::API::Paths::Blocks::get(Host& newHost, const char *const blockId) { char url[128] = {}; @@ -59,6 +62,9 @@ std::pair Ark::Client::API::Paths::Blocks::search( /** * Delegates **/ + +const char* Ark::Client::API::Paths::Delegates::base() { return "/api/v2/delegates"; } + std::string Ark::Client::API::Paths::Delegates::get(Host& newHost, const char *const identifier) { char url[128] = {}; @@ -109,6 +115,9 @@ std::string Ark::Client::API::Paths::Delegates::voters( /** * Delegates **/ + +const char* Ark::Client::API::Paths::Node::base() { return "/api/v2/node"; } + std::string Ark::Client::API::Paths::Node::configuration(Host& newHost) { char url[128] = {}; @@ -139,6 +148,9 @@ std::string Ark::Client::API::Paths::Node::syncing(Host& newHost) /** * Peers **/ + +const char* Ark::Client::API::Paths::Peers::base() { return "/api/v2/peers"; } + std::string Ark::Client::API::Paths::Peers::get(Host& newHost, const char *const ip) { char url[128] = {}; @@ -163,6 +175,9 @@ std::string Ark::Client::API::Paths::Peers::all( /** * Transactions **/ + +const char* Ark::Client::API::Paths::Transactions::base() { return "/api/v2/transactions"; } + std::string Ark::Client::API::Paths::Transactions::getUnconfirmed( Host& newHost, const char *const identifier @@ -244,6 +259,9 @@ std::pair Ark::Client::API::Paths::Transactions::searc /** * Votes **/ + +const char* Ark::Client::API::Paths::Votes::base() { return "/api/v2/votes"; } + std::string Ark::Client::API::Paths::Votes::get(Host& newHost, const char *const identifier) { char url[128] = { }; @@ -268,6 +286,9 @@ std::string Ark::Client::API::Paths::Votes::all( /** * Wallets **/ + +const char* Ark::Client::API::Paths::Wallets::base() { return "/api/v2/wallets"; } + std::string Ark::Client::API::Paths::Wallets::get( Host& newHost, const char *const identifier From 710d07bd6ef960a4742176569d7aee87d3bd071a Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Wed, 2 Jan 2019 14:08:16 -0600 Subject: [PATCH 5/5] misc: Fix typo --- src/api/paths.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/paths.cpp b/src/api/paths.cpp index 144a2c05..59e0e508 100644 --- a/src/api/paths.cpp +++ b/src/api/paths.cpp @@ -113,7 +113,7 @@ std::string Ark::Client::API::Paths::Delegates::voters( /******/ /** - * Delegates + * Node **/ const char* Ark::Client::API::Paths::Node::base() { return "/api/v2/node"; }