summaryrefslogtreecommitdiff
path: root/libgphoto2
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2021-10-07 01:03:42 +0200
committerMarcus Meissner <meissner@suse.de>2021-10-11 09:20:50 +0200
commit767ee8bad421f7317718a1c6f138fb32d8432a7c (patch)
treeed207bdcbdea3ff25d405559034838121022d6e8 /libgphoto2
parent6e2779554662e37a1e53570e590c818ad99a96d9 (diff)
downloadlibgphoto2-767ee8bad421f7317718a1c6f138fb32d8432a7c.tar.gz
Avoid accidental include file name collisions
There are five libgphoto2 internal *.h include files inside the source tree's `libgphoto2/` folder. Internal means they are part of the libgphoto2 implementation, and are not part of the public libgphoto2 API or ABI. These files have names which are so generic that it is difficult to see from a `#include` statement that the included file is actually part of libgphoto2: bayer-types.h bayer.h exif.h gamma.h jpeg.h While building, an additional file is created inside the `libgphoto2/` folder with a name which does hint to its relationship with libgphoto2: gphoto2-endian.h To reduce the probability of accidental conflicts with include files which might also be called the same very generic name, this changes the use of these include files to a preprocessor directive like #include "libgphoto2/bayer.h> instead of #include "bayer.h" To enforce the need for the "libgphoto2/" part in the #include preprocessor directive, this also removes the respective `-I` arguments for the `libgphoto2` subdir (both in source tree and in build tree) from `*_CPPFLAGS`. This change was inspired by `libgphoto2/` and `camlibs/stv0680/` containing very different include files both called `bayer.h`.
Diffstat (limited to 'libgphoto2')
-rw-r--r--libgphoto2/ahd_bayer.c2
-rw-r--r--libgphoto2/bayer.c2
-rw-r--r--libgphoto2/bayer.h2
-rw-r--r--libgphoto2/exif.c2
-rw-r--r--libgphoto2/gamma.c2
-rw-r--r--libgphoto2/jpeg.c4
6 files changed, 8 insertions, 6 deletions
diff --git a/libgphoto2/ahd_bayer.c b/libgphoto2/ahd_bayer.c
index 80117a133..1039f941b 100644
--- a/libgphoto2/ahd_bayer.c
+++ b/libgphoto2/ahd_bayer.c
@@ -46,7 +46,7 @@
#include <time.h>
#include "config.h"
-#include "bayer.h"
+#include "libgphoto2/bayer.h"
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-port-log.h>
diff --git a/libgphoto2/bayer.c b/libgphoto2/bayer.c
index 12da20fbc..b6a102e1a 100644
--- a/libgphoto2/bayer.c
+++ b/libgphoto2/bayer.c
@@ -29,7 +29,7 @@
*/
#include "config.h"
-#include "bayer.h"
+#include "libgphoto2/bayer.h"
#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-result.h>
diff --git a/libgphoto2/bayer.h b/libgphoto2/bayer.h
index 890e6ec8c..2a602ebd4 100644
--- a/libgphoto2/bayer.h
+++ b/libgphoto2/bayer.h
@@ -25,7 +25,7 @@
#define LIBGPHOTO2_BAYER_H
-#include "bayer-types.h"
+#include "libgphoto2/bayer-types.h"
int gp_bayer_expand (unsigned char *input, int w, int h, unsigned char *output,
diff --git a/libgphoto2/exif.c b/libgphoto2/exif.c
index 2297edab7..2d9dcdda0 100644
--- a/libgphoto2/exif.c
+++ b/libgphoto2/exif.c
@@ -24,7 +24,7 @@
/* Contained some EXIF functions previously. We now defer to libexif usage. */
-#include "exif.h"
+#include "libgphoto2/exif.h"
#include <stdio.h>
diff --git a/libgphoto2/gamma.c b/libgphoto2/gamma.c
index c4a970ffe..ea571455b 100644
--- a/libgphoto2/gamma.c
+++ b/libgphoto2/gamma.c
@@ -22,7 +22,7 @@
*/
#include "config.h"
-#include "gamma.h"
+#include "libgphoto2/gamma.h"
#include <math.h>
diff --git a/libgphoto2/jpeg.c b/libgphoto2/jpeg.c
index 05f67f181..9b9832f98 100644
--- a/libgphoto2/jpeg.c
+++ b/libgphoto2/jpeg.c
@@ -21,10 +21,12 @@
*/
#include "config.h"
-#include "jpeg.h"
+#include "libgphoto2/jpeg.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include <gphoto2/gphoto2-file.h>
/* call example:nullpictureabort(picture,"Picture",0); */