Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid redefinition of strcasecmp under mingw-w64 #2106

Merged
merged 8 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,6 @@ are set when opening a binary file on Windows. */
#define _OFF_T_DEFINED
#endif

#ifdef _WIN32
#ifndef strcasecmp
#define strcasecmp _stricmp
#endif

#ifndef strincasecmp
#define strncasecmp _strnicmp
#endif

#ifndef snprintf
#if _MSC_VER<1900
#define snprintf _snprintf
#endif
#endif
#endif


#define strdup _strdup
#define fdopen _fdopen
#define write _write
Expand Down Expand Up @@ -678,21 +661,6 @@ with zip */
/* Define to `unsigned long if <sys/types.h> does not define. */
#cmakedefine uintptr_t unsigned long

/* Define strcasecmp, strncasecmp, snprintf on Win32 systems. */
#ifdef _WIN32
#ifndef HAVE_STRCASECMP
#define strcasecmp _stricmp
#endif

#ifndef HAVE_STRNCASECMP
#define strncasecmp _strnicmp
#endif

#ifndef HAVE_SNPRINTF
#define snprintf _snprintf
#endif
#endif

#cmakedefine WORDS_BIGENDIAN

#include "ncconfigure.h"
Expand Down
10 changes: 0 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1801,16 +1801,6 @@ AC_SUBST(DO_FILTER_TESTS,[$enable_filter_testing])
AC_SUBST(HAVE_BLOSC,[$enable_blosc])
AC_SUBST(HAVE_SZIP,[$enable_szip])

# Include some specifics for netcdf on windows.
#AH_VERBATIM([_WIN32_STRICMP],
AH_BOTTOM(
[/* Define strcasecmp, strncasecmp, snprintf on Win32 systems. */
#ifdef _WIN32
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define snprintf _snprintf
#endif])

# Access netcdf specific version of config.h
AH_BOTTOM([#include "ncconfigure.h"])

Expand Down
1 change: 0 additions & 1 deletion dap4_test/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#define snprintf _snprintf
#endif

#include "netcdf.h"
Expand Down
21 changes: 17 additions & 4 deletions include/ncconfigure.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,32 @@ extern unsigned long long int strtoull(const char*, char**, int);
#endif

#endif /*STDC*/
#endif /*!_WIN32*/

#ifdef _WIN32
#else /*_WIN32*/

#ifndef HAVE_STRLCAT
#define strlcat(d,s,n) strcat_s((d),(n),(s))
#endif
#ifndef HAVE_STRCASECMP


#ifndef __MINGW32__
#ifndef strcasecmp
#define strcasecmp _stricmp
#endif
#ifndef strncasecmp
#define strncasecmp _strnicmp
#endif
#ifndef snprintf
#if _MSC_VER<1900
#define snprintf _snprintf
#endif
#endif
#ifndef fileno
#define fileno(f) _fileno(f)
#endif
#endif
#endif /*__MINGW32__*/

#endif /*_WIN32*/

/* handle null arguments */
#ifndef nulldup
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/ncjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ typedef struct NCJbuf {

/**************************************************/

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#define strdup _strdup
#define strcasecmp _stricmp
#else
Expand Down
2 changes: 1 addition & 1 deletion libdispatch/nclist.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "nclist.h"

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#define strcasecmp _stricmp
#endif

Expand Down
1 change: 0 additions & 1 deletion ncdump/nccopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#define snprintf _snprintf
#endif

#ifdef HAVE_UNISTD_H
Expand Down
1 change: 0 additions & 1 deletion ncdump/ncdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Research/Unidata. See \ref copyright file for more info. */

#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#define snprintf _snprintf
#endif

#ifdef HAVE_UNISTD_H
Expand Down
1 change: 0 additions & 1 deletion ncdump/ncvalidator.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ THIS SOFTWARE.
#if defined(_WIN32) && !defined(__MINGW32__)
#include <io.h>
#include "XGetopt.h"
#define snprintf _snprintf
#endif

#define X_ALIGN 4
Expand Down
6 changes: 1 addition & 5 deletions ncgen/ncgen.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
* $Header: /upc/share/CVS/netcdf-3/ncgen/ncgen.h,v 1.18 2010/06/01 15:34:53 ed Exp $
*********************************************************************/

#ifdef _WIN32
#include <float.h>
#include "isnan.h"
#define strcasecmp _stricmp
#endif
#include "config.h"

#ifdef USE_NETCDF4
#define CLASSICONLY 0
Expand Down
1 change: 0 additions & 1 deletion ncgen3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#if defined(_WIN32) && !defined(__MINGW32__)
#include "XGetopt.h"
#define snprintf _snprintf
#endif

#include "netcdf.h"
Expand Down