fix prefix stripping in maxYearSpan

This commit is contained in:
Jean-Francois Dockes 2012-10-16 13:36:54 +02:00
parent d260bdbf7a
commit 303da79621

View file

@ -1478,15 +1478,18 @@ bool Db::filenameWildExp(const string& fnexp, vector<string>& names, int max)
// Walk the Y terms and return min/max // Walk the Y terms and return min/max
bool Db::maxYearSpan(int *minyear, int *maxyear) bool Db::maxYearSpan(int *minyear, int *maxyear)
{ {
LOGDEB(("Rcl::Db:maxYearSpan\n"));
*minyear = 1000000; *minyear = 1000000;
*maxyear = -1000000; *maxyear = -1000000;
TermMatchResult result; TermMatchResult result;
if (!termMatch(ET_WILD, string(), "*", result, -1, "xapyear")) if (!termMatch(ET_WILD, string(), "*", result, -1, "xapyear")) {
LOGINFO(("Rcl::Db:maxYearSpan: termMatch failed\n"));
return false; return false;
}
for (vector<TermMatchEntry>::const_iterator it = result.entries.begin(); for (vector<TermMatchEntry>::const_iterator it = result.entries.begin();
it != result.entries.end(); it++) { it != result.entries.end(); it++) {
if (!it->term.empty()) { if (!it->term.empty()) {
int year = atoi(it->term.c_str()+1); int year = atoi(strip_prefix(it->term).c_str());
if (year < *minyear) if (year < *minyear)
*minyear = year; *minyear = year;
if (year > *maxyear) if (year > *maxyear)