From 4afee170f5e26b044236fd1e93c6ae2371a993de Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 10 Jan 2018 20:57:15 +0000 Subject: Fix some nits from commit a74e75d. Change-Id: Ib4556ac75efafee5a2566ad76acd87883303660f Reviewed-on: https://pdfium-review.googlesource.com/22679 Reviewed-by: Henrique Nakashima Commit-Queue: Lei Zhang --- fpdfsdk/fpdfannot.cpp | 7 ++----- fpdfsdk/fpdfannot_embeddertest.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp index c7433d03d8..e40e21981e 100644 --- a/fpdfsdk/fpdfannot.cpp +++ b/fpdfsdk/fpdfannot.cpp @@ -767,11 +767,8 @@ FPDFAnnot_GetAP(FPDF_ANNOTATION annot, static_cast(appearanceMode); CPDF_Stream* pStream = FPDFDOC_GetAnnotAPNoFallback(pAnnotDict, mode); - if (!pStream) - return Utf16EncodeMaybeCopyAndReturnLength(L"", buffer, buflen); - - return Utf16EncodeMaybeCopyAndReturnLength(pStream->GetUnicodeText(), buffer, - buflen); + return Utf16EncodeMaybeCopyAndReturnLength( + pStream ? pStream->GetUnicodeText() : L"", buffer, buflen); } FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV diff --git a/fpdfsdk/fpdfannot_embeddertest.cpp b/fpdfsdk/fpdfannot_embeddertest.cpp index 6d4521f26e..f07070a4a5 100644 --- a/fpdfsdk/fpdfannot_embeddertest.cpp +++ b/fpdfsdk/fpdfannot_embeddertest.cpp @@ -19,12 +19,12 @@ static constexpr char kContentsKey[] = "Contents"; class FPDFAnnotEmbeddertest : public EmbedderTest {}; -const std::wstring BufferToWString(std::vector& buf) { - return GetPlatformWString(reinterpret_cast(buf.data())); +std::wstring BufferToWString(const std::vector& buf) { + return GetPlatformWString(reinterpret_cast(buf.data())); } -const std::string BufferToString(std::vector& buf) { - return GetPlatformString(reinterpret_cast(buf.data())); +std::string BufferToString(const std::vector& buf) { + return GetPlatformString(reinterpret_cast(buf.data())); } TEST_F(FPDFAnnotEmbeddertest, RenderAnnotWithOnlyRolloverAP) { -- cgit v1.2.3