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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100
void* buffer, unsigned long buflen) | 100
void* buffer, unsigned long buflen) |
101 { | 101 { |
102 if (document == NULL) return 0; | 102 if (document == NULL) return 0; |
103 if (action == NULL) return 0; | 103 if (action == NULL) return 0; |
104 CPDF_Document* pDoc = (CPDF_Document*)document; | 104 CPDF_Document* pDoc = (CPDF_Document*)document; |
105 CPDF_Action Action = (CPDF_Dictionary*)action; | 105 CPDF_Action Action = (CPDF_Dictionary*)action; |
106 | 106 |
107 CFX_ByteString path = Action.GetURI(pDoc); | 107 CFX_ByteString path = Action.GetURI(pDoc); |
108 unsigned long len = path.GetLength() + 1; | 108 unsigned long len = path.GetLength() + 1; |
109 if (buffer != NULL && buflen >= len) | 109 if (buffer != NULL && buflen >= len) |
110 » » FXSYS_memcpy(buffer, (FX_LPCSTR)path, len); | 110 » » FXSYS_memcpy(buffer, path.c_str(), len); |
111 return len; | 111 return len; |
112 } | 112 } |
113 | 113 |
114 DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FP
DF_DEST dest) | 114 DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FP
DF_DEST dest) |
115 { | 115 { |
116 if (document == NULL) return 0; | 116 if (document == NULL) return 0; |
117 if (dest == NULL) return 0; | 117 if (dest == NULL) return 0; |
118 CPDF_Document* pDoc = (CPDF_Document*)document; | 118 CPDF_Document* pDoc = (CPDF_Document*)document; |
119 CPDF_Dest Dest = (CPDF_Array*)dest; | 119 CPDF_Dest Dest = (CPDF_Array*)dest; |
120 | 120 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // Get info dictionary | 244 // Get info dictionary |
245 CPDF_Dictionary* pInfo = pDoc->GetInfo(); | 245 CPDF_Dictionary* pInfo = pDoc->GetInfo(); |
246 if (pInfo == NULL) return 0; | 246 if (pInfo == NULL) return 0; |
247 | 247 |
248 CFX_WideString text = pInfo->GetUnicodeText(tag); | 248 CFX_WideString text = pInfo->GetUnicodeText(tag); |
249 | 249 |
250 // Use UTF-16LE encoding | 250 // Use UTF-16LE encoding |
251 CFX_ByteString bstr = text.UTF16LE_Encode(); | 251 CFX_ByteString bstr = text.UTF16LE_Encode(); |
252 unsigned long len = bstr.GetLength(); | 252 unsigned long len = bstr.GetLength(); |
253 if (buffer != NULL && buflen >= len+2) { | 253 if (buffer != NULL && buflen >= len+2) { |
254 » » FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len); | 254 » » FXSYS_memcpy(buffer, bstr.c_str(), len); |
255 // use double zero as trailer | 255 // use double zero as trailer |
256 ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; | 256 ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; |
257 } | 257 } |
258 return len+2; | 258 return len+2; |
259 } | 259 } |
260 | 260 |
OLD | NEW |