mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
remove cases of equal comparison for qsort()
Returning 0 (equal) can lead to undefined behaviour. And, in our cases we'll never have equal keys (added asserts for that) Change-Id: Ifaf202df321d3f877ad2a03de42e0d6cdd1b2388
This commit is contained in:
@ -138,13 +138,8 @@ static int CompareHuffmanTrees(const void* ptr1, const void* ptr2) {
|
||||
} else if (t1->total_count_ < t2->total_count_) {
|
||||
return 1;
|
||||
} else {
|
||||
if (t1->value_ < t2->value_) {
|
||||
return -1;
|
||||
}
|
||||
if (t1->value_ > t2->value_) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
assert(t1->value_ != t2->value_);
|
||||
return (t1->value_ < t2->value_) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user