diff options
author | Jane Liu <janeliulwq@google.com> | 2017-07-18 10:15:16 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-19 13:55:30 +0000 |
commit | 18ae06d9ae493276b3ddcd37eb19de7aeba1a0e8 (patch) | |
tree | cfe59580602328796f2931506a591f2cf655c479 /fpdfsdk/fpdfannot.cpp | |
parent | 0add284c1a2b3bee022bef34c7efddcb304f2e21 (diff) | |
download | pdfium-18ae06d9ae493276b3ddcd37eb19de7aeba1a0e8.tar.xz |
Basic APIs and tests for extracting attachments
1. Added API for extracting attachment properties and data.
* Expanded the embedder test to cover all the new APIs.
Bug=pdfium:174
Change-Id: I09bffd412410e9aea45faca442d2b72eefafef4e
Reviewed-on: https://pdfium-review.googlesource.com/7790
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfannot.cpp')
-rw-r--r-- | fpdfsdk/fpdfannot.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp index 412c80b5de..1c4345ab52 100644 --- a/fpdfsdk/fpdfannot.cpp +++ b/fpdfsdk/fpdfannot.cpp @@ -170,10 +170,6 @@ bool HasAPStream(const CPDF_Dictionary* pAnnotDict) { return !!FPDFDOC_GetAnnotAP(pAnnotDict, CPDF_Annot::AppearanceMode::Normal); } -CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING text) { - return CFX_WideString::FromUTF16LE(text, CFX_WideString::WStringLength(text)) - .UTF8Encode(); -} void UpdateContentStream(CPDF_Form* pForm, CPDF_Stream* pStream) { ASSERT(pForm); ASSERT(pStream); @@ -760,14 +756,9 @@ DLLEXPORT unsigned long STDCALL FPDFAnnot_GetStringValue(FPDF_ANNOTATION annot, if (!pAnnotDict) return 0; - CFX_ByteString contents = - pAnnotDict->GetUnicodeTextFor(CFXByteStringFromFPDFWideString(key)) - .UTF16LE_Encode(); - unsigned long len = contents.GetLength(); - if (buffer && buflen >= len) - memcpy(buffer, contents.c_str(), len); - - return len; + return Utf16EncodeMaybeCopyAndReturnLength( + pAnnotDict->GetUnicodeTextFor(CFXByteStringFromFPDFWideString(key)), + buffer, buflen); } DLLEXPORT int STDCALL FPDFAnnot_GetFlags(FPDF_ANNOTATION annot) { |