Skip to content

Commit 131a2f0

Browse files
committed
scripted-diff: rename base_blob::data to m_data
This is in preparation for exposing a ::data member function. -BEGIN VERIFY SCRIPT- sed -i "s/\([^.]\|other.\)data/\1m_data/g" src/uint256.h src/uint256.cpp -END VERIFY SCRIPT-
1 parent edec7f7 commit 131a2f0

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/uint256.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
template <unsigned int BITS>
1313
base_blob<BITS>::base_blob(const std::vector<unsigned char>& vch)
1414
{
15-
assert(vch.size() == sizeof(data));
16-
memcpy(data, vch.data(), sizeof(data));
15+
assert(vch.size() == sizeof(m_data));
16+
memcpy(m_data, vch.data(), sizeof(m_data));
1717
}
1818

1919
template <unsigned int BITS>
2020
std::string base_blob<BITS>::GetHex() const
2121
{
22-
return HexStr(std::reverse_iterator<const uint8_t*>(data + sizeof(data)), std::reverse_iterator<const uint8_t*>(data));
22+
return HexStr(std::reverse_iterator<const uint8_t*>(m_data + sizeof(m_data)), std::reverse_iterator<const uint8_t*>(m_data));
2323
}
2424

2525
template <unsigned int BITS>
2626
void base_blob<BITS>::SetHex(const char* psz)
2727
{
28-
memset(data, 0, sizeof(data));
28+
memset(m_data, 0, sizeof(m_data));
2929

3030
// skip leading spaces
3131
while (IsSpace(*psz))
@@ -39,7 +39,7 @@ void base_blob<BITS>::SetHex(const char* psz)
3939
size_t digits = 0;
4040
while (::HexDigit(psz[digits]) != -1)
4141
digits++;
42-
unsigned char* p1 = (unsigned char*)data;
42+
unsigned char* p1 = (unsigned char*)m_data;
4343
unsigned char* pend = p1 + WIDTH;
4444
while (digits > 0 && p1 < pend) {
4545
*p1 = ::HexDigit(psz[--digits]);

src/uint256.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ class base_blob
1818
{
1919
protected:
2020
static constexpr int WIDTH = BITS / 8;
21-
uint8_t data[WIDTH];
21+
uint8_t m_data[WIDTH];
2222
public:
2323
base_blob()
2424
{
25-
memset(data, 0, sizeof(data));
25+
memset(m_data, 0, sizeof(m_data));
2626
}
2727

2828
explicit base_blob(const std::vector<unsigned char>& vch);
2929

3030
bool IsNull() const
3131
{
3232
for (int i = 0; i < WIDTH; i++)
33-
if (data[i] != 0)
33+
if (m_data[i] != 0)
3434
return false;
3535
return true;
3636
}
3737

3838
void SetNull()
3939
{
40-
memset(data, 0, sizeof(data));
40+
memset(m_data, 0, sizeof(m_data));
4141
}
4242

43-
inline int Compare(const base_blob& other) const { return memcmp(data, other.data, sizeof(data)); }
43+
inline int Compare(const base_blob& other) const { return memcmp(m_data, other.m_data, sizeof(m_data)); }
4444

4545
friend inline bool operator==(const base_blob& a, const base_blob& b) { return a.Compare(b) == 0; }
4646
friend inline bool operator!=(const base_blob& a, const base_blob& b) { return a.Compare(b) != 0; }
@@ -53,32 +53,32 @@ class base_blob
5353

5454
unsigned char* begin()
5555
{
56-
return &data[0];
56+
return &m_data[0];
5757
}
5858

5959
unsigned char* end()
6060
{
61-
return &data[WIDTH];
61+
return &m_data[WIDTH];
6262
}
6363

6464
const unsigned char* begin() const
6565
{
66-
return &data[0];
66+
return &m_data[0];
6767
}
6868

6969
const unsigned char* end() const
7070
{
71-
return &data[WIDTH];
71+
return &m_data[WIDTH];
7272
}
7373

7474
unsigned int size() const
7575
{
76-
return sizeof(data);
76+
return sizeof(m_data);
7777
}
7878

7979
uint64_t GetUint64(int pos) const
8080
{
81-
const uint8_t* ptr = data + pos * 8;
81+
const uint8_t* ptr = m_data + pos * 8;
8282
return ((uint64_t)ptr[0]) | \
8383
((uint64_t)ptr[1]) << 8 | \
8484
((uint64_t)ptr[2]) << 16 | \
@@ -92,13 +92,13 @@ class base_blob
9292
template<typename Stream>
9393
void Serialize(Stream& s) const
9494
{
95-
s.write((char*)data, sizeof(data));
95+
s.write((char*)m_data, sizeof(m_data));
9696
}
9797

9898
template<typename Stream>
9999
void Unserialize(Stream& s)
100100
{
101-
s.read((char*)data, sizeof(data));
101+
s.read((char*)m_data, sizeof(m_data));
102102
}
103103
};
104104

0 commit comments

Comments
 (0)