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

Re: [PATCH] Porting filmgimp-0.1-1.0.4 to GNU/Hurd



--- PUYDT Julien <julien.puydt@club-internet.fr> wrote:
> Hi,
> 
> since I already wrote a (very) little patch to enable gimp to
> compile/run on the Hurd, I thought it could be easy to port filmgimp
> too. It was, and you'll find the patch included below.
> 
> Cordially,
> 
> JP (Snark on #hurd, #hurdfr on irc.openprojects.net)
> 
> 
> PS: here is the patch:
> diff -ur filmgimp-0.1-1.0.4-orig/libgimp/gimp.c
> filmgimp-0.1-1.0.4-hurd/libgimp/
> gimp.c
> --- filmgimp-0.1-1.0.4-orig/libgimp/gimp.c      Wed Sep  6 08:22:34 2000
> +++ filmgimp-0.1-1.0.4-hurd/libgimp/gimp.c      Wed Aug 14 09:27:37 2002
> @@ -802,13 +802,18 @@
>  gchar*
>  gimp_gtkrc ()
>  {
> -  static char filename[MAXPATHLEN];
> +  char *filename;
> +  int filename_len;
>    char *home_dir;
>  
>    home_dir = getenv ("HOME");
>    if (!home_dir)
>      return NULL;
>  
> +  filename_len = strlen(home_dir) + strlen(GIMPDIR) + 8;
> +  filename = malloc(filename_len);
> +  if (!filename)
> +    return NULL;
>    sprintf (filename, "%s/%s/gtkrc", home_dir, GIMPDIR);
>  
>    return filename;
> 
> 

 Good work.  I don't know how portable filegimp needs to be but you may
want to look at asprintf.  I know it is available on the BSDs and any GNU
system.  If you used asprinf, the patch would look like

-  static char filename[MAXPATHLEN];
+  char *filename;
...
-    sprintf (filename, "%s/%s/gtkrc", home_dir, GIMPDIR);
+    if (asprintf (&filename, "%s/%s/gtkrc", home_dir, GIMPDIR) < 0)
+        return NULL;


=====
James Morrison
   University of Waterloo
   Computer Science - Digital Hardware
   2A co-op
http://hurd.dyndns.org

Anyone referring to this as 'Open Source' shall be eaten by a GNU

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com



Reply to: