Skip to contentSkip to conversation

Fix build if OSS_GETVERSION is not defined

PATCH In review Juergen Lock 3 participants 7 messages Jan 7, 2010 – Jan 9, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix build if OSS_GETVERSION is not defined

In this case it was missing on FreeBSD <= 6.x (Which also doesn't have SNDCTL_DSP_POLICY yet so the version doesn't get used anyway.)

audio/ossaudio.c +3 -1
@@ -240,7 +240,7 @@ static int oss_open (int in, struct oss_
                      struct oss_params *obt, int *pfd)
 {
     int fd;
-    int version;
+    int version = 0;
     int oflags = conf.exclusive ? O_EXCL : 0;
     audio_buf_info abinfo;
     int fmt, freq, nchannels;
@@ -281,10 +281,12 @@ static int oss_open (int in, struct oss_
         goto err;
     }
 
+#ifdef OSS_GETVERSION
     if (ioctl (fd, OSS_GETVERSION, &version)) {
         oss_logerr2 (errno, typ, "Failed to get OSS version\n");
         version = 0;
     }
+#endif
 
     if (conf.debug) {
         dolog ("OSS version = %#x\n", version);
#1 lore raw
Quoted 2 lines · Juergen Lock

In this case it was missing on FreeBSD <= 6.x (Which also doesn't have SNDCTL_DSP_POLICY yet so the version doesn't get used anyway.)

I've commited slightly different fix for the issue, thanks.

Signature · 1 line
mailto:[email protected]
#2 lore raw
Quoted 7 lines · malc
Quoted 2 lines · Juergen Lock

In this case it was missing on FreeBSD <= 6.x (Which also doesn't have SNDCTL_DSP_POLICY yet so the version doesn't get used anyway.)

I've commited slightly different fix for the issue, thanks.

Hmm looking at the last hunk of the commit,

Quoted 4 lines

[...]

(quoted diff) +0 -0
@@ -289,9 +292,17 @@ static int oss_open (int in, struct oss_params *req,
    if (conf.debug) {
        dolog ("OSS version = %#x\n", version);

Review static int oss_open (int in, struct oss_params *req, · line 302

Quoted 10 lines
(quoted diff) +6 -1
    }
+#endif
 
 #ifdef SNDCTL_DSP_POLICY
-    if (conf.policy >= 0 && version >= 0x040000) {
+    if (conf.policy >= 0
+#ifdef OSS_GETVERSION
+        && version >= 0x040000
+#else
+        0

...these last two lines (#else and 0) probably should go, I dont think
the compiler likes whitespace between digits. :)

Quoted 8 lines
(quoted diff) +3 -0
+#endif
+        )
+    {
        int policy = conf.policy;
        if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
            oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
Signature · 1 line
1.6.6

And also I forgot to say this is stable-0.12 material too.

And thanx for committing!
Juergen

#3 lore raw
Quoted 17 lines · Juergen Lock
Quoted 7 lines · malc
Quoted 2 lines · Juergen Lock

In this case it was missing on FreeBSD <= 6.x (Which also doesn't have SNDCTL_DSP_POLICY yet so the version doesn't get used anyway.)

I've commited slightly different fix for the issue, thanks.

Hmm looking at the last hunk of the commit,

Quoted 7 lines

[...]

audio/ossaudio.c +1 -0
@@ -289,9 +292,17 @@ static int oss_open (int in, struct oss_params *req,
    if (conf.debug) {
        dolog ("OSS version = %#x\n", version);
    }
+#endif
 
Quoted 10 lines

Review static int oss_open (int in, struct oss_params *req, · line 302

Quoted 7 lines
(quoted diff) +5 -1
 #ifdef SNDCTL_DSP_POLICY
-    if (conf.policy >= 0 && version >= 0x040000) {
+    if (conf.policy >= 0
+#ifdef OSS_GETVERSION
+        && version >= 0x040000
+#else
+        0

...these last two lines (#else and 0) probably should go, I dont think
the compiler likes whitespace between digits. :)

Uh, yeah, my bad, sorry, hopefuly fixed now..

Quoted 11 lines
Quoted 9 lines
(quoted diff) +3 -0
+#endif
+        )
+    {
        int policy = conf.policy;
        if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
            oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
Signature · 1 line
1.6.6

And also I forgot to say this is stable-0.12 material too.

You really should talk to the people who know what that means :)

Quoted 3 lines

And thanx for committing!
Juergen

Signature · 1 line
mailto:[email protected]
#4 lore raw
Quoted 30 lines · malc
Quoted 17 lines · Juergen Lock
Quoted 7 lines · malc
Quoted 2 lines · Juergen Lock

In this case it was missing on FreeBSD <= 6.x (Which also doesn't have SNDCTL_DSP_POLICY yet so the version doesn't get used anyway.)

I've commited slightly different fix for the issue, thanks.

Hmm looking at the last hunk of the commit,

Quoted 7 lines

[...]

audio/ossaudio.c +1 -0
@@ -289,9 +292,17 @@ static int oss_open (int in, struct oss_params *req,
    if (conf.debug) {
        dolog ("OSS version = %#x\n", version);
    }
+#endif
 
Quoted 10 lines

Review static int oss_open (int in, struct oss_params *req, · line 302

Quoted 7 lines
(quoted diff) +5 -1
 #ifdef SNDCTL_DSP_POLICY
-    if (conf.policy >= 0 && version >= 0x040000) {
+    if (conf.policy >= 0
+#ifdef OSS_GETVERSION
+        && version >= 0x040000
+#else
+        0

...these last two lines (#else and 0) probably should go, I dont think
the compiler likes whitespace between digits. :)

Quoted 2 lines

Uh, yeah, my bad, sorry, hopefuly fixed now..

Yeah looking better now... Thanx!

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
(quoted diff) +3 -0
+#endif
+        )
+    {
        int policy = conf.policy;
        if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
            oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
Signature · 1 line
1.6.6
Quoted 3 lines
Quoted 1 line

And also I forgot to say this is stable-0.12 material too.

You really should talk to the people who know what that means :)

Oh sorry I should have guessed not all committers do merges to stable
branches... Anthony? :)

Greets,
Juergen

#5 lore raw

Am 09.01.2010 um 14:45 schrieb Juergen Lock:

Quoted 9 lines · malc
Quoted 5 lines · Juergen Lock
Quoted 2 lines

And also I forgot to say this is stable-0.12 material too.

You really should talk to the people who know what that means :)

Oh sorry I should have guessed not all committers do merges to stable branches... Anthony? :)

In this case you should probably resubmit one accumulated top-level patch marked [PATCH][For stable-0.12] or similar (instead of having two commits cherry-picked).

Andreas

#6 lore raw
Quoted 8 lines · Andreas Färber

Am 09.01.2010 um 14:45 schrieb Juergen Lock:

Quoted 5 lines · malc
Quoted 4 lines · Juergen Lock
Quoted 2 lines

And also I forgot to say this is stable-0.12 material too.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

You really should talk to the people who know what that means :)

Oh sorry I should have guessed not all committers do merges to stable branches... Anthony? :)

In this case you should probably resubmit one accumulated top-level patch marked [PATCH][For stable-0.12] or similar (instead of having two commits cherry-picked).

Ok I can do that, but first I have another patch to the same code, turns out the ioctl doesn't actually work yet on FreeBSD even if it is defined...

Cheers,
Juergen