Author Topic: Patch for inserting implementation  (Read 4690 times)

Offline zetab

  • Multiple posting newcomer
  • *
  • Posts: 18
Patch for inserting implementation
« on: June 16, 2014, 10:02:36 pm »
Hello,

If I remember it right, this is once reported by ollydbg in an old bug ticket, but somehow it's not applied to the source.

The patch fixes the wrong return type when inserting implementation of functions whose return type have multiple words, e.g. "unsigned int func();".

Code
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 9807)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -2744,7 +2744,7 @@
                 str << ed->GetLineIndentString(line - 1);
             if (addDoxgenComment)
                 str << _T("/** @brief ") << token->m_Name << _T("\n  *\n  * @todo: document this function\n  */\n");
-            wxString type = token->m_BaseType;
+            wxString type = token->m_FullType;
             if ((type.Last() == _T('&') || type.Last() == _T('*')) && type[type.Len() - 2] == _T(' '))
             {
                 type[type.Len() - 2] = type.Last();


Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6075
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Patch for inserting implementation
« Reply #1 on: June 18, 2014, 08:22:11 am »
Hi, thanks for the remind, I really forgot this.

The good news is that I can still find the old bug report, I just did a Google search by
Code
  return type ollydbg  site:alpha0010.github.io/cb-history
Credit goes to alpha!!

Now, I find it here:
Bug 18526 - Code::Blocks History

There are a lot of discussions two years ago, I will read them.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.