ref: f140e52941bed2b902411f6eab0804c81fd4a072
parent: c2dcae88e6254da3da1af1957a41b9dd3b9bc8d2
author: Mans Rullgard <mans@mansr.com>
date: Mon Jul 20 09:00:00 EDT 2020
examples: silence compiler warnings
--- a/src/example0.c
+++ b/src/example0.c
@@ -43,12 +43,12 @@
assert(sox_init() == SOX_SUCCESS);
/* Open the input file (with default parameters) */
- assert(in = sox_open_read(argv[1], NULL, NULL, NULL));
+ assert((in = sox_open_read(argv[1], NULL, NULL, NULL)));
/* Open the output file; we must specify the output signal characteristics.
* Since we are using only simple effects, they are the same as the input
* file characteristics */
- assert(out = sox_open_write(argv[2], &in->signal, NULL, NULL, NULL, NULL));
+ assert((out = sox_open_write(argv[2], &in->signal, NULL, NULL, NULL, NULL)));
/* Create an effects chain; some effects need to know about the input
* or output file encoding so we provide that information here */
--- a/src/example1.c
+++ b/src/example1.c
@@ -115,12 +115,12 @@
assert(sox_init() == SOX_SUCCESS);
/* Open the input file (with default parameters) */
- assert(in = sox_open_read(argv[1], NULL, NULL, NULL));
+ assert((in = sox_open_read(argv[1], NULL, NULL, NULL)));
/* Open the output file; we must specify the output signal characteristics.
* Since we are using only simple effects, they are the same as the input
* file characteristics */
- assert(out = sox_open_write(argv[2], &in->signal, NULL, NULL, NULL, NULL));
+ assert((out = sox_open_write(argv[2], &in->signal, NULL, NULL, NULL, NULL)));
/* Create an effects chain; some effects need to know about the input
* or output file encoding so we provide that information here */
--- a/src/example2.c
+++ b/src/example2.c
@@ -50,7 +50,7 @@
++argv, --argc; /* Move to 1st parameter */
/* Open the input file (with default parameters) */
- assert(in = sox_open_read(*argv, NULL, NULL, NULL));
+ assert((in = sox_open_read(*argv, NULL, NULL, NULL)));
++argv, --argc; /* Move past this parameter */
if (argc) { /* If given, read the start time: */
@@ -75,7 +75,7 @@
/* Make sure that this is at a `wide sample' boundary: */
block_size -= block_size % in->signal.channels;
/* Allocate a block of memory to store the block of audio samples: */
- assert(buf = malloc(sizeof(sox_sample_t) * block_size));
+ assert((buf = malloc(sizeof(sox_sample_t) * block_size)));
/* This example program requires that the audio has precisely 2 channels: */
assert(in->signal.channels == 2);
--- a/src/example3.c
+++ b/src/example3.c
@@ -65,9 +65,9 @@
sox_globals.verbosity = 1;
assert(sox_init() == SOX_SUCCESS);
- assert(in = sox_open_read(argv[1], NULL, NULL, NULL));
+ assert((in = sox_open_read(argv[1], NULL, NULL, NULL)));
/* Change "alsa" in this line to use an alternative audio device driver: */
- assert(out= sox_open_write("default", &in->signal, NULL, "alsa", NULL, NULL));
+ assert((out= sox_open_write("default", &in->signal, NULL, "alsa", NULL, NULL)));
chain = sox_create_effects_chain(&in->encoding, &out->encoding);
--- a/src/example5.c
+++ b/src/example5.c
@@ -57,11 +57,11 @@
assert(sox_init() == SOX_SUCCESS);
/* Open the input file (with default parameters) */
- assert(in = sox_open_read(argv[1], NULL, NULL, NULL));
+ assert((in = sox_open_read(argv[1], NULL, NULL, NULL)));
#if defined FIXED_BUFFER
- assert(out = sox_open_mem_write(buffer, buffer_size, &in->signal, NULL, "sox", NULL));
+ assert((out = sox_open_mem_write(buffer, buffer_size, &in->signal, NULL, "sox", NULL)));
#else
- assert(out = sox_open_memstream_write(&buffer, &buffer_size, &in->signal, NULL, "sox", NULL));
+ assert((out = sox_open_memstream_write(&buffer, &buffer_size, &in->signal, NULL, "sox", NULL)));
#endif
while ((number_read = sox_read(in, samples, MAX_SAMPLES)))
assert(sox_write(out, samples, number_read) == number_read);
@@ -68,8 +68,8 @@
sox_close(out);
sox_close(in);
- assert(in = sox_open_mem_read(buffer, buffer_size, NULL, NULL, NULL));
- assert(out = sox_open_write(argv[2], &in->signal, NULL, NULL, NULL, NULL));
+ assert((in = sox_open_mem_read(buffer, buffer_size, NULL, NULL, NULL)));
+ assert((out = sox_open_write(argv[2], &in->signal, NULL, NULL, NULL, NULL)));
while ((number_read = sox_read(in, samples, MAX_SAMPLES)))
assert(sox_write(out, samples, number_read) == number_read);
sox_close(out);
--- a/src/example6.c
+++ b/src/example6.c
@@ -86,8 +86,8 @@
assert(argc == 3);
assert(sox_init() == SOX_SUCCESS);
- assert(in = sox_open_read(argv[1], NULL, NULL, NULL));
- assert(out = sox_open_write(argv[2], &out_signal, &out_encoding, NULL, NULL, NULL));
+ assert((in = sox_open_read(argv[1], NULL, NULL, NULL)));
+ assert((out = sox_open_write(argv[2], &out_signal, &out_encoding, NULL, NULL, NULL)));
chain = sox_create_effects_chain(&in->encoding, &out->encoding);