Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netdump printf fix #8215

Merged
merged 3 commits into from
Jul 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/Netdump/src/Netdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void Netdump::reset()

void Netdump::printDump(Print& out, Packet::PacketDetail ndd, const Filter nf)
{
out.printf("netDump starting\r\n");
out.printf_P(PSTR("netDump starting\r\n"));
setCallback([&out, ndd, this](const Packet & ndp)
{
printDumpProcess(out, ndd, ndp);
Expand Down Expand Up @@ -140,7 +140,7 @@ void Netdump::writePcapHeader(Stream& s) const

void Netdump::printDumpProcess(Print& out, Packet::PacketDetail ndd, const Packet& np) const
{
out.printf_P(PSTR("%8d %s"), np.getTime(), np.toString(ndd).c_str());
out.printf_P(PSTR("%8lld %s"), np.getTime(), np.toString(ndd).c_str());
}

void Netdump::fileDumpProcess(File& outfile, const Packet& np) const
Expand Down
2 changes: 1 addition & 1 deletion libraries/Netdump/src/NetdumpIP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ size_t NetdumpIP::printTo(Print& p)
uint16_t bit = PP_NTOHS(reinterpret_cast<const uint16_t*>(rawip)[i]);
if (bit || count0 < 0)
{
n += p.printf("%x", bit);
n += p.printf_P(PSTR("%x"), bit);
if (count0 > 0)
// no more hiding 0
{
Expand Down
10 changes: 5 additions & 5 deletions libraries/Netdump/src/NetdumpPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ void Packet::printDetail(Print& out, const String& indent, const char* data, siz
{
end = size;
}
out.printf("%s", indent.c_str());
out.printf_P(PSTR("%s"), indent.c_str());
if (pd != PacketDetail::CHAR)
{
for (size_t i = start; i < end; i++)
{
out.printf("%02x ", (unsigned char)data[i]);
out.printf_P(PSTR("%02x "), (unsigned char)data[i]);
}
for (size_t i = end; i < start + charCount; i++)
{
out.print(" ");
out.printf_P(PSTR(" "));
}
}
for (size_t i = start; i < end; i++)
{
out.printf("%c", data[i] >= 32 && data[i] < 128 ? data[i] : '.');
out.printf_P(PSTR("%c"), data[i] >= 32 && data[i] < 128 ? data[i] : '.');
}
out.println();

Expand Down Expand Up @@ -253,7 +253,7 @@ void Packet::ICMPtoString(PacketDetail, StreamString& sstr) const
default: sstr.printf_P(PSTR("type(0x%02x)"), getIcmpType()); break;
}
}
sstr.printf("\r\n");
sstr.printf_P(PSTR("\r\n"));
}

void Packet::IGMPtoString(PacketDetail, StreamString& sstr) const
Expand Down