diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-02-19 14:05:38 +0000 | 
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-02-19 14:05:38 +0000 | 
| commit | 47e8477a2ea5983ba918c811a15a67c5b2cea25c (patch) | |
| tree | aed25aa486b562207ccbf77b9ec706ca94e74107 | |
| parent | Install ice to new standard path (diff) | |
| download | gentoobrowse-api-47e8477a2ea5983ba918c811a15a67c5b2cea25c.tar.bz2 gentoobrowse-api-47e8477a2ea5983ba918c811a15a67c5b2cea25c.tar.xz gentoobrowse-api-47e8477a2ea5983ba918c811a15a67c5b2cea25c.zip  | |
Fix first round of tools warnings
32 files changed, 115 insertions, 67 deletions
diff --git a/Jamroot.jam b/Jamroot.jam index 5913b40..6fb1bd3 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -17,10 +17,28 @@ project  		<variant>release:<lto>on  		<variant>debug:<warnings>extra  		<variant>debug:<warnings-as-errors>on +		<variant>debug:<cflags>-Wnon-virtual-dtor +		<variant>debug:<cflags>-Wold-style-cast +		<variant>debug:<cflags>-Wcast-align +		<variant>debug:<cflags>-Wunused +		<variant>debug:<cflags>-Woverloaded-virtual +		<variant>debug:<cflags>-Wpedantic +		<variant>debug:<cflags>-Wconversion +		<variant>debug:<cflags>-Wsign-conversion +		<variant>debug:<cflags>-Wnull-dereference +		<variant>debug:<cflags>-Wdouble-promotion +		<variant>debug:<cflags>-Wformat=2 +		<toolset>gcc,<variant>debug:<cflags>-Wduplicated-cond +		<toolset>gcc,<variant>debug:<cflags>-Wduplicated-branches +		<toolset>gcc,<variant>debug:<cflags>-Wlogical-op +		<toolset>gcc,<variant>debug:<cflags>-Wuseless-cast  		<variant>coverage:<coverage>on  		<toolset>tidy:<define>ICE_IGNORE_VERSION -		<toolset>tidy:<exclude>cxxstd-17-iso/maintenance.h +		<toolset>tidy:<define>ICE_MEMBER_IMPORT_EXPORT +		<toolset>tidy:<exclude>cxxstd-20-iso/maintenance.h  		<toolset>tidy:<exclude>unpackPqTextArray.cpp +		<toolset>tidy:<librarydef>boost +		<toolset>tidy:<librarydef>std  	;  build-project gentoobrowse-api ; diff --git a/gentoobrowse-api/domain/unpackPqTextArray.ll b/gentoobrowse-api/domain/unpackPqTextArray.ll index 627e142..d212d58 100644 --- a/gentoobrowse-api/domain/unpackPqTextArray.ll +++ b/gentoobrowse-api/domain/unpackPqTextArray.ll @@ -10,8 +10,15 @@  %{  #include "unpackPqTextArray.h"  #include <boost/algorithm/string/trim.hpp> +#pragma GCC diagnostic ignored "-Wconversion"  #pragma GCC diagnostic ignored "-Wsign-compare"  #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#pragma GCC diagnostic ignored "-Wold-style-cast" +#if __clang__ +#pragma GCC diagnostic ignored "-Wnull-conversion" +#else +#pragma GCC diagnostic ignored "-Wuseless-cast" +#endif  %}  begin "{" diff --git a/gentoobrowse-api/service/Jamfile.jam b/gentoobrowse-api/service/Jamfile.jam index a5713e1..b2edc55 100644 --- a/gentoobrowse-api/service/Jamfile.jam +++ b/gentoobrowse-api/service/Jamfile.jam @@ -4,8 +4,8 @@ import generators : register-standard ;  type.register XSLT : xslt ; -generators.register-standard xxd.i : XSLT : C H ; -generators.register-standard xxd.i : CSS : C H ; +generators.register-standard xxd.i : XSLT : CPP H ; +generators.register-standard xxd.i : CSS : CPP H ;  actions xxd.i  { diff --git a/gentoobrowse-api/service/depend.cpp b/gentoobrowse-api/service/depend.cpp index 15588d8..8b2e29b 100644 --- a/gentoobrowse-api/service/depend.cpp +++ b/gentoobrowse-api/service/depend.cpp @@ -1,5 +1,5 @@  #include "depend.h" -#include <boost/algorithm/string/split.hpp> +#include "wrap/regex.h"  #include <lexer-regex.h>  AdHoc::Lexer::PatternPtr WhenUse_Begin( @@ -16,7 +16,7 @@ AdHoc::Lexer::PatternPtr AtomSpec(AdHoc::LexerMatchers::regex(  		"(-([0-9][.0-9]*[[:alpha:]]?\\*?((_(alpha|beta|pre|rc|p))?[[:digit:]]*)*(-r[[:digit:]]+)?))?" // version  		"(:([^/ []+(\\/[^ []+)?))?" // slot  		"(\\[([^]]+)\\])?(\\s+|$)", -		(GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_UNGREEDY))); // use +		static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_UNGREEDY))); // use  const std::string InWhen("InWhen");  const std::string InOr("InOr"); @@ -39,9 +39,7 @@ namespace Portage {  		{  			std::vector<T> rtn;  			if (x) { -				boost::algorithm::split(rtn, *x, [](auto c) { -					return c == ','; -				}); +				Glib::Regex::split_simple(",", *x).assign_to(rtn);  				std::sort(rtn.begin(), rtn.end());  			}  			return rtn; diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp index 6bcf149..ae241b1 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp @@ -3,9 +3,9 @@  #include "utils/dbUtils.h"  #include "utils/ebuildCacheParser.h"  #include "utils/splitEbuildProps.h" +#include "wrap/regex.h"  #include <boost/algorithm/string/join.hpp>  #include <boost/date_time/posix_time/conversion.hpp> -#include <glibmm/regex.h>  #include <modifycommand.h>  #include <optionalUtils.h>  #include <selectcommandUtil.impl.h> diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.cpp b/gentoobrowse-api/service/maintenance/masksProcessor.cpp index 86c9c1f..242f3ac 100644 --- a/gentoobrowse-api/service/maintenance/masksProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/masksProcessor.cpp @@ -3,10 +3,10 @@  #include "sql/maintenance/masksFixDates.sql.h"  #include "sql/maintenance/masksSets.sql.h"  #include "utils/dbUtils.h" +#include "wrap/regex.h"  #include <boost/algorithm/string/join.hpp>  #include <boost/algorithm/string/trim.hpp>  #include <fileUtils.h> -#include <glibmm/regex.h>  #include <mask.h>  #include <modifycommand.h>  #include <sqlWriter.h> @@ -70,7 +70,7 @@ namespace Gentoo {  				}  				DB::ModifyCommand * i;  			}; -			MaskInserter(tempTable.second.get()).extract((gchar *)f.data, f.getStat().st_size); +			MaskInserter(tempTable.second.get()).extract(f.sv<gchar>().data(), f.sv<gchar>().length());  			// Dates are hand-typed and sometimes typos occur... ensure they're at  			// least within the range of Boost ptimes.  			while (sql::maintenance::masksFixDates.modify(dbc)->execute()) diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp index df51460..c56bc55 100644 --- a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp @@ -1,12 +1,12 @@  #include "updatesProcessor.h"  #include "utils/dbUtils.h"  #include "utils/entityWhereFilter.h" +#include "wrap/regex.h"  #include <boost/algorithm/string/join.hpp>  #include <boost/algorithm/string/predicate.hpp>  #include <buffer.h>  #include <fileUtils.h>  #include <fstream> -#include <glibmm/regex.h>  #include <modifycommand.h>  #include <selectcommandUtil.impl.h>  #include <sql/maintenance/categoryInsert.sql.h> @@ -150,7 +150,7 @@ namespace Gentoo {  				DB::Connection * dbc, int64_t, const StringList & fn, const std::filesystem::path & path)  		{  			AdHoc::FileUtils::MemMap u(path); -			Glib::ustring d(std::string(reinterpret_cast<const char *>(u.data), u.getStat().st_size)); +			Glib::ustring d(std::string(u.sv()));  			Glib::MatchInfo matches;  			auto i = Utils::Database::tablePatchInserter(dbc, *up);  			i->bindParamS(4, fn.back().c_str()); diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp index 2ab2632..6f0775b 100644 --- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp @@ -1,7 +1,7 @@  #include "useGlobalProcessor.h"  #include "utils/dbUtils.h" +#include "wrap/regex.h"  #include <fileUtils.h> -#include <glibmm/regex.h>  #include <modifycommand.h>  #include <tablepatch.h> @@ -46,7 +46,7 @@ namespace Gentoo {  			p.cols = {"use", "description"};  			AdHoc::FileUtils::MemMap u(path); -			Glib::ustring d(std::string(reinterpret_cast<const char *>(u.data), u.getStat().st_size)); +			Glib::ustring d(std::string(u.sv()));  			Glib::MatchInfo matches;  			auto i = Utils::Database::tablePatchInserter(dbc, p);  			for (useDesc->match(d, matches); matches.get_match_count() == 3; matches.next()) { diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp index c213c26..d42f740 100644 --- a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp @@ -4,9 +4,9 @@  #include "sql/maintenance/useGroupsInsert.sql.h"  #include "utils/dbUtils.h"  #include "utils/entityWhereFilter.h" +#include "wrap/regex.h"  #include <boost/algorithm/string/predicate.hpp>  #include <fileUtils.h> -#include <glibmm/regex.h>  #include <modifycommand.h>  #include <selectcommandUtil.impl.h>  #include <tablepatch.h> @@ -69,7 +69,7 @@ namespace Gentoo {  			p.where = &gwf;  			AdHoc::FileUtils::MemMap u(path); -			Glib::ustring d(std::string(reinterpret_cast<const char *>(u.data), u.getStat().st_size)); +			Glib::ustring d(std::string(u.sv()));  			Glib::MatchInfo matches;  			auto i = Utils::Database::tablePatchInserter(dbc, p);  			i->bindParamI(2, useGroupId); diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp index 5495b46..2379410 100644 --- a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp @@ -1,8 +1,8 @@  #include "useLocalProcessor.h"  #include "sql/maintenance/useLocalMap.sql.h"  #include "utils/dbUtils.h" +#include "wrap/regex.h"  #include <fileUtils.h> -#include <glibmm/regex.h>  #include <modifycommand.h>  #include <sqlWriter.h>  #include <tablepatch.h> @@ -51,7 +51,7 @@ namespace Gentoo {  			p.cols = {"packageId", "use", "description"};  			AdHoc::FileUtils::MemMap u(path); -			Glib::ustring d(std::string(reinterpret_cast<const char *>(u.data), u.getStat().st_size)); +			Glib::ustring d(std::string(u.sv()));  			Glib::MatchInfo matches;  			auto i = tempTable.second;  			for (useDesc->match(d, matches); matches.get_match_count() == 5; matches.next()) { diff --git a/gentoobrowse-api/service/maintenanceCommon.cpp b/gentoobrowse-api/service/maintenanceCommon.cpp index eb11648..77f77ae 100644 --- a/gentoobrowse-api/service/maintenanceCommon.cpp +++ b/gentoobrowse-api/service/maintenanceCommon.cpp @@ -98,10 +98,8 @@ namespace Gentoo {  									return AdHoc::containerContains(t.categoryids, c->categoryid);  								});  						for (auto pid : t.packageids) { -							auto par = portage->getPackageAsync(pid); -							auto vsar = portage->getPackageVersionsAsync(pid); -							nc.packages.push_back(par.get()); -							auto vs = vsar.get(); +							nc.packages.emplace_back(portage->getPackage(pid)); +							auto vs = portage->getPackageVersions(pid);  							std::copy_if(vs.begin(), vs.end(), std::back_inserter(nc.ebuilds),  									[&t](const Gentoo::EbuildPtr & v) {  										return AdHoc::containerContains(t.ebuildids, v->ebuildid); diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp index 503a1cf..28940da 100644 --- a/gentoobrowse-api/service/maintenanceGitOperations.cpp +++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp @@ -67,7 +67,7 @@ namespace Gentoo {  				// Collect all files change in commit from all parents  				std::unique_ptr<git_tree, void (*)(git_tree *)> parentTree(nullptr, git_tree_free);  				if (git_commit_parentcount(commit.get()) > 0) { -					auto parentCommit = gitSafeGet(git_commit_parent, git_commit_free, commit.get(), 0); +					auto parentCommit = gitSafeGet(git_commit_parent, git_commit_free, commit.get(), 0U);  					// Get parent tree  					parentTree = gitSafeGet(git_commit_tree, git_tree_free, parentCommit.get());  				} diff --git a/gentoobrowse-api/service/mask.cpp b/gentoobrowse-api/service/mask.cpp index 4d8975c..6f4d1ac 100644 --- a/gentoobrowse-api/service/mask.cpp +++ b/gentoobrowse-api/service/mask.cpp @@ -3,9 +3,10 @@  namespace Portage {  	namespace Utils { -		static AdHoc::Lexer::PatternPtr maskHead = AdHoc::LexerMatchers::regex( -				"^# ([^<\n]+)? ?(<(.+?@[^\n>]+)>?)? \\((\\d{4}-\\d{2}-\\d{1,2})\\)$\n", -				(GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_CASELESS | G_REGEX_UNGREEDY | G_REGEX_MULTILINE)); +		static AdHoc::Lexer::PatternPtr maskHead +				= AdHoc::LexerMatchers::regex("^# ([^<\n]+)? ?(<(.+?@[^\n>]+)>?)? \\((\\d{4}-\\d{2}-\\d{1,2})\\)$\n", +						static_cast<GRegexCompileFlags>( +								G_REGEX_OPTIMIZE | G_REGEX_CASELESS | G_REGEX_UNGREEDY | G_REGEX_MULTILINE));  		static AdHoc::Lexer::PatternPtr maskDesc = AdHoc::LexerMatchers::regex("^# *([^\n]*)$\n", G_REGEX_MULTILINE);  		static AdHoc::Lexer::PatternPtr atom = AdHoc::LexerMatchers::regex("^([^\n/]+/[^\n]*)$\n?", G_REGEX_MULTILINE);  		static AdHoc::Lexer::PatternPtr end = AdHoc::LexerMatchers::regex("^\\s*$\n", G_REGEX_MULTILINE); diff --git a/gentoobrowse-api/service/mask.h b/gentoobrowse-api/service/mask.h index e4a3748..abdf6b0 100644 --- a/gentoobrowse-api/service/mask.h +++ b/gentoobrowse-api/service/mask.h @@ -1,7 +1,7 @@  #ifndef GENTOOBROWSE_SERVICE_MASK_H  #define GENTOOBROWSE_SERVICE_MASK_H -#include <glibmm/ustring.h> +#include "wrap/ustring.h"  #include <lexer.h>  #include <list>  #include <optional> @@ -11,6 +11,7 @@ namespace Portage {  		class Masks : public AdHoc::Lexer {  		protected:  			Masks(); +			virtual ~Masks() = default;  			virtual void consume() const = 0; diff --git a/gentoobrowse-api/service/news.cpp b/gentoobrowse-api/service/news.cpp index 15877c0..62e33ef 100644 --- a/gentoobrowse-api/service/news.cpp +++ b/gentoobrowse-api/service/news.cpp @@ -2,22 +2,22 @@  #include <boost/algorithm/string/split.hpp>  #include <lexer-regex.h> -AdHoc::Lexer::PatternPtr Title( -		AdHoc::LexerMatchers::regex("^Title: (.+)$\\s", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); +AdHoc::Lexer::PatternPtr Title(AdHoc::LexerMatchers::regex( +		"^Title: (.+)$\\s", static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE)));  AdHoc::Lexer::PatternPtr DisplayIfInstalled(AdHoc::LexerMatchers::regex( -		"^Display-If-Installed: (.+)$\\s", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); +		"^Display-If-Installed: (.+)$\\s", static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE)));  AdHoc::Lexer::PatternPtr Author(AdHoc::LexerMatchers::regex( -		"^Author: (.+) <([^>]+)>$\\s", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); -AdHoc::Lexer::PatternPtr Posted(AdHoc::LexerMatchers::regex( -		"^Posted: ([0-9]{4}-[0-9]{2}-[0-9]{2})$\\s", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); -AdHoc::Lexer::PatternPtr IgnoredHeader( -		AdHoc::LexerMatchers::regex("^[^ :]+: .+$\\s", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); +		"^Author: (.+) <([^>]+)>$\\s", static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); +AdHoc::Lexer::PatternPtr Posted(AdHoc::LexerMatchers::regex("^Posted: ([0-9]{4}-[0-9]{2}-[0-9]{2})$\\s", +		static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); +AdHoc::Lexer::PatternPtr IgnoredHeader(AdHoc::LexerMatchers::regex( +		"^[^ :]+: .+$\\s", static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE)));  AdHoc::Lexer::PatternPtr BlankLine( -		AdHoc::LexerMatchers::regex("^$\\s", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); -AdHoc::Lexer::PatternPtr BodyText( -		AdHoc::LexerMatchers::regex("^(.*)$\\s?", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); -AdHoc::Lexer::PatternPtr Link(AdHoc::LexerMatchers::regex( -		"^\\[[[:digit:]]+\\] ([[:alpha:]]+://.*)$\\s?", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); +		AdHoc::LexerMatchers::regex("^$\\s", static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); +AdHoc::Lexer::PatternPtr BodyText(AdHoc::LexerMatchers::regex( +		"^(.*)$\\s?", static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE))); +AdHoc::Lexer::PatternPtr Link(AdHoc::LexerMatchers::regex("^\\[[[:digit:]]+\\] ([[:alpha:]]+://.*)$\\s?", +		static_cast<GRegexCompileFlags>(G_REGEX_OPTIMIZE | G_REGEX_MULTILINE)));  const std::string Body("Body"); diff --git a/gentoobrowse-api/service/notificationsimpl.cpp b/gentoobrowse-api/service/notificationsimpl.cpp index ad5ac91..76a0bfd 100644 --- a/gentoobrowse-api/service/notificationsimpl.cpp +++ b/gentoobrowse-api/service/notificationsimpl.cpp @@ -7,14 +7,16 @@  #include <slicer/slicer.h>  #include <string.h> +#define BADCAST(str) reinterpret_cast<const unsigned char *>(str) +  namespace Gentoo {  	namespace Service {  		xmlDocPtr  		xsltDocLoaderFunc(const xmlChar * URI, xmlDictPtr, int, void *, xsltLoadType)  		{  #define MATCH(name) \ -	if (xmlStrcmp(URI, BAD_CAST #name ".xslt") == 0) { \ -		return xmlParseMemory((char *)name##_xslt, name##_xslt_len); \ +	if (xmlStrcmp(URI, BADCAST(#name ".xslt")) == 0) { \ +		return xmlParseMemory(reinterpret_cast<const char *>(name##_xslt), static_cast<int>(name##_xslt_len)); \  	}  			MATCH(base)  			MATCH(news) @@ -26,8 +28,8 @@ namespace Gentoo {  		Notifications::Notifications()  		{  			xsltSetLoaderFunc(&xsltDocLoaderFunc); -			news = xsltSSPtr(xsltParseStylesheetFile(BAD_CAST "news.xslt"), xsltFreeStylesheet); -			signup = xsltSSPtr(xsltParseStylesheetFile(BAD_CAST "signup.xslt"), xsltFreeStylesheet); +			news = xsltSSPtr(xsltParseStylesheetFile(BADCAST("news.xslt")), xsltFreeStylesheet); +			signup = xsltSSPtr(xsltParseStylesheetFile(BADCAST("signup.xslt")), xsltFreeStylesheet);  			xsltSetLoaderFunc(NULL);  		} diff --git a/gentoobrowse-api/service/utils/ebuildCacheParser.h b/gentoobrowse-api/service/utils/ebuildCacheParser.h index e881e53..4fed766 100644 --- a/gentoobrowse-api/service/utils/ebuildCacheParser.h +++ b/gentoobrowse-api/service/utils/ebuildCacheParser.h @@ -1,9 +1,9 @@  #ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_EBUILDCACHEPARSER_H  #define GENTOOBROWSE_API_SERVICE_MAINTENANCE_EBUILDCACHEPARSER_H +#include "wrap/ustring.h"  #include <fileUtils.h>  #include <filesystem> -#include <glibmm/ustring.h>  #include <map>  #include <optional>  #include <string_view> diff --git a/gentoobrowse-api/service/utils/git.cpp b/gentoobrowse-api/service/utils/git.cpp index 1d7d9a8..b21edf2 100644 --- a/gentoobrowse-api/service/utils/git.cpp +++ b/gentoobrowse-api/service/utils/git.cpp @@ -35,7 +35,7 @@ namespace Gentoo {  			GitAnnotatedCommitPtr  			gitFetch(git_repository * repo, git_remote * remote, const char * remoteBranchName)  			{ -				auto opts = gitSafeGet(git_fetch_init_options, GIT_FETCH_OPTIONS_VERSION); +				auto opts = gitSafeGet(git_fetch_init_options, static_cast<unsigned int>(GIT_FETCH_OPTIONS_VERSION));  				opts.prune = GIT_FETCH_PRUNE;  				opts.update_fetchhead = 1;  				auto localBranch = gitSafeGet(git_repository_head, git_reference_free, repo); @@ -57,7 +57,7 @@ namespace Gentoo {  				const git_annotated_commit * heads[] = {fetch_head};  				git_merge_analysis_t analysis = GIT_MERGE_ANALYSIS_NONE;  				git_merge_preference_t preference = GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY; -				gitSafe(git_merge_analysis, &analysis, &preference, repo, heads, 1); +				gitSafe(git_merge_analysis, &analysis, &preference, repo, heads, 1LU);  				auto head = gitSafeGet(git_repository_head, git_reference_free, repo);  				if (analysis == GIT_MERGE_ANALYSIS_UP_TO_DATE) { diff --git a/gentoobrowse-api/service/utils/git.h b/gentoobrowse-api/service/utils/git.h index 7e2e66a..b9191e1 100644 --- a/gentoobrowse-api/service/utils/git.h +++ b/gentoobrowse-api/service/utils/git.h @@ -14,8 +14,8 @@ namespace Gentoo {  			void  			gitSafe(int (*func)(P...), A... p)  			{ -				if (int _giterror = func(p...) < 0) { -					throwError((void * const)func, _giterror); +				if (int giterror_ = func(p...) < 0) { +					throwError(reinterpret_cast<void * const>(func), giterror_);  				}  			} diff --git a/gentoobrowse-api/service/utils/splitEbuildProps.cpp b/gentoobrowse-api/service/utils/splitEbuildProps.cpp index 1f2c5ea..ec9df6b 100644 --- a/gentoobrowse-api/service/utils/splitEbuildProps.cpp +++ b/gentoobrowse-api/service/utils/splitEbuildProps.cpp @@ -6,7 +6,7 @@  namespace Gentoo {  	namespace Utils {  		SplitEbuildProps::SplitEbuildProps( -				const std::string & ce, int e, const std::string & cp, const std::optional<Glib::ustring> & p) : +				const std::string & ce, int64_t e, const std::string & cp, const std::optional<Glib::ustring> & p) :  			entityId(e),  			colEntityName(ce), colPropName(cp), props(p)  		{ diff --git a/gentoobrowse-api/service/utils/splitEbuildProps.h b/gentoobrowse-api/service/utils/splitEbuildProps.h index 00ce910..3945b6a 100644 --- a/gentoobrowse-api/service/utils/splitEbuildProps.h +++ b/gentoobrowse-api/service/utils/splitEbuildProps.h @@ -1,7 +1,7 @@  #ifndef GENTOOBROWSE_API_SERVICE_MAINTENANCE_SPLITEBUILDPROPS_H  #define GENTOOBROWSE_API_SERVICE_MAINTENANCE_SPLITEBUILDPROPS_H -#include <glibmm/ustring.h> +#include "wrap/ustring.h"  #include <optional>  #include <sqlWriter.h> @@ -10,12 +10,12 @@ namespace Gentoo {  		class SplitEbuildProps : public DB::SqlWriter {  		public:  			SplitEbuildProps( -					const std::string & ce, int e, const std::string & cp, const std::optional<Glib::ustring> & p); +					const std::string & ce, int64_t e, const std::string & cp, const std::optional<Glib::ustring> & p);  			void writeSql(AdHoc::Buffer & sql) override;  			void bindParams(DB::Command * c, unsigned int & offset) override; -			const int entityId; +			const int64_t entityId;  			const std::string colEntityName, colPropName;  			const std::optional<Glib::ustring> props;  		}; diff --git a/gentoobrowse-api/service/utils/xmlUtils.h b/gentoobrowse-api/service/utils/xmlUtils.h index 26e5da0..51da33a 100644 --- a/gentoobrowse-api/service/utils/xmlUtils.h +++ b/gentoobrowse-api/service/utils/xmlUtils.h @@ -1,8 +1,8 @@  #ifndef GENTOOBROWSE_API_SERVICE_XMLUTILS_H  #define GENTOOBROWSE_API_SERVICE_XMLUTILS_H +#include "wrap/domparser.h"  #include <filesystem> -#include <libxml++/parsers/domparser.h>  #include <optional>  namespace Gentoo { diff --git a/gentoobrowse-api/service/wrap/domparser.h b/gentoobrowse-api/service/wrap/domparser.h new file mode 100644 index 0000000..3b0b588 --- /dev/null +++ b/gentoobrowse-api/service/wrap/domparser.h @@ -0,0 +1,5 @@ +#pragma once +#pragma GCC diagnostic push +#include "pragma.h" +#include <libxml++/parsers/domparser.h> +#pragma GCC diagnostic pop diff --git a/gentoobrowse-api/service/wrap/pragma.h b/gentoobrowse-api/service/wrap/pragma.h new file mode 100644 index 0000000..6c168ce --- /dev/null +++ b/gentoobrowse-api/service/wrap/pragma.h @@ -0,0 +1,7 @@ +#pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#ifdef __clang__ +#	pragma GCC diagnostic ignored "-Wdeprecated-copy" +#else +#	pragma GCC diagnostic ignored "-Wuseless-cast" +#endif diff --git a/gentoobrowse-api/service/wrap/regex.h b/gentoobrowse-api/service/wrap/regex.h new file mode 100644 index 0000000..bbd8e52 --- /dev/null +++ b/gentoobrowse-api/service/wrap/regex.h @@ -0,0 +1,5 @@ +#pragma once +#pragma GCC diagnostic push +#include "pragma.h" +#include <glibmm/regex.h> +#pragma GCC diagnostic pop diff --git a/gentoobrowse-api/service/wrap/ustring.h b/gentoobrowse-api/service/wrap/ustring.h new file mode 100644 index 0000000..5aa0916 --- /dev/null +++ b/gentoobrowse-api/service/wrap/ustring.h @@ -0,0 +1,5 @@ +#pragma once +#pragma GCC diagnostic push +#include "pragma.h" +#include <glibmm/ustring.h> +#pragma GCC diagnostic pop diff --git a/gentoobrowse-api/service/xsltStreamSerializer.cpp b/gentoobrowse-api/service/xsltStreamSerializer.cpp index 2abf599..b7fd624 100644 --- a/gentoobrowse-api/service/xsltStreamSerializer.cpp +++ b/gentoobrowse-api/service/xsltStreamSerializer.cpp @@ -15,14 +15,14 @@ namespace Gentoo {  	static int  	xmlstrmclosecallback(void * context)  	{ -		((std::ostream *)context)->flush(); +		(static_cast<std::ostream *>(context))->flush();  		return 0;  	}  	static int  	xmlstrmwritecallback(void * context, const char * buffer, int len)  	{ -		((std::ostream *)context)->write(buffer, len); +		(static_cast<std::ostream *>(context))->write(buffer, len);  		return len;  	} @@ -82,7 +82,7 @@ namespace Gentoo {  		htmlNodeDumpFileFormat(lynxIn, result, xmlDocGetRootElement(result), "utf-8", 0);  		fclose(lynxIn);  		char buf[1024]; -		int r; +		ssize_t r;  		while ((r = read(fds.fdOut(), buf, sizeof(buf))) > 0) {  			strm.write(buf, r);  		} diff --git a/gentoobrowse-api/unittests/testBugs.cpp b/gentoobrowse-api/unittests/testBugs.cpp index 175a800..a9c08e0 100644 --- a/gentoobrowse-api/unittests/testBugs.cpp +++ b/gentoobrowse-api/unittests/testBugs.cpp @@ -12,7 +12,7 @@ BOOST_AUTO_TEST_CASE(importBugHtml)  	const int64_t expectedBugCount = 34;  	m->refreshBugs(); -	auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("GentooBrowseAPI")); +	auto db = DB::MockDatabase::openConnectionTo("GentooBrowseAPI");  	SQL_REQUIRE_EQUAL("SELECT COUNT(*) FROM gentoobrowse.bugs", int64_t, expectedBugCount);  #if DUMPDB  	db->execute("COPY gentoobrowse.bugs TO '/tmp/bugs.tsv'"); diff --git a/gentoobrowse-api/unittests/testMaintenance.cpp b/gentoobrowse-api/unittests/testMaintenance.cpp index 6f4e040..b90c659 100644 --- a/gentoobrowse-api/unittests/testMaintenance.cpp +++ b/gentoobrowse-api/unittests/testMaintenance.cpp @@ -150,7 +150,7 @@ public:  BOOST_AUTO_TEST_CASE(refreshPackageTree)  { -	auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("GentooBrowseAPI")); +	auto db = DB::MockDatabase::openConnectionTo("GentooBrowseAPI");  	auto insRepo = db->modify(  			"INSERT INTO gentoobrowse.repos(name, path, upstream, branch, lastcommit) VALUES(?, ?, ?, ?, ?)");  	insRepo->bindParamS(0, "gentoo"); @@ -238,7 +238,7 @@ create_initial_commit(git_repository * repo)  BOOST_AUTO_TEST_CASE(testUpdateGitRepository)  { -	auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("GentooBrowseAPI")); +	auto db = DB::MockDatabase::openConnectionTo("GentooBrowseAPI");  	auto testRepo = binDir / "testrepo";  	std::filesystem::remove_all(testRepo);  	std::filesystem::create_directories(testRepo); @@ -276,7 +276,8 @@ BOOST_AUTO_TEST_CASE(testUpdateGitRepository)  }  struct localPortageRepoIsComplete { -	boost::test_tools::assertion_result operator()(boost::unit_test::test_unit_id) const +	boost::test_tools::assertion_result +	operator()(boost::unit_test::test_unit_id) const  	{  		return !std::filesystem::exists("/usr/portage/.git/shallow");  	} @@ -284,7 +285,7 @@ struct localPortageRepoIsComplete {  BOOST_AUTO_TEST_CASE(testRefreshGitRepository, *boost::unit_test::precondition(localPortageRepoIsComplete {}))  { -	auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("GentooBrowseAPI")); +	auto db = DB::MockDatabase::openConnectionTo("GentooBrowseAPI");  	auto insRepo = db->modify(  			"INSERT INTO gentoobrowse.repos(name, path, upstream, branch, lastcommit) VALUES(?, ?, ?, ?, ?)");  	insRepo->bindParamS(0, "gentoo"); diff --git a/gentoobrowse-api/unittests/testMasks.cpp b/gentoobrowse-api/unittests/testMasks.cpp index 7f37d3b..055c83e 100644 --- a/gentoobrowse-api/unittests/testMasks.cpp +++ b/gentoobrowse-api/unittests/testMasks.cpp @@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(f1)  {  	AdHoc::FileUtils::MemMap f(  			rootDir / "fixtures" / "4156eb45cf3b0ce1d7125b84efd8688c2d6e831d" / "profiles" / "package.mask"); -	extract((const gchar *)f.data, f.getStat().st_size); +	extract(f.sv<gchar>().data(), f.sv<gchar>().length());  	BOOST_CHECK_EQUAL(masks.size(), 151);  	auto m = masks.front();  	BOOST_CHECK(m->person); diff --git a/gentoobrowse-api/unittests/testNotifications.cpp b/gentoobrowse-api/unittests/testNotifications.cpp index c0f3162..1049b58 100644 --- a/gentoobrowse-api/unittests/testNotifications.cpp +++ b/gentoobrowse-api/unittests/testNotifications.cpp @@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(testNews)  	commonAssert(e);  	lintable_test_files("news", e);  	auto [plainPart, htmlPart] = humanReadableParts(e); -	for (auto text : {plainPart, htmlPart}) { +	for (const auto text : {plainPart, htmlPart}) {  		BOOST_REQUIRE(text);  		BOOST_REQUIRE(text->payload.find("Latest news") != std::string::npos);  		BOOST_REQUIRE( diff --git a/gentoobrowse-api/unittests/testUtils.cpp b/gentoobrowse-api/unittests/testUtils.cpp index 6d66de5..8bf8ed2 100644 --- a/gentoobrowse-api/unittests/testUtils.cpp +++ b/gentoobrowse-api/unittests/testUtils.cpp @@ -14,10 +14,10 @@ BOOST_AUTO_TEST_CASE(gitErrorMessage)  	xmlInitParser();  	git_libgit2_init(); -	BOOST_REQUIRE_THROW(gitSafeGet(git_repository_open_ext, git_repository_free, "/", 0, nullptr), Gentoo::GitError); +	BOOST_REQUIRE_THROW(gitSafeGet(git_repository_open_ext, git_repository_free, "/", 0U, nullptr), Gentoo::GitError);  	try { -		gitSafeGet(git_repository_open_ext, git_repository_free, "/", 0, nullptr); +		gitSafeGet(git_repository_open_ext, git_repository_free, "/", 0U, nullptr);  	}  	catch (const Gentoo::GitError & ge) {  		BOOST_TEST_CONTEXT(ge.what()) {  | 
