| 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 "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 | 1037 |
| 1038 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 1038 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| 1039 if (!pDoc) | 1039 if (!pDoc) |
| 1040 return nullptr; | 1040 return nullptr; |
| 1041 | 1041 |
| 1042 CPDF_NameTree name_tree(pDoc, "Dests"); | 1042 CPDF_NameTree name_tree(pDoc, "Dests"); |
| 1043 return name_tree.LookupNamedDest(pDoc, name); | 1043 return name_tree.LookupNamedDest(pDoc, name); |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 #ifdef PDF_ENABLE_XFA | 1046 #ifdef PDF_ENABLE_XFA |
| 1047 FPDF_RESULT FPDF_BStr_Init(FPDF_BSTR* str) { | 1047 DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str) { |
| 1048 if (!str) | 1048 if (!str) |
| 1049 return -1; | 1049 return -1; |
| 1050 | 1050 |
| 1051 FXSYS_memset(str, 0, sizeof(FPDF_BSTR)); | 1051 FXSYS_memset(str, 0, sizeof(FPDF_BSTR)); |
| 1052 return 0; | 1052 return 0; |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 FPDF_RESULT FPDF_BStr_Set(FPDF_BSTR* str, FPDF_LPCSTR bstr, int length) { | 1055 DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, |
| 1056 FPDF_LPCSTR bstr, |
| 1057 int length) { |
| 1056 if (!str) | 1058 if (!str) |
| 1057 return -1; | 1059 return -1; |
| 1058 if (!bstr || !length) | 1060 if (!bstr || !length) |
| 1059 return -1; | 1061 return -1; |
| 1060 if (length == -1) | 1062 if (length == -1) |
| 1061 length = FXSYS_strlen(bstr); | 1063 length = FXSYS_strlen(bstr); |
| 1062 | 1064 |
| 1063 if (length == 0) { | 1065 if (length == 0) { |
| 1064 if (str->str) { | 1066 if (str->str) { |
| 1065 FX_Free(str->str); | 1067 FX_Free(str->str); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1077 str->str[length] = 0; | 1079 str->str[length] = 0; |
| 1078 if (str->str == NULL) | 1080 if (str->str == NULL) |
| 1079 return -1; | 1081 return -1; |
| 1080 | 1082 |
| 1081 FXSYS_memcpy(str->str, bstr, length); | 1083 FXSYS_memcpy(str->str, bstr, length); |
| 1082 str->len = length; | 1084 str->len = length; |
| 1083 | 1085 |
| 1084 return 0; | 1086 return 0; |
| 1085 } | 1087 } |
| 1086 | 1088 |
| 1087 FPDF_RESULT FPDF_BStr_Clear(FPDF_BSTR* str) { | 1089 DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str) { |
| 1088 if (!str) | 1090 if (!str) |
| 1089 return -1; | 1091 return -1; |
| 1090 | 1092 |
| 1091 if (str->str) { | 1093 if (str->str) { |
| 1092 FX_Free(str->str); | 1094 FX_Free(str->str); |
| 1093 str->str = NULL; | 1095 str->str = NULL; |
| 1094 } | 1096 } |
| 1095 str->len = 0; | 1097 str->len = 0; |
| 1096 return 0; | 1098 return 0; |
| 1097 } | 1099 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 if (!buffer) { | 1161 if (!buffer) { |
| 1160 *buflen = len; | 1162 *buflen = len; |
| 1161 } else if (*buflen >= len) { | 1163 } else if (*buflen >= len) { |
| 1162 memcpy(buffer, utf16Name.c_str(), len); | 1164 memcpy(buffer, utf16Name.c_str(), len); |
| 1163 *buflen = len; | 1165 *buflen = len; |
| 1164 } else { | 1166 } else { |
| 1165 *buflen = -1; | 1167 *buflen = -1; |
| 1166 } | 1168 } |
| 1167 return (FPDF_DEST)pDestObj; | 1169 return (FPDF_DEST)pDestObj; |
| 1168 } | 1170 } |
| OLD | NEW |