summaryrefslogtreecommitdiff
path: root/src/interface/Textblock.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-20 12:40:34 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-20 12:40:34 (GMT)
commite81e18238df47212d84fa00422a64983857e1ea1 (patch)
tree67c973f1f3666f9f4b230524575cda5dd6cc4cd6 /src/interface/Textblock.cpp
parent2be9c925088c16beb144dd9932202416d00ff581 (diff)
parentf6403958de1f67d3bce47f56b40de254c30f5ba4 (diff)
downloadpowder-e81e18238df47212d84fa00422a64983857e1ea1.zip
powder-e81e18238df47212d84fa00422a64983857e1ea1.tar.gz
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/interface/Textblock.cpp')
-rw-r--r--src/interface/Textblock.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/interface/Textblock.cpp b/src/interface/Textblock.cpp
index c378925..f003a6a 100644
--- a/src/interface/Textblock.cpp
+++ b/src/interface/Textblock.cpp
@@ -28,8 +28,8 @@ void Textblock::SetText(std::string text)
void Textblock::updateMultiline()
{
- char * rawText = (char*)malloc(text.length()+1);
- memcpy(rawText, text.c_str(), text.length());
+ char * rawText = new char[text.length()+1];
+ std::copy(text.begin(), text.end(), rawText);
rawText[text.length()] = 0;
int lines = 1;
@@ -60,7 +60,8 @@ void Textblock::updateMultiline()
{
Size.Y = lines*12;
}
- textLines = rawText;
+ textLines = std::string(rawText);
+ delete[] rawText;
}
void Textblock::Draw(const Point &screenPos)