Skip to content

Commit 26816c6

Browse files
committed
Fix compiler warnings
1 parent b8687bf commit 26816c6

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

src/tX_audiodevice.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ void tX_audiodevice_oss ::play(int16_t* buffer) {
198198
int tX_audiodevice_alsa ::open() {
199199
snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
200200
snd_pcm_hw_params_t* hw_params;
201-
char pcm_name[64];
201+
char pcm_name[4097];
202202
char* pos;
203203

204-
strncpy(pcm_name, globals.alsa_device_id, sizeof(pcm_name));
204+
strncpy(pcm_name, globals.alsa_device_id, sizeof(pcm_name) - 1);
205205
if ((pos = strchr(pcm_name, '#')) != NULL)
206206
*pos = 0;
207207

src/tX_audiofile.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "tX_endian.h"
3333
#include "tX_loaddlg.h"
3434
#include "wav_file.h"
35+
#include <cstdint>
3536
#include <malloc.h>
3637
#include <string.h>
3738

@@ -754,13 +755,14 @@ tX_audio_error tx_audiofile::load_af() {
754755
}
755756

756757
/* shorten to the actually read size of samples */
757-
if (!realloc(data, frames_read * 2)) {
758+
int16_t* new_data = (int16_t*)realloc(data, frames_read * 2);
759+
if (!new_data) {
758760
if (data)
759761
free(data);
760762
return TX_AUDIO_ERR_ALLOC;
761763
}
762764

763-
mem = data;
765+
mem = new_data;
764766
no_samples = frames_read;
765767

766768
return TX_AUDIO_SUCCESS;

src/tX_ladspa.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void LADSPA_Plugin ::init() {
4646
tX_warning("LADSPA_PATH not set. Trying /usr/lib/ladspa:/usr/local/lib/ladspa");
4747
strcpy(ladspa_path, "/usr/lib/ladspa:/usr/local/lib/ladspa");
4848
} else
49-
strncpy(ladspa_path, ladspa_path_ptr, sizeof(ladspa_path));
49+
strncpy(ladspa_path, ladspa_path_ptr, sizeof(ladspa_path) - 1);
5050

5151
/* Scanning every dir in path */
5252
start = ladspa_path;

src/tX_maingui.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ void load_tt_part(char* buffer) {
311311
#endif
312312
turn_audio_off();
313313

314-
strncpy(globals.tables_filename, buffer, sizeof(globals.tables_filename));
314+
strncpy(globals.tables_filename, buffer, sizeof(globals.tables_filename) - 1);
315315

316316
doc = xmlParseFile(buffer);
317317
if (doc) {

src/tX_vtt.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,6 @@ void vtt_class ::calc_speed() {
650650
}
651651

652652
void vtt_class ::render_scratch() {
653-
int16_t* ptr;
654-
655653
int sample;
656654

657655
d_prec pos_a_f;
@@ -1646,7 +1644,7 @@ void vtt_class ::effect_move(vtt_fx* effect, int pos) {
16461644
if (pos == 0) {
16471645
list->remove(effect);
16481646
list->push_front(effect);
1649-
} else if (pos == list->size() - 1) {
1647+
} else if (pos == ((int)list->size()) - 1) {
16501648
list->remove(effect);
16511649
list->push_back(effect);
16521650
} else {

src/tX_vtt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ class vtt_class {
343343
}
344344

345345
int16_t get_sample(int sample) {
346-
if (sample >= samples_in_buffer) {
346+
if (sample >= (int)samples_in_buffer) {
347347
if (loop) {
348348
// sample %= samples_in_buffer;
349-
while (sample >= samples_in_buffer) {
349+
while (sample >= (int)samples_in_buffer) {
350350
sample -= samples_in_buffer;
351351
}
352352
} else {

src/tX_vttgui.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,6 @@ void build_vtt_gui(vtt_class* vtt) {
835835
gtk_widget_show(tempbox);
836836
gtk_box_pack_start(GTK_BOX(tempbox2), tempbox, WID_DYN);
837837

838-
GtkWidget* pixmap;
839838
g->audio_minimize = create_top_button(MINIMIZE);
840839
gtk_box_pack_end(GTK_BOX(tempbox2), g->audio_minimize, WID_FIX);
841840
gtk_widget_show(g->audio_minimize);

0 commit comments

Comments
 (0)