diff options
author | Karl Berry <karl@freefriends.org> | 2017-02-13 17:57:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-02-13 17:57:19 +0000 |
commit | 440b2f2a8fe3b1328d2166a83ab56a12bedc624c (patch) | |
tree | 02326974419db3aefc05d556d6e218ae8a92e480 /Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp | |
parent | 8be6eac70738a24fd3b7609bf9447b84a4237025 (diff) |
import original dvisvgm-2.1.2
git-svn-id: svn://tug.org/texlive/trunk@43208 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp')
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp index f45b17e966d..ba5d62c9835 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/BoundingBox.cpp @@ -67,26 +67,26 @@ BoundingBox::BoundingBox (const string &boxstr) } -/** Extracts a sequence of length values from a given string. +/** Extracts a sequence of length values from a string like "5cm, 2.4in, 0pt". * @param[in] boxstr whitespace and/or comma separated string of lengths. * @param[out] the extracted lengths */ void BoundingBox::extractLengths (string boxstr, vector<Length> &lengths) { - const size_t len = boxstr.length(); - size_t l=0; boxstr = util::trim(boxstr); + const size_t len = boxstr.length(); + size_t left=0; string lenstr; do { - while (l < len && isspace(boxstr[l])) - l++; - size_t r=l; - while (r < len && !isspace(boxstr[r]) && boxstr[r] != ',') - r++; - lenstr = boxstr.substr(l, r-l); + while (left < len && isspace(boxstr[left])) + left++; + size_t right=left; + while (right < len && !isspace(boxstr[right]) && boxstr[right] != ',') + right++; + lenstr = boxstr.substr(left, right-left); if (!lenstr.empty()) { lengths.emplace_back(Length(lenstr)); - if (boxstr[r] == ',') - r++; - l = r; + if (boxstr[right] == ',') + right++; + left = right; } } while (!lenstr.empty() && lengths.size() < 4); } |