diff options
author | John Wiegley <johnw@newartisans.com> | 2022-01-27 21:28:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 21:28:52 -0800 |
commit | bcbcf169d5fddd48a77e30ef60ba07c0a2e1e1ab (patch) | |
tree | 47a132b29a9ea3b362789c48d122ec5f68f2563b /src/utils.h | |
parent | e001548e7f68f304dd6a98f0919fe15ee3e24496 (diff) | |
parent | 436895905d19f8ef0d3258cd515052a0e540b8b4 (diff) | |
download | fork-ledger-bcbcf169d5fddd48a77e30ef60ba07c0a2e1e1ab.tar.gz fork-ledger-bcbcf169d5fddd48a77e30ef60ba07c0a2e1e1ab.tar.bz2 fork-ledger-bcbcf169d5fddd48a77e30ef60ba07c0a2e1e1ab.zip |
Merge branch 'master' into add-flake
Diffstat (limited to 'src/utils.h')
-rw-r--r-- | src/utils.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/utils.h b/src/utils.h index c9146dd7..9af1251a 100644 --- a/src/utils.h +++ b/src/utils.h @@ -540,25 +540,25 @@ inline char * next_element(char * buf, bool variable = false) { return NULL; } -inline char peek_next_nonws(std::istream& in) { - char c = static_cast<char>(in.peek()); +inline int peek_next_nonws(std::istream& in) { + int c = in.peek(); while (in.good() && ! in.eof() && std::isspace(c)) { - in.get(c); - c = static_cast<char>(in.peek()); + in.get(); + c = in.peek(); } return c; } #define READ_INTO(str, targ, size, var, cond) { \ char * _p = targ; \ - var = static_cast<char>(str.peek()); \ + var = str.peek(); \ while (str.good() && ! str.eof() && var != '\n' && \ (cond) && _p - targ < size) { \ - str.get(var); \ + var = str.get(); \ if (str.eof()) \ break; \ if (var == '\\') { \ - str.get(var); \ + var = str.get(); \ if (in.eof()) \ break; \ switch (var) { \ @@ -572,22 +572,22 @@ inline char peek_next_nonws(std::istream& in) { } \ } \ *_p++ = var; \ - var = static_cast<char>(str.peek()); \ + var = str.peek(); \ } \ *_p = '\0'; \ } #define READ_INTO_(str, targ, size, var, idx, cond) { \ char * _p = targ; \ - var = static_cast<char>(str.peek()); \ + var = str.peek(); \ while (str.good() && ! str.eof() && var != '\n' && \ (cond) && _p - targ < size) { \ - str.get(var); \ + var = str.get(); \ if (str.eof()) \ break; \ idx++; \ if (var == '\\') { \ - str.get(var); \ + var = str.get(); \ if (in.eof()) \ break; \ switch (var) { \ @@ -602,7 +602,7 @@ inline char peek_next_nonws(std::istream& in) { idx++; \ } \ *_p++ = var; \ - var = static_cast<char>(str.peek()); \ + var = str.peek(); \ } \ *_p = '\0'; \ } |