Skip to content

Commit

Permalink
Merge pull request #23 from paveljanik/20160527_Wshadow
Browse files Browse the repository at this point in the history
Do not shadow variables
  • Loading branch information
jgarzik committed Aug 24, 2016
2 parents bed8dd9 + fceb4f8 commit c74a04c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
26 changes: 13 additions & 13 deletions include/univalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class UniValue {
bool setNumStr(const std::string& val);
bool setInt(uint64_t val);
bool setInt(int64_t val);
bool setInt(int val) { return setInt((int64_t)val); }
bool setInt(int val_) { return setInt((int64_t)val_); }
bool setFloat(double val);
bool setStr(const std::string& val);
bool setArray();
Expand Down Expand Up @@ -95,28 +95,28 @@ class UniValue {
bool push_backV(const std::vector<UniValue>& vec);

bool pushKV(const std::string& key, const UniValue& val);
bool pushKV(const std::string& key, const std::string& val) {
UniValue tmpVal(VSTR, val);
bool pushKV(const std::string& key, const std::string& val_) {
UniValue tmpVal(VSTR, val_);
return pushKV(key, tmpVal);
}
bool pushKV(const std::string& key, const char *val_) {
std::string val(val_);
return pushKV(key, val);
std::string _val(val_);
return pushKV(key, _val);
}
bool pushKV(const std::string& key, int64_t val) {
UniValue tmpVal(val);
bool pushKV(const std::string& key, int64_t val_) {
UniValue tmpVal(val_);
return pushKV(key, tmpVal);
}
bool pushKV(const std::string& key, uint64_t val) {
UniValue tmpVal(val);
bool pushKV(const std::string& key, uint64_t val_) {
UniValue tmpVal(val_);
return pushKV(key, tmpVal);
}
bool pushKV(const std::string& key, int val) {
UniValue tmpVal((int64_t)val);
bool pushKV(const std::string& key, int val_) {
UniValue tmpVal((int64_t)val_);
return pushKV(key, tmpVal);
}
bool pushKV(const std::string& key, double val) {
UniValue tmpVal(val);
bool pushKV(const std::string& key, double val_) {
UniValue tmpVal(val_);
return pushKV(key, tmpVal);
}
bool pushKVs(const UniValue& obj);
Expand Down
20 changes: 10 additions & 10 deletions lib/univalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,32 +119,32 @@ bool UniValue::setNumStr(const string& val_)
return true;
}

bool UniValue::setInt(uint64_t val)
bool UniValue::setInt(uint64_t val_)
{
string s;
ostringstream oss;

oss << val;
oss << val_;

return setNumStr(oss.str());
}

bool UniValue::setInt(int64_t val)
bool UniValue::setInt(int64_t val_)
{
string s;
ostringstream oss;

oss << val;
oss << val_;

return setNumStr(oss.str());
}

bool UniValue::setFloat(double val)
bool UniValue::setFloat(double val_)
{
string s;
ostringstream oss;

oss << std::setprecision(16) << val;
oss << std::setprecision(16) << val_;

bool ret = setNumStr(oss.str());
typ = VNUM;
Expand Down Expand Up @@ -173,12 +173,12 @@ bool UniValue::setObject()
return true;
}

bool UniValue::push_back(const UniValue& val)
bool UniValue::push_back(const UniValue& val_)
{
if (typ != VARR)
return false;

values.push_back(val);
values.push_back(val_);
return true;
}

Expand All @@ -192,13 +192,13 @@ bool UniValue::push_backV(const std::vector<UniValue>& vec)
return true;
}

bool UniValue::pushKV(const std::string& key, const UniValue& val)
bool UniValue::pushKV(const std::string& key, const UniValue& val_)
{
if (typ != VOBJ)
return false;

keys.push_back(key);
values.push_back(val);
values.push_back(val_);
return true;
}

Expand Down

0 comments on commit c74a04c

Please sign in to comment.