aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-08-03 11:49:55 -0400
committerDavid Robillard <d@drobilla.net>2024-08-03 14:21:47 -0400
commit760720b1f762be629841b4d0a32f17aab2ee44f2 (patch)
tree28a648f2fa918c42d8388f3ba63f79835ea993f7 /src
parent8da362e71566465b86a09ae1197abcb93f0f83be (diff)
downloadserd-760720b1f762be629841b4d0a32f17aab2ee44f2.tar.gz
serd-760720b1f762be629841b4d0a32f17aab2ee44f2.tar.bz2
serd-760720b1f762be629841b4d0a32f17aab2ee44f2.zip
Avoid bumping cursor column on EOF
Diffstat (limited to 'src')
-rw-r--r--src/byte_source.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/byte_source.h b/src/byte_source.h
index 02aab663..bd6701c9 100644
--- a/src/byte_source.h
+++ b/src/byte_source.h
@@ -69,10 +69,11 @@ serd_byte_source_advance(SerdByteSource* source)
{
SerdStatus st = SERD_SUCCESS;
- if (serd_byte_source_peek(source) == '\n') {
+ const uint8_t c = serd_byte_source_peek(source);
+ if (c == '\n') {
++source->cur.line;
source->cur.col = 0;
- } else {
+ } else if (c) {
++source->cur.col;
}