kdelibs/kdelibs-4.0.5-strigi-metain...

29 lines
866 B
Diff

--- kdelibs/kio/kio/kfilemetainfo.cpp 2008/06/06 22:10:03 817892
+++ kdelibs/kio/kio/kfilemetainfo.cpp 2008/06/06 22:13:15 817893
@@ -56,7 +56,7 @@
QIODevice& in;
int32_t fillBuffer(char* start, int32_t space);
public:
- QIODeviceInputStream(QIODevice& i) :in(i) {}
+ QIODeviceInputStream(QIODevice& i);
};
int32_t
QIODeviceInputStream::fillBuffer(char* start, int32_t space) {
@@ -74,6 +74,16 @@
}
return nwritten;
}
+
+QIODeviceInputStream::QIODeviceInputStream(QIODevice &i) :in(i)
+{
+ // determine if we have a character device, which will likely never eof and thereby
+ // potentially cause an infinite loop.
+ if(i.isSequential()) {
+ in.close(); // cause fillBuffer to return -1
+ }
+}
+
/**
* @brief KMetaInfoWriter handles the data returned by the Strigi analyzers and
* store it in a KFileMetaInfo.