OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 #include "SkCodec.h" | 8 #include "SkCodec.h" |
9 #include "SkMSAN.h" | 9 #include "SkMSAN.h" |
10 #include "SkJpegCodec.h" | 10 #include "SkJpegCodec.h" |
11 #include "SkJpegDecoderMgr.h" | 11 #include "SkJpegDecoderMgr.h" |
12 #include "SkCodecPriv.h" | 12 #include "SkCodecPriv.h" |
13 #include "SkColorPriv.h" | 13 #include "SkColorPriv.h" |
14 #include "SkStream.h" | 14 #include "SkStream.h" |
15 #include "SkTemplates.h" | 15 #include "SkTemplates.h" |
16 #include "SkTypes.h" | 16 #include "SkTypes.h" |
17 | 17 |
18 // stdio is needed for libjpeg-turbo | 18 // stdio is needed for libjpeg-turbo |
19 #include <stdio.h> | 19 #include <stdio.h> |
20 #include "SkJpegUtility.h" | 20 #include "SkJpegUtility.h" |
21 | 21 |
| 22 // This warning triggers false postives way too often in here. |
| 23 #if defined(__GNUC__) && !defined(__clang__) |
| 24 #pragma GCC diagnostic ignored "-Wclobbered" |
| 25 #endif |
| 26 |
22 extern "C" { | 27 extern "C" { |
23 #include "jerror.h" | 28 #include "jerror.h" |
24 #include "jpeglib.h" | 29 #include "jpeglib.h" |
25 } | 30 } |
26 | 31 |
27 bool SkJpegCodec::IsJpeg(const void* buffer, size_t bytesRead) { | 32 bool SkJpegCodec::IsJpeg(const void* buffer, size_t bytesRead) { |
28 static const uint8_t jpegSig[] = { 0xFF, 0xD8, 0xFF }; | 33 static const uint8_t jpegSig[] = { 0xFF, 0xD8, 0xFF }; |
29 return bytesRead >= 3 && !memcmp(buffer, jpegSig, sizeof(jpegSig)); | 34 return bytesRead >= 3 && !memcmp(buffer, jpegSig, sizeof(jpegSig)); |
30 } | 35 } |
31 | 36 |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 | 904 |
900 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 905 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
901 if (linesRead < remainingRows) { | 906 if (linesRead < remainingRows) { |
902 // FIXME: Handle incomplete YUV decodes without signalling an error. | 907 // FIXME: Handle incomplete YUV decodes without signalling an error. |
903 return kInvalidInput; | 908 return kInvalidInput; |
904 } | 909 } |
905 } | 910 } |
906 | 911 |
907 return kSuccess; | 912 return kSuccess; |
908 } | 913 } |
OLD | NEW |