| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 FX_LPWSTR dest_buf = result.GetBuffer(src_len); | 429 FX_LPWSTR dest_buf = result.GetBuffer(src_len); |
| 430 for (FX_DWORD i = 0; i < src_len; i ++) { | 430 for (FX_DWORD i = 0; i < src_len; i ++) { |
| 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) | |
| 440 { | |
| 441 return PDF_DecodeText((FX_LPCBYTE)bstr.c_str(), bstr.GetLength(), pCharMap); | |
| 442 } | |
| 443 CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap
) | 439 CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap
) |
| 444 { | 440 { |
| 445 if (len == -1) { | 441 if (len == -1) { |
| 446 len = (FX_STRSIZE)FXSYS_wcslen(pString); | 442 len = (FX_STRSIZE)FXSYS_wcslen(pString); |
| 447 } | 443 } |
| 448 CFX_ByteString result; | 444 CFX_ByteString result; |
| 449 if (pCharMap == NULL) { | 445 if (pCharMap == NULL) { |
| 450 FX_LPSTR dest_buf1 = result.GetBuffer(len); | 446 FX_LPSTR dest_buf1 = result.GetBuffer(len); |
| 451 int i; | 447 int i; |
| 452 for (i = 0; i < len; i ++) { | 448 for (i = 0; i < len; i ++) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 527 } |
| 532 } | 528 } |
| 533 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
buf, FX_DWORD& dest_size) | 529 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
buf, FX_DWORD& dest_size) |
| 534 { | 530 { |
| 535 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); | 531 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); |
| 536 if (pEncoders) { | 532 if (pEncoders) { |
| 537 return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src
_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); | 533 return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src
_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); |
| 538 } | 534 } |
| 539 return 0; | 535 return 0; |
| 540 } | 536 } |
| OLD | NEW |