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

View File

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

View File

@ -40,6 +40,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -116,6 +117,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" RuntimeLibrary="2"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"

View File

@ -40,7 +40,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -114,7 +114,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" RuntimeLibrary="2"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"

View File

@ -40,7 +40,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -103,7 +103,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" RuntimeLibrary="2"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"

View File

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

View File

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

View File

@ -42,7 +42,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -117,7 +117,7 @@
Optimization="2" Optimization="2"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" RuntimeLibrary="2"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
@ -171,6 +171,14 @@
ReferencedProjectIdentifier="{EC741F89-2FC8-46B5-9C0F-0F1A3089ED21}" ReferencedProjectIdentifier="{EC741F89-2FC8-46B5-9C0F-0F1A3089ED21}"
RelativePathToProject=".\libsynergy\libsynergy.vcproj" 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> </References>
<Files> <Files>
<Filter <Filter

View File

@ -42,7 +42,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@ -107,7 +107,7 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="..\..\lib\arch;..\..\lib\base;..\..\lib\client;..\..\lib\common;..\..\lib\io;..\..\lib\mt;..\..\lib\net;..\..\lib\platform;..\..\lib\server;..\..\lib\synergy" 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" RuntimeLibrary="2"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"

View File

@ -117,11 +117,9 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="2" 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" 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" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
DebugInformationFormat="3" DebugInformationFormat="3"