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

View file

@ -243,7 +243,7 @@ parse_bit_rate(char *optarg, uint32_t *bit_rate) {
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);
return false;
}

View file

@ -103,6 +103,7 @@ sdl_init_and_configure(bool display) {
// <https://stackoverflow.com/a/40693139/1987178>
static int
event_watcher(void *data, SDL_Event *event) {
(void) data;
if (event->type == SDL_WINDOWEVENT
&& event->window.event == SDL_WINDOWEVENT_RESIZED) {
// 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);
uint32_t len = buffer_read32be(&header[8]);
SDL_assert(pts == NO_PTS || (pts & 0x8000000000000000) == 0);
SDL_assert(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);
if (r < len) {
if (r < 0 || ((uint32_t) r) < len) {
av_packet_unref(packet);
return false;
}
packet->pts = pts != NO_PTS ? pts : AV_NOPTS_VALUE;
packet->pts = pts != NO_PTS ? (int64_t) pts : AV_NOPTS_VALUE;
return true;
}

View file

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