Return Type | Function name | Arguments |
---|---|---|
hzString& | hzString::ToLower | (void) |
Declared in file: hzString.h
Defined in file : hzString.cpp
Function Logic:
Function body:
hzString& hzString::ToLower (void) { _hzfunc("hzString::ToLower") ; _strItem* thisCtl ; _strItem* destCtl ; char* i ; char* j ; uint32_t count ; uint32_t destAddr ; bool bChange ; if (!m_addr) return *this ; thisCtl = (_strItem*) _strXlate(m_addr) ; bChange = false ; for (i = (char*) thisCtl->_data(), count = thisCtl->_getSize() ; count ; count--, i++) { if (*i >&eq; ''A''&&*i <&eq; ''Z'') { bChange = true ; break ; } } if (!bChange) return *this ; count = thisCtl->_getSize() ; destAddr = _strAlloc(count) ; destCtl = (_strItem*) _strXlate(destAddr) ; destCtl->_setSize(count) ; destCtl->m_copy = 1; i = (char*) thisCtl->_data() ; j = (char*) destCtl->_data() ; for (; count ; count--) *j++ = tolower(*i++) ; if (thisCtl->m_copy && thisCtl->m_copy < 50) { if (!_hzGlobal_MT) thisCtl->m_copy-- ; else if (__sync_add_and_fetch(&(thisCtl->m_copy), -1)== 0) if (!thisCtl->m_copy) _strFree(m_addr, thisCtl->_getSize()) ; } m_addr = destAddr ; return *this ; }