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
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,7 @@ extern
|
|||
void sharedbitsprivInternalError(const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#ifndef sharedbitsNoVsnprintf
|
||||
#ifdef sharedbitsStatic
|
||||
sharedbitsStatic
|
||||
#endif
|
||||
|
@ -35,6 +36,7 @@ int sharedbitsPrefixName(Vsnprintf)(char *s, size_t n, const char *fmt, va_list
|
|||
return vsnprintf(s, n, fmt, ap);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef sharedbitsStatic
|
||||
sharedbitsStatic
|
||||
|
|
|
@ -64,5 +64,6 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
printf("PASS\n");
|
||||
fflush(stdout); // AddressSanitizer can chop the tail end of the output for whatever reason
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,10 +23,8 @@ static char caseErrorEncodingError[] = "encoding error while handling other case
|
|||
|
||||
#define sharedbitsPrefix priv
|
||||
#define sharedbitsStatic static
|
||||
#include "../../sharedbits/strsafe_impl.h"
|
||||
#undef sharedbitsStatic
|
||||
#undef sharedbitsPrefix
|
||||
|
||||
// do this conditionally to avoid warnings on non-Windows
|
||||
#ifdef _WIN32
|
||||
static void privInternalError(const char *fmt, ...)
|
||||
{
|
||||
va_list ap, ap2;
|
||||
|
@ -50,6 +48,17 @@ static void privInternalError(const char *fmt, ...)
|
|||
privVsnprintf(caseError, n + 1, fmt, 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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue