diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-05-22 00:00:34 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-05-22 00:00:34 +0400 |
commit | 8557af19b508e6a23a9752eeac7aa980ebd199d7 (patch) | |
tree | c6a4d3a5d6a26751ffd856790502df5c0bcb23e3 /apt-pkg/contrib/strutl.cc | |
parent | bd7d9f2577ecc7a68113bb3499ffa3f581a9c8ff (diff) | |
parent | f431dc624a04b9280ddd5a6a839adc25ad621847 (diff) | |
download | apt-8557af19b508e6a23a9752eeac7aa980ebd199d7.tar.gz |
Merge http://git.debian.org/apt/apt
Conflicts:
apt-pkg/makefile
apti18n.h
configure.in
debian/changelog
debian/rules
doc/makefile
po/ast.po
po/bg.po
po/ca.po
po/cs.po
po/da.po
po/de.po
po/es.po
po/eu.po
po/fr.po
po/gl.po
po/hu.po
po/it.po
po/ja.po
po/ko.po
po/nb.po
po/nl.po
po/pl.po
po/pt.po
po/ru.po
po/sk.po
po/sl.po
po/sv.po
po/vi.po
po/zh_CN.po
po/zh_TW.po
test/libapt/makefile
Diffstat (limited to 'apt-pkg/contrib/strutl.cc')
-rw-r--r-- | apt-pkg/contrib/strutl.cc | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 5dac7921..7a4e70d5 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -118,7 +118,13 @@ char *_strstrip(char *String) if (*String == 0) return String; - + return _strrstrip(String); +} + /*}}}*/ +// strrstrip - Remove white space from the back of a string /*{{{*/ +// --------------------------------------------------------------------- +char *_strrstrip(char *String) +{ char *End = String + strlen(String) - 1; for (;End != String - 1 && (*End == ' ' || *End == '\t' || *End == '\n' || *End == '\r'); End--); @@ -1250,7 +1256,7 @@ string StripEpoch(const string &VerStr) return VerStr; return VerStr.substr(i+1); } - + /*}}}*/ // tolower_ascii - tolower() function that ignores the locale /*{{{*/ // --------------------------------------------------------------------- /* This little function is the most called method we have and tries @@ -1288,14 +1294,14 @@ bool CheckDomainList(const string &Host,const string &List) return false; } /*}}}*/ -// DeEscapeString - unescape (\0XX and \xXX) from a string /*{{{*/ +// DeEscapeString - unescape (\0XX and \xXX) from a string /*{{{*/ // --------------------------------------------------------------------- /* */ string DeEscapeString(const string &input) { char tmp[3]; - string::const_iterator it, escape_start; - string output, octal, hex; + string::const_iterator it; + string output; for (it = input.begin(); it != input.end(); ++it) { // just copy non-escape chars @@ -1481,9 +1487,12 @@ URI::operator string() if (User.empty() == false) { - Res += User; + // FIXME: Technically userinfo is permitted even less + // characters than these, but this is not conveniently + // expressed with a blacklist. + Res += QuoteString(User, ":/?#[]@"); if (Password.empty() == false) - Res += ":" + Password; + Res += ":" + QuoteString(Password, ":/?#[]@"); Res += "@"; } @@ -1522,7 +1531,6 @@ string URI::SiteOnly(const string &URI) U.User.clear(); U.Password.clear(); U.Path.clear(); - U.Port = 0; return U; } /*}}}*/ @@ -1534,7 +1542,6 @@ string URI::NoUserPassword(const string &URI) ::URI U(URI); U.User.clear(); U.Password.clear(); - U.Port = 0; return U; } /*}}}*/ |