[gparted] Initialise all struct FS members



commit 1a4cefb9601de47a1d4fdd31d60be9e37fadda2d
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Nov 13 21:46:57 2015 +0000

    Initialise all struct FS members
    
    The struct FS constructor initialised every member *except* filesystem
    and busy.  Then in *most* cases after declaring struct FS, assignments
    followed like this:
        FS fs;
        fs.filesystem = FS_BTRFS;
        fs.busy       = FS::GPARTED;
    But member busy wasn't always initialised.
    
    Add initialisation of members filesystem and busy to the struct FS
    constructor.  Specify optional parameter to the constructor to set the
    filesystem member, or when left off filesystem is initialised to
    FS_UNKNOWN.

 include/Utils.h     |    6 +++---
 src/GParted_Core.cc |    6 ++----
 src/btrfs.cc        |    3 +--
 src/exfat.cc        |    3 +--
 src/ext2.cc         |    3 +--
 src/f2fs.cc         |    4 +---
 src/fat16.cc        |    3 +--
 src/hfs.cc          |    3 +--
 src/hfsplus.cc      |    3 +--
 src/jfs.cc          |    3 +--
 src/linux_swap.cc   |    3 +--
 src/lvm2_pv.cc      |    3 +--
 src/nilfs2.cc       |    3 +--
 src/ntfs.cc         |    3 +--
 src/reiser4.cc      |    3 +--
 src/reiserfs.cc     |    3 +--
 src/ufs.cc          |    3 +--
 src/xfs.cc          |    3 +--
 18 files changed, 21 insertions(+), 40 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index f4809a2..5793b83 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -151,10 +151,10 @@ struct FS
        Byte_Value MIN ; 
        Byte_Value MAX ;
        
-       FS()
+       FS( FILESYSTEM fstype = FS_UNKNOWN ) : filesystem( fstype )
        {
-               read = read_label = write_label = read_uuid = write_uuid = create = create_with_label =
-               grow = shrink = move = check = copy = remove = online_read =
+               busy = read = read_label = write_label = read_uuid = write_uuid = create =
+               create_with_label = grow = shrink = move = check = copy = remove = online_read =
                online_grow = online_shrink = NONE ;
                MIN = MAX = 0 ;
        } 
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index cd9c280..cd9aa68 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -120,12 +120,11 @@ void GParted_Core::find_supported_filesystems()
        //  systems in menus and dialogs.
        FILESYSTEMS .clear() ;
 
-       FS fs_notsupp;
        for ( f = FILESYSTEM_MAP .begin() ; f != FILESYSTEM_MAP .end() ; f++ ) {
                if ( f ->second )
                        FILESYSTEMS .push_back( f ->second ->get_filesystem_support() ) ;
                else {
-                       fs_notsupp .filesystem = f ->first ;
+                       FS fs_notsupp( f->first );
                        FILESYSTEMS .push_back( fs_notsupp ) ;
                }
        }
@@ -942,8 +941,7 @@ const FS & GParted_Core::get_fs( GParted::FILESYSTEM filesystem ) const
                        return FILESYSTEMS[ t ] ;
        }
 
-       static FS fs_notsupp;
-       fs_notsupp.filesystem = FS_UNKNOWN;
+       static FS fs_notsupp( FS_UNKNOWN );
        return fs_notsupp;
 }
 
diff --git a/src/btrfs.cc b/src/btrfs.cc
index a8268b7..80e2185 100644
--- a/src/btrfs.cc
+++ b/src/btrfs.cc
@@ -39,8 +39,7 @@ std::map<Glib::ustring, BTRFS_Device> btrfs_device_cache ;
 
 FS btrfs::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_BTRFS ;
+       FS fs( FS_BTRFS );
 
        fs .busy = FS::EXTERNAL ;
 
diff --git a/src/exfat.cc b/src/exfat.cc
index f444fed..3f589a6 100644
--- a/src/exfat.cc
+++ b/src/exfat.cc
@@ -22,8 +22,7 @@ namespace GParted
 
 FS exfat::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = FS_EXFAT ;
+       FS fs( FS_EXFAT );
 
        fs .busy = FS::GPARTED ;
        fs .copy = FS::GPARTED ;
diff --git a/src/ext2.cc b/src/ext2.cc
index d1febeb..5c4ca69 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -23,8 +23,7 @@ namespace GParted
 
 FS ext2::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = specific_type;
+       FS fs( specific_type );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/f2fs.cc b/src/f2fs.cc
index 7f25e47..e68475a 100644
--- a/src/f2fs.cc
+++ b/src/f2fs.cc
@@ -23,9 +23,7 @@ namespace GParted
 
 FS f2fs::get_filesystem_support()
 {
-       FS fs ;
-
-       fs .filesystem = FS_F2FS ;
+       FS fs( FS_F2FS );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/fat16.cc b/src/fat16.cc
index c161605..c8dcbb1 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -60,8 +60,7 @@ const Glib::ustring fat16::get_custom_text( CUSTOM_TEXT ttype, int index ) const
 
 FS fat16::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = specific_type ;
+       FS fs( specific_type );
 
        // hack to disable silly mtools warnings
        setenv( "MTOOLS_SKIP_CHECK", "1", 0 );
diff --git a/src/hfs.cc b/src/hfs.cc
index 194d6f3..f0f473c 100644
--- a/src/hfs.cc
+++ b/src/hfs.cc
@@ -24,8 +24,7 @@ namespace GParted
 
 FS hfs::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_HFS ;
+       FS fs( FS_HFS );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/hfsplus.cc b/src/hfsplus.cc
index 7c38949..6c643b9 100644
--- a/src/hfsplus.cc
+++ b/src/hfsplus.cc
@@ -24,8 +24,7 @@ namespace GParted
 
 FS hfsplus::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_HFSPLUS ;
+       FS fs( FS_HFSPLUS );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/jfs.cc b/src/jfs.cc
index ea86def..7d9cef9 100644
--- a/src/jfs.cc
+++ b/src/jfs.cc
@@ -24,8 +24,7 @@ namespace GParted
 
 FS jfs::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_JFS ;
+       FS fs( FS_JFS );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/linux_swap.cc b/src/linux_swap.cc
index db48d1e..0e9dadc 100644
--- a/src/linux_swap.cc
+++ b/src/linux_swap.cc
@@ -42,8 +42,7 @@ const Glib::ustring linux_swap::get_custom_text( CUSTOM_TEXT ttype, int index )
 
 FS linux_swap::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_LINUX_SWAP ;
+       FS fs( FS_LINUX_SWAP );
 
        fs .busy = FS::GPARTED ;
        fs .read = FS::EXTERNAL ;
diff --git a/src/lvm2_pv.cc b/src/lvm2_pv.cc
index a601935..e58f34d 100644
--- a/src/lvm2_pv.cc
+++ b/src/lvm2_pv.cc
@@ -47,8 +47,7 @@ const Glib::ustring lvm2_pv::get_custom_text( CUSTOM_TEXT ttype, int index ) con
 
 FS lvm2_pv::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_LVM2_PV ;
+       FS fs( FS_LVM2_PV );
 
        if ( LVM2_PV_Info::is_lvm2_pv_supported() )
        {
diff --git a/src/nilfs2.cc b/src/nilfs2.cc
index 0c75ccb..8fea2e1 100644
--- a/src/nilfs2.cc
+++ b/src/nilfs2.cc
@@ -23,8 +23,7 @@ namespace GParted
 
 FS nilfs2::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_NILFS2 ;
+       FS fs( FS_NILFS2 );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/ntfs.cc b/src/ntfs.cc
index 6cea41e..eac75eb 100644
--- a/src/ntfs.cc
+++ b/src/ntfs.cc
@@ -57,8 +57,7 @@ const Glib::ustring ntfs::get_custom_text( CUSTOM_TEXT ttype, int index ) const
 
 FS ntfs::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_NTFS ;
+       FS fs( FS_NTFS );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/reiser4.cc b/src/reiser4.cc
index c749f22..5dfbdb4 100644
--- a/src/reiser4.cc
+++ b/src/reiser4.cc
@@ -24,8 +24,7 @@ namespace GParted
 
 FS reiser4::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_REISER4 ;
+       FS fs( FS_REISER4 );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/reiserfs.cc b/src/reiserfs.cc
index f87145f..6c46613 100644
--- a/src/reiserfs.cc
+++ b/src/reiserfs.cc
@@ -24,8 +24,7 @@ namespace GParted
 
 FS reiserfs::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_REISERFS ;
+       FS fs( FS_REISERFS );
 
        fs .busy = FS::GPARTED ;
 
diff --git a/src/ufs.cc b/src/ufs.cc
index 0f25735..42d34b6 100644
--- a/src/ufs.cc
+++ b/src/ufs.cc
@@ -23,8 +23,7 @@ namespace GParted
 
 FS ufs::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_UFS ;
+       FS fs( FS_UFS );
 
        fs .busy = FS::GPARTED ;
        fs .copy = GParted::FS::GPARTED ;
diff --git a/src/xfs.cc b/src/xfs.cc
index 5d822cb..b261993 100644
--- a/src/xfs.cc
+++ b/src/xfs.cc
@@ -24,8 +24,7 @@ namespace GParted
 
 FS xfs::get_filesystem_support()
 {
-       FS fs ;
-       fs .filesystem = GParted::FS_XFS ;
+       FS fs( FS_XFS );
 
        fs .busy = FS::GPARTED ;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]