Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 165970 Details for
Bug 238216
app-portage/eix-0.13.3 - update-eix fails with terminate called after throwing an instance of 'std::out_of_range'
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix from upstream svn (for >=eix-0.12.4)
numeric_compare.patch (text/plain), 2.94 KB, created by
Emil Beinroth
on 2008-09-21 01:43:33 UTC
(
hide
)
Description:
Fix from upstream svn (for >=eix-0.12.4)
Filename:
MIME Type:
Creator:
Emil Beinroth
Created:
2008-09-21 01:43:33 UTC
Size:
2.94 KB
patch
obsolete
>Index: trunk/src/eixTk/compare.h >=================================================================== >--- trunk/src/eixTk/compare.h (revision 590) >+++ trunk/src/eixTk/compare.h (revision 730) >@@ -1,3 +1,3 @@ >-// vim:set et cinoptions=g0,t0,^-2,(0 sw=4 ts=4: >+// vim:set noet cinoptions=g0,t0,(0 sw=4 ts=4: > // This file is part of the eix project and distributed under the > // terms of the GNU General Public License v2. >@@ -5,4 +5,5 @@ > // Copyright (c) > // Emil Beinroth <emilbeinroth@gmx.net> >+// Martin VÃâ¬th <vaeth@mathematik.uni-wuerzburg.de> > > #ifndef __GUARD__COMPARE_H__ >@@ -14,34 +15,40 @@ > namespace eix > { >- /// compare two objects. >- /// @return 0 if equal, 1 if left > right or -1 if left < right. >- template<typename T> >- int default_compare(const T& left, const T& right) >- { >- if (left == right) >- return 0; >- else if(left < right) >- return -1; >- else >- return 1; >- } >+ /// compare two objects. >+ /// @return 0 if equal, 1 if left > right or -1 if left < right. >+ template<typename T> >+ int default_compare(const T& left, const T& right) >+ { >+ if (left == right) >+ return 0; >+ if(left < right) >+ return -1; >+ return 1; >+ } > >- /// numeric comparison. >- /// @note empty strings count a "0" >- static inline int >- numeric_compare(const std::string& left, const std::string& right) >- { >- // strip leading 0's >- const std::string::size_type lstart = left.find_first_not_of('0'); >- const std::string::size_type rstart = right.find_first_not_of('0'); >+ /// numeric comparison. >+ /// @note empty strings count a "0" >+ static inline int >+ numeric_compare(const std::string& left, const std::string& right) >+ { >+ // strip leading 0's >+ std::string::size_type lstart = left.find_first_not_of('0'); >+ std::string::size_type rstart = right.find_first_not_of('0'); >+ // Special cases: number is 0 or string is empty >+ if (lstart == std::string::npos) { >+ if(rstart == std::string::npos) >+ return 0; >+ return -1; >+ } >+ if (rstart == std::string::npos) >+ return 1; > >- // check if one is longer, that one would be bigger >- const int size_result = default_compare(left.size() - (lstart == std::string::npos ? 0 : lstart), >- right.size() - (rstart == std::string::npos ? 0 : rstart)); >- if (size_result) >- return size_result; >- // both strings have the same length, do string comparison >- return left.compare(lstart, std::string::npos, right, rstart, std::string::npos); >- } >+ // check if one is longer, that one would be bigger >+ int size_result = default_compare(left.size() - lstart, right.size() - rstart); >+ if (size_result) >+ return size_result; >+ // both strings have the same length, do string comparison >+ return left.compare(lstart, std::string::npos, right, rstart, std::string::npos); >+ } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 238216
:
165928
|
165929
|
165930
|
165938
| 165970