diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2011-11-07 14:03:20 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2011-11-07 14:03:20 +0000 |
| commit | 5e7d96110e0c4b19b7e1b05e949f70673358be05 (patch) | |
| tree | 321a1b7889a98263f506ac08ec86fa3015c777b7 /src/dom/uri.cpp | |
| parent | Powerstroke: adjust control points when adding or deleting knots, to try and ... (diff) | |
| download | inkscape-5e7d96110e0c4b19b7e1b05e949f70673358be05.tar.gz inkscape-5e7d96110e0c4b19b7e1b05e949f70673358be05.zip | |
cppcheck: performance and initialisation
(bzr r10729)
Diffstat (limited to 'src/dom/uri.cpp')
| -rw-r--r-- | src/dom/uri.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/dom/uri.cpp b/src/dom/uri.cpp index d559dffeb..e1089017d 100644 --- a/src/dom/uri.cpp +++ b/src/dom/uri.cpp @@ -144,6 +144,7 @@ void URI::init() scheme = SCHEME_NONE; schemeStr.clear(); port = 0; + portSpecified = false; authority.clear(); path.clear(); absolute = false; @@ -200,18 +201,18 @@ static DOMString toStr(const std::vector<int> &arr) DOMString URI::toString() const { DOMString str = schemeStr; - if (authority.size() > 0) + if (!authority.empty()) { str.append("//"); str.append(toStr(authority)); } str.append(toStr(path)); - if (query.size() > 0) + if (!query.empty()) { str.append("?"); str.append(toStr(query)); } - if (fragment.size() > 0) + if (!fragment.empty()) { str.append("#"); str.append(toStr(fragment)); @@ -380,11 +381,11 @@ URI URI::resolve(const URI &other) const return other; //## 2 - if (other.fragment.size() > 0 && - other.path.size() == 0 && - other.scheme == SCHEME_NONE && - other.authority.size() == 0 && - other.query.size() == 0 ) + if (!other.fragment.empty() && + other.path.empty() && + other.scheme == SCHEME_NONE && + other.authority.empty() && + other.query.empty()) { URI fragUri = *this; fragUri.fragment = other.fragment; @@ -398,7 +399,7 @@ URI URI::resolve(const URI &other) const newUri.schemeStr = schemeStr; newUri.query = other.query; newUri.fragment = other.fragment; - if (other.authority.size() > 0) + if (!other.authority.empty()) { //# 3.2 if (absolute || other.absolute) |
