diff options
author | Michael Vogt <mvo@debian.org> | 2014-03-14 09:02:44 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-03-14 09:02:44 +0100 |
commit | 83b880c6505a20247239d897b7387bba37942993 (patch) | |
tree | 11a23275548175e301f6fefda20a6a8bb6fe6de8 /apt-pkg/contrib/strutl.cc | |
parent | f98d9bd2adf4f24a72d973f5752b47987843984c (diff) | |
parent | 40f8a8ba8c2e7ff9ce80781250c863c07ac130dd (diff) |
fix test/integration/test-apt-helper
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index d4f53ea3a..2100ee47b 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -21,6 +21,11 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/error.h> +#include <stddef.h> +#include <stdlib.h> +#include <time.h> +#include <string> +#include <vector> #include <ctype.h> #include <string.h> #include <sstream> @@ -33,9 +38,9 @@ #include <iconv.h> #include <apti18n.h> - -using namespace std; /*}}}*/ +using namespace std; + // Strip - Remove white space from the front and back of a string /*{{{*/ // --------------------------------------------------------------------- namespace APT { @@ -153,7 +158,7 @@ char *_strrstrip(char *String) End++; *End = 0; return String; -}; +} /*}}}*/ // strtabexpand - Converts tabs into 8 spaces /*{{{*/ // --------------------------------------------------------------------- @@ -1130,9 +1135,11 @@ bool TokSplitString(char Tok,char *Input,char **List, also, but the advantage is that we have an iteratable vector */ vector<string> VectorizeString(string const &haystack, char const &split) { + vector<string> exploded; + if (haystack.empty() == true) + return exploded; string::const_iterator start = haystack.begin(); string::const_iterator end = start; - vector<string> exploded; do { for (; end != haystack.end() && *end != split; ++end); exploded.push_back(string(start, end)); @@ -1182,7 +1189,7 @@ unsigned long RegexChoice(RxChoiceList *Rxs,const char **ListBegin, R->Hit = false; unsigned long Hits = 0; - for (; ListBegin != ListEnd; ListBegin++) + for (; ListBegin < ListEnd; ++ListBegin) { // Check if the name is a regex const char *I; |