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

Unified Diff: core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
index dd820ae4ca58f17389d2666f385f1b7cbdfc3c46..0807ce0baa66912ff557aec6f9ea985973fe33a0 100644
--- a/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp
@@ -1,55 +1,53 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "JBig2_HuffmanDecoder.h"
-CJBig2_HuffmanDecoder::CJBig2_HuffmanDecoder(CJBig2_BitStream *pStream)
-{
- m_pStream = pStream;
+CJBig2_HuffmanDecoder::CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream) {
+ m_pStream = pStream;
}
-CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder()
-{
+CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder() {
}
-int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable *pTable, int *nResult)
-{
- int nVal, nTmp, i, nBits;
- nVal = 0;
- nBits = 0;
- while(1) {
- if(m_pStream->read1Bit(&nTmp) == -1) {
- return -1;
+int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable,
+ int* nResult) {
+ int nVal, nTmp, i, nBits;
+ nVal = 0;
+ nBits = 0;
+ while (1) {
+ if (m_pStream->read1Bit(&nTmp) == -1) {
+ return -1;
+ }
+ nVal = (nVal << 1) | nTmp;
+ nBits++;
+ for (i = 0; i < pTable->NTEMP; i++) {
+ if ((pTable->PREFLEN[i] == nBits) && (pTable->CODES[i] == nVal)) {
+ if ((pTable->HTOOB == 1) && (i == pTable->NTEMP - 1)) {
+ return JBIG2_OOB;
+ }
+ if (m_pStream->readNBits(pTable->RANGELEN[i], &nTmp) == -1) {
+ return -1;
}
- nVal = (nVal << 1) | nTmp;
- nBits ++;
- for(i = 0; i < pTable->NTEMP; i++) {
- if((pTable->PREFLEN[i] == nBits) && (pTable->CODES[i] == nVal)) {
- if((pTable->HTOOB == 1) && (i == pTable->NTEMP - 1)) {
- return JBIG2_OOB;
- }
- if(m_pStream->readNBits(pTable->RANGELEN[i], &nTmp) == -1) {
- return -1;
- }
- if(pTable->HTOOB) {
- if(i == pTable->NTEMP - 3) {
- *nResult = pTable->RANGELOW[i] - nTmp;
- return 0;
- } else {
- *nResult = pTable->RANGELOW[i] + nTmp;
- return 0;
- }
- } else {
- if(i == pTable->NTEMP - 2) {
- *nResult = pTable->RANGELOW[i] - nTmp;
- return 0;
- } else {
- *nResult = pTable->RANGELOW[i] + nTmp;
- return 0;
- }
- }
- }
+ if (pTable->HTOOB) {
+ if (i == pTable->NTEMP - 3) {
+ *nResult = pTable->RANGELOW[i] - nTmp;
+ return 0;
+ } else {
+ *nResult = pTable->RANGELOW[i] + nTmp;
+ return 0;
+ }
+ } else {
+ if (i == pTable->NTEMP - 2) {
+ *nResult = pTable->RANGELOW[i] - nTmp;
+ return 0;
+ } else {
+ *nResult = pTable->RANGELOW[i] + nTmp;
+ return 0;
+ }
}
+ }
}
- return -2;
+ }
+ return -2;
}

Powered by Google App Engine
This is Rietveld 408576698