gskngltexturelibraryprivate.h: Fix build on Visual Studio
The 'GskNglTextureAtlasEntry' structure is used as a member in two other structures in two Gsk private headers, namely 'GskNglGlyphValue' and 'GskNglIconData', but the build breaks on Visual Studio since 'GskNglTextureAtlasEntry' contains a last member that is a zero-sized array that is normally OK if it is the last member of structure -or- if the structure that contains a 'GskNglTextureAtlasEntry' structure as its last member. Otherwise, a GCCism is involved here. Fix the build on Visual Studio compilers by not using a zero-sized array as a last member of 'GskNglTextureAtlasEntry', on Visual Studio compilers.
This commit is contained in:
@@ -53,6 +53,12 @@ typedef struct _GskNglTextureAtlas
|
||||
void *user_data;
|
||||
} GskNglTextureAtlas;
|
||||
|
||||
#if defined (_MSC_VER) && !defined (__clang__)
|
||||
# define NGL_TRAILING_DATA_SIZE 1
|
||||
#else
|
||||
# define NGL_TRAILING_DATA_SIZE 0
|
||||
#endif
|
||||
|
||||
typedef struct _GskNglTextureAtlasEntry
|
||||
{
|
||||
/* A backreference to either the atlas or texture containing
|
||||
@@ -89,9 +95,11 @@ typedef struct _GskNglTextureAtlasEntry
|
||||
/* Suffix data that is per-library specific. gpointer used to
|
||||
* guarantee the alignment for the entries using this.
|
||||
*/
|
||||
gpointer data[0];
|
||||
gpointer data[NGL_TRAILING_DATA_SIZE];
|
||||
} GskNglTextureAtlasEntry;
|
||||
|
||||
#undef NGL_TRAILING_DATA_SIZE
|
||||
|
||||
typedef struct _GskNglTextureLibrary
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
Reference in New Issue
Block a user