gegl r2147 - in trunk: . bin operations/external



Author: muks
Date: Wed Mar 19 00:12:41 2008
New Revision: 2147
URL: http://svn.gnome.org/viewvc/gegl?rev=2147&view=rev

Log:
2008-03-18  Mukund Sivaraman <muks mukund org>

        * operations/external/png-save.c:
        * bin/export.c: Close FILEs before returning



Modified:
   trunk/ChangeLog
   trunk/bin/export.c
   trunk/operations/external/png-save.c

Modified: trunk/bin/export.c
==============================================================================
--- trunk/bin/export.c	(original)
+++ trunk/bin/export.c	Wed Mar 19 00:12:41 2008
@@ -299,6 +299,7 @@
     {
       fp = fopen (path, "wb");
     }
+
   if (!fp)
     {
       return -1;
@@ -327,12 +328,23 @@
 
   png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
   if (png == NULL)
-    return -1;
+    {
+      if (stdout != fp)
+        fclose (fp);
+
+      return -1;
+    }
 
   info = png_create_info_struct (png);
 
   if (setjmp (png_jmpbuf (png)))
-    return -1;
+    {
+      if (stdout != fp)
+        fclose (fp);
+
+      return -1;
+    }
+
   png_set_compression_level (png, 1);
   png_init_io (png, fp);
 
@@ -365,7 +377,7 @@
   png_destroy_write_struct (&png, &info);
   g_free (pixels);
 
-  if (fp!=stdout)
+  if (stdout != fp)
     fclose (fp);
 
   return 0;

Modified: trunk/operations/external/png-save.c
==============================================================================
--- trunk/operations/external/png-save.c	(original)
+++ trunk/operations/external/png-save.c	Wed Mar 19 00:12:41 2008
@@ -90,12 +90,23 @@
 
   png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
   if (png == NULL)
-    return -1;
+    {
+      if (stdout != fp)
+        fclose (fp);
+
+      return -1;
+    }
 
   info = png_create_info_struct (png);
 
   if (setjmp (png_jmpbuf (png)))
-    return -1;
+    {
+      if (stdout != fp)
+        fclose (fp);
+
+      return -1;
+    }
+
   png_set_compression_level (png, compression);
   png_init_io (png, fp);
 
@@ -130,7 +141,7 @@
   png_destroy_write_struct (&png, &info);
   g_free (pixels);
 
-  if (fp!=stdout)
+  if (stdout != fp)
     fclose (fp);
 
   return 0;



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