Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

New code completion remarks/issues

<< < (10/54) > >>

ollydbg:

--- Quote from: blueshake on September 25, 2009, 07:43:57 am ---@ollydbg
I comment wxArrayString GetIncludeDirs(cbProject &project)
and void CodeCompletion::CodeCompleteIncludes() function implementation.Then the cc works in the latest cc.
And I test the codes in codecompletion.cpp without any comment in svn 5731.Everything work perfectly.


--- End quote ---

I have noticed that there's no difference in the parserthread::SkipBlock() function in the neally two month.

but I found some code changes in the tokenizer.cpp in function SkipToChar from rev 5434->5783.


--- Code: ---bool Tokenizer::SkipToChar(const wxChar& ch)
{
    // skip everything until we find ch
    while(true)
    {
        while (CurrentChar() != ch && MoveToNextChar())  // don't check EOF when MoveToNextChar already does
            ;

        if (IsEOF())
            return false;

        if (PreviousChar() != '\\')
            break;
        else
        {
            // check for "\\"
            if (((m_TokenIndex - 2) >= 0) && ((m_TokenIndex - 2) >= m_BufferLen) && (m_Buffer.GetChar(m_TokenIndex - 2) == '\\'))
                break;
        }
        MoveToNextChar();
    }
    return true;
}

--- End code ---

Why we need to check this :


--- Code: ---            // check for "\\"
            if (((m_TokenIndex - 2) >= 0) && ((m_TokenIndex - 2) >= m_BufferLen) && (m_Buffer.GetChar(m_TokenIndex - 2) == '\\'))

--- End code ---


((m_TokenIndex - 2) >= m_BufferLen  ?????


I think it should be:

(m_TokenIndex - 2)<= m_BufferLen

ollydbg:
Ok, fixed by this patch:


--- Code: ---Index: tokenizer.cpp
===================================================================
--- tokenizer.cpp (revision 5818)
+++ tokenizer.cpp (working copy)
@@ -230,7 +230,7 @@
         else
         {
             // check for "\\"
-            if (((m_TokenIndex - 2) >= 0) && ((m_TokenIndex - 2) >= m_BufferLen) && (m_Buffer.GetChar(m_TokenIndex - 2) == '\\'))
+            if (((m_TokenIndex - 2) >= 0) && ((m_TokenIndex - 2) <= m_BufferLen) && (m_Buffer.GetChar(m_TokenIndex - 2) == '\\'))
                 break;
         }
         MoveToNextChar();
@@ -286,7 +286,7 @@
         else
         {
             // check for "\\"
-            if (((m_TokenIndex - 2) >= 0) && ((m_TokenIndex - 2) >= m_BufferLen) && (m_Buffer.GetChar(m_TokenIndex - 2) == '\\'))
+            if (((m_TokenIndex - 2) >= 0) && ((m_TokenIndex - 2) <= m_BufferLen) && (m_Buffer.GetChar(m_TokenIndex - 2) == '\\'))
                 break;
         }
         MoveToNextChar();

--- End code ---

MortenMacFly:

--- Quote from: ollydbg on September 25, 2009, 08:19:23 am ---I think it should be:
(m_TokenIndex - 2)<= m_BufferLen

--- End quote ---
Definitely. I'll certainly apply this in trunk when tested. But it really looks very ugly to me, too.

blueshake:
It worked. :D
Cool ,man!!!!!!!!!!!!!!

mmkider:
New Code Completion plug-in is more powerful.

 :D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version