|
|
@ -165,9 +165,13 @@ int KMimeMagic::apprentice( const TQString& magicfile ) {
|
|
|
|
TQString maindatabase = magicfile;
|
|
|
|
TQString maindatabase = magicfile;
|
|
|
|
if (maindatabase == "") {
|
|
|
|
if (maindatabase == "") {
|
|
|
|
maindatabase = magic_getpath(0, FILE_LOAD);
|
|
|
|
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.clear();
|
|
|
|
conf->databases.append(maindatabase);
|
|
|
|
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());
|
|
|
|
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);
|
|
|
|
magic_setflags(conf->magic, magic_flags);
|
|
|
|
conf->resultBuf = TQString(magic_file(conf->magic, fileName));
|
|
|
|
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);
|
|
|
|
conf->resultBuf = fixupMagicOutput(conf->resultBuf);
|
|
|
|
|
|
|
|
|
|
|
|
if ( conf->utimeConf && conf->utimeConf->restoreAccessTime( fn ) ) {
|
|
|
|
if ( conf->utimeConf && conf->utimeConf->restoreAccessTime( fn ) ) {
|
|
|
@ -253,6 +258,7 @@ bool KMimeMagic::mergeConfig(const TQString & _configfile) {
|
|
|
|
TQString merged_databases = conf->databases.join(":");
|
|
|
|
TQString merged_databases = conf->databases.join(":");
|
|
|
|
int magicvers = magic_version();
|
|
|
|
int magicvers = magic_version();
|
|
|
|
if ((magicvers < 512) || (magicvers >= 518)) {
|
|
|
|
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) {
|
|
|
|
if (magic_load(conf->magic, merged_databases.latin1()) == 0) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -261,7 +267,7 @@ bool KMimeMagic::mergeConfig(const TQString & _configfile) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
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;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -289,6 +295,7 @@ KMimeMagicResult *KMimeMagic::findBufferType(const TQByteArray &array) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
magic_setflags(conf->magic, magic_flags);
|
|
|
|
magic_setflags(conf->magic, magic_flags);
|
|
|
|
conf->resultBuf = TQString(magic_buffer(conf->magic, array.data(), nbytes));
|
|
|
|
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);
|
|
|
|
conf->resultBuf = fixupMagicOutput(conf->resultBuf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* if we have any results, put them in the request structure */
|
|
|
|
/* if we have any results, put them in the request structure */
|
|
|
|