| 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/fsdk_mgr.h" | 8 #include "../include/fsdk_mgr.h" |
| 9 #include "../include/fpdfview.h" | 9 #include "../include/fpdfview.h" |
| 10 #include "../include/fsdk_rendercontext.h" | 10 #include "../include/fsdk_rendercontext.h" |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 while (pos) { | 1041 while (pos) { |
| 1042 pDestObj = pDest->GetNextElement(pos, bsName); | 1042 pDestObj = pDest->GetNextElement(pos, bsName); |
| 1043 if (!pDestObj) continue; | 1043 if (!pDestObj) continue; |
| 1044 if (i == index) break; | 1044 if (i == index) break; |
| 1045 i++; | 1045 i++; |
| 1046 } | 1046 } |
| 1047 } else { | 1047 } else { |
| 1048 pDestObj = nameTree.LookupValue(index, bsName); | 1048 pDestObj = nameTree.LookupValue(index, bsName); |
| 1049 } | 1049 } |
| 1050 if (!pDestObj) return NULL; | 1050 if (!pDestObj) return NULL; |
| 1051 if (pDestObj->GetType() == PDFOBJ_DICTIONARY) | 1051 if (pDestObj->GetType() == PDFOBJ_DICTIONARY) { |
| 1052 pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D")); | 1052 pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D")); |
| 1053 if (!pDestObj) return NULL; |
| 1054 } |
| 1053 if (pDestObj->GetType() != PDFOBJ_ARRAY) return NULL; | 1055 if (pDestObj->GetType() != PDFOBJ_ARRAY) return NULL; |
| 1054 CFX_WideString wsName = PDF_DecodeText(bsName); | 1056 CFX_WideString wsName = PDF_DecodeText(bsName); |
| 1055 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); | 1057 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); |
| 1056 unsigned int len = utf16Name.GetLength(); | 1058 unsigned int len = utf16Name.GetLength(); |
| 1057 if (!buffer) { | 1059 if (!buffer) { |
| 1058 buflen = len; | 1060 buflen = len; |
| 1059 } else if (buflen >= len) { | 1061 } else if (buflen >= len) { |
| 1060 memcpy(buffer, utf16Name.c_str(), len); | 1062 memcpy(buffer, utf16Name.c_str(), len); |
| 1063 buflen = len; |
| 1061 } else { | 1064 } else { |
| 1062 buflen = -1; | 1065 buflen = -1; |
| 1063 } | 1066 } |
| 1064 return (FPDF_DEST)pDestObj; | 1067 return (FPDF_DEST)pDestObj; |
| 1065 } | 1068 } |
| OLD | NEW |