Skip to content

Commit

Permalink
clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
shaomeng committed May 28, 2024
1 parent 791d556 commit 1cc2395
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
builddir: 'build'
excludedirs: ''
extensions: 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'
cmakeoptions: '-DBUILD_CLI_UTILITIES=OFF -DBUILD_UNIT_TESTS=OFF -DUSE_ZSTD=OFF'
cmakeoptions: '-DBUILD_CLI_UTILITIES=OFF -DBUILD_UNIT_TESTS=OFF'
2 changes: 1 addition & 1 deletion include/SPERR3D_Stream_Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SPERR3D_Stream_Tools {

// Function that reads in portions of a file only to facilitate progressive access.
// (This function does not read the whole file.)
auto progressive_read(std::string filename, unsigned pct) const -> vec8_type;
auto progressive_read(const std::string& filename, unsigned pct) const -> vec8_type;

// Function that truncates a bitstream in the memory to facilitate progressive access.
// Note on `stream_len`: it does not need to be the full length of the original bitstream,
Expand Down
2 changes: 1 addition & 1 deletion src/SPERR3D_Stream_Tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ auto sperr::SPERR3D_Stream_Tools::get_stream_header(const void* p) const -> SPER
return header;
}

auto sperr::SPERR3D_Stream_Tools::progressive_read(std::string filename, unsigned pct) const
auto sperr::SPERR3D_Stream_Tools::progressive_read(const std::string& filename, unsigned pct) const
-> vec8_type
{
// Read the header of this bitstream.
Expand Down
20 changes: 10 additions & 10 deletions src/SPERR_C_API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

#include "SPERR3D_Stream_Tools.h"

int C_API::sperr_comp_2d(const void* src,
auto C_API::sperr_comp_2d(const void* src,
int is_float,
size_t dimx,
size_t dimy,
int mode,
double quality,
int out_inc_header,
void** dst,
size_t* dst_len)
size_t* dst_len) -> int
{
// Examine if `dst` is pointing to a NULL pointer
if (*dst != nullptr)
Expand Down Expand Up @@ -95,12 +95,12 @@ int C_API::sperr_comp_2d(const void* src,
return 0;
}

int C_API::sperr_decomp_2d(const void* src,
auto C_API::sperr_decomp_2d(const void* src,
size_t src_len,
int output_float,
size_t dimx,
size_t dimy,
void** dst)
void** dst) -> int
{
// Examine if `dst` is pointing to a NULL pointer
if (*dst != nullptr)
Expand Down Expand Up @@ -153,7 +153,7 @@ void C_API::sperr_parse_header(const void* src,
*dimz = dims[2];
}

int C_API::sperr_comp_3d(const void* src,
auto C_API::sperr_comp_3d(const void* src,
int is_float,
size_t dimx,
size_t dimy,
Expand All @@ -165,7 +165,7 @@ int C_API::sperr_comp_3d(const void* src,
double quality,
size_t nthreads,
void** dst,
size_t* dst_len)
size_t* dst_len) -> int
{
// Examine if `dst` is pointing to a NULL pointer
if (*dst != nullptr)
Expand Down Expand Up @@ -215,14 +215,14 @@ int C_API::sperr_comp_3d(const void* src,
return 0;
}

int C_API::sperr_decomp_3d(const void* src,
auto C_API::sperr_decomp_3d(const void* src,
size_t src_len,
int output_float,
size_t nthreads,
size_t* dimx,
size_t* dimy,
size_t* dimz,
void** dst)
void** dst) -> int
{
// Examine if `dst` is pointing to a NULL pointer.
if (*dst != nullptr)
Expand Down Expand Up @@ -257,11 +257,11 @@ int C_API::sperr_decomp_3d(const void* src,
return 0;
}

int C_API::sperr_trunc_3d(const void* src,
auto C_API::sperr_trunc_3d(const void* src,
size_t src_len,
unsigned pct,
void** dst,
size_t* dst_len)
size_t* dst_len) -> int
{
if (*dst != nullptr)
return 1;
Expand Down
2 changes: 1 addition & 1 deletion src/notes_on_clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .

2. I used the following clang-tidy options:

clang-tidy-10 ../src/SPECK3D.cpp -checks=-*,performance-*,portability-*,modernize-*,clang-analyzer-*,-modernize-avoid-c-arrays,-modernize-use-nodiscard -header-filter=../include/* -fix
clang-tidy ../src/SPECK3D.cpp -checks=-*,performance-*,portability-*,modernize-*,clang-analyzer-*,-modernize-avoid-c-arrays,-modernize-use-nodiscard -header-filter=../include/* -fix
8 changes: 4 additions & 4 deletions src/sperr_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ auto sperr::coarsened_resolutions(dims_type vdim, dims_type cdim) -> std::vector
auto nz = vdim[2] / cdim[2];

resolutions = sperr::coarsened_resolutions(cdim);
for (size_t i = 0; i < resolutions.size(); i++) {
resolutions[i][0] *= nx;
resolutions[i][1] *= ny;
resolutions[i][2] *= nz;
for (auto & resolution : resolutions) {
resolution[0] *= nx;
resolution[1] *= ny;
resolution[2] *= nz;
}
}

Expand Down

0 comments on commit 1cc2395

Please sign in to comment.