Added decoding checks for the most obvious of sam parsing failures.

Note that some of these cannot be done in bam_read1 due to it not
having enough information (no header), so they are performed in
sam_read1 instead.

The auxiliary tag checking needs far more work, and is only done in
sam_format1 at present. I'm not sure there is a way to make this check
efficient given that a lot of calls to sam_read1 may not care to
decode auxiliary data. Instead we maybe just need to have a set of
standard auxiliary tag parsing functions and make sure all have
appropriate error handling.
Removed old comment from earlier code.
Merge branch 'develop' of https://github.com/samtools/htslib into develop
Further fixing of auxiliary tag decoding.
Added the ability to do samtools index on a CRAM file.

This is not the same as being able to use the index. This has not been
added yet.
Compile cleanly without warnings with gcc 4.6.3
Fixed return status checks of fread calls
Merge pull request #33 from sm15/develop

bcf_gt_type can now, optionally, give the index of the 2nd alt allele
Merge branch 'develop' into bcftools+calling
vcf: Support for regions in the form chr|chr:pos|chr:from-to|chr:from-
tbx: Sanity check if the file type meets the expectation, detect non-numeric fields
hts_idx: check return status of bgzf_read
bcf reader: Fix in chr:pos type of regions
Add hclose_abruptly() for stack unwinding after errors

This variant of hclose() is for use when an (e.g. I/O) error has already
occurred and you just need to close and deallocate the stream without
caring about any further errors.
synced reader: Support for BED regions/target files
Change hts_close() to return int (error indication)

Also add documentation to hts_close() and reformat hts_open() docs and
note format autodetection when reading.

Fixes #29.  Further changes are likely in the places where hts_close()
is called, to report errors.
synced reader: regions and targets now support VCF; Fix for match_alleles by reverting 0-terminating chr modification
synced reader: Give a hint when tabix was used with wrong column indexes for regions/targets
Fix bgzf_write() for large (> 2GB) blocks

bgzf_write() takes a size_t length, so its internal counters need to be
size_ts or ssize_ts rather than ints if it is to operate on lengths up to
max(ssize_t) as advertised rather than just up to INT_MAX.  Also inline
the salient parts of mt_write() rather than duplicating the loop code.

Fixes samtools/samtools#67 (more than 2GB of headers fails), but note
that the BAM l_text field is a *signed* int32_t, so in fact BAM files
with such large headers are outwith the spec and likely not portable
to other BAM implementations, notably Picard.
pileup: Detect non-recoverable errors and exit with proper status