Commit 9ee68e63 authored by Andrey Starodubtsev's avatar Andrey Starodubtsev Committed by Mouse

MinGW support

- fixed: format specifiers like PRIu32 or PRIdMAX are defined in
  standard C header `inttypes.h`

- fixed: `_snprintf` is a function introduced by MicroSoft, which isn't
  fully compliant with `snprintf` from C99 (it doesn't support `%zu`,
  for example). `snprintf`/`vsnprintf` are available in MinGW though

- fixed: `_GNU_SOURCE` was added in `fadb26aa`, Aug 23 2017 in attempt
  to enable declaration of GNU extension `vasprintf`. But later in
  `a06b1b4d` and `6bdd8c0a` more correct way of handling this function
  was added - via definition of subsitution if it's absent (e.g. for
  Solaris); so enforcing `_GNU_SOURCE` isn't necessary anymore, and it
  breaks MinGW build.
parent 08ce89bf
#define _GNU_SOURCE
#include <sys/types.h>
#include <stdlib.h>
#include <stdarg.h>
......
......@@ -6,6 +6,7 @@
#include <asn_internal.h>
#include <INTEGER.h>
#include <errno.h>
#include <inttypes.h>
/*
* INTEGER basic type description.
......
......@@ -8,6 +8,7 @@
#include <asn_codecs_prim.h>
#include <limits.h> /* for CHAR_BIT */
#include <errno.h>
#include <inttypes.h>
/*
* OBJECT IDENTIFIER basic type description.
......
......@@ -27,12 +27,15 @@
#include <limits.h> /* For LONG_MAX */
#include <stdarg.h> /* For va_start */
#include <stddef.h> /* for offsetof and ptrdiff_t */
#include <inttypes.h> /* for PRIdMAX */
#ifdef _WIN32
#include <malloc.h>
#ifndef __MINGW32__
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#endif
/* To avoid linking with ws2_32.lib, here's the definition of ntohl() */
#define sys_ntohl(l) ((((l) << 24) & 0xff000000) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment