GCC new warnings fixed (GCC) 8.1.1 20180531

This commit is contained in:
Bertrand Songis
2018-08-03 23:02:43 +02:00
parent a77f00d665
commit 131078e3a0
15 changed files with 62 additions and 42 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ inline bool lcdIsPointOutside(coord_t x, coord_t y)
void lcdClear()
{
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE);
memset(displayBuf, 0, DISPLAY_BUFFER_SIZE * sizeof(display_t));
}
coord_t lcdLastRightPos;
+2 -2
View File
@@ -56,9 +56,9 @@ void loadCustomScreens()
{
for (unsigned int i=0; i<MAX_CUSTOM_SCREENS; i++) {
delete customScreens[i];
char name[sizeof(g_model.screenData[i].layoutName)+1];
char name[LAYOUT_NAME_LEN + 1];
memset(name, 0, sizeof(name));
strncpy(name, g_model.screenData[i].layoutName, sizeof(g_model.screenData[i].layoutName));
strncpy(name, g_model.screenData[i].layoutName, LAYOUT_NAME_LEN);
customScreens[i] = loadLayout(name, &g_model.screenData[i].layoutData);
}
+1 -1
View File
@@ -105,7 +105,7 @@ enum FontSizeIndex {
#include "colors.h"
#define DISPLAY_PIXELS_COUNT (LCD_W*LCD_H)
#define DISPLAY_BUFFER_SIZE (sizeof(display_t)*DISPLAY_PIXELS_COUNT)
#define DISPLAY_BUFFER_SIZE (DISPLAY_PIXELS_COUNT)
#if defined(SIMU)
extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
+1 -1
View File
@@ -176,7 +176,7 @@ bool menuModelWizard(event_t event)
}
break;
}
strncpy(wizpath, WIZARD_PATH, sizeof(WIZARD_PATH));
strcpy(wizpath, WIZARD_PATH);
strcpy(&wizpath[sizeof(WIZARD_PATH)-1], "/");
lcdDrawSolidFilledRect(0, 0, LCD_W, LCD_H, TEXT_BGCOLOR);
lcd->drawBitmap(0, 0, modelselWizardBackground);
+2 -2
View File
@@ -144,9 +144,9 @@ void loadTheme(Theme * new_theme)
void loadTheme()
{
char name[sizeof(g_eeGeneral.themeName)+1];
char name[THEME_NAME_LEN + 1];
memset(name, 0, sizeof(name));
strncpy(name, g_eeGeneral.themeName, sizeof(g_eeGeneral.themeName));
strncpy(name, g_eeGeneral.themeName, THEME_NAME_LEN);
Theme * new_theme = getTheme(name);
if (new_theme) {
loadTheme(new_theme);
+5 -3
View File
@@ -47,12 +47,14 @@ class WidgetsContainerInterface
Widget ** widgets;
};
#define WIDGET_NAME_LEN 10
template<int N, int O>
class WidgetsContainer: public WidgetsContainerInterface
{
public:
struct ZonePersistentData {
char widgetName[10];
char widgetName[WIDGET_NAME_LEN];
Widget::PersistentData widgetData;
};
@@ -104,9 +106,9 @@ class WidgetsContainer: public WidgetsContainerInterface
for (unsigned int i=0; i<count; i++) {
delete widgets[i];
if (persistentData->zones[i].widgetName[0]) {
char name[sizeof(persistentData->zones[i].widgetName)+1];
char name[WIDGET_NAME_LEN + 1];
memset(name, 0, sizeof(name));
strncpy(name, persistentData->zones[i].widgetName, sizeof(persistentData->zones[i].widgetName));
strncpy(name, persistentData->zones[i].widgetName, WIDGET_NAME_LEN);
widgets[i] = loadWidget(name, getZone(i), &persistentData->zones[i].widgetData);
}
else {