Use npos instead of -1. Remove second comment.

This commit is contained in:
Martin van Zijl 2020-04-01 22:15:11 +13:00
parent 2ffeac34fa
commit 4e3671fd46

View file

@ -606,8 +606,7 @@ std::string TFilePath::getLevelName() const {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// es. TFilePath("/pippo/pluto.0001.tif").getLevelName() == "pluto..tif" // es. TFilePath("/pippo/pluto.0001.gif").getLevelName() == "pluto..gif"
// es. TFilePath("/pippo/0001.tif").getLevelName() == "0001.tif"
std::wstring TFilePath::getLevelNameW() const { std::wstring TFilePath::getLevelNameW() const {
int i = getLastSlash(m_path); // cerco l'ultimo slash int i = getLastSlash(m_path); // cerco l'ultimo slash
@ -623,7 +622,8 @@ std::wstring TFilePath::getLevelNameW() const {
if (j == i || j - i == 1) // prova.tif o prova..tif if (j == i || j - i == 1) // prova.tif o prova..tif
return str; return str;
if (!checkForSeqNum(type) || !isNumbers(str, i, j) || i == -1) return str; if (!checkForSeqNum(type) || !isNumbers(str, i, j) ||
i == (int)std::wstring::npos) return str;
// prova.0001.tif // prova.0001.tif
return str.erase(i + 1, j - i - 1); return str.erase(i + 1, j - i - 1);
} }