diff options
-rw-r--r-- | FoundationEx/MemDebug.cpp | 65 | ||||
-rw-r--r-- | FoundationEx/MemDebug.h | 17 | ||||
-rw-r--r-- | Magic2/Magic.vcxproj | 2 | ||||
-rw-r--r-- | Magic2/Magic.vcxproj.filters | 6 | ||||
-rw-r--r-- | NetEx/NetEx.vcxproj | 2 | ||||
-rw-r--r-- | NetEx/NetEx.vcxproj.filters | 6 | ||||
-rw-r--r-- | Stars45/Stars.vcxproj | 2 | ||||
-rw-r--r-- | Stars45/Stars.vcxproj.filters | 6 |
8 files changed, 96 insertions, 10 deletions
diff --git a/FoundationEx/MemDebug.cpp b/FoundationEx/MemDebug.cpp index 2694b33..4f3174f 100644 --- a/FoundationEx/MemDebug.cpp +++ b/FoundationEx/MemDebug.cpp @@ -45,7 +45,9 @@ // +--------------------------------------------------------------------+ +#ifndef FOUNDATION_USE_MFC static Memory::LEVEL mem_chk_level = Memory::PERIODIC; +#endif #ifdef _DEBUG static _CrtMemState mem_chk_p1, @@ -61,6 +63,66 @@ static HANDLE mem_log_file = 0; #define CrtClrDebugField(a) _CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) #endif +#ifdef FOUNDATION_USE_MFC + +#ifndef _DEBUG + +void* __cdecl operator new(unsigned int s, const char*, int) +{ + return ::operator new(s); +} + +void __cdecl operator delete(void* p, const char*, int) +{ + ::operator delete(p); +} + +#else + +// No definitions for the following: +//void* __cdecl operator new(unsigned int s, const char*, int) {} +//void __cdecl operator delete(void* p, const char*, int) {} + +#endif + +#else // if not defined FOUNDATION_USE_MFC + +#ifndef _DEBUG + +void* __cdecl operator new(unsigned int s, const char*, int) +{ + return ::operator new(s); +} + +void __cdecl operator delete(void* p, const char*, int) +{ + ::operator delete(p); +} + +#else + +// No definitions for the following: +//void* __cdecl operator new(unsigned int, int, const char*, int) {} + +void* __cdecl operator new(unsigned int s, const char* f, int l) +{ + return ::operator new(s, 1, f, l); +} + +void* __cdecl operator new(unsigned int s) +{ + return ::operator new(s, 1, __FILE__, __LINE__); +} + +void __cdecl operator delete(void* p, const char*, int) +{ + ::operator delete(p); +} + +#endif _DEBUG + +#endif FOUNDATION_USE_MFC + static void heapdump() { _HEAPINFO hinfo; @@ -107,6 +169,7 @@ static void heapdump() // +--------------------------------------------------------------------+ +#ifndef FOUNDATION_USE_MFC void Memory::OpenLog(const char* filename) { @@ -234,3 +297,5 @@ Memory::SetLevel(LEVEL l) #endif } +#endif + diff --git a/FoundationEx/MemDebug.h b/FoundationEx/MemDebug.h index 14bc0cf..0bd63da 100644 --- a/FoundationEx/MemDebug.h +++ b/FoundationEx/MemDebug.h @@ -51,8 +51,8 @@ #ifndef _DEBUG -inline void* __cdecl operator new(unsigned int s, const char*, int) { return ::operator new(s); } -inline void __cdecl operator delete(void* p, const char*, int) { ::operator delete(p); } +void* __cdecl operator new(unsigned int s, const char*, int); +void __cdecl operator delete(void* p, const char*, int); #else @@ -89,21 +89,18 @@ public: #ifndef _DEBUG -inline void* __cdecl operator new(unsigned int s, const char*, int) { return ::operator new(s); } -inline void __cdecl operator delete(void* p, const char*, int) { ::operator delete(p); } +void* __cdecl operator new(unsigned int s, const char*, int); +void __cdecl operator delete(void* p, const char*, int); #else /*_CRTIMP*/ void* __cdecl operator new(unsigned int, int, const char*, int); -inline void* __cdecl operator new(unsigned int s, const char* f, int l) - { return ::operator new(s, 1, f, l); } +void* __cdecl operator new(unsigned int s, const char* f, int l); -inline void* __cdecl operator new(unsigned int s) - { return ::operator new(s, 1, __FILE__, __LINE__); } +void* __cdecl operator new(unsigned int s); -inline void __cdecl operator delete(void* p, const char*, int) - { ::operator delete(p); } +void __cdecl operator delete(void* p, const char*, int); #endif _DEBUG diff --git a/Magic2/Magic.vcxproj b/Magic2/Magic.vcxproj index d1cac69..cda41e0 100644 --- a/Magic2/Magic.vcxproj +++ b/Magic2/Magic.vcxproj @@ -699,6 +699,7 @@ </ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\FoundationEx\MemDebug.cpp" />
<ClCompile Include="..\nGenEx\ActiveWindow.cpp" />
<ClCompile Include="AlphaInverse.cpp" />
<ClCompile Include="AlphaPalette.cpp" />
@@ -825,6 +826,7 @@ <ResourceCompile Include="Magic.rc" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\FoundationEx\MemDebug.h" />
<ClInclude Include="..\nGenEx\AviFile.h" />
<ClInclude Include="Command.h" />
<ClInclude Include="ContentBundle.h" />
diff --git a/Magic2/Magic.vcxproj.filters b/Magic2/Magic.vcxproj.filters index 1ed7515..a6b3503 100644 --- a/Magic2/Magic.vcxproj.filters +++ b/Magic2/Magic.vcxproj.filters @@ -315,6 +315,9 @@ <ClCompile Include="Locale_ss.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\FoundationEx\MemDebug.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Magic.rc">
@@ -403,6 +406,9 @@ <ClInclude Include="Locale_ss.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\FoundationEx\MemDebug.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="res\Magic.ico">
diff --git a/NetEx/NetEx.vcxproj b/NetEx/NetEx.vcxproj index 9833b25..020eb22 100644 --- a/NetEx/NetEx.vcxproj +++ b/NetEx/NetEx.vcxproj @@ -543,6 +543,7 @@ </ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\FoundationEx\MemDebug.cpp" />
<ClCompile Include="HttpClient.cpp" />
<ClCompile Include="HttpServer.cpp" />
<ClCompile Include="HttpServlet.cpp" />
@@ -559,6 +560,7 @@ <ClCompile Include="NetSock.cpp" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\FoundationEx\MemDebug.h" />
<ClInclude Include="HttpClient.h" />
<ClInclude Include="HttpServer.h" />
<ClInclude Include="HttpServlet.h" />
diff --git a/NetEx/NetEx.vcxproj.filters b/NetEx/NetEx.vcxproj.filters index a702de6..7801820 100644 --- a/NetEx/NetEx.vcxproj.filters +++ b/NetEx/NetEx.vcxproj.filters @@ -53,6 +53,9 @@ <ClCompile Include="NetSock.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\FoundationEx\MemDebug.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="HttpClient.h">
@@ -97,5 +100,8 @@ <ClInclude Include="NetSock.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\FoundationEx\MemDebug.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/Stars45/Stars.vcxproj b/Stars45/Stars.vcxproj index 7d013ff..7c2cd83 100644 --- a/Stars45/Stars.vcxproj +++ b/Stars45/Stars.vcxproj @@ -813,6 +813,7 @@ </ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\FoundationEx\MemDebug.cpp" />
<ClCompile Include="Asteroid.cpp" />
<ClCompile Include="AudDlg.cpp" />
<ClCompile Include="AudioConfig.cpp" />
@@ -1033,6 +1034,7 @@ <ResourceCompile Include="Stars.rc" />
</ItemGroup>
<ItemGroup>
+ <ClInclude Include="..\FoundationEx\MemDebug.h" />
<ClInclude Include="Asteroid.h" />
<ClInclude Include="AudDlg.h" />
<ClInclude Include="AudioConfig.h" />
diff --git a/Stars45/Stars.vcxproj.filters b/Stars45/Stars.vcxproj.filters index c3628a5..faa3e03 100644 --- a/Stars45/Stars.vcxproj.filters +++ b/Stars45/Stars.vcxproj.filters @@ -618,6 +618,9 @@ <ClCompile Include="WepView.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\FoundationEx\MemDebug.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Stars.rc">
@@ -1111,6 +1114,9 @@ <ClInclude Include="WepView.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\FoundationEx\MemDebug.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="Stars.ico">
|