diff --git a/storage/tianmu/compress/code_stream.h b/storage/tianmu/compress/code_stream.h index a77c086ed..2ff1de7f7 100644 --- a/storage/tianmu/compress/code_stream.h +++ b/storage/tianmu/compress/code_stream.h @@ -34,10 +34,10 @@ class CoderStream : protected ArithCoder { my_stream_.Reset(buf, len, pos); str_ = &my_stream_; } - void Reset(BitStream *str_ = 0) { str_ = str_; } + void Reset(BitStream *str = 0) { str_ = str; } CoderStream() { Reset(); } CoderStream(char *buf, uint len, uint pos = 0) { Reset(buf, len, pos); } - CoderStream(BitStream *str_) { Reset(str_); } + CoderStream(BitStream *str) { Reset(str); } virtual ~CoderStream() {} using ArithCoder::BaseT; using ArithCoder::MAX_TOTAL_; diff --git a/storage/tianmu/compress/data_stream.h b/storage/tianmu/compress/data_stream.h index 841eaf529..0744de736 100644 --- a/storage/tianmu/compress/data_stream.h +++ b/storage/tianmu/compress/data_stream.h @@ -42,9 +42,9 @@ class DataStream { using uint64_t = unsigned long long; void Reset() { pos_ = 0; } - void Reset(uint len_, uint pos_ = 0) { - len_ = len_; - pos_ = pos_; + void Reset(uint len, uint pos = 0) { + len_ = len; + pos_ = pos; } void Reset(char *buf, uint len, uint pos = 0) { buf_ = (uchar *)buf; @@ -57,7 +57,7 @@ class DataStream { virtual ~DataStream() {} char *GetBuf() { return (char *)buf_; } uint GetPos() { return pos_; } - void SetPos(uint pos_) { pos_ = pos_; } + void SetPos(uint pos) { pos_ = pos; } bool CanRead() { return pos_ < len_; } bool CanWrite() { return pos_ < len_; } virtual uchar Get() = 0; @@ -85,18 +85,18 @@ class BitStream : public DataStream { DataStream::Reset(); clrlen_ = 0; } - void Reset(uint len_, uint pos_ = 0) { - DataStream::Reset(len_, pos_); + void Reset(uint len, uint pos = 0) { + DataStream::Reset(len, pos); clrlen_ = 0; } - void Reset(char *buf_, uint len_, uint pos_ = 0) { - DataStream::Reset(buf_, len_, pos_); + void Reset(char *buf, uint len, uint pos = 0) { + DataStream::Reset(buf, len, pos); clrlen_ = 0; } // len_, pos_ - numbers of BITS BitStream() { Reset(0, 0, 0); } - BitStream(char *buf_, uint len_, uint pos_ = 0) { Reset(buf_, len_, pos_); } + BitStream(char *buf, uint len, uint pos = 0) { Reset(buf, len, pos); } virtual ~BitStream() {} uchar NextBit(); // show the next bit, but don't remove it from the stream uchar NextByte(); // show the next byte, but don't remove it from the stream diff --git a/storage/tianmu/compress/ppm_defs.h b/storage/tianmu/compress/ppm_defs.h index 1aa3f7a88..d712a319e 100644 --- a/storage/tianmu/compress/ppm_defs.h +++ b/storage/tianmu/compress/ppm_defs.h @@ -61,7 +61,7 @@ class PPMModel { static const int N_Symb_ = 256; public: - virtual void TransformForPPM(PPMParam param_ = PPMParam()) = 0; + virtual void TransformForPPM(PPMParam param = PPMParam()) = 0; virtual void InitPPM() = 0; diff --git a/storage/tianmu/compress/suffix_tree.cpp b/storage/tianmu/compress/suffix_tree.cpp index ef6b762b1..65d68b007 100644 --- a/storage/tianmu/compress/suffix_tree.cpp +++ b/storage/tianmu/compress/suffix_tree.cpp @@ -352,8 +352,8 @@ void SuffixTree::Print(std::ostream &str, uint flags, PNode n, PNod //------------------------------------------------------------------------ template -void SuffixTree::TransformForPPM(PPMParam param_) { - param_ = param_; +void SuffixTree::TransformForPPM(PPMParam param) { + param_ = param; // compute counts of all nodes_ in the 'tree' SetCounts(); diff --git a/storage/tianmu/compress/suffix_tree.h b/storage/tianmu/compress/suffix_tree.h index af5abcf4d..4480f7b07 100644 --- a/storage/tianmu/compress/suffix_tree.h +++ b/storage/tianmu/compress/suffix_tree.h @@ -306,7 +306,7 @@ class SuffixTree : public PPMModel { //------------------------------------------------------------------------- // definitions for PPM - void TransformForPPM(PPMParam param_ = PPMParam()) override; + void TransformForPPM(PPMParam param = PPMParam()) override; void InitPPM() override { state_ = ROOT_; } // compression: [str,len_total] -> [len_of_edge,rng,total] void Move(Symb *str, int &len, Range &rng, Count &total) override; diff --git a/storage/tianmu/compress/word_graph.cpp b/storage/tianmu/compress/word_graph.cpp index 0960425f4..5c5cb4857 100644 --- a/storage/tianmu/compress/word_graph.cpp +++ b/storage/tianmu/compress/word_graph.cpp @@ -377,8 +377,8 @@ void WordGraph::Print(std::ostream &str, [[maybe_unused]] uint flags) { // transformation for PPM //------------------------------------------------------------------------ -void WordGraph::TransformForPPM(PPMParam param_) { - param_ = param_; +void WordGraph::TransformForPPM(PPMParam param) { + param_ = param; // propagate 'stop' numbers from final nodes_ to all border-path nodes_ PropagateStop(); diff --git a/storage/tianmu/compress/word_graph.h b/storage/tianmu/compress/word_graph.h index ca4b24a0e..78e4be6bf 100644 --- a/storage/tianmu/compress/word_graph.h +++ b/storage/tianmu/compress/word_graph.h @@ -252,7 +252,7 @@ class WordGraph : public PPMModel { //------------------------------------------------------------------------- // definitions for PPM - void TransformForPPM(PPMParam param_ = PPMParam()) override; + void TransformForPPM(PPMParam param = PPMParam()) override; void InitPPM() override; // compression: [str,len_total] -> [len_of_edge,rng,total] diff --git a/storage/tianmu/types/rc_item_types.h b/storage/tianmu/types/rc_item_types.h index 0a72f6cc7..6192e174a 100644 --- a/storage/tianmu/types/rc_item_types.h +++ b/storage/tianmu/types/rc_item_types.h @@ -47,7 +47,7 @@ class Item_sum_int_rcbase : public Item_sum_num { maybe_null = null_value = 0; } - void int64_value(int64_t &value_); + void int64_value(int64_t &value); void clear() override; bool add() override; diff --git a/storage/tianmu/types/rc_num.cpp b/storage/tianmu/types/rc_num.cpp index 8ff5f0122..2b10aa98b 100644 --- a/storage/tianmu/types/rc_num.cpp +++ b/storage/tianmu/types/rc_num.cpp @@ -34,8 +34,8 @@ RCNum::RCNum(int64_t value_, short scale, bool is_double_, common::CT attrt) { Assign(value_, scale, is_double_, attrt); } -RCNum::RCNum(double value_) - : value_(*(int64_t *)&value_), scale_(0), is_double_(true), is_dot_(false), attr_type_(common::CT::REAL) { +RCNum::RCNum(double value) + : value_(*(int64_t *)&value), scale_(0), is_double_(true), is_dot_(false), attr_type_(common::CT::REAL) { null_ = (value_ == NULL_VALUE_D ? true : false); } @@ -51,10 +51,10 @@ RCNum::RCNum(const RCNum &rcn) RCNum::~RCNum() {} -RCNum &RCNum::Assign(int64_t value_, short scale, bool is_double_, common::CT attrt) { - this->value_ = value_; +RCNum &RCNum::Assign(int64_t value, short scale, bool is_double, common::CT attrt) { + this->value_ = value; this->scale_ = scale; - this->is_double_ = is_double_; + this->is_double_ = is_double; this->attr_type_ = attrt; if (scale != -1 && !is_double_) { @@ -76,8 +76,8 @@ RCNum &RCNum::Assign(int64_t value_, short scale, bool is_double_, common::CT at return *this; } -RCNum &RCNum::Assign(double value_) { - this->value_ = *(int64_t *)&value_; +RCNum &RCNum::Assign(double value) { + this->value_ = *(int64_t *)&value; this->scale_ = 0; this->is_double_ = true; this->is_dot_ = false; @@ -411,18 +411,18 @@ RCNum &RCNum::operator*=(const RCNum &rcn) { return *this; } -void fcvt(char *buf_, double val_, int digits_, int *dec_, int *sign_) { +void fcvt(char *buf, double val, int digits, int *dec, int *sign) { static int const fmtlen = 10; char format[fmtlen + 1]; - std::snprintf(format, fmtlen + 1, "%%.%df", digits_); - std::snprintf(buf_, digits_, format, val_); - int len(std::strlen(buf_)); - (*sign_) = (buf_[0] == '-') ? 1 : 0; - (*sign_) && std::memmove(buf_, buf_ + 1, len); - char *pbuf(buf_); + std::snprintf(format, fmtlen + 1, "%%.%df", digits); + std::snprintf(buf, digits, format, val); + int len(std::strlen(buf)); + (*sign) = (buf[0] == '-') ? 1 : 0; + (*sign) && std::memmove(buf, buf + 1, len); + char *pbuf(buf); ::strsep(&pbuf, ".,"); if (pbuf) { - (*dec_) = pbuf - buf_ - 1; + (*dec) = pbuf - buf - 1; std::memmove(pbuf - 1, pbuf, std::strlen(pbuf) + 1); } return; diff --git a/storage/tianmu/types/text_stat.cpp b/storage/tianmu/types/text_stat.cpp index b55acb023..5f302de63 100644 --- a/storage/tianmu/types/text_stat.cpp +++ b/storage/tianmu/types/text_stat.cpp @@ -28,7 +28,7 @@ TextStat::TextStat() { bool TextStat::AddString(const BString &rcbs) { size_t len = rcbs.size(); - if (len > TAB_SIZE) { + if (len > TAB_SIZE_) { valid_ = false; return false; } @@ -41,7 +41,7 @@ bool TextStat::AddString(const BString &rcbs) { chars_found_[256 * i + uchar(rcbs[i])] = 1; } - if (len < TAB_SIZE) + if (len < TAB_SIZE_) chars_found_[256 * len] = 1; // value of len n puts 0 on position n (starting with 0) if (len > max_string_size_) max_string_size_ = len; @@ -51,7 +51,7 @@ bool TextStat::AddString(const BString &rcbs) { bool TextStat::AddChar(uchar v, int pos) // return false if out of range { - if (static_cast(pos) >= TAB_SIZE || v == 0) { + if (static_cast(pos) >= TAB_SIZE_ || v == 0) { valid_ = false; return false; } @@ -64,9 +64,9 @@ bool TextStat::AddChar(uchar v, int pos) // return false if out of range void TextStat::AddLen(int pos) // value of len n puts 0 on position n (starting with 0) { - if (static_cast(pos) == TAB_SIZE) + if (static_cast(pos) == TAB_SIZE_) return; - DEBUG_ASSERT(static_cast(pos) < TAB_SIZE); + DEBUG_ASSERT(static_cast(pos) < TAB_SIZE_); chars_found_[256 * pos] = 1; if (static_cast(pos) > max_string_size_) max_string_size_ = pos; @@ -151,7 +151,7 @@ int64_t TextStat::Encode(const BString &rcbs, { int64_t res = 0; size_t len = rcbs.size(); - if (len > TAB_SIZE) + if (len > TAB_SIZE_) return common::NULL_VALUE_64; int charcode; for (size_t i = 0; i < len; i++) { @@ -205,9 +205,9 @@ BString TextStat::Decode(int64_t code) { int charcode; int len = max_string_size_; - char buf_val[TMP_BUFFER_SIZE] = {0}; + char buf_val[TMP_BUFFER_SIZE_] = {0}; - DEBUG_ASSERT(max_string_size_ < TMP_BUFFER_SIZE); + DEBUG_ASSERT(max_string_size_ < TMP_BUFFER_SIZE_); buf_val[max_string_size_] = 0; for (int i = max_string_size_ - 1; i >= 0; i--) { charcode = 0; diff --git a/storage/tianmu/types/text_stat.h b/storage/tianmu/types/text_stat.h index 65eac1b33..62ffad48b 100644 --- a/storage/tianmu/types/text_stat.h +++ b/storage/tianmu/types/text_stat.h @@ -55,20 +55,20 @@ class TextStat final { void Invalidate() { valid_ = false; } private: - static constexpr int TMP_BUFFER_SIZE = 49; + static constexpr int TMP_BUFFER_SIZE_ = 49; - static constexpr size_t TAB_SIZE = 48; + static constexpr size_t TAB_SIZE_ = 48; // binary length of position n, value 0 means that this is a constant // character - std::array len_table_; + std::array len_table_; // encode_table[c + 256 * n] is a character for code c on position n - std::array encode_table_; + std::array encode_table_; // a buffer for two purposes: collecting 0/1 info about chars found, or // collecting decoding into - std::array chars_found_; + std::array chars_found_; bool chars_found_for_decoding_{false}; // true, if chars_found is initialized for value decoding bool valid_{true};