summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/strutl.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-04-01 13:57:22 +0200
committerMichael Vogt <mvo@debian.org>2014-04-01 13:57:22 +0200
commit8a1c9010137a8c49d9808f2db34b9ee277138986 (patch)
tree5ec5c0103cb896407d8c9542fac0ec8ab3313602 /apt-pkg/contrib/strutl.cc
parentfa55ccaa85ca8f85251300f5c5f574edc0c3ca71 (diff)
parent417e83d0d79637266e04c98189c62ce85bcdf737 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: apt-pkg/deb/dpkgpm.cc debian/apt.auto-removal.sh debian/changelog vendor/debian/sources.list.in
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r--apt-pkg/contrib/strutl.cc17
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;