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

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

Issue 1720043003: Remove foo != NULL outside of xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 10 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/lgif/fx_gif.cpp ('k') | fpdfsdk/src/formfiller/FFL_CBA_Fontmap.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 "core/include/fxcrt/fx_basic.h" 7 #include "core/include/fxcrt/fx_basic.h"
8 #include "core/src/fxcrt/plex.h" 8 #include "core/src/fxcrt/plex.h"
9 9
10 CFX_MapPtrToPtr::CFX_MapPtrToPtr(int nBlockSize) 10 CFX_MapPtrToPtr::CFX_MapPtrToPtr(int nBlockSize)
(...skipping 21 matching lines...) Expand all
32 return ((FX_DWORD)(uintptr_t)key) >> 4; 32 return ((FX_DWORD)(uintptr_t)key) >> 4;
33 } 33 }
34 void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, 34 void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition,
35 void*& rKey, 35 void*& rKey,
36 void*& rValue) const { 36 void*& rValue) const {
37 ASSERT(m_pHashTable); 37 ASSERT(m_pHashTable);
38 CAssoc* pAssocRet = (CAssoc*)rNextPosition; 38 CAssoc* pAssocRet = (CAssoc*)rNextPosition;
39 ASSERT(pAssocRet); 39 ASSERT(pAssocRet);
40 if (pAssocRet == (CAssoc*)-1) { 40 if (pAssocRet == (CAssoc*)-1) {
41 for (FX_DWORD nBucket = 0; nBucket < m_nHashTableSize; nBucket++) { 41 for (FX_DWORD nBucket = 0; nBucket < m_nHashTableSize; nBucket++) {
42 if ((pAssocRet = m_pHashTable[nBucket]) != NULL) 42 if ((pAssocRet = m_pHashTable[nBucket]))
43 break; 43 break;
44 } 44 }
45 ASSERT(pAssocRet); 45 ASSERT(pAssocRet);
46 } 46 }
47 CAssoc* pAssocNext; 47 CAssoc* pAssocNext;
48 if ((pAssocNext = pAssocRet->pNext) == NULL) { 48 if ((pAssocNext = pAssocRet->pNext) == NULL) {
49 for (FX_DWORD nBucket = (HashKey(pAssocRet->key) % m_nHashTableSize) + 1; 49 for (FX_DWORD nBucket = (HashKey(pAssocRet->key) % m_nHashTableSize) + 1;
50 nBucket < m_nHashTableSize; nBucket++) { 50 nBucket < m_nHashTableSize; nBucket++) {
51 if ((pAssocNext = m_pHashTable[nBucket]) != NULL) { 51 if ((pAssocNext = m_pHashTable[nBucket])) {
52 break; 52 break;
53 } 53 }
54 } 54 }
55 } 55 }
56 rNextPosition = (FX_POSITION)pAssocNext; 56 rNextPosition = (FX_POSITION)pAssocNext;
57 rKey = pAssocRet->key; 57 rKey = pAssocRet->key;
58 rValue = pAssocRet->value; 58 rValue = pAssocRet->value;
59 } 59 }
60 FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const { 60 FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const {
61 FX_DWORD nHash; 61 FX_DWORD nHash;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 void CFX_MapPtrToPtr::FreeAssoc(CFX_MapPtrToPtr::CAssoc* pAssoc) { 151 void CFX_MapPtrToPtr::FreeAssoc(CFX_MapPtrToPtr::CAssoc* pAssoc) {
152 pAssoc->pNext = m_pFreeList; 152 pAssoc->pNext = m_pFreeList;
153 m_pFreeList = pAssoc; 153 m_pFreeList = pAssoc;
154 m_nCount--; 154 m_nCount--;
155 ASSERT(m_nCount >= 0); 155 ASSERT(m_nCount >= 0);
156 if (m_nCount == 0) { 156 if (m_nCount == 0) {
157 RemoveAll(); 157 RemoveAll();
158 } 158 }
159 } 159 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/lgif/fx_gif.cpp ('k') | fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698