Switch to unified view

a/src/utils/debuglog.cpp b/src/utils/debuglog.cpp
...
...
180
    return false;
180
    return false;
181
}
181
}
182
182
183
#ifdef _WINDOWS
183
#ifdef _WINDOWS
184
#include <windows.h>
184
#include <windows.h>
185
static void datestring(char *d) {
185
static void datestring(char *d, int sz) {
186
    SYSTEMTIME buf;
186
    SYSTEMTIME buf;
187
    GetLocalTime(&buf);
187
    GetLocalTime(&buf);
188
    int year = buf.wYear % 100;
188
    int year = buf.wYear % 100;
189
189
190
    sprintf(d, "%02d%02d%02d%02d%02d%02d", year, int(buf.wMonth),
190
    snprintf(d, sz, "%02d%02d%02d%02d%02d%02d", year, int(buf.wMonth),
191
        int(buf.wDay), int(buf.wHour), int(buf.wMinute), int(buf.wSecond));
191
        int(buf.wDay), int(buf.wHour), int(buf.wMinute), int(buf.wSecond));
192
}
192
}
193
#define vsnprintf _vsnprintf
193
#define vsnprintf _vsnprintf
194
194
195
#else // !WINDOWS ->
195
#else // !WINDOWS ->
196
196
197
#include <time.h>
197
#include <time.h>
198
static void datestring(char *d)
198
static void datestring(char *d, int sz)
199
{
199
{
200
    struct tm *tmp;
200
    struct tm *tmp;
201
    time_t tim = time((time_t)0);
201
    time_t tim = time((time_t)0);
202
    tmp = localtime(&tim);
202
    tmp = localtime(&tim);
203
    int year = tmp->tm_year % 100;
203
    int year = tmp->tm_year % 100;
204
    sprintf(d, "%02d%02d%02d%02d%02d%02d", year, tmp->tm_mon+1,
204
    snprintf(d, sz, "%02d%02d%02d%02d%02d%02d", year, tmp->tm_mon+1,
205
        tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
205
        tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
206
}
206
}
207
207
208
#endif // !WINDOWS
208
#endif // !WINDOWS
209
209
...
...
218
    } else {
218
    } else {
219
    fileyes = true;
219
    fileyes = true;
220
    }
220
    }
221
    if (dodate) {
221
    if (dodate) {
222
    char dts[100];
222
    char dts[100];
223
    datestring(dts);
223
    datestring(dts, 100);
224
    writer->put(dts);
224
    writer->put(dts);
225
    }
225
    }
226
    char buf[100];
226
    char buf[100];
227
    sprintf(buf, ":%d:", lev);
227
    sprintf(buf, ":%d:", lev);
228
    writer->put(buf);
228
    writer->put(buf);