Minor Win vs Linux bugg

This commit is contained in:
Linus_Probert 2018-01-25 08:45:57 +01:00
parent cdefa1e737
commit 574e34ce4b
2 changed files with 7 additions and 5 deletions

View File

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

View File

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