From b0c9c185f38c6bfc41a1d60e60aac1f7e79429dc Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周日, 01 12月 2019 14:24:31 +0800
Subject: [PATCH] fix mingw

---
 src/library/LicenseReader.hpp        |    2 +-
 src/library/base/StringUtils.h       |   10 ++++------
 src/library/licensecc.cpp            |    2 +-
 src/library/LicenseReader.cpp        |    7 ++++---
 test/functional/generate-license.cpp |    2 +-
 .travis.yml                          |    3 +++
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index d9b4de2..73c2fab 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -117,6 +117,9 @@
         - travis_wait 30 ./b2 toolset=gcc-mingw target-os=windows address-model=64 --with-date_time --with-test --with-filesystem --with-program_options --with-regex --with-serialization --with-system runtime-link=static --prefix=./dist release install
         - cd ..
         - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-ubuntu-mingw64.cmake -DCMAKE_INSTALL_PREFIX=../../install -DBOOST_ROOT=$PWD/boost_1_71_0/dist  ..
+     script: 
+        - cmake --build . --target install --config Release
+        #disabling tests for now. Need to compile and install openssl... 
    - os: windows
      name: "Widnows server 1803 - Visual Studio 15 2017 Win64 - (/MD)"
      before_script:
diff --git a/src/library/LicenseReader.cpp b/src/library/LicenseReader.cpp
index 9aa53ab..a85b1ca 100644
--- a/src/library/LicenseReader.cpp
+++ b/src/library/LicenseReader.cpp
@@ -34,6 +34,7 @@
 #include "locate/LocatorFactory.hpp"
 
 namespace license {
+using namespace std;
 
 FullLicenseInfo::FullLicenseInfo(const string &source, const string &product, const string &license_signature)
 	: source(source),
@@ -42,7 +43,7 @@
 
 LicenseReader::LicenseReader(const LicenseLocation *licenseLocation) : licenseLocation(licenseLocation) {}
 
-EventRegistry LicenseReader::readLicenses(const string &product, vector<FullLicenseInfo> &licenseInfoOut) {
+EventRegistry LicenseReader::readLicenses(const string &product, vector<FullLicenseInfo> &licenseInfoOut) const {
 	vector<string> diskFiles;
 	vector<unique_ptr<locate::LocatorStrategy>> locator_strategies;
 	FUNCTION_RETURN ret = locate::LocatorFactory::get_active_strategies(locator_strategies, licenseLocation);
@@ -64,7 +65,7 @@
 		CSimpleIniA ini;
 		for (auto it = licenseLocations.begin(); it != licenseLocations.end(); it++) {
 			ini.Reset();
-			string license = locator->retrieve_license_content((*it).c_str());
+			const string license = locator->retrieve_license_content((*it).c_str());
 			const SI_Error rc = ini.LoadData(license.c_str(), license.size());
 			if (rc < 0) {
 				eventRegistry.addEvent(FILE_FORMAT_NOT_RECOGNIZED, *it);
@@ -120,7 +121,7 @@
 	}
 
 #ifdef _DEBUG
-	cout << "[" << oss.str() << "]" << endl;
+	cout << "license to sign [" << oss.str() << "]" << endl;
 #endif
 	return oss.str();
 }
diff --git a/src/library/LicenseReader.hpp b/src/library/LicenseReader.hpp
index de3bfa0..bad939e 100644
--- a/src/library/LicenseReader.hpp
+++ b/src/library/LicenseReader.hpp
@@ -55,7 +55,7 @@
 
 public:
 	LicenseReader(const LicenseLocation* licenseLocation);
-	EventRegistry readLicenses(const std::string& product, std::vector<FullLicenseInfo>& licenseInfoOut);
+	EventRegistry readLicenses(const std::string& product, std::vector<FullLicenseInfo>& licenseInfoOut) const;
 	virtual ~LicenseReader();
 };
 }  // namespace license
diff --git a/src/library/base/StringUtils.h b/src/library/base/StringUtils.h
index 8134349..41f303a 100644
--- a/src/library/base/StringUtils.h
+++ b/src/library/base/StringUtils.h
@@ -12,7 +12,6 @@
 #include <vector>
 
 namespace license {
-using namespace std;
 
 /**
  * Eliminate whitespace from both sides of a string and returns a copy
@@ -20,23 +19,22 @@
  * @param string_to_trim
  * @return the trimmed string
  */
-string trim_copy(const string& string_to_trim);
+std::string trim_copy(const std::string& string_to_trim);
 
-string toupper_copy(const string& lowercase);
+std::string toupper_copy(const std::string& lowercase);
 
 time_t seconds_from_epoch(const char* s);
 
 /**
  * Split a string on a given character
  */
-const vector<string> split_string(const string& stringToBeSplit, const char splitchar);
+const std::vector<std::string> split_string(const std::string& stringToBeSplit, const char splitchar);
 
 typedef enum {
 	INI, BASE64, UNKNOWN
 } FILE_FORMAT;
 
-FILE_FORMAT identify_format(const string& license);
-
+FILE_FORMAT identify_format(const std::string& license);
 }
 
 /* namespace license */
diff --git a/src/library/licensecc.cpp b/src/library/licensecc.cpp
index 5cc512b..dfce497 100644
--- a/src/library/licensecc.cpp
+++ b/src/library/licensecc.cpp
@@ -40,7 +40,7 @@
 
 EVENT_TYPE acquire_license(const CallerInformations* callerInformation, const LicenseLocation* licenseLocation,
 						   LicenseInfo* license_out) {
-	license::LicenseReader lr = license::LicenseReader(licenseLocation);
+	const license::LicenseReader lr = license::LicenseReader(licenseLocation);
 	vector<license::FullLicenseInfo> licenses;
 	string project;
 	if (callerInformation != nullptr && strlen(callerInformation->project_name) > 0) {
diff --git a/test/functional/generate-license.cpp b/test/functional/generate-license.cpp
index 0002bee..c3e7edb 100644
--- a/test/functional/generate-license.cpp
+++ b/test/functional/generate-license.cpp
@@ -76,7 +76,7 @@
 	const int retCode = std::system(ss.str().c_str());
 	BOOST_CHECK_EQUAL(retCode, 0);
 	BOOST_ASSERT(fs::exists(outputFile));
-	std::ifstream ifs(outputFile.c_str());
+	std::ifstream ifs(output_file_s.c_str());
 	std::string content((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
 	return content;
 }

--
Gitblit v1.9.1