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/spca50x/spca50x-avi-header.h | 6 +++--- camlibs/spca50x/spca50x-flash.h | 6 +++--- camlibs/spca50x/spca50x-jpeg-header.h | 7 ++++--- camlibs/spca50x/spca50x-registers.h | 6 +++--- camlibs/spca50x/spca50x-sdram.h | 7 ++++--- camlibs/spca50x/spca50x.h | 7 ++++--- 6 files changed, 21 insertions(+), 18 deletions(-) (limited to 'camlibs/spca50x') diff --git a/camlibs/spca50x/spca50x-avi-header.h b/camlibs/spca50x/spca50x-avi-header.h index 4d1c13511..0764a0255 100644 --- a/camlibs/spca50x/spca50x-avi-header.h +++ b/camlibs/spca50x/spca50x-avi-header.h @@ -1,5 +1,5 @@ -#ifndef __SPCA50X_AVI_HEADER_H -#define __SPCA50X_AVI_HEADER_H +#ifndef CAMLIBS_SPCA50X_SPCA50X_AVI_HEADER_H +#define CAMLIBS_SPCA50X_SPCA50X_AVI_HEADER_H #define SPCA50X_AVI_FRAME_HEADER_LENGTH 8 static const uint8_t SPCA50xAviFrameHeader[SPCA50X_AVI_FRAME_HEADER_LENGTH] = { @@ -73,4 +73,4 @@ static const uint8_t SPCA50xAviHeader[SPCA50X_AVI_HEADER_LENGTH] = { 0x6D, 0x6F, 0x76, 0x69 /* 0xda: movi */ }; -#endif /* __SPCA50X_AVI_HEADER_H */ +#endif /* !defined(CAMLIBS_SPCA50X_SPCA50X_AVI_HEADER_H) */ diff --git a/camlibs/spca50x/spca50x-flash.h b/camlibs/spca50x/spca50x-flash.h index 705b3ae1f..19f624af4 100644 --- a/camlibs/spca50x/spca50x-flash.h +++ b/camlibs/spca50x/spca50x-flash.h @@ -14,8 +14,8 @@ * based on work by: Mark A. Zimmerman */ -#ifndef __SPCA50X_FLASH_H__ -#define __SPCA50X_FLASH_H__ +#ifndef CAMLIBS_SPCA50X_SPCA50X_FLASH_H +#define CAMLIBS_SPCA50X_SPCA50X_FLASH_H #include #include @@ -39,4 +39,4 @@ int spca50x_flash_delete_all (CameraPrivateLibrary *pl, GPContext *context); int spca500_flash_delete_file (CameraPrivateLibrary *pl, int index); int spca500_flash_capture (CameraPrivateLibrary *pl); -#endif +#endif /* !defined(CAMLIBS_SPCA50X_SPCA50X_FLASH_H) */ diff --git a/camlibs/spca50x/spca50x-jpeg-header.h b/camlibs/spca50x/spca50x-jpeg-header.h index de6c37e55..a9ea5ce3b 100644 --- a/camlibs/spca50x/spca50x-jpeg-header.h +++ b/camlibs/spca50x/spca50x-jpeg-header.h @@ -1,5 +1,5 @@ -#ifndef __SPCA50X_JPEG_HEADER_H -#define __SPCA50X_JPEG_HEADER_H +#ifndef CAMLIBS_SPCA50X_SPCA50X_JPEG_HEADER_H +#define CAMLIBS_SPCA50X_SPCA50X_JPEG_HEADER_H /* * Start from 0 -> 588 @@ -175,4 +175,5 @@ static const uint8_t SPCA50xQTable[20][64]= 124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124, 124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124 } }; -#endif /* __SPCA50X_JPEG_HEADER_H */ + +#endif /* !defined(CAMLIBS_SPCA50X_SPCA50X_JPEG_HEADER_H) */ diff --git a/camlibs/spca50x/spca50x-registers.h b/camlibs/spca50x/spca50x-registers.h index f1fd911d4..619f2724c 100644 --- a/camlibs/spca50x/spca50x-registers.h +++ b/camlibs/spca50x/spca50x-registers.h @@ -24,8 +24,8 @@ /* Boston, MA 02110-1301 USA */ /****************************************************************/ -#ifndef __SPCA50X_REGISTERS_H__ -#define __SPCA50X_REGISTERS_H__ +#ifndef CAMLIBS_SPCA50X_SPCA50X_REGISTERS_H +#define CAMLIBS_SPCA50X_SPCA50X_REGISTERS_H /* ---- Register ---- */ @@ -81,4 +81,4 @@ SPCA50xCamMode; #define SPCA50X_REG_I2C_rStatus 0x2a06 -#endif /* __SPCA50X_REGISTERS_H__ */ +#endif /* !defined(CAMLIBS_SPCA50X_SPCA50X_REGISTERS_H) */ diff --git a/camlibs/spca50x/spca50x-sdram.h b/camlibs/spca50x/spca50x-sdram.h index b5bad4dee..85f1f674e 100644 --- a/camlibs/spca50x/spca50x-sdram.h +++ b/camlibs/spca50x/spca50x-sdram.h @@ -24,8 +24,9 @@ /* Boston, MA 02110-1301 USA */ /****************************************************************/ -#ifndef __SPCA50X_SDRAM_H__ -#define __SPCA50X_SDRAM_H__ +#ifndef CAMLIBS_SPCA50X_SPCA50X_SDRAM_H +#define CAMLIBS_SPCA50X_SPCA50X_SDRAM_H + #include int spca50x_sdram_get_info (CameraPrivateLibrary * lib); @@ -39,4 +40,4 @@ int spca50x_sdram_request_thumbnail (CameraPrivateLibrary * lib, uint8_t ** buf, unsigned int *len, unsigned int number, int *type); -#endif /* __SPCA50X_SDRAM_H__ */ +#endif /* !defined(CAMLIBS_SPCA50X_SPCA50X_SDRAM_H) */ diff --git a/camlibs/spca50x/spca50x.h b/camlibs/spca50x/spca50x.h index 072759178..9331f48f7 100644 --- a/camlibs/spca50x/spca50x.h +++ b/camlibs/spca50x/spca50x.h @@ -24,8 +24,9 @@ /* Boston, MA 02110-1301 USA */ /****************************************************************/ -#ifndef __SPCA50X_H__ -#define __SPCA50X_H__ +#ifndef CAMLIBS_SPCA50X_SPCA50X_H +#define CAMLIBS_SPCA50X_SPCA50X_H + #include #include @@ -91,4 +92,4 @@ int create_jpeg_from_data (uint8_t * dst, uint8_t * src, unsigned int qIndex, int original_size, int *size, int omit_huffman_table, int omit_escape); -#endif /* __SPCA50X_H__ */ +#endif /* !defined(CAMLIBS_SPCA50X_SPCA50X_H) */ -- cgit v1.2.1