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

Side by Side Diff: core/src/fxcodec/codec/fx_codec_jbig.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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/codec/fx_codec_icc.cpp ('k') | core/src/fxcodec/codec/fx_codec_jpeg.cpp » ('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 "../../../include/fxcodec/fx_codec.h" 7 #include "../../../include/fxcodec/fx_codec.h"
8 #include "codec_int.h" 8 #include "codec_int.h"
9 9
10 CCodec_Jbig2Context::CCodec_Jbig2Context() 10 CCodec_Jbig2Context::CCodec_Jbig2Context()
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if(m_pJbig2Context->m_src_buf) { 165 if(m_pJbig2Context->m_src_buf) {
166 FX_Free(m_pJbig2Context->m_src_buf); 166 FX_Free(m_pJbig2Context->m_src_buf);
167 } 167 }
168 m_pJbig2Context->m_src_buf = NULL; 168 m_pJbig2Context->m_src_buf = NULL;
169 return FXCODEC_STATUS_ERROR; 169 return FXCODEC_STATUS_ERROR;
170 } 170 }
171 FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(void* pJbig2Context, IFX_Pause * pPause) 171 FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(void* pJbig2Context, IFX_Pause * pPause)
172 { 172 {
173 CCodec_Jbig2Context* m_pJbig2Context = (CCodec_Jbig2Context*)pJbig2Context; 173 CCodec_Jbig2Context* m_pJbig2Context = (CCodec_Jbig2Context*)pJbig2Context;
174 int ret = m_pJbig2Context->m_pContext->Continue(pPause); 174 int ret = m_pJbig2Context->m_pContext->Continue(pPause);
175 if(m_pJbig2Context->m_pContext->GetProcessiveStatus() == FXCODEC_STATUS_DECO DE_FINISH) { 175 if (m_pJbig2Context->m_pContext->GetProcessiveStatus() != FXCODEC_STATUS_DEC ODE_FINISH) {
176 if(m_pJbig2Context->m_bFileReader) { 176 return m_pJbig2Context->m_pContext->GetProcessiveStatus();
177 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext); 177 }
178 m_pJbig2Context->m_pContext = NULL; 178 if (m_pJbig2Context->m_bFileReader) {
179 if (ret != JBIG2_SUCCESS) { 179 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext);
180 if(m_pJbig2Context->m_src_buf) { 180 m_pJbig2Context->m_pContext = NULL;
181 FX_Free(m_pJbig2Context->m_src_buf); 181 if (ret != JBIG2_SUCCESS) {
182 } 182 if(m_pJbig2Context->m_src_buf) {
183 m_pJbig2Context->m_src_buf = NULL; 183 FX_Free(m_pJbig2Context->m_src_buf);
184 return FXCODEC_STATUS_ERROR;
185 } 184 }
186 delete m_pJbig2Context->m_dest_image; 185 m_pJbig2Context->m_src_buf = NULL;
187 FX_Free(m_pJbig2Context->m_src_buf); 186 return FXCODEC_STATUS_ERROR;
188 return FXCODEC_STATUS_DECODE_FINISH;
189 } else {
190 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext);
191 m_pJbig2Context->m_pContext = NULL;
192 if (ret != JBIG2_SUCCESS) {
193 return FXCODEC_STATUS_ERROR;
194 }
195 int dword_size = m_pJbig2Context->m_height * m_pJbig2Context->m_dest _pitch / 4;
196 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf;
197 for (int i = 0; i < dword_size; i ++) {
198 dword_buf[i] = ~dword_buf[i];
199 }
200 return FXCODEC_STATUS_DECODE_FINISH;
201 } 187 }
188 delete m_pJbig2Context->m_dest_image;
189 FX_Free(m_pJbig2Context->m_src_buf);
190 return FXCODEC_STATUS_DECODE_FINISH;
202 } 191 }
203 return m_pJbig2Context->m_pContext->GetProcessiveStatus(); 192 CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext);
193 m_pJbig2Context->m_pContext = NULL;
194 if (ret != JBIG2_SUCCESS) {
195 return FXCODEC_STATUS_ERROR;
196 }
197 int dword_size = m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4;
198 FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf;
199 for (int i = 0; i < dword_size; i ++) {
200 dword_buf[i] = ~dword_buf[i];
201 }
202 return FXCODEC_STATUS_DECODE_FINISH;
204 } 203 }
205 204
206 205
207 206
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_icc.cpp ('k') | core/src/fxcodec/codec/fx_codec_jpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698