From fdede6003446efe2002fc650f635f1be73265116 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sat, 31 Oct 2015 02:38:23 -0400 Subject: [PATCH] Fix C++11 compatibility --- src/debug.cpp | 12 +++++++----- src/objdef.h | 1 + src/threading/thread.cpp | 6 +++--- src/threading/thread.h | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 9f1042646..3761e416d 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -45,7 +45,7 @@ void sanity_check_fn(const char *assertion, const char *file, unsigned int line, const char *function) { errorstream << std::endl << "In thread " << std::hex - << (unsigned long)thr_get_current_thread_id() << ":" << std::endl; + << thr_get_current_thread_id() << ":" << std::endl; errorstream << file << ":" << line << ": " << function << ": An engine assumption '" << assertion << "' failed." << std::endl; @@ -58,7 +58,7 @@ void fatal_error_fn(const char *msg, const char *file, unsigned int line, const char *function) { errorstream << std::endl << "In thread " << std::hex - << (unsigned long)thr_get_current_thread_id() << ":" << std::endl; + << thr_get_current_thread_id() << ":" << std::endl; errorstream << file << ":" << line << ": " << function << ": A fatal error occured: " << msg << std::endl; @@ -93,8 +93,10 @@ DebugStack::DebugStack(threadid_t id) void DebugStack::print(FILE *file, bool everything) { - fprintf(file, "DEBUG STACK FOR THREAD %lx:\n", - (unsigned long)threadid); + std::ostringstream os; + os << threadid; + fprintf(file, "DEBUG STACK FOR THREAD %s:\n", + os.str().c_str()); for(int i=0; iget_id(); - m_thread_handle = m_thread->native_handle(); - } except (const std::system_error &e) { + m_thread_id = m_thread_obj->get_id(); + m_thread_handle = m_thread_obj->native_handle(); + } catch (const std::system_error &e) { return false; } diff --git a/src/threading/thread.h b/src/threading/thread.h index 83ca785c7..5f2d8aad1 100644 --- a/src/threading/thread.h +++ b/src/threading/thread.h @@ -26,6 +26,7 @@ DEALINGS IN THE SOFTWARE. #ifndef THREADING_THREAD_H #define THREADING_THREAD_H +#include "basicmacros.h" #include "threading/atomic.h" #include "threading/mutex.h" #include "threads.h"