Skip to content

Commit

Permalink
Remove VLA usage for GLB size constants
Browse files Browse the repository at this point in the history
Opinions on whether VLA's are a good feature tend to be pretty mixed.
Regardless of opinion, Microsoft's MSVC compiler does not support them,
and any project attempting to use the C89 standard won't either.

The VLA's in this library aren't even of variable size - their sizes are
known at compile time.
  • Loading branch information
rgriege committed Nov 21, 2023
1 parent fd3a618 commit f517dcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cgltf.h
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,8 @@ static int jsmn_parse(jsmn_parser *parser, const char *js, size_t len, jsmntok_t


#ifndef CGLTF_CONSTS
static const cgltf_size GlbHeaderSize = 12;
static const cgltf_size GlbChunkHeaderSize = 8;
#define GlbHeaderSize 12
#define GlbChunkHeaderSize 8
static const uint32_t GlbVersion = 2;
static const uint32_t GlbMagic = 0x46546C67;
static const uint32_t GlbMagicJsonChunk = 0x4E4F534A;
Expand Down
4 changes: 2 additions & 2 deletions cgltf_write.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ typedef struct {
cgltf_write_line(context, "}"); }

#ifndef CGLTF_CONSTS
static const cgltf_size GlbHeaderSize = 12;
static const cgltf_size GlbChunkHeaderSize = 8;
#define GlbHeaderSize 12
#define GlbChunkHeaderSize 8
static const uint32_t GlbVersion = 2;
static const uint32_t GlbMagic = 0x46546C67;
static const uint32_t GlbMagicJsonChunk = 0x4E4F534A;
Expand Down

0 comments on commit f517dcd

Please sign in to comment.