| 939 | } |
| 940 | |
| 941 | static void text_detect_eol(const char *data, size_t len, const char **eol_out, |
| 942 | size_t *eol_len_out) { |
| 943 | for (size_t pos = 0U; pos < len; pos++) { |
| 944 | if (data[pos] == '\n') { |
| 945 | if (pos > 0U && data[pos - 1U] == '\r') { |
| 946 | *eol_out = "\r\n"; |
| 947 | *eol_len_out = 2U; |
| 948 | } else { |
| 949 | *eol_out = "\n"; |
| 950 | *eol_len_out = 1U; |
| 951 | } |
| 952 | return; |
| 953 | } |
| 954 | } |
| 955 | *eol_out = "\n"; |
| 956 | *eol_len_out = 1U; |
| 957 | } |
| 958 | |
| 959 | static int text_append_normalized(text_buffer_t *buffer, const char *content, size_t content_len, |
| 960 | const char *eol, size_t eol_len) { |
no outgoing calls
no test coverage detected