From 4772948087bec8b8b1a4e225560179274474d1f0 Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 27 Jun 2017 20:51:44 +0200 Subject: [PATCH] plug-ins: do some basic tweaking on file-rawtherapee. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a few compilation warnings, clean what needs to be, apply coding style fixes, add a Makefile… --- configure.ac | 1 + plug-ins/Makefile.am | 1 + plug-ins/file-rawtherapee/Makefile.am | 30 ++++++++++++++++++++ plug-ins/file-rawtherapee/file-formats.h | 3 -- plug-ins/file-rawtherapee/file-rawtherapee.c | 27 ++++++++---------- 5 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 plug-ins/file-rawtherapee/Makefile.am diff --git a/configure.ac b/configure.ac index 6c0028c612..e09add3790 100644 --- a/configure.ac +++ b/configure.ac @@ -2523,6 +2523,7 @@ plug-ins/file-fli/Makefile plug-ins/file-ico/Makefile plug-ins/file-jpeg/Makefile plug-ins/file-psd/Makefile +plug-ins/file-rawtherapee/Makefile plug-ins/file-sgi/Makefile plug-ins/file-tiff/Makefile plug-ins/file-webp/Makefile diff --git a/plug-ins/Makefile.am b/plug-ins/Makefile.am index d60046cb36..da45da244f 100644 --- a/plug-ins/Makefile.am +++ b/plug-ins/Makefile.am @@ -41,6 +41,7 @@ SUBDIRS = \ file-ico \ file-jpeg \ file-psd \ + file-rawtherapee \ file-sgi \ file-tiff \ $(file_webp) \ diff --git a/plug-ins/file-rawtherapee/Makefile.am b/plug-ins/file-rawtherapee/Makefile.am new file mode 100644 index 0000000000..3f4a09a322 --- /dev/null +++ b/plug-ins/file-rawtherapee/Makefile.am @@ -0,0 +1,30 @@ +## Process this file with automake to produce Makefile.in + +libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la +libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la + +filerawtherapeedatadir = $(gimpdatadir)/file-rawtherapee + +if OS_WIN32 +mwindows = -mwindows +endif + +AM_LDFLAGS = $(mwindows) + +libexecdir = $(gimpplugindir)/plug-ins + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(includedir) \ + $(GTK_CFLAGS) \ + $(GEGL_CFLAGS) + +libexec_PROGRAMS = file-rawtherapee + +file_rawtherapee_SOURCES = \ + file-rawtherapee.c \ + file-formats.h + +file_rawtherapee_LDADD = \ + $(libgimp) \ + $(libgimpbase) diff --git a/plug-ins/file-rawtherapee/file-formats.h b/plug-ins/file-rawtherapee/file-formats.h index b967c7cbe2..fc6697ec74 100644 --- a/plug-ins/file-rawtherapee/file-formats.h +++ b/plug-ins/file-rawtherapee/file-formats.h @@ -35,9 +35,6 @@ struct _FileFormat const gchar *load_help; }; -#define N_(s) s -#define _(s) s - static const FileFormat file_formats[] = { { diff --git a/plug-ins/file-rawtherapee/file-rawtherapee.c b/plug-ins/file-rawtherapee/file-rawtherapee.c index 92ce40f9fd..995dfe0f88 100644 --- a/plug-ins/file-rawtherapee/file-rawtherapee.c +++ b/plug-ins/file-rawtherapee/file-rawtherapee.c @@ -20,18 +20,17 @@ * along with this program. If not, see . */ -//#include "config.h" +#include "config.h" #include #include -#include #include #include #include -//#include "libgimp/stdplugins-intl.h" +#include "libgimp/stdplugins-intl.h" #include "file-formats.h" @@ -117,7 +116,7 @@ query (void) &rtversion) == 1) { have_rawtherapee = TRUE; - free(rtversion); + free (rtversion); } g_free (rawtherapee_stdout); @@ -182,7 +181,7 @@ run (const gchar *name, GError *error = NULL; gint i; -// INIT_I18N (); + INIT_I18N (); run_mode = param[0].data.d_int32; @@ -278,7 +277,7 @@ load_image (const gchar *filename, if (g_spawn_sync (NULL, argv, NULL, -// G_SPAWN_STDOUT_TO_DEV_NULL | + /*G_SPAWN_STDOUT_TO_DEV_NULL |*/ G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_SEARCH_PATH, NULL, @@ -293,8 +292,8 @@ load_image (const gchar *filename, gimp_image_set_filename (image_ID, filename); } -// if (rawtherapee_stdout) printf ("%s\n", rawtherapee_stdout); - g_free(rawtherapee_stdout); + /*if (rawtherapee_stdout) printf ("%s\n", rawtherapee_stdout);*/ + g_free (rawtherapee_stdout); g_unlink (filename_out); g_free (filename_out); @@ -312,9 +311,7 @@ load_thumbnail_image (const gchar *filename, gint32 image_ID = -1; gchar *filename_out = gimp_temp_name ("jpg"); gchar *thumb_pp3 = gimp_temp_name ("pp3"); - gchar *size = g_strdup_printf ("%d", thumb_size); - FILE *thumb_pp3_f = fopen(thumb_pp3, "w"); - gboolean pp3_ok = FALSE; + FILE *thumb_pp3_f = fopen (thumb_pp3, "w"); gchar *rawtherapee_stdout = NULL; const char *pp3_content = "[Version]\n" @@ -360,7 +357,7 @@ load_thumbnail_image (const gchar *filename, "\n" "[RAW X-Trans]\n" "Method=fast\n"; - + gchar *argv[] = { @@ -376,8 +373,8 @@ load_thumbnail_image (const gchar *filename, }; if (thumb_pp3_f) { - if (fprintf(thumb_pp3_f, pp3_content, thumb_size, thumb_size) < 0) { - fclose(thumb_pp3_f); + if (fprintf (thumb_pp3_f, pp3_content, thumb_size, thumb_size) < 0) { + fclose (thumb_pp3_f); thumb_pp3_f = NULL; } } @@ -413,7 +410,7 @@ load_thumbnail_image (const gchar *filename, gimp_progress_update (1.0); if (thumb_pp3_f) { - fclose(thumb_pp3_f); + fclose (thumb_pp3_f); } g_unlink (thumb_pp3); g_free (filename_out);