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

Side by Side Diff: core/src/fxge/agg/agg23/agg_array.h

Issue 1145843005: Revert "Remove FX_Alloc() null checks now that it can't return NULL." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 7 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/fxcrt/xml_int.h ('k') | core/src/fxge/agg/agg23/fx_agg_path_storage.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 1
2 //---------------------------------------------------------------------------- 2 //----------------------------------------------------------------------------
3 // Anti-Grain Geometry - Version 2.3 3 // Anti-Grain Geometry - Version 2.3
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) 4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5 // 5 //
6 // Permission to copy, use, modify, sell and distribute this software 6 // Permission to copy, use, modify, sell and distribute this software
7 // is granted provided this copyright notice appears in all copies. 7 // is granted provided this copyright notice appears in all copies.
8 // This software is provided "as is" without express or implied 8 // This software is provided "as is" without express or implied
9 // warranty, and with no claim as to its suitability for any purpose. 9 // warranty, and with no claim as to its suitability for any purpose.
10 // 10 //
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void pod_array<T>::capacity(unsigned cap, unsigned extra_tail) 104 void pod_array<T>::capacity(unsigned cap, unsigned extra_tail)
105 { 105 {
106 m_size = 0; 106 m_size = 0;
107 unsigned full_cap = cap + extra_tail; 107 unsigned full_cap = cap + extra_tail;
108 if(full_cap < cap) { 108 if(full_cap < cap) {
109 FX_Free(m_array); 109 FX_Free(m_array);
110 m_array = 0; 110 m_array = 0;
111 m_capacity = 0; 111 m_capacity = 0;
112 } else if(full_cap > m_capacity) { 112 } else if(full_cap > m_capacity) {
113 FX_Free(m_array); 113 FX_Free(m_array);
114 m_array = 0;
115 m_capacity = 0;
114 m_array = FX_Alloc(T, full_cap); 116 m_array = FX_Alloc(T, full_cap);
115 m_capacity = full_cap; 117 if (m_array) {
118 m_capacity = full_cap;
119 }
116 } 120 }
117 } 121 }
118 template<class T> 122 template<class T>
119 void pod_array<T>::allocate(unsigned size, unsigned extra_tail) 123 void pod_array<T>::allocate(unsigned size, unsigned extra_tail)
120 { 124 {
121 capacity(size, extra_tail); 125 capacity(size, extra_tail);
122 m_size = size; 126 m_size = size;
123 } 127 }
124 template<class T> 128 template<class T>
125 void pod_array<T>::resize(unsigned new_size) 129 void pod_array<T>::resize(unsigned new_size)
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 quick_sort_threshold = 9 501 quick_sort_threshold = 9
498 }; 502 };
499 template<class T> inline void swap_elements(T& a, T& b) 503 template<class T> inline void swap_elements(T& a, T& b)
500 { 504 {
501 T temp = a; 505 T temp = a;
502 a = b; 506 a = b;
503 b = temp; 507 b = temp;
504 } 508 }
505 } 509 }
506 #endif 510 #endif
OLDNEW
« no previous file with comments | « core/src/fxcrt/xml_int.h ('k') | core/src/fxge/agg/agg23/fx_agg_path_storage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698