From 8c7a6242808887762170abd41b0e0f0fd20fa3c3 Mon Sep 17 00:00:00 2001 From: SymbolixAU Date: Tue, 17 Mar 2020 08:13:47 +1100 Subject: [PATCH] variable lenght char buffer --- src/read_geojson.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/read_geojson.cpp b/src/read_geojson.cpp index 76afa72..c27b3b8 100644 --- a/src/read_geojson.cpp +++ b/src/read_geojson.cpp @@ -21,7 +21,12 @@ rapidjson::Document buffer_string( const char* file, const char* mode, int buffer_size = 1024 ) { FILE* fp = fopen(file, mode ); - char readBuffer[ buffer_size ]; + //char readBuffer[ buffer_size ]; + //rapidjson::FileReadStream is(fp, readBuffer, sizeof( readBuffer ) ); + + // ISO C++ forbids variable length array ‘readBuffer’ [-Wvla] + // https://stackoverflow.com/a/11379442/5977215 + char *readBuffer = new char[ buffer_size ]; rapidjson::FileReadStream is(fp, readBuffer, sizeof( readBuffer ) );