diff --git a/bp.c b/bp.c index c9998d7..ec2b180 100644 --- a/bp.c +++ b/bp.c @@ -202,9 +202,9 @@ static void cleanup(void) if (modifying_file && backup_file) { rewind(modifying_file); ftruncate(fileno(modifying_file), 0); - fwrite(backup_file->start, 1, - (size_t)(backup_file->end - backup_file->start), - modifying_file); + (void)fwrite(backup_file->start, 1, + (size_t)(backup_file->end - backup_file->start), + modifying_file); fclose(modifying_file); modifying_file = NULL; } diff --git a/pattern.c b/pattern.c index 0faf39d..6340047 100644 --- a/pattern.c +++ b/pattern.c @@ -50,7 +50,7 @@ pat_t *new_pat(file_t *f, const char *start, const char *end, size_t minlen, ssi static pat_t *new_range(file_t *f, const char *start, const char *end, size_t min, ssize_t max, pat_t *repeating, pat_t *sep) { size_t minlen = min*repeating->min_matchlen + (min > 0 ? min-1 : 0)*(sep ? sep->min_matchlen : 0); - ssize_t maxlen = (max == -1 || UNBOUNDED(repeating) || (max != 0 && max != 1 && sep && UNBOUNDED(sep))) ? -1 + ssize_t maxlen = (max == -1 || UNBOUNDED(repeating) || (max != 0 && max != 1 && sep && UNBOUNDED(sep))) ? (ssize_t)-1 : max*repeating->max_matchlen + (ssize_t)(max > 0 ? min-1 : 0)*(ssize_t)(sep ? sep->min_matchlen : 0); pat_t *range = new_pat(f, start, end, minlen, maxlen, BP_REPEAT); range->args.repetitions.min = min; @@ -141,7 +141,7 @@ pat_t *chain_together(file_t *f, pat_t *first, pat_t *second) if (first == NULL) return second; if (second == NULL) return first; size_t minlen = first->min_matchlen + second->min_matchlen; - ssize_t maxlen = (UNBOUNDED(first) || UNBOUNDED(second)) ? -1 : first->max_matchlen + second->max_matchlen; + ssize_t maxlen = (UNBOUNDED(first) || UNBOUNDED(second)) ? (ssize_t)-1 : first->max_matchlen + second->max_matchlen; pat_t *chain = new_pat(f, first->start, second->end, minlen, maxlen, BP_CHAIN); chain->args.multiple.first = first; chain->args.multiple.second = second; @@ -174,7 +174,7 @@ pat_t *either_pat(file_t *f, pat_t *first, pat_t *second) if (first == NULL) return second; if (second == NULL) return first; size_t minlen = first->min_matchlen < second->min_matchlen ? first->min_matchlen : second->min_matchlen; - ssize_t maxlen = (UNBOUNDED(first) || UNBOUNDED(second)) ? -1 : + ssize_t maxlen = (UNBOUNDED(first) || UNBOUNDED(second)) ? (ssize_t)-1 : (first->max_matchlen > second->max_matchlen ? first->max_matchlen : second->max_matchlen); pat_t *either = new_pat(f, first->start, second->end, minlen, maxlen, BP_OTHERWISE); either->args.multiple.first = first; diff --git a/utf8.h b/utf8.h index fb353d9..8d7d969 100644 --- a/utf8.h +++ b/utf8.h @@ -12,7 +12,7 @@ // (i.e. skip forward one codepoint at a time, not one byte at a time) // __attribute__((nonnull, pure)) -static inline const char *next_char(file_t *f, const char *str) +inline const char *next_char(file_t *f, const char *str) { if (__builtin_expect(str+1 <= f->end && (str[0] & 0x80) == 0x0, 1)) return str+1; @@ -30,7 +30,7 @@ static inline const char *next_char(file_t *f, const char *str) // (i.e. skip backwards one codepoint at a time, not one byte at a time) // __attribute__((nonnull, pure)) -static inline const char *prev_char(file_t *f, const char *str) +inline const char *prev_char(file_t *f, const char *str) { if (__builtin_expect(str-1 >= f->start && (str[-1] & 0x80) == 0x0, 1)) return str-1;