Skip to content

Commit

Permalink
Fix build warnings/errs w/ -DNO_GETENV/-DNO_PUTENV
Browse files Browse the repository at this point in the history
- strtest.c: Fix unused variable warnings if both -DNO_GETENV and
  -DNO_PUTENV are specified or if only -DNO_GETENV is specified.

- jinclude.h: Fix build error if only -DNO_GETENV is specified.

Fixes libjpeg-turbo#697
  • Loading branch information
dcommander committed Jun 16, 2023
1 parent 65a85ce commit c27695a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion jinclude.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1994, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2022, D. R. Commander.
* Copyright (C) 2022-2023, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
Expand Down Expand Up @@ -123,6 +123,8 @@ static INLINE int GETENV_S(char *buffer, size_t buffer_size, const char *name)

#else

#include <errno.h>

/* This provides a similar interface to the Microsoft _putenv_s() function, but
* other than parameter validation, it has no advantages over setenv().
*/
Expand Down
6 changes: 5 additions & 1 deletion strtest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C)2022 D. R. Commander. All Rights Reserved.
* Copyright (C)2022-2023 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 @@ -55,8 +55,12 @@ void invalid_parameter_handler(const wchar_t *expression,

int main(int argc, char **argv)
{
#if !defined(NO_GETENV) || !defined(NO_PUTENV)
int err;
#endif
#ifndef NO_GETENV
char env[3];
#endif

#ifdef _MSC_VER
_set_invalid_parameter_handler(invalid_parameter_handler);
Expand Down

0 comments on commit c27695a

Please sign in to comment.