Fix GCC array bounds warning when accessing g_usrvars

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6258 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2012-09-06 22:43:31 +00:00
parent 667a2c8cae
commit c6fdb4436d
5 changed files with 18 additions and 8 deletions

View file

@ -18,7 +18,15 @@
#include "fileform.h"
extern NSIS_STRING g_usrvars[1];
#ifdef __GNUC__
// GCC warns about array bounds when accessing g_usrvarssection[2] because it is only [1] at compile time,
// the other part of this hack is in util.c where g_usrvarsstart is initialized.
extern const NSIS_STRING*const g_usrvarsstart;
#define g_usrvars ( (NSIS_STRING*) (g_usrvarsstart) )
#else
extern NSIS_STRING g_usrvarssection[1];
#define g_usrvars g_usrvarssection
#endif
#define state_command_line g_usrvars[20]
#define state_install_directory g_usrvars[21]