Silly macro removed-2

This commit is contained in:
Nekotekina 2016-08-14 03:22:19 +03:00
parent 5e0489dcc0
commit 0f87c4485d
38 changed files with 346 additions and 445 deletions

View file

@ -1,11 +1,16 @@
#include "StrFmt.h"
#include "BEType.h"
#include "StrUtil.h"
#include "Macro.h"
#include "cfmt.h"
#include <algorithm>
#ifdef _WIN32
#include <Windows.h>
#else
#include <errno.h>
#endif
void fmt_class_string<const void*>::format(std::string& out, u64 arg)
{
fmt::append(out, "%p", reinterpret_cast<const void*>(static_cast<std::uintptr_t>(arg)));
@ -124,18 +129,26 @@ namespace fmt
{
void raw_error(const char* msg)
{
std::string out{"Error"};
out += ": ";
out += msg;
throw std::runtime_error{out};
throw std::runtime_error{msg};
}
void raw_verify_error(const char* msg, uint position)
{
std::string out{"Verification failed"};
// Print error code (may be irrelevant)
#ifdef _WIN32
if (DWORD error = GetLastError())
{
fmt::append(out, " (e%#x)", error);
}
#else
if (int error = errno)
{
fmt::append(out, " (e%d)", error);
}
#endif
if (position)
{
out += " (+";