Skip to content

Commit 3ac9a04

Browse files
committed
Fix MinGW warnings, push to 1.3.0
1 parent a2d0b06 commit 3ac9a04

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/core/logger.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <stdarg.h>
77
#include <stdio.h>
88
#include <stdlib.h> // getenv
9+
#include <time.h>
910
#ifndef _WIN32
1011
#include <unistd.h>
1112
#endif
@@ -86,7 +87,7 @@ void Logger::doLogStartup()
8687
{
8788
time_t timestamp_now = time(NULL);
8889
struct tm *tm_info = localtime(&timestamp_now);
89-
printf("Time: %lu | %s", timestamp_now, asctime(tm_info));
90+
printf("Time: %zu | %s", timestamp_now, asctime(tm_info));
9091

9192
startup_time = timestamp_now;
9293

@@ -134,7 +135,7 @@ void Logger::operator()(LogLevel ll, const char *fmt, ...)
134135

135136
time_t timestamp_now = time(NULL);
136137
if (1) {
137-
fprintf(stream, "%4lu", timestamp_now - startup_time);
138+
fprintf(stream, "%4zu", timestamp_now - startup_time);
138139
} else {
139140
// Print current time
140141
struct tm *tm_info = localtime(&timestamp_now);

src/core/script/script_environment.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ int Script::l_register_event(lua_State *L)
8181
MESSY_CPP_EXCEPTIONS_START
8282
Script *script = get_script(L);
8383

84-
int event_id = luaL_checkinteger(L, 1);
84+
int event_id_raw = luaL_checkinteger(L, 1);
85+
uint16_t event_id = (uint16_t)event_id_raw;
86+
if (event_id_raw != event_id || event_id_raw == UINT16_MAX)
87+
luaL_error(L, "event id=%d is out of range", event_id);
88+
8589
(void)luaL_checkinteger(L, 2); // flags (TODO)
8690

8791
auto &defs = script->m_emgr->getDefs();

src/core/script/scriptevent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ScriptEvent::ScriptEvent(u16 event_id)
2121

2222
ScriptEvent::ScriptEvent(ScriptEvent &&other)
2323
{
24-
std::swap(event_id, other.event_id);
24+
event_id = other.event_id;
2525
std::swap(data, other.data);
2626
}
2727

src/version.cpp.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
const char *VERSION_STRING = "OpenEdits v1.2.2-${GIT_SHA1} (${CMAKE_BUILD_TYPE})";
2+
const char *VERSION_STRING = "OpenEdits v1.3.0-${GIT_SHA1} (${CMAKE_BUILD_TYPE})";

0 commit comments

Comments
 (0)