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

Side by Side Diff: xfa/fde/xml/fde_xml_imp.cpp

Issue 2640143003: Update safe numerics package to get bitwise ops (Closed)
Patch Set: 0 is a perfectly fine value of zero Created 3 years, 11 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 "xfa/fde/xml/fde_xml_imp.h" 7 #include "xfa/fde/xml/fde_xml_imp.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 m_iCurrentPos = m_pStream->GetBOM(bom); 1307 m_iCurrentPos = m_pStream->GetBOM(bom);
1308 ASSERT(!m_pBuffer); 1308 ASSERT(!m_pBuffer);
1309 1309
1310 FX_SAFE_INT32 alloc_size_safe = m_iXMLPlaneSize; 1310 FX_SAFE_INT32 alloc_size_safe = m_iXMLPlaneSize;
1311 alloc_size_safe += 1; // For NUL. 1311 alloc_size_safe += 1; // For NUL.
1312 if (!alloc_size_safe.IsValid() || alloc_size_safe.ValueOrDie() <= 0) { 1312 if (!alloc_size_safe.IsValid() || alloc_size_safe.ValueOrDie() <= 0) {
1313 m_syntaxParserResult = FDE_XmlSyntaxResult::Error; 1313 m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
1314 return; 1314 return;
1315 } 1315 }
1316 1316
1317 m_pBuffer = FX_Alloc(FX_WCHAR, alloc_size_safe.ValueOrDie()); 1317 m_pBuffer = FX_Alloc(FX_WCHAR, alloc_size_safe.ValueOrDie<size_t>());
1318 m_pStart = m_pEnd = m_pBuffer; 1318 m_pStart = m_pEnd = m_pBuffer;
1319 ASSERT(!m_BlockBuffer.IsInitialized()); 1319 ASSERT(!m_BlockBuffer.IsInitialized());
1320 m_BlockBuffer.InitBuffer(); 1320 m_BlockBuffer.InitBuffer();
1321 m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock); 1321 m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
1322 m_iParsedBytes = m_iParsedChars = 0; 1322 m_iParsedBytes = m_iParsedChars = 0;
1323 m_iBufferChars = 0; 1323 m_iBufferChars = 0;
1324 } 1324 }
1325 1325
1326 FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() { 1326 FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
1327 if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error || 1327 if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 m_BlockBuffer.DeleteTextChars(m_iDataLength - m_iEntityStart, false); 1914 m_BlockBuffer.DeleteTextChars(m_iDataLength - m_iEntityStart, false);
1915 m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock); 1915 m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock);
1916 m_iEntityStart = -1; 1916 m_iEntityStart = -1;
1917 } else { 1917 } else {
1918 if (m_iEntityStart < 0 && character == L'&') { 1918 if (m_iEntityStart < 0 && character == L'&') {
1919 m_iEntityStart = m_iDataLength - 1; 1919 m_iEntityStart = m_iDataLength - 1;
1920 } 1920 }
1921 } 1921 }
1922 m_pStart++; 1922 m_pStart++;
1923 } 1923 }
OLDNEW
« core/fxge/ge/fx_ge_text.cpp ('K') | « third_party/base/numerics/safe_math_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698