handle malloc(0) and calloc(0) uniformly on all platforms

also change lossless encoder logic, which was relying on explicit
NULL return from WebPSafeMalloc(0)

renamed function to CheckSizeArgumentsOverflow() explicitly

addresses issue #138

Change-Id: Ibbd51cc0281e60e86dfd4c5496274399e4c0f7f3
This commit is contained in:
skal
2013-01-22 10:34:35 +01:00
parent 8189feda50
commit 42f8f9346c
3 changed files with 16 additions and 7 deletions

View File

@ -188,6 +188,10 @@ static int GenerateOptimalTree(const int* const histogram, int histogram_size,
}
}
if (tree_size_orig == 0) { // pretty optimal already!
return 1;
}
// 3 * tree_size is enough to cover all the nodes representing a
// population and all the inserted nodes combining two existing nodes.
// The tree pool needs 2 * (tree_size_orig - 1) entities, and the