diff options
author | David Robillard <d@drobilla.net> | 2023-02-04 19:25:22 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-02-04 19:25:22 -0500 |
commit | 5a9787b4247c6735cc3213944945e8983002edf9 (patch) | |
tree | 635a8711a53b9e50d7dcd24dc4acefefce694c3d /src | |
parent | c4b3814edad510c6c124089822bd5506f9334411 (diff) | |
download | zix-5a9787b4247c6735cc3213944945e8983002edf9.tar.gz zix-5a9787b4247c6735cc3213944945e8983002edf9.tar.bz2 zix-5a9787b4247c6735cc3213944945e8983002edf9.zip |
Suppress/fix clang-tidy warnings on Windows
Diffstat (limited to 'src')
-rw-r--r-- | src/path.c | 4 | ||||
-rw-r--r-- | src/win32/.clang-tidy | 8 | ||||
-rw-r--r-- | src/win32/filesystem_win32.c | 4 |
3 files changed, 14 insertions, 2 deletions
@@ -182,6 +182,10 @@ ZIX_PURE_FUNC static ZixIndexRange zix_path_filename_range(const ZixStringView path) { + if (!path.length) { + return zix_make_range(0, 0); + } + // Find the first filename character (skip leading root path if any) const size_t begin = zix_path_root_path_range(path.data).end; if (begin == path.length || is_dir_sep(path.data[path.length - 1U])) { diff --git a/src/win32/.clang-tidy b/src/win32/.clang-tidy new file mode 100644 index 0000000..386137b --- /dev/null +++ b/src/win32/.clang-tidy @@ -0,0 +1,8 @@ +# Copyright 2021-2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +Checks: > + -hicpp-signed-bitwise, + -misc-misplaced-const, + -performance-no-int-to-ptr, +InheritParentConfig: true diff --git a/src/win32/filesystem_win32.c b/src/win32/filesystem_win32.c index 0484684..0038189 100644 --- a/src/win32/filesystem_win32.c +++ b/src/win32/filesystem_win32.c @@ -90,7 +90,7 @@ zix_create_temporary_directory(ZixAllocator* const allocator, // Ensure that the pattern ends with "XXXXXX" const size_t length = strlen(path_pattern); - if (length < 7 || strcmp(path_pattern + length - 6, "XXXXXX")) { + if (length < 7 || !!strcmp(path_pattern + length - 6, "XXXXXX")) { errno = EINVAL; return NULL; } @@ -206,7 +206,7 @@ zix_canonical_path(ZixAllocator* const allocator, const char* const path) } char* const final = (char*)zix_calloc(allocator, final_size + 1U, 1U); - if (final && !GetFinalPathNameByHandle(h, final, final_size + 1U, flags)) { + if (!final || !GetFinalPathNameByHandle(h, final, final_size + 1U, flags)) { zix_free(allocator, final); CloseHandle(h); return NULL; |