bool PyUnicodeUCS2::set( const wchar_t* str, size_t len ) { if (str == NULL || len == 0) return false; if (resize(len) == false) return false; ASCENT_MEMCPY(mStr, str, len * 2); mStr[len] = '\0'; return true; }
bool PyString::set(const char* str, size_t len) { if (str == NULL || len == 0) return false; if (mStr != NULL) mStr = static_cast<char*>(ASCENT_REALLOC(mStr, len+1)); else mStr = static_cast<char*>(ASCENT_MALLOC(len+1)); mStrLen = len; if (mStr == NULL) return false; ASCENT_MEMCPY(mStr, str, mStrLen); mStr[mStrLen] = '\0'; return true; }