Fix typo in hash table code.

When detecting a clash when inserting into a hash table (which
should only ever happen in multithreaded cases), we should give
a warning, and return the existing item from the table.

The current code doesn't do this due to a stupid typo. Fixed here.

CLUSTER_UNTESTED as we don't test multithreaded operation in the
cluster.
Move base_object from fitz to pdf in the VS solution too.

Forgot to move this earlier.
On MacOS/iOS use _setjmp/_longjmp rather than setjmp/longjmp.

On Apple OSs setjmp/longjmp also mess with the signal handlers;
we don't use signals, so we don't need the slowdown this causes.

CLUSTER_UNTESTED as not tested on cluster.
Fix typo that causes an undefined pointer to be freed.

When a font is destroyed the t3 resources are freed; due to a typo
a random pointer was being freed.
Fix trailing whitespace and mixed tabs/spaces in indentation.
Remove mask entry from fz_pixmap as never used any more.

Also, the attempts to keep it up to date were causing race
conditions in multithreading cases.
Setjmp/longjmp exception tweaks.

First, fix a couple of the 'alternative formulations' of the
try/catch code in the comments.

Secondly, work around a Mac OS X compiler bug.
Fix incorrect handling of race condition.

When inserting an item into the store we check for an identically
keyed item being there already (for instance a pixmap created from
an image I at factor F may find that such a pixmap has already been
inserted). The correct thing to do is to return the old one so we
can use that in preference.

The code was attempting to do this, but was returning a pointer
to the fz_item rather than to the item->val. Fixed here.
Add some more docs to fitz.h

Add docs for fz_store, fz_image, fz_halftones.

Move fz_item definition into res_store.c as it does not need to be
external.

Rename fz_store_context to fz_keep_store_context to be consistent.
Fix race condition in fz_render_ft_glyph

We were dropping the FREETYPE lock before completing the copy out
of the glyph.
Guess encryption revision from the version if missing.
Warn instead of throw when permissions are missing in encrypted PDF.
Remove stray newlines in error messages.
Tweak compression bomb detection.
Fix ref counting bugs in race condition correction code.

When we attempt to insert a key/value pair into the store, we have
to allow for the possibility that a racing thread may have already
inserted an equivalent key/value. We have special code in place to
handle this eventuality; if we spot an existing entry, we take the
existing one in preference to our new key/value pair.

This means that fz_store_item needs to take a new reference to any
existing thing it finds before returning it.

Currently the only store user that is exposed to this possibility
is pdf_image; it spots an existing tile being returned, and was
inadvertently double freeing the key.
Fix memory corruption

I'd foolishly removed a check in the previous commit that was needed.
refs can be < 0 for static resources.
Split fitz.h/mupdf.h into internal/external headers.

Attempt to separate public API from internal functions.
Splitting tweaks.
Move to OpenJPEG 1.5.0

Just makefile/solution changes.
Tweak Halftone functions

A NULL halftone pointer passed to fz_halftone_pixmap is now taken
to mean "use the default halftone".

This means we can remove most of the halftone functions from the
public API until (post 1.0) we decide to flesh out the functionality.