diff options
author | srs5694 <srs5694@users.sourceforge.net> | 2010-02-19 17:19:55 -0500 |
---|---|---|
committer | srs5694 <srs5694@users.sourceforge.net> | 2010-02-19 17:19:55 -0500 |
commit | 08bb0da07953af605b4918e268272de15ac151aa (patch) | |
tree | 401ff14b62ddfda4c4c64b3dfcee817ad8133971 /bsd.cc | |
parent | fad064250bf6c49eb4966bf0f617591a0821808e (diff) | |
download | sgdisk-08bb0da07953af605b4918e268272de15ac151aa.tar.gz |
Version 0.6.4
Diffstat (limited to 'bsd.cc')
-rw-r--r-- | bsd.cc | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -10,7 +10,7 @@ #define __STDC_CONSTANT_MACROS #include <stdio.h> -#include <unistd.h> +//#include <unistd.h> #include <stdlib.h> #include <stdint.h> #include <fcntl.h> @@ -37,7 +37,8 @@ BSDData::BSDData(void) { } // default constructor BSDData::~BSDData(void) { - delete[] partitions; + if (partitions != NULL) + delete[] partitions; } // destructor // Read BSD disklabel data from the specified device filename. This function @@ -64,9 +65,10 @@ int BSDData::ReadBSDData(const string & device, uint64_t startSector, uint64_t e // Load the BSD disklabel data from an already-opened disk // file, starting with the specified sector number. int BSDData::ReadBSDData(DiskIO *theDisk, uint64_t startSector, uint64_t endSector) { - uint8_t buffer[4096]; // I/O buffer - int i, foundSig = 0, bigEnd = 0, allOK = 1; + int allOK = 1; + int i, foundSig = 0, bigEnd = 0; int relative = 0; // assume absolute partition sector numbering + uint8_t buffer[4096]; // I/O buffer uint32_t realSig; uint32_t* temp32; uint16_t* temp16; @@ -158,7 +160,7 @@ int BSDData::ReadBSDData(DiskIO *theDisk, uint64_t startSector, uint64_t endSect // detected above, apply a correction to all partition start sectors.... if (relative) { for (i = 0; i < numParts; i++) { - partitions[i].firstLBA += startSector; + partitions[i].firstLBA += (uint32_t) startSector; } // for } // if } // if signatures OK |