diff options
| author | Bob Jamison <ishmalius@gmail.com> | 2008-03-08 20:41:09 +0000 |
|---|---|---|
| committer | ishmal <ishmal@users.sourceforge.net> | 2008-03-08 20:41:09 +0000 |
| commit | daed6656ab71670bc2a3881f0ba8e810c7bf9220 (patch) | |
| tree | 7d3a78fcc4499be8a709312a6068a41bdc651185 /src | |
| parent | Change charclass.cpp/h to ucd.cpp/h (diff) | |
| download | inkscape-daed6656ab71670bc2a3881f0ba8e810c7bf9220.tar.gz inkscape-daed6656ab71670bc2a3881f0ba8e810c7bf9220.zip | |
Fixed bug found by JonCruz. Using an unsigned int in findLast() caused an infinite loop.
(bzr r4994)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dom/uri.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/dom/uri.cpp b/src/dom/uri.cpp index db45a2abf..562a674bb 100644 --- a/src/dom/uri.cpp +++ b/src/dom/uri.cpp @@ -10,7 +10,7 @@ * Authors: * Bob Jamison * - * Copyright (C) 2005-2007 Bob Jamison + * Copyright (C) 2005-2008 Bob Jamison * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -329,10 +329,11 @@ static int find(const std::vector<int> &str, int ch, int startpos) static int findLast(const std::vector<int> &str, int ch) { - // TODO FIXME BUGBUG - // This loop appears to be infinite, so it is probably not being called. - // Test for a problem, then fix after it has been observed locking up. - for (unsigned int i = str.size()-1 ; i>=0 ; i--) + /** + * Fixed. Originally I used an unsigned int for str.size(), + * which was dumb, since i>=0 would always be true. + */ + for (int i = ((int)str.size())-1 ; i>=0 ; i--) { if (ch == str[i]) return i; |
