use glibc strlcpy and strlcat with glibc2.38 and above
also silences warnings related to this
This commit is contained in:
parent
9a15f21236
commit
5a0740803c
2 changed files with 11 additions and 2 deletions
|
|
@ -130,6 +130,15 @@ char *strcasestr(const char *in, const char *what);
|
|||
#define HAVE_DOSSTR_FUNCS
|
||||
#endif
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#define SRB2_HAVE_STRLCPY
|
||||
#elif defined (__GLIBC_PREREQ)
|
||||
// glibc 2.38: added strlcpy and strlcat to _DEFAULT_SOURCE
|
||||
#if __GLIBC_PREREQ(2, 38)
|
||||
#define SRB2_HAVE_STRLCPY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_DOSSTR_FUNCS
|
||||
int strupr(char *n); // from dosstr.c
|
||||
int strlwr(char *n); // from dosstr.c
|
||||
|
|
@ -137,7 +146,7 @@ int strlwr(char *n); // from dosstr.c
|
|||
|
||||
#include <stddef.h> // for size_t
|
||||
|
||||
#ifndef __APPLE__
|
||||
#ifndef SRB2_HAVE_STRLCPY
|
||||
#ifndef __cplusplus
|
||||
size_t strlcat(char *dst, const char *src, size_t siz);
|
||||
size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include <string.h>
|
||||
#include "doomdef.h"
|
||||
|
||||
#if !defined (__APPLE__)
|
||||
#ifndef SRB2_HAVE_STRLCPY
|
||||
|
||||
// Like the OpenBSD version, but it doesn't check for src not being a valid
|
||||
// C string.
|
||||
|
|
|
|||
Loading…
Reference in a new issue