[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kdoctools
From: Stephan Kulow <coolo () kde ! org>
Date: 2003-01-08 13:04:54
[Download RAW message or body]
CVS commit by coolo:
don't rely on KTrader to find the bzip2 filter we link to anyway
M +20 -2 xslt.cpp 1.58
--- kdelibs/kdoctools/xslt.cpp #1.57:1.58
@@ -25,4 +25,5 @@
#include <gzip/kgzipfilter.h>
#include <bzip2/kbzip2filter.h>
+#include <klibloader.h>
#if !defined( SIMPLE_XSLT )
@@ -283,7 +284,24 @@ void fillInstance(KInstance &ins) {
}
+extern "C" void *init_kbzip2filter();
+
+static QIODevice *getBZip2device(const QString &fileName )
+{
+ QFile * f = new QFile( fileName );
+ KLibFactory * factory = static_cast<KLibFactory*>(init_kbzip2filter());
+ KFilterBase * base = static_cast<KFilterBase*>( factory->create(0, "bzip2" ) );
+
+ if ( base )
+ {
+ base->setDevice(f, true);
+ return new KFilterDev(base, true);
+ }
+ return 0;
+}
+
bool saveToCache( const QString &contents, const QString &filename )
{
- QIODevice *fd = KFilterDev::deviceForFile(filename);
+ kdDebug() << "saveToCache " << filename << endl;
+ QIODevice *fd = ::getBZip2device(filename);
if (!fd->open(IO_WriteOnly))
@@ -309,5 +327,5 @@ static bool readCache( const QString &fi
kdDebug( 7119 ) << "create filter" << endl;
- QIODevice *fd = KFilterDev::deviceForFile(cache);
+ QIODevice *fd = ::getBZip2device(cache);
if (!fd->open(IO_ReadOnly))
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic