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

Side by Side Diff: fpdfsdk/src/fpdfdoc.cpp

Issue 847243005: Allow FPDFBookmark_GetFirstChild to return the top level bookmark (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fpdfdoc.h" 8 #include "../include/fpdfdoc.h"
9 9
10 static int THISMODULE = 0; 10 static int THISMODULE = 0;
(...skipping 11 matching lines...) Expand all
22 CPDF_Bookmark found = FindBookmark(tree, child, title); 22 CPDF_Bookmark found = FindBookmark(tree, child, title);
23 if (found) 23 if (found)
24 return found; 24 return found;
25 child = tree.GetNextSibling(child); 25 child = tree.GetNextSibling(child);
26 } 26 }
27 return CPDF_Bookmark(); 27 return CPDF_Bookmark();
28 } 28 }
29 29
30 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild(FPDF_DOCUMENT documen t, FPDF_BOOKMARK pDict) 30 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild(FPDF_DOCUMENT documen t, FPDF_BOOKMARK pDict)
31 { 31 {
32 if (!document || !pDict) 32 if (!document)
33 return NULL; 33 return NULL;
34 CPDF_Document* pDoc = (CPDF_Document*)document; 34 CPDF_Document* pDoc = (CPDF_Document*)document;
35 CPDF_BookmarkTree tree(pDoc); 35 CPDF_BookmarkTree tree(pDoc);
36 CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict); 36 CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict);
37 return tree.GetFirstChild(bookmark).GetDict(); 37 return tree.GetFirstChild(bookmark).GetDict();
38 } 38 }
39 39
40 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetNextSibling(FPDF_DOCUMENT docume nt, FPDF_BOOKMARK pDict) 40 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetNextSibling(FPDF_DOCUMENT docume nt, FPDF_BOOKMARK pDict)
41 { 41 {
42 if (!document || !pDict) 42 if (!document || !pDict)
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 CFX_ByteString encodedText = text.UTF16LE_Encode(); 293 CFX_ByteString encodedText = text.UTF16LE_Encode();
294 unsigned long len = encodedText.GetLength(); 294 unsigned long len = encodedText.GetLength();
295 if (buffer && buflen >= len + 2) { 295 if (buffer && buflen >= len + 2) {
296 FXSYS_memcpy(buffer, encodedText.c_str(), len); 296 FXSYS_memcpy(buffer, encodedText.c_str(), len);
297 // use double zero as trailer 297 // use double zero as trailer
298 ((FX_BYTE*)buffer)[len] = 0; 298 ((FX_BYTE*)buffer)[len] = 0;
299 ((FX_BYTE*)buffer)[len + 1] = 0; 299 ((FX_BYTE*)buffer)[len + 1] = 0;
300 } 300 }
301 return len+2; 301 return len+2;
302 } 302 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698