Fix Link Time Optimizations

This commit fixes compiling rTorrent with LTO (Link Time Optimizations). We just need to rename from variables in the directory_entry structure to avoid ODR and ZLIB conflicts.
This commit is contained in:
stickz
2024-09-01 08:20:01 -04:00
parent 4e246a401f
commit ea3828a17e
7 changed files with 29 additions and 29 deletions
+8 -8
View File
@@ -83,19 +83,19 @@ Directory::update(int flags) {
#ifdef __sun__
stat(entry->d_name, &s);
itr->d_fileno = entry->d_ino;
itr->d_reclen = 0;
itr->d_type = s.st_mode;
itr->s_fileno = entry->d_ino;
itr->s_reclen = 0;
itr->s_type = s.st_mode;
#else
itr->d_fileno = entry->d_fileno;
itr->d_reclen = entry->d_reclen;
itr->d_type = entry->d_type;
itr->s_fileno = entry->d_fileno;
itr->s_reclen = entry->d_reclen;
itr->s_type = entry->d_type;
#endif
#ifdef DIRENT_NAMLEN_EXISTS_FOOBAR
itr->d_name = std::string(entry->d_name, entry->d_name + entry->d_namlen);
itr->s_name = std::string(entry->d_name, entry->d_name + entry->d_namlen);
#else
itr->d_name = std::string(entry->d_name);
itr->s_name = std::string(entry->d_name);
#endif
}
+10 -10
View File
@@ -48,11 +48,11 @@ struct directory_entry {
bool is_file() const { return true; }
// The name and types should match POSIX.
uint32_t d_fileno;
uint32_t d_reclen; //Not used. Messes with Solaris.
uint8_t d_type;
uint32_t s_fileno;
uint32_t s_reclen; //Not used. Messes with Solaris.
uint8_t s_type;
std::string d_name;
std::string s_name;
};
class Directory : private std::vector<directory_entry> {
@@ -94,12 +94,12 @@ private:
std::string m_path;
};
inline bool operator == (const directory_entry& left, const directory_entry& right) { return left.d_name == right.d_name; }
inline bool operator != (const directory_entry& left, const directory_entry& right) { return left.d_name != right.d_name; }
inline bool operator < (const directory_entry& left, const directory_entry& right) { return left.d_name < right.d_name; }
inline bool operator > (const directory_entry& left, const directory_entry& right) { return left.d_name > right.d_name; }
inline bool operator <= (const directory_entry& left, const directory_entry& right) { return left.d_name <= right.d_name; }
inline bool operator >= (const directory_entry& left, const directory_entry& right) { return left.d_name >= right.d_name; }
inline bool operator == (const directory_entry& left, const directory_entry& right) { return left.s_name == right.s_name; }
inline bool operator != (const directory_entry& left, const directory_entry& right) { return left.s_name != right.s_name; }
inline bool operator < (const directory_entry& left, const directory_entry& right) { return left.s_name < right.s_name; }
inline bool operator > (const directory_entry& left, const directory_entry& right) { return left.s_name > right.s_name; }
inline bool operator <= (const directory_entry& left, const directory_entry& right) { return left.s_name <= right.s_name; }
inline bool operator >= (const directory_entry& left, const directory_entry& right) { return left.s_name >= right.s_name; }
}