summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfannot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdfannot.cpp')
-rw-r--r--fpdfsdk/fpdfannot.cpp15
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) {