From 8d405b265285c368df2e9cf1c14acee7532e0ee7 Mon Sep 17 00:00:00 2001 From: nancy.liao <huihui.liao@greentest.com.cn> Date: ćšć, 29 5æ 2025 18:14:38 +0800 Subject: [PATCH] Merge branch 'develop' of http://139.9.88.116:3000/r/module/open-license-manager into develop --- src/library/locate/ExternalDefinition.cpp | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/library/locate/ExternalDefinition.cpp b/src/library/locate/ExternalDefinition.cpp index 13ca80a..00a58ed 100644 --- a/src/library/locate/ExternalDefinition.cpp +++ b/src/library/locate/ExternalDefinition.cpp @@ -9,19 +9,19 @@ #include <cstring> #include <string> #include <vector> - +#include <stdexcept> #include <licensecc/datatypes.h> #include "../base/base64.h" #include "../base/EventRegistry.h" -#include "../base/FileUtils.hpp" -#include "../base/StringUtils.h" +#include "../base/string_utils.h" #include "ExternalDefinition.hpp" +#include "../base/file_utils.hpp" namespace license { namespace locate { -using namespace std; + using namespace std; ExternalDefinition::ExternalDefinition(const LicenseLocation *location) : LocatorStrategy("ExternalDefinition"), m_location(location) {} @@ -34,7 +34,7 @@ eventRegistry.addEvent(LICENSE_SPECIFIED, get_strategy_name()); switch (m_location->license_data_type) { case LICENSE_PATH: { - string licData(m_location->licenseData, mstrnlen_s(m_location->licenseData, API_LICENSE_DATA_LENGTH)); + string licData(m_location->licenseData, mstrnlen_s(m_location->licenseData, LCC_API_MAX_LICENSE_DATA_LENGTH)); const vector<string> declared_positions = license::split_string(licData, ';'); existing_pos = license::filter_existing_files(declared_positions, eventRegistry, get_strategy_name().c_str()); @@ -52,12 +52,11 @@ const std::string ExternalDefinition::retrieve_license_content(const std::string &licenseLocation) const { if (licenseLocation == get_strategy_name()) { - string licData(m_location->licenseData, mstrnlen_s(m_location->licenseData, API_LICENSE_DATA_LENGTH)); + string licData(m_location->licenseData, mstrnlen_s(m_location->licenseData, LCC_API_MAX_LICENSE_DATA_LENGTH)); if (m_location->license_data_type == LICENSE_ENCODED) { - int flen = 0; - unsigned char *raw = unbase64(licData.c_str(), licData.length(), &flen); - string str = string(reinterpret_cast<char *>(raw)); - free(raw); + // FIXME what if license content is not base64 + vector<uint8_t> raw = unbase64(licData); + string str = string(reinterpret_cast<char *>(raw.data())); return str; } else { return licData; -- Gitblit v1.9.1