[Gptfdisk-general] A proposed patch for gptfdisk
Brought to you by:
srs5694
From: Aurimas L. <au...@go...> - 2016-06-29 21:42:59
|
commit 3c1e0296b565f9fbdf5ebc929d6c4c840e060b5a Author: Aurimas Liutikas <au...@go...> Date: Tue May 10 19:16:10 2016 -0700 Fix a couple of clang warnings. - __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS might be defined by a project that includes gptfdisk. This patch add #ifndef checks. - register keyword does not do anything in newer compilers. This patch removes it from crc32.cc - all structs need to be fully initialized. This patch adds missing NULL values in gptcl.cc Signed-off-by: Aurimas Liutikas <au...@go...> diff --git a/attributes.cc b/attributes.cc index f3cd585..7c1b990 100644 --- a/attributes.cc +++ b/attributes.cc @@ -6,8 +6,12 @@ /* 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <stdint.h> #include <stdio.h> diff --git a/basicmbr.cc b/basicmbr.cc index 5661487..742e95e 100644 --- a/basicmbr.cc +++ b/basicmbr.cc @@ -6,8 +6,12 @@ /* 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <stdio.h> #include <stdlib.h> diff --git a/bsd.cc b/bsd.cc index f487f18..d3cf10d 100644 --- a/bsd.cc +++ b/bsd.cc @@ -6,8 +6,12 @@ /* 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <stdio.h> //#include <unistd.h> 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-unix.cc b/diskio-unix.cc index af71cdb..6b3ff14 100644 --- a/diskio-unix.cc +++ b/diskio-unix.cc @@ -12,8 +12,12 @@ // 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <sys/ioctl.h> #include <string.h> diff --git a/diskio-windows.cc b/diskio-windows.cc index 5535f49..7d3190b 100644 --- a/diskio-windows.cc +++ b/diskio-windows.cc @@ -12,8 +12,12 @@ // This program is copyright (c) 2009, 2010 by Roderick W. Smith. It is distributed // under the terms of the GNU GPL version 2, as detailed in the COPYING file. +#ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <windows.h> #include <winioctl.h> diff --git a/diskio.cc b/diskio.cc index baf235b..43209cc 100644 --- a/diskio.cc +++ b/diskio.cc @@ -12,8 +12,12 @@ // 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #ifdef _WIN32 #include <windows.h> diff --git a/gpt.cc b/gpt.cc index d0a46c6..7e0a535 100644 --- a/gpt.cc +++ b/gpt.cc @@ -6,8 +6,12 @@ /* 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <stdio.h> #include <stdlib.h> diff --git a/gptcl.cc b/gptcl.cc index 920dd44..3616996 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -109,7 +109,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { {"version", 'V', POPT_ARG_NONE, NULL, 'V', "display version information", ""}, {"zap", 'z', POPT_ARG_NONE, NULL, 'z', "zap (destroy) GPT (but not MBR) data structures", ""}, {"zap-all", 'Z', POPT_ARG_NONE, NULL, 'Z', "zap (destroy) GPT and MBR data structures", ""}, - POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } + POPT_AUTOHELP { NULL, 0, 0, NULL, 0, NULL, NULL } }; // Create popt context... diff --git a/gptpart.cc b/gptpart.cc index 17d6f15..0877ae0 100644 --- a/gptpart.cc +++ b/gptpart.cc @@ -12,8 +12,12 @@ // 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #ifdef USE_UTF16 #include <unicode/ustdio.h> diff --git a/guid.cc b/guid.cc index 1e73ab7..7c66ad7 100644 --- a/guid.cc +++ b/guid.cc @@ -11,8 +11,12 @@ // // +#ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <stdio.h> #include <time.h> diff --git a/mbr.cc b/mbr.cc index 08c61be..c063de7 100644 --- a/mbr.cc +++ b/mbr.cc @@ -6,8 +6,12 @@ /* 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <stdio.h> #include <stdlib.h> diff --git a/mbrpart.cc b/mbrpart.cc index 0ca5814..ad1d39e 100644 --- a/mbrpart.cc +++ b/mbrpart.cc @@ -17,8 +17,12 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <stddef.h> #include <stdint.h> diff --git a/parttypes.cc b/parttypes.cc index 175aca5..4dee3a9 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -5,8 +5,12 @@ /* This program is copyright (c) 2009-2015 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ +#ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <string.h> #include <stdint.h> diff --git a/support.cc b/support.cc index 0ff3485..b1a5266 100644 --- a/support.cc +++ b/support.cc @@ -6,8 +6,12 @@ /* 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 __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include <stdio.h> #include <stdint.h> |