diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2021-05-10 23:14:17 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-05-11 01:30:58 +0100 |
| commit | 14f6950bcecd2f6c254ab3108b0ac8b267983713 (patch) | |
| tree | db9055ccbba9bc4a7e920eac4d575fd6a4699c6d /src/buffer.c | |
| parent | d525e063ba4e478cc4afac4cdf60f7acd989dbf2 (diff) | |
| download | libgit2-14f6950bcecd2f6c254ab3108b0ac8b267983713.tar.gz | |
buf: bom enum is in the buf namespace
Instead of a `git_bom_t` that a `git_buf` function returns, let's keep
it `git_buf_bom_t`.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/buffer.c b/src/buffer.c index ffce73c68..794e1f1ab 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1227,12 +1227,12 @@ int git_buf_common_prefix(git_buf *buf, const git_strarray *strings) int git_buf_is_binary(const git_buf *buf) { const char *scan = buf->ptr, *end = buf->ptr + buf->size; - git_bom_t bom; + git_buf_bom_t bom; int printable = 0, nonprintable = 0; scan += git_buf_detect_bom(&bom, buf); - if (bom > GIT_BOM_UTF8) + if (bom > GIT_BUF_BOM_UTF8) return 1; while (scan < end) { @@ -1257,12 +1257,12 @@ int git_buf_contains_nul(const git_buf *buf) return (memchr(buf->ptr, '\0', buf->size) != NULL); } -int git_buf_detect_bom(git_bom_t *bom, const git_buf *buf) +int git_buf_detect_bom(git_buf_bom_t *bom, const git_buf *buf) { const char *ptr; size_t len; - *bom = GIT_BOM_NONE; + *bom = GIT_BUF_BOM_NONE; /* need at least 2 bytes to look for any BOM */ if (buf->size < 2) return 0; @@ -1273,19 +1273,19 @@ int git_buf_detect_bom(git_bom_t *bom, const git_buf *buf) switch (*ptr++) { case 0: if (len >= 4 && ptr[0] == 0 && ptr[1] == '\xFE' && ptr[2] == '\xFF') { - *bom = GIT_BOM_UTF32_BE; + *bom = GIT_BUF_BOM_UTF32_BE; return 4; } break; case '\xEF': if (len >= 3 && ptr[0] == '\xBB' && ptr[1] == '\xBF') { - *bom = GIT_BOM_UTF8; + *bom = GIT_BUF_BOM_UTF8; return 3; } break; case '\xFE': if (*ptr == '\xFF') { - *bom = GIT_BOM_UTF16_BE; + *bom = GIT_BUF_BOM_UTF16_BE; return 2; } break; @@ -1293,10 +1293,10 @@ int git_buf_detect_bom(git_bom_t *bom, const git_buf *buf) if (*ptr != '\xFE') break; if (len >= 4 && ptr[1] == 0 && ptr[2] == 0) { - *bom = GIT_BOM_UTF32_LE; + *bom = GIT_BUF_BOM_UTF32_LE; return 4; } else { - *bom = GIT_BOM_UTF16_LE; + *bom = GIT_BUF_BOM_UTF16_LE; return 2; } break; |
