For some esoteric messages from GCC C:B would crash.
if the message output from GCC would contain %(something) like for example in my case:
n:\temp/cc6daaaa.s: Assembler messages:
n:\temp/cc6daaaa.s:397: Warning: translating to `fst %st(1)'
C:B would crash. This is because the Printf(...) like functions: LogToStdOut() and Log(…) where called with the message from GCC passed on the format_str parameter.
(I guess this is the oldest bug in the book, I keep doing them still). The fix also eliminates a few cycles as it does not need the wxString extra copy with the ' output + _T"\n" '.
I have only fixed these places that where in my code path, but a quick search for LogToStdOut() reviles this mistake is done in other places as well. Should I make a patch for all other places? (that I can find)
I have inlined the diff file as made by tortoiseSVN is that ok or should I send it somewhere else? other format ?
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Index: M:/Dinosaur/OneSource/codeblocks/src/plugins/compilergcc/compilergcc.cpp
===================================================================
--- M:/Dinosaur/OneSource/codeblocks/src/plugins/compilergcc/compilergcc.cpp (revision 2139)
+++ M:/Dinosaur/OneSource/codeblocks/src/plugins/compilergcc/compilergcc.cpp (working copy)
@@ -2614,7 +2614,7 @@
void CompilerGCC::AddOutputLine(const wxString& output, bool forceErrorColor)
{
- Manager::Get()->GetMessageManager()->LogToStdOut(output + _T('\n'));
+ Manager::Get()->GetMessageManager()->LogToStdOut(_T("%s\n") ,output.c_str() );
size_t maxErrors = Manager::Get()->GetConfigManager(_T("compiler"))->ReadInt(_T("/max_reported_errors"), 50);
if (maxErrors > 0)
@@ -2674,7 +2674,7 @@
}
if (!output.IsEmpty())
- Manager::Get()->GetMessageManager()->Log(m_PageIndex, output.c_str());
+ Manager::Get()->GetMessageManager()->Log(m_PageIndex, _T("%s"), output.c_str());
}
void CompilerGCC::OnGCCTerminated(CodeBlocksEvent& event)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^