mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
parser: Make CRLF increment line number
Partial revert of cb927e85 fixing CRLFs not incrementing the line
number.
This requires to rework xmlParseQNameHashed. The original implementation
prompted the change to xmlCurrentChar which really shouldn't modify the
'cur' pointer as side effect. But the NEXTL macro relies on this
behavior.
Ultimately, we should reintroduce the change to xmlCurrentChar and fix
the NEXTL macro. This will lead to single CRs incrementing the line
number as well which seems more consistent.
Fixes #628.
This commit is contained in:
@@ -849,7 +849,14 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
|
||||
* the single character #xA.
|
||||
*/
|
||||
if (c == '\r') {
|
||||
*len = ((cur[1] == '\n') ? 2 : 1);
|
||||
/*
|
||||
* TODO: This function shouldn't change the 'cur' pointer
|
||||
* as side effect, but the NEXTL macro in parser.c relies
|
||||
* on this behavior when incrementing line numbers.
|
||||
*/
|
||||
if (cur[1] == '\n')
|
||||
ctxt->input->cur++;
|
||||
*len = 1;
|
||||
c = '\n';
|
||||
} else if (c == 0) {
|
||||
if (ctxt->input->cur >= ctxt->input->end) {
|
||||
|
||||
Reference in New Issue
Block a user