Fixes for variable shadowing (7/28)

This commit is contained in:
John Wiegley 2012-02-17 14:27:11 -06:00
parent cf4a665a0e
commit cc40beca46

View file

@ -40,27 +40,27 @@
namespace ledger { namespace ledger {
string csv_reader::read_field(std::istream& in) string csv_reader::read_field(std::istream& sin)
{ {
string field; string field;
char c; char c;
if (in.peek() == '"' || in.peek() == '|') { if (sin.peek() == '"' || sin.peek() == '|') {
in.get(c); sin.get(c);
char x; char x;
while (in.good() && ! in.eof()) { while (sin.good() && ! sin.eof()) {
in.get(x); sin.get(x);
if (x == '\\') { if (x == '\\') {
in.get(x); sin.get(x);
} }
else if (x == '"' && in.peek() == '"') { else if (x == '"' && sin.peek() == '"') {
in.get(x); sin.get(x);
} }
else if (x == c) { else if (x == c) {
if (x == '|') if (x == '|')
in.unget(); sin.unget();
else if (in.peek() == ',') else if (sin.peek() == ',')
in.get(c); sin.get(c);
break; break;
} }
if (x != '\0') if (x != '\0')
@ -68,8 +68,8 @@ string csv_reader::read_field(std::istream& in)
} }
} }
else { else {
while (in.good() && ! in.eof()) { while (sin.good() && ! sin.eof()) {
in.get(c); sin.get(c);
if (c == ',') if (c == ',')
break; break;
if (c != '\0') if (c != '\0')