1 #ifndef MBFL_UTF7_HELPER_H
2 #define MBFL_UTF7_HELPER_H
3 
4 #include "mbfilter.h"
5 
6 /* Ways which a Base64-encoded section can end: */
7 #define DASH 0xFC
8 #define DIRECT 0xFD
9 #define ASCII 0xFE
10 #define ILLEGAL 0xFF
11 
is_base64_end_valid(unsigned char n,bool gap,bool is_surrogate)12 static inline bool is_base64_end_valid(unsigned char n, bool gap, bool is_surrogate)
13 {
14 	return !(gap || is_surrogate || n == ASCII || n == ILLEGAL);
15 }
16 
has_surrogate(uint16_t cp,bool is_surrogate)17 static inline bool has_surrogate(uint16_t cp, bool is_surrogate)
18 {
19 	return !is_surrogate && cp >= 0xD800 && cp <= 0xDBFF;
20 }
21 
22 #endif /* MBFL_UTF7_HELPER_H */
23