[gparted] Strip unnecessary scope from GParted::TYPE_* (!20)



commit 2bbe7fcc45a7ccfba2e5c5cb2f11ba5691145c07
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Oct 14 13:27:58 2018 +0100

    Strip unnecessary scope from GParted::TYPE_* (!20)
    
    The code inconsistently uses GParted:: scope in front of TYPE_*.
    
        $ fgrep 'GParted::TYPE_' src/*.cc | wc -l
        35
        $ egrep '[^:]TYPE_' src/*.cc | wc -l
        83
    
    GParted:: scope resolution is unnecessary as all the code is inside the
    GParted scope, except for main().  So remove it.
    
    Closes !20 - Minor namespace and scope operator tidy-ups

 src/DMRaid.cc                       |  2 +-
 src/Dialog_Partition_Info.cc        |  2 +-
 src/Dialog_Partition_New.cc         |  8 ++++----
 src/Dialog_Partition_Resize_Move.cc | 17 +++++++++--------
 src/Dialog_Rescue_Data.cc           | 16 ++++++++--------
 src/DrawingAreaVisualDisk.cc        |  5 ++---
 src/GParted_Core.cc                 |  8 ++++----
 src/OperationCreate.cc              |  6 +++---
 src/OperationDelete.cc              |  4 ++--
 src/OperationResizeMove.cc          |  8 ++++----
 src/Partition.cc                    |  2 +-
 src/TreeView_Detail.cc              |  4 ++--
 12 files changed, 41 insertions(+), 41 deletions(-)
---
diff --git a/src/DMRaid.cc b/src/DMRaid.cc
index 9276bef7..7f7671b7 100644
--- a/src/DMRaid.cc
+++ b/src/DMRaid.cc
@@ -474,7 +474,7 @@ bool DMRaid::update_dev_map_entry( const Partition & partition, OperationDetail
        //Update dmraid entry by first deleting the entry then recreating the entry
 
        //Skip if extended partition because the only change is to the partition table.
-       if ( partition .type == GParted::TYPE_EXTENDED )
+       if (partition.type == TYPE_EXTENDED)
                return true ;
 
        bool exit_status = true ;
diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc
index 62cec8ee..dd81efda 100644
--- a/src/Dialog_Partition_Info.cc
+++ b/src/Dialog_Partition_Info.cc
@@ -186,7 +186,7 @@ void Dialog_Partition_Info::init_drawingarea()
        this ->get_vbox() ->pack_start( *hbox, Gtk::PACK_SHRINK ) ;
        
        //calculate proportional width of used, unused and unallocated
-       if ( partition .type == GParted::TYPE_EXTENDED )
+       if (partition.type == TYPE_EXTENDED)
        {
                //Specifically show extended partitions as unallocated
                used        = 0 ;
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index da7aba78..d6da6b03 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -195,11 +195,11 @@ const Partition & Dialog_Partition_New::Get_New_Partition()
 
        switch (combo_type.get_active_row_number())
        {
-               case 0  :       part_type = GParted::TYPE_PRIMARY;  break;
-               case 1  :       part_type = GParted::TYPE_LOGICAL;  break;
-               case 2  :       part_type = GParted::TYPE_EXTENDED; break;
+               case 0:   part_type = TYPE_PRIMARY;   break;
+               case 1:   part_type = TYPE_LOGICAL;   break;
+               case 2:   part_type = TYPE_EXTENDED;  break;
 
-               default :       part_type = GParted::TYPE_UNALLOCATED ;
+               default:  part_type = TYPE_UNALLOCATED;
        }
 
        //FIXME:  Partition size is limited to just less than 1024 TeraBytes due
diff --git a/src/Dialog_Partition_Resize_Move.cc b/src/Dialog_Partition_Resize_Move.cc
index b28c82ec..b8666f4c 100644
--- a/src/Dialog_Partition_Resize_Move.cc
+++ b/src/Dialog_Partition_Resize_Move.cc
@@ -47,7 +47,7 @@ void Dialog_Partition_Resize_Move::set_data( const Partition & selected_partitio
 
        new_partition = selected_partition.clone();
 
-       if ( selected_partition .type == GParted::TYPE_EXTENDED )
+       if (selected_partition.type == TYPE_EXTENDED)
        {
                Set_Resizer( true ) ;   
                Resize_Move_Extended( partitions ) ;
@@ -116,7 +116,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const PartitionVector & p
        Sector previous, next ;
        previous = next = 0 ;
        //also check the partitions file system ( if this is a 'resize-only' then previous should be 0 )      
  
-       if ( t >= 1 && partitions[t -1].type == GParted::TYPE_UNALLOCATED && ! this ->fixed_start )
+       if (t >= 1 && partitions[t-1].type == TYPE_UNALLOCATED && ! this->fixed_start)
        { 
                previous = partitions[t -1] .get_sector_length() ;
                START = partitions[t -1] .sector_start ;
@@ -124,7 +124,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const PartitionVector & p
        else
                START = new_partition->sector_start;
 
-       if ( t +1 < partitions .size() && partitions[t +1] .type == GParted::TYPE_UNALLOCATED )
+       if (t+1 < partitions.size() && partitions[t+1].type == TYPE_UNALLOCATED)
        {
                next = partitions[t +1] .get_sector_length() ;
 
@@ -235,12 +235,13 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const PartitionVector &
        //calculate total size in MiB's of previous, current and next partition
        //first find index of partition
        unsigned int t = 0;
-       while ( t < partitions .size() && partitions[ t ] .type != GParted::TYPE_EXTENDED ) t++ ;
-       
+       while (t < partitions.size() && partitions[t].type != TYPE_EXTENDED)
+               t++;
+
        Sector previous, next ;
        previous = next = 0 ;
        //calculate length and start of previous
-       if ( t > 0 && partitions[t -1] .type == GParted::TYPE_UNALLOCATED )
+       if (t > 0 && partitions[t-1].type == TYPE_UNALLOCATED)
        {
                previous = partitions[t -1] .get_sector_length() ;
                START = partitions[t -1] .sector_start ;
@@ -249,7 +250,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const PartitionVector &
                START = new_partition->sector_start;
 
        //calculate length of next
-       if ( t +1 < partitions .size() && partitions[ t +1 ] .type == GParted::TYPE_UNALLOCATED )
+       if (t+1 < partitions.size() && partitions[t+1].type == TYPE_UNALLOCATED)
                next = partitions[ t +1 ] .get_sector_length() ;
                
        //now we have enough data to calculate some important values..
@@ -279,7 +280,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const PartitionVector &
                last = new_partition->sector_start;
                for ( unsigned int i = 0 ; i < partitions[ t ] .logicals .size() ; i++ )
                {
-                       if ( partitions[ t ] .logicals[ i ] .type == GParted::TYPE_LOGICAL )
+                       if (partitions[t].logicals[i].type == TYPE_LOGICAL)
                        {
                                if ( partitions[ t ] .logicals[ i ] .sector_start < first )
                                        first = partitions[t].logicals[i].sector_start - (MEBIBYTE / 
new_partition->sector_size);
diff --git a/src/Dialog_Rescue_Data.cc b/src/Dialog_Rescue_Data.cc
index 319ecf6c..3d7cd4ac 100644
--- a/src/Dialog_Rescue_Data.cc
+++ b/src/Dialog_Rescue_Data.cc
@@ -109,12 +109,12 @@ void Dialog_Rescue_Data::create_list_of_fs()
 
        for(unsigned int i=0;i<this->partitions.size();i++)
        {
-               if (this->partitions[i].filesystem == FS_UNALLOCATED
-                       || this->partitions[i].filesystem == FS_UNKNOWN
-                       || this->partitions[i].filesystem == FS_UNFORMATTED
-                       || this->partitions[i].filesystem == FS_EXTENDED
-                       || this->partitions[i].type==GParted::TYPE_EXTENDED
-                       || this->partitions[i].type==GParted::TYPE_UNALLOCATED)
+               if (this->partitions[i].filesystem == FS_UNALLOCATED   ||
+                   this->partitions[i].filesystem == FS_UNKNOWN       ||
+                   this->partitions[i].filesystem == FS_UNFORMATTED   ||
+                   this->partitions[i].filesystem == FS_EXTENDED      ||
+                   this->partitions[i].type       == TYPE_EXTENDED    ||
+                   this->partitions[i].type       == TYPE_UNALLOCATED   )
                {
                        continue;
                }
@@ -329,7 +329,7 @@ void Dialog_Rescue_Data::read_partitions_from_buffer()
                        Glib::ustring dev_path=this->device_path;
                        Glib::ustring part_path;
                        int part_num;
-                       PartitionType type=GParted::TYPE_PRIMARY;
+                       PartitionType type = TYPE_PRIMARY;
                        FSType fs = FS_UNALLOCATED;
                        Sector sec_start=0;
                        Sector sec_end=0;
@@ -392,7 +392,7 @@ void Dialog_Rescue_Data::read_partitions_from_buffer()
                                                case 0x85: //Extended
                                                {
                                                        fs = FS_EXTENDED;
-                                                       type=GParted::TYPE_EXTENDED;
+                                                       type = TYPE_EXTENDED;
                                                        break;
                                                }
                                                default:
diff --git a/src/DrawingAreaVisualDisk.cc b/src/DrawingAreaVisualDisk.cc
index ff4f68dd..2b0069ff 100644
--- a/src/DrawingAreaVisualDisk.cc
+++ b/src/DrawingAreaVisualDisk.cc
@@ -74,10 +74,9 @@ void DrawingAreaVisualDisk::clear()
 int DrawingAreaVisualDisk::get_total_separator_px( const PartitionVector & partitions )
 {
        for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
-               if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
+               if (partitions[t].type == TYPE_EXTENDED)
                        return ( partitions[ t ] .logicals .size() -1 + partitions .size() -1 ) * SEP ;
 
-
        return ( partitions .size() -1 ) * SEP ;
 }      
 
@@ -96,7 +95,7 @@ void DrawingAreaVisualDisk::set_static_data( const PartitionVector & partitions,
                Glib::ustring color_str = Utils::get_color( 
partitions[t].get_filesystem_partition().filesystem );
                visual_partitions.back().color.set( color_str );
 
-               if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
+               if (partitions[t].type == TYPE_EXTENDED)
                        set_static_data( partitions[t].logicals,
                                         visual_partitions.back().logicals, partition_length );
                else
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index da6ca942..ff5f802c 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1943,13 +1943,13 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail
                //create new partition
                switch ( new_partition .type )
                {
-                       case GParted::TYPE_PRIMARY:
+                       case TYPE_PRIMARY:
                                type = PED_PARTITION_NORMAL ;
                                break ;
-                       case GParted::TYPE_LOGICAL:
+                       case TYPE_LOGICAL:
                                type = PED_PARTITION_LOGICAL ;
                                break ;
-                       case GParted::TYPE_EXTENDED:
+                       case TYPE_EXTENDED:
                                type = PED_PARTITION_EXTENDED ;
                                break ;
                                
@@ -1957,7 +1957,7 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail
                                type = PED_PARTITION_FREESPACE;
                }
 
-               if ( new_partition .type != GParted::TYPE_EXTENDED )
+               if (new_partition.type != TYPE_EXTENDED)
                        fs_type = ped_file_system_type_get( "ext2" ) ;
 
                PedPartition* lp_partition = ped_partition_new( lp_disk,
diff --git a/src/OperationCreate.cc b/src/OperationCreate.cc
index 49ff1ec1..1a629c6d 100644
--- a/src/OperationCreate.cc
+++ b/src/OperationCreate.cc
@@ -54,13 +54,13 @@ void OperationCreate::create_description()
 
        switch( partition_new->type )
        {
-               case GParted::TYPE_PRIMARY      :
+               case TYPE_PRIMARY:
                        description = _("Primary Partition");
                        break;
-               case GParted::TYPE_LOGICAL      :
+               case TYPE_LOGICAL:
                        description = _("Logical Partition") ;
                        break;  
-               case GParted::TYPE_EXTENDED     :
+               case TYPE_EXTENDED:
                        description = _("Extended Partition");
                        break;
        
diff --git a/src/OperationDelete.cc b/src/OperationDelete.cc
index cfeadc38..351c0f82 100644
--- a/src/OperationDelete.cc
+++ b/src/OperationDelete.cc
@@ -128,11 +128,11 @@ void OperationDelete::remove_original_and_adjacent_unallocated( PartitionVector
 {
        //remove unallocated space following the original partition
        if ( index_orig +1 < static_cast<int>( partitions .size() ) &&
-            partitions[ index_orig +1 ] .type == GParted::TYPE_UNALLOCATED )
+            partitions[index_orig+1].type == TYPE_UNALLOCATED )
                partitions .erase( partitions .begin() + index_orig +1 );
        
        //remove unallocated space preceding the original partition and the original partition
-       if ( index_orig -1 >= 0 && partitions[ index_orig -1 ] .type == GParted::TYPE_UNALLOCATED )
+       if (index_orig-1 >= 0 && partitions[index_orig-1].type == TYPE_UNALLOCATED)
                partitions .erase( partitions .begin() + --index_orig ) ;
                                
        //and finally remove the original partition
diff --git a/src/OperationResizeMove.cc b/src/OperationResizeMove.cc
index 22f80cbf..ddcd531d 100644
--- a/src/OperationResizeMove.cc
+++ b/src/OperationResizeMove.cc
@@ -210,11 +210,11 @@ void OperationResizeMove::apply_extended_to_visual( PartitionVector & partitions
        if ( index_extended >= 0 )
        {
                if ( partitions[ index_extended ] .logicals .size() > 0 &&
-                    partitions[ index_extended ] .logicals .front() .type == GParted::TYPE_UNALLOCATED )
+                    partitions[index_extended].logicals.front().type == TYPE_UNALLOCATED )
                        partitions[ index_extended ] .logicals .erase( partitions[ index_extended ] .logicals 
.begin() ) ;
        
                if ( partitions[ index_extended ] .logicals .size() &&
-                    partitions[ index_extended ] .logicals .back() .type == GParted::TYPE_UNALLOCATED )
+                    partitions[index_extended].logicals.back().type == TYPE_UNALLOCATED )
                        partitions[ index_extended ] .logicals .pop_back() ;
        
                insert_unallocated( partitions[ index_extended ] .logicals,
@@ -229,11 +229,11 @@ void OperationResizeMove::remove_adjacent_unallocated( PartitionVector & partiti
 {
        //remove unallocated space following the original partition
        if ( index_orig +1 < static_cast<int>( partitions .size() ) &&
-            partitions[ index_orig +1 ] .type == GParted::TYPE_UNALLOCATED )
+            partitions[index_orig+1].type == TYPE_UNALLOCATED )
                partitions .erase( partitions .begin() + index_orig +1 );
        
        //remove unallocated space preceding the original partition
-       if ( index_orig -1 >= 0 && partitions[ index_orig -1 ] .type == GParted::TYPE_UNALLOCATED )
+       if (index_orig-1 >= 0 && partitions[index_orig-1].type == TYPE_UNALLOCATED)
                partitions .erase( partitions .begin() + ( index_orig -1 ) ) ;
 }
 
diff --git a/src/Partition.cc b/src/Partition.cc
index bf942749..788d4eb8 100644
--- a/src/Partition.cc
+++ b/src/Partition.cc
@@ -39,7 +39,7 @@ void Partition::Reset()
        path.clear();
        messages .clear() ;
        status = GParted::STAT_REAL ;
-       type = GParted::TYPE_UNALLOCATED ;
+       type = TYPE_UNALLOCATED;
        alignment = ALIGN_STRICT ;
        filesystem = FS_UNALLOCATED;
        have_filesystem_label = false;
diff --git a/src/TreeView_Detail.cc b/src/TreeView_Detail.cc
index f5e6834b..c95d4ebc 100644
--- a/src/TreeView_Detail.cc
+++ b/src/TreeView_Detail.cc
@@ -123,7 +123,7 @@ void TreeView_Detail::load_partitions( const PartitionVector & partitions,
                row = parent_row ? *( treestore_detail ->append( parent_row .children() ) ) : *( 
treestore_detail ->append() ) ;
                create_row( row, partitions[i], show_names, show_mountpoints, show_labels );
 
-               if ( partitions[ i ] .type == GParted::TYPE_EXTENDED )
+               if (partitions[i].type == TYPE_EXTENDED)
                        load_partitions( partitions[i].logicals, show_names, show_mountpoints, show_labels, 
row );
        }
 }
@@ -174,7 +174,7 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow,
        treerow[ treeview_detail_columns .path ] = partition .get_path() ;
 
        //this fixes a weird issue (see #169683 for more info)
-       if ( partition .type == GParted::TYPE_EXTENDED && partition .busy ) 
+       if (partition.type == TYPE_EXTENDED && partition.busy)
                treerow[ treeview_detail_columns .path ] = treerow[ treeview_detail_columns .path ] + "   " ;
 
        // name


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