Merge branch 'master' of gitlab.com:gambas/gambas

This commit is contained in:
gambix 2019-02-01 22:24:58 +01:00
commit 13120e91b6

View file

@ -109,29 +109,28 @@ void XMLDocument_Open(Document *doc, const char *fileName, const size_t lenFileN
void XMLDocument_SetContent(Document *doc, const char *content, const size_t len) void XMLDocument_SetContent(Document *doc, const char *content, const size_t len)
{ {
char *posStart = 0, *posEnd = 0; const char *posStart = 0, *posEnd = 0;
if(doc->docType == XMLDocumentType) if(doc->docType == XMLDocumentType)
{ {
//On cherche le début du prologue XML //On cherche le début du prologue XML
posStart = (char*)memchrs(content, len, "<?xml ", 6); posStart = (const char*)memchrs(content, len, "<?xml ", 6);
if(posStart)//On cherche la fin du prologue XML if(posStart)//On cherche la fin du prologue XML
{ {
posEnd = (char*)memchrs(posStart, len - (posStart - content), "?>", 2); posEnd = (const char*)memchrs(posStart, len - (posStart - content), "?>", 2);
posEnd += 2; posEnd += 2;
} }
} }
else else
{ {
//On cherche le début du prologue XML //On cherche le début du prologue XML
posStart = (char*)memchrs(content, len, "<!DOCTYPE ", 10); posStart = strcasestr(content, "<!DOCTYPE ");
if(!posStart) posStart = (char*)memchrs(content, len, "<!doctype ", 10);
//On cherche la fin du prologue XML //On cherche la fin du prologue XML
if(posStart) if(posStart)
{ {
posEnd = (char*)memchr(posStart, '>', len - (posStart - content)); posEnd = (const char*)memchr(posStart, '>', len - (posStart - content));
if(posEnd) if(posEnd)
{ {