Skip to content

Commit

Permalink
Fix windows compile errors. (#19344) (#19345)
Browse files Browse the repository at this point in the history
vtkIdType cverts[nbnel] yields 'does not evaluate to constant' error.
In order for this to work 'nbnel' must be a constant at compile time, so need to use 'new' to allocate the array.

strcasestr not defined on Windows, #define it to be 'StrStrIA'.
  • Loading branch information
biagas committed Feb 23, 2024
1 parent d73c6a7 commit b287642
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/databases/unv/avtunvFileFormat.C
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
#include <avtParallel.h>
#endif

#ifdef _MSC_VER
#include <shlwapi.h>
#define strcasestr StrStrIA
#endif

using std::string;
using namespace std;

Expand Down Expand Up @@ -2678,7 +2683,7 @@ avtunvFileFormat::GetMesh(const char *meshname)
case 34:
{
int nbnel = itre->nbnel ;
vtkIdType cverts[nbnel];
vtkIdType *cverts = new vtkIdType[nbnel];
for (int i=0; i < nbnel; i++)
{
anUnvNode.label = itre->nodes[i];
Expand All @@ -2689,6 +2694,7 @@ avtunvFileFormat::GetMesh(const char *meshname)
#endif
}
ugrid->InsertNextCell(VTK_POLYGON, nbnel, cverts);
delete [] cverts;
break;
}
case 24:
Expand Down Expand Up @@ -2866,7 +2872,7 @@ avtunvFileFormat::GetMesh(const char *meshname)
case 34:
{
int nbnel = itre->nbnel ;
vtkIdType cverts[nbnel];
vtkIdType *cverts = new vtkIdType[nbnel];
for (int i=0; i < nbnel; i++)
{
anUnvNode.label = itre->nodes[i];
Expand All @@ -2877,6 +2883,7 @@ avtunvFileFormat::GetMesh(const char *meshname)
#endif
}
ugrid->InsertNextCell(VTK_POLYGON, nbnel, cverts);
delete [] cverts;
break;
}
default:
Expand Down Expand Up @@ -2940,7 +2947,7 @@ avtunvFileFormat::GetMesh(const char *meshname)
case 34:
{
int nbnel = itre->nbnel ;
vtkIdType cverts[nbnel];
vtkIdType *cverts = new vtkIdType[nbnel];
for (int i=0; i < nbnel; i++)
{
anUnvNode.label = itre->nodes[i];
Expand All @@ -2951,6 +2958,7 @@ avtunvFileFormat::GetMesh(const char *meshname)
#endif
}
ugrid->InsertNextCell(VTK_POLYGON, nbnel, cverts);
delete [] cverts;
break;
}
default:
Expand Down

0 comments on commit b287642

Please sign in to comment.