From ec739a17c2a43a6e25a3d963e4d53344985bc546 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Fri, 6 Jul 2012 08:28:45 +0200 Subject: [PATCH] Fix compiler warning (access beyond array bounds) --- src/GUI/FGFontCache.cxx | 5 +++-- utils/fgpanel/FGFontCache.cxx | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/GUI/FGFontCache.cxx b/src/GUI/FGFontCache.cxx index 3a9ca2c79..937eaeb78 100644 --- a/src/GUI/FGFontCache.cxx +++ b/src/GUI/FGFontCache.cxx @@ -66,10 +66,11 @@ const GuiFont guifonts[] = { { "HELVETICA_12", &FONT_HELVETICA_12 }, { "HELVETICA_14", &FONT_HELVETICA_14 }, { "HELVETICA_18", &PUFONT_HELVETICA_18 }, - { "SANS_12B", &FONT_SANS_12B } + { "SANS_12B", &FONT_SANS_12B }, + { 0 } }; -const GuiFont* guifontsEnd = &guifonts[sizeof(guifonts)/ sizeof(guifonts[0])]; +const GuiFont* guifontsEnd = &guifonts[sizeof(guifonts)/ sizeof(guifonts[0])-1]; } FGFontCache::FGFontCache() : diff --git a/utils/fgpanel/FGFontCache.cxx b/utils/fgpanel/FGFontCache.cxx index b3bbdd6b9..c362bfe73 100644 --- a/utils/fgpanel/FGFontCache.cxx +++ b/utils/fgpanel/FGFontCache.cxx @@ -66,11 +66,12 @@ const GuiFont guifonts[] = { { "HELVETICA_10", &PUFONT_HELVETICA_10 }, { "HELVETICA_12", &PUFONT_HELVETICA_12 }, // { "HELVETICA_14", &FONT_HELVETICA_14 }, - { "HELVETICA_18", &PUFONT_HELVETICA_18 } -// { "SANS_12B", &FONT_SANS_12B } + { "HELVETICA_18", &PUFONT_HELVETICA_18 }, +// { "SANS_12B", &FONT_SANS_12B }, + { 0 } }; -const GuiFont* guifontsEnd = &guifonts[sizeof(guifonts)/ sizeof(guifonts[0])]; +const GuiFont* guifontsEnd = &guifonts[sizeof(guifonts)/ sizeof(guifonts[0])-1]; } FGFontCache::fnt::~fnt() -- 2.39.5