Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Picaso_4DGL-32PTU_graphics.cpp
- Revision:
- 15:86bdf382e6f7
- Parent:
- 12:29f5ad896382
--- a/Picaso_4DGL-32PTU_graphics.cpp Thu Sep 15 09:48:59 2016 +0000
+++ b/Picaso_4DGL-32PTU_graphics.cpp Thu Sep 15 11:52:31 2016 +0000
@@ -206,7 +206,8 @@
int size = 6 + (n*4);
int i, j = 4;
- char command[size];
+ char *command;
+ command = (char *)malloc(sizeof(char) * size);
for(i = 0; i < size; i++) command[i] = 0;
command[0] = (DRAW_POLYLINE >> (8*1)) & 0xff;
@@ -230,6 +231,7 @@
writeCOMMAND(command, size);
getResponse(1);
+ free(command);
}
//**************************************************************************
@@ -248,7 +250,8 @@
int size = 6 + (n*4);
int i, j = 4;
- char command[size];
+ char *command;
+ command = (char *)malloc(sizeof(char) * size);
for(i = 0; i < size; i++) command[i] = 0;
command[0] = (DRAW_POLYGON >> (8*1)) & 0xff;
@@ -272,6 +275,7 @@
writeCOMMAND(command, size);
getResponse(1);
+ free(command);
}
//**************************************************************************
@@ -289,7 +293,8 @@
if (n >= 3) {
int size = 6 + (n*4);
int i, j = 4;
- char command[size];
+ char *command;
+ command = (char *)malloc(sizeof(char) * size);
for(i = 0; i < size; i++) command[i] = 0;
command[0] = (POLYGON_FILLED >> (8*1)) & 0xff;
@@ -313,6 +318,7 @@
writeCOMMAND(command, size);
getResponse(1);
+ free(command);
}
else pc.printf("\n\r ERROR_POLYGON_FILLED: There has to be at least 3 vertices!\n\r");
}
@@ -584,9 +590,10 @@
//**************************************************************************
void PICASO_4DGL :: drawButton(short state, short x, short y, short btnColor, short txtColor, short font, short txtW, short txtH, char *txt) {
- int size = 19 + (strlen(txt));
+ int size = (19 + (strlen(txt)));
int i, j = 18;
- char command[size];
+ char *command;
+ command = (char *)malloc(sizeof(char) * size);
for(i = 0; i < size; i++) command[i] = 0;
command[0] = (DRAW_BUTTON >> (8*1)) & 0xff;
@@ -615,6 +622,7 @@
writeCOMMAND(command, size);
getResponse(1);
+ free(command);
}
//**************************************************************************