mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-07-02 14:04:22 +00:00
Fix various problems introduced in scan with the last commit.
Fixes a crash due to an assertion trying to access a past-the-end iterator. Gets content type detection to work, although only after hashing is done (see comment in main.cpp for details). Fixes a problem with the array passed to guess_content_type being not sorted as the function expects. Adds more assertions.
This commit is contained in:
parent
22614432a9
commit
be9fc3eb0b
7 changed files with 93 additions and 10 deletions
|
@ -51,11 +51,17 @@ namespace mchlib {
|
|||
{
|
||||
}
|
||||
|
||||
#if defined(NDEBUG)
|
||||
FileRecordData ( const FileRecordData& ) = delete;
|
||||
#else
|
||||
FileRecordData ( const FileRecordData& ) = default;
|
||||
#endif
|
||||
FileRecordData ( FileRecordData&& ) = default;
|
||||
FileRecordData& operator= ( const FileRecordData& ) = delete;
|
||||
FileRecordData& operator= ( FileRecordData&& ) = default;
|
||||
bool operator== ( const FileRecordData& ) const = delete;
|
||||
#if !defined(NDEBUG)
|
||||
bool operator== ( const FileRecordData& parOther ) const;
|
||||
#endif
|
||||
|
||||
TigerHash hash;
|
||||
std::string abs_path;
|
||||
|
@ -83,6 +89,12 @@ namespace mchlib {
|
|||
std::string name;
|
||||
uint32_t disk_number;
|
||||
};
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
inline bool FileRecordData::operator== (const FileRecordData& parOther) const {
|
||||
return (this->abs_path == parOther.abs_path);
|
||||
}
|
||||
#endif
|
||||
} //namespace mchlib
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <ciso646>
|
||||
#include <cstdint>
|
||||
|
||||
namespace mchlib {
|
||||
namespace implem {
|
||||
|
@ -146,6 +147,10 @@ namespace mchlib {
|
|||
std::size_t size ( void ) const;
|
||||
std::size_t files_count ( void ) const;
|
||||
std::size_t dir_count ( void ) const;
|
||||
const ListType& sorted_list ( void ) const;
|
||||
|
||||
static void sort_list ( ListType& parList );
|
||||
static ListType::iterator lower_bound ( ListType& parList, const char* parPath, uint16_t parLevel, bool parIsDir );
|
||||
|
||||
private:
|
||||
ListType m_list;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue