OLD | NEW |
1 /* | 1 /* |
2 ****************************************************************************** | 2 ****************************************************************************** |
3 * Copyright (C) 1999-2010, International Business Machines Corporation and * | 3 * Copyright (C) 1999-2015, International Business Machines Corporation and |
4 * others. All Rights Reserved. * | 4 * others. All Rights Reserved. |
5 ****************************************************************************** | 5 ****************************************************************************** |
6 */ | 6 */ |
7 | 7 |
8 #include "uvectr64.h" | 8 #include "uvectr64.h" |
9 #include "cmemory.h" | 9 #include "cmemory.h" |
10 #include "putilimp.h" | 10 #include "putilimp.h" |
11 | 11 |
12 U_NAMESPACE_BEGIN | 12 U_NAMESPACE_BEGIN |
13 | 13 |
14 #define DEFAULT_CAPACITY 8 | 14 #define DEFAULT_CAPACITY 8 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ++count; | 107 ++count; |
108 } | 108 } |
109 /* else index out of range */ | 109 /* else index out of range */ |
110 } | 110 } |
111 | 111 |
112 void UVector64::removeAllElements(void) { | 112 void UVector64::removeAllElements(void) { |
113 count = 0; | 113 count = 0; |
114 } | 114 } |
115 | 115 |
116 UBool UVector64::expandCapacity(int32_t minimumCapacity, UErrorCode &status) { | 116 UBool UVector64::expandCapacity(int32_t minimumCapacity, UErrorCode &status) { |
| 117 if (U_FAILURE(status)) { |
| 118 return FALSE; |
| 119 } |
117 if (minimumCapacity < 0) { | 120 if (minimumCapacity < 0) { |
118 status = U_ILLEGAL_ARGUMENT_ERROR; | 121 status = U_ILLEGAL_ARGUMENT_ERROR; |
119 return FALSE; | 122 return FALSE; |
120 } | 123 } |
121 if (capacity >= minimumCapacity) { | 124 if (capacity >= minimumCapacity) { |
122 return TRUE; | 125 return TRUE; |
123 } | 126 } |
124 if (maxCapacity>0 && minimumCapacity>maxCapacity) { | 127 if (maxCapacity>0 && minimumCapacity>maxCapacity) { |
125 status = U_BUFFER_OVERFLOW_ERROR; | 128 status = U_BUFFER_OVERFLOW_ERROR; |
126 return FALSE; | 129 return FALSE; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 203 } |
201 for (i=count; i<newSize; ++i) { | 204 for (i=count; i<newSize; ++i) { |
202 elements[i] = 0; | 205 elements[i] = 0; |
203 } | 206 } |
204 } | 207 } |
205 count = newSize; | 208 count = newSize; |
206 } | 209 } |
207 | 210 |
208 U_NAMESPACE_END | 211 U_NAMESPACE_END |
209 | 212 |
OLD | NEW |