fix suboptimal MAX_LEN cut-off limit

MAX_LEN -> max_len
This was sub-optimal at the end of the picture, when there's
less than MAX_LEN bytes left to match.

Change-Id: I5ebe1fca4e7c112dcd34748a082d1c97f95eb099
This commit is contained in:
Pascal Massimino 2012-01-10 07:41:11 -08:00
parent 57cab7b891
commit 716d1d7f87

View File

@ -53,7 +53,7 @@ typedef struct {
static size_t GetLongestMatch(const uint8_t* const data, static size_t GetLongestMatch(const uint8_t* const data,
const uint8_t* const ref, size_t max_len) { const uint8_t* const ref, size_t max_len) {
size_t n; size_t n;
for (n = 0; n < max_len && (data[n] == ref[n]); ++n) { /* do nothing */ } for (n = 0; (n < max_len) && (data[n] == ref[n]); ++n) { /* do nothing */ }
return n; return n;
} }
@ -127,7 +127,7 @@ static int EncodeZlibTCoder(const uint8_t* data, int width, int height,
best.dist = dist; best.dist = dist;
} }
} }
if (len >= MAX_LEN) { if (len >= max_len) {
break; // No need to search further. We already got a max-long match break; // No need to search further. We already got a max-long match
} }
} }