diff --git a/src/main/common/log.c b/src/main/common/log.c index c2cc30a3a48..d1d9ef1e6b0 100644 --- a/src/main/common/log.c +++ b/src/main/common/log.c @@ -205,8 +205,12 @@ void _logBufferHex(logTopic_e topic, unsigned level, const void *buffer, size_t { // Print lines of up to maxBytes bytes. We need 5 characters per byte // 0xAB[space|\n] - const size_t charsPerByte = 5; - const size_t maxBytes = 8; + // charsPerByte/maxBytes must be true compile-time constants (not `const` + // locals) so the buffer size below is a real constant expression, not a VLA. + enum { + charsPerByte = 5, + maxBytes = 8, + }; char buf[LOG_PREFIX_FORMATTED_SIZE + charsPerByte * maxBytes + 1]; // +1 for the null terminator size_t bufPos = LOG_PREFIX_FORMATTED_SIZE; const uint8_t *inputPtr = buffer; diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 0bdb9e3375f..aa0a01ce71b 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -841,7 +841,7 @@ static void osdFormatCoordinate(char *buff, char sym, int32_t val) int integerDigits = tfp_sprintf(buff + 1, (integerPart == 0 && val < 0) ? "-%d" : "%d", (int)integerPart); // We can show up to 7 digits in decimalPart. int32_t decimalPart = abs(val % (int)GPS_DEGREES_DIVIDER); - STATIC_ASSERT(GPS_DEGREES_DIVIDER == 1e7, adjust_max_decimal_digits); + STATIC_ASSERT(GPS_DEGREES_DIVIDER == 10000000L, adjust_max_decimal_digits); int decimalDigits; bool djiCompat = false; // Assume DJICOMPAT mode is no enabled