diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-05-31 14:48:44 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-05-31 14:58:06 +0100 |
commit | 569867b6769104f001dc1ae070783318098de583 (patch) | |
tree | e35ef098afc5601bd88a409e5df4b58ac65b5b25 /xml2cmp | |
parent | 93b415a68f6080b5cb88381637433ff29e64cf2d (diff) |
targetted tweak to prep for stl re-work reversion
Change-Id: Ibe60e96b6f961fba13fdd39320969acf51f545f4
Diffstat (limited to 'xml2cmp')
-rw-r--r-- | xml2cmp/source/support/list.hxx | 5 | ||||
-rw-r--r-- | xml2cmp/source/xcd/xmlelem.cxx | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/xml2cmp/source/support/list.hxx b/xml2cmp/source/support/list.hxx index cf949a070e2a..7b270d997853 100644 --- a/xml2cmp/source/support/list.hxx +++ b/xml2cmp/source/support/list.hxx @@ -73,6 +73,9 @@ class List unsigned size() const { return len; } unsigned space() const { return allocated; } + bool is_valid_index( + unsigned n) const + { return n < len; } // ACCESS XX & front() { return elem(0); } XX & back() { return elem(len-1); } @@ -236,7 +239,7 @@ template <class XY> void DynamicList<XY>::remove( unsigned pos ) { - if (pos >= this->len) + if (!this->is_valid_index(pos) ) return; this->len--; delete this->inhalt[pos]; diff --git a/xml2cmp/source/xcd/xmlelem.cxx b/xml2cmp/source/xcd/xmlelem.cxx index 5a795d61c8aa..836c8f65179e 100644 --- a/xml2cmp/source/xcd/xmlelem.cxx +++ b/xml2cmp/source/xcd/xmlelem.cxx @@ -202,7 +202,7 @@ MultipleTextElement::Data( unsigned i_nNr ) const { static const Simstr sNull_; - if (i_nNr < aContent.size()) + if (aContent.is_valid_index(i_nNr)) return aContent[i_nNr]; return sNull_; } |