aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-05 07:25:19 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-05 07:25:19 +0000
commit998ded909087493cc1ad80801ec8409193b8d581 (patch)
tree26bc8f67e2478ea426b46c94a8bc9fdf01662943
parent4b1049778358573294a285a0705ab6c99a5182f5 (diff)
downloadpaludis-998ded909087493cc1ad80801ec8409193b8d581.tar.gz
paludis-998ded909087493cc1ad80801ec8409193b8d581.tar.xz
Don't barf on -100dpi and the like in package names
-rw-r--r--paludis/dep_atom.cc14
-rw-r--r--paludis/name.cc14
2 files changed, 14 insertions, 14 deletions
diff --git a/paludis/dep_atom.cc b/paludis/dep_atom.cc
index e07d9fa..c0d1c7f 100644
--- a/paludis/dep_atom.cc
+++ b/paludis/dep_atom.cc
@@ -111,6 +111,7 @@ PackageDepAtom::PackageDepAtom(const std::string & ss) :
_version_operator = s.substr(0, p);
std::string::size_type q(p);
+
while (true)
{
if (p >= s.length())
@@ -121,6 +122,19 @@ PackageDepAtom::PackageDepAtom(const std::string & ss) :
if (s.at(q) >= '0' && s.at(q) <= '9')
break;
}
+
+ std::string::size_type new_q(q);
+ while (true)
+ {
+ if (new_q >= s.length())
+ break;
+ new_q = s.find('-', new_q + 1);
+ if ((std::string::npos == new_q) || (++new_q >= s.length()))
+ break;
+ if (s.at(new_q) >= '0' && s.at(new_q) <= '9')
+ q = new_q;
+ }
+
_package = QualifiedPackageName(s.substr(p, q - p - 1));
if ('*' == s.at(s.length() - 1))
diff --git a/paludis/name.cc b/paludis/name.cc
index 7cfb508..a025c63 100644
--- a/paludis/name.cc
+++ b/paludis/name.cc
@@ -139,8 +139,6 @@ PackageNamePartValidator::validate(const std::string & s)
throw PackageNamePartError(s);
}
- /* we don't allow - followed by only numbers, because it could be
- * a version spec. */
for (std::string::size_type p(0) ; p < s.length() ; ++p)
{
if (std::string::npos == allowed_chars.find(s[p]))
@@ -148,18 +146,6 @@ PackageNamePartValidator::validate(const std::string & s)
Context c("When validating package name part '" + s + "':");
throw PackageNamePartError(s);
}
-
- if ('-' != s[p])
- continue;
- if (++p >= s.length())
- break;
- if ((std::string::npos != number_chars.find(s[p]) &&
- std::string::npos == s.find_first_not_of(number_chars, p)) ||
- (std::string::npos == allowed_chars.find(s[p])))
- {
- Context c("When validating package name part '" + s + "':");
- throw PackageNamePartError(s);
- }
}
}