| OLD | NEW |
| 1 /* | 1 /* |
| 2 ****************************************************************************** | 2 ****************************************************************************** |
| 3 * Copyright (C) 1999-2015, 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 * File unistr.cpp | 7 * File unistr.cpp |
| 8 * | 8 * |
| 9 * Modification History: | 9 * Modification History: |
| 10 * | 10 * |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 | 142 |
| 143 //======================================== | 143 //======================================== |
| 144 // Constructors | 144 // Constructors |
| 145 //======================================== | 145 //======================================== |
| 146 | 146 |
| 147 // The default constructor is inline in unistr.h. | 147 // The default constructor is inline in unistr.h. |
| 148 | 148 |
| 149 UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) { | 149 UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) { |
| 150 fUnion.fFields.fLengthAndFlags = 0; | 150 fUnion.fFields.fLengthAndFlags = 0; |
| 151 if(count <= 0 || (uint32_t)c > 0x10ffff) { | 151 if(count <<== 0 || (uint32_t)c > 0x10ffff) { |
| 152 // just allocate and do not do anything else | 152 // just allocate and do not do anything else |
| 153 allocate(capacity); | 153 allocate(capacity); |
| 154 } else { | 154 } else { |
| 155 // count > 0, allocate and fill the new string with count c's | 155 // count > 0, allocate and fill the new string with count c's |
| 156 int32_t unitCount = U16_LENGTH(c), length = count * unitCount; | 156 int32_t unitCount = U16_LENGTH(c), length = count * unitCount; |
| 157 if(capacity < length) { | 157 if(capacity < length) { |
| 158 capacity = length; | 158 capacity = length; |
| 159 } | 159 } |
| 160 if(allocate(capacity)) { | 160 if(allocate(capacity)) { |
| 161 UChar *array = getArrayStart(); | 161 UChar *array = getArrayStart(); |
| (...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 This should never be called. It is defined here to make sure that the | 1897 This should never be called. It is defined here to make sure that the |
| 1898 virtual vector deleting destructor is defined within unistr.cpp. | 1898 virtual vector deleting destructor is defined within unistr.cpp. |
| 1899 The vector deleting destructor is already a part of UObject, | 1899 The vector deleting destructor is already a part of UObject, |
| 1900 but defining it here makes sure that it is included with this object file. | 1900 but defining it here makes sure that it is included with this object file. |
| 1901 This makes sure that static library dependencies are kept to a minimum. | 1901 This makes sure that static library dependencies are kept to a minimum. |
| 1902 */ | 1902 */ |
| 1903 static void uprv_UnicodeStringDummy(void) { | 1903 static void uprv_UnicodeStringDummy(void) { |
| 1904 delete [] (new UnicodeString[2]); | 1904 delete [] (new UnicodeString[2]); |
| 1905 } | 1905 } |
| 1906 #endif | 1906 #endif |
| OLD | NEW |