Left: | ||
Right: |
OLD | NEW |
---|---|
1 #include "stdafx.h" | 1 #include "stdafx.h" |
2 | 2 |
3 #include <fstream> | 3 #include <fstream> |
4 #include <stdio.h> | 4 #include <stdio.h> |
5 | 5 |
6 #include "Debug.h" | 6 #include "Debug.h" |
7 #include "Utils.h" | 7 #include "Utils.h" |
8 | 8 |
9 #ifdef _DEBUG | 9 #ifdef _DEBUG |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... | |
31 { | 31 { |
32 EnterCriticalSection(section); | 32 EnterCriticalSection(section); |
33 } | 33 } |
34 | 34 |
35 ~Lock() | 35 ~Lock() |
36 { | 36 { |
37 LeaveCriticalSection(section); | 37 LeaveCriticalSection(section); |
38 } | 38 } |
39 private: | 39 private: |
40 LPCRITICAL_SECTION section; | 40 LPCRITICAL_SECTION section; |
41 Lock(const Lock&); | |
42 Lock& operator=(const Lock&); | |
41 }; | 43 }; |
42 private: | 44 private: |
43 CRITICAL_SECTION section; | 45 CRITICAL_SECTION section; |
46 CriticalSection(const CriticalSection&); | |
47 CriticalSection& operator=(const CriticalSection&); | |
44 }; | 48 }; |
45 | 49 |
46 static CriticalSection debugLock; | 50 CriticalSection debugLock; |
47 } | 51 } |
48 | 52 |
49 void Debug(const std::string& text) | 53 void Debug(const std::string& text) |
50 { | 54 { |
51 SYSTEMTIME st; | 55 SYSTEMTIME st; |
52 ::GetSystemTime(&st); | 56 ::GetSystemTime(&st); |
53 | 57 |
54 char timeBuf[14]; | 58 char timeBuf[14]; |
55 _snprintf_s(timeBuf, _TRUNCATE, "%02i:%02i:%02i.%03i", st.wHour, st.wMinute, s t.wSecond, st.wMilliseconds); | 59 _snprintf_s(timeBuf, _TRUNCATE, "%02i:%02i:%02i.%03i", st.wHour, st.wMinute, s t.wSecond, st.wMilliseconds); |
56 | 60 |
(...skipping 10 matching lines...) Expand all Loading... | |
67 std::stringstream stream; | 71 std::stringstream stream; |
68 stream << message << " (Error code: " << GetLastError() << ")"; | 72 stream << message << " (Error code: " << GetLastError() << ")"; |
69 Debug(stream.str()); | 73 Debug(stream.str()); |
70 } | 74 } |
71 | 75 |
72 void DebugException(const std::exception& exception) | 76 void DebugException(const std::exception& exception) |
73 { | 77 { |
74 Debug(std::string("An exception occurred: ") + exception.what()); | 78 Debug(std::string("An exception occurred: ") + exception.what()); |
75 } | 79 } |
76 #else | 80 #else |
77 void Debug(const std::string& text) {} | 81 void Debug(const std::string& text) {} |
Felix Dahlke
2013/06/04 09:39:09
These are already defined in Debug.h, no?
Wladimir Palant
2013/06/04 10:17:01
No, not any more - Oleksandr moved them in a diffe
| |
78 void DebugLastError(const std::string& message) {} | 82 void DebugLastError(const std::string& message) {} |
79 void DebugException(const std::exception& exception) {} | 83 void DebugException(const std::exception& exception) {} |
80 #endif // _DEBUG | 84 #endif // _DEBUG |
OLD | NEW |