Mercurial > hg > match-vamp
changeset 215:0df914e353e1
Fix some erroneous uses of -1 where INVALID_PATHCOST was intended
author | Chris Cannam |
---|---|
date | Thu, 05 Mar 2015 10:59:32 +0000 |
parents | 97cc0b9135e7 |
children | ccdadbdd80df |
files | src/Finder.cpp |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Finder.cpp Thu Mar 05 09:47:15 2015 +0000 +++ b/src/Finder.cpp Thu Mar 05 10:59:32 2015 +0000 @@ -149,7 +149,7 @@ int bestRow = row; int bestCol = col; - normpathcost_t bestCost = -1; + normpathcost_t bestCost = INVALID_PATHCOST; // cerr << "Finder " << this << "::getExpandDirection: "; @@ -190,7 +190,7 @@ m_m->getDiagonalWeight()); if (r > r1) { // not first row - pathcost_t min = -1; + pathcost_t min = INVALID_PATHCOST; if ((c > prevRowStart) && (c <= prevRowStop)) { // diagonal from (r-1,c-1) min = m_m->getPathCost(r-1, c-1) + diagIncrement; @@ -199,7 +199,7 @@ if ((c >= prevRowStart) && (c < prevRowStop)) { // vertical from (r-1,c) pathcost_t cost = m_m->getPathCost(r-1, c) + straightIncrement; - if ((min < 0) || (cost < min)) { + if ((min == INVALID_PATHCOST) || (cost < min)) { min = cost; dir = AdvanceThis; } @@ -207,7 +207,7 @@ if (c > rowStart) { // horizontal from (r,c-1) pathcost_t cost = m_m->getPathCost(r, c-1) + straightIncrement; - if ((min < 0) || (cost < min)) { + if ((min == INVALID_PATHCOST) || (cost < min)) { min = cost; dir = AdvanceOther; } @@ -261,7 +261,7 @@ err.distance = distance; if (r > r1) { // not first row - pathcost_t min = -1; + pathcost_t min = INVALID_PATHCOST; if ((c > prevRowStart) && (c <= prevRowStop)) { // diagonal from (r-1,c-1) min = m_m->getPathCost(r-1, c-1) + diagIncrement; @@ -271,7 +271,7 @@ if ((c >= prevRowStart) && (c < prevRowStop)) { // vertical from (r-1,c) pathcost_t cost = m_m->getPathCost(r-1, c) + straightIncrement; - if ((min < 0) || (cost < min)) { + if ((min == INVALID_PATHCOST) || (cost < min)) { min = cost; err.prevCost = m_m->getPathCost(r-1, c); dir = AdvanceThis; @@ -280,7 +280,7 @@ if (c > rowStart) { // horizontal from (r,c-1) pathcost_t cost = m_m->getPathCost(r, c-1) + straightIncrement; - if ((min < 0) || (cost < min)) { + if ((min == INVALID_PATHCOST) || (cost < min)) { min = cost; err.prevCost = m_m->getPathCost(r, c-1); dir = AdvanceOther;