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 if (pCompact->m_pBuffer) { | 416 FXSYS_memcpy32(pCompact->m_pBuffer, pStr, len); |
417 FXSYS_memcpy32(pCompact->m_pBuffer, pStr, len); | |
418 } | |
419 } | 417 } |
420 static CFX_ByteStringC _CompactStringGet(_CompactString* pCompact) | 418 static CFX_ByteStringC _CompactStringGet(_CompactString* pCompact) |
421 { | 419 { |
422 if (pCompact->m_CompactLen == 0xff) { | 420 if (pCompact->m_CompactLen == 0xff) { |
423 return CFX_ByteStringC(pCompact->m_pBuffer, pCompact->m_LenHigh * 256 +
pCompact->m_LenLow); | 421 return CFX_ByteStringC(pCompact->m_pBuffer, pCompact->m_LenHigh * 256 +
pCompact->m_LenLow); |
424 } | 422 } |
425 if (pCompact->m_CompactLen == 0xfe) { | 423 if (pCompact->m_CompactLen == 0xfe) { |
426 return CFX_ByteStringC(); | 424 return CFX_ByteStringC(); |
427 } | 425 } |
428 return CFX_ByteStringC(&pCompact->m_LenHigh, pCompact->m_CompactLen); | 426 return CFX_ByteStringC(&pCompact->m_LenHigh, pCompact->m_CompactLen); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 buf[mid].value = value; | 632 buf[mid].value = value; |
635 return; | 633 return; |
636 } | 634 } |
637 } | 635 } |
638 m_Buffer.InsertBlock(low * sizeof(_DWordPair), &pair, sizeof(_DWordPair)); | 636 m_Buffer.InsertBlock(low * sizeof(_DWordPair), &pair, sizeof(_DWordPair)); |
639 } | 637 } |
640 void CFX_CMapDWordToDWord::EstimateSize(FX_DWORD size, FX_DWORD grow_by) | 638 void CFX_CMapDWordToDWord::EstimateSize(FX_DWORD size, FX_DWORD grow_by) |
641 { | 639 { |
642 m_Buffer.EstimateSize(size, grow_by); | 640 m_Buffer.EstimateSize(size, grow_by); |
643 } | 641 } |
OLD | NEW |