Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Sep 15, 2024
1 parent f73becd commit 04120a3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions firmware/util/loggingcentral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,21 @@ void efiPrintfInternal(const char *format, ...) {
// Ensure that the string is comma-terminated in case it overflowed
lineBuffer->buffer[sizeof(lineBuffer->buffer) - 1] = LOG_DELIMITER[0];

if (len > sizeof(lineBuffer->buffer) - 1)
if (len > sizeof(lineBuffer->buffer) - 1) {
len = sizeof(lineBuffer->buffer) - 1;
}

for (size_t i = 0; i < len; i++) {
/* just replace all non-printable chars with space
* TODO: is there any other "prohibited" chars? */
if (isprint(lineBuffer->buffer[i]) == 0)
if (isprint(lineBuffer->buffer[i]) == 0) {
lineBuffer->buffer[i] = ' ';
}
}

{
// Push the buffer in to the written list so it can be written back
chibios_rt::CriticalSectionLocker csl;

filledBuffers.postI(lineBuffer);
}
#endif
Expand Down

0 comments on commit 04120a3

Please sign in to comment.