From b97dc5ffda4b33539befcff709d35a78d326047c Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 12 May 2021 15:32:56 +0200 Subject: [PATCH] Fixed some Windows warnings --- src/audio/audio.cpp | 2 +- src/keyboard_control.cpp | 24 ++++++++++++------------ src/video_capture/decklink.cpp | 2 +- src/video_capture/testcard.cpp | 2 +- src/video_display/gl.cpp | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index d00df038d..9cd10cea6 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -614,7 +614,7 @@ static void audio_update_recv_buf(struct state_audio *s, size_t curr_frame_len) if (new_size > s->recv_buf_size) { s->recv_buf_size = new_size; - debug_msg("[Audio receiver] Recv buffer adjusted to %zd\n", new_size); + debug_msg("[Audio receiver] Recv buffer adjusted to %zu\n", new_size); rtp_set_recv_buf(s->audio_network_device, s->recv_buf_size); } } diff --git a/src/keyboard_control.cpp b/src/keyboard_control.cpp index 35bd550bc..b5bb81515 100644 --- a/src/keyboard_control.cpp +++ b/src/keyboard_control.cpp @@ -213,18 +213,6 @@ void keyboard_control::stop() #define GETCH getch #endif -/* - * Input must be 0x80-0xff - */ -static int count_utf8_bytes(unsigned int i) { - int count = 0; - while ((i & 0x80) != 0u) { - count++; - i <<= 1; - } - return count; -} - #define CHECK_EOF(x) do { if (x == EOF) { LOG(LOG_LEVEL_WARNING) << MOD_NAME "Unexpected EOF detected!\n"; return EOF; } } while(0) /** @@ -273,6 +261,18 @@ static int64_t get_ansi_code() { } #ifndef WIN32 +/* + * Input must be 0x80-0xff + */ +static int count_utf8_bytes(unsigned int i) { + int count = 0; + while ((i & 0x80) != 0u) { + count++; + i <<= 1; + } + return count; +} + static int64_t get_utf8_code(int c) { if (c < 0xc0) { LOG(LOG_LEVEL_WARNING) << MOD_NAME "Wrong UTF sequence!\n"; diff --git a/src/video_capture/decklink.cpp b/src/video_capture/decklink.cpp index 9a043eacd..1106c4358 100644 --- a/src/video_capture/decklink.cpp +++ b/src/video_capture/decklink.cpp @@ -1565,7 +1565,7 @@ static audio_frame *process_new_audio_packets(struct vidcap_decklink_state *s) { LOG(LOG_LEVEL_WARNING) << "[DeckLink] Audio frame too small!\n"; } } else { - if (s->audio.data_len + audioPacket->GetSampleFrameCount() * s->audio.ch_count * s->audio.bps <= static_cast(s->audio.max_size)) { + if (s->audio.data_len + audioPacket->GetSampleFrameCount() * s->audio.ch_count * s->audio.bps <= s->audio.max_size) { memcpy(s->audio.data + s->audio.data_len, audioFrame, audioPacket->GetSampleFrameCount() * s->audio.ch_count * s->audio.bps); s->audio.data_len = min(s->audio.data_len + audioPacket->GetSampleFrameCount() * s->audio.ch_count * s->audio.bps, INT_MAX); } else { diff --git a/src/video_capture/testcard.cpp b/src/video_capture/testcard.cpp index 17df277c3..d4c823eb9 100644 --- a/src/video_capture/testcard.cpp +++ b/src/video_capture/testcard.cpp @@ -435,7 +435,7 @@ static int vidcap_testcard_init(struct vidcap_params *params, void **state) assert(filesize >= 0); fseek(in, 0L, SEEK_SET); - if (s->frame->tiles[0].data_len != filesize) { + if (s->frame->tiles[0].data_len != static_cast(filesize)) { int level = s->frame->tiles[0].data_len < filesize ? LOG_LEVEL_WARNING : LOG_LEVEL_ERROR; LOG(level) << MOD_NAME << "Wrong file size for selected " "resolution and codec. File size " << filesize << ", " diff --git a/src/video_display/gl.cpp b/src/video_display/gl.cpp index f001b2f75..5293b83fd 100644 --- a/src/video_display/gl.cpp +++ b/src/video_display/gl.cpp @@ -677,7 +677,7 @@ static void screenshot(struct video_frame *frame) time_ptr = &time_tmp; #endif - strftime(name, sizeof(name), "screenshot-%a, %d %b %Y %T %z.pnm", + strftime(name, sizeof(name), "screenshot-%a, %d %b %Y %H:%M:%S %z.pnm", time_ptr); if (save_video_frame_as_pnm(frame, name)) { log_msg(LOG_LEVEL_NOTICE, MOD_NAME "Generated screenshot \"%s\".\n", name);