1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

entities: Rework serialization of numeric character references

This commit is contained in:
Nick Wellnhofer
2024-07-12 03:07:57 +02:00
parent 8d1606265d
commit 1cfc5b8089
4 changed files with 92 additions and 71 deletions

View File

@@ -43,6 +43,7 @@
#include "private/buf.h"
#include "private/enc.h"
#include "private/entities.h"
#include "private/error.h"
#ifdef LIBXML_ICU_ENABLED
@@ -1744,8 +1745,7 @@ retry:
* and continue the transcoding phase, hoping the error
* did not mangle the encoder state.
*/
charrefLen = snprintf((char *) &charref[0], sizeof(charref),
"&#%d;", cur);
charrefLen = xmlSerializeDecCharRef((char *) charref, cur);
xmlBufGrow(out, charrefLen * 4);
c_out = xmlBufAvail(out);
c_in = charrefLen;
@@ -1856,8 +1856,7 @@ retry:
* and continue the transcoding phase, hoping the error
* did not mangle the encoder state.
*/
charrefLen = snprintf((char *) &charref[0], sizeof(charref),
"&#%d;", cur);
charrefLen = xmlSerializeDecCharRef((char *) charref, cur);
xmlBufferShrink(in, len);
xmlBufferGrow(out, charrefLen * 4);
written = out->size - out->use - 1;