Merge branch 'master' of github.com:sippeangelo/Escape-the-Dawn

This commit is contained in:
Tobias Dahl
2014-03-11 09:45:03 +01:00
2 changed files with 12 additions and 4 deletions
+8 -2
View File
@@ -2,6 +2,7 @@
#define DEBUG_H #define DEBUG_H
#ifdef _WIN32 #ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS
// http://stackoverflow.com/a/2282433 // http://stackoverflow.com/a/2282433
#define __func__ __FUNCTION__ #define __func__ __FUNCTION__
// http://stackoverflow.com/a/8488201 // http://stackoverflow.com/a/8488201
@@ -46,10 +47,13 @@ static void _LOG(_LOG_LEVEL logLevel, char* file, char* func, unsigned int line,
if (logLevel > LOG_LEVEL) if (logLevel > LOG_LEVEL)
return; return;
char message[2048];
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vsnprintf_s(message, 2048, format, args); char* message = nullptr;
size_t size = vsnprintf(message, 0, format, args);
message = new char[size+1];
message[size] = '\0';
vsnprintf(message, size, format, args);
va_end(args); va_end(args);
if (logLevel == LOG_LEVEL_ERROR) if (logLevel == LOG_LEVEL_ERROR)
@@ -61,6 +65,8 @@ static void _LOG(_LOG_LEVEL logLevel, char* file, char* func, unsigned int line,
{ {
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl; std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
} }
delete[] message;
} }
#define LOG(logLevel, format, ...) \ #define LOG(logLevel, format, ...) \
+4 -2
View File
@@ -43,19 +43,21 @@
<OutDir>$(SolutionDir)bin\</OutDir> <OutDir>$(SolutionDir)bin\</OutDir>
<TargetName>$(SolutionName)-$(Configuration)</TargetName> <TargetName>$(SolutionName)-$(Configuration)</TargetName>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir> <IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\Escape-the-Dawn;$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath> <IncludePath>$(SolutionDir)\Escape-the-Dawn;$(BOOST_ROOT);$(SolutionDir)\Libraries\openal-soft-1.15.1-bin\include;$(SolutionDir)\Libraries\SOIL\src;$(ProjectDir);$(SolutionDir)\Libraries;$(SolutionDir)\Libraries\glew-1.10.0\include;$(SolutionDir)\Libraries\glfw-3.0.4\include;$(SolutionDir)\Libraries\glm-0.9.5.2;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir> <OutDir>$(SolutionDir)bin\</OutDir>
<TargetName>$(SolutionName)-$(Configuration)</TargetName> <TargetName>$(SolutionName)-$(Configuration)</TargetName>
<IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir> <IntDir>$(SolutionDir)obj\$(ProjectName)\</IntDir>
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-11.0;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GLEW_STATIC;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -69,7 +71,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GLEW_STATIC;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>