mirror of
https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
synced 2025-05-14 16:58:43 +00:00
Fix compiler warnings
This commit is contained in:
parent
4642e14f71
commit
f867a2ff92
3 changed files with 44 additions and 6 deletions
|
@ -58,9 +58,19 @@ static std::string GetEnvironment(const char *variable) {
|
|||
result = GetAndroidProperty("debug.vulkan.screenshot");
|
||||
}
|
||||
return result;
|
||||
#elif defined(_WIN32)
|
||||
auto size = GetEnvironmentVariableA(variable, NULL, 0);
|
||||
if (size == 0) {
|
||||
return "";
|
||||
}
|
||||
char *buffer = new char[size];
|
||||
GetEnvironmentVariableA(variable, buffer, size);
|
||||
std::string output = buffer;
|
||||
delete[] buffer;
|
||||
return output;
|
||||
#else
|
||||
const char *output = std::getenv(variable);
|
||||
return output == NULL ? "" : output;
|
||||
return output == nullptr ? "" : output;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -202,9 +202,9 @@ int32_t ToInt32(const std::string &token) {
|
|||
int64_t ToInt64(const std::string &token) {
|
||||
int64_t int_id = 0;
|
||||
if (token.find("0x") == 0 || token.find("0X") == 0 || token.find("-0x") == 0 || token.find("-0X") == 0) { // Handle hex format
|
||||
int_id = static_cast<uint64_t>(std::strtoll(token.c_str(), nullptr, 16));
|
||||
int_id = static_cast<int64_t>(std::strtoll(token.c_str(), nullptr, 16));
|
||||
} else {
|
||||
int_id = static_cast<uint64_t>(std::strtoll(token.c_str(), nullptr, 10)); // Decimal format
|
||||
int_id = static_cast<int64_t>(std::strtoll(token.c_str(), nullptr, 10)); // Decimal format
|
||||
}
|
||||
return int_id;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "layer_settings_manager.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <charconv>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
@ -222,7 +223,16 @@ VkResult vkuGetLayerSettingValues(VkuLayerSettingSet layerSettingSet, const char
|
|||
for (std::size_t i = 0, n = values.size(); i < n; ++i) {
|
||||
const std::string &setting_value = vl::ToLower(settings[i]);
|
||||
if (vl::IsInteger(setting_value)) {
|
||||
values[i] = std::atoll(setting_value.c_str());
|
||||
int64_t setting{};
|
||||
|
||||
if (std::from_chars(setting_value.data(), setting_value.data() + setting_value.size(), setting).ec ==
|
||||
std::errc()) {
|
||||
values[i] = setting;
|
||||
} else {
|
||||
const std::string &message =
|
||||
vl::FormatString("The data provided (%s) is not an INT64 value.", setting_value.c_str());
|
||||
layer_setting_set->Log(pSettingName, message.c_str());
|
||||
}
|
||||
} else {
|
||||
const std::string &message =
|
||||
vl::FormatString("The data provided (%s) is not an integer value.", setting_value.c_str());
|
||||
|
@ -267,7 +277,16 @@ VkResult vkuGetLayerSettingValues(VkuLayerSettingSet layerSettingSet, const char
|
|||
for (std::size_t i = 0, n = values.size(); i < n; ++i) {
|
||||
const std::string &setting_value = vl::ToLower(settings[i]);
|
||||
if (vl::IsInteger(setting_value)) {
|
||||
values[i] = std::atoi(setting_value.c_str());
|
||||
uint32_t setting{};
|
||||
|
||||
if (std::from_chars(setting_value.data(), setting_value.data() + setting_value.size(), setting).ec ==
|
||||
std::errc()) {
|
||||
values[i] = setting;
|
||||
} else {
|
||||
const std::string &message =
|
||||
vl::FormatString("The data provided (%s) is not a UINT32 value.", setting_value.c_str());
|
||||
layer_setting_set->Log(pSettingName, message.c_str());
|
||||
}
|
||||
} else {
|
||||
const std::string &message =
|
||||
vl::FormatString("The data provided (%s) is not an integer value.", setting_value.c_str());
|
||||
|
@ -312,7 +331,16 @@ VkResult vkuGetLayerSettingValues(VkuLayerSettingSet layerSettingSet, const char
|
|||
for (std::size_t i = 0, n = values.size(); i < n; ++i) {
|
||||
const std::string &setting_value = vl::ToLower(settings[i]);
|
||||
if (vl::IsInteger(setting_value)) {
|
||||
values[i] = std::atoll(setting_value.c_str());
|
||||
uint64_t setting{};
|
||||
|
||||
if (std::from_chars(setting_value.data(), setting_value.data() + setting_value.size(), setting).ec ==
|
||||
std::errc()) {
|
||||
values[i] = setting;
|
||||
} else {
|
||||
const std::string &message =
|
||||
vl::FormatString("The data provided (%s) is not a UINT64 value.", setting_value.c_str());
|
||||
layer_setting_set->Log(pSettingName, message.c_str());
|
||||
}
|
||||
} else {
|
||||
const std::string &message =
|
||||
vl::FormatString("The data provided (%s) is not an integer value.", setting_value.c_str());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue