Skip to content
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
19 changes: 19 additions & 0 deletions src/spandsp/private/v150_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@
#if !defined(_SPANDSP_PRIVATE_V150_1_H_)
#define _SPANDSP_PRIVATE_V150_1_H_

#if defined(_WIN32)
/* <windows.h> (minwindef.h) defines the legacy 16 bit memory model keywords
"near" and "far" as empty macros. Left in place, they strip the names from
the near and far members of v150_1_state_s, making them anonymous structs.
MSVC then flattens their contents into the enclosing struct, where the two
"parms" members collide (error C2020: 'parms': 'struct' member
redefinition). Both macros are restored at the end of this header, so an
including application keeps whatever it had. */
#pragma push_macro("near")
#pragma push_macro("far")
#undef near
#undef far
#endif

/*
telephone network
^
Expand Down Expand Up @@ -361,5 +375,10 @@ struct v150_1_state_s
logging_state_t logging;
};

#if defined(_WIN32)
#pragma pop_macro("far")
#pragma pop_macro("near")
#endif

#endif
/*- End of file ------------------------------------------------------------*/
8 changes: 8 additions & 0 deletions src/v150_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@

#include "v150_1_local.h"

#if defined(_WIN32)
/* See the note in spandsp/private/v150_1.h. The near and far members of
v150_1_state_t are referenced by name throughout this file, so the
<windows.h> macros of those names must not be in effect here. */
#undef near
#undef far
#endif

/* Terminology

V.150.1 has several components. The terms used for these are:
Expand Down
Loading