From 8e1bdfdca2ad2157fd74cedc1a6768a1b1c0849d Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周日, 09 2月 2020 04:48:55 +0800 Subject: [PATCH] identifiers next work --- src/library/locate/EnvironmentVarData.cpp | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/library/locate/EnvironmentVarData.cpp b/src/library/locate/EnvironmentVarData.cpp index 6e47d21..707d6a5 100644 --- a/src/library/locate/EnvironmentVarData.cpp +++ b/src/library/locate/EnvironmentVarData.cpp @@ -29,32 +29,31 @@ const vector<string> EnvironmentVarData::license_locations(EventRegistry &eventRegistry) { vector<string> diskFiles; - char *env_var_value = getenv(LICENSE_DATA_ENV_VAR); + char *env_var_value = getenv(LCC_LICENSE_DATA_ENV_VAR); if (env_var_value != nullptr && env_var_value[0] != '\0') { - eventRegistry.addEvent(LICENSE_SPECIFIED, LICENSE_LOCATION_ENV_VAR); + eventRegistry.addEvent(LICENSE_SPECIFIED, LCC_LICENSE_LOCATION_ENV_VAR); FILE_FORMAT licenseFormat = identify_format(env_var_value); if (licenseFormat == UNKNOWN) { - eventRegistry.addEvent(LICENSE_MALFORMED, LICENSE_LOCATION_ENV_VAR); + eventRegistry.addEvent(LICENSE_MALFORMED, LCC_LICENSE_LOCATION_ENV_VAR); } else { - diskFiles.push_back(LICENSE_LOCATION_ENV_VAR); + diskFiles.push_back(LCC_LICENSE_LOCATION_ENV_VAR); isBase64 = (licenseFormat == BASE64); } } else { - eventRegistry.addEvent(ENVIRONMENT_VARIABLE_NOT_DEFINED, LICENSE_LOCATION_ENV_VAR); + eventRegistry.addEvent(ENVIRONMENT_VARIABLE_NOT_DEFINED, LCC_LICENSE_LOCATION_ENV_VAR); } return diskFiles; } const std::string EnvironmentVarData::retrieve_license_content(const std::string &licenseLocation) const { - string tmpVal = getenv(LICENSE_LOCATION_ENV_VAR); + string env_val = getenv(LCC_LICENSE_LOCATION_ENV_VAR); if (isBase64) { int flen = 0; - unsigned char *raw = unbase64(tmpVal.c_str(), tmpVal.length(), &flen); - string str = string(reinterpret_cast<char *>(raw)); - free(raw); + vector<uint8_t> data = unbase64(env_val); + string str = string(reinterpret_cast<char *>(data.data())); return str; } - return tmpVal; + return env_val; } } // namespace locate -- Gitblit v1.9.1