Skip to content

Commit 1a6aebd

Browse files
fixed some whitespace issues
1 parent 65ecc97 commit 1a6aebd

18 files changed

+60
-60
lines changed

blobstamper/dict.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
******************************************************************************/
1818

19-
#include"dict.h"
19+
#include "dict.h"
2020

2121

2222
size_t

blobstamper/dict.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#define DICT_H
2121

2222

23-
#include<string>
24-
#include<vector>
23+
#include <string>
24+
#include <vector>
2525

2626

2727
class DictBase
@@ -31,10 +31,10 @@ class DictBase
3131
public:
3232
size_t size();
3333
std::string get(size_t n); // FIXME May be it would be good to use operator[] later.
34-
DictBase() {data = {};};
34+
DictBase() { data = {}; };
3535
};
3636

37-
class DictLCAlphaSmall : public DictBase
37+
class DictLCAlphaSmall: public DictBase
3838
{
3939
public:
4040
DictLCAlphaSmall();

blobstamper/galley.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ GalleySetBase::minSize()
427427
if (unbounded_count > 1) /* One unbounded stamp will take all data. Nothing to predict */
428428
res += ORACLE_SIZE * unbounded_count;
429429

430-
return res;
430+
return res;
431431
}
432432

433433
int

blobstamper/galley.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ GalleyVectorV<T>::ExtractValuesVector(std::shared_ptr<Blob> blob)
8181
std::vector<std::shared_ptr<Blob>> blobs = extract_internal(blob);
8282
std::vector<T> res(blobs.size());
8383

84-
for(int i=0; i<blobs.size(); i++)
84+
for (int i = 0; i < blobs.size(); i++)
8585
{
8686
res[i] = std::dynamic_pointer_cast<StampBaseV<T>>(stamp)->ExtractValue(blobs[i]);
8787
}

blobstamper/oracle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ OracleProportion(ORACLE_TYPE oracle, size_t min, size_t max)
3131
* хвоста диапазона предсказания не попасть никогда и тогда он не округлиться
3232
* в max + 1*/
3333
size_t delta = max - min + 1;
34-
size_t res = floor(((float) oracle) / ((float) ORACLE_MAX + 1) * delta );
34+
size_t res = floor(((float) oracle) / ((float) ORACLE_MAX + 1) * delta);
3535
return min + res;
3636
}
3737

blobstamper/stamp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ StampBase::Load(std::shared_ptr<Blob> blob)
4343
{
4444
res_size = maxSize();
4545
if (res_size > blob->Size())
46-
res_size = blob->Size();
46+
res_size = blob->Size();
4747
}
4848
bitten_blob = blob->Chop(res_size);
4949
}

blobstamper/stamp.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class StampBase
4040

4141
void Load(std::shared_ptr<Blob> blob);
4242

43-
bool isFixedSize() {return minSize() == maxSize();}
44-
bool isVariated() {return ! isFixedSize() && ! isUnbounded();}
45-
bool isUnbounded() {return maxSize() == -1;}
43+
bool isFixedSize() { return minSize() == maxSize(); }
44+
bool isVariated() { return !isFixedSize() && !isUnbounded(); }
45+
bool isUnbounded() { return maxSize() == -1; }
4646
virtual bool isRecursive() {return is_recursive;}
4747
};
4848

@@ -90,8 +90,8 @@ StampBasePV<T>::ExtractBin(std::shared_ptr<Blob> blob)
9090
return v;
9191
}
9292

93-
template<class T> class StampBaseV: public StampBasePV<T>
94-
,public virtual StampBase //FIXME I do not understand why do we need it here, but wihtout it, it does not build
93+
template<class T> class StampBaseV: public StampBasePV<T>,
94+
public virtual StampBase //FIXME I do not understand why do we need it here, but wihtout it, it does not build
9595
{
9696
public:
9797
virtual T ExtractValue(std::shared_ptr<Blob> blob) = 0;/* Should be defined by derived classes*/

blobstamper/stamp_dict.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
int
2525
StampDict::ChooseStampSize(std::shared_ptr<DictBase> dict)
2626
{
27-
if (dict->size() <= UCHAR_MAX+1)
27+
if (dict->size() <= UCHAR_MAX + 1)
2828
{
2929
stamp_max_value = UCHAR_MAX;
3030
return 1;
3131
}
32-
if (dict->size() <= USHRT_MAX+1)
32+
if (dict->size() <= USHRT_MAX + 1)
3333
{
3434
stamp_max_value = USHRT_MAX;
3535
return 2;
3636
}
37-
if (dict->size() <= UINT_MAX+1)
37+
if (dict->size() <= UINT_MAX + 1)
3838
{
3939
stamp_max_value = UINT_MAX;
4040
return 4;
@@ -76,6 +76,6 @@ StampDict::ExtractStr(std::shared_ptr<Blob> blob)
7676
exit(1);
7777
}
7878
long long actual_index = ((double) index_oracle) / stamp_max_value * dict->size();
79-
if ( actual_index == dict->size()) actual_index--; /* If we hit the boundary step inside a bit*/
79+
if (actual_index == dict->size()) actual_index--; /* If we hit the boundary step inside a bit*/
8080
return dict->get(actual_index);
8181
}

blobstamper/stamp_dict.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ class StampDict: public StampBaseStr
4747
int maxSize() override {return stamp_size;}
4848
};
4949

50-
class StampDictLCAlphaSmall : public StampDict
50+
class StampDictLCAlphaSmall: public StampDict
5151
{
5252
public:
53-
StampDictLCAlphaSmall (): StampDict(std::make_shared<DictLCAlphaSmall>()) {};
53+
StampDictLCAlphaSmall(): StampDict(std::make_shared<DictLCAlphaSmall>()) {};
5454
};
5555

5656

blobstamper/stamp_enumerator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ std::string StampStrEnumerator::ExtractStr(std::shared_ptr<Blob> blob)
2929
std::vector<std::string> data = ExtractStrVector(blob);
3030
std::string res = "";
3131

32-
for(std::string s : data)
32+
for (std::string s : data)
3333
{
3434
if (!res.empty())
3535
{
36-
res+= separator;
36+
res += separator;
3737
}
38-
res+= s;
38+
res += s;
3939
}
4040
res = left_bracket + res + right_bracket;
4141
return res;

blobstamper/stamp_enumerator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#ifndef STAMP_ENUMERATOR_H
2020
#define STAMP_ENUMERATOR_H
2121

22-
#include"galley.h"
23-
#include"stamp.h"
24-
#include"blob.h"
22+
#include "galley.h"
23+
#include "stamp.h"
24+
#include "blob.h"
2525

26-
#include<string>
26+
#include <string>
2727

2828
class StampStrEnumerator: public GalleyVectorStr, public StampBaseStr
2929
{

blobstamper/stamp_json.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
PoolPickerStamp::PoolPickerStamp(std::vector<std::shared_ptr<StampBaseStr>> new_pool)
2828
: pool{new_pool}
2929
{
30-
for(auto stamp : pool)
30+
for (auto stamp : pool)
3131
{
3232
std::weak_ptr<StampBaseStr> wp = stamp;
3333
weak_pool.push_back(wp);
@@ -37,10 +37,10 @@ PoolPickerStamp::PoolPickerStamp(std::vector<std::shared_ptr<StampBaseStr>> new_
3737
bool
3838
PoolPickerStamp::isRecursive()
3939
{
40-
if(is_recursive || is_in_recursion)
40+
if (is_recursive || is_in_recursion)
4141
return true;
4242
is_in_recursion = true;
43-
for(auto stamp : weak_pool)
43+
for (auto stamp : weak_pool)
4444
{
4545
if (stamp.lock()->isRecursive())
4646
{
@@ -62,7 +62,7 @@ PoolPickerStamp::ExtractStr(std::shared_ptr<Blob> blob)
6262
std::vector<std::weak_ptr<StampBaseStr>> target_pool;
6363
std::vector<std::weak_ptr<StampBaseStr>> unbounded_pool;
6464

65-
for(auto stamp_w : weak_pool)
65+
for (auto stamp_w : weak_pool)
6666
{
6767
auto stamp = stamp_w.lock();
6868
if (stamp->minSize() <= blob->Size())
@@ -75,7 +75,7 @@ PoolPickerStamp::ExtractStr(std::shared_ptr<Blob> blob)
7575
}
7676
}
7777
if (unbounded_pool.size()>0)
78-
target_pool = unbounded_pool;
78+
target_pool = unbounded_pool;
7979

8080
size_t index = OracleProportion(oracle, 0, target_pool.size() - 1);
8181
return target_pool[index].lock()->ExtractStr(blob);
@@ -111,7 +111,7 @@ PoolPickerStamp::maxSize()
111111
if (is_recursive || is_in_recursion)
112112
return -1;
113113
is_in_recursion = true; /* Do not use isRecursive() inside as it uses same flag*/
114-
for(auto stamp : weak_pool)
114+
for (auto stamp : weak_pool)
115115
{
116116
int candidat = stamp.lock()->maxSize();
117117
if (candidat == -1)

blobstamper/stamp_json.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "stamp_dict.h"
2828
#include "stamp_enumerator.h"
2929

30-
class PoolPickerStamp : public virtual StampBaseStr
30+
class PoolPickerStamp: public virtual StampBaseStr
3131
{
3232
protected:
3333
std::vector<std::shared_ptr<StampBaseStr>> pool;
@@ -44,15 +44,15 @@ class PoolPickerStamp : public virtual StampBaseStr
4444
virtual int maxSize() override;
4545
};
4646

47-
class StampJSONInt : public virtual StampArithm<long int>
47+
class StampJSONInt: public virtual StampArithm<long int>
4848
{
4949
};
5050

51-
class StampJSONFloat : public virtual StampArithm<double>
51+
class StampJSONFloat: public virtual StampArithm<double>
5252
{
5353
};
5454

55-
class StampJSONString : public virtual StampDictT<DictLCAlphaSmall>
55+
class StampJSONString: public virtual StampDictT<DictLCAlphaSmall>
5656
{
5757
protected:
5858
public:
@@ -66,8 +66,8 @@ class StampJSONArray: public StampStrEnumerator
6666
{
6767
private:
6868
public:
69-
StampJSONArray(std::shared_ptr<PoolPickerStamp> picker)
70-
:StampStrEnumerator(picker, ", ", "[", "]") {};
69+
StampJSONArray(std::shared_ptr<PoolPickerStamp> picker):
70+
StampStrEnumerator(picker, ", ", "[", "]") {};
7171
};
7272

7373
class StampJSONHashEl: public StampBaseStr
@@ -76,8 +76,8 @@ class StampJSONHashEl: public StampBaseStr
7676
std::shared_ptr<StampJSONString> stamp_name;
7777
std::shared_ptr<PoolPickerStamp> stamp_value;
7878
public:
79-
StampJSONHashEl(std::shared_ptr<PoolPickerStamp> picker)
80-
:stamp_value(picker), stamp_name(std::make_shared<StampJSONString>()) {};
79+
StampJSONHashEl(std::shared_ptr<PoolPickerStamp> picker):
80+
stamp_value(picker), stamp_name(std::make_shared<StampJSONString>()) {};
8181
virtual int minSize() override {return stamp_name->minSize() + stamp_value->minSize();};
8282
virtual int maxSize() override {return -1;};
8383
std::string ExtractStr(std::shared_ptr<Blob> blob) override;
@@ -88,8 +88,8 @@ class StampJSONHash: public StampStrEnumerator
8888
private:
8989
std::shared_ptr<StampJSONHashEl> stamp_el;
9090
public:
91-
StampJSONHash(std::shared_ptr<PoolPickerStamp> picker)
92-
:StampStrEnumerator(stamp_el = std::make_shared<StampJSONHashEl>(picker), ", ", "{", "}") {};
91+
StampJSONHash(std::shared_ptr<PoolPickerStamp> picker):
92+
StampStrEnumerator(stamp_el = std::make_shared<StampJSONHashEl>(picker), ", ", "{", "}") {};
9393
};
9494

9595

blobstamper/stamp_lottery.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ template<class StampT> bool
6262
StampLottery4Recursion<StampT>::
6363
soft_maxsize_filter(StampT &stamp, int data_size)
6464
{
65-
if ( stamp.isUnbounded() || // Unbounded is always ok
66-
stamp.maxSize() > data_size || // Variated that can consume all data is ok
67-
stamp.minSize() + stamp.maxSize() > data_size // Fixed or variated stamp that lefts less data then it's min size will also do
68-
)
65+
if (stamp.isUnbounded() || // Unbounded is always ok
66+
stamp.maxSize() > data_size || // Variated that can consume all data is ok
67+
stamp.minSize() + stamp.maxSize() > data_size // Fixed or variated stamp that lefts less data then it's min size will also do
68+
)
6969
return true;
7070
return false;
7171
}
@@ -76,7 +76,7 @@ init_stored_min(std::ref_vector<StampT> stamps_arg)
7676
{
7777
int min = std::numeric_limits<int>::max();
7878

79-
for(StampT & stamp : stamps)
79+
for (StampT & stamp : stamps)
8080
{
8181

8282
if (min > stamp.minSize())
@@ -91,13 +91,13 @@ init_stored_max(std::ref_vector<StampT> stamps_arg)
9191
{
9292
int max = 0;
9393

94-
for(StampT & stamp : stamps)
94+
for (StampT & stamp : stamps)
9595
{
9696
if (stamp.maxSize() == -1)
9797
return -1;
9898

9999
if (max < stamp.maxSize())
100-
max = stamp.maxSize();
100+
max = stamp.maxSize();
101101
}
102102
return max;
103103
}

blobstamper/stamp_math_op.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ std::string
3030
StampMathBinaryOp::ExtractStr(std::shared_ptr<Blob> blob)
3131
{
3232
std::vector<std::shared_ptr<Blob>> blobs = extract_internal(blob);
33-
return (std::string)"(" + stamp1->ExtractStr(blobs[0]) + " "+ op_name + " " + stamp2->ExtractStr(blobs[1]) + ")";
33+
return (std::string)"(" + stamp1->ExtractStr(blobs[0]) + " " + op_name + " " + stamp2->ExtractStr(blobs[1]) + ")";
3434
}
3535

blobstamper/stamp_math_op.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
#ifndef STAMP_MATH_OP_H
2020
#define STAMP_MATH_OP_H
2121

22-
#include"blob.h"
23-
#include"stamp.h"
24-
#include"galley.h"
22+
#include "blob.h"
23+
#include "stamp.h"
24+
#include "galley.h"
2525

2626

2727
class StampMathUnaryOp: public StampBaseStr
@@ -31,7 +31,7 @@ class StampMathUnaryOp: public StampBaseStr
3131
std::shared_ptr<StampBaseStr> stamp;
3232
public:
3333
virtual std::string ExtractStr(std::shared_ptr<Blob> blob) override;
34-
StampMathUnaryOp(std::string arg_op_name, std::shared_ptr<StampBaseStr> arg_stamp) : op_name(arg_op_name), stamp(arg_stamp) {};
34+
StampMathUnaryOp(std::string arg_op_name, std::shared_ptr<StampBaseStr> arg_stamp): op_name(arg_op_name), stamp(arg_stamp) {};
3535
virtual int maxSize() override {return -1;};
3636
virtual int minSize() override {return stamp->minSize();};
3737
};
@@ -48,7 +48,7 @@ class StampMathBinaryOp: public StampBaseStr, public GalleySetBase
4848
virtual std::string ExtractStr(std::shared_ptr<Blob> blob) override;
4949
StampMathBinaryOp(std::string arg_op_name,
5050
std::shared_ptr<StampBaseStr> arg_stamp1,
51-
std::shared_ptr<StampBaseStr> arg_stamp2) :
51+
std::shared_ptr<StampBaseStr> arg_stamp2):
5252
GalleySetBase({arg_stamp1, arg_stamp2}),
5353
op_name(arg_op_name),
5454
stamp1(arg_stamp1),

blobstamper/stamp_text.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
******************************************************************************/
1818

19-
#include"stamp_text.h"
19+
#include "stamp_text.h"
2020

2121
std::string
2222
StampTextPulp::ExtractStr(std::shared_ptr<Blob> blob)
@@ -26,7 +26,7 @@ StampTextPulp::ExtractStr(std::shared_ptr<Blob> blob)
2626
std::vector<char>::iterator the_iterator;
2727

2828
the_iterator = data.begin();
29-
std:: string res;
29+
std::string res;
3030
while (the_iterator != data.end())
3131
{
3232
if (*the_iterator == '\0') { *the_iterator = ' '; }

blobstamper/stamp_text.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
class StampTextPulp: public StampBaseStr
2828
{
2929
public:
30-
virtual int minSize() override {return 1;}
31-
virtual int maxSize() override {return -1;}
30+
virtual int minSize() override { return 1; }
31+
virtual int maxSize() override { return -1; }
3232
std::string ExtractStr(std::shared_ptr<Blob> blob) override;
3333
};
3434

0 commit comments

Comments
 (0)