diff options
author | srs5694 <srs5694@users.sourceforge.net> | 2011-03-15 00:34:10 -0400 |
---|---|---|
committer | srs5694 <srs5694@users.sourceforge.net> | 2011-03-15 00:34:10 -0400 |
commit | 9a46b042c57144c26a67781d335e6ba4128382d2 (patch) | |
tree | a7126d54e9cd8387251787c7f1da6cfb7b44b8f2 /gptpart.cc | |
parent | d3ba7a61f68ca97fc3828f0c2edd7cda7ca3dfda (diff) | |
download | sgdisk-9a46b042c57144c26a67781d335e6ba4128382d2.tar.gz |
Patches supplied by Florian Zumbiehl
Diffstat (limited to 'gptpart.cc')
-rw-r--r-- | gptpart.cc | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -131,6 +131,19 @@ GPTPart & GPTPart::operator=(const GPTPart & orig) { return *this; } // assignment operator +// Compare the values, and return a bool result. +// Because this is intended for sorting and a firstLBA value of 0 denotes +// a partition that's not in use and so that should be sorted upwards, +// we return the opposite of the usual arithmetic result when either +// firstLBA value is 0. +bool GPTPart::operator<(const GPTPart &other) const { + + if (firstLBA && other.firstLBA) + return (firstLBA < other.firstLBA); + else + return (other.firstLBA < firstLBA); +} // GPTPart::operator<() + // Display summary information; does nothing if the partition is empty. void GPTPart::ShowSummary(int partNum, uint32_t blockSize) { string sizeInSI; @@ -227,7 +240,7 @@ void GPTPart::ChangeType(void) { cout << "Current type is '" << GetTypeName() << "'\n"; do { cout << "Hex code or GUID (L to show codes, Enter = 0700): "; - ReadCString(line, 255); + ReadCString(line, sizeof(line)); if ((line[0] == 'L') || (line[0] == 'l')) { partitionType.ShowAllTypes(); } else { |