#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
+#include "support/mutex.h"
#include "support/os.h"
#include "support/PathChanger.h"
#include "support/Systemcall.h"
#include <map>
#include <ctime>
-// FIXME: Q_WS_MACX is not available, it's in Qt
+// FIXME: Q_OS_MAC is not available, it's in Qt
#ifdef USE_MACOSX_PACKAGING
#include "support/linkback/LinkBackProxy.h"
#endif
int const max_count = 50;
int count = 0;
- // Maximum number of binary chars allowed for latex detection
- int const max_bin = 5;
-
string str;
string format;
bool firstLine = true;
bool backslash = false;
bool maybelatex = false;
- int binchars = 0;
int dollars = 0;
- while ((count++ < max_count) && format.empty() && binchars <= max_bin) {
+ while ((count++ < max_count) && format.empty() && !maybelatex) {
if (ifs.eof())
break;
// inline equation
maybelatex = true;
}
-
- binchars += count_bin_chars(str);
}
- if (format.empty() && binchars <= max_bin && maybelatex)
+ if (format.empty() && maybelatex && !isBinaryFile(fn))
format = "latex";
if (format.empty()) {
};
-// FIXME THREAD
/// Mapping absolute pathnames of files to their ZippedInfo metadata.
static std::map<std::string, ZippedInfo> zipped_;
+static Mutex zipped_mutex;
bool Formats::isZippedFile(support::FileName const & filename) const {
string const & fname = filename.absFileName();
time_t timestamp = filename.lastModified();
+ Mutex::Locker lock(&zipped_mutex);
map<string, ZippedInfo>::iterator it = zipped_.find(fname);
if (it != zipped_.end() && it->second.timestamp == timestamp)
return it->second.zipped;