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

Side by Side Diff: core/src/fxcrt/fx_basic_array.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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 | « core/src/fxcodec/codec/fx_codec_jpeg.cpp ('k') | core/src/fxcrt/fx_basic_bstring.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 "../../include/fxcrt/fx_basic.h" 7 #include "../../include/fxcrt/fx_basic.h"
8 #include "../../../third_party/base/numerics/safe_math.h" 8 #include "../../../third_party/base/numerics/safe_math.h"
9 9
10 CFX_BasicArray::CFX_BasicArray(int unit_size) 10 CFX_BasicArray::CFX_BasicArray(int unit_size)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 pSpot[seg_index % m_IndexSize] = pSegment; 237 pSpot[seg_index % m_IndexSize] = pSegment;
238 m_DataSize ++; 238 m_DataSize ++;
239 return pSegment; 239 return pSegment;
240 } 240 }
241 void** CFX_BaseSegmentedArray::GetIndex(int seg_index) const 241 void** CFX_BaseSegmentedArray::GetIndex(int seg_index) const
242 { 242 {
243 ASSERT(m_IndexDepth != 0); 243 ASSERT(m_IndexDepth != 0);
244 if (m_IndexDepth == 1) { 244 if (m_IndexDepth == 1) {
245 return (void**)m_pIndex; 245 return (void**)m_pIndex;
246 } else if (m_IndexDepth == 2) { 246 }
247 if (m_IndexDepth == 2) {
247 return (void**)((void**)m_pIndex)[seg_index / m_IndexSize]; 248 return (void**)((void**)m_pIndex)[seg_index / m_IndexSize];
248 } 249 }
249 int tree_size = 1; 250 int tree_size = 1;
250 int i; 251 int i;
251 for (i = 1; i < m_IndexDepth; i ++) { 252 for (i = 1; i < m_IndexDepth; i ++) {
252 tree_size *= m_IndexSize; 253 tree_size *= m_IndexSize;
253 } 254 }
254 void** pSpot = (void**)m_pIndex; 255 void** pSpot = (void**)m_pIndex;
255 for (i = 1; i < m_IndexDepth; i ++) { 256 for (i = 1; i < m_IndexDepth; i ++) {
256 pSpot = (void**)pSpot[seg_index / tree_size]; 257 pSpot = (void**)pSpot[seg_index / tree_size];
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 FX_Free(pIndex[i % m_IndexSize]); 331 FX_Free(pIndex[i % m_IndexSize]);
331 pIndex[i % m_IndexSize] = NULL; 332 pIndex[i % m_IndexSize] = NULL;
332 } 333 }
333 } else { 334 } else {
334 FX_Free(m_pIndex); 335 FX_Free(m_pIndex);
335 m_pIndex = NULL; 336 m_pIndex = NULL;
336 } 337 }
337 } 338 }
338 m_DataSize -= count; 339 m_DataSize -= count;
339 } 340 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_jpeg.cpp ('k') | core/src/fxcrt/fx_basic_bstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698