From c536a979f5a213188ac54f5669ddf4b4ff48c218 Mon Sep 17 00:00:00 2001 From: Gabriele Contini <contini.mailing@gmail.com> Date: 周六, 07 9月 2019 22:13:32 +0800 Subject: [PATCH] Merge branch 'master' of https://github.com/open-license-manager/open-license-manager.git --- src/library/LicenseReader.cpp | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/library/LicenseReader.cpp b/src/library/LicenseReader.cpp index 5ec8623..9927426 100644 --- a/src/library/LicenseReader.cpp +++ b/src/library/LicenseReader.cpp @@ -60,7 +60,7 @@ er.addEvent(LICENSE_CORRUPTED, SVRT_ERROR); } if (has_expiry) { - const time_t now = time(NULL); + const time_t now = time(nullptr); if (expires_on() < now) { er.addEvent(PRODUCT_EXPIRED, SVRT_ERROR, ""); } @@ -80,7 +80,7 @@ } void FullLicenseInfo::toLicenseInfo(LicenseInfo* license) const { - if (license != NULL) { + if (license != nullptr) { strncpy(license->proprietary_data, extra_data.c_str(), PROPRIETARY_DATA_SIZE); @@ -93,7 +93,7 @@ strncpy(license->expiry_date, to_date.c_str(), 11); const double secs = difftime( seconds_from_epoch(to_date.c_str()), - time(NULL)); + time(nullptr)); license->days_left = round(secs / (60 * 60 * 24)); } } @@ -141,10 +141,10 @@ * application_data = xxxxxxxxx (optional string 16) */ const char * license_signature = ini.GetValue(productNamePtr, - "license_signature", NULL); - const long license_version = ini.GetLongValue(productNamePtr, + "license_signature", nullptr); + long license_version = ini.GetLongValue(productNamePtr, "license_version", -1); - if (license_signature != NULL && license_version > 0) { + if (license_signature != nullptr && license_version > 0) { const string from_date = trim_copy( ini.GetValue(productNamePtr, "from_date", FullLicenseInfo::UNUSED_TIME)); @@ -188,7 +188,7 @@ EventRegistry& eventRegistry) { //bool hasFileLocation = false; bool licenseFoundWithExplicitLocation = false; - if (licenseLocation.licenseFileLocation != NULL + if (licenseLocation.licenseFileLocation != nullptr && licenseLocation.licenseFileLocation[0] != '\0') { //hasFileLocation = true; const string varName(licenseLocation.licenseFileLocation); @@ -213,13 +213,13 @@ bool LicenseReader::findFileWithEnvironmentVariable(vector<string>& diskFiles, EventRegistry& eventRegistry) { bool licenseFileFoundWithEnvVariable = false; - if (licenseLocation.environmentVariableName != NULL + if (licenseLocation.environmentVariableName != nullptr && licenseLocation.environmentVariableName[0] != '\0') { const string varName(licenseLocation.environmentVariableName); if (varName.length() > 0) { //var name is passed in by the calling application. char* env_var_value = getenv(varName.c_str()); - if (env_var_value != NULL && env_var_value[0] != '\0') { + if (env_var_value != nullptr && env_var_value[0] != '\0') { const vector<string> declared_positions = splitLicensePositions( string(env_var_value)); vector<string> existing_pos = filterExistingFiles( -- Gitblit v1.9.1