summaryrefslogtreecommitdiffstats
path: root/tdeio
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-07 15:35:07 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-07 15:35:07 -0500
commit30c2b7e4bd6fa63d0f3431b8e82fefd81364726f (patch)
treedb230ec7e83392ce981cd80912a2b4fdf6f3a206 /tdeio
parente5f898219af927c9bac3aa9b0c9e9473a52dde15 (diff)
downloadtdelibs-30c2b7e4bd6fa63d0f3431b8e82fefd81364726f.tar.gz
tdelibs-30c2b7e4bd6fa63d0f3431b8e82fefd81364726f.zip
Autodetect downloaded mime type and compare against category; if wallpaper downloads something other than image abort
This relates to Bug 2127
Diffstat (limited to 'tdeio')
-rw-r--r--tdeio/tdeio/kmimemagic.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tdeio/tdeio/kmimemagic.cpp b/tdeio/tdeio/kmimemagic.cpp
index eec0fb2a7..821794123 100644
--- a/tdeio/tdeio/kmimemagic.cpp
+++ b/tdeio/tdeio/kmimemagic.cpp
@@ -165,9 +165,13 @@ int KMimeMagic::apprentice( const TQString& magicfile ) {
TQString maindatabase = magicfile;
if (maindatabase == "") {
maindatabase = magic_getpath(0, FILE_LOAD);
+ if (maindatabase == "") {
+ kdWarning() << k_funcinfo << "Unable to locate system mime magic database; mime type detection will not function correctly!" << endl;
+ }
}
conf->databases.clear();
conf->databases.append(maindatabase);
+printf("[RAJA DEBUG 342.0] Loading database '%s'\n\r", conf->databases[0].ascii()); fflush(stdout);
return magic_load(conf->magic, conf->databases[0].latin1());
}
@@ -186,6 +190,7 @@ void process(struct config_rec* conf, const TQString & fn) {
}
magic_setflags(conf->magic, magic_flags);
conf->resultBuf = TQString(magic_file(conf->magic, fileName));
+printf("[RAJA DEBUG 340.0] fileName: '%s' conf->resultBuf: '%s'\n\r", fileName.data(), conf->resultBuf.ascii()); fflush(stdout);
conf->resultBuf = fixupMagicOutput(conf->resultBuf);
if ( conf->utimeConf && conf->utimeConf->restoreAccessTime( fn ) ) {
@@ -253,6 +258,7 @@ bool KMimeMagic::mergeConfig(const TQString & _configfile) {
TQString merged_databases = conf->databases.join(":");
int magicvers = magic_version();
if ((magicvers < 512) || (magicvers >= 518)) {
+printf("[RAJA DEBUG 342.1] Loading database(s) '%s'\n\r", merged_databases.ascii()); fflush(stdout);
if (magic_load(conf->magic, merged_databases.latin1()) == 0) {
return true;
}
@@ -261,7 +267,7 @@ bool KMimeMagic::mergeConfig(const TQString & _configfile) {
}
}
else {
- kdWarning(7018) << "KMimeMagic::mergeConfig disabled due to buggy libmagic version " << magicvers << endl;
+ kdWarning(7018) << k_funcinfo << "KMimeMagic::mergeConfig disabled due to buggy libmagic version " << magicvers << endl;
return false;
}
}
@@ -289,6 +295,7 @@ KMimeMagicResult *KMimeMagic::findBufferType(const TQByteArray &array) {
}
magic_setflags(conf->magic, magic_flags);
conf->resultBuf = TQString(magic_buffer(conf->magic, array.data(), nbytes));
+printf("[RAJA DEBUG 340.1] conf->resultBuf: '%s'\n\r", conf->resultBuf.ascii()); fflush(stdout);
conf->resultBuf = fixupMagicOutput(conf->resultBuf);
}
/* if we have any results, put them in the request structure */