[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: branches/KDE/4.4/kdelibs/kate/utils
From:       Michael Seiwert <mseiwert () hbv ! de>
Date:       2010-03-25 12:54:14
Message-ID: 201003251354.15154.mseiwert () hbv ! de
[Download RAW message or body]

Hi,

one of the commits broke compiling the 4.4 branch.

[ 69%] [ 69%] Building CXX object 
kate/CMakeFiles/katepart.dir/utils/katetemplatehandler.o
Building CXX object kate/CMakeFiles/katepart.dir/search/katesearchbar.o               \
                
/home/mseiwert/src/svn/kde/kdelibs/kate/utils/katetemplatehandler.cpp:124: 
warning: unused parameter ‘document'  
/home/mseiwert/src/svn/kde/kdelibs/kate/utils/katetemplatehandler.cpp:491: 
warning: unused parameter ‘document'
/home/mseiwert/src/svn/kde/kdelibs/kate/search/katesearchbar.cpp:987: error: 
expected unqualified-id before ‘while'
/home/mseiwert/src/svn/kde/kdelibs/kate/search/katesearchbar.cpp:990: error: 
expected unqualified-id before ‘if'
make[2]: *** [kate/CMakeFiles/katepart.dir/search/katesearchbar.o] Fehler 1
make[2]: *** Warte auf noch nicht beendete Prozesse...
[ 69%] Built target kdewebkit
[ 69%] Built target data-handbook
[ 69%] Generating index.cache.bz2
make[1]: *** [kate/CMakeFiles/katepart.dir/all] Fehler 2                              \
 make[1]: *** Warte auf noch nicht beendete Prozesse...
[ 69%] Built target file-handbook

Best,

Michael


On Thursday 25 March 2010 00:07:37 Milian Wolff wrote:
> SVN commit 1107146 by mwolff:
> 
> backport r1106487: fix handling of escaped variables, fixes cases like
> \${foo${real template var}asdf}
> 
> 
> M  +48 -42    katetemplatehandler.cpp
> 
> 
> --- branches/KDE/4.4/kdelibs/kate/utils/katetemplatehandler.cpp
> #1107145:1107146 @@ -351,61 +351,67 @@
> }
> } else if ( (templateString[i] == '%' || templateString[i] == '$')
> && i + 1 < templateString.size() && templateString[i+1] ==
> '{' ) { -      // don't check for startPos == -1 here, overwrite blindly
> since nested variables are not supported -      startPos = i;
> -      // skip '{'
> -      ++i;
> -      column += 2;
> -    } else if ( templateString[i] == '}' && startPos != -1 ) {
> // check whether this var is escaped
> int escapeChars = 0;
> -      while ( startPos - escapeChars > 0 && templateString[startPos -
> escapeChars - 1] == '\\' ) { +      while ( i - escapeChars > 0 &&
> templateString[i - escapeChars - 1] == '\\' ) { ++escapeChars;
> }
> if ( escapeChars > 0 ) {
> +        ifDebug(kDebug() << "found" << escapeChars << "escape chars at "
> << templateString.mid(i - escapeChars - 10, escapeChars + 10);) // remove
> half of the escape chars (i.e. \\ => \) and make sure the // odd rest is
> removed as well (i.e. the one that escapes this var) int toRemove =
> (escapeChars + 1) / 2;
> -        templateString.remove(startPos - escapeChars, toRemove);
> +        ifDebug(kDebug() << "will remove" << toRemove << "of those escape
> chars";) +        templateString.remove(i - escapeChars, toRemove);
> i -= toRemove;
> column -= toRemove;
> -        startPos -= toRemove;
> }
> if ( escapeChars % 2 == 0 ) {
> -        // get key, i.e. contents between ${..}
> -        const QString key = templateString.mid( startPos + 2, i -
> (startPos + 2) ); -        if ( !initialValues.contains(key) ) {
> -          kWarning() << "unknown variable key:" << key;
> -        } else if ( key == "cursor" ) {
> -          finalCursorPosition = Cursor(line, column - key.length() - 2);
> -          // don't insert anything, just remove the placeholder
> -          templateString.remove(startPos, i - startPos + 1);
> -          // correct iterator pos, 3 == $ + { + }
> -          i -= 3 + key.length();
> -          column -= 2 + key.length();
> -          startPos = -1;
> -        } else {
> -          // whether the variable starts with % or $
> -          QChar c = templateString[startPos];
> -          // replace variable with initial value
> -          templateString.replace( startPos, i - startPos + 1,
> initialValues[key] ); -          // correct iterator pos, 3 == % + { + }
> -          i -= 3 + key.length() - initialValues[key].length();
> -          // correct column to point at end of range, taking replacement
> width diff into account -          // 2 == % + {
> -          column -= 2 + key.length() - initialValues[key].length();
> -          // always add ${...} to the editable ranges
> -          // only add %{...} to the editable ranges when it's value equals
> the key -          if ( c == '$' || key == initialValues[key] ) {
> -            if ( !keyQueue.contains(key) ) {
> -              keyQueue.append(key);
> -            }
> -            ranges.insert( key,
> -                          Range( line, column -
> initialValues[key].length(), -                                  line,
> column
> -                                )
> -                          );
> +        // don't check for startPos == -1 here, overwrite blindly since
> nested variables are not supported +        startPos = i;
> +      }
> +      // skip '{'
> +      ++i;
> +      column += 2;
> +    } else if ( templateString[i] == '}' && startPos != -1 ) {
> +      // get key, i.e. contents between ${..}
> +      const QString key = templateString.mid( startPos + 2, i - (startPos
> + 2) ); +      ifDebug(kDebug() << "key found:" << key;)
> +      if ( !initialValues.contains(key) ) {
> +        kWarning() << "unknown variable key:" << key;
> +      } else if ( key == "cursor" ) {
> +        finalCursorPosition = Cursor(line, column - key.length() - 2);
> +        // don't insert anything, just remove the placeholder
> +        templateString.remove(startPos, i - startPos + 1);
> +        // correct iterator pos, 3 == $ + { + }
> +        i -= 3 + key.length();
> +        column -= 2 + key.length();
> +        startPos = -1;
> +      } else {
> +        // whether the variable starts with % or $
> +        QChar c = templateString[startPos];
> +        // replace variable with initial value
> +        templateString.replace( startPos, i - startPos + 1,
> initialValues[key] ); +        // correct iterator pos, 3 == % + { + }
> +        i -= 3 + key.length() - initialValues[key].length();
> +        // correct column to point at end of range, taking replacement
> width diff into account +        // 2 == % + {
> +        column -= 2 + key.length() - initialValues[key].length();
> +        // always add ${...} to the editable ranges
> +        // only add %{...} to the editable ranges when it's value equals
> the key +        ifDebug(kDebug() << "char is:" << c << "initial value
> is:" << initialValues[key];) +        if ( c == '$' || key ==
> initialValues[key] ) {
> +          if ( !keyQueue.contains(key) ) {
> +            keyQueue.append(key);
> }
> +          ranges.insert( key,
> +                        Range( line, column - initialValues[key].length(),
> +                                line, column
> +                              )
> +                        );
> +          ifDebug(kDebug() << "range is:" << Range( line, column -
> initialValues[key].length(), +                                line, column
> +                              );)
> }
> }
> startPos = -1;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic