gnome-games r7171 - trunk/libgames-support



Author: chpe
Date: Sun Jan 13 22:07:34 2008
New Revision: 7171
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7171&view=rev

Log:
Make param const, and use g_build_filename.


Modified:
   trunk/libgames-support/games-sound.c

Modified: trunk/libgames-support/games-sound.c
==============================================================================
--- trunk/libgames-support/games-sound.c	(original)
+++ trunk/libgames-support/games-sound.c	Sun Jan 13 22:07:34 2008
@@ -107,20 +107,22 @@
 
 #ifdef HAVE_SDL_MIXER
 static void
-games_sound_sdl_play (gchar *filename)
+games_sound_sdl_play (const gchar *filename)
 {
   Mix_Chunk *wave = NULL;
-  gchar *fullpath = NULL;
-  
-  fullpath = g_strdup_printf ("%s/%s.ogg", SOUNDDIR, (char *) filename);
+  gchar *name, *path;
 
-  wave = Mix_LoadWAV(fullpath);
+  name = g_strdup_printf ("%s.ogg", filename);
+  path = g_build_filename (SOUNDDIR, name, NULL);
+  g_free (name);
+
+  wave = Mix_LoadWAV (path);
   if (wave == NULL) {
-    g_print (_("Error playing sound: %s\n"), Mix_GetError());
+    g_print (_("Error playing sound %s: %s\n"), path, Mix_GetError ());
   }
 
-  Mix_PlayChannel(-1, wave, 0); 
-  g_free(fullpath);
+  Mix_PlayChannel (-1, wave, 0);
+  g_free (path);
 }
 #endif /* HAVE_SDL_MIXER */
 



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