| 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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 if (!pDestObj) continue; | 843 if (!pDestObj) continue; |
| 844 if (i == index) break; | 844 if (i == index) break; |
| 845 i++; | 845 i++; |
| 846 } | 846 } |
| 847 } else { | 847 } else { |
| 848 pDestObj = nameTree.LookupValue(index, bsName); | 848 pDestObj = nameTree.LookupValue(index, bsName); |
| 849 } | 849 } |
| 850 if (!pDestObj) return NULL; | 850 if (!pDestObj) return NULL; |
| 851 if (pDestObj->GetType() == PDFOBJ_DICTIONARY) | 851 if (pDestObj->GetType() == PDFOBJ_DICTIONARY) |
| 852 pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D")); | 852 pDestObj = ((CPDF_Dictionary*)pDestObj)->GetArray(FX_BSTRC("D")); |
| 853 if (pDestObj->GetType() != PDFOBJ_ARRAY) return NULL; | 853 if (!pDestObj || pDestObj->GetType() != PDFOBJ_ARRAY) return NULL; |
| 854 CFX_WideString wsName = PDF_DecodeText(bsName); | 854 CFX_WideString wsName = PDF_DecodeText(bsName); |
| 855 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); | 855 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); |
| 856 unsigned int len = utf16Name.GetLength(); | 856 unsigned int len = utf16Name.GetLength(); |
| 857 if (!buffer) { | 857 if (!buffer) { |
| 858 buflen = len + 2; | 858 buflen = len + 2; |
| 859 } else if (buflen >= len + 2) { | 859 } else if (buflen >= len + 2) { |
| 860 memcpy(buffer, utf16Name.c_str(), len); | 860 memcpy(buffer, utf16Name.c_str(), len); |
| 861 ((FX_BYTE*)buffer)[len] = 0; | 861 ((FX_BYTE*)buffer)[len] = 0; |
| 862 ((FX_BYTE*)buffer)[len + 1] = 0; | 862 ((FX_BYTE*)buffer)[len + 1] = 0; |
| 863 } else { | 863 } else { |
| 864 len = -1; | 864 buflen = -1; |
| 865 } | 865 } |
| 866 return (FPDF_DEST)pDestObj; | 866 return (FPDF_DEST)pDestObj; |
| 867 } | 867 } |
| OLD | NEW |