Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: fpdfsdk/src/fpdfview.cpp

Issue 837723009: Add tests for GetNamedDests() API. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, adjust buffer_length type. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fpdfsdk/src/fpdfview_embeddertest.cpp » ('j') | fpdfsdk/src/fpdfview_embeddertest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfview.cpp
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 3f6bdd94b3324146873a1e3eb06751a7ce7264f5..fba5d65bcecfbdec3b9cec470f0b62dd4363e45f 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -848,8 +848,10 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index,
pDestObj = nameTree.LookupValue(index, bsName);
}
if (!pDestObj) return NULL;
- if (pDestObj->GetType() == PDFOBJ_DICTIONARY)
+ if (pDestObj->GetType() == PDFOBJ_DICTIONARY) {
pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D"));
+ if (!pDestObj) return NULL;
+ }
if (pDestObj->GetType() != PDFOBJ_ARRAY) return NULL;
CFX_WideString wsName = PDF_DecodeText(bsName);
CFX_ByteString utf16Name = wsName.UTF16LE_Encode();
@@ -858,6 +860,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, int index,
buflen = len;
} else if (buflen >= len) {
memcpy(buffer, utf16Name.c_str(), len);
+ buflen = len;
} else {
buflen = -1;
}
« no previous file with comments | « no previous file | fpdfsdk/src/fpdfview_embeddertest.cpp » ('j') | fpdfsdk/src/fpdfview_embeddertest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698