Skip to content

Commit

Permalink
autoconf cleanup, fix -Wextra warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dpirch committed May 1, 2018
1 parent 94e4f48 commit bde19dd
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 276 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ before_install:
- sudo apt-get install libsndfile1-dev

script:
- ./bootstrap
- autoreconf -i
- ./configure
- make DISTCHECK_CONFIGURE_FLAGS='--enable-examples' distcheck
- make distcheck
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ if BUILD_EXAMPLES
endif

SUBDIRS = src $(examples_dir) tests
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-examples
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = bootstrap LICENSE PATENTS README.md tools
EXTRA_DIST = LICENSE PATENTS README.md

# install pkgconfig file
pkgconfigdir = $(libdir)/pkgconfig
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@ from the rest of the WebRTC code. There are currently no changes in
functionality.

## Building and Installing ##
libfvad uses autoconf/automake. After cloning the git repository, the
*configure* script can be generated using `./bootstrap`, afterwards the library
can be build and installed with the usual `./configure`, `make` and
`make install`.
libfvad uses autoconf/automake and can be build and installed with the usual:
```
./configure
make
sudo make install
```

When building from the cloned git repository (instead of a downloaded release),
run `autoreconf -i` to create the missing *configure* script.

An optional example can be enabled enabled by `./configure --enable-examples`.
This requires libsndfile (http://www.mega-nerd.com/libsndfile/, e.g.
`apt install libsndfile1-dev`).

Tests can be run with `make check`.

## Usage ##
The API is documented in the `include/fvad.h` header file.
The API is documented in the `include/fvad.h` header file. See also
`examples/fvadwav.h`.

## Development Notes ##
Recommended CFLAGS to turn on warnings: `-std=c11 -Wall -Wextra -Wpedantic`.
Tests can be run with `make check`.

## Origin ##
### Origin ###
This library largely consists of parts of the WebRTC Native Code package, the
repository of which can be found at
https://chromium.googlesource.com/external/webrtc:
Expand Down
11 changes: 0 additions & 11 deletions bootstrap

This file was deleted.

2 changes: 0 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ AM_INIT_AUTOMAKE([
])

AC_PROG_CC
AX_APPEND_COMPILE_FLAGS([-std=c11 -Wall -Wpedantic])
AC_PROG_CC_STDC

LT_INIT([disable-static pic-only])

Expand Down
2 changes: 1 addition & 1 deletion examples/fvadwav.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static bool process_sf(SNDFILE *infile, Fvad *vad,
goto end;
}

while (sf_read_double(infile, buf0, framelen) == framelen) {
while (sf_read_double(infile, buf0, framelen) == (sf_count_t)framelen) {

// Convert the read samples to int16
for (size_t i = 0; i < framelen; i++)
Expand Down
Empty file added m4/.gitkeep
Empty file.
65 changes: 0 additions & 65 deletions m4/ax_append_compile_flags.m4

This file was deleted.

71 changes: 0 additions & 71 deletions m4/ax_append_flag.m4

This file was deleted.

74 changes: 0 additions & 74 deletions m4/ax_check_compile_flag.m4

This file was deleted.

37 changes: 0 additions & 37 deletions m4/ax_require_defined.m4

This file was deleted.

6 changes: 3 additions & 3 deletions src/fvad.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static int (*const process_funcs[])(VadInstT*, const int16_t*, size_t) = {
};

// valid frame lengths in ms
static const int valid_frame_times[] = { 10, 20, 30 };
static const size_t valid_frame_times[] = { 10, 20, 30 };


struct Fvad {
Expand Down Expand Up @@ -72,7 +72,7 @@ int fvad_set_mode(Fvad* inst, int mode)
int fvad_set_sample_rate(Fvad* inst, int sample_rate)
{
assert(inst);
for (int i = 0; i < arraysize(valid_rates); i++) {
for (size_t i = 0; i < arraysize(valid_rates); i++) {
if (valid_rates[i] * 1000 == sample_rate) {
inst->rate_idx = i;
return 0;
Expand All @@ -85,7 +85,7 @@ int fvad_set_sample_rate(Fvad* inst, int sample_rate)
static bool valid_length(int rate_idx, size_t length)
{
int samples_per_ms = valid_rates[rate_idx];
for (int i = 0; i < arraysize(valid_frame_times); i++) {
for (size_t i = 0; i < arraysize(valid_frame_times); i++) {
if (valid_frame_times[i] * samples_per_ms == length)
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void expect_fail(const char *s, const char *file, int line)
// function to be defined by individual tests
void test_main(void);

int main(int argc, char *argv[])
int main()
{
test_main();
if (expect_failed) exit(2);
Expand Down

0 comments on commit bde19dd

Please sign in to comment.