| 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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 return nullptr; | 1103 return nullptr; |
| 1104 } | 1104 } |
| 1105 if (!pDestObj->IsArray()) | 1105 if (!pDestObj->IsArray()) |
| 1106 return nullptr; | 1106 return nullptr; |
| 1107 | 1107 |
| 1108 CFX_WideString wsName = PDF_DecodeText(bsName); | 1108 CFX_WideString wsName = PDF_DecodeText(bsName); |
| 1109 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); | 1109 CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); |
| 1110 int len = utf16Name.GetLength(); | 1110 int len = utf16Name.GetLength(); |
| 1111 if (!buffer) { | 1111 if (!buffer) { |
| 1112 *buflen = len; | 1112 *buflen = len; |
| 1113 } else if (*buflen >= len) { | 1113 } else if (len <= *buflen) { |
| 1114 memcpy(buffer, utf16Name.c_str(), len); | 1114 memcpy(buffer, utf16Name.c_str(), len); |
| 1115 *buflen = len; | 1115 *buflen = len; |
| 1116 } else { | 1116 } else { |
| 1117 *buflen = -1; | 1117 *buflen = -1; |
| 1118 } | 1118 } |
| 1119 return (FPDF_DEST)pDestObj; | 1119 return (FPDF_DEST)pDestObj; |
| 1120 } | 1120 } |
| OLD | NEW |