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

Side by Side Diff: fpdfsdk/fpdfview.cpp

Issue 2425783002: Revert "Make CPDF_Object containers hold objects via unique pointers." (Closed)
Patch Set: Created 4 years, 2 months 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/javascript/Document.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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfppo.cpp ('k') | fpdfsdk/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698