| 15 | using namespace std; |
| 16 | |
| 17 | string SanitizeString(const string& str) |
| 18 | { |
| 19 | /** |
| 20 | * safeChars chosen to allow simple messages/URLs/email addresses, but avoid anything |
| 21 | * even possibly remotely dangerous like & or > |
| 22 | */ |
| 23 | static string safeChars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890 .,;_/:?@()"); |
| 24 | string strResult; |
| 25 | for (std::string::size_type i = 0; i < str.size(); i++) |
| 26 | { |
| 27 | if (safeChars.find(str[i]) != std::string::npos) |
| 28 | strResult.push_back(str[i]); |
| 29 | } |
| 30 | return strResult; |
| 31 | } |
| 32 | |
| 33 | const signed char p_util_hexdigit[256] = |
| 34 | { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, |
no test coverage detected