From e82bf09f26a5020f8e9bb6f4cb279cc3630291f3 Mon Sep 17 00:00:00 2001 From: 7415963987456321 Date: Wed, 25 Nov 2020 12:54:01 +0000 Subject: [PATCH 1/5] Remove unused variable to silence compiler warning. --- src/rpcmisc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index f7e249077..173953031 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -855,7 +855,6 @@ Value getubilist(const Array& params, bool fHelp) ServiceItemList.GetUbiList(info); - int i = 0; for(std::set< std::pair< std::string, std::tuple > >::const_iterator it = info.begin(); it!=info.end(); it++ ) { @@ -1193,4 +1192,4 @@ Value verifymessage(const Array& params, bool fHelp) return (pubkey.GetID() == keyID); } -#pragma clang diagnostic pop \ No newline at end of file +#pragma clang diagnostic pop From 1ef1cd41987e5990d594d84117a459d93433b4ac Mon Sep 17 00:00:00 2001 From: 7415963987456321 Date: Wed, 25 Nov 2020 12:55:06 +0000 Subject: [PATCH 2/5] Whitespace fixes --- src/rpcmisc.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 173953031..eed62b4a9 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -874,18 +874,18 @@ Value getdexlist(const Array& params, bool fHelp) throw runtime_error("getdexlist \"address\"\n" "Returns all DEX addresses that belong to the specified DEX service address\n" ); - + Object obj; std::multiset>> info; ServiceItemList.GetDexList(info); - + for(std::set< std::pair< std::string, std::tuple > >::const_iterator it = info.begin(); it!=info.end(); it++ ) { obj.push_back(Pair("DEX Address: ", it->first)); obj.push_back(Pair("Description: ", get<2>(it->second))); } - + return obj; } @@ -896,18 +896,18 @@ Value getnpolist(const Array& params, bool fHelp) throw runtime_error("getnpolist\n" "Returns all non profit organization addresses\n" ); - + Object obj; /*std::multiset>> info; ServiceItemList.GetNpoList(info); - + for(std::set< std::pair< CScript, std::tuple > >::const_iterator it = info.begin(); it!=info.end(); it++ ) { obj.push_back(Pair("Npo name: ", get<1>(it->second))); obj.push_back(Pair("Npo address: ", get<2>(it->second))); }*/ - + return obj; } @@ -918,18 +918,18 @@ Value getbooklist(const Array& params, bool fHelp) throw runtime_error("getbooklist \"address\"\n" "Returns all book chapters that belong to the specified book service address\n" ); - + Object obj; std::multiset>> info; ServiceItemList.GetBookList(info); - + //TODO bæta við book name, book author og year for(std::set< std::pair< std::string, std::tuple > >::const_iterator it = info.begin(); it!=info.end(); it++ ) { obj.push_back(Pair("Chapter Number: ", get<2>(it->second))); obj.push_back(Pair("Chapter Address: ", it->first)); } - + return obj; } From b5856381a6a91f67a45bb43e9e8b53d4a60c1047 Mon Sep 17 00:00:00 2001 From: 7415963987456321 Date: Wed, 25 Nov 2020 14:20:12 +0000 Subject: [PATCH 3/5] Use raw string literal to silence warnings --- src/util.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/util.h b/src/util.h index 2696c4e55..73672aa97 100644 --- a/src/util.h +++ b/src/util.h @@ -262,8 +262,7 @@ inline bool is_number(std::string s) inline bool is_date(std::string s) { - std::string date = "([1-9]|([012][0-9])|(3[01]))\/([0]{0,1}[1-9]|1[012])\/[0-9]{4}(([01]{0,1}[0-9])|(2[0-4])):[0-5][0-9]"; - std::regex expr(date); + std::regex expr(R"--(([1-9]|([012][0-9])|(3[01]))\/([0]{0,1}[1-9]|1[012])\/[0-9]{4}(([01]{0,1}[0-9])|(2[0-4])):[0-5][0-9])--"); if (std::regex_match(s, expr)) { return true; } From dd33df537dd006b28dd1e45b393d3084a883a395 Mon Sep 17 00:00:00 2001 From: 7415963987456321 Date: Wed, 25 Nov 2020 15:20:09 +0000 Subject: [PATCH 4/5] Refactor is_before to silence compiler warnings. --- src/util.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/util.h b/src/util.h index 73672aa97..64ad41953 100644 --- a/src/util.h +++ b/src/util.h @@ -273,18 +273,19 @@ inline bool is_before(std::string dateOfTicket) { time_t now = time(NULL); time_t tTicket; - int yy, month, dd, hh, mm; - struct tm whenTicket = {0}; + struct tm whenTicket; + memset(&whenTicket, 0, sizeof(struct tm)); const char *zTicket = dateOfTicket.c_str(); - - sscanf(zTicket, "%2d/%2d/%4d %2d:%2d", &dd, &month, &yy, &hh, &mm); - whenTicket.tm_mday = dd; - whenTicket.tm_mon = month - 1; - whenTicket.tm_year = yy - 1900; - whenTicket.tm_hour = hh; - whenTicket.tm_min = mm; whenTicket.tm_isdst = -1; + sscanf(zTicket, "%2d/%2d/%4d %2d:%2d", + &whenTicket.tm_mday, + &whenTicket.tm_mon, + &whenTicket.tm_year, + &whenTicket.tm_hour, + &whenTicket.tm_min + ); + tTicket = mktime(&whenTicket); return tTicket > now; From 737d55aa30a33f0be4f7fd12c2a49982b9b45fe8 Mon Sep 17 00:00:00 2001 From: 7415963987456321 Date: Thu, 26 Nov 2020 15:18:51 +0000 Subject: [PATCH 5/5] Use size_t in loop to silence compiler warnings. --- src/regex.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/regex.h b/src/regex.h index 89e38574e..90f5c20c6 100644 --- a/src/regex.h +++ b/src/regex.h @@ -44,7 +44,7 @@ bool isRegex(const string& txData) { lines.push_back(line); } - for (int i = 0; i < lines.size(); i++) { + for (size_t i = 0; i < lines.size(); i++) { std::string strengur = lines[i]; std::regex expr(strengur); @@ -59,4 +59,4 @@ bool isRegex(const string& txData) { infile.close(); -} \ No newline at end of file +}