Cope with empty containers internal to a CRAM stream.
Technically empty containers shouldn't exist as the specification
states they must contain at least one block. However this is a useful
precursor to the EOF block checking.
Added implementation of cram_external_encode(). It's not yet used
except in experimental versions, but opens up the route to storing
more CORE data in external blocks to make partial decoding simpler (eg
CRAM->FASTA).
Bug fix to the zlib strategy tuning in multi-threaded mode. It could
(legitimately) drive the number of trials negative, but this meant it
never left the trial phase and consequentially encoding speed more or
less halved the instant we asked for more than one encoding thread.
Added refs_t->last_id (note distinct from ->last) for use when reading
from MD5 server. This reduces excessive reloading of the file in
certain cases.

Ideally the reference code should be completely rewritten to use a LRU
cache of reference sequence blocks, seamlessly integrating fasta,
local md5 and remote md5 streams through the same API. That can wait
for another release though.
Add mfsteal to mFILE, and use it in cram_populate_ref.

mfsteal returns the data stored in an mFILE.  The mFILE itself is
closed after the data has been detached.  This can be used to replace an
unnecessary allocation and copy if the entire contents of the mFILE are
wanted.

Update cram_populate_ref to use mfsteal.  This halves the memory it uses
when trying to load via REF_PATH.

(Code change by Rob Davies.)
Added missing return code checks.  Fixed 'x' mode of mfreopen.

Added missing checks for system call return codes.  Mainly malloc/realloc
but also i/o calls in mfflush.

Removed pointless check to see if the underlying file is seekable in
mfreopen when 'x' is present in the mode string.  The whole point of 'x'
was to turn off a seek in mfflush, so it doesn't matter if the file is
seekable or not.

(Code change added to io_lib by Rob Davies.)