From 28183ed24fe1e85eaa9df0317d6233bb9d37e48f Mon Sep 17 00:00:00 2001
From: Gabriele Contini <contini.mailing@gmail.com>
Date: 周日, 24 11月 2019 21:25:23 +0800
Subject: [PATCH] tests ok

---
 src/library/LicenseReader.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/library/LicenseReader.cpp b/src/library/LicenseReader.cpp
index 0bb9262..9aa53ab 100644
--- a/src/library/LicenseReader.cpp
+++ b/src/library/LicenseReader.cpp
@@ -54,6 +54,8 @@
 	}
 
 	bool atLeastOneLicenseComplete = false;
+	const string product_up = toupper_copy(product);
+	const char *productNamePtr = product_up.c_str();
 	for (unique_ptr<locate::LocatorStrategy> &locator : locator_strategies) {
 		vector<string> licenseLocations = locator->license_locations(eventRegistry);
 		if (licenseLocations.size() == 0) {
@@ -68,7 +70,6 @@
 				eventRegistry.addEvent(FILE_FORMAT_NOT_RECOGNIZED, *it);
 				continue;
 			}
-			const char *productNamePtr = product.c_str();
 			const int sectionSize = ini.GetSectionSize(productNamePtr);
 			if (sectionSize <= 0) {
 				eventRegistry.addEvent(PRODUCT_NOT_LICENSED, *it);
@@ -85,8 +86,8 @@
 			 *  sig = XXXXXXXXXX (mandatory, 1024)
 			 *  application_data = xxxxxxxxx (optional string 16)
 			 */
-			const char *license_signature = ini.GetValue(productNamePtr, "sig", nullptr);
-			long license_version = ini.GetLongValue(productNamePtr, "lic_ver", -1);
+			const char *license_signature = ini.GetValue(productNamePtr, LICENSE_SIGNATURE, nullptr);
+			long license_version = ini.GetLongValue(productNamePtr, LICENSE_VERSION, -1);
 			if (license_signature != nullptr && license_version == 200) {
 				CSimpleIniA::TNamesDepend keys;
 				ini.GetAllKeys(productNamePtr, keys);

--
Gitblit v1.9.1