From 0af995d28056b2921c1c92abe883a212c4a3141e Mon Sep 17 00:00:00 2001 From: mikee47 Date: Mon, 17 Jun 2024 21:27:44 +0100 Subject: [PATCH] Fix type errors building in 64-bit mode --- Sming/Libraries/ArduCAM/ArduCAMStream.cpp | 2 +- Sming/Libraries/Arduino_TensorFlowLite | 2 +- Sming/Libraries/Graphics | 2 +- Sming/Libraries/HardwareSPI | 2 +- Sming/Libraries/LittleFS | 2 +- Sming/Libraries/MultipartParser/src/MultipartParser.cpp | 2 +- Sming/Libraries/SPI/test/app/SPI.cpp | 2 +- Sming/Libraries/USB | 2 +- Sming/System/include/m_printf.h | 2 +- Sming/Wiring/WVector.h | 4 ++-- samples/Basic_Storage/app/application.cpp | 2 +- tests/HostTests/modules/ArduinoString.cpp | 4 ++-- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Sming/Libraries/ArduCAM/ArduCAMStream.cpp b/Sming/Libraries/ArduCAM/ArduCAMStream.cpp index 9552ee3c1b..c280f0bef3 100644 --- a/Sming/Libraries/ArduCAM/ArduCAMStream.cpp +++ b/Sming/Libraries/ArduCAM/ArduCAMStream.cpp @@ -99,7 +99,7 @@ uint16_t ArduCAMStream::readMemoryBlock(char* data, int bufSize) { } - int bytesread = min(len, (unsigned int)bufSize); + int bytesread = min(len, size_t(bufSize)); ACAM_DEBUG("ArduCAMStream::readMemoryBlock [%d] (%d bytes) remaining (%d bytes)\n", bcount++, bytesread, len); diff --git a/Sming/Libraries/Arduino_TensorFlowLite b/Sming/Libraries/Arduino_TensorFlowLite index a938e15289..ff5c36b3a9 160000 --- a/Sming/Libraries/Arduino_TensorFlowLite +++ b/Sming/Libraries/Arduino_TensorFlowLite @@ -1 +1 @@ -Subproject commit a938e15289a2b0087eef0643dd62993aeb92f6d6 +Subproject commit ff5c36b3a9661852dc548ee8dd0efa7b679f5254 diff --git a/Sming/Libraries/Graphics b/Sming/Libraries/Graphics index 89d315bdaf..befc633e1e 160000 --- a/Sming/Libraries/Graphics +++ b/Sming/Libraries/Graphics @@ -1 +1 @@ -Subproject commit 89d315bdaf45ea9b75692a8f21e07376fa6d72ba +Subproject commit befc633e1e3fb113a8c9423953ea9734c82f9622 diff --git a/Sming/Libraries/HardwareSPI b/Sming/Libraries/HardwareSPI index 5c8a52121a..9f93de9b2c 160000 --- a/Sming/Libraries/HardwareSPI +++ b/Sming/Libraries/HardwareSPI @@ -1 +1 @@ -Subproject commit 5c8a52121aa788495c21172ceb724cfc1975411b +Subproject commit 9f93de9b2cf3a06a503d14f85f40f5d515707799 diff --git a/Sming/Libraries/LittleFS b/Sming/Libraries/LittleFS index 14d9c51afe..0731572923 160000 --- a/Sming/Libraries/LittleFS +++ b/Sming/Libraries/LittleFS @@ -1 +1 @@ -Subproject commit 14d9c51afea4c89717fde894baf3ff02b4ced971 +Subproject commit 0731572923c45331c60eab8b3dba6485300ce3cf diff --git a/Sming/Libraries/MultipartParser/src/MultipartParser.cpp b/Sming/Libraries/MultipartParser/src/MultipartParser.cpp index 3a864ae250..75d27daf9f 100644 --- a/Sming/Libraries/MultipartParser/src/MultipartParser.cpp +++ b/Sming/Libraries/MultipartParser/src/MultipartParser.cpp @@ -187,7 +187,7 @@ int MultipartParser::partHeadersComplete(multipart_parser_t* p) .name = name, .fileName = fileName, .mime = headers[HTTP_HEADER_CONTENT_TYPE], - .length = contentLength ? contentLength.toInt() : -1, + .length = contentLength ? int(contentLength.toInt()) : -1, }; auto checkerStream = static_cast(stream); diff --git a/Sming/Libraries/SPI/test/app/SPI.cpp b/Sming/Libraries/SPI/test/app/SPI.cpp index 31377d3fd3..18d2d71155 100644 --- a/Sming/Libraries/SPI/test/app/SPI.cpp +++ b/Sming/Libraries/SPI/test/app/SPI.cpp @@ -317,7 +317,7 @@ class SpiTest : public TestGroup { String inData = outData; auto bufptr = reinterpret_cast(inData.begin() + startOffset); - auto length = inData.length() - startOffset; + unsigned length = inData.length() - startOffset; debug_i("TX %u bytes, startOffset %u, %cSB first", length, startOffset, settings.bitOrder == MSBFIRST ? 'M' : 'L'); diff --git a/Sming/Libraries/USB b/Sming/Libraries/USB index 52424de587..37174f917d 160000 --- a/Sming/Libraries/USB +++ b/Sming/Libraries/USB @@ -1 +1 @@ -Subproject commit 52424de587e636f36b2cdaa345e88de37075cddc +Subproject commit 37174f917dba6d03eaf0dd9212545bc74f4839a8 diff --git a/Sming/System/include/m_printf.h b/Sming/System/include/m_printf.h index 46e74ea98a..41b7a34598 100644 --- a/Sming/System/include/m_printf.h +++ b/Sming/System/include/m_printf.h @@ -63,7 +63,7 @@ size_t m_puts(const char* str); extern "C++" { -template int snprintf(char* buf, int length, const char* fmt, Args... args) +template int snprintf(char* buf, size_t length, const char* fmt, Args... args) { return m_snprintf(buf, length, fmt, args...); } diff --git a/Sming/Wiring/WVector.h b/Sming/Wiring/WVector.h index 425b951ea4..b4328a008b 100644 --- a/Sming/Wiring/WVector.h +++ b/Sming/Wiring/WVector.h @@ -182,7 +182,7 @@ template class Vector : public Countable removeAllElements(); } - bool ensureCapacity(unsigned int minCapacity); + bool ensureCapacity(size_t minCapacity); void removeAllElements() { @@ -376,7 +376,7 @@ template bool Vector::addElement(Element* objp) return true; } -template bool Vector::ensureCapacity(unsigned int minCapacity) +template bool Vector::ensureCapacity(size_t minCapacity) { if(_data.size >= minCapacity) { return true; diff --git a/samples/Basic_Storage/app/application.cpp b/samples/Basic_Storage/app/application.cpp index bb0e8e7920..a642aa6906 100644 --- a/samples/Basic_Storage/app/application.cpp +++ b/samples/Basic_Storage/app/application.cpp @@ -41,7 +41,7 @@ void printPart(Storage::Partition part) String s = part.getDeviceName(); s += '/'; s += part.name(); - m_printHex(s.c_str(), buf, std::min(128U, bufSize)); + m_printHex(s.c_str(), buf, std::min(size_t(128U), bufSize)); Serial << _F("Elapsed: ") << elapsed.toString() << endl; if(elapsed != 0) { Serial << _F("Speed: ") << 1000 * bufSize / elapsed << " KB/s" << endl; diff --git a/tests/HostTests/modules/ArduinoString.cpp b/tests/HostTests/modules/ArduinoString.cpp index 399ab29d88..82287b468f 100644 --- a/tests/HostTests/modules/ArduinoString.cpp +++ b/tests/HostTests/modules/ArduinoString.cpp @@ -131,9 +131,9 @@ class ArduinoStringTest : public TestGroup REQUIRE(str == "cleanclean"); // non-decimal negative #s should be as if they were unsigned str = String((int)-100, 16); - REQUIRE(str == "ffffff9c"); + REQUIRE_EQ(str, sizeof(long) == 4 ? "ffffff9c" : "ffffffffffffff9c"); str = String((long)-101, 16); - REQUIRE(str == "ffffff9b"); + REQUIRE_EQ(str, sizeof(long) == 4 ? "ffffff9b" : "ffffffffffffff9b"); str = String((int)-100, 10); REQUIRE(str == "-100"); str = String((long)-100, 10);