Clean up #include directives

This is subtle, but #include <header.h> searches directories specified
with -I, then system include directories.  #include "header.h" searches
the current source directory, then directories specified with -I, then
system include directories.

Using bracketed #include directives for jpeglib.h, jinclude.h, jerror.h,
cdjpeg.h, and turbojpeg.h only worked because the build system
explicitly passed -I{source_directory}/src/ to the compiler.  Referring
to 51cee03629, it's better for the source
code to have as few dependencies on our specific build system as
possible.

Since jpeglib.h, jinclude.h, jerror.h, and turbojpeg.h can be installed
in system include directories, it's also better for internal references
to those headers to resolve internally first, to avoid potential
conflicts between the system-installed version of libjpeg-turbo and the
version being built.  (Such conflicts would never have occurred with our
build system, but they might have occurred due to misintegration with a
downstream build system.)
This commit is contained in:
DRC
2025-09-25 11:32:45 -04:00
parent bf2c1efbb2
commit f74989d8c7
21 changed files with 45 additions and 46 deletions

View File

@@ -617,8 +617,7 @@ if(UNIX)
endif()
# Include directories and compiler definitions
include_directories(${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
###############################################################################

View File

@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2021-2024 D. R. Commander. All Rights Reserved.
* Copyright (C)2021-2025 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdlib.h>
#include <stdint.h>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2021-2024 D. R. Commander. All Rights Reserved.
* Copyright (C)2021-2025 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdlib.h>
#include <stdint.h>

View File

@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <turbojpeg.h>
#include "../src/turbojpeg.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2024 D. R. Commander. All Rights Reserved.
* Copyright (C)2011-2025 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -27,8 +27,8 @@
*/
#include <limits.h>
#include "turbojpeg.h"
#include "jinclude.h"
#include "../src/turbojpeg.h"
#include "../src/jinclude.h"
#include <jni.h>
#include "org_libjpegturbo_turbojpeg_TJCompressor.h"
#include "org_libjpegturbo_turbojpeg_TJDecompressor.h"

View File

@@ -1,7 +1,7 @@
/*
* cmyk.h
*
* Copyright (C) 2017-2018, 2022, 2024, D. R. Commander.
* Copyright (C) 2017-2018, 2022, 2024-2025, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -14,9 +14,9 @@
#ifndef CMYK_H
#define CMYK_H
#include <jinclude.h>
#include "jinclude.h"
#define JPEG_INTERNALS
#include <jpeglib.h>
#include "jpeglib.h"
#include "jsamplecomp.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
* Copyright (C)2011, 2025 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -30,8 +30,8 @@
capabilities of libjpeg-turbo at both compile time and run time. */
#include <stdio.h>
#include <jpeglib.h>
#include <jerror.h>
#include "jpeglib.h"
#include "jerror.h"
#include <setjmp.h>
#ifndef JCS_EXTENSIONS

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2013, 2016 D. R. Commander. All Rights Reserved.
* Copyright (C)2013, 2016, 2025 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <string.h>
#include "./md5.h"
#include "md5.h"
#include "../tjutil.h"
int main(int argc, char *argv[])

View File

@@ -6,8 +6,8 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
* libjpeg-turbo Modifications:
* Copyright (C)2016, 2018-2019, 2022, 2024 D. R. Commander.
* All Rights Reserved.
* Copyright (C)2016, 2018-2019, 2022, 2024-2025 D. R. Commander.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -59,7 +59,7 @@
#define LENGTH 16
#include "./md5.h"
#include "md5.h"
static char *MD5End(MD5_CTX *ctx, char *buf)
{

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2013, 2016, 2024 D. R. Commander. All Rights Reserved.
* Copyright (C)2013, 2016, 2024-2025 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -33,7 +33,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "./md5.h"
#include "md5.h"
int main(int argc, char *argv[])
{

View File

@@ -40,9 +40,9 @@
#if !defined(_MSC_VER) || _MSC_VER > 1600
#include <stdint.h>
#endif
#include <cdjpeg.h>
#include "./tjutil.h"
#include "./turbojpeg.h"
#include "cdjpeg.h"
#include "tjutil.h"
#include "turbojpeg.h"
#define MATCH_ARG(arg, string, minChars) \

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2012, 2014-2015, 2017, 2019, 2021-2024
* Copyright (C)2011-2012, 2014-2015, 2017, 2019, 2021-2025
* D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,7 +56,7 @@
#if !defined(_MSC_VER) || _MSC_VER > 1600
#include <stdint.h>
#endif
#include <turbojpeg.h>
#include "turbojpeg.h"
#ifdef _WIN32

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2012, 2014-2015, 2017, 2019, 2021-2024
* Copyright (C)2011-2012, 2014-2015, 2017, 2019, 2021-2025
* D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,7 +53,7 @@
#if !defined(_MSC_VER) || _MSC_VER > 1600
#include <stdint.h>
#endif
#include <turbojpeg.h>
#include "turbojpeg.h"
#ifdef _WIN32

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2011-2012, 2014-2015, 2017, 2019, 2021-2024
* Copyright (C)2011-2012, 2014-2015, 2017, 2019, 2021-2025
* D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,7 @@
#if !defined(_MSC_VER) || _MSC_VER > 1600
#include <stdint.h>
#endif
#include <turbojpeg.h>
#include "turbojpeg.h"
#ifdef _WIN32

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C)2009-2024 D. R. Commander. All Rights Reserved.
* Copyright (C)2009-2025 D. R. Commander. All Rights Reserved.
* Copyright (C)2021 Alex Richardson. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,17 +35,17 @@
#if !defined(_MSC_VER) || _MSC_VER > 1600
#include <stdint.h>
#endif
#include <jinclude.h>
#include "jinclude.h"
#define JPEG_INTERNALS
#include <jpeglib.h>
#include <jerror.h>
#include "jpeglib.h"
#include "jerror.h"
#include <setjmp.h>
#include <errno.h>
#include "./turbojpeg.h"
#include "./tjutil.h"
#include "turbojpeg.h"
#include "tjutil.h"
#include "transupp.h"
#include "./jpegapicomp.h"
#include "./cdjpeg.h"
#include "jpegapicomp.h"
#include "cdjpeg.h"
extern void jpeg_mem_dest_tj(j_compress_ptr, unsigned char **, size_t *,
boolean);