Don't use variable length arrays in wxFileName::ResolveLink()

Use wxVector<> instead of relying on compiler support for VLAs which is
not standard and shouldn't be required.

This fixes compilation using OpenVMS compiler after the changes of
53bd1391f4 (Add a new wxFileName function to resolve symlinks to
absolute paths, 2021-04-01).
This commit is contained in:
Vadim Zeitlin
2021-04-30 13:43:26 +02:00
parent 1e4f0a370f
commit 236e77c263

View File

@@ -91,6 +91,10 @@
#include "wx/longlong.h" #include "wx/longlong.h"
#include "wx/uri.h" #include "wx/uri.h"
#if defined(wxHAS_NATIVE_READLINK)
#include "wx/vector.h"
#endif
#if defined(__WIN32__) && defined(__MINGW32__) #if defined(__WIN32__) && defined(__MINGW32__)
#include "wx/msw/gccpriv.h" #include "wx/msw/gccpriv.h"
#endif #endif
@@ -1697,7 +1701,8 @@ wxFileName wxFileName::ResolveLink()
if( st.st_size != 0 ) if( st.st_size != 0 )
bufSize = st.st_size + 1; bufSize = st.st_size + 1;
char buf[bufSize]; wxVector<char> bufData(bufSize);
char* const buf = &bufData[0];
ssize_t result = wxReadlink(link, buf, bufSize - 1); ssize_t result = wxReadlink(link, buf, bufSize - 1);
if ( result != -1 ) if ( result != -1 )