summaryrefslogtreecommitdiff
path: root/basicmbr.cc
diff options
context:
space:
mode:
authorRod Smith <rodsmith@rodsbooks.com>2021-03-17 21:57:12 -0400
committerRod Smith <rodsmith@rodsbooks.com>2021-03-17 21:59:18 -0400
commiteae9f7e2e1470ed2d5bc029180aa2adc88fbc4a7 (patch)
treedd82bf5ca410609032f73fe888a56d9f29ee3c93 /basicmbr.cc
parent80e66b25922ab78cf987f693bf5477e466b1443a (diff)
downloadsgdisk-eae9f7e2e1470ed2d5bc029180aa2adc88fbc4a7.tar.gz
Code cleanup based on 'infer' suggestions; mostly just dead stores.
One forgotten change
Diffstat (limited to 'basicmbr.cc')
-rw-r--r--basicmbr.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/basicmbr.cc b/basicmbr.cc
index c266e39..e09b0e9 100644
--- a/basicmbr.cc
+++ b/basicmbr.cc
@@ -140,7 +140,7 @@ BasicMBRData & BasicMBRData::operator=(const BasicMBRData & orig) {
// Read data from MBR. Returns 1 if read was successful (even if the
// data isn't a valid MBR), 0 if the read failed.
int BasicMBRData::ReadMBRData(const string & deviceFilename) {
- int allOK = 1;
+ int allOK;
if (myDisk == NULL) {
myDisk = new DiskIO;
@@ -355,7 +355,7 @@ int BasicMBRData::ReadLogicalParts(uint64_t extendedStart, int partNum) {
// MBR itself and any defined logical partitions, provided there's an
// MBR extended partition.
int BasicMBRData::WriteMBRData(void) {
- int allOK = 1;
+ int allOK;
if (myDisk != NULL) {
if (myDisk->OpenForWrite() != 0) {
@@ -372,7 +372,7 @@ int BasicMBRData::WriteMBRData(void) {
// Save the MBR data to a file. This writes both the
// MBR itself and any defined logical partitions.
int BasicMBRData::WriteMBRData(DiskIO *theDisk) {
- int i, j, partNum, next, allOK = 1, moreLogicals = 0;
+ int i, j, partNum, next, allOK, moreLogicals = 0;
uint64_t extFirstLBA = 0;
uint64_t writeEbrTo; // 64-bit because we support extended in 2-4TiB range
TempMBR tempMBR;
@@ -948,7 +948,7 @@ int BasicMBRData::SpaceBeforeAllLogicals(void) {
// primary status. Also does NOT consider partition order; there
// can be gaps and it will still be considered legal.
int BasicMBRData::IsLegal(void) {
- int allOK = 1;
+ int allOK;
allOK = (FindOverlaps() == 0);
allOK = (allOK && (NumPrimaries() <= 4));
@@ -1055,7 +1055,7 @@ void BasicMBRData::MakePart(int num, uint64_t start, uint64_t length, int type,
// Set the partition's type code.
// Returns 1 if successful, 0 if not (invalid partition number)
int BasicMBRData::SetPartType(int num, int type) {
- int allOK = 1;
+ int allOK;
if ((num >= 0) && (num < MAX_MBR_PARTS)) {
if (partitions[num].GetLengthLBA() != UINT32_C(0)) {
@@ -1308,7 +1308,7 @@ void BasicMBRData::MakeItLegal(void) {
// entries (primary space).
// Returns the number of partitions moved.
int BasicMBRData::RemoveLogicalsFromFirstFour(void) {
- int i, j = 4, numMoved = 0, swapped = 0;
+ int i, j, numMoved = 0, swapped = 0;
MBRPart temp;
for (i = 0; i < 4; i++) {