Bug 693624: Ensure that windows copes with utf8 filenames

When running under Windows, replace fopen with our own fopen_utf8
that converts from utf8 to unicode before calling the unicode
version of fopen.
Avoid interactive features causing bloat in mutool
Fix misalignment of rotated images.

The recent positioning fix for bug 693640 caused a problem with rotated
images. The fix is to only apply the previous fix when we have rectilinear
scalings of images.
Fix warnings seen on cleaning a document.

Seen with the test file from bu 693677. When we read a file in, we
read the trailer, and the encrypt object before we start to decrypt
other objects. These objects do not make it into the xref table though.

When we write a file out, we run through the file reading in objects
prior to writing them out; when we read in the trailer and the encrypt
object we therefore try to decrypt them, giving errors.

To avoid these errors, put the trailer and the encrypt object into the
xref table when they are first read.

This solves all but 1 problem when cleaning this file with "-dif" (as
the signature object contains a digest block of data that is unencrypted).

This solves all but 3 problems when cleaning this file with "-difggg";
the signature object, and one orphan copy of the crypt dictionary that
is reported twice.
Auto-generate appearance streams for strikeout, underline, highlight

This fixes bug #693664, and also simplifies app code.

The example file attached to the bug produces strange results, but that
is because the QuadPoint information is incorrect.
Fix compilation on Mac OS X by partially reverting 61c1f80d36.

Starting with 61c1f80d36bf1d946ce26d39f9afb99897fc9923 mupdf requires
pkg-config to build.  However pkg-config is not supplied with Xcode
and is therefore not routinely installed on Mac OS X.  Even if
pkg-config were available it would not accomplish the goal of that
commit (speed up compilation); on Mac OS X compilation would be
slower.
Add noreturn attribute to throw/rethrow to help improve compiler warnings.
Silence warnings.
Remove unneccessary ./ prefix in generated file makefile recipes.
Fix incorrect scissor boxes for second and subsequent glyphs.
Fix invalid font bboxes

The font bbox is wrong in some fonts, so any calculations we base
on that will be wrong; in particular this affects fz_bound_glyph.
We now spot an illegal bbox, and use a 'large' default.
Add caching of rendered tiles.

This requires a slight change to the device interface.

Callers that use fz_begin_tile will see no change (and no caching
will be done). We add a new fz_begin_tile_id function that takes an
extra 'id' parameter, and returns 0 or 1. If the id is 0 then the
function behaves exactly as fz_being_tile does, and always returns 0.

The PDF and XPS code continues to call the old (uncached) version.
The display list code however generates a unique id for every
BEGIN_TILE node, and passes this in.

If the id is non zero, then it is taken to be a unique identifier
for this tile; the implementer of the fz_begin_tile_id entry point
can choose to use this to implement caching. If it chooses to ignore
the id (and do no caching), it returns 0.

If the device implements caching, then it can check on entry for a
previously rendered tile with the appropriate matrix and a matching id.
If it finds one, then it returns 1. It is the callers responsibility
to then skip over all the device calls that would usually happen to
render the tiles (i.e. to skip forward to the matching 'END_TILE'
operation).
Bug 693719: Android: Catch exceptions when counting pages.

Return 0. Check for this case when opening a PDF and give a nice dialogue.

Fix the nice dialogue code so that it doesn't crash afterwards due to
a null mSearchTask.
Simple debug code to quantify locking times
Bug 693708: Avoid dereferencing null pointer.

Ensure pointer is non NULL before dereferencing.
Add 'void' to a function declaration.
Fix store debugging fns so that all output goes to the same file.
Squash some warnings.

Some -Wshadow ones, plus some 'set but not used' ones.
pdf_device: only output color if it's changed.

I'd half finished this code before, and only spotted the missing
bits while cleaning up some warnings.
Bug 693708: Fix unclosed XML entry in fz_trace output.

Thanks to Brian Nixon for pointing this out.