Fixed build errors on other platforms. This is a headache and a half :D I should split the files into strsafe_vsnprintf and strsafe_strncpy, but I want to share this file as is in one piece for now.
This commit is contained in:
parent
a17b7c8c14
commit
7d0f8403ab
|
@ -1,5 +1,7 @@
|
||||||
// 19 april 2019
|
// 19 april 2019
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,6 +15,7 @@ extern
|
||||||
void sharedbitsprivInternalError(const char *fmt, ...);
|
void sharedbitsprivInternalError(const char *fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef sharedbitsNoVsnprintf
|
||||||
#ifdef sharedbitsStatic
|
#ifdef sharedbitsStatic
|
||||||
sharedbitsStatic
|
sharedbitsStatic
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,6 +36,7 @@ int sharedbitsPrefixName(Vsnprintf)(char *s, size_t n, const char *fmt, va_list
|
||||||
return vsnprintf(s, n, fmt, ap);
|
return vsnprintf(s, n, fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef sharedbitsStatic
|
#ifdef sharedbitsStatic
|
||||||
sharedbitsStatic
|
sharedbitsStatic
|
||||||
|
|
|
@ -64,5 +64,6 @@ int main(int argc, char *argv[])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
printf("PASS\n");
|
printf("PASS\n");
|
||||||
|
fflush(stdout); // AddressSanitizer can chop the tail end of the output for whatever reason
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,8 @@ static char caseErrorEncodingError[] = "encoding error while handling other case
|
||||||
|
|
||||||
#define sharedbitsPrefix priv
|
#define sharedbitsPrefix priv
|
||||||
#define sharedbitsStatic static
|
#define sharedbitsStatic static
|
||||||
#include "../../sharedbits/strsafe_impl.h"
|
// do this conditionally to avoid warnings on non-Windows
|
||||||
#undef sharedbitsStatic
|
#ifdef _WIN32
|
||||||
#undef sharedbitsPrefix
|
|
||||||
|
|
||||||
static void privInternalError(const char *fmt, ...)
|
static void privInternalError(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap, ap2;
|
va_list ap, ap2;
|
||||||
|
@ -50,6 +48,17 @@ static void privInternalError(const char *fmt, ...)
|
||||||
privVsnprintf(caseError, n + 1, fmt, ap);
|
privVsnprintf(caseError, n + 1, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define sharedbitsInternalError
|
||||||
|
#define sharedbitsNoVsnprintf
|
||||||
|
#endif
|
||||||
|
#include "../../sharedbits/strsafe_impl.h"
|
||||||
|
#ifndef _WIN32
|
||||||
|
#undef sharedbitsNoVsnprintf
|
||||||
|
#undef sharedbitsInternalError
|
||||||
|
#endif
|
||||||
|
#undef sharedbitsStatic
|
||||||
|
#undef sharedbitsPrefix
|
||||||
|
|
||||||
static void catalogProgrammerError(const char *prefix, const char *msg, const char *suffix, bool internal)
|
static void catalogProgrammerError(const char *prefix, const char *msg, const char *suffix, bool internal)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue