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 = 0; |
40 » while (title[len]) len++; | |
palmer
2014/07/12 00:54:39
wcslen?
Bo Xu
2014/07/12 05:18:04
Done.
| |
41 » CFX_WideString wstr = CFX_WideString::FromUTF16LE(title, len); | |
40 return FindBookmark(tree, NULL, wstr); | 42 return FindBookmark(tree, NULL, wstr); |
41 } | 43 } |
42 | 44 |
43 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BO OKMARK bookmark) | 45 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BO OKMARK bookmark) |
44 { | 46 { |
45 if (document == NULL) return NULL; | 47 if (document == NULL) return NULL; |
46 if (bookmark == NULL) return NULL; | 48 if (bookmark == NULL) return NULL; |
47 | 49 |
48 CPDF_Bookmark Bookmark = (CPDF_Dictionary*)bookmark; | 50 CPDF_Bookmark Bookmark = (CPDF_Dictionary*)bookmark; |
49 CPDF_Document* pDoc = (CPDF_Document*)document; | 51 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(); | 252 CFX_ByteString bstr = text.UTF16LE_Encode(); |
251 unsigned long len = bstr.GetLength(); | 253 unsigned long len = bstr.GetLength(); |
252 if (buffer != NULL && buflen >= len+2) { | 254 if (buffer != NULL && buflen >= len+2) { |
253 FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len); | 255 FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len); |
254 // use double zero as trailer | 256 // use double zero as trailer |
255 ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; | 257 ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; |
256 } | 258 } |
257 return len+2; | 259 return len+2; |
258 } | 260 } |
259 | 261 |
OLD | NEW |