Mercurial > trustbridge
changeset 504:3cf72c5282e8
Redirect errorprintf to output debug string on windows
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 28 Apr 2014 09:19:29 +0000 |
parents | 7f2cb85288d0 |
children | 78959fd970b0 |
files | cinst/windowsstore.c common/logging.h |
diffstat | 2 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/cinst/windowsstore.c Mon Apr 28 09:18:55 2014 +0000 +++ b/cinst/windowsstore.c Mon Apr 28 09:19:29 2014 +0000 @@ -192,6 +192,7 @@ if (!hStore) { + ERRORPRINTF ("Failed to access store.\n"); return ERR_STORE_ACCESS_DENIED; }
--- a/common/logging.h Mon Apr 28 09:18:55 2014 +0000 +++ b/common/logging.h Mon Apr 28 09:19:29 2014 +0000 @@ -81,7 +81,17 @@ * * Prints an error to stderr */ -#define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); +#ifdef WIN32 +# define ERRORPRINTF(fmt, ...) \ + { \ + char buf[512]; \ + snprintf(buf, 511, "ERROR: " fmt, ##__VA_ARGS__); \ + buf[511] = '\0'; \ + OutputDebugStringA(buf); \ + } +#else +# define ERRORPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "ERROR: " fmt, ##__VA_ARGS__); +#endif #define PRINTLASTERROR(msg) \ char *my_error = getLastErrorMsg(); \