From 82f3f0b529ec1bb936141ae41b03f95c72ce573a Mon Sep 17 00:00:00 2001 From: srs5694 Date: Wed, 22 Sep 2010 10:50:24 -0400 Subject: Further refinements to GUID type code entry. --- sgdisk.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'sgdisk.cc') diff --git a/sgdisk.cc b/sgdisk.cc index 612c526..b829d3c 100644 --- a/sgdisk.cc +++ b/sgdisk.cc @@ -35,7 +35,6 @@ int main(int argc, char *argv[]) { int saveNonGPT = 1; uint32_t gptPartNum = 0; int alignment = DEFAULT_ALIGNMENT, retval = 0, pretend = 0; - unsigned int hexCode; uint32_t tableSize = 128; uint64_t startSector, endSector; char *attributeOperation = NULL; @@ -305,14 +304,9 @@ int main(int argc, char *argv[]) { case 't': theGPT.JustLooking(0); partNum = (int) GetInt(typeCode, 1) - 1; - cout << "Got string '" << GetString(typeCode, 2) << "'\n"; - if (GetString(typeCode, 2).length() < 10) { - sscanf(GetString(typeCode, 2).c_str(), "%x", &hexCode); - typeHelper = hexCode; - } else { - typeHelper = GetString(typeCode, 2); - } // if/else hexCode or GUID - if (theGPT.ChangePartType(partNum, typeHelper)) { + typeHelper = GetString(typeCode, 2); + if ((typeHelper != (GUIDData) "00000000-0000-0000-0000-000000000000") && + (theGPT.ChangePartType(partNum, typeHelper))) { saveData = 1; } else { cerr << "Could not change partition " << partNum + 1 -- cgit v1.2.1