gegl r1933 - in trunk: . operations/io



Author: neo
Date: Tue Jan 29 07:38:28 2008
New Revision: 1933
URL: http://svn.gnome.org/viewvc/gegl?rev=1933&view=rev

Log:
	* operations/io/raw-load.c (load_buffer): fixed string handling.



Modified:
   trunk/ChangeLog
   trunk/operations/io/load.c
   trunk/operations/io/raw-load.c

Modified: trunk/operations/io/load.c
==============================================================================
--- trunk/operations/io/load.c	(original)
+++ trunk/operations/io/load.c	Tue Jan 29 07:38:28 2008
@@ -96,7 +96,7 @@
 
           if (!g_file_test (self->path, G_FILE_TEST_EXISTS))
             {
-              gchar *name = g_filename_display_name (filename);
+              gchar *name = g_filename_display_name (self->path);
               gchar *tmp  = g_strdup_printf ("File '%s' does not exist", name);
               g_free (name);
               g_warning ("load: %s", tmp);

Modified: trunk/operations/io/raw-load.c
==============================================================================
--- trunk/operations/io/raw-load.c	(original)
+++ trunk/operations/io/raw-load.c	Tue Jan 29 07:38:28 2008
@@ -94,18 +94,14 @@
 {
   if (!op_raw_load->priv)
     {
-      FILE *pfp;
+      FILE  *pfp;
       gchar *command;
+      gint   width, height, val_max;
+      gchar  newline;
 
-      gint width, height, val_max;
-      char newline;
-
-      command = g_malloc (strlen (op_raw_load->path) + 128);
-      if (!command)
-        return;
-      sprintf (command, "dcraw -4 -c '%s'\n", op_raw_load->path);
+      command = g_strdup_printf ("dcraw -4 -c '%s'\n", op_raw_load->path);
       pfp = popen (command, PIPE_MODE);
-      free (command);
+      g_free (command);
 
       if (fscanf (pfp, "P6 %d %d %d %c",
          &width, &height, &val_max, &newline) != 4)
@@ -116,8 +112,8 @@
         }
 
         {
-          GeglRectangle extent = {0,0,width, height};
-          op_raw_load->priv = (gpointer)gegl_buffer_new (&extent,
+          GeglRectangle extent = { 0, 0, width, height };
+          op_raw_load->priv = (gpointer) gegl_buffer_new (&extent,
                                                babl_format_new (
                                                  babl_model ("RGB"),
                                                  babl_type ("u16"),
@@ -127,8 +123,8 @@
                                                  NULL));
         }
          {
-           
-           guchar *buf=g_malloc (width * height * 3 * 2);
+
+           guint16 *buf = g_new (guint16, width * height * 3);
            fread (buf, 1, width * height * 3 * 2, pfp);
            gegl_buffer_set (GEGL_BUFFER (op_raw_load->priv),
                             NULL,



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