| 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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 if (!pDestObj) | 1034 if (!pDestObj) |
| 1035 continue; | 1035 continue; |
| 1036 if (i == index) | 1036 if (i == index) |
| 1037 break; | 1037 break; |
| 1038 i++; | 1038 i++; |
| 1039 } | 1039 } |
| 1040 } else { | 1040 } else { |
| 1041 pDestObj = nameTree.LookupValue(index, bsName); | 1041 pDestObj = nameTree.LookupValue(index, bsName); |
| 1042 } | 1042 } |
| 1043 if (!pDestObj) | 1043 if (!pDestObj) |
| 1044 return NULL; | 1044 return nullptr; |
| 1045 if (CPDF_Dictionary* pDict = pDestObj->AsDictionary()) { | 1045 if (CPDF_Dictionary* pDict = pDestObj->AsDictionary()) { |
| 1046 pDestObj = pDict->GetArray(FX_BSTRC("D")); | 1046 pDestObj = pDict->GetArray(FX_BSTRC("D")); |
| 1047 if (!pDestObj) | 1047 if (!pDestObj) |
| 1048 return NULL; | 1048 return nullptr; |
| 1049 } | 1049 } |
| 1050 if (pDestObj->GetType() != PDFOBJ_ARRAY) | 1050 if (!pDestObj->IsArray()) |
| 1051 return NULL; | 1051 return nullptr; |
| 1052 |
| 1052 CFX_WideString wsName = PDF_DecodeText(bsName); | 1053 CFX_WideString wsName = PDF_DecodeText(bsName); |
| 1053 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); | 1054 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); |
| 1054 unsigned int len = utf16Name.GetLength(); | 1055 unsigned int len = utf16Name.GetLength(); |
| 1055 if (!buffer) { | 1056 if (!buffer) { |
| 1056 *buflen = len; | 1057 *buflen = len; |
| 1057 } else if (*buflen >= len) { | 1058 } else if (*buflen >= len) { |
| 1058 memcpy(buffer, utf16Name.c_str(), len); | 1059 memcpy(buffer, utf16Name.c_str(), len); |
| 1059 *buflen = len; | 1060 *buflen = len; |
| 1060 } else { | 1061 } else { |
| 1061 *buflen = -1; | 1062 *buflen = -1; |
| 1062 } | 1063 } |
| 1063 return (FPDF_DEST)pDestObj; | 1064 return (FPDF_DEST)pDestObj; |
| 1064 } | 1065 } |
| OLD | NEW |