OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * Portions are Copyright (C) 2001-6 mozilla.org | 4 * Portions are Copyright (C) 2001-6 mozilla.org |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Stuart Parmenter <stuart@mozilla.com> | 7 * Stuart Parmenter <stuart@mozilla.com> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // A tiff file starts with 'I', 'I' (intel / little endian byte order) or | 143 // A tiff file starts with 'I', 'I' (intel / little endian byte order) or |
144 // 'M', 'M' (motorola / big endian byte order), followed by (uint16_t)42, | 144 // 'M', 'M' (motorola / big endian byte order), followed by (uint16_t)42, |
145 // followed by an uint32_t with the offset to the tag block, relative to the | 145 // followed by an uint32_t with the offset to the tag block, relative to the |
146 // tiff file start. | 146 // tiff file start. |
147 const unsigned exifHeaderSize = 14; | 147 const unsigned exifHeaderSize = 14; |
148 if (!(marker->marker == exifMarker && marker->data_length >= exifHeaderSize && | 148 if (!(marker->marker == exifMarker && marker->data_length >= exifHeaderSize && |
149 marker->data[0] == 'E' && marker->data[1] == 'x' && | 149 marker->data[0] == 'E' && marker->data[1] == 'x' && |
150 marker->data[2] == 'i' && marker->data[3] == 'f' && | 150 marker->data[2] == 'i' && marker->data[3] == 'f' && |
151 marker->data[4] == '\0' | 151 marker->data[4] == '\0' |
152 // data[5] is a fill byte | 152 // data[5] is a fill byte |
153 && ((marker->data[6] == 'I' && marker->data[7] == 'I') || | 153 && |
154 (marker->data[6] == 'M' && marker->data[7] == 'M')))) | 154 ((marker->data[6] == 'I' && marker->data[7] == 'I') || |
| 155 (marker->data[6] == 'M' && marker->data[7] == 'M')))) |
155 return false; | 156 return false; |
156 | 157 |
157 isBigEndian = marker->data[6] == 'M'; | 158 isBigEndian = marker->data[6] == 'M'; |
158 if (readUint16(marker->data + 8, isBigEndian) != 42) | 159 if (readUint16(marker->data + 8, isBigEndian) != 42) |
159 return false; | 160 return false; |
160 | 161 |
161 ifdOffset = readUint32(marker->data + 10, isBigEndian); | 162 ifdOffset = readUint32(marker->data + 10, isBigEndian); |
162 return true; | 163 return true; |
163 } | 164 } |
164 | 165 |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 // has failed. | 1006 // has failed. |
1006 if (!m_reader->decode(onlySize) && isAllDataReceived()) | 1007 if (!m_reader->decode(onlySize) && isAllDataReceived()) |
1007 setFailed(); | 1008 setFailed(); |
1008 | 1009 |
1009 // If decoding is done or failed, we don't need the JPEGImageReader anymore. | 1010 // If decoding is done or failed, we don't need the JPEGImageReader anymore. |
1010 if (isComplete(this, onlySize) || failed()) | 1011 if (isComplete(this, onlySize) || failed()) |
1011 m_reader.reset(); | 1012 m_reader.reset(); |
1012 } | 1013 } |
1013 | 1014 |
1014 } // namespace blink | 1015 } // namespace blink |
OLD | NEW |