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

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

Issue 1142713005: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix missing FX_Alloc2D, check overflow on add, remove unused enum. 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;
116 m_array = FX_Alloc(T, full_cap); 114 m_array = FX_Alloc(T, full_cap);
117 if (m_array) { 115 m_capacity = full_cap;
118 m_capacity = full_cap;
119 }
120 } 116 }
121 } 117 }
122 template<class T> 118 template<class T>
123 void pod_array<T>::allocate(unsigned size, unsigned extra_tail) 119 void pod_array<T>::allocate(unsigned size, unsigned extra_tail)
124 { 120 {
125 capacity(size, extra_tail); 121 capacity(size, extra_tail);
126 m_size = size; 122 m_size = size;
127 } 123 }
128 template<class T> 124 template<class T>
129 void pod_array<T>::resize(unsigned new_size) 125 void pod_array<T>::resize(unsigned new_size)
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 quick_sort_threshold = 9 497 quick_sort_threshold = 9
502 }; 498 };
503 template<class T> inline void swap_elements(T& a, T& b) 499 template<class T> inline void swap_elements(T& a, T& b)
504 { 500 {
505 T temp = a; 501 T temp = a;
506 a = b; 502 a = b;
507 b = temp; 503 b = temp;
508 } 504 }
509 } 505 }
510 #endif 506 #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