Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msvc u8 conversion warning fix test #3

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/vmaware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ struct VM {
static constexpr const char* JOEBOX = "JoeBox";

// VM scoreboard table specifically for VM::brand()
static std::map<std::string, u8> scoreboard;
static std::map<const char*, int> scoreboard;

// check if cpuid is supported
[[nodiscard]] static bool check_cpuid(void) {
Expand Down Expand Up @@ -457,7 +457,7 @@ struct VM {
}

// memoize the value from VM::detect() in case it's ran again
static std::map<bool, std::pair<bool, std::string>> memo;
static std::map<bool, std::pair<bool, const char*>> memo;

// cpuid check value
static bool cpuid_supported;
Expand Down Expand Up @@ -2430,8 +2430,7 @@ struct VM {
// threshold score
const bool result = (points >= 100);

std::string current_brand = "";
//const char* current_brand = "";
const char* current_brand = "";

#ifdef __VMAWARE_DEBUG__
for (const auto p : scoreboard) {
Expand Down Expand Up @@ -2488,7 +2487,11 @@ struct VM {
};


std::map<std::string, VM::u8> VM::scoreboard {
// ============= EXTERNAL DEFINITIONS =============
// These are added here due to warnings related to C++17 inline variables for C++ standards that are under 17.
// It's easier to just group them together rather than having C++17<= preprocessors with inline stuff

std::map<const char*, int> VM::scoreboard {
{ VM::VMWARE, 0 },
{ VM::VBOX, 0 },
{ VM::KVM, 0 },
Expand All @@ -2513,7 +2516,7 @@ std::map<std::string, VM::u8> VM::scoreboard {

VM::u64 VM::flags = 0;
bool VM::cpuid_supported = false;
std::map<bool, std::pair<bool, std::string>> VM::memo;
std::map<bool, std::pair<bool, const char*>> VM::memo;


const std::map<VM::u64, VM::technique> VM::table = {
Expand Down