diff options
author | srs5694 <srs5694@users.sourceforge.net> | 2011-03-12 01:23:12 -0500 |
---|---|---|
committer | srs5694 <srs5694@users.sourceforge.net> | 2011-03-12 01:23:12 -0500 |
commit | bf8950cad0285ee6ab8a896e8d0a30c5fb62c7af (patch) | |
tree | ca6eaedd03128249d84544d6ad077f1498d66e41 /gptpart.cc | |
parent | 96312236d7f0c857efc95871a31857e24ecdc81b (diff) | |
download | sgdisk-bf8950cad0285ee6ab8a896e8d0a30c5fb62c7af.tar.gz |
Version 0.7.0
Diffstat (limited to 'gptpart.cc')
-rw-r--r-- | gptpart.cc | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -36,7 +36,7 @@ GPTPart::~GPTPart(void) { } // destructor // Return the gdisk-specific two-byte hex code for the partition -uint16_t GPTPart::GetHexType(void) { +uint16_t GPTPart::GetHexType(void) const { return partitionType.GetHexType(); } // GPTPart::GetHexType() @@ -48,7 +48,7 @@ string GPTPart::GetTypeName(void) { // Compute and return the partition's length (or 0 if the end is incorrectly // set before the beginning). -uint64_t GPTPart::GetLengthLBA(void) { +uint64_t GPTPart::GetLengthLBA(void) const { uint64_t length = 0; if (firstLBA <= lastLBA) @@ -98,10 +98,7 @@ void GPTPart::SetName(const string & theName) { if (theName == "") { // No name specified, so get one from the user cout << "Enter name: "; - if (!fgets(newName, NAME_SIZE / 2 + 1, stdin)) { - cerr << "Critical error! Failed fgets() in GPTPart::SetName()!\n"; - exit(1); - } + ReadCString(newName, NAME_SIZE / 2 + 1); // Input is likely to include a newline, so remove it.... i = strlen(newName); @@ -203,7 +200,6 @@ void GPTPart::BlankPartition(void) { int GPTPart::DoTheyOverlap(const GPTPart & other) { // Don't bother checking unless these are defined (both start and end points // are 0 for undefined partitions, so just check the start points) -// cout << "Entering GPTPart::DoTheyOverlap()\n"; return firstLBA && other.firstLBA && (firstLBA <= other.lastLBA) != (lastLBA < other.firstLBA); } // GPTPart::DoTheyOverlap() @@ -231,10 +227,7 @@ void GPTPart::ChangeType(void) { cout << "Current type is '" << GetTypeName() << "'\n"; do { cout << "Hex code or GUID (L to show codes, Enter = 0700): "; - if (!fgets(line, sizeof(line), stdin)) { - cerr << "Critical error! Failed fgets() in GPTPart::ChangeType()!\n"; - exit(1); - } // if + ReadCString(line, 255); if ((line[0] == 'L') || (line[0] == 'l')) { partitionType.ShowAllTypes(); } else { |