From 5094cb3c168ed5c08dbdaa982fe1c096482c5ecc Mon Sep 17 00:00:00 2001 From: Daniel Plasa Date: Sun, 31 May 2020 14:43:26 +0200 Subject: fix esp32 compile errors --- FTPCommon.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'FTPCommon.cpp') diff --git a/FTPCommon.cpp b/FTPCommon.cpp index 4b8af4c..0651022 100644 --- a/FTPCommon.cpp +++ b/FTPCommon.cpp @@ -1,7 +1,6 @@ #include "FTPCommon.h" -FTPCommon::FTPCommon(FS &_FSImplementation) : - THEFS(_FSImplementation), sTimeOutMs(FTP_TIME_OUT*60*1000), aTimeout(FTP_TIME_OUT*60*1000) +FTPCommon::FTPCommon(FS &_FSImplementation) : THEFS(_FSImplementation), sTimeOutMs(FTP_TIME_OUT * 60 * 1000), aTimeout(FTP_TIME_OUT * 60 * 1000) { } @@ -23,14 +22,17 @@ void FTPCommon::setTimeout(uint32_t timeoutMs) sTimeOutMs = timeoutMs; } +// +// allocate a big buffer for file transfers +// uint16_t FTPCommon::allocateBuffer(uint16_t desiredBytes) { - // allocate a big buffer for file transfers +#if (defined ESP8266) uint16_t maxBlock = ESP.getMaxFreeBlockSize() / 2; if (desiredBytes > maxBlock) desiredBytes = maxBlock; - +#endif while (fileBuffer == NULL && desiredBytes > 0) { fileBuffer = (uint8_t *)malloc(desiredBytes); @@ -141,7 +143,7 @@ bool FTPCommon::doNetworkToFile() void FTPCommon::closeTransfer() { - freeBuffer(); - file.close(); - data.stop(); + freeBuffer(); + file.close(); + data.stop(); } -- cgit v1.2.3