OLD | NEW |
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 this_module = 0; | 10 static int this_module = 0; |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_W
IDESTRING title) | 31 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_W
IDESTRING title) |
32 { | 32 { |
33 if (document == NULL) return NULL; | 33 if (document == NULL) return NULL; |
34 if (title == NULL || title[0] == 0) return NULL; | 34 if (title == NULL || title[0] == 0) return NULL; |
35 | 35 |
36 CPDF_Document* pDoc = (CPDF_Document*)document; | 36 CPDF_Document* pDoc = (CPDF_Document*)document; |
37 CPDF_BookmarkTree tree(pDoc); | 37 CPDF_BookmarkTree tree(pDoc); |
38 | 38 |
39 » CFX_WideString wstr = CFX_WideString::FromUTF16LE(title); | 39 » FX_STRSIZE len = CFX_WideString::WStringLength(title); |
| 40 » CFX_WideString wstr = CFX_WideString::FromUTF16LE(title, len); |
40 return FindBookmark(tree, NULL, wstr); | 41 return FindBookmark(tree, NULL, wstr); |
41 } | 42 } |
42 | 43 |
43 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BO
OKMARK bookmark) | 44 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BO
OKMARK bookmark) |
44 { | 45 { |
45 if (document == NULL) return NULL; | 46 if (document == NULL) return NULL; |
46 if (bookmark == NULL) return NULL; | 47 if (bookmark == NULL) return NULL; |
47 | 48 |
48 CPDF_Bookmark Bookmark = (CPDF_Dictionary*)bookmark; | 49 CPDF_Bookmark Bookmark = (CPDF_Dictionary*)bookmark; |
49 CPDF_Document* pDoc = (CPDF_Document*)document; | 50 CPDF_Document* pDoc = (CPDF_Document*)document; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 CFX_ByteString bstr = text.UTF16LE_Encode(); | 251 CFX_ByteString bstr = text.UTF16LE_Encode(); |
251 unsigned long len = bstr.GetLength(); | 252 unsigned long len = bstr.GetLength(); |
252 if (buffer != NULL && buflen >= len+2) { | 253 if (buffer != NULL && buflen >= len+2) { |
253 FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len); | 254 FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len); |
254 // use double zero as trailer | 255 // use double zero as trailer |
255 ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; | 256 ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; |
256 } | 257 } |
257 return len+2; | 258 return len+2; |
258 } | 259 } |
259 | 260 |
OLD | NEW |