summaryrefslogtreecommitdiff
path: root/gptpart.cc
diff options
context:
space:
mode:
authorsrs5694 <srs5694@users.sourceforge.net>2009-09-21 20:51:47 -0400
committersrs5694 <srs5694@users.sourceforge.net>2009-09-21 20:51:47 -0400
commit978041ca613dcb881763b36cf53639d924e52a56 (patch)
treebcb9e01e2c62812085a7195b0e8cc4bc20cc4c2d /gptpart.cc
parente35eb1beb6381977ff0dd8443d91f4569779cf2d (diff)
downloadsgdisk-978041ca613dcb881763b36cf53639d924e52a56.tar.gz
GPT fdisk 0.5.0
Added several features, including a restructuring of the menu system, GPT-to-MBR conversion, and the ability to re-read the MBR to generate a fresh GPT from the current on-disk MBR.
Diffstat (limited to 'gptpart.cc')
-rw-r--r--gptpart.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/gptpart.cc b/gptpart.cc
index 671e42e..671d04e 100644
--- a/gptpart.cc
+++ b/gptpart.cc
@@ -9,8 +9,8 @@
// Copyright: See COPYING file that comes with this distribution
//
//
-/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed
- under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
+// This program is copyright (c) 2009 by Roderick W. Smith. It is distributed
+// under the terms of the GNU GPL version 2, as detailed in the COPYING file.
#define __STDC_LIMIT_MACROS
#define __STDC_CONSTANT_MACROS
@@ -25,6 +25,10 @@ using namespace std;
PartTypes GPTPart::typeHelper;
GPTPart::GPTPart(void) {
+ int i;
+
+ for (i = 0; i < NAME_SIZE; i++)
+ name[i] = '\0';
} // Default constructor
GPTPart::~GPTPart(void) {
@@ -128,16 +132,16 @@ void GPTPart::ReversePartBytes(void) {
} // GPTPart::ReverseBytes()
// Display summary information; does nothing if the partition is empty.
-void GPTPart::ShowSummary(int i, uint32_t blockSize, char* sizeInSI) {
- int j;
+void GPTPart::ShowSummary(int partNum, uint32_t blockSize) {
+ char sizeInSI[255];
+ int j = 0;
if (firstLBA != 0) {
BytesToSI(blockSize * (lastLBA - firstLBA + 1), sizeInSI);
- printf("%4d %14lu %14lu", i + 1, (unsigned long) firstLBA,
+ printf("%4d %14lu %14lu", partNum + 1, (unsigned long) firstLBA,
(unsigned long) lastLBA);
printf(" %-10s %04X ", sizeInSI,
typeHelper.GUIDToID(partitionType));
- j = 0;
while ((name[j] != '\0') && (j < 44)) {
printf("%c", name[j]);
j += 2;