bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnubg] Build failure because of the potential use of ca_content wit


From: Daisuke Takahashi
Subject: [Bug-gnubg] Build failure because of the potential use of ca_content without inclusion of canberra.h at sound.c
Date: Tue, 24 Jun 2014 14:00:46 +0900

Dear all,

At sound.c, canberra.h and canberra-gtk.h are included only when no other 
options are available (sound.c:341-344), but ca_context is used always when 
canberra is available (sound.c:397). As a consequence, the compilation of the 
sound.c fails under an Mac OS X machine with canberra installed (e.g., by 
macports or other utilities).

Below patch moves the declaration of canberracontext into the latter ifdef 
block.
Thank you very much.

Regards,
Daisuke Takahashi

--- sound_org.c 2013-07-23 03:51:01.000000000 +0900
+++ sound.c     2014-06-23 17:53:34.000000000 +0900
@@ -393,9 +393,7 @@
 playSoundFile(char *file, gboolean UNUSED(sync))
 {
     GError *error = NULL;
-#if HAVE_CANBERRA
-    static ca_context *canberracontext = NULL;
-#endif
+
     if (!g_file_test(file, G_FILE_TEST_EXISTS)) {
         outputf(_("The sound file (%s) doesn't exist.\n"), file);
         return;
@@ -436,16 +434,19 @@
 #elif HAVE_APPLE_COREAUDIO
     CoreAudio_PlayFile(file);
 #elif HAVE_CANBERRA
-    if (!canberracontext) {
+    {
+        static ca_context *canberracontext = NULL;
+        if (!canberracontext) {
 #if USE_GTK
-        if (fX)
-            canberracontext = ca_gtk_context_get();
-        else
+            if (fX)
+                canberracontext = ca_gtk_context_get();
+            else
 #endif
-            ca_context_create(&canberracontext);
-       ca_context_change_props(canberracontext, CA_PROP_CANBERRA_ENABLE, "1", 
NULL);
+                ca_context_create(&canberracontext);
+            ca_context_change_props(canberracontext, CA_PROP_CANBERRA_ENABLE, 
"1", NULL);
+        }
+        ca_context_play(canberracontext, 0, CA_PROP_MEDIA_FILENAME, file, 
NULL);
     }
-    ca_context_play(canberracontext, 0, CA_PROP_MEDIA_FILENAME, file, NULL);
 #endif
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]