hwhw/kindlepdfviewer — pull request #397 by tigran123 (2012-10-08 18:50:57+00:00)
Title: Validate DjVu magic string before opening.

While browsing libdjvu sources I remembered that I always validated DjVu magic string before passing the file to djvulibre. This is because forcing djvulibre errors on open is a bad idea --- it can lead to very strange side effects, such as refusing to open the next (valid!) DjVu file.

So, I have now implemented the same in KPV --- check DjVu magic string before passing it to the proper DjVu :openDocument() method.
I timed the difference between opening with and without validation and it was absolutely negligible (i.e. by far most of the time is spent in DjVu document decoding anyway).