1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
From 183e6666f6afd7973f60f2253187e8c24b58b6b1 Mon Sep 17 00:00:00 2001
From: Jim Ramsay <i.am@jimramsay.com>
Date: Mon, 6 Apr 2009 17:25:01 -0400
Subject: [PATCH 1/2] Exit loop for unterminated { } pair
---
src/FbTk/StringUtil.hh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/FbTk/StringUtil.hh b/src/FbTk/StringUtil.hh
index 75fa69e..35f23a2 100644
--- a/src/FbTk/StringUtil.hh
+++ b/src/FbTk/StringUtil.hh
@@ -84,7 +84,7 @@ static void stringTokensBetween(Container &container, const std::string &in,
while (true) {
err = getStringBetween(token, in.c_str() + pos, first, last, ok_chars,
allow_nesting);
- if (err == 0)
+ if (err <= 0)
break;
container.push_back(token);
pos += err;
--
1.6.2
From 55c45305d4f6973f5fbecec1e527e55dd6bd9fa5 Mon Sep 17 00:00:00 2001
From: Jim Ramsay <i.am@jimramsay.com>
Date: Wed, 8 Apr 2009 10:57:04 -0400
Subject: [PATCH 2/2] Error on incomplete MacroCmd key command
---
src/FbTk/MacroCommand.cc | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/FbTk/MacroCommand.cc b/src/FbTk/MacroCommand.cc
index 511683b..555e5f5 100644
--- a/src/FbTk/MacroCommand.cc
+++ b/src/FbTk/MacroCommand.cc
@@ -33,16 +33,18 @@ namespace {
template <typename M>
M *addCommands(M *macro, const std::string &args, bool trusted) {
- std::string blah;
+ std::string remainder;
std::list<std::string> cmds;
- StringUtil::stringTokensBetween(cmds, args, blah, '{', '}');
+ StringUtil::stringTokensBetween(cmds, args, remainder, '{', '}');
RefCount<Command<void> > cmd(0);
- std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end();
- for (; it != it_end; ++it) {
- cmd = CommandParser<void>::instance().parse(*it, trusted);
- if (*cmd)
- macro->add(cmd);
+ if (remainder.length() == 0) {
+ std::list<std::string>::iterator it = cmds.begin(), it_end = cmds.end();
+ for (; it != it_end; ++it) {
+ cmd = CommandParser<void>::instance().parse(*it, trusted);
+ if (*cmd)
+ macro->add(cmd);
+ }
}
if (macro->size() > 0)
--
1.6.2
|