diff --git a/CMakeLists.txt b/CMakeLists.txt index 03cb1d64..2f6bbdd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -475,7 +475,7 @@ if(UNIX) check_c_source_runs(" #include #include - int is_shifting_signed (long arg) { + static int is_shifting_signed (long arg) { long res = arg >> 4; if (res == -0x7F7E80CL) return 1; /* right shift is signed */ @@ -495,7 +495,7 @@ if(UNIX) endif() if(NOT MSVC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - check_c_source_compiles("const int __attribute__((visibility(\"hidden\"))) table[1] = { 0 }; int main(void) { return table[0]; }" + check_c_source_compiles("extern const int table[1]; const int __attribute__((visibility(\"hidden\"))) table[1] = { 0 }; int main(void) { return table[0]; }" HIDDEN_WORKS) if(HIDDEN_WORKS) set(HIDDEN "__attribute__((visibility(\"hidden\")))") @@ -536,7 +536,7 @@ if(MSVC) else() set(THREAD_LOCAL "__thread") endif() -check_c_source_compiles("${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" +check_c_source_compiles("static ${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }" HAVE_THREAD_LOCAL) if(HAVE_THREAD_LOCAL) message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}") diff --git a/cjpeg.c b/cjpeg.c index ed649d21..b7385bff 100644 --- a/cjpeg.c +++ b/cjpeg.c @@ -7,7 +7,7 @@ * Lossless JPEG Modifications: * Copyright (C) 1999, Ken Murchison. * libjpeg-turbo Modifications: - * Copyright (C) 2010, 2013-2014, 2017, 2019-2022, D. R. Commander. + * Copyright (C) 2010, 2013-2014, 2017, 2019-2022, 2024, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -156,9 +156,9 @@ select_file_type(j_compress_ptr cinfo, FILE *infile) static const char *progname; /* program name for error messages */ static char *icc_filename; /* for -icc switch */ static char *outfilename; /* for -outfile switch */ -boolean memdst; /* for -memdst switch */ -boolean report; /* for -report switch */ -boolean strict; /* for -strict switch */ +static boolean memdst; /* for -memdst switch */ +static boolean report; /* for -report switch */ +static boolean strict; /* for -strict switch */ #ifdef CJPEG_FUZZER diff --git a/djpeg.c b/djpeg.c index 4ea5c4bd..fd30a9ed 100644 --- a/djpeg.c +++ b/djpeg.c @@ -5,7 +5,7 @@ * Copyright (C) 1991-1997, Thomas G. Lane. * Modified 2013-2019 by Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2010-2011, 2013-2017, 2019-2020, 2022-2023, D. R. Commander. + * Copyright (C) 2010-2011, 2013-2017, 2019-2020, 2022-2024, D. R. Commander. * Copyright (C) 2015, Google, Inc. * For conditions of distribution and use, see the accompanying README.ijg * file. @@ -84,14 +84,14 @@ static IMAGE_FORMATS requested_fmt; static const char *progname; /* program name for error messages */ static char *icc_filename; /* for -icc switch */ -JDIMENSION max_scans; /* for -maxscans switch */ +static JDIMENSION max_scans; /* for -maxscans switch */ static char *outfilename; /* for -outfile switch */ -boolean memsrc; /* for -memsrc switch */ -boolean report; /* for -report switch */ -boolean skip, crop; -JDIMENSION skip_start, skip_end; -JDIMENSION crop_x, crop_y, crop_width, crop_height; -boolean strict; /* for -strict switch */ +static boolean memsrc; /* for -memsrc switch */ +static boolean report; /* for -report switch */ +static boolean skip, crop; +static JDIMENSION skip_start, skip_end; +static JDIMENSION crop_x, crop_y, crop_width, crop_height; +static boolean strict; /* for -strict switch */ #define INPUT_BUF_SIZE 4096 diff --git a/jerror.c b/jerror.c index d0ab5b88..c12c34fc 100644 --- a/jerror.c +++ b/jerror.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1998, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2022, D. R. Commander. + * Copyright (C) 2022, 2024, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -46,7 +46,7 @@ #define JMESSAGE(code, string) string, -const char * const jpeg_std_message_table[] = { +static const char * const jpeg_std_message_table[] = { #include "jerror.h" NULL }; diff --git a/jpegtran.c b/jpegtran.c index d1552ec7..2857a564 100644 --- a/jpegtran.c +++ b/jpegtran.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1995-2019, Thomas G. Lane, Guido Vollbeding. * libjpeg-turbo Modifications: - * Copyright (C) 2010, 2014, 2017, 2019-2022, D. R. Commander. + * Copyright (C) 2010, 2014, 2017, 2019-2022, 2024, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -35,11 +35,11 @@ static const char *progname; /* program name for error messages */ static char *icc_filename; /* for -icc switch */ -JDIMENSION max_scans; /* for -maxscans switch */ +static JDIMENSION max_scans; /* for -maxscans switch */ static char *outfilename; /* for -outfile switch */ static char *dropfilename; /* for -drop switch */ -boolean report; /* for -report switch */ -boolean strict; /* for -strict switch */ +static boolean report; /* for -report switch */ +static boolean strict; /* for -strict switch */ static JCOPY_OPTION copyoption; /* -copy switch */ static jpeg_transform_info transformoption; /* image transformation options */ diff --git a/tjbench.c b/tjbench.c index bedc94b4..a3592e85 100644 --- a/tjbench.c +++ b/tjbench.c @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2019, 2021-2023 D. R. Commander. All Rights Reserved. + * Copyright (C)2009-2019, 2021-2024 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: @@ -48,8 +48,8 @@ } #define THROW_UNIX(m) THROW(m, strerror(errno)) -char tjErrorStr[JMSG_LENGTH_MAX] = "\0"; -int tjErrorLine = -1, tjErrorCode = -1; +static char tjErrorStr[JMSG_LENGTH_MAX] = "\0"; +static int tjErrorLine = -1, tjErrorCode = -1; #define THROW_TJG() { \ printf("ERROR in line %d\n%s\n", __LINE__, tj3GetErrorStr(NULL)); \ @@ -88,30 +88,31 @@ int tjErrorLine = -1, tjErrorCode = -1; (IS_CROPPED(cr) ? (cr.h != 0 ? cr.h : TJSCALED(height, sf) - cr.y) : \ TJSCALED(height, sf)) -int stopOnWarning = 0, bottomUp = 0, noRealloc = 1, fastUpsample = 0, +static int stopOnWarning = 0, bottomUp = 0, noRealloc = 1, fastUpsample = 0, fastDCT = 0, optimize = 0, progressive = 0, limitScans = 0, maxMemory = 0, maxPixels = 0, arithmetic = 0, lossless = 0, restartIntervalBlocks = 0, restartIntervalRows = 0; -int precision = 8, sampleSize, compOnly = 0, decompOnly = 0, doYUV = 0, +static int precision = 8, sampleSize, compOnly = 0, decompOnly = 0, doYUV = 0, quiet = 0, doTile = 0, pf = TJPF_BGR, yuvAlign = 1, doWrite = 1; -char *ext = "ppm"; -const char *pixFormatStr[TJ_NUMPF] = { +static char *ext = "ppm"; +static const char *pixFormatStr[TJ_NUMPF] = { "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY", "", "", "", "", "CMYK" }; -const char *subNameLong[TJ_NUMSAMP] = { +static const char *subNameLong[TJ_NUMSAMP] = { "4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0", "4:1:1", "4:4:1" }; -const char *csName[TJ_NUMCS] = { +static const char *csName[TJ_NUMCS] = { "RGB", "YCbCr", "GRAY", "CMYK", "YCCK" }; -const char *subName[TJ_NUMSAMP] = { +static const char *subName[TJ_NUMSAMP] = { "444", "422", "420", "GRAY", "440", "411", "441" }; -tjscalingfactor *scalingFactors = NULL, sf = { 1, 1 }; -tjregion cr = { 0, 0, 0, 0 }; -int nsf = 0, xformOp = TJXOP_NONE, xformOpt = 0; -int (*customFilter) (short *, tjregion, tjregion, int, int, tjtransform *); -double benchTime = 5.0, warmup = 1.0; +static tjscalingfactor *scalingFactors = NULL, sf = { 1, 1 }; +static tjregion cr = { 0, 0, 0, 0 }; +static int nsf = 0, xformOp = TJXOP_NONE, xformOpt = 0; +static int (*customFilter) (short *, tjregion, tjregion, int, int, + tjtransform *); +static double benchTime = 5.0, warmup = 1.0; static char *formatName(int subsamp, int cs, char *buf) diff --git a/tjexample.c b/tjexample.c index 1edf30f7..59aa5959 100644 --- a/tjexample.c +++ b/tjexample.c @@ -1,5 +1,5 @@ /* - * Copyright (C)2011-2012, 2014-2015, 2017, 2019, 2021-2023 + * Copyright (C)2011-2012, 2014-2015, 2017, 2019, 2021-2024 * D. R. Commander. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,16 +61,16 @@ #define DEFAULT_QUALITY 95 -const char *subsampName[TJ_NUMSAMP] = { +static const char *subsampName[TJ_NUMSAMP] = { "4:4:4", "4:2:2", "4:2:0", "Grayscale", "4:4:0", "4:1:1", "4:4:1" }; -const char *colorspaceName[TJ_NUMCS] = { +static const char *colorspaceName[TJ_NUMCS] = { "RGB", "YCbCr", "GRAY", "CMYK", "YCCK" }; -tjscalingfactor *scalingFactors = NULL; -int numScalingFactors = 0; +static tjscalingfactor *scalingFactors = NULL; +static int numScalingFactors = 0; /* DCT filter example. This produces a negative of the image. */ diff --git a/tjunittest.c b/tjunittest.c index dcd5006e..3942833a 100644 --- a/tjunittest.c +++ b/tjunittest.c @@ -1,5 +1,5 @@ /* - * Copyright (C)2009-2014, 2017-2019, 2022-2023 D. R. Commander. + * Copyright (C)2009-2014, 2017-2019, 2022-2024 D. R. Commander. * All Rights Reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,29 +83,29 @@ static void usage(char *progName) BAILOUT() \ } -const char *subNameLong[TJ_NUMSAMP] = { +static const char *subNameLong[TJ_NUMSAMP] = { "4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0", "4:1:1", "4:4:1" }; -const char *subName[TJ_NUMSAMP] = { +static const char *subName[TJ_NUMSAMP] = { "444", "422", "420", "GRAY", "440", "411", "441" }; -const char *pixFormatStr[TJ_NUMPF] = { +static const char *pixFormatStr[TJ_NUMPF] = { "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale", "RGBA", "BGRA", "ABGR", "ARGB", "CMYK" }; -const int _3sampleFormats[] = { TJPF_RGB, TJPF_BGR }; -const int _4sampleFormats[] = { +static const int _3sampleFormats[] = { TJPF_RGB, TJPF_BGR }; +static const int _4sampleFormats[] = { TJPF_RGBX, TJPF_BGRX, TJPF_XBGR, TJPF_XRGB, TJPF_CMYK }; -const int _onlyGray[] = { TJPF_GRAY }; -const int _onlyRGB[] = { TJPF_RGB }; +static const int _onlyGray[] = { TJPF_GRAY }; +static const int _onlyRGB[] = { TJPF_RGB }; -int doYUV = 0, lossless = 0, psv = 1, alloc = 0, yuvAlign = 4; -int precision = 8, sampleSize, maxSample, tolerance, redToY, yellowToY; +static int doYUV = 0, lossless = 0, psv = 1, alloc = 0, yuvAlign = 4; +static int precision = 8, sampleSize, maxSample, tolerance, redToY, yellowToY; -int exitStatus = 0; +static int exitStatus = 0; #define BAILOUT() { exitStatus = -1; goto bailout; }