Checks whether the unicode code point is malformed, i.e. illegal or incomplete, and warns if it is. Returns true if any warning is added.
| 113 | /// Checks whether the unicode code point is malformed, i.e. illegal or incomplete, and |
| 114 | /// warns if it is. Returns true if any warning is added. |
| 115 | static bool CheckAndWarnCodePoint(FunctionContext* ctx, uint32_t code_point) { |
| 116 | if (code_point == utf::illegal || code_point == utf::incomplete) { |
| 117 | ctx->AddWarning(Substitute("String contains $0 code point. Return NULL.", |
| 118 | code_point == utf::illegal ? "illegal" : "incomplete").c_str()); |
| 119 | return true; |
| 120 | } |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | /// Mask the substring in range [start, end) of the given string value. Using rules in |
| 125 | /// 'MaskTransform'. Indices are counted in UTF-8 code points. |
no test coverage detected