Changeset View
Changeset View
Standalone View
Standalone View
src/util/strencodings.h
Show All 17 Lines | |||||
#define BEGIN(a) ((char *)&(a)) | #define BEGIN(a) ((char *)&(a)) | ||||
#define END(a) ((char *)&((&(a))[1])) | #define END(a) ((char *)&((&(a))[1])) | ||||
#define UBEGIN(a) ((uint8_t *)&(a)) | #define UBEGIN(a) ((uint8_t *)&(a)) | ||||
#define UEND(a) ((uint8_t *)&((&(a))[1])) | #define UEND(a) ((uint8_t *)&((&(a))[1])) | ||||
#define ARRAYLEN(array) (sizeof(array) / sizeof((array)[0])) | #define ARRAYLEN(array) (sizeof(array) / sizeof((array)[0])) | ||||
/** Used by SanitizeString() */ | /** Used by SanitizeString() */ | ||||
enum SafeChars { | enum SafeChars { | ||||
//!< The full set of allowed chars | //! The full set of allowed chars | ||||
SAFE_CHARS_DEFAULT, | SAFE_CHARS_DEFAULT, | ||||
//!< BIP-0014 subset | //! BIP-0014 subset | ||||
SAFE_CHARS_UA_COMMENT, | SAFE_CHARS_UA_COMMENT, | ||||
//!< Chars allowed in filenames | //! Chars allowed in filenames | ||||
SAFE_CHARS_FILENAME, | SAFE_CHARS_FILENAME, | ||||
}; | }; | ||||
/** | /** | ||||
* Remove unsafe chars. Safe chars chosen to allow simple messages/URLs/email | * Remove unsafe chars. Safe chars chosen to allow simple messages/URLs/email | ||||
* addresses, but avoid anything even possibly remotely dangerous like & or > | * addresses, but avoid anything even possibly remotely dangerous like & or > | ||||
* @param[in] str The string to sanitize | * @param[in] str The string to sanitize | ||||
* @param[in] rule The set of safe chars to choose (default: least | * @param[in] rule The set of safe chars to choose (default: least | ||||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |