| 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_FXCRT_INCLUDE_FX_BASIC_H_ | 7 #ifndef CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
| 8 #define CORE_FXCRT_INCLUDE_FX_BASIC_H_ | 8 #define CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 int GetSize() const { return m_nSize; } | 270 int GetSize() const { return m_nSize; } |
| 271 | 271 |
| 272 int GetUpperBound() const { return m_nSize - 1; } | 272 int GetUpperBound() const { return m_nSize - 1; } |
| 273 | 273 |
| 274 FX_BOOL SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); } | 274 FX_BOOL SetSize(int nNewSize) { return CFX_BasicArray::SetSize(nNewSize); } |
| 275 | 275 |
| 276 void RemoveAll() { SetSize(0); } | 276 void RemoveAll() { SetSize(0); } |
| 277 | 277 |
| 278 const TYPE GetAt(int nIndex) const { | 278 const TYPE GetAt(int nIndex) const { |
| 279 if (nIndex < 0 || nIndex >= m_nSize) { | 279 if (nIndex < 0 || nIndex >= m_nSize) { |
| 280 return (const TYPE&)(*(volatile const TYPE*)NULL); | 280 IMMEDIATE_CRASH(); |
| 281 } | 281 } |
| 282 return ((const TYPE*)m_pData)[nIndex]; | 282 return ((const TYPE*)m_pData)[nIndex]; |
| 283 } | 283 } |
| 284 | 284 |
| 285 FX_BOOL SetAt(int nIndex, TYPE newElement) { | 285 FX_BOOL SetAt(int nIndex, TYPE newElement) { |
| 286 if (nIndex < 0 || nIndex >= m_nSize) { | 286 if (nIndex < 0 || nIndex >= m_nSize) { |
| 287 return FALSE; | 287 return FALSE; |
| 288 } | 288 } |
| 289 ((TYPE*)m_pData)[nIndex] = newElement; | 289 ((TYPE*)m_pData)[nIndex] = newElement; |
| 290 return TRUE; | 290 return TRUE; |
| 291 } | 291 } |
| 292 | 292 |
| 293 TYPE& ElementAt(int nIndex) { | 293 TYPE& ElementAt(int nIndex) { |
| 294 if (nIndex < 0 || nIndex >= m_nSize) { | 294 if (nIndex < 0 || nIndex >= m_nSize) { |
| 295 return *(TYPE*)NULL; | 295 IMMEDIATE_CRASH(); |
| 296 } | 296 } |
| 297 return ((TYPE*)m_pData)[nIndex]; | 297 return ((TYPE*)m_pData)[nIndex]; |
| 298 } | 298 } |
| 299 | 299 |
| 300 const TYPE* GetData() const { return (const TYPE*)m_pData; } | 300 const TYPE* GetData() const { return (const TYPE*)m_pData; } |
| 301 | 301 |
| 302 TYPE* GetData() { return (TYPE*)m_pData; } | 302 TYPE* GetData() { return (TYPE*)m_pData; } |
| 303 | 303 |
| 304 FX_BOOL SetAtGrow(int nIndex, TYPE newElement) { | 304 FX_BOOL SetAtGrow(int nIndex, TYPE newElement) { |
| 305 if (nIndex < 0) | 305 if (nIndex < 0) |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 FX_FLOAT c; | 1062 FX_FLOAT c; |
| 1063 FX_FLOAT d; | 1063 FX_FLOAT d; |
| 1064 FX_FLOAT e; | 1064 FX_FLOAT e; |
| 1065 FX_FLOAT f; | 1065 FX_FLOAT f; |
| 1066 FX_FLOAT g; | 1066 FX_FLOAT g; |
| 1067 FX_FLOAT h; | 1067 FX_FLOAT h; |
| 1068 FX_FLOAT i; | 1068 FX_FLOAT i; |
| 1069 }; | 1069 }; |
| 1070 | 1070 |
| 1071 #endif // CORE_FXCRT_INCLUDE_FX_BASIC_H_ | 1071 #endif // CORE_FXCRT_INCLUDE_FX_BASIC_H_ |
| OLD | NEW |