msxml3: Skip the first XML declaration in file generated by domdoc_save.
This is the last patch needed for Photoshop CS3 installer.
This commit is contained in:
parent
82b2a83337
commit
616fd82062
|
@ -1690,7 +1690,7 @@ static HRESULT WINAPI domdoc_save(
|
|||
{
|
||||
domdoc *This = impl_from_IXMLDOMDocument2( iface );
|
||||
HANDLE handle;
|
||||
xmlChar *mem;
|
||||
xmlChar *mem, *p;
|
||||
int size;
|
||||
HRESULT ret = S_OK;
|
||||
DWORD written;
|
||||
|
@ -1738,7 +1738,23 @@ static HRESULT WINAPI domdoc_save(
|
|||
}
|
||||
|
||||
xmlDocDumpMemory(get_doc(This), &mem, &size);
|
||||
if(!WriteFile(handle, mem, (DWORD)size, &written, NULL) || written != (DWORD)size)
|
||||
|
||||
/*
|
||||
* libxml2 always adds XML declaration on top of the file and one for each processing instruction node in DOM tree.
|
||||
* MSXML adds XML declaration only for processing instruction nodes.
|
||||
* We skip the first XML declaration generated by libxml2 to get exactly what we need.
|
||||
*/
|
||||
p = mem;
|
||||
if(size > 2 && p[0] == '<' && p[1] == '?') {
|
||||
while(p < mem+size && (p[0] != '?' || p[1] != '>'))
|
||||
p++;
|
||||
p += 2;
|
||||
while(p < mem+size && isspace(*p))
|
||||
p++;
|
||||
size -= p-mem;
|
||||
}
|
||||
|
||||
if(!WriteFile(handle, p, (DWORD)size, &written, NULL) || written != (DWORD)size)
|
||||
{
|
||||
WARN("write error\n");
|
||||
ret = S_FALSE;
|
||||
|
|
|
@ -3304,9 +3304,7 @@ static void test_DocumentSaveToFile(void)
|
|||
|
||||
ReadFile(file, buffer, sizeof(buffer), &read, NULL);
|
||||
ok(read != 0, "could not read file\n");
|
||||
todo_wine {
|
||||
ok(buffer[0] != '<' || buffer[1] != '?', "File contains processing instruction\n");
|
||||
}
|
||||
|
||||
DeleteFile("test.xml");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue