summaryrefslogtreecommitdiff
path: root/src/cRender.cpp
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-03-06 22:59:13 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-03-06 22:59:13 +0100
commit98da4bb94fbd2e65b1634f01519e3bbd59b76592 (patch)
treeb70d3c45d6df559fea00bc4b5aa792ae259c3275 /src/cRender.cpp
parenta472dc51a18ad16bd8c72337023a08251a5888a8 (diff)
downloadtermgl-98da4bb94fbd2e65b1634f01519e3bbd59b76592.tar.gz
converting size variables to unsigned #1
Diffstat (limited to 'src/cRender.cpp')
-rw-r--r--src/cRender.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cRender.cpp b/src/cRender.cpp
index 9fbdc8f..df518ee 100644
--- a/src/cRender.cpp
+++ b/src/cRender.cpp
@@ -305,6 +305,9 @@ void cRender::setBufferSize(sPos _size)
if(_size.x == sizeX && _size.y == sizeY)
return;
+ if(_size.x < 0 || _size.y < 0)
+ return;
+
if(sizeX!=0 && sizeY!=0) //resize. delete first
{
for (int i = 0; i < sizeX; i++) {
@@ -323,15 +326,15 @@ void cRender::setBufferSize(sPos _size)
//Initialize 2D array
cScreen = (char**)malloc(sizeof *cScreen * sizeX);
- for (int i = 0; i < sizeX; i++)
+ for (unsigned int i = 0; i < sizeX; i++)
cScreen[i] = (char*)malloc(sizeof *cScreen[i] * sizeY);
wColor = (WORD**)malloc(sizeof *wColor * sizeX);
- for (int i = 0; i < sizeX; i++)
+ for (unsigned int i = 0; i < sizeX; i++)
wColor[i] = (WORD*)malloc(sizeof *wColor[i] * sizeY);
bChanged = (bool**)malloc(sizeof *bChanged * sizeX);
- for (int i = 0; i < sizeX; i++)
+ for (unsigned int i = 0; i < sizeX; i++)
bChanged[i] = (bool*)malloc(sizeof *bChanged[i] * sizeY);
clear(true);