Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: src/pdf/SkJpegInfo.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkJpegInfo.h ('k') | src/pdf/SkPDFBitmap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkData.h" 8 #include "SkData.h"
9 #include "SkJpegInfo.h" 9 #include "SkJpegInfo.h"
10 10
11 namespace { 11 namespace {
12 class JpegSegment { 12 class JpegSegment {
13 public: 13 public:
14 JpegSegment(const SkData* skdata) 14 JpegSegment(const SkData* skdata)
15 : fData(static_cast<const char*>(skdata->data())) 15 : fData(static_cast<const char*>(skdata->data()))
16 , fSize(skdata->size()) 16 , fSize(skdata->size())
17 , fOffset(0) 17 , fOffset(0)
18 , fLength(0) {} 18 , fLength(0) {}
19 bool read() { 19 bool read() {
20 if (!this->readBigendianUint16(&fMarker)) { 20 if (!this->readBigendianUint16(&fMarker)) {
21 return false; 21 return false;
22 } 22 }
23 if (JpegSegment::StandAloneMarker(fMarker)) { 23 if (JpegSegment::StandAloneMarker(fMarker)) {
24 fLength = 0; 24 fLength = 0;
25 fBuffer = NULL; 25 fBuffer = nullptr;
26 return true; 26 return true;
27 } 27 }
28 if (!this->readBigendianUint16(&fLength) || fLength < 2) { 28 if (!this->readBigendianUint16(&fLength) || fLength < 2) {
29 return false; 29 return false;
30 } 30 }
31 fLength -= 2; // Length includes itself for some reason. 31 fLength -= 2; // Length includes itself for some reason.
32 if (fOffset + fLength > fSize) { 32 if (fOffset + fLength > fSize) {
33 return false; // Segment too long. 33 return false; // Segment too long.
34 } 34 }
35 fBuffer = &fData[fOffset]; 35 fBuffer = &fData[fOffset];
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if (numberOfComponents == 3) { 112 if (numberOfComponents == 3) {
113 info->fType = SkJFIFInfo::kYCbCr; 113 info->fType = SkJFIFInfo::kYCbCr;
114 } else { 114 } else {
115 info->fType = SkJFIFInfo::kGrayscale; 115 info->fType = SkJFIFInfo::kGrayscale;
116 } 116 }
117 } 117 }
118 return true; 118 return true;
119 } 119 }
120 120
121 121
OLDNEW
« no previous file with comments | « src/pdf/SkJpegInfo.h ('k') | src/pdf/SkPDFBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698