From a7830d3bc2a7bcb1f95962241d9e7e08fcae116f Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 20 Jun 2018 16:21:01 +0200 Subject: [PATCH] Fixed few warnings --- ldgm/matrix-gen/matrix-generator.cpp | 1 + ldgm/src/ldgm-session-cpu.cpp | 2 +- rs/fec.c | 5 +++-- src/audio/playback/decklink.cpp | 4 ++-- src/audio/types.cpp | 4 ++-- src/audio/utils.cpp | 6 +++--- src/control_socket.cpp | 2 +- src/main.cpp | 2 +- src/video_decompress/jpeg_to_dxt.cpp | 10 +++++----- src/video_rxtx/rtp.cpp | 4 ++++ 10 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ldgm/matrix-gen/matrix-generator.cpp b/ldgm/matrix-gen/matrix-generator.cpp index 04645a9dc..d6249e526 100644 --- a/ldgm/matrix-gen/matrix-generator.cpp +++ b/ldgm/matrix-gen/matrix-generator.cpp @@ -22,6 +22,7 @@ #include #include "ldpc-matrix.h" +#include "matrix-generator.h" #include "rand_pmms.h" int generate_ldgm_matrix(char *fname, unsigned int k, unsigned int m, unsigned int column_weight, diff --git a/ldgm/src/ldgm-session-cpu.cpp b/ldgm/src/ldgm-session-cpu.cpp index fafc063af..a6e78d102 100644 --- a/ldgm/src/ldgm-session-cpu.cpp +++ b/ldgm/src/ldgm-session-cpu.cpp @@ -53,7 +53,7 @@ static inline void *aligned_malloc(size_t size, size_t alignment) #endif -char* +static char* xor_using_sse (char* source, char* dest, int packet_size) { // int a = 0; diff --git a/rs/fec.c b/rs/fec.c index 7da0844cb..457b244d1 100644 --- a/rs/fec.c +++ b/rs/fec.c @@ -5,6 +5,7 @@ #include "fec.h" #include +#include #include #include #include @@ -412,7 +413,7 @@ init_fec (void) { void fec_free (fec_t *p) { - assert (p != NULL && p->magic == (((FEC_MAGIC ^ p->k) ^ p->n) ^ (unsigned long) (p->enc_matrix))); + assert (p != NULL && p->magic == (((FEC_MAGIC ^ p->k) ^ p->n) ^ (uintptr_t) (p->enc_matrix))); free (p->enc_matrix); free (p); } @@ -431,7 +432,7 @@ fec_new(unsigned short k, unsigned short n) { retval->k = k; retval->n = n; retval->enc_matrix = NEW_GF_MATRIX (n, k); - retval->magic = ((FEC_MAGIC ^ k) ^ n) ^ (unsigned long) (retval->enc_matrix); + retval->magic = ((FEC_MAGIC ^ k) ^ n) ^ (uintptr_t) (retval->enc_matrix); tmp_m = NEW_GF_MATRIX (n, k); /* * fill the matrix with powers of field elements, starting from 0. diff --git a/src/audio/playback/decklink.cpp b/src/audio/playback/decklink.cpp index 622688aee..9db420d45 100644 --- a/src/audio/playback/decklink.cpp +++ b/src/audio/playback/decklink.cpp @@ -148,10 +148,10 @@ static void audio_play_decklink_help(const char *driver_name) result = deckLink->GetModelName(&deviceNameString); if (result == S_OK) { - const char *deviceNameCString = get_cstr_from_bmd_api_str(deviceNameString); + char *deviceNameCString = get_cstr_from_bmd_api_str(deviceNameString); printf("\tdecklink:%d : Blackmagic %s\n",numDevices, deviceNameCString); release_bmd_api_str(deviceNameString); - free((void *)deviceNameCString); + free(deviceNameCString); } // Increment the total number of DeckLink cards found diff --git a/src/audio/types.cpp b/src/audio/types.cpp index 858a4712c..8a6699169 100644 --- a/src/audio/types.cpp +++ b/src/audio/types.cpp @@ -352,8 +352,8 @@ void audio_frame2::resample(audio_frame2_resampler & resampler_state, int new_sa speex_resampler_process_int( (SpeexResamplerState *) resampler_state.resampler, i, - (spx_int16_t *)get_data(i), &in_frames, - (spx_int16_t *)(void *) new_channels[i].data.get(), &write_frames); + (const spx_int16_t *) get_data(i), &in_frames, + (spx_int16_t *) new_channels[i].data.get(), &write_frames); if (in_frames != in_frames_orig) { LOG(LOG_LEVEL_WARNING) << "Audio frame resampler: not all samples resampled!\n"; } diff --git a/src/audio/utils.cpp b/src/audio/utils.cpp index fe8754f03..a9b192250 100644 --- a/src/audio/utils.cpp +++ b/src/audio/utils.cpp @@ -64,7 +64,7 @@ static double get_normalized(const int8_t *in, int bps) { bool negative = false; for (int j = 0; j < bps; ++j) { - sample = (sample | ((((uint8_t *)in)[j]) << (8ull * j))); + sample = (sample | ((((const uint8_t *)in)[j]) << (8ull * j))); } if ((int8_t)(in[bps - 1] < 0)) negative = true; @@ -92,7 +92,7 @@ double calculate_rms(audio_frame2 *frame, int channel, double *peak) int sample_count = frame->get_data_len(channel) / frame->get_bps(); const char *channel_data = frame->get_data(channel); for (size_t i = 0; i < frame->get_data_len(channel); i += frame->get_bps()) { - double val = get_normalized((int8_t *) channel_data + i, frame->get_bps()); + double val = get_normalized((const int8_t *) channel_data + i, frame->get_bps()); sum += val; if (fabs(val) > *peak) { *peak = fabs(val); @@ -104,7 +104,7 @@ double calculate_rms(audio_frame2 *frame, int channel, double *peak) double sumMeanSquare = 0.0; for (size_t i = 0; i < frame->get_data_len(channel); i += frame->get_bps()) { - sumMeanSquare += pow(get_normalized((int8_t *) channel_data + i, frame->get_bps()) + sumMeanSquare += pow(get_normalized((const int8_t *) channel_data + i, frame->get_bps()) - average, 2.0); } diff --git a/src/control_socket.cpp b/src/control_socket.cpp index 3ddae153e..b7b7fa91d 100644 --- a/src/control_socket.cpp +++ b/src/control_socket.cpp @@ -125,7 +125,7 @@ static void send_response(fd_t fd, struct response *resp); static ssize_t write_all(fd_t fd, const void *buf, size_t count) { - char *p = (char *) buf; + const char *p = (const char *) buf; size_t rest = count; ssize_t w = 0; diff --git a/src/main.cpp b/src/main.cpp index 0d1d0e5c8..3b671c30d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -386,7 +386,7 @@ static void *capture_thread(void *arg) return NULL; } -bool parse_audio_capture_format(const char *optarg) +static bool parse_audio_capture_format(const char *optarg) { if (strcmp(optarg, "help") == 0) { printf("Usage:\n"); diff --git a/src/video_decompress/jpeg_to_dxt.cpp b/src/video_decompress/jpeg_to_dxt.cpp index 1611fad7b..827f198f5 100644 --- a/src/video_decompress/jpeg_to_dxt.cpp +++ b/src/video_decompress/jpeg_to_dxt.cpp @@ -178,7 +178,7 @@ static void *worker_thread(void *arg) return NULL; } -void * jpeg_to_dxt_decompress_init(void) +static void * jpeg_to_dxt_decompress_init(void) { struct state_decompress_jpeg_to_dxt *s; @@ -226,7 +226,7 @@ static void flush(struct state_decompress_jpeg_to_dxt *s) * @return 0 to indicate error * otherwise maximal buffer size which ins needed for image of given codec, width, and height */ -int jpeg_to_dxt_decompress_reconfigure(void *state, struct video_desc desc, +static int jpeg_to_dxt_decompress_reconfigure(void *state, struct video_desc desc, int rshift, int gshift, int bshift, int pitch, codec_t out_codec) { struct state_decompress_jpeg_to_dxt *s = (struct state_decompress_jpeg_to_dxt *) state; @@ -303,7 +303,7 @@ static int reconfigure_thread(struct thread_data *s, struct video_desc desc, int return true; } -decompress_status jpeg_to_dxt_decompress(void *state, unsigned char *dst, unsigned char *buffer, +static decompress_status jpeg_to_dxt_decompress(void *state, unsigned char *dst, unsigned char *buffer, unsigned int src_len, int frame_seq) { struct state_decompress_jpeg_to_dxt *s = (struct state_decompress_jpeg_to_dxt *) state; @@ -332,7 +332,7 @@ decompress_status jpeg_to_dxt_decompress(void *state, unsigned char *dst, unsign return DECODER_GOT_FRAME; } -int jpeg_to_dxt_decompress_get_property(void *state, int property, void *val, size_t *len) +static int jpeg_to_dxt_decompress_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); UNUSED(property); @@ -342,7 +342,7 @@ int jpeg_to_dxt_decompress_get_property(void *state, int property, void *val, si return FALSE; } -void jpeg_to_dxt_decompress_done(void *state) +static void jpeg_to_dxt_decompress_done(void *state) { struct state_decompress_jpeg_to_dxt *s = (struct state_decompress_jpeg_to_dxt *) state; diff --git a/src/video_rxtx/rtp.cpp b/src/video_rxtx/rtp.cpp index e7fe34e49..1804c5049 100644 --- a/src/video_rxtx/rtp.cpp +++ b/src/video_rxtx/rtp.cpp @@ -204,6 +204,10 @@ struct response *rtp_video_rxtx::process_sender_message(struct msg_sender *msg, } } break; + case SENDER_MSG_GET_STATUS: + case SENDER_MSG_MUTE: + log_msg(LOG_LEVEL_ERROR, "Unexpected message!\n"); + break; } return new_response(RESPONSE_OK, NULL);