| 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 #include <utility> | 10 #include <utility> |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 | 1097 |
| 1098 pdfium::base::CheckedNumeric<int> checked_count = count; | 1098 pdfium::base::CheckedNumeric<int> checked_count = count; |
| 1099 checked_count += pDest->GetCount(); | 1099 checked_count += pDest->GetCount(); |
| 1100 if (!checked_count.IsValid() || index >= checked_count.ValueOrDie()) | 1100 if (!checked_count.IsValid() || index >= checked_count.ValueOrDie()) |
| 1101 return nullptr; | 1101 return nullptr; |
| 1102 | 1102 |
| 1103 index -= count; | 1103 index -= count; |
| 1104 int i = 0; | 1104 int i = 0; |
| 1105 for (const auto& it : *pDest) { | 1105 for (const auto& it : *pDest) { |
| 1106 bsName = it.first; | 1106 bsName = it.first; |
| 1107 pDestObj = it.second.get(); | 1107 pDestObj = it.second; |
| 1108 if (!pDestObj) | 1108 if (!pDestObj) |
| 1109 continue; | 1109 continue; |
| 1110 if (i == index) | 1110 if (i == index) |
| 1111 break; | 1111 break; |
| 1112 i++; | 1112 i++; |
| 1113 } | 1113 } |
| 1114 } else { | 1114 } else { |
| 1115 pDestObj = nameTree.LookupValue(index, bsName); | 1115 pDestObj = nameTree.LookupValue(index, bsName); |
| 1116 } | 1116 } |
| 1117 if (!pDestObj) | 1117 if (!pDestObj) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1130 if (!buffer) { | 1130 if (!buffer) { |
| 1131 *buflen = len; | 1131 *buflen = len; |
| 1132 } else if (*buflen >= len) { | 1132 } else if (*buflen >= len) { |
| 1133 memcpy(buffer, utf16Name.c_str(), len); | 1133 memcpy(buffer, utf16Name.c_str(), len); |
| 1134 *buflen = len; | 1134 *buflen = len; |
| 1135 } else { | 1135 } else { |
| 1136 *buflen = -1; | 1136 *buflen = -1; |
| 1137 } | 1137 } |
| 1138 return (FPDF_DEST)pDestObj; | 1138 return (FPDF_DEST)pDestObj; |
| 1139 } | 1139 } |
| OLD | NEW |