Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 216483
Collapse All | Expand All

(-)src/portage/mask.cc (-5 / +24 lines)
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:
(-)src/portage/basicversion.cc (+6 lines)
Lines 48-53 Link Here
48
			rtrim(&l1, "0");
48
			rtrim(&l1, "0");
49
			rtrim(&l2, "0");
49
			rtrim(&l2, "0");
50
50
51
			/* No need to check if stripping zeros makes the component empty,
52
			 * since that only happens for components that _only_ contain zeros
53
			 * and comparing to "0" or "" will yield the same result - every
54
			 * other possible value is bigger.
55
			 */
56
51
			return l1.compare(l2);
57
			return l1.compare(l2);
52
		}
58
		}
53
		// "If neither component has a leading zero, components are compared
59
		// "If neither component has a leading zero, components are compared

Return to bug 216483