1
0
mirror of http://mpg123.de/trunk/.git synced 2025-10-23 16:48:31 +03:00

various fixes, standards conformance, compiler pedantism, plain little screwups

git-svn-id: svn://scm.orgis.org/mpg123/trunk@3867 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
thor
2015-09-10 18:44:20 +00:00
parent c6a271b3bc
commit a0f0686164
9 changed files with 20 additions and 17 deletions

View File

@@ -117,11 +117,9 @@ long brate(struct ratepair *table, long arate, int count, int *last)
void audio_capabilities(out123_handle *ao, mpg123_handle *mh) void audio_capabilities(out123_handle *ao, mpg123_handle *mh)
{ {
int force_fmt = 0; int force_fmt = 0;
int fmts;
size_t ri; size_t ri;
/* Pitching introduces a difference between decoder rate and playback rate. */ /* Pitching introduces a difference between decoder rate and playback rate. */
long rate, decode_rate; long decode_rate;
int channels;
const long *rates; const long *rates;
long *outrates; long *outrates;
struct ratepair *unpitch; struct ratepair *unpitch;

View File

@@ -7,6 +7,14 @@
reworked by Thomas Orgis - it was the entry point for eventually becoming maintainer... reworked by Thomas Orgis - it was the entry point for eventually becoming maintainer...
*/ */
#include "config.h"
/* _BSD_SOURCE needed for setlinebuf, erm, but that's deprecated
so trying _DEFAULT_SOURCE */
#ifndef _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#endif
#include "compat.h"
#include "mpg123app.h" #include "mpg123app.h"
#include "out123.h" #include "out123.h"
#include <stdarg.h> #include <stdarg.h>

View File

@@ -97,7 +97,7 @@ static int performoption (int argc, char *argv[], topt *opt)
} }
if (opt->func) if (opt->func)
opt->func(loptarg); opt->func(loptarg);
debug4("result: %i (%p, %i, %i)", result, opt->var, opt->value, opt->sname); debug4("result: %i (%p, %li, %i)", result, opt->var, opt->value, opt->sname);
return (result); return (result);
} }

View File

@@ -274,6 +274,7 @@ int buffer_formats( out123_handle *ao, const long *rates, int ratecount
, struct mpg123_fmt **fmtlist ) , struct mpg123_fmt **fmtlist )
{ {
int writerfd = ao->buffermem->fd[XF_WRITER]; int writerfd = ao->buffermem->fd[XF_WRITER];
size_t ratesize;
if(xfermem_putcmd(writerfd, BUF_CMD_AUDIOFMT) != 1) if(xfermem_putcmd(writerfd, BUF_CMD_AUDIOFMT) != 1)
{ {
@@ -281,7 +282,7 @@ int buffer_formats( out123_handle *ao, const long *rates, int ratecount
return -1; return -1;
} }
size_t ratesize = ratecount*sizeof(rates); ratesize = ratecount*sizeof(rates);
if( if(
!GOOD_WRITEVAL(writerfd, maxchannels) !GOOD_WRITEVAL(writerfd, maxchannels)
@@ -753,9 +754,7 @@ int buffer_loop(out123_handle *ao)
int minchannels; int minchannels;
int maxchannels; int maxchannels;
struct mpg123_fmt *fmtlist; struct mpg123_fmt *fmtlist;
int success;
int fmtcount = -1; int fmtcount = -1;
int recread = 0;
if( if(
!GOOD_READVAL_BUF(my_fd, maxchannels) !GOOD_READVAL_BUF(my_fd, maxchannels)

View File

@@ -27,6 +27,9 @@ void buffer_exit(out123_handle *ao);
int buffer_sync_param(out123_handle *ao); int buffer_sync_param(out123_handle *ao);
int buffer_open(out123_handle *ao, const char* driver, const char* device); int buffer_open(out123_handle *ao, const char* driver, const char* device);
int buffer_encodings(out123_handle *ao); int buffer_encodings(out123_handle *ao);
int buffer_formats( out123_handle *ao, const long *rates, int ratecount
, int minchannels, int maxchannels
, struct mpg123_fmt **fmtlist );
int buffer_start(out123_handle *ao); int buffer_start(out123_handle *ao);
void buffer_ndrain(out123_handle *ao, size_t bytes); void buffer_ndrain(out123_handle *ao, size_t bytes);

View File

@@ -430,7 +430,7 @@ void attribute_align_arg out123_close(out123_handle *ao)
int attribute_align_arg int attribute_align_arg
out123_start(out123_handle *ao, long rate, int channels, int encoding) out123_start(out123_handle *ao, long rate, int channels, int encoding)
{ {
debug4( "out123_start(%p, %li, %i, %li)" debug4( "out123_start(%p, %li, %i, %i)"
, (void*)ao, rate, channels, encoding ); , (void*)ao, rate, channels, encoding );
if(!ao) if(!ao)
return OUT123_ERR; return OUT123_ERR;
@@ -890,7 +890,7 @@ int out123_formats( out123_handle *ao, const long *rates, int ratecount
{ {
debug6( "out123_formats(%p, %p, %i, %i, %i, %p)" debug6( "out123_formats(%p, %p, %i, %i, %i, %p)"
, (void*)ao, (void*)rates, ratecount, minchannels, maxchannels , (void*)ao, (void*)rates, ratecount, minchannels, maxchannels
, (void)fmtlist ); , (void*)fmtlist );
if(!ao) if(!ao)
return OUT123_ERR; return OUT123_ERR;
ao->errcode = OUT123_OK; ao->errcode = OUT123_OK;

View File

@@ -165,7 +165,7 @@ static int testEndian(void)
/* return: 0 is good, -1 is bad */ /* return: 0 is good, -1 is bad */
static int open_file(struct wavdata *wdat, char *filename) static int open_file(struct wavdata *wdat, char *filename)
{ {
debug2("open_file(%p, %s)", wdat, filename ? filename : "<nil>"); debug2("open_file(%p, %s)", (void*)wdat, filename ? filename : "<nil>");
if(!wdat) if(!wdat)
return -1; return -1;
#if defined(HAVE_SETUID) && defined(HAVE_GETUID) #if defined(HAVE_SETUID) && defined(HAVE_GETUID)

View File

@@ -146,11 +146,6 @@ static void safe_exit(int code)
exit(code); exit(code);
} }
static void check_fatal(int code)
{
if(code) safe_exit(code);
}
static void check_fatal_output(int code) static void check_fatal_output(int code)
{ {
if(code) if(code)
@@ -636,7 +631,7 @@ static char* output_enclist(void)
int i; int i;
char *list = NULL; char *list = NULL;
char *pos; char *pos;
size_t len; size_t len = 0;
int enc_count = 0; int enc_count = 0;
int *enc_codes = NULL; int *enc_codes = NULL;

View File

@@ -211,11 +211,11 @@ static void seekmode(mpg123_handle *mh, out123_handle *ao)
{ {
if(param.usebuffer && !stopped) if(param.usebuffer && !stopped)
{ {
stopped = TRUE;
int channels; int channels;
int encoding; int encoding;
off_t back_samples; off_t back_samples;
stopped = TRUE;
out123_pause(ao); out123_pause(ao);
mpg123_getformat(mh, NULL, &channels, &encoding); mpg123_getformat(mh, NULL, &channels, &encoding);
back_samples = out123_buffered(ao)/(mpg123_samplesize(encoding)*channels); back_samples = out123_buffered(ao)/(mpg123_samplesize(encoding)*channels);