Mercurial > hg > orthanc
comparison Core/Toolbox.cpp @ 2442:330349d712f9
fix Toolbox::IsAsciiString
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 Dec 2017 21:58:09 +0100 |
parents | cad393b41bc3 |
children | 878b59270859 |
comparison
equal
deleted
inserted
replaced
2441:67c01a6f151e | 2442:330349d712f9 |
---|---|
532 { | 532 { |
533 const uint8_t* p = reinterpret_cast<const uint8_t*>(data); | 533 const uint8_t* p = reinterpret_cast<const uint8_t*>(data); |
534 | 534 |
535 for (size_t i = 0; i < size; i++, p++) | 535 for (size_t i = 0; i < size; i++, p++) |
536 { | 536 { |
537 if (*p > 127 || (*p != 0 && iscntrl(*p))) | 537 if (*p > 127 || *p == 0 || iscntrl(*p)) |
538 { | 538 { |
539 return false; | 539 return false; |
540 } | 540 } |
541 } | 541 } |
542 | 542 |
543 return true; | 543 return true; |
544 } | 544 } |
545 | 545 |
546 | |
547 bool Toolbox::IsAsciiString(const std::string& s) | |
548 { | |
549 return IsAsciiString(s.c_str(), s.size()); | |
550 } | |
551 | |
546 | 552 |
547 std::string Toolbox::ConvertToAscii(const std::string& source) | 553 std::string Toolbox::ConvertToAscii(const std::string& source) |
548 { | 554 { |
549 std::string result; | 555 std::string result; |
550 | 556 |