Commit f3f4b332 authored by Max Kellermann's avatar Max Kellermann

event/MultiSocketMonitor: use uint64_t instead of gint64

Unsigned and portable.
parent 84ac79bb
...@@ -43,7 +43,7 @@ MultiSocketMonitor::MultiSocketMonitor(EventLoop &_loop) ...@@ -43,7 +43,7 @@ MultiSocketMonitor::MultiSocketMonitor(EventLoop &_loop)
:loop(_loop), :loop(_loop),
source((Source *)g_source_new(&multi_socket_monitor_source_funcs, source((Source *)g_source_new(&multi_socket_monitor_source_funcs,
sizeof(*source))), sizeof(*source))),
absolute_timeout_us(G_MAXINT64) { absolute_timeout_us(-1) {
source->monitor = this; source->monitor = this;
g_source_attach(&source->base, loop.GetContext()); g_source_attach(&source->base, loop.GetContext());
...@@ -61,8 +61,8 @@ MultiSocketMonitor::Prepare(gint *timeout_r) ...@@ -61,8 +61,8 @@ MultiSocketMonitor::Prepare(gint *timeout_r)
{ {
int timeout_ms = *timeout_r = PrepareSockets(); int timeout_ms = *timeout_r = PrepareSockets();
absolute_timeout_us = timeout_ms < 0 absolute_timeout_us = timeout_ms < 0
? G_MAXINT64 ? uint64_t(-1)
: GetTime() + gint64(timeout_ms) * 1000; : GetTime() + uint64_t(timeout_ms) * 1000;
return false; return false;
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <forward_list> #include <forward_list>
#include <assert.h> #include <assert.h>
#include <stdint.h>
#ifdef WIN32 #ifdef WIN32
/* ERRORis a WIN32 macro that poisons our namespace; this is a /* ERRORis a WIN32 macro that poisons our namespace; this is a
...@@ -52,7 +53,7 @@ class MultiSocketMonitor { ...@@ -52,7 +53,7 @@ class MultiSocketMonitor {
EventLoop &loop; EventLoop &loop;
Source *source; Source *source;
gint64 absolute_timeout_us; uint64_t absolute_timeout_us;
std::forward_list<GPollFD> fds; std::forward_list<GPollFD> fds;
public: public:
...@@ -69,7 +70,7 @@ public: ...@@ -69,7 +70,7 @@ public:
} }
gcc_pure gcc_pure
gint64 GetTime() const { uint64_t GetTime() const {
return g_source_get_time(&source->base); return g_source_get_time(&source->base);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment