nancy.liao
2025-05-23 8553a8d63f97cfa8d64b5b2260e81f8c896a8398
修改部分因为标准原因的报错
12个文件已修改
49 ■■■■■ 已修改文件
CMakeLists.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/CMakeLists.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/inspector/inspector.cpp 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/CMakeLists.txt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/LicenseReader.cpp 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/base/file_utils.cpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/ini/SimpleIni.h 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/licensecc.cpp 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/functional/crack_test.cpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/functional/generate-license.cpp 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/functional/generate-license.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test/functional/standard-license_test.cpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CMakeLists.txt
@@ -131,7 +131,6 @@
message( STATUS "Project base dir    : " ${LCC_PROJECTS_BASE_DIR}/${LCC_PROJECT_NAME} )
add_subdirectory(src)
#boost is required only for tests
#bug in cmake win32 - can't find boost compiled with mingw 
if(WIN32 AND "x${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "x")
src/CMakeLists.txt
@@ -8,3 +8,4 @@
ENDIF(NOT EXISTS "${LCC_INCLUDE_DIR}/licensecc_properties.h")
add_subdirectory("library")
src/inspector/inspector.cpp
@@ -12,7 +12,7 @@
#include "../library/os/cpu_info.hpp"
#include "../library/os/dmi_info.hpp"
#include "../library/os/network.hpp"
//硬件的设备信息获取
using namespace std;
using namespace license::os;
@@ -93,9 +93,6 @@
            std::cout << x.second << ": NA" << endl;
        }
    }
    cout << "Virtualiz. class :" << descByVirt.find(exec_env_info.virtualization)->second << endl;
    cout << "Virtualiz. detail:" << descByVirtDetail.find(exec_env_info.virtualization_detail)->second << endl;
    cout << "Cloud provider   :" << descByCloudProvider.find(exec_env_info.cloud_provider)->second << endl;
    std::vector<license::os::OsAdapterInfo> adapterInfos;
    FUNCTION_RETURN ret = license::os::getAdapterInfos(adapterInfos);
src/library/CMakeLists.txt
@@ -4,6 +4,7 @@
add_subdirectory("hw_identifier")
ADD_LIBRARY(licensecc_static STATIC
    licensecc.cpp
    LicenseReader.cpp
    limits/license_verifier.cpp
@@ -22,15 +23,23 @@
endif(CODE_COVERAGE AND UNIX)
define_property(TARGET PROPERTY WITH_OPENSSL BRIEF_DOCS "need openssl to compile" FULL_DOCS "ff")
IF(UNIX OR OPENSSL_FOUND)
    target_compile_definitions(licensecc_static PUBLIC HAS_OPENSSL)
    set_target_properties(licensecc_static PROPERTIES WITH_OPENSSL 1)
    target_link_libraries(licensecc_static PUBLIC OpenSSL::Crypto ${EXTERNAL_LIBS} ${CMAKE_DL_LIBS})
    target_link_libraries(licensecc_static PUBLIC
        OpenSSL::Crypto
        ${EXTERNAL_LIBS} ${CMAKE_DL_LIBS}
    )
ELSE(UNIX OR OPENSSL_FOUND)
    set_target_properties(licensecc_static PROPERTIES WITH_OPENSSL 0)
    target_link_libraries(licensecc_static PUBLIC ${EXTERNAL_LIBS})
ENDIF(UNIX OR OPENSSL_FOUND)
#set_property(TARGET licensecc_static PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_include_directories(licensecc_static
src/library/LicenseReader.cpp
@@ -117,9 +117,6 @@
        }
    }
#ifndef NDEBUG
    cout << "license to sign [" << oss.str() << "]" << endl;
#endif
    return oss.str();
}
src/library/base/file_utils.cpp
@@ -13,7 +13,7 @@
#include <errno.h>
#include <cstring>
#include "file_utils.hpp"
#include "../test/functional/generate-license.h"
namespace license {
using namespace std;
@@ -69,4 +69,6 @@
    return path.substr(0, dotpos);
}
}
src/library/ini/SimpleIni.h
@@ -218,6 +218,7 @@
#include <list>
#include <algorithm>
#include <stdio.h>
#include <functional>
#ifdef SI_SUPPORT_IOSTREAMS
# include <iostream>
@@ -244,7 +245,7 @@
};
#define SI_UTF8_SIGNATURE     "\xEF\xBB\xBF"
#include <functional>
#ifdef _WIN32
# define SI_NEWLINE_A   "\r\n"
# define SI_NEWLINE_W   L"\r\n"
@@ -326,7 +327,8 @@
#endif
        /** Strict less ordering by name of key only */
        struct KeyOrder : std::binary_function<Entry, Entry, bool> {
        struct KeyOrder /*: std::binary_function<Entry, Entry, bool>*/{
            bool operator()(const Entry & lhs, const Entry & rhs) const {
                const static SI_STRLESS isLess = SI_STRLESS();
                return isLess(lhs.pItem, rhs.pItem);
@@ -334,7 +336,9 @@
        };
        /** Strict less ordering by order, and then name of key */
        struct LoadOrder : std::binary_function<Entry, Entry, bool> {
        struct LoadOrder /*: std::binary_function<Entry, Entry, bool>*/
        {
            bool operator()(const Entry & lhs, const Entry & rhs) const {
                if (lhs.nOrder != rhs.nOrder) {
                    return lhs.nOrder < rhs.nOrder;
src/library/licensecc.cpp
@@ -24,7 +24,8 @@
#include "limits/license_verifier.hpp"
#include "base/string_utils.h"
#include "LicenseReader.hpp"
#include "../test/functional/generate-license.h"
using namespace license;
using namespace std;
void print_error(char out_buffer[LCC_API_ERROR_BUFFER_SIZE], LicenseInfo* licenseInfo) {}
@@ -56,6 +57,7 @@
}
static void mergeLicenses(const vector<LicenseInfo>& licenses, LicenseInfo* license_out) {
    if (license_out != nullptr) {
        int days_left = INT_MIN;
        for (auto it = licenses.begin(); it != licenses.end(); it++) {
@@ -70,7 +72,6 @@
        }
    }
}
LCC_EVENT_TYPE acquire_license(const CallerInformations* callerInformation, const LicenseLocation* licenseLocation,
                               LicenseInfo* license_out) {
    const license::LicenseReader lr = license::LicenseReader(licenseLocation);
@@ -131,9 +132,12 @@
    if (license_out != nullptr) {
        er.exportLastEvents(license_out->status, LCC_API_AUDIT_EVENT_NUM);
    }
    return result;
}
LCC_EVENT_TYPE confirm_license(char* product, LicenseLocation licenseLocation) { return LICENSE_OK; }
LCC_EVENT_TYPE release_license(char* product, LicenseLocation licenseLocation) { return LICENSE_OK; }
test/functional/crack_test.cpp
@@ -18,6 +18,7 @@
using namespace license;
using namespace std;
//测试一个通用的许可证
/**
 * Test a generic license, passing a bad license number trough the api.
 * see projects/DEFAULT/include/licensecc/DEFAULT/licensecc_properties.h (magic should be 0)
test/functional/generate-license.cpp
@@ -15,10 +15,11 @@
#include <licensecc_properties_test.h>
#include <licensecc_properties.h>
#include "../../src/library/base/base.h"
#include"licensecc/licensecc.h"
#include "../../src/library/ini/SimpleIni.h"
#include "generate-license.h"
#include "../src/library/base/file_utils.hpp"
namespace fs = boost::filesystem;
using namespace std;
test/functional/generate-license.h
@@ -6,6 +6,7 @@
std::string generate_license(const std::string& fname, const std::vector<std::string>& other_args);
std::string sign_data(const std::string& data, const std::string& test_name);
void tetsMultiple_features();
}  // namespace test
}  // namespace license
test/functional/standard-license_test.cpp
@@ -99,6 +99,7 @@
}
#endif
//
// BOOST_AUTO_TEST_CASE( hw_identifier ) {
//    const string licLocation(PROJECT_TEST_TEMP_DIR "/hw_identifier.lic");