2d9c5fa8ce0182cd8c14736241b709fd50cab6f8 |
|
23-Nov-2010 |
Elliott Hughes <enh@google.com> |
Slight cleanup of java.util.zip code, plus a bug fix. The key fix is switching to zstream's next_in and next_out fields (the pointers into the input and output buffers) rather than relying on the integer "accounting" fields. If turns out in the Z_NEED_DICT case that the accounting goes slightly awry. (We shouldn't have been using the accounting anyway, because we were silently coercing longs to ints.) The new code is simpler, clearer, and doesn't need a special case for Z_NEED_DICT at all. I've also removed yet another hand-written UTF-8 encoder, made Inflater throw ArrayIndexOutOfBoundsExceptions with useful detail messages (factored out into Arrays so we can make this change more widely), and rewritten the Inflater and Deflater documentation. The unit test reproduces the problem (and tests as many other cases as it can too). Critical for testing this bug is that we needed to limit the size of the input buffer so that zlib has to ask us for more input. Bug: 3220923 Change-Id: I39e5456620eaa7f75d12d885db279f009ee3e8ef
|