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/fxcodec/fx_codec.h" | 7 #include "../../core/include/fxcodec/fx_codec.h" |
8 #include "../../core/include/fxcrt/fx_safe_types.h" | 8 #include "../../core/include/fxcrt/fx_safe_types.h" |
9 #include "../../public/fpdf_ext.h" | 9 #include "../../public/fpdf_ext.h" |
10 #include "../../public/fpdf_progressive.h" | 10 #include "../../public/fpdf_progressive.h" |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 if (!pDestObj) | 874 if (!pDestObj) |
875 continue; | 875 continue; |
876 if (i == index) | 876 if (i == index) |
877 break; | 877 break; |
878 i++; | 878 i++; |
879 } | 879 } |
880 } else { | 880 } else { |
881 pDestObj = nameTree.LookupValue(index, bsName); | 881 pDestObj = nameTree.LookupValue(index, bsName); |
882 } | 882 } |
883 if (!pDestObj) | 883 if (!pDestObj) |
884 return NULL; | 884 return nullptr; |
885 if (CPDF_Dictionary* pDict = pDestObj->AsDictionary()) { | 885 if (CPDF_Dictionary* pDict = pDestObj->AsDictionary()) { |
886 pDestObj = pDict->GetArray(FX_BSTRC("D")); | 886 pDestObj = pDict->GetArray(FX_BSTRC("D")); |
887 if (!pDestObj) | 887 if (!pDestObj) |
888 return NULL; | 888 return nullptr; |
889 } | 889 } |
890 if (pDestObj->GetType() != PDFOBJ_ARRAY) | 890 if (!pDestObj->IsArray()) |
891 return NULL; | 891 return nullptr; |
| 892 |
892 CFX_WideString wsName = PDF_DecodeText(bsName); | 893 CFX_WideString wsName = PDF_DecodeText(bsName); |
893 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); | 894 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); |
894 unsigned int len = utf16Name.GetLength(); | 895 unsigned int len = utf16Name.GetLength(); |
895 if (!buffer) { | 896 if (!buffer) { |
896 *buflen = len; | 897 *buflen = len; |
897 } else if (*buflen >= len) { | 898 } else if (*buflen >= len) { |
898 memcpy(buffer, utf16Name.c_str(), len); | 899 memcpy(buffer, utf16Name.c_str(), len); |
899 *buflen = len; | 900 *buflen = len; |
900 } else { | 901 } else { |
901 *buflen = -1; | 902 *buflen = -1; |
902 } | 903 } |
903 return (FPDF_DEST)pDestObj; | 904 return (FPDF_DEST)pDestObj; |
904 } | 905 } |
OLD | NEW |