plug-ins: do some basic tweaking on file-rawtherapee.

Fix a few compilation warnings, clean what needs to be, apply coding
style fixes, add a Makefile…
This commit is contained in:
Jehan 2017-06-27 20:51:44 +02:00
parent 90659deb82
commit 4772948087
5 changed files with 44 additions and 18 deletions

View File

@ -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

View File

@ -41,6 +41,7 @@ SUBDIRS = \
file-ico \
file-jpeg \
file-psd \
file-rawtherapee \
file-sgi \
file-tiff \
$(file_webp) \

View File

@ -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)

View File

@ -35,9 +35,6 @@ struct _FileFormat
const gchar *load_help;
};
#define N_(s) s
#define _(s) s
static const FileFormat file_formats[] =
{
{

View File

@ -20,18 +20,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//#include "config.h"
#include "config.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <glib/gstdio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
//#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);