Skip to content

Commit

Permalink
style: fix cpplint warning for array length
Browse files Browse the repository at this point in the history
  • Loading branch information
dqhntt committed Nov 19, 2023
1 parent bf7537e commit 9f2cb5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/dylib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,14 @@ class dylib {

static std::string get_error_description() noexcept {
#if (defined(_WIN32) || defined(_WIN64))
constexpr const size_t buf_size = 512;
constexpr const size_t BUF_SIZE = 512;
const auto error_code = GetLastError();
if (!error_code)
return "No error reported by GetLastError";
char description[buf_size];
char description[BUF_SIZE];
const auto lang = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
const DWORD length =
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, error_code, lang, description, buf_size, nullptr);
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, error_code, lang, description, BUF_SIZE, nullptr);
return (length == 0) ? "Unknown error (FormatMessage failed)" : description;
#else
const auto description = dlerror();
Expand Down

0 comments on commit 9f2cb5c

Please sign in to comment.