| OLD | NEW |
| 1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 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/fxcodec/jbig2/JBig2_BitStream.h" | 7 #include "core/fxcodec/jbig2/JBig2_BitStream.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 int32_t CJBig2_BitStream::readInteger(FX_DWORD* dwResult) { | 94 int32_t CJBig2_BitStream::readInteger(FX_DWORD* dwResult) { |
| 95 if (m_dwByteIdx + 3 >= m_dwLength) | 95 if (m_dwByteIdx + 3 >= m_dwLength) |
| 96 return -1; | 96 return -1; |
| 97 | 97 |
| 98 *dwResult = (m_pBuf[m_dwByteIdx] << 24) | (m_pBuf[m_dwByteIdx + 1] << 16) | | 98 *dwResult = (m_pBuf[m_dwByteIdx] << 24) | (m_pBuf[m_dwByteIdx + 1] << 16) | |
| 99 (m_pBuf[m_dwByteIdx + 2] << 8) | m_pBuf[m_dwByteIdx + 3]; | 99 (m_pBuf[m_dwByteIdx + 2] << 8) | m_pBuf[m_dwByteIdx + 3]; |
| 100 m_dwByteIdx += 4; | 100 m_dwByteIdx += 4; |
| 101 return 0; | 101 return 0; |
| 102 } | 102 } |
| 103 | 103 |
| 104 int32_t CJBig2_BitStream::readShortInteger(FX_WORD* dwResult) { | 104 int32_t CJBig2_BitStream::readShortInteger(uint16_t* dwResult) { |
| 105 if (m_dwByteIdx + 1 >= m_dwLength) | 105 if (m_dwByteIdx + 1 >= m_dwLength) |
| 106 return -1; | 106 return -1; |
| 107 | 107 |
| 108 *dwResult = (m_pBuf[m_dwByteIdx] << 8) | m_pBuf[m_dwByteIdx + 1]; | 108 *dwResult = (m_pBuf[m_dwByteIdx] << 8) | m_pBuf[m_dwByteIdx + 1]; |
| 109 m_dwByteIdx += 2; | 109 m_dwByteIdx += 2; |
| 110 return 0; | 110 return 0; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void CJBig2_BitStream::alignByte() { | 113 void CJBig2_BitStream::alignByte() { |
| 114 if (m_dwBitIdx != 0) { | 114 if (m_dwBitIdx != 0) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 return m_dwByteIdx < m_dwLength; | 180 return m_dwByteIdx < m_dwLength; |
| 181 } | 181 } |
| 182 | 182 |
| 183 FX_DWORD CJBig2_BitStream::LengthInBits() const { | 183 FX_DWORD CJBig2_BitStream::LengthInBits() const { |
| 184 return m_dwLength << 3; | 184 return m_dwLength << 3; |
| 185 } | 185 } |
| 186 | 186 |
| 187 FX_DWORD CJBig2_BitStream::getObjNum() const { | 187 FX_DWORD CJBig2_BitStream::getObjNum() const { |
| 188 return m_dwObjNum; | 188 return m_dwObjNum; |
| 189 } | 189 } |
| OLD | NEW |