summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRod Smith <rodsmith@rodsbooks.com>2022-04-10 09:28:08 -0400
committerRod Smith <rodsmith@rodsbooks.com>2022-04-10 09:28:08 -0400
commitedc67b66dbd09bf9a905bb5f1eddd1c19c2df294 (patch)
tree0676771891810a7e386d48e62b81470f80fe1c80
parentfd60f743628e16180daf3b1719974fa4dadf8f90 (diff)
downloadsgdisk-edc67b66dbd09bf9a905bb5f1eddd1c19c2df294.tar.gz
Patch set from Bin Meng to clean up some code & support building sgdisk for Windows
-rw-r--r--Makefile17
-rw-r--r--Makefile.freebsd22
-rw-r--r--Makefile.mac22
-rw-r--r--Makefile.mingw29
-rw-r--r--Makefile.mingw6428
-rw-r--r--README.Windows135
-rw-r--r--attributes.h10
-rw-r--r--basicmbr.h12
-rw-r--r--bsd.h5
-rw-r--r--crc32.cc2
-rw-r--r--diskio.h16
-rw-r--r--gdisk.cc2
-rw-r--r--gpt.h20
-rw-r--r--gptcl.cc4
-rw-r--r--gptcl.h10
-rw-r--r--gptcurses.cc4
-rw-r--r--gptcurses.h10
-rw-r--r--gptpart.cc11
-rw-r--r--gptpart.h6
-rw-r--r--gpttext.h12
-rw-r--r--guid.h12
-rw-r--r--mbr.h4
-rw-r--r--mbrpart.h2
-rw-r--r--parttypes.h16
-rw-r--r--support.h18
25 files changed, 225 insertions, 204 deletions
diff --git a/Makefile b/Makefile
index 0d7309c..7ecab54 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-CFLAGS+=-D_FILE_OFFSET_BITS=64
-#CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16
-CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64
+#CXXFLAGS+=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16
+CXXFLAGS+=-O2 -Wall -D_FILE_OFFSET_BITS=64
LDFLAGS+=
+LDLIBS+=-luuid #-licuio -licuuc
LIB_NAMES=crc32 support guid gptpart mbrpart basicmbr mbr gpt bsd parttypes attributes diskio diskio-unix
MBR_LIBS=support diskio diskio-unix basicmbr mbrpart
LIB_OBJS=$(LIB_NAMES:=.o)
@@ -12,19 +12,16 @@ DEPEND= makedepend $(CXXFLAGS)
all: cgdisk gdisk sgdisk fixparts
gdisk: $(LIB_OBJS) gdisk.o gpttext.o
- $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) -luuid $(LDLIBS) -o gdisk
-# $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) -licuio -licuuc -luuid -o gdisk
+ $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) $(LDLIBS) -o gdisk
cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
- $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -luuid -lncursesw $(LDLIBS) -o cgdisk
-# $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licuio -licuuc -luuid -lncurses -o cgdisk
+ $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) $(LDLIBS) -lncursesw -o cgdisk
sgdisk: $(LIB_OBJS) sgdisk.o gptcl.o
- $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) -luuid -lpopt $(LDLIBS) -o sgdisk
-# $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) -licuio -licuuc -luuid -lpopt -o sgdisk
+ $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) $(LDLIBS) -lpopt -o sgdisk
fixparts: $(MBR_LIB_OBJS) fixparts.o
- $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) $(LDLIBS) -o fixparts
+ $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts
test:
./gdisk_test.sh
diff --git a/Makefile.freebsd b/Makefile.freebsd
index 4b4b616..7223f2d 100644
--- a/Makefile.freebsd
+++ b/Makefile.freebsd
@@ -1,9 +1,8 @@
-CC=clang
CXX=clang++
-CFLAGS+=-D_FILE_OFFSET_BITS=64
-#CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/usr/local/include
-CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64 -I /usr/local/include
-LDFLAGS+=
+#CXXFLAGS+=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/usr/local/include
+CXXFLAGS+=-O2 -Wall -D_FILE_OFFSET_BITS=64 -I /usr/local/include
+LDFLAGS+=-L/usr/local/lib
+LDLIBS+=-luuid #-licuio
LIB_NAMES=crc32 support guid gptpart mbrpart basicmbr mbr gpt bsd parttypes attributes diskio diskio-unix
MBR_LIBS=support diskio diskio-unix basicmbr mbrpart
LIB_OBJS=$(LIB_NAMES:=.o)
@@ -14,25 +13,22 @@ DEPEND= makedepend $(CXXFLAGS)
all: gdisk cgdisk sgdisk fixparts
gdisk: $(LIB_OBJS) gdisk.o gpttext.o
-# $(CXX) $(LIB_OBJS) gdisk.o gpttext.o -L/usr/local/lib $(LDFLAGS) -licuio -luuid -o gdisk
- $(CXX) $(LIB_OBJS) gdisk.o gpttext.o -L/usr/local/lib $(LDFLAGS) -luuid -o gdisk
+ $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) $(LDLIBS) -o gdisk
cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
-# $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o -L/usr/local/lib $(LDFLAGS) -licuio -luuid -lncurses -o cgdisk
- $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o -L/usr/local/lib $(LDFLAGS) -luuid -lncurses -o cgdisk
+ $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) $(LDLIBS) -lncurses -o cgdisk
sgdisk: $(LIB_OBJS) sgdisk.o gptcl.o
-# $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o -L/usr/local/lib $(LDFLAGS) -luuid -licuio -lpopt -o sgdisk
- $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o -L/usr/local/lib $(LDFLAGS) -luuid -lpopt -o sgdisk
+ $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) $(LDLIBS) -lpopt -o sgdisk
fixparts: $(MBR_LIB_OBJS) fixparts.o
- $(CXX) $(MBR_LIB_OBJS) fixparts.o -L/usr/local/lib $(LDFLAGS) -o fixparts
+ $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts
lint: #no pre-reqs
lint $(SRCS)
clean: #no pre-reqs
- rm -f core *.o *~ gdisk sgdisk
+ rm -f core *.o *~ gdisk cgdisk sgdisk fixparts
# what are the source dependencies
depend: $(SRCS)
diff --git a/Makefile.mac b/Makefile.mac
index ea21fa6..91a281c 100644
--- a/Makefile.mac
+++ b/Makefile.mac
@@ -1,11 +1,11 @@
-CC=gcc
CXX=c++
# FATBINFLAGS=-arch x86_64 -arch i386 -mmacosx-version-min=10.9
FATBINFLAGS=-arch x86_64 -arch arm64 -mmacosx-version-min=10.9
THINBINFLAGS=-arch x86_64 -mmacosx-version-min=10.9
-CFLAGS=$(FATBINFLAGS) -O2 -D_FILE_OFFSET_BITS=64 -g
-#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/opt/local/include -I/usr/local/include -I/opt/local/include -g
-CXXFLAGS=$(FATBINFLAGS) -O2 -Wall -D_FILE_OFFSET_BITS=64 -stdlib=libc++ -I/opt/local/include -I /usr/local/include -I/opt/local/include -g
+#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/opt/local/include -I/usr/local/include -I/opt/local/include
+CXXFLAGS=$(FATBINFLAGS) -O2 -Wall -D_FILE_OFFSET_BITS=64 -stdlib=libc++ -I/opt/local/include -I /usr/local/include -I/opt/local/include
+LDFLAGS+=
+LDLIBS+= #-licucore
LIB_NAMES=crc32 support guid gptpart mbrpart basicmbr mbr gpt bsd parttypes attributes diskio diskio-unix
MBR_LIBS=support diskio diskio-unix basicmbr mbrpart
#LIB_SRCS=$(NAMES:=.cc)
@@ -17,25 +17,17 @@ DEPEND= makedepend $(CFLAGS)
all: gdisk sgdisk cgdisk fixparts
gdisk: $(LIB_OBJS) gpttext.o gdisk.o
- $(CXX) $(LIB_OBJS) gpttext.o gdisk.o $(FATBINFLAGS) -o gdisk
-# $(CXX) $(LIB_OBJS) -L/usr/lib -licucore gpttext.o gdisk.o -o gdisk
+ $(CXX) $(LIB_OBJS) gpttext.o gdisk.o $(FATBINFLAGS) $(LDFLAGS) $(LDLIBS) -o gdisk
cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
- $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o /usr/local/Cellar/ncurses/6.2/lib/libncurses.dylib $(LDFLAGS) -o cgdisk
-# $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o /usr/lib/libncurses.dylib $(LDFLAGS) -o cgdisk
-# $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licucore -lncurses -o cgdisk
+ $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) $(LDLIBS) /usr/local/Cellar/ncurses/6.2/lib/libncurses.dylib -o cgdisk
sgdisk: $(LIB_OBJS) gptcl.o sgdisk.o
-# $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o /opt/local/lib/libiconv.a /opt/local/lib/libintl.a /opt/local/lib/libpopt.a $(FATBINFLAGS) -o sgdisk
- $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/usr/local/lib -lpopt $(THINBINFLAGS) -o sgdisk
-# $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/sw/lib -licucore -lpopt -o sgdisk
+ $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o $(LDFLAGS) -L/usr/local/lib $(LDLIBS) -lpopt $(THINBINFLAGS) -o sgdisk
fixparts: $(MBR_LIB_OBJS) fixparts.o
$(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) $(FATBINFLAGS) -o fixparts
-testguid: $(LIB_OBJS) testguid.o
- $(CXX) $(LIB_OBJS) testguid.o -o testguid
-
lint: #no pre-reqs
lint $(SRCS)
diff --git a/Makefile.mingw b/Makefile.mingw
index acfff64..2ed228a 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -1,9 +1,9 @@
-CC=/usr/bin/i686-w64-mingw32-gcc
-CXX=/usr/bin/i686-w64-mingw32-g++
-STRIP=/usr/bin/i686-w64-mingw32-strip
-CFLAGS=-O2 -Wall -static -static-libgcc -static-libstdc++ -D_FILE_OFFSET_BITS=64 -g
-CXXFLAGS=-O2 -Wall -static -static-libgcc -static-libstdc++ -D_FILE_OFFSET_BITS=64 -g
-#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -I /usr/local/include -I/opt/local/include -g
+CXX=i686-w64-mingw32-g++
+STRIP=i686-w64-mingw32-strip
+CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -static -static-libgcc -static-libstdc++
+#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -I /usr/local/include -I/opt/local/include
+LDFLAGS+=-static -static-libgcc -static-libstdc++
+LDLIBS+=-lrpcrt4
LIB_NAMES=guid gptpart bsd parttypes attributes crc32 mbrpart basicmbr mbr gpt support diskio diskio-windows
MBR_LIBS=support diskio diskio-windows basicmbr mbrpart
LIB_SRCS=$(NAMES:=.cc)
@@ -12,25 +12,28 @@ MBR_LIB_OBJS=$(MBR_LIBS:=.o)
LIB_HEADERS=$(LIB_NAMES:=.h)
DEPEND= makedepend $(CFLAGS)
-all: gdisk fixparts
+all: gdisk sgdisk fixparts
gdisk: $(LIB_OBJS) gdisk.o gpttext.o
- $(CXX) $(CXXFLAGS) $(LIB_OBJS) gdisk.o gpttext.o -lrpcrt4 -static-libgcc -o gdisk32.exe
+ $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) $(LDLIBS) -o gdisk32.exe
-sgdisk: $(LIB_OBJS) sgdisk.o
- $(CXX) $(CXXFLAGS) $(LIB_OBJS) sgdisk.o -lpopt -static-libgcc -o sgdisk32.exe
+cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
+ $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) $(LDLIBS) -lncursesw -o cgdisk32.exe
+
+sgdisk: $(LIB_OBJS) sgdisk.o gptcl.o
+ $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) $(LDLIBS) -lpopt -lintl -liconv -o sgdisk32.exe
fixparts: $(MBR_LIB_OBJS) fixparts.o
- $(CXX) $(CXXFLAGS) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -static-libgcc -o fixparts32.exe
+ $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts32.exe
lint: #no pre-reqs
lint $(SRCS)
clean: #no pre-reqs
- rm -f core *.o *~ gdisk.exe sgdisk.exe
+ rm -f core *.o *~ gdisk32.exe cgdisk32.exe sgdisk32.exe fixparts32.exe
strip: #no pre-reqs
- $(STRIP) gdisk32.exe fixparts32.exe
+ $(STRIP) gdisk32.exe cgdisk32.exe sgdisk32.exe fixparts32.exe
# what are the source dependencies
depend: $(SRCS)
diff --git a/Makefile.mingw64 b/Makefile.mingw64
index 7e4b32b..3070a42 100644
--- a/Makefile.mingw64
+++ b/Makefile.mingw64
@@ -1,9 +1,9 @@
-CC=/usr/bin/x86_64-w64-mingw32-gcc
-CXX=/usr/bin/x86_64-w64-mingw32-g++
-STRIP=/usr/bin/x86_64-w64-mingw32-strip
-CFLAGS=-O2 -Wall -static -static-libgcc -static-libstdc++ -D_FILE_OFFSET_BITS=64 -g
-CXXFLAGS=-O2 -Wall -static -static-libgcc -static-libstdc++ -D_FILE_OFFSET_BITS=64 -g
+CXX=x86_64-w64-mingw32-g++
+STRIP=x86_64-w64-mingw32-strip
+CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -g
#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -I /usr/local/include -I/opt/local/include -g
+LDFLAGS+=-static -static-libgcc -static-libstdc++
+LDLIBS+=-lrpcrt4
LIB_NAMES=guid gptpart bsd parttypes attributes crc32 mbrpart basicmbr mbr gpt support diskio diskio-windows
MBR_LIBS=support diskio diskio-windows basicmbr mbrpart
LIB_SRCS=$(NAMES:=.cc)
@@ -12,25 +12,29 @@ MBR_LIB_OBJS=$(MBR_LIBS:=.o)
LIB_HEADERS=$(LIB_NAMES:=.h)
DEPEND= makedepend $(CFLAGS)
-all: gdisk fixparts
+# Note: cgdisk is buildable in Windows, but not in Ubuntu 20.04 or 22.04
+all: gdisk sgdisk fixparts
gdisk: $(LIB_OBJS) gdisk.o gpttext.o
- $(CXX) $(CXXFLAGS) $(LIB_OBJS) gdisk.o gpttext.o -lrpcrt4 -static-libgcc -o gdisk64.exe
+ $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) $(LDLIBS) -o gdisk64.exe
-sgdisk: $(LIB_OBJS) sgdisk.o
- $(CXX) $(CXXFLAGS) $(LIB_OBJS) sgdisk.o -lpopt -static-libgcc -o sgdisk64.exe
+cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
+ $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) $(LDLIBS) -lncursesw -o cgdisk64.exe
+
+sgdisk: $(LIB_OBJS) sgdisk.o gptcl.o
+ $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) $(LDLIBS) -lpopt -lintl -liconv -o sgdisk64.exe
fixparts: $(MBR_LIB_OBJS) fixparts.o
- $(CXX) $(CXXFLAGS) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -static-libgcc -o fixparts64.exe
+ $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts64.exe
lint: #no pre-reqs
lint $(SRCS)
clean: #no pre-reqs
- rm -f core *.o *~ gdisk64.exe sgdisk64.exe
+ rm -f core *.o *~ gdisk64.exe cgdisk64.exe sgdisk64.exe fixparts64.exe
strip: #no pre-reqs
- $(STRIP) gdisk64.exe fixparts64.exe
+ $(STRIP) gdisk64.exe cgdisk64.exe sgdisk64.exe fixparts64.exe
# what are the source dependencies
depend: $(SRCS)
diff --git a/README.Windows b/README.Windows
index 3f49023..275b56d 100644
--- a/README.Windows
+++ b/README.Windows
@@ -28,12 +28,8 @@ Windows Use Notes
The Windows version of GPT fdisk was added with version 0.6.2 of the
package. The Windows binary package includes the gdisk.exe interactive
-text-mode program file but no equivalent to the sgdisk program that's
-available with Linux, FreeBSD, and OS X builds. In theory, an sgdisk.exe
-for Windows could be built if the popt library were installed. I've not
-attempted to do this myself, though. If you care to try, check
-http://gnuwin32.sourceforge.net/packages/popt.htm for information on popt
-for Windows.
+text-mode program file as well as the sgdisk program that's available
+with Linux, FreeBSD, and OS X builds.
Beginning with version 0.8.10, I'm distributing both 32-bit and 64-bit
binaries, which include the strings "32" or "64" in their names. The 32-bit
@@ -47,10 +43,11 @@ certain partition table problems that can be created by buggy partitioning
software. Windows seems to be unfazed by most such problems, but I've not
done an extensive survey of Windows partitioning tools on this score.
-To install the programs, copy the gdisk32.exe and fixparts32.exe (or
-gdisk64.exe and fixparts64.exe) program files to any directory on your
-path, such as C:\Windows. Alternatively, you can change to the program's
-directory or type its complete path whenever you use it.
+To install the programs, copy the gdisk32.exe, cgdisk32.exe, sgdisk32.exe
+and fixparts32.exe (or gdisk64.exe, cgdisk64.exe, sgdisk64.exe and
+fixparts64.exe) program files to any directory on your path, such as
+C:\Windows. Alternatively, you can change to the program's directory or type
+its complete path whenever you use it.
To use the programs, first launch a Command Prompt as the Administrator. To
do this, locate the Command Prompt program icon, right-click it, and select
@@ -74,17 +71,18 @@ This command is equivalent to the earlier one -- it edits the partition
table on the first physical disk. Change the number at the end of the
device name to change the disk edited.
-If you pass the "-l" option to gdisk.exe in addition to the disk
-identifier, the program displays the current partition table information
-and then exits. This use entails no risk to MBR disks, since the program
-never writes data back to the disk when used in this way.
+If you pass the "-l" option to gdisk64.exe in addition to the disk
+identifier, the program displays the current partition table information and
+then exits. (Alternatively, you can pass "-p" to sgdisk64.exe.) This use
+entails no risk to MBR disks, since the program never writes data back to
+the disk when used in this way.
-As noted above, editing the first disk with GPT fdisk is usually a Bad
-Idea. An exception would be if your system uses an Extensible Firmware
-Interface (EFI) and already boots from a GPT disk. It's safer to edit
-non-boot disks, which usually have numbers of 1 and above, but only if you
-run a version of Windows with GPT support. For more information on Windows'
-support of GPT, see Microsoft's Web page on the topic:
+As noted above, editing the first disk with GPT fdisk is a Bad Idea on older
+BIOS-based computers. Newer computers typically use an Extensible Firmware
+Interface (EFI) and boot from GPT disks. It's safer to edit non-boot disks,
+which usually have numbers of 1 and above, but only if you run a version of
+Windows with GPT support. For more information on Windows' support of GPT,
+see Microsoft's Web page on the topic:
http://www.microsoft.com/whdc/device/storage/GPT_FAQ.mspx
@@ -103,34 +101,91 @@ Source Code and Compilation Issues
I have successfully compiled GPT fdisk using three different Windows
compilers:
-- MinGW (http://www.mingw.org), and in particular its Linux-hosted
- cross-compiler -- Under Ubuntu Linux, the Makefile.mingw and
- Makefile.mingw64 files enable compilation of the software via MinGW.
- (Type "make -f Makefile.mingw" to compile 32-bit binaries, and "make -f
- Makefile.mingw64" to compile 64-bit binaries.) If you try to compile
- using another compiler or even using MinGW under Windows or another Linux
- variety, you may need to adjust the Makefile.mingw options.
+- MinGW (https://www.mingw-w64.org/), using either a Linux-hosted
+ cross-compiler or under Windows using the original MinGW or MSYS2
+ (https://www.msys2.org). This is my only GPT fdisk development environment
+ for Windows in 2022.
- Microsoft Visual C++ 2008 Express
(http://www.microsoft.com/express/Windows/) -- This compiler requires a
third-party stdint.h file (I used the one from
- http://msinttypes.googlecode.com/svn/trunk/stdint.h), but it otherwise
- works fine. A project is easily created by adding all the *.h files and
- all the *.cc files except diskio-unix.cc, sgdisk.cc, and whichever
- program file you intend to NOT build (gdisk.cc or fixparts.cc).
+ http://web.archive.org/web/20130317001712/http://msinttypes.googlecode.com/svn/trunk/stdint.h),
+ but it otherwise worked fine the last time I tried it. A project is easily
+ created by adding all the *.h files and all the *.cc files except
+ diskio-unix.cc, sgdisk.cc, and whichever program file you intend to NOT
+ build (gdisk.cc or fixparts.cc).
- Microsoft Visual C++ 2010 Express -- This compiler works much like the
2008 version, although I didn't need to add a third-party stdint.h file.
-The MinGW compiler produces much larger executables than do the MS
-compilers. The resulting binaries seem to work equally well, but my testing
-has been minimal.
-
-I've also attempted to compile the code with OpenWatcom 1.8, but this
-attempt failed, mostly because the compiler can't yet handle iostream
-output on standard C++ strings. OpenWatcom also seems to have incorrectly
-set the value of UINT32_MAX as if uint32_t values were 64-bit integers.
-This alone won't cause the compile to fail, but it would create bugs.
+Although I used Microsoft Visual C++ in the past, I haven't tried using
+these compilers recently and so I can't promise they would work today (in
+2022).
If you modify GPT fdisk to get it to compile under another compiler, I
welcome submission of patches.
+
+The following instructions focus on use of MinGW to compile GPT fdisk for
+Windows.
+
+My primary development environment is Ubuntu Linux, using the MinGW
+cross-compiler. This system can compile the gdisk and fixparts binaries with
+no need for additional libraries; after installing MinGW (via the
+g++-mingw-w64 package in Ubuntu, or the equivalent in another distribution),
+you can type "make -f Makefile.mingw" to compile 32-bit binaries, and "make
+-f Makefile.mingw64" to compile 64-bit binaries.
+
+If you use Windows, your best bet is likely to be to install the MSYS2
+package (https://www.msys2.org). This package provides MinGW and a package
+management system based on pacman (used by Arch Linux) for installing
+additional libraries. To install the libraries needed to compile sgdisk and
+cgdisk, type "pacman -S mingw-w64-x86_64-popt mingw-w64-x86_64-gettext
+mingw-w64-x86_64-ncurses" if you want to compile 64-bit binaries; change
+'x86_64' to 'i686' for 32-bit packages. This command will install the popt
+library needed by sgdisk and the ncurses library needed by cgdisk, along
+with gettext, which is needed by popt. With these libraries installed, you
+should be able to compile all four Linux programs -- gdisk, cgdisk, sgdisk,
+and fixparts.
+
+If you want to compile sgdisk for Windows under Linux, you can do so;
+however, you must copy the relevant header and library files from a Windows
+installation to Linux. Specifically, you must copy:
+
+ Windows File Linux Directory
+ ------------ ---------------
+ /mingw64/include/popt.h /usr/x86_64-w64-mingw32/include/
+ /mingw64/lib/libpopt.a /usr/x86_64-w64-mingw32/lib/
+ /mingw64/lib/libintl.a /usr/x86_64-w64-mingw32/lib/
+ /mingw64/lib/libiconv.a /usr/x86_64-w64-mingw32/lib/
+
+For 32-bit binaries, change /mingw64 to /mingw32 on the Windows source and
+x86_64-w64-mingw32 to i686-w64-mingw32 on the Linux destination.
+
+In theory, you should be able to do something similar to compile cgdisk. The
+relevant files are:
+
+ Windows File Linux Directory
+ ------------ ---------------
+ /mingw64/include/ncursesw/curses.h /usr/x86_64-w64-mingw32/include/ncursesw/
+ /mingw64/include/ncursesw/ncurses.h /usr/x86_64-w64-mingw32/include/ncursesw/
+ /mingw64/include/ncursesw/ncurses_dll.h /usr/x86_64-w64-mingw32/include/ncursesw/
+ /mingw64/include/ncursesw/unctrl.h /usr/x86_64-w64-mingw32/include/ncursesw/
+ /mingw64/lib/libncurses.a /usr/x86_64-w64-mingw32/lib/
+
+In practice, this has not worked for me; the compilation fails with a
+complaint about an undefined reference to 'nanosleep'. My guess is that the
+ncurses version installed in Windows is too new to work with the MinGW
+libraries in Ubuntu (20.04 or 22.04). It's conceivable it would work with
+another distribution, though.
+
+In any event, the Makefile.mingw and Makefile.mingw64 files contain targets
+for all four programs; however, because of the problem building cgdisk in
+Linux, that program is omitted from the "all" target. It can still be built
+explicitly, though, as in:
+
+make -f Makefile.mingw64 cgdisk
+
+The Makefiles are configured to create statically-linked binaries so as to
+simplify installation of the binaries. If you want smaller binaries, you can
+remove the various static options from the relevant Makefile. You can also
+strip the binaries ("make -f Makefile.mingw64 strip") to remove unused code.
diff --git a/attributes.h b/attributes.h
index 6a61b8c..5eb57e3 100644
--- a/attributes.h
+++ b/attributes.h
@@ -10,11 +10,9 @@
#define NUM_ATR 64 /* # of attributes -- 64, since it's a 64-bit field */
#define ATR_NAME_SIZE 25 /* maximum size of attribute names */
-using namespace std;
-
class Attributes {
protected:
- static string atNames[NUM_ATR];
+ static std::string atNames[NUM_ATR];
static int numAttrs;
void Setup(void);
uint64_t attributes;
@@ -30,12 +28,12 @@ public:
void ShowAttributes(const uint32_t partNum);
void ChangeAttributes(void);
- bool OperateOnAttributes(const uint32_t partNum, const string& attributeOperator, const string& attributeBits);
+ bool OperateOnAttributes(const uint32_t partNum, const std::string& attributeOperator, const std::string& attributeBits);
- static const string& GetAttributeName(const uint32_t bitNum) {return atNames [bitNum];}
+ static const std::string& GetAttributeName(const uint32_t bitNum) {return atNames [bitNum];}
static void ListAttributes(void);
}; // class Attributes
-ostream & operator<<(ostream & os, const Attributes & data);
+std::ostream & operator<<(std::ostream & os, const Attributes & data);
#endif
diff --git a/basicmbr.h b/basicmbr.h
index f4b0e45..696f826 100644
--- a/basicmbr.h
+++ b/basicmbr.h
@@ -16,8 +16,6 @@
// Maximum number of MBR partitions
#define MAX_MBR_PARTS 128
-using namespace std;
-
/****************************************
* *
* MBRData class and related structures *
@@ -57,23 +55,23 @@ protected:
uint32_t numSecspTrack; // number of sectors per track, in CHS scheme
DiskIO* myDisk;
int canDeleteMyDisk;
- string device;
+ std::string device;
MBRValidity state;
MBRPart* GetPartition(int i); // Return primary or logical partition
public:
BasicMBRData(void);
- BasicMBRData(string deviceFilename);
+ BasicMBRData(std::string deviceFilename);
BasicMBRData(const BasicMBRData &);
~BasicMBRData(void);
BasicMBRData & operator=(const BasicMBRData & orig);
// File I/O functions...
- int ReadMBRData(const string & deviceFilename);
+ int ReadMBRData(const std::string & deviceFilename);
int ReadMBRData(DiskIO * theDisk, int checkBlockSize = 1);
int ReadLogicalParts(uint64_t extendedStart, int partNum);
int WriteMBRData(void);
int WriteMBRData(DiskIO *theDisk);
- int WriteMBRData(const string & deviceFilename);
+ int WriteMBRData(const std::string & deviceFilename);
int WriteMBRData(struct TempMBR & mbr, DiskIO *theDisk, uint64_t sector);
void DiskSync(void) {myDisk->DiskSync();}
void SetDisk(DiskIO *theDisk);
@@ -147,7 +145,7 @@ public:
uint64_t GetLength(int i);
// User interaction functions....
- int DoMenu(const string& prompt = "\nMBR command (? for help): ");
+ int DoMenu(const std::string& prompt = "\nMBR command (? for help): ");
void ShowCommands(void);
}; // class BasicMBRData
diff --git a/bsd.h b/bsd.h
index c4b74a4..e042b7b 100644
--- a/bsd.h
+++ b/bsd.h
@@ -30,9 +30,6 @@
// memory errors will occur.
#define MAX_BSD_PARTS 64
-
-using namespace std;
-
/****************************************
* *
* BSDData class and related structures *
@@ -75,7 +72,7 @@ class BSDData {
public:
BSDData(void);
~BSDData(void);
- int ReadBSDData(const string & deviceFilename, uint64_t startSector, uint64_t endSector);
+ int ReadBSDData(const std::string & deviceFilename, uint64_t startSector, uint64_t endSector);
int ReadBSDData(DiskIO *myDisk, uint64_t startSector, uint64_t endSector);
void ReverseMetaBytes(void);
void DisplayBSDData(void);
diff --git a/crc32.cc b/crc32.cc
index d253dd9..5eca100 100644
--- a/crc32.cc
+++ b/crc32.cc
@@ -31,7 +31,7 @@ uint32_t crc_tab[256];
*/
uint32_t chksum_crc32 (unsigned char *block, unsigned int length)
{
- register unsigned long crc;
+ unsigned long crc;
unsigned long i;
crc = 0xFFFFFFFF;
diff --git a/diskio.h b/diskio.h
index 0bdaba4..b5c2ecc 100644
--- a/diskio.h
+++ b/diskio.h
@@ -37,8 +37,6 @@
#include "support.h"
//#include "parttypes.h"
-using namespace std;
-
/***************************************
* *
* DiskIO class and related structures *
@@ -47,9 +45,9 @@ using namespace std;
class DiskIO {
protected:
- string userFilename;
- string realFilename;
- string modelName;
+ std::string userFilename;
+ std::string realFilename;
+ std::string modelName;
int isOpen;
int openForWrite;
#ifdef _WIN32
@@ -62,9 +60,9 @@ class DiskIO {
~DiskIO(void);
void MakeRealName(void);
- int OpenForRead(const string & filename);
+ int OpenForRead(const std::string & filename);
int OpenForRead(void);
- int OpenForWrite(const string & filename);
+ int OpenForWrite(const std::string & filename);
int OpenForWrite(void);
void Close();
int Seek(uint64_t sector);
@@ -73,12 +71,12 @@ class DiskIO {
int DiskSync(void); // resync disk caches to use new partitions
int GetBlockSize(void);
int GetPhysBlockSize(void);
- string GetModel(void) {return modelName;}
+ std::string GetModel(void) {return modelName;}
uint32_t GetNumHeads(void);
uint32_t GetNumSecsPerTrack(void);
int IsOpen(void) {return isOpen;}
int IsOpenForWrite(void) {return openForWrite;}
- string GetName(void) const {return realFilename;}
+ std::string GetName(void) const {return realFilename;}
uint64_t DiskSize(int* err);
}; // class DiskIO
diff --git a/gdisk.cc b/gdisk.cc
index 5f85498..c9443bd 100644
--- a/gdisk.cc
+++ b/gdisk.cc
@@ -11,6 +11,8 @@
#include <iostream>
#include "gpttext.h"
+using namespace std;
+
int main(int argc, char* argv[]) {
GPTDataTextUI theGPT;
string device = "";
diff --git a/gpt.h b/gpt.h
index cf05f59..5d19372 100644
--- a/gpt.h
+++ b/gpt.h
@@ -24,8 +24,6 @@
// smallest Advanced Format drive I know of is 320GB in size
#define SMALLEST_ADVANCED_FORMAT UINT64_C(585937500)
-using namespace std;
-
/****************************************
* *
* GPTData class and related structures *
@@ -67,7 +65,7 @@ protected:
uint32_t numParts; // # of partitions the table can hold
struct GPTHeader secondHeader;
MBRData protectiveMBR;
- string device; // device filename
+ std::string device; // device filename
DiskIO myDisk;
uint32_t blockSize; // device logical block size
uint32_t physBlockSize; // device physical block size (or 0 if it can't be determined)
@@ -93,7 +91,7 @@ public:
// Basic necessary functions....
GPTData(void);
GPTData(const GPTData &);
- GPTData(string deviceFilename);
+ GPTData(std::string deviceFilename);
virtual ~GPTData(void);
GPTData & operator=(const GPTData & orig);
@@ -111,18 +109,18 @@ public:
int FindInsanePartitions(void);
// Load or save data from/to disk
- int SetDisk(const string & deviceFilename);
+ int SetDisk(const std::string & deviceFilename);
DiskIO* GetDisk(void) {return &myDisk;}
- int LoadMBR(const string & f) {return protectiveMBR.ReadMBRData(f);}
+ int LoadMBR(const std::string & f) {return protectiveMBR.ReadMBRData(f);}
int WriteProtectiveMBR(void) {return protectiveMBR.WriteMBRData(&myDisk);}
void PartitionScan(void);
- int LoadPartitions(const string & deviceFilename);
+ int LoadPartitions(const std::string & deviceFilename);
int ForceLoadGPTData(void);
int LoadMainTable(void);
int LoadSecondTableAsMain(void);
int SaveGPTData(int quiet = 0);
- int SaveGPTBackup(const string & filename);
- int LoadGPTBackup(const string & filename);
+ int SaveGPTBackup(const std::string & filename);
+ int LoadGPTBackup(const std::string & filename);
int SaveMBR(void);
int DestroyGPT(void);
int DestroyMBR(void);
@@ -204,9 +202,9 @@ public:
void ReversePartitionBytes(); // for endianness
// Attributes functions
- int ManageAttributes(int partNum, const string & command, const string & bits);
+ int ManageAttributes(int partNum, const std::string & command, const std::string & bits);
void ShowAttributes(const uint32_t partNum);
- void GetAttribute(const uint32_t partNum, const string& attributeBits);
+ void GetAttribute(const uint32_t partNum, const std::string& attributeBits);
}; // class GPTData
diff --git a/gptcl.cc b/gptcl.cc
index 3995093..34c9421 100644
--- a/gptcl.cc
+++ b/gptcl.cc
@@ -26,6 +26,8 @@
#include <popt.h>
#include "gptcl.h"
+using namespace std;
+
GPTDataCL::GPTDataCL(void) {
attributeOperation = backupFile = partName = hybrids = newPartInfo = NULL;
mbrParts = twoParts = outDevice = typeCode = partGUID = diskGUID = NULL;
@@ -504,7 +506,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
// Create a hybrid or regular MBR from GPT data structures
int GPTDataCL::BuildMBR(char* argument, int isHybrid) {
int numParts, allOK = 1, i, origPartNum;
- int eeLast, mbrNum = 0;
+ int eeLast = 0, mbrNum = 0;
MBRPart newPart;
BasicMBRData newMBR;
diff --git a/gptcl.h b/gptcl.h
index 183b846..57d3f5d 100644
--- a/gptcl.h
+++ b/gptcl.h
@@ -25,8 +25,6 @@
#include "gpt.h"
#include <popt.h>
-using namespace std;
-
class GPTDataCL : public GPTData {
protected:
// Following are variables associated with popt parameters....
@@ -41,14 +39,14 @@ class GPTDataCL : public GPTData {
int BuildMBR(char* argument, int isHybrid);
public:
GPTDataCL(void);
- GPTDataCL(string filename);
+ GPTDataCL(std::string filename);
~GPTDataCL(void);
- void LoadBackupFile(string backupFile, int &saveData, int &neverSaveData);
+ void LoadBackupFile(std::string backupFile, int &saveData, int &neverSaveData);
int DoOptions(int argc, char* argv[]);
}; // class GPTDataCL
int CountColons(char* argument);
-uint64_t GetInt(const string & argument, int itemNum);
-string GetString(string argument, int itemNum);
+uint64_t GetInt(const std::string & argument, int itemNum);
+std::string GetString(std::string argument, int itemNum);
#endif
diff --git a/gptcurses.cc b/gptcurses.cc
index 2ffcf4f..08b4257 100644
--- a/gptcurses.cc
+++ b/gptcurses.cc
@@ -90,7 +90,7 @@ void GPTDataCurses::EmptySpaces(void) {
// unpartitioned space on the disk.
// Returns the number of Spaces created.
int GPTDataCurses::MakeSpacesFromParts(void) {
- uint i;
+ uint32_t i;
Space *tempSpace;
EmptySpaces();
@@ -608,7 +608,7 @@ void GPTDataCurses::MoveSelection(int delta) {
// Show user's options. Refers to currentSpace to determine which options to show.
// Highlights the option with the key selectedKey; or a default if that's invalid.
void GPTDataCurses::DisplayOptions(char selectedKey) {
- uint i, j = 0, firstLine, numPerLine;
+ uint64_t i, j = 0, firstLine, numPerLine;
string optionName, optionDesc = "";
if (currentSpace != NULL) {
diff --git a/gptcurses.h b/gptcurses.h
index a080987..8d2ecaf 100644
--- a/gptcurses.h
+++ b/gptcurses.h
@@ -27,12 +27,10 @@
#include "gptpart.h"
#include "gpt.h"
-using namespace std;
-
struct MenuItem {
int key; // Keyboard shortcut
- string name; // Item name; 8 characters
- string desc; // Description
+ std::string name; // Item name; 8 characters
+ std::string desc; // Description
};
static struct MenuItem menuMain[] = {
@@ -81,7 +79,7 @@ protected:
Space *lastSpace;
Space *currentSpace;
int currentSpaceNum;
- string whichOptions;
+ std::string whichOptions;
char currentKey;
int numSpaces;
int displayType;
@@ -130,7 +128,7 @@ public:
void ClearLine(int lineNum);
void ClearBottom(void);
void PromptToContinue(void);
-void Report(string theText);
+void Report(std::string theText);
void ShowTypes(void);
#endif
diff --git a/gptpart.cc b/gptpart.cc
index b83254d..5fe7b5a 100644
--- a/gptpart.cc
+++ b/gptpart.cc
@@ -15,17 +15,16 @@
#define __STDC_LIMIT_MACROS
#define __STDC_CONSTANT_MACROS
-#ifdef USE_UTF16
-#include <unicode/ustdio.h>
-#else
-#define UnicodeString string
-#endif
-
#include <string.h>
#include <stdio.h>
#include <iostream>
#include "gptpart.h"
#include "attributes.h"
+#ifdef USE_UTF16
+#include <unicode/ustdio.h>
+#else
+#define UnicodeString std::string
+#endif
using namespace std;
diff --git a/gptpart.h b/gptpart.h
index 51bfb38..ede8139 100644
--- a/gptpart.h
+++ b/gptpart.h
@@ -23,8 +23,6 @@
#include "guid.h"
#include "attributes.h"
-using namespace std;
-
// Values returned by GPTPart::IsSizedForMBR()
#define MBR_SIZED_GOOD 0 /* Whole partition under 2^32 sectors */
#define MBR_SIZED_IFFY 1 /* Partition starts under 2^32 & is less than 2^32, but ends over 2^32 */
@@ -59,7 +57,7 @@ class GPTPart {
// Simple data retrieval:
PartType & GetType(void) {return partitionType;}
uint16_t GetHexType(void) const;
- string GetTypeName(void);
+ std::string GetTypeName(void);
UnicodeString GetUTypeName(void);
const GUIDData GetUniqueGUID(void) const {return uniqueGUID;}
uint64_t GetFirstLBA(void) const {return firstLBA;}
@@ -80,7 +78,7 @@ class GPTPart {
void SetLastLBA(uint64_t l) {lastLBA = l;}
void SetAttributes(uint64_t a) {attributes = a;}
void SetAttributes(void) {attributes.ChangeAttributes();}
- void SetName(const string & theName);
+ void SetName(const std::string & theName);
#ifdef USE_UTF16
void SetName(const UnicodeString & theName);
#endif
diff --git a/gpttext.h b/gpttext.h
index 36a17f9..32e2f88 100644
--- a/gpttext.h
+++ b/gpttext.h
@@ -23,13 +23,11 @@
#include "gpt.h"
-using namespace std;
-
class GPTDataTextUI : public GPTData {
protected:
public:
GPTDataTextUI(void);
- GPTDataTextUI(string filename);
+ GPTDataTextUI(std::string filename);
~GPTDataTextUI(void);
// This one needs to be explicitly defined, even though it does nothing new....
@@ -55,17 +53,17 @@ class GPTDataTextUI : public GPTData {
void ShowDetails(void);
void MakeHybrid(void);
int XFormToMBR(void); // convert GPT to MBR, wiping GPT afterwards. Returns 1 if successful
- uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, const string & prompt);
+ uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, const std::string & prompt);
// An informational function....
void WarnAboutIffyMBRPart(int partNum);
// Main menu functions
- void MainMenu(string filename);
+ void MainMenu(std::string filename);
void ShowCommands(void);
- void ExpertsMenu(string filename);
+ void ExpertsMenu(std::string filename);
void ShowExpertCommands(void);
- void RecoveryMenu(string filename);
+ void RecoveryMenu(std::string filename);
void ShowRecoveryCommands(void);
}; // class GPTDataTextUI
diff --git a/guid.h b/guid.h
index 229d5bd..515a75d 100644
--- a/guid.h
+++ b/guid.h
@@ -30,8 +30,6 @@ typedef unsigned char my_uuid_t[16];
typedef uuid_t my_uuid_t;
#endif
-using namespace std;
-
// Note: This class's data size is critical. If data elements must be added,
// it will be necessary to modify various GPT classes to compensate.
class GUIDData {
@@ -39,17 +37,17 @@ class GUIDData {
static bool firstInstance;
protected:
my_uuid_t uuidData;
- string DeleteSpaces(string s);
+ std::string DeleteSpaces(std::string s);
public:
GUIDData(void);
GUIDData(const GUIDData & orig);
- GUIDData(const string & orig);
+ GUIDData(const std::string & orig);
GUIDData(const char * orig);
~GUIDData(void);
// Data assignment operators....
GUIDData & operator=(const GUIDData & orig);
- GUIDData & operator=(const string & orig);
+ GUIDData & operator=(const std::string & orig);
GUIDData & operator=(const char * orig);
void Zero(void);
void Randomize(void);
@@ -59,9 +57,9 @@ class GUIDData {
int operator!=(const GUIDData & orig) const;
// Data retrieval....
- string AsString(void) const;
+ std::string AsString(void) const;
}; // class GUIDData
-ostream & operator<<(ostream & os, const GUIDData & data);
+std::ostream & operator<<(std::ostream & os, const GUIDData & data);
#endif
diff --git a/mbr.h b/mbr.h
index 21c1d7b..3eea775 100644
--- a/mbr.h
+++ b/mbr.h
@@ -13,8 +13,6 @@
#include "diskio.h"
#include "basicmbr.h"
-using namespace std;
-
/****************************************
* *
* MBRData class and related structures *
@@ -26,7 +24,7 @@ class MBRData : public BasicMBRData {
protected:
public:
MBRData(void) {}
- MBRData(string deviceFilename) : BasicMBRData(deviceFilename) {}
+ MBRData(std::string deviceFilename) : BasicMBRData(deviceFilename) {}
MBRData & operator=(const BasicMBRData & orig);
~MBRData(void);
diff --git a/mbrpart.h b/mbrpart.h
index 0de365f..6c7b21a 100644
--- a/mbrpart.h
+++ b/mbrpart.h
@@ -32,8 +32,6 @@
#define EBR 4 /* sector is used as an EBR or MBR */
#define INVALID 8 /* sector number is too large for disk */
-using namespace std;
-
// Data for a single MBR partition record
// Note that firstSector and lastSector are in CHS addressing, which
// splits the bits up in a weird way.
diff --git a/parttypes.h b/parttypes.h
index 92f3d64..4e1d968 100644
--- a/parttypes.h
+++ b/parttypes.h
@@ -6,16 +6,14 @@
#include <stdint.h>
#include <stdlib.h>
+#include <string>
+#include "support.h"
+#include "guid.h"
#ifdef USE_UTF16
#include <unicode/ustream.h>
#else
-#define UnicodeString string
+#define UnicodeString std::string
#endif
-#include <string>
-#include "support.h"
-#include "guid.h"
-
-using namespace std;
// A partition type
struct AType {
@@ -24,7 +22,7 @@ struct AType {
// codes required by GPT
uint16_t MBRType;
GUIDData GUIDType;
- string name;
+ std::string name;
int display; // 1 to show to users as available type, 0 not to
AType* next;
}; // struct AType
@@ -48,7 +46,7 @@ public:
int AddType(uint16_t mbrType, const char * guidData, const char * name, int toDisplay = 1);
// New assignment operators....
- PartType & operator=(const string & orig);
+ PartType & operator=(const std::string & orig);
PartType & operator=(const char * orig);
// Assignment operators based on base class....
@@ -58,7 +56,7 @@ public:
PartType & operator=(uint16_t ID); // Use MBR type code times 0x0100 to assign GUID
// Retrieve transformed GUID data based on type code matches
- string TypeName(void) const;
+ std::string TypeName(void) const;
UnicodeString UTypeName(void) const;
uint16_t GetHexType() const;
diff --git a/support.h b/support.h
index a61ddf4..3930ee4 100644
--- a/support.h
+++ b/support.h
@@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string>
-#define GPTFDISK_VERSION "1.0.8.2"
+#define GPTFDISK_VERSION "1.0.8.3"
#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
// Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64
@@ -69,18 +69,16 @@
#define GPT_RESERVED 420
#define NAME_SIZE 36 // GPT allows 36 UTF-16LE code units for a name in a 128 byte partition entry
-using namespace std;
-
-string ReadString(void);
-uint64_t GetNumber(uint64_t low, uint64_t high, uint64_t def, const string & prompt);
+std::string ReadString(void);
+uint64_t GetNumber(uint64_t low, uint64_t high, uint64_t def, const std::string & prompt);
char GetYN(void);
-uint64_t IeeeToInt(string IeeeValue, uint64_t sSize, uint64_t low, uint64_t high, uint32_t sectorAlignment, uint64_t def = 0);
-string BytesToIeee(uint64_t size, uint32_t sectorSize);
-unsigned char StrToHex(const string & input, unsigned int position);
-int IsHex(string input); // Returns 1 if input can be hexadecimal number....
+uint64_t IeeeToInt(std::string IeeeValue, uint64_t sSize, uint64_t low, uint64_t high, uint32_t sectorAlignment, uint64_t def = 0);
+std::string BytesToIeee(uint64_t size, uint32_t sectorSize);
+unsigned char StrToHex(const std::string & input, unsigned int position);
+int IsHex(std::string input); // Returns 1 if input can be hexadecimal number....
int IsLittleEndian(void); // Returns 1 if CPU is little-endian, 0 if it's big-endian
void ReverseBytes(void* theValue, int numBytes); // Reverses byte-order of theValue
void WinWarning(void);
-string ToLower(const string& input);
+std::string ToLower(const std::string& input);
#endif