diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..abd53ef --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,3 @@ +# git config blame.ignoreRevsFile .git-blame-ignore-revs +# ignore codestyle commits +1a6aebd9d208d77f161b50a74fd0c673c1746e70 \ No newline at end of file diff --git a/blobstamper/dict.cpp b/blobstamper/dict.cpp index 85481e1..5ecf856 100644 --- a/blobstamper/dict.cpp +++ b/blobstamper/dict.cpp @@ -16,7 +16,7 @@ * ******************************************************************************/ -#include"dict.h" +#include "dict.h" size_t diff --git a/blobstamper/dict.h b/blobstamper/dict.h index 688e754..0098a41 100644 --- a/blobstamper/dict.h +++ b/blobstamper/dict.h @@ -20,8 +20,8 @@ #define DICT_H -#include -#include +#include +#include class DictBase @@ -31,10 +31,10 @@ class DictBase public: size_t size(); std::string get(size_t n); // FIXME May be it would be good to use operator[] later. - DictBase() {data = {};}; + DictBase() { data = {}; }; }; -class DictLCAlphaSmall : public DictBase +class DictLCAlphaSmall: public DictBase { public: DictLCAlphaSmall(); diff --git a/blobstamper/galley.cpp b/blobstamper/galley.cpp index 918d5b8..7dba7a5 100644 --- a/blobstamper/galley.cpp +++ b/blobstamper/galley.cpp @@ -427,7 +427,7 @@ GalleySetBase::minSize() if (unbounded_count > 1) /* One unbounded stamp will take all data. Nothing to predict */ res += ORACLE_SIZE * unbounded_count; - return res; + return res; } int diff --git a/blobstamper/galley.h b/blobstamper/galley.h index a5b5080..563fd2c 100644 --- a/blobstamper/galley.h +++ b/blobstamper/galley.h @@ -81,7 +81,7 @@ GalleyVectorV::ExtractValuesVector(std::shared_ptr blob) std::vector> blobs = extract_internal(blob); std::vector res(blobs.size()); - for(int i=0; i>(stamp)->ExtractValue(blobs[i]); } diff --git a/blobstamper/oracle.cpp b/blobstamper/oracle.cpp index 149186f..f640647 100644 --- a/blobstamper/oracle.cpp +++ b/blobstamper/oracle.cpp @@ -31,7 +31,7 @@ OracleProportion(ORACLE_TYPE oracle, size_t min, size_t max) * хвоста диапазона предсказания не попасть никогда и тогда он не округлиться * в max + 1*/ size_t delta = max - min + 1; - size_t res = floor(((float) oracle) / ((float) ORACLE_MAX + 1) * delta ); + size_t res = floor(((float) oracle) / ((float) ORACLE_MAX + 1) * delta); return min + res; } diff --git a/blobstamper/stamp.cpp b/blobstamper/stamp.cpp index 7fd3221..1b1adc6 100644 --- a/blobstamper/stamp.cpp +++ b/blobstamper/stamp.cpp @@ -43,7 +43,7 @@ StampBase::Load(std::shared_ptr blob) { res_size = maxSize(); if (res_size > blob->Size()) - res_size = blob->Size(); + res_size = blob->Size(); } bitten_blob = blob->Chop(res_size); } diff --git a/blobstamper/stamp.h b/blobstamper/stamp.h index 63465fa..97d7316 100644 --- a/blobstamper/stamp.h +++ b/blobstamper/stamp.h @@ -40,9 +40,9 @@ class StampBase void Load(std::shared_ptr blob); - bool isFixedSize() {return minSize() == maxSize();} - bool isVariated() {return ! isFixedSize() && ! isUnbounded();} - bool isUnbounded() {return maxSize() == -1;} + bool isFixedSize() { return minSize() == maxSize(); } + bool isVariated() { return !isFixedSize() && !isUnbounded(); } + bool isUnbounded() { return maxSize() == -1; } virtual bool isRecursive() {return is_recursive;} }; @@ -90,8 +90,8 @@ StampBasePV::ExtractBin(std::shared_ptr blob) return v; } -template class StampBaseV: public StampBasePV -,public virtual StampBase //FIXME I do not understand why do we need it here, but wihtout it, it does not build +template class StampBaseV: public StampBasePV, +public virtual StampBase //FIXME I do not understand why do we need it here, but wihtout it, it does not build { public: virtual T ExtractValue(std::shared_ptr blob) = 0;/* Should be defined by derived classes*/ diff --git a/blobstamper/stamp_dict.cpp b/blobstamper/stamp_dict.cpp index 7a0be53..3abbcf1 100644 --- a/blobstamper/stamp_dict.cpp +++ b/blobstamper/stamp_dict.cpp @@ -24,17 +24,17 @@ int StampDict::ChooseStampSize(std::shared_ptr dict) { - if (dict->size() <= UCHAR_MAX+1) + if (dict->size() <= UCHAR_MAX + 1) { stamp_max_value = UCHAR_MAX; return 1; } - if (dict->size() <= USHRT_MAX+1) + if (dict->size() <= USHRT_MAX + 1) { stamp_max_value = USHRT_MAX; return 2; } - if (dict->size() <= UINT_MAX+1) + if (dict->size() <= UINT_MAX + 1) { stamp_max_value = UINT_MAX; return 4; @@ -76,6 +76,6 @@ StampDict::ExtractStr(std::shared_ptr blob) exit(1); } long long actual_index = ((double) index_oracle) / stamp_max_value * dict->size(); - if ( actual_index == dict->size()) actual_index--; /* If we hit the boundary step inside a bit*/ + if (actual_index == dict->size()) actual_index--; /* If we hit the boundary step inside a bit*/ return dict->get(actual_index); } diff --git a/blobstamper/stamp_dict.h b/blobstamper/stamp_dict.h index 36ecad9..9cd4dfc 100644 --- a/blobstamper/stamp_dict.h +++ b/blobstamper/stamp_dict.h @@ -47,10 +47,10 @@ class StampDict: public StampBaseStr int maxSize() override {return stamp_size;} }; -class StampDictLCAlphaSmall : public StampDict +class StampDictLCAlphaSmall: public StampDict { public: - StampDictLCAlphaSmall (): StampDict(std::make_shared()) {}; + StampDictLCAlphaSmall(): StampDict(std::make_shared()) {}; }; diff --git a/blobstamper/stamp_enumerator.cpp b/blobstamper/stamp_enumerator.cpp index 9419dd1..8e1146c 100644 --- a/blobstamper/stamp_enumerator.cpp +++ b/blobstamper/stamp_enumerator.cpp @@ -29,13 +29,13 @@ std::string StampStrEnumerator::ExtractStr(std::shared_ptr blob) std::vector data = ExtractStrVector(blob); std::string res = ""; - for(std::string s : data) + for (std::string s : data) { if (!res.empty()) { - res+= separator; + res += separator; } - res+= s; + res += s; } res = left_bracket + res + right_bracket; return res; diff --git a/blobstamper/stamp_enumerator.h b/blobstamper/stamp_enumerator.h index 20c5761..dc30c6d 100644 --- a/blobstamper/stamp_enumerator.h +++ b/blobstamper/stamp_enumerator.h @@ -19,11 +19,11 @@ #ifndef STAMP_ENUMERATOR_H #define STAMP_ENUMERATOR_H -#include"galley.h" -#include"stamp.h" -#include"blob.h" +#include "galley.h" +#include "stamp.h" +#include "blob.h" -#include +#include class StampStrEnumerator: public GalleyVectorStr, public StampBaseStr { diff --git a/blobstamper/stamp_json.cpp b/blobstamper/stamp_json.cpp index baba678..0fb5d2d 100644 --- a/blobstamper/stamp_json.cpp +++ b/blobstamper/stamp_json.cpp @@ -27,7 +27,7 @@ PoolPickerStamp::PoolPickerStamp(std::vector> new_pool) : pool{new_pool} { - for(auto stamp : pool) + for (auto stamp : pool) { std::weak_ptr wp = stamp; weak_pool.push_back(wp); @@ -37,10 +37,10 @@ PoolPickerStamp::PoolPickerStamp(std::vector> new_ bool PoolPickerStamp::isRecursive() { - if(is_recursive || is_in_recursion) + if (is_recursive || is_in_recursion) return true; is_in_recursion = true; - for(auto stamp : weak_pool) + for (auto stamp : weak_pool) { if (stamp.lock()->isRecursive()) { @@ -62,7 +62,7 @@ PoolPickerStamp::ExtractStr(std::shared_ptr blob) std::vector> target_pool; std::vector> unbounded_pool; - for(auto stamp_w : weak_pool) + for (auto stamp_w : weak_pool) { auto stamp = stamp_w.lock(); if (stamp->minSize() <= blob->Size()) @@ -75,7 +75,7 @@ PoolPickerStamp::ExtractStr(std::shared_ptr blob) } } if (unbounded_pool.size()>0) - target_pool = unbounded_pool; + target_pool = unbounded_pool; size_t index = OracleProportion(oracle, 0, target_pool.size() - 1); return target_pool[index].lock()->ExtractStr(blob); @@ -111,7 +111,7 @@ PoolPickerStamp::maxSize() if (is_recursive || is_in_recursion) return -1; is_in_recursion = true; /* Do not use isRecursive() inside as it uses same flag*/ - for(auto stamp : weak_pool) + for (auto stamp : weak_pool) { int candidat = stamp.lock()->maxSize(); if (candidat == -1) diff --git a/blobstamper/stamp_json.h b/blobstamper/stamp_json.h index af1a7f0..8e6508a 100644 --- a/blobstamper/stamp_json.h +++ b/blobstamper/stamp_json.h @@ -27,7 +27,7 @@ #include "stamp_dict.h" #include "stamp_enumerator.h" -class PoolPickerStamp : public virtual StampBaseStr +class PoolPickerStamp: public virtual StampBaseStr { protected: std::vector> pool; @@ -44,15 +44,15 @@ class PoolPickerStamp : public virtual StampBaseStr virtual int maxSize() override; }; -class StampJSONInt : public virtual StampArithm +class StampJSONInt: public virtual StampArithm { }; -class StampJSONFloat : public virtual StampArithm +class StampJSONFloat: public virtual StampArithm { }; -class StampJSONString : public virtual StampDictT +class StampJSONString: public virtual StampDictT { protected: public: @@ -66,8 +66,8 @@ class StampJSONArray: public StampStrEnumerator { private: public: - StampJSONArray(std::shared_ptr picker) - :StampStrEnumerator(picker, ", ", "[", "]") {}; + StampJSONArray(std::shared_ptr picker): + StampStrEnumerator(picker, ", ", "[", "]") {}; }; class StampJSONHashEl: public StampBaseStr @@ -76,8 +76,8 @@ class StampJSONHashEl: public StampBaseStr std::shared_ptr stamp_name; std::shared_ptr stamp_value; public: - StampJSONHashEl(std::shared_ptr picker) - :stamp_value(picker), stamp_name(std::make_shared()) {}; + StampJSONHashEl(std::shared_ptr picker): + stamp_value(picker), stamp_name(std::make_shared()) {}; virtual int minSize() override {return stamp_name->minSize() + stamp_value->minSize();}; virtual int maxSize() override {return -1;}; std::string ExtractStr(std::shared_ptr blob) override; @@ -88,8 +88,8 @@ class StampJSONHash: public StampStrEnumerator private: std::shared_ptr stamp_el; public: - StampJSONHash(std::shared_ptr picker) - :StampStrEnumerator(stamp_el = std::make_shared(picker), ", ", "{", "}") {}; + StampJSONHash(std::shared_ptr picker): + StampStrEnumerator(stamp_el = std::make_shared(picker), ", ", "{", "}") {}; }; diff --git a/blobstamper/stamp_lottery.h b/blobstamper/stamp_lottery.h index a5212e4..2a4af2e 100644 --- a/blobstamper/stamp_lottery.h +++ b/blobstamper/stamp_lottery.h @@ -62,10 +62,10 @@ template bool StampLottery4Recursion:: soft_maxsize_filter(StampT &stamp, int data_size) { - if ( stamp.isUnbounded() || // Unbounded is always ok - stamp.maxSize() > data_size || // Variated that can consume all data is ok - stamp.minSize() + stamp.maxSize() > data_size // Fixed or variated stamp that lefts less data then it's min size will also do - ) + if (stamp.isUnbounded() || // Unbounded is always ok + stamp.maxSize() > data_size || // Variated that can consume all data is ok + stamp.minSize() + stamp.maxSize() > data_size // Fixed or variated stamp that lefts less data then it's min size will also do + ) return true; return false; } @@ -76,7 +76,7 @@ init_stored_min(std::ref_vector stamps_arg) { int min = std::numeric_limits::max(); - for(StampT & stamp : stamps) + for (StampT & stamp : stamps) { if (min > stamp.minSize()) @@ -91,13 +91,13 @@ init_stored_max(std::ref_vector stamps_arg) { int max = 0; - for(StampT & stamp : stamps) + for (StampT & stamp : stamps) { if (stamp.maxSize() == -1) return -1; if (max < stamp.maxSize()) - max = stamp.maxSize(); + max = stamp.maxSize(); } return max; } diff --git a/blobstamper/stamp_math_op.cpp b/blobstamper/stamp_math_op.cpp index 9c8f0bd..50ef4a6 100644 --- a/blobstamper/stamp_math_op.cpp +++ b/blobstamper/stamp_math_op.cpp @@ -30,6 +30,6 @@ std::string StampMathBinaryOp::ExtractStr(std::shared_ptr blob) { std::vector> blobs = extract_internal(blob); - return (std::string)"(" + stamp1->ExtractStr(blobs[0]) + " "+ op_name + " " + stamp2->ExtractStr(blobs[1]) + ")"; + return (std::string)"(" + stamp1->ExtractStr(blobs[0]) + " " + op_name + " " + stamp2->ExtractStr(blobs[1]) + ")"; } diff --git a/blobstamper/stamp_math_op.h b/blobstamper/stamp_math_op.h index 59877c6..a9fbe7b 100644 --- a/blobstamper/stamp_math_op.h +++ b/blobstamper/stamp_math_op.h @@ -19,9 +19,9 @@ #ifndef STAMP_MATH_OP_H #define STAMP_MATH_OP_H -#include"blob.h" -#include"stamp.h" -#include"galley.h" +#include "blob.h" +#include "stamp.h" +#include "galley.h" class StampMathUnaryOp: public StampBaseStr @@ -31,7 +31,7 @@ class StampMathUnaryOp: public StampBaseStr std::shared_ptr stamp; public: virtual std::string ExtractStr(std::shared_ptr blob) override; - StampMathUnaryOp(std::string arg_op_name, std::shared_ptr arg_stamp) : op_name(arg_op_name), stamp(arg_stamp) {}; + StampMathUnaryOp(std::string arg_op_name, std::shared_ptr arg_stamp): op_name(arg_op_name), stamp(arg_stamp) {}; virtual int maxSize() override {return -1;}; virtual int minSize() override {return stamp->minSize();}; }; @@ -48,7 +48,7 @@ class StampMathBinaryOp: public StampBaseStr, public GalleySetBase virtual std::string ExtractStr(std::shared_ptr blob) override; StampMathBinaryOp(std::string arg_op_name, std::shared_ptr arg_stamp1, - std::shared_ptr arg_stamp2) : + std::shared_ptr arg_stamp2): GalleySetBase({arg_stamp1, arg_stamp2}), op_name(arg_op_name), stamp1(arg_stamp1), diff --git a/blobstamper/stamp_text.cpp b/blobstamper/stamp_text.cpp index 7d8ade7..cadddfd 100644 --- a/blobstamper/stamp_text.cpp +++ b/blobstamper/stamp_text.cpp @@ -16,7 +16,7 @@ * ******************************************************************************/ -#include"stamp_text.h" +#include "stamp_text.h" std::string StampTextPulp::ExtractStr(std::shared_ptr blob) @@ -26,7 +26,7 @@ StampTextPulp::ExtractStr(std::shared_ptr blob) std::vector::iterator the_iterator; the_iterator = data.begin(); - std:: string res; + std::string res; while (the_iterator != data.end()) { if (*the_iterator == '\0') { *the_iterator = ' '; } diff --git a/blobstamper/stamp_text.h b/blobstamper/stamp_text.h index 3b5c7fa..c51c616 100644 --- a/blobstamper/stamp_text.h +++ b/blobstamper/stamp_text.h @@ -27,8 +27,8 @@ class StampTextPulp: public StampBaseStr { public: - virtual int minSize() override {return 1;} - virtual int maxSize() override {return -1;} + virtual int minSize() override { return 1; } + virtual int maxSize() override { return -1; } std::string ExtractStr(std::shared_ptr blob) override; };