Skip to content

Commit

Permalink
Properly copy images for the XML output.
Browse files Browse the repository at this point in the history
Use the exact same mechanism that is used for the HTML/LaTeX/... output,
which is findAndCopyImage() in docparser.cpp, because that one works,
unlike the method here. Not sure why that function doesn't handle XML as
well. Also not sure how to integrate this into the automated tests.
  • Loading branch information
mosra committed Dec 7, 2017
1 parent 4f45bd2 commit 507dd0a
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/xmldocvisitor.cpp
Expand Up @@ -770,17 +770,22 @@ void XmlDocVisitor::visitPre(DocImage *img)
visitPreStart(m_t, "image", FALSE, this, img->children(), baseName, TRUE, img->type(), img->width(), img->height());

// copy the image to the output dir
QFile inImage(img->name());
QFile outImage(Config_getString(XML_OUTPUT)+"/"+baseName.data());
if (inImage.open(IO_ReadOnly))
FileDef *fd;
bool ambig;
if ((fd=findFileDef(Doxygen::imageNameDict,img->name(),ambig)))
{
if (outImage.open(IO_WriteOnly))
QFile inImage(fd->absFilePath());
QFile outImage(Config_getString(XML_OUTPUT)+"/"+baseName.data());
if (inImage.open(IO_ReadOnly))
{
char *buffer = new char[inImage.size()];
inImage.readBlock(buffer,inImage.size());
outImage.writeBlock(buffer,inImage.size());
outImage.flush();
delete[] buffer;
if (outImage.open(IO_WriteOnly))
{
char *buffer = new char[inImage.size()];
inImage.readBlock(buffer,inImage.size());
outImage.writeBlock(buffer,inImage.size());
outImage.flush();
delete[] buffer;
}
}
}
}
Expand Down

0 comments on commit 507dd0a

Please sign in to comment.