[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kviewshell-0.7/kviewshell/plugins/dvi [POSSIBLY UNSAFE]
From: Stefan Kebekus <kebekus () kde ! org>
Date: 2006-10-25 7:03:59
Message-ID: 1161759839.649372.29411.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 598956 by kebekus:
fixes problem with DVI files that contain references to non-existent EPS files
M +25 -1 psgs.cpp [POSSIBLY UNSAFE: system]
M +1 -1 special.cpp
--- branches/work/kviewshell-0.7/kviewshell/plugins/dvi/psgs.cpp #598955:598956
@@ -348,14 +348,38 @@
return fi2.absFilePath();
}
+
+ // If all else fails, use kpsewhich to find the filename. Note: we
+ // can't use the convenient "KProcIO" class here because this
+ // crashes infrequently when this method is called from a
+ // non-GUI-thread. Instead, we use an ugly "system"-call, make
+ // kpsewhich write its output to a temporary file and read that
+ // file.
+ KTempFile outFile(QString::null);
+ outFile.setAutoDelete(1);
+ outFile.close(); // we are want the filename, not the file
+
+ QString cmd_line = "kpsewhich " + filename + ">" + outFile.name();
+ system(cmd_line.latin1());
+ QFile kpse_out(outFile.name());
+ if (kpse_out.open(IO_ReadOnly) == false) {
+ outFile.unlink();
+ return QString::null;
+ }
+ QString EPSfilename;
+ kpse_out.readLine( EPSfilename, 1024);
+ outFile.unlink();
+ return EPSfilename.stripWhiteSpace();
+
+ /*
// Otherwise, use kpsewhich to find the eps file.
QString EPSfilename;
KProcIO proc;
proc << "kpsewhich" << filename;
proc.start(KProcess::Block);
proc.readln(EPSfilename);
-
return EPSfilename.stripWhiteSpace();
+ */
}
#include "psgs.moc"
--- branches/work/kviewshell-0.7/kviewshell/plugins/dvi/special.cpp #598955:598956
@@ -491,7 +491,7 @@
}
else
{
- QString text = i18n("File not found: \n %1").arg(EPSfilename_orig);
+ QString text = i18n("File not found: %1").arg(EPSfilename_orig);
cairo_show_text(painter, text.utf8());
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic