Skip to content

Commit

Permalink
fix: Variable length arrays are not portable C++ (gave errors in MSVC)
Browse files Browse the repository at this point in the history
  • Loading branch information
atteneder committed May 15, 2023
1 parent 6c24182 commit a28e4f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/draco/unity/draco_unity_enc_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ namespace draco {

switch (componentCount) {
case 2:
{
T tmp[componentCount];
{
T tmp[2];
for (uint32_t i = 0; i < count; i++)
{
T* srcPtr = (T*) (dataBytes + i * stride);
Expand All @@ -252,7 +252,7 @@ namespace draco {
}
case 3:
{
T tmp[componentCount];
T tmp[3];
for (uint32_t i = 0; i < count; i++)
{
T* srcPtr = (T*) (dataBytes + i * stride);
Expand All @@ -266,7 +266,7 @@ namespace draco {
}
case 4:
{
T tmp[componentCount];
T tmp[4];
for (uint32_t i = 0; i < count; i++)
{
T* srcPtr = (T*) (dataBytes + i * stride);
Expand Down

0 comments on commit a28e4f4

Please sign in to comment.