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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp

Issue 1849443003: Re-enable all the windows warnings except 4267 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/fpdfapi/fpdf_parser/include/ipdf_data_avail.h" 7 #include "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" 9 #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h"
10 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" 10 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h"
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 709 }
710 710
711 m_docStatus = 711 m_docStatus =
712 m_bSupportHintTable ? PDF_DATAAVAIL_HINTTABLE : PDF_DATAAVAIL_DONE; 712 m_bSupportHintTable ? PDF_DATAAVAIL_HINTTABLE : PDF_DATAAVAIL_DONE;
713 return TRUE; 713 return TRUE;
714 } 714 }
715 715
716 FX_BOOL CPDF_DataAvail::IsDataAvail(FX_FILESIZE offset, 716 FX_BOOL CPDF_DataAvail::IsDataAvail(FX_FILESIZE offset,
717 uint32_t size, 717 uint32_t size,
718 IPDF_DataAvail::DownloadHints* pHints) { 718 IPDF_DataAvail::DownloadHints* pHints) {
719 if (offset > m_dwFileLen) 719 if (offset > m_dwFileLen)
Tom Sepez 2016/03/30 23:28:28 probably should check for < 0, as FX_FILESIZE is s
Wei Li 2016/03/31 01:39:09 Done.
720 return TRUE; 720 return TRUE;
721 721
722 FX_SAFE_DWORD safeSize = pdfium::base::checked_cast<uint32_t>(offset); 722 FX_SAFE_DWORD safeSize = pdfium::base::checked_cast<uint32_t>(offset);
Tom Sepez 2016/03/30 23:28:28 If this were a FX_SAFE_FILESIZE, we could avoid al
Wei Li 2016/03/31 01:39:08 Good idea, done.
723 safeSize += size; 723 safeSize += size;
724 safeSize += 512; 724 safeSize += 512;
725 if (!safeSize.IsValid() || safeSize.ValueOrDie() > m_dwFileLen) 725 if (!safeSize.IsValid() ||
726 safeSize.ValueOrDie() > static_cast<uint32_t>(m_dwFileLen))
726 size = m_dwFileLen - offset; 727 size = m_dwFileLen - offset;
727 else 728 else
728 size += 512; 729 size += 512;
729 730
730 if (!m_pFileAvail->IsDataAvail(offset, size)) { 731 if (!m_pFileAvail->IsDataAvail(offset, size)) {
731 pHints->AddSegment(offset, size); 732 pHints->AddSegment(offset, size);
732 return FALSE; 733 return FALSE;
733 } 734 }
734 return TRUE; 735 return TRUE;
735 } 736 }
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 return FormAvailable; 1836 return FormAvailable;
1836 } 1837 }
1837 1838
1838 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} 1839 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {}
1839 1840
1840 CPDF_DataAvail::PageNode::~PageNode() { 1841 CPDF_DataAvail::PageNode::~PageNode() {
1841 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) 1842 for (int32_t i = 0; i < m_childNode.GetSize(); ++i)
1842 delete m_childNode[i]; 1843 delete m_childNode[i];
1843 m_childNode.RemoveAll(); 1844 m_childNode.RemoveAll();
1844 } 1845 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698