[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kfile-plugins
From: David Faure <faure () kde ! org>
Date: 2004-09-08 21:45:00
Message-ID: 20040908214500.304021CC2 () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
Don't try to create a QFile on an empty path (as happens with remote urls)
Test if open(IO_ReadOnly) worked (I guess it can still fail with non-readable files)
This fixes some QFile warnings on stderr.
M +2 -0 dvi/kfile_dvi.cpp 1.5
M +4 -3 jpeg/exif.cpp 1.8
M +4 -0 jpeg/kfile_jpeg.cpp 1.21
M +5 -1 pcx/kfile_pcx.cpp 1.7
M +5 -2 png/kfile_png.cpp 1.24
--- kdegraphics/kfile-plugins/dvi/kfile_dvi.cpp #1.4:1.5
@@ -58,4 +58,6 @@ KDviPlugin::KDviPlugin (QObject * parent
bool KDviPlugin::readInfo (KFileMetaInfo & info, uint /* what (unused in this plugin) */)
{
+ if ( info.path().isEmpty() )
+ return false;
KFileMetaInfoGroup GeneralGroup = appendGroup(info, "General");
QFile f(info.path());
--- kdegraphics/kfile-plugins/jpeg/exif.cpp #1.7:1.8
@@ -883,5 +883,6 @@ bool ExifData::scan(const QString & path
QFile f(path);
- f.open(IO_ReadOnly);
+ if ( !f.open(IO_ReadOnly) )
+ return false;
try {
--- kdegraphics/kfile-plugins/jpeg/kfile_jpeg.cpp #1.20:1.21
@@ -191,4 +191,8 @@ bool KJpegPlugin::writeInfo( const KFile
bool KJpegPlugin::readInfo( KFileMetaInfo& info, uint what )
{
+ const QString path( info.path() );
+ if ( path.isEmpty() ) // remote file
+ return false;
+
QString tag;
ExifData ImageInfo;
--- kdegraphics/kfile-plugins/pcx/kfile_pcx.cpp #1.6:1.7
@@ -83,8 +83,12 @@ KPcxPlugin::KPcxPlugin( QObject *parent,
bool KPcxPlugin::readInfo( KFileMetaInfo& info, uint )
{
+ if ( info.path().isEmpty() )
+ return false;
+
struct PCXHEADER header;
QFile f( info.path() );
- f.open( IO_ReadOnly );
+ if ( !f.open( IO_ReadOnly ) )
+ return false;
QDataStream s( &f );
--- kdegraphics/kfile-plugins/png/kfile_png.cpp #1.23:1.24
@@ -120,6 +120,9 @@ KPngPlugin::KPngPlugin(QObject *parent,
bool KPngPlugin::readInfo( KFileMetaInfo& info, uint what)
{
+ if ( info.path().isEmpty() ) // remote file
+ return false;
QFile f(info.path());
- f.open(IO_ReadOnly);
+ if ( !f.open(IO_ReadOnly) )
+ return false;
if (f.size() < 26) return false;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic