From 2a57306c461964f860ba1cb51f1bf96c954173e0 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 1 Nov 2020 17:16:37 -0500 Subject: add upstream 11.3 --- zen/basic_math.h | 2 +- zen/legacy_compiler.h | 2 +- zen/string_tools.h | 4 ++-- zen/sys_info.cpp | 7 +++++-- 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'zen') diff --git a/zen/basic_math.h b/zen/basic_math.h index 26fb9e58..0f5191e3 100644 --- a/zen/basic_math.h +++ b/zen/basic_math.h @@ -10,7 +10,7 @@ #include #include #include - #include +#include #include "type_traits.h" diff --git a/zen/legacy_compiler.h b/zen/legacy_compiler.h index ad5442fe..0cbb830e 100644 --- a/zen/legacy_compiler.h +++ b/zen/legacy_compiler.h @@ -7,7 +7,7 @@ #ifndef LEGACY_COMPILER_H_839567308565656789 #define LEGACY_COMPILER_H_839567308565656789 -#include +#include //contains all __cpp_lib_ macros /* C++ standard conformance: https://en.cppreference.com/w/cpp/feature_test diff --git a/zen/string_tools.h b/zen/string_tools.h index fc715961..83d87244 100644 --- a/zen/string_tools.h +++ b/zen/string_tools.h @@ -83,7 +83,7 @@ template Num stringTo(const S& str); std::pair hexify (unsigned char c, bool upperCase = true); char unhexify(char high, char low); -std::string formatAsHexString(const std::string& blob); //bytes -> (human-readable) hex string +std::string formatAsHexString(const std::string_view& blob); //bytes -> (human-readable) hex string template S printNumber(const T& format, const Num& number); //format a single number using std::snprintf() @@ -859,7 +859,7 @@ char unhexify(char high, char low) inline -std::string formatAsHexString(const std::string& blob) +std::string formatAsHexString(const std::string_view& blob) { std::string output; for (const char c : blob) diff --git a/zen/sys_info.cpp b/zen/sys_info.cpp index da5cc61f..475e1c6c 100644 --- a/zen/sys_info.cpp +++ b/zen/sys_info.cpp @@ -63,9 +63,12 @@ ComputerModel zen::getComputerModel() //throw FileError cm.vendor = tryGetInfo("/sys/devices/virtual/dmi/id/sys_vendor"); // //clean up: + cm.model = beforeFirst(cm.model , L'\u00ff', IfNotFoundReturn::all); //fix broken BIOS entries: + cm.vendor = beforeFirst(cm.vendor, L'\u00ff', IfNotFoundReturn::all); //0xff can be considered 0 + for (const char* dummyModel : { - "To Be Filled By O.E.M.", "Default string", "empty", "O.E.M", "OEM", "NA", + "To Be Filled By O.E.M.", "Default string", "$(DEFAULT_STRING)", "Undefined", "empty", "O.E.M", "OEM", "NA", "System Product Name", "Please change product name", "INVALID", }) if (equalAsciiNoCase(cm.model, dummyModel)) @@ -76,7 +79,7 @@ ComputerModel zen::getComputerModel() //throw FileError for (const char* dummyVendor : { - "To Be Filled By O.E.M.", "Default string", "empty", "O.E.M", "OEM", "NA", + "To Be Filled By O.E.M.", "Default string", "$(DEFAULT_STRING)", "Undefined", "empty", "O.E.M", "OEM", "NA", "System manufacturer", "OEM Manufacturer", }) if (equalAsciiNoCase(cm.vendor, dummyVendor)) -- cgit