Fix warnings on Windows

fix warnings reported with -Dwarning_level=2 on Windows.
This commit is contained in:
Romain Vimont 2019-11-27 13:39:42 +01:00
parent 06104a701b
commit 8dc11a0286
5 changed files with 8 additions and 5 deletions

View file

@ -18,6 +18,7 @@
# define PRIsizet PRIu32 # define PRIsizet PRIu32
# endif # endif
# define PROCESS_NONE NULL # define PROCESS_NONE NULL
# define NO_EXIT_CODE -1u // max value as unsigned
typedef HANDLE process_t; typedef HANDLE process_t;
typedef DWORD exit_code_t; typedef DWORD exit_code_t;
@ -28,6 +29,7 @@
# define PRIsizet "zu" # define PRIsizet "zu"
# define PRIexitcode "d" # define PRIexitcode "d"
# define PROCESS_NONE -1 # define PROCESS_NONE -1
# define NO_EXIT_CODE -1
typedef pid_t process_t; typedef pid_t process_t;
typedef int exit_code_t; typedef int exit_code_t;
@ -35,8 +37,6 @@
#include "config.h" #include "config.h"
# define NO_EXIT_CODE -1
enum process_result { enum process_result {
PROCESS_SUCCESS, PROCESS_SUCCESS,
PROCESS_ERROR_GENERIC, PROCESS_ERROR_GENERIC,

View file

@ -243,7 +243,7 @@ parse_bit_rate(char *optarg, uint32_t *bit_rate) {
return false; return false;
} }
} }
if (value < 0 || ((uint32_t) -1) / mul < value) { if (value < 0 || ((uint32_t) -1) / mul < (unsigned long) value) {
LOGE("Bitrate must be positive and less than 2^32: %s", optarg); LOGE("Bitrate must be positive and less than 2^32: %s", optarg);
return false; return false;
} }

View file

@ -103,6 +103,7 @@ sdl_init_and_configure(bool display) {
// <https://stackoverflow.com/a/40693139/1987178> // <https://stackoverflow.com/a/40693139/1987178>
static int static int
event_watcher(void *data, SDL_Event *event) { event_watcher(void *data, SDL_Event *event) {
(void) data;
if (event->type == SDL_WINDOWEVENT if (event->type == SDL_WINDOWEVENT
&& event->window.event == SDL_WINDOWEVENT_RESIZED) { && event->window.event == SDL_WINDOWEVENT_RESIZED) {
// called from another thread, not very safe, but it's a workaround! // called from another thread, not very safe, but it's a workaround!

View file

@ -44,6 +44,7 @@ stream_recv_packet(struct stream *stream, AVPacket *packet) {
uint64_t pts = buffer_read64be(header); uint64_t pts = buffer_read64be(header);
uint32_t len = buffer_read32be(&header[8]); uint32_t len = buffer_read32be(&header[8]);
SDL_assert(pts == NO_PTS || (pts & 0x8000000000000000) == 0);
SDL_assert(len); SDL_assert(len);
if (av_new_packet(packet, len)) { if (av_new_packet(packet, len)) {
@ -52,12 +53,12 @@ stream_recv_packet(struct stream *stream, AVPacket *packet) {
} }
r = net_recv_all(stream->socket, packet->data, len); r = net_recv_all(stream->socket, packet->data, len);
if (r < len) { if (r < 0 || ((uint32_t) r) < len) {
av_packet_unref(packet); av_packet_unref(packet);
return false; return false;
} }
packet->pts = pts != NO_PTS ? pts : AV_NOPTS_VALUE; packet->pts = pts != NO_PTS ? (int64_t) pts : AV_NOPTS_VALUE;
return true; return true;
} }

View file

@ -20,6 +20,7 @@ build_cmd(char *cmd, size_t len, const char *const argv[]) {
enum process_result enum process_result
cmd_execute(const char *path, const char *const argv[], HANDLE *handle) { cmd_execute(const char *path, const char *const argv[], HANDLE *handle) {
(void) path;
STARTUPINFOW si; STARTUPINFOW si;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si)); memset(&si, 0, sizeof(si));