Print a better error message.

Use format_message to print the proper error message in JPEG decoder.

R=mtklein@google.com

Review URL: https://codereview.chromium.org/24461002

git-svn-id: http://skia.googlecode.com/svn/trunk/src@11459 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/images/SkImageDecoder_libjpeg.cpp b/images/SkImageDecoder_libjpeg.cpp
index d50e4eb..107441b 100644
--- a/images/SkImageDecoder_libjpeg.cpp
+++ b/images/SkImageDecoder_libjpeg.cpp
@@ -285,11 +285,12 @@
 // This guy exists just to aid in debugging, as it allows debuggers to just
 // set a break-point in one place to see all error exists.
 static bool return_false(const jpeg_decompress_struct& cinfo,
-                         const SkBitmap& bm, const char msg[]) {
+                         const SkBitmap& bm, const char caller[]) {
 #ifdef SK_DEBUG
+    char buffer[JMSG_LENGTH_MAX];
+    cinfo.err->format_message((const j_common_ptr)&cinfo, buffer);
     SkDebugf("libjpeg error %d <%s> from %s [%d %d]\n", cinfo.err->msg_code,
-             cinfo.err->jpeg_message_table[cinfo.err->msg_code], msg,
-             bm.width(), bm.height());
+             buffer, caller, bm.width(), bm.height());
 #endif
     return false;   // must always return false
 }