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
+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 {