diff options
| author | Ryan <fauxpark@gmail.com> | 2022-03-04 22:04:45 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-04 11:04:45 +0000 |
| commit | f634fddd344a456c3eff8014d9d58a2d764d7a8c (patch) | |
| tree | 6bdd560da1c23c95314afe5500044c27abcaee5f /quantum/process_keycode/process_unicode_common.c | |
| parent | 24f2effbddd45475f815f9d7edc1732baaec4e3f (diff) | |
Remove `send_unicode_hex_string()` (#16518)
Diffstat (limited to 'quantum/process_keycode/process_unicode_common.c')
| -rw-r--r-- | quantum/process_keycode/process_unicode_common.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 46b77e14ba..2606ea1f37 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c | |||
| @@ -16,8 +16,6 @@ | |||
| 16 | 16 | ||
| 17 | #include "process_unicode_common.h" | 17 | #include "process_unicode_common.h" |
| 18 | #include "eeprom.h" | 18 | #include "eeprom.h" |
| 19 | #include <ctype.h> | ||
| 20 | #include <string.h> | ||
| 21 | 19 | ||
| 22 | unicode_config_t unicode_config; | 20 | unicode_config_t unicode_config; |
| 23 | uint8_t unicode_saved_mods; | 21 | uint8_t unicode_saved_mods; |
| @@ -231,37 +229,6 @@ void register_unicode(uint32_t code_point) { | |||
| 231 | unicode_input_finish(); | 229 | unicode_input_finish(); |
| 232 | } | 230 | } |
| 233 | 231 | ||
| 234 | // clang-format off | ||
| 235 | |||
| 236 | void send_unicode_hex_string(const char *str) { | ||
| 237 | if (!str) { | ||
| 238 | return; | ||
| 239 | } | ||
| 240 | |||
| 241 | while (*str) { | ||
| 242 | // Find the next code point (token) in the string | ||
| 243 | for (; *str == ' '; str++); // Skip leading spaces | ||
| 244 | size_t n = strcspn(str, " "); // Length of the current token | ||
| 245 | char code_point[n+1]; | ||
| 246 | strncpy(code_point, str, n); // Copy token into buffer | ||
| 247 | code_point[n] = '\0'; // Make sure it's null-terminated | ||
| 248 | |||
| 249 | // Normalize the code point: make all hex digits lowercase | ||
| 250 | for (char *p = code_point; *p; p++) { | ||
| 251 | *p = tolower((unsigned char)*p); | ||
| 252 | } | ||
| 253 | |||
| 254 | // Send the code point as a Unicode input string | ||
| 255 | unicode_input_start(); | ||
| 256 | send_string(code_point); | ||
| 257 | unicode_input_finish(); | ||
| 258 | |||
| 259 | str += n; // Move to the first ' ' (or '\0') after the current token | ||
| 260 | } | ||
| 261 | } | ||
| 262 | |||
| 263 | // clang-format on | ||
| 264 | |||
| 265 | // Borrowed from https://nullprogram.com/blog/2017/10/06/ | 232 | // Borrowed from https://nullprogram.com/blog/2017/10/06/ |
| 266 | static const char *decode_utf8(const char *str, int32_t *code_point) { | 233 | static const char *decode_utf8(const char *str, int32_t *code_point) { |
| 267 | const char *next; | 234 | const char *next; |
