Fixed MSVC build

This commit is contained in:
Linus Probert 2018-01-24 19:24:05 +01:00
parent 720ce7fc71
commit 2d05f10a44
2 changed files with 9 additions and 2 deletions

View File

@ -190,7 +190,7 @@ gui_render_panel(Gui *gui, unsigned int width, unsigned int height, Camera *cam)
void
gui_log(const char *fmt, ...)
{
char buffer[log_data.strlen];
char buffer[200];
char *new_message;
unsigned int i;
char tstamp[10];
@ -200,7 +200,7 @@ gui_log(const char *fmt, ...)
#ifndef _MSC_VER
vsprintf(buffer, fmt, args);
#else // _MSC_VER
vsprintf_s(buffer, log_data.strlen, fmt, args);
vsprintf_s(buffer, 200, fmt, args);
#endif // _MSC_VER
va_end(args);

View File

@ -127,7 +127,14 @@ timestamp(char *tstamp, size_t sz)
struct tm *tm_info;
time(&cTime);
#ifndef _MSC_VER
tm_info = localtime(&cTime);
#else // _MSC_VER
tm_info = ec_malloc(sizeof(struct tm));
localtime_s(tm_info, &cTime);
#endif // _MSC_VER
strftime(tstamp, sz, "%H:%M:%S", tm_info);
free(tm_info);
}