* Fixed log output truncating the last byte in each message

* Fixed log output for Release builds (NDEBUG)
* Synchronized VS2005/VS2008 preprocessor definitions
This commit is contained in:
sveith 2009-04-07 17:50:26 +00:00
parent 419fa0329d
commit 6d0ddb6a6b
10 changed files with 39 additions and 22 deletions

View File

@ -149,9 +149,8 @@ CLog::print(const char* file, int line, const char* fmt, ...) const
}
// print the prefix to the buffer. leave space for priority label.
char message[2048];
if (file != NULL) {
char message[2048];
struct tm *tm;
char tmp[220];
time_t t;
@ -169,11 +168,12 @@ CLog::print(const char* file, int line, const char* fmt, ...) const
message += pPad - g_priorityPad;
}
*/
// output buffer
output(priority, message);
} else {
output(priority, buffer);
}
// output buffer
output(priority, message);
// clean up
if (buffer != stack) {
delete[] buffer;
@ -272,7 +272,10 @@ CLog::output(int priority, char* msg) const
*/
// find end of message
//char* end = msg + g_priorityPad + strlen(msg + g_priorityPad);
char* end = msg+strlen(msg)-1;
int len = strlen(msg);
char* tmp = new char[len+m_maxNewlineLength+1];
char* end = tmp + len;
strcpy(tmp, msg);
// write to each outputter
CArchMutexLock lock(m_mutex);
@ -282,12 +285,12 @@ CLog::output(int priority, char* msg) const
// get outputter
ILogOutputter* outputter = *index;
// put an appropriate newline at the end
strcpy(end, outputter->getNewline());
// put an appropriate newline at the end
strcpy(end, outputter->getNewline());
// write message
outputter->write(static_cast<ILogOutputter::ELevel>(priority),
msg /*+ g_maxPriorityLength - n*/);
tmp /*+ g_maxPriorityLength - n*/);
}
for (COutputterList::const_iterator index = m_outputters.begin();
index != m_outputters.end(); ++index) {
@ -299,8 +302,10 @@ CLog::output(int priority, char* msg) const
// write message and break out of loop if it returns false
if (!outputter->write(static_cast<ILogOutputter::ELevel>(priority),
msg /*+ g_maxPriorityLength - n*/)) {
tmp /*+ g_maxPriorityLength - n*/)) {
break;
}
}
delete[] tmp;
}

View File

@ -40,6 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -113,6 +114,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

View File

@ -40,6 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SYNRGYHK_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -116,6 +117,7 @@
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SYNRGYHK_EXPORTS"
RuntimeLibrary="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

View File

@ -40,7 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -114,7 +114,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"

View File

@ -40,7 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -103,7 +103,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -40,6 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -113,6 +114,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
WarningLevel="3"
Detect64BitPortabilityProblems="true"

View File

@ -94,7 +94,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool

View File

@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -117,7 +117,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@ -171,6 +171,14 @@
ReferencedProjectIdentifier="{EC741F89-2FC8-46B5-9C0F-0F1A3089ED21}"
RelativePathToProject=".\libsynergy\libsynergy.vcproj"
/>
<ProjectReference
ReferencedProjectIdentifier="{18E611F5-A254-495B-BAC8-3322F827E7B3}"
RelativePathToProject=".\server\server.vcproj"
/>
<ProjectReference
ReferencedProjectIdentifier="{29F4C90F-33D2-4AD1-9E59-412DFA26FC29}"
RelativePathToProject=".\client\client.vcproj"
/>
</References>
<Files>
<Filter

View File

@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@ -107,7 +107,7 @@
EnableIntrinsicFunctions="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"

View File

@ -117,11 +117,9 @@
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"