News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

[FIXED] Patch for what I think is an coding bug in compileroptionsdlg.cpp

Started by stahta01, September 18, 2008, 04:45:44 PM

Previous topic - Next topic

stahta01

FYI:

While trying to patch Code::Blocks for wxWidgets 2.9x I found an place where an string is compared to an int.

Tim S

PS: I have been up for over an day; so, take that into consideration.

excerpt from compilerfactory.h

static const wxString& GetDefaultCompilerID();


excerpt from compileroptionsdlg.cpp

        int idx   = XRCCTRL(*this, "cmbCompiler", wxChoice)->GetSelection();
        int count = XRCCTRL(*this, "cmbCompiler", wxChoice)->GetCount(); // compilers count
        Compiler* compiler = CompilerFactory::GetCompiler(idx);

        XRCCTRL(*this, "btnSetDefaultCompiler", wxButton)->Enable(CompilerFactory::GetDefaultCompilerID() != idx);


Patch that I think is needed

Index: src/plugins/compilergcc/compileroptionsdlg.cpp
===================================================================
--- src/plugins/compilergcc/compileroptionsdlg.cpp (revision 5204)
+++ src/plugins/compilergcc/compileroptionsdlg.cpp (working copy)
@@ -2124,7 +2124,7 @@
         int count = XRCCTRL(*this, "cmbCompiler", wxChoice)->GetCount(); // compilers count
         Compiler* compiler = CompilerFactory::GetCompiler(idx);

-        XRCCTRL(*this, "btnSetDefaultCompiler", wxButton)->Enable(CompilerFactory::GetDefaultCompilerID() != idx);
+        XRCCTRL(*this, "btnSetDefaultCompiler", wxButton)->Enable(CompilerFactory::GetCompilerIndex(CompilerFactory::GetDefaultCompiler()) != idx);
         XRCCTRL(*this, "btnAddCompiler",        wxButton)->Enable(en);
         XRCCTRL(*this, "btnRenameCompiler",     wxButton)->Enable(en && count);
         XRCCTRL(*this, "btnDelCompiler",        wxButton)->Enable(en &&
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

MortenMacFly

Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]