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

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_Context.cpp

Issue 1405723003: Sanity check the values of TRUE and FALSE. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 2 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
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 "JBig2_Context.h" 7 #include "JBig2_Context.h"
8 8
9 #include <list> 9 #include <list>
10 10
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 FX_WORD wTemp; 374 FX_WORD wTemp;
375 nonstd::unique_ptr<JBig2PageInfo> pPageInfo(new JBig2PageInfo); 375 nonstd::unique_ptr<JBig2PageInfo> pPageInfo(new JBig2PageInfo);
376 if (m_pStream->readInteger(&pPageInfo->m_dwWidth) != 0 || 376 if (m_pStream->readInteger(&pPageInfo->m_dwWidth) != 0 ||
377 m_pStream->readInteger(&pPageInfo->m_dwHeight) != 0 || 377 m_pStream->readInteger(&pPageInfo->m_dwHeight) != 0 ||
378 m_pStream->readInteger(&pPageInfo->m_dwResolutionX) != 0 || 378 m_pStream->readInteger(&pPageInfo->m_dwResolutionX) != 0 ||
379 m_pStream->readInteger(&pPageInfo->m_dwResolutionY) != 0 || 379 m_pStream->readInteger(&pPageInfo->m_dwResolutionY) != 0 ||
380 m_pStream->read1Byte(&pPageInfo->m_cFlags) != 0 || 380 m_pStream->read1Byte(&pPageInfo->m_cFlags) != 0 ||
381 m_pStream->readShortInteger(&wTemp) != 0) { 381 m_pStream->readShortInteger(&wTemp) != 0) {
382 return JBIG2_ERROR_TOO_SHORT; 382 return JBIG2_ERROR_TOO_SHORT;
383 } 383 }
384 pPageInfo->m_bIsStriped = ((wTemp >> 15) & 1) ? TRUE : FALSE; 384 pPageInfo->m_bIsStriped = (wTemp >> 15) & 1;
Tom Sepez 2015/10/15 17:08:31 nit: prefer !!(wTemp & 0xSomething)
Lei Zhang 2015/10/19 08:56:18 Done.
385 pPageInfo->m_wMaxStripeSize = wTemp & 0x7fff; 385 pPageInfo->m_wMaxStripeSize = wTemp & 0x7fff;
386 bool bMaxHeight = (pPageInfo->m_dwHeight == 0xffffffff); 386 bool bMaxHeight = (pPageInfo->m_dwHeight == 0xffffffff);
387 if (bMaxHeight && pPageInfo->m_bIsStriped != TRUE) 387 if (bMaxHeight && pPageInfo->m_bIsStriped != TRUE)
388 pPageInfo->m_bIsStriped = TRUE; 388 pPageInfo->m_bIsStriped = TRUE;
389 389
390 if (!m_bBufSpecified) { 390 if (!m_bBufSpecified) {
391 FX_DWORD height = 391 FX_DWORD height =
392 bMaxHeight ? pPageInfo->m_wMaxStripeSize : pPageInfo->m_dwHeight; 392 bMaxHeight ? pPageInfo->m_wMaxStripeSize : pPageInfo->m_dwHeight;
393 m_pPage.reset(new CJBig2_Image(pPageInfo->m_dwWidth, height)); 393 m_pPage.reset(new CJBig2_Image(pPageInfo->m_dwWidth, height));
394 } 394 }
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 SBSYMCODES[CURTEMP].code = CURCODE; 1420 SBSYMCODES[CURTEMP].code = CURCODE;
1421 CURCODE = CURCODE + 1; 1421 CURCODE = CURCODE + 1;
1422 } 1422 }
1423 CURTEMP = CURTEMP + 1; 1423 CURTEMP = CURTEMP + 1;
1424 } 1424 }
1425 CURLEN = CURLEN + 1; 1425 CURLEN = CURLEN + 1;
1426 } 1426 }
1427 FX_Free(LENCOUNT); 1427 FX_Free(LENCOUNT);
1428 FX_Free(FIRSTCODE); 1428 FX_Free(FIRSTCODE);
1429 } 1429 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698