From f1d283e941680a97d74a2fb7f6bcdd9490efc394 Mon Sep 17 00:00:00 2001
From: nancy.liao <huihui.liao@greentest.com.cn>
Date: 周四, 29 5月 2025 18:14:27 +0800
Subject: [PATCH] 根据具体需求 修改了一个强制性的版本匹配,否则license返回结果不正确

---
 src/library/locate/LocatorFactory.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/library/locate/LocatorFactory.cpp b/src/library/locate/LocatorFactory.cpp
index 9b77b06..c60d4d5 100644
--- a/src/library/locate/LocatorFactory.cpp
+++ b/src/library/locate/LocatorFactory.cpp
@@ -21,14 +21,18 @@
 FUNCTION_RETURN LocatorFactory::get_active_strategies(std::vector<std::unique_ptr<LocatorStrategy>> &strategies,
 													  const LicenseLocation *locationHint) {
 	if (find_license_near_moduleb) {
-		strategies.push_back(std::unique_ptr<LocatorStrategy>((LocatorStrategy *)new ApplicationFolder()));
+		strategies.push_back(
+			std::unique_ptr<LocatorStrategy>(dynamic_cast<LocatorStrategy *>(new ApplicationFolder())));
 	}
 	if (find_license_with_env_varb) {
-		strategies.push_back(std::unique_ptr<LocatorStrategy>((LocatorStrategy *)new EnvironmentVarLocation()));
-		strategies.push_back(std::unique_ptr<LocatorStrategy>((LocatorStrategy *)new EnvironmentVarData()));
+		strategies.push_back(
+			std::unique_ptr<LocatorStrategy>(dynamic_cast<LocatorStrategy *>(new EnvironmentVarLocation())));
+		strategies.push_back(
+			std::unique_ptr<LocatorStrategy>(dynamic_cast<LocatorStrategy *>(new EnvironmentVarData())));
 	}
 	if (locationHint != nullptr) {
-		strategies.push_back(std::unique_ptr<LocatorStrategy>((LocatorStrategy *)new ExternalDefinition(locationHint)));
+		strategies.push_back(
+			std::unique_ptr<LocatorStrategy>(dynamic_cast<LocatorStrategy *>(new ExternalDefinition(locationHint))));
 	}
 	return strategies.size() > 0 ? FUNC_RET_OK : FUNC_RET_NOT_AVAIL;
 }

--
Gitblit v1.9.1