From 18ae06d9ae493276b3ddcd37eb19de7aeba1a0e8 Mon Sep 17 00:00:00 2001 From: Jane Liu Date: Tue, 18 Jul 2017 10:15:16 -0400 Subject: 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 Commit-Queue: dsinclair --- fpdfsdk/fpdfannot.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'fpdfsdk/fpdfannot.cpp') 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) { -- cgit v1.2.3