~ubuntu-branches/ubuntu/intrepid/gparted/intrepid

« back to all changes in this revision

Viewing changes to src/Partition.cc

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-18 09:24:46 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070518092446-qog6ipxs9ah78q0c
Tags: 0.3.3-2ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/control:
    - Maintainer: Ubuntu Core Developers
      <ubuntu-devel-discuss@lists.ubuntu.com> 
    - don't depend on menu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
void Partition::Reset()
36
36
{
37
37
        paths .clear() ;
38
 
        error .clear() ;
 
38
        messages .clear() ;
39
39
        status = GParted::STAT_REAL ;
40
40
        type = GParted::TYPE_UNALLOCATED ;
41
41
        filesystem = GParted::FS_UNALLOCATED ;
 
42
        label .clear() ;
42
43
        partition_number = sector_start = sector_end = sectors_used = sectors_unused = -1;
43
44
        color .set( "black" ) ;
44
45
        inside_extended = busy = strict = false ;
148
149
 
149
150
Sector Partition::get_length() const 
150
151
{
151
 
        return sector_end - sector_start + 1 ;
 
152
        if ( sector_start >= 0 && sector_end >= 0 )
 
153
                return sector_end - sector_start + 1 ;
 
154
        else
 
155
                return -1 ;
152
156
}
153
157
 
154
158
Glib::ustring Partition::get_path() const
166
170
 
167
171
bool Partition::operator==( const Partition & partition ) const
168
172
{
169
 
        return this ->partition_number == partition .partition_number && 
170
 
               this ->sector_start == partition .sector_start && 
171
 
               this ->type == partition .type ;
 
173
        return device_path == partition .device_path &&
 
174
               partition_number == partition .partition_number && 
 
175
               sector_start == partition .sector_start && 
 
176
               type == partition .type ;
172
177
}
173
178
 
174
179
bool Partition::operator!=( const Partition & partition ) const
207
212
        return mountpoints ;
208
213
}
209
214
 
 
215
Sector Partition::get_sector() const 
 
216
{
 
217
        return (sector_start + sector_end) / 2 ; 
 
218
}
 
219
        
 
220
bool Partition::test_overlap( const Partition & partition ) const
 
221
{
 
222
        return ( (partition .sector_start >= sector_start && partition .sector_start <= sector_end) 
 
223
                 ||
 
224
                 (partition .sector_end >= sector_start && partition .sector_end <= sector_end)
 
225
                 ||
 
226
                 (partition .sector_start < sector_start && partition .sector_end > sector_end) ) ;
 
227
}
 
228
 
210
229
void Partition::clear_mountpoints()
211
230
{
212
231
        mountpoints .clear() ;