MCPcopy Create free account
hub / github.com/cinience/RedisStudio / Assign

Method Assign

DuiLib/Utils/Utils.cpp:419–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417 }
418
419 void CDuiString::Assign(LPCTSTR pstr, int cchMax)
420 {
421 if( pstr == NULL ) pstr = _T("");
422 cchMax = (cchMax < 0 ? (int) _tcslen(pstr) : cchMax);
423 if( cchMax < MAX_LOCAL_STRING_LEN ) {
424 if( m_pstr != m_szBuffer ) {
425 free(m_pstr);
426 m_pstr = m_szBuffer;
427 }
428 }
429 else if( cchMax > GetLength() || m_pstr == m_szBuffer ) {
430 if( m_pstr == m_szBuffer ) m_pstr = NULL;
431 m_pstr = static_cast<LPTSTR>(realloc(m_pstr, (cchMax + 1) * sizeof(TCHAR)));
432 }
433 _tcsncpy(m_pstr, pstr, cchMax);
434 m_pstr[cchMax] = '\0';
435 }
436
437 bool CDuiString::IsEmpty() const
438 {

Callers 2

SetTextMethod · 0.80
DrawItemTextMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected