[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmplayer/0.11] /: Fix subsequence endless loop and handle missing length
From: Koos Vriezen <koos.vriezen () gmail ! com>
Date: 2016-07-02 11:58:59
Message-ID: E1bJJZb-0002bK-4m () code ! kde ! org
[Download RAW message or body]
Git commit ac0daefd74403452e3839d0d25c19d68f17cd997 by Koos Vriezen.
Committed on 02/07/2016 at 11:54.
Pushed by vriezen into branch '0.11'.
Fix subsequence endless loop and handle missing length
Test was lucky to start at 1
M +2 -2 src/expression.cpp
M +2 -0 tests/state.smil
http://commits.kde.org/kmplayer/ac0daefd74403452e3839d0d25c19d68f17cd997
diff --git a/src/expression.cpp b/src/expression.cpp
index d64185b..ab5e787 100644
--- a/src/expression.cpp
+++ b/src/expression.cpp
@@ -1323,7 +1323,7 @@ ExprIterator* SubSequence::exprIterator(ExprIterator* parent) \
const start = 1;
if (a->next_sibling)
length = a->next_sibling->toInt();
- while (!parent->atEnd()) {
+ for (; !parent->atEnd(); parent->next()) {
if (parent->position + 1 == start)
break;
}
@@ -1334,7 +1334,7 @@ ExprIterator* SubSequence::exprIterator(ExprIterator* parent) \
const virtual void next() {
assert(!parent->atEnd());
parent->next();
- if (parent->position + 1 < start + length)
+ if (length < 0 || parent->position + 1 < start + length)
cur_value = parent->cur_value;
else
cur_value = NodeValue(NULL, NULL);
diff --git a/tests/state.smil b/tests/state.smil
index 83ffab8..6134c43 100644
--- a/tests/state.smil
+++ b/tests/state.smil
@@ -62,6 +62,8 @@
left="10" top="70" width="300" height="20"/>
<text src="data:,First two \
words%20are%20"{string-join(subsequence(tokenize(/data/books/book[2]/title,"\S+"),1,2), \
' ')}"" left="10" top="100" width="300" height="20"/>
+ <text src="data:,Words after second \
words%20are%20"{string-join(subsequence(tokenize(/data/books/book[2]/title,"\S+"),3), \
' ')}"" + left="10" top="130" width="300" height="20"/>
<text src="data:,second%20attribute%20on%20book%20{//book/@*[2]}" left="10" \
top="160" width="300" height="20"/> </par>
<par dur="5">
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic