OLD | NEW |
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 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 return *(TYPE*)NULL; | 308 return *(TYPE*)NULL; |
309 } | 309 } |
310 return ((TYPE*)m_pData)[nIndex]; | 310 return ((TYPE*)m_pData)[nIndex]; |
311 } | 311 } |
312 | 312 |
313 const TYPE* GetData() const { return (const TYPE*)m_pData; } | 313 const TYPE* GetData() const { return (const TYPE*)m_pData; } |
314 | 314 |
315 TYPE* GetData() { return (TYPE*)m_pData; } | 315 TYPE* GetData() { return (TYPE*)m_pData; } |
316 | 316 |
317 FX_BOOL SetAtGrow(int nIndex, TYPE newElement) { | 317 FX_BOOL SetAtGrow(int nIndex, TYPE newElement) { |
318 if (nIndex < 0) { | 318 if (nIndex < 0) |
319 return FALSE; | 319 return FALSE; |
320 } | 320 |
321 if (nIndex >= m_nSize) | 321 if (nIndex >= m_nSize && !SetSize(nIndex + 1)) |
322 if (!SetSize(nIndex + 1)) { | 322 return FALSE; |
323 return FALSE; | 323 |
324 } | |
325 ((TYPE*)m_pData)[nIndex] = newElement; | 324 ((TYPE*)m_pData)[nIndex] = newElement; |
326 return TRUE; | 325 return TRUE; |
327 } | 326 } |
328 | 327 |
329 FX_BOOL Add(TYPE newElement) { | 328 FX_BOOL Add(TYPE newElement) { |
330 if (m_nSize < m_nMaxSize) { | 329 if (m_nSize < m_nMaxSize) { |
331 m_nSize++; | 330 m_nSize++; |
332 } else if (!SetSize(m_nSize + 1)) { | 331 } else if (!SetSize(m_nSize + 1)) { |
333 return FALSE; | 332 return FALSE; |
334 } | 333 } |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 FX_FLOAT c; | 1157 FX_FLOAT c; |
1159 FX_FLOAT d; | 1158 FX_FLOAT d; |
1160 FX_FLOAT e; | 1159 FX_FLOAT e; |
1161 FX_FLOAT f; | 1160 FX_FLOAT f; |
1162 FX_FLOAT g; | 1161 FX_FLOAT g; |
1163 FX_FLOAT h; | 1162 FX_FLOAT h; |
1164 FX_FLOAT i; | 1163 FX_FLOAT i; |
1165 }; | 1164 }; |
1166 | 1165 |
1167 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ | 1166 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ |
OLD | NEW |