Fix GCC 9 warnings (#1730)

This commit is contained in:
Peter Johnson
2019-06-30 00:28:32 -07:00
committed by GitHub
parent 60dce66a4f
commit eedb3a1adc
6 changed files with 13 additions and 13 deletions

View File

@@ -956,7 +956,7 @@ json::binary_writer::CharType json::binary_writer::ubjson_prefix(const json& j)
case value_t::number_unsigned:
{
if (j.m_value.number_unsigned <= (std::numeric_limits<int8_t>::max)())
if (j.m_value.number_unsigned <= static_cast<uint64_t>((std::numeric_limits<int8_t>::max)()))
{
return 'i';
}
@@ -964,11 +964,11 @@ json::binary_writer::CharType json::binary_writer::ubjson_prefix(const json& j)
{
return 'U';
}
else if (j.m_value.number_unsigned <= (std::numeric_limits<int16_t>::max)())
else if (j.m_value.number_unsigned <= static_cast<uint64_t>((std::numeric_limits<int16_t>::max)()))
{
return 'I';
}
else if (j.m_value.number_unsigned <= (std::numeric_limits<int32_t>::max)())
else if (j.m_value.number_unsigned <= static_cast<uint64_t>((std::numeric_limits<int32_t>::max)()))
{
return 'l';
}

View File

@@ -191,7 +191,7 @@ typedef struct {
int backend_fd; \
void* pending_queue[2]; \
void* watcher_queue[2]; \
uv__io_t** watchers; \
void** watchers; \
unsigned int nwatchers; \
unsigned int nfds; \
void* wq[2]; \

View File

@@ -794,7 +794,7 @@ static unsigned int next_power_of_two(unsigned int val) {
}
static void maybe_resize(uv_loop_t* loop, unsigned int len) {
uv__io_t** watchers;
void** watchers;
void* fake_watcher_list;
void* fake_watcher_count;
unsigned int nwatchers;
@@ -813,15 +813,15 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
}
nwatchers = next_power_of_two(len + 2) - 2;
watchers = (uv__io_t**)
watchers = (void**)
uv__realloc(loop->watchers, (nwatchers + 2) * sizeof(loop->watchers[0]));
if (watchers == NULL)
abort();
for (i = loop->nwatchers; i < nwatchers; i++)
watchers[i] = NULL;
watchers[nwatchers] = (uv__io_t*)fake_watcher_list;
watchers[nwatchers + 1] = (uv__io_t*)fake_watcher_count;
watchers[nwatchers] = fake_watcher_list;
watchers[nwatchers + 1] = fake_watcher_count;
loop->watchers = watchers;
loop->nwatchers = nwatchers;

View File

@@ -258,7 +258,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
/* Skip invalidated events, see uv__platform_invalidate_fd */
if (fd == -1)
continue;
w = loop->watchers[fd];
w = (uv__io_t*)loop->watchers[fd];
if (w == NULL) {
/* File descriptor that we've stopped watching, disarm it.

View File

@@ -344,8 +344,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
nevents = 0;
assert(loop->watchers != NULL);
loop->watchers[loop->nwatchers] = (uv__io_t*) events;
loop->watchers[loop->nwatchers + 1] = (uv__io_t*) (uintptr_t) nfds;
loop->watchers[loop->nwatchers] = events;
loop->watchers[loop->nwatchers + 1] = (void*) (uintptr_t) nfds;
for (i = 0; i < nfds; i++) {
pe = events + i;
fd = pe->data;
@@ -357,7 +357,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
assert(fd >= 0);
assert((unsigned) fd < loop->nwatchers);
w = loop->watchers[fd];
w = (uv__io_t*)loop->watchers[fd];
if (w == NULL) {
/* File descriptor that we've stopped watching, disarm it.

View File

@@ -129,7 +129,7 @@ int uv_loop_fork(uv_loop_t* loop) {
/* Rearm all the watchers that aren't re-queued by the above. */
for (i = 0; i < loop->nwatchers; i++) {
w = loop->watchers[i];
w = (uv__io_t*)loop->watchers[i];
if (w == NULL)
continue;