1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Linux fix

This commit is contained in:
Brian Fiete 2024-03-16 21:17:53 -04:00
parent fe2244fb4b
commit 8f0ba26dd1
3 changed files with 12 additions and 3 deletions

View file

@ -680,7 +680,7 @@ void TestFailed(const Beefy::StringView& error, int stackOffset)
{ {
if (gClientPipe != NULL) if (gClientPipe != NULL)
{ {
Beefy::String errorString = error; Beefy::StringSimple errorString = error;
if (gTestBreakOnFailure) if (gTestBreakOnFailure)
{ {

View file

@ -7,7 +7,7 @@ Beefy::String bf::System::Object::GetTypeName()
String* strObj = BFRTCALLBACKS.String_Alloc(); String* strObj = BFRTCALLBACKS.String_Alloc();
Type* type = _GetType(); Type* type = _GetType();
BFRTCALLBACKS.Type_GetFullName(type, strObj); BFRTCALLBACKS.Type_GetFullName(type, strObj);
Beefy::String str = strObj->ToStringView(); Beefy::StringSimple str = strObj->ToStringView();
BFRTCALLBACKS.Object_Delete(strObj); BFRTCALLBACKS.Object_Delete(strObj);
return str; return str;
} }
@ -16,7 +16,7 @@ Beefy::String bf::System::Type::GetFullName()
{ {
String* strObj = BFRTCALLBACKS.String_Alloc(); String* strObj = BFRTCALLBACKS.String_Alloc();
BFRTCALLBACKS.Type_GetFullName(this, strObj); BFRTCALLBACKS.Type_GetFullName(this, strObj);
Beefy::String str = strObj->ToStringView(); Beefy::StringSimple str = strObj->ToStringView();
BFRTCALLBACKS.Object_Delete(strObj); BFRTCALLBACKS.Object_Delete(strObj);
return str; return str;
} }

View file

@ -1241,6 +1241,15 @@ public:
((char*)mPtr)[this->mLength] = 0; ((char*)mPtr)[this->mLength] = 0;
} }
StringSimple& operator=(const StringView& sv)
{
delete this->mPtr;
this->mPtr = new char[sv.mLength + 1];
this->mLength = sv.mLength;
memcpy((char*)this->mPtr, sv.mPtr, this->mLength);
((char*)this->mPtr)[this->mLength] = 0;
}
~StringSimple() ~StringSimple()
{ {
delete this->mPtr; delete this->mPtr;