gcontini
2019-12-01 b0c9c185f38c6bfc41a1d60e60aac1f7e79429dc
fix mingw
6个文件已修改
26 ■■■■ 已修改文件
.travis.yml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/LicenseReader.cpp 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/LicenseReader.hpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/base/StringUtils.h 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/licensecc.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/functional/generate-license.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
.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:
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();
}
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
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 */
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) {
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;
}