summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-06 20:58:54 +0200
committerwm4 <wm4@nowhere>2013-05-06 23:11:11 +0200
commit885c6a2610619ad3ee2b01ae7ec7670f8551d388 (patch)
tree7a9d2d4f9516c417e15e16613bb71a87f1feca3f /stream
parentab776adeceb4b9b6ce7adde5a857ffc1e4b2c4ae (diff)
downloadmpv-885c6a2610619ad3ee2b01ae7ec7670f8551d388.tar.bz2
mpv-885c6a2610619ad3ee2b01ae7ec7670f8551d388.tar.xz
Fix some cppcheck / scan-build warnings
These were found by the cppcheck and scan-build static analyzers. Most of these aren't interesting (the 2 previous commits fix some interesting cases found by these analyzers), and they don't nearly fix all warnings. (Most of the unfixed warnings are spam, things MPlayer never cared about, or false positives.)
Diffstat (limited to 'stream')
-rw-r--r--stream/cookies.c2
-rw-r--r--stream/dvb_tune.c4
-rw-r--r--stream/http.c2
-rw-r--r--stream/stream_cdda.c2
-rw-r--r--stream/tvi_v4l2.c27
5 files changed, 5 insertions, 32 deletions
diff --git a/stream/cookies.c b/stream/cookies.c
index 5d772b8a6a..a7f01ef420 100644
--- a/stream/cookies.c
+++ b/stream/cookies.c
@@ -112,7 +112,7 @@ static int parse_line(char **ptr, char *cols[6])
/* Loads a file into RAM */
static char *load_file(const char *filename, int64_t * length)
{
- int fd = -1;
+ int fd;
char *buffer = NULL;
mp_msg(MSGT_NETWORK, MSGL_V, "Loading cookie file: %s\n", filename);
diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c
index d5ea8c7b1a..8b24e88ede 100644
--- a/stream/dvb_tune.c
+++ b/stream/dvb_tune.c
@@ -325,7 +325,7 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int
fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth,
fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout)
{
- int res, hi_lo = 0, dfd;
+ int hi_lo = 0, dfd;
struct dvb_frontend_parameters feparams;
struct dvb_frontend_info fe_info;
@@ -334,7 +334,7 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int
memset(&feparams, 0, sizeof(feparams));
- if ( (res = ioctl(fd_frontend,FE_GET_INFO, &fe_info) < 0))
+ if ( ioctl(fd_frontend,FE_GET_INFO, &fe_info) < 0)
{
mp_msg(MSGT_DEMUX, MSGL_FATAL, "FE_GET_INFO FAILED\n");
return -1;
diff --git a/stream/http.c b/stream/http.c
index eb0ea701b6..2ec7c9d58c 100644
--- a/stream/http.c
+++ b/stream/http.c
@@ -187,9 +187,9 @@ static int scast_streaming_start(stream_t *stream) {
int metaint;
scast_data_t *scast_data;
HTTP_header_t *http_hdr = stream->streaming_ctrl->data;
- int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
if (!stream || stream->fd < 0 || !http_hdr)
return -1;
+ int is_ultravox = strcasecmp(stream->streaming_ctrl->url->protocol, "unsv") == 0;
if (is_ultravox)
metaint = 0;
else {
diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c
index 6fbd18fcc2..a99150f65d 100644
--- a/stream/stream_cdda.c
+++ b/stream/stream_cdda.c
@@ -312,7 +312,7 @@ static int control(stream_t *stream, int cmd, void *arg)
// returning error.
return STREAM_OK;
}
- seek_sector = track <= 0 ? p->start_sector
+ seek_sector = track == 0 ? p->start_sector
: p->cd->disc_toc[track].dwStartSector;
r = seek(stream, seek_sector * CDIO_CD_FRAMESIZE_RAW);
if (r)
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index abe455d8bf..06344d1fa9 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -1747,29 +1747,6 @@ static int get_video_framesize(priv_t *priv)
return priv->format.fmt.pix.sizeimage;
}
-//#define DOUBLESPEED
-#ifdef DOUBLESPEED
-// for testing purposes only
-static void read_doublespeed(priv_t *priv)
-{
- char *bufx = calloc(priv->audio_in.blocksize, 2);
- short *s;
- short *d;
- int i;
-
- audio_in_read_chunk(&priv->audio_in, bufx);
- audio_in_read_chunk(&priv->audio_in, bufx+priv->audio_in.blocksize);
-
- s = bufx;
- d = priv->audio_ringbuffer+priv->audio_tail*priv->audio_in.blocksize;
- for (i = 0; i < priv->audio_in.blocksize/2; i++) {
- *d++ = *s++;
- *s++;
- }
-
-}
-#endif
-
static void *audio_grabber(void *data)
{
priv_t *priv = (priv_t*)data;
@@ -1788,12 +1765,8 @@ static void *audio_grabber(void *data)
for (; !priv->shutdown;)
{
-#ifdef DOUBLESPEED
- read_doublespeed(priv);
-#else
if (audio_in_read_chunk(&priv->audio_in, priv->audio_ringbuffer+priv->audio_tail*priv->audio_in.blocksize) < 0)
continue;
-#endif
pthread_mutex_lock(&priv->skew_mutex);
if (priv->first_frame == 0) {
// there is no first frame yet (unlikely to happen)