| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "SkJpegUtility.h" | 9 #include "SkJpegUtility.h" |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #endif | 62 #endif |
| 63 src->next_input_byte = (const JOCTET*)src->fBuffer; | 63 src->next_input_byte = (const JOCTET*)src->fBuffer; |
| 64 src->bytes_in_buffer = bytes; | 64 src->bytes_in_buffer = bytes; |
| 65 return TRUE; | 65 return TRUE; |
| 66 } | 66 } |
| 67 | 67 |
| 68 static void sk_skip_input_data(j_decompress_ptr cinfo, long num_bytes) { | 68 static void sk_skip_input_data(j_decompress_ptr cinfo, long num_bytes) { |
| 69 skjpeg_source_mgr* src = (skjpeg_source_mgr*)cinfo->src; | 69 skjpeg_source_mgr* src = (skjpeg_source_mgr*)cinfo->src; |
| 70 | 70 |
| 71 if (num_bytes > (long)src->bytes_in_buffer) { | 71 if (num_bytes > (long)src->bytes_in_buffer) { |
| 72 long bytesToSkip = num_bytes - src->bytes_in_buffer; | 72 size_t bytesToSkip = num_bytes - src->bytes_in_buffer; |
| 73 while (bytesToSkip > 0) { | 73 while (bytesToSkip > 0) { |
| 74 long bytes = (long)src->fStream->skip(bytesToSkip); | 74 size_t bytes = src->fStream->skip(bytesToSkip); |
| 75 if (bytes <= 0 || bytes > bytesToSkip) { | 75 if (bytes <= 0 || bytes > bytesToSkip) { |
| 76 // SkDebugf("xxxxxxxxxxxxxx failure to skip request %d returned %d\
n", bytesToSkip, bytes); | 76 // SkDebugf("xxxxxxxxxxxxxx failure to skip request %d returned %d\
n", bytesToSkip, bytes); |
| 77 cinfo->err->error_exit((j_common_ptr)cinfo); | 77 cinfo->err->error_exit((j_common_ptr)cinfo); |
| 78 return; | 78 return; |
| 79 } | 79 } |
| 80 #ifdef SK_BUILD_FOR_ANDROID | 80 #ifdef SK_BUILD_FOR_ANDROID |
| 81 src->current_offset += bytes; | 81 src->current_offset += bytes; |
| 82 #endif | 82 #endif |
| 83 bytesToSkip -= bytes; | 83 bytesToSkip -= bytes; |
| 84 } | 84 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void skjpeg_error_exit(j_common_ptr cinfo) { | 161 void skjpeg_error_exit(j_common_ptr cinfo) { |
| 162 skjpeg_error_mgr* error = (skjpeg_error_mgr*)cinfo->err; | 162 skjpeg_error_mgr* error = (skjpeg_error_mgr*)cinfo->err; |
| 163 | 163 |
| 164 (*error->output_message) (cinfo); | 164 (*error->output_message) (cinfo); |
| 165 | 165 |
| 166 /* Let the memory manager delete any temp files before we die */ | 166 /* Let the memory manager delete any temp files before we die */ |
| 167 jpeg_destroy(cinfo); | 167 jpeg_destroy(cinfo); |
| 168 | 168 |
| 169 longjmp(error->fJmpBuf, -1); | 169 longjmp(error->fJmpBuf, -1); |
| 170 } | 170 } |
| OLD | NEW |