diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/blogc/file.c | 4 | ||||
-rw-r--r-- | src/blogc/main.c | 2 | ||||
-rw-r--r-- | src/common/utf8.c | 8 | ||||
-rw-r--r-- | src/common/utf8.h | 6 |
4 files changed, 10 insertions, 10 deletions
diff --git a/src/blogc/file.c b/src/blogc/file.c index cede962..71598b8 100644 --- a/src/blogc/file.c +++ b/src/blogc/file.c @@ -49,7 +49,7 @@ blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err) if (str->len == 0 && read_len > 0) { // skipping BOM before validation, for performance. should be safe // enough - size_t skip = blogc_utf8_skip_bom((uint8_t*) buffer, read_len); + size_t skip = bc_utf8_skip_bom((uint8_t*) buffer, read_len); read_len -= skip; tmp += skip; } @@ -59,7 +59,7 @@ blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err) } fclose(fp); - if (!blogc_utf8_validate_str(str)) { + if (!bc_utf8_validate_str(str)) { *err = bc_error_new_printf(BLOGC_ERROR_FILE, "File content is not valid UTF-8: %s", path); bc_string_free(str, true); diff --git a/src/blogc/main.c b/src/blogc/main.c index beb67d6..992b9e7 100644 --- a/src/blogc/main.c +++ b/src/blogc/main.c @@ -162,7 +162,7 @@ main(int argc, char **argv) else if (i + 1 < argc) tmp = argv[++i]; if (tmp != NULL) { - if (!blogc_utf8_validate((uint8_t*) tmp, strlen(tmp))) { + if (!bc_utf8_validate((uint8_t*) tmp, strlen(tmp))) { fprintf(stderr, "blogc: error: invalid value for " "-D (must be valid UTF-8 string): %s\n", tmp); goto cleanup; diff --git a/src/common/utf8.c b/src/common/utf8.c index ddd51ee..625f705 100644 --- a/src/common/utf8.c +++ b/src/common/utf8.c @@ -70,7 +70,7 @@ decode(uint32_t* state, uint32_t* codep, uint32_t byte) { bool -blogc_utf8_validate(const uint8_t *str, size_t len) +bc_utf8_validate(const uint8_t *str, size_t len) { uint32_t codepoint; uint32_t state = 0; @@ -83,14 +83,14 @@ blogc_utf8_validate(const uint8_t *str, size_t len) bool -blogc_utf8_validate_str(bc_string_t *str) +bc_utf8_validate_str(bc_string_t *str) { - return blogc_utf8_validate((uint8_t*) str->str, str->len); + return bc_utf8_validate((uint8_t*) str->str, str->len); } size_t -blogc_utf8_skip_bom(const uint8_t *str, size_t len) +bc_utf8_skip_bom(const uint8_t *str, size_t len) { if (len < 3) return 0; diff --git a/src/common/utf8.h b/src/common/utf8.h index b37a97d..206b3a9 100644 --- a/src/common/utf8.h +++ b/src/common/utf8.h @@ -14,8 +14,8 @@ #include <stdint.h> #include "utils.h" -bool blogc_utf8_validate(const uint8_t *str, size_t len); -bool blogc_utf8_validate_str(bc_string_t *str); -size_t blogc_utf8_skip_bom(const uint8_t *str, size_t len); +bool bc_utf8_validate(const uint8_t *str, size_t len); +bool bc_utf8_validate_str(bc_string_t *str); +size_t bc_utf8_skip_bom(const uint8_t *str, size_t len); #endif /* _UTF_8_H */ |