summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEScreen.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp
index 1db34d2..30ff49d 100644
--- a/core/apps/embeddedkonsole/TEScreen.cpp
+++ b/core/apps/embeddedkonsole/TEScreen.cpp
@@ -67,13 +67,13 @@
-TEScreen::TEScreen(int lines, int columns)
+TEScreen::TEScreen(int _lines, int _columns) :
+ lines(_lines),
+ columns(_columns),
+ tabstops(0),
+ histCursor(0),
+ horzCursor(0)
{
- this->lines = lines;
- this->columns = columns;
// odebug << "Columns " << columns << "" << oendl;
- image = (ca*) malloc(lines*columns*sizeof(ca));
- tabstops = NULL; initTabStops();
-
- histCursor = 0;
- horzCursor = 0;
+ image = new ca[lines*columns];
+ initTabStops();
@@ -88,4 +88,4 @@ TEScreen::~TEScreen()
{
- free(image);
- if (tabstops) free(tabstops);
+ delete [] image;
+ delete [] tabstops;
}
@@ -398,3 +398,3 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
// make new image
- ca* newimg = (ca*)malloc( new_lines * new_columns * sizeof( ca));
+ ca* newimg = new ca[new_lines * new_columns];
@@ -420,3 +420,3 @@ void TEScreen::resizeImage(int new_lines, int new_columns)
}
- free(image);
+ delete [] image;
image = newimg;
@@ -509,3 +509,3 @@ ca* TEScreen::getCookedImage()
int x,y;
- ca* merged = (ca*)malloc(lines*columns*sizeof(ca));
+ ca* merged = new ca[lines*columns];
ca dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION);
@@ -625,4 +625,6 @@ void TEScreen::initTabStops()
{
- if (tabstops) free(tabstops);
- tabstops = (bool*)malloc(columns*sizeof(bool));
+ if (tabstops)
+ delete [] tabstops;
+
+ tabstops = new bool[columns];
// Arrg! The 1st tabstop has to be one longer than the other.