Browse Source

neth: use streams for inputs

cl-refactor
Vincent Gariepy 11 years ago
parent
commit
585ffb1025
  1. 35
      neth/main.cpp

35
neth/main.cpp

@ -564,9 +564,18 @@ int main(int argc, char** argv)
fields[4].erase(std::remove(fields[4].begin(), fields[4].end(), ' '), fields[4].end());
fields[5].erase(std::find_if(fields[5].rbegin(), fields[5].rend(), std::bind1st(std::not_equal_to<char>(), ' ')).base(), fields[5].end());
int size = fields[0].length();
u256 amount = atoll(fields[1].c_str());
u256 gasPrice = atoll(fields[2].c_str());
u256 gas = atoll(fields[3].c_str());
u256 amount;
u256 gasPrice;
u256 gas;
stringstream ssa;
ssa << fields[1];
ssa >> amount;
stringstream ssg;
ssg << fields[3];
ssg >> gas;
stringstream ssp;
ssp << fields[2];
ssp >> gasPrice;
string sechex = fields[4];
string sdata = fields[5];
cnote << "Data:";
@ -623,7 +632,10 @@ int main(int argc, char** argv)
{
fields[0].erase(std::remove(fields[0].begin(), fields[0].end(), ' '), fields[0].end());
int size = fields[0].length();
u256 amount = atoll(fields[1].c_str());
u256 amount;
stringstream sss;
sss << fields[1];
sss >> amount;
if (size < 40)
{
if (size > 0)
@ -661,9 +673,18 @@ int main(int argc, char** argv)
}
else
{
u256 endowment = atoll(fields[0].c_str());
u256 gas = atoll(fields[2].c_str());
u256 gasPrice = atoll(fields[1].c_str());
u256 endowment;
u256 gas;
u256 gasPrice;
stringstream sse;
sse << fields[0];
sse >> endowment;
stringstream ssg;
ssg << fields[2];
ssg >> gas;
stringstream ssp;
ssp << fields[1];
ssp >> gasPrice;
if (endowment < 0)
cwarn << "Invalid endowment";
else if (gasPrice < c_minGasPrice)

Loading…
Cancel
Save