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

Side by Side Diff: core/src/fxcrt/fx_basic_maps.cpp

Issue 1145843005: Revert "Remove FX_Alloc() null checks now that it can't return NULL." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 7 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/fxcrt/fx_basic_buffer.cpp ('k') | core/src/fxcrt/fx_basic_plex.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/fxcrt/fx_ext.h" 7 #include "../../include/fxcrt/fx_ext.h"
8 #include "plex.h" 8 #include "plex.h"
9 static void ConstructElement(CFX_ByteString* pNewData) 9 static void ConstructElement(CFX_ByteString* pNewData)
10 { 10 {
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 { 406 {
407 if (len < (int)sizeof(_CompactString)) { 407 if (len < (int)sizeof(_CompactString)) {
408 pCompact->m_CompactLen = (FX_BYTE)len; 408 pCompact->m_CompactLen = (FX_BYTE)len;
409 FXSYS_memcpy32(&pCompact->m_LenHigh, pStr, len); 409 FXSYS_memcpy32(&pCompact->m_LenHigh, pStr, len);
410 return; 410 return;
411 } 411 }
412 pCompact->m_CompactLen = 0xff; 412 pCompact->m_CompactLen = 0xff;
413 pCompact->m_LenHigh = len / 256; 413 pCompact->m_LenHigh = len / 256;
414 pCompact->m_LenLow = len % 256; 414 pCompact->m_LenLow = len % 256;
415 pCompact->m_pBuffer = FX_Alloc(FX_BYTE, len); 415 pCompact->m_pBuffer = FX_Alloc(FX_BYTE, len);
416 FXSYS_memcpy32(pCompact->m_pBuffer, pStr, len); 416 if (pCompact->m_pBuffer) {
417 FXSYS_memcpy32(pCompact->m_pBuffer, pStr, len);
418 }
417 } 419 }
418 static CFX_ByteStringC _CompactStringGet(_CompactString* pCompact) 420 static CFX_ByteStringC _CompactStringGet(_CompactString* pCompact)
419 { 421 {
420 if (pCompact->m_CompactLen == 0xff) { 422 if (pCompact->m_CompactLen == 0xff) {
421 return CFX_ByteStringC(pCompact->m_pBuffer, pCompact->m_LenHigh * 256 + pCompact->m_LenLow); 423 return CFX_ByteStringC(pCompact->m_pBuffer, pCompact->m_LenHigh * 256 + pCompact->m_LenLow);
422 } 424 }
423 if (pCompact->m_CompactLen == 0xfe) { 425 if (pCompact->m_CompactLen == 0xfe) {
424 return CFX_ByteStringC(); 426 return CFX_ByteStringC();
425 } 427 }
426 return CFX_ByteStringC(&pCompact->m_LenHigh, pCompact->m_CompactLen); 428 return CFX_ByteStringC(&pCompact->m_LenHigh, pCompact->m_CompactLen);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 buf[mid].value = value; 634 buf[mid].value = value;
633 return; 635 return;
634 } 636 }
635 } 637 }
636 m_Buffer.InsertBlock(low * sizeof(_DWordPair), &pair, sizeof(_DWordPair)); 638 m_Buffer.InsertBlock(low * sizeof(_DWordPair), &pair, sizeof(_DWordPair));
637 } 639 }
638 void CFX_CMapDWordToDWord::EstimateSize(FX_DWORD size, FX_DWORD grow_by) 640 void CFX_CMapDWordToDWord::EstimateSize(FX_DWORD size, FX_DWORD grow_by)
639 { 641 {
640 m_Buffer.EstimateSize(size, grow_by); 642 m_Buffer.EstimateSize(size, grow_by);
641 } 643 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_buffer.cpp ('k') | core/src/fxcrt/fx_basic_plex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698