From ecb322d8e5d751c6b2a17fd7df0cbfa200e2cf64 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Fri, 4 Sep 2015 20:30:31 +0000
Subject: Fix clash resolution when a blank node ID prefix is set.

git-svn-id: http://svn.drobilla.net/serd/trunk@490 490d8e77-9747-427b-9fa3-0b8f29cee8a0
---
 src/reader.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/reader.c b/src/reader.c
index 012dcb43..ec1a6034 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1035,11 +1035,12 @@ read_BLANK_NODE_LABEL(SerdReader* reader, bool* ate_dot)
 	}
 
 	if (reader->syntax == SERD_TURTLE) {
-		if (is_digit(n->buf[1])) {
-			if (n->buf[0] == 'b') {
-				((char*)n->buf)[0] = 'B';  // Prevent clash
+		if (is_digit(n->buf[reader->bprefix_len + 1])) {
+			if ((n->buf[reader->bprefix_len]) == 'b') {
+				((char*)n->buf)[reader->bprefix_len] = 'B';  // Prevent clash
 				reader->seen_genid = true;
-			} else if (reader->seen_genid && n->buf[0] == 'B') {
+			} else if (reader->seen_genid &&
+			           n->buf[reader->bprefix_len] == 'B') {
 				r_err(reader, SERD_ERR_ID_CLASH,
 				      "found both `b' and `B' blank IDs, prefix required\n");
 				return pop_node(reader, ref);
-- 
cgit v1.2.1