aboutsummaryrefslogtreecommitdiff
path: root/parttypes.cc
diff options
context:
space:
mode:
authorsrs5694 <srs5694@users.sourceforge.net>2010-10-07 13:00:45 -0400
committersrs5694 <srs5694@users.sourceforge.net>2010-10-07 13:00:45 -0400
commit0873e9d0e9345a2c4418b4718db525c9f1111c83 (patch)
tree4c6b2adf5d20e0bce392eb2cf0ebc47801d9495b /parttypes.cc
parentab4b0438394df4ae6bdea86194e254d7d35fdea0 (diff)
downloadgptfdisk-0873e9d0e9345a2c4418b4718db525c9f1111c83.tar.gz
Version 0.6.12 release; mostly changes in support for disks with other
than 512-byte sectors.
Diffstat (limited to 'parttypes.cc')
-rw-r--r--parttypes.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/parttypes.cc b/parttypes.cc
index 37f47a7..d8d8624 100644
--- a/parttypes.cc
+++ b/parttypes.cc
@@ -192,13 +192,16 @@ int PartType::AddType(uint16_t mbrType, const char * guidData, const char * name
// Assignment operator by string. If the original string is short,
// interpret it as a gdisk hex code; if it's longer, interpret it as
-// a direct entry of a GUID value....
+// a direct entry of a GUID value. If a short string isn't a hex
+// number, do nothing.
PartType & PartType::operator=(const string & orig) {
uint32_t hexCode;
if (orig.length() < 32) {
- sscanf(orig.c_str(), "%x", &hexCode);
- *this = hexCode;
+ if (IsHex(orig)) {
+ sscanf(orig.c_str(), "%x", &hexCode);
+ *this = hexCode;
+ } // if
} else {
GUIDData::operator=(orig);
} // if/else hexCode or GUID