1 | Don't pass negative values around. Especially if functions return them |
---|
2 | |
---|
3 | From: Erik Hovland <erik@hovland.org> |
---|
4 | |
---|
5 | as status |
---|
6 | --- |
---|
7 | |
---|
8 | mythtv/libs/libmythtv/audioinputoss.cpp | 16 ++++++++-------- |
---|
9 | 1 files changed, 8 insertions(+), 8 deletions(-) |
---|
10 | |
---|
11 | |
---|
12 | diff --git a/mythtv/libs/libmythtv/audioinputoss.cpp b/mythtv/libs/libmythtv/audioinputoss.cpp |
---|
13 | index 0f582ac..26865f4 100644 |
---|
14 | --- a/mythtv/libs/libmythtv/audioinputoss.cpp |
---|
15 | +++ b/mythtv/libs/libmythtv/audioinputoss.cpp |
---|
16 | @@ -59,7 +59,7 @@ bool AudioInputOSS::Open(uint sample_bits, uint sample_rate, uint channels) |
---|
17 | dsp_fd = open(m_device_name.constData(), O_RDONLY); |
---|
18 | if (dsp_fd < 0) |
---|
19 | { |
---|
20 | - VERBOSE(VB_IMPORTANT, LOC_ERR + QString("open failed - %1").arg(strerror(dsp_fd))); |
---|
21 | + VERBOSE(VB_IMPORTANT, LOC_ERR + QString("open failed - %1").arg(strerror(errno))); |
---|
22 | Close(); |
---|
23 | return false; |
---|
24 | } |
---|
25 | @@ -122,7 +122,7 @@ bool AudioInputOSS::Open(uint sample_bits, uint sample_rate, uint channels) |
---|
26 | if ((chk = ioctl(dsp_fd, SNDCTL_DSP_CHANNELS, &m_audio_channels)) < 0) |
---|
27 | { |
---|
28 | VERBOSE(VB_IMPORTANT, LOC_ERR + QString("failed to set audio channels to %1 - %2") |
---|
29 | - .arg(channels).arg(strerror(chk))); |
---|
30 | + .arg(channels).arg(strerror(errno))); |
---|
31 | Close(); |
---|
32 | return false; |
---|
33 | } |
---|
34 | @@ -137,7 +137,7 @@ bool AudioInputOSS::Open(uint sample_bits, uint sample_rate, uint channels) |
---|
35 | { |
---|
36 | VERBOSE(VB_IMPORTANT, LOC_ERR + |
---|
37 | QString("failed to set sample rate to %1 - %2") |
---|
38 | - .arg(sample_rate).arg(strerror(chk))); |
---|
39 | + .arg(sample_rate).arg(strerror(errno))); |
---|
40 | Close(); |
---|
41 | return false; |
---|
42 | } |
---|
43 | @@ -171,7 +171,7 @@ bool AudioInputOSS::Start(void) |
---|
44 | trig = PCM_ENABLE_INPUT; // enable input |
---|
45 | if ((chk = ioctl(dsp_fd, SNDCTL_DSP_SETTRIGGER, &trig)) < 0) |
---|
46 | { |
---|
47 | - VERBOSE(VB_IMPORTANT, LOC_ERR + QString("Start() failed - %1").arg(strerror(chk))); |
---|
48 | + VERBOSE(VB_IMPORTANT, LOC_ERR + QString("Start() failed - %1").arg(strerror(errno))); |
---|
49 | } |
---|
50 | else |
---|
51 | { |
---|
52 | @@ -189,7 +189,7 @@ bool AudioInputOSS::Stop(void) |
---|
53 | int trig = 0; |
---|
54 | if ((chk = ioctl(dsp_fd, SNDCTL_DSP_SETTRIGGER, &trig)) < 0) |
---|
55 | { |
---|
56 | - VERBOSE(VB_IMPORTANT, LOC_ERR + QString("stop action failed - %1").arg(strerror(chk))); |
---|
57 | + VERBOSE(VB_IMPORTANT, LOC_ERR + QString("stop action failed - %1").arg(strerror(errno))); |
---|
58 | } |
---|
59 | else |
---|
60 | { |
---|
61 | @@ -209,7 +209,7 @@ int AudioInputOSS::GetBlockSize(void) |
---|
62 | { |
---|
63 | VERBOSE(VB_IMPORTANT, LOC_ERR + |
---|
64 | QString("fragment size query failed, returned %1 - %2") |
---|
65 | - .arg(frag).arg(strerror(chk))); |
---|
66 | + .arg(frag).arg(strerror(errno))); |
---|
67 | frag = 0; |
---|
68 | } |
---|
69 | } |
---|
70 | @@ -231,7 +231,7 @@ int AudioInputOSS::GetSamples(void *buffer, uint num_bytes) |
---|
71 | if (this_read < 0) |
---|
72 | { |
---|
73 | VERBOSE(VB_IMPORTANT, LOC_ERR + QString("GetSamples read failed - %1") |
---|
74 | - .arg(strerror(this_read))); |
---|
75 | + .arg(strerror(errno))); |
---|
76 | } |
---|
77 | else |
---|
78 | { |
---|
79 | @@ -259,7 +259,7 @@ int AudioInputOSS::GetNumReadyBytes(void) |
---|
80 | { |
---|
81 | VERBOSE(VB_IMPORTANT, LOC_ERR + |
---|
82 | QString("get ready bytes failed, returned %1 - %2") |
---|
83 | - .arg(ispace.bytes).arg(strerror(chk))); |
---|
84 | + .arg(ispace.bytes).arg(strerror(errno))); |
---|
85 | } |
---|
86 | else if ((readies = ispace.bytes) > 0) |
---|
87 | VERBOSE(VB_AUDIO|VB_EXTRA, LOC_DEV + QString("ready bytes %1") |
---|