diff --git a/Framework/Utilities.cpp b/Framework/Utilities.cpp index f251329..e7859c6 100644 --- a/Framework/Utilities.cpp +++ b/Framework/Utilities.cpp @@ -17,7 +17,7 @@ void yqDebugBreak() { #ifdef _WIN32 - DebugBreak(); + DebugBreak(); #endif } @@ -25,130 +25,130 @@ void yqConsolePrintString(const char* a_string) { #ifdef _WIN32 - // Windows code - OutputDebugStringA(a_string); + // Windows code + OutputDebugStringA(a_string); #else - // ANSI C / POSIX porting code - fputs(a_string, stderr); - //fputs("\n", stderr); + // ANSI C / POSIX porting code + fputs(a_string, stderr); + //fputs("\n", stderr); #endif } void ErrorHandler::handleError(yqResult /*a_result*/, const char *a_location, const char *a_message) { - yqConsolePrintString(a_location); - yqConsolePrintString("Caught an error! "); - yqConsolePrintString(a_message); - yqConsolePrintString("\n"); - //yqDebugBreak(); + yqConsolePrintString(a_location); + yqConsolePrintString("Caught an error! "); + yqConsolePrintString(a_message); + yqConsolePrintString("\n"); + //yqDebugBreak(); } void Logger::logMessage(yqLogLevel /*a_logLevel*/, const char *a_location, const char *a_message) { - if (BT_IsDebug) - { - yqConsolePrintString(a_location); - yqConsolePrintString(a_message); - yqConsolePrintString("\n"); - } + if (BT_IsDebug) + { + yqConsolePrintString(a_location); + yqConsolePrintString(a_message); + yqConsolePrintString("\n"); + } } void *HeapManager::malloc(size_t a_size) { - return ::malloc(a_size); + return ::malloc(a_size); } void *HeapManager::realloc(void *ptr, size_t newSize) { - return ::realloc(ptr, newSize); + return ::realloc(ptr, newSize); } void HeapManager::free(void *ptr) { - ::free(ptr); + ::free(ptr); } -yqResult ResourceDeviceFactory::CreateResourceDevice(const char * /*resourceID*/, uint32_t /*writerFlags*/, ResourceDevice **/*newDevice*/) +yqResult ResourceDeviceFactory::CreateResourceDevice(const char * /*resourceID*/, uint32_t /*writerFlags*/, ResourceDevice ** /*newDevice*/) { - // TODO: - yqDebugBreak(); - YQ_API_LEAVE(R_Failure, "Unimplemented"); + // TODO: + yqDebugBreak(); + YQ_API_LEAVE(R_Failure, "Unimplemented"); } void yqLogMessage(yqLogLevel a_logLevel, const char *a_location, const char* a_func, const char *a_format, ...) { - va_list args; - va_start(args, a_format); - std::string loc = a_location; - loc += a_func; + va_list args; + va_start(args, a_format); + std::string loc = a_location; + loc += a_func; #ifdef _WIN32 - size_t sizeRequired = size_t(_vscprintf(a_format, args) + 1); - char* message = (char*)_alloca(sizeRequired); - _vsnprintf(message, sizeRequired, a_format, args); - if (g_currentModule.m_messageLogger) - g_currentModule.m_messageLogger->logMessage(a_logLevel, loc.c_str(), message); - _freea(message); + size_t sizeRequired = size_t(_vscprintf(a_format, args) + 1); + char* message = (char*)_alloca(sizeRequired); + _vsnprintf(message, sizeRequired, a_format, args); + if (g_currentModule.m_messageLogger) + g_currentModule.m_messageLogger->logMessage(a_logLevel, loc.c_str(), message); + _freea(message); #else - char* message = 0; - if (vasprintf(&message, a_format, args) != -1) - { - if (g_currentModule.m_messageLogger) - g_currentModule.m_messageLogger->logMessage(a_logLevel, loc.c_str(), message); - free(message); - } + char* message = 0; + if (vasprintf(&message, a_format, args) != -1) + { + if (g_currentModule.m_messageLogger) + g_currentModule.m_messageLogger->logMessage(a_logLevel, loc.c_str(), message); + free(message); + } #endif - va_end(args); + va_end(args); } void yqHandleError(yqResult a_result, const char *a_location, const char* a_func, const char *a_format, ...) { - va_list args; - va_start(args, a_format); - std::string loc = a_location; - loc += a_func; + va_list args; + va_start(args, a_format); + std::string loc = a_location; + loc += a_func; #ifdef _WIN32 - size_t sizeRequired = size_t(_vscprintf(a_format, args) + 1); - char* message = (char*)_alloca(sizeRequired); - _vsnprintf(message, sizeRequired, a_format, args); - if (g_currentModule.m_errorHandler) - g_currentModule.m_errorHandler->handleError(a_result, loc.c_str(), message); - _freea(message); + size_t sizeRequired = size_t(_vscprintf(a_format, args) + 1); + char* message = (char*)_alloca(sizeRequired); + _vsnprintf(message, sizeRequired, a_format, args); + if (g_currentModule.m_errorHandler) + g_currentModule.m_errorHandler->handleError(a_result, loc.c_str(), message); + _freea(message); #else - char* message = 0; - if (vasprintf(&message, a_format, args) != -1) - { - if (g_currentModule.m_errorHandler) - g_currentModule.m_errorHandler->handleError(a_result, loc.c_str(), message); - free(message); - } + char* message = 0; + if (vasprintf(&message, a_format, args) != -1) + { + if (g_currentModule.m_errorHandler) + g_currentModule.m_errorHandler->handleError(a_result, loc.c_str(), message); + free(message); + } #endif - va_end(args); + va_end(args); } void* yqAllocateMemory(size_t a_newSize) { - return g_currentModule.m_heapManager->malloc(a_newSize); + return g_currentModule.m_heapManager->malloc(a_newSize); } void* yqReallocateMemory(void* a_ptr, size_t a_newSize) { - return g_currentModule.m_heapManager->realloc(a_ptr, a_newSize); + return g_currentModule.m_heapManager->realloc(a_ptr, a_newSize); } void yqFreeMemory(void* a_ptr) { - return g_currentModule.m_heapManager->free(a_ptr); + return g_currentModule.m_heapManager->free(a_ptr); }