Chromium Code Reviews| Index: core/src/fxcodec/jbig2/JBig2_BitStream.h |
| diff --git a/core/src/fxcodec/jbig2/JBig2_BitStream.h b/core/src/fxcodec/jbig2/JBig2_BitStream.h |
| index 85c992f4ff7a941311e247f254851fc022ab96c1..094867521e554326e78d4b187ae7b8caff0f152e 100644 |
| --- a/core/src/fxcodec/jbig2/JBig2_BitStream.h |
| +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.h |
| @@ -7,11 +7,12 @@ |
| #ifndef _JBIG2_BIT_STREAM_H_ |
| #define _JBIG2_BIT_STREAM_H_ |
| +#include "../../../include/fpdfapi/fpdf_objects.h" |
| #include "JBig2_Define.h" |
| class CJBig2_BitStream { |
| public: |
| - CJBig2_BitStream(const uint8_t* pBuffer, FX_DWORD dwLength); |
| + CJBig2_BitStream(CPDF_StreamAcc* pSrcStream); |
|
Lei Zhang
2015/10/06 22:40:24
add the explicit keyword
David Lattimore
2015/10/07 22:41:53
Done.
|
| CJBig2_BitStream(CJBig2_BitStream& bs); |
| @@ -65,6 +66,8 @@ class CJBig2_BitStream { |
| FX_DWORD getByteLeft(); |
| + FX_DWORD getObjNum(); |
|
Lei Zhang
2015/10/06 22:40:24
This can be a const method.
David Lattimore
2015/10/07 22:41:53
Done.
|
| + |
| private: |
| const uint8_t* m_pBuf; |
| @@ -73,11 +76,13 @@ class CJBig2_BitStream { |
| FX_DWORD m_dwByteIdx; |
| FX_DWORD m_dwBitIdx; |
| + |
| + FX_DWORD m_dwObjNum; |
|
Lei Zhang
2015/10/06 22:40:24
If you move the initialization in the ctors to the
David Lattimore
2015/10/07 22:41:53
Done.
|
| }; |
| -inline CJBig2_BitStream::CJBig2_BitStream(const uint8_t* pBuffer, |
| - FX_DWORD dwLength) { |
| - m_pBuf = pBuffer; |
| - m_dwLength = dwLength; |
| +inline CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream) { |
|
Lei Zhang
2015/10/06 22:40:24
Oh geez, I need to fix more of these silly inlinin
|
| + m_pBuf = pSrcStream->GetData(); |
| + m_dwLength = pSrcStream->GetSize(); |
| + m_dwObjNum = pSrcStream->GetStream()->GetObjNum(); |
| m_dwByteIdx = 0; |
| m_dwBitIdx = 0; |
| if (m_dwLength > 256 * 1024 * 1024) { |
| @@ -90,6 +95,7 @@ inline CJBig2_BitStream::CJBig2_BitStream(CJBig2_BitStream& bs) { |
| m_dwLength = bs.m_dwLength; |
| m_dwByteIdx = bs.m_dwByteIdx; |
| m_dwBitIdx = bs.m_dwBitIdx; |
| + m_dwObjNum = bs.m_dwObjNum; |
| } |
| inline CJBig2_BitStream::~CJBig2_BitStream() {} |
| inline int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, |
| @@ -287,4 +293,7 @@ inline void CJBig2_BitStream::offset(FX_DWORD dwOffset) { |
| inline FX_DWORD CJBig2_BitStream::getByteLeft() { |
| return m_dwLength - m_dwByteIdx; |
| } |
| +inline FX_DWORD CJBig2_BitStream::getObjNum() { |
| + return m_dwObjNum; |
| +} |
| #endif |