diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2006-10-17 18:03:21 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2006-10-17 18:03:21 (GMT) |
commit | 65f47e04daaf7f06da11c64af364e65e60e66387 (patch) | |
tree | 54faf2b759aca5cdc6184168aa676ed669435766 /src/docparser.cpp | |
parent | 3c8148441a129febc5c2b9e4b2b2cbd018ad3b6e (diff) | |
download | Doxygen-65f47e04daaf7f06da11c64af364e65e60e66387.zip Doxygen-65f47e04daaf7f06da11c64af364e65e60e66387.tar.gz Doxygen-65f47e04daaf7f06da11c64af364e65e60e66387.tar.bz2 |
Release-1.5.0
Diffstat (limited to 'src/docparser.cpp')
-rw-r--r-- | src/docparser.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp index 0cfeb88..c7a621a 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -158,7 +158,8 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type) //printf("Search for %s\n",fileName); if ((fd=findFileDef(Doxygen::imageNameDict,fileName,ambig))) { - QFile inImage(QString(fd->absFilePath().data())); + QCString inputFile = fd->absFilePath(); + QFile inImage(inputFile); if (inImage.open(IO_ReadOnly)) { result = fileName; @@ -185,19 +186,22 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type) break; } QCString outputFile = outputDir+"/"+result; - QFile outImage(QString(outputFile.data())); - if (outImage.open(IO_WriteOnly)) // copy the image + if (outputFile!=inputFile) // prevent copying to ourself { - char *buffer = new char[inImage.size()]; - inImage.readBlock(buffer,inImage.size()); - outImage.writeBlock(buffer,inImage.size()); - outImage.flush(); - delete buffer; - } - else - { - warn_doc_error(g_fileName,doctokenizerYYlineno, - "Warning: could not write output image %s",outputFile.data()); + QFile outImage(outputFile.data()); + if (outImage.open(IO_WriteOnly)) // copy the image + { + char *buffer = new char[inImage.size()]; + inImage.readBlock(buffer,inImage.size()); + outImage.writeBlock(buffer,inImage.size()); + outImage.flush(); + delete buffer; + } + else + { + warn_doc_error(g_fileName,doctokenizerYYlineno, + "Warning: could not write output image %s",outputFile.data()); + } } } else |