OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |