Chromium Code Reviews| Index: fpdfsdk/src/fpdfdoc.cpp |
| diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp |
| index 19ca06ca276416e0df34c3f7e432b423ca910cc1..7a8a5350e2074a707b3627dca895a32e0738453e 100644 |
| --- a/fpdfsdk/src/fpdfdoc.cpp |
| +++ b/fpdfsdk/src/fpdfdoc.cpp |
| @@ -28,6 +28,39 @@ static CPDF_Bookmark FindBookmark(CPDF_BookmarkTree& tree, CPDF_Bookmark This, c |
| return NULL; |
| } |
| +DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark) |
| +{ |
| + if (document == NULL) return NULL; |
|
Tom Sepez
2015/01/01 01:10:08
nit: or just !document.
Bo Xu
2015/01/05 22:46:52
Done.
|
| + |
| + CPDF_Document* pDoc = (CPDF_Document*)document; |
| + CPDF_BookmarkTree tree(pDoc); |
| + return (CPDF_Dictionary*)tree.GetFirstChild((CPDF_Dictionary*)bookmark); |
|
Tom Sepez
2015/01/01 01:10:08
The cast of the return value doen't match the decl
Bo Xu
2015/01/01 06:40:38
This is an operator in CPDF_Bookmark class. I remo
|
| +} |
| + |
| +DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark) |
| +{ |
| + if (!document || !bookmark) return NULL; |
| + |
| + CPDF_Document* pDoc = (CPDF_Document*)document; |
| + CPDF_BookmarkTree tree(pDoc); |
| + return (CPDF_Dictionary*)tree.GetNextSibling((CPDF_Dictionary*)bookmark); |
|
Tom Sepez
2015/01/01 01:10:08
ditto.
Bo Xu
2015/01/01 06:40:38
ditto
|
| +} |
| + |
| +DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark, void* buffer, unsigned long buflen) |
| +{ |
| + if (bookmark == NULL) return 0; |
| + |
|
Tom Sepez
2015/01/01 01:10:08
nit: or just !bookmark
Bo Xu
2015/01/05 22:46:52
Done.
|
| + CPDF_Bookmark Bookmark = (CPDF_Dictionary*)bookmark; |
|
Tom Sepez
2015/01/01 01:10:08
nit: maybe pBookmark to avoid starting local varia
Bo Xu
2015/01/05 22:46:52
Done.
|
| + CFX_WideString title = Bookmark.GetTitle(); |
| + CFX_ByteString bstr = title.UTF16LE_Encode(FALSE); |
|
Tom Sepez
2015/01/01 01:10:08
nit: how about encoded_title instead of bstr (foll
|
| + unsigned long len = bstr.GetLength(); |
|
Tom Sepez
2015/01/01 01:10:08
nit: how about title_len instead of just len
|
| + if (buffer != NULL && buflen >= len + 2) { |
|
Tom Sepez
2015/01/01 01:10:08
nit: (buffer && buflen >= len + 2)
Bo Xu
2015/01/05 22:46:52
Done.
|
| + FXSYS_memcpy(buffer, bstr.c_str(), len); |
| + ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len + 1] = 0; |
|
Tom Sepez
2015/01/01 01:10:08
nit: two separate statements.
Bo Xu
2015/01/05 22:46:52
Done.
|
| + } |
| + return len + 2; |
| +} |
| + |
| DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title) |
| { |
| if (document == NULL) return NULL; |
| @@ -257,4 +290,3 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTR |
| } |
| return len+2; |
| } |
| - |