Skip to content

Commit

Permalink
Fix warnings with -Wmissing-variable-declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
dcommander committed Mar 6, 2024
1 parent 7bb958b commit 34c0558
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 52 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Expand Up @@ -475,7 +475,7 @@ if(UNIX)
check_c_source_runs("
#include <stdio.h>
#include <stdlib.h>
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 */
Expand All @@ -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\")))")
Expand Down Expand Up @@ -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}")
Expand Down
8 changes: 4 additions & 4 deletions cjpeg.c
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions djpeg.c
Expand Up @@ -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.
Expand Down Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions jerror.c
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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
};
Expand Down
8 changes: 4 additions & 4 deletions jpegtran.c
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 */

Expand Down
31 changes: 16 additions & 15 deletions 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:
Expand Down Expand Up @@ -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)); \
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions 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
Expand Down Expand Up @@ -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. */
Expand Down
22 changes: 11 additions & 11 deletions 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
Expand Down Expand Up @@ -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; }


Expand Down

0 comments on commit 34c0558

Please sign in to comment.