Changeset 35567 in vbox for trunk/src/VBox/Runtime/common/string
- Timestamp:
- Jan 14, 2011 2:16:45 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 69451
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/ministring.cpp
r35128 r35567 224 224 } 225 225 226 MiniString MiniString::substr (size_t pos /*= 0*/, size_t n /*= npos*/)226 MiniString MiniString::substrCP(size_t pos /*= 0*/, size_t n /*= npos*/) 227 227 const 228 228 { … … 256 256 257 257 size_t cbCopy = psz - pFirst; 258 ret.reserve(cbCopy + 1); // may throw bad_alloc 259 #ifndef RT_EXCEPTIONS_ENABLED 260 AssertRelease(capacity() >= cbCopy + 1); 261 #endif 262 memcpy(ret.m_psz, pFirst, cbCopy); 263 ret.m_cch = cbCopy; 264 ret.m_psz[cbCopy] = '\0'; 258 if (cbCopy) 259 { 260 ret.reserve(cbCopy + 1); // may throw bad_alloc 261 #ifndef RT_EXCEPTIONS_ENABLED 262 AssertRelease(capacity() >= cbCopy + 1); 263 #endif 264 memcpy(ret.m_psz, pFirst, cbCopy); 265 ret.m_cch = cbCopy; 266 ret.m_psz[cbCopy] = '\0'; 267 } 265 268 } 266 269 }
Note:
See TracChangeset
for help on using the changeset viewer.