From 93054172079202502d4e4d4712190d3f36a2f337 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 30 Oct 2020 22:50:44 +0000 Subject: [PATCH] Terrasync: tarball extraction, use larger buffer Use a 1MB buffer, 2kByte is very 1979 :) --- simgear/io/HTTPRepository.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index 4bc9aa73..c3fbfeed 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -462,13 +462,15 @@ public: SGPath extractDir = p.dir(); ArchiveExtractor ex(extractDir); - uint8_t *buf = (uint8_t *)alloca(2048); + const size_t bufSize = 1024 * 1024; + uint8_t* buf = (uint8_t*)malloc(bufSize); while (!f.eof()) { - size_t bufSize = f.read((char *)buf, 2048); - ex.extractBytes(buf, bufSize); + size_t rd = f.read((char*)buf, bufSize); + ex.extractBytes(buf, rd); } ex.flush(); + free(buf); if (! ex.isAtEndOfArchive()) { SG_LOG(SG_TERRASYNC, SG_ALERT, "Corrupt tarball " << p); _repository->failedToUpdateChild(