diff --git a/cpp/include/kvikio/cufile/config.hpp b/cpp/include/kvikio/cufile/config.hpp index 5d48106c9b..fd721e5fe4 100644 --- a/cpp/include/kvikio/cufile/config.hpp +++ b/cpp/include/kvikio/cufile/config.hpp @@ -26,6 +26,6 @@ namespace kvikio { * * @return The filepath to the cufile.json file or the empty string if it isn't found. */ -[[nodiscard]] KVIKIO_EXPORT const std::string& config_path(); +[[nodiscard]] KVIKIO_EXPORT std::string const& config_path(); } // namespace kvikio diff --git a/cpp/include/kvikio/shim/cufile_h_wrapper.hpp b/cpp/include/kvikio/shim/cufile_h_wrapper.hpp index cc2e2ac47e..66f5adbaf3 100644 --- a/cpp/include/kvikio/shim/cufile_h_wrapper.hpp +++ b/cpp/include/kvikio/shim/cufile_h_wrapper.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024, NVIDIA CORPORATION. + * Copyright (c) 2022-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cpp/include/kvikio/utils.hpp b/cpp/include/kvikio/utils.hpp index e41a486e10..b10e54c482 100644 --- a/cpp/include/kvikio/utils.hpp +++ b/cpp/include/kvikio/utils.hpp @@ -72,9 +72,9 @@ template >* = nullptr> * @return The boolean answer */ #ifdef KVIKIO_CUDA_FOUND -bool is_host_memory(const void* ptr); +bool is_host_memory(void const* ptr); #else -constexpr bool is_host_memory(const void* ptr) { return true; } +constexpr bool is_host_memory(void const* ptr) { return true; } #endif /** diff --git a/cpp/src/file_handle.cpp b/cpp/src/file_handle.cpp index d41525b65e..d6b96f3d6d 100644 --- a/cpp/src/file_handle.cpp +++ b/cpp/src/file_handle.cpp @@ -106,7 +106,7 @@ int open_fd(std::string const& file_path, std::string const& flags, bool o_direc */ [[nodiscard]] std::size_t get_file_size(int file_descriptor) { - struct stat st{}; + struct stat st {}; int ret = fstat(file_descriptor, &st); if (ret == -1) { throw std::system_error(errno, std::generic_category(), "Unable to query file size"); diff --git a/cpp/src/shim/utils.cpp b/cpp/src/shim/utils.cpp index 6e16c07e80..91f4f28d19 100644 --- a/cpp/src/shim/utils.cpp +++ b/cpp/src/shim/utils.cpp @@ -48,7 +48,7 @@ void* load_library(std::vector const& names, int mode) bool is_running_in_wsl() noexcept { try { - struct utsname buf{}; + struct utsname buf {}; int err = ::uname(&buf); if (err == 0) { std::string const name(static_cast(buf.release)); diff --git a/cpp/src/utils.cpp b/cpp/src/utils.cpp index 3b83b6a515..bed2cbafbc 100644 --- a/cpp/src/utils.cpp +++ b/cpp/src/utils.cpp @@ -56,7 +56,7 @@ CUdeviceptr convert_void2deviceptr(void const* devPtr) } #ifdef KVIKIO_CUDA_FOUND -bool is_host_memory(const void* ptr) +bool is_host_memory(void const* ptr) { CUpointer_attribute attrs[1] = { CU_POINTER_ATTRIBUTE_MEMORY_TYPE, diff --git a/cpp/tests/test_basic_io.cpp b/cpp/tests/test_basic_io.cpp index c884ec6230..e16bd99d83 100644 --- a/cpp/tests/test_basic_io.cpp +++ b/cpp/tests/test_basic_io.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, NVIDIA CORPORATION. + * Copyright (c) 2024-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ TEST_F(BasicIOTest, write_read_async) // Explicitly set compatibility mode std::array compat_modes{kvikio::CompatMode::AUTO, kvikio::CompatMode::ON}; - for (const auto& compat_mode : compat_modes) { + for (auto const& compat_mode : compat_modes) { { kvikio::FileHandle f(_filepath, "w", kvikio::FileHandle::m644, compat_mode); auto stream_future = f.write_async(_dev_a.ptr, _dev_a.nbytes, 0, 0, stream); diff --git a/cpp/tests/test_defaults.cpp b/cpp/tests/test_defaults.cpp index c4a88775e4..c95e9d1d11 100644 --- a/cpp/tests/test_defaults.cpp +++ b/cpp/tests/test_defaults.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, NVIDIA CORPORATION. + * Copyright (c) 2024-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ TEST(Defaults, parse_compat_mode_str) { std::vector inputs{ "ON", "on", "On", "TRUE", "true", "True", "YES", "yes", "Yes", "1"}; - for (const auto& input : inputs) { + for (auto const& input : inputs) { EXPECT_EQ(kvikio::detail::parse_compat_mode_str(input), kvikio::CompatMode::ON); } } @@ -32,21 +32,21 @@ TEST(Defaults, parse_compat_mode_str) { std::vector inputs{ "OFF", "off", "oFf", "FALSE", "false", "False", "NO", "no", "No", "0"}; - for (const auto& input : inputs) { + for (auto const& input : inputs) { EXPECT_EQ(kvikio::detail::parse_compat_mode_str(input), kvikio::CompatMode::OFF); } } { std::vector inputs{"AUTO", "auto", "aUtO"}; - for (const auto& input : inputs) { + for (auto const& input : inputs) { EXPECT_EQ(kvikio::detail::parse_compat_mode_str(input), kvikio::CompatMode::AUTO); } } { std::vector inputs{"", "invalidOption", "11", "*&^Yes"}; - for (const auto& input : inputs) { + for (auto const& input : inputs) { EXPECT_THROW(kvikio::detail::parse_compat_mode_str(input), std::invalid_argument); } } diff --git a/cpp/tests/utils.hpp b/cpp/tests/utils.hpp index 1c671a82bc..5722d3db25 100644 --- a/cpp/tests/utils.hpp +++ b/cpp/tests/utils.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, NVIDIA CORPORATION. + * Copyright (c) 2024-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ namespace kvikio::test { */ class TempDir { public: - TempDir(const bool cleanup = true) : _cleanup{cleanup} + TempDir(bool const cleanup = true) : _cleanup{cleanup} { std::string tpl{std::filesystem::temp_directory_path() / "kvikio.XXXXXX"}; if (mkdtemp(tpl.data()) == nullptr) { @@ -91,17 +91,17 @@ class TempDir { } } - TempDir(const TempDir&) = delete; + TempDir(TempDir const&) = delete; TempDir& operator=(TempDir const&) = delete; - TempDir(const TempDir&&) = delete; + TempDir(TempDir const&&) = delete; TempDir&& operator=(TempDir const&&) = delete; - const std::filesystem::path& path() { return _dir_path; } + std::filesystem::path const& path() { return _dir_path; } operator std::string() { return path(); } private: - const bool _cleanup; + bool const _cleanup; std::filesystem::path _dir_path{}; }; @@ -120,7 +120,7 @@ class DevBuffer { { KVIKIO_CHECK_CUDA(cudaMalloc(&ptr, nbytes)); } - DevBuffer(const std::vector& host_buffer) : DevBuffer{host_buffer.size()} + DevBuffer(std::vector const& host_buffer) : DevBuffer{host_buffer.size()} { KVIKIO_CHECK_CUDA(cudaMemcpy(ptr, host_buffer.data(), nbytes, cudaMemcpyHostToDevice)); } @@ -149,7 +149,7 @@ class DevBuffer { return DevBuffer{host_buffer}; } - [[nodiscard]] static DevBuffer zero_like(const DevBuffer& prototype) + [[nodiscard]] static DevBuffer zero_like(DevBuffer const& prototype) { DevBuffer ret{prototype.nelem}; KVIKIO_CHECK_CUDA(cudaMemset(ret.ptr, 0, ret.nbytes)); @@ -176,7 +176,7 @@ class DevBuffer { /** * @brief Check that two buffers are equal */ -inline void expect_equal(const DevBuffer& a, const DevBuffer& b) +inline void expect_equal(DevBuffer const& a, DevBuffer const& b) { EXPECT_EQ(a.nbytes, b.nbytes); auto a_vec = a.to_vector(); diff --git a/java/src/main/native/src/CuFileJni.cpp b/java/src/main/native/src/CuFileJni.cpp index 9aa4131fe2..829fcbf5f9 100644 --- a/java/src/main/native/src/CuFileJni.cpp +++ b/java/src/main/native/src/CuFileJni.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, NVIDIA CORPORATION. + * Copyright (c) 2024-2025, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -168,7 +168,7 @@ JNIEXPORT jlong JNICALL Java_ai_rapids_kvikio_cufile_CuFileDriver_create(JNIEnv* { try { return reinterpret_cast(new cufile_driver()); - } catch (const std::exception& e) { + } catch (std::exception const& e) { jlong default_ret_val = 0; if (env->ExceptionOccurred()) { return default_ret_val; }