From 236e77c26374bed4191a90ed9ef7db1df864fe69 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 30 Apr 2021 13:43:26 +0200 Subject: [PATCH] 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). --- src/common/filename.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/filename.cpp b/src/common/filename.cpp index e5e9ec39ca..7715f1973f 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -91,6 +91,10 @@ #include "wx/longlong.h" #include "wx/uri.h" +#if defined(wxHAS_NATIVE_READLINK) + #include "wx/vector.h" +#endif + #if defined(__WIN32__) && defined(__MINGW32__) #include "wx/msw/gccpriv.h" #endif @@ -1697,7 +1701,8 @@ wxFileName wxFileName::ResolveLink() if( st.st_size != 0 ) bufSize = st.st_size + 1; - char buf[bufSize]; + wxVector bufData(bufSize); + char* const buf = &bufData[0]; ssize_t result = wxReadlink(link, buf, bufSize - 1); if ( result != -1 )