diff --git a/include/LightGBM/utils/common.h b/include/LightGBM/utils/common.h index 55c14e9028e6..8acf62d218e9 100644 --- a/include/LightGBM/utils/common.h +++ b/include/LightGBM/utils/common.h @@ -313,6 +313,7 @@ inline static unsigned CountDecimalDigit32(uint32_t n) { 1000000000 }; #ifdef _MSC_VER + // NOLINTNEXTLINE unsigned long i = 0; _BitScanReverse(&i, n | 1); uint32_t t = (i + 1) * 1233 >> 12; diff --git a/src/io/dataset.cpp b/src/io/dataset.cpp index e48636c103df..fa979d61cadd 100644 --- a/src/io/dataset.cpp +++ b/src/io/dataset.cpp @@ -434,7 +434,7 @@ void Dataset::FinishLoad() { void PushDataToMultiValBin( data_size_t num_data, const std::vector most_freq_bins, const std::vector offsets, - std::vector>>& iters, + std::vector>>* iters, MultiValBin* ret) { Common::FunctionTimer fun_time("Dataset::PushDataToMultiValBin", global_timer); @@ -444,12 +444,12 @@ void PushDataToMultiValBin( std::vector cur_data; cur_data.reserve(most_freq_bins.size()); for (size_t j = 0; j < most_freq_bins.size(); ++j) { - iters[tid][j]->Reset(start); + (*iters)[tid][j]->Reset(start); } for (data_size_t i = start; i < end; ++i) { cur_data.clear(); for (size_t j = 0; j < most_freq_bins.size(); ++j) { - auto cur_bin = iters[tid][j]->Get(i); + auto cur_bin = (*iters)[tid][j]->Get(i); if (cur_bin == most_freq_bins[j]) { continue; } @@ -467,11 +467,11 @@ void PushDataToMultiValBin( 0, num_data, 1024, [&](int tid, data_size_t start, data_size_t end) { std::vector cur_data(most_freq_bins.size(), 0); for (size_t j = 0; j < most_freq_bins.size(); ++j) { - iters[tid][j]->Reset(start); + (*iters)[tid][j]->Reset(start); } for (data_size_t i = start; i < end; ++i) { for (size_t j = 0; j < most_freq_bins.size(); ++j) { - auto cur_bin = iters[tid][j]->Get(i); + auto cur_bin = (*iters)[tid][j]->Get(i); if (cur_bin == most_freq_bins[j]) { cur_bin = 0; } else { @@ -528,7 +528,7 @@ MultiValBin* Dataset::GetMultiBinFromSparseFeatures() const { std::unique_ptr ret; ret.reset(MultiValBin::CreateMultiValBin(num_data_, offsets.back(), num_feature, sum_sparse_rate)); - PushDataToMultiValBin(num_data_, most_freq_bins, offsets, iters, ret.get()); + PushDataToMultiValBin(num_data_, most_freq_bins, offsets, &iters, ret.get()); ret->FinishLoad(); return ret.release(); } @@ -581,7 +581,7 @@ MultiValBin* Dataset::GetMultiBinFromAllFeatures() const { ret.reset(MultiValBin::CreateMultiValBin( num_data_, num_total_bin, static_cast(most_freq_bins.size()), 1.0 - sum_dense_ratio)); - PushDataToMultiValBin(num_data_, most_freq_bins, offsets, iters, ret.get()); + PushDataToMultiValBin(num_data_, most_freq_bins, offsets, &iters, ret.get()); ret->FinishLoad(); return ret.release(); } diff --git a/src/io/tree.cpp b/src/io/tree.cpp index 52145acad196..be928b7e3124 100644 --- a/src/io/tree.cpp +++ b/src/io/tree.cpp @@ -57,7 +57,7 @@ int Tree::Split(int leaf, int feature, int real_feature, uint32_t threshold_bin, decision_type_[new_node_idx] = 0; SetDecisionType(&decision_type_[new_node_idx], false, kCategoricalMask); SetDecisionType(&decision_type_[new_node_idx], default_left, kDefaultLeftMask); - SetMissingType(&decision_type_[new_node_idx], missing_type); + SetMissingType(&decision_type_[new_node_idx], static_cast(missing_type)); threshold_in_bin_[new_node_idx] = threshold_bin; threshold_[new_node_idx] = threshold_double; ++num_leaves_; @@ -71,7 +71,7 @@ int Tree::SplitCategorical(int leaf, int feature, int real_feature, const uint32 int new_node_idx = num_leaves_ - 1; decision_type_[new_node_idx] = 0; SetDecisionType(&decision_type_[new_node_idx], true, kCategoricalMask); - SetMissingType(&decision_type_[new_node_idx], missing_type); + SetMissingType(&decision_type_[new_node_idx], static_cast(missing_type)); threshold_in_bin_[new_node_idx] = num_cat_; threshold_[new_node_idx] = num_cat_; ++num_cat_; diff --git a/src/network/socket_wrapper.hpp b/src/network/socket_wrapper.hpp index 244bc0db548f..70f9586b99c5 100644 --- a/src/network/socket_wrapper.hpp +++ b/src/network/socket_wrapper.hpp @@ -218,6 +218,7 @@ class TcpSocket { continue; } if (ifa->ifa_addr->sa_family == AF_INET) { + // NOLINTNEXTLINE tmpAddrPtr = &((struct sockaddr_in *)ifa->ifa_addr)->sin_addr; char addressBuffer[INET_ADDRSTRLEN]; inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);