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

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_BitStream.h

Issue 1326953006: Remove CJBig2_Object, CJBig2_Module, and friends. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase 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 | « core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h ('k') | core/src/fxcodec/jbig2/JBig2_Context.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 // 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 #ifndef _JBIG2_BIT_STREAM_H_ 7 #ifndef _JBIG2_BIT_STREAM_H_
8 #define _JBIG2_BIT_STREAM_H_ 8 #define _JBIG2_BIT_STREAM_H_
9 9
10 #include "JBig2_Define.h" 10 #include "JBig2_Define.h"
11 11
12 class CJBig2_BitStream { 12 class CJBig2_BitStream {
13 public: 13 public:
14 CJBig2_BitStream(uint8_t* pBuffer, FX_DWORD dwLength); 14 CJBig2_BitStream(const uint8_t* pBuffer, FX_DWORD dwLength);
15 15
16 CJBig2_BitStream(CJBig2_BitStream& bs); 16 CJBig2_BitStream(CJBig2_BitStream& bs);
17 17
18 ~CJBig2_BitStream(); 18 ~CJBig2_BitStream();
19 19
20 int32_t readNBits(FX_DWORD nBits, FX_DWORD* dwResult); 20 int32_t readNBits(FX_DWORD nBits, FX_DWORD* dwResult);
21 21
22 int32_t readNBits(FX_DWORD nBits, int32_t* nResult); 22 int32_t readNBits(FX_DWORD nBits, int32_t* nResult);
23 23
24 int32_t read1Bit(FX_DWORD* dwResult); 24 int32_t read1Bit(FX_DWORD* dwResult);
(...skipping 23 matching lines...) Expand all
48 uint8_t getNextByte_arith(); 48 uint8_t getNextByte_arith();
49 49
50 FX_DWORD getOffset(); 50 FX_DWORD getOffset();
51 51
52 void setOffset(FX_DWORD dwOffset); 52 void setOffset(FX_DWORD dwOffset);
53 53
54 FX_DWORD getBitPos(); 54 FX_DWORD getBitPos();
55 55
56 void setBitPos(FX_DWORD dwBitPos); 56 void setBitPos(FX_DWORD dwBitPos);
57 57
58 uint8_t* getBuf(); 58 const uint8_t* getBuf();
59 59
60 FX_DWORD getLength() { return m_dwLength; } 60 FX_DWORD getLength() { return m_dwLength; }
61 61
62 uint8_t* getPointer(); 62 const uint8_t* getPointer();
63 63
64 void offset(FX_DWORD dwOffset); 64 void offset(FX_DWORD dwOffset);
65 65
66 FX_DWORD getByteLeft(); 66 FX_DWORD getByteLeft();
67 67
68 private: 68 private:
69 uint8_t* m_pBuf; 69 const uint8_t* m_pBuf;
70 70
71 FX_DWORD m_dwLength; 71 FX_DWORD m_dwLength;
72 72
73 FX_DWORD m_dwByteIdx; 73 FX_DWORD m_dwByteIdx;
74 74
75 FX_DWORD m_dwBitIdx; 75 FX_DWORD m_dwBitIdx;
76 }; 76 };
77 inline CJBig2_BitStream::CJBig2_BitStream(uint8_t* pBuffer, FX_DWORD dwLength) { 77 inline CJBig2_BitStream::CJBig2_BitStream(const uint8_t* pBuffer,
78 FX_DWORD dwLength) {
78 m_pBuf = pBuffer; 79 m_pBuf = pBuffer;
79 m_dwLength = dwLength; 80 m_dwLength = dwLength;
80 m_dwByteIdx = 0; 81 m_dwByteIdx = 0;
81 m_dwBitIdx = 0; 82 m_dwBitIdx = 0;
82 if (m_dwLength > 256 * 1024 * 1024) { 83 if (m_dwLength > 256 * 1024 * 1024) {
83 m_dwLength = 0; 84 m_dwLength = 0;
84 m_pBuf = NULL; 85 m_pBuf = NULL;
85 } 86 }
86 } 87 }
87 inline CJBig2_BitStream::CJBig2_BitStream(CJBig2_BitStream& bs) { 88 inline CJBig2_BitStream::CJBig2_BitStream(CJBig2_BitStream& bs) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 268 }
268 m_dwByteIdx = dwOffset; 269 m_dwByteIdx = dwOffset;
269 } 270 }
270 inline FX_DWORD CJBig2_BitStream::getBitPos() { 271 inline FX_DWORD CJBig2_BitStream::getBitPos() {
271 return (m_dwByteIdx << 3) + m_dwBitIdx; 272 return (m_dwByteIdx << 3) + m_dwBitIdx;
272 } 273 }
273 inline void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) { 274 inline void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) {
274 m_dwByteIdx = dwBitPos >> 3; 275 m_dwByteIdx = dwBitPos >> 3;
275 m_dwBitIdx = dwBitPos & 7; 276 m_dwBitIdx = dwBitPos & 7;
276 } 277 }
277 inline uint8_t* CJBig2_BitStream::getBuf() { 278 inline const uint8_t* CJBig2_BitStream::getBuf() {
278 return m_pBuf; 279 return m_pBuf;
279 } 280 }
280 inline uint8_t* CJBig2_BitStream::getPointer() { 281 inline const uint8_t* CJBig2_BitStream::getPointer() {
281 return m_pBuf + m_dwByteIdx; 282 return m_pBuf + m_dwByteIdx;
282 } 283 }
283 inline void CJBig2_BitStream::offset(FX_DWORD dwOffset) { 284 inline void CJBig2_BitStream::offset(FX_DWORD dwOffset) {
284 m_dwByteIdx += dwOffset; 285 m_dwByteIdx += dwOffset;
285 } 286 }
286 inline FX_DWORD CJBig2_BitStream::getByteLeft() { 287 inline FX_DWORD CJBig2_BitStream::getByteLeft() {
287 return m_dwLength - m_dwByteIdx; 288 return m_dwLength - m_dwByteIdx;
288 } 289 }
289 #endif 290 #endif
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h ('k') | core/src/fxcodec/jbig2/JBig2_Context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698