[vlc-devel] commit: notify: use asprintf ( Rémi Duraffort )

git version control git at videolan.org
Tue Feb 24 08:28:39 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Feb 24 08:24:36 2009 +0100| [2724ab87118a259287d564a7c51c92f9601ae58c] | committer: Rémi Duraffort 

notify: use asprintf

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2724ab87118a259287d564a7c51c92f9601ae58c
---

 modules/misc/notify/notify.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/misc/notify/notify.c b/modules/misc/notify/notify.c
index 7345744..dbe933a 100644
--- a/modules/misc/notify/notify.c
+++ b/modules/misc/notify/notify.c
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * notify.c : libnotify notification plugin
  *****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright (C) 2006-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Christophe Mutricy <xtophe -at- videolan -dot- org>
@@ -70,7 +70,7 @@ vlc_module_begin ()
     set_shortname( N_( "Notify" ) )
     set_description( N_("LibNotify Notification Plugin") )
 
-    add_integer( "notify-timeout", 4000,NULL,
+    add_integer( "notify-timeout", 4000, NULL,
                 TIMEOUT_TEXT, TIMEOUT_LONGTEXT, true )
 
     set_capability( "interface", 0 )
@@ -215,11 +215,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     }
     else /* else we show state-of-the art logo */
     {
-        const char *data_path = config_GetDataDir ();
-        char buf[strlen (data_path) + sizeof ("/vlc48x48.png")];
-
-        snprintf (buf, sizeof (buf), "%s/vlc48x48.png", data_path);
-        pix = gdk_pixbuf_new_from_file( buf, &p_error );
+        char *psz_pixbuf;
+        if( asprintf( &psz_pixbuf, "%s/vlc48x48.png", config_GetDataDir() ) >= 0 )
+        {
+            pix = gdk_pixbuf_new_from_file( psz_pixbuf, &p_error );
+            free( psz_pixbuf );
+        }
     }
 
     /* we need to replace '&' with '&' because '&' is a keyword of




More information about the vlc-devel mailing list