|
Lines 177-187
Link Here
|
| 177 |
{ |
177 |
{ |
| 178 |
// '=*' operator has to remove leading zeros |
178 |
// '=*' operator has to remove leading zeros |
| 179 |
// see match_from_list in portage_dep.py |
179 |
// see match_from_list in portage_dep.py |
| 180 |
const std::string& s1(getFull()); |
180 |
const std::string& my_string(getFull()); |
| 181 |
const std::string& s2(ev->getFull()); |
181 |
const std::string& version_string(ev->getFull()); |
| 182 |
const std::string::size_type start = s1.find_first_not_of('0'); |
182 |
|
| 183 |
const std::string::size_type total = s1.size() - start; |
183 |
std::string::size_type my_start = my_string.find_first_not_of('0'); |
| 184 |
return s2.compare(s2.find_first_not_of('0'), total, s1, start, total) == 0; |
184 |
std::string::size_type version_start = version_string.find_first_not_of('0'); |
|
|
185 |
|
| 186 |
/* Otherwise, if a component has a leading zero, any trailing |
| 187 |
* zeroes in that component are stripped (if this makes the |
| 188 |
* component empty, proceed as if it were 0 instead), and the |
| 189 |
* components are compared using a stringwise comparison. |
| 190 |
*/ |
| 191 |
|
| 192 |
if (my_start == std::string::npos) |
| 193 |
my_start = my_string.size() - 1; |
| 194 |
else if(! isdigit(my_string[my_start])) |
| 195 |
my_start -= 1; |
| 196 |
|
| 197 |
if (version_start == std::string::npos) |
| 198 |
version_start = version_string.size() - 1; |
| 199 |
else if(! isdigit(version_string[version_start])) |
| 200 |
version_start -= 1; |
| 201 |
|
| 202 |
const std::string::size_type total = my_string.size() - my_start; |
| 203 |
return version_string.compare(version_start, total, my_string, my_start, total) == 0; |
| 185 |
} |
204 |
} |
| 186 |
|
205 |
|
| 187 |
case maskOpLess: |
206 |
case maskOpLess: |