aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_source.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/byte_source.c')
-rw-r--r--src/byte_source.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/byte_source.c b/src/byte_source.c
index 6ec2084a..8959b1e6 100644
--- a/src/byte_source.c
+++ b/src/byte_source.c
@@ -123,3 +123,19 @@ serd_byte_source_prepare(SerdByteSource* const source)
return serd_byte_source_advance(source);
}
+
+SerdStatus
+serd_byte_source_skip_bom(SerdByteSource* const source)
+{
+ if (serd_byte_source_peek(source) == 0xEF) {
+ if (serd_byte_source_advance(source) ||
+ serd_byte_source_peek(source) != 0xBB ||
+ serd_byte_source_advance(source) ||
+ serd_byte_source_peek(source) != 0xBF ||
+ serd_byte_source_advance(source)) {
+ return SERD_BAD_SYNTAX;
+ }
+ }
+
+ return SERD_SUCCESS;
+}