Added copyright notices.

These have been derived from looking at the old change.log from LMB's
pubseq account and my subversion logs for io_lib.

Kept BSD licence for newer files, given the original io_lib source was
under BSD too.
Fixed errors in copyright due to pasting the MRC one and forgetting to
change the organisation name. Oops!

This time I fixed the text as per GRL's policy.
Fixed a variety of multi-threading data races, detected through
1000 repeated runs of the same command at approximately the 2% failure
level on unsorted data only.

clang -fsanitize=thread has been instrumental in identifying the
causes. It gets my recommendation.
Merge branch 'develop' of https://github.com/samtools/htslib into develop

Conflicts:
	cram/cram_io.c
Samtools. The test harness worked, but the samtools interface needed
an additional cram_set_header function as we don't pass this over when
opening the new cram file.
(Try#2 - previous commit accidentally rolled back an upstream change
from 2 hours before.)
Added prototype for cram_set_header()
Fixed a couple complaints from clang.

1) Assigning hgetc() output to enumerated types doesn't work very well
unless I have the -1 case handled. (Technically this should perhaps be
EOF).

2) I wasn't checked the return value from hclose and hflush in all
situations. The hclose() call was in an error handler that is about to
return failure anyway so doesn't matter, but the hflush one needed
fixing.
Merge CRAM copyright notices and data race fixes from jkbonfield

Merge commit 116ccd228c128f95 of github.com/jkbonfield/htslib:

116ccd2 Fixed a variety of multi-threading data races
d3803f3 Fixed errors in copyright due to pasting the MRC one
b5f5f16 Added copyright notices.
Fixed a bunch of code warnings produced by clang's static analyser.

1) Various memory leaks, all caused by returning after a malloc
failure without freeing precursor allocations.

2) Fixed potential error in cram_codecs.c where an external block ID
could fail to be found, resulting in dereferencing a null pointer.

3) Improved guards around block IDs to prevent negative blocks (not
found by clang).

4) Removal of dead code; assignments that are no longer used.
A couple more clang reported errors, which are duplicates of previous
ones. I assume omitted before due to duplication.
Merge branch 'develop' of https://github.com/samtools/htslib into develop
Robustness improvements following fuzz testing. (See io_lib r3500).

While not rigorous, this is the result of 3000 trials of making 100
random edits to an uncompressed CRAM file and decoding it as SAM.
Merge cram_set_header() from github.com/jkbonfield/htslib

f149e78 Added prototype for cram_set_header()
808b36f [...] samtools interface needed an additional cram_set_header

Modified when merging to use cram_set_header() within sam_hdr_write(),
rather than using hts_open()'s old-API-style third parameter, which will
soon be disappearing.
Merge branch develop of github.com/jkbonfield/htslib

Robustness improvements indicated via clang's static analyser
and fuzz testing.