From 273fff5c84288f3c09b32521d1217619e9cc079e Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Wed, 13 Jan 2021 14:33:54 -0500 Subject: [PATCH] Adjust position of multiple-inclusion protection in .h files --- attributes.h | 6 +++--- basicmbr.h | 6 +++--- bsd.h | 6 +++--- diskio-unix.cc | 4 ++++ gpt.h | 6 +++--- gptcurses.h | 6 +++--- mbr.h | 6 +++--- parttypes.h | 6 +++--- support.h | 6 +++--- 9 files changed, 28 insertions(+), 24 deletions(-) diff --git a/attributes.h b/attributes.h index f6c66ff..6a61b8c 100644 --- a/attributes.h +++ b/attributes.h @@ -1,12 +1,12 @@ /* This program is copyright (c) 2009-2011 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ -#include -#include - #ifndef __GPT_ATTRIBUTES #define __GPT_ATTRIBUTES +#include +#include + #define NUM_ATR 64 /* # of attributes -- 64, since it's a 64-bit field */ #define ATR_NAME_SIZE 25 /* maximum size of attribute names */ diff --git a/basicmbr.h b/basicmbr.h index 504e039..f4b0e45 100644 --- a/basicmbr.h +++ b/basicmbr.h @@ -3,14 +3,14 @@ /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ +#ifndef __BASICMBRSTRUCTS +#define __BASICMBRSTRUCTS + #include #include #include "diskio.h" #include "mbrpart.h" -#ifndef __BASICMBRSTRUCTS -#define __BASICMBRSTRUCTS - #define MBR_SIGNATURE UINT16_C(0xAA55) // Maximum number of MBR partitions diff --git a/bsd.h b/bsd.h index cbd3588..c4b74a4 100644 --- a/bsd.h +++ b/bsd.h @@ -3,14 +3,14 @@ /* 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. */ +#ifndef __BSD_STRUCTS +#define __BSD_STRUCTS + #include #include #include "gptpart.h" #include "diskio.h" -#ifndef __BSD_STRUCTS -#define __BSD_STRUCTS - #define BSD_SIGNATURE UINT32_C(0x82564557) /* BSD disklabel signature ("magic") */ // BSD disklabels can start at offsets of 64 or the sector size -- at least, diff --git a/diskio-unix.cc b/diskio-unix.cc index 35a4f5e..4aefc6f 100644 --- a/diskio-unix.cc +++ b/diskio-unix.cc @@ -37,6 +37,10 @@ using namespace std; +#ifdef __APPLE__ +#define off64_t off_t +#endif + // Returns the official "real" name for a shortened version of same. // Trivial here; more important in Windows void DiskIO::MakeRealName(void) { diff --git a/gpt.h b/gpt.h index a5be961..9ba013b 100644 --- a/gpt.h +++ b/gpt.h @@ -4,6 +4,9 @@ /* This program is copyright (c) 2009-2011 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ +#ifndef __GPTSTRUCTS +#define __GPTSTRUCTS + #include #include #include "gptpart.h" @@ -12,9 +15,6 @@ #include "bsd.h" #include "gptpart.h" -#ifndef __GPTSTRUCTS -#define __GPTSTRUCTS - // Default values for sector alignment #define DEFAULT_ALIGNMENT 2048 #define MAX_ALIGNMENT 65536 diff --git a/gptcurses.h b/gptcurses.h index f153de2..a080987 100644 --- a/gptcurses.h +++ b/gptcurses.h @@ -19,14 +19,14 @@ * */ +#ifndef __GPT_CURSES +#define __GPT_CURSES + #include #include #include "gptpart.h" #include "gpt.h" -#ifndef __GPT_CURSES -#define __GPT_CURSES - using namespace std; struct MenuItem { diff --git a/mbr.h b/mbr.h index bbb84ef..21c1d7b 100644 --- a/mbr.h +++ b/mbr.h @@ -3,6 +3,9 @@ /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ +#ifndef __MBRSTRUCTS +#define __MBRSTRUCTS + #include #include #include "gptpart.h" @@ -10,9 +13,6 @@ #include "diskio.h" #include "basicmbr.h" -#ifndef __MBRSTRUCTS -#define __MBRSTRUCTS - using namespace std; /**************************************** diff --git a/parttypes.h b/parttypes.h index 2b80026..92f3d64 100644 --- a/parttypes.h +++ b/parttypes.h @@ -1,6 +1,9 @@ /* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ +#ifndef __PARTITION_TYPES +#define __PARTITION_TYPES + #include #include #ifdef USE_UTF16 @@ -12,9 +15,6 @@ #include "support.h" #include "guid.h" -#ifndef __PARTITION_TYPES -#define __PARTITION_TYPES - using namespace std; // A partition type diff --git a/support.h b/support.h index 25e660a..d87fe9a 100644 --- a/support.h +++ b/support.h @@ -1,13 +1,13 @@ /* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ +#ifndef __GPTSUPPORT +#define __GPTSUPPORT + #include #include #include -#ifndef __GPTSUPPORT -#define __GPTSUPPORT - #define GPTFDISK_VERSION "1.0.6" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)