Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Side by Side Diff: fpdfsdk/fpdfview.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdfppo.cpp ('k') | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 1075
1076 pdfium::base::CheckedNumeric<int> checked_count = count; 1076 pdfium::base::CheckedNumeric<int> checked_count = count;
1077 checked_count += pDest->GetCount(); 1077 checked_count += pDest->GetCount();
1078 if (!checked_count.IsValid() || index >= checked_count.ValueOrDie()) 1078 if (!checked_count.IsValid() || index >= checked_count.ValueOrDie())
1079 return nullptr; 1079 return nullptr;
1080 1080
1081 index -= count; 1081 index -= count;
1082 int i = 0; 1082 int i = 0;
1083 for (const auto& it : *pDest) { 1083 for (const auto& it : *pDest) {
1084 bsName = it.first; 1084 bsName = it.first;
1085 pDestObj = it.second; 1085 pDestObj = it.second.get();
1086 if (!pDestObj) 1086 if (!pDestObj)
1087 continue; 1087 continue;
1088 if (i == index) 1088 if (i == index)
1089 break; 1089 break;
1090 i++; 1090 i++;
1091 } 1091 }
1092 } else { 1092 } else {
1093 pDestObj = nameTree.LookupValue(index, bsName); 1093 pDestObj = nameTree.LookupValue(index, bsName);
1094 } 1094 }
1095 if (!pDestObj) 1095 if (!pDestObj)
(...skipping 12 matching lines...) Expand all
1108 if (!buffer) { 1108 if (!buffer) {
1109 *buflen = len; 1109 *buflen = len;
1110 } else if (*buflen >= len) { 1110 } else if (*buflen >= len) {
1111 memcpy(buffer, utf16Name.c_str(), len); 1111 memcpy(buffer, utf16Name.c_str(), len);
1112 *buflen = len; 1112 *buflen = len;
1113 } else { 1113 } else {
1114 *buflen = -1; 1114 *buflen = -1;
1115 } 1115 }
1116 return (FPDF_DEST)pDestObj; 1116 return (FPDF_DEST)pDestObj;
1117 } 1117 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfppo.cpp ('k') | fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698