Skip to content

Commit 3650668

Browse files
author
MarcoFalke
committed
Squashed 'src/univalue/' changes from f32df99..daf1285
daf1285 Merge pull request #2 from jgarzik/master d9e62d3 Merge pull request sipa#24 from MarcoFalke/Mf1608-cleanup faf260f Rem unused vars and prefer prefix operator for non-primitive type 09a2693 Merge pull request sipa#22 from laanwj/2016_04_unicode c74a04c Merge pull request sipa#23 from paveljanik/20160527_Wshadow fceb4f8 Do not shadow variables git-subtree-dir: src/univalue git-subtree-split: daf1285
1 parent 60ab9b2 commit 3650668

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

include/univalue.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class UniValue {
5656
bool setNumStr(const std::string& val);
5757
bool setInt(uint64_t val);
5858
bool setInt(int64_t val);
59-
bool setInt(int val) { return setInt((int64_t)val); }
59+
bool setInt(int val_) { return setInt((int64_t)val_); }
6060
bool setFloat(double val);
6161
bool setStr(const std::string& val);
6262
bool setArray();
@@ -95,28 +95,28 @@ class UniValue {
9595
bool push_backV(const std::vector<UniValue>& vec);
9696

9797
bool pushKV(const std::string& key, const UniValue& val);
98-
bool pushKV(const std::string& key, const std::string& val) {
99-
UniValue tmpVal(VSTR, val);
98+
bool pushKV(const std::string& key, const std::string& val_) {
99+
UniValue tmpVal(VSTR, val_);
100100
return pushKV(key, tmpVal);
101101
}
102102
bool pushKV(const std::string& key, const char *val_) {
103-
std::string val(val_);
104-
return pushKV(key, val);
103+
std::string _val(val_);
104+
return pushKV(key, _val);
105105
}
106-
bool pushKV(const std::string& key, int64_t val) {
107-
UniValue tmpVal(val);
106+
bool pushKV(const std::string& key, int64_t val_) {
107+
UniValue tmpVal(val_);
108108
return pushKV(key, tmpVal);
109109
}
110-
bool pushKV(const std::string& key, uint64_t val) {
111-
UniValue tmpVal(val);
110+
bool pushKV(const std::string& key, uint64_t val_) {
111+
UniValue tmpVal(val_);
112112
return pushKV(key, tmpVal);
113113
}
114-
bool pushKV(const std::string& key, int val) {
115-
UniValue tmpVal((int64_t)val);
114+
bool pushKV(const std::string& key, int val_) {
115+
UniValue tmpVal((int64_t)val_);
116116
return pushKV(key, tmpVal);
117117
}
118-
bool pushKV(const std::string& key, double val) {
119-
UniValue tmpVal(val);
118+
bool pushKV(const std::string& key, double val_) {
119+
UniValue tmpVal(val_);
120120
return pushKV(key, tmpVal);
121121
}
122122
bool pushKVs(const UniValue& obj);

lib/univalue.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,32 +119,29 @@ bool UniValue::setNumStr(const string& val_)
119119
return true;
120120
}
121121

122-
bool UniValue::setInt(uint64_t val)
122+
bool UniValue::setInt(uint64_t val_)
123123
{
124-
string s;
125124
ostringstream oss;
126125

127-
oss << val;
126+
oss << val_;
128127

129128
return setNumStr(oss.str());
130129
}
131130

132-
bool UniValue::setInt(int64_t val)
131+
bool UniValue::setInt(int64_t val_)
133132
{
134-
string s;
135133
ostringstream oss;
136134

137-
oss << val;
135+
oss << val_;
138136

139137
return setNumStr(oss.str());
140138
}
141139

142-
bool UniValue::setFloat(double val)
140+
bool UniValue::setFloat(double val_)
143141
{
144-
string s;
145142
ostringstream oss;
146143

147-
oss << std::setprecision(16) << val;
144+
oss << std::setprecision(16) << val_;
148145

149146
bool ret = setNumStr(oss.str());
150147
typ = VNUM;
@@ -173,12 +170,12 @@ bool UniValue::setObject()
173170
return true;
174171
}
175172

176-
bool UniValue::push_back(const UniValue& val)
173+
bool UniValue::push_back(const UniValue& val_)
177174
{
178175
if (typ != VARR)
179176
return false;
180177

181-
values.push_back(val);
178+
values.push_back(val_);
182179
return true;
183180
}
184181

@@ -192,13 +189,13 @@ bool UniValue::push_backV(const std::vector<UniValue>& vec)
192189
return true;
193190
}
194191

195-
bool UniValue::pushKV(const std::string& key, const UniValue& val)
192+
bool UniValue::pushKV(const std::string& key, const UniValue& val_)
196193
{
197194
if (typ != VOBJ)
198195
return false;
199196

200197
keys.push_back(key);
201-
values.push_back(val);
198+
values.push_back(val_);
202199
return true;
203200
}
204201

@@ -228,7 +225,7 @@ int UniValue::findKey(const std::string& key) const
228225
bool UniValue::checkObject(const std::map<std::string,UniValue::VType>& t)
229226
{
230227
for (std::map<std::string,UniValue::VType>::const_iterator it = t.begin();
231-
it != t.end(); it++) {
228+
it != t.end(); ++it) {
232229
int idx = findKey(it->first);
233230
if (idx < 0)
234231
return false;

0 commit comments

Comments
 (0)