Author Topic: Strange editor checks  (Read 4868 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Strange editor checks
« on: February 03, 2013, 11:46:39 pm »
I've just found some strange code in the CC plugin.

There is a variable which holds the name of the start page.
And instead of checking for IsBuiltinEditor it does string compares to the filename.
Can someone familiar with the code check it and verify that it is correct (I highly doubt it is)?

To find it search globally for "g_StartHereTitle".
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5370
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Strange editor checks
« Reply #1 on: February 04, 2013, 04:15:25 am »
Hi, OBF, good catch, by reading the source code, I see that using "IsBuiltinEditor()" check is better. Currently, only cbEditor class have this bool member variable set "m_IsBuiltinEditor = true;". Will fix it.
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5370
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Strange editor checks
« Reply #2 on: February 04, 2013, 08:11:34 am »
A testing patch.

I see that the logic of updating the Toolbar was not good, so maybe, it still need refactoring.

A related discussion: Time to refresh the CC Toolbar
« Last Edit: February 04, 2013, 08:20:17 am by ollydbg »
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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5370
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Strange editor checks
« Reply #3 on: February 16, 2013, 03:03:41 pm »
Done.

Quote
Revision: 8844
Author: ollydbg
Date: 2013-2-16 17:20:48
Message:
*CC: Checking a valid builtin editor by using Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor() instead of comparing the global g_StartHereTitle wxString.
-CC: Tweak some comments.
-------------------------------
M : /trunk/src/plugins/codecompletion/codecompletion.cpp

M : /trunk/src/plugins/codecompletion/nativeparser.cpp

M : /trunk/src/plugins/codecompletion/nativeparser.h

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.