mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-19 07:38:28 +00:00
xml_node: support backslash as attribute value
XML allows attribute values like <node attr="\"/>. The XML parser wrongly reflects this case as 'Invalid_syntax'. This behavior stems from the implicit use of the 'end_of_quote' function, which considers the sequence of '\"' as a quoted '"' rather than the end of a quoted string. The patch solves this problem by making the 'end_of_quote' part of the tokenizer's scanner policy. The patch removes the 'end_of_quote' function from 'util/string.h' because it is not universal, and to avoid the ambiguity with 'SCANNER_POLICY::end_of_quote'. Fixes #4431
This commit is contained in:
@ -512,15 +512,6 @@ namespace Genode {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for end of quotation
|
||||
*
|
||||
* Checks if next character is non-backslashed quotation mark.
|
||||
*/
|
||||
inline bool end_of_quote(const char *s) {
|
||||
return s[0] != '\\' && s[1] == '\"'; }
|
||||
|
||||
|
||||
/**
|
||||
* Unpack quoted string
|
||||
*
|
||||
@ -537,6 +528,9 @@ namespace Genode {
|
||||
|
||||
src++;
|
||||
|
||||
auto end_of_quote = [] (const char *s) {
|
||||
return s[0] != '\\' && s[1] == '\"'; };
|
||||
|
||||
size_t i = 0;
|
||||
for (; *src && !end_of_quote(src - 1) && (i < dst_len - 1); i++) {
|
||||
|
||||
|
Reference in New Issue
Block a user