add notion of free_bytes() to Buffer
adapt T_Buffer testcase for free_bytes()
add Clone() to upload::CharBuffer
TEST: test upload::CharBuffer::Clone()
CharBuffer handling for deflate results is now handled in Chunk
allow upload of empty CharBuffer
Merge pull request #334 from reneme/fix_memory_leak

FIX: Coverity Defect / Memory Leak in Compression

This is a fix for a Coverity complaint and actually needed some refactoring.
Turns out, that zlib sometimes claims to need additional memory for compressed data output and needs to rerun deflate(). I assumed, that such a claim would always actually produce more data but apparently it doesn't!

It would have bloated the core processing code to keep track of which allocated buffers were actually used and which needed cleanup. Additionally it would have occasionally allocated useless buffers only to delete them again. Thus I moved this buffer handling into the Chunk, which now keeps a single buffer until it is completely filled with compression data. In case there is more data to be compressed, a new buffer is allocated and the old one is finalized and sent to the asynchronous upload module.

Interestingly Coverity even sometimes points to design flaws, which is nice. :o)

Moreover this contains some additions to the Buffer class, to simplify the above-described implementation and test code for the added Buffer functionality.