Fix build warnings/errs w/ -DNO_GETENV/-DNO_PUTENV

- 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 #697
This commit is contained in:
DRC
2023-06-16 11:20:15 -04:00
parent 58cbda3e37
commit fcfd2ada75
2 changed files with 8 additions and 2 deletions

View File

@@ -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.
*
@@ -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().
*/

View File

@@ -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:
@@ -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);