| 245 | } |
| 246 | |
| 247 | static int will_convert_lf_to_crlf(struct text_stat *stats, |
| 248 | enum convert_crlf_action crlf_action) |
| 249 | { |
| 250 | if (output_eol(crlf_action) != EOL_CRLF) |
| 251 | return 0; |
| 252 | /* No "naked" LF? Nothing to convert, regardless. */ |
| 253 | if (!stats->lonelf) |
| 254 | return 0; |
| 255 | |
| 256 | if (crlf_action == CRLF_AUTO || crlf_action == CRLF_AUTO_INPUT || crlf_action == CRLF_AUTO_CRLF) { |
| 257 | /* If we have any CR or CRLF line endings, we do not touch it */ |
| 258 | /* This is the new safer autocrlf-handling */ |
| 259 | if (stats->lonecr || stats->crlf) |
| 260 | return 0; |
| 261 | |
| 262 | if (convert_is_binary(stats)) |
| 263 | return 0; |
| 264 | } |
| 265 | return 1; |
| 266 | |
| 267 | } |
| 268 | |
| 269 | static int validate_encoding(const char *path, const char *enc, |
| 270 | const char *data, size_t len, int die_on_error) |
no test coverage detected