mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
Merge pull request #36 from kaldoran/log_print
Using standard library function for handling ascii out of range characters.
This commit is contained in:
commit
bfe41dbb45
1 file changed
+1
-1
@@ -90,7 +90,7 @@ struct LogMethod {
|
||||
void logPrintable(const uint8_t *buf, size_t buflen) const {
|
||||
std::string buf_clean(buflen, '\0');
|
||||
for (size_t i=0; i<buflen; i++)
|
||||
buf_clean[i] = buf[i] >= 32 && buf[i] <= 126 ? buf[i] : '.';
|
||||
buf_clean[i] = std::isprint(buf[i]) ? buf[i] : '.';
|
||||
(*this)("%s", buf_clean.c_str());
|
||||
}
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user