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/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include <limits.h> | 10 #include <limits.h> |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 dest_buf[i] = PDFDocEncoding[src_data[i]]; | 431 dest_buf[i] = PDFDocEncoding[src_data[i]]; |
432 } | 432 } |
433 result.ReleaseBuffer(src_len); | 433 result.ReleaseBuffer(src_len); |
434 } else { | 434 } else { |
435 return (*pCharMap->m_GetWideString)(pCharMap, CFX_ByteString((FX_LPCSTR)
src_data, src_len)); | 435 return (*pCharMap->m_GetWideString)(pCharMap, CFX_ByteString((FX_LPCSTR)
src_data, src_len)); |
436 } | 436 } |
437 return result; | 437 return result; |
438 } | 438 } |
439 CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, CFX_CharMap* pCharMap) | 439 CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, CFX_CharMap* pCharMap) |
440 { | 440 { |
441 return PDF_DecodeText((FX_LPCBYTE)(FX_LPCSTR)bstr, bstr.GetLength(), pCharMa
p); | 441 return PDF_DecodeText((FX_LPCBYTE)bstr.c_str(), bstr.GetLength(), pCharMap); |
442 } | 442 } |
443 CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap
) | 443 CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap
) |
444 { | 444 { |
445 if (len == -1) { | 445 if (len == -1) { |
446 len = (FX_STRSIZE)FXSYS_wcslen(pString); | 446 len = (FX_STRSIZE)FXSYS_wcslen(pString); |
447 } | 447 } |
448 CFX_ByteString result; | 448 CFX_ByteString result; |
449 if (pCharMap == NULL) { | 449 if (pCharMap == NULL) { |
450 FX_LPSTR dest_buf1 = result.GetBuffer(len); | 450 FX_LPSTR dest_buf1 = result.GetBuffer(len); |
451 int i; | 451 int i; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 531 } |
532 } | 532 } |
533 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
buf, FX_DWORD& dest_size) | 533 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
buf, FX_DWORD& dest_size) |
534 { | 534 { |
535 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); | 535 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); |
536 if (pEncoders) { | 536 if (pEncoders) { |
537 return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src
_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); | 537 return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src
_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); |
538 } | 538 } |
539 return 0; | 539 return 0; |
540 } | 540 } |
OLD | NEW |