mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-23 03:00:56 +00:00
fix a lot of nuisances reported by cppcheck (#4872)
* fix a lot of nuisances reported by cppcheck * fix portduino
This commit is contained in:
@@ -60,10 +60,9 @@ char *strnstr(const char *s, const char *find, size_t slen)
|
||||
|
||||
void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
||||
{
|
||||
char *messageBuffer;
|
||||
int labelSize = strlen(label);
|
||||
if (labelSize < 100 && numbytes < 64) {
|
||||
messageBuffer = new char[labelSize + (numbytes * 3) + 2];
|
||||
char *messageBuffer = new char[labelSize + (numbytes * 3) + 2];
|
||||
strncpy(messageBuffer, label, labelSize);
|
||||
for (size_t i = 0; i < numbytes; i++)
|
||||
snprintf(messageBuffer + labelSize + i * 3, 4, " %02x", p[i]);
|
||||
|
||||
Reference in New Issue
Block a user