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

(-)../../tags/gatt-0.6.1/src/atom.cc (-6 / +16 lines)
Lines 36-41 Link Here
36
bool toNextPotenialExactAtom(string::const_iterator& p, const string::const_iterator& end, bool ignoreMissingPrefix);
36
bool toNextPotenialExactAtom(string::const_iterator& p, const string::const_iterator& end, bool ignoreMissingPrefix);
37
bool sequenceAdvance(const string& sequence, string::const_iterator& p, const string::const_iterator& end);
37
bool sequenceAdvance(const string& sequence, string::const_iterator& p, const string::const_iterator& end);
38
int versionNumberCompare(const string& ls, const string& rs);
38
int versionNumberCompare(const string& ls, const string& rs);
39
int toCannocalValue(int arg);
39
40
40
class PVSuffixToken
41
class PVSuffixToken
41
{
42
{
Lines 190-196 Link Here
190
        }
191
        }
191
192
192
    }
193
    }
193
    return lls.compare(rrs);
194
    
195
    //we want this function to return -1, 0 or 1!
196
    return toCannocalValue(lls.compare(rrs));
197
}
198
199
inline int toCannocalValue(int arg)
200
{
201
    if(arg != 0)
202
        return (arg < 0 ? -1 : 1);
203
    return 0;
194
}
204
}
195
205
196
PVSuffixToken::PVSuffixToken(const string& str)
206
PVSuffixToken::PVSuffixToken(const string& str)
Lines 463-469 Link Here
463
{
473
{
464
    string opMe(getCategory() + getPN());
474
    string opMe(getCategory() + getPN());
465
    string opOther(other.getCategory() + other.getPN());
475
    string opOther(other.getCategory() + other.getPN());
466
    return opMe.compare(opOther);
476
    return local::toCannocalValue(opMe.compare(opOther));
467
}
477
}
468
478
469
int Atom::comparePV(const ExactAtom& other) const
479
int Atom::comparePV(const ExactAtom& other) const
Lines 478-484 Link Here
478
        string ov(other._pv);
488
        string ov(other._pv);
479
        if(ov.size() > mv.size())
489
        if(ov.size() > mv.size())
480
            ov.erase(mv.size());
490
            ov.erase(mv.size());
481
        return mv.compare(ov);
491
        return local::toCannocalValue(mv.compare(ov));
482
    }
492
    }
483
493
484
    if(_pv.empty() || other._pv.empty())
494
    if(_pv.empty() || other._pv.empty())
Lines 518-524 Link Here
518
    {
528
    {
519
        hlp = mTok[i].compare(oTok[i]);
529
        hlp = mTok[i].compare(oTok[i]);
520
        if(hlp != 0)
530
        if(hlp != 0)
521
            return hlp;
531
            return local::toCannocalValue(hlp);
522
        ++i;
532
        ++i;
523
    }
533
    }
524
    else if(isPVOptionalLetterComponentIndex(i))
534
    else if(isPVOptionalLetterComponentIndex(i))
Lines 570-576 Link Here
570
        local::PVSuffixToken tokO(oTok[i]);
580
        local::PVSuffixToken tokO(oTok[i]);
571
        int hlp = tokL.compare(tokO);
581
        int hlp = tokL.compare(tokO);
572
        if(hlp != 0)
582
        if(hlp != 0)
573
            return hlp;
583
            return local::toCannocalValue(hlp);
574
    }
584
    }
575
    return trailingPVPartIncoperate(other);
585
    return trailingPVPartIncoperate(other);
576
}
586
}
Lines 882-888 Link Here
882
892
883
bool ExactAtom::operator<(const ExactAtom& other) const
893
bool ExactAtom::operator<(const ExactAtom& other) const
884
{
894
{
885
    return compare(other) == -1;
895
    return compare(other) < 0;
886
}
896
}
887
897
888
int ExactAtom::compare(const ExactAtom& other) const
898
int ExactAtom::compare(const ExactAtom& other) const

Return to bug 231233