File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 2121
2222#include < zlib.h>
2323
24+ #include < array>
2425#include < format>
2526#include < string>
2627
@@ -160,13 +161,13 @@ Result<std::string> DecompressGZIPFile(const std::string& filepath) {
160161 return IOError (" Failed to open gzip file:{} " , filepath);
161162 }
162163
163- const int CHUNK_SIZE = 32768 ; // 32KB chunks
164- char buffer[ CHUNK_SIZE] ;
164+ static const int CHUNK_SIZE = 32768 ; // 32KB chunks
165+ std::array< char , CHUNK_SIZE> buffer ;
165166 std::string result;
166167 int bytes_read;
167168
168- while ((bytes_read = gzread (file, buffer, CHUNK_SIZE)) > 0 ) {
169- result.append (buffer, bytes_read);
169+ while ((bytes_read = gzread (file, buffer. data () , CHUNK_SIZE)) > 0 ) {
170+ result.append (buffer. data () , bytes_read);
170171 }
171172
172173 int err;
You can’t perform that action at this time.
0 commit comments