unsigned long FileName::checksum() const
{
- unsigned long result = 0;
-
if (!exists()) {
//LYXERR0("File \"" << absFileName() << "\" does not exist!");
- return result;
+ return 0;
}
// a directory may be passed here so we need to test it. (bug 3622)
if (isDirectory()) {
LYXERR0('"' << absFileName() << "\" is a directory!");
- return result;
+ return 0;
}
// This is used in the debug output at the end of the method.
if (lyxerr.debugging(Debug::FILES))
t.restart();
+ unsigned long result = 0;
+
#if QT_VERSION >= 0x999999
// First version of checksum uses Qt4.4 mmap support.
// FIXME: This code is not ready with Qt4.4.2,
// QAbstractFileEngine::MapExtension)
QFile qf(fi.filePath());
if (!qf.open(QIODevice::ReadOnly))
- return result;
+ return 0;
qint64 size = fi.size();
uchar * ubeg = qf.map(0, size);
uchar * uend = ubeg + size;
int fd = open(file, O_RDONLY);
if (!fd)
- return result;
+ return 0;
struct stat info;
if (fstat(fd, &info)){
// Some platforms have the wrong type for MAP_FAILED (compaq cxx).
if (mm == reinterpret_cast<void*>(MAP_FAILED)) {
close(fd);
- return result;
+ return 0;
}
char * beg = static_cast<char*>(mm);
// This will do nothing if *it is already absolute.
string const exe_dir = makeAbsPath(*it).absFileName();
- FileName const exe_path(addName(exe_dir, exe_name));
- if (exe_path.exists())
- return exe_path;
+ FileName const exe_path2(addName(exe_dir, exe_name));
+ if (exe_path2.exists())
+ return exe_path2;
}
// Didn't find anything.
in_double_quote = !in_double_quote;
}
} else if (c == '\\' && !escaped) {
- escaped = !escaped;
+ escaped = true;
} else if (c == '>' && !(in_double_quote || escaped)) {
if (suffixIs(outcmd[o], " 2")) {
outcmd[o] = rtrim(outcmd[o], "2");
}
-int hexToInt(docstring const & str)
+unsigned int hexToInt(docstring const & str)
{
string s = to_ascii(str);
- int h;
+ unsigned int h;
sscanf(s.c_str(), "%x", &h);
return h;
}
bool isHex(docstring const & str);
-int hexToInt(docstring const & str);
+unsigned int hexToInt(docstring const & str);
/// is \p str pure ascii?
bool isAscii(docstring const & str);
// but we are trying hard to find a valid python binary
vector<string> const path = getEnvPath("PATH");
lyxerr << "Looking for python 3.x ...\n";
- for (auto bin: path) {
+ for (auto bin : path) {
QString const dir = toqstr(bin);
string const localdir = dir.toLocal8Bit().constData();
QDir qdir(dir);
qdir.setFilter(QDir::Files | QDir::Executable);
QStringList list = qdir.entryList(QStringList("python3*"));
- for (auto bin: list) {
+ for (auto bin2 : list) {
string const binary = addName(localdir,
- bin.toLocal8Bit().constData());
+ bin2.toLocal8Bit().constData());
command = python23_call(binary, true);
if (!command.empty())
return command;
// the search is probably broader than required
// but we are trying hard to find a valid python binary
lyxerr << "Looking for python 2.x ...\n";
- for (auto bin: path) {
+ for (auto bin : path) {
QString const dir = toqstr(bin);
string const localdir = dir.toLocal8Bit().constData();
QDir qdir(dir);
qdir.setFilter(QDir::Files | QDir::Executable);
QStringList list = qdir.entryList(QStringList("python2*"));
- for (auto bin: list) {
+ for (auto bin2 : list) {
string const binary = addName(localdir,
- bin.toLocal8Bit().constData());
+ bin2.toLocal8Bit().constData());
command = python23_call(binary, true);
if (!command.empty())
return command;