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 "../../core/include/fpdfapi/fpdf_module.h" | 7 #include "../../core/include/fpdfapi/fpdf_module.h" |
8 #include "../../core/include/fxcodec/fx_codec.h" | 8 #include "../../core/include/fxcodec/fx_codec.h" |
9 #include "../../core/include/fxcrt/fx_safe_types.h" | 9 #include "../../core/include/fxcrt/fx_safe_types.h" |
10 #include "../../public/fpdf_ext.h" | 10 #include "../../public/fpdf_ext.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 break; | 230 break; |
231 } | 231 } |
232 SetLastError(err_code); | 232 SetLastError(err_code); |
233 } | 233 } |
234 | 234 |
235 DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, | 235 DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, |
236 FPDF_BOOL enable) { | 236 FPDF_BOOL enable) { |
237 return FSDK_SetSandBoxPolicy(policy, enable); | 237 return FSDK_SetSandBoxPolicy(policy, enable); |
238 } | 238 } |
239 | 239 |
240 | |
241 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, | 240 DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, |
242 FPDF_BYTESTRING password) { | 241 FPDF_BYTESTRING password) { |
243 // NOTE: the creation of the file needs to be by the embedder on the | 242 // NOTE: the creation of the file needs to be by the embedder on the |
244 // other side of this API. | 243 // other side of this API. |
245 IFX_FileRead* pFileAccess = FX_CreateFileRead((const FX_CHAR*)file_path); | 244 IFX_FileRead* pFileAccess = FX_CreateFileRead((const FX_CHAR*)file_path); |
246 if (!pFileAccess) { | 245 if (!pFileAccess) { |
247 return nullptr; | 246 return nullptr; |
248 } | 247 } |
249 | 248 |
250 CPDF_Parser* pParser = new CPDF_Parser; | 249 CPDF_Parser* pParser = new CPDF_Parser; |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 if (!buffer) { | 1092 if (!buffer) { |
1094 *buflen = len; | 1093 *buflen = len; |
1095 } else if (*buflen >= len) { | 1094 } else if (*buflen >= len) { |
1096 memcpy(buffer, utf16Name.c_str(), len); | 1095 memcpy(buffer, utf16Name.c_str(), len); |
1097 *buflen = len; | 1096 *buflen = len; |
1098 } else { | 1097 } else { |
1099 *buflen = -1; | 1098 *buflen = -1; |
1100 } | 1099 } |
1101 return (FPDF_DEST)pDestObj; | 1100 return (FPDF_DEST)pDestObj; |
1102 } | 1101 } |
OLD | NEW |