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

Side by Side Diff: core/fpdfapi/parser/fpdf_parser_utility.cpp

Issue 2451493002: Refcount all the IFX_ stream classes all the time. (Closed)
Patch Set: Clean up cast expression Created 4 years 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
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/parser/fpdf_parser_utility.h" 7 #include "core/fpdfapi/parser/fpdf_parser_utility.h"
8 8
9 #include "core/fpdfapi/parser/cpdf_array.h" 9 #include "core/fpdfapi/parser/cpdf_array.h"
10 #include "core/fpdfapi/parser/cpdf_boolean.h" 10 #include "core/fpdfapi/parser/cpdf_boolean.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 'W', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 62 'W', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
63 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 63 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
64 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 64 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
65 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 65 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
66 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 66 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
67 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 67 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
68 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 68 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
69 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 69 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R',
70 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W'}; 70 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W'};
71 71
72 int32_t GetHeaderOffset(IFX_SeekableReadStream* pFile) { 72 int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
73 const size_t kBufSize = 4; 73 const size_t kBufSize = 4;
74 uint8_t buf[kBufSize]; 74 uint8_t buf[kBufSize];
75 for (int32_t offset = 0; offset <= 1024; ++offset) { 75 for (int32_t offset = 0; offset <= 1024; ++offset) {
76 if (!pFile->ReadBlock(buf, offset, kBufSize)) 76 if (!pFile->ReadBlock(buf, offset, kBufSize))
77 return -1; 77 return -1;
78 78
79 if (memcmp(buf, "%PDF", 4) == 0) 79 if (memcmp(buf, "%PDF", 4) == 0)
80 return offset; 80 return offset;
81 } 81 }
82 return -1; 82 return -1;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 buf.AppendBlock(acc.GetData(), acc.GetSize()); 213 buf.AppendBlock(acc.GetData(), acc.GetSize());
214 buf << "\r\nendstream"; 214 buf << "\r\nendstream";
215 break; 215 break;
216 } 216 }
217 default: 217 default:
218 ASSERT(false); 218 ASSERT(false);
219 break; 219 break;
220 } 220 }
221 return buf; 221 return buf;
222 } 222 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/fpdf_parser_utility.h ('k') | core/fxcodec/codec/ccodec_progressivedecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698