From 20cf0876eb8c45c079565e19b183e2798ca362dc Mon Sep 17 00:00:00 2001 From: Anish Bhobe Date: Sun, 16 Jun 2024 11:01:13 +0200 Subject: [PATCH] Purged custom formatting code. --- aster/global.cpp | 57 ------------------------------------------------ aster/global.h | 11 ---------- 2 files changed, 68 deletions(-) diff --git a/aster/global.cpp b/aster/global.cpp index c5fad93..e524574 100644 --- a/aster/global.cpp +++ b/aster/global.cpp @@ -13,60 +13,3 @@ // NOTE: Vulkan Dispatch Loader Storage - Should only appear once. VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE - -//int Vsnprintf8(char* pDestination, size_t n, const char* pFormat, va_list arguments) { -// //ERROR_IF(pDestination == nullptr, "Null buffer") THEN_CRASH(1) ELSE_IF_ERROR(n == 0, "Empty buffer") THEN_CRASH(1); -//#ifdef _MSC_VER -// auto v = vsnprintf(pDestination, n, pFormat, arguments); -// ERROR_IF(v == 0, "Final requirement cannot be 0") THEN_CRASH(1); -// return v; -//#else -// return vsnprintf(pDestination, n, pFormat, arguments); -//#endif -//} -// -//int VsnprintfW(wchar_t* pDestination, size_t n, const wchar_t* pFormat, va_list arguments) { -// //ERROR_IF(pDestination == nullptr, "Null buffer") THEN_CRASH(1) ELSE_IF_ERROR(n == 0, "Empty buffer") THEN_CRASH(1); -//#ifdef _MSC_VER -// if (pDestination == nullptr && n == 0) { -// return _vscwprintf(pFormat, arguments); -// } else { -// return _vsnwprintf_s(pDestination, n, _TRUNCATE, pFormat, arguments); -// } -//#else -// char* d = new char[n + 1]; -// int r = vsnprintf(d, n, convertstring(pFormat).c_str(), arguments); -// memcpy(pDestination, convertstring(d).c_str(), (n + 1) * sizeof(char16_t)); -// delete[] d; -// return r; -//#endif -//} -// -//int Vsnprintf16(char16_t* pDestination, size_t n, const char16_t* pFormat, va_list arguments) { -// //ERROR_IF(pDestination == nullptr, "Null buffer") THEN_CRASH(1) ELSE_IF_ERROR(n == 0, "Empty buffer") THEN_CRASH(1); -//#ifdef _MSC_VER -// if (pDestination == nullptr && n == 0) { -// return _vscwprintf((wchar_t*)pFormat, arguments); -// } else { -// return _vsnwprintf_s((wchar_t*)pDestination, n, _TRUNCATE, (wchar_t*)pFormat, arguments); -// } -//#else -// char* d = new char[n + 1]; -// int r = vsnprintf(d, n, convertstring(pFormat).c_str(), arguments); -// memcpy(pDestination, convertstring(d).c_str(), (n + 1) * sizeof(char16_t)); -// delete[] d; -// return r; -//#endif -//} - -std::string std::impl::format(const char *_fmt, ...) { - va_list args; - va_start(args, _fmt); - - const auto req = vsnprintf(nullptr, 0, _fmt, args) + 1; - string buf(req, '\0'); - vsnprintf(buf.data(), buf.size(), _fmt, args); - - va_end(args); - return buf; -} diff --git a/aster/global.h b/aster/global.h index 9cc74b2..3649cd8 100644 --- a/aster/global.h +++ b/aster/global.h @@ -23,17 +23,6 @@ return _result != vk::Result::eSuccess; } -namespace std { -namespace impl { -string format(const char *_fmt, ...); -} - -template -[[nodiscard]] string fmt(const char *_fmt, Ts &&..._args) { - return impl::format(_fmt, forward(_args)...); -} -} // namespace std - template concept IsVkEnum = requires(T _t) { { std::is_enum_v };