Brian Fiete hace 1 año
padre
commit
8f0ba26dd1
Se han modificado 3 ficheros con 12 adiciones y 3 borrados
  1. 1 1
      BeefRT/rt/Internal.cpp
  2. 2 2
      BeefRT/rt/Object.cpp
  3. 9 0
      BeefySysLib/util/String.h

+ 1 - 1
BeefRT/rt/Internal.cpp

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

+ 2 - 2
BeefRT/rt/Object.cpp

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

+ 9 - 0
BeefySysLib/util/String.h

@@ -1241,6 +1241,15 @@ public:
 		((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()
 	{
 		delete this->mPtr;