From 0dbeaf7cbf30ab88ac7aea3e7d3f24df8dc0309f Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 5 Oct 2021 15:50:32 +0200 Subject: Use consistently named non-reserved CPP macros for header files C preprocessor macros beginning/ending with underscores are reserved for system use as well as macros containing a double underscore anywhere, so application software macros are supposed to be named differently. For a header file gphoto2-abilities-list.h, this consistently uses a macro name LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H for the usual #ifndef LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H #define LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H ... content of the header file ... #endif /* !defined(LIBGPHOTO2_GPHOTO2_ABILITIES_LIST_H) */ Found using "clang -Weverything". This should work, unless when run with an ancient C preprocessor which might only the first 8 or 10 characters to distinguish macro names and ignores the remainder of the name. --- camlibs/mustek/core.h | 7 ++++--- camlibs/mustek/image.h | 7 ++++--- camlibs/mustek/io.h | 7 ++++--- camlibs/mustek/mdc800_spec.h | 6 +++--- camlibs/mustek/mustek-config.h | 6 +++--- camlibs/mustek/print.h | 8 +++++--- camlibs/mustek/rs232.h | 7 ++++--- camlibs/mustek/usb.h | 7 ++++--- 8 files changed, 31 insertions(+), 24 deletions(-) (limited to 'camlibs/mustek') diff --git a/camlibs/mustek/core.h b/camlibs/mustek/core.h index 780f95f28..3534808ec 100644 --- a/camlibs/mustek/core.h +++ b/camlibs/mustek/core.h @@ -16,8 +16,8 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _MUSTEK_CORE_H -#define _MUSTEK_CORE_H +#ifndef CAMLIBS_MUSTEK_CORE_H +#define CAMLIBS_MUSTEK_CORE_H #include "io.h" #include "mdc800_spec.h" @@ -91,4 +91,5 @@ int mdc800_getExposureMode (Camera*,int *); int mdc800_enableMenu (Camera *,int); int mdc800_number_of_pictures (Camera *camera, int *nrofpics); -#endif + +#endif /* !defined(CAMLIBS_MUSTEK_CORE_H) */ diff --git a/camlibs/mustek/image.h b/camlibs/mustek/image.h index 265ad76e5..41beedf52 100644 --- a/camlibs/mustek/image.h +++ b/camlibs/mustek/image.h @@ -19,10 +19,11 @@ /* * JPeg corrections table */ -#ifndef DEFINE_IMAGE_H -#define DEFINE_IMAGE_H + +#ifndef CAMLIBS_MUSTEK_IMAGE_H +#define CAMLIBS_MUSTEK_IMAGE_H int mdc800_correctImageData (unsigned char*, int,int,int ); -#endif +#endif /* !defined(CAMLIBS_MUSTEK_IMAGE_H) */ diff --git a/camlibs/mustek/io.h b/camlibs/mustek/io.h index d5477719e..c6e46924c 100644 --- a/camlibs/mustek/io.h +++ b/camlibs/mustek/io.h @@ -16,8 +16,8 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _IO_H -#define _IO_H +#ifndef CAMLIBS_MUSTEK_IO_H +#define CAMLIBS_MUSTEK_IO_H /* Maximum Number of tries, before a command is given up */ #define MDC800_DEFAULT_COMMAND_RETRY 4 @@ -45,4 +45,5 @@ int mdc800_io_sendCommand(GPPort *, unsigned char ,unsigned char,unsigned char,u /* Helper Function for rs232 and usb */ int mdc800_io_getCommandTimeout(unsigned char); -#endif + +#endif /* !defined(CAMLIBS_MUSTEK_IO_H) */ diff --git a/camlibs/mustek/mdc800_spec.h b/camlibs/mustek/mdc800_spec.h index a999fc30e..e0059176f 100644 --- a/camlibs/mustek/mdc800_spec.h +++ b/camlibs/mustek/mdc800_spec.h @@ -20,8 +20,8 @@ * Definition of Commands and useful structs. */ -#ifndef DEFINE_MDC800_SPEC_H -#define DEFINE_MDC800_SPEC_H +#ifndef CAMLIBS_MUSTEK_MDC800_SPEC_H +#define CAMLIBS_MUSTEK_MDC800_SPEC_H #define ANSWER_COMMIT 0xbb @@ -69,4 +69,4 @@ #define COMMAND_SET_EXPOSURE_MODE 0x50 #define COMMAND_GET_EXPOSURE_MODE 0x51 -#endif +#endif /* !defined(CAMLIBS_MUSTEK_MDC800_SPEC_H) */ diff --git a/camlibs/mustek/mustek-config.h b/camlibs/mustek/mustek-config.h index d04c4129e..84c19f281 100644 --- a/camlibs/mustek/mustek-config.h +++ b/camlibs/mustek/mustek-config.h @@ -1,7 +1,7 @@ -#ifndef DEFINE_MUSTEK_CONFIG_H -#define DEFINE_MUSTEK_CONFIG_H +#ifndef CAMLIBS_MUSTEK_MUSTEK_CONFIG_H +#define CAMLIBS_MUSTEK_MUSTEK_CONFIG_H int mdc800_configure (); -#endif +#endif /* !defined(CAMLIBS_MUSTEK_MUSTEK_CONFIG_H) */ diff --git a/camlibs/mustek/print.h b/camlibs/mustek/print.h index 4a716e677..ac5b9ec3a 100644 --- a/camlibs/mustek/print.h +++ b/camlibs/mustek/print.h @@ -20,8 +20,10 @@ Defines some PrintMacros. They are need to disable much outputs they were used during development. */ -#ifndef DEFINE_PRINT_H -#define DEFINE_PRINT_H + +#ifndef CAMLIBS_MUSTEK_PRINT_H +#define CAMLIBS_MUSTEK_PRINT_H + #include /* Message or Errors from the gphoto API */ @@ -40,5 +42,5 @@ #define printCError if (1) printf -#endif +#endif /* !defined(CAMLIBS_MUSTEK_PRINT_H) */ diff --git a/camlibs/mustek/rs232.h b/camlibs/mustek/rs232.h index 163b91c12..73a72f70c 100644 --- a/camlibs/mustek/rs232.h +++ b/camlibs/mustek/rs232.h @@ -15,12 +15,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _RS232_H -#define _RS232_H + +#ifndef CAMLIBS_MUSTEK_RS232_H +#define CAMLIBS_MUSTEK_RS232_H int mdc800_rs232_sendCommand(GPPort*,unsigned char* , unsigned char * , int ); int mdc800_rs232_waitForCommit(GPPort*,char commandid); int mdc800_rs232_receive(GPPort*,unsigned char * , int ); int mdc800_rs232_download(GPPort*,unsigned char *, int); -#endif +#endif /* !defined(CAMLIBS_MUSTEK_RS232_H) */ diff --git a/camlibs/mustek/usb.h b/camlibs/mustek/usb.h index a28b8053d..9e01d1db5 100644 --- a/camlibs/mustek/usb.h +++ b/camlibs/mustek/usb.h @@ -19,8 +19,9 @@ /* Header for USB Interface */ -#ifndef _USB_H -#define _USB_H + +#ifndef CAMLIBS_MUSTEK_USB_H +#define CAMLIBS_MUSTEK_USB_H #define MDC800_USB_ENDPOINT_COMMAND 0x01 #define MDC800_USB_ENDPOINT_STATUS 0x82 @@ -29,4 +30,4 @@ int mdc800_usb_sendCommand (GPPort*,unsigned char* , unsigned char * , int ); -#endif +#endif /* !defined(CAMLIBS_MUSTEK_USB_H) */ -- cgit v1.2.1