summaryrefslogtreecommitdiff
path: root/guid.cc
diff options
context:
space:
mode:
authorsrs5694 <srs5694@users.sourceforge.net>2010-03-07 22:16:07 -0500
committersrs5694 <srs5694@users.sourceforge.net>2010-03-07 22:16:07 -0500
commit55d926192adc984462509b2966e23bc0d1129bbd (patch)
treebff8bea805e3fb0e15f7f3a0cd26a20fa12c5f29 /guid.cc
parentea17cffd083c839b7af3560d55ba697667277901 (diff)
downloadsgdisk-55d926192adc984462509b2966e23bc0d1129bbd.tar.gz
Updated project files for 0.6.5 release version.
Diffstat (limited to 'guid.cc')
-rw-r--r--guid.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/guid.cc b/guid.cc
index 9c173ff..07fd733 100644
--- a/guid.cc
+++ b/guid.cc
@@ -61,7 +61,7 @@ GUIDData & GUIDData::operator=(const string & orig) {
// Break points for segments, either with or without characters separating the segments....
size_t longSegs[6] = {0, 9, 14, 19, 24, 36};
size_t shortSegs[6] = {0, 8, 12, 16, 20, 32};
- size_t *segStart = longSegs; // Assume there are separators between segments */
+ size_t *segStart = longSegs; // Assume there are separators between segments
Zero();
@@ -150,7 +150,7 @@ GUIDData & GUIDData::GetGUIDFromUser(void) {
cout << "Enter a six-byte hexadecimal number for the fifth segment: ";
cin >> part5;
operator=(part1 += (string) "-" += part2 += (string) "-" += part3
- += (string) "-" += part4 += (string) "-" += part5);
+ += (string) "-" += part4 += (string) "-" += part5);
} // if/else
cin.ignore(255, '\n');
cout << "New GUID: " << AsString() << "\n";
@@ -217,15 +217,15 @@ string GUIDData::AsString(void) {
// Delete spaces or braces (which often enclose GUIDs) from the orig string,
// returning modified string.
-string GUIDData::DeleteSpaces(const string & orig) {
- string copy;
+string GUIDData::DeleteSpaces(string s) {
size_t position;
- copy = orig;
- for (position = copy.length(); position > 0; position--) {
- if ((copy[position - 1] == ' ') || (copy[position - 1] == '{') || (copy[position - 1] == '}')) {
- copy.erase(position - 1, 1);
- } // if
- } // for
- return copy;
+ if (s.length() > 0) {
+ for (position = s.length(); position > 0; position--) {
+ if ((s[position - 1] == ' ') || (s[position - 1] == '{') || (s[position - 1] == '}')) {
+ s.erase(position - 1, 1);
+ } // if
+ } // for
+ } // if
+ return s;
} // GUIDData::DeleteSpaces()