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

Side by Side Diff: core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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/fxcodec/jbig2/JBig2_HtrdProc.cpp ('k') | core/fxcodec/jbig2/JBig2_HuffmanTable.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 #include "core/fxcodec/jbig2/JBig2_HuffmanDecoder.h" 7 #include "core/fxcodec/jbig2/JBig2_HuffmanDecoder.h"
8 8
9 #include "core/fxcodec/jbig2/JBig2_Define.h" 9 #include "core/fxcodec/jbig2/JBig2_Define.h"
10 10
11 CJBig2_HuffmanDecoder::CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream) 11 CJBig2_HuffmanDecoder::CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream)
12 : m_pStream(pStream) {} 12 : m_pStream(pStream) {}
13 13
14 CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder() {} 14 CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder() {}
15 15
16 int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable, 16 int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable,
17 int* nResult) { 17 int* nResult) {
18 int nVal = 0; 18 int nVal = 0;
19 int nBits = 0; 19 int nBits = 0;
20 while (1) { 20 while (1) {
21 FX_DWORD nTmp; 21 uint32_t nTmp;
22 if (m_pStream->read1Bit(&nTmp) == -1) 22 if (m_pStream->read1Bit(&nTmp) == -1)
23 break; 23 break;
24 24
25 nVal = (nVal << 1) | nTmp; 25 nVal = (nVal << 1) | nTmp;
26 ++nBits; 26 ++nBits;
27 for (FX_DWORD i = 0; i < pTable->Size(); ++i) { 27 for (uint32_t i = 0; i < pTable->Size(); ++i) {
28 if (pTable->GetPREFLEN()[i] == nBits && pTable->GetCODES()[i] == nVal) { 28 if (pTable->GetPREFLEN()[i] == nBits && pTable->GetCODES()[i] == nVal) {
29 if (pTable->IsHTOOB() && i == pTable->Size() - 1) 29 if (pTable->IsHTOOB() && i == pTable->Size() - 1)
30 return JBIG2_OOB; 30 return JBIG2_OOB;
31 31
32 if (m_pStream->readNBits(pTable->GetRANGELEN()[i], &nTmp) == -1) 32 if (m_pStream->readNBits(pTable->GetRANGELEN()[i], &nTmp) == -1)
33 return -1; 33 return -1;
34 34
35 FX_DWORD offset = pTable->IsHTOOB() ? 3 : 2; 35 uint32_t offset = pTable->IsHTOOB() ? 3 : 2;
36 if (i == pTable->Size() - offset) 36 if (i == pTable->Size() - offset)
37 *nResult = pTable->GetRANGELOW()[i] - nTmp; 37 *nResult = pTable->GetRANGELOW()[i] - nTmp;
38 else 38 else
39 *nResult = pTable->GetRANGELOW()[i] + nTmp; 39 *nResult = pTable->GetRANGELOW()[i] + nTmp;
40 return 0; 40 return 0;
41 } 41 }
42 } 42 }
43 } 43 }
44 return -1; 44 return -1;
45 } 45 }
OLDNEW
« no previous file with comments | « core/fxcodec/jbig2/JBig2_HtrdProc.cpp ('k') | core/fxcodec/jbig2/JBig2_HuffmanTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698