--- ../../tags/gatt-0.6.1/src/atom.cc 2008-06-09 01:54:18.000000000 +0200 +++ atom.cc 2008-07-28 17:36:21.000000000 +0200 @@ -36,6 +36,7 @@ bool toNextPotenialExactAtom(string::const_iterator& p, const string::const_iterator& end, bool ignoreMissingPrefix); bool sequenceAdvance(const string& sequence, string::const_iterator& p, const string::const_iterator& end); int versionNumberCompare(const string& ls, const string& rs); +int toCannocalValue(int arg); class PVSuffixToken { @@ -190,7 +191,16 @@ } } - return lls.compare(rrs); + + //we want this function to return -1, 0 or 1! + return toCannocalValue(lls.compare(rrs)); +} + +inline int toCannocalValue(int arg) +{ + if(arg != 0) + return (arg < 0 ? -1 : 1); + return 0; } PVSuffixToken::PVSuffixToken(const string& str) @@ -463,7 +473,7 @@ { string opMe(getCategory() + getPN()); string opOther(other.getCategory() + other.getPN()); - return opMe.compare(opOther); + return local::toCannocalValue(opMe.compare(opOther)); } int Atom::comparePV(const ExactAtom& other) const @@ -478,7 +488,7 @@ string ov(other._pv); if(ov.size() > mv.size()) ov.erase(mv.size()); - return mv.compare(ov); + return local::toCannocalValue(mv.compare(ov)); } if(_pv.empty() || other._pv.empty()) @@ -518,7 +528,7 @@ { hlp = mTok[i].compare(oTok[i]); if(hlp != 0) - return hlp; + return local::toCannocalValue(hlp); ++i; } else if(isPVOptionalLetterComponentIndex(i)) @@ -570,7 +580,7 @@ local::PVSuffixToken tokO(oTok[i]); int hlp = tokL.compare(tokO); if(hlp != 0) - return hlp; + return local::toCannocalValue(hlp); } return trailingPVPartIncoperate(other); } @@ -882,7 +892,7 @@ bool ExactAtom::operator<(const ExactAtom& other) const { - return compare(other) == -1; + return compare(other) < 0; } int ExactAtom::compare(const ExactAtom& other) const