Skip to content

Commit

Permalink
Merge pull request #3 from kernelwernel/dev
Browse files Browse the repository at this point in the history
msvc u8 conversion warning fix test
  • Loading branch information
kernelwernel authored Oct 22, 2023
2 parents 5be1f23 + 959d380 commit 718b961
Showing 1 changed file with 9 additions and 6 deletions.
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

0 comments on commit 718b961

Please sign in to comment.