- Timestamp:
- May 6, 2019 11:24:31 PM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/string.cpp
r76553 r78417 328 328 * @param a_pcszSrc The source string. 329 329 * @param a_offSrc Start offset to copy from. 330 * @param a_cchSrc The source string.330 * @param a_cchSrc How much to copy 331 331 * @returns S_OK or E_OUTOFMEMORY. 332 332 * … … 336 336 HRESULT Utf8Str::copyFromExNComRC(const char *a_pcszSrc, size_t a_offSrc, size_t a_cchSrc) 337 337 { 338 Assert(!a_cchSrc || !m_psz || (uintptr_t)&a_pcszSrc[a_offSrc] - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated); 338 339 cleanup(); 339 340 if (a_cchSrc) -
trunk/src/VBox/Runtime/common/string/ministring.cpp
r76553 r78417 56 56 RTCString &RTCString::assign(const RTCString &a_rSrc) 57 57 { 58 Assert(&a_rSrc != this); 58 59 size_t const cchSrc = a_rSrc.length(); 59 60 if (cchSrc > 0) … … 98 99 if (cchSrc) 99 100 { 101 Assert((uintptr_t)&a_pszSrc - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated); 102 100 103 reserve(cchSrc + 1); 101 104 memcpy(m_psz, a_pszSrc, cchSrc); … … 116 119 if (cchSrc) 117 120 { 121 Assert((uintptr_t)&a_pszSrc - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated); 122 118 123 int rc = reserveNoThrow(cchSrc + 1); 119 124 if (RT_SUCCESS(rc)) … … 176 181 { 177 182 a_cchSrc = RTStrNLen(a_pszSrc, a_cchSrc); 178 reserve(a_cchSrc + 1); 179 memcpy(m_psz, a_pszSrc, a_cchSrc); 180 m_psz[a_cchSrc] = '\0'; 181 m_cch = a_cchSrc; 182 } 183 else 184 setNull(); 185 return *this; 186 } 187 188 int RTCString::assignNoThrow(const char *a_pszSrc, size_t a_cchSrc) RT_NOEXCEPT 189 { 190 if (a_cchSrc) 191 { 192 a_cchSrc = RTStrNLen(a_pszSrc, a_cchSrc); 193 int rc = reserveNoThrow(a_cchSrc + 1); 194 if (RT_SUCCESS(rc)) 195 { 183 if (a_cchSrc) 184 { 185 Assert((uintptr_t)&a_pszSrc - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated); 186 187 reserve(a_cchSrc + 1); 196 188 memcpy(m_psz, a_pszSrc, a_cchSrc); 197 189 m_psz[a_cchSrc] = '\0'; 198 190 m_cch = a_cchSrc; 199 return VINF_SUCCESS; 200 } 201 return rc; 191 return *this; 192 } 193 } 194 setNull(); 195 return *this; 196 } 197 198 int RTCString::assignNoThrow(const char *a_pszSrc, size_t a_cchSrc) RT_NOEXCEPT 199 { 200 if (a_cchSrc) 201 { 202 a_cchSrc = RTStrNLen(a_pszSrc, a_cchSrc); 203 if (a_cchSrc) 204 { 205 Assert((uintptr_t)&a_pszSrc - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated); 206 207 int rc = reserveNoThrow(a_cchSrc + 1); 208 if (RT_SUCCESS(rc)) 209 { 210 memcpy(m_psz, a_pszSrc, a_cchSrc); 211 m_psz[a_cchSrc] = '\0'; 212 m_cch = a_cchSrc; 213 return VINF_SUCCESS; 214 } 215 return rc; 216 } 202 217 } 203 218 setNull(); … … 433 448 if (cchSrc) 434 449 { 450 Assert((uintptr_t)&pszSrc - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated); 451 435 452 size_t cchThis = length(); 436 453 size_t cchBoth = cchThis + cchSrc; … … 456 473 if (cchSrc) 457 474 { 475 Assert((uintptr_t)&pszSrc - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated); 476 458 477 size_t cchThis = length(); 459 478 size_t cchBoth = cchThis + cchSrc; … … 668 687 RTCString &RTCString::replaceWorker(size_t offStart, size_t cchLength, const char *pszSrc, size_t cchSrc) 669 688 { 689 Assert((uintptr_t)&pszSrc - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated || !cchSrc); 690 670 691 /* 671 692 * Our non-standard handling of out_of_range situations. … … 710 731 int RTCString::replaceWorkerNoThrow(size_t offStart, size_t cchLength, const char *pszSrc, size_t cchSrc) RT_NOEXCEPT 711 732 { 733 Assert((uintptr_t)&pszSrc - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated || !cchSrc); 734 712 735 /* 713 736 * Our non-standard handling of out_of_range situations.
Note:
See TracChangeset
for help on using the changeset viewer.