Simplify GParted_Core::get_fs()
get_fs() used to work by (1) returning the supported capabilities of the requested file system found in the FILESYSTEMS vector; (2) if not found return the supported capabilities for file system FS_UNKNOWN; and (3) if that wasn't found either, create a not supported capabilities set for FS_UNKNOWN and return that. This is more complicated that required. Also the not supported capabilities set, as created by struct FS() constructor, is the same as that created in file_supported_filesystems() local variable fs_notsupp. Simplify get_fs() just using a single not found code path returning a not supported capabilities set.
This commit is contained in:
parent
320e166c03
commit
49664f3ca3
|
@ -932,26 +932,19 @@ const std::vector<FS> & GParted_Core::get_filesystems() const
|
|||
return FILESYSTEMS ;
|
||||
}
|
||||
|
||||
// Return supported capabilities of the file system type or, if not found, not supported
|
||||
// capabilities set.
|
||||
const FS & GParted_Core::get_fs( GParted::FILESYSTEM filesystem ) const
|
||||
{
|
||||
unsigned int unknown ;
|
||||
|
||||
unknown = FILESYSTEMS .size() ;
|
||||
for ( unsigned int t = 0 ; t < FILESYSTEMS .size() ; t++ )
|
||||
{
|
||||
if ( FILESYSTEMS[ t ] .filesystem == filesystem )
|
||||
return FILESYSTEMS[ t ] ;
|
||||
else if ( FILESYSTEMS[ t ] .filesystem == FS_UNKNOWN )
|
||||
unknown = t ;
|
||||
}
|
||||
|
||||
if ( unknown == FILESYSTEMS .size() ) {
|
||||
// This shouldn't happen, but just in case...
|
||||
static FS fs;
|
||||
fs .filesystem = FS_UNKNOWN ;
|
||||
return fs ;
|
||||
} else
|
||||
return FILESYSTEMS[ unknown ] ;
|
||||
static FS fs_notsupp;
|
||||
fs_notsupp.filesystem = FS_UNKNOWN;
|
||||
return fs_notsupp;
|
||||
}
|
||||
|
||||
//Return all libparted's partition table types in it's preferred ordering,
|
||||
|
|
Loading…
Reference in New Issue