Forgotten with previous commit.

This commit is contained in:
jief 2020-04-15 19:03:38 +03:00
parent c405c4e4f3
commit c248c89a50
2 changed files with 9 additions and 6 deletions

View File

@ -97,7 +97,7 @@ wchar_t * XStringW::forgetDataWithoutFreeing()
return ret; return ret;
} }
const XStringW& XStringW::takeValueFrom(const wchar_t* S, xsize count) XStringW& XStringW::takeValueFrom(const wchar_t* S, xsize count)
{ {
if ( !S ) { if ( !S ) {
// DebugLog(2, "takeValueFrom(const wchar_t* S) called with NULL. Use setEmpty()\n"); // DebugLog(2, "takeValueFrom(const wchar_t* S) called with NULL. Use setEmpty()\n");
@ -110,14 +110,14 @@ const XStringW& XStringW::takeValueFrom(const wchar_t* S, xsize count)
return *this; return *this;
} }
const XStringW& XStringW::takeValueFrom(const wchar_t* S) XStringW& XStringW::takeValueFrom(const wchar_t* S)
{ {
if ( S ) return takeValueFrom(S, wcslen(S)); if ( S ) return takeValueFrom(S, wcslen(S));
Init(0); Init(0);
return *this; return *this;
} }
const XStringW& XStringW::takeValueFrom(const char* S) XStringW& XStringW::takeValueFrom(const char* S)
{ {
xsize newLen = utf8_string_wchar_count(S); xsize newLen = utf8_string_wchar_count(S);
Init(newLen); Init(newLen);
@ -523,21 +523,21 @@ const XStringW &XStringW::operator =(const XStringW &aString)
// //
//************************************************************************************************* //*************************************************************************************************
const XStringW &XStringW::operator +=(wchar_t aChar) XStringW &XStringW::operator +=(wchar_t aChar)
{ {
//TRACE("Operator +=wchar_t \n"); //TRACE("Operator +=wchar_t \n");
StrnCat(&aChar, 1); StrnCat(&aChar, 1);
return *this; return *this;
} }
const XStringW &XStringW::operator +=(const XStringW &aString) XStringW &XStringW::operator +=(const XStringW &aString)
{ {
//TRACE("Operator +=const XStringW&\n"); //TRACE("Operator +=const XStringW&\n");
StrnCat(aString.data(), aString.size()); StrnCat(aString.data(), aString.size());
return *this; return *this;
} }
const XStringW &XStringW::operator +=(const wchar_t *S) XStringW &XStringW::operator +=(const wchar_t *S)
{ {
//TRACE("operator +=const wchar_t *\n"); //TRACE("operator +=const wchar_t *\n");
StrCat(S); StrCat(S);

View File

@ -177,6 +177,9 @@ int XStringW_tests()
} }
} }
wchar_t* s = XStringW().takeValueFrom("aa").forgetDataWithoutFreeing();
if ( s != L"aa"_XSW ) return 102;
// XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot"); // XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot");
// for (UINTN Index = 0; Index < 20; Index++) { // for (UINTN Index = 0; Index < 20; Index++) {
// XStringW Name = CommonName + SPrintf("%lld", Index) + L".png"; // XStringW Name = CommonName + SPrintf("%lld", Index) + L".png";